58 associatorTokens.push_back(consumes<reco::TrackToTrackingParticleAssociator>(associator));
74 for (
unsigned int www=0;www<
label.size();www++){
82 dirName+=algo.
label()+
"_";
89 if (assoc.find(
"Track")<assoc.length()){
90 assoc.replace(assoc.find(
"Track"),5,
"");
107 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
108 <<
"Analyzing new event" <<
"\n"
109 <<
"====================================================\n" <<
"\n";
132 if (tPCeff.size()==0) {
edm::LogInfo(
"TrackValidator") <<
"TP Collection for efficiency studies has size = 0! Skipping Event." ;
return;}
133 if (tPCfake.size()==0) {
edm::LogInfo(
"TrackValidator") <<
"TP Collection for fake rate studies has size = 0! Skipping Event." ;
return;}
136 event.getByToken(
bsSrc,recoBeamSpotHandle);
143 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
144 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
145 puinfo=(*puinfoH)[puinfo_ite];
162 auto nlayers_tPCeff_ptrs = tpNumberOfLayersAlgo.
calculate(TPCollectionHeff, setup);
163 const auto& nLayers_tPCeff = *(std::get<TrackingParticleNumberOfLayers::nTrackerLayers>(nlayers_tPCeff_ptrs));
164 const auto& nPixelLayers_tPCeff = *(std::get<TrackingParticleNumberOfLayers::nPixelLayers>(nlayers_tPCeff_ptrs));
165 const auto& nStripMonoAndStereoLayers_tPCeff = *(std::get<TrackingParticleNumberOfLayers::nStripMonoAndStereoLayers>(nlayers_tPCeff_ptrs));
167 std::vector<float> mvaDummy;
170 for (
unsigned int ww=0;ww<
associators.size();ww++){
175 for (
unsigned int www=0;www<
label.size();www++){
177 <<
label[www].process()<<
":"
178 <<
label[www].label()<<
":"
179 <<
label[www].instance()<<
" with "
186 if (seedCollection->size()==0) {
187 edm::LogInfo(
"TrackValidator") <<
"SeedCollection size = 0!" ;
192 LogTrace(
"TrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
195 LogTrace(
"TrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
203 edm::LogVerbatim(
"TrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
211 if (tp->charge()==0)
continue;
220 double dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
221 double dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
222 * momentum.z()/
sqrt(momentum.perp2());
224 if(tp->eventId().bunchCrossing() == 0) {
229 histoProducerAlgo_->fill_generic_simTrack_histos(momentumTP,vertexTP, tp->eventId().bunchCrossing());
232 std::vector<std::pair<edm::RefToBase<TrajectorySeed>,
double> > rt;
233 if(simRecColl.
find(tp) != simRecColl.
end()){
237 matchedSeedPointer = rt.begin()->first.get();
239 <<
" with pt=" <<
sqrt(tp->momentum().perp2())
240 <<
" associated with quality:" << rt.begin()->second <<
"\n";
244 <<
" with pt=" <<
sqrt(tp->momentum().perp2())
245 <<
" NOT associated to any TrajectorySeed" <<
"\n";
248 int nSimHits = tp->numberOfTrackerHits();
249 int nSimLayers = nLayers_tPCeff[tp];
250 int nSimPixelLayers = nPixelLayers_tPCeff[tp];
251 int nSimStripMonoAndStereoLayers = nStripMonoAndStereoLayers_tPCeff[tp];
255 if (matchedSeedPointer) {
260 if(!(tsAtClosestApproachSeed.isValid())){
261 edm::LogVerbatim(
"SeedValidator")<<
"TrajectoryStateClosestToBeamLine not valid";
265 tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
266 tsAtClosestApproachSeed.trackStateAtPCA().position().z());
268 tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
269 tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
272 matchedTrackPointer =
new reco::Track(0.,0., vSeed1, pSeed, 1, seedPerigeeErrors.covarianceMatrix());
277 histoProducerAlgo_->fill_recoAssociated_simTrack_histos(w,*tp,tp->momentum(),tp->vertex(),dxySim,dzSim,0,0,nSimHits,nSimLayers,nSimPixelLayers,nSimStripMonoAndStereoLayers,
281 if (matchedTrackPointer) asts++;
292 <<
label[www].process()<<
":"
293 <<
label[www].label()<<
":"
294 <<
label[www].instance()
295 <<
": " << seedCollection->size() <<
"\n";
309 if(!(tsAtClosestApproachSeed.isValid())){
310 edm::LogVerbatim(
"SeedValidator")<<
"TrajectoryStateClosestToBeamLine not valid";
314 tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
315 tsAtClosestApproachSeed.trackStateAtPCA().position().z());
317 tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
318 tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
323 reco::Track* trackFromSeed =
new reco::Track(0.,0., vSeed1, pSeed, 1, seedPerigeeErrors.covarianceMatrix());
326 bool isSigSimMatched(
false);
327 bool isSimMatched(
false);
328 bool isChargeMatched(
true);
329 int numAssocSeeds = 0;
331 double sharedFraction = 0.;
332 std::vector<std::pair<TrackingParticleRef, double> > tp;
333 if(recSimColl.
find(seed) != recSimColl.
end()) {
334 tp = recSimColl[
seed];
337 nSimHits = tp[0].first->numberOfTrackerHits();
338 sharedFraction = tp[0].second;
341 if(simRecColl.
find(tp[0].first) != simRecColl.
end()) numAssocSeeds = simRecColl[tp[0].
first].
size();
346 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
349 isSigSimMatched =
true;
356 edm::LogVerbatim(
"SeedValidator") <<
"TrajectorySeed #" << rT <<
" associated with quality:" << tp.begin()->second <<
"\n";
359 edm::LogVerbatim(
"SeedValidator") <<
"TrajectorySeed #" << rT <<
" NOT associated to any TrackingParticle" <<
"\n";
363 histoProducerAlgo_->fill_generic_recoTrack_histos(w,*trackFromSeed, ttopo, bs.
position(),
nullptr,
nullptr, isSimMatched,isSigSimMatched,
364 isChargeMatched, numAssocSeeds,
366 nSimHits, sharedFraction,
dR, mvaDummy, 0, 0);
370 if (tp.size()==0)
continue;
412 histoProducerAlgo_->fill_ResoAndPull_recoTrack_histos(w,momentumTP,vertexTP,tpr->charge(),
417 LogTrace(
"SeedValidator") <<
"exception found: " << e.
what() <<
"\n";
424 <<
"Total Associated (simToReco): " << ats <<
"\n"
425 <<
"Total Reconstructed: " << rT <<
"\n"
426 <<
"Total Associated (recoToSim): " << at <<
"\n"
427 <<
"Total Fakes: " << rT-at <<
"\n";
virtual char const * what() const
T getParameter(std::string const &) const
void analyze(const edm::Event &, const edm::EventSetup &) override
Method called once per event.
std::vector< edm::InputTag > associators
int event() const
get the contents of the subdetector field (should be protected?)
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > label_pileupinfo
std::vector< TrackingParticle > TrackingParticleCollection
const_iterator end() const
last iterator over the map (read only)
edm::EDGetTokenT< TrackingParticleCollection > label_tp_effic
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
Sin< T >::type sin(const T &t)
const_iterator find(const key_type &k) const
find element with specified reference key
TrackingParticleSelector tpSelector
edm::EDGetTokenT< reco::BeamSpot > bsSrc
math::XYZPointD Point
point in the space
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
std::vector< edm::InputTag > label
std::vector< edm::EDGetTokenT< edm::View< TrajectorySeed > > > labelTokenSeed
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Method called to book the DQM histograms.
int bunchCrossing() const
get the detector field from this detid
FreeTrajectoryState const * freeState(bool withErrors=true) const
TrackerSeedValidator(const edm::ParameterSet &pset)
Constructor.
Cos< T >::type cos(const T &t)
math::XYZPoint Point
point in the space
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::ESHandle< TransientTrackingRecHitBuilder > theTTRHBuilder
std::shared_ptr< TrackingRecHit const > RecHitPointer
std::string parametersDefiner
PTrajectoryStateOnDet const & startingState() const
void setCurrentFolder(const std::string &fullpath)
T const * product() const
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
T const * product() const
TrackCharge charge() const
Charge (-1, 0 or 1)
const int getPU_NumInteractions() const
EncodedEventId eventId() const
Signal source, crossing number.
std::tuple< std::unique_ptr< edm::ValueMap< unsigned int > >, std::unique_ptr< edm::ValueMap< unsigned int > >, std::unique_ptr< edm::ValueMap< unsigned int > > > calculate(const edm::Handle< TrackingParticleCollection > &tps, const edm::EventSetup &iSetup) const
Monte Carlo truth information used for tracking validation.
PerigeeTrajectoryError ftsToPerigeeError(const FTS &originalFTS)
virtual ~TrackerSeedValidator()
Destructor.
const Point & position() const
position
volatile std::atomic< bool > shutdown_flag false
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
math::XYZVectorD Vector
point in the space
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
math::XYZVector Vector
spatial vector
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
bool appendHits(const C &c, const TrackerTopology &ttopo)
append hit patterns from vector of hit references
tuple size
Write out results.
std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associatorTokens
const LocalTrajectoryParameters & parameters() const