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 **************************************************************************/
20 #include "AliESDEvent.h"
21 #include "AliESDVertex.h"
22 #include "AliMCEvent.h"
23 #include "AliHeader.h"
24 #include "AliGenEventHeader.h"
26 #include "AlidNdPtEventCuts.h"
30 ClassImp(AlidNdPtEventCuts)
32 //_____________________________________________________________________________
33 AlidNdPtEventCuts::AlidNdPtEventCuts(const Char_t* name,const Char_t *title) :
34 AliAnalysisCuts(name, title)
35 , fTriggerRequired(kTRUE)
36 , fRecVertexRequired(kTRUE)
37 , fEventProcessType(AliPWG0Helper::kInvalidProcess)
38 , fMinNContributors(0)
39 , fMaxNContributors(0)
49 , fRedoTPCVertex(kTRUE)
50 , fUseBeamSpotConstraint(kTRUE)
52 // default constructor
54 // init data members with defaults
58 //_____________________________________________________________________________
59 AlidNdPtEventCuts::~AlidNdPtEventCuts()
64 //_____________________________________________________________________________
65 void AlidNdPtEventCuts::Init()
69 SetRecVertexRequired();
70 SetEventProcessType();
71 SetNContributorsRange();
77 SetUseBeamSpotConstraint();
80 //_____________________________________________________________________________
81 Bool_t AlidNdPtEventCuts::AcceptEvent(AliESDEvent *esdEvent,AliMCEvent *mcEvent, const AliESDVertex *vtx)
83 // Check event selection cuts
84 Bool_t retValue=kTRUE;
86 if(!esdEvent) return kFALSE;
87 if(!IsRecVertexRequired()) return kTRUE;
88 if(!vtx) return kFALSE;
89 if(!vtx->GetStatus()) return kFALSE;
92 // check MC event conditions
93 AliHeader* header = mcEvent->Header();
94 if(!header) return kFALSE;
96 // select event type (ND-non diffractive, SD-single diffractive, DD-double diffractive)
97 if(fEventProcessType == AliPWG0Helper::kInvalidProcess) {
100 else if(fEventProcessType == AliPWG0Helper::kSD || fEventProcessType == AliPWG0Helper::kDD) {
101 AliPWG0Helper::MCProcessType processType = AliPWG0Helper::GetEventProcessType(header);
102 if(processType == AliPWG0Helper::kND) retValue=kFALSE;
105 else if(fEventProcessType == AliPWG0Helper::GetEventProcessType(header)) {
112 Float_t R = TMath::Sqrt(vtx->GetXv()*vtx->GetXv()+vtx->GetYv()*vtx->GetYv());
114 if(vtx->GetNContributors() < fMinNContributors) return kFALSE;
115 if(vtx->GetNContributors() > fMaxNContributors) return kFALSE;
116 if(R > fMaxR) return kFALSE;
117 if(vtx->GetZv() < fMinZv) return kFALSE;
118 if(vtx->GetZv() > fMaxZv) return kFALSE;
123 //_____________________________________________________________________________
124 Bool_t AlidNdPtEventCuts::AcceptMCEvent(AliMCEvent *mcEvent)
126 // Check event selection cuts
127 if(!mcEvent) return kFALSE;
129 Bool_t retValue=kTRUE;
131 // check MC event conditions
132 AliHeader* header = mcEvent->Header();
133 if(!header) return kFALSE;
135 AliGenEventHeader* genHeader = header->GenEventHeader();
137 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
141 genHeader->PrimaryVertex(vtxMC);
143 // select event type (ND-non diffractive, SD-single diffractive, DD-double diffractive)
144 if(fEventProcessType == AliPWG0Helper::kInvalidProcess) {
147 if(fEventProcessType == AliPWG0Helper::GetEventProcessType(header)) retValue=kTRUE;
148 else retValue=kFALSE;
151 Float_t R = TMath::Sqrt(vtxMC[0]*vtxMC[0]+vtxMC[1]*vtxMC[1]);
153 if(R > fMaxR) return kFALSE;
154 if(vtxMC[2] < fMinZv) return kFALSE;
155 if(vtxMC[2] > fMaxZv) return kFALSE;
160 //_____________________________________________________________________________
161 Long64_t AlidNdPtEventCuts::Merge(TCollection* list)
163 // Merge list of objects (needed by PROOF)
170 TIterator* iter = list->MakeIterator();
174 while((obj = iter->Next()) != 0)
176 AlidNdPtEventCuts* entry = dynamic_cast<AlidNdPtEventCuts*>(obj);