]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.h
change histogram with invariant mass of all clusters in EMCAL from TH1 to TH2 to...
[u/mrichter/AliRoot.git] / PWG4 / CaloCalib / AliAnalysisTaskEMCALPi0CalibSelection.h
1 #ifndef ALIANALYSISTASKEMCALPI0CALIBSELECTION_H
2 #define ALIANALYSISTASKEMCALPI0CALIBSELECTION_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 //---------------------------------------------------------------------------// 
8 // Fill histograms with two-cluster invariant mass                           //
9 // using calibration coefficients of the previous iteration.                 //
10 //---------------------------------------------------------------------------//
11
12 // Root includes
13 class TH1F;
14 #include "TH2I.h"
15 #include "TObjArray.h"
16
17 // AliRoot includes
18 #include "AliAnalysisTaskSE.h"
19 class AliEMCALGeometry;
20 class AliAODCaloCluster;
21 class AliAODCaloCells;
22 //class AliEMCALCalibData ;
23 #include "AliEMCALGeoParams.h"
24
25 class AliAnalysisTaskEMCALPi0CalibSelection : public AliAnalysisTaskSE
26 {
27 public:
28
29   AliAnalysisTaskEMCALPi0CalibSelection(const char* name);
30   AliAnalysisTaskEMCALPi0CalibSelection(const AliAnalysisTaskEMCALPi0CalibSelection&); 
31   AliAnalysisTaskEMCALPi0CalibSelection& operator=(const AliAnalysisTaskEMCALPi0CalibSelection&); 
32   virtual ~AliAnalysisTaskEMCALPi0CalibSelection();
33
34   // Implementation of interface methods
35   virtual void UserCreateOutputObjects();
36   virtual void UserExec(Option_t * opt);
37   virtual void LocalInit() ;
38
39   void SetClusterMinEnergy(Float_t emin) {fEmin=emin;}
40   void SetClusterMaxEnergy(Float_t emax) {fEmax=emax;}
41   void SetClusterMinNCells(Int_t n)      {fMinNCells=n;}
42   void SetNCellsGroup(Int_t n)           {fGroupNCells=n;}
43
44   void SetLogWeight(Float_t weight) {fLogWeight=weight;}
45   //void SetCalibCorrections(AliEMCALCalibData* const cdata);
46   void CreateAODFromESD();
47   void CreateAODFromAOD();      
48
49   void CopyAOD(Bool_t copy)   { fCopyAOD = copy ; }
50   Bool_t IsAODCopied() const { return fCopyAOD ; }
51         
52   void SetGeometryName(TString name)   { fEMCALGeoName = name ; }
53   TString GeometryName() const { return fEMCALGeoName ; }
54  
55   // Bad channels, copy from PWG4/PartCorrBase/AliCalorimeterUtils
56   Bool_t IsBadChannelsRemovalSwitchedOn()  const { return fRemoveBadChannels ; }
57   void SwitchOnBadChannelsRemoval ()  {fRemoveBadChannels = kTRUE  ; InitEMCALBadChannelStatusMap();}
58   void SwitchOffBadChannelsRemoval()  {fRemoveBadChannels = kFALSE ; }
59         
60   void InitEMCALBadChannelStatusMap() ;
61         
62   Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const { 
63         if(fEMCALBadChannelMap) return (Int_t) ((TH2I*)fEMCALBadChannelMap->At(iSM))->GetBinContent(iCol,iRow); 
64         else return 0;}//Channel is ok by default
65         
66   void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { 
67         if(!fEMCALBadChannelMap)InitEMCALBadChannelStatusMap() ;
68         ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c);}
69         
70   TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap->At(iSM);}
71         
72   void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALBadChannelMap = map;}
73         
74   Bool_t ClusterContainsBadChannel(UShort_t* cellList, Int_t nCells);
75         
76   // Recalibration
77   Bool_t IsRecalibrationOn()  const { return fRecalibration ; }
78   void SwitchOnRecalibration()    {fRecalibration = kTRUE ; InitEMCALRecalibrationFactors();}
79   void SwitchOffRecalibration()   {fRecalibration = kFALSE ; }
80         
81   void InitEMCALRecalibrationFactors() ;
82         
83   Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const { 
84         if(fEMCALRecalibrationFactors) return (Float_t) ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->GetBinContent(iCol,iRow); 
85         else return 1;}
86         
87   void SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { 
88         if(!fEMCALRecalibrationFactors) InitEMCALRecalibrationFactors();
89         ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->SetBinContent(iCol,iRow,c);}
90         
91   void SetEMCALChannelRecalibrationFactors(Int_t iSM , TH2F* h) {fEMCALRecalibrationFactors->AddAt(h,iSM);}
92         
93   TH2F * GetEMCALChannelRecalibrationFactors(Int_t iSM) const {return (TH2F*)fEMCALRecalibrationFactors->At(iSM);}
94         
95   void SetEMCALChannelRecalibrationFactors(TObjArray *map) {fEMCALRecalibrationFactors = map;}
96   Float_t RecalibrateClusterEnergy(AliAODCaloCluster* cluster, AliAODCaloCells * cells);
97         
98   void SetInvariantMassHistoBinRange(Int_t nBins, Float_t minbin, Float_t maxbin){
99         fNbins = nBins; fMinBin = minbin; fMaxBin = maxbin; }
100         
101 private:
102
103   void MaxEnergyCellPos(AliAODCaloCells* const cells, AliAODCaloCluster* const clu, Int_t& iSM, Int_t& ieta, Int_t& iphi);
104
105 private:
106
107   AliEMCALGeometry * fEMCALGeo;  //! EMCAL geometry
108   //AliEMCALCalibData* fCalibData; // corrections to CC from the previous iteration
109         
110   Float_t fEmin;          // min. cluster energy
111   Float_t fEmax;          // max. cluster energy
112   Int_t   fMinNCells;     // min. ncells in cluster
113   Int_t   fGroupNCells;   // group n cells
114   Float_t fLogWeight;     // log weight used in cluster recalibration
115   Bool_t  fCopyAOD;       // Copy calo information only to AOD?
116   TString fEMCALGeoName;  // Name of geometry to use.
117         
118   Bool_t     fRemoveBadChannels;         // Check the channel status provided and remove clusters with bad channels
119   TObjArray *fEMCALBadChannelMap;        // Array of histograms with map of bad channels, EMCAL
120   Bool_t     fRecalibration;             // Switch on or off the recalibration
121   TObjArray *fEMCALRecalibrationFactors; // Array of histograms with map of recalibration factors, EMCAL                 
122  
123   //Output histograms   
124   Int_t   fNbins;  // N       mass bins of invariant mass histograms
125   Float_t fMinBin; // Minimum mass bins of invariant mass histograms
126   Float_t fMaxBin; // Maximum mass bins of invariant mass histograms
127
128   TList*  fOutputContainer; //!histogram container
129   TH1F*   fHmpi0[AliEMCALGeoParams::fgkEMCALModules][AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows];//! two-cluster inv. mass assigned to each cell.
130   TH2F*   fHmgg;            //! two-cluster inv.mass vt pt of pair
131   TH1I*   fhNEvents;        //! Number of events counter histogram
132   TList * fCuts ;           //! List with analysis cuts
133
134   ClassDef(AliAnalysisTaskEMCALPi0CalibSelection,3);
135
136 };
137
138 #endif //ALIANALYSISTASKEMCALPI0CALIBSELECTION_H