Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-31 23:14:20

0001 #ifndef GlobalDigisAnalyzer_h
0002 #define GlobalDigisAnalyzer_h
0003 
0004 /** \class GlobalDigiAnalyzer
0005  *
0006  *  Class to fill PGlobalDigi object to be inserted into data stream
0007  *  containing information about various sub-systems in global coordinates
0008  *  with full geometry
0009  *
0010  *  \author M. Strang SUNY-Buffalo
0011  */
0012 
0013 // framework & common header files
0014 #include "DataFormats/Common/interface/Handle.h"
0015 #include "DataFormats/Provenance/interface/Provenance.h"
0016 #include "FWCore/Framework/interface/ESHandle.h"
0017 #include "FWCore/Framework/interface/Event.h"
0018 #include "FWCore/Framework/interface/EventSetup.h"
0019 #include "FWCore/Framework/interface/Frameworkfwd.h"
0020 #include "FWCore/Framework/interface/MakerMacros.h"
0021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0023 
0024 // DQM services
0025 #include "DQMServices/Core/interface/DQMStore.h"
0026 #include "FWCore/ServiceRegistry/interface/Service.h"
0027 
0028 // ecal calorimeter info
0029 #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h"
0030 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0031 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0032 #include "DataFormats/EcalDetId/interface/ESDetId.h"
0033 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
0034 #include "DataFormats/EcalDigi/interface/EEDataFrame.h"
0035 #include "DataFormats/EcalDigi/interface/ESDataFrame.h"
0036 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0037 
0038 // hcal calorimeter info
0039 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
0040 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
0041 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
0042 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
0043 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0044 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
0045 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0046 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
0047 #include "DataFormats/HcalDigi/interface/HFDataFrame.h"
0048 #include "DataFormats/HcalDigi/interface/HODataFrame.h"
0049 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0050 #include "DataFormats/HcalDigi/interface/HcalQIESample.h"
0051 
0052 // silicon strip info
0053 #include "DataFormats/Common/interface/DetSetVector.h"
0054 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0055 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
0056 
0057 // silicon pixel info
0058 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0059 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
0060 
0061 // muon DT info
0062 #include "DataFormats/DTDigi/interface/DTDigi.h"
0063 #include "DataFormats/DTDigi/interface/DTDigiCollection.h"
0064 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0065 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0066 
0067 // muon CSC Strip info
0068 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h"
0069 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
0070 
0071 // muon CSC Wire info
0072 #include "DataFormats/CSCDigi/interface/CSCWireDigi.h"
0073 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
0074 
0075 // muon RPC info
0076 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0077 #include "DataFormats/RPCDigi/interface/RPCDigi.h"
0078 #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h"
0079 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
0080 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0081 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0082 
0083 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0084 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0085 #include "Geometry/CommonTopologies/interface/RectangularStripTopology.h"
0086 #include "Geometry/CommonTopologies/interface/TrapezoidalStripTopology.h"
0087 
0088 // event info
0089 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
0090 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0091 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
0092 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
0093 
0094 #include <cstdlib>
0095 #include <map>
0096 #include <memory>
0097 #include <string>
0098 #include <vector>
0099 
0100 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0101 #include "TString.h"
0102 
0103 class PGlobalDigi;
0104 class TrackerTopology;
0105 class TrackerTopologyRcd;
0106 class GlobalDigisAnalyzer : public DQMEDAnalyzer {
0107 public:
0108   typedef std::vector<float> FloatVector;
0109   typedef std::vector<double> DoubleVector;
0110   typedef std::vector<int> IntVector;
0111   typedef std::map<uint32_t, float, std::less<uint32_t>> MapType;
0112 
0113   explicit GlobalDigisAnalyzer(const edm::ParameterSet &);
0114   ~GlobalDigisAnalyzer() override;
0115   void analyze(const edm::Event &, const edm::EventSetup &) override;
0116 
0117 protected:
0118   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0119 
0120 private:
0121   // production related methods
0122   void fillECal(const edm::Event &, const edm::EventSetup &);
0123   // void storeECal(PGlobalDigi&);
0124   void fillHCal(const edm::Event &, const edm::EventSetup &);
0125   // void storeHCal(PGlobalDigi&);
0126   void fillTrk(const edm::Event &, const edm::EventSetup &);
0127   // void storeTrk(PGlobalDigi&);
0128   void fillMuon(const edm::Event &, const edm::EventSetup &);
0129   // void storeMuon(PGlobalDigi&);
0130 
0131   // void clear();
0132 
0133 private:
0134   //  parameter information
0135   std::string fName;
0136   int verbosity;
0137   int frequency;
0138   std::string label;
0139   bool getAllProvenances;
0140   bool printProvenanceInfo;
0141   std::string hitsProducer;
0142 
0143   // Electromagnetic info
0144   // ECal info
0145 
0146   MonitorElement *mehEcaln[2];
0147   MonitorElement *mehEScaln;
0148   MonitorElement *mehEcalAEE[2];
0149   MonitorElement *mehEcalSHE[2];
0150   MonitorElement *mehEcalMaxPos[2];
0151   MonitorElement *mehEcalMultvAEE[2];
0152   MonitorElement *mehEcalSHEvAEESHE[2];
0153   MonitorElement *mehEScalADC[3];
0154 
0155   edm::InputTag ECalEBSrc_;
0156   edm::InputTag ECalEESrc_;
0157   edm::InputTag ECalESSrc_;
0158   edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> ecalADCtoGevToken_;
0159   edm::ESGetToken<RPCGeometry, MuonGeometryRecord> rpcGeomToken_;
0160   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
0161   edm::ESGetToken<HcalDbService, HcalDbRecord> hcaldbToken_;
0162 
0163   std::map<int, double, std::less<int>> ECalgainConv_;
0164   double ECalbarrelADCtoGeV_;
0165   double ECalendcapADCtoGeV_;
0166 
0167   // HCal info
0168 
0169   MonitorElement *mehHcaln[4];
0170   MonitorElement *mehHcalAEE[4];
0171   MonitorElement *mehHcalSHE[4];
0172   MonitorElement *mehHcalAEESHE[4];
0173   MonitorElement *mehHcalSHEvAEE[4];
0174 
0175   edm::InputTag HCalSrc_;
0176   edm::InputTag HCalDigi_;
0177 
0178   // Tracker info
0179   // SiStrip
0180 
0181   MonitorElement *mehSiStripn[19];
0182   MonitorElement *mehSiStripADC[19];
0183   MonitorElement *mehSiStripStrip[19];
0184 
0185   edm::InputTag SiStripSrc_;
0186 
0187   // SiPxl
0188 
0189   MonitorElement *mehSiPixeln[7];
0190   MonitorElement *mehSiPixelADC[7];
0191   MonitorElement *mehSiPixelRow[7];
0192   MonitorElement *mehSiPixelCol[7];
0193 
0194   edm::InputTag SiPxlSrc_;
0195 
0196   // Muon info
0197   // DT
0198 
0199   MonitorElement *mehDtMuonn[4];
0200   MonitorElement *mehDtMuonLayer[4];
0201   MonitorElement *mehDtMuonTime[4];
0202   MonitorElement *mehDtMuonTimevLayer[4];
0203 
0204   edm::InputTag MuDTSrc_;
0205 
0206   // CSC
0207 
0208   MonitorElement *mehCSCStripn;
0209   MonitorElement *mehCSCStripADC;
0210   MonitorElement *mehCSCWiren;
0211   MonitorElement *mehCSCWireTime;
0212 
0213   edm::InputTag MuCSCStripSrc_;
0214   float theCSCStripPedestalSum;
0215   int theCSCStripPedestalCount;
0216 
0217   edm::InputTag MuCSCWireSrc_;
0218 
0219   // RPC
0220   MonitorElement *mehRPCMuonn;
0221   MonitorElement *mehRPCRes[5];
0222 
0223   edm::InputTag MuRPCSrc_;
0224 
0225   // fix for consumes
0226   edm::EDGetTokenT<EBDigiCollection> ECalEBSrc_Token_;
0227   edm::EDGetTokenT<EEDigiCollection> ECalEESrc_Token_;
0228   edm::EDGetTokenT<ESDigiCollection> ECalESSrc_Token_;
0229   edm::EDGetTokenT<edm::PCaloHitContainer> HCalSrc_Token_;
0230   edm::EDGetTokenT<edm::SortedCollection<HBHEDataFrame>> HBHEDigi_Token_;
0231   edm::EDGetTokenT<edm::SortedCollection<HODataFrame>> HODigi_Token_;
0232   edm::EDGetTokenT<edm::SortedCollection<HFDataFrame>> HFDigi_Token_;
0233   edm::EDGetTokenT<edm::DetSetVector<SiStripDigi>> SiStripSrc_Token_;
0234   edm::EDGetTokenT<edm::DetSetVector<PixelDigi>> SiPxlSrc_Token_;
0235   edm::EDGetTokenT<DTDigiCollection> MuDTSrc_Token_;
0236   edm::EDGetTokenT<CSCStripDigiCollection> MuCSCStripSrc_Token_;
0237   edm::EDGetTokenT<CSCWireDigiCollection> MuCSCWireSrc_Token_;
0238   edm::EDGetTokenT<RPCDigiCollection> MuRPCSrc_Token_;
0239   edm::EDGetTokenT<CrossingFrame<PCaloHit>> EBHits_Token_;
0240   edm::EDGetTokenT<CrossingFrame<PCaloHit>> EEHits_Token_;
0241   edm::EDGetTokenT<CrossingFrame<PCaloHit>> ESHits_Token_;
0242   edm::EDGetTokenT<edm::PSimHitContainer> RPCSimHit_Token_;
0243 
0244   // private statistics information
0245   unsigned int count;
0246 
0247 };  // end class declaration
0248 
0249 #endif
0250 
0251 #ifndef GlobalHitMap
0252 #define GlobalHitMap
0253 
0254 // geometry mapping
0255 static const int dTrk = 1;
0256 static const int sdPxlBrl = 1;
0257 static const int sdPxlFwd = 2;
0258 static const int sdSiTIB = 3;
0259 static const int sdSiTID = 4;
0260 static const int sdSiTOB = 5;
0261 static const int sdSiTEC = 6;
0262 
0263 static const int dMuon = 2;
0264 static const int sdMuonDT = 1;
0265 static const int sdMuonCSC = 2;
0266 static const int sdMuonRPC = 3;
0267 static const int sdMuonRPCRgnBrl = 0;
0268 static const int sdMuonRPCRgnFwdp = 1;
0269 static const int sdMuonRPCRgnFwdn = -1;
0270 
0271 static const int dEcal = 3;
0272 static const int sdEcalBrl = 1;
0273 static const int sdEcalFwd = 2;
0274 static const int sdEcalPS = 3;
0275 static const int sdEcalTT = 4;
0276 static const int sdEcalLPnD = 5;
0277 
0278 static const int dHcal = 4;
0279 static const int sdHcalEmpty = 0;
0280 static const int sdHcalBrl = 1;
0281 static const int sdHcalEC = 2;
0282 static const int sdHcalOut = 3;
0283 static const int sdHcalFwd = 4;
0284 static const int sdHcalTT = 5;
0285 static const int sdHcalCalib = 6;
0286 static const int sdHcalCompst = 7;
0287 
0288 #endif  // PGlobalDigisAnalyzer_h