CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MultiTrackValidator.cc
Go to the documentation of this file.
3 
7 
25 
30 #include<type_traits>
31 #include <unordered_set>
32 
33 
34 #include "TMath.h"
35 #include <TF1.h>
38 //#include <iostream>
39 
40 using namespace std;
41 using namespace edm;
42 
44 namespace {
45  bool trackSelected(unsigned char mask, unsigned char qual) {
46  return mask & 1<<qual;
47  }
48 
49 }
50 
52  MultiTrackValidatorBase(pset,consumesCollector()),
53  parametersDefinerIsCosmic_(parametersDefiner == "CosmicParametersDefinerForTP"),
54  calculateDrSingleCollection_(pset.getUntrackedParameter<bool>("calculateDrSingleCollection")),
55  doPlotsOnlyForTruePV_(pset.getUntrackedParameter<bool>("doPlotsOnlyForTruePV")),
56  doSummaryPlots_(pset.getUntrackedParameter<bool>("doSummaryPlots")),
57  doSimPlots_(pset.getUntrackedParameter<bool>("doSimPlots")),
58  doSimTrackPlots_(pset.getUntrackedParameter<bool>("doSimTrackPlots")),
59  doRecoTrackPlots_(pset.getUntrackedParameter<bool>("doRecoTrackPlots")),
60  dodEdxPlots_(pset.getUntrackedParameter<bool>("dodEdxPlots")),
61  doPVAssociationPlots_(pset.getUntrackedParameter<bool>("doPVAssociationPlots")),
62  doSeedPlots_(pset.getUntrackedParameter<bool>("doSeedPlots")),
63  doMVAPlots_(pset.getUntrackedParameter<bool>("doMVAPlots")),
64  simPVMaxZ_(pset.getUntrackedParameter<double>("simPVMaxZ"))
65 {
66  ParameterSet psetForHistoProducerAlgo = pset.getParameter<ParameterSet>("histoProducerAlgoBlock");
67  histoProducerAlgo_ = std::make_unique<MTVHistoProducerAlgoForTracker>(psetForHistoProducerAlgo, doSeedPlots_, consumesCollector());
68 
69  dirName_ = pset.getParameter<std::string>("dirName");
70  UseAssociators = pset.getParameter< bool >("UseAssociators");
71 
72  tpNLayersToken_ = consumes<edm::ValueMap<unsigned int> >(pset.getParameter<edm::InputTag>("label_tp_nlayers"));
73  tpNPixelLayersToken_ = consumes<edm::ValueMap<unsigned int> >(pset.getParameter<edm::InputTag>("label_tp_npixellayers"));
74  tpNStripStereoLayersToken_ = consumes<edm::ValueMap<unsigned int> >(pset.getParameter<edm::InputTag>("label_tp_nstripstereolayers"));
75 
76  if(dodEdxPlots_) {
77  m_dEdx1Tag = consumes<edm::ValueMap<reco::DeDxData> >(pset.getParameter< edm::InputTag >("dEdx1Tag"));
78  m_dEdx2Tag = consumes<edm::ValueMap<reco::DeDxData> >(pset.getParameter< edm::InputTag >("dEdx2Tag"));
79  }
80 
81  label_tv = consumes<TrackingVertexCollection>(pset.getParameter< edm::InputTag >("label_tv"));
83  recoVertexToken_ = consumes<edm::View<reco::Vertex> >(pset.getUntrackedParameter<edm::InputTag>("label_vertex"));
84  vertexAssociatorToken_ = consumes<reco::VertexToTrackingVertexAssociator>(pset.getUntrackedParameter<edm::InputTag>("vertexAssociator"));
85  }
86 
87  if(doMVAPlots_) {
89  auto mvaPSet = pset.getUntrackedParameter<edm::ParameterSet>("mvaLabels");
90  for(size_t iIter=0; iIter<labelToken.size(); ++iIter) {
92  labelsForToken(labelToken[iIter], labels);
93  if(mvaPSet.exists(labels.module)) {
94  mvaQualityCollectionTokens_[iIter] = edm::vector_transform(mvaPSet.getUntrackedParameter<std::vector<std::string> >(labels.module),
95  [&](const std::string& tag) {
96  return std::make_tuple(consumes<MVACollection>(edm::InputTag(tag, "MVAValues")),
97  consumes<QualityMaskCollection>(edm::InputTag(tag, "QualityMasks")));
98  });
99  }
100  }
101  }
102 
103  tpSelector = TrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
104  pset.getParameter<double>("minRapidityTP"),
105  pset.getParameter<double>("maxRapidityTP"),
106  pset.getParameter<double>("tipTP"),
107  pset.getParameter<double>("lipTP"),
108  pset.getParameter<int>("minHitTP"),
109  pset.getParameter<bool>("signalOnlyTP"),
110  pset.getParameter<bool>("intimeOnlyTP"),
111  pset.getParameter<bool>("chargedOnlyTP"),
112  pset.getParameter<bool>("stableOnlyTP"),
113  pset.getParameter<std::vector<int> >("pdgIdTP"));
114 
115  cosmictpSelector = CosmicTrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
116  pset.getParameter<double>("minRapidityTP"),
117  pset.getParameter<double>("maxRapidityTP"),
118  pset.getParameter<double>("tipTP"),
119  pset.getParameter<double>("lipTP"),
120  pset.getParameter<int>("minHitTP"),
121  pset.getParameter<bool>("chargedOnlyTP"),
122  pset.getParameter<std::vector<int> >("pdgIdTP"));
123 
124 
125  ParameterSet psetVsPhi = psetForHistoProducerAlgo.getParameter<ParameterSet>("TpSelectorForEfficiencyVsPhi");
126  dRtpSelector = TrackingParticleSelector(psetVsPhi.getParameter<double>("ptMin"),
127  psetVsPhi.getParameter<double>("minRapidity"),
128  psetVsPhi.getParameter<double>("maxRapidity"),
129  psetVsPhi.getParameter<double>("tip"),
130  psetVsPhi.getParameter<double>("lip"),
131  psetVsPhi.getParameter<int>("minHit"),
132  psetVsPhi.getParameter<bool>("signalOnly"),
133  psetVsPhi.getParameter<bool>("intimeOnly"),
134  psetVsPhi.getParameter<bool>("chargedOnly"),
135  psetVsPhi.getParameter<bool>("stableOnly"),
136  psetVsPhi.getParameter<std::vector<int> >("pdgId"));
137 
138  dRtpSelectorNoPtCut = TrackingParticleSelector(0.0,
139  psetVsPhi.getParameter<double>("minRapidity"),
140  psetVsPhi.getParameter<double>("maxRapidity"),
141  psetVsPhi.getParameter<double>("tip"),
142  psetVsPhi.getParameter<double>("lip"),
143  psetVsPhi.getParameter<int>("minHit"),
144  psetVsPhi.getParameter<bool>("signalOnly"),
145  psetVsPhi.getParameter<bool>("intimeOnly"),
146  psetVsPhi.getParameter<bool>("chargedOnly"),
147  psetVsPhi.getParameter<bool>("stableOnly"),
148  psetVsPhi.getParameter<std::vector<int> >("pdgId"));
149 
150  useGsf = pset.getParameter<bool>("useGsf");
151 
152  _simHitTpMapTag = mayConsume<SimHitTPAssociationProducer::SimHitTPAssociationList>(pset.getParameter<edm::InputTag>("simHitTpMapTag"));
153 
154  if(calculateDrSingleCollection_) {
155  labelTokenForDrCalculation = consumes<edm::View<reco::Track> >(pset.getParameter<edm::InputTag>("trackCollectionForDrCalculation"));
156  }
157 
158  if(UseAssociators) {
159  for (auto const& src: associators) {
160  associatorTokens.push_back(consumes<reco::TrackToTrackingParticleAssociator>(src));
161  }
162  } else {
163  for (auto const& src: associators) {
164  associatormapStRs.push_back(consumes<reco::SimToRecoCollection>(src));
165  associatormapRtSs.push_back(consumes<reco::RecoToSimCollection>(src));
166  }
167  }
168 }
169 
170 
172 
173 
175 
176  const auto minColl = -0.5;
177  const auto maxColl = label.size()-0.5;
178  const auto nintColl = label.size();
179 
180  auto binLabels = [&](MonitorElement *me) {
181  TH1 *h = me->getTH1();
182  for(size_t i=0; i<label.size(); ++i) {
183  h->GetXaxis()->SetBinLabel(i+1, label[i].label().c_str());
184  }
185  return me;
186  };
187 
188  //Booking histograms concerning with simulated tracks
189  if(doSimPlots_) {
190  ibook.cd();
191  ibook.setCurrentFolder(dirName_ + "simulation");
192 
193  histoProducerAlgo_->bookSimHistos(ibook);
194 
195  ibook.cd();
196  ibook.setCurrentFolder(dirName_);
197  }
198 
199  for (unsigned int ww=0;ww<associators.size();ww++){
200  ibook.cd();
201  // FIXME: these need to be moved to a subdirectory whose name depends on the associator
202  ibook.setCurrentFolder(dirName_);
203 
204  if(doSummaryPlots_) {
205  if(doSimTrackPlots_) {
206  h_assoc_coll.push_back(binLabels( ibook.book1D("num_assoc(simToReco)_coll", "N of associated (simToReco) tracks vs track collection", nintColl, minColl, maxColl) ));
207  h_simul_coll.push_back(binLabels( ibook.book1D("num_simul_coll", "N of simulated tracks vs track collection", nintColl, minColl, maxColl) ));
208 
209  h_assoc_coll_allPt.push_back(binLabels( ibook.book1D("num_assoc(simToReco)_coll_allPt", "N of associated (simToReco) tracks vs track collection", nintColl, minColl, maxColl) ));
210  h_simul_coll_allPt.push_back(binLabels( ibook.book1D("num_simul_coll_allPt", "N of simulated tracks vs track collection", nintColl, minColl, maxColl) ));
211 
212  }
213  if(doRecoTrackPlots_) {
214  h_reco_coll.push_back(binLabels( ibook.book1D("num_reco_coll", "N of reco track vs track collection", nintColl, minColl, maxColl) ));
215  h_assoc2_coll.push_back(binLabels( ibook.book1D("num_assoc(recoToSim)_coll", "N of associated (recoToSim) tracks vs track collection", nintColl, minColl, maxColl) ));
216  h_looper_coll.push_back(binLabels( ibook.book1D("num_duplicate_coll", "N of associated (recoToSim) looper tracks vs track collection", nintColl, minColl, maxColl) ));
217  h_pileup_coll.push_back(binLabels( ibook.book1D("num_pileup_coll", "N of associated (recoToSim) pileup tracks vs track collection", nintColl, minColl, maxColl) ));
218  }
219  }
220 
221  for (unsigned int www=0;www<label.size();www++){
222  ibook.cd();
223  InputTag algo = label[www];
224  string dirName=dirName_;
225  if (algo.process()!="")
226  dirName+=algo.process()+"_";
227  if(algo.label()!="")
228  dirName+=algo.label()+"_";
229  if(algo.instance()!="")
230  dirName+=algo.instance()+"_";
231  if (dirName.find("Tracks")<dirName.length()){
232  dirName.replace(dirName.find("Tracks"),6,"");
233  }
234  string assoc= associators[ww].label();
235  if (assoc.find("Track")<assoc.length()){
236  assoc.replace(assoc.find("Track"),5,"");
237  }
238  dirName+=assoc;
239  std::replace(dirName.begin(), dirName.end(), ':', '_');
240 
241  ibook.setCurrentFolder(dirName.c_str());
242 
243  if(doSimTrackPlots_) {
244  histoProducerAlgo_->bookSimTrackHistos(ibook);
245  if(doPVAssociationPlots_) histoProducerAlgo_->bookSimTrackPVAssociationHistos(ibook);
246  }
247 
248  //Booking histograms concerning with reconstructed tracks
249  if(doRecoTrackPlots_) {
250  histoProducerAlgo_->bookRecoHistos(ibook);
251  if (dodEdxPlots_) histoProducerAlgo_->bookRecodEdxHistos(ibook);
252  if (doPVAssociationPlots_) histoProducerAlgo_->bookRecoPVAssociationHistos(ibook);
253  if (doMVAPlots_) histoProducerAlgo_->bookMVAHistos(ibook, mvaQualityCollectionTokens_[www].size());
254  }
255 
256  if(doSeedPlots_) {
257  histoProducerAlgo_->bookSeedHistos(ibook);
258  }
259  }//end loop www
260  }// end loop ww
261 }
262 
263 namespace {
264  void ensureEffIsSubsetOfFake(const TrackingParticleRefVector& eff, const TrackingParticleRefVector& fake) {
265  // If efficiency RefVector is empty, don't check the product ids
266  // as it will be 0:0 for empty. This covers also the case where
267  // both are empty. The case of fake being empty and eff not is an
268  // error.
269  if(eff.empty())
270  return;
271 
272  // First ensure product ids
273  if(eff.id() != fake.id()) {
274  throw cms::Exception("Configuration") << "Efficiency and fake TrackingParticle (refs) point to different collections (eff " << eff.id() << " fake " << fake.id() << "). This is not supported. Efficiency TP set must be the same or a subset of the fake TP set.";
275  }
276 
277  // Same technique as in associationMapFilterValues
278  std::unordered_set<reco::RecoToSimCollection::index_type> fakeKeys;
279  for(const auto& ref: fake) {
280  fakeKeys.insert(ref.key());
281  }
282 
283  for(const auto& ref: eff) {
284  if(fakeKeys.find(ref.key()) == fakeKeys.end()) {
285  throw cms::Exception("Configuration") << "Efficiency TrackingParticle " << ref.key() << " is not found from the set of fake TPs. This is not supported. The efficiency TP set must be the same or a subset of the fake TP set.";
286  }
287  }
288  }
289 }
290 
292  using namespace reco;
293 
294  LogDebug("TrackValidator") << "\n====================================================" << "\n"
295  << "Analyzing new event" << "\n"
296  << "====================================================\n" << "\n";
297 
298 
299  edm::ESHandle<ParametersDefinerForTP> parametersDefinerTPHandle;
300  setup.get<TrackAssociatorRecord>().get(parametersDefiner,parametersDefinerTPHandle);
301  //Since we modify the object, we must clone it
302  auto parametersDefinerTP = parametersDefinerTPHandle->clone();
303 
305  setup.get<TrackerTopologyRcd>().get(httopo);
306  const TrackerTopology& ttopo = *httopo;
307 
308  // FIXME: we really need to move to edm::View for reading the
309  // TrackingParticles... Unfortunately it has non-trivial
310  // consequences on the associator/association interfaces etc.
311  TrackingParticleRefVector tmpTPeff;
312  TrackingParticleRefVector tmpTPfake;
313  const TrackingParticleRefVector *tmpTPeffPtr = nullptr;
314  const TrackingParticleRefVector *tmpTPfakePtr = nullptr;
315 
317  edm::Handle<TrackingParticleRefVector> TPCollectionHeffRefVector;
318 
319  const bool tp_effic_refvector = label_tp_effic.isUninitialized();
320  if(!tp_effic_refvector) {
321  event.getByToken(label_tp_effic, TPCollectionHeff);
322  for(size_t i=0, size=TPCollectionHeff->size(); i<size; ++i) {
323  tmpTPeff.push_back(TrackingParticleRef(TPCollectionHeff, i));
324  }
325  tmpTPeffPtr = &tmpTPeff;
326  }
327  else {
328  event.getByToken(label_tp_effic_refvector, TPCollectionHeffRefVector);
329  tmpTPeffPtr = TPCollectionHeffRefVector.product();
330  }
332  edm::Handle<TrackingParticleCollection> TPCollectionHfake ;
333  event.getByToken(label_tp_fake,TPCollectionHfake);
334  for(size_t i=0, size=TPCollectionHfake->size(); i<size; ++i) {
335  tmpTPfake.push_back(TrackingParticleRef(TPCollectionHfake, i));
336  }
337  tmpTPfakePtr = &tmpTPfake;
338  }
339  else {
340  edm::Handle<TrackingParticleRefVector> TPCollectionHfakeRefVector;
341  event.getByToken(label_tp_fake_refvector, TPCollectionHfakeRefVector);
342  tmpTPfakePtr = TPCollectionHfakeRefVector.product();
343  }
344 
345  TrackingParticleRefVector const & tPCeff = *tmpTPeffPtr;
346  TrackingParticleRefVector const & tPCfake = *tmpTPfakePtr;
347 
348  ensureEffIsSubsetOfFake(tPCeff, tPCfake);
349 
352  //warning: make sure the TP collection used in the map is the same used in the MTV!
353  event.getByToken(_simHitTpMapTag,simHitsTPAssoc);
354  parametersDefinerTP->initEvent(simHitsTPAssoc);
355  cosmictpSelector.initEvent(simHitsTPAssoc);
356  }
357 
358  const reco::Vertex::Point *thePVposition = nullptr;
359  const TrackingVertex::LorentzVector *theSimPVPosition = nullptr;
360  // Find the sim PV and tak its position
362  event.getByToken(label_tv, htv);
363  {
364  const TrackingVertexCollection& tv = *htv;
365  for(size_t i=0; i<tv.size(); ++i) {
366  const TrackingVertex& simV = tv[i];
367  if(simV.eventId().bunchCrossing() != 0) continue; // remove OOTPU
368  if(simV.eventId().event() != 0) continue; // pick the PV of hard scatter
369  theSimPVPosition = &(simV.position());
370  break;
371  }
372  }
373  if(simPVMaxZ_ >= 0) {
374  if(!theSimPVPosition) return;
375  if(std::abs(theSimPVPosition->z()) > simPVMaxZ_) return;
376  }
377 
378  // Check, when necessary, if reco PV matches to sim PV
381  event.getByToken(recoVertexToken_, hvertex);
382 
384  event.getByToken(vertexAssociatorToken_, hvassociator);
385 
386  auto v_r2s = hvassociator->associateRecoToSim(hvertex, htv);
387  auto pvPtr = hvertex->refAt(0);
388  if(!(pvPtr->isFake() || pvPtr->ndof() < 0)) { // skip junk vertices
389  auto pvFound = v_r2s.find(pvPtr);
390  if(pvFound != v_r2s.end()) {
391  bool matchedToSimPV = false;
392  for(const auto& vertexRefQuality: pvFound->val) {
393  const TrackingVertex& tv = *(vertexRefQuality.first);
394  if(tv.eventId().event() == 0 && tv.eventId().bunchCrossing() == 0) {
395  matchedToSimPV = true;
396  break;
397  }
398  }
399  if(matchedToSimPV) {
401  thePVposition = &(pvPtr->position());
402  }
403  }
404  else if(doPlotsOnlyForTruePV_)
405  return;
406  }
407  else if(doPlotsOnlyForTruePV_)
408  return;
409  }
410  else if(doPlotsOnlyForTruePV_)
411  return;
412  }
413 
414  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
415  event.getByToken(bsSrc,recoBeamSpotHandle);
416  reco::BeamSpot const & bs = *recoBeamSpotHandle;
417 
419  event.getByToken(label_pileupinfo,puinfoH);
420  PileupSummaryInfo puinfo;
421 
422  for (unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
423  if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
424  puinfo=(*puinfoH)[puinfo_ite];
425  break;
426  }
427  }
428 
429  /*
430  edm::Handle<TrackingVertexCollection> tvH;
431  event.getByToken(label_tv,tvH);
432  TrackingVertexCollection const & tv = *tvH;
433  */
434 
435  // Number of 3D layers for TPs
437  event.getByToken(tpNLayersToken_, tpNLayersH);
438  const auto& nLayers_tPCeff = *tpNLayersH;
439 
440  event.getByToken(tpNPixelLayersToken_, tpNLayersH);
441  const auto& nPixelLayers_tPCeff = *tpNLayersH;
442 
443  event.getByToken(tpNStripStereoLayersToken_, tpNLayersH);
444  const auto& nStripMonoAndStereoLayers_tPCeff = *tpNLayersH;
445 
446  // Precalculate TP selection (for efficiency), and momentum and vertex wrt PCA
447  //
448  // TODO: ParametersDefinerForTP ESProduct needs to be changed to
449  // EDProduct because of consumes.
450  //
451  // In principle, we could just precalculate the momentum and vertex
452  // wrt PCA for all TPs for once and put that to the event. To avoid
453  // repetitive calculations those should be calculated only once for
454  // each TP. That would imply that we should access TPs via Refs
455  // (i.e. View) in here, since, in general, the eff and fake TP
456  // collections can be different (and at least HI seems to use that
457  // feature). This would further imply that the
458  // RecoToSimCollection/SimToRecoCollection should be changed to use
459  // View<TP> instead of vector<TP>, and migrate everything.
460  //
461  // Or we could take only one input TP collection, and do another
462  // TP-selection to obtain the "fake" collection like we already do
463  // for "efficiency" TPs.
464  std::vector<size_t> selected_tPCeff;
465  std::vector<std::tuple<TrackingParticle::Vector, TrackingParticle::Point>> momVert_tPCeff;
466  selected_tPCeff.reserve(tPCeff.size());
467  momVert_tPCeff.reserve(tPCeff.size());
468  int nIntimeTPs = 0;
470  for(size_t j=0; j<tPCeff.size(); ++j) {
471  const TrackingParticleRef& tpr = tPCeff[j];
472 
473  TrackingParticle::Vector momentum = parametersDefinerTP->momentum(event,setup,tpr);
474  TrackingParticle::Point vertex = parametersDefinerTP->vertex(event,setup,tpr);
475  if(doSimPlots_) {
476  histoProducerAlgo_->fill_generic_simTrack_histos(momentum, vertex, tpr->eventId().bunchCrossing());
477  }
478  if(tpr->eventId().bunchCrossing() == 0)
479  ++nIntimeTPs;
480 
481  if(cosmictpSelector(tpr,&bs,event,setup)) {
482  selected_tPCeff.push_back(j);
483  momVert_tPCeff.emplace_back(momentum, vertex);
484  }
485  }
486  }
487  else {
488  size_t j=0;
489  for(auto const& tpr: tPCeff) {
490  const TrackingParticle& tp = *tpr;
491 
492  // TODO: do we want to fill these from all TPs that include IT
493  // and OOT (as below), or limit to IT+OOT TPs passing tpSelector
494  // (as it was before)? The latter would require another instance
495  // of tpSelector with intimeOnly=False.
496  if(doSimPlots_) {
497  histoProducerAlgo_->fill_generic_simTrack_histos(tp.momentum(), tp.vertex(), tp.eventId().bunchCrossing());
498  }
499  if(tp.eventId().bunchCrossing() == 0)
500  ++nIntimeTPs;
501 
502  if(tpSelector(tp)) {
503  selected_tPCeff.push_back(j);
504  TrackingParticle::Vector momentum = parametersDefinerTP->momentum(event,setup,tpr);
505  TrackingParticle::Point vertex = parametersDefinerTP->vertex(event,setup,tpr);
506  momVert_tPCeff.emplace_back(momentum, vertex);
507  }
508  ++j;
509  }
510  }
511  if(doSimPlots_) {
512  histoProducerAlgo_->fill_simTrackBased_histos(nIntimeTPs);
513  }
514 
515  //calculate dR for TPs
516  float dR_tPCeff[tPCeff.size()];
517  {
518  float etaL[tPCeff.size()], phiL[tPCeff.size()];
519  for(size_t iTP: selected_tPCeff) {
520  //calculare dR wrt inclusive collection (also with PU, low pT, displaced)
521  auto const& tp2 = *(tPCeff[iTP]);
522  auto && p = tp2.momentum();
523  etaL[iTP] = etaFromXYZ(p.x(),p.y(),p.z());
524  phiL[iTP] = atan2f(p.y(),p.x());
525  }
526  auto i=0U;
527  for ( auto const & tpr : tPCeff) {
528  auto const& tp = *tpr;
530  if(dRtpSelector(tp)) {//only for those needed for efficiency!
531  auto && p = tp.momentum();
532  float eta = etaFromXYZ(p.x(),p.y(),p.z());
533  float phi = atan2f(p.y(),p.x());
534  for(size_t iTP: selected_tPCeff) {
535  //calculare dR wrt inclusive collection (also with PU, low pT, displaced)
536  if (i==iTP) {continue;}
537  auto dR_tmp = reco::deltaR2(eta, phi, etaL[iTP], phiL[iTP]);
538  if (dR_tmp<dR) dR=dR_tmp;
539  } // ttp2 (iTP)
540  }
541  dR_tPCeff[i++] = std::sqrt(dR);
542  } // tp
543  }
544 
545  edm::Handle<View<Track> > trackCollectionForDrCalculation;
547  event.getByToken(labelTokenForDrCalculation, trackCollectionForDrCalculation);
548  }
549 
550  // dE/dx
551  // at some point this could be generalized, with a vector of tags and a corresponding vector of Handles
552  // I'm writing the interface such to take vectors of ValueMaps
553  std::vector<const edm::ValueMap<reco::DeDxData> *> v_dEdx;
554  if(dodEdxPlots_) {
557  event.getByToken(m_dEdx1Tag, dEdx1Handle);
558  event.getByToken(m_dEdx2Tag, dEdx2Handle);
559  v_dEdx.push_back(dEdx1Handle.product());
560  v_dEdx.push_back(dEdx2Handle.product());
561  }
562 
563  std::vector<const MVACollection *> mvaCollections;
564  std::vector<const QualityMaskCollection *> qualityMaskCollections;
565  std::vector<float> mvaValues;
566 
567  int w=0; //counter counting the number of sets of histograms
568  for (unsigned int ww=0;ww<associators.size();ww++){
569  for (unsigned int www=0;www<label.size();www++, w++){ // need to increment w here, since there are many continues in the loop body
570  //
571  //get collections from the event
572  //
573  edm::Handle<View<Track> > trackCollectionHandle;
574  if(!event.getByToken(labelToken[www], trackCollectionHandle)&&ignoremissingtkcollection_)continue;
575  const edm::View<Track>& trackCollection = *trackCollectionHandle;
576 
577  reco::RecoToSimCollection const * recSimCollP=nullptr;
578  reco::SimToRecoCollection const * simRecCollP=nullptr;
579  reco::RecoToSimCollection recSimCollL;
580  reco::SimToRecoCollection simRecCollL;
581 
582  //associate tracks
583  LogTrace("TrackValidator") << "Analyzing "
584  << label[www] << " with "
585  << associators[ww] <<"\n";
586  if(UseAssociators){
588  event.getByToken(associatorTokens[ww], theAssociator);
589 
590  // The associator interfaces really need to be fixed...
592  for(edm::View<Track>::size_type i=0; i<trackCollection.size(); ++i) {
593  trackRefs.push_back(trackCollection.refAt(i));
594  }
595 
596 
597  LogTrace("TrackValidator") << "Calling associateRecoToSim method" << "\n";
598  recSimCollL = std::move(theAssociator->associateRecoToSim(trackRefs, tPCfake));
599  recSimCollP = &recSimCollL;
600  LogTrace("TrackValidator") << "Calling associateSimToReco method" << "\n";
601  // It is necessary to do the association wrt. fake TPs,
602  // because this SimToReco association is used also for
603  // duplicates. Since the set of efficiency TPs are required to
604  // be a subset of the set of fake TPs, for efficiency
605  // histograms it doesn't matter if the association contains
606  // associations of TPs not in the set of efficiency TPs.
607  simRecCollL = std::move(theAssociator->associateSimToReco(trackRefs, tPCfake));
608  simRecCollP = &simRecCollL;
609  }
610  else{
611  Handle<reco::SimToRecoCollection > simtorecoCollectionH;
612  event.getByToken(associatormapStRs[ww], simtorecoCollectionH);
613  simRecCollP = simtorecoCollectionH.product();
614 
615  // We need to filter the associations of the current track
616  // collection only from SimToReco collection, otherwise the
617  // SimToReco histograms get false entries
618  simRecCollL = associationMapFilterValues(*simRecCollP, trackCollection);
619  simRecCollP = &simRecCollL;
620 
621  Handle<reco::RecoToSimCollection > recotosimCollectionH;
622  event.getByToken(associatormapRtSs[ww],recotosimCollectionH);
623  recSimCollP = recotosimCollectionH.product();
624 
625  // We need to filter the associations of the fake-TrackingParticle
626  // collection only from RecoToSim collection, otherwise the
627  // RecoToSim histograms get false entries
628  recSimCollL = associationMapFilterValues(*recSimCollP, tPCfake);
629  recSimCollP = &recSimCollL;
630  }
631 
632  reco::RecoToSimCollection const & recSimColl = *recSimCollP;
633  reco::SimToRecoCollection const & simRecColl = *simRecCollP;
634 
635  // read MVA collections
639  for(const auto& tokenTpl: mvaQualityCollectionTokens_[www]) {
640  event.getByToken(std::get<0>(tokenTpl), hmva);
641  event.getByToken(std::get<1>(tokenTpl), hqual);
642 
643  mvaCollections.push_back(hmva.product());
644  qualityMaskCollections.push_back(hqual.product());
645  if(mvaCollections.back()->size() != trackCollection.size()) {
646  throw cms::Exception("Configuration") << "Inconsistency in track collection and MVA sizes. Track collection " << www << " has " << trackCollection.size() << " tracks, whereas the MVA " << (mvaCollections.size()-1) << " for it has " << mvaCollections.back()->size() << " entries. Double-check your configuration.";
647  }
648  if(qualityMaskCollections.back()->size() != trackCollection.size()) {
649  throw cms::Exception("Configuration") << "Inconsistency in track collection and quality mask sizes. Track collection " << www << " has " << trackCollection.size() << " tracks, whereas the quality mask " << (qualityMaskCollections.size()-1) << " for it has " << qualityMaskCollections.back()->size() << " entries. Double-check your configuration.";
650  }
651  }
652  }
653 
654  // ########################################################
655  // fill simulation histograms (LOOP OVER TRACKINGPARTICLES)
656  // ########################################################
657 
658  //compute number of tracks per eta interval
659  //
660  LogTrace("TrackValidator") << "\n# of TrackingParticles: " << tPCeff.size() << "\n";
661  int ats(0); //This counter counts the number of simTracks that are "associated" to recoTracks
662  int st(0); //This counter counts the number of simulated tracks passing the MTV selection (i.e. tpSelector(tp) )
663  unsigned sts(0); //This counter counts the number of simTracks surviving the bunchcrossing cut
664  unsigned asts(0); //This counter counts the number of simTracks that are "associated" to recoTracks surviving the bunchcrossing cut
665 
666  //loop over already-selected TPs for tracking efficiency
667  for(size_t i=0; i<selected_tPCeff.size(); ++i) {
668  size_t iTP = selected_tPCeff[i];
669  const TrackingParticleRef& tpr = tPCeff[iTP];
670  const TrackingParticle& tp = *tpr;
671 
672  auto const& momVert = momVert_tPCeff[i];
673  TrackingParticle::Vector momentumTP;
674  TrackingParticle::Point vertexTP;
675 
676  double dxySim(0);
677  double dzSim(0);
678  double dxyPVSim = 0;
679  double dzPVSim = 0;
680  double dR=dR_tPCeff[iTP];
681 
682  //---------- THIS PART HAS TO BE CLEANED UP. THE PARAMETER DEFINER WAS NOT MEANT TO BE USED IN THIS WAY ----------
683  //If the TrackingParticle is collison like, get the momentum and vertex at production state
685  {
686  momentumTP = tp.momentum();
687  vertexTP = tp.vertex();
688  //Calcualte the impact parameters w.r.t. PCA
689  const TrackingParticle::Vector& momentum = std::get<TrackingParticle::Vector>(momVert);
690  const TrackingParticle::Point& vertex = std::get<TrackingParticle::Point>(momVert);
691  dxySim = (-vertex.x()*sin(momentum.phi())+vertex.y()*cos(momentum.phi()));
692  dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/sqrt(momentum.perp2())
693  * momentum.z()/sqrt(momentum.perp2());
694 
695  if(theSimPVPosition) {
696  // As in TrackBase::dxy(Point) and dz(Point)
697  dxyPVSim = -(vertex.x()-theSimPVPosition->x())*sin(momentum.phi()) + (vertex.y()-theSimPVPosition->y())*cos(momentum.phi());
698  dzPVSim = vertex.z()-theSimPVPosition->z() - ( (vertex.x()-theSimPVPosition->x()) + (vertex.y()-theSimPVPosition->y()) )/sqrt(momentum.perp2()) * momentum.z()/sqrt(momentum.perp2());
699  }
700  }
701  //If the TrackingParticle is comics, get the momentum and vertex at PCA
702  else
703  {
704  momentumTP = std::get<TrackingParticle::Vector>(momVert);
705  vertexTP = std::get<TrackingParticle::Point>(momVert);
706  dxySim = (-vertexTP.x()*sin(momentumTP.phi())+vertexTP.y()*cos(momentumTP.phi()));
707  dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/sqrt(momentumTP.perp2())
708  * momentumTP.z()/sqrt(momentumTP.perp2());
709 
710  // Do dxy and dz vs. PV make any sense for cosmics? I guess not
711  }
712  //---------- THE PART ABOVE HAS TO BE CLEANED UP. THE PARAMETER DEFINER WAS NOT MEANT TO BE USED IN THIS WAY ----------
713 
714  //This counter counts the number of simulated tracks passing the MTV selection (i.e. tpSelector(tp) ), but only for in-time TPs
715  if(tp.eventId().bunchCrossing() == 0) {
716  st++;
717  }
718 
719  // in the coming lines, histos are filled using as input
720  // - momentumTP
721  // - vertexTP
722  // - dxySim
723  // - dzSim
724  if(!doSimTrackPlots_)
725  continue;
726 
727  // ##############################################
728  // fill RecoAssociated SimTracks' histograms
729  // ##############################################
730  const reco::Track* matchedTrackPointer=0;
731  unsigned int selectsLoose = mvaCollections.size();
732  unsigned int selectsHP = mvaCollections.size();
733  if(simRecColl.find(tpr) != simRecColl.end()){
734  auto const & rt = simRecColl[tpr];
735  if (rt.size()!=0) {
736  ats++; //This counter counts the number of simTracks that have a recoTrack associated
737  // isRecoMatched = true; // UNUSED
738  matchedTrackPointer = rt.begin()->first.get();
739  LogTrace("TrackValidator") << "TrackingParticle #" << st
740  << " with pt=" << sqrt(momentumTP.perp2())
741  << " associated with quality:" << rt.begin()->second <<"\n";
742 
743  if(doMVAPlots_) {
744  // for each MVA we need to take the value of the track
745  // with largest MVA value (for the cumulative histograms)
746  //
747  // also identify the first MVA that possibly selects any
748  // track matched to this TrackingParticle, separately
749  // for loose and highPurity qualities
750  for(size_t imva=0; imva<mvaCollections.size(); ++imva) {
751  const auto& mva = *(mvaCollections[imva]);
752  const auto& qual = *(qualityMaskCollections[imva]);
753 
754  auto iMatch = rt.begin();
755  float maxMva = mva[iMatch->first.key()];
756  for(; iMatch!=rt.end(); ++iMatch) {
757  auto itrk = iMatch->first.key();
758  maxMva = std::max(maxMva, mva[itrk]);
759 
760  if(selectsLoose >= imva && trackSelected(qual[itrk], reco::TrackBase::loose))
761  selectsLoose = imva;
762  if(selectsHP >= imva && trackSelected(qual[itrk], reco::TrackBase::highPurity))
763  selectsHP = imva;
764  }
765  mvaValues.push_back(maxMva);
766  }
767  }
768  }
769  }else{
770  LogTrace("TrackValidator")
771  << "TrackingParticle #" << st
772  << " with pt,eta,phi: "
773  << sqrt(momentumTP.perp2()) << " , "
774  << momentumTP.eta() << " , "
775  << momentumTP.phi() << " , "
776  << " NOT associated to any reco::Track" << "\n";
777  }
778 
779 
780 
781 
782  int nSimHits = tp.numberOfTrackerHits();
783  int nSimLayers = nLayers_tPCeff[tpr];
784  int nSimPixelLayers = nPixelLayers_tPCeff[tpr];
785  int nSimStripMonoAndStereoLayers = nStripMonoAndStereoLayers_tPCeff[tpr];
786  histoProducerAlgo_->fill_recoAssociated_simTrack_histos(w,tp,momentumTP,vertexTP,dxySim,dzSim,dxyPVSim,dzPVSim,nSimHits,nSimLayers,nSimPixelLayers,nSimStripMonoAndStereoLayers,matchedTrackPointer,puinfo.getPU_NumInteractions(), dR, thePVposition, theSimPVPosition, mvaValues, selectsLoose, selectsHP);
787  mvaValues.clear();
788  sts++;
789  if(matchedTrackPointer)
790  asts++;
791  if(doSummaryPlots_) {
792  if(dRtpSelectorNoPtCut(tp)) {
793  h_simul_coll_allPt[ww]->Fill(www);
794  if (matchedTrackPointer) {
795  h_assoc_coll_allPt[ww]->Fill(www);
796  }
797 
798  if(dRtpSelector(tp)) {
799  h_simul_coll[ww]->Fill(www);
800  if (matchedTrackPointer) {
801  h_assoc_coll[ww]->Fill(www);
802  }
803  }
804  }
805  }
806 
807 
808 
809 
810  } // End for (TrackingParticleCollection::size_type i=0; i<tPCeff.size(); i++){
811 
812  // ##############################################
813  // fill recoTracks histograms (LOOP OVER TRACKS)
814  // ##############################################
815  if(!doRecoTrackPlots_)
816  continue;
817  LogTrace("TrackValidator") << "\n# of reco::Tracks with "
818  << label[www].process()<<":"
819  << label[www].label()<<":"
820  << label[www].instance()
821  << ": " << trackCollection.size() << "\n";
822 
823  int sat(0); //This counter counts the number of recoTracks that are associated to SimTracks from Signal only
824  int at(0); //This counter counts the number of recoTracks that are associated to SimTracks
825  int rT(0); //This counter counts the number of recoTracks in general
826  int seed_fit_failed = 0;
827 
828  //calculate dR for tracks
829  const edm::View<Track> *trackCollectionDr = &trackCollection;
831  trackCollectionDr = trackCollectionForDrCalculation.product();
832  }
833  float dR_trk[trackCollection.size()];
834  int i=0;
835  float etaL[trackCollectionDr->size()];
836  float phiL[trackCollectionDr->size()];
837  bool validL[trackCollectionDr->size()];
838  for (auto const & track2 : *trackCollectionDr) {
839  auto && p = track2.momentum();
840  etaL[i] = etaFromXYZ(p.x(),p.y(),p.z());
841  phiL[i] = atan2f(p.y(),p.x());
842  validL[i] = !trackFromSeedFitFailed(track2);
843  ++i;
844  }
845  for(View<Track>::size_type i=0; i<trackCollection.size(); ++i){
846  auto const & track = trackCollection[i];
848  if(!trackFromSeedFitFailed(track)) {
849  auto && p = track.momentum();
850  float eta = etaFromXYZ(p.x(),p.y(),p.z());
851  float phi = atan2f(p.y(),p.x());
852  for(View<Track>::size_type j=0; j<trackCollectionDr->size(); ++j){
853  if(!validL[j]) continue;
854  auto dR_tmp = reco::deltaR2(eta, phi, etaL[j], phiL[j]);
855  if ( (dR_tmp<dR) & (dR_tmp>std::numeric_limits<float>::min())) dR=dR_tmp;
856  }
857  }
858  dR_trk[i] = std::sqrt(dR);
859  }
860 
861  for(View<Track>::size_type i=0; i<trackCollection.size(); ++i){
862  auto track = trackCollection.refAt(i);
863  rT++;
864  if(trackFromSeedFitFailed(*track)) ++seed_fit_failed;
865 
866  bool isSigSimMatched(false);
867  bool isSimMatched(false);
868  bool isChargeMatched(true);
869  int numAssocRecoTracks = 0;
870  int nSimHits = 0;
871  double sharedFraction = 0.;
872 
873  auto tpFound = recSimColl.find(track);
874  isSimMatched = tpFound != recSimColl.end();
875  if (isSimMatched) {
876  const auto& tp = tpFound->val;
877  nSimHits = tp[0].first->numberOfTrackerHits();
878  sharedFraction = tp[0].second;
879  if (tp[0].first->charge() != track->charge()) isChargeMatched = false;
880  if(simRecColl.find(tp[0].first) != simRecColl.end()) numAssocRecoTracks = simRecColl[tp[0].first].size();
881  at++;
882  for (unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
883  TrackingParticle trackpart = *(tp[tp_ite].first);
884  if ((trackpart.eventId().event() == 0) && (trackpart.eventId().bunchCrossing() == 0)){
885  isSigSimMatched = true;
886  sat++;
887  break;
888  }
889  }
890  LogTrace("TrackValidator") << "reco::Track #" << rT << " with pt=" << track->pt()
891  << " associated with quality:" << tp.begin()->second <<"\n";
892  } else {
893  LogTrace("TrackValidator") << "reco::Track #" << rT << " with pt=" << track->pt()
894  << " NOT associated to any TrackingParticle" << "\n";
895  }
896 
897  // set MVA values for this track
898  // take also the indices of first MVAs to select by loose and
899  // HP quality
900  unsigned int selectsLoose = mvaCollections.size();
901  unsigned int selectsHP = mvaCollections.size();
902  if(doMVAPlots_) {
903  for(size_t imva=0; imva<mvaCollections.size(); ++imva) {
904  const auto& mva = *(mvaCollections[imva]);
905  const auto& qual = *(qualityMaskCollections[imva]);
906  mvaValues.push_back(mva[i]);
907 
908  if(selectsLoose >= imva && trackSelected(qual[i], reco::TrackBase::loose))
909  selectsLoose = imva;
910  if(selectsHP >= imva && trackSelected(qual[i], reco::TrackBase::highPurity))
911  selectsHP = imva;
912  }
913  }
914 
915  double dR=dR_trk[i];
916  histoProducerAlgo_->fill_generic_recoTrack_histos(w,*track, ttopo, bs.position(), thePVposition, theSimPVPosition, isSimMatched,isSigSimMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), nSimHits, sharedFraction, dR, mvaValues, selectsLoose, selectsHP);
917  mvaValues.clear();
918 
919  if(doSummaryPlots_) {
920  h_reco_coll[ww]->Fill(www);
921  if(isSimMatched) {
922  h_assoc2_coll[ww]->Fill(www);
923  if(numAssocRecoTracks>1) {
924  h_looper_coll[ww]->Fill(www);
925  }
926  if(!isSigSimMatched) {
927  h_pileup_coll[ww]->Fill(www);
928  }
929  }
930  }
931 
932  // dE/dx
933  if (dodEdxPlots_) histoProducerAlgo_->fill_dedx_recoTrack_histos(w,track, v_dEdx);
934 
935 
936  //Fill other histos
937  if (!isSimMatched) continue;
938 
939  histoProducerAlgo_->fill_simAssociated_recoTrack_histos(w,*track);
940 
941  TrackingParticleRef tpr = tpFound->val.begin()->first;
942 
943  /* TO BE FIXED LATER
944  if (associators[ww]=="trackAssociatorByChi2"){
945  //association chi2
946  double assocChi2 = -tp.begin()->second;//in association map is stored -chi2
947  h_assochi2[www]->Fill(assocChi2);
948  h_assochi2_prob[www]->Fill(TMath::Prob((assocChi2)*5,5));
949  }
950  else if (associators[ww]=="quickTrackAssociatorByHits"){
951  double fraction = tp.begin()->second;
952  h_assocFraction[www]->Fill(fraction);
953  h_assocSharedHit[www]->Fill(fraction*track->numberOfValidHits());
954  }
955  */
956 
957 
958  //Get tracking particle parameters at point of closest approach to the beamline
959  TrackingParticle::Vector momentumTP = parametersDefinerTP->momentum(event,setup,tpr);
960  TrackingParticle::Point vertexTP = parametersDefinerTP->vertex(event,setup,tpr);
961  int chargeTP = tpr->charge();
962 
963  histoProducerAlgo_->fill_ResoAndPull_recoTrack_histos(w,momentumTP,vertexTP,chargeTP,
964  *track,bs.position());
965 
966 
967  //TO BE FIXED
968  //std::vector<PSimHit> simhits=tpr.get()->trackPSimHit(DetId::Tracker);
969  //nrecHit_vs_nsimHit_rec2sim[w]->Fill(track->numberOfValidHits(), (int)(simhits.end()-simhits.begin() ));
970 
971  } // End of for(View<Track>::size_type i=0; i<trackCollection.size(); ++i){
972  mvaCollections.clear();
973  qualityMaskCollections.clear();
974 
975  histoProducerAlgo_->fill_trackBased_histos(w,at,rT,st);
976  // Fill seed-specific histograms
977  if(doSeedPlots_) {
978  histoProducerAlgo_->fill_seed_histos(www, seed_fit_failed, trackCollection.size());
979  }
980 
981 
982  LogTrace("TrackValidator") << "Total Simulated: " << st << "\n"
983  << "Total Associated (simToReco): " << ats << "\n"
984  << "Total Reconstructed: " << rT << "\n"
985  << "Total Associated (recoToSim): " << at << "\n"
986  << "Total Fakes: " << rT-at << "\n";
987  } // End of for (unsigned int www=0;www<label.size();www++){
988  } //END of for (unsigned int ww=0;ww<associators.size();ww++){
989 
990 }
#define LogDebug(id)
T getParameter(std::string const &) const
unsigned int size_type
Definition: View.h:85
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx1Tag
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< SimHitTPAssociationProducer::SimHitTPAssociationList > _simHitTpMapTag
int event() const
get the contents of the subdetector field (should be protected?)
std::vector< MonitorElement * > h_reco_coll
bool trackFromSeedFitFailed(const reco::Track &track)
std::vector< edm::EDGetTokenT< reco::SimToRecoCollection > > associatormapStRs
const double w
Definition: UKUtility.cc:23
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > label_pileupinfo
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
CosmicTrackingParticleSelector cosmictpSelector
Vector momentum() const
spatial momentum vector
const_iterator end() const
last iterator over the map (read only)
edm::EDGetTokenT< TrackingParticleCollection > label_tp_effic
std::vector< MonitorElement * > h_simul_coll
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void cd(void)
Definition: DQMStore.cc:269
edm::EDGetTokenT< TrackingParticleRefVector > label_tp_fake_refvector
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< std::vector< std::tuple< edm::EDGetTokenT< MVACollection >, edm::EDGetTokenT< QualityMaskCollection > > > > mvaQualityCollectionTokens_
edm::EDGetTokenT< TrackingParticleRefVector > label_tp_effic_refvector
void analyze(const edm::Event &, const edm::EventSetup &) override
Method called once per event.
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNStripStereoLayersToken_
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNLayersToken_
size_type size() const
edm::EDGetTokenT< TrackingVertexCollection > label_tv
T_AssociationMap associationMapFilterValues(const T_AssociationMap &map, const T_RefVector &valueRefs)
TrackingParticleSelector dRtpSelector
TrackingParticleSelector dRtpSelectorNoPtCut
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associatorTokens
bool empty() const
Is the RefVector empty.
Definition: RefVector.h:104
const bool doPlotsOnlyForTruePV_
edm::EDGetTokenT< reco::BeamSpot > bsSrc
RefToBase< value_type > refAt(size_type i) const
math::XYZPointD Point
point in the space
std::vector< MonitorElement * > h_looper_coll
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNPixelLayersToken_
math::XYZTLorentzVectorD LorentzVector
std::vector< MonitorElement * > h_pileup_coll
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
std::vector< MonitorElement * > h_assoc_coll
std::vector< edm::InputTag > label
ProductID id() const
Accessor for product ID.
Definition: RefVector.h:122
std::vector< edm::EDGetTokenT< reco::RecoToSimCollection > > associatormapRtSs
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
T sqrt(T t)
Definition: SSEVec.h:18
int bunchCrossing() const
get the detector field from this detid
TrackingParticleSelector tpSelector
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def move
Definition: eostools.py:510
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< edm::View< reco::Track > > labelTokenForDrCalculation
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
void initEvent(edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssocToSet) const
T min(T a, T b)
Definition: MathUtil.h:58
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
char const * module
Definition: ProductLabels.h:5
MultiTrackValidator(const edm::ParameterSet &pset)
Constructor.
#define LogTrace(id)
ObjectSelector< CosmicTrackingParticleSelector > CosmicTrackingParticleSelector
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
tuple trackCollection
std::vector< MonitorElement * > h_assoc_coll_allPt
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
T const * product() const
Definition: Handle.h:81
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Method called to book the DQM histograms.
edm::EDGetTokenT< reco::VertexToTrackingVertexAssociator > vertexAssociatorToken_
std::vector< TrackingVertex > TrackingVertexCollection
const T & get() const
Definition: EventSetup.h:56
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
std::string const & label() const
Definition: InputTag.h:36
const bool doPVAssociationPlots_
EncodedEventId eventId() const
Signal source, crossing number.
Point vertex() const
Parent vertex position.
edm::EDGetTokenT< edm::View< reco::Vertex > > recoVertexToken_
std::string const & process() const
Definition: InputTag.h:40
const EncodedEventId & eventId() const
const bool calculateDrSingleCollection_
std::vector< MonitorElement * > h_simul_coll_allPt
void push_back(const RefToBase< T > &)
std::vector< MonitorElement * > h_assoc2_coll
Monte Carlo truth information used for tracking validation.
bool isUninitialized() const
Definition: EDGetToken.h:73
int numberOfTrackerHits() const
The number of hits in the tracker. Hits on overlaps in the same layer count separately.
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > labelToken
math::XYZVectorD Vector
point in the space
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
std::string const & instance() const
Definition: InputTag.h:37
tuple size
Write out results.
edm::Ref< TrackingParticleCollection > TrackingParticleRef
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx2Tag
Definition: Run.h:42
virtual ~MultiTrackValidator()
Destructor.
const LorentzVector & position() const
const bool parametersDefinerIsCosmic_