Subversion Repositories f9daq

Rev

Rev 266 | Rev 271 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 266 Rev 267
Line 65... Line 65...
65
        }
65
        }
66
  }      
66
  }      
67
  return nprt;  
67
  return nprt;  
68
}
68
}
69
 
69
 
70
int CombineParticles(TClonesArray *plist1 ,TClonesArray *plist2 , float masslow, float massup, SIMPLEPID pid, TClonesArray *pout){
70
int CombineParticles(TClonesArray *plist1 ,TClonesArray *plist2 , int same, float masslow, float massup, SIMPLEPID pid, TClonesArray *pout){
71
 // Loop over all the particles in both lists.
71
 // Loop over all the particles in both lists.
72
 pout->Clear();
72
 pout->Clear();
73
 int nprt=0;
73
 int nprt=0;
74
 
74
 
75
 for(TIter next1(plist1);BParticle * p1 =(BParticle *) next1();) {
75
 for(TIter next1(plist1);BParticle * p1 =(BParticle *) next1();) {
76
    // the second loop 
76
    // the second loop 
77
   for(TIter next2(plist2); BParticle * p2 =(BParticle *) next2();) {  
77
   for( TIter next2 = (plist1!=plist2 && same==0) ?  TIter(plist2): TIter(next1) ; BParticle * p2 =(BParticle *) next2();) {  
78
      BParticle  p = *p1 + *p2; // Combine two particles into a new particle   
78
      BParticle  p = *p1 + *p2; // Combine two particles into a new particle   
79
      if (p.InMassRange(masslow, massup)){
79
      if (p.InMassRange(masslow, massup)){
80
            p.SetPid(pid);
80
            p.SetPid(pid);
81
                TClonesArray& list = *pout;
81
                TClonesArray& list = *pout;
82
            new (list[nprt++]) BParticle ( p ); // create a new entry in kslist list of particles
82
            new (list[nprt++]) BParticle ( p ); // create a new entry in kslist list of particles