Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /*
0002  * StubsSimHitsMatcher.h
0003  *
0004  *  Created on: Jan 13, 2021
0005  *      Author: kbunkow
0006  */
0007 
0008 #ifndef L1T_OmtfP1_TOOLS_STUBSSIMHITSMATCHER_H_
0009 #define L1T_OmtfP1_TOOLS_STUBSSIMHITSMATCHER_H_
0010 
0011 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/AlgoMuon.h"
0012 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFinput.h"
0013 
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/Framework/interface/ESWatcher.h"
0017 #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
0018 #include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
0019 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0020 
0021 #include "TH1I.h"
0022 #include "TH2I.h"
0023 
0024 class RPCGeometry;
0025 class CSCGeometry;
0026 class DTGeometry;
0027 
0028 struct MuonGeometryTokens;
0029 
0030 class StubsSimHitsMatcher {
0031 public:
0032   StubsSimHitsMatcher(const edm::ParameterSet& edmCfg,
0033                       const OMTFConfiguration* omtfConfig,
0034                       const MuonGeometryTokens& muonGeometryTokens);
0035   virtual ~StubsSimHitsMatcher();
0036 
0037   void beginRun(edm::EventSetup const& eventSetup);
0038 
0039   void endJob();
0040 
0041   void match(const edm::Event& iEvent,
0042              const l1t::RegionalMuonCand* omtfCand,
0043              const AlgoMuonPtr& procMuon,
0044              std::ostringstream& ostr);  //Processor gbCandidate);
0045 
0046   class MatchedTrackInfo {
0047   public:
0048     union {
0049       struct {
0050         int32_t eventNum = 0;
0051         uint32_t trackId = 0;
0052       };
0053       uint64_t eventTrackNum;
0054     };
0055 
0056     mutable std::vector<unsigned int> matchedDigiCnt;
0057 
0058     MatchedTrackInfo(uint32_t eventNum, uint32_t trackId) : matchedDigiCnt(18, 0) {
0059       this->eventNum = eventNum;
0060       this->trackId = trackId;
0061     }
0062 
0063     bool operator<(const MatchedTrackInfo& b) const { return this->eventTrackNum < b.eventTrackNum; }
0064 
0065     bool operator>(const MatchedTrackInfo& b) const { return this->eventTrackNum > b.eventTrackNum; }
0066 
0067     bool operator==(const MatchedTrackInfo& b) const { return this->eventTrackNum == b.eventTrackNum; }
0068   };
0069 
0070 private:
0071   const OMTFConfiguration* omtfConfig;
0072 
0073   edm::InputTag rpcSimHitsInputTag;
0074   edm::InputTag cscSimHitsInputTag;
0075   edm::InputTag dtSimHitsInputTag;
0076 
0077   edm::InputTag rpcDigiSimLinkInputTag;
0078   edm::InputTag cscStripDigiSimLinksInputTag;
0079   edm::InputTag dtDigiSimLinksInputTag;
0080 
0081   edm::InputTag trackingParticleTag;
0082 
0083   const MuonGeometryTokens& muonGeometryTokens;
0084 
0085   edm::ESWatcher<MuonGeometryRecord> muonGeometryRecordWatcher;
0086 
0087   // pointers to the current geometry records
0088   unsigned long long _geom_cache_id = 0;
0089   edm::ESHandle<RPCGeometry> _georpc;
0090   edm::ESHandle<CSCGeometry> _geocsc;
0091   edm::ESHandle<DTGeometry> _geodt;
0092 
0093   TH1I* allMatchedTracksPdgIds = nullptr;   //indexing: [pdgId] = tracksCnt
0094   TH1I* bestMatchedTracksPdgIds = nullptr;  //indexing: [pdgId] = tracksCnt
0095 
0096   TH2I* stubsInLayersCntByPdgId = nullptr;
0097   TH2I* firedLayersCntByPdgId = nullptr;
0098   TH2I* ptByPdgId = nullptr;
0099 
0100   TH2I* rhoByPdgId = nullptr;
0101 };
0102 
0103 #endif /* L1T_OmtfP1_TOOLS_STUBSSIMHITSMATCHER_H_ */