]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliPhysicsSelection.h
style modifications (Markus)
[u/mrichter/AliRoot.git] / ANALYSIS / AliPhysicsSelection.h
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
16 //           Michele Floris, CERN
17 //-------------------------------------------------------------------------
18
19 #include <AliAnalysisCuts.h>
20 #include <TList.h>
21 #include "TObjString.h"
22
23 #define VERBOSE_STAT
24
25 class AliESDEvent;
26 class TH2F;
27 class TH1F;
28 class TCollection;
29 class AliTriggerAnalysis;
30 class AliAnalysisTaskSE;
31
32 class AliPhysicsSelection : public AliAnalysisCuts
33 {
34 public:
35
36   enum {kStatTriggerClass=1,kStatHWTrig,kStatV0ABG,kStatV0CBG,kStatMB1,kStatMB1Prime,kStatFMD,kStatFO1,kStatFO2,kStatV0A,kStatV0C,kStatSSD1,kStatFO1AndV0,kStatV0,kStatAny2Hits,kStatOffline,kStatBG,kStatAccepted};
37
38 #ifdef VERBOSE_STAT
39   enum {kStatRowBG=5,kStatRowAcc,kStatRowBGFrac,kStatRowAccFrac,kStatRowErrGoodFrac,kStatRowGoodFrac,kStatRowErrGood,kStatRowGood};
40 #else
41   enum {kStatRowBG=5,kStatRowAcc,kStatRowGood};
42 #endif
43
44   enum {kStatIdxAll=0,kStatIdxBin0=1};
45
46
47   typedef Bool_t (*Bin0Callback_t)(const AliESDEvent *);
48
49   AliPhysicsSelection();
50   virtual ~AliPhysicsSelection();
51     
52   // AliAnalysisCuts interface
53   virtual Bool_t IsSelected(TObject* obj) { return IsCollisionCandidate((const AliESDEvent*) obj); }
54   virtual Bool_t IsSelected(TList*) { return kFALSE; }
55     
56   Bool_t IsCollisionCandidate(const AliESDEvent* aEsd);
57   Bool_t Initialize(Int_t runNumber);
58     
59   void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; }
60   void SetSkipTriggerClassSelection(Bool_t flag = kTRUE) { fSkipTriggerClassSelection = flag; }
61   void SetSkipV0(Bool_t flag=kTRUE) { fSkipV0 = flag;}
62    
63   void AddBackgroundIdentification(AliAnalysisCuts* background) { fBackgroundIdentification = background; }
64     
65   virtual void Print(Option_t* option = "") const;
66   virtual Long64_t Merge(TCollection* list);
67   void SaveHistograms(const char* folder = 0) const;
68     
69   const TList* GetCollisionTriggerClasses() const { return &fCollTrigClasses; }
70   const TList* GetBGTriggerClasses()        const { return &fBGTrigClasses; }
71   void AddCollisionTriggerClass(const char* className){ fCollTrigClasses.Add(new TObjString(className)); fUsingCustomClasses = kTRUE; }
72   void AddBGTriggerClass(const char* className)       { fBGTrigClasses.Add(new TObjString(className));  fUsingCustomClasses = kTRUE; }
73   
74   AliTriggerAnalysis* GetTriggerAnalysis(Int_t i = 0) { return (fTriggerAnalysis.GetEntries() > 0) ? (AliTriggerAnalysis*) fTriggerAnalysis.At(i) : 0; }    
75     
76   const TH2F* GetStatisticsHistogram(Int_t idx=kStatIdxAll) const { return fHistStatistics[idx]; }
77   const TH2F* GetBunchCrossingHistogram() const { return fHistBunchCrossing; }
78     
79   void SetBIFactors(Int_t run);
80   
81   void SetUseBXNumbers(Bool_t flag = kTRUE) {fUseBXNumbers = flag;}
82   void SetComputeBG   (Bool_t flag = kTRUE) {fComputeBG    = flag; if(flag) fUseBXNumbers = flag;}
83   void SetUseMuonTriggers(Bool_t flag = kTRUE) {fUseMuonTriggers = flag;}
84   void SetBin0Callback( const char * cb) {fBin0CallBack = cb;} 
85   void SetBin0CallbackViaPointer( Bin0Callback_t cb) {fBin0CallBackPointer = cb;}// WARNING: THIS SHOULD NOT BE USED, WILL BE REMOVED SOON
86   
87
88 protected:
89   Bool_t CheckTriggerClass(const AliESDEvent* aEsd, const char* trigger) const;
90   Int_t GetTriggerScheme(UInt_t runNumber) const;
91   const char * GetBXIDs(UInt_t runNumber, const char * trigger ) ;
92   const char * GetFillingScheme(UInt_t runNumber) ;
93   Int_t GetRatioBBBE(Int_t runNumber);
94   TH2F * BookHistStatistics(const char * tag) ;
95
96     
97   Int_t fCurrentRun;      // run number for which the object is initialized
98   Bool_t fMC;             // flag if MC is analyzed
99   TList fCollTrigClasses; // trigger class identifying collision candidates
100   TList fBGTrigClasses;   // trigger classes identifying background events
101     
102   TList fTriggerAnalysis; // list of offline trigger objects (several are needed to keep the control histograms separate per trigger class)
103   
104   AliAnalysisCuts* fBackgroundIdentification; // class that performs additional background identification
105     
106   TH2F* fHistStatistics[2];      // how many events are cut away why {all,bin 0}
107   TH2F* fHistBunchCrossing;   // histograms of accepted bunch crossing numbers
108   TH1F* fHistTriggerPattern;  // Pattern of the individual detectors in the MB1 trigger. Can reveal inconsistencies/inefficiencies in the trigger 
109     
110   Bool_t fSkipTriggerClassSelection;  // flag that determines if the trigger classs selection is skipped
111   Bool_t fUsingCustomClasses;         // flag that is set if costum trigger classes are defined
112   Bool_t fSkipV0;                     // ignore information from v0
113
114   Float_t fBIFactorA;                 // ratio of interacting over non interacting bunch intensities for beam 1
115   Float_t fBIFactorC;                 // ratio of interacting over non interacting bunch intensities for beam 2
116
117   Int_t fRatioBEEE; // ratio between the number of BX in the Beam-Empty and the Empty-Empty. Depends on the filling and on the trigger scheme
118
119   Bool_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)
120   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.
121   Bool_t fUseMuonTriggers;      // if true, also use the muon triggers
122   TString fFillingScheme; // stores the filling scheme of the current run.
123
124   TString fBin0CallBack; // callback used to determine if an event is in the bin0 (name of the task where the callback is implemented);
125   Bin0Callback_t fBin0CallBackPointer; //! don't stream this. TO BE REMOVED SOON
126
127   ClassDef(AliPhysicsSelection, 8)
128     
129     private:
130   AliPhysicsSelection(const AliPhysicsSelection&);
131   AliPhysicsSelection& operator=(const AliPhysicsSelection&);
132 };
133
134 #endif