Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Validation_MuonHits_DTSimHitMatcher_h
0002 #define Validation_MuonHits_DTSimHitMatcher_h
0003 
0004 /**\class DTSimHitMatcher
0005 
0006    Description: Matching of DT 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/DTGeometry/interface/DTGeometry.h"
0014 #include "Validation/MuonHits/interface/MuonSimHitMatcher.h"
0015 
0016 class DTSimHitMatcher : public MuonSimHitMatcher {
0017 public:
0018   // constructor
0019   DTSimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC);
0020 
0021   // destructor
0022   ~DTSimHitMatcher() {}
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 type = MuonHitHelper::DT_ALL) const;
0032 
0033   // chamber detIds with SimHits
0034   std::set<unsigned int> chamberIds(int type = MuonHitHelper::DT_ALL) const;
0035 
0036   // DT station detIds with SimHits
0037   std::set<unsigned int> chamberIdsStation(int station) const;
0038 
0039   // DT layer detIds with SimHits
0040   std::set<unsigned int> layerIds() const;
0041 
0042   // DT super layer detIds with SimHits
0043   std::set<unsigned int> superlayerIds() const;
0044 
0045   // was there a hit in a particular DT/CSC station?
0046   bool hitStation(int, int, int) const;
0047 
0048   // number of stations with hits in at least X layers
0049   int nStations(int nsl = 1, int nl = 3) const;
0050 
0051   // access to DT hits
0052   int nCellsWithHitsInLayer(unsigned int) const;
0053   int nLayersWithHitsInSuperLayer(unsigned int) const;
0054   int nSuperLayersWithHitsInChamber(unsigned int) const;
0055   int nLayersWithHitsInChamber(unsigned int) const;
0056   const edm::PSimHitContainer& hitsInLayer(unsigned int) const;
0057   const edm::PSimHitContainer& hitsInSuperLayer(unsigned int) const;
0058   const edm::PSimHitContainer& hitsInChamber(unsigned int) const;
0059 
0060   // calculate average wg number for a provided collection of simhits
0061   float simHitsMeanWire(const edm::PSimHitContainer& sim_hits) const;
0062 
0063   // calculate the average position at the second station
0064   GlobalPoint simHitsMeanPositionStation(int n) const;
0065 
0066   std::set<unsigned int> hitWiresInDTLayerId(unsigned int, int margin_n_wires = 0) const;       // DT
0067   std::set<unsigned int> hitWiresInDTSuperLayerId(unsigned int, int margin_n_wires = 0) const;  // DT
0068   std::set<unsigned int> hitWiresInDTChamberId(unsigned int, int margin_n_wires = 0) const;     // DT
0069 
0070   void dtChamberIdsToString(const std::set<unsigned int>&) const;
0071 
0072 private:
0073   void matchSimHitsToSimTrack();
0074 
0075   std::map<unsigned int, edm::PSimHitContainer> layer_to_hits_;
0076   std::map<unsigned int, edm::PSimHitContainer> superlayer_to_hits_;
0077 
0078   edm::ESGetToken<DTGeometry, MuonGeometryRecord> geomToken_;
0079 };
0080 
0081 #endif