CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
DTHitAssociator Class Reference

#include <DTHitAssociator.h>

Classes

class  Config
 

Public Types

typedef std::map< DTWireId,
std::vector< DTDigi > > 
DigiMap
 
typedef std::map< DTWireId,
std::vector< DTDigiSimLink > > 
LinksMap
 
typedef std::pair< PSimHit, bool > PSimHit_withFlag
 
typedef std::map< DTWireId,
std::vector< DTRecHit1DPair > > 
RecHitMap
 
typedef std::pair< uint32_t,
EncodedEventId
SimHitIdpr
 
typedef std::map< DTWireId,
std::vector< PSimHit_withFlag > > 
SimHitMap
 

Public Member Functions

std::vector< SimHitIdprassociateDTHitId (const DTRecHit1D *dtrechit) const
 
std::vector< PSimHitassociateHit (const TrackingRecHit &hit) const
 
std::vector< SimHitIdprassociateHitId (const TrackingRecHit &hit) const
 
 DTHitAssociator (const edm::Event &, const edm::EventSetup &, const Config &, bool printRtS)
 

Public Attributes

DigiMap mapOfDigi
 
LinksMap mapOfLinks
 
RecHitMap mapOfRecHit
 
SimHitMap mapOfSimHit
 

Private Member Functions

void initEvent (const edm::Event &, const edm::EventSetup &)
 
bool SimHitOK (const edm::ESHandle< DTGeometry > &, const PSimHit &)
 

Private Attributes

Config const & config_
 
bool printRtS
 

Detailed Description

Definition at line 25 of file DTHitAssociator.h.

Member Typedef Documentation

typedef std::map<DTWireId, std::vector<DTDigi> > DTHitAssociator::DigiMap

Definition at line 31 of file DTHitAssociator.h.

typedef std::map<DTWireId, std::vector<DTDigiSimLink> > DTHitAssociator::LinksMap

Definition at line 32 of file DTHitAssociator.h.

typedef std::pair<PSimHit, bool> DTHitAssociator::PSimHit_withFlag

Definition at line 28 of file DTHitAssociator.h.

typedef std::map<DTWireId, std::vector<DTRecHit1DPair> > DTHitAssociator::RecHitMap

Definition at line 30 of file DTHitAssociator.h.

typedef std::pair<uint32_t, EncodedEventId> DTHitAssociator::SimHitIdpr

Definition at line 27 of file DTHitAssociator.h.

typedef std::map<DTWireId, std::vector<PSimHit_withFlag> > DTHitAssociator::SimHitMap

Definition at line 29 of file DTHitAssociator.h.

Constructor & Destructor Documentation

DTHitAssociator::DTHitAssociator ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const Config conf,
bool  printRtS 
)

Definition at line 53 of file DTHitAssociator.cc.

References initEvent().

57  : // input collection labels
58  config_(conf),
59  printRtS(true)
60 
61 {
62  initEvent(iEvent, iSetup);
63 }
Config const & config_
void initEvent(const edm::Event &, const edm::EventSetup &)

Member Function Documentation

std::vector< DTHitAssociator::SimHitIdpr > DTHitAssociator::associateDTHitId ( const DTRecHit1D dtrechit) const

Definition at line 267 of file DTHitAssociator.cc.

References DTHitAssociator::Config::associatorByWire, config_, DTRecHit1D::digiTime(), PSimHit::eventId(), newFWLiteAna::found, LogTrace, mapOfLinks, mapOfSimHit, PSimHit::trackId(), and DTRecHit1D::wireId().

Referenced by associateHit(), associateHitId(), and MuonAssociatorByHitsHelper::getMatchedIds().

267  {
268  std::vector<SimHitIdpr> matched;
269 
270  DTWireId wireid = dtrechit->wireId();
271 
273  // matching based on DTWireId : take only "valid" SimHits on that wire
274 
275  auto found = mapOfSimHit.find(wireid);
276  if (found != mapOfSimHit.end()) {
277  for (vector<PSimHit_withFlag>::const_iterator hitIT = found->second.begin(); hitIT != found->second.end();
278  ++hitIT) {
279  bool valid_hit = hitIT->second;
280  PSimHit this_hit = hitIT->first;
281 
282  if (valid_hit) {
283  SimHitIdpr currentId(this_hit.trackId(), this_hit.eventId());
284  matched.push_back(currentId);
285  }
286  }
287  }
288  }
289 
290  else {
291  // matching based on DTDigiSimLink
292 
293  float theTime = dtrechit->digiTime();
294  int theNumber(-1);
295 
296  auto found = mapOfLinks.find(wireid);
297 
298  if (found != mapOfLinks.end()) {
299  // DTDigiSimLink::time() is set equal to DTDigi::time() only for the
300  // DTDigiSimLink corresponding to the digitizied PSimHit other
301  // DTDigiSimLinks associated to the same DTDigi are identified by having
302  // the same DTDigiSimLink::number()
303 
304  // first find the associated digi Number
305  for (vector<DTDigiSimLink>::const_iterator linkIT = found->second.begin(); linkIT != found->second.end();
306  ++linkIT) {
307  float digitime = linkIT->time();
308  if (fabs(digitime - theTime) < 0.1) {
309  theNumber = linkIT->number();
310  }
311  }
312 
313  // then get all the DTDigiSimLinks with that digi Number (corresponding to
314  // valid SimHits
315  // within a time window of the order of the time resolution, specified in
316  // the DTDigitizer)
317  for (vector<DTDigiSimLink>::const_iterator linkIT = found->second.begin(); linkIT != found->second.end();
318  ++linkIT) {
319  int digiNr = linkIT->number();
320  if (digiNr == theNumber) {
321  SimHitIdpr currentId(linkIT->SimTrackId(), linkIT->eventId());
322  matched.push_back(currentId);
323  }
324  }
325 
326  } else {
327  LogTrace("DTHitAssociator") << "*** ERROR in DTHitAssociator::associateDTHitId - DTRecHit1D: " << *dtrechit
328  << " has no associated DTDigiSimLink !" << endl;
329  return matched;
330  }
331  }
332 
333  return matched;
334 }
#define LogTrace(id)
SimHitMap mapOfSimHit
float digiTime() const
Return the time (ns) of the digi used to build the rechit.
Definition: DTRecHit1D.h:79
EncodedEventId eventId() const
Definition: PSimHit.h:108
Config const & config_
std::pair< uint32_t, EncodedEventId > SimHitIdpr
unsigned int trackId() const
Definition: PSimHit.h:106
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:76
std::vector< PSimHit > DTHitAssociator::associateHit ( const TrackingRecHit hit) const

Definition at line 336 of file DTHitAssociator.cc.

References associateDTHitId(), DTHitAssociator::Config::associatorByWire, config_, newFWLiteAna::found, LogTrace, mapOfSimHit, and DTRecHit1D::wireId().

Referenced by MuonAssociatorByHitsHelper::getMatchedIds().

336  {
337  std::vector<PSimHit> simhits;
338  std::vector<SimHitIdpr> simtrackids;
339 
340  const TrackingRecHit *hitp = &hit;
341  const DTRecHit1D *dtrechit = dynamic_cast<const DTRecHit1D *>(hitp);
342 
343  if (dtrechit) {
344  DTWireId wireid = dtrechit->wireId();
345 
347  // matching based on DTWireId : take only "valid" SimHits on that wire
348 
349  auto found = mapOfSimHit.find(wireid);
350  if (found != mapOfSimHit.end()) {
351  for (vector<PSimHit_withFlag>::const_iterator hitIT = found->second.begin(); hitIT != found->second.end();
352  ++hitIT) {
353  bool valid_hit = hitIT->second;
354  if (valid_hit)
355  simhits.push_back(hitIT->first);
356  }
357  }
358  } else {
359  // matching based on DTDigiSimLink
360 
361  simtrackids = associateDTHitId(dtrechit);
362 
363  for (vector<SimHitIdpr>::const_iterator idIT = simtrackids.begin(); idIT != simtrackids.end(); ++idIT) {
364  uint32_t trId = idIT->first;
365  EncodedEventId evId = idIT->second;
366 
367  auto found = mapOfSimHit.find(wireid);
368  if (found != mapOfSimHit.end()) {
369  for (vector<PSimHit_withFlag>::const_iterator hitIT = found->second.begin(); hitIT != found->second.end();
370  ++hitIT) {
371  if (hitIT->first.trackId() == trId && hitIT->first.eventId() == evId)
372  simhits.push_back(hitIT->first);
373  }
374  }
375  }
376  }
377 
378  } else {
379  LogTrace("DTHitAssociator") << "*** WARNING in DTHitAssociator::associateHit, null dynamic_cast !";
380  }
381  return simhits;
382 }
#define LogTrace(id)
SimHitMap mapOfSimHit
Config const & config_
std::vector< SimHitIdpr > associateDTHitId(const DTRecHit1D *dtrechit) const
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:76
std::vector< DTHitAssociator::SimHitIdpr > DTHitAssociator::associateHitId ( const TrackingRecHit hit) const

Definition at line 253 of file DTHitAssociator.cc.

References associateDTHitId(), and LogTrace.

253  {
254  std::vector<SimHitIdpr> simtrackids;
255  const TrackingRecHit *hitp = &hit;
256  const DTRecHit1D *dtrechit = dynamic_cast<const DTRecHit1D *>(hitp);
257 
258  if (dtrechit) {
259  simtrackids = associateDTHitId(dtrechit);
260  } else {
261  LogTrace("DTHitAssociator") << "*** WARNING in DTHitAssociator::associateHitId, null dynamic_cast "
262  "!";
263  }
264  return simtrackids;
265 }
#define LogTrace(id)
std::vector< SimHitIdpr > associateDTHitId(const DTRecHit1D *dtrechit) const
void DTHitAssociator::initEvent ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 65 of file DTHitAssociator.cc.

References DTHitAssociator::Config::associatorByWire, SplitLinear::begin, MuonDigiCollection< IndexType, DigiType >::begin(), EncodedEventId::bunchCrossing(), config_, DTHitAssociator::Config::crossingframe, DTHitAssociator::Config::DTdigisimlinkTag, DTHitAssociator::Config::DTdigisimlinkToken, DTHitAssociator::Config::DTdigiTag, DTHitAssociator::Config::DTdigiToken, DTHitAssociator::Config::DTrechitTag, DTHitAssociator::Config::DTrechitToken, DTHitAssociator::Config::DTsimhitsTag, DTHitAssociator::Config::DTsimhitsToken, DTHitAssociator::Config::DTsimhitsXFTag, DTHitAssociator::Config::DTsimhitsXFToken, DTHitAssociator::Config::dumpDT, MuonDigiCollection< IndexType, DigiType >::end(), EncodedEventId::event(), PSimHit::eventId(), DTHitAssociator::Config::geomToken, edm::Event::get(), edm::EventSetup::getHandle(), edm::Event::getHandle(), edm::HandleBase::isValid(), edm::InputTag::label(), MainPageGenerator::link, DTHitAssociator::Config::links_exist, LogTrace, mapOfDigi, mapOfLinks, mapOfRecHit, mapOfSimHit, PSimHit::particleType(), printRtS, PSimHit::processType(), sistrip::SpyUtilities::range(), SimHitOK(), and PSimHit::trackId().

Referenced by DTHitAssociator().

65  {
66  LogTrace("DTHitAssociator") << "DTHitAssociator constructor: dumpDT = " << config_.dumpDT
67  << ", crossingframe = " << config_.crossingframe
68  << ", links_exist = " << config_.links_exist
69  << ", associatorByWire = " << config_.associatorByWire;
70 
71  // need DT Geometry to discard hits for which the drift time parametrisation
72  // is not applicable
74 
75  // Get the DT SimHits from the event and map PSimHit by DTWireId
76  mapOfSimHit.clear();
77  bool takeHit(true);
78 
79  if (config_.crossingframe) {
80  LogTrace("DTHitAssociator") << "getting CrossingFrame<PSimHit> collection - " << config_.DTsimhitsXFTag;
81  CrossingFrame<PSimHit> const &xFrame = iEvent.get(config_.DTsimhitsXFToken);
82  unique_ptr<MixCollection<PSimHit>> DTsimhits(new MixCollection<PSimHit>(&xFrame));
83  LogTrace("DTHitAssociator") << "... size = " << DTsimhits->size();
85  for (isimhit = DTsimhits->begin(); isimhit != DTsimhits->end(); isimhit++) {
86  DTWireId wireid((*isimhit).detUnitId());
87  takeHit = SimHitOK(muonGeom, *isimhit);
88  mapOfSimHit[wireid].push_back(make_pair(*isimhit, takeHit));
89  }
90  } else if (!config_.DTsimhitsTag.label().empty()) {
91  LogTrace("DTHitAssociator") << "getting PSimHit collection - " << config_.DTsimhitsTag;
92  edm::PSimHitContainer const &DTsimhits = iEvent.get(config_.DTsimhitsToken);
93  LogTrace("DTHitAssociator") << "... size = " << DTsimhits.size();
94  edm::PSimHitContainer::const_iterator isimhit;
95  for (isimhit = DTsimhits.begin(); isimhit != DTsimhits.end(); isimhit++) {
96  DTWireId wireid((*isimhit).detUnitId());
97  takeHit = SimHitOK(muonGeom, *isimhit);
98  mapOfSimHit[wireid].push_back(make_pair(*isimhit, takeHit));
99  }
100  }
101 
102  // Get the DT Digi collection from the event
103  mapOfDigi.clear();
104  LogTrace("DTHitAssociator") << "getting DTDigi collection - " << config_.DTdigiTag;
106 
107  if (digis.isValid()) {
108  // Map DTDigi by DTWireId
109  for (DTDigiCollection::DigiRangeIterator detUnit = digis->begin(); detUnit != digis->end(); ++detUnit) {
110  const DTLayerId &layerid = (*detUnit).first;
111  const DTDigiCollection::Range &range = (*detUnit).second;
112 
114  for (digi = range.first; digi != range.second; ++digi) {
115  DTWireId wireid(layerid, (*digi).wire());
116  mapOfDigi[wireid].push_back(*digi);
117  }
118  }
119  } else {
120  LogTrace("DTHitAssociator") << "... NO DTDigi collection found !";
121  }
122 
123  mapOfLinks.clear();
124  if (config_.links_exist) {
125  // Get the DT DigiSimLink collection from the event and map DTDigiSimLink by
126  // DTWireId
127  LogTrace("DTHitAssociator") << "getting DTDigiSimLink collection - " << config_.DTdigisimlinkTag;
128  DTDigiSimLinkCollection const &digisimlinks = iEvent.get(config_.DTdigisimlinkToken);
129 
130  for (DTDigiSimLinkCollection::DigiRangeIterator detUnit = digisimlinks.begin(); detUnit != digisimlinks.end();
131  ++detUnit) {
132  const DTLayerId &layerid = (*detUnit).first;
133  const DTDigiSimLinkCollection::Range &range = (*detUnit).second;
134 
136  for (link = range.first; link != range.second; ++link) {
137  DTWireId wireid(layerid, (*link).wire());
138  mapOfLinks[wireid].push_back(*link);
139  }
140  }
141  }
142 
143  if (config_.dumpDT && printRtS) {
144  // Get the DT rechits from the event
145  LogTrace("DTHitAssociator") << "getting DTRecHit1DPair collection - " << config_.DTrechitTag;
146  DTRecHitCollection const &DTrechits = iEvent.get(config_.DTrechitToken);
147  LogTrace("DTHitAssociator") << "... size = " << DTrechits.size();
148 
149  // map DTRecHit1DPair by DTWireId
150  mapOfRecHit.clear();
152  for (rechit = DTrechits.begin(); rechit != DTrechits.end(); ++rechit) {
153  DTWireId wireid = (*rechit).wireId();
154  mapOfRecHit[wireid].push_back(*rechit);
155  }
156 
157  if (mapOfSimHit.end() != mapOfSimHit.begin()) {
158  LogTrace("DTHitAssociator") << "\n *** Dump DT PSimHit's ***";
159 
160  int jwire = 0;
161  int ihit = 0;
162 
163  for (SimHitMap::const_iterator mapIT = mapOfSimHit.begin(); mapIT != mapOfSimHit.end(); ++mapIT, jwire++) {
164  DTWireId wireid = (*mapIT).first;
165  for (vector<PSimHit_withFlag>::const_iterator hitIT = mapOfSimHit[wireid].begin();
166  hitIT != mapOfSimHit[wireid].end();
167  hitIT++, ihit++) {
168  PSimHit hit = hitIT->first;
169  LogTrace("DTHitAssociator") << "PSimHit " << ihit << ", wire " << wireid //<<", detID = "<<hit.detUnitId()
170  << ", SimTrack Id:" << hit.trackId() << "/Evt:(" << hit.eventId().event() << ","
171  << hit.eventId().bunchCrossing() << ") "
172  << ", pdg = " << hit.particleType() << ", procs = " << hit.processType();
173  }
174  }
175  } else {
176  LogTrace("DTHitAssociator") << "\n *** There are NO DT PSimHit's ***";
177  }
178 
179  if (mapOfDigi.end() != mapOfDigi.begin()) {
180  int jwire = 0;
181  int ihit = 0;
182 
183  for (DigiMap::const_iterator mapIT = mapOfDigi.begin(); mapIT != mapOfDigi.end(); ++mapIT, jwire++) {
184  LogTrace("DTHitAssociator") << "\n *** Dump DT digis ***";
185 
186  DTWireId wireid = (*mapIT).first;
187  for (vector<DTDigi>::const_iterator hitIT = mapOfDigi[wireid].begin(); hitIT != mapOfDigi[wireid].end();
188  hitIT++, ihit++) {
189  LogTrace("DTHitAssociator") << "DTDigi " << ihit << ", wire " << wireid << ", number = " << hitIT->number()
190  << ", TDC counts = " << hitIT->countsTDC();
191  }
192  }
193  } else {
194  LogTrace("DTHitAssociator") << "\n *** There are NO DTDigi's ***";
195  }
196 
197  if (mapOfRecHit.end() != mapOfRecHit.begin())
198  LogTrace("DTHitAssociator") << "\n *** Analyze DTRecHitCollection by DTWireId ***";
199 
200  int iwire = 0;
201  for (RecHitMap::const_iterator mapIT = mapOfRecHit.begin(); mapIT != mapOfRecHit.end(); ++mapIT, iwire++) {
202  DTWireId wireid = (*mapIT).first;
203  LogTrace("DTHitAssociator") << "\n======================================="
204  "============================";
205  LogTrace("DTHitAssociator") << "wire index = " << iwire << " *** DTWireId = "
206  << " (" << wireid << ")";
207 
208  if (mapOfSimHit.find(wireid) != mapOfSimHit.end()) {
209  LogTrace("DTHitAssociator") << "\n" << mapOfSimHit[wireid].size() << " SimHits (PSimHit):";
210 
211  for (vector<PSimHit_withFlag>::const_iterator hitIT = mapOfSimHit[wireid].begin();
212  hitIT != mapOfSimHit[wireid].end();
213  ++hitIT) {
214  stringstream tId;
215  tId << (hitIT->first).trackId();
216  string simhitlog = "\t SimTrack Id = " + tId.str();
217  if (hitIT->second)
218  simhitlog = simhitlog + "\t -VALID HIT-";
219  else
220  simhitlog = simhitlog + "\t -not valid hit-";
221  LogTrace("DTHitAssociator") << simhitlog;
222  }
223  }
224 
225  if (mapOfLinks.find(wireid) != mapOfLinks.end()) {
226  LogTrace("DTHitAssociator") << "\n" << mapOfLinks[wireid].size() << " Links (DTDigiSimLink):";
227 
228  for (vector<DTDigiSimLink>::const_iterator hitIT = mapOfLinks[wireid].begin();
229  hitIT != mapOfLinks[wireid].end();
230  ++hitIT) {
231  LogTrace("DTHitAssociator") << "\t digi number = " << hitIT->number() << ", time = " << hitIT->time()
232  << ", SimTrackId = " << hitIT->SimTrackId();
233  }
234  }
235 
236  if (mapOfDigi.find(wireid) != mapOfDigi.end()) {
237  LogTrace("DTHitAssociator") << "\n" << mapOfDigi[wireid].size() << " Digis (DTDigi):";
238  for (vector<DTDigi>::const_iterator hitIT = mapOfDigi[wireid].begin(); hitIT != mapOfDigi[wireid].end();
239  ++hitIT) {
240  LogTrace("DTHitAssociator") << "\t digi number = " << hitIT->number() << ", time = " << hitIT->time();
241  }
242  }
243 
244  LogTrace("DTHitAssociator") << "\n" << (*mapIT).second.size() << " RecHits (DTRecHit1DPair):";
245  for (vector<DTRecHit1DPair>::const_iterator vIT = (*mapIT).second.begin(); vIT != (*mapIT).second.end(); ++vIT) {
246  LogTrace("DTHitAssociator") << "\t digi time = " << vIT->digiTime();
247  }
248  }
249  }
250 }
edm::InputTag DTdigisimlinkTag
int event() const
get the contents of the subdetector field (should be protected?)
edm::EDGetTokenT< DTDigiCollection > DTdigiToken
RecHitMap mapOfRecHit
#define LogTrace(id)
const uint16_t range(const Frame &aFrame)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
SimHitMap mapOfSimHit
int bunchCrossing() const
get the detector field from this detid
edm::InputTag DTsimhitsXFTag
edm::EDGetTokenT< DTRecHitCollection > DTrechitToken
edm::EDGetTokenT< DTDigiSimLinkCollection > DTdigisimlinkToken
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
edm::ESGetToken< DTGeometry, MuonGeometryRecord > geomToken
EncodedEventId eventId() const
Definition: PSimHit.h:108
bool isValid() const
Definition: HandleBase.h:70
Config const & config_
edm::EDGetTokenT< edm::PSimHitContainer > DTsimhitsToken
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
unsigned short processType() const
Definition: PSimHit.h:120
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag DTsimhitsTag
int particleType() const
Definition: PSimHit.h:89
unsigned int trackId() const
Definition: PSimHit.h:106
std::vector< PSimHit > PSimHitContainer
edm::EDGetTokenT< CrossingFrame< PSimHit > > DTsimhitsXFToken
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
bool SimHitOK(const edm::ESHandle< DTGeometry > &, const PSimHit &)
DigiRangeIterator end() const
DigiRangeIterator begin() const
A container for a generic type of digis indexed by some index, implemented with a map&lt;IndexType...
bool DTHitAssociator::SimHitOK ( const edm::ESHandle< DTGeometry > &  muongeom,
const PSimHit simhit 
)
private

Definition at line 384 of file DTHitAssociator.cc.

References PSimHit::detUnitId(), PSimHit::entryPoint(), PSimHit::exitPoint(), PSimHit::localPosition(), DTTopology::none, DTTopology::onWhichBorder(), mps_fire::result, DTTopology::wirePosition(), x, PV3DBase< T, PVType, FrameType >::x(), DTTopology::xMax, DTTopology::xMin, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by initEvent().

384  {
385  bool result = true;
386 
387  DTWireId wireid(simhit.detUnitId());
388  const DTLayer *dtlayer = muongeom->layer(wireid.layerId());
389  LocalPoint entryP = simhit.entryPoint();
390  LocalPoint exitP = simhit.exitPoint();
391  const DTTopology &topo = dtlayer->specificTopology();
392  float xwire = topo.wirePosition(wireid.wire());
393  float xEntry = entryP.x() - xwire;
394  float xExit = exitP.x() - xwire;
395  DTTopology::Side entrySide = topo.onWhichBorder(xEntry, entryP.y(), entryP.z());
396  DTTopology::Side exitSide = topo.onWhichBorder(xExit, exitP.y(), exitP.z());
397 
398  bool noParametrisation =
399  ((entrySide == DTTopology::none || exitSide == DTTopology::none) || (entrySide == exitSide) ||
400  ((entrySide == DTTopology::xMin && exitSide == DTTopology::xMax) ||
401  (entrySide == DTTopology::xMax && exitSide == DTTopology::xMin)));
402 
403  // discard hits where parametrization can not be used
404  if (noParametrisation) {
405  result = false;
406  return result;
407  }
408 
409  float x;
410  LocalPoint hitPos = simhit.localPosition();
411 
412  if (fabs(hitPos.z()) < 0.002) {
413  // hit center within 20 um from z=0, no need to extrapolate.
414  x = hitPos.x() - xwire;
415  } else {
416  x = xEntry - (entryP.z() * (xExit - xEntry)) / (exitP.z() - entryP.z());
417  }
418 
419  // discard hits where x is out of range of the parametrization (|x|>2.1 cm)
420  x *= 10.; // cm -> mm
421  if (fabs(x) > 21.)
422  result = false;
423 
424  return result;
425 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:59
Side onWhichBorder(float x, float y, float z) const
Definition: DTTopology.cc:78
T y() const
Definition: PV3DBase.h:60
tuple result
Definition: mps_fire.py:311
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
Local3DPoint localPosition() const
Definition: PSimHit.h:52
T z() const
Definition: PV3DBase.h:61
Side
Sides of the cell.
Definition: DTTopology.h:89
T x() const
Definition: PV3DBase.h:59
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
unsigned int detUnitId() const
Definition: PSimHit.h:97

Member Data Documentation

Config const& DTHitAssociator::config_
private

Definition at line 77 of file DTHitAssociator.h.

Referenced by associateDTHitId(), associateHit(), and initEvent().

DigiMap DTHitAssociator::mapOfDigi

Definition at line 70 of file DTHitAssociator.h.

Referenced by initEvent().

LinksMap DTHitAssociator::mapOfLinks

Definition at line 71 of file DTHitAssociator.h.

Referenced by associateDTHitId(), and initEvent().

RecHitMap DTHitAssociator::mapOfRecHit

Definition at line 69 of file DTHitAssociator.h.

Referenced by initEvent().

SimHitMap DTHitAssociator::mapOfSimHit

Definition at line 68 of file DTHitAssociator.h.

Referenced by associateDTHitId(), associateHit(), and initEvent().

bool DTHitAssociator::printRtS
private

Definition at line 78 of file DTHitAssociator.h.

Referenced by initEvent().