00001 #include "Validation/HcalRecHits/interface/HcalRecHitsValidation.h"
00002 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00003
00004
00005 HcalRecHitsValidation::HcalRecHitsValidation(edm::ParameterSet const& conf) {
00006
00007 outputFile_ = conf.getUntrackedParameter<std::string>("outputFile", "myfile.root");
00008
00009 if ( outputFile_.size() != 0 ) {
00010 edm::LogInfo("OutputInfo") << " Hcal RecHit Task histograms will be saved to '" << outputFile_.c_str() << "'";
00011 } else {
00012 edm::LogInfo("OutputInfo") << " Hcal RecHit Task histograms will NOT be saved";
00013 }
00014
00015 nevtot = 0;
00016
00017 dbe_ = 0;
00018
00019 dbe_ = edm::Service<DQMStore>().operator->();
00020
00021 Char_t histo[20];
00022
00023 hcalselector_ = conf.getUntrackedParameter<std::string>("hcalselector", "all");
00024 ecalselector_ = conf.getUntrackedParameter<std::string>("ecalselector", "yes");
00025 eventype_ = conf.getUntrackedParameter<std::string>("eventype", "single");
00026 sign_ = conf.getUntrackedParameter<std::string>("sign", "*");
00027 mc_ = conf.getUntrackedParameter<std::string>("mc", "yes");
00028 famos_ = conf.getUntrackedParameter<bool>("Famos", false);
00029
00030
00031 subdet_ = 5;
00032 if (hcalselector_ == "noise") subdet_ = 0;
00033 if (hcalselector_ == "HB" ) subdet_ = 1;
00034 if (hcalselector_ == "HE" ) subdet_ = 2;
00035 if (hcalselector_ == "HO" ) subdet_ = 3;
00036 if (hcalselector_ == "HF" ) subdet_ = 4;
00037 if (hcalselector_ == "all" ) subdet_ = 5;
00038 if (hcalselector_ == "ZS" ) subdet_ = 6;
00039
00040 etype_ = 1;
00041 if (eventype_ == "multi") etype_ = 2;
00042
00043 iz = 1;
00044 if(sign_ == "-") iz = -1;
00045 if(sign_ == "*") iz = 0;
00046
00047 imc = 1;
00048 if(mc_ == "no") imc = 0;
00049
00050 if ( dbe_ ) {
00051 dbe_->setCurrentFolder("HcalRecHitsV/HcalRecHitTask");
00052
00053
00054
00055 sprintf (histo, "N_HB" );
00056 Nhb = dbe_->book1D(histo, histo, 2600,0.,2600.);
00057 sprintf (histo, "N_HE" );
00058 Nhe = dbe_->book1D(histo, histo, 2600,0.,2600.);
00059 sprintf (histo, "N_HO" );
00060 Nho = dbe_->book1D(histo, histo, 2200,0.,2200.);
00061 sprintf (histo, "N_HF" );
00062 Nhf = dbe_->book1D(histo, histo, 1800,0., 1800.);
00063
00064
00065 if(subdet_ == 6) {
00066
00067 for (unsigned int i1 = 0; i1 < 82; i1++) {
00068 for (unsigned int i2 = 0; i2 < 72; i2++) {
00069 for (unsigned int i3 = 0; i3 < 4; i3++) {
00070 for (unsigned int i4 = 0; i4 < 4; i4++) {
00071 emap_min [i1][i2][i3][i4] = 99999.;
00072 }
00073 }
00074 }
00075 }
00076
00077 sprintf (histo, "ZSmin_map_depth1" );
00078 map_depth1 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00079 sprintf (histo, "ZSmin_map_depth2" );
00080 map_depth2 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00081 sprintf (histo, "ZSmin_map_depth3" );
00082 map_depth3 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00083 sprintf (histo, "ZSmin_map_depth4" );
00084 map_depth4 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00085
00086
00087 sprintf (histo, "ZS_Nreco_HB1" );
00088 ZS_nHB1 = dbe_->book1D(histo, histo, 2500, 0., 2500.);
00089 sprintf (histo, "ZS_Nreco_HB2" );
00090 ZS_nHB2 = dbe_->book1D(histo, histo, 500, 0., 500.);
00091 sprintf (histo, "ZS_Nreco_HE1" );
00092 ZS_nHE1 = dbe_->book1D(histo, histo, 2000, 0., 2000.);
00093 sprintf (histo, "ZS_Nreco_HE2" );
00094 ZS_nHE2 = dbe_->book1D(histo, histo, 2000, 0., 2000.);
00095 sprintf (histo, "ZS_Nreco_HE3" );
00096 ZS_nHE3 = dbe_->book1D(histo, histo, 500, 0., 500.);
00097 sprintf (histo, "ZS_Nreco_HO" );
00098 ZS_nHO = dbe_->book1D(histo, histo, 2500, 0., 2500.);
00099 sprintf (histo, "ZS_Nreco_HF1" );
00100 ZS_nHF1 = dbe_->book1D(histo, histo, 1000, 0., 1000.);
00101 sprintf (histo, "ZS_Nreco_HF2" );
00102 ZS_nHF2 = dbe_->book1D(histo, histo, 1000, 0., 1000.);
00103
00104 sprintf (histo, "ZSmin_simple1D_HB1" );
00105 ZS_HB1 = dbe_->book1D(histo, histo,120, -2., 10.);
00106 sprintf (histo, "ZSmin_simple1D_HB2" );
00107 ZS_HB2 = dbe_->book1D(histo, histo,120, -2., 10.);
00108 sprintf (histo, "ZSmin_simple1D_HE1" );
00109 ZS_HE1 = dbe_->book1D(histo, histo,120, -2., 10.);
00110 sprintf (histo, "ZSmin_simple1D_HE2" );
00111 ZS_HE2 = dbe_->book1D(histo, histo,120, -2., 10.);
00112 sprintf (histo, "ZSmin_simple1D_HE3" );
00113 ZS_HE3 = dbe_->book1D(histo, histo,120, -2., 10.);
00114 sprintf (histo, "ZSmin_simple1D_HO" );
00115 ZS_HO = dbe_->book1D(histo, histo,120, -2., 10.);
00116 sprintf (histo, "ZSmin_simple1D_HF1" );
00117 ZS_HF1 = dbe_->book1D(histo, histo,200, -10., 10.);
00118 sprintf (histo, "ZSmin_simple1D_HF2" );
00119 ZS_HF2 = dbe_->book1D(histo, histo,200, -10., 10.);
00120
00121 sprintf (histo, "ZSmin_sequential1D_HB1" );
00122 ZS_seqHB1 = dbe_->book1D(histo, histo,2400, -1200., 1200.);
00123 sprintf (histo, "ZSmin_sequential1D_HB2" );
00124 ZS_seqHB2 = dbe_->book1D(histo, histo,2400, -1200., 1200.);
00125 sprintf (histo, "ZSmin_sequential1D_HE1" );
00126 ZS_seqHE1 = dbe_->book1D(histo, histo,4400, -2200., 2200.);
00127 sprintf (histo, "ZSmin_sequential1D_HE2" );
00128 ZS_seqHE2 = dbe_->book1D(histo, histo,4400, -2200., 2200.);
00129 sprintf (histo, "ZSmin_sequential1D_HE3" );
00130 ZS_seqHE3 = dbe_->book1D(histo, histo,4400, -2200., 2200.);
00131 sprintf (histo, "ZSmin_sequential1D_HO" );
00132 ZS_seqHO = dbe_->book1D(histo, histo,2400, -1200., 1200.);
00133 sprintf (histo, "ZSmin_sequential1D_HF1" );
00134 ZS_seqHF1 = dbe_->book1D(histo, histo,6000, -3000., 3000.);
00135 sprintf (histo, "ZSmin_sequential1D_HF2" );
00136 ZS_seqHF2 = dbe_->book1D(histo, histo,6000, -3000., 3000.);
00137 }
00138
00139
00140 else {
00141 if (ecalselector_ == "yes") {
00142 sprintf (histo, "map_ecal" );
00143 map_ecal = dbe_->book2D(histo, histo, 70, -3.045, 3.045, 72, -3.1415926536, 3.1415926536);
00144 }
00145
00146 sprintf (histo, "emap_HB1" );
00147 emap_HB1 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00148 sprintf (histo, "emap_HB2" );
00149 emap_HB2 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00150 sprintf (histo, "emap_HE1" );
00151 emap_HE1 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00152 sprintf (histo, "emap_HE2" );
00153 emap_HE2 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00154 sprintf (histo, "emap_HE3" );
00155 emap_HE3 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00156 sprintf (histo, "emap_HO" );
00157 emap_HO = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00158 sprintf (histo, "emap_HF1" );
00159 emap_HF1 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00160 sprintf (histo, "emap_HF2" );
00161 emap_HF2 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00162
00163 sprintf (histo, "emean_vs_ieta_HB1" );
00164 emean_vs_ieta_HB1 = dbe_->bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s");
00165 sprintf (histo, "emean_vs_ieta_HB2" );
00166 emean_vs_ieta_HB2 = dbe_->bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s");
00167 sprintf (histo, "emean_vs_ieta_HE1" );
00168 emean_vs_ieta_HE1 = dbe_->bookProfile(histo, histo, 82, -41., 41., 2010, -10. ,2000., "s" );
00169 sprintf (histo, "emean_vs_ieta_HE2" );
00170 emean_vs_ieta_HE2 = dbe_->bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s");
00171 sprintf (histo, "emean_vs_ieta_HE3" );
00172 emean_vs_ieta_HE3 = dbe_->bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s" );
00173 sprintf (histo, "emean_vs_ieta_HO" );
00174 emean_vs_ieta_HO = dbe_->bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s" );
00175 sprintf (histo, "emean_vs_ieta_HF1" );
00176 emean_vs_ieta_HF1 = dbe_->bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s" );
00177 sprintf (histo, "emean_vs_ieta_HF2" );
00178 emean_vs_ieta_HF2 = dbe_->bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s" );
00179
00180
00181 sprintf (histo, "RMS_vs_ieta_HB1" );
00182 RMS_vs_ieta_HB1 = dbe_->book1D(histo, histo, 82, -41., 41.);
00183 sprintf (histo, "RMS_vs_ieta_HB2" );
00184 RMS_vs_ieta_HB2 = dbe_->book1D(histo, histo, 82, -41., 41.);
00185 sprintf (histo, "RMS_vs_ieta_HE1" );
00186 RMS_vs_ieta_HE1 = dbe_->book1D(histo, histo, 82, -41., 41.);
00187 sprintf (histo, "RMS_vs_ieta_HE2" );
00188 RMS_vs_ieta_HE2 = dbe_->book1D(histo, histo, 82, -41., 41.);
00189 sprintf (histo, "RMS_vs_ieta_HE3" );
00190 RMS_vs_ieta_HE3 = dbe_->book1D(histo, histo, 82, -41., 41.);
00191 sprintf (histo, "RMS_vs_ieta_HO" );
00192 RMS_vs_ieta_HO = dbe_->book1D(histo, histo, 82, -41., 41.);
00193 sprintf (histo, "RMS_vs_ieta_HF1" );
00194 RMS_vs_ieta_HF1 = dbe_->book1D(histo, histo, 82, -41., 41.);
00195 sprintf (histo, "RMS_vs_ieta_HF2" );
00196 RMS_vs_ieta_HF2 = dbe_->book1D(histo, histo, 82, -41., 41.);
00197
00198
00199 sprintf (histo, "emean_seq_HB1" );
00200 emean_seqHB1 = dbe_->bookProfile(histo, histo, 2400, -1200., 1200., 2010, -10., 2000., "s" );
00201 sprintf (histo, "emean_seq_HB2" );
00202 emean_seqHB2 = dbe_->bookProfile(histo, histo, 2400, -1200., 1200., 2010, -10., 2000., "s" );
00203 sprintf (histo, "emean_seq_HE1" );
00204 emean_seqHE1 = dbe_->bookProfile(histo, histo, 4400, -2200., 2200., 2010, -10., 2000., "s" );
00205 sprintf (histo, "emean_seq_HE2" );
00206 emean_seqHE2 = dbe_->bookProfile(histo, histo, 4400, -2200., 2200., 2010, -10., 2000., "s" );
00207 sprintf (histo, "emean_seq_HE3" );
00208 emean_seqHE3 = dbe_->bookProfile(histo, histo, 4400, -2200., 2200., 2010, -10., 2000., "s" );
00209 sprintf (histo, "emean_seq_HO" );
00210 emean_seqHO = dbe_->bookProfile(histo, histo, 2400, -1200., 1200., 2010, -10., 2000., "s" );
00211 sprintf (histo, "emean_seq_HF1" );
00212 emean_seqHF1 = dbe_->bookProfile(histo, histo, 6000, -3000., 3000., 2010, -10., 2000., "s" );
00213 sprintf (histo, "emean_seq_HF2" );
00214 emean_seqHF2 = dbe_->bookProfile(histo, histo, 6000, -3000., 3000., 2010, -10., 2000., "s" );
00215
00216 sprintf (histo, "RMS_seq_HB1" );
00217 RMS_seq_HB1 = dbe_->book1D(histo, histo, 2400, -1200., 1200.);
00218 sprintf (histo, "RMS_seq_HB2" );
00219 RMS_seq_HB2 = dbe_->book1D(histo, histo, 2400, -1200., 1200.);
00220 sprintf (histo, "RMS_seq_HE1" );
00221 RMS_seq_HE1 = dbe_->book1D(histo, histo, 4400, -2200., 2200.);
00222 sprintf (histo, "RMS_seq_HE2" );
00223 RMS_seq_HE2 = dbe_->book1D(histo, histo, 4400, -2200., 2200.);
00224 sprintf (histo, "RMS_seq_HE3" );
00225 RMS_seq_HE3 = dbe_->book1D(histo, histo, 4400, -2200., 2200.);
00226 sprintf (histo, "RMS_seq_HO" );
00227 RMS_seq_HO = dbe_->book1D(histo, histo, 2400, -1200., 1200.);
00228 sprintf (histo, "RMS_seq_HF1" );
00229 RMS_seq_HF1 = dbe_->book1D(histo, histo, 6000, -3000., 3000.);
00230 sprintf (histo, "RMS_seq_HF2" );
00231 RMS_seq_HF2 = dbe_->book1D(histo, histo, 6000, -3000., 3000.);
00232
00233
00234
00235 sprintf (histo, "occupancy_map_HB1" );
00236 occupancy_map_HB1 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00237 sprintf (histo, "occupancy_map_HB2" );
00238 occupancy_map_HB2 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00239 sprintf (histo, "occupancy_map_HE1" );
00240 occupancy_map_HE1 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00241 sprintf (histo, "occupancy_map_HE2" );
00242 occupancy_map_HE2 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00243 sprintf (histo, "occupancy_map_HE3" );
00244 occupancy_map_HE3 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00245 sprintf (histo, "occupancy_map_HO" );
00246 occupancy_map_HO = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00247 sprintf (histo, "occupancy_map_HF1" );
00248 occupancy_map_HF1 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00249 sprintf (histo, "occupancy_map_HF2" );
00250 occupancy_map_HF2 = dbe_->book2D(histo, histo, 82, -41., 41., 72, 0., 72.);
00251
00252 sprintf (histo, "occupancy_vs_ieta_HB1" );
00253 occupancy_vs_ieta_HB1 = dbe_->book1D(histo, histo, 82, -41., 41.);
00254 sprintf (histo, "occupancy_vs_ieta_HB2" );
00255 occupancy_vs_ieta_HB2 = dbe_->book1D(histo, histo, 82, -41., 41.);
00256 sprintf (histo, "occupancy_vs_ieta_HE1" );
00257 occupancy_vs_ieta_HE1 = dbe_->book1D(histo, histo, 82, -41., 41.);
00258 sprintf (histo, "occupancy_vs_ieta_HE2" );
00259 occupancy_vs_ieta_HE2 = dbe_->book1D(histo, histo, 82, -41., 41.);
00260 sprintf (histo, "occupancy_vs_ieta_HE3" );
00261 occupancy_vs_ieta_HE3 = dbe_->book1D(histo, histo, 82, -41., 41.);
00262 sprintf (histo, "occupancy_vs_ieta_HO" );
00263 occupancy_vs_ieta_HO = dbe_->book1D(histo, histo, 82, -41., 41.);
00264 sprintf (histo, "occupancy_vs_ieta_HF1" );
00265 occupancy_vs_ieta_HF1 = dbe_->book1D(histo, histo, 82, -41., 41.);
00266 sprintf (histo, "occupancy_vs_ieta_HF2" );
00267 occupancy_vs_ieta_HF2 = dbe_->book1D(histo, histo, 82, -41., 41.);
00268
00269 sprintf (histo, "occ_sequential1D_HB1" );
00270 occupancy_seqHB1 = dbe_->book1D(histo, histo,2400, -1200., 1200.);
00271 sprintf (histo, "occ_sequential1D_HB2" );
00272 occupancy_seqHB2 = dbe_->book1D(histo, histo,2400, -1200., 1200.);
00273 sprintf (histo, "occ_sequential1D_HE1" );
00274 occupancy_seqHE1 = dbe_->book1D(histo, histo,4400, -2200., 2200.);
00275 sprintf (histo, "occ_sequential1D_HE2" );
00276 occupancy_seqHE2 = dbe_->book1D(histo, histo,4400, -2200., 2200.);
00277 sprintf (histo, "occ_sequential1D_HE3" );
00278 occupancy_seqHE3 = dbe_->book1D(histo, histo,4400, -2200., 2200.);
00279 sprintf (histo, "occ_sequential1D_HO" );
00280 occupancy_seqHO = dbe_->book1D(histo, histo,2400, -1200., 1200.);
00281 sprintf (histo, "occ_sequential1D_HF1" );
00282 occupancy_seqHF1 = dbe_->book1D(histo, histo,6000, -3000., 3000.);
00283 sprintf (histo, "occ_sequential1D_HF2" );
00284 occupancy_seqHF2 = dbe_->book1D(histo, histo,6000, -3000., 3000.);
00285
00286 if(imc !=0) {
00287 sprintf (histo, "map_econe_depth1" );
00288 map_econe_depth1 =
00289 dbe_->book2D(histo, histo, 520, -5.2, 5.2, 72, -3.1415926536, 3.1415926536);
00290 sprintf (histo, "map_econe_depth2" );
00291 map_econe_depth2 =
00292 dbe_->book2D(histo, histo, 520, -5.2, 5.2, 72, -3.1415926536, 3.1415926536);
00293 sprintf (histo, "map_econe_depth3" );
00294 map_econe_depth3 =
00295 dbe_->book2D(histo, histo, 520, -5.2, 5.2, 72, -3.1415926536, 3.1415926536);
00296 sprintf (histo, "map_econe_depth4" );
00297 map_econe_depth4 =
00298 dbe_->book2D(histo, histo, 520, -5.2, 5.2, 72, -3.1415926536, 3.1415926536);
00299 }
00300 }
00301
00302
00303
00304 if(subdet_ != 0 && imc != 0) {
00305
00306
00307
00308 sprintf (histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_depth1");
00309 meEnConeEtaProfile_depth1 = dbe_->bookProfile(histo, histo, 82, -41., 41., 210, -10., 200.);
00310
00311 sprintf (histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_depth2");
00312 meEnConeEtaProfile_depth2 = dbe_->bookProfile(histo, histo, 82, -41., 41., 210, -10., 200.);
00313
00314 sprintf (histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_depth3");
00315 meEnConeEtaProfile_depth3 = dbe_->bookProfile(histo, histo, 82, -41., 41., 210, -10., 200.);
00316
00317 sprintf (histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_depth4");
00318 meEnConeEtaProfile_depth4 = dbe_->bookProfile(histo, histo, 82, -41., 41., 210, -10., 200.);
00319
00320 sprintf (histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths");
00321 meEnConeEtaProfile = dbe_->bookProfile(histo, histo, 82, -41., 41., 210, -10., 200.);
00322
00323
00324 }
00325
00326 if(etype_ == 1 && subdet_ != 0) {
00327
00328 sprintf (histo, "Delta_phi_cluster-MC");
00329 meDeltaPhi = dbe_->book2D(histo, histo, 520, -5.2, 5.2, 60, -0.6, 0.6);
00330
00331 sprintf (histo, "Delta_eta_cluster-MC");
00332 meDeltaEta = dbe_->book2D(histo, histo, 520, -5.2, 5.2, 60, -0.6, 0.6);
00333
00334 sprintf (histo, "Delta_phi_simcluster-MC");
00335 meDeltaPhiS = dbe_->book2D(histo, histo, 520, -5.2, 5.2, 60, -0.6, 0.6);
00336
00337 sprintf (histo, "Delta_eta_simcluster-MC");
00338 meDeltaEtaS = dbe_->book2D(histo, histo, 520, -5.2, 5.2, 60, -0.6, 0.6);
00339
00340
00341 }
00342
00343
00344 if (hcalselector_ == "noise" ){
00345
00346 sprintf (histo, "e_hb" ) ;
00347 e_hb = dbe_->book1D(histo, histo,1000, -5., 5.);
00348 sprintf (histo, "e_he" ) ;
00349 e_he = dbe_->book1D(histo, histo,1000, -5., 5.);
00350 sprintf (histo, "e_ho" ) ;
00351 e_ho = dbe_->book1D(histo, histo,1000, -5., 5.);
00352 sprintf (histo, "e_hfl" ) ;
00353 e_hfl = dbe_->book1D(histo, histo,2000, -10., 10.);
00354 sprintf (histo, "e_hfs" ) ;
00355 e_hfs = dbe_->book1D(histo, histo,2000, -10., 10.);
00356
00357 }
00358
00359 if (subdet_ == 1 || subdet_ == 5 ){
00360
00361 if(etype_ == 1 && subdet_ == 1 ) {
00362 if(imc != 0) {
00363 sprintf (histo, "HcalRecHitTask_number_of_rechits_in_cone_HB" ) ;
00364 meNumRecHitsConeHB = dbe_->book1D(histo, histo, 100, 0., 100.);
00365
00366 sprintf (histo, "HcalRecHitTask_sum_of_rechits_energy_in_cone_HB" ) ;
00367 meSumRecHitsEnergyConeHB = dbe_->book1D(histo,histo, 60 ,-20., 280.);
00368 }
00369
00370 sprintf (histo, "HcalRecHitTask_number_of_rechits_above_1GeV_HB");
00371 meNumRecHitsThreshHB = dbe_->book1D(histo, histo, 30, 0., 30.);
00372
00373 sprintf (histo, "HcalRecHitTask_sum_of_rechits_energy_HB" ) ;
00374 meSumRecHitsEnergyHB = dbe_->book1D(histo,histo, 60 , -20., 280.);
00375
00376 if (ecalselector_ == "yes") {
00377 if(imc != 0) {
00378 sprintf (histo, "HcalRecHitTask_number_of_ecalrechits_in_cone_HB");
00379 meNumEcalRecHitsConeHB = dbe_->book1D(histo, histo, 300, 0., 300.);
00380 sprintf (histo, "HcalRecHitTask_energy_ecal_plus_hcal_in_cone_HB");
00381 meEcalHcalEnergyConeHB = dbe_->book1D(histo,histo, 60 , -20., 280.);
00382 }
00383
00384 sprintf (histo, "HcalRecHitTask_energy_hcal_vs_ecal_HB");
00385 meEnergyHcalVsEcalHB = dbe_->book2D(histo, histo, 300, 0., 150., 300, 0., 150.);
00386 sprintf (histo, "HcalRecHitTask_energy_ecal_plus_hcal_HB" ) ;
00387 meEcalHcalEnergyHB = dbe_->book1D(histo,histo, 60 , -20., 280.);
00388
00389 }
00390 }
00391
00392 sprintf (histo, "HcalRecHitTask_energy_of_rechits_HB" ) ;
00393 meRecHitsEnergyHB = dbe_->book1D(histo, histo, 510 , -10. , 500.);
00394
00395 sprintf (histo, "HcalRecHitTask_timing_HB" ) ;
00396 meTimeHB = dbe_->book1D(histo, histo, 2000 , -100. , 100.);
00397
00398 sprintf (histo, "HcalRecHitTask_timing_vs_energy_HB" ) ;
00399 meTE_HB = dbe_->book2D(histo, histo, 200, -5., 95., 220, -10., 100.);
00400
00401 sprintf (histo, "HcalRecHitTask_timing_vs_energy_HB_depth1" ) ;
00402 meTE_HB1 = dbe_->book2D(histo, histo, 200, -5., 95., 220, -10., 100.);
00403
00404 sprintf (histo, "HcalRecHitTask_timing_vs_energy_HB_depth2" ) ;
00405 meTE_HB2 = dbe_->book2D(histo, histo, 200, -5., 95., 220, -10., 100.);
00406
00407 sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_HB" ) ;
00408 meTEprofileHB = dbe_->bookProfile(histo, histo, 100, -5., 95., 110, -10., 100.);
00409
00410 if(imc != 0) {
00411 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_HB");
00412 meRecHitSimHitHB = dbe_->book2D(histo, histo, 120, 0., 1.2, 300, 0., 150.);
00413 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_profile_HB");
00414 meRecHitSimHitProfileHB = dbe_->bookProfile(histo, histo, 120, 0., 1.2, 500, 0., 500.);
00415 }
00416 }
00417
00418
00419 if ( subdet_ == 2 || subdet_ == 5 ){
00420
00421 if(etype_ == 1 && subdet_ == 2 ) {
00422
00423 if(imc != 0) {
00424 sprintf (histo, "HcalRecHitTask_number_of_rechits_in_cone_HE" ) ;
00425 meNumRecHitsConeHE = dbe_->book1D(histo, histo, 100, 0., 100.);
00426
00427 sprintf (histo, "HcalRecHitTask_sum_of_rechits_energy_in_cone_HE" ) ;
00428 meSumRecHitsEnergyConeHE = dbe_->book1D(histo,histo, 60 ,-20., 280.);
00429 }
00430
00431 sprintf (histo, "HcalRecHitTask_number_of_rechits_above_1GeV_HE");
00432 meNumRecHitsThreshHE = dbe_->book1D(histo, histo, 30, 0., 30.);
00433
00434 sprintf (histo, "HcalRecHitTask_sum_of_rechits_energy_HE" ) ;
00435 meSumRecHitsEnergyHE = dbe_->book1D(histo,histo, 60 , -20., 280.);
00436
00437 if (ecalselector_ == "yes") {
00438 sprintf (histo, "HcalRecHitTask_energy_ecal_plus_hcal_HE" ) ;
00439 meEcalHcalEnergyHE = dbe_->book1D(histo,histo, 80, -20., 380.);
00440
00441 sprintf (histo, "HcalRecHitTask_energy_hcal_vs_ecal_HE");
00442 meEnergyHcalVsEcalHE = dbe_->book2D(histo, histo, 300, 0., 150., 300, 0., 150.);
00443 if(imc != 0) {
00444 sprintf (histo, "HcalRecHitTask_number_of_ecalrechits_in_cone_HE");
00445 meNumEcalRecHitsConeHE = dbe_->book1D(histo, histo, 300, 0., 300.);
00446 sprintf (histo, "HcalRecHitTask_energy_ecal_plus_hcal_in_cone_HE");
00447 meEcalHcalEnergyConeHE = dbe_->book1D(histo,histo, 60,-20., 280.);
00448 }
00449 }
00450 }
00451
00452 sprintf (histo, "HcalRecHitTask_energy_of_rechits_HE" ) ;
00453 meRecHitsEnergyHE = dbe_->book1D(histo, histo, 510, -10., 500.);
00454
00455 sprintf (histo, "HcalRecHitTask_timing_HE" ) ;
00456 meTimeHE = dbe_->book1D(histo, histo, 200 , -100. , 100.);
00457
00458 sprintf (histo, "HcalRecHitTask_timing_vs_energy_HE" ) ;
00459 meTE_HE = dbe_->book2D(histo, histo, 200, -5., 95., 220, -10., 100.);
00460
00461 sprintf (histo, "HcalRecHitTask_timing_vs_energy_HE_depth1" ) ;
00462 meTE_HE1 = dbe_->book2D(histo, histo, 200, -5., 95., 220, -10., 100.);
00463
00464 sprintf (histo, "HcalRecHitTask_timing_vs_energy_HE_depth2" ) ;
00465 meTE_HE2 = dbe_->book2D(histo, histo, 200, -5., 95., 220, -10., 100.);
00466
00467 sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_HE" ) ;
00468 meTEprofileHE = dbe_->bookProfile(histo, histo, 100, -5., 95., 110, -10., 100.);
00469
00470 if(imc != 0) {
00471 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_HE");
00472 meRecHitSimHitHE = dbe_->book2D(histo, histo, 120, 0., 0.6, 300, 0., 150.);
00473 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_profile_HE");
00474 meRecHitSimHitProfileHE = dbe_->bookProfile(histo, histo, 120, 0., 0.6, 500, 0., 500.);
00475 }
00476
00477 }
00478
00479
00480 if ( subdet_ == 3 || subdet_ == 5 ){
00481
00482 if(etype_ == 1 && subdet_ == 3) {
00483 if (imc != 0) {
00484 sprintf (histo, "HcalRecHitTask_number_of_rechits_in_cone_HO" ) ;
00485 meNumRecHitsConeHO = dbe_->book1D(histo, histo, 100, 0 , 100.);
00486
00487 sprintf (histo, "HcalRecHitTask_sum_of_rechits_energy_in_cone_HO" ) ;
00488 meSumRecHitsEnergyConeHO = dbe_->book1D(histo,histo, 80 ,-20., 380.);
00489 }
00490
00491 sprintf (histo, "HcalRecHitTask_number_of_rechits_above_1GeV_HO");
00492 meNumRecHitsThreshHO = dbe_->book1D(histo, histo, 30, 0., 30.);
00493
00494 sprintf (histo, "HcalRecHitTask_sum_of_rechits_energy_HO" ) ;
00495 meSumRecHitsEnergyHO = dbe_->book1D(histo,histo, 80 , -20., 380.);
00496
00497 }
00498
00499 sprintf (histo, "HcalRecHitTask_energy_of_rechits_HO" ) ;
00500 meRecHitsEnergyHO = dbe_->book1D(histo, histo, 510 , -10. , 500.);
00501
00502 sprintf (histo, "HcalRecHitTask_timing_HO" ) ;
00503 meTimeHO = dbe_->book1D(histo, histo, 2000 , -100., 100.);
00504
00505 sprintf (histo, "HcalRecHitTask_timing_vs_energy_HO" ) ;
00506 meTE_HO= dbe_->book2D(histo, histo, 300, -5., 295., 110, -10., 100.);
00507
00508 sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_HO" ) ;
00509 meTEprofileHO = dbe_->bookProfile(histo, histo, 300, -5., 295., 110, -10., 100.);
00510
00511 if(imc != 0) {
00512 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_HO");
00513 meRecHitSimHitHO = dbe_->book2D(histo, histo, 150, 0., 1.5, 350, 0., 350.);
00514 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_profile_HO");
00515 meRecHitSimHitProfileHO = dbe_->bookProfile(histo, histo, 150, 0., 1.5, 500, 0., 500.);
00516 }
00517 }
00518
00519
00520 if ( subdet_ == 4 || subdet_ == 5 ){
00521
00522 if(etype_ == 1 && subdet_ == 4) {
00523
00524 if(imc != 0) {
00525 sprintf (histo, "HcalRecHitTask_number_of_rechits_in_cone_HF" ) ;
00526 meNumRecHitsConeHF = dbe_->book1D(histo, histo, 30, 0 , 30.);
00527
00528 sprintf (histo, "HcalRecHitTask_sum_of_rechits_energy_in_cone_HF" ) ;
00529 meSumRecHitsEnergyConeHF = dbe_->book1D(histo,histo,100, -20., 180.);
00530
00531 sprintf (histo, "HcalRecHitTask_sum_of_rechits_energy_in_cone_HFL" );
00532 meSumRecHitsEnergyConeHFL = dbe_->book1D(histo,histo,100,-20., 180.);
00533
00534 sprintf (histo, "HcalRecHitTask_sum_of_rechits_energy_in_cone_HFS");
00535 meSumRecHitsEnergyConeHFS = dbe_->book1D(histo,histo,100,-20., 180.);
00536 }
00537
00538 sprintf (histo, "HcalRecHitTask_sum_of_rechits_energy_HF" ) ;
00539 meSumRecHitsEnergyHF = dbe_->book1D(histo,histo, 80 , -20., 380.);
00540
00541 }
00542
00543 sprintf (histo, "HcalRecHitTask_energy_of_rechits_HF" ) ;
00544 meRecHitsEnergyHF = dbe_->book1D(histo, histo, 1010 , -10. , 1000.);
00545
00546 sprintf (histo, "HcalRecHitTask_timing_HF" ) ;
00547 meTimeHF = dbe_->book1D(histo, histo, 2000 , -100. , 100.);
00548
00549 sprintf (histo, "HcalRecHitTask_timing_vs_energy_HF" ) ;
00550 meTE_HF = dbe_->book2D(histo, histo, 200, -5., 95., 220, -10., 100.);
00551
00552 sprintf (histo, "HcalRecHitTask_timing_vs_energy_HFL" ) ;
00553 meTE_HFL = dbe_->book2D(histo, histo, 200, -5., 95., 220, -10., 100.);
00554
00555 sprintf (histo, "HcalRecHitTask_timing_vs_energy_HFS" ) ;
00556 meTE_HFS = dbe_->book2D(histo, histo, 200, -5., 95., 220, -10., 100.);
00557
00558 sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_HF" ) ;
00559 meTEprofileHF = dbe_->bookProfile(histo, histo, 100, -5., 95., 110, -10., 100.);
00560
00561 if(imc != 0) {
00562 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_HF");
00563 meRecHitSimHitHF = dbe_->book2D(histo, histo, 30, 0., 30., 200, 0., 200.);
00564 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_HFL");
00565 meRecHitSimHitHFL = dbe_->book2D(histo, histo, 30, 0., 30., 200, 0., 200.);
00566 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_HFS");
00567 meRecHitSimHitHFS = dbe_->book2D(histo, histo, 30, 0., 30., 200, 0., 200.);
00568 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_profile_HF");
00569 meRecHitSimHitProfileHF = dbe_->bookProfile(histo, histo, 30, 0., 30., 500, 0., 500.);
00570 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_profile_HFL");
00571 meRecHitSimHitProfileHFL = dbe_->bookProfile(histo, histo, 30, 0., 30., 500, 0., 500.);
00572 sprintf (histo, "HcalRecHitTask_energy_rechits_vs_simhits_profile_HFS");
00573 meRecHitSimHitProfileHFS = dbe_->bookProfile(histo, histo, 30, 0., 30., 500, 0., 500.);
00574 }
00575 }
00576 }
00577
00578 }
00579
00580
00581 HcalRecHitsValidation::~HcalRecHitsValidation() {
00582
00583
00584 if (hcalselector_ == "ZS" ) {
00585
00586 for (unsigned int i1 = 0; i1 < 82; i1++) {
00587 for (unsigned int i2 = 0; i2 < 72; i2++) {
00588
00589 int index = (i1-41) * 72 + i2;
00590
00591 double e = emap_min[i1][i2][0][0];
00592 if( e < 10000.) {
00593 ZS_HB1->Fill(e);
00594 ZS_seqHB1->Fill(double(index),e);
00595 }
00596 e = emap_min[i1][i2][1][0];
00597 if( e < 10000.) {
00598 ZS_HB2->Fill(e);
00599 ZS_seqHB2->Fill(double(index),e);
00600 }
00601
00602 e = emap_min[i1][i2][0][1];
00603 if( e < 10000.) {
00604 ZS_HE1->Fill(e);
00605 ZS_seqHE1->Fill(double(index),e);
00606 }
00607 e = emap_min[i1][i2][1][1];
00608 if( e < 10000.) {
00609 ZS_HE2->Fill(e);
00610 ZS_seqHE2->Fill(double(index),e);
00611 }
00612 e = emap_min[i1][i2][2][1];
00613 if( e < 10000.) {
00614 ZS_HE3->Fill(e);
00615 ZS_seqHE3->Fill(double(index),e);
00616 }
00617
00618
00619 e = emap_min[i1][i2][3][2];
00620 if( e < 10000.) {
00621 ZS_HO->Fill(e);
00622 ZS_seqHO->Fill(double(index),e);
00623 }
00624
00625 e = emap_min[i1][i2][0][3];
00626 if( e < 10000.) {
00627 ZS_HF1->Fill(e);
00628 ZS_seqHF1->Fill(double(index),e);
00629 }
00630
00631 e = emap_min[i1][i2][1][3];
00632 if( e < 10000.) {
00633 ZS_HF2->Fill(e);
00634 ZS_seqHF2->Fill(double(index),e);
00635 }
00636
00637 for (unsigned int i3 = 0; i3 < 4; i3++) {
00638 double emin = 100000.;
00639 for (unsigned int i4 = 0; i4 < 4; i4++) {
00640
00641
00642
00643
00644
00645
00646 if ( emin > emap_min [i1][i2][i3][i4])
00647 emin = emap_min [i1][i2][i3][i4];
00648 }
00649
00650 int ieta = i1-41;
00651 if( i3 == 0 && emin < 10000.) {
00652 map_depth1->Fill(double(ieta),double(i2),emin);
00653
00654
00655
00656
00657 }
00658 if( i3 == 1 && emin < 10000.)
00659 map_depth2->Fill(double(ieta),double(i2),emin);
00660 if( i3 == 2 && emin < 10000.)
00661 map_depth3->Fill(double(ieta),double(i2),emin);
00662 if( i3 == 3 && emin < 10000.)
00663 map_depth4->Fill(double(ieta),double(i2),emin);
00664 }
00665 }
00666 }
00667 }
00668
00669
00670 else {
00671
00672 int nx = emap_HB1->getNbinsX();
00673 int ny = emap_HB1->getNbinsY();
00674 float cnorm;
00675 float fev = float (nevtot);
00676
00677
00678 float sumphi_hb1, sumphi_hb2, sumphi_he1, sumphi_he2, sumphi_he3,
00679 sumphi_ho, sumphi_hf1, sumphi_hf2;
00680
00681
00682
00683
00684 float phi_factor;
00685
00686 for (int i = 1; i <= nx; i++) {
00687 sumphi_hb1 = 0.;
00688 sumphi_hb2 = 0.;
00689 sumphi_he1 = 0.;
00690 sumphi_he2 = 0.;
00691 sumphi_he3 = 0.;
00692 sumphi_ho = 0.;
00693 sumphi_hf1 = 0.;
00694 sumphi_hf2 = 0.;
00695
00696 for (int j = 1; j <= ny; j++) {
00697
00698 int index = (i-42) * ny + j-1;
00699
00700
00701 cnorm = emap_HB1->getBinContent(i,j) / fev;
00702 emap_HB1->setBinContent(i,j,cnorm);
00703 cnorm = emap_HB2->getBinContent(i,j) / fev;
00704 emap_HB2->setBinContent(i,j,cnorm);
00705 cnorm = emap_HE1->getBinContent(i,j) / fev;
00706 emap_HE1->setBinContent(i,j,cnorm);
00707 cnorm = emap_HE2->getBinContent(i,j) / fev;
00708 emap_HE2->setBinContent(i,j,cnorm);
00709 cnorm = emap_HE3->getBinContent(i,j) / fev;
00710 emap_HE3->setBinContent(i,j,cnorm);
00711 cnorm = emap_HO->getBinContent(i,j) / fev;
00712 emap_HO->setBinContent(i,j,cnorm);
00713 cnorm = emap_HF1->getBinContent(i,j) / fev;
00714 emap_HF1->setBinContent(i,j,cnorm);
00715 cnorm = emap_HF2->getBinContent(i,j) / fev;
00716 emap_HF2->setBinContent(i,j,cnorm);
00717
00718
00719 cnorm = occupancy_map_HB1->getBinContent(i,j) / fev;
00720 occupancy_map_HB1->setBinContent(i,j,cnorm);
00721 occupancy_seqHB1->Fill(double(index),cnorm);
00722
00723
00724
00725
00726
00727
00728
00729 cnorm = occupancy_map_HB2->getBinContent(i,j) / fev;
00730 occupancy_map_HB2->setBinContent(i,j,cnorm);
00731 occupancy_seqHB2->Fill(double(index),cnorm);
00732 cnorm = occupancy_map_HE1->getBinContent(i,j) / fev;
00733 occupancy_map_HE1->setBinContent(i,j,cnorm);
00734 occupancy_seqHE1->Fill(double(index),cnorm);
00735 cnorm = occupancy_map_HE2->getBinContent(i,j) / fev;
00736 occupancy_map_HE2->setBinContent(i,j,cnorm);
00737 occupancy_seqHE2->Fill(double(index),cnorm);
00738 cnorm = occupancy_map_HE3->getBinContent(i,j) / fev;
00739 occupancy_map_HE3->setBinContent(i,j,cnorm);
00740 occupancy_seqHE3->Fill(double(index),cnorm);
00741 cnorm = occupancy_map_HO->getBinContent(i,j) / fev;
00742 occupancy_map_HO->setBinContent(i,j,cnorm);
00743 occupancy_seqHO->Fill(double(index),cnorm);
00744 cnorm = occupancy_map_HF1->getBinContent(i,j) / fev;
00745 occupancy_map_HF1->setBinContent(i,j,cnorm);
00746 occupancy_seqHF1->Fill(double(index),cnorm);
00747 cnorm = occupancy_map_HF2->getBinContent(i,j) / fev;
00748 occupancy_map_HF2->setBinContent(i,j,cnorm);
00749 occupancy_seqHF2->Fill(double(index),cnorm);
00750
00751 sumphi_hb1 += occupancy_map_HB1->getBinContent(i,j);
00752 sumphi_hb2 += occupancy_map_HB2->getBinContent(i,j);
00753 sumphi_he1 += occupancy_map_HE1->getBinContent(i,j);
00754 sumphi_he2 += occupancy_map_HE2->getBinContent(i,j);
00755 sumphi_he3 += occupancy_map_HE3->getBinContent(i,j);
00756 sumphi_ho += occupancy_map_HO->getBinContent(i,j);
00757 sumphi_hf1 += occupancy_map_HF1->getBinContent(i,j);
00758 sumphi_hf2 += occupancy_map_HF2->getBinContent(i,j);
00759 }
00760
00761 int ieta = i - 42;
00762 if(ieta >=0 ) ieta +=1;
00763
00764 if(ieta >= -20 && ieta <= 20 )
00765 {phi_factor = 72.;}
00766 else {
00767 if(ieta >= 40 || ieta <= -40 ) {phi_factor = 18.;}
00768 else
00769 phi_factor = 36.;
00770 }
00771 if(ieta >= 0) ieta -= 1;
00772
00773
00774
00775
00776
00777
00778
00779
00780 cnorm = sumphi_hb1 / phi_factor;
00781 occupancy_vs_ieta_HB1->Fill(float(ieta), cnorm);
00782 cnorm = sumphi_hb2 / phi_factor;
00783 occupancy_vs_ieta_HB2->Fill(float(ieta), cnorm);
00784 cnorm = sumphi_he1 / phi_factor;
00785 occupancy_vs_ieta_HE1->Fill(float(ieta), cnorm);
00786 cnorm = sumphi_he2 / phi_factor;
00787 occupancy_vs_ieta_HE2->Fill(float(ieta), cnorm);
00788 cnorm = sumphi_he3 / phi_factor;
00789 occupancy_vs_ieta_HE3->Fill(float(ieta), cnorm);
00790 cnorm = sumphi_ho / phi_factor;
00791 occupancy_vs_ieta_HO->Fill(float(ieta), cnorm);
00792 cnorm = sumphi_hf1 / phi_factor;
00793 occupancy_vs_ieta_HF1->Fill(float(ieta), cnorm);
00794 cnorm = sumphi_hf2 / phi_factor;
00795 occupancy_vs_ieta_HF2->Fill(float(ieta), cnorm);
00796
00797
00798
00799 cnorm = emean_vs_ieta_HB1->getBinError(i);
00800 RMS_vs_ieta_HB1->Fill(ieta,cnorm);
00801 cnorm = emean_vs_ieta_HB2->getBinError(i);
00802 RMS_vs_ieta_HB2->Fill(ieta,cnorm);
00803 cnorm = emean_vs_ieta_HE1->getBinError(i);
00804 RMS_vs_ieta_HE1->Fill(ieta,cnorm);
00805 cnorm = emean_vs_ieta_HE2->getBinError(i);
00806 RMS_vs_ieta_HE2->Fill(ieta,cnorm);
00807 cnorm = emean_vs_ieta_HE1->getBinError(i);
00808 RMS_vs_ieta_HE3->Fill(ieta,cnorm);
00809 cnorm = emean_vs_ieta_HB1->getBinError(i);
00810 RMS_vs_ieta_HO->Fill(ieta,cnorm);
00811 cnorm = emean_vs_ieta_HB1->getBinError(i);
00812 RMS_vs_ieta_HF1->Fill(ieta,cnorm);
00813 cnorm = emean_vs_ieta_HB1->getBinError(i);
00814 RMS_vs_ieta_HF2->Fill(ieta,cnorm);
00815
00816
00817 }
00818
00819
00820
00821 nx = emean_seqHB1->getNbinsX();
00822 for(int ibin = 1; ibin <= nx; ibin++ ){
00823 cnorm = emean_seqHB1->getBinError(ibin);
00824 RMS_seq_HB1->setBinContent(ibin, cnorm);
00825 cnorm = emean_seqHB2->getBinError(ibin);
00826 RMS_seq_HB2->setBinContent(ibin, cnorm);
00827 cnorm = emean_seqHO->getBinError(ibin);
00828 RMS_seq_HO->setBinContent(ibin, cnorm);
00829 }
00830 nx = emean_seqHE1->getNbinsX();
00831 for(int ibin = 1; ibin <= nx; ibin++ ){
00832 cnorm = emean_seqHE1->getBinError(ibin);
00833 RMS_seq_HE1->setBinContent(ibin, cnorm);
00834 cnorm = emean_seqHE2->getBinError(ibin);
00835 RMS_seq_HE2->setBinContent(ibin, cnorm);
00836 cnorm = emean_seqHE3->getBinError(ibin);
00837 RMS_seq_HE3->setBinContent(ibin, cnorm);
00838 }
00839 nx = emean_seqHF1->getNbinsX();
00840 for(int ibin = 1; ibin <= nx; ibin++ ){
00841 cnorm = emean_seqHF1->getBinError(ibin);
00842 RMS_seq_HF1->setBinContent(ibin, cnorm);
00843 cnorm = emean_seqHF2->getBinError(ibin);
00844 RMS_seq_HF2->setBinContent(ibin, cnorm);
00845 }
00846
00847 }
00848
00849 if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
00850
00851 }
00852
00853 void HcalRecHitsValidation::endJob() { }
00854
00855 void HcalRecHitsValidation::beginJob(const edm::EventSetup& c){ }
00856
00857 void HcalRecHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& c) {
00858
00859 using namespace edm;
00860
00861
00862
00863
00864
00865 double eHcal = 0.;
00866 double eHcalCone = 0.;
00867 double eHcalConeHB = 0.;
00868 double eHcalConeHE = 0.;
00869 double eHcalConeHO = 0.;
00870 double eHcalConeHF = 0.;
00871 double eHcalConeHFL = 0.;
00872 double eHcalConeHFS = 0.;
00873
00874 int nrechits = 0;
00875 int nrechitsCone = 0;
00876 int nrechitsThresh = 0;
00877
00878
00879 double eEcal = 0.;
00880 double eEcalB = 0.;
00881 double eEcalE = 0.;
00882 double eEcalCone = 0.;
00883 int numrechitsEcal = 0;
00884
00885
00886 double phi_MC = -999999.;
00887 double eta_MC = -999999.;
00888 bool MC = false;
00889
00890
00891 double partR = 0.3;
00892 double ehcal_coneMC_1 = 0.;
00893 double ehcal_coneMC_2 = 0.;
00894 double ehcal_coneMC_3 = 0.;
00895 double ehcal_coneMC_4 = 0.;
00896
00897
00898 double searchR = 1.0;
00899 double eps = 0.001;
00900
00901
00902
00903 double etaHot = 99999.;
00904 double phiHot = 99999.;
00905 int ietahot = 1000;
00906 int iphihot = 1000;
00907
00908
00909
00910
00911
00912
00913 if(imc != 0) {
00914
00915 edm::Handle<edm::HepMCProduct> evtMC;
00916
00917 ev.getByLabel("source",evtMC);
00918 if (!evtMC.isValid()) {
00919 std::cout << "no HepMCProduct found" << std::endl;
00920 } else {
00921 MC=true;
00922
00923 }
00924
00925
00926 double maxPt = -99999.;
00927 int npart = 0;
00928 HepMC::GenEvent * myGenEvent = new HepMC::GenEvent(*(evtMC->GetEvent()));
00929 for ( HepMC::GenEvent::particle_iterator p = myGenEvent->particles_begin();
00930 p != myGenEvent->particles_end(); ++p ) {
00931 double phip = (*p)->momentum().phi();
00932 double etap = (*p)->momentum().eta();
00933
00934
00935 double pt = (*p)->momentum().perp();
00936 if(pt > maxPt) { npart++; maxPt = pt; phi_MC = phip; eta_MC = etap; }
00937 }
00938
00939
00940 }
00941
00942
00943
00944 c.get<CaloGeometryRecord>().get (geometry);
00945
00946
00947
00948 fillRecHitsTmp(subdet_, ev);
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958 if(ecalselector_ == "yes" && (subdet_ == 1 || subdet_ == 2 || subdet_ == 5)) {
00959 Handle<EBRecHitCollection> rhitEB;
00960
00961 if(famos_)
00962 ev.getByLabel("caloRecHits","EcalRecHitsEB", rhitEB);
00963 else
00964 ev.getByLabel("ecalRecHit","EcalRecHitsEB", rhitEB);
00965
00966 EcalRecHitCollection::const_iterator RecHit = rhitEB.product()->begin();
00967 EcalRecHitCollection::const_iterator RecHitEnd = rhitEB.product()->end();
00968
00969 for (; RecHit != RecHitEnd ; ++RecHit) {
00970 EBDetId EBid = EBDetId(RecHit->id());
00971
00972 const CaloCellGeometry* cellGeometry =
00973 geometry->getSubdetectorGeometry (EBid)->getGeometry (EBid) ;
00974 double eta = cellGeometry->getPosition ().eta () ;
00975 double phi = cellGeometry->getPosition ().phi () ;
00976 double en = RecHit->energy();
00977 eEcal += en;
00978 eEcalB += en;
00979
00980 map_ecal->Fill(eta, phi, en);
00981
00982 double r = dR(eta_MC, phi_MC, eta, phi);
00983 if( r < partR) {
00984 eEcalCone += en;
00985 numrechitsEcal++;
00986 }
00987 }
00988
00989
00990 Handle<EERecHitCollection> rhitEE;
00991
00992 if(famos_)
00993 ev.getByLabel("caloRecHits", "EcalRecHitsEE", rhitEE );
00994 else
00995 ev.getByLabel("ecalRecHit","EcalRecHitsEE", rhitEE);
00996
00997 RecHit = rhitEE.product()->begin();
00998 RecHitEnd = rhitEE.product()->end();
00999
01000 for (; RecHit != RecHitEnd ; ++RecHit) {
01001 EEDetId EEid = EEDetId(RecHit->id());
01002
01003 const CaloCellGeometry* cellGeometry =
01004 geometry->getSubdetectorGeometry (EEid)->getGeometry (EEid) ;
01005 double eta = cellGeometry->getPosition ().eta () ;
01006 double phi = cellGeometry->getPosition ().phi () ;
01007 double en = RecHit->energy();
01008 eEcal += en;
01009 eEcalE += en;
01010
01011 map_ecal->Fill(eta, phi, en);
01012
01013 double r = dR(eta_MC, phi_MC, eta, phi);
01014 if( r < partR) {
01015 eEcalCone += en;
01016 numrechitsEcal++;
01017 }
01018 }
01019 }
01020
01021
01022
01023
01024
01025
01026
01027 double maxE = -99999.;
01028
01029 int nhb1 = 0;
01030 int nhb2 = 0;
01031 int nhe1 = 0;
01032 int nhe2 = 0;
01033 int nhe3 = 0;
01034 int nho = 0;
01035 int nhf1 = 0;
01036 int nhf2 = 0;
01037
01038 for (unsigned int i = 0; i < cen.size(); i++) {
01039
01040 int sub = csub[i];
01041 int depth = cdepth[i];
01042 int ieta = cieta[i];
01043 int iphi = ciphi[i];
01044 double en = cen[i];
01045 double eta = ceta[i];
01046 double phi = cphi[i];
01047
01048
01049 int index = ieta * 72 + iphi;
01050
01051
01052
01053
01054
01055
01056
01057
01058 if( sub == 1 && depth == 1) nhb1++;
01059 if( sub == 1 && depth == 2) nhb2++;
01060 if( sub == 2 && depth == 1) nhe1++;
01061 if( sub == 2 && depth == 2) nhe2++;
01062 if( sub == 2 && depth == 3) nhe3++;
01063 if( sub == 3 && depth == 4) nho++;
01064 if( sub == 4 && depth == 1) nhf1++;
01065 if( sub == 4 && depth == 2) nhf2++;
01066
01067 if( subdet_ == 6) {
01068 if( en < emap_min[ieta+41][iphi][depth-1][sub-1] )
01069 emap_min[ieta+41][iphi][depth-1][sub-1] = en;
01070 }
01071
01072 double emin = 1.;
01073 if(fabs(eta) > 3.) emin = 5.;
01074
01075 double r = dR(eta_MC, phi_MC, eta, phi);
01076 if( r < searchR ) {
01077 if(maxE < en && en > emin) {
01078 maxE = en;
01079 etaHot = eta;
01080 phiHot = phi;
01081 ietahot = ieta;
01082 iphihot = iphi;
01083 }
01084 }
01085
01086
01087
01088
01089
01090
01091
01092
01093 if( subdet_ != 6) {
01094
01095
01096
01097 if (depth == 1 && sub == 1 ) {
01098 emap_HB1->Fill(double(ieta), double(iphi), en);
01099 emean_vs_ieta_HB1->Fill(double(ieta), en);
01100 occupancy_map_HB1->Fill(double(ieta), double(iphi));
01101 emean_seqHB1->Fill(double(index), en);
01102 }
01103 if (depth == 2 && sub == 1) {
01104 emap_HB2->Fill(double(ieta), double(iphi), en);
01105 emean_vs_ieta_HB2->Fill(double(ieta), en);
01106 occupancy_map_HB2->Fill(double(ieta), double(iphi));
01107 emean_seqHB2->Fill(double(index), en);
01108 }
01109 if (depth == 1 && sub == 2) {
01110 emap_HE1->Fill(double(ieta), double(iphi), en);
01111 emean_vs_ieta_HE1->Fill(double(ieta), en);
01112 occupancy_map_HE1->Fill(double(ieta), double(iphi));
01113 emean_seqHE1->Fill(double(index), en);
01114 }
01115 if (depth == 2 && sub == 2) {
01116 emap_HE2->Fill(double(ieta), double(iphi), en);
01117 emean_vs_ieta_HE2->Fill(double(ieta), en);
01118 occupancy_map_HE2->Fill(double(ieta), double(iphi));
01119 emean_seqHE2->Fill(double(index), en);
01120 }
01121 if (depth == 3 && sub == 2) {
01122 emap_HE3->Fill(double(ieta), double(iphi), en);
01123 emean_vs_ieta_HE3->Fill(double(ieta), en);
01124 occupancy_map_HE3->Fill(double(ieta), double(iphi));
01125 emean_seqHE3->Fill(double(index), en);
01126 }
01127 if (depth == 4 ) {
01128 emap_HO->Fill(double(ieta), double(iphi), en);
01129 emean_vs_ieta_HO->Fill(double(ieta), en);
01130 occupancy_map_HO->Fill(double(ieta), double(iphi));
01131 emean_seqHO->Fill(double(index), en);
01132 }
01133 if (depth == 1 && sub == 4) {
01134 emap_HF1->Fill(double(ieta), double(iphi), en);
01135 emean_vs_ieta_HF1->Fill(double(ieta), en);
01136 occupancy_map_HF1->Fill(double(ieta), double(iphi));
01137 emean_seqHF1->Fill(double(index), en);
01138 }
01139 if (depth == 2 && sub == 4) {
01140 emap_HF2->Fill(double(ieta), double(iphi), en);
01141 emean_vs_ieta_HF2->Fill(double(ieta), en);
01142 occupancy_map_HF2->Fill(double(ieta), double(iphi));
01143 emean_seqHF2->Fill(double(index), en);
01144 }
01145 }
01146
01147
01148 if( r < partR ) {
01149 if (depth == 1) ehcal_coneMC_1 += en;
01150 if (depth == 2) ehcal_coneMC_2 += en;
01151 if (depth == 3) ehcal_coneMC_3 += en;
01152 if (depth == 4) ehcal_coneMC_4 += en;
01153 }
01154
01155 }
01156
01157
01158
01159 if( subdet_ == 6) {
01160 ZS_nHB1->Fill(double(nhb1));
01161 ZS_nHB2->Fill(double(nhb2));
01162 ZS_nHE1->Fill(double(nhe1));
01163 ZS_nHE2->Fill(double(nhe2));
01164 ZS_nHE3->Fill(double(nhe3));
01165 ZS_nHO ->Fill(double(nho));
01166 ZS_nHF1->Fill(double(nhf1));
01167 ZS_nHF2->Fill(double(nhf2));
01168 }
01169 else{
01170 Nhb->Fill(double(nhb1 + nhb2));
01171 Nhe->Fill(double(nhe1 + nhe2 + nhe3));
01172 Nho->Fill(double(nho));
01173 Nhf->Fill(double(nhf1 + nhf2));
01174
01175 if(imc != 0) {
01176 map_econe_depth1->Fill(eta_MC, phi_MC, ehcal_coneMC_1);
01177 map_econe_depth2->Fill(eta_MC, phi_MC, ehcal_coneMC_2);
01178 map_econe_depth3->Fill(eta_MC, phi_MC, ehcal_coneMC_3);
01179 map_econe_depth4->Fill(eta_MC, phi_MC, ehcal_coneMC_4);
01180 }
01181 }
01182
01183
01184
01185
01186
01187
01188 if (hcalselector_ == "noise") {
01189 for (unsigned int i = 0; i < cen.size(); i++) {
01190
01191 int sub = csub[i];
01192 int depth = cdepth[i];
01193 double en = cen[i];
01194
01195 if (sub == 1) e_hb->Fill(en);
01196 if (sub == 2) e_he->Fill(en);
01197 if (sub == 3) e_ho->Fill(en);
01198 if (sub == 4) {
01199 if(depth == 1)
01200 e_hfl->Fill(en);
01201 else
01202 e_hfs->Fill(en);
01203 }
01204 }
01205 }
01206
01207
01208
01209
01210
01211 else if ((subdet_ != 6) && (subdet_ != 0)) {
01212
01213
01214
01215
01216 double clusEta = 999.;
01217 double clusPhi = 999.;
01218 double clusEn = 0.;
01219
01220 double HcalCone_d1 = 0.;
01221 double HcalCone_d2 = 0.;
01222 double HcalCone_d3 = 0.;
01223 double HcalCone_d4 = 0.;
01224 double HcalCone = 0.;
01225
01226 int ietaMax1 = 9999;
01227 int ietaMax2 = 9999;
01228 int ietaMax3 = 9999;
01229 int ietaMax4 = 9999;
01230 int ietaMax = 9999;
01231 double enMax1 = -9999.;
01232 double enMax2 = -9999.;
01233 double enMax3 = -9999.;
01234 double enMax4 = -9999.;
01235 double enMax = -9999.;
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246 for (unsigned int i = 0; i < cen.size(); i++) {
01247 int sub = csub[i];
01248 int depth = cdepth[i];
01249 double eta = ceta[i];
01250 double phi = cphi[i];
01251 double en = cen[i];
01252 double t = ctime[i];
01253 int ieta = cieta[i];
01254
01255 double rhot = dR(etaHot, phiHot, eta, phi);
01256 if(rhot < partR && en > 1.) {
01257 clusEta = (clusEta * clusEn + eta * en)/(clusEn + en);
01258 clusPhi = phi12(clusPhi, clusEn, phi, en);
01259 clusEn += en;
01260 }
01261
01262 nrechits++;
01263 eHcal += en;
01264 if(en > 1. ) nrechitsThresh++;
01265
01266 double r = dR(eta_MC, phi_MC, eta, phi);
01267 if( r < partR ){
01268 if(sub == 1) eHcalConeHB += en;
01269 if(sub == 2) eHcalConeHE += en;
01270 if(sub == 3) eHcalConeHO += en;
01271 if(sub == 4) {
01272 eHcalConeHF += en;
01273 if (depth == 1) eHcalConeHFL += en;
01274 else eHcalConeHFS += en;
01275 }
01276 eHcalCone += en;
01277 nrechitsCone++;
01278
01279
01280 if(depth == 1) {
01281 HcalCone_d1 += en;
01282 if(enMax1 < en) {
01283 enMax1 = en;
01284 ietaMax1 = ieta;
01285 }
01286 }
01287 if(depth == 2) {
01288 HcalCone_d2 += en;
01289 if(enMax2 < en) {
01290 enMax2 = en;
01291 ietaMax2 = ieta;
01292 }
01293 }
01294 if(depth == 3) {
01295 HcalCone_d3 += en;
01296 if(enMax3 < en) {
01297 enMax3 = en;
01298 ietaMax3 = ieta;
01299 }
01300 }
01301 if(depth == 4) {
01302 HcalCone_d4 += en;
01303 if(enMax4 < en) {
01304 enMax4 = en;
01305 ietaMax4 = ieta;
01306 }
01307 }
01308
01309 HcalCone += en;
01310 if(enMax < en) {
01311 enMax = en;
01312 ietaMax = ieta;
01313 }
01314
01315
01316
01317 }
01318
01319 if(sub == 1 && (subdet_ == 1 || subdet_ == 5)) {
01320 meTimeHB->Fill(t);
01321 meRecHitsEnergyHB->Fill(en);
01322 meTE_HB->Fill( en, t);
01323 if(depth == 1) meTE_HB1->Fill( en, t);
01324 else if(depth == 2) meTE_HB2->Fill( en, t);
01325 meTEprofileHB->Fill(en, t);
01326 }
01327
01328 if(sub == 2 && (subdet_ == 2 || subdet_ == 5)) {
01329 meTimeHE->Fill(t);
01330 meRecHitsEnergyHE->Fill(en);
01331 meTE_HE->Fill( en, t);
01332 if(depth == 1) meTE_HE1->Fill( en, t);
01333 else if(depth == 2) meTE_HE2->Fill( en, t);
01334 meTEprofileHE->Fill(en, t);
01335 }
01336
01337 if(sub == 4 && (subdet_ == 4 || subdet_ == 5)) {
01338 meTimeHF->Fill(t);
01339 meTE_HF->Fill(en, t);
01340 if(depth == 1) meTE_HFL->Fill( en, t);
01341 else meTE_HFS->Fill( en, t);
01342 meTEprofileHF->Fill(en, t);
01343 meRecHitsEnergyHF->Fill(en);
01344 }
01345
01346 if(sub == 3 && (subdet_ == 3 || subdet_ == 5)) {
01347 meTimeHO->Fill(t);
01348 meRecHitsEnergyHO->Fill(en);
01349 meTE_HO->Fill( en, t);
01350 meTEprofileHO->Fill(en, t);
01351 }
01352 }
01353
01354 if(imc != 0) {
01355 meEnConeEtaProfile_depth1->Fill(double(ietaMax1), HcalCone_d1);
01356 meEnConeEtaProfile_depth2->Fill(double(ietaMax2), HcalCone_d2);
01357 meEnConeEtaProfile_depth3->Fill(double(ietaMax3), HcalCone_d3);
01358 meEnConeEtaProfile_depth4->Fill(double(ietaMax4), HcalCone_d4);
01359 meEnConeEtaProfile ->Fill(double(ietaMax), HcalCone);
01360 }
01361
01362
01363
01364
01365
01366
01367
01368 if(etype_ == 1) {
01369
01370
01371
01372
01373
01374
01375
01376
01377 double phidev = dPhiWsign(clusPhi, phi_MC);
01378 meDeltaPhi->Fill(eta_MC, phidev);
01379 double etadev = clusEta - eta_MC;
01380 meDeltaEta->Fill(eta_MC, etadev);
01381
01382 if(subdet_ == 1) {
01383 meSumRecHitsEnergyHB->Fill(eHcal);
01384 if(imc != 0) meSumRecHitsEnergyConeHB->Fill(eHcalConeHB);
01385 if(imc != 0) meNumRecHitsConeHB->Fill(double(nrechitsCone));
01386 meNumRecHitsThreshHB->Fill(double(nrechitsThresh));
01387 }
01388
01389 if(subdet_ == 2) {
01390 meSumRecHitsEnergyHE->Fill(eHcal);
01391 if(imc != 0) meSumRecHitsEnergyConeHE->Fill(eHcalConeHE);
01392 if(imc != 0) meNumRecHitsConeHE->Fill(double(nrechitsCone));
01393 meNumRecHitsThreshHE->Fill(double(nrechitsThresh));
01394 }
01395
01396 if(subdet_ == 3) {
01397 meSumRecHitsEnergyHO->Fill(eHcal);
01398 if(imc != 0) meSumRecHitsEnergyConeHO->Fill(eHcalConeHO);
01399 if(imc != 0) meNumRecHitsConeHO->Fill(double(nrechitsCone));
01400 meNumRecHitsThreshHO->Fill(double(nrechitsThresh));
01401 }
01402
01403 if(subdet_ == 4) {
01404 if(eHcalConeHF > eps ) {
01405 meSumRecHitsEnergyHF ->Fill(eHcal);
01406 if(imc != 0) {
01407 meSumRecHitsEnergyConeHF ->Fill(eHcalConeHF);
01408 meNumRecHitsConeHF->Fill(double(nrechitsCone));
01409 meSumRecHitsEnergyConeHFL ->Fill(eHcalConeHFL);
01410 meSumRecHitsEnergyConeHFS ->Fill(eHcalConeHFS);
01411 }
01412 }
01413 }
01414
01415
01416
01417
01418
01419 if(subdet_ == 1 && ecalselector_ == "yes") {
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431 meEcalHcalEnergyHB->Fill(eEcalB+eHcal);
01432 meEcalHcalEnergyConeHB->Fill(eEcalCone+eHcalCone);
01433 meNumEcalRecHitsConeHB->Fill(double(numrechitsEcal));
01434
01435 }
01436
01437 if(subdet_ == 2 && ecalselector_ == "yes"){
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448 meEcalHcalEnergyHE->Fill(eEcalE+eHcal);
01449 if(imc != 0) meEcalHcalEnergyConeHE->Fill(eEcalCone+eHcalCone);
01450 if(imc != 0) meNumEcalRecHitsConeHE->Fill(double(numrechitsEcal));
01451 }
01452
01453
01454 if(imc != 0) {
01455 if(subdet_ == 1 && ecalselector_ == "yes")
01456 meEnergyHcalVsEcalHB -> Fill(eEcalCone,eHcalCone);
01457 if(subdet_ == 2 && ecalselector_ == "yes")
01458 meEnergyHcalVsEcalHE -> Fill(eEcalCone,eHcalCone);
01459 }
01460 }
01461 }
01462
01463
01464
01465
01466
01467
01468
01469 if(subdet_ > 0 && subdet_ < 6 && imc !=0 && !famos_ ) {
01470
01471 double maxES = -9999.;
01472 double etaHotS = 1000.;
01473 double phiHotS = 1000.;
01474
01475 edm::Handle<PCaloHitContainer> hcalHits;
01476 ev.getByLabel("g4SimHits","HcalHits",hcalHits);
01477 const PCaloHitContainer * SimHitResult = hcalHits.product () ;
01478
01479 double enSimHits = 0.;
01480 double enSimHitsHB = 0.;
01481 double enSimHitsHE = 0.;
01482 double enSimHitsHO = 0.;
01483 double enSimHitsHF = 0.;
01484 double enSimHitsHFL = 0.;
01485 double enSimHitsHFS = 0.;
01486
01487
01488 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
01489 HcalDetId cell(SimHits->id());
01490 int sub = cell.subdet();
01491 const CaloCellGeometry* cellGeometry =
01492 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
01493 double etaS = cellGeometry->getPosition().eta () ;
01494 double phiS = cellGeometry->getPosition().phi () ;
01495 double en = SimHits->energy();
01496
01497 double emin = 0.01;
01498 if(fabs(etaS) > 3.) emin = 1.;
01499
01500 double r = dR(eta_MC, phi_MC, etaS, phiS);
01501 if( r < searchR ) {
01502 if(maxES < en && en > emin ) {
01503 maxES = en;
01504 etaHotS = etaS;
01505 phiHotS = phiS;
01506 }
01507 }
01508
01509 if ( r < partR ){
01510 enSimHits += en;
01511 if(sub == 1) enSimHitsHB += en;
01512 if(sub == 2) enSimHitsHE += en;
01513 if(sub == 3) enSimHitsHO += en;
01514 if(sub == 4) {
01515 enSimHitsHF += en;
01516 int depth = cell.depth();
01517 if(depth == 1) enSimHitsHFL += en;
01518 else enSimHitsHFS += en;
01519 }
01520 }
01521 }
01522
01523
01524
01525
01526 double clusEta = 999.;
01527 double clusPhi = 999.;
01528 double clusEn = 0.;
01529
01530 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
01531 HcalDetId cell(SimHits->id());
01532
01533 const CaloCellGeometry* cellGeometry =
01534 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
01535 double etaS = cellGeometry->getPosition().eta () ;
01536 double phiS = cellGeometry->getPosition().phi () ;
01537 double en = SimHits->energy();
01538
01539 double emin = 0.01;
01540 if(fabs(etaS) > 3.) emin = 1.;
01541
01542 double rhot = dR(etaHotS, phiHotS, etaS, phiS);
01543 if(rhot < partR && en > emin) {
01544 clusEta = (clusEta * clusEn + etaS * en)/(clusEn + en);
01545 clusPhi = phi12(clusPhi, clusEn, phiS, en);
01546 clusEn += en;
01547 }
01548 }
01549
01550
01551 if(etype_ == 1) {
01552 double phidev = dPhiWsign(clusPhi, phi_MC);
01553 meDeltaPhiS->Fill(eta_MC, phidev);
01554 double etadev = clusEta - eta_MC;
01555 meDeltaEtaS->Fill(eta_MC, etadev);
01556 }
01557
01558
01559
01560
01561 if(subdet_ == 4 || subdet_ == 5) {
01562 if(eHcalConeHF > eps) {
01563 meRecHitSimHitHF->Fill( enSimHitsHF, eHcalConeHF );
01564 meRecHitSimHitProfileHF->Fill( enSimHitsHF, eHcalConeHF);
01565
01566 meRecHitSimHitHFL->Fill( enSimHitsHFL, eHcalConeHFL );
01567 meRecHitSimHitProfileHFL->Fill( enSimHitsHFL, eHcalConeHFL);
01568 meRecHitSimHitHFS->Fill( enSimHitsHFS, eHcalConeHFS );
01569 meRecHitSimHitProfileHFS->Fill( enSimHitsHFS, eHcalConeHFS);
01570 }
01571 }
01572 if(subdet_ == 1 || subdet_ == 5) {
01573 meRecHitSimHitHB->Fill( enSimHitsHB,eHcalConeHB );
01574 meRecHitSimHitProfileHB->Fill( enSimHitsHB,eHcalConeHB);
01575 }
01576 if(subdet_ == 2 || subdet_ == 5) {
01577 meRecHitSimHitHE->Fill( enSimHitsHE,eHcalConeHE );
01578 meRecHitSimHitProfileHE->Fill( enSimHitsHE,eHcalConeHE);
01579 }
01580 if(subdet_ == 3 || subdet_ == 5) {
01581 meRecHitSimHitHO->Fill( enSimHitsHO,eHcalConeHO );
01582 meRecHitSimHitProfileHO->Fill( enSimHitsHO,eHcalConeHO);
01583 }
01584 }
01585
01586 nevtot++;
01587 }
01588
01589
01591 void HcalRecHitsValidation::fillRecHitsTmp(int subdet_, edm::Event const& ev){
01592
01593 using namespace edm;
01594
01595
01596
01597 csub.clear();
01598 cen.clear();
01599 ceta.clear();
01600 cphi.clear();
01601 ctime.clear();
01602 cieta.clear();
01603 ciphi.clear();
01604 cdepth.clear();
01605 cz.clear();
01606
01607
01608 if( subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
01609
01610
01611 std::vector<edm::Handle<HBHERecHitCollection> > hbhecoll;
01612 ev.getManyByType(hbhecoll);
01613
01614 std::vector<edm::Handle<HBHERecHitCollection> >::iterator i;
01615
01616 int count = 0;
01617 for (i=hbhecoll.begin(); i!=hbhecoll.end(); i++) {
01618
01619 count ++;
01620
01621 if ( count == 1) {
01622 for (HBHERecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
01623 HcalDetId cell(j->id());
01624 const CaloCellGeometry* cellGeometry =
01625 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
01626 double eta = cellGeometry->getPosition().eta () ;
01627 double phi = cellGeometry->getPosition().phi () ;
01628 double zc = cellGeometry->getPosition().z ();
01629 int sub = cell.subdet();
01630 int depth = cell.depth();
01631 int inteta = cell.ieta();
01632 if(inteta > 0) inteta -= 1;
01633 int intphi = cell.iphi()-1;
01634 double en = j->energy();
01635 double t = j->time();
01636
01637 if((iz > 0 && eta > 0.) || (iz < 0 && eta <0.) || iz == 0) {
01638
01639 csub.push_back(sub);
01640 cen.push_back(en);
01641 ceta.push_back(eta);
01642 cphi.push_back(phi);
01643 ctime.push_back(t);
01644 cieta.push_back(inteta);
01645 ciphi.push_back(intphi);
01646 cdepth.push_back(depth);
01647 cz.push_back(zc);
01648 }
01649 }
01650
01651 }
01652 }
01653 }
01654
01655 if( subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
01656
01657
01658 std::vector<edm::Handle<HFRecHitCollection> > hfcoll;
01659 ev.getManyByType(hfcoll);
01660 std::vector<edm::Handle<HFRecHitCollection> >::iterator ihf;
01661
01662 int count = 0;
01663 for (ihf=hfcoll.begin(); ihf!=hfcoll.end(); ihf++) {
01664 count++;
01665 if(count == 1) {
01666 for (HFRecHitCollection::const_iterator j=(*ihf)->begin(); j!=(*ihf)->end(); j++) {
01667 HcalDetId cell(j->id());
01668 const CaloCellGeometry* cellGeometry =
01669 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
01670 double eta = cellGeometry->getPosition().eta () ;
01671 double phi = cellGeometry->getPosition().phi () ;
01672 double zc = cellGeometry->getPosition().z ();
01673 int sub = cell.subdet();
01674 int depth = cell.depth();
01675 int inteta = cell.ieta();
01676 if(inteta > 0) inteta -= 1;
01677 int intphi = cell.iphi()-1;
01678 double en = j->energy();
01679 double t = j->time();
01680
01681 if((iz > 0 && eta > 0.) || (iz < 0 && eta <0.) || iz == 0) {
01682
01683 csub.push_back(sub);
01684 cen.push_back(en);
01685 ceta.push_back(eta);
01686 cphi.push_back(phi);
01687 ctime.push_back(t);
01688 cieta.push_back(inteta);
01689 ciphi.push_back(intphi);
01690 cdepth.push_back(depth);
01691 cz.push_back(zc);
01692
01693 }
01694 }
01695 }
01696 }
01697 }
01698
01699
01700
01701 if( subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
01702
01703 std::vector<edm::Handle<HORecHitCollection> > hocoll;
01704 ev.getManyByType(hocoll);
01705 std::vector<edm::Handle<HORecHitCollection> >::iterator iho;
01706
01707 int count = 0;
01708 for (iho=hocoll.begin(); iho!=hocoll.end(); iho++) {
01709 count++;
01710 if (count == 1) {
01711 for (HORecHitCollection::const_iterator j=(*iho)->begin(); j!=(*iho)->end(); j++) {
01712 HcalDetId cell(j->id());
01713 const CaloCellGeometry* cellGeometry =
01714 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
01715 double eta = cellGeometry->getPosition().eta () ;
01716 double phi = cellGeometry->getPosition().phi () ;
01717 double zc = cellGeometry->getPosition().z ();
01718 int sub = cell.subdet();
01719 int depth = cell.depth();
01720 int inteta = cell.ieta();
01721 if(inteta > 0) inteta -= 1;
01722 int intphi = cell.iphi()-1;
01723 double t = j->time();
01724 double en = j->energy();
01725
01726 if((iz > 0 && eta > 0.) || (iz < 0 && eta <0.) || iz == 0) {
01727 csub.push_back(sub);
01728 cen.push_back(en);
01729 ceta.push_back(eta);
01730 cphi.push_back(phi);
01731 ctime.push_back(t);
01732 cieta.push_back(inteta);
01733 ciphi.push_back(intphi);
01734 cdepth.push_back(depth);
01735 cz.push_back(zc);
01736 }
01737 }
01738 }
01739 }
01740 }
01741
01742 }
01743 double HcalRecHitsValidation::dR(double eta1, double phi1, double eta2, double phi2) {
01744 double PI = 3.1415926535898;
01745 double deltaphi= phi1 - phi2;
01746 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
01747 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
01748 double deltaeta = eta2 - eta1;
01749 double tmp = sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
01750 return tmp;
01751 }
01752
01753 double HcalRecHitsValidation::phi12(double phi1, double en1, double phi2, double en2) {
01754
01755
01756 double tmp;
01757 double PI = 3.1415926535898;
01758 double a1 = phi1; double a2 = phi2;
01759
01760 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*PI;
01761 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*PI;
01762 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
01763 if(tmp > PI) tmp -= 2.*PI;
01764
01765 return tmp;
01766
01767 }
01768
01769 double HcalRecHitsValidation::dPhiWsign(double phi1, double phi2) {
01770
01771
01772
01773 double PI = 3.1415926535898;
01774 double a1 = phi1; double a2 = phi2;
01775 double tmp = a2 - a1;
01776 if( a1*a2 < 0.) {
01777 if(a1 > 0.5 * PI) tmp += 2.*PI;
01778 if(a2 > 0.5 * PI) tmp -= 2.*PI;
01779 }
01780 return tmp;
01781
01782 }
01783
01784 #include "FWCore/PluginManager/interface/ModuleDef.h"
01785 #include "FWCore/Framework/interface/MakerMacros.h"
01786 #include "DQMServices/Core/interface/DQMStore.h"
01787
01788 DEFINE_SEAL_MODULE();
01789 DEFINE_ANOTHER_FWK_MODULE(HcalRecHitsValidation);
01790