Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef GlobalHitsProducer_h
0002 #define GlobalHitsProducer_h
0003 
0004 /** \class GlobalHitsProducer
0005  *
0006  *  Class to fill PGlobalSimHit 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/DetId/interface/DetId.h"
0016 #include "DataFormats/Provenance/interface/Provenance.h"
0017 #include "FWCore/Framework/interface/one/EDProducer.h"
0018 #include "FWCore/Framework/interface/ESHandle.h"
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/Framework/interface/EventSetup.h"
0021 #include "FWCore/Framework/interface/Frameworkfwd.h"
0022 #include "FWCore/Framework/interface/MakerMacros.h"
0023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0025 #include "FWCore/Utilities/interface/InputTag.h"
0026 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0027 
0028 // tracker info
0029 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0030 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0031 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0032 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0033 
0034 // muon info
0035 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0036 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
0037 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0038 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
0039 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0040 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
0041 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0042 
0043 // calorimeter info
0044 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0045 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0046 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0047 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0048 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0049 
0050 // data in edm::event
0051 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0052 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0053 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0054 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0055 #include "SimDataFormats/ValidationFormats/interface/PValidationFormats.h"
0056 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0057 //#include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
0058 //#include "SimDataFormats/CrossingFrame/interface/MixCollection.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 "TString.h"
0072 
0073 class PGlobalSimHit;
0074 class CaloGeometryRecord;
0075 class GlobalHitsProducer : public edm::one::EDProducer<> {
0076 public:
0077   typedef std::vector<float> FloatVector;
0078 
0079   explicit GlobalHitsProducer(const edm::ParameterSet &);
0080   ~GlobalHitsProducer() override;
0081   void beginJob(void) override;
0082   void endJob() override;
0083   void produce(edm::Event &, const edm::EventSetup &) override;
0084 
0085 private:
0086   // GlobalValidation(const GlobalValidation&);
0087   // const GlobalValidation& operator=(const GlobalValidation&);
0088 
0089   // production related methods
0090   void fillG4MC(edm::Event &);
0091   void storeG4MC(PGlobalSimHit &);
0092   void fillTrk(edm::Event &, const edm::EventSetup &);
0093   void storeTrk(PGlobalSimHit &);
0094   void fillMuon(edm::Event &, const edm::EventSetup &);
0095   void storeMuon(PGlobalSimHit &);
0096   void fillECal(edm::Event &, const edm::EventSetup &);
0097   void storeECal(PGlobalSimHit &);
0098   void fillHCal(edm::Event &, const edm::EventSetup &);
0099   void storeHCal(PGlobalSimHit &);
0100 
0101   void clear();
0102 
0103 private:
0104   //  parameter information
0105   std::string fName;
0106   int verbosity;
0107   int frequency;
0108   int vtxunit;
0109   std::string label;
0110   bool getAllProvenances;
0111   bool printProvenanceInfo;
0112 
0113   // G4MC info
0114   int nRawGenPart;
0115   FloatVector G4VtxX;
0116   FloatVector G4VtxY;
0117   FloatVector G4VtxZ;
0118   FloatVector G4TrkPt;
0119   FloatVector G4TrkE;
0120 
0121   edm::InputTag G4VtxSrc_;
0122   edm::InputTag G4TrkSrc_;
0123   edm::EDGetTokenT<edm::SimVertexContainer> G4VtxSrc_Token_;
0124   edm::EDGetTokenT<edm::SimTrackContainer> G4TrkSrc_Token_;
0125 
0126   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tGeomToken_;
0127   edm::ESGetToken<CSCGeometry, MuonGeometryRecord> cscGeomToken_;
0128   edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomToken_;
0129   edm::ESGetToken<RPCGeometry, MuonGeometryRecord> rpcGeomToken_;
0130   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeomToken_;
0131   // Electromagnetic info
0132   // ECal info
0133   FloatVector ECalE;
0134   FloatVector ECalToF;
0135   FloatVector ECalPhi;
0136   FloatVector ECalEta;
0137   edm::InputTag ECalEBSrc_;
0138   edm::InputTag ECalEESrc_;
0139   edm::EDGetTokenT<edm::PCaloHitContainer> ECalEBSrc_Token_;
0140   edm::EDGetTokenT<edm::PCaloHitContainer> ECalEESrc_Token_;
0141 
0142   // Preshower info
0143   FloatVector PreShE;
0144   FloatVector PreShToF;
0145   FloatVector PreShPhi;
0146   FloatVector PreShEta;
0147   edm::InputTag ECalESSrc_;
0148   edm::EDGetTokenT<edm::PCaloHitContainer> ECalESSrc_Token_;
0149 
0150   // Hadronic info
0151   // HCal info
0152   FloatVector HCalE;
0153   FloatVector HCalToF;
0154   FloatVector HCalPhi;
0155   FloatVector HCalEta;
0156   edm::InputTag HCalSrc_;
0157   edm::EDGetTokenT<edm::PCaloHitContainer> HCalSrc_Token_;
0158 
0159   // Tracker info
0160   // Pixel info
0161   FloatVector PxlBrlToF;
0162   FloatVector PxlBrlR;
0163   FloatVector PxlBrlPhi;
0164   FloatVector PxlBrlEta;
0165   FloatVector PxlFwdToF;
0166   FloatVector PxlFwdZ;
0167   FloatVector PxlFwdPhi;
0168   FloatVector PxlFwdEta;
0169   edm::InputTag PxlBrlLowSrc_;
0170   edm::InputTag PxlBrlHighSrc_;
0171   edm::InputTag PxlFwdLowSrc_;
0172   edm::InputTag PxlFwdHighSrc_;
0173   edm::EDGetTokenT<edm::PSimHitContainer> PxlBrlLowSrc_Token_;
0174   edm::EDGetTokenT<edm::PSimHitContainer> PxlBrlHighSrc_Token_;
0175   edm::EDGetTokenT<edm::PSimHitContainer> PxlFwdLowSrc_Token_;
0176   edm::EDGetTokenT<edm::PSimHitContainer> PxlFwdHighSrc_Token_;
0177 
0178   // Strip info
0179   FloatVector SiBrlToF;
0180   FloatVector SiBrlR;
0181   FloatVector SiBrlPhi;
0182   FloatVector SiBrlEta;
0183   FloatVector SiFwdToF;
0184   FloatVector SiFwdZ;
0185   FloatVector SiFwdPhi;
0186   FloatVector SiFwdEta;
0187   edm::InputTag SiTIBLowSrc_;
0188   edm::InputTag SiTIBHighSrc_;
0189   edm::InputTag SiTOBLowSrc_;
0190   edm::InputTag SiTOBHighSrc_;
0191   edm::InputTag SiTIDLowSrc_;
0192   edm::InputTag SiTIDHighSrc_;
0193   edm::InputTag SiTECLowSrc_;
0194   edm::InputTag SiTECHighSrc_;
0195   edm::EDGetTokenT<edm::PSimHitContainer> SiTIBLowSrc_Token_;
0196   edm::EDGetTokenT<edm::PSimHitContainer> SiTIBHighSrc_Token_;
0197   edm::EDGetTokenT<edm::PSimHitContainer> SiTOBLowSrc_Token_;
0198   edm::EDGetTokenT<edm::PSimHitContainer> SiTOBHighSrc_Token_;
0199   edm::EDGetTokenT<edm::PSimHitContainer> SiTIDLowSrc_Token_;
0200   edm::EDGetTokenT<edm::PSimHitContainer> SiTIDHighSrc_Token_;
0201   edm::EDGetTokenT<edm::PSimHitContainer> SiTECLowSrc_Token_;
0202   edm::EDGetTokenT<edm::PSimHitContainer> SiTECHighSrc_Token_;
0203 
0204   // Muon info
0205   // DT info
0206   FloatVector MuonDtToF;
0207   FloatVector MuonDtR;
0208   FloatVector MuonDtPhi;
0209   FloatVector MuonDtEta;
0210   edm::InputTag MuonDtSrc_;
0211   edm::EDGetTokenT<edm::PSimHitContainer> MuonDtSrc_Token_;
0212   // CSC info
0213   FloatVector MuonCscToF;
0214   FloatVector MuonCscZ;
0215   FloatVector MuonCscPhi;
0216   FloatVector MuonCscEta;
0217   edm::InputTag MuonCscSrc_;
0218   edm::EDGetTokenT<edm::PSimHitContainer> MuonCscSrc_Token_;
0219   // RPC info
0220   FloatVector MuonRpcBrlToF;
0221   FloatVector MuonRpcBrlR;
0222   FloatVector MuonRpcBrlPhi;
0223   FloatVector MuonRpcBrlEta;
0224   FloatVector MuonRpcFwdToF;
0225   FloatVector MuonRpcFwdZ;
0226   FloatVector MuonRpcFwdPhi;
0227   FloatVector MuonRpcFwdEta;
0228   edm::InputTag MuonRpcSrc_;
0229   edm::EDGetTokenT<edm::PSimHitContainer> MuonRpcSrc_Token_;
0230 
0231   // private statistics information
0232   unsigned int count;
0233 
0234 };  // end class declaration
0235 
0236 #endif
0237 
0238 #ifndef GlobalHitMap
0239 #define GlobalHitMap
0240 // geometry mapping
0241 static const int dTrk = 1;
0242 static const int sdPxlBrl = 1;
0243 static const int sdPxlFwd = 2;
0244 static const int sdSiTIB = 3;
0245 static const int sdSiTID = 4;
0246 static const int sdSiTOB = 5;
0247 static const int sdSiTEC = 6;
0248 
0249 static const int dMuon = 2;
0250 static const int sdMuonDT = 1;
0251 static const int sdMuonCSC = 2;
0252 static const int sdMuonRPC = 3;
0253 static const int sdMuonRPCRgnBrl = 0;
0254 static const int sdMuonRPCRgnFwdp = 1;
0255 static const int sdMuonRPCRgnFwdn = -1;
0256 
0257 static const int dEcal = 3;
0258 static const int sdEcalBrl = 1;
0259 static const int sdEcalFwd = 2;
0260 static const int sdEcalPS = 3;
0261 static const int sdEcalTT = 4;
0262 static const int sdEcalLPnD = 5;
0263 
0264 static const int dHcal = 4;
0265 static const int sdHcalEmpty = 0;
0266 static const int sdHcalBrl = 1;
0267 static const int sdHcalEC = 2;
0268 static const int sdHcalOut = 3;
0269 static const int sdHcalFwd = 4;
0270 static const int sdHcalTT = 5;
0271 static const int sdHcalCalib = 6;
0272 static const int sdHcalCompst = 7;
0273 
0274 #endif