1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 ////////////////////////////////////////////////////////////////////////
19 // Class for the Selection of Non-Heavy-Flavour-Electrons trought //
20 // the invariant mass method. The selection can be done from two //
21 // diferent algorithms, which can be choosed calling the function //
22 // "SetAlgorithm(TString Algorithm)". //
24 // Author: Elienos Pereira de Oliveira Filho //
25 // (University of São Paulo) //
27 ////////////////////////////////////////////////////////////////////////
31 #include "TLorentzVector.h"
32 #include "AliAODTrack.h"
33 #include "AliESDtrack.h"
34 #include "AliVEvent.h"
35 #include "AliESDtrackCuts.h"
36 #include "AliVTrack.h"
37 #include "AliVParticle.h"
38 #include "AliPIDResponse.h"
40 #include "AliExternalTrackParam.h"
41 #include "AliSelectNonHFE.h"
42 #include "AliKFParticle.h"
48 ClassImp(AliSelectNonHFE)
49 //________________________________________________________________________
50 AliSelectNonHFE::AliSelectNonHFE(const char *name, const Char_t *title)
82 fTrackCuts = new AliESDtrackCuts();
83 //Configure Default Track Cuts
84 fTrackCuts->SetAcceptKinkDaughters(kFALSE);
85 fTrackCuts->SetRequireTPCRefit(kTRUE);
86 fTrackCuts->SetEtaRange(-0.9,0.9);
87 fTrackCuts->SetRequireSigmaToVertex(kTRUE);
88 fTrackCuts->SetMaxChi2PerClusterTPC(4.0);
89 fTrackCuts->SetMinNClustersTPC(50);
90 fTrackCuts->SetPtRange(0.3,1e10);
95 //________________________________________________________________________
96 AliSelectNonHFE::AliSelectNonHFE()
105 ,fChi2OverNDFCut(999)
128 fTrackCuts = new AliESDtrackCuts();
129 //Configure Default Track Cuts
130 fTrackCuts->SetAcceptKinkDaughters(kFALSE);
131 fTrackCuts->SetRequireTPCRefit(kTRUE);
132 fTrackCuts->SetEtaRange(-0.9,0.9);
133 fTrackCuts->SetRequireSigmaToVertex(kTRUE);
134 fTrackCuts->SetMaxChi2PerClusterTPC(4.0);
135 fTrackCuts->SetMinNClustersTPC(50);
136 fTrackCuts->SetPtRange(0.3,1e10);
141 //_________________________________________
142 AliSelectNonHFE::~AliSelectNonHFE()
148 if(fTrackCuts) delete fTrackCuts;
149 if(fLSPartner) delete [] fLSPartner;
150 if(fULSPartner) delete [] fULSPartner;
155 //__________________________________________
156 void AliSelectNonHFE::FindNonHFE(Int_t iTrack1, AliVParticle *Vtrack1, AliVEvent *fVevent)
158 AliVTrack *track1 = dynamic_cast<AliVTrack*>(Vtrack1);
159 AliESDtrack *etrack1 = dynamic_cast<AliESDtrack*>(Vtrack1);
160 AliExternalTrackParam *extTrackParam1=NULL;
161 AliExternalTrackParam *extTrackParam2=NULL;
162 if(fAlgorithm=="DCA")
164 extTrackParam1 = new AliExternalTrackParam();
165 extTrackParam1->CopyFromVTrack(track1);
168 // Find non HFE electrons
172 Double_t bfield = fVevent->GetMagneticField();
176 fIsULS = kFALSE; //Non-HFE Unlike signal Flag
177 fIsLS = kFALSE; //Non-HFE like signal Flag
178 fNULS = 0; //Non-HFE Unlike signal Flag
179 fNLS = 0; //Non-HFE like signal Flag
181 if(fLSPartner) delete [] fLSPartner;
182 if(fULSPartner) delete [] fULSPartner;
183 fLSPartner = new int [100]; //store the partners index
184 fULSPartner = new int [100]; //store the partners index
186 for(Int_t iTrack2 = 0; iTrack2 < fVevent->GetNumberOfTracks(); iTrack2++)
188 if(iTrack1==iTrack2) continue;
190 AliVParticle* Vtrack2 = fVevent->GetTrack(iTrack2);
193 printf("ERROR: Could not receive track %d\n", iTrack2);
197 AliVTrack *track2 = dynamic_cast<AliVTrack*>(Vtrack2);
198 AliAODTrack *atrack2 = dynamic_cast<AliAODTrack*>(Vtrack2);
199 AliESDtrack *etrack2 = dynamic_cast<AliESDtrack*>(Vtrack2);
201 if(fAlgorithm=="DCA")
203 extTrackParam2 = new AliExternalTrackParam();
204 extTrackParam2->CopyFromVTrack(track2);
210 if(!atrack2->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
211 if((!(atrack2->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrack2->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
212 if(atrack2->GetTPCNcls() < fTpcNcls) continue;
216 if(!fTrackCuts->AcceptTrack(etrack2)) continue;
220 Double_t tpcNsigma2 = fPIDResponse->NumberOfSigmasTPC(track2,AliPID::kElectron);
221 if(tpcNsigma2<fTPCnSigmaMin || tpcNsigma2>fTPCnSigmaMax) continue;
224 if((track2->Pt() < fPtMin) && (fHasPtCut)) continue;
226 if(fAlgorithm=="DCA")
231 Double_t xt1; //radial position track 1 at the DCA point
232 Double_t xt2; //radial position track 2 at the DCA point
233 Double_t dca12; //DCA 1-2
240 dca12 = extTrackParam2->GetDCA(extTrackParam1,bfield,xt2,xt1);
242 //Momento of the track extrapolated to DCA track-track
244 hasdcaT1 = extTrackParam1->GetPxPyPzAt(xt1,bfield,p1);
246 hasdcaT2 = extTrackParam2->GetPxPyPzAt(xt2,bfield,p2);
251 dca12 = etrack2->GetDCA(etrack1,bfield,xt2,xt1);
253 //Momento of the track extrapolated to DCA track-track
255 hasdcaT1 = etrack1->GetPxPyPzAt(xt1,bfield,p1);
257 hasdcaT2 = etrack2->GetPxPyPzAt(xt2,bfield,p2);
260 if(!hasdcaT1 || !hasdcaT2) AliWarning("It could be a problem in the extrapolation");
262 //track1-track2 Invariant Mass
263 Double_t eMass = 0.000510998910; //Electron mass in GeV
264 Double_t pP1 = sqrt(p1[0]*p1[0]+p1[1]*p1[1]+p1[2]*p1[2]); //Track 1 momentum
265 Double_t pP2 = sqrt(p2[0]*p2[0]+p2[1]*p2[1]+p2[2]*p2[2]); //Track 1 momentum
267 //Double_t E1 = sqrt(eMass*eMass+pP1*pP1);
268 //Double_t E2 = sqrt(eMass*eMass+pP2*pP2);
269 //Double_t imass = sqrt(2*eMass*eMass+2*(E1*E2-(p1[0]*p2[0]+p1[1]*p2[1]+p1[2]*p2[2])));
270 //Double_t angle = TMath::ACos((p1[0]*p2[0]+p1[1]*p2[1]+p1[2]*p2[2])/(pP1*pP2));
272 TLorentzVector v1(p1[0],p1[1],p1[2],sqrt(eMass*eMass+pP1*pP1));
273 TLorentzVector v2(p2[0],p2[1],p2[2],sqrt(eMass*eMass+pP2*pP2));
274 Double_t imass = (v1+v2).M(); //Invariant Mass
275 Double_t angle = v1.Angle(v2.Vect()); //Opening Angle (Total Angle)
277 Float_t fCharge1 = track1->Charge();
278 Float_t fCharge2 = track2->Charge();
280 if(imass<fMassCut && angle<fAngleCut && dca12<fdcaCut)
282 if(fCharge1*fCharge2<0)
285 fULSPartner[fNULS] = iTrack2;
288 if(fCharge1*fCharge2>0)
291 fLSPartner[fNLS] = iTrack2;
296 //Fill some histograms
297 if(fCharge1*fCharge2<0 && fHistMass) fHistMass->Fill(imass);
298 if(fCharge1*fCharge2>0 && fHistMassBack) fHistMassBack->Fill(imass);
300 if(fCharge1*fCharge2<0 && fHistDCA) fHistDCA->Fill(dca12);
301 if(fCharge1*fCharge2>0 && fHistDCABack) fHistDCABack->Fill(dca12);
303 if(fCharge1*fCharge2<0 && fHistAngle) fHistAngle->Fill(angle);
304 if(fCharge1*fCharge2>0 && fHistAngleBack) fHistAngleBack->Fill(angle);
307 else if(fAlgorithm=="KF")
309 Int_t fPDGtrack1 = 11;
310 Int_t fPDGtrack2 = 11;
312 Float_t fCharge1 = track1->Charge();
313 Float_t fCharge2 = track2->Charge();
315 if(fCharge1>0) fPDGtrack1 = -11;
316 if(fCharge2>0) fPDGtrack2 = -11;
318 AliKFParticle::SetField(bfield);
319 AliKFParticle fKFtrack1(*track1, fPDGtrack1);
320 AliKFParticle fKFtrack2(*track2, fPDGtrack2);
321 AliKFParticle fRecoGamma(fKFtrack1, fKFtrack2);
323 //Reconstruction Cuts
324 if(fRecoGamma.GetNDF()<1) continue;
325 Double_t chi2OverNDF = fRecoGamma.GetChi2()/fRecoGamma.GetNDF();
326 if(TMath::Sqrt(TMath::Abs(chi2OverNDF))>fChi2OverNDFCut) continue;
331 fRecoGamma.GetMass(imass,width);
333 //Opening Angle (Total Angle)
334 Double_t angle = fKFtrack1.GetAngle(fKFtrack2);
336 //Fill some histograms
337 if(fCharge1*fCharge2<0 && fHistAngle) fHistAngle->Fill(angle);
338 if(fCharge1*fCharge2>0 && fHistAngleBack) fHistAngleBack->Fill(angle);
340 if(angle>fAngleCut) continue;
344 if(fCharge1*fCharge2<0)
347 fULSPartner[fNULS] = iTrack2;
350 if(fCharge1*fCharge2>0)
353 fLSPartner[fNLS] = iTrack2;
358 //Fill some histograms
359 if(fCharge1*fCharge2<0 && fHistMass) fHistMass->Fill(imass);
360 if(fCharge1*fCharge2>0 && fHistMassBack) fHistMassBack->Fill(imass);
365 AliError( Form("Error: %s is not a valid algorithm option.",(const char*)fAlgorithm));
368 if(extTrackParam2) delete extTrackParam2;
373 if(extTrackParam1) delete extTrackParam1;