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