CMS 3D CMS Logo

HcalRecHitsValidation.h

Go to the documentation of this file.
00001 #ifndef HcalRecHitsValidation_H
00002 #define HcalRecHitsValidation_H
00003 
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "FWCore/Framework/interface/EDAnalyzer.h"
00006 
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "FWCore/Framework/interface/EventSetup.h"
00009 #include "FWCore/Framework/interface/ESHandle.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012 
00013 #include "DQMServices/Core/interface/DQMStore.h"
00014 #include "FWCore/ServiceRegistry/interface/Service.h"
00015 
00016 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00017 #include "DataFormats/HcalRecHit/interface/HcalSourcePositionData.h"
00018 #include "FWCore/Framework/interface/Selector.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/HepMCProduct/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 HcalRecHitsValidation : public edm::EDAnalyzer {
00044  public:
00045   HcalRecHitsValidation(edm::ParameterSet const& conf);
00046   ~HcalRecHitsValidation();
00047   virtual void analyze(edm::Event const& ev, edm::EventSetup const& c);
00048   virtual void beginJob(const edm::EventSetup&) ;
00049   virtual void endJob() ;
00050  private:
00051   
00052   virtual void fillRecHitsTmp(int subdet_, edm::Event const& ev);
00053   double dR(double eta1, double phi1, double eta2, double phi2);
00054   double phi12(double phi1, double en1, double phi2, double en2);
00055   double dPhiWsign(double phi1,double phi2);  
00056 
00057   DQMStore* dbe_;
00058   
00059   std::string outputFile_;
00060   std::string hcalselector_;
00061   std::string ecalselector_;
00062   std::string eventype_;
00063   std::string sign_;
00064   std::string mc_;
00065   bool        famos_;
00066 
00067   // choice of subdetector in config : noise/HB/HE/HO/HF/ALL (0/1/2/3/4/5)
00068   int subdet_;
00069 
00070   // single/multi-particle sample (1/2)
00071   int etype_;
00072   int iz;
00073   int imc;
00074 
00075   // RecHits counters
00076   MonitorElement* Nhb;
00077   MonitorElement* Nhe;
00078   MonitorElement* Nho;
00079   MonitorElement* Nhf;
00080 
00081   // ZS-specific
00082 
00083   MonitorElement* map_depth1;
00084   MonitorElement* map_depth2;
00085   MonitorElement* map_depth3;
00086   MonitorElement* map_depth4;
00087 
00088   MonitorElement* ZS_HB1;
00089   MonitorElement* ZS_HB2;
00090   MonitorElement* ZS_HE1;
00091   MonitorElement* ZS_HE2;
00092   MonitorElement* ZS_HE3;
00093   MonitorElement* ZS_HO;
00094   MonitorElement* ZS_HF1;
00095   MonitorElement* ZS_HF2;
00096 
00097   MonitorElement* ZS_nHB1;
00098   MonitorElement* ZS_nHB2;
00099   MonitorElement* ZS_nHE1;
00100   MonitorElement* ZS_nHE2;
00101   MonitorElement* ZS_nHE3;
00102   MonitorElement* ZS_nHO;
00103   MonitorElement* ZS_nHF1;
00104   MonitorElement* ZS_nHF2;
00105 
00106   MonitorElement* ZS_seqHB1;
00107   MonitorElement* ZS_seqHB2;
00108   MonitorElement* ZS_seqHE1;
00109   MonitorElement* ZS_seqHE2;
00110   MonitorElement* ZS_seqHE3;
00111   MonitorElement* ZS_seqHO;
00112   MonitorElement* ZS_seqHF1;
00113   MonitorElement* ZS_seqHF2;
00114 
00115   // In ALL other cases : 2D ieta-iphi maps 
00116   // without and with cuts (a la "Scheme B") on energy
00117   // - only in the cone around particle for single-part samples (mc = "yes")
00118   // - for all calls in milti-particle samples (mc = "no")
00119 
00120   MonitorElement* map_ecal;
00121 
00122   MonitorElement* emap_HB1;
00123   MonitorElement* emap_HB2;
00124   MonitorElement* emap_HE1;
00125   MonitorElement* emap_HE2;
00126   MonitorElement* emap_HE3;
00127   MonitorElement* emap_HO;
00128   MonitorElement* emap_HF1;
00129   MonitorElement* emap_HF2;
00130 
00131   MonitorElement* emean_vs_ieta_HB1;
00132   MonitorElement* emean_vs_ieta_HB2;
00133   MonitorElement* emean_vs_ieta_HE1;
00134   MonitorElement* emean_vs_ieta_HE2;
00135   MonitorElement* emean_vs_ieta_HE3;
00136   MonitorElement* emean_vs_ieta_HO;
00137   MonitorElement* emean_vs_ieta_HF1;
00138   MonitorElement* emean_vs_ieta_HF2;
00139 
00140   MonitorElement* RMS_vs_ieta_HB1;
00141   MonitorElement* RMS_vs_ieta_HB2;
00142   MonitorElement* RMS_vs_ieta_HE1;
00143   MonitorElement* RMS_vs_ieta_HE2;
00144   MonitorElement* RMS_vs_ieta_HE3;
00145   MonitorElement* RMS_vs_ieta_HO;
00146   MonitorElement* RMS_vs_ieta_HF1;
00147   MonitorElement* RMS_vs_ieta_HF2;
00148 
00149   MonitorElement* emean_seqHB1;
00150   MonitorElement* emean_seqHB2;
00151   MonitorElement* emean_seqHE1;
00152   MonitorElement* emean_seqHE2;
00153   MonitorElement* emean_seqHE3;
00154   MonitorElement* emean_seqHO;
00155   MonitorElement* emean_seqHF1;
00156   MonitorElement* emean_seqHF2;
00157 
00158   MonitorElement* RMS_seq_HB1;
00159   MonitorElement* RMS_seq_HB2;
00160   MonitorElement* RMS_seq_HE1;
00161   MonitorElement* RMS_seq_HE2;
00162   MonitorElement* RMS_seq_HE3;
00163   MonitorElement* RMS_seq_HO;
00164   MonitorElement* RMS_seq_HF1;
00165   MonitorElement* RMS_seq_HF2;
00166 
00167   MonitorElement* occupancy_map_HB1;
00168   MonitorElement* occupancy_map_HB2;
00169   MonitorElement* occupancy_map_HE1;
00170   MonitorElement* occupancy_map_HE2;
00171   MonitorElement* occupancy_map_HE3;
00172   MonitorElement* occupancy_map_HO;
00173   MonitorElement* occupancy_map_HF1;
00174   MonitorElement* occupancy_map_HF2;
00175 
00176   MonitorElement* occupancy_vs_ieta_HB1;
00177   MonitorElement* occupancy_vs_ieta_HB2;
00178   MonitorElement* occupancy_vs_ieta_HE1;
00179   MonitorElement* occupancy_vs_ieta_HE2;
00180   MonitorElement* occupancy_vs_ieta_HE3;
00181   MonitorElement* occupancy_vs_ieta_HO;
00182   MonitorElement* occupancy_vs_ieta_HF1;
00183   MonitorElement* occupancy_vs_ieta_HF2;
00184 
00185   MonitorElement* occupancy_seqHB1;
00186   MonitorElement* occupancy_seqHB2;
00187   MonitorElement* occupancy_seqHE1;
00188   MonitorElement* occupancy_seqHE2;
00189   MonitorElement* occupancy_seqHE3;
00190   MonitorElement* occupancy_seqHO;
00191   MonitorElement* occupancy_seqHF1;
00192   MonitorElement* occupancy_seqHF2;
00193 
00194 
00195   // also - energy in the cone around MC particle
00196   MonitorElement* map_econe_depth1;
00197   MonitorElement* map_econe_depth2;
00198   MonitorElement* map_econe_depth3;
00199   MonitorElement* map_econe_depth4;
00200  
00201   // for single monoenergetic particles - cone collection profile vs ieta.
00202   MonitorElement* meEnConeEtaProfile_depth1;
00203   MonitorElement* meEnConeEtaProfile_depth2;
00204   MonitorElement* meEnConeEtaProfile_depth3;
00205   MonitorElement* meEnConeEtaProfile_depth4;
00206   MonitorElement* meEnConeEtaProfile;
00207 
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* meRecHitsEnergyHB;
00240   MonitorElement* meRecHitsEnergyHE;
00241   MonitorElement* meRecHitsEnergyHO;
00242   MonitorElement* meRecHitsEnergyHF;
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

Generated on Tue Jun 9 17:49:24 2009 for CMSSW by  doxygen 1.5.4