CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/DQMOffline/Hcal/interface/HcalRecHitsAnalyzer.h

Go to the documentation of this file.
00001 #ifndef _DQMOFFLINE_HCAL_HCALRECHITSANALYZER_H_
00002 #define _DQMOFFLINE_HCAL_HCALRECHITSANALYZER_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 <vector>
00032 #include <utility>
00033 #include <ostream>
00034 #include <string>
00035 #include <algorithm>
00036 #include <cmath>
00037 #include "DQMServices/Core/interface/MonitorElement.h"
00038 
00039 #include "DataFormats/DetId/interface/DetId.h"
00040 // channel status
00041 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
00042 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
00043 
00044 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
00045 #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h"
00046 
00047 // severity level assignment for HCAL
00048 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h"
00049 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputerRcd.h"
00050 
00051 // severity level assignment for ECAL
00052 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
00053 
00054 
00055 class HcalRecHitsAnalyzer : public edm::EDAnalyzer {
00056  public:
00057   HcalRecHitsAnalyzer(edm::ParameterSet const& conf);
00058   ~HcalRecHitsAnalyzer();
00059   virtual void analyze(edm::Event const& ev, edm::EventSetup const& c);
00060   virtual void beginJob() ;
00061   virtual void endJob() ;
00062  private:
00063   
00064   virtual void fillRecHitsTmp(int subdet_, edm::Event const& ev);
00065   double dR(double eta1, double phi1, double eta2, double phi2);
00066   double phi12(double phi1, double en1, double phi2, double en2);
00067   double dPhiWsign(double phi1,double phi2);  
00068 
00069   DQMStore* dbe_;
00070   
00071   std::string outputFile_;
00072   std::string hcalselector_;
00073   std::string ecalselector_;
00074   std::string eventype_;
00075   std::string sign_;
00076   std::string mc_;
00077   bool        famos_;
00078   bool        useAllHistos_;
00079 
00080   //RecHit Collection input tags
00081   edm::InputTag theHBHERecHitCollectionLabel;
00082   edm::InputTag theHFRecHitCollectionLabel;
00083   edm::InputTag theHORecHitCollectionLabel;
00084 
00085   // choice of subdetector in config : noise/HB/HE/HO/HF/ALL (0/1/2/3/4/5)
00086   int subdet_;
00087 
00088   // single/multi-particle sample (1/2)
00089   int etype_;
00090   int iz;
00091   int imc;
00092 
00093   // for checking the status of ECAL and HCAL channels stored in the DB 
00094   const HcalChannelQuality* theHcalChStatus;
00095   // calculator of severety level for HCAL
00096   const HcalSeverityLevelComputer* theHcalSevLvlComputer;
00097   int hcalSevLvl(const CaloRecHit* hit);
00098 
00099   std::vector<int> hcalHBSevLvlVec, hcalHESevLvlVec, hcalHFSevLvlVec, hcalHOSevLvlVec;
00100 
00101   MonitorElement* sevLvl_HB;
00102   MonitorElement* sevLvl_HE;
00103   MonitorElement* sevLvl_HF;
00104   MonitorElement* sevLvl_HO; 
00105 
00106   // RecHits counters
00107   MonitorElement* Nhb;
00108   MonitorElement* Nhe;
00109   MonitorElement* Nho;
00110   MonitorElement* Nhf;
00111 
00112   // ZS-specific
00113 
00114   MonitorElement* map_depth1;
00115   MonitorElement* map_depth2;
00116   MonitorElement* map_depth3;
00117   MonitorElement* map_depth4;
00118 
00119   MonitorElement* ZS_HB1;
00120   MonitorElement* ZS_HB2;
00121   MonitorElement* ZS_HE1;
00122   MonitorElement* ZS_HE2;
00123   MonitorElement* ZS_HE3;
00124   MonitorElement* ZS_HO;
00125   MonitorElement* ZS_HF1;
00126   MonitorElement* ZS_HF2;
00127 
00128   MonitorElement* ZS_nHB1;
00129   MonitorElement* ZS_nHB2;
00130   MonitorElement* ZS_nHE1;
00131   MonitorElement* ZS_nHE2;
00132   MonitorElement* ZS_nHE3;
00133   MonitorElement* ZS_nHO;
00134   MonitorElement* ZS_nHF1;
00135   MonitorElement* ZS_nHF2;
00136 
00137   MonitorElement* ZS_seqHB1;
00138   MonitorElement* ZS_seqHB2;
00139   MonitorElement* ZS_seqHE1;
00140   MonitorElement* ZS_seqHE2;
00141   MonitorElement* ZS_seqHE3;
00142   MonitorElement* ZS_seqHO;
00143   MonitorElement* ZS_seqHF1;
00144   MonitorElement* ZS_seqHF2;
00145 
00146   // In ALL other cases : 2D ieta-iphi maps 
00147   // without and with cuts (a la "Scheme B") on energy
00148   // - only in the cone around particle for single-part samples (mc = "yes")
00149   // - for all calls in milti-particle samples (mc = "no")
00150 
00151   MonitorElement* map_ecal;
00152 
00153   MonitorElement* emap_depth1;
00154   MonitorElement* emap_depth2;
00155   MonitorElement* emap_depth3;
00156   MonitorElement* emap_depth4;
00157 
00158   MonitorElement* emean_vs_ieta_HB1;
00159   MonitorElement* emean_vs_ieta_HB2;
00160   MonitorElement* emean_vs_ieta_HE1;
00161   MonitorElement* emean_vs_ieta_HE2;
00162   MonitorElement* emean_vs_ieta_HE3;
00163   MonitorElement* emean_vs_ieta_HO;
00164   MonitorElement* emean_vs_ieta_HF1;
00165   MonitorElement* emean_vs_ieta_HF2;
00166 
00167   MonitorElement* RMS_vs_ieta_HB1;
00168   MonitorElement* RMS_vs_ieta_HB2;
00169   MonitorElement* RMS_vs_ieta_HE1;
00170   MonitorElement* RMS_vs_ieta_HE2;
00171   MonitorElement* RMS_vs_ieta_HE3;
00172   MonitorElement* RMS_vs_ieta_HO;
00173   MonitorElement* RMS_vs_ieta_HF1;
00174   MonitorElement* RMS_vs_ieta_HF2;
00175 
00176   MonitorElement* emean_seqHB1;
00177   MonitorElement* emean_seqHB2;
00178   MonitorElement* emean_seqHE1;
00179   MonitorElement* emean_seqHE2;
00180   MonitorElement* emean_seqHE3;
00181   MonitorElement* emean_seqHO;
00182   MonitorElement* emean_seqHF1;
00183   MonitorElement* emean_seqHF2;
00184 
00185   MonitorElement* RMS_seq_HB1;
00186   MonitorElement* RMS_seq_HB2;
00187   MonitorElement* RMS_seq_HE1;
00188   MonitorElement* RMS_seq_HE2;
00189   MonitorElement* RMS_seq_HE3;
00190   MonitorElement* RMS_seq_HO;
00191   MonitorElement* RMS_seq_HF1;
00192   MonitorElement* RMS_seq_HF2;
00193 
00194   MonitorElement* occupancy_map_HB1;
00195   MonitorElement* occupancy_map_HB2;
00196   MonitorElement* occupancy_map_HE1;
00197   MonitorElement* occupancy_map_HE2;
00198   MonitorElement* occupancy_map_HE3;
00199   MonitorElement* occupancy_map_HO;
00200   MonitorElement* occupancy_map_HF1;
00201   MonitorElement* occupancy_map_HF2;
00202 
00203   MonitorElement* occupancy_vs_ieta_HB1;
00204   MonitorElement* occupancy_vs_ieta_HB2;
00205   MonitorElement* occupancy_vs_ieta_HE1;
00206   MonitorElement* occupancy_vs_ieta_HE2;
00207   MonitorElement* occupancy_vs_ieta_HE3;
00208   MonitorElement* occupancy_vs_ieta_HO;
00209   MonitorElement* occupancy_vs_ieta_HF1;
00210   MonitorElement* occupancy_vs_ieta_HF2;
00211 
00212   MonitorElement* occupancy_seqHB1;
00213   MonitorElement* occupancy_seqHB2;
00214   MonitorElement* occupancy_seqHE1;
00215   MonitorElement* occupancy_seqHE2;
00216   MonitorElement* occupancy_seqHE3;
00217   MonitorElement* occupancy_seqHO;
00218   MonitorElement* occupancy_seqHF1;
00219   MonitorElement* occupancy_seqHF2;
00220 
00221 
00222   // also - energy in the cone around MC particle
00223   MonitorElement* map_econe_depth1;
00224   MonitorElement* map_econe_depth2;
00225   MonitorElement* map_econe_depth3;
00226   MonitorElement* map_econe_depth4;
00227  
00228   // for single monoenergetic particles - cone collection profile vs ieta.
00229   MonitorElement* meEnConeEtaProfile_depth1;
00230   MonitorElement* meEnConeEtaProfile_depth2;
00231   MonitorElement* meEnConeEtaProfile_depth3;
00232   MonitorElement* meEnConeEtaProfile_depth4;
00233   MonitorElement* meEnConeEtaProfile;
00234   MonitorElement* meEnConeEtaProfile_E;
00235   MonitorElement* meEnConeEtaProfile_EH;
00236   // Single particles - deviation of cluster from MC truth
00237   MonitorElement* meDeltaPhi;
00238   MonitorElement* meDeltaEta;
00239 
00240   //----------- NOISE case
00241   MonitorElement* e_hb;
00242   MonitorElement* e_he;
00243   MonitorElement* e_ho;
00244   MonitorElement* e_hfl;
00245   MonitorElement* e_hfs;
00246 
00247   // number of rechits above threshold 1GEV
00248   MonitorElement* meNumRecHitsThreshHB;
00249   MonitorElement* meNumRecHitsThreshHE;
00250   MonitorElement* meNumRecHitsThreshHO;
00251 
00252   // number of rechits in the cone
00253   MonitorElement* meNumRecHitsConeHB;
00254   MonitorElement* meNumRecHitsConeHE;
00255   MonitorElement* meNumRecHitsConeHO;
00256   MonitorElement* meNumRecHitsConeHF;
00257 
00258   // time?
00259   MonitorElement* meTimeHB;
00260   MonitorElement* meTimeHE;
00261   MonitorElement* meTimeHO;
00262   MonitorElement* meTimeHF;
00263 
00264   // energy of rechits
00265   MonitorElement* meRecHitsEnergyHB;
00266   MonitorElement* meRecHitsEnergyHE;
00267   MonitorElement* meRecHitsEnergyHO;
00268   MonitorElement* meRecHitsEnergyHF;
00269 
00270   MonitorElement* meTE_Low_HB;
00271   MonitorElement* meTE_HB;
00272   MonitorElement* meTE_High_HB;
00273   MonitorElement* meTE_HB1;
00274   MonitorElement* meTE_HB2;
00275   MonitorElement* meTEprofileHB_Low;
00276   MonitorElement* meTEprofileHB;
00277   MonitorElement* meTEprofileHB_High;
00278 
00279   MonitorElement* meTE_Low_HE;
00280   MonitorElement* meTE_HE;
00281   MonitorElement* meTE_HE1;
00282   MonitorElement* meTE_HE2;
00283   MonitorElement* meTEprofileHE_Low;
00284   MonitorElement* meTEprofileHE;
00285 
00286   MonitorElement* meTE_HO;
00287   MonitorElement* meTE_High_HO;
00288   MonitorElement* meTEprofileHO;
00289   MonitorElement* meTEprofileHO_High;
00290 
00291   MonitorElement* meTE_Low_HF;
00292   MonitorElement* meTE_HF;
00293   MonitorElement* meTE_HFL;
00294   MonitorElement* meTE_HFS;
00295   MonitorElement* meTEprofileHF_Low;
00296   MonitorElement* meTEprofileHF;
00297 
00298 
00299   MonitorElement* meSumRecHitsEnergyHB;
00300   MonitorElement* meSumRecHitsEnergyHE;
00301   MonitorElement* meSumRecHitsEnergyHO;
00302   MonitorElement* meSumRecHitsEnergyHF;
00303 
00304 
00305   MonitorElement* meSumRecHitsEnergyConeHB;
00306   MonitorElement* meSumRecHitsEnergyConeHE;
00307   MonitorElement* meSumRecHitsEnergyConeHO;
00308   MonitorElement* meSumRecHitsEnergyConeHF;
00309   MonitorElement* meSumRecHitsEnergyConeHFL;
00310   MonitorElement* meSumRecHitsEnergyConeHFS;
00311 
00312 
00313   MonitorElement* meEcalHcalEnergyHB;
00314   MonitorElement* meEcalHcalEnergyHE;
00315    
00316   MonitorElement* meEcalHcalEnergyConeHB; 
00317   MonitorElement* meEcalHcalEnergyConeHE; 
00318   MonitorElement* meEcalHcalEnergyConeHO; 
00319   MonitorElement* meEcalHcalEnergyConeHF; 
00320  
00321   // 2D plot of sum of RecHits in HCAL as function of ECAL's one
00322   MonitorElement* meEnergyHcalVsEcalHB;
00323   MonitorElement* meEnergyHcalVsEcalHE;
00324   
00325   // number of ECAL's rechits in cone 0.3 
00326   MonitorElement* meNumEcalRecHitsConeHB;
00327   MonitorElement* meNumEcalRecHitsConeHE;
00328 
00329   edm::ESHandle<CaloGeometry> geometry ;
00330 
00331   //Status word histos
00332   MonitorElement* RecHit_StatusWord_HB;
00333   MonitorElement* RecHit_StatusWord_HE;
00334   MonitorElement* RecHit_StatusWord_HF;
00335   MonitorElement* RecHit_StatusWord_HF67;
00336   MonitorElement* RecHit_StatusWord_HO;
00337 
00338   //Aux Status word histos
00339   MonitorElement* RecHit_Aux_StatusWord_HB;
00340   MonitorElement* RecHit_Aux_StatusWord_HE;
00341   MonitorElement* RecHit_Aux_StatusWord_HF;
00342   MonitorElement* RecHit_Aux_StatusWord_HO;
00343 
00344  // Filling vectors with essential RecHits data
00345   std::vector<int>      csub;
00346   std::vector<int>      cieta;
00347   std::vector<int>      ciphi;
00348   std::vector<int>      cdepth;
00349   std::vector<double>   cen;
00350   std::vector<double>   ceta;
00351   std::vector<double>   cphi;
00352   std::vector<double>   ctime;
00353   std::vector<double>   cz;
00354   std::vector<uint32_t> cstwd;
00355   std::vector<uint32_t> cauxstwd;
00356 
00357   // array or min. e-values  ieta x iphi x depth x subdet
00358   double emap_min[82][72][4][4];
00359 
00360   // counter
00361   int nevtot;
00362 
00363 };
00364 
00365 #endif