30 doTrackAssoc_(
false ) {
60 isim != thisContainerHits->end(); isim++)
61 SimHitMap[(*isim).detUnitId()].push_back((*isim));
64 for (std::vector<PSimHit>::const_iterator isim = simHits->begin();
65 isim != simHits->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") ) {
105 isim != thisContainerHits->end(); isim++) {
106 SimHitMap[(*isim).detUnitId()].push_back((*isim));
112 for (std::vector<PSimHit>::const_iterator isim = simHits->begin();
113 isim != simHits->end(); isim++) {
114 SimHitMap[(*isim).detUnitId()].push_back((*isim));
130 std::vector<PSimHit>
result;
135 std::vector<SimHitIdpr> simtrackid;
139 uint32_t detID = detid.
rawId();
148 vector<PSimHit> simHit;
149 std::map<unsigned int, std::vector<PSimHit> >::const_iterator it =
SimHitMap.find(detID);
153 vector<PSimHit>::const_iterator simHitIter = simHit.begin();
154 vector<PSimHit>::const_iterator simHitIterEnd = simHit.end();
155 for (;simHitIter != simHitIterEnd; ++simHitIter) {
156 const PSimHit ihit = *simHitIter;
157 unsigned int simHitid = ihit.
trackId();
160 for(
size_t i=0;
i<simtrackid.size();
i++) {
161 if(simHitid == simtrackid[
i].
first && simHiteid == simtrackid[
i].
second) {
164 result.push_back(ihit);
173 std::map<unsigned int, std::vector<PSimHit> >::const_iterator itrphi =
175 std::map<unsigned int, std::vector<PSimHit> >::const_iterator itster =
178 simHit = itrphi->second;
179 simHit.insert(simHit.end(),(itster->second).
begin(),(itster->second).
end());
180 vector<PSimHit>::const_iterator simHitIter = simHit.begin();
181 vector<PSimHit>::const_iterator simHitIterEnd = simHit.end();
182 for (;simHitIter != simHitIterEnd; ++simHitIter) {
183 const PSimHit ihit = *simHitIter;
184 unsigned int simHitid = ihit.
trackId();
186 for(
size_t i=0;
i<simtrackid.size();
i++) {
187 if(simHitid == simtrackid[
i].
first && simHiteid == simtrackid[
i].
second) {
190 result.push_back(ihit);
203 std::vector< SimHitIdpr > simhitid;
228 dynamic_cast<const SiStripRecHit2D *>(&thit))
234 dynamic_cast<const SiStripRecHit1D *>(&thit))
240 dynamic_cast<const SiStripMatchedRecHit2D *>(&thit))
246 dynamic_cast<const ProjectedSiStripRecHit2D *>(&thit))
259 if(
const SiPixelRecHit * rechit = dynamic_cast<const SiPixelRecHit *>(&thit))
284 const uint32_t& detID,
285 std::vector<SimHitIdpr>& simtrackid)
const{
289 std::vector<SimHitIdpr> cache_simtrackid;
290 cache_simtrackid.clear();
292 std::map<SimHitIdpr, vector<float> > temp_simtrackid;
293 temp_simtrackid.clear();
302 int last = first + clusiz;
307 std::vector<SimHitIdpr> idcachev;
311 if( (
int)(linkiter->channel()) >= first && (
int)(linkiter->channel()) < last ){
325 SimHitIdpr currentId(linkiter->SimTrackId(), linkiter->eventId());
330 if(
find(idcachev.begin(),idcachev.end(),currentId ) == idcachev.end()){
337 idcachev.push_back(currentId);
338 simtrackid.push_back(currentId);
344 edm::LogError(
"TrackerHitAssociator")<<
"no cluster reference attached";
351 vector<SimHitIdpr> matched_mono;
352 vector<SimHitIdpr> matched_st;
353 matched_mono.clear();
363 std::vector<SimHitIdpr> simtrackid;
364 if(!matched_mono.empty() && !matched_st.empty()){
365 std::vector<SimHitIdpr> idcachev;
366 for(vector<SimHitIdpr>::iterator mhit=matched_mono.begin(); mhit != matched_mono.end(); mhit++){
368 if(
find(idcachev.begin(), idcachev.end(),(*mhit)) == idcachev.end()) {
369 idcachev.push_back(*mhit);
371 if(
find(matched_st.begin(), matched_st.end(),(*mhit))!=matched_st.end()){
372 simtrackid.push_back(*mhit);
386 vector<SimHitIdpr> matched_mono;
387 matched_mono.clear();
401 uint32_t detID = detid.
rawId();
412 int minPixelRow = (*cluster).minPixelRow();
413 int maxPixelRow = (*cluster).maxPixelRow();
414 int minPixelCol = (*cluster).minPixelCol();
415 int maxPixelCol = (*cluster).maxPixelCol();
420 std::vector<SimHitIdpr> idcachev;
421 for( ; linkiter != link_detset.
data.end(); linkiter++) {
425 if( pixel_coord.first <= maxPixelRow &&
426 pixel_coord.first >= minPixelRow &&
427 pixel_coord.second <= maxPixelCol &&
428 pixel_coord.second >= minPixelCol ) {
431 SimHitIdpr currentId(linkiter->SimTrackId(), linkiter->eventId());
433 if(
find(idcachev.begin(),idcachev.end(),currentId) == idcachev.end()){
434 simtrackid.push_back(currentId);
435 idcachev.push_back(currentId);
441 edm::LogError(
"TrackerHitAssociator")<<
"no Pixel cluster reference attached";
451 vector<SimHitIdpr> simtrackid;
454 simtrackid.push_back(currentId);
459 std::vector<const TrackingRecHit*> componenthits = multirechit->
recHits();
461 int size=multirechit->
weights().size(), idmostprobable=0;
464 if(multirechit->
weight(
i)>multirechit->
weight(idmostprobable)) idmostprobable=
i;
471 std::vector<const TrackingRecHit*> componenthits = multirechit->
recHits();
472 int size=multirechit->
weights().size(), idmostprobable=0;
475 if(multirechit->
weight(
i)>multirechit->
weight(idmostprobable)) idmostprobable=
i;
485 vector<SimHitIdpr> simtrackid;
488 simtrackid.push_back(currentId);
T getParameter(std::string const &) const
edm::Handle< edm::DetSetVector< StripDigiSimLink > > stripdigisimlink
std::vector< PSimHit > associateMultiRecHit(const SiTrackerMultiRecHit *multirechit) const
void associateSimpleRecHitCluster(const SiStripCluster *clust, const uint32_t &detID, std::vector< SimHitIdpr > &simtrackid) const
TrackerHitAssociator(const edm::Event &e)
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)
float weight(unsigned int i) const
const int & simtrackId() const
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
const int & simtrackId() const
std::vector< SimHitIdpr > associateProjectedRecHit(const ProjectedSiStripRecHit2D *projectedrechit) const
bool isNull() const
Checks for null.
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
std::vector< float > const & weights() const
std::vector< SimHitIdpr > associateMultiRecHitId(const SiTrackerMultiRecHit *multirechit) const
std::vector< SimHitIdpr > associateGSMatchedRecHit(const SiTrackerGSMatchedRecHit2D *gsmrechit) const
EncodedEventId eventId() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
SiStripRecHit2D originalHit() const
const uint32_t & eeId() const
vstring trackerContainers
std::pair< uint32_t, EncodedEventId > SimHitIdpr
SiStripRecHit2D stereoHit() const
const uint32_t & eeId() const
ClusterRef cluster() const
static std::pair< int, int > channelToPixel(int ch)
T const * product() const
SiStripRecHit2D monoHit() const
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
void associatePixelRecHit(const SiPixelRecHit *pixelrechit, std::vector< SimHitIdpr > &simhitid) const
unsigned int trackId() const
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
std::vector< SimHitIdpr > associateGSRecHit(const SiTrackerGSRecHit2D *gsrechit) const
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
collection_type::const_iterator const_iterator
std::vector< SimHitIdpr > associateMatchedRecHit(const SiStripMatchedRecHit2D *matchedrechit) const
collection_type::const_iterator const_iterator
tuple size
Write out results.
const std::vector< uint8_t > & amplitudes() const
void associateSiStripRecHit(const T *simplerechit, std::vector< SimHitIdpr > &simtrackid) const