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