Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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