CMS 3D CMS Logo

MuonShowerDigiFiller.cc
Go to the documentation of this file.
1 //
2 // Package: MuonShowerDigiFiller
3 // Class: MuonShowerDigiFiller
4 //
12 //
13 // Original Author: Carlo Battilana, INFN BO
14 // Created: Sat Mar 23 14:36:22 CET 2019
15 //
16 //
17 
18 // system include files
19 
20 // user include files
22 
24 
25 //
26 // constructors and destructor
27 //
28 
30  : m_digiMaxDistanceX(iConfig.getParameter<double>("digiMaxDistanceX")),
31  m_dtDigisToken(iC.consumes<DTDigiCollection>(iConfig.getParameter<edm::InputTag>("dtDigiCollectionLabel"))),
32  m_cscDigisToken(
33  iC.consumes<CSCStripDigiCollection>(iConfig.getParameter<edm::InputTag>("cscDigiCollectionLabel"))) {}
34 
35 //
36 // member functions
37 //
38 
42 }
43 
45  iEvent.getByToken(m_dtDigisToken, m_dtDigis);
46  iEvent.getByToken(m_cscDigisToken, m_cscDigis);
47 }
48 
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 }
115 
MuonShowerDigiFiller::m_dtDigis
edm::Handle< DTDigiCollection > m_dtDigis
Definition: MuonShowerDigiFiller.h:66
change_name.diff
diff
Definition: change_name.py:13
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
MuonSubdetId::CSC
static constexpr int CSC
Definition: MuonSubdetId.h:12
MuonShowerDigiFiller::getES
void getES(const edm::EventSetup &iSetup)
Definition: MuonShowerDigiFiller.cc:39
MuonShowerDigiFiller::m_dtDigisToken
edm::EDGetTokenT< DTDigiCollection > m_dtDigisToken
Definition: MuonShowerDigiFiller.h:60
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
MuonShowerDigiFiller::m_cscGeometry
edm::ESHandle< CSCGeometry > m_cscGeometry
Definition: MuonShowerDigiFiller.h:64
MuonShowerDigiFiller.h
reco::MuonChamberMatch::x
float x
Definition: MuonChamberMatch.h:19
edm
HLT enums.
Definition: AlignableModifier.h:19
CSCStripDigiCollection
DTTopology::wirePosition
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:59
MuonShowerDigiFiller::fill
void fill(reco::MuonChamberMatch &muChMatch) const
Definition: MuonShowerDigiFiller.cc:49
reco::MuonChamberMatch::detector
int detector() const
Definition: MuonChamberMatch.h:31
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
CSCLayerGeometry::xOfStrip
float xOfStrip(int strip, float y=0.) const
Definition: CSCLayerGeometry.h:175
CSCLayerGeometry
Definition: CSCLayerGeometry.h:25
MuonShowerDigiFiller::fillDefault
void fillDefault(reco::MuonChamberMatch &muChMatch) const
Definition: MuonShowerDigiFiller.cc:116
MuonShowerDigiFiller::m_cscDigisToken
edm::EDGetTokenT< CSCStripDigiCollection > m_cscDigisToken
Definition: MuonShowerDigiFiller.h:61
CSCLayer::geometry
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
MuonSubdetId::DT
static constexpr int DT
Definition: MuonSubdetId.h:11
reco::MuonChamberMatch::nDigisInRange
int nDigisInRange
Definition: MuonChamberMatch.h:29
MuonShowerDigiFiller::m_digiMaxDistanceX
double m_digiMaxDistanceX
Definition: MuonShowerDigiFiller.h:58
DTLayerId
Definition: DTLayerId.h:12
MuonShowerDigiFiller::m_cscDigis
edm::Handle< CSCStripDigiCollection > m_cscDigis
Definition: MuonShowerDigiFiller.h:67
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
DTGeometry::layer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
reco::MuonChamberMatch::id
DetId id
Definition: MuonChamberMatch.h:27
DTDigiCollection
CSCDetId
Definition: CSCDetId.h:26
DTChamberId::maxLayerId
static const int maxLayerId
highest layer id
Definition: DTChamberId.h:70
iEvent
int iEvent
Definition: GenABIO.cc:224
EcalCondDBWriter_cfi.pedestal
pedestal
Definition: EcalCondDBWriter_cfi.py:49
edm::EventSetup
Definition: EventSetup.h:57
reco::MuonChamberMatch
Definition: MuonChamberMatch.h:10
get
#define get
DTChamberId::maxSuperLayerId
static const int maxSuperLayerId
highest superlayer id
Definition: DTChamberId.h:66
MuonShowerDigiFiller::getDigis
void getDigis(edm::Event &iEvent)
Definition: MuonShowerDigiFiller.cc:44
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
MuonShowerDigiFiller::MuonShowerDigiFiller
MuonShowerDigiFiller(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
Definition: MuonShowerDigiFiller.cc:29
CSCGeometry::layer
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
MuonShowerDigiFiller::m_dtGeometry
edm::ESHandle< DTGeometry > m_dtGeometry
Definition: MuonShowerDigiFiller.h:63
CSCDetId::maxLayerId
static int maxLayerId()
Definition: CSCDetId.h:228
reco::MuonChamberMatch::y
float y
Definition: MuonChamberMatch.h:20
DTLayer::specificTopology
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DTChamberId
Definition: DTChamberId.h:14
MuonGeometryRecord.h
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
edm::Event
Definition: Event.h:73
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::ConsumesCollector
Definition: ConsumesCollector.h:39