30 doTrackAssoc_(
false ) {
65 for (isim=allTrackerHits->
begin(); isim!= allTrackerHits->
end();isim++) {
66 SimHitMap[(*isim).detUnitId()].push_back((*isim));
79 doPixel_( conf.getParameter<bool>(
"associatePixel") ),
80 doStrip_( conf.getParameter<bool>(
"associateStrip") ),
81 doTrackAssoc_( conf.getParameter<bool>(
"associateRecoTracks") ){
109 for (isim=allTrackerHits->
begin(); isim!= allTrackerHits->
end();isim++) {
110 SimHitMap[(*isim).detUnitId()].push_back((*isim));
125 std::cout <<
"calling associateHit for TransientTRH" << std::endl;
130 std::vector<PSimHit>
result;
139 uint32_t detID = detid.
rawId();
149 if(
const SiStripRecHit2D * rechit =
150 dynamic_cast<const SiStripRecHit2D *>(&thit))
155 else if(
const SiStripRecHit1D * rechit =
156 dynamic_cast<const SiStripRecHit1D *>(&thit))
161 else if(
const SiStripMatchedRecHit2D * rechit =
162 dynamic_cast<const SiStripMatchedRecHit2D *>(&thit))
168 dynamic_cast<const ProjectedSiStripRecHit2D *>(&thit))
172 detid = rechit->originalHit().geographicalId();
173 detID = detid.
rawId();
185 if(
const SiPixelRecHit * rechit = dynamic_cast<const SiPixelRecHit *>(&thit))
223 vector<PSimHit> simHit;
224 std::map<unsigned int, std::vector<PSimHit> >::const_iterator it =
SimHitMap.find(detID);
228 vector<PSimHit>::const_iterator simHitIter = simHit.begin();
229 vector<PSimHit>::const_iterator simHitIterEnd = simHit.end();
230 for (;simHitIter != simHitIterEnd; ++simHitIter) {
231 const PSimHit ihit = *simHitIter;
232 unsigned int simHitid = ihit.
trackId();
239 result.push_back(ihit);
245 std::map<unsigned int, std::vector<PSimHit> >::const_iterator itrphi =
247 std::map<unsigned int, std::vector<PSimHit> >::const_iterator itster =
250 simHit = itrphi->second;
251 simHit.insert(simHit.end(),(itster->second).
begin(),(itster->second).
end());
252 vector<PSimHit>::const_iterator simHitIter = simHit.begin();
253 vector<PSimHit>::const_iterator simHitIterEnd = simHit.end();
254 for (;simHitIter != simHitIterEnd; ++simHitIter) {
255 const PSimHit ihit = *simHitIter;
256 unsigned int simHitid = ihit.
trackId();
267 result.push_back(ihit);
282 std::vector< SimHitIdpr > simhitid;
316 if(
const SiStripRecHit2D * rechit =
317 dynamic_cast<const SiStripRecHit2D *>(&thit))
322 else if(
const SiStripRecHit1D * rechit =
323 dynamic_cast<const SiStripRecHit1D *>(&thit))
328 else if(
const SiStripMatchedRecHit2D * rechit =
329 dynamic_cast<const SiStripMatchedRecHit2D *>(&thit))
335 dynamic_cast<const ProjectedSiStripRecHit2D *>(&thit))
348 if(
const SiPixelRecHit * rechit = dynamic_cast<const SiPixelRecHit *>(&thit))
370 if(simplerechit->cluster().isNonnull())
372 clust=&(*simplerechit->cluster());
374 else if(simplerechit->cluster_regional().isNonnull())
376 clust=&(*simplerechit->cluster_regional());
387 if(simplerechit->cluster().isNonnull())
389 clust=&(*simplerechit->cluster());
391 else if(simplerechit->cluster_regional().isNonnull())
393 clust=&(*simplerechit->cluster_regional());
399 const uint32_t& detID,
400 std::vector<SimHitIdpr>& theSimtrackid, std::vector<PSimHit>& simhit)
405 theSimtrackid.clear();
417 const uint32_t& detID,
418 std::vector<PSimHit>& simhit)
434 const uint32_t& detID,
435 std::vector<SimHitIdpr>& simtrackid){
443 std::vector<SimHitIdpr> cache_simtrackid;
444 cache_simtrackid.clear();
446 std::map<SimHitIdpr, vector<float> > temp_simtrackid;
447 temp_simtrackid.clear();
462 int last = first + clusiz;
467 std::vector<SimHitIdpr> idcachev;
468 std::vector<int> CFposcachev;
472 if( (
int)(linkiter->channel()) >= first && (
int)(linkiter->channel()) < last ){
486 SimHitIdpr currentId(linkiter->SimTrackId(), linkiter->eventId());
491 if(
find(idcachev.begin(),idcachev.end(),currentId ) == idcachev.end()){
498 idcachev.push_back(currentId);
499 simtrackid.push_back(currentId);
504 int currentCFPos = linkiter->CFposition()-1;
505 if(
find(CFposcachev.begin(),CFposcachev.end(),currentCFPos ) == CFposcachev.end()){
512 CFposcachev.push_back(currentCFPos);
520 edm::LogError(
"TrackerHitAssociator")<<
"no cluster reference attached";
531 vector<SimHitIdpr> matched_mono;
532 vector<SimHitIdpr> matched_st;
533 matched_mono.clear();
536 const SiStripRecHit2D mono = matchedrechit->monoHit();
537 const SiStripRecHit2D st = matchedrechit->stereoHit();
543 if(!matched_mono.empty() && !matched_st.empty()){
546 std::vector<SimHitIdpr> idcachev;
548 for(vector<SimHitIdpr>::iterator mhit=matched_mono.begin(); mhit != matched_mono.end(); mhit++){
550 if(
find(idcachev.begin(), idcachev.end(),(*mhit)) == idcachev.end()) {
551 idcachev.push_back(*mhit);
553 if(
find(matched_st.begin(), matched_st.end(),(*mhit))!=matched_st.end()){
571 vector<SimHitIdpr> matched_mono;
572 matched_mono.clear();
574 const SiStripRecHit2D mono = projectedrechit->
originalHit();
588 uint32_t detID = detid.
rawId();
595 SiPixelRecHit::ClusterRef
const& cluster = pixelrechit->cluster();
599 if(!(cluster.isNull())){
601 int minPixelRow = (*cluster).minPixelRow();
602 int maxPixelRow = (*cluster).maxPixelRow();
603 int minPixelCol = (*cluster).minPixelCol();
604 int maxPixelCol = (*cluster).maxPixelCol();
610 std::vector<SimHitIdpr> idcachev;
611 for( ; linkiter != link_detset.
data.end(); linkiter++) {
615 if( pixel_coord.first <= maxPixelRow &&
616 pixel_coord.first >= minPixelRow &&
617 pixel_coord.second <= maxPixelCol &&
618 pixel_coord.second >= minPixelCol ) {
621 SimHitIdpr currentId(linkiter->SimTrackId(), linkiter->eventId());
623 if(
find(idcachev.begin(),idcachev.end(),currentId) == idcachev.end()){
626 simtrackid.push_back(currentId);
627 idcachev.push_back(currentId);
633 edm::LogError(
"TrackerHitAssociator")<<
"no Pixel cluster reference attached";
649 simtrackid.push_back(currentId);
654 std::vector<const TrackingRecHit*> componenthits = multirechit->
recHits();
656 int size=multirechit->
weights().size(), idmostprobable=0;
659 if(multirechit->
weight(
i)>multirechit->
weight(idmostprobable)) idmostprobable=
i;
669 std::vector<const TrackingRecHit*> componenthits = multirechit->
recHits();
670 int size=multirechit->
weights().size(), idmostprobable=0;
673 if(multirechit->
weight(
i)>multirechit->
weight(idmostprobable)) idmostprobable=
i;
687 simtrackid.push_back(currentId);
T getParameter(std::string const &) const
MixCollection< PSimHit > TrackerHits
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)
void associateSimpleRecHitCluster(const SiStripCluster *clust, const uint32_t &detID, std::vector< SimHitIdpr > &theSimtrackid, std::vector< PSimHit > &simhit)
std::vector< float > const & weights() const
std::vector< int > simhitCFPos
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
edm::Handle< CrossingFrame< PSimHit > > cf_simhit
const T & getObject(unsigned int ip) const
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
volatile std::atomic< bool > shutdown_flag false
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)