00001 #ifndef HcalSimHitsValidation_H 00002 #define HcalSimHitsValidation_H 00003 00004 #include "FWCore/Framework/interface/Frameworkfwd.h" 00005 #include "FWCore/Framework/interface/EDAnalyzer.h" 00006 #include "FWCore/Framework/interface/Event.h" 00007 #include "FWCore/Framework/interface/EventSetup.h" 00008 #include "FWCore/Framework/interface/ESHandle.h" 00009 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00010 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00011 #include "FWCore/Framework/interface/MakerMacros.h" 00012 #include "FWCore/PluginManager/interface/ModuleDef.h" 00013 #include "FWCore/ServiceRegistry/interface/Service.h" 00014 00015 #include "DQMServices/Core/interface/DQMStore.h" 00016 00017 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" 00018 #include "DataFormats/HcalRecHit/interface/HcalSourcePositionData.h" 00019 00020 #include <DataFormats/EcalDetId/interface/EBDetId.h> 00021 #include <DataFormats/EcalDetId/interface/EEDetId.h> 00022 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" 00023 00024 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h" 00025 #include "DataFormats/HcalDetId/interface/HcalDetId.h" 00026 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" 00027 #include "Geometry/CaloGeometry/interface/CaloGeometry.h" 00028 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" 00029 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" 00030 00031 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" 00032 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" 00033 00034 #include <vector> 00035 #include <utility> 00036 #include <ostream> 00037 #include <string> 00038 #include <algorithm> 00039 #include <cmath> 00040 #include "DQMServices/Core/interface/MonitorElement.h" 00041 00042 00043 class HcalSimHitsValidation : public edm::EDAnalyzer { 00044 public: 00045 HcalSimHitsValidation(edm::ParameterSet const& conf); 00046 ~HcalSimHitsValidation(); 00047 virtual void analyze(edm::Event const& ev, edm::EventSetup const& c); 00048 virtual void beginJob() ; 00049 virtual void endJob() ; 00050 private: 00051 00052 double dR(double eta1, double phi1, double eta2, double phi2); 00053 double phi12(double phi1, double en1, double phi2, double en2); 00054 double dPhiWsign(double phi1,double phi2); 00055 00056 DQMStore* dbe_; 00057 00058 std::string outputFile_; 00059 std::string hcalselector_; 00060 std::string ecalselector_; 00061 std::string eventype_; 00062 std::string sign_; 00063 std::string mc_; 00064 bool famos_; 00065 00066 // choice of subdetector in config : noise/HB/HE/HO/HF/ALL (0/1/2/3/4/5) 00067 int subdet_; 00068 00069 // single/multi-particle sample (1/2) 00070 int etype_; 00071 int iz; 00072 int imc; 00073 00074 // RecHits counters 00075 MonitorElement* Nhb; 00076 MonitorElement* Nhe; 00077 MonitorElement* Nho; 00078 MonitorElement* Nhf; 00079 00080 // ZS-specific 00081 00082 MonitorElement* map_depth1; 00083 MonitorElement* map_depth2; 00084 MonitorElement* map_depth3; 00085 MonitorElement* map_depth4; 00086 00087 MonitorElement* ZS_HB1; 00088 MonitorElement* ZS_HB2; 00089 MonitorElement* ZS_HE1; 00090 MonitorElement* ZS_HE2; 00091 MonitorElement* ZS_HE3; 00092 MonitorElement* ZS_HO; 00093 MonitorElement* ZS_HF1; 00094 MonitorElement* ZS_HF2; 00095 00096 MonitorElement* ZS_nHB1; 00097 MonitorElement* ZS_nHB2; 00098 MonitorElement* ZS_nHE1; 00099 MonitorElement* ZS_nHE2; 00100 MonitorElement* ZS_nHE3; 00101 MonitorElement* ZS_nHO; 00102 MonitorElement* ZS_nHF1; 00103 MonitorElement* ZS_nHF2; 00104 00105 MonitorElement* ZS_seqHB1; 00106 MonitorElement* ZS_seqHB2; 00107 MonitorElement* ZS_seqHE1; 00108 MonitorElement* ZS_seqHE2; 00109 MonitorElement* ZS_seqHE3; 00110 MonitorElement* ZS_seqHO; 00111 MonitorElement* ZS_seqHF1; 00112 MonitorElement* ZS_seqHF2; 00113 00114 // In ALL other cases : 2D ieta-iphi maps 00115 // without and with cuts (a la "Scheme B") on energy 00116 // - only in the cone around particle for single-part samples (mc = "yes") 00117 // - for all calls in milti-particle samples (mc = "no") 00118 00119 MonitorElement* map_ecal; 00120 00121 MonitorElement* emap_HB1; 00122 MonitorElement* emap_HB2; 00123 MonitorElement* emap_HE1; 00124 MonitorElement* emap_HE2; 00125 MonitorElement* emap_HE3; 00126 MonitorElement* emap_HO; 00127 MonitorElement* emap_HF1; 00128 MonitorElement* emap_HF2; 00129 00130 MonitorElement* emean_vs_ieta_HB1; 00131 MonitorElement* emean_vs_ieta_HB2; 00132 MonitorElement* emean_vs_ieta_HE1; 00133 MonitorElement* emean_vs_ieta_HE2; 00134 MonitorElement* emean_vs_ieta_HE3; 00135 MonitorElement* emean_vs_ieta_HO; 00136 MonitorElement* emean_vs_ieta_HF1; 00137 MonitorElement* emean_vs_ieta_HF2; 00138 00139 MonitorElement* RMS_vs_ieta_HB1; 00140 MonitorElement* RMS_vs_ieta_HB2; 00141 MonitorElement* RMS_vs_ieta_HE1; 00142 MonitorElement* RMS_vs_ieta_HE2; 00143 MonitorElement* RMS_vs_ieta_HE3; 00144 MonitorElement* RMS_vs_ieta_HO; 00145 MonitorElement* RMS_vs_ieta_HF1; 00146 MonitorElement* RMS_vs_ieta_HF2; 00147 00148 MonitorElement* emean_seqHB1; 00149 MonitorElement* emean_seqHB2; 00150 MonitorElement* emean_seqHE1; 00151 MonitorElement* emean_seqHE2; 00152 MonitorElement* emean_seqHE3; 00153 MonitorElement* emean_seqHO; 00154 MonitorElement* emean_seqHF1; 00155 MonitorElement* emean_seqHF2; 00156 00157 MonitorElement* RMS_seq_HB1; 00158 MonitorElement* RMS_seq_HB2; 00159 MonitorElement* RMS_seq_HE1; 00160 MonitorElement* RMS_seq_HE2; 00161 MonitorElement* RMS_seq_HE3; 00162 MonitorElement* RMS_seq_HO; 00163 MonitorElement* RMS_seq_HF1; 00164 MonitorElement* RMS_seq_HF2; 00165 00166 MonitorElement* occupancy_map_HB1; 00167 MonitorElement* occupancy_map_HB2; 00168 MonitorElement* occupancy_map_HE1; 00169 MonitorElement* occupancy_map_HE2; 00170 MonitorElement* occupancy_map_HE3; 00171 MonitorElement* occupancy_map_HO; 00172 MonitorElement* occupancy_map_HF1; 00173 MonitorElement* occupancy_map_HF2; 00174 00175 MonitorElement* occupancy_vs_ieta_HB1; 00176 MonitorElement* occupancy_vs_ieta_HB2; 00177 MonitorElement* occupancy_vs_ieta_HE1; 00178 MonitorElement* occupancy_vs_ieta_HE2; 00179 MonitorElement* occupancy_vs_ieta_HE3; 00180 MonitorElement* occupancy_vs_ieta_HO; 00181 MonitorElement* occupancy_vs_ieta_HF1; 00182 MonitorElement* occupancy_vs_ieta_HF2; 00183 00184 MonitorElement* occupancy_seqHB1; 00185 MonitorElement* occupancy_seqHB2; 00186 MonitorElement* occupancy_seqHE1; 00187 MonitorElement* occupancy_seqHE2; 00188 MonitorElement* occupancy_seqHE3; 00189 MonitorElement* occupancy_seqHO; 00190 MonitorElement* occupancy_seqHF1; 00191 MonitorElement* occupancy_seqHF2; 00192 00193 00194 // also - energy in the cone around MC particle 00195 MonitorElement* map_econe_depth1; 00196 MonitorElement* map_econe_depth2; 00197 MonitorElement* map_econe_depth3; 00198 MonitorElement* map_econe_depth4; 00199 00200 // for single monoenergetic particles - cone collection profile vs ieta. 00201 MonitorElement* meEnConeEtaProfile_depth1; 00202 MonitorElement* meEnConeEtaProfile_depth2; 00203 MonitorElement* meEnConeEtaProfile_depth3; 00204 MonitorElement* meEnConeEtaProfile_depth4; 00205 MonitorElement* meEnConeEtaProfile; 00206 MonitorElement* meEnConeEtaProfile_E; 00207 MonitorElement* meEnConeEtaProfile_EH; 00208 // Single particles - deviation of cluster from MC truth 00209 MonitorElement* meDeltaPhi; 00210 MonitorElement* meDeltaEta; 00211 MonitorElement* meDeltaPhiS; // simcluster 00212 MonitorElement* meDeltaEtaS; // simculster 00213 00214 //----------- NOISE case 00215 MonitorElement* e_hb; 00216 MonitorElement* e_he; 00217 MonitorElement* e_ho; 00218 MonitorElement* e_hfl; 00219 MonitorElement* e_hfs; 00220 00221 // number of rechits above threshold 1GEV 00222 MonitorElement* meNumRecHitsThreshHB; 00223 MonitorElement* meNumRecHitsThreshHE; 00224 MonitorElement* meNumRecHitsThreshHO; 00225 00226 // number of rechits in the cone 00227 MonitorElement* meNumRecHitsConeHB; 00228 MonitorElement* meNumRecHitsConeHE; 00229 MonitorElement* meNumRecHitsConeHO; 00230 MonitorElement* meNumRecHitsConeHF; 00231 00232 // time? 00233 MonitorElement* meTimeHB; 00234 MonitorElement* meTimeHE; 00235 MonitorElement* meTimeHO; 00236 MonitorElement* meTimeHF; 00237 00238 // energy of rechits 00239 MonitorElement* meSimHitsEnergyHB; 00240 MonitorElement* meSimHitsEnergyHE; 00241 MonitorElement* meSimHitsEnergyHO; 00242 MonitorElement* meSimHitsEnergyHF; 00243 00244 MonitorElement* meTE_HB; 00245 MonitorElement* meTE_HB1; 00246 MonitorElement* meTE_HB2; 00247 MonitorElement* meTEprofileHB; 00248 MonitorElement* meTE_HE; 00249 MonitorElement* meTE_HE1; 00250 MonitorElement* meTE_HE2; 00251 MonitorElement* meTEprofileHE; 00252 MonitorElement* meTE_HO; 00253 MonitorElement* meTEprofileHO; 00254 MonitorElement* meTE_HF; 00255 MonitorElement* meTE_HFL; 00256 MonitorElement* meTE_HFS; 00257 MonitorElement* meTEprofileHF; 00258 00259 00260 MonitorElement* meSumRecHitsEnergyHB; 00261 MonitorElement* meSumRecHitsEnergyHE; 00262 MonitorElement* meSumRecHitsEnergyHO; 00263 MonitorElement* meSumRecHitsEnergyHF; 00264 00265 00266 MonitorElement* meSumRecHitsEnergyConeHB; 00267 MonitorElement* meSumRecHitsEnergyConeHE; 00268 MonitorElement* meSumRecHitsEnergyConeHO; 00269 MonitorElement* meSumRecHitsEnergyConeHF; 00270 MonitorElement* meSumRecHitsEnergyConeHFL; 00271 MonitorElement* meSumRecHitsEnergyConeHFS; 00272 00273 00274 MonitorElement* meEcalHcalEnergyHB; 00275 MonitorElement* meEcalHcalEnergyHE; 00276 00277 MonitorElement* meEcalHcalEnergyConeHB; 00278 MonitorElement* meEcalHcalEnergyConeHE; 00279 MonitorElement* meEcalHcalEnergyConeHO; 00280 MonitorElement* meEcalHcalEnergyConeHF; 00281 00282 // Histo (2D plot) for sum of RecHits vs SimHits (hcal only) 00283 MonitorElement* meRecHitSimHitHB; 00284 MonitorElement* meRecHitSimHitHE; 00285 MonitorElement* meRecHitSimHitHO; 00286 MonitorElement* meRecHitSimHitHF; 00287 MonitorElement* meRecHitSimHitHFL; 00288 MonitorElement* meRecHitSimHitHFS; 00289 // profile histo (2D plot) for sum of RecHits vs SimHits (hcal only) 00290 MonitorElement* meRecHitSimHitProfileHB; 00291 MonitorElement* meRecHitSimHitProfileHE; 00292 MonitorElement* meRecHitSimHitProfileHO; 00293 MonitorElement* meRecHitSimHitProfileHF; 00294 MonitorElement* meRecHitSimHitProfileHFL; 00295 MonitorElement* meRecHitSimHitProfileHFS; 00296 00297 // 2D plot of sum of RecHits in HCAL as function of ECAL's one 00298 MonitorElement* meEnergyHcalVsEcalHB; 00299 MonitorElement* meEnergyHcalVsEcalHE; 00300 00301 // number of ECAL's rechits in cone 0.3 00302 MonitorElement* meNumEcalRecHitsConeHB; 00303 MonitorElement* meNumEcalRecHitsConeHE; 00304 00305 edm::ESHandle<CaloGeometry> geometry ; 00306 00307 // Filling vectors with essential RecHits data 00308 std::vector<int> csub; 00309 std::vector<int> cieta; 00310 std::vector<int> ciphi; 00311 std::vector<int> cdepth; 00312 std::vector<double> cen; 00313 std::vector<double> ceta; 00314 std::vector<double> cphi; 00315 std::vector<double> ctime; 00316 std::vector<double> cz; 00317 00318 // array or min. e-values ieta x iphi x depth x subdet 00319 double emap_min[82][72][4][4]; 00320 00321 // counter 00322 int nevtot; 00323 00324 }; 00325 00326 #endif