Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:51

0001 #ifndef Validation_MuonHits_GEMSimHitMatcher_h
0002 #define Validation_MuonHits_GEMSimHitMatcher_h
0003 
0004 /**\class GEMSimHitMatcher
0005 
0006    Description: Matching of GEM SimHit to SimTrack
0007 
0008    Author: Sven Dildick (TAMU), Tao Huang (TAMU)
0009 */
0010 
0011 #include "FWCore/Utilities/interface/ESGetToken.h"
0012 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0013 #include "Geometry/GEMGeometry/interface/GEMGeometry.h"
0014 #include "Validation/MuonHits/interface/MuonSimHitMatcher.h"
0015 
0016 class GEMSimHitMatcher : public MuonSimHitMatcher {
0017 public:
0018   // constructor
0019   GEMSimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC);
0020 
0021   // destructor
0022   ~GEMSimHitMatcher() {}
0023 
0024   // initialize the event
0025   void init(const edm::Event& e, const edm::EventSetup& eventSetup);
0026 
0027   // do the matching
0028   void match(const SimTrack& t, const SimVertex& v);
0029 
0030   // partitions' detIds with SimHits
0031   std::set<unsigned int> detIds(int gem_type = MuonHitHelper::GEM_ALL) const;
0032 
0033   // chamber detIds with SimHits
0034   std::set<unsigned int> chamberIds(int gem_type = MuonHitHelper::GEM_ALL) const;
0035 
0036   // GEM detid's with hits in 2 layers of coincidence pads
0037   // those are layer==1 only detid's
0038   std::set<unsigned int> detIdsCoincidences() const;
0039 
0040   // GEM superchamber detIds with SimHits
0041   std::set<unsigned int> superChamberIds() const;
0042 
0043   // GEM superchamber detIds with SimHits 2 layers of coincidence pads
0044   std::set<unsigned int> superChamberIdsCoincidences() const;
0045 
0046   // simhits from a particular superchamber
0047   const edm::PSimHitContainer& hitsInSuperChamber(unsigned int) const;
0048 
0049   // was there a hit in a particular station?
0050   bool hitStation(int, int) const;
0051 
0052   // number of stations with hits in at least X layers
0053   int nStations(int nl = 2) const;
0054 
0055   // #layers with hits
0056   int nLayersWithHitsInSuperChamber(unsigned int) const;
0057 
0058   // How many pads with simhits in GEM did this simtrack get?
0059   int nPadsWithHits() const;
0060 
0061   // How many coincidence pads with simhits in GEM did this simtrack get?
0062   int nCoincidencePadsWithHits() const;
0063 
0064   // transverse position in GEM
0065   float simHitsGEMCentralPosition(const edm::PSimHitContainer& sim_hits) const;
0066 
0067   // calculate average strip number for a provided collection of simhits
0068   float simHitsMeanStrip(const edm::PSimHitContainer& sim_hits) const;
0069 
0070   std::set<int> hitStripsInDetId(unsigned int, int margin_n_strips = 1) const;
0071   std::set<int> hitPadsInDetId(unsigned int) const;
0072   std::set<int> hitCoPadsInDetId(unsigned int) const;
0073 
0074   // what unique partitions numbers were hit by this simtrack?
0075   std::set<int> hitPartitions() const;
0076 
0077 private:
0078   void matchSimHitsToSimTrack();
0079 
0080   void clear();
0081 
0082   edm::ESGetToken<GEMGeometry, MuonGeometryRecord> geomToken_;
0083 
0084   std::map<unsigned int, edm::PSimHitContainer> superchamber_to_hits_;
0085 
0086   // detids with hits in pads
0087   std::map<unsigned int, std::set<int> > detids_to_pads_;
0088 
0089   // detids with hits in 2-layer pad coincidences
0090   std::map<unsigned int, std::set<int> > detids_to_copads_;
0091 };
0092 
0093 #endif