CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // needed to get cell coordinates
37 
38 
39 class hcalCalib : public TSelector {
40 public :
41  TTree *fChain;
42 
43  UInt_t eventNumber;
44  UInt_t runNumber;
45  Int_t iEtaHit;
46  UInt_t iPhiHit;
47  TClonesArray *cells;
48  Float_t emEnergy;
49  Float_t targetE;
50  Float_t etVetoJet;
51 
52  Float_t xTrkHcal;
53  Float_t yTrkHcal;
54  Float_t zTrkHcal;
55  Float_t xTrkEcal;
56  Float_t yTrkEcal;
57  Float_t zTrkEcal;
58 
59  TLorentzVector *tagJetP4;
60  TLorentzVector *probeJetP4;
61 
62  Float_t tagJetEmFrac;
63  Float_t probeJetEmFrac;
64 
65  // List of branches
66  TBranch *b_eventNumber;
67  TBranch *b_runNumber;
68  TBranch *b_iEtaHit;
69  TBranch *b_iPhiHit;
70  TBranch *b_cells;
71  TBranch *b_emEnergy;
72  TBranch *b_targetE;
73  TBranch *b_etVetoJet;
74 
75  TBranch *b_xTrkHcal;
76  TBranch *b_yTrkHcal;
77  TBranch *b_zTrkHcal;
78  TBranch *b_xTrkEcal;
79  TBranch *b_yTrkEcal;
80  TBranch *b_zTrkEcal;
81 
82  TBranch *b_tagJetEmFrac;
83  TBranch *b_probeJetEmFrac;
84 
85  TBranch *b_tagJetP4;
86  TBranch *b_probeJetP4;
87 
88 
89  hcalCalib(TTree * /*tree*/ =0) { }
90  virtual ~hcalCalib() { }
91  virtual Int_t Version() const { return 2; }
92  virtual void Begin(TTree *tree);
93  // virtual void SlaveBegin(TTree *tree);
94  virtual void Init(TTree *tree);
95  virtual Bool_t Notify();
96  virtual Bool_t Process(Long64_t entry);
97  virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
98  virtual void SetOption(const char *option) { fOption = option; }
99  virtual void SetObject(TObject *obj) { fObject = obj; }
100  virtual void SetInputList(TList *input) { fInput = input; }
101  virtual TList *GetOutputList() const { return fOutput; }
102  // virtual void SlaveTerminate();
103  virtual void Terminate();
104 
105  //------------ CUTS ---------------
106  Float_t MIN_TARGET_E;
107  Float_t MAX_TARGET_E;
108 
109  Float_t MIN_CELL_E;
110  Float_t MIN_EOVERP;
111  Float_t MAX_EOVERP;
112  Float_t MAX_TRK_EME;
113 
116 
117  Bool_t SUM_DEPTHS;
119  Bool_t COMBINE_PHI;
120 
123 
125  Float_t MAX_CONE_DIST;
126 
129 
133  Float_t MIN_TAGJET_ET;
134 
136 
137  TString CALIB_TYPE; // "ISO_TRACK" or "DI_JET"
138  TString CALIB_METHOD; // L3, matrix inversion, everage then matrix inversion,...
139 
142 
144  TString HISTO_FILENAME;
145 
146 
149 
150 
151  void SetMinTargetE(Float_t e) { MIN_TARGET_E = e; }
152  void SetMaxTargetE(Float_t e) { MAX_TARGET_E = e; }
153  void SetSumDepthsFlag(Bool_t b) { SUM_DEPTHS = b; }
155  void SetCombinePhiFlag(Bool_t b) { COMBINE_PHI = b; }
156  void SetMinCellE(Float_t e) { MIN_CELL_E = e; }
157  void SetMinEOverP(Float_t e) { MIN_EOVERP = e; }
158  void SetMaxEOverP(Float_t e) { MAX_EOVERP = e; }
159  void SetMaxTrkEmE(Float_t e) { MAX_TRK_EME = e; }
160  void SetCalibType(const TString& s) { CALIB_TYPE = s; }
161  void SetCalibMethod(const TString& s) { CALIB_METHOD = s; }
162  void SetHbClusterSize(Int_t i) { HB_CLUSTER_SIZE = i; }
163  void SetHeClusterSize(Int_t i) { HE_CLUSTER_SIZE = i; }
164 
166  void SetConeMaxDist(Float_t d) { MAX_CONE_DIST = d; }
167 
170  void SetMaxEtThirdJet(Float_t et) { MAX_ET_THIRD_JET = et; }
171  void SetMinDPhiDiJets(Float_t dphi) { MIN_DPHI_DIJETS = dphi; }
177  void SetMinTagJetEt(Float_t e) { MIN_TAGJET_ET = e; }
180  void SetHistoFileName(const TString& filename) { HISTO_FILENAME = filename; }
181 
182 
183  void SetCaloGeometry (const CaloGeometry* g, const HcalTopology* topo) { theCaloGeometry = g; topo_=topo; }
184 
186 
187  Bool_t ReadPhiSymCor();
188 
189  void makeTextFile();
190 
191 
192  // --------- containers passed to minimizers ----------------
193  std::vector< std::vector<Float_t> > cellEnergies;
194  std::vector< std::vector<UInt_t> > cellIds;
195  std::vector< std::pair<Int_t, UInt_t> > refIEtaIPhi; // centroid of jet or hottest tower iEta, iPhi
196  std::vector< Float_t> targetEnergies;
197 
198  std::map<UInt_t, Float_t> phiSymCor; // holds the phi symmetry corrections read from the file
199 
200  std::map<UInt_t, Float_t> solution; // correction coef: solution from L3, holds final coef for hybrid methods as well
201  std::map<Int_t, Float_t> iEtaCoefMap; // correction coef: from matrix inversion AFTER averaging, also intermediate results for hybrid methods
202 
203 
204 
205  // ClassDef(hcalCalib,0);
206 };
207 
208 #endif
209 
210 #ifdef hcalCalib_cxx
211 void hcalCalib::Init(TTree *tree)
212 {
213  // The Init() function is called when the selector needs to initialize
214  // a new tree or chain. Typically here the branch addresses and branch
215  // pointers of the tree will be set.
216  // It is normaly not necessary to make changes to the generated
217  // code, but the routine can be extended by the user if needed.
218  // Init() will be called many times when running on PROOF
219  // (once per file to be processed).
220 
221  // Set object pointer
222  cells = 0;
223  tagJetP4 = 0;
224  probeJetP4 = 0;
225 
226  // Set branch addresses and branch pointers
227  if (!tree) return;
228  fChain = tree;
229 
230  // fChain->SetMakeClass(1);
231 
232  fChain->SetBranchAddress("eventNumber", &eventNumber, &b_eventNumber);
233  fChain->SetBranchAddress("runNumber", &runNumber, &b_runNumber);
234  fChain->SetBranchAddress("iEtaHit", &iEtaHit, &b_iEtaHit);
235  fChain->SetBranchAddress("iPhiHit", &iPhiHit, &b_iPhiHit);
236  fChain->SetBranchAddress("cells", &cells, &b_cells);
237  fChain->SetBranchAddress("emEnergy", &emEnergy, &b_emEnergy);
238  fChain->SetBranchAddress("targetE", &targetE, &b_targetE);
239  fChain->SetBranchAddress("etVetoJet", &etVetoJet, &b_etVetoJet);
240 
241  fChain->SetBranchAddress("xTrkHcal", &xTrkHcal, &b_xTrkHcal);
242  fChain->SetBranchAddress("yTrkHcal", &yTrkHcal, &b_yTrkHcal);
243  fChain->SetBranchAddress("zTrkHcal", &zTrkHcal, &b_zTrkHcal);
244  fChain->SetBranchAddress("xTrkEcal", &xTrkEcal, &b_xTrkEcal);
245  fChain->SetBranchAddress("yTrkEcal", &yTrkEcal, &b_yTrkEcal);
246  fChain->SetBranchAddress("zTrkEcal", &zTrkEcal, &b_zTrkEcal);
247 
248  fChain->SetBranchAddress("tagJetEmFrac", &tagJetEmFrac, &b_tagJetEmFrac);
249  fChain->SetBranchAddress("probeJetEmFrac", &probeJetEmFrac, &b_probeJetEmFrac);
250 
251  fChain->SetBranchAddress("tagJetP4", &tagJetP4, &b_tagJetP4);
252  fChain->SetBranchAddress("probeJetP4", &probeJetP4, &b_probeJetP4);
253 
254 
255 
256 }
257 
258 Bool_t hcalCalib::Notify()
259 {
260  // The Notify() function is called when a new file is opened. This
261  // can be either for a new TTree in a TChain or when when a new TTree
262  // is started when using PROOF. It is normaly not necessary to make changes
263  // to the generated code, but the routine can be extended by the
264  // user if needed. The return value is currently not used.
265 
266  return kTRUE;
267 }
268 
269 #endif // #ifdef hcalCalib_cxx
void SetMaxTagJetAbsEta(Float_t e)
Definition: hcalCalib.h:176
void SetPhiSymCorFileName(const TString &filename)
Definition: hcalCalib.h:173
void SetHbClusterSize(Int_t i)
Definition: hcalCalib.h:162
int i
Definition: DBlmapReader.cc:9
std::map< Int_t, Float_t > iEtaCoefMap
Definition: hcalCalib.h:201
void SetOutputCorCoefFileName(const TString &filename)
Definition: hcalCalib.h:179
virtual void SetOption(const char *option)
Definition: hcalCalib.h:98
void SetMinTagJetEt(Float_t e)
Definition: hcalCalib.h:177
virtual Bool_t Process(Long64_t entry)
Definition: hcalCalib.cc:142
TBranch * b_iEtaHit
Definition: hcalCalib.h:68
TTree * fChain
Definition: hcalCalib.h:41
UInt_t eventNumber
pointer to the analyzed TTree or TChain
Definition: hcalCalib.h:43
Float_t MAX_TARGET_E
Definition: hcalCalib.h:107
TBranch * b_etVetoJet
Definition: hcalCalib.h:73
TString PHI_SYM_COR_FILENAME
Definition: hcalCalib.h:140
void SetMaxEOverP(Float_t e)
Definition: hcalCalib.h:158
TBranch * b_yTrkEcal
Definition: hcalCalib.h:79
void SetMaxProbeJetEmFrac(Float_t f)
Definition: hcalCalib.h:174
void SetSumSmallDepthsFlag(Bool_t b)
Definition: hcalCalib.h:154
void GetCoefFromMtrxInvOfAve()
Definition: hcalCalib.cc:521
virtual TList * GetOutputList() const
Definition: hcalCalib.h:101
TBranch * b_probeJetEmFrac
Definition: hcalCalib.h:83
void SetConeMaxDist(Float_t d)
Definition: hcalCalib.h:166
void SetApplyPhiSymCorFlag(Bool_t b)
Definition: hcalCalib.h:172
TBranch * b_iPhiHit
Definition: hcalCalib.h:69
Float_t xTrkHcal
Definition: hcalCalib.h:52
TString CALIB_TYPE
Definition: hcalCalib.h:137
TLorentzVector * tagJetP4
Definition: hcalCalib.h:59
Float_t tagJetEmFrac
Definition: hcalCalib.h:62
Float_t zTrkHcal
Definition: hcalCalib.h:54
std::map< UInt_t, Float_t > phiSymCor
Definition: hcalCalib.h:198
void SetCalibType(const TString &s)
Definition: hcalCalib.h:160
Float_t xTrkEcal
Definition: hcalCalib.h:55
void SetMinDPhiDiJets(Float_t dphi)
Definition: hcalCalib.h:171
Float_t MAX_EOVERP
Definition: hcalCalib.h:111
Float_t targetE
Definition: hcalCalib.h:49
Bool_t SUM_DEPTHS
Definition: hcalCalib.h:117
Float_t MIN_CELL_E
Definition: hcalCalib.h:109
void SetSumDepthsFlag(Bool_t b)
Definition: hcalCalib.h:153
TLorentzVector * probeJetP4
Definition: hcalCalib.h:60
std::vector< std::pair< Int_t, UInt_t > > refIEtaIPhi
Definition: hcalCalib.h:195
void SetUseConeClustering(Bool_t b)
Definition: hcalCalib.h:165
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:44
Float_t yTrkEcal
Definition: hcalCalib.h:56
Int_t CALIB_ABS_IETA_MIN
Definition: hcalCalib.h:128
std::vector< Float_t > targetEnergies
Definition: hcalCalib.h:196
virtual Bool_t Notify()
virtual void Begin(TTree *tree)
Definition: hcalCalib.cc:69
TBranch * b_zTrkHcal
Definition: hcalCalib.h:77
tuple d
Definition: ztail.py:151
TBranch * b_tagJetP4
Definition: hcalCalib.h:85
Int_t HE_CLUSTER_SIZE
Definition: hcalCalib.h:122
TBranch * b_runNumber
Definition: hcalCalib.h:67
void SetMinTargetE(Float_t e)
Definition: hcalCalib.h:151
Int_t iEtaHit
Definition: hcalCalib.h:45
Float_t MAX_TRK_EME
Definition: hcalCalib.h:112
TBranch * b_zTrkEcal
Definition: hcalCalib.h:80
Float_t MIN_DPHI_DIJETS
Definition: hcalCalib.h:115
Int_t HB_CLUSTER_SIZE
Definition: hcalCalib.h:121
void SetCalibMethod(const TString &s)
Definition: hcalCalib.h:161
Float_t MIN_TAGJET_ET
Definition: hcalCalib.h:133
void SetCalibAbsIEtaMax(Int_t i)
Definition: hcalCalib.h:168
TBranch * b_eventNumber
Definition: hcalCalib.h:66
Bool_t APPLY_PHI_SYM_COR_FLAG
Definition: hcalCalib.h:141
Float_t zTrkEcal
Definition: hcalCalib.h:57
double f[11][100]
TBranch * b_tagJetEmFrac
Definition: hcalCalib.h:82
const HcalTopology * topo_
Definition: hcalCalib.h:148
std::map< UInt_t, Float_t > solution
Definition: hcalCalib.h:200
Float_t emEnergy
Definition: hcalCalib.h:48
void SetMaxTargetE(Float_t e)
Definition: hcalCalib.h:152
Float_t MIN_EOVERP
Definition: hcalCalib.h:110
TBranch * b_cells
Definition: hcalCalib.h:70
void SetMaxTrkEmE(Float_t e)
Definition: hcalCalib.h:159
Float_t MIN_PROBEJET_ABSETA
Definition: hcalCalib.h:135
Bool_t COMBINE_PHI
Definition: hcalCalib.h:119
Float_t MAX_ET_THIRD_JET
Definition: hcalCalib.h:114
UInt_t iPhiHit
Definition: hcalCalib.h:46
virtual void Init(TTree *tree)
Bool_t USE_CONE_CLUSTERING
Definition: hcalCalib.h:124
TString CALIB_METHOD
Definition: hcalCalib.h:138
TString OUTPUT_COR_COEF_FILENAME
Definition: hcalCalib.h:143
void SetCaloGeometry(const CaloGeometry *g, const HcalTopology *topo)
Definition: hcalCalib.h:183
void SetMaxTagJetEmFrac(Float_t f)
Definition: hcalCalib.h:175
virtual void Terminate()
Definition: hcalCalib.cc:351
virtual void SetObject(TObject *obj)
Definition: hcalCalib.h:99
void SetCalibAbsIEtaMin(Int_t i)
Definition: hcalCalib.h:169
double b
Definition: hdecay.h:120
Int_t CALIB_ABS_IETA_MAX
Definition: hcalCalib.h:127
TBranch * b_yTrkHcal
Definition: hcalCalib.h:76
Float_t etVetoJet
Definition: hcalCalib.h:50
TBranch * b_emEnergy
Definition: hcalCalib.h:71
void makeTextFile()
Definition: hcalCalib.cc:673
TBranch * b_xTrkEcal
Definition: hcalCalib.h:78
Bool_t ReadPhiSymCor()
Definition: hcalCalib.cc:614
void SetCombinePhiFlag(Bool_t b)
Definition: hcalCalib.h:155
TClonesArray * cells
Definition: hcalCalib.h:47
Bool_t SUM_SMALL_DEPTHS
Definition: hcalCalib.h:118
void SetHistoFileName(const TString &filename)
Definition: hcalCalib.h:180
tuple filename
Definition: lut2db_cfg.py:20
Float_t MIN_TARGET_E
Definition: hcalCalib.h:106
TString HISTO_FILENAME
Definition: hcalCalib.h:144
Float_t MAX_TAGJET_EMFRAC
Definition: hcalCalib.h:131
virtual Int_t Version() const
Definition: hcalCalib.h:91
virtual ~hcalCalib()
Definition: hcalCalib.h:90
Float_t MAX_TAGJET_ABSETA
Definition: hcalCalib.h:132
Float_t MAX_PROBEJET_EMFRAC
Definition: hcalCalib.h:130
const CaloGeometry * theCaloGeometry
Definition: hcalCalib.h:147
void SetHeClusterSize(Int_t i)
Definition: hcalCalib.h:163
std::vector< std::vector< Float_t > > cellEnergies
Definition: hcalCalib.h:193
void SetMinCellE(Float_t e)
Definition: hcalCalib.h:156
void SetMaxEtThirdJet(Float_t et)
Definition: hcalCalib.h:170
hcalCalib(TTree *=0)
Definition: hcalCalib.h:89
UInt_t runNumber
Definition: hcalCalib.h:44
std::vector< std::vector< UInt_t > > cellIds
Definition: hcalCalib.h:194
TBranch * b_xTrkHcal
Definition: hcalCalib.h:75
TBranch * b_targetE
Definition: hcalCalib.h:72
Float_t MAX_CONE_DIST
Definition: hcalCalib.h:125
Float_t yTrkHcal
Definition: hcalCalib.h:53
virtual void SetInputList(TList *input)
Definition: hcalCalib.h:100
void SetMinProbeJetAbsEta(Float_t e)
Definition: hcalCalib.h:178
Float_t probeJetEmFrac
Definition: hcalCalib.h:63
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Definition: hcalCalib.h:97
void SetMinEOverP(Float_t e)
Definition: hcalCalib.h:157
TBranch * b_probeJetP4
Definition: hcalCalib.h:86