updating physics selection for heavy-ion data
[u/mrichter/AliRoot.git] / ANALYSIS / AliPhysicsSelection.h
CommitLineData
61899827 1/* $Id: AliPhysicsSelection.h 35782 2009-10-22 11:54:31Z jgrosseo $ */
2
3#ifndef ALIPHYSICSSELECTION_H
4#define ALIPHYSICSSELECTION_H
5
6/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
7 * See cxx source for full Copyright notice */
8
9//-------------------------------------------------------------------------
10// Implementation of Class AliPhysicsSelection
11//
12// This class selects collision candidates from data runs, applying selection cuts on triggers
13// and background rejection based on the content of the ESD
14//
15// Origin: Jan Fiete Grosse-Oetringhaus, CERN
73cc8654 16// Michele Floris, CERN
61899827 17//-------------------------------------------------------------------------
18
296dd262 19#include <AliAnalysisCuts.h>
61899827 20#include <TList.h>
91bea6e7 21#include "TObjString.h"
141265a2 22#include "AliVEvent.h"
61899827 23
73cc8654 24#define VERBOSE_STAT
25
61899827 26class AliESDEvent;
17ba346c 27class TH2F;
73cc8654 28class TH1F;
61899827 29class TCollection;
30class AliTriggerAnalysis;
85c71ba7 31class AliAnalysisTaskSE;
61899827 32
141265a2 33
296dd262 34class AliPhysicsSelection : public AliAnalysisCuts
61899827 35{
9b0cb3c3 36public:
85c71ba7 37
5f337f3d 38public:
c2ba5a61 39 enum {kStatTriggerClass=1,kStatHWTrig,kStatV0ABG,kStatV0CBG,kStatMB1,kStatMB1Prime,kStatFMD,kStatFO1,kStatFO2,kStatFO2L1,kStatV0A,kStatV0C,kStatZDCA,kStatZDCC,kStatZDCAC,kStatV0,kStatOffline,kStatBG,kStatAccepted};
85c71ba7 40
41#ifdef VERBOSE_STAT
141265a2 42 enum {kStatRowBG=0,kStatRowAcc,kStatRowBGFrac,kStatRowAccFrac,kStatRowErrGoodFrac,kStatRowGoodFrac,kStatRowErrGood,kStatRowGood}; // offset wrt fBGStatOffset
85c71ba7 43#else
141265a2 44 enum {kStatRowBG=0,kStatRowAcc,kStatRowGood}; // offset wrt fBGStatOffset
85c71ba7 45#endif
46
47 enum {kStatIdxAll=0,kStatIdxBin0=1};
c2ba5a61 48 enum ETriggerLogic { kCINT1 = 0, kCMBS2A, kCMBS2C, kCMBAC };
85c71ba7 49
ff097e3f 50 typedef Bool_t (*Bin0Callback_t)(const AliESDEvent *);
85c71ba7 51
52 AliPhysicsSelection();
53 virtual ~AliPhysicsSelection();
61899827 54
85c71ba7 55 // AliAnalysisCuts interface
0c6c629b 56 virtual UInt_t GetSelectionMask(const TObject* obj) { return IsCollisionCandidate((const AliESDEvent*) obj); }
85c71ba7 57 virtual Bool_t IsSelected(TList*) { return kFALSE; }
0c6c629b 58 virtual Bool_t IsSelected(TObject*) {return kFALSE;}
296dd262 59
518b6d59 60 Int_t GetCurrentRun() const {return fCurrentRun;}
0c6c629b 61 UInt_t IsCollisionCandidate(const AliESDEvent* aEsd);
85c71ba7 62 Bool_t Initialize(Int_t runNumber);
decf6fd4 63
85c71ba7 64 void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; }
65 void SetSkipTriggerClassSelection(Bool_t flag = kTRUE) { fSkipTriggerClassSelection = flag; }
66 void SetSkipV0(Bool_t flag=kTRUE) { fSkipV0 = flag;}
91bea6e7 67
85c71ba7 68 void AddBackgroundIdentification(AliAnalysisCuts* background) { fBackgroundIdentification = background; }
296dd262 69
85c71ba7 70 virtual void Print(Option_t* option = "") const;
71 virtual Long64_t Merge(TCollection* list);
72 void SaveHistograms(const char* folder = 0) const;
61899827 73
85c71ba7 74 const TList* GetCollisionTriggerClasses() const { return &fCollTrigClasses; }
75 const TList* GetBGTriggerClasses() const { return &fBGTrigClasses; }
76 void AddCollisionTriggerClass(const char* className){ fCollTrigClasses.Add(new TObjString(className)); fUsingCustomClasses = kTRUE; }
77 void AddBGTriggerClass(const char* className) { fBGTrigClasses.Add(new TObjString(className)); fUsingCustomClasses = kTRUE; }
91bea6e7 78
c3a12f21 79 AliTriggerAnalysis* GetTriggerAnalysis(Int_t i = 0) { return (fTriggerAnalysis.GetEntries() > 0) ? (AliTriggerAnalysis*) fTriggerAnalysis.At(i) : 0; }
61899827 80
85c71ba7 81 const TH2F* GetStatisticsHistogram(Int_t idx=kStatIdxAll) const { return fHistStatistics[idx]; }
82 const TH2F* GetBunchCrossingHistogram() const { return fHistBunchCrossing; }
2d45a1a7 83 virtual TObject *GetStatistics(Option_t *option) const;
17ba346c 84
141265a2 85 void SetBIFactors(const AliESDEvent * aESD);
85c71ba7 86
87 void SetUseBXNumbers(Bool_t flag = kTRUE) {fUseBXNumbers = flag;}
141265a2 88 void SetComputeBG (UInt_t flag = AliVEvent::kMB) {fComputeBG = flag; if(flag) fUseBXNumbers = flag;}
85fc0208 89 void SetUseMuonTriggers(Bool_t) { Printf("ERROR: Use of AliPhysicsSelection::SetUseMuonTriggers is deprecated. Use AliVEvent::kMUON selection instead."); }
85c71ba7 90 void SetBin0Callback( const char * cb) {fBin0CallBack = cb;}
ff097e3f 91 void SetBin0CallbackViaPointer( Bin0Callback_t cb) {fBin0CallBackPointer = cb;}// WARNING: THIS SHOULD NOT BE USED, WILL BE REMOVED SOON
73cc8654 92
85c71ba7 93protected:
c2ba5a61 94 UInt_t CheckTriggerClass(const AliESDEvent* aEsd, const char* trigger, Int_t& triggerLogic) const;
85c71ba7 95 Int_t GetTriggerScheme(UInt_t runNumber) const;
96 const char * GetBXIDs(UInt_t runNumber, const char * trigger ) ;
97 const char * GetFillingScheme(UInt_t runNumber) ;
85c71ba7 98 TH2F * BookHistStatistics(const char * tag) ;
141265a2 99 Int_t GetStatRow(const char * triggerBXClass, UInt_t offlineTriggerType, UInt_t ** rowIDs) const;
85c71ba7 100
85c71ba7 101 Int_t fCurrentRun; // run number for which the object is initialized
102 Bool_t fMC; // flag if MC is analyzed
103 TList fCollTrigClasses; // trigger class identifying collision candidates
104 TList fBGTrigClasses; // trigger classes identifying background events
296dd262 105
85c71ba7 106 TList fTriggerAnalysis; // list of offline trigger objects (several are needed to keep the control histograms separate per trigger class)
61899827 107
85c71ba7 108 AliAnalysisCuts* fBackgroundIdentification; // class that performs additional background identification
61899827 109
85c71ba7 110 TH2F* fHistStatistics[2]; // how many events are cut away why {all,bin 0}
111 TH2F* fHistBunchCrossing; // histograms of accepted bunch crossing numbers
73cc8654 112 TH1F* fHistTriggerPattern; // Pattern of the individual detectors in the MB1 trigger. Can reveal inconsistencies/inefficiencies in the trigger
61899827 113
85c71ba7 114 Bool_t fSkipTriggerClassSelection; // flag that determines if the trigger classs selection is skipped
115 Bool_t fUsingCustomClasses; // flag that is set if costum trigger classes are defined
116 Bool_t fSkipV0; // ignore information from v0
117
118 Float_t fBIFactorA; // ratio of interacting over non interacting bunch intensities for beam 1
119 Float_t fBIFactorC; // ratio of interacting over non interacting bunch intensities for beam 2
141265a2 120 Float_t fBIFactorAC; // ratio of interacting over non interacting bunch intensities for beam 1&2:
121 // for some trigger classes we do not distinguish betweem 1 and 2
85c71ba7 122
85c71ba7 123
141265a2 124 UInt_t fComputeBG; // Switch on computation of background and filling of relevant stat table entries. If you enable this you can only process one run at a time (the relative bunch intensity used to compute this chages from run to run); This is a mask of the trigger types to be used in the selection, as defined in AliVEvent
125 Int_t fBGStatOffset; // Offset of the BG statistics computed at the end of the processing. It depends on how many trigger classes you have selected
73cc8654 126 Bool_t fUseBXNumbers; // Explicitely select "good" bunch crossing numbers (exclude pilot, afterpulses and fakes). If you anable this you can only process runs within the same filling scheme.
127 Bool_t fUseMuonTriggers; // if true, also use the muon triggers
128 TString fFillingScheme; // stores the filling scheme of the current run.
85c71ba7 129
130 TString fBin0CallBack; // callback used to determine if an event is in the bin0 (name of the task where the callback is implemented);
ff097e3f 131 Bin0Callback_t fBin0CallBackPointer; //! don't stream this. TO BE REMOVED SOON
91bea6e7 132
141265a2 133 ClassDef(AliPhysicsSelection, 10)
61899827 134
85c71ba7 135 private:
136 AliPhysicsSelection(const AliPhysicsSelection&);
137 AliPhysicsSelection& operator=(const AliPhysicsSelection&);
61899827 138};
139
140#endif