]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/AliPhysicsSelection.h
fix missing pt cut (old part of framework)
[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"
7e7fadb8 23#include "AliLog.h"
7c55ebd9 24#include "AliAnalysisManager.h"
61899827 25
8dec6e35 26//#define VERBOSE_STAT
73cc8654 27
61899827 28class AliESDEvent;
17ba346c 29class TH2F;
73cc8654 30class TH1F;
61899827 31class TCollection;
32class AliTriggerAnalysis;
85c71ba7 33class AliAnalysisTaskSE;
7c55ebd9 34class AliOADBPhysicsSelection ;
35class AliOADBFillingScheme ;
eeaab745 36class AliOADBTriggerAnalysis;
7c55ebd9 37class TPRegexp;
141265a2 38
296dd262 39class AliPhysicsSelection : public AliAnalysisCuts
61899827 40{
9b0cb3c3 41public:
85c71ba7 42
5f337f3d 43public:
559b5ed7 44 enum {kStatTriggerClass=1,kStatHWTrig,kStatV0ABG,kStatV0CBG,kStatMB1,kStatMB1Prime,kStatLaserCut,kStatFO1,kStatFO2,kStatFO2L1,kStatV0A,kStatV0C, kStatT0BB, kStatT0BG, kStatT0PileUp, kStatZDCA,kStatZDCC,kStatZDCAC,kStatZDCTime,kStatV0,kStatOffline,kStatBG, kStatAcceptedPileUp, kStatAccepted};
85c71ba7 45
46#ifdef VERBOSE_STAT
8dec6e35 47 enum {kStatRowAllB=0, kStatRowAllAC, kStatRowAllE, kStatRowBG,kStatRowAcc,kStatRowBGFrac,kStatRowAccFrac,kStatRowErrGoodFrac,kStatRowGoodFrac,kStatRowErrGood,kStatRowGood}; // offset wrt fBGStatOffset
85c71ba7 48#else
8dec6e35 49 enum {kStatRowAllB=0, kStatRowAllAC, kStatRowAllE, kStatRowBG, kStatRowAcc,kStatRowGood}; // offset wrt fBGStatOffset
85c71ba7 50#endif
51
52 enum {kStatIdxAll=0,kStatIdxBin0=1};
05e1da5d 53 enum ETriggerLogic { kCINT1 = 0, kCMBS2A, kCMBS2C, kCMBAC, kCMBACS2, kHighMultL1 };
85c71ba7 54
ff097e3f 55 typedef Bool_t (*Bin0Callback_t)(const AliESDEvent *);
85c71ba7 56
57 AliPhysicsSelection();
58 virtual ~AliPhysicsSelection();
61899827 59
85c71ba7 60 // AliAnalysisCuts interface
0c6c629b 61 virtual UInt_t GetSelectionMask(const TObject* obj) { return IsCollisionCandidate((const AliESDEvent*) obj); }
85c71ba7 62 virtual Bool_t IsSelected(TList*) { return kFALSE; }
0c6c629b 63 virtual Bool_t IsSelected(TObject*) {return kFALSE;}
296dd262 64
518b6d59 65 Int_t GetCurrentRun() const {return fCurrentRun;}
0c6c629b 66 UInt_t IsCollisionCandidate(const AliESDEvent* aEsd);
1107e2ce 67 Bool_t Initialize(const AliESDEvent* aEsd);
7c55ebd9 68 Bool_t Initialize(Int_t runNumber);
decf6fd4 69
85c71ba7 70 void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; }
71 void SetSkipTriggerClassSelection(Bool_t flag = kTRUE) { fSkipTriggerClassSelection = flag; }
7e7fadb8 72 void SetSkipV0(Bool_t flag=kTRUE) { AliError ("This method is deprecated! Please change the OADB configuration instead") ; fSkipV0 = flag;}
91bea6e7 73
f9ee1d1a 74 void AddBackgroundIdentification(AliAnalysisCuts*) { AliFatal ("This method is deprecated. Please use the kSPDClsVsTrkBG tag in the OADB configuration instead"); }
296dd262 75
7c55ebd9 76 virtual void Print(const Option_t* option = "") const;
85c71ba7 77 virtual Long64_t Merge(TCollection* list);
8dec6e35 78 void SaveHistograms(const char* folder = 0);
61899827 79
85c71ba7 80 const TList* GetCollisionTriggerClasses() const { return &fCollTrigClasses; }
81 const TList* GetBGTriggerClasses() const { return &fBGTrigClasses; }
7c55ebd9 82 void AddCollisionTriggerClass(const char* className);
83 void AddBGTriggerClass(const char* className) ;
eeaab745 84 void SetCustomOADBObjects(AliOADBPhysicsSelection * oadbPS, AliOADBFillingScheme * oadbFS, AliOADBTriggerAnalysis * oadbTA = 0) { fPSOADB = oadbPS; fFillOADB = oadbFS; fTriggerOADB = oadbTA; fUsingCustomClasses = kTRUE;}
7c55ebd9 85 const AliOADBPhysicsSelection * GetOADBPhysicsSelection() const {return fPSOADB; }
86 const AliOADBFillingScheme * GetOADBFillingScheme() const {return fFillOADB;}
eeaab745 87 const AliOADBTriggerAnalysis * GetOADBTriggerAnalysis() const {return fTriggerOADB;}
7c55ebd9 88
eb7757e9 89 Int_t GetBGStatOffset() const { return fBGStatOffset; }
7c55ebd9 90
91
c3a12f21 92 AliTriggerAnalysis* GetTriggerAnalysis(Int_t i = 0) { return (fTriggerAnalysis.GetEntries() > 0) ? (AliTriggerAnalysis*) fTriggerAnalysis.At(i) : 0; }
61899827 93
85c71ba7 94 const TH2F* GetStatisticsHistogram(Int_t idx=kStatIdxAll) const { return fHistStatistics[idx]; }
95 const TH2F* GetBunchCrossingHistogram() const { return fHistBunchCrossing; }
7c55ebd9 96 virtual TObject *GetStatistics(const Option_t *option) const;
17ba346c 97
141265a2 98 void SetBIFactors(const AliESDEvent * aESD);
85c71ba7 99
100 void SetUseBXNumbers(Bool_t flag = kTRUE) {fUseBXNumbers = flag;}
141265a2 101 void SetComputeBG (UInt_t flag = AliVEvent::kMB) {fComputeBG = flag; if(flag) fUseBXNumbers = flag;}
85fc0208 102 void SetUseMuonTriggers(Bool_t) { Printf("ERROR: Use of AliPhysicsSelection::SetUseMuonTriggers is deprecated. Use AliVEvent::kMUON selection instead."); }
85c71ba7 103 void SetBin0Callback( const char * cb) {fBin0CallBack = cb;}
ff097e3f 104 void SetBin0CallbackViaPointer( Bin0Callback_t cb) {fBin0CallBackPointer = cb;}// WARNING: THIS SHOULD NOT BE USED, WILL BE REMOVED SOON
73cc8654 105
7c55ebd9 106 static const char * GetOADBFileName() { static TString filename; filename.Form("%s/COMMON/PHYSICSSELECTION/data/physicsSelection.root", AliAnalysisManager::GetOADBPath()); return filename.Data();};
107
85c71ba7 108protected:
c2ba5a61 109 UInt_t CheckTriggerClass(const AliESDEvent* aEsd, const char* trigger, Int_t& triggerLogic) const;
7c55ebd9 110 Bool_t EvaluateTriggerLogic(const AliESDEvent* aEsd, AliTriggerAnalysis* triggerAnalysis, const char* triggerLogic, Bool_t offline);
85c71ba7 111 TH2F * BookHistStatistics(const char * tag) ;
141265a2 112 Int_t GetStatRow(const char * triggerBXClass, UInt_t offlineTriggerType, UInt_t ** rowIDs) const;
7c55ebd9 113 const char * GetTriggerString(TObjString * obj);
114
85c71ba7 115
85c71ba7 116 Int_t fCurrentRun; // run number for which the object is initialized
117 Bool_t fMC; // flag if MC is analyzed
118 TList fCollTrigClasses; // trigger class identifying collision candidates
119 TList fBGTrigClasses; // trigger classes identifying background events
296dd262 120
85c71ba7 121 TList fTriggerAnalysis; // list of offline trigger objects (several are needed to keep the control histograms separate per trigger class)
1ea7a921 122
85c71ba7 123 TH2F* fHistStatistics[2]; // how many events are cut away why {all,bin 0}
7c55ebd9 124 // TH2F* fHistStatisticsTokens; // how many events are cut away why (new version, bins for all tokens. Only used tokens are filled)
85c71ba7 125 TH2F* fHistBunchCrossing; // histograms of accepted bunch crossing numbers
73cc8654 126 TH1F* fHistTriggerPattern; // Pattern of the individual detectors in the MB1 trigger. Can reveal inconsistencies/inefficiencies in the trigger
61899827 127
15695e03 128 Bool_t fSkipTriggerClassSelection; // flag that determines if the trigger class selection is skipped
85c71ba7 129 Bool_t fUsingCustomClasses; // flag that is set if costum trigger classes are defined
130 Bool_t fSkipV0; // ignore information from v0
131
132 Float_t fBIFactorA; // ratio of interacting over non interacting bunch intensities for beam 1
133 Float_t fBIFactorC; // ratio of interacting over non interacting bunch intensities for beam 2
141265a2 134 Float_t fBIFactorAC; // ratio of interacting over non interacting bunch intensities for beam 1&2:
135 // for some trigger classes we do not distinguish betweem 1 and 2
85c71ba7 136
85c71ba7 137
141265a2 138 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
139 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 140 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.
141 Bool_t fUseMuonTriggers; // if true, also use the muon triggers
142 TString fFillingScheme; // stores the filling scheme of the current run.
85c71ba7 143
144 TString fBin0CallBack; // callback used to determine if an event is in the bin0 (name of the task where the callback is implemented);
ff097e3f 145 Bin0Callback_t fBin0CallBackPointer; //! don't stream this. TO BE REMOVED SOON
91bea6e7 146
869f9767 147 Bool_t fIsPP; // True if processing pp run, false if heavy ion
148
7c55ebd9 149 AliOADBPhysicsSelection * fPSOADB; // Physics selection OADB object
150 AliOADBFillingScheme * fFillOADB; // Filling scheme OADB object
eeaab745 151 AliOADBTriggerAnalysis * fTriggerOADB; // Trigger analysis OADB object
7c55ebd9 152
153 TPRegexp* fRegexp; //! regular expression for trigger tokens
154 TList* fCashedTokens; //! trigger token lookup list
155
a25e6b1c 156 ClassDef(AliPhysicsSelection, 15)
61899827 157
85c71ba7 158 private:
159 AliPhysicsSelection(const AliPhysicsSelection&);
160 AliPhysicsSelection& operator=(const AliPhysicsSelection&);
61899827 161};
162
163#endif