CMS 3D CMS Logo

Calibratable.h
Go to the documentation of this file.
1 #ifndef CALIBRATABLE_H_
2 #define CALIBRATABLE_H_
3 
4 //#include <boost/shared_ptr.hpp>
5 
6 #include <vector>
7 #include <iostream>
8 
14 
15 namespace pftools {
16 
25 public:
27  reset();
28  }
29 
30  CalibratableElement(double energy, double eta, double phi, int layer,
31  double extent = 0.0, double time = 0.0) :
32  energy_(energy), eta_(eta), phi_(phi), time_(time), layer_(layer), extent_(extent) {
33  }
34 
35  double energy_, eta_, phi_, time_;
36  int layer_;
37 
38  //RMS of deltaR of hits in the cluster to its centre
39  double extent_;
40 
41  void reset() {
42  energy_ = 0.0;
43  eta_ = 0.0;
44  phi_ = 0.0;
45  layer_ = 0;
46  extent_ = 0.0;
47  time_ = 0.0;
48  }
49  bool operator<(const CalibratableElement& em) const {
50  if (em.energy_ < energy_)
51  return true;
52  return false;
53  }
54 
55 
56 };
57 
67 public:
69  reset();
70  }
71 
72  CandidateWrapper(double energy, double eta, double phi, double energyEcal,
73  double energyHcal, int type) :
74  energy_(energy), eta_(eta), phi_(phi), energyEcal_(energyEcal),
75  energyHcal_(energyHcal), type_(type) {
76  calowindow_ecal_.reset();
77  calowindow_hcal_.reset();
78  caloellipse_ecal_.reset();
79  caloellipse_hcal_.reset();
80 
81  }
82 
83  double energy_, eta_, phi_, energyEcal_, energyHcal_;
84  int cluster_numEcal_, cluster_numHcal_;
85  int type_;
86 
89 
92 
93  void reset() {
94  energy_ = 0;
95  eta_ = 0;
96  phi_ = 0;
97  energyEcal_ = 0;
98  energyHcal_ = 0;
99  cluster_numEcal_ = 0;
100  cluster_numHcal_ = 0;
101  type_ = -1;
102  calowindow_ecal_.reset();
103  calowindow_hcal_.reset();
104  caloellipse_ecal_.reset();
105  caloellipse_hcal_.reset();
106  }
107 
108  void recompute() {
109  caloellipse_ecal_.makeCaches();
110  caloellipse_hcal_.makeCaches();
111  }
112 };
123 public:
124 
126  reset();
127  }
128 
129  virtual ~Calibratable() {
130  }
131 
135  virtual void reset();
136 
145  //truth first
146  double sim_energyEvent_, sim_eta_, sim_phi_;
147  double sim_energyEcal_, sim_energyHcal_;
148  double sim_etaEcal_, sim_etaHcal_, sim_phiEcal_, sim_phiHcal_;
150  //set to true if this event is not real data
151  bool sim_isMC_;
152  //test beam specific
153  bool tb_isTB_;
154  //where was the TB table?
155  double tb_eta_, tb_phi_;
156  //TB run number and PDG particle type
157  int tb_run_, tb_pdg_;
158  //Veto counter values
159  double tb_tof_, tb_ck3_, tb_ck2_;
160  //Erm, bit complicated this one...
162 
163  //DYNAMIC: Computed from tb_ecal_ and tb_hcal_
164  double tb_energyEvent_, tb_energyEcal_, tb_energyHcal_;
165  std::vector<CalibratableElement> tb_ecal_, tb_hcal_;
166  int tb_numEcal_, tb_numHcal_; //DYNAMIC
167 
168  CalibratableElement tb_meanEcal_, tb_meanHcal_; //DYNAMIC
169 
170  //leading track
171  double recotrk_numHits_, recotrk_quality_, recotrk_charge_;
172  double recotrk_etaEcal_, recotrk_phiEcal_;
173  //delta phi between sim particle and leading track
176 
177  //CaloWindow class (new for 3_1_X)
180 
181  //pf clusters
182  //DYNAMIC: Computed from cluster_ecal_ and cluster_hcal_
183  double cluster_energyEvent_, cluster_energyEcal_, cluster_energyHcal_; //DYNAMIC
184  std::vector<CalibratableElement> cluster_ecal_, cluster_hcal_;
185  int cluster_numEcal_, cluster_numHcal_; //DYNAMIC
186  CalibratableElement cluster_meanEcal_, cluster_meanHcal_; //DYNAMIC
187 
188  //pf rechits
189  //DYNAMIC: Computed from rechits_ecal_ and rechits_hcal_
190  double rechits_energyEvent_, rechits_energyEcal_, rechits_energyHcal_;
191  std::vector<CalibratableElement> rechits_ecal_, rechits_hcal_;
192  int rechits_numEcal_, rechits_numHcal_; //DYNAMIC
193  CalibratableElement rechits_meanEcal_, rechits_meanHcal_; //DYNAMIC
194 
195  //pf candidates
196  std::vector<CandidateWrapper> cands_;
198  int cands_num_; //DYNAMIC
199 
200  //DYNAMIC: Computed from cands_
201  double cand_energyEvent_, cand_energyEcal_, cand_energyHcal_, cand_eta_,
202  cand_phi_;
203  double cand_energyNeutralEM_, cand_energyNeutralHad_; //DYNAMIC
204  int cand_type_; //DYNAMIC
205 
206  std::vector<CalibrationResultWrapper> calibrations_;
207 
208  //Recomputes cluster and rechit averages using the vectors of DepositDiets
209  //Users should call this before filling the tree.
210  virtual void recompute();
211 
217  virtual CalibratableElement computeMean(const std::vector<
218  CalibratableElement>& diets);
219 
225  virtual CandidateWrapper computeMean(
226  const std::vector<CandidateWrapper>& wrappers);
227 
234  virtual void fillCaloWindow(const std::vector<CalibratableElement>& source,
235  CaloWindow& destination) const;
236 
237 };
238 
239 //typedef boost::shared_ptr<Calibratable> CalibratablePtr;
240 
241 std::ostream& operator<<(std::ostream& s, const Calibratable& calib_);
242 std::ostream& operator<<(std::ostream& s, const CalibratableElement& ce_);
243 
244 }
245 #endif /*CALIBRATABLE_H_*/
246 
CaloEllipse caloellipse_ecal_
Definition: Calibratable.h:90
CalibratableElement rechits_meanHcal_
Definition: Calibratable.h:193
type
Definition: HCALResponse.h:21
CandidateWrapper(double energy, double eta, double phi, double energyEcal, double energyHcal, int type)
Definition: Calibratable.h:72
Wraps essential single particle calibration data ready for export to a Root file. ...
Definition: Calibratable.h:122
Small wrapper class for storing individual rechit and cluster information.
Definition: Calibratable.h:24
bool operator<(const CalibratableElement &em) const
Definition: Calibratable.h:49
std::vector< CalibrationResultWrapper > calibrations_
Definition: Calibratable.h:206
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
CaloWindow calowindow_hcal_
Definition: Calibratable.h:179
std::vector< CalibratableElement > rechits_hcal_
Definition: Calibratable.h:191
std::vector< CandidateWrapper > cands_
Definition: Calibratable.h:196
std::vector< CalibratableElement > tb_hcal_
Definition: Calibratable.h:165
CaloEllipse caloellipse_hcal_
Definition: Calibratable.h:91
CalibratableElement(double energy, double eta, double phi, int layer, double extent=0.0, double time=0.0)
Definition: Calibratable.h:30
std::vector< CalibratableElement > cluster_hcal_
Definition: Calibratable.h:184
CalibratableElement tb_meanHcal_
Definition: Calibratable.h:168
CalibratableElement cluster_meanHcal_
Definition: Calibratable.h:186
math::XYZTLorentzVector recotrk_momentum_
Definition: Calibratable.h:175
std::ostream & operator<<(std::ostream &s, const Calibratable &calib_)
Definition: Calibratable.cc:6
CandidateWrapper cands_mean_
Definition: Calibratable.h:197
static std::string const source
Definition: EdmProvDump.cc:47
CaloWindow calowindow_ecal_
Definition: Calibratable.h:178
Small wrapper class to store information associated with PFCandidates.
Definition: Calibratable.h:66