Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-05 22:26:25

0001 #ifndef MCTruth_GEMHitAssociator_h
0002 #define MCTruth_GEMHitAssociator_h
0003 
0004 #include "DataFormats/Common/interface/Handle.h"
0005 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0006 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0007 #include "FWCore/Framework/interface/ConsumesCollector.h"
0008 #include "FWCore/Framework/interface/ESHandle.h"
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/Utilities/interface/InputTag.h"
0011 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
0012 #include "SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h"
0013 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0014 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0015 
0016 #include <map>
0017 #include <set>
0018 #include <string>
0019 #include <vector>
0020 
0021 #include "DataFormats/Common/interface/DetSetVector.h"
0022 #include "DataFormats/DetId/interface/DetId.h"
0023 #include "DataFormats/GEMDigi/interface/GEMDigiCollection.h"
0024 #include "DataFormats/GEMRecHit/interface/GEMRecHitCollection.h"
0025 #include "DataFormats/GEMRecHit/interface/GEMSegmentCollection.h"
0026 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
0027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0028 #include "Geometry/GEMGeometry/interface/GEMGeometry.h"
0029 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0030 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
0031 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
0032 
0033 class GEMHitAssociator {
0034 public:
0035   class Config {
0036   public:
0037     Config(const edm::ParameterSet &, edm::ConsumesCollector ic);
0038 
0039   private:
0040     friend class GEMHitAssociator;
0041 
0042     edm::InputTag GEMdigisimlinkTag;
0043     edm::InputTag GEMsimhitsTag;
0044     edm::InputTag GEMsimhitsXFTag;
0045 
0046     edm::EDGetTokenT<CrossingFrame<PSimHit>> GEMsimhitsXFToken_;
0047     edm::EDGetTokenT<edm::PSimHitContainer> GEMsimhitsToken_;
0048     edm::EDGetTokenT<edm::DetSetVector<GEMDigiSimLink>> GEMdigisimlinkToken_;
0049 
0050     bool crossingframe;
0051     bool useGEMs_;
0052   };
0053 
0054   typedef edm::DetSetVector<GEMDigiSimLink> DigiSimLinks;
0055   typedef edm::DetSet<GEMDigiSimLink> LayerLinks;
0056   typedef std::pair<uint32_t, EncodedEventId> SimHitIdpr;
0057 
0058   // Constructor with configurable parameters
0059   GEMHitAssociator(const edm::Event &e, const Config &config);
0060 
0061   std::vector<SimHitIdpr> associateRecHit(const GEMRecHit *gemrechit) const;
0062 
0063 private:
0064   void initEvent(const edm::Event &);
0065 
0066   const Config &theConfig;
0067   const DigiSimLinks *theDigiSimLinks;
0068   std::map<unsigned int, edm::PSimHitContainer> _SimHitMap;
0069 };
0070 
0071 #endif