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