Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not reorder elements when assigning time (on master) #4

Merged
merged 1 commit into from
Sep 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,39 +51,27 @@ importToBlock( const edm::Event& e,
e.getByToken(srcTimeGsf_, timeGsfH);
e.getByToken(srcTimeErrorGsf_, timeErrGsfH);

auto TKs_end = std::partition(elems.begin(),elems.end(),
[](const ElementType& a){
return a->type() == reco::PFBlockElement::TRACK;
});
auto btk_elems = elems.begin();
for( auto track = btk_elems; track != TKs_end; ++track) {
const auto& ref = (*track)->trackRef();
if (timeH->contains(ref.id())) {
(*track)->setTime( (*timeH)[ref], (*timeErrH)[ref] );
}
if( debug_ ) {
edm::LogInfo("TrackTimingImporter")
<< "Track with pT / eta " << ref->pt() << " / " << ref->eta()
<< " has time: " << (*track)->time() << " +/- " << (*track)->timeError() << std::endl;
}

}

auto gsfTKs_end = std::partition(elems.begin(),elems.end(),
[](const ElementType& a){
return a->type() == reco::PFBlockElement::GSF;
});
auto gsfbtk_elems = elems.begin();
for( auto track = gsfbtk_elems; track != gsfTKs_end; ++track) {
const auto& ref = static_cast<const reco::PFBlockElementGsfTrack*>((*track).get())->GsftrackRef();
if (timeGsfH->contains(ref.id())) {
(*track)->setTime( (*timeGsfH)[ref], (*timeErrGsfH)[ref] );
}
if( debug_ ) {
edm::LogInfo("TrackTimingImporter")
<< "Track with pT / eta " << ref->pt() << " / " << ref->eta()
<< " has time: " << (*track)->time() << " +/- " << (*track)->timeError() << std::endl;
}

}
for( auto& elem : elems ) {
if( reco::PFBlockElement::TRACK == elem->type() ) {
const auto& ref = elem->trackRef();
if (timeH->contains(ref.id())) {
elem->setTime( (*timeH)[ref], (*timeErrH)[ref] );
}
if( debug_ ) {
edm::LogInfo("TrackTimingImporter")
<< "Track with pT / eta " << ref->pt() << " / " << ref->eta()
<< " has time: " << elem->time() << " +/- " << elem->timeError() << std::endl;
}
} else if ( reco::PFBlockElement::GSF == elem->type() ) {
const auto& ref = static_cast<const reco::PFBlockElementGsfTrack*>(elem.get())->GsftrackRef();
if (timeGsfH->contains(ref.id())) {
elem->setTime( (*timeGsfH)[ref], (*timeErrGsfH)[ref] );
}
if( debug_ ) {
edm::LogInfo("TrackTimingImporter")
<< "Track with pT / eta " << ref->pt() << " / " << ref->eta()
<< " has time: " << elem->time() << " +/- " << elem->timeError() << std::endl;
}
}
}
}