76 LogTrace(
"DTHitAssociator") <<
"DTHitAssociator constructor: dumpDT = " <<
dumpDT
81 LogTrace(
"DTHitAssociator") <<
"*** WARNING in DTHitAssociator::DTHitAssociator: associatorByWire "
83 <<
" \t (missing DTDigiSimLinkCollection ?)";
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;
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
192 <<
", SimTrack Id:" <<
hit.trackId() <<
"/Evt:(" <<
hit.eventId().event() <<
","
193 <<
hit.eventId().bunchCrossing() <<
") "
194 <<
", pdg = " <<
hit.particleType() <<
", procs = " <<
hit.processType();
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 ***";
209 for (vector<DTDigi>::const_iterator hitIT =
mapOfDigi[wireid].begin(); hitIT !=
mapOfDigi[wireid].end();
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):";
260 for (vector<DTDigi>::const_iterator hitIT =
mapOfDigi[wireid].begin(); hitIT !=
mapOfDigi[wireid].end();
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;
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());
349 LogTrace(
"DTHitAssociator") <<
"*** ERROR in DTHitAssociator::associateDTHitId - DTRecHit1D: " << *
dtrechit
350 <<
" has no associated DTDigiSimLink !" << endl;
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());