Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:07

0001 #ifndef EcalRecHitsValidation_H
0002 #define EcalRecHitsValidation_H
0003 
0004 /*
0005  * \file EcalRecHitsValidation.h
0006  *
0007  * \author C. Rovelli
0008  *
0009  */
0010 
0011 #include "FWCore/Framework/interface/Frameworkfwd.h"
0012 
0013 #include "FWCore/Framework/interface/ESHandle.h"
0014 #include "FWCore/Framework/interface/Event.h"
0015 #include "FWCore/Framework/interface/EventSetup.h"
0016 #include "FWCore/Framework/interface/MakerMacros.h"
0017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0019 
0020 #include "DQMServices/Core/interface/DQMStore.h"
0021 #include "FWCore/ServiceRegistry/interface/Service.h"
0022 
0023 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
0024 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0025 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0026 
0027 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
0028 #include "DataFormats/EcalDigi/interface/EEDataFrame.h"
0029 #include "DataFormats/EcalDigi/interface/ESDataFrame.h"
0030 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0031 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0032 
0033 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
0034 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
0035 
0036 #include <Validation/EcalRecHits/interface/EcalRecHitsValidation.h>
0037 #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h"
0038 #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h"
0039 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0040 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
0041 
0042 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0043 #include <fstream>
0044 #include <iostream>
0045 #include <map>
0046 #include <vector>
0047 
0048 class EcalRecHitsValidation : public DQMEDAnalyzer {
0049   typedef std::map<uint32_t, float, std::less<uint32_t>> MapType;
0050 
0051 public:
0052   /// Constructor
0053   EcalRecHitsValidation(const edm::ParameterSet &ps);
0054 
0055   /// Destructor
0056   ~EcalRecHitsValidation() override;
0057 
0058 protected:
0059   void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override;
0060   /// Analyze
0061   void analyze(const edm::Event &e, const edm::EventSetup &c) override;
0062 
0063   uint32_t getUnitWithMaxEnergy(MapType &themap);
0064   void findBarrelMatrix(int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &themap);
0065   void findEndcapMatrix(int nCellInX, int nCellInY, int CentralX, int CentralY, int CentralZ, MapType &themap);
0066 
0067 private:
0068   std::string HepMCLabel;
0069   std::string hitsProducer_;
0070 
0071   bool verbose_;
0072 
0073   std::string outputFile_;
0074 
0075   edm::InputTag EBrechitCollection_;
0076   edm::InputTag EErechitCollection_;
0077   edm::InputTag ESrechitCollection_;
0078   edm::InputTag EBuncalibrechitCollection_;
0079   edm::InputTag EEuncalibrechitCollection_;
0080   bool enableEndcaps_;
0081   // fix for consumes
0082   edm::EDGetTokenT<edm::HepMCProduct> HepMCLabel_Token_;
0083   edm::EDGetTokenT<EBRecHitCollection> EBrechitCollection_Token_;
0084   edm::EDGetTokenT<EERecHitCollection> EErechitCollection_Token_;
0085   edm::EDGetTokenT<ESRecHitCollection> ESrechitCollection_Token_;
0086   edm::EDGetTokenT<EBUncalibratedRecHitCollection> EBuncalibrechitCollection_Token_;
0087   edm::EDGetTokenT<EEUncalibratedRecHitCollection> EEuncalibrechitCollection_Token_;
0088   edm::EDGetTokenT<CrossingFrame<PCaloHit>> EBHits_Token_;
0089   edm::EDGetTokenT<CrossingFrame<PCaloHit>> EEHits_Token_;
0090   edm::EDGetTokenT<CrossingFrame<PCaloHit>> ESHits_Token_;
0091   edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> pAgc;
0092   edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> pEcsToken;
0093   edm::ESGetToken<EcalTrigTowerConstituentsMap, IdealGeometryRecord> pttMapToken;
0094 
0095   MonitorElement *meGunEnergy_;
0096   MonitorElement *meGunEta_;
0097   MonitorElement *meGunPhi_;
0098   MonitorElement *meEBRecHitSimHitRatio_;
0099   MonitorElement *meEERecHitSimHitRatio_;
0100   MonitorElement *meESRecHitSimHitRatio_;
0101   MonitorElement *meEBRecHitSimHitRatio1011_;
0102   MonitorElement *meEERecHitSimHitRatio1011_;
0103   MonitorElement *meEBRecHitSimHitRatio12_;
0104   MonitorElement *meEERecHitSimHitRatio12_;
0105   MonitorElement *meEBRecHitSimHitRatio13_;
0106   MonitorElement *meEERecHitSimHitRatio13_;
0107   MonitorElement *meEBRecHitSimHitRatioGt35_;
0108   MonitorElement *meEERecHitSimHitRatioGt35_;
0109   MonitorElement *meEBUnRecHitSimHitRatio_;
0110   MonitorElement *meEEUnRecHitSimHitRatio_;
0111   MonitorElement *meEBUnRecHitSimHitRatioGt35_;
0112   MonitorElement *meEEUnRecHitSimHitRatioGt35_;
0113   MonitorElement *meEBe5x5_;
0114   MonitorElement *meEBe5x5OverSimHits_;
0115   MonitorElement *meEBe5x5OverGun_;
0116   MonitorElement *meEEe5x5_;
0117   MonitorElement *meEEe5x5OverSimHits_;
0118   MonitorElement *meEEe5x5OverGun_;
0119 
0120   MonitorElement *meEBRecHitLog10Energy_;
0121   MonitorElement *meEERecHitLog10Energy_;
0122   MonitorElement *meESRecHitLog10Energy_;
0123   MonitorElement *meEBRecHitLog10EnergyContr_;
0124   MonitorElement *meEERecHitLog10EnergyContr_;
0125   MonitorElement *meESRecHitLog10EnergyContr_;
0126   MonitorElement *meEBRecHitLog10Energy5x5Contr_;
0127   MonitorElement *meEERecHitLog10Energy5x5Contr_;
0128 
0129   MonitorElement *meEBRecHitsOccupancyFlag5_6_;
0130   MonitorElement *meEBRecHitsOccupancyFlag8_9_;
0131 
0132   MonitorElement *meEERecHitsOccupancyPlusFlag5_6_;
0133   MonitorElement *meEERecHitsOccupancyMinusFlag5_6_;
0134   MonitorElement *meEERecHitsOccupancyPlusFlag8_9_;
0135   MonitorElement *meEERecHitsOccupancyMinusFlag8_9_;
0136 
0137   MonitorElement *meEBRecHitFlags_;
0138   MonitorElement *meEBRecHitSimHitvsSimHitFlag5_6_;
0139   MonitorElement *meEBRecHitSimHitFlag6_;
0140   MonitorElement *meEBRecHitSimHitFlag7_;
0141   MonitorElement *meEB5x5RecHitSimHitvsSimHitFlag8_;
0142 
0143   MonitorElement *meEERecHitFlags_;
0144   MonitorElement *meEERecHitSimHitvsSimHitFlag5_6_;
0145   MonitorElement *meEERecHitSimHitFlag6_;
0146   MonitorElement *meEERecHitSimHitFlag7_;
0147 
0148   std::vector<uint32_t> crystalMatrix;
0149 };
0150 
0151 #endif