Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef GlobalHitsAnalyzer_h
0002 #define GlobalHitsAnalyzer_h
0003 
0004 /** \class GlobalHitsAnalyzer
0005  *
0006  *  Class to fill dqm monitor elements from existing EDM file
0007  *
0008  *  \author M. Strang SUNY-Buffalo
0009  */
0010 
0011 // framework & common header files
0012 #include "DataFormats/Common/interface/Handle.h"
0013 #include "DataFormats/DetId/interface/DetId.h"
0014 #include "DataFormats/Provenance/interface/Provenance.h"
0015 #include "FWCore/Framework/interface/ESHandle.h"
0016 #include "FWCore/Framework/interface/Event.h"
0017 #include "FWCore/Framework/interface/EventSetup.h"
0018 #include "FWCore/Framework/interface/Frameworkfwd.h"
0019 #include "FWCore/Framework/interface/MakerMacros.h"
0020 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 #include "FWCore/Utilities/interface/InputTag.h"
0023 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0024 
0025 // DQM services
0026 #include "DQMServices/Core/interface/DQMStore.h"
0027 #include "FWCore/ServiceRegistry/interface/Service.h"
0028 
0029 // tracker info
0030 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0031 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0032 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0033 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0034 
0035 // muon info
0036 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0037 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
0038 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0039 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
0040 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0041 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
0042 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0043 
0044 // calorimeter info
0045 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0046 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0047 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0048 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0049 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0050 
0051 // data in edm::event
0052 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0053 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0054 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0055 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0056 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0057 
0058 // helper files
0059 //#include <CLHEP/Vector/LorentzVector.h>
0060 #include "CLHEP/Units/GlobalSystemOfUnits.h"
0061 #include "DataFormats/Math/interface/LorentzVector.h"
0062 
0063 #include <cstdlib>
0064 #include <memory>
0065 #include <string>
0066 #include <vector>
0067 
0068 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0069 #include "TString.h"
0070 
0071 class HcalDDDRecConstants;
0072 class CaloGeometryRecord;
0073 class HcalRecNumberingRecord;
0074 class GlobalHitsAnalyzer : public DQMEDAnalyzer {
0075 public:
0076   // typedef std::vector<float> FloatVector;
0077 
0078   explicit GlobalHitsAnalyzer(const edm::ParameterSet &);
0079   ~GlobalHitsAnalyzer() override;
0080   void analyze(const edm::Event &, const edm::EventSetup &) override;
0081 
0082 protected:
0083   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0084 
0085 private:
0086   // production related methods
0087   void fillG4MC(const edm::Event &);
0088   void fillTrk(const edm::Event &, const edm::EventSetup &);
0089   void fillMuon(const edm::Event &, const edm::EventSetup &);
0090   void fillECal(const edm::Event &, const edm::EventSetup &);
0091   void fillHCal(const edm::Event &, const edm::EventSetup &);
0092 
0093 private:
0094   //  parameter information
0095   std::string fName;
0096   int verbosity;
0097   int frequency;
0098   int vtxunit;
0099   std::string label;
0100   bool getAllProvenances;
0101   bool printProvenanceInfo;
0102   bool testNumber;
0103 
0104   bool validHepMCevt;
0105   bool validG4VtxContainer;
0106   bool validG4trkContainer;
0107   bool validPxlBrlLow;
0108   bool validPxlBrlHigh;
0109   bool validPxlFwdLow;
0110   bool validPxlFwdHigh;
0111   bool validSiTIBLow;
0112   bool validSiTIBHigh;
0113   bool validSiTOBLow;
0114   bool validSiTOBHigh;
0115   bool validSiTIDLow;
0116   bool validSiTIDHigh;
0117   bool validSiTECLow;
0118   bool validSiTECHigh;
0119   bool validMuonCSC;
0120   bool validMuonDt;
0121   bool validMuonRPC;
0122   bool validEB;
0123   bool validEE;
0124   bool validPresh;
0125   bool validHcal;
0126 
0127   // G4MC info
0128   MonitorElement *meMCRGP[2];
0129   MonitorElement *meMCG4Vtx[2];
0130   MonitorElement *meGeantVtxX[2];
0131   MonitorElement *meGeantVtxY[2];
0132   MonitorElement *meGeantVtxZ[2];
0133   MonitorElement *meMCG4Trk[2];
0134   MonitorElement *meGeantTrkPt;
0135   MonitorElement *meGeantTrkE;
0136   MonitorElement *meGeantVtxEta;
0137   MonitorElement *meGeantVtxPhi;
0138   MonitorElement *meGeantVtxRad[2];
0139   MonitorElement *meGeantVtxMulti;
0140   int nRawGenPart;
0141 
0142   edm::InputTag G4VtxSrc_;
0143   edm::InputTag G4TrkSrc_;
0144   edm::EDGetTokenT<edm::SimVertexContainer> G4VtxSrc_Token_;
0145   edm::EDGetTokenT<edm::SimTrackContainer> G4TrkSrc_Token_;
0146 
0147   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tGeomToken_;
0148   edm::ESGetToken<CSCGeometry, MuonGeometryRecord> cscGeomToken_;
0149   edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomToken_;
0150   edm::ESGetToken<RPCGeometry, MuonGeometryRecord> rpcGeomToken_;
0151   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeomToken_;
0152   edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> hcaldddRecToken_;
0153 
0154   // Electromagnetic info
0155   // ECal info
0156   MonitorElement *meCaloEcal[2];
0157   MonitorElement *meCaloEcalE[2];
0158   MonitorElement *meCaloEcalToF[2];
0159   MonitorElement *meCaloEcalPhi;
0160   MonitorElement *meCaloEcalEta;
0161   edm::InputTag ECalEBSrc_;
0162   edm::InputTag ECalEESrc_;
0163   edm::EDGetTokenT<edm::PCaloHitContainer> ECalEBSrc_Token_;
0164   edm::EDGetTokenT<edm::PCaloHitContainer> ECalEESrc_Token_;
0165 
0166   // Preshower info
0167   MonitorElement *meCaloPreSh[2];
0168   MonitorElement *meCaloPreShE[2];
0169   MonitorElement *meCaloPreShToF[2];
0170   MonitorElement *meCaloPreShPhi;
0171   MonitorElement *meCaloPreShEta;
0172   edm::InputTag ECalESSrc_;
0173   edm::EDGetTokenT<edm::PCaloHitContainer> ECalESSrc_Token_;
0174 
0175   // Hadronic info
0176   // HCal info
0177   MonitorElement *meCaloHcal[2];
0178   MonitorElement *meCaloHcalE[2];
0179   MonitorElement *meCaloHcalToF[2];
0180   MonitorElement *meCaloHcalPhi;
0181   MonitorElement *meCaloHcalEta;
0182   edm::InputTag HCalSrc_;
0183   edm::EDGetTokenT<edm::PCaloHitContainer> HCalSrc_Token_;
0184 
0185   // Tracker info
0186   // Pixel info
0187   int nPxlHits;
0188   MonitorElement *meTrackerPx[2];
0189   MonitorElement *meTrackerPxPhi;
0190   MonitorElement *meTrackerPxEta;
0191   MonitorElement *meTrackerPxBToF;
0192   MonitorElement *meTrackerPxBR;
0193   MonitorElement *meTrackerPxFToF;
0194   MonitorElement *meTrackerPxFZ;
0195   edm::InputTag PxlBrlLowSrc_;
0196   edm::InputTag PxlBrlHighSrc_;
0197   edm::InputTag PxlFwdLowSrc_;
0198   edm::InputTag PxlFwdHighSrc_;
0199   edm::EDGetTokenT<edm::PSimHitContainer> PxlBrlLowSrc_Token_;
0200   edm::EDGetTokenT<edm::PSimHitContainer> PxlBrlHighSrc_Token_;
0201   edm::EDGetTokenT<edm::PSimHitContainer> PxlFwdLowSrc_Token_;
0202   edm::EDGetTokenT<edm::PSimHitContainer> PxlFwdHighSrc_Token_;
0203 
0204   // Strip info
0205   int nSiHits;
0206   MonitorElement *meTrackerSi[2];
0207   MonitorElement *meTrackerSiPhi;
0208   MonitorElement *meTrackerSiEta;
0209   MonitorElement *meTrackerSiBToF;
0210   MonitorElement *meTrackerSiBR;
0211   MonitorElement *meTrackerSiFToF;
0212   MonitorElement *meTrackerSiFZ;
0213   edm::InputTag SiTIBLowSrc_;
0214   edm::InputTag SiTIBHighSrc_;
0215   edm::InputTag SiTOBLowSrc_;
0216   edm::InputTag SiTOBHighSrc_;
0217   edm::InputTag SiTIDLowSrc_;
0218   edm::InputTag SiTIDHighSrc_;
0219   edm::InputTag SiTECLowSrc_;
0220   edm::InputTag SiTECHighSrc_;
0221   edm::EDGetTokenT<edm::PSimHitContainer> SiTIBLowSrc_Token_;
0222   edm::EDGetTokenT<edm::PSimHitContainer> SiTIBHighSrc_Token_;
0223   edm::EDGetTokenT<edm::PSimHitContainer> SiTOBLowSrc_Token_;
0224   edm::EDGetTokenT<edm::PSimHitContainer> SiTOBHighSrc_Token_;
0225   edm::EDGetTokenT<edm::PSimHitContainer> SiTIDLowSrc_Token_;
0226   edm::EDGetTokenT<edm::PSimHitContainer> SiTIDHighSrc_Token_;
0227   edm::EDGetTokenT<edm::PSimHitContainer> SiTECLowSrc_Token_;
0228   edm::EDGetTokenT<edm::PSimHitContainer> SiTECHighSrc_Token_;
0229 
0230   // Muon info
0231   MonitorElement *meMuon[2];
0232   MonitorElement *meMuonPhi;
0233   MonitorElement *meMuonEta;
0234   int nMuonHits;
0235 
0236   // DT info
0237   MonitorElement *meMuonDtToF[2];
0238   MonitorElement *meMuonDtR;
0239   edm::InputTag MuonDtSrc_;
0240   edm::EDGetTokenT<edm::PSimHitContainer> MuonDtSrc_Token_;
0241   // CSC info
0242   MonitorElement *meMuonCscToF[2];
0243   MonitorElement *meMuonCscZ;
0244   edm::InputTag MuonCscSrc_;
0245   edm::EDGetTokenT<edm::PSimHitContainer> MuonCscSrc_Token_;
0246   // RPC info
0247   MonitorElement *meMuonRpcFToF[2];
0248   MonitorElement *meMuonRpcFZ;
0249   MonitorElement *meMuonRpcBToF[2];
0250   MonitorElement *meMuonRpcBR;
0251   edm::InputTag MuonRpcSrc_;
0252   edm::EDGetTokenT<edm::PSimHitContainer> MuonRpcSrc_Token_;
0253 
0254   // private statistics information
0255   unsigned int count;
0256 
0257 };  // end class declaration
0258 
0259 #endif
0260 
0261 #ifndef GlobalHitMap
0262 #define GlobalHitMap
0263 // geometry mapping
0264 static const int dTrk = 1;
0265 static const int sdPxlBrl = 1;
0266 static const int sdPxlFwd = 2;
0267 static const int sdSiTIB = 3;
0268 static const int sdSiTID = 4;
0269 static const int sdSiTOB = 5;
0270 static const int sdSiTEC = 6;
0271 
0272 static const int dMuon = 2;
0273 static const int sdMuonDT = 1;
0274 static const int sdMuonCSC = 2;
0275 static const int sdMuonRPC = 3;
0276 static const int sdMuonRPCRgnBrl = 0;
0277 static const int sdMuonRPCRgnFwdp = 1;
0278 static const int sdMuonRPCRgnFwdn = -1;
0279 
0280 static const int dEcal = 3;
0281 static const int sdEcalBrl = 1;
0282 static const int sdEcalFwd = 2;
0283 static const int sdEcalPS = 3;
0284 static const int sdEcalTT = 4;
0285 static const int sdEcalLPnD = 5;
0286 
0287 static const int dHcal = 4;
0288 static const int sdHcalEmpty = 0;
0289 static const int sdHcalBrl = 1;
0290 static const int sdHcalEC = 2;
0291 static const int sdHcalOut = 3;
0292 static const int sdHcalFwd = 4;
0293 static const int sdHcalTT = 5;
0294 static const int sdHcalCalib = 6;
0295 static const int sdHcalCompst = 7;
0296 
0297 #endif