20 #include "AliESDEvent.h" 21 #include "AliESDVertex.h" 22 #include "AliMCEvent.h" 23 #include "AliHeader.h" 24 #include "AliGenEventHeader.h" 25 #include "AliGenPythiaEventHeader.h" 26 #include "AliGenCocktailEventHeader.h" 27 #include "AliGenDPMjetEventHeader.h" 41 AliAnalysisCuts(name,
title)
42 , fTriggerRequired(kTRUE)
43 , fRecVertexRequired(kTRUE)
44 , fEventProcessType(kInvalidProcess)
45 , fMinNContributors(0)
46 , fMaxNContributors(0)
56 , fRedoTPCVertex(kTRUE)
57 , fUseBeamSpotConstraint(kTRUE)
58 , fEventSelectedRequired(kFALSE)
77 SetRecVertexRequired();
78 SetEventProcessType();
79 SetNContributorsRange();
85 SetUseBeamSpotConstraint();
94 if(!esdEvent)
return kFALSE;
95 if(!IsRecVertexRequired())
return kTRUE;
96 if(!vtx)
return kFALSE;
97 if(!vtx->GetStatus())
return kFALSE;
101 AliHeader* header = mcEvent->Header();
102 if(!header)
return kFALSE;
105 if(fEventProcessType == kInvalidProcess) {
108 else if(fEventProcessType == kSD || fEventProcessType == kDD) {
110 if(processType == kND) retValue=kFALSE;
113 else if(fEventProcessType == GetEventProcessType(header)) {
120 if(vtx->GetZ() < fMinZv)
return kFALSE;
121 if(vtx->GetZ() > fMaxZv)
return kFALSE;
130 if(!mcEvent)
return kFALSE;
135 AliHeader* header = mcEvent->Header();
136 if(!header)
return kFALSE;
138 AliGenEventHeader* genHeader = header->GenEventHeader();
140 AliDebug(AliLog::kError,
"Could not retrieve genHeader from Header");
144 genHeader->PrimaryVertex(vtxMC);
147 if(fEventProcessType == kInvalidProcess) {
150 if(fEventProcessType == GetEventProcessType(header)) retValue=kTRUE;
151 else retValue=kFALSE;
159 if(vtxMC[2] < fMinZv)
return kFALSE;
160 if(vtxMC[2] > fMaxZv)
return kFALSE;
175 TIterator* iter = list->MakeIterator();
179 while((obj = iter->Next()) != 0)
200 AliGenPythiaEventHeader* pythiaGenHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(aHeader->GenEventHeader());
201 if (pythiaGenHeader) {
202 return GetPythiaEventProcessType(pythiaGenHeader,adebug);
205 AliGenDPMjetEventHeader* dpmJetGenHeader =
dynamic_cast<AliGenDPMjetEventHeader*
>(aHeader->GenEventHeader());
206 if (dpmJetGenHeader) {
207 return GetDPMjetEventProcessType(dpmJetGenHeader,adebug);
213 AliGenCocktailEventHeader* genCocktailHeader =
dynamic_cast<AliGenCocktailEventHeader*
>(aHeader->GenEventHeader());
214 if (!genCocktailHeader) {
215 printf(
"AliFilteredTreeEventCuts::GetProcessType : Unknown header type (not Pythia or Cocktail). \n");
216 return kInvalidProcess;
219 TList* headerList = genCocktailHeader->GetHeaders();
221 return kInvalidProcess;
224 for (
Int_t i=0; i<headerList->GetEntries(); i++) {
226 pythiaGenHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(headerList->At(i));
227 if (pythiaGenHeader) {
228 return GetPythiaEventProcessType(pythiaGenHeader,adebug);
231 dpmJetGenHeader =
dynamic_cast<AliGenDPMjetEventHeader*
>(headerList->At(i));
232 if (dpmJetGenHeader) {
233 return GetDPMjetEventProcessType(dpmJetGenHeader,adebug);
236 return kInvalidProcess;
254 if (diffTreatment == kMCFlags)
255 return mcProcessType;
259 Printf(
"ERROR: AliFilteredTreeEventCuts::GetEventProcessType: diffTreatment != kMCFlags and esd == 0");
260 return kInvalidProcess;
263 Float_t cms = esd->GetESDRun()->GetBeamEnergy();
264 if (esd->GetESDRun()->IsBeamEnergyIsSqrtSHalfGeV())
268 if (diffTreatment == kUA5Cuts && mcProcessType == kSD)
270 if (IsHadronLevelSingleDiffractive(stack, cms, 0, 0.05))
273 else if (diffTreatment == kE710Cuts && mcProcessType == kSD)
275 if (IsHadronLevelSingleDiffractive(stack, cms, 2. / cms / cms, 0.05))
278 else if (diffTreatment == kALICEHadronLevel)
280 if (IsHadronLevelSingleDiffractive(stack, cms, 0, 0.05))
284 if (mcProcessType == kSD)
287 return mcProcessType;
293 AliGenPythiaEventHeader* pythiaGenHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(aHeader);
295 if (!pythiaGenHeader) {
296 printf(
"AliFilteredTreeEventCuts::GetProcessType : Unknown gen Header type). \n");
297 return kInvalidProcess;
301 Int_t pythiaType = pythiaGenHeader->ProcessType();
302 fgLastProcessType = pythiaType;
307 printf(
"AliFilteredTreeEventCuts::GetProcessType : Pythia process type found: %d \n",pythiaType);
311 if(pythiaType==92||pythiaType==93){
314 else if(pythiaType==94){
331 AliGenDPMjetEventHeader* dpmJetGenHeader =
dynamic_cast<AliGenDPMjetEventHeader*
>(aHeader);
333 if (!dpmJetGenHeader) {
334 printf(
"AliFilteredTreeEventCuts::GetDPMjetProcessType : Unknown header type (not DPMjet or). \n");
335 return kInvalidProcess;
338 Int_t dpmJetType = dpmJetGenHeader->ProcessType();
339 fgLastProcessType = dpmJetType;
344 printf(
"AliFilteredTreeEventCuts::GetDPMJetProcessType : DPMJet process type found: %d \n",dpmJetType);
348 if (dpmJetType == 1 || dpmJetType == 4) {
351 else if (dpmJetType==5 || dpmJetType==6) {
354 else if (dpmJetType==7) {
371 TParticle* part1 = 0;
372 TParticle* part2 = 0;
377 for (
Int_t iParticle = 0; iParticle < stack->GetNprimary(); iParticle++)
379 TParticle*
part = stack->Particle(iParticle);
383 Int_t pdg = TMath::Abs(part->GetPdgCode());
385 Int_t child1 = part->GetFirstDaughter();
386 Int_t ist = part->GetStatusCode();
389 if (child1 > -1 || ist != 1)
391 if (!(stack->IsPhysicalPrimary(iParticle) || pdg == 111 || pdg == 3212 || pdg==3124 || mfl >= 4))
393 Int_t imother = part->GetFirstMother();
396 TParticle *partM = stack->Particle(imother);
397 Int_t pdgM=TMath::Abs(partM->GetPdgCode());
398 if (pdgM==111 || pdgM==3124 || pdgM==3212)
406 y = Rapidity(part->Pt(), part->Pz(), part->GetMass());
408 y = Rapidity(part->Pt(), part->Pz(), 1.5195);
423 if (part1 == 0 || part2 == 0)
426 Int_t pdg1 = part1->GetPdgCode();
427 Int_t pdg2 = part2->GetPdgCode();
434 Double_t y1 = TMath::Abs(Rapidity(pt1, pz1, 0.938));
435 Double_t y2 = TMath::Abs(Rapidity(pt2, pz2, 0.938));
438 if (pdg1 == 2212 && pdg2 == 2212)
445 else if (pdg1 == 2212)
447 else if (pdg2 == 2212)
450 Double_t M02s = 1. - 2 * part1->Energy() / cms;
451 Double_t M12s = 1. - 2 * part2->Energy() / cms;
453 if (arm == 0 && M02s > xiMin && M02s < xiMax)
455 else if (arm == 1 && M12s > xiMin && M12s < xiMax)
469 if (energy != TMath::Abs(pz))
470 return 0.5*TMath::Log((energy+pz)/(energy-pz));
473 return TMath::Sign(1.e30,pz);
static MCProcessType GetPythiaEventProcessType(AliGenEventHeader *aHeader, Bool_t adebug=kFALSE)
static Bool_t IsHadronLevelSingleDiffractive(AliStack *stack, Float_t cms, Float_t xiMin, Float_t xiMax)
TString part
use mixed event to constrain combinatorial background
virtual ~AliFilteredTreeEventCuts()
static MCProcessType GetDPMjetEventProcessType(AliGenEventHeader *aHeader, Bool_t adebug=kFALSE)
virtual Long64_t Merge(TCollection *list)
Int_t GetEventProcessType() const
Bool_t AcceptMCEvent(AliMCEvent *mcEvent=0)
Bool_t AcceptEvent(AliESDEvent *event=0, AliMCEvent *mcEvent=0, const AliESDVertex *vtx=0)
static Double_t Rapidity(Double_t pt, Double_t pz, Double_t m)