46 LogTrace(
"DTHitAssociator") <<
"*** WARNING in DTHitAssociator::DTHitAssociator: associatorByWire " 48 <<
" \t (missing DTDigiSimLinkCollection ?)";
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));
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));
110 const DTLayerId &layerid = (*detUnit).first;
114 for (digi =
range.first; digi !=
range.second; ++digi) {
115 DTWireId wireid(layerid, (*digi).wire());
120 LogTrace(
"DTHitAssociator") <<
"... NO DTDigi collection found !";
132 const DTLayerId &layerid = (*detUnit).first;
136 for (link =
range.first; link !=
range.second; ++link) {
137 DTWireId wireid(layerid, (*link).wire());
147 LogTrace(
"DTHitAssociator") <<
"... size = " << DTrechits.size();
152 for (rechit = DTrechits.begin(); rechit != DTrechits.end(); ++rechit) {
153 DTWireId wireid = (*rechit).wireId();
158 LogTrace(
"DTHitAssociator") <<
"\n *** Dump DT PSimHit's ***";
163 for (SimHitMap::const_iterator mapIT =
mapOfSimHit.begin(); mapIT !=
mapOfSimHit.end(); ++mapIT, jwire++) {
165 for (vector<PSimHit_withFlag>::const_iterator hitIT =
mapOfSimHit[wireid].
begin();
169 LogTrace(
"DTHitAssociator") <<
"PSimHit " << ihit <<
", wire " << wireid
170 <<
", SimTrack Id:" <<
hit.trackId() <<
"/Evt:(" <<
hit.eventId().event() <<
"," 171 <<
hit.eventId().bunchCrossing() <<
") " 172 <<
", pdg = " <<
hit.particleType() <<
", procs = " <<
hit.processType();
176 LogTrace(
"DTHitAssociator") <<
"\n *** There are NO DT PSimHit's ***";
183 for (DigiMap::const_iterator mapIT =
mapOfDigi.begin(); mapIT !=
mapOfDigi.end(); ++mapIT, jwire++) {
184 LogTrace(
"DTHitAssociator") <<
"\n *** Dump DT digis ***";
189 LogTrace(
"DTHitAssociator") <<
"DTDigi " << ihit <<
", wire " << wireid <<
", number = " << hitIT->number()
190 <<
", TDC counts = " << hitIT->countsTDC();
194 LogTrace(
"DTHitAssociator") <<
"\n *** There are NO DTDigi's ***";
198 LogTrace(
"DTHitAssociator") <<
"\n *** Analyze DTRecHitCollection by DTWireId ***";
201 for (RecHitMap::const_iterator mapIT =
mapOfRecHit.begin(); mapIT !=
mapOfRecHit.end(); ++mapIT, iwire++) {
203 LogTrace(
"DTHitAssociator") <<
"\n=======================================" 204 "============================";
205 LogTrace(
"DTHitAssociator") <<
"wire index = " << iwire <<
" *** DTWireId = " 206 <<
" (" << wireid <<
")";
209 LogTrace(
"DTHitAssociator") <<
"\n" <<
mapOfSimHit[wireid].size() <<
" SimHits (PSimHit):";
211 for (vector<PSimHit_withFlag>::const_iterator hitIT =
mapOfSimHit[wireid].
begin();
215 tId << (hitIT->first).trackId();
216 string simhitlog =
"\t SimTrack Id = " + tId.str();
218 simhitlog = simhitlog +
"\t -VALID HIT-";
220 simhitlog = simhitlog +
"\t -not valid hit-";
221 LogTrace(
"DTHitAssociator") << simhitlog;
226 LogTrace(
"DTHitAssociator") <<
"\n" <<
mapOfLinks[wireid].size() <<
" Links (DTDigiSimLink):";
228 for (vector<DTDigiSimLink>::const_iterator hitIT =
mapOfLinks[wireid].
begin();
231 LogTrace(
"DTHitAssociator") <<
"\t digi number = " << hitIT->number() <<
", time = " << hitIT->time()
232 <<
", SimTrackId = " << hitIT->SimTrackId();
237 LogTrace(
"DTHitAssociator") <<
"\n" <<
mapOfDigi[wireid].size() <<
" Digis (DTDigi):";
240 LogTrace(
"DTHitAssociator") <<
"\t digi number = " << hitIT->number() <<
", time = " << hitIT->time();
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();
254 std::vector<SimHitIdpr> simtrackids;
261 LogTrace(
"DTHitAssociator") <<
"*** WARNING in DTHitAssociator::associateHitId, null dynamic_cast " 268 std::vector<SimHitIdpr>
matched;
277 for (vector<PSimHit_withFlag>::const_iterator hitIT =
found->second.begin(); hitIT !=
found->second.end();
279 bool valid_hit = hitIT->second;
280 PSimHit this_hit = hitIT->first;
293 float theTime =
dtrechit->digiTime();
305 for (vector<DTDigiSimLink>::const_iterator linkIT =
found->second.begin(); linkIT !=
found->second.end();
307 float digitime = linkIT->time();
308 if (fabs(digitime - theTime) < 0.1) {
309 theNumber = linkIT->number();
317 for (vector<DTDigiSimLink>::const_iterator linkIT =
found->second.begin(); linkIT !=
found->second.end();
319 int digiNr = linkIT->number();
320 if (digiNr == theNumber) {
321 SimHitIdpr currentId(linkIT->SimTrackId(), linkIT->eventId());
327 LogTrace(
"DTHitAssociator") <<
"*** ERROR in DTHitAssociator::associateDTHitId - DTRecHit1D: " << *
dtrechit 328 <<
" has no associated DTDigiSimLink !" << endl;
338 std::vector<SimHitIdpr> simtrackids;
351 for (vector<PSimHit_withFlag>::const_iterator hitIT =
found->second.begin(); hitIT !=
found->second.end();
353 bool valid_hit = hitIT->second;
355 simhits.push_back(hitIT->first);
363 for (vector<SimHitIdpr>::const_iterator idIT = simtrackids.begin(); idIT != simtrackids.end(); ++idIT) {
364 uint32_t trId = idIT->first;
369 for (vector<PSimHit_withFlag>::const_iterator hitIT =
found->second.begin(); hitIT !=
found->second.end();
371 if (hitIT->first.trackId() == trId && hitIT->first.eventId() == evId)
372 simhits.push_back(hitIT->first);
379 LogTrace(
"DTHitAssociator") <<
"*** WARNING in DTHitAssociator::associateHit, null dynamic_cast !";
388 const DTLayer *dtlayer = muongeom->
layer(wireid.layerId());
391 const DTTopology &topo = dtlayer->specificTopology();
393 float xEntry = entryP.
x() - xwire;
394 float xExit = exitP.
x() - xwire;
398 bool noParametrisation =
404 if (noParametrisation) {
412 if (fabs(hitPos.
z()) < 0.002) {
414 x = hitPos.
x() - xwire;
416 x = xEntry - (entryP.
z() * (xExit - xEntry)) / (exitP.
z() - entryP.
z());
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::InputTag DTdigisimlinkTag
std::vector< PSimHit > associateHit(const TrackingRecHit &hit) const
std::pair< uint32_t, EncodedEventId > SimHitIdpr
Config(const edm::ParameterSet &, edm::ConsumesCollector iC)
unsigned int detUnitId() const
edm::EDGetTokenT< DTDigiCollection > DTdigiToken
Side onWhichBorder(float x, float y, float z) const
Local3DPoint exitPoint() const
Exit point in the local Det frame.
std::vector< SimHitIdpr > associateDTHitId(const DTRecHit1D *dtrechit) const
DTHitAssociator(const edm::Event &, const edm::EventSetup &, const Config &, bool printRtS)
C::const_iterator const_iterator
constant access iterator type
edm::InputTag DTsimhitsXFTag
edm::EDGetTokenT< DTRecHitCollection > DTrechitToken
edm::EDGetTokenT< DTDigiSimLinkCollection > DTdigisimlinkToken
Local3DPoint entryPoint() const
Entry point in the local Det frame.
edm::InputTag DTrechitTag
edm::ESGetToken< DTGeometry, MuonGeometryRecord > geomToken
unsigned int trackId() const
EncodedEventId eventId() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
DigiRangeIterator begin() const
edm::EDGetTokenT< edm::PSimHitContainer > DTsimhitsToken
Local3DPoint localPosition() const
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
edm::InputTag DTsimhitsTag
void initEvent(const edm::Event &, const edm::EventSetup &)
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &hit) const
std::vector< PSimHit > PSimHitContainer
edm::EDGetTokenT< CrossingFrame< PSimHit > > DTsimhitsXFToken
bool SimHitOK(const edm::ESHandle< DTGeometry > &, const PSimHit &)
DigiRangeIterator end() const
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
A container for a generic type of digis indexed by some index, implemented with a map<IndexType...