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 **************************************************************************/
15 // Cut on the Event at generator level: for the moment just
16 // the requirements on the MB process type, number of tracks and on
17 // the 3-D vertex position are implemented
18 // The argument of IsSelected member function (passed object) is cast into
19 // an AliMCEvent. In the future may be modified to use AliVEvent interface
20 // and include more cut variables.
21 // The class derives from AliCFCutBase
22 // Author:S.Arcelli Silvia.Arcelli@cern.ch
27 #include "AliMCEvent.h"
28 #include <AliGenEventHeader.h>
29 #include <AliGenPythiaEventHeader.h>
30 #include <AliGenCocktailEventHeader.h>
31 #include "AliCFEventGenCuts.h"
33 ClassImp(AliCFEventGenCuts)
34 //____________________________________________________________________
35 AliCFEventGenCuts::AliCFEventGenCuts() :
40 fRequireVtxCuts(kFALSE),
54 //____________________________________________________________________
55 AliCFEventGenCuts::AliCFEventGenCuts(Char_t* name, Char_t* title) :
56 AliCFCutBase(name,title),
60 fRequireVtxCuts(kFALSE),
74 //____________________________________________________________________
75 AliCFEventGenCuts::AliCFEventGenCuts(const AliCFEventGenCuts& c) :
77 fMBProcType(c.fMBProcType),
78 fNTracksMin(c.fNTracksMin),
79 fNTracksMax(c.fNTracksMax),
80 fRequireVtxCuts(c.fRequireVtxCuts),
94 //____________________________________________________________________
95 AliCFEventGenCuts::~AliCFEventGenCuts() {
100 if(fBitMap)delete fBitMap;
102 //____________________________________________________________________
103 AliCFEventGenCuts& AliCFEventGenCuts::operator=(const AliCFEventGenCuts& c)
106 // Assignment operator
109 AliCFCutBase::operator=(c) ;
110 fMBProcType=c.fMBProcType;
111 fNTracksMin=c.fNTracksMin;
112 fNTracksMax=c.fNTracksMax;
113 fRequireVtxCuts=c.fRequireVtxCuts;
124 //____________________________________________________________________
125 Bool_t AliCFEventGenCuts::IsSelected(TObject* obj) {
127 //Check if the requested cuts are passed
130 SelectionBitMap(obj);
132 Bool_t isSelected = kTRUE;
134 for (UInt_t icut=0; icut<fBitMap->GetNbits();icut++)
135 if(!fBitMap->TestBitNumber(icut)) isSelected = kFALSE;
141 //____________________________________________________________________
142 void AliCFEventGenCuts::SelectionBitMap(TObject* obj){
144 //cut on the MB process type, the number of charged and neutral
145 //tracks and on the event vertex. So far specific to AliMCEvents
148 //Check if the requested cuts are passed and return a bitmap
149 for(Int_t j=0;j<kNCuts;j++)fBitMap->SetBitNumber(j,kFALSE);
150 AliMCEvent* ev = dynamic_cast<AliMCEvent *>(obj);
152 AliGenEventHeader*genHeader = ev->GenEventHeader();
155 fBitMap->SetBitNumber(0,kTRUE);
157 Int_t process=ProcType(genHeader);
159 AliInfo(Form(" not a pythia event, not checking on the process type"));
162 switch (fMBProcType) {
165 if (!( process!=92 && process!=93 && process!=94))
166 fBitMap->SetBitNumber(0,kFALSE);
171 if (!( process==92 || process==93))
172 fBitMap->SetBitNumber(0,kFALSE);
178 fBitMap->SetBitNumber(0,kFALSE);
186 //Number of charged+neutral tracks:
187 Int_t nTracks = ev->GetNumberOfTracks();
188 fBitMap->SetBitNumber(1,kTRUE); //assume it is ok...
189 if(nTracks<fNTracksMin || nTracks>fNTracksMax)
190 fBitMap->SetBitNumber(1,kFALSE);
192 //now check the vertex cuts
193 for(Int_t j=2;j<kNCuts;j++)fBitMap->SetBitNumber(j,kTRUE);
196 genHeader->PrimaryVertex(vtxPos);
200 if (vtxPos[0]>fVtxXMax || vtxPos[0]<fVtxXMin)
201 fBitMap->SetBitNumber(2,kFALSE);
202 if (vtxPos[1]>fVtxYMax || vtxPos[1]<fVtxYMin)
203 fBitMap->SetBitNumber(3,kFALSE);
204 if (vtxPos[2]>fVtxZMax || vtxPos[2]<fVtxZMin)
205 fBitMap->SetBitNumber(4,kFALSE);
210 //______________________________________________________________________
211 Bool_t AliCFEventGenCuts::IsMBProcType(AliMCEvent *ev, PrType iproc){
213 //returns the type of MB process (if pythia events)
216 if ( !ev ) return kFALSE ;
218 AliGenEventHeader*genHeader = ev->GenEventHeader();
220 Int_t process=ProcType(genHeader);
223 case kND: //Non Diffractive: Actually what is checked is ALL - SD - DD
225 if ( process!=92 && process!=93 && process!=94)
228 case kSD: //Single Diffractive
230 if ( process==92 || process==93)
233 case kDD: //Double Diffractive
242 //____________________________________________________________________________
243 Int_t AliCFEventGenCuts::ProcType(AliGenEventHeader *genHeader) {
245 //get the Pythia process type: if we are not dealing with pythia stuff,
246 //return -1 and we do not apply the cut
249 // can only read pythia headers, either directly or from cocktalil header
250 AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
252 if (!pythiaGenHeader) {
254 AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast<AliGenCocktailEventHeader*>(genHeader);
255 if (!genCocktailHeader) {
259 TList* headerList = genCocktailHeader->GetHeaders();
264 for (Int_t i=0; i<headerList->GetEntries(); i++) {
265 pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(headerList->At(i));
270 if (!pythiaGenHeader) {
275 Int_t process=pythiaGenHeader->ProcessType();