Skip to content

Commit

Permalink
Merge pull request cms-sw#4937 from mtosi/from-CMSSW_7_2_X_2014-08-12…
Browse files Browse the repository at this point in the history
…-1400_tracking_and_PV_validation@HLT

tracking and PV validation@HLT
  • Loading branch information
ktf committed Aug 21, 2014
2 parents fb438e7 + 3adae5c commit 1052f22
Show file tree
Hide file tree
Showing 9 changed files with 328 additions and 165 deletions.
4 changes: 4 additions & 0 deletions HLTriggerOffline/Common/python/HLTValidationHarvest_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
from HLTriggerOffline.Higgs.HLTHiggsPostVal_cff import *
from HLTriggerOffline.Exotica.hltExoticaPostProcessors_cff import *
from Validation.RecoTrack.HLTpostProcessorTracker_cfi import *
from Validation.RecoVertex.HLTpostProcessorVertex_cfi import *
#from HLTriggerOffline.Common.PostProcessorExample_cfi import *
from HLTriggerOffline.Common.HLTValidationQT_cff import *

hltpostvalidation = cms.Sequence(
postProcessorHLTtracking
+postProcessorHLTvertexing
+HLTMuonPostVal
+HLTTauPostVal
+EgammaPostVal
Expand Down Expand Up @@ -48,6 +50,7 @@

hltpostvalidation_preprod = cms.Sequence(
postProcessorHLTtracking
+postProcessorHLTvertexing
+HLTTauPostVal
+hltriggerFourVectorClient
+heavyFlavorValidationHarvestingSequence
Expand All @@ -57,5 +60,6 @@

hltpostvalidation_prod = cms.Sequence(
postProcessorHLTtracking
+postProcessorHLTvertexing
+hltriggerFourVectorClient
)
2 changes: 2 additions & 0 deletions HLTriggerOffline/Common/python/HLTValidation_cff.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from Validation.RecoTrack.HLTmultiTrackValidator_cff import *
from Validation.RecoVertex.HLTmultiPVvalidator_cff import *
from HLTriggerOffline.Muon.HLTMuonVal_cff import *
from HLTriggerOffline.Tau.Validation.HLTTauValidation_cff import *
from HLTriggerOffline.Egamma.EgammaValidationAutoConf_cff import *
Expand Down Expand Up @@ -29,6 +30,7 @@

hltvalidation = cms.Sequence(
hltMultiTrackValidation
+hltMultiPVValidation
+HLTMuonVal
+HLTTauVal
+egammaValidationSequence
Expand Down
90 changes: 45 additions & 45 deletions SimTracker/TrackAssociation/src/QuickTrackAssociatorByHits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,9 @@ reco::RecoToSimCollection QuickTrackAssociatorByHits::associateRecoToSimImplemen

size_t collectionSize=::collectionSize(trackCollection); // Delegate away type specific part

//std::cout << "#reco Tracks = " << collectionSize << std::endl;
for( size_t i=0; i < collectionSize; ++i )
{
const reco::Track* pTrack=::getTrackAt(trackCollection,i); // Get a normal pointer for ease of use. This part is type specific so delegate.
// std::cout << ">>> recoTrack #index = " << i << " pt = " << pTrack->pt() << std::endl;

// The return of this function has first as the index and second as the number of associated hits
std::vector < std::pair<edm::Ref<TrackingParticleCollection>,size_t> > trackingParticleQualityPairs=associateTrack( hitOrClusterAssociator, trackingParticleCollection, pTrack->recHitsBegin(), pTrack->recHitsEnd() );
Expand All @@ -216,7 +214,6 @@ reco::RecoToSimCollection QuickTrackAssociatorByHits::associateRecoToSimImplemen
size_t numberOfSharedHits=iTrackingParticleQualityPair->second;
size_t numberOfValidTrackHits=pTrack->found();

//std::cout << ">>> reco2sim. numberOfSharedHits = " << nt++ << ", " << numberOfSharedHits << std::endl;
if( numberOfSharedHits == 0 ) continue; // No point in continuing if there was no association

//if electron subtract double counting
Expand Down Expand Up @@ -263,7 +260,6 @@ reco::SimToRecoCollection QuickTrackAssociatorByHits::associateSimToRecoImplemen
size_t numberOfValidTrackHits=pTrack->found();
size_t numberOfSimulatedHits=0; // Set a few lines below, but only if required.

//std::cout << ">>> sim2reco. numberOfSharedHits = " << nt++ << ", " << numberOfSharedHits << std::endl;
if( numberOfSharedHits==0 ) continue; // No point in continuing if there was no association

if( simToRecoDenominator_==denomsim || (numberOfSharedHits<3 && threeHitTracksAreSpecial_) ) // the numberOfSimulatedHits is not always required, so can skip counting in some circumstances
Expand Down Expand Up @@ -429,48 +425,52 @@ template<typename T_TPCollection,typename iter> std::vector< std::pair<edm::Ref<

template<typename iter> std::vector<OmniClusterRef> QuickTrackAssociatorByHits::getMatchedClusters(iter begin, iter end) const
{
std::vector<OmniClusterRef> returnValue;
for (iter iRecHit = begin; iRecHit != end; ++iRecHit) {
const TrackingRecHit* rhit = getHitFromIter(iRecHit);
if (rhit->isValid()) {
int subdetid = rhit->geographicalId().subdetId();
if (subdetid==PixelSubdetector::PixelBarrel||subdetid==PixelSubdetector::PixelEndcap) {
const SiPixelRecHit* pRHit = dynamic_cast<const SiPixelRecHit*>(rhit);
if (!pRHit->cluster().isNonnull())
edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!" << " file: " << __FILE__ << " line: " << __LINE__;
returnValue.push_back(pRHit->omniClusterRef());
}
else if (subdetid==SiStripDetId::TIB||subdetid==SiStripDetId::TOB||subdetid==SiStripDetId::TID||subdetid==SiStripDetId::TEC) {
const std::type_info &tid = typeid(*rhit);
if (tid == typeid(SiStripMatchedRecHit2D)) {
const SiStripMatchedRecHit2D* sMatchedRHit = dynamic_cast<const SiStripMatchedRecHit2D*>(rhit);
if (!sMatchedRHit->monoHit().cluster().isNonnull() || !sMatchedRHit->stereoHit().cluster().isNonnull())
edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!" << " file: " << __FILE__ << " line: " << __LINE__;
returnValue.push_back(sMatchedRHit->monoClusterRef());
returnValue.push_back(sMatchedRHit->stereoClusterRef());
}
else if (tid == typeid(SiStripRecHit2D)) {
const SiStripRecHit2D* sRHit = dynamic_cast<const SiStripRecHit2D*>(rhit);
if (!sRHit->cluster().isNonnull())
edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!" << " file: " << __FILE__ << " line: " << __LINE__;
returnValue.push_back(sRHit->omniClusterRef());
}
else if (tid == typeid(SiStripRecHit1D)) {
const SiStripRecHit1D* sRHit = dynamic_cast<const SiStripRecHit1D*>(rhit);
if (!sRHit->cluster().isNonnull())
edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!" << " file: " << __FILE__ << " line: " << __LINE__;
returnValue.push_back(sRHit->omniClusterRef());
}
else {
edm::LogError("TrackAssociator") << ">>> getMatchedClusters: TrackingRecHit not associated to any SiStripCluster! subdetid = " << subdetid;
}
}
else {
edm::LogError("TrackAssociator") << ">>> getMatchedClusters: TrackingRecHit not associated to any cluster! subdetid = " << subdetid;
}
}
std::vector<OmniClusterRef> returnValue;
for (iter iRecHit = begin; iRecHit != end; ++iRecHit) {
const TrackingRecHit* rhit = getHitFromIter(iRecHit);
if (rhit->isValid()) {
int subdetid = rhit->geographicalId().subdetId();
if (subdetid==PixelSubdetector::PixelBarrel||subdetid==PixelSubdetector::PixelEndcap) {
const SiPixelRecHit* pRHit = dynamic_cast<const SiPixelRecHit*>(rhit);
if (!pRHit->cluster().isNonnull())
edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!" << " file: " << __FILE__ << " line: " << __LINE__;
returnValue.push_back(pRHit->omniClusterRef());
}
else if (subdetid==SiStripDetId::TIB||subdetid==SiStripDetId::TOB||subdetid==SiStripDetId::TID||subdetid==SiStripDetId::TEC) {
const std::type_info &tid = typeid(*rhit);
if (tid == typeid(SiStripMatchedRecHit2D)) {
const SiStripMatchedRecHit2D* sMatchedRHit = dynamic_cast<const SiStripMatchedRecHit2D*>(rhit);
if (!sMatchedRHit->monoHit().cluster().isNonnull() || !sMatchedRHit->stereoHit().cluster().isNonnull())
edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!" << " file: " << __FILE__ << " line: " << __LINE__;
returnValue.push_back(sMatchedRHit->monoClusterRef());
returnValue.push_back(sMatchedRHit->stereoClusterRef());
}
return returnValue;
else if (tid == typeid(SiStripRecHit2D)) {
const SiStripRecHit2D* sRHit = dynamic_cast<const SiStripRecHit2D*>(rhit);
if (!sRHit->cluster().isNonnull())
edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!" << " file: " << __FILE__ << " line: " << __LINE__;
returnValue.push_back(sRHit->omniClusterRef());
}
else if (tid == typeid(SiStripRecHit1D)) {
const SiStripRecHit1D* sRHit = dynamic_cast<const SiStripRecHit1D*>(rhit);
if (!sRHit->cluster().isNonnull())
edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!" << " file: " << __FILE__ << " line: " << __LINE__;
returnValue.push_back(sRHit->omniClusterRef());
}
else {
auto const & thit = static_cast<BaseTrackerRecHit const&>(*rhit);
if ( thit.isProjected() ) {
} else {
edm::LogError("TrackAssociator") << ">>> getMatchedClusters: TrackingRecHit not associated to any SiStripCluster! subdetid = " << subdetid;
}
}
}
else {
edm::LogError("TrackAssociator") << ">>> getMatchedClusters: TrackingRecHit not associated to any cluster! subdetid = " << subdetid;
}
}
}
return returnValue;
}

template<typename iter> std::vector< std::pair<QuickTrackAssociatorByHits::SimTrackIdentifiers,size_t> > QuickTrackAssociatorByHits::getAllSimTrackIdentifiers( const TrackerHitAssociator& hitAssociator, iter begin, iter end ) const
Expand Down
12 changes: 4 additions & 8 deletions Validation/RecoTrack/plugins/MultiTrackValidator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void MultiTrackValidator::analyze(const edm::Event& event, const edm::EventSetup
edm::Handle<TrackingParticleCollection> TPCollectionHfake ;
event.getByToken(label_tp_fake,TPCollectionHfake);


if(parametersDefiner=="CosmicParametersDefinerForTP") {
edm::Handle<SimHitTPAssociationProducer::SimHitTPAssociationList> simHitsTPAssoc;
//warning: make sure the TP collection used in the map is the same used in the MTV!
Expand All @@ -193,7 +194,7 @@ void MultiTrackValidator::analyze(const edm::Event& event, const edm::EventSetup
event.getByToken(bsSrc,recoBeamSpotHandle);
reco::BeamSpot const & bs = *recoBeamSpotHandle;

edm::Handle< vector<PileupSummaryInfo> > puinfoH;
edm::Handle< std::vector<PileupSummaryInfo> > puinfoH;
event.getByToken(label_pileupinfo,puinfoH);
PileupSummaryInfo puinfo;

Expand Down Expand Up @@ -257,10 +258,7 @@ void MultiTrackValidator::analyze(const edm::Event& event, const edm::EventSetup
//
edm::Handle<View<Track> > trackCollection;
if(!event.getByToken(labelToken[www], trackCollection)&&ignoremissingtkcollection_)continue;
//if (trackCollection->size()==0)
//edm::LogInfo("TrackValidator") << "TrackCollection size = 0!" ;
//continue;
//}

reco::RecoToSimCollection const * recSimCollP=nullptr;
reco::SimToRecoCollection const * simRecCollP=nullptr;
reco::RecoToSimCollection recSimCollL;
Expand Down Expand Up @@ -330,7 +328,7 @@ void MultiTrackValidator::analyze(const edm::Event& event, const edm::EventSetup

//---------- THIS PART HAS TO BE CLEANED UP. THE PARAMETER DEFINER WAS NOT MEANT TO BE USED IN THIS WAY ----------
//If the TrackingParticle is collison like, get the momentum and vertex at production state
if(parametersDefiner=="LhcParametersDefinerForTP")
if(parametersDefiner=="LhcParametersDefinerForTP" || parametersDefiner=="hltLhcParametersDefinerForTP")
{
if(! tpSelector(*tp)) continue;
momentumTP = tp->momentum();
Expand Down Expand Up @@ -426,7 +424,6 @@ void MultiTrackValidator::analyze(const edm::Event& event, const edm::EventSetup
edm::Handle<edm::ValueMap<reco::DeDxData> > dEdx2Handle;
std::vector<edm::ValueMap<reco::DeDxData> > v_dEdx;
v_dEdx.clear();
//std::cout << "PIPPO: label is " << label[www] << std::endl;
if (label[www].label()=="generalTracks") {
try {
event.getByToken(m_dEdx1Tag, dEdx1Handle);
Expand Down Expand Up @@ -487,7 +484,6 @@ void MultiTrackValidator::analyze(const edm::Event& event, const edm::EventSetup
isSimMatched = true;
if (tp[0].first->charge() != track->charge()) isChargeMatched = false;
if(simRecColl.find(tp[0].first) != simRecColl.end()) numAssocRecoTracks = simRecColl[tp[0].first].size();
//std::cout << numAssocRecoTracks << std::endl;
at++;
for (unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
TrackingParticle trackpart = *(tp[tp_ite].first);
Expand Down
Loading

0 comments on commit 1052f22

Please sign in to comment.