CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MuonShowerDigiFiller Class Reference

#include <RecoMuon/MuonIdentification/src/MuonShowerDigiFiller.cc>

Public Member Functions

void fill (reco::MuonChamberMatch &muChMatch) const
 
void fillDefault (reco::MuonChamberMatch &muChMatch) const
 
void getDigis (edm::Event &iEvent)
 
void getES (const edm::EventSetup &iSetup)
 
 MuonShowerDigiFiller ()
 
 MuonShowerDigiFiller (const edm::ParameterSet &, edm::ConsumesCollector &&iC)
 

Private Attributes

edm::Handle< CSCStripDigiCollectionm_cscDigis
 
edm::EDGetTokenT< CSCStripDigiCollectionm_cscDigisToken
 
edm::ESHandle< CSCGeometrym_cscGeometry
 
edm::ESGetToken< CSCGeometry, MuonGeometryRecordm_cscGeometryToken
 
double m_digiMaxDistanceX
 
edm::Handle< DTDigiCollectionm_dtDigis
 
edm::EDGetTokenT< DTDigiCollectionm_dtDigisToken
 
edm::ESHandle< DTGeometrym_dtGeometry
 
edm::ESGetToken< DTGeometry, MuonGeometryRecordm_dtGeometryToken
 

Detailed Description

Description: Class filling shower information using DT and CSC digis

Implementation: <Notes on="" implementation>="">

Definition at line 47 of file MuonShowerDigiFiller.h.

Constructor & Destructor Documentation

◆ MuonShowerDigiFiller() [1/2]

MuonShowerDigiFiller::MuonShowerDigiFiller ( )
inline

Definition at line 49 of file MuonShowerDigiFiller.h.

49 {}

◆ MuonShowerDigiFiller() [2/2]

MuonShowerDigiFiller::MuonShowerDigiFiller ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 27 of file MuonShowerDigiFiller.cc.

28  : m_digiMaxDistanceX(iConfig.getParameter<double>("digiMaxDistanceX")),
29  m_dtDigisToken(iC.consumes<DTDigiCollection>(iConfig.getParameter<edm::InputTag>("dtDigiCollectionLabel"))),
31  iC.consumes<CSCStripDigiCollection>(iConfig.getParameter<edm::InputTag>("cscDigiCollectionLabel"))),
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< CSCStripDigiCollection > m_cscDigisToken
edm::EDGetTokenT< DTDigiCollection > m_dtDigisToken
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > m_cscGeometryToken
edm::ESGetToken< DTGeometry, MuonGeometryRecord > m_dtGeometryToken

Member Function Documentation

◆ fill()

void MuonShowerDigiFiller::fill ( reco::MuonChamberMatch muChMatch) const

Definition at line 49 of file MuonShowerDigiFiller.cc.

References funct::abs(), MuonSubdetId::CSC, reco::MuonChamberMatch::detector(), change_name::diff, MuonSubdetId::DT, dX(), ALCARECOEcalPhiSym_cff::float, CSCLayer::geometry(), reco::MuonChamberMatch::id, nano_mu_digi_cff::layer, CSCGeometry::layer(), DTGeometry::layer(), m_cscDigis, m_cscGeometry, m_digiMaxDistanceX, m_dtDigis, m_dtGeometry, DTChamberId::maxLayerId, CSCDetId::maxLayerId(), DTChamberId::maxSuperLayerId, reco::MuonChamberMatch::nDigisInRange, Hcal_Conditions_forGlobalTag_cff::pedestal, isotrackApplyRegressor::range, DetId::rawId(), DTLayer::specificTopology(), DiMuonV_cfg::threshold, DTTopology::wirePosition(), reco::MuonChamberMatch::x, CSCLayerGeometry::xOfStrip(), and reco::MuonChamberMatch::y.

49  {
50  int nDigisInRange = 0;
51 
52  // DT chamber
53  if (muChMatch.detector() == MuonSubdetId::DT) {
54  double xTrack = muChMatch.x;
55 
56  for (int sl = 1; sl <= DTChamberId::maxSuperLayerId; sl += 2) {
57  for (int layer = 1; layer <= DTChamberId::maxLayerId; ++layer) {
58  const DTLayerId layerId(DTChamberId(muChMatch.id.rawId()), sl, layer);
59 
60  auto range = m_dtDigis->get(layerId);
61 
62  for (auto digiIt = range.first; digiIt != range.second; ++digiIt) {
63  const auto topo = m_dtGeometry->layer(layerId)->specificTopology();
64 
65  double xWire = topo.wirePosition((*digiIt).wire());
66  double dX = std::abs(xWire - xTrack);
67 
68  if (dX < m_digiMaxDistanceX)
69  nDigisInRange++;
70  }
71  }
72  }
73  }
74 
75  else if (muChMatch.detector() == MuonSubdetId::CSC) {
76  double xTrack = muChMatch.x;
77  double yTrack = muChMatch.y;
78 
79  for (int iLayer = 1; iLayer <= CSCDetId::maxLayerId(); ++iLayer) {
80  const CSCDetId chId(muChMatch.id.rawId());
81  const CSCDetId layerId(chId.endcap(), chId.station(), chId.ring(), chId.chamber(), iLayer);
82 
83  auto range = m_cscDigis->get(layerId);
84 
85  for (auto digiIt = range.first; digiIt != range.second; ++digiIt) {
86  std::vector<int> adcVals = digiIt->getADCCounts();
87  bool hasFired = false;
88  float pedestal = 0.5 * (float)(adcVals[0] + adcVals[1]);
89  float threshold = 13.3;
90  float diff = 0.;
91  for (const auto& adcVal : adcVals) {
92  diff = (float)adcVal - pedestal;
93  if (diff > threshold) {
94  hasFired = true;
95  break;
96  }
97  }
98 
99  if (!hasFired)
100  continue;
101 
102  const CSCLayerGeometry* layerGeom = m_cscGeometry->layer(layerId)->geometry();
103 
104  Float_t xStrip = layerGeom->xOfStrip(digiIt->getStrip(), yTrack);
105  float dX = std::abs(xStrip - xTrack);
106 
107  if (dX < m_digiMaxDistanceX)
108  nDigisInRange++;
109  }
110  }
111  }
112 
113  muChMatch.nDigisInRange = nDigisInRange;
114 }
edm::Handle< DTDigiCollection > m_dtDigis
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
edm::ESHandle< DTGeometry > m_dtGeometry
static const int maxLayerId
highest layer id
Definition: DTChamberId.h:73
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
static const int maxSuperLayerId
highest superlayer id
Definition: DTChamberId.h:69
float dX(const MatchPair &match)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
edm::ESHandle< CSCGeometry > m_cscGeometry
float xOfStrip(int strip, float y=0.) const
static constexpr int DT
Definition: MuonSubdetId.h:11
edm::Handle< CSCStripDigiCollection > m_cscDigis
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
static constexpr int CSC
Definition: MuonSubdetId.h:12
static int maxLayerId()
Definition: CSCDetId.h:243
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:63
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96

◆ fillDefault()

void MuonShowerDigiFiller::fillDefault ( reco::MuonChamberMatch muChMatch) const

Definition at line 116 of file MuonShowerDigiFiller.cc.

References reco::MuonChamberMatch::nDigisInRange.

116 { muChMatch.nDigisInRange = 0; }

◆ getDigis()

void MuonShowerDigiFiller::getDigis ( edm::Event iEvent)

Definition at line 44 of file MuonShowerDigiFiller.cc.

References iEvent, m_cscDigis, m_cscDigisToken, m_dtDigis, and m_dtDigisToken.

44  {
45  iEvent.getByToken(m_dtDigisToken, m_dtDigis);
46  iEvent.getByToken(m_cscDigisToken, m_cscDigis);
47 }
edm::Handle< DTDigiCollection > m_dtDigis
edm::EDGetTokenT< CSCStripDigiCollection > m_cscDigisToken
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< DTDigiCollection > m_dtDigisToken
edm::Handle< CSCStripDigiCollection > m_cscDigis

◆ getES()

void MuonShowerDigiFiller::getES ( const edm::EventSetup iSetup)

Definition at line 39 of file MuonShowerDigiFiller.cc.

References edm::EventSetup::getHandle(), m_cscGeometry, m_cscGeometryToken, m_dtGeometry, and m_dtGeometryToken.

39  {
42 }
edm::ESHandle< DTGeometry > m_dtGeometry
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > m_cscGeometryToken
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
edm::ESHandle< CSCGeometry > m_cscGeometry
edm::ESGetToken< DTGeometry, MuonGeometryRecord > m_dtGeometryToken

Member Data Documentation

◆ m_cscDigis

edm::Handle<CSCStripDigiCollection> MuonShowerDigiFiller::m_cscDigis
private

Definition at line 71 of file MuonShowerDigiFiller.h.

Referenced by fill(), and getDigis().

◆ m_cscDigisToken

edm::EDGetTokenT<CSCStripDigiCollection> MuonShowerDigiFiller::m_cscDigisToken
private

Definition at line 62 of file MuonShowerDigiFiller.h.

Referenced by getDigis().

◆ m_cscGeometry

edm::ESHandle<CSCGeometry> MuonShowerDigiFiller::m_cscGeometry
private

Definition at line 68 of file MuonShowerDigiFiller.h.

Referenced by fill(), and getES().

◆ m_cscGeometryToken

edm::ESGetToken<CSCGeometry, MuonGeometryRecord> MuonShowerDigiFiller::m_cscGeometryToken
private

Definition at line 65 of file MuonShowerDigiFiller.h.

Referenced by getES().

◆ m_digiMaxDistanceX

double MuonShowerDigiFiller::m_digiMaxDistanceX
private

Definition at line 59 of file MuonShowerDigiFiller.h.

Referenced by fill().

◆ m_dtDigis

edm::Handle<DTDigiCollection> MuonShowerDigiFiller::m_dtDigis
private

Definition at line 70 of file MuonShowerDigiFiller.h.

Referenced by fill(), and getDigis().

◆ m_dtDigisToken

edm::EDGetTokenT<DTDigiCollection> MuonShowerDigiFiller::m_dtDigisToken
private

Definition at line 61 of file MuonShowerDigiFiller.h.

Referenced by getDigis().

◆ m_dtGeometry

edm::ESHandle<DTGeometry> MuonShowerDigiFiller::m_dtGeometry
private

Definition at line 67 of file MuonShowerDigiFiller.h.

Referenced by fill(), and getES().

◆ m_dtGeometryToken

edm::ESGetToken<DTGeometry, MuonGeometryRecord> MuonShowerDigiFiller::m_dtGeometryToken
private

Definition at line 64 of file MuonShowerDigiFiller.h.

Referenced by getES().