Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-04-25 22:38:12

0001 #ifndef Phase2TrackerValidateDigi_h
0002 #define Phase2TrackerValidateDigi_h
0003 
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 #include "FWCore/Framework/interface/Event.h"
0008 
0009 #include "DataFormats/DetId/interface/DetId.h"
0010 #include "DataFormats/Common/interface/DetSetVector.h"
0011 #include "DataFormats/Common/interface/Handle.h"
0012 #include "FWCore/Framework/interface/ESHandle.h"
0013 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0014 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0015 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0016 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0017 #include "DQMServices/Core/interface/DQMStore.h"
0018 
0019 // DQM Histograming
0020 class PixelDigiSimLink;
0021 class SimTrack;
0022 class SimHit;
0023 class TrackerTopology;
0024 class PixelDigi;
0025 class Phase2TrackerDigi;
0026 class TrackerGeometry;
0027 class TrackerDigiGeometryRecord;
0028 class TrackerTopologyRcd;
0029 class Phase2TrackerValidateDigi : public DQMEDAnalyzer {
0030 public:
0031   explicit Phase2TrackerValidateDigi(const edm::ParameterSet&);
0032   ~Phase2TrackerValidateDigi() override;
0033   void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) override;
0034   void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0035   void dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) override;
0036   std::string getHistoId(uint32_t det_id, bool flag);
0037 
0038   struct DigiMEs {
0039     MonitorElement* SimTrackPt;
0040     MonitorElement* SimTrackEta;
0041     MonitorElement* SimTrackPhi;
0042     MonitorElement* MatchedTrackPt;
0043     MonitorElement* MatchedTrackPhi;
0044     MonitorElement* MatchedTrackEta;
0045     MonitorElement* MissedHitTrackPt;
0046     MonitorElement* MissedHitTrackPhi;
0047     MonitorElement* MissedHitTrackEta;
0048     MonitorElement* MissedDigiTrackPt;
0049     MonitorElement* MissedDigiTrackPhi;
0050     MonitorElement* MissedDigiTrackEta;
0051     MonitorElement* MissedDigiSimHitElossP;
0052     MonitorElement* MissedDigiSimHitElossS;
0053     MonitorElement* MatchedSimHitElossP;
0054     MonitorElement* MatchedSimHitElossS;
0055     MonitorElement* SimHitDx;
0056     MonitorElement* SimHitDy;
0057     MonitorElement* SimHitDz;
0058     MonitorElement* BunchXTimeBin;
0059     MonitorElement* FractionOfOOTDigis;
0060     MonitorElement* MissedDigiLocalXposVsYPos;
0061     MonitorElement* MissedDigiTimeWindow;
0062     int nHits;
0063     int nDigis;
0064   };
0065 
0066 private:
0067   MonitorElement* nSimulatedTracks;
0068   MonitorElement* nSimulatedTracksP;
0069   MonitorElement* nSimulatedTracksS;
0070 
0071   MonitorElement* nSimVertices;
0072 
0073   MonitorElement* SimulatedTrackPt;
0074   MonitorElement* SimulatedTrackEta;
0075   MonitorElement* SimulatedTrackPhi;
0076 
0077   MonitorElement* SimulatedTrackPtP;
0078   MonitorElement* SimulatedTrackEtaP;
0079   MonitorElement* SimulatedTrackPhiP;
0080 
0081   MonitorElement* SimulatedTrackPtS;
0082   MonitorElement* SimulatedTrackEtaS;
0083   MonitorElement* SimulatedTrackPhiS;
0084 
0085   MonitorElement* SimulatedXYPositionMap;
0086   MonitorElement* SimulatedRZPositionMap;
0087 
0088   MonitorElement* MatchedXYPositionMap;
0089   MonitorElement* MatchedRZPositionMap;
0090 
0091   MonitorElement* SimulatedTOFEtaMap;
0092   MonitorElement* SimulatedTOFPhiMap;
0093   MonitorElement* SimulatedTOFRMap;
0094   MonitorElement* SimulatedTOFZMap;
0095 
0096   MonitorElement* nSimHitsPerTrack;
0097   float etaCut_;
0098   float ptCut_;
0099   float tofUpperCut_;
0100   float tofLowerCut_;
0101 
0102   void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, bool flag);
0103   unsigned int getSimTrackId(const edm::DetSetVector<PixelDigiSimLink>* simLinks,
0104                              const DetId& detId,
0105                              unsigned int& channel);
0106   int matchedSimTrack(edm::Handle<edm::SimTrackContainer>& SimTk, unsigned int simTrkId);
0107   bool isPrimary(const SimTrack& simTrk, const PSimHit& simHit);
0108 
0109   void fillHistogram(MonitorElement* th1, MonitorElement* th2, MonitorElement* th3, float val, int primary);
0110   int fillSimHitInfo(const edm::Event& iEvent, const SimTrack simTrk);
0111 
0112   bool findOTDigi(unsigned int detid, unsigned int id);
0113 
0114   bool findITPixelDigi(unsigned int detid, unsigned int id);
0115   void fillOTBXInfo();
0116   void fillITPixelBXInfo();
0117   void fillHitsPerTrack();
0118 
0119   edm::ParameterSet config_;
0120   std::map<std::string, DigiMEs> layerMEs;
0121 
0122   bool pixelFlag_;
0123   std::string geomType_;
0124 
0125   edm::InputTag otDigiSrc_;
0126   edm::InputTag otDigiSimLinkSrc_;
0127   edm::InputTag itPixelDigiSrc_;
0128   edm::InputTag itPixelDigiSimLinkSrc_;
0129   std::vector<edm::InputTag> pSimHitSrc_;
0130   edm::InputTag simTrackSrc_;
0131   edm::InputTag simVertexSrc_;
0132 
0133   const edm::EDGetTokenT<edm::DetSetVector<Phase2TrackerDigi>> otDigiToken_;
0134   const edm::EDGetTokenT<edm::DetSetVector<PixelDigiSimLink>> otDigiSimLinkToken_;
0135   const edm::EDGetTokenT<edm::DetSetVector<PixelDigi>> itPixelDigiToken_;
0136   const edm::EDGetTokenT<edm::DetSetVector<PixelDigiSimLink>> itPixelDigiSimLinkToken_;
0137   const edm::EDGetTokenT<edm::SimTrackContainer> simTrackToken_;
0138   const edm::EDGetTokenT<edm::SimVertexContainer> simVertexToken_;
0139   const edm::DetSetVector<PixelDigiSimLink>* otSimLink_;
0140   const edm::DetSetVector<PixelDigiSimLink>* itSimLink_;
0141   const edm::DetSetVector<Phase2TrackerDigi>* otdigis_;
0142   const edm::DetSetVector<PixelDigi>* itdigis_;
0143   std::vector<edm::EDGetTokenT<edm::PSimHitContainer>> simHitTokens_;
0144   edm::Handle<edm::PSimHitContainer> simHits;
0145   edm::Handle<edm::SimTrackContainer> simTracks;
0146   edm::Handle<edm::SimVertexContainer> simVertices;
0147   const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
0148   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoToken_;
0149   const TrackerGeometry* tkGeom_ = nullptr;
0150   const TrackerTopology* tTopo_ = nullptr;
0151 
0152   const float GeVperElectron;  // 3.7E-09
0153   const float cval;            // cm/ns
0154 };
0155 #endif