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)
49 fOnlyPrim = kFALSE; //implicit consider si part secundare
55 printf("AliAnalysisCentralCutMC::Constructor\n");
58 //____________________________________________________________________
59 AliAnalysisCentralCutMC::~AliAnalysisCentralCutMC(){
62 if(fMCEvt) delete fMCEvt;
64 printf("AliAnalysisCentralCutMC::Destructor\n");
67 //___________________________________________________________________________
68 Bool_t AliAnalysisCentralCutMC::IsSelected(TObject* const obj){
69 // Check if the particle passes the cuts
71 AliMCParticle *part = dynamic_cast<AliMCParticle *>(obj);
74 printf("AliAnalysisCentralCutMC:IsSelected ->Can't get particle!\n");
79 printf("AliAnalysisCentralCutMC:IsSelected ->Can't get MCEvent!\n");
83 AliStack *stack = fMCEvt->Stack();
85 printf("AliAnalysisCentralCutMC:IsSelected ->Can't get Stack!\n");
89 Double_t pt = part->Pt();
91 Double_t eta = part->Eta();
95 if(!IsPrimary(part, stack)) return kFALSE;
99 if(!CheckPDG(part, fPDGCode)) return kFALSE;
102 if((pt < fPtMin) || (pt > fPtMax)) return kFALSE;
104 if((eta < fEtaMin) || (eta > fEtaMax)) return kFALSE;
110 //___________________________________________________________________________
111 Bool_t AliAnalysisCentralCutMC::IsPrimary(AliMCParticle* const part, AliStack* const stack){
112 // Check if the particle is primary
114 Int_t index = part->GetLabel();
116 TParticle* p = stack->Particle(index);
118 printf("AliAnalysisCentralCutMC:IsPrimary -> Can't get TParticle!\n");
122 Int_t ist = p->GetStatusCode();
124 if (ist > 1) return kFALSE;
126 // Int_t pdg = TMath::Abs(p->GetPdgCode());
128 if (index < stack->GetNprimary()) {
136 void AliAnalysisCentralCutMC::ReceiveEvt(TObject* mcEvent) {
137 // Receive the event send from the task
138 // The event is needed in order to get the Stack
141 printf("Pointer to MC Event is null! \n");
145 fMCEvt = dynamic_cast<AliMCEvent*> (mcEvent);
147 printf("AliAnalysisCentralCutMC:ReceiveEvt -> Can't get fMCEvt!\n");
154 Bool_t AliAnalysisCentralCutMC::CheckPDG(AliMCParticle* const mcPart, Int_t const pdg) {
155 // Checks if the particle is of the wanted type
157 TParticle* part = mcPart->Particle();
160 printf("AliAnalysisCentralCutMC:IsPrimary -> Can't get TParticle!\n");
164 Int_t pdgCode = part->GetPdgCode();
166 if (pdgCode != pdg ) return kFALSE;