Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-13 03:16:17

0001 #ifndef GlobalHitsProdHist_h
0002 #define GlobalHitsProdHist_h
0003 
0004 /** \class GlobalHitsProdHist
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/Framework/interface/Run.h"
0021 #include "FWCore/Framework/interface/one/EDProducer.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 #include "FWCore/Utilities/interface/InputTag.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 <iostream>
0067 #include <memory>
0068 #include <string>
0069 #include <vector>
0070 
0071 #include "TH1F.h"
0072 #include "TString.h"
0073 
0074 class GlobalHitsProdHist : public edm::one::EDProducer<edm::EndRunProducer> {
0075 public:
0076   // typedef std::vector<float> FloatVector;
0077 
0078   explicit GlobalHitsProdHist(const edm::ParameterSet &);
0079   ~GlobalHitsProdHist() override;
0080   void beginJob() override;
0081   void endJob() override;
0082   void produce(edm::Event &, const edm::EventSetup &) override;
0083   void endRunProduce(edm::Run &, const edm::EventSetup &) override;
0084 
0085 private:
0086   // production related methods
0087   void fillG4MC(edm::Event &);
0088   void fillTrk(edm::Event &, const edm::EventSetup &);
0089   void fillMuon(edm::Event &, const edm::EventSetup &);
0090   void fillECal(edm::Event &, const edm::EventSetup &);
0091   void fillHCal(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   bool getAllProvenances;
0100   bool printProvenanceInfo;
0101 
0102   // DQMStore *dbe;
0103   // std::string outputfile;
0104 
0105   std::vector<std::string> histName_;
0106   std::map<std::string, TH1F *> histMap_;
0107 
0108   // G4MC info
0109   TH1F *hMCRGP[2];
0110   TH1F *hMCG4Vtx[2];
0111   TH1F *hGeantVtxX[2];
0112   TH1F *hGeantVtxY[2];
0113   TH1F *hGeantVtxZ[2];
0114   TH1F *hMCG4Trk[2];
0115   TH1F *hGeantTrkPt;
0116   TH1F *hGeantTrkE;
0117   int nRawGenPart;
0118 
0119   edm::InputTag G4VtxSrc_;
0120   edm::InputTag G4TrkSrc_;
0121   edm::EDGetTokenT<edm::SimVertexContainer> G4VtxSrc_Token_;
0122   edm::EDGetTokenT<edm::SimTrackContainer> G4TrkSrc_Token_;
0123 
0124   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tGeomToken_;
0125   edm::ESGetToken<CSCGeometry, MuonGeometryRecord> cscGeomToken_;
0126   edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomToken_;
0127   edm::ESGetToken<RPCGeometry, MuonGeometryRecord> rpcGeomToken_;
0128   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeomToken_;
0129   // Electromagnetic info
0130   // ECal info
0131   TH1F *hCaloEcal[2];
0132   TH1F *hCaloEcalE[2];
0133   TH1F *hCaloEcalToF[2];
0134   TH1F *hCaloEcalPhi;
0135   TH1F *hCaloEcalEta;
0136   edm::InputTag ECalEBSrc_;
0137   edm::InputTag ECalEESrc_;
0138   edm::EDGetTokenT<edm::PCaloHitContainer> ECalEBSrc_Token_;
0139   edm::EDGetTokenT<edm::PCaloHitContainer> ECalEESrc_Token_;
0140 
0141   // Preshower info
0142   TH1F *hCaloPreSh[2];
0143   TH1F *hCaloPreShE[2];
0144   TH1F *hCaloPreShToF[2];
0145   TH1F *hCaloPreShPhi;
0146   TH1F *hCaloPreShEta;
0147   edm::InputTag ECalESSrc_;
0148   edm::EDGetTokenT<edm::PCaloHitContainer> ECalESSrc_Token_;
0149 
0150   // Hadronic info
0151   // HCal info
0152   TH1F *hCaloHcal[2];
0153   TH1F *hCaloHcalE[2];
0154   TH1F *hCaloHcalToF[2];
0155   TH1F *hCaloHcalPhi;
0156   TH1F *hCaloHcalEta;
0157   edm::InputTag HCalSrc_;
0158   edm::EDGetTokenT<edm::PCaloHitContainer> HCalSrc_Token_;
0159 
0160   // Tracker info
0161   // Pixel info
0162   int nPxlHits;
0163   TH1F *hTrackerPx[2];
0164   TH1F *hTrackerPxPhi;
0165   TH1F *hTrackerPxEta;
0166   TH1F *hTrackerPxBToF;
0167   TH1F *hTrackerPxBR;
0168   TH1F *hTrackerPxFToF;
0169   TH1F *hTrackerPxFZ;
0170   edm::InputTag PxlBrlLowSrc_;
0171   edm::InputTag PxlBrlHighSrc_;
0172   edm::InputTag PxlFwdLowSrc_;
0173   edm::InputTag PxlFwdHighSrc_;
0174   edm::EDGetTokenT<edm::PSimHitContainer> PxlBrlLowSrc_Token_;
0175   edm::EDGetTokenT<edm::PSimHitContainer> PxlBrlHighSrc_Token_;
0176   edm::EDGetTokenT<edm::PSimHitContainer> PxlFwdLowSrc_Token_;
0177   edm::EDGetTokenT<edm::PSimHitContainer> PxlFwdHighSrc_Token_;
0178 
0179   // Strip info
0180   int nSiHits;
0181   TH1F *hTrackerSi[2];
0182   TH1F *hTrackerSiPhi;
0183   TH1F *hTrackerSiEta;
0184   TH1F *hTrackerSiBToF;
0185   TH1F *hTrackerSiBR;
0186   TH1F *hTrackerSiFToF;
0187   TH1F *hTrackerSiFZ;
0188   edm::InputTag SiTIBLowSrc_;
0189   edm::InputTag SiTIBHighSrc_;
0190   edm::InputTag SiTOBLowSrc_;
0191   edm::InputTag SiTOBHighSrc_;
0192   edm::InputTag SiTIDLowSrc_;
0193   edm::InputTag SiTIDHighSrc_;
0194   edm::InputTag SiTECLowSrc_;
0195   edm::InputTag SiTECHighSrc_;
0196   edm::EDGetTokenT<edm::PSimHitContainer> SiTIBLowSrc_Token_;
0197   edm::EDGetTokenT<edm::PSimHitContainer> SiTIBHighSrc_Token_;
0198   edm::EDGetTokenT<edm::PSimHitContainer> SiTOBLowSrc_Token_;
0199   edm::EDGetTokenT<edm::PSimHitContainer> SiTOBHighSrc_Token_;
0200   edm::EDGetTokenT<edm::PSimHitContainer> SiTIDLowSrc_Token_;
0201   edm::EDGetTokenT<edm::PSimHitContainer> SiTIDHighSrc_Token_;
0202   edm::EDGetTokenT<edm::PSimHitContainer> SiTECLowSrc_Token_;
0203   edm::EDGetTokenT<edm::PSimHitContainer> SiTECHighSrc_Token_;
0204 
0205   // Muon info
0206   TH1F *hMuon[2];
0207   TH1F *hMuonPhi;
0208   TH1F *hMuonEta;
0209   int nMuonHits;
0210 
0211   // DT info
0212   TH1F *hMuonDtToF[2];
0213   TH1F *hMuonDtR;
0214   edm::InputTag MuonDtSrc_;
0215   edm::EDGetTokenT<edm::PSimHitContainer> MuonDtSrc_Token_;
0216   // CSC info
0217   TH1F *hMuonCscToF[2];
0218   TH1F *hMuonCscZ;
0219   edm::InputTag MuonCscSrc_;
0220   edm::EDGetTokenT<edm::PSimHitContainer> MuonCscSrc_Token_;
0221   // RPC info
0222   TH1F *hMuonRpcFToF[2];
0223   TH1F *hMuonRpcFZ;
0224   TH1F *hMuonRpcBToF[2];
0225   TH1F *hMuonRpcBR;
0226   edm::InputTag MuonRpcSrc_;
0227   edm::EDGetTokenT<edm::PSimHitContainer> MuonRpcSrc_Token_;
0228 
0229   // private statistics information
0230   unsigned int count;
0231 
0232 };  // end class declaration
0233 
0234 #endif
0235 
0236 #ifndef GlobalHitMap
0237 #define GlobalHitMap
0238 // geometry mapping
0239 static const int dTrk = 1;
0240 static const int sdPxlBrl = 1;
0241 static const int sdPxlFwd = 2;
0242 static const int sdSiTIB = 3;
0243 static const int sdSiTID = 4;
0244 static const int sdSiTOB = 5;
0245 static const int sdSiTEC = 6;
0246 
0247 static const int dMuon = 2;
0248 static const int sdMuonDT = 1;
0249 static const int sdMuonCSC = 2;
0250 static const int sdMuonRPC = 3;
0251 static const int sdMuonRPCRgnBrl = 0;
0252 static const int sdMuonRPCRgnFwdp = 1;
0253 static const int sdMuonRPCRgnFwdn = -1;
0254 
0255 static const int dEcal = 3;
0256 static const int sdEcalBrl = 1;
0257 static const int sdEcalFwd = 2;
0258 static const int sdEcalPS = 3;
0259 static const int sdEcalTT = 4;
0260 static const int sdEcalLPnD = 5;
0261 
0262 static const int dHcal = 4;
0263 static const int sdHcalEmpty = 0;
0264 static const int sdHcalBrl = 1;
0265 static const int sdHcalEC = 2;
0266 static const int sdHcalOut = 3;
0267 static const int sdHcalFwd = 4;
0268 static const int sdHcalTT = 5;
0269 static const int sdHcalCalib = 6;
0270 static const int sdHcalCompst = 7;
0271 
0272 #endif