1 /*************************************************************************
2 * Copyright(c) 1998-2008, 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 **************************************************************************/
16 // ----------------------------------------------------
17 // MC particle level cuts for azimuthal isotropic
18 // expansion in highly central collisions analysis
19 // author: Cristian Andrei
20 // acristian@niham.nipne.ro
21 // ----------------------------------------------------
23 #include <TParticle.h>
25 #include "AliMCEvent.h"
27 #include "AliMCParticle.h"
29 #include "AliAnalysisCentralCutMC.h"
33 //____________________________________________________________________
34 ClassImp(AliAnalysisCentralCutMC)
36 //____________________________________________________________________
37 AliAnalysisCentralCutMC::AliAnalysisCentralCutMC(const Char_t* name, const Char_t* title)
38 :AliAnalysisCuts(name,title)
57 //____________________________________________________________________
58 AliAnalysisCentralCutMC::~AliAnalysisCentralCutMC(){
61 if(fMCEvt) delete fMCEvt;
65 //___________________________________________________________________________
66 Bool_t AliAnalysisCentralCutMC::IsSelected(TObject* const obj){
67 // Check if the particle passes the cuts
69 AliMCParticle *part = dynamic_cast<AliMCParticle *>(obj);
72 printf("AliAnalysisCentralCutMC:IsSelected ->Can't get particle!\n");
77 printf("AliAnalysisCentralCutMC:IsSelected ->Can't get MCEvent!\n");
81 AliStack *stack = fMCEvt->Stack();
83 printf("AliAnalysisCentralCutMC:IsSelected ->Can't get Stack!\n");
87 Double_t pt = part->Pt();
89 Double_t eta = part->Eta();
92 if(!IsPrimary(part, stack)) return kFALSE;
96 if(!CheckPDG(part, fPDGCode)) return kFALSE;
99 if((pt < fPtMin) || (pt > fPtMax)) return kFALSE;
101 if((eta < fEtaMin) || (eta > fEtaMax)) return kFALSE;
107 //___________________________________________________________________________
108 Bool_t AliAnalysisCentralCutMC::IsPrimary(AliMCParticle* const part, AliStack* const stack){
109 // Check if the particle is primary
111 Int_t index = part->GetLabel();
113 TParticle* p = stack->Particle(index);
115 printf("AliAnalysisCentralCutMC:IsPrimary -> Can't get TParticle!\n");
119 Int_t ist = p->GetStatusCode();
121 if (ist > 1) return kFALSE;
123 // Int_t pdg = TMath::Abs(p->GetPdgCode());
125 if (index < stack->GetNprimary()) {
133 void AliAnalysisCentralCutMC::ReceiveEvt(TObject* mcEvent) {
134 // Receive the event send from the task
135 // The event is needed in order to get the Stack
138 printf("Pointer to MC Event is null! \n");
142 fMCEvt = dynamic_cast<AliMCEvent*> (mcEvent);
144 printf("AliAnalysisCentralCutMC:ReceiveEvt -> Can't get fMCEvt!\n");
151 Bool_t AliAnalysisCentralCutMC::CheckPDG(AliMCParticle* const mcPart, Int_t const pdg) {
152 // Checks if the particle is of the wanted type
154 TParticle* part = mcPart->Particle();
157 printf("AliAnalysisCentralCutMC:IsPrimary -> Can't get TParticle!\n");
161 Int_t pdgCode = part->GetPdgCode();
163 if (pdgCode != pdg ) return kFALSE;