20 DTdigiTag(conf.getParameter<
edm::InputTag>(
"DTdigiTag")),
55 DTdigiTag(conf.getParameter<
edm::InputTag>(
"DTdigiTag")),
76 LogTrace(
"DTHitAssociator") <<
"DTHitAssociator constructor: dumpDT = " <<
dumpDT 81 LogTrace(
"DTHitAssociator") <<
"*** WARNING in DTHitAssociator::DTHitAssociator: associatorByWire " 83 <<
" \t (missing DTDigiSimLinkCollection ?)";
84 associatorByWire =
true;
101 LogTrace(
"DTHitAssociator") <<
"... size = " << DTsimhits->size();
103 for (isimhit = DTsimhits->begin(); isimhit != DTsimhits->end(); isimhit++) {
104 DTWireId wireid((*isimhit).detUnitId());
105 takeHit =
SimHitOK(muonGeom, *isimhit);
106 mapOfSimHit[wireid].push_back(make_pair(*isimhit, takeHit));
112 LogTrace(
"DTHitAssociator") <<
"... size = " << DTsimhits->size();
113 edm::PSimHitContainer::const_iterator isimhit;
114 for (isimhit = DTsimhits->begin(); isimhit != DTsimhits->end(); isimhit++) {
115 DTWireId wireid((*isimhit).detUnitId());
116 takeHit =
SimHitOK(muonGeom, *isimhit);
117 mapOfSimHit[wireid].push_back(make_pair(*isimhit, takeHit));
130 const DTLayerId &layerid = (*detUnit).first;
134 for (digi = range.first; digi != range.second; ++digi) {
135 DTWireId wireid(layerid, (*digi).wire());
140 LogTrace(
"DTHitAssociator") <<
"... NO DTDigi collection found !";
153 const DTLayerId &layerid = (*detUnit).first;
157 for (link = range.first; link != range.second; ++link) {
158 DTWireId wireid(layerid, (*link).wire());
169 LogTrace(
"DTHitAssociator") <<
"... size = " << DTrechits->size();
174 for (rechit = DTrechits->begin(); rechit != DTrechits->end(); ++rechit) {
175 DTWireId wireid = (*rechit).wireId();
180 LogTrace(
"DTHitAssociator") <<
"\n *** Dump DT PSimHit's ***";
185 for (SimHitMap::const_iterator mapIT =
mapOfSimHit.begin(); mapIT !=
mapOfSimHit.end(); ++mapIT, jwire++) {
187 for (vector<PSimHit_withFlag>::const_iterator hitIT =
mapOfSimHit[wireid].
begin();
191 LogTrace(
"DTHitAssociator") <<
"PSimHit " << ihit <<
", wire " << wireid
198 LogTrace(
"DTHitAssociator") <<
"\n *** There are NO DT PSimHit's ***";
205 for (DigiMap::const_iterator mapIT =
mapOfDigi.begin(); mapIT !=
mapOfDigi.end(); ++mapIT, jwire++) {
206 LogTrace(
"DTHitAssociator") <<
"\n *** Dump DT digis ***";
211 LogTrace(
"DTHitAssociator") <<
"DTDigi " << ihit <<
", wire " << wireid <<
", number = " << hitIT->number()
212 <<
", TDC counts = " << hitIT->countsTDC();
216 LogTrace(
"DTHitAssociator") <<
"\n *** There are NO DTDigi's ***";
220 LogTrace(
"DTHitAssociator") <<
"\n *** Analyze DTRecHitCollection by DTWireId ***";
223 for (RecHitMap::const_iterator mapIT =
mapOfRecHit.begin(); mapIT !=
mapOfRecHit.end(); ++mapIT, iwire++) {
225 LogTrace(
"DTHitAssociator") <<
"\n=======================================" 226 "============================";
227 LogTrace(
"DTHitAssociator") <<
"wire index = " << iwire <<
" *** DTWireId = " 228 <<
" (" << wireid <<
")";
231 LogTrace(
"DTHitAssociator") <<
"\n" <<
mapOfSimHit[wireid].size() <<
" SimHits (PSimHit):";
233 for (vector<PSimHit_withFlag>::const_iterator hitIT =
mapOfSimHit[wireid].
begin();
237 tId << (hitIT->first).trackId();
238 string simhitlog =
"\t SimTrack Id = " + tId.str();
240 simhitlog = simhitlog +
"\t -VALID HIT-";
242 simhitlog = simhitlog +
"\t -not valid hit-";
243 LogTrace(
"DTHitAssociator") << simhitlog;
248 LogTrace(
"DTHitAssociator") <<
"\n" <<
mapOfLinks[wireid].size() <<
" Links (DTDigiSimLink):";
250 for (vector<DTDigiSimLink>::const_iterator hitIT =
mapOfLinks[wireid].
begin();
253 LogTrace(
"DTHitAssociator") <<
"\t digi number = " << hitIT->number() <<
", time = " << hitIT->time()
254 <<
", SimTrackId = " << hitIT->SimTrackId();
259 LogTrace(
"DTHitAssociator") <<
"\n" <<
mapOfDigi[wireid].size() <<
" Digis (DTDigi):";
262 LogTrace(
"DTHitAssociator") <<
"\t digi number = " << hitIT->number() <<
", time = " << hitIT->time();
266 LogTrace(
"DTHitAssociator") <<
"\n" << (*mapIT).second.size() <<
" RecHits (DTRecHit1DPair):";
267 for (vector<DTRecHit1DPair>::const_iterator vIT = (*mapIT).second.begin(); vIT != (*mapIT).second.end(); ++vIT) {
268 LogTrace(
"DTHitAssociator") <<
"\t digi time = " << vIT->digiTime();
276 std::vector<SimHitIdpr> simtrackids;
283 LogTrace(
"DTHitAssociator") <<
"*** WARNING in DTHitAssociator::associateHitId, null dynamic_cast " 290 std::vector<SimHitIdpr>
matched;
299 for (vector<PSimHit_withFlag>::const_iterator hitIT =
found->second.begin(); hitIT !=
found->second.end();
301 bool valid_hit = hitIT->second;
302 PSimHit this_hit = hitIT->first;
306 matched.push_back(currentId);
315 float theTime = dtrechit->
digiTime();
327 for (vector<DTDigiSimLink>::const_iterator linkIT =
found->second.begin(); linkIT !=
found->second.end();
329 float digitime = linkIT->time();
330 if (fabs(digitime - theTime) < 0.1) {
331 theNumber = linkIT->number();
339 for (vector<DTDigiSimLink>::const_iterator linkIT =
found->second.begin(); linkIT !=
found->second.end();
341 int digiNr = linkIT->number();
342 if (digiNr == theNumber) {
343 SimHitIdpr currentId(linkIT->SimTrackId(), linkIT->eventId());
344 matched.push_back(currentId);
349 LogTrace(
"DTHitAssociator") <<
"*** ERROR in DTHitAssociator::associateDTHitId - DTRecHit1D: " << *dtrechit
350 <<
" has no associated DTDigiSimLink !" << endl;
359 std::vector<PSimHit> simhits;
360 std::vector<SimHitIdpr> simtrackids;
373 for (vector<PSimHit_withFlag>::const_iterator hitIT =
found->second.begin(); hitIT !=
found->second.end();
375 bool valid_hit = hitIT->second;
377 simhits.push_back(hitIT->first);
385 for (vector<SimHitIdpr>::const_iterator idIT = simtrackids.begin(); idIT != simtrackids.end(); ++idIT) {
386 uint32_t trId = idIT->first;
391 for (vector<PSimHit_withFlag>::const_iterator hitIT =
found->second.begin(); hitIT !=
found->second.end();
393 if (hitIT->first.trackId() == trId && hitIT->first.eventId() == evId)
394 simhits.push_back(hitIT->first);
401 LogTrace(
"DTHitAssociator") <<
"*** WARNING in DTHitAssociator::associateHit, null dynamic_cast !";
410 const DTLayer *dtlayer = muongeom->
layer(wireid.layerId());
413 const DTTopology &topo = dtlayer->specificTopology();
415 float xEntry = entryP.
x() - xwire;
416 float xExit = exitP.
x() - xwire;
420 bool noParametrisation =
426 if (noParametrisation) {
434 if (fabs(hitPos.
z()) < 0.002) {
436 x = hitPos.
x() - xwire;
438 x = xEntry - (entryP.
z() * (xExit - xEntry)) / (exitP.
z() - entryP.
z());
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &hit) const
std::pair< uint32_t, EncodedEventId > SimHitIdpr
int event() const
get the contents of the subdetector field (should be protected?)
Side onWhichBorder(float x, float y, float z) const
std::vector< PSimHit > associateHit(const TrackingRecHit &hit) const
edm::InputTag DTsimhitsTag
C::const_iterator const_iterator
constant access iterator type
Local3DPoint exitPoint() const
Exit point in the local Det frame.
edm::InputTag DTrechitTag
Local3DPoint localPosition() const
int bunchCrossing() const
get the detector field from this detid
float digiTime() const
Return the time (ns) of the digi used to build the rechit.
EncodedEventId eventId() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
T const * product() const
edm::InputTag DTdigisimlinkTag
std::vector< DigiType >::const_iterator const_iterator
unsigned short processType() const
void initEvent(const edm::Event &, const edm::EventSetup &)
DTHitAssociator(const edm::Event &, const edm::EventSetup &, const edm::ParameterSet &, bool printRtS)
unsigned int trackId() const
std::pair< const_iterator, const_iterator > Range
std::vector< PSimHit > PSimHitContainer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
edm::InputTag DTsimhitsXFTag
bool SimHitOK(const edm::ESHandle< DTGeometry > &, const PSimHit &)
DigiRangeIterator end() const
Local3DPoint entryPoint() const
Entry point in the local Det frame.
std::vector< SimHitIdpr > associateDTHitId(const DTRecHit1D *dtrechit) const
unsigned int detUnitId() const
DigiRangeIterator begin() const
DTWireId wireId() const
Return the wireId.
A container for a generic type of digis indexed by some index, implemented with a map<IndexType...