00001 #ifndef CALIBRATABLE_H_
00002 #define CALIBRATABLE_H_
00003
00004
00005
00006 #include <vector>
00007 #include <iostream>
00008
00009 #include "DataFormats/ParticleFlowReco/interface/CalibrationResultWrapper.h"
00010 #include "DataFormats/ParticleFlowReco/interface/CalibrationProvenance.h"
00011 #include "DataFormats/Math/interface/LorentzVector.h"
00012 #include "DataFormats/ParticleFlowReco/interface/CaloWindow.h"
00013 #include "DataFormats/ParticleFlowReco/interface/CaloEllipse.h"
00014
00015 namespace pftools {
00016
00024 class CalibratableElement {
00025 public:
00026 CalibratableElement() {
00027 reset();
00028 }
00029
00030 CalibratableElement(double energy, double eta, double phi, int layer,
00031 double extent = 0.0, double time = 0.0) :
00032 energy_(energy), eta_(eta), phi_(phi), time_(time), layer_(layer), extent_(extent) {
00033 }
00034
00035 double energy_, eta_, phi_, time_;
00036 int layer_;
00037
00038
00039 double extent_;
00040
00041 void reset() {
00042 energy_ = 0.0;
00043 eta_ = 0.0;
00044 phi_ = 0.0;
00045 layer_ = 0;
00046 extent_ = 0.0;
00047 time_ = 0.0;
00048 }
00049 bool operator<(const CalibratableElement& em) const {
00050 if (em.energy_ < energy_)
00051 return true;
00052 return false;
00053 }
00054
00055
00056 };
00057
00066 class CandidateWrapper {
00067 public:
00068 CandidateWrapper() {
00069 reset();
00070 }
00071
00072 CandidateWrapper(double energy, double eta, double phi, double energyEcal,
00073 double energyHcal, int type) :
00074 energy_(energy), eta_(eta), phi_(phi), energyEcal_(energyEcal),
00075 energyHcal_(energyHcal), type_(type) {
00076 calowindow_ecal_.reset();
00077 calowindow_hcal_.reset();
00078 caloellipse_ecal_.reset();
00079 caloellipse_hcal_.reset();
00080
00081 }
00082
00083 double energy_, eta_, phi_, energyEcal_, energyHcal_;
00084 int cluster_numEcal_, cluster_numHcal_;
00085 int type_;
00086
00087 CaloWindow calowindow_ecal_;
00088 CaloWindow calowindow_hcal_;
00089
00090 CaloEllipse caloellipse_ecal_;
00091 CaloEllipse caloellipse_hcal_;
00092
00093 void reset() {
00094 energy_ = 0;
00095 eta_ = 0;
00096 phi_ = 0;
00097 energyEcal_ = 0;
00098 energyHcal_ = 0;
00099 cluster_numEcal_ = 0;
00100 cluster_numHcal_ = 0;
00101 type_ = -1;
00102 calowindow_ecal_.reset();
00103 calowindow_hcal_.reset();
00104 caloellipse_ecal_.reset();
00105 caloellipse_hcal_.reset();
00106 }
00107
00108 void recompute() {
00109 caloellipse_ecal_.makeCaches();
00110 caloellipse_hcal_.makeCaches();
00111 }
00112 };
00122 class Calibratable {
00123 public:
00124
00125 Calibratable() {
00126 reset();
00127 }
00128
00129 virtual ~Calibratable() {
00130 }
00131
00135 virtual void reset();
00136
00145
00146 double sim_energyEvent_, sim_eta_, sim_phi_;
00147 double sim_energyEcal_, sim_energyHcal_;
00148 double sim_etaEcal_, sim_etaHcal_, sim_phiEcal_, sim_phiHcal_;
00149 int sim_numEvent_;
00150
00151 bool sim_isMC_;
00152
00153 bool tb_isTB_;
00154
00155 double tb_eta_, tb_phi_;
00156
00157 int tb_run_, tb_pdg_;
00158
00159 double tb_tof_, tb_ck3_, tb_ck2_;
00160
00161 char tb_vetosPassed_;
00162
00163
00164 double tb_energyEvent_, tb_energyEcal_, tb_energyHcal_;
00165 std::vector<CalibratableElement> tb_ecal_, tb_hcal_;
00166 int tb_numEcal_, tb_numHcal_;
00167
00168 CalibratableElement tb_meanEcal_, tb_meanHcal_;
00169
00170
00171 double recotrk_numHits_, recotrk_quality_, recotrk_charge_;
00172 double recotrk_etaEcal_, recotrk_phiEcal_;
00173
00174 double recotrk_deltaRWithSim_;
00175 math::XYZTLorentzVector recotrk_momentum_;
00176
00177
00178 CaloWindow calowindow_ecal_;
00179 CaloWindow calowindow_hcal_;
00180
00181
00182
00183 double cluster_energyEvent_, cluster_energyEcal_, cluster_energyHcal_;
00184 std::vector<CalibratableElement> cluster_ecal_, cluster_hcal_;
00185 int cluster_numEcal_, cluster_numHcal_;
00186 CalibratableElement cluster_meanEcal_, cluster_meanHcal_;
00187
00188
00189
00190 double rechits_energyEvent_, rechits_energyEcal_, rechits_energyHcal_;
00191 std::vector<CalibratableElement> rechits_ecal_, rechits_hcal_;
00192 int rechits_numEcal_, rechits_numHcal_;
00193 CalibratableElement rechits_meanEcal_, rechits_meanHcal_;
00194
00195
00196 std::vector<CandidateWrapper> cands_;
00197 CandidateWrapper cands_mean_;
00198 int cands_num_;
00199
00200
00201 double cand_energyEvent_, cand_energyEcal_, cand_energyHcal_, cand_eta_,
00202 cand_phi_;
00203 double cand_energyNeutralEM_, cand_energyNeutralHad_;
00204 int cand_type_;
00205
00206 std::vector<CalibrationResultWrapper> calibrations_;
00207
00208
00209
00210 virtual void recompute();
00211
00217 virtual CalibratableElement computeMean(const std::vector<
00218 CalibratableElement>& diets);
00219
00225 virtual CandidateWrapper computeMean(
00226 const std::vector<CandidateWrapper>& wrappers);
00227
00234 virtual void fillCaloWindow(const std::vector<CalibratableElement>& source,
00235 CaloWindow& destination) const;
00236
00237 };
00238
00239
00240
00241 std::ostream& operator<<(std::ostream& s, const Calibratable& calib_);
00242 std::ostream& operator<<(std::ostream& s, const CalibratableElement& ce_);
00243
00244 }
00245 #endif
00246