30 doTrackAssoc_(
false ),
67 for (isim=allTrackerHits->begin(); isim!= allTrackerHits->end();isim++) {
68 SimHitMap[(*isim).detUnitId()].push_back((*isim));
70 DetId theDet((*isim).detUnitId());
85 doPixel_( conf.getParameter<bool>(
"associatePixel") ),
86 doStrip_( conf.getParameter<bool>(
"associateStrip") ),
87 doTrackAssoc_( conf.getParameter<bool>(
"associateRecoTracks") ),
117 for (isim=allTrackerHits->begin(); isim!= allTrackerHits->end();isim++) {
118 SimHitMap[(*isim).detUnitId()].push_back((*isim));
120 DetId theDet((*isim).detUnitId());
137 std::cout <<
"calling associateHit for TransientTRH" << std::endl;
142 std::vector<PSimHit>
result;
151 uint32_t detID = detid.
rawId();
161 if(
const SiStripRecHit2D * rechit =
162 dynamic_cast<const SiStripRecHit2D *>(&thit))
167 else if(
const SiStripRecHit1D * rechit =
168 dynamic_cast<const SiStripRecHit1D *>(&thit))
173 else if(
const SiStripMatchedRecHit2D * rechit =
174 dynamic_cast<const SiStripMatchedRecHit2D *>(&thit))
180 dynamic_cast<const ProjectedSiStripRecHit2D *>(&thit))
184 detid = rechit->originalHit().geographicalId();
185 detID = detid.
rawId();
197 if(
const SiPixelRecHit * rechit = dynamic_cast<const SiPixelRecHit *>(&thit))
235 std::vector<PSimHit> simHit;
250 vector<PSimHit> simHit;
251 std::map<unsigned int, std::vector<PSimHit> >::const_iterator it =
SimHitMap.find(detID);
255 vector<PSimHit>::const_iterator simHitIter = simHit.begin();
256 vector<PSimHit>::const_iterator simHitIterEnd = simHit.end();
257 for (;simHitIter != simHitIterEnd; ++simHitIter) {
258 const PSimHit ihit = *simHitIter;
259 unsigned int simHitid = ihit.
trackId();
266 result.push_back(ihit);
273 std::map<unsigned int, std::vector<PSimHit> >::const_iterator itrphi =
275 std::map<unsigned int, std::vector<PSimHit> >::const_iterator itster =
278 simHit = itrphi->second;
279 simHit.insert(simHit.end(),(itster->second).
begin(),(itster->second).
end());
280 vector<PSimHit>::const_iterator simHitIter = simHit.begin();
281 vector<PSimHit>::const_iterator simHitIterEnd = simHit.end();
282 for (;simHitIter != simHitIterEnd; ++simHitIter) {
283 const PSimHit ihit = *simHitIter;
284 unsigned int simHitid = ihit.
trackId();
295 result.push_back(ihit);
311 std::vector< SimHitIdpr > simhitid;
345 if(
const SiStripRecHit2D * rechit =
346 dynamic_cast<const SiStripRecHit2D *>(&thit))
351 else if(
const SiStripRecHit1D * rechit =
352 dynamic_cast<const SiStripRecHit1D *>(&thit))
357 else if(
const SiStripMatchedRecHit2D * rechit =
358 dynamic_cast<const SiStripMatchedRecHit2D *>(&thit))
364 dynamic_cast<const ProjectedSiStripRecHit2D *>(&thit))
377 if(
const SiPixelRecHit * rechit = dynamic_cast<const SiPixelRecHit *>(&thit))
399 if(simplerechit->cluster().isNonnull())
401 clust=&(*simplerechit->cluster());
403 else if(simplerechit->cluster_regional().isNonnull())
405 clust=&(*simplerechit->cluster_regional());
416 if(simplerechit->cluster().isNonnull())
418 clust=&(*simplerechit->cluster());
420 else if(simplerechit->cluster_regional().isNonnull())
422 clust=&(*simplerechit->cluster_regional());
482 const uint32_t& detID,
483 std::vector<SimHitIdpr>& simtrackid){
491 std::vector<SimHitIdpr> cache_simtrackid;
492 cache_simtrackid.clear();
494 std::map<SimHitIdpr, vector<float> > temp_simtrackid;
495 temp_simtrackid.clear();
510 int last = first + clusiz;
515 std::vector<SimHitIdpr> idcachev;
516 std::vector<int> CFposcachev;
520 if( (
int)(linkiter->channel()) >= first && (
int)(linkiter->channel()) < last ){
534 SimHitIdpr currentId(linkiter->SimTrackId(), linkiter->eventId());
539 if(
find(idcachev.begin(),idcachev.end(),currentId ) == idcachev.end()){
546 idcachev.push_back(currentId);
547 simtrackid.push_back(currentId);
553 int currentCFPos = linkiter->CFposition()-1;
554 if(
useCFpos_ &&
find(CFposcachev.begin(),CFposcachev.end(),currentCFPos ) == CFposcachev.end()){
559 CFposcachev.push_back(currentCFPos);
567 edm::LogError(
"TrackerHitAssociator")<<
"no cluster reference attached";
578 vector<SimHitIdpr> matched_mono;
579 vector<SimHitIdpr> matched_st;
580 matched_mono.clear();
583 const SiStripRecHit2D mono = matchedrechit->monoHit();
584 const SiStripRecHit2D st = matchedrechit->stereoHit();
590 if(!matched_mono.empty() && !matched_st.empty()){
593 std::vector<SimHitIdpr> idcachev;
595 for(vector<SimHitIdpr>::iterator mhit=matched_mono.begin(); mhit != matched_mono.end(); mhit++){
597 if(
find(idcachev.begin(), idcachev.end(),(*mhit)) == idcachev.end()) {
598 idcachev.push_back(*mhit);
600 if(
find(matched_st.begin(), matched_st.end(),(*mhit))!=matched_st.end()){
618 vector<SimHitIdpr> matched_mono;
619 matched_mono.clear();
621 const SiStripRecHit2D mono = projectedrechit->
originalHit();
635 uint32_t detID = detid.
rawId();
642 SiPixelRecHit::ClusterRef
const& cluster = pixelrechit->cluster();
646 if(!(cluster.isNull())){
648 int minPixelRow = (*cluster).minPixelRow();
649 int maxPixelRow = (*cluster).maxPixelRow();
650 int minPixelCol = (*cluster).minPixelCol();
651 int maxPixelCol = (*cluster).maxPixelCol();
657 std::vector<SimHitIdpr> idcachev;
658 for( ; linkiter != link_detset.
data.end(); linkiter++) {
662 if( pixel_coord.first <= maxPixelRow &&
663 pixel_coord.first >= minPixelRow &&
664 pixel_coord.second <= maxPixelCol &&
665 pixel_coord.second >= minPixelCol ) {
668 SimHitIdpr currentId(linkiter->SimTrackId(), linkiter->eventId());
670 if(
find(idcachev.begin(),idcachev.end(),currentId) == idcachev.end()){
673 simtrackid.push_back(currentId);
674 idcachev.push_back(currentId);
680 edm::LogError(
"TrackerHitAssociator")<<
"no Pixel cluster reference attached";
696 simtrackid.push_back(currentId);
701 std::vector<const TrackingRecHit*> componenthits = multirechit->
recHits();
703 int size=multirechit->
weights().size(), idmostprobable=0;
706 if(multirechit->
weight(
i)>multirechit->
weight(idmostprobable)) idmostprobable=
i;
716 std::vector<const TrackingRecHit*> componenthits = multirechit->
recHits();
717 int size=multirechit->
weights().size(), idmostprobable=0;
720 if(multirechit->
weight(
i)>multirechit->
weight(idmostprobable)) idmostprobable=
i;
734 simtrackid.push_back(currentId);
T getParameter(std::string const &) const
edm::Handle< edm::DetSetVector< StripDigiSimLink > > stripdigisimlink
std::vector< SimHitIdpr > associateGSRecHit(const SiTrackerGSRecHit2D *gsrechit)
TrackerHitAssociator(const edm::Event &e)
void associateSimpleRecHit(const SiStripRecHit2D *simplerechit, std::vector< SimHitIdpr > &simhitid)
uint16_t firstStrip() const
edm::Handle< edm::DetSetVector< PixelDigiSimLink > > pixeldigisimlink
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit)
void associateSiStripRecHit1D(const SiStripRecHit1D *simplerechit, std::vector< SimHitIdpr > &simhitid)
std::vector< SimHitIdpr > simtrackid
float weight(unsigned int i) const
const int & simtrackId() const
uint32_t geographicalId() const
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
std::vector< const CrossingFrame< PSimHit > * > cf_simhitvec
const int & simtrackId() const
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
std::vector< float > const & weights() const
std::vector< int > simhitCFPos
simhit_map SimHitSubdetMap
EncodedEventId eventId() const
std::vector< SimHitIdpr > associateMultiRecHitId(const SiTrackerMultiRecHit *multirechit)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< PSimHit > associateMultiRecHit(const SiTrackerMultiRecHit *multirechit)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void associateSimpleRecHitCluster(const SiStripCluster *clust, const uint32_t &detID, std::vector< SimHitIdpr > &simtrackid)
edm::Handle< CrossingFrame< PSimHit > > cf_simhit
const uint32_t & eeId() const
vstring trackerContainers
std::pair< uint32_t, EncodedEventId > SimHitIdpr
const uint32_t & eeId() const
static std::pair< int, int > channelToPixel(int ch)
T const * product() const
std::vector< PSimHit > associateHit(const TrackingRecHit &thit)
unsigned int trackId() const
DetId geographicalId() const
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
std::vector< SimHitIdpr > associateProjectedRecHit(const ProjectedSiStripRecHit2D *projectedrechit)
const SiStripRecHit2D & originalHit() const
tuple size
Write out results.
std::vector< SimHitIdpr > associateMatchedRecHit(const SiStripMatchedRecHit2D *matchedrechit)
const std::vector< uint8_t > & amplitudes() const
void associatePixelRecHit(const SiPixelRecHit *pixelrechit, std::vector< SimHitIdpr > &simhitid)
std::vector< SimHitIdpr > associateGSMatchedRecHit(const SiTrackerGSMatchedRecHit2D *gsmrechit)