CMS 3D CMS Logo

hcalCalib.h
Go to the documentation of this file.
1 // This class skeleton has been automatically generated on
3 // from TTree hcalCalibTree/Tree for IsoTrack Calibration
4 // with ROOT version 5.17/02
5 //
6 // TSelector-based code for getting the HCAL resp. correction
7 // from physics events. Works for DiJet and IsoTrack calibration.
8 //
9 // Anton Anastassov (Northwestern)
10 // Email: aa@fnal.gov
11 //
12 //
14 
15 #ifndef hcalCalib_h
16 #define hcalCalib_h
17 
18 #include <vector>
19 #include <map>
20 
21 #include <TROOT.h>
22 #include <TChain.h>
23 #include <TFile.h>
24 #include <TSelector.h>
25 #include <TROOT.h>
26 #include <TChain.h>
27 #include <TFile.h>
28 #include <TSelector.h>
29 
30 #include <TLorentzVector.h>
31 #include <TClonesArray.h>
32 #include <TRefArray.h>
33 
34 #include <TH2.h>
35 #include <TStyle.h>
36 #include <TFile.h>
37 #include <TMatrixF.h>
38 #include <TMatrixD.h>
39 #include <TDecompSVD.h>
40 #include <TDecompQRH.h>
41 
42 // needed to get cell coordinates
45 
46 class hcalCalib : public TSelector {
47 public:
48  TTree *fChain;
49 
50  UInt_t eventNumber;
51  UInt_t runNumber;
52  Int_t iEtaHit;
53  UInt_t iPhiHit;
54  TClonesArray *cells;
55  Float_t emEnergy;
56  Float_t targetE;
57  Float_t etVetoJet;
58 
59  Float_t xTrkHcal;
60  Float_t yTrkHcal;
61  Float_t zTrkHcal;
62  Float_t xTrkEcal;
63  Float_t yTrkEcal;
64  Float_t zTrkEcal;
65 
66  TLorentzVector *tagJetP4;
67  TLorentzVector *probeJetP4;
68 
69  Float_t tagJetEmFrac;
70  Float_t probeJetEmFrac;
71 
72  // List of branches
73  TBranch *b_eventNumber;
74  TBranch *b_runNumber;
75  TBranch *b_iEtaHit;
76  TBranch *b_iPhiHit;
77  TBranch *b_cells;
78  TBranch *b_emEnergy;
79  TBranch *b_targetE;
80  TBranch *b_etVetoJet;
81 
82  TBranch *b_xTrkHcal;
83  TBranch *b_yTrkHcal;
84  TBranch *b_zTrkHcal;
85  TBranch *b_xTrkEcal;
86  TBranch *b_yTrkEcal;
87  TBranch *b_zTrkEcal;
88 
89  TBranch *b_tagJetEmFrac;
90  TBranch *b_probeJetEmFrac;
91 
92  TBranch *b_tagJetP4;
93  TBranch *b_probeJetP4;
94 
95  UInt_t nEvents;
96 
97  TFile *histoFile;
98 
99  // sanity check histograms
100  TH1F *h1_trkP;
101  TH1F *h1_allTrkP;
102 
104 
105  TH1F *h1_rawSumE;
106  TH1F *h1_rawResp;
107  TH1F *h1_corResp;
113 
116 
117  // histograms based on iEta, iPhi of refPosition forthe cluster (at the moment: hottest tower)
118  // expect range |iEta|<=24 (to do: add flexibility for arbitrary range)
119  TH1F *h1_corRespIEta[48];
120 
121  hcalCalib(TTree * /*tree*/ = nullptr) {}
122  ~hcalCalib() override {}
123  Int_t Version() const override { return 2; }
124  void Begin(TTree *tree) override;
125  // virtual void SlaveBegin(TTree *tree);
126  void Init(TTree *tree) override;
127  Bool_t Notify() override;
128  Bool_t Process(Long64_t entry) override;
129  Int_t GetEntry(Long64_t entry, Int_t getall = 0) override {
130  return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0;
131  }
132  void SetOption(const char *option) override { fOption = option; }
133  void SetObject(TObject *obj) override { fObject = obj; }
134  void SetInputList(TList *input) override { fInput = input; }
135  TList *GetOutputList() const override { return fOutput; }
136  // virtual void SlaveTerminate();
137  void Terminate() override;
138 
139  //------------ CUTS ---------------
140  Float_t MIN_TARGET_E;
141  Float_t MAX_TARGET_E;
142 
143  Float_t MIN_CELL_E;
144  Float_t MIN_EOVERP;
145  Float_t MAX_EOVERP;
146  Float_t MAX_TRK_EME;
147 
150 
151  Bool_t SUM_DEPTHS;
153  Bool_t COMBINE_PHI;
154 
157 
159  Float_t MAX_CONE_DIST;
160 
163 
167  Float_t MIN_TAGJET_ET;
168 
170 
171  TString CALIB_TYPE; // "ISO_TRACK" or "DI_JET"
172  TString CALIB_METHOD; // L3, matrix inversion, everage then matrix inversion,...
173 
176 
178  TString HISTO_FILENAME;
179 
182 
183  void SetMinTargetE(Float_t e) { MIN_TARGET_E = e; }
184  void SetMaxTargetE(Float_t e) { MAX_TARGET_E = e; }
185  void SetSumDepthsFlag(Bool_t b) { SUM_DEPTHS = b; }
187  void SetCombinePhiFlag(Bool_t b) { COMBINE_PHI = b; }
188  void SetMinCellE(Float_t e) { MIN_CELL_E = e; }
189  void SetMinEOverP(Float_t e) { MIN_EOVERP = e; }
190  void SetMaxEOverP(Float_t e) { MAX_EOVERP = e; }
191  void SetMaxTrkEmE(Float_t e) { MAX_TRK_EME = e; }
192  void SetCalibType(const TString &s) { CALIB_TYPE = s; }
193  void SetCalibMethod(const TString &s) { CALIB_METHOD = s; }
194  void SetHbClusterSize(Int_t i) { HB_CLUSTER_SIZE = i; }
195  void SetHeClusterSize(Int_t i) { HE_CLUSTER_SIZE = i; }
196 
198  void SetConeMaxDist(Float_t d) { MAX_CONE_DIST = d; }
199 
202  void SetMaxEtThirdJet(Float_t et) { MAX_ET_THIRD_JET = et; }
203  void SetMinDPhiDiJets(Float_t dphi) { MIN_DPHI_DIJETS = dphi; }
209  void SetMinTagJetEt(Float_t e) { MIN_TAGJET_ET = e; }
212  void SetHistoFileName(const TString &filename) { HISTO_FILENAME = filename; }
213 
214  void SetCaloGeometry(const CaloGeometry *g, const HcalTopology *topo) {
215  theCaloGeometry = g;
216  topo_ = topo;
217  }
218 
220 
221  Bool_t ReadPhiSymCor();
222 
223  void makeTextFile();
224 
225  // --------- containers passed to minimizers ----------------
226  std::vector<std::vector<Float_t> > cellEnergies;
227  std::vector<std::vector<UInt_t> > cellIds;
228  std::vector<std::pair<Int_t, UInt_t> > refIEtaIPhi; // centroid of jet or hottest tower iEta, iPhi
229  std::vector<Float_t> targetEnergies;
230 
231  std::map<UInt_t, Float_t> phiSymCor; // holds the phi symmetry corrections read from the file
232 
233  std::map<UInt_t, Float_t> solution; // correction coef: solution from L3, holds final coef for hybrid methods as well
234  std::map<Int_t, Float_t>
235  iEtaCoefMap; // correction coef: from matrix inversion AFTER averaging, also intermediate results for hybrid methods
236 
237  // ClassDef(hcalCalib,0);
238 };
239 
240 #endif
std::vector< std::pair< Int_t, UInt_t > > refIEtaIPhi
Definition: hcalCalib.h:228
void SetMaxTagJetAbsEta(Float_t e)
Definition: hcalCalib.h:208
void SetPhiSymCorFileName(const TString &filename)
Definition: hcalCalib.h:205
std::vector< Float_t > targetEnergies
Definition: hcalCalib.h:229
TH1F * h1_corRespBarrel
Definition: hcalCalib.h:109
TH1F * h1_trkP
Definition: hcalCalib.h:100
void SetHbClusterSize(Int_t i)
Definition: hcalCalib.h:194
std::map< Int_t, Float_t > iEtaCoefMap
Definition: hcalCalib.h:235
void SetOutputCorCoefFileName(const TString &filename)
Definition: hcalCalib.h:211
void SetMinTagJetEt(Float_t e)
Definition: hcalCalib.h:209
TBranch * b_iEtaHit
Definition: hcalCalib.h:75
TTree * fChain
Definition: hcalCalib.h:48
UInt_t eventNumber
pointer to the analyzed TTree or TChain
Definition: hcalCalib.h:50
Float_t MAX_TARGET_E
Definition: hcalCalib.h:141
TBranch * b_etVetoJet
Definition: hcalCalib.h:80
std::vector< std::vector< UInt_t > > cellIds
Definition: hcalCalib.h:227
TString PHI_SYM_COR_FILENAME
Definition: hcalCalib.h:174
void SetMaxEOverP(Float_t e)
Definition: hcalCalib.h:190
TBranch * b_yTrkEcal
Definition: hcalCalib.h:86
void SetMaxProbeJetEmFrac(Float_t f)
Definition: hcalCalib.h:206
void SetSumSmallDepthsFlag(Bool_t b)
Definition: hcalCalib.h:186
void GetCoefFromMtrxInvOfAve()
Definition: hcalCalib.cc:471
void Begin(TTree *tree) override
Definition: hcalCalib.cc:28
TBranch * b_probeJetEmFrac
Definition: hcalCalib.h:90
void SetConeMaxDist(Float_t d)
Definition: hcalCalib.h:198
void SetApplyPhiSymCorFlag(Bool_t b)
Definition: hcalCalib.h:204
TBranch * b_iPhiHit
Definition: hcalCalib.h:76
~hcalCalib() override
Definition: hcalCalib.h:122
Float_t xTrkHcal
Definition: hcalCalib.h:59
TString CALIB_TYPE
Definition: hcalCalib.h:171
TLorentzVector * tagJetP4
Definition: hcalCalib.h:66
Float_t tagJetEmFrac
Definition: hcalCalib.h:69
void SetOption(const char *option) override
Definition: hcalCalib.h:132
Float_t zTrkHcal
Definition: hcalCalib.h:61
std::map< UInt_t, Float_t > phiSymCor
Definition: hcalCalib.h:231
void SetCalibType(const TString &s)
Definition: hcalCalib.h:192
Float_t xTrkEcal
Definition: hcalCalib.h:62
void SetMinDPhiDiJets(Float_t dphi)
Definition: hcalCalib.h:203
Float_t MAX_EOVERP
Definition: hcalCalib.h:145
Float_t targetE
Definition: hcalCalib.h:56
Bool_t SUM_DEPTHS
Definition: hcalCalib.h:151
Float_t MIN_CELL_E
Definition: hcalCalib.h:143
void SetSumDepthsFlag(Bool_t b)
Definition: hcalCalib.h:185
TFile * histoFile
Definition: hcalCalib.h:97
TLorentzVector * probeJetP4
Definition: hcalCalib.h:67
UInt_t nEvents
Definition: hcalCalib.h:95
void SetUseConeClustering(Bool_t b)
Definition: hcalCalib.h:197
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
static std::string const input
Definition: EdmProvDump.cc:50
Float_t yTrkEcal
Definition: hcalCalib.h:63
Int_t CALIB_ABS_IETA_MIN
Definition: hcalCalib.h:162
TH1F * h1_rawSumE
Definition: hcalCalib.h:105
void SetObject(TObject *obj) override
Definition: hcalCalib.h:133
TH1F * h1_corRespEndcap
Definition: hcalCalib.h:111
TBranch * b_zTrkHcal
Definition: hcalCalib.h:84
TH2F * h2_dHitRefEndcap
Definition: hcalCalib.h:115
TBranch * b_tagJetP4
Definition: hcalCalib.h:92
Int_t HE_CLUSTER_SIZE
Definition: hcalCalib.h:156
TBranch * b_runNumber
Definition: hcalCalib.h:74
TH1F * h1_rawResp
Definition: hcalCalib.h:106
void SetMinTargetE(Float_t e)
Definition: hcalCalib.h:183
Int_t Version() const override
Definition: hcalCalib.h:123
Int_t iEtaHit
Definition: hcalCalib.h:52
Float_t MAX_TRK_EME
Definition: hcalCalib.h:146
TBranch * b_zTrkEcal
Definition: hcalCalib.h:87
Float_t MIN_DPHI_DIJETS
Definition: hcalCalib.h:149
Int_t HB_CLUSTER_SIZE
Definition: hcalCalib.h:155
void SetCalibMethod(const TString &s)
Definition: hcalCalib.h:193
TH1F * h1_corResp
Definition: hcalCalib.h:107
Float_t MIN_TAGJET_ET
Definition: hcalCalib.h:167
void Terminate() override
Definition: hcalCalib.cc:316
void SetCalibAbsIEtaMax(Int_t i)
Definition: hcalCalib.h:200
TBranch * b_eventNumber
Definition: hcalCalib.h:73
Bool_t APPLY_PHI_SYM_COR_FLAG
Definition: hcalCalib.h:175
TH1F * h1_rawRespBarrel
Definition: hcalCalib.h:108
Float_t zTrkEcal
Definition: hcalCalib.h:64
TH1F * h1_corRespIEta[48]
Definition: hcalCalib.h:119
TH1F * h1_numEventsTwrIEta
Definition: hcalCalib.h:112
double f[11][100]
TBranch * b_tagJetEmFrac
Definition: hcalCalib.h:89
const HcalTopology * topo_
Definition: hcalCalib.h:181
std::map< UInt_t, Float_t > solution
Definition: hcalCalib.h:233
Float_t emEnergy
Definition: hcalCalib.h:55
void SetMaxTargetE(Float_t e)
Definition: hcalCalib.h:184
std::vector< std::vector< Float_t > > cellEnergies
Definition: hcalCalib.h:226
Float_t MIN_EOVERP
Definition: hcalCalib.h:144
TBranch * b_cells
Definition: hcalCalib.h:77
d
Definition: ztail.py:151
void SetMaxTrkEmE(Float_t e)
Definition: hcalCalib.h:191
Float_t MIN_PROBEJET_ABSETA
Definition: hcalCalib.h:169
Bool_t COMBINE_PHI
Definition: hcalCalib.h:153
hcalCalib(TTree *=nullptr)
Definition: hcalCalib.h:121
Float_t MAX_ET_THIRD_JET
Definition: hcalCalib.h:148
UInt_t iPhiHit
Definition: hcalCalib.h:53
Bool_t USE_CONE_CLUSTERING
Definition: hcalCalib.h:158
TString CALIB_METHOD
Definition: hcalCalib.h:172
TString OUTPUT_COR_COEF_FILENAME
Definition: hcalCalib.h:177
void SetCaloGeometry(const CaloGeometry *g, const HcalTopology *topo)
Definition: hcalCalib.h:214
void SetMaxTagJetEmFrac(Float_t f)
Definition: hcalCalib.h:207
TH1F * h1_rawRespEndcap
Definition: hcalCalib.h:110
void SetCalibAbsIEtaMin(Int_t i)
Definition: hcalCalib.h:201
double b
Definition: hdecay.h:120
Int_t CALIB_ABS_IETA_MAX
Definition: hcalCalib.h:161
void Init(TTree *tree) override
Definition: hcalCalib.cc:695
TBranch * b_yTrkHcal
Definition: hcalCalib.h:83
Float_t etVetoJet
Definition: hcalCalib.h:57
TList * GetOutputList() const override
Definition: hcalCalib.h:135
TBranch * b_emEnergy
Definition: hcalCalib.h:78
void SetInputList(TList *input) override
Definition: hcalCalib.h:134
void makeTextFile()
Definition: hcalCalib.cc:620
TBranch * b_xTrkEcal
Definition: hcalCalib.h:85
Bool_t Process(Long64_t entry) override
Definition: hcalCalib.cc:111
Bool_t ReadPhiSymCor()
Definition: hcalCalib.cc:557
void SetCombinePhiFlag(Bool_t b)
Definition: hcalCalib.h:187
TClonesArray * cells
Definition: hcalCalib.h:54
Bool_t SUM_SMALL_DEPTHS
Definition: hcalCalib.h:152
void SetHistoFileName(const TString &filename)
Definition: hcalCalib.h:212
Int_t GetEntry(Long64_t entry, Int_t getall=0) override
Definition: hcalCalib.h:129
Float_t MIN_TARGET_E
Definition: hcalCalib.h:140
TString HISTO_FILENAME
Definition: hcalCalib.h:178
Float_t MAX_TAGJET_EMFRAC
Definition: hcalCalib.h:165
TH1F * h1_allTrkP
Definition: hcalCalib.h:101
Float_t MAX_TAGJET_ABSETA
Definition: hcalCalib.h:166
Definition: tree.py:1
Float_t MAX_PROBEJET_EMFRAC
Definition: hcalCalib.h:164
const CaloGeometry * theCaloGeometry
Definition: hcalCalib.h:180
void SetHeClusterSize(Int_t i)
Definition: hcalCalib.h:195
void SetMinCellE(Float_t e)
Definition: hcalCalib.h:188
void SetMaxEtThirdJet(Float_t et)
Definition: hcalCalib.h:202
UInt_t runNumber
Definition: hcalCalib.h:51
TBranch * b_xTrkHcal
Definition: hcalCalib.h:82
TBranch * b_targetE
Definition: hcalCalib.h:79
Float_t MAX_CONE_DIST
Definition: hcalCalib.h:159
Float_t yTrkHcal
Definition: hcalCalib.h:60
void SetMinProbeJetAbsEta(Float_t e)
Definition: hcalCalib.h:210
Bool_t Notify() override
Definition: hcalCalib.cc:739
Float_t probeJetEmFrac
Definition: hcalCalib.h:70
TH1F * h1_selTrkP_iEta10
Definition: hcalCalib.h:103
void SetMinEOverP(Float_t e)
Definition: hcalCalib.h:189
TH2F * h2_dHitRefBarrel
Definition: hcalCalib.h:114
TBranch * b_probeJetP4
Definition: hcalCalib.h:93