#include <TrackAssociatorByHits.h>
Definition at line 21 of file TrackAssociatorByHits.h.
Definition at line 25 of file TrackAssociatorByHits.h.
TrackAssociatorByHits::TrackAssociatorByHits | ( | const edm::ParameterSet & | conf | ) | [explicit] |
Definition at line 38 of file TrackAssociatorByHits.cc.
References conf_, denomnone, denomreco, denomsim, Exception, edm::ParameterSet::getParameter(), SimToRecoDenominator, AlCaHLTBitMon_QueryRunRegistry::string, and tmp.
: conf_(conf), AbsoluteNumberOfHits(conf_.getParameter<bool>("AbsoluteNumberOfHits")), SimToRecoDenominator(denomnone), quality_SimToReco(conf_.getParameter<double>("Quality_SimToReco")), purity_SimToReco(conf_.getParameter<double>("Purity_SimToReco")), cut_RecoToSim(conf_.getParameter<double>("Cut_RecoToSim")), UsePixels(conf_.getParameter<bool>("UsePixels")), UseGrouped(conf_.getParameter<bool>("UseGrouped")), UseSplitting(conf_.getParameter<bool>("UseSplitting")), ThreeHitTracksAreSpecial(conf_.getParameter<bool>("ThreeHitTracksAreSpecial")) { std::string tmp = conf_.getParameter<string>("SimToRecoDenominator"); if (tmp=="sim") { SimToRecoDenominator = denomsim; } else if (tmp == "reco") { SimToRecoDenominator = denomreco; } if (SimToRecoDenominator == denomnone) { throw cms::Exception("TrackAssociatorByHits") << "SimToRecoDenominator not specified as sim or reco"; } }
TrackAssociatorByHits::~TrackAssociatorByHits | ( | ) |
Definition at line 65 of file TrackAssociatorByHits.cc.
{
//do cleanup here
}
reco::RecoToSimCollection TrackAssociatorByHits::associateRecoToSim | ( | const edm::RefToBaseVector< reco::Track > & | , |
const edm::RefVector< TrackingParticleCollection > & | , | ||
const edm::Event * | event = 0 , |
||
const edm::EventSetup * | setup = 0 |
||
) | const [virtual] |
Association Reco To Sim with Collections.
Implements TrackAssociatorBase.
Referenced by associateRecoToSim().
reco::RecoToSimCollectionSeed TrackAssociatorByHits::associateRecoToSim | ( | const edm::Handle< edm::View< TrajectorySeed > > & | , |
const edm::Handle< TrackingParticleCollection > & | , | ||
const edm::Event * | event = 0 , |
||
const edm::EventSetup * | setup = 0 |
||
) | const [virtual] |
Reimplemented from TrackAssociatorBase.
reco::RecoToSimCollection TrackAssociatorByHits::associateRecoToSim | ( | edm::Handle< edm::View< reco::Track > > & | tCH, |
edm::Handle< TrackingParticleCollection > & | tPCH, | ||
const edm::Event * | event = 0 , |
||
const edm::EventSetup * | setup = 0 |
||
) | const [inline, virtual] |
compare reco to sim the handle of reco::Track and TrackingParticle collections
Reimplemented from TrackAssociatorBase.
Definition at line 44 of file TrackAssociatorByHits.h.
References associateRecoToSim(), event(), and HcalObjRepresent::setup().
{ return TrackAssociatorBase::associateRecoToSim(tCH,tPCH,event,setup); }
reco::SimToRecoCollection TrackAssociatorByHits::associateSimToReco | ( | edm::Handle< edm::View< reco::Track > > & | tCH, |
edm::Handle< TrackingParticleCollection > & | tPCH, | ||
const edm::Event * | event = 0 , |
||
const edm::EventSetup * | setup = 0 |
||
) | const [inline, virtual] |
compare reco to sim the handle of reco::Track and TrackingParticle collections
Reimplemented from TrackAssociatorBase.
Definition at line 52 of file TrackAssociatorByHits.h.
References associateSimToReco(), event(), and HcalObjRepresent::setup().
{ return TrackAssociatorBase::associateSimToReco(tCH,tPCH,event,setup); }
reco::SimToRecoCollection TrackAssociatorByHits::associateSimToReco | ( | const edm::RefToBaseVector< reco::Track > & | , |
const edm::RefVector< TrackingParticleCollection > & | , | ||
const edm::Event * | event = 0 , |
||
const edm::EventSetup * | setup = 0 |
||
) | const [virtual] |
Association Sim To Reco with Collections.
Implements TrackAssociatorBase.
Referenced by associateSimToReco().
reco::SimToRecoCollectionSeed TrackAssociatorByHits::associateSimToReco | ( | const edm::Handle< edm::View< TrajectorySeed > > & | , |
const edm::Handle< TrackingParticleCollection > & | , | ||
const edm::Event * | event = 0 , |
||
const edm::EventSetup * | setup = 0 |
||
) | const [virtual] |
Reimplemented from TrackAssociatorBase.
int TrackAssociatorByHits::getDoubleCount | ( | iter | , |
iter | , | ||
TrackerHitAssociator * | , | ||
TrackingParticleCollection::const_iterator | |||
) | const |
int TrackAssociatorByHits::getDoubleCount | ( | iter | begin, |
iter | end, | ||
TrackerHitAssociator * | associate, | ||
TrackingParticleCollection::const_iterator | t | ||
) | const |
Definition at line 546 of file TrackAssociatorByHits.cc.
References TrackerHitAssociator::associateHitId(), end, and spr::find().
{ int doublecount = 0 ; std::vector<SimHitIdpr> SimTrackIdsDC; // cout<<begin-end<<endl; for (iter it = begin; it != end; it++){ int idcount = 0; SimTrackIdsDC.clear(); associate->associateHitId(*getHitPtr(it), SimTrackIdsDC); // cout<<SimTrackIdsDC.size()<<endl; if(SimTrackIdsDC.size()>1){ // cout<<(t->g4Track_end()-t->g4Track_begin())<<endl; for (TrackingParticle::g4t_iterator g4T = t -> g4Track_begin(); g4T != t -> g4Track_end(); ++g4T) { if(find(SimTrackIdsDC.begin(), SimTrackIdsDC.end(),SimHitIdpr((*g4T).trackId(), SimTrackIdsDC.begin()->second)) != SimTrackIdsDC.end() ){ idcount++; } } } if (idcount>1) doublecount+=(idcount-1); } return doublecount; }
const TrackingRecHit* TrackAssociatorByHits::getHitPtr | ( | edm::OwnVector< TrackingRecHit >::const_iterator | iter | ) | const [inline, private] |
Definition at line 98 of file TrackAssociatorByHits.h.
{return &*iter;}
const TrackingRecHit* TrackAssociatorByHits::getHitPtr | ( | trackingRecHit_iterator | iter | ) | const [inline, private] |
Definition at line 99 of file TrackAssociatorByHits.h.
{return &**iter;}
void TrackAssociatorByHits::getMatchedIds | ( | std::vector< SimHitIdpr > & | , |
std::vector< SimHitIdpr > & | , | ||
int & | , | ||
iter | , | ||
iter | , | ||
TrackerHitAssociator * | |||
) | const |
void TrackAssociatorByHits::getMatchedIds | ( | std::vector< SimHitIdpr > & | matchedIds, |
std::vector< SimHitIdpr > & | SimTrackIds, | ||
int & | ri, | ||
iter | begin, | ||
iter | end, | ||
TrackerHitAssociator * | associate | ||
) | const |
Definition at line 463 of file TrackAssociatorByHits.cc.
References TrackerHitAssociator::associateHitId(), end, TrackingRecHit::geographicalId(), TrackingRecHit::isValid(), j, LogTrace, and DetId::rawId().
{ matchedIds.clear(); ri=0;//valid rechits for (iter it = begin; it != end; it++){ const TrackingRecHit *hit=getHitPtr(it); if (hit->isValid()){ ri++; uint32_t t_detID= hit->geographicalId().rawId(); SimTrackIds.clear(); associate->associateHitId(*hit, SimTrackIds); //save all the id of matched simtracks if(!SimTrackIds.empty()){ for(size_t j=0; j<SimTrackIds.size(); j++){ LogTrace("TrackAssociator") << " hit # " << ri << " valid=" << hit->isValid() << " det id = " << t_detID << " SimId " << SimTrackIds[j].first << " evt=" << SimTrackIds[j].second.event() << " bc=" << SimTrackIds[j].second.bunchCrossing(); matchedIds.push_back(SimTrackIds[j]); } } //****to be used when the crossing frame is in the event and with flag TrackAssociatorByHitsESProducer.associateRecoTracks = false //std::vector<PSimHit> tmpSimHits = associate->associateHit(*getHitPtr(it)); //for(size_t j=0; j<tmpSimHits.size(); j++) { // LogTrace("TrackAssociator") << " hit # " << ri << " valid=" << getHitPtr(it)->isValid() // << " det id = " << t_detID << " SimId " << SimTrackIds[j].first // << " evt=" << SimTrackIds[j].second.event() // << " bc=" << SimTrackIds[j].second.bunchCrossing() // << " process=" << tmpSimHits[j].processType() // << " eloss=" << tmpSimHits[j].energyLoss() // << " part type=" << tmpSimHits[j].particleType() // << " pabs=" << tmpSimHits[j].pabs() // << " trId=" << tmpSimHits[j].trackId(); //} }else{ LogTrace("TrackAssociator") <<"\t\t Invalid Hit On "<<hit->geographicalId().rawId(); } }//trackingRecHit loop }
int TrackAssociatorByHits::getShared | ( | std::vector< SimHitIdpr > & | matchedIds, |
std::vector< SimHitIdpr > & | idcachev, | ||
TrackingParticleCollection::const_iterator | t | ||
) | const |
Definition at line 511 of file TrackAssociatorByHits.cc.
References prof2calltree::count, spr::find(), and j.
{ int nshared = 0; if (t->trackPSimHit().size()==0) return nshared;//should use trackerPSimHit but is not const for(size_t j=0; j<matchedIds.size(); j++){ //LogTrace("TrackAssociator") << "now matchedId=" << matchedIds[j].first; if(find(idcachev.begin(), idcachev.end(),matchedIds[j]) == idcachev.end() ){ //only the first time we see this ID idcachev.push_back(matchedIds[j]); for (TrackingParticle::g4t_iterator g4T = t -> g4Track_begin(); g4T != t -> g4Track_end(); ++g4T) { // LogTrace("TrackAssociator") << " TP (ID, Ev, BC) = " << (*g4T).trackId() // << ", " << t->eventId().event() << ", "<< t->eventId().bunchCrossing() // << " Match(ID, Ev, BC) = " << matchedIds[j].first // << ", " << matchedIds[j].second.event() << ", " // << matchedIds[j].second.bunchCrossing() ; //<< "\t G4 Track Momentum " << (*g4T).momentum() //<< " \t reco Track Momentum " << track->momentum(); if((*g4T).trackId() == matchedIds[j].first && t->eventId() == matchedIds[j].second){ int countedhits = std::count(matchedIds.begin(), matchedIds.end(), matchedIds[j]); nshared += countedhits; // LogTrace("TrackAssociator") << "hits shared by this segment : " << countedhits; // LogTrace("TrackAssociator") << "hits shared so far : " << nshared; } }//g4Tracks loop } } return nshared; }
int TrackAssociatorByHits::LayerFromDetid | ( | const DetId & | detId | ) | const [private] |
Definition at line 291 of file TrackAssociatorByHits.cc.
References PXFDetId::disk(), TIBDetId::layer(), TOBDetId::layer(), PXBDetId::layer(), align::tib::layerNumber(), LogTrace, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, DetId::rawId(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, TIDDetId::wheel(), and TECDetId::wheel().
{ int layerNumber=0; unsigned int subdetId = static_cast<unsigned int>(detId.subdetId()); if ( subdetId == StripSubdetector::TIB) { TIBDetId tibid(detId.rawId()); layerNumber = tibid.layer(); } else if ( subdetId == StripSubdetector::TOB ) { TOBDetId tobid(detId.rawId()); layerNumber = tobid.layer(); } else if ( subdetId == StripSubdetector::TID) { TIDDetId tidid(detId.rawId()); layerNumber = tidid.wheel(); } else if ( subdetId == StripSubdetector::TEC ) { TECDetId tecid(detId.rawId()); layerNumber = tecid.wheel(); } else if ( subdetId == PixelSubdetector::PixelBarrel ) { PXBDetId pxbid(detId.rawId()); layerNumber = pxbid.layer(); } else if ( subdetId == PixelSubdetector::PixelEndcap ) { PXFDetId pxfid(detId.rawId()); layerNumber = pxfid.disk(); } else LogTrace("TrackAssociator") << "Unknown subdetid: " << subdetId; return layerNumber; }
const bool TrackAssociatorByHits::AbsoluteNumberOfHits [private] |
Definition at line 87 of file TrackAssociatorByHits.h.
const edm::ParameterSet& TrackAssociatorByHits::conf_ [private] |
Definition at line 86 of file TrackAssociatorByHits.h.
Referenced by TrackAssociatorByHits().
const double TrackAssociatorByHits::cut_RecoToSim [private] |
Definition at line 91 of file TrackAssociatorByHits.h.
const double TrackAssociatorByHits::purity_SimToReco [private] |
Definition at line 90 of file TrackAssociatorByHits.h.
const double TrackAssociatorByHits::quality_SimToReco [private] |
Definition at line 89 of file TrackAssociatorByHits.h.
Definition at line 88 of file TrackAssociatorByHits.h.
Referenced by TrackAssociatorByHits().
const bool TrackAssociatorByHits::ThreeHitTracksAreSpecial [private] |
Definition at line 95 of file TrackAssociatorByHits.h.
const bool TrackAssociatorByHits::UseGrouped [private] |
Definition at line 93 of file TrackAssociatorByHits.h.
const bool TrackAssociatorByHits::UsePixels [private] |
Definition at line 92 of file TrackAssociatorByHits.h.
const bool TrackAssociatorByHits::UseSplitting [private] |
Definition at line 94 of file TrackAssociatorByHits.h.