1 #include "AliInvmass.h"
3 ClassImp(AliInvmass) // Class implementation to enable ROOT I/O
5 AliInvmass::AliInvmass()
7 // Creation of an AliInvmass object and initialisation of parameters
16 ////////////////////////////////////////////////////////////////////////////////
17 AliInvmass::~AliInvmass()
19 // Destructor to delete dynamically allocated memory
34 ////////////////////////////////////////////////////////////////////////////////
35 void AliInvmass::SetStorageMode(Int_t m)
37 // Set storage mode for the result arrays for inv. mass and comb. background
41 ////////////////////////////////////////////////////////////////////////////////
42 void AliInvmass::SetThetaSwitch(Int_t i)
44 // Enable/Disable (1/0) switching of theta angle in comb. bkg. reconstruction.
45 // Default : Switching of theta is enabled.
47 if (i==0) fNewtheta=0;
49 ////////////////////////////////////////////////////////////////////////////////
50 void AliInvmass::SetPhiSwitch(Int_t i)
52 // Enable/Disable (1/0) switching of phi angle in comb. bkg. reconstruction.
53 // Default : Switching of phi is enabled.
57 ////////////////////////////////////////////////////////////////////////////////
58 Int_t AliInvmass::GetStorageMode()
60 // Provide mode of storage for the result arrays for inv. mass and comb. background
63 ////////////////////////////////////////////////////////////////////////////////
64 Int_t AliInvmass::GetThetaSwitch()
66 // Provide the theta switching flag
69 ////////////////////////////////////////////////////////////////////////////////
70 Int_t AliInvmass::GetPhiSwitch()
72 // Provide the phi switching flag
75 ////////////////////////////////////////////////////////////////////////////////
76 TObjArray* AliInvmass::Invmass(TObjArray* a1,TObjArray* a2)
78 // Perform two-particle invariant mass reconstruction
83 ////////////////////////////////////////////////////////////////////////////////
84 TObjArray* AliInvmass::CombBkg(TObjArray* a1,TObjArray* a2)
86 // Perform two-particle combinatorial background reconstruction
98 ////////////////////////////////////////////////////////////////////////////////
99 void AliInvmass::Combine(TObjArray* a1,TObjArray* a2)
101 // Perform two-particle invariant mass reconstruction
103 if ((!fBkg || fMode==1) && fMinv)
110 if (fBkg && (fMode !=1) && fMbkg)
117 Int_t isame; // Indicates whether both lists are identical
121 // Index i must loop over the shortest of a1 and a2
124 Int_t ni=a1->GetEntries();
125 Int_t nj=a2->GetEntries();
139 Double_t v2[4],vx[4];
142 Int_t jmin; // Start index for list j
143 Int_t jx; // Index for randomly picked particle for comb. bkg. reconstruction
145 for (Int_t i=0; i<ni; i++) // Select first a particle from list i
147 p1=(AliTrack*)listi->At(i);
154 for (Int_t j=jmin; j<nj; j++) // Select also a particle from list j
156 p2=(AliTrack*)listj->At(j);
157 if (p1==p2) p2=0; // Don't combine particle with itself
161 p2->GetVector(v2,"sph");
163 // Take theta and phi from randomly chosen other list j particle for bkg. reconstr.
167 if ((!isame && nj>1) || (isame && nj>2))
169 jx=int(fRndm.Uniform(0,float(nj)));
170 px=(AliTrack*)listj->At(jx);
172 while (!px || px==p2 || px==p1)
176 px=(AliTrack*)listj->At(jx);
179 px->GetVector(vx,"sph");
180 if (fNewtheta) v2[2]=vx[2]; // Replace the theta angle in the v2 vector
181 if (fNewphi) v2[3]=vx[3]; // Replace the phi angle in the v2 vector
185 if ((!fBkg && p2) || (fBkg && px))
187 // Store the data of this two-particle combination
188 ptot.SetVector(v2,"sph");
189 ptot=(Ali4Vector)(ptot+(*p1));
193 t->Set4Momentum(ptot);
195 if (!fBkg || fMode==1)
197 if (!fMinv) fMinv=new TObjArray();
202 if (!fMbkg) fMbkg=new TObjArray();
207 } // End of second particle loop
209 } // End of first particle loop
211 ////////////////////////////////////////////////////////////////////////////////