CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes | Private Attributes
MultiTrackValidator Class Reference

#include <MultiTrackValidator.h>

Inheritance diagram for MultiTrackValidator:
DQMEDAnalyzer MultiTrackValidatorBase edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase MultiTrackValidatorGenPs

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 Method called once per event. More...
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 Method called to book the DQM histograms. More...
 
 MultiTrackValidator (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~MultiTrackValidator ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Attributes

const bool calculateDrSingleCollection_
 
const bool dodEdxPlots_
 
const bool doPlotsOnlyForTruePV_
 
const bool doPVAssociationPlots_
 
const bool doRecoTrackPlots_
 
const bool doSimPlots_
 
const bool doSimTrackPlots_
 
const bool doSummaryPlots_
 
std::unique_ptr
< MTVHistoProducerAlgoForTracker
histoProducerAlgo_
 
const bool parametersDefinerIsCosmic_
 
bool UseAssociators
 
- Protected Attributes inherited from MultiTrackValidatorBase
std::vector< edm::InputTagassociators
 
edm::EDGetTokenT< reco::BeamSpotbsSrc
 
bool ignoremissingtkcollection_
 
std::vector< edm::InputTaglabel
 
edm::EDGetTokenT< std::vector
< PileupSummaryInfo > > 
label_pileupinfo
 
edm::EDGetTokenT
< TrackingParticleCollection
label_tp_effic
 
edm::EDGetTokenT
< TrackingParticleCollection
label_tp_fake
 
edm::EDGetTokenT
< TrackingVertexCollection
label_tv
 
std::vector< edm::EDGetTokenT
< edm::View< reco::Track > > > 
labelToken
 
std::vector< edm::EDGetTokenT
< edm::View< TrajectorySeed > > > 
labelTokenSeed
 
edm::EDGetTokenT
< edm::ValueMap
< reco::DeDxData > > 
m_dEdx1Tag
 
edm::EDGetTokenT
< edm::ValueMap
< reco::DeDxData > > 
m_dEdx2Tag
 
std::string parametersDefiner
 
std::vector< edm::EDGetTokenT
< std::vector< PSimHit > > > 
simHitTokens_
 

Private Attributes

edm::EDGetTokenT
< SimHitTPAssociationProducer::SimHitTPAssociationList
_simHitTpMapTag
 
std::vector< edm::EDGetTokenT
< reco::RecoToSimCollection > > 
associatormapRtSs
 
std::vector< edm::EDGetTokenT
< reco::SimToRecoCollection > > 
associatormapStRs
 
std::vector< edm::EDGetTokenT
< reco::TrackToTrackingParticleAssociator > > 
associatorTokens
 
CosmicTrackingParticleSelector cosmictpSelector
 
std::string dirName_
 
TrackingParticleSelector dRtpSelector
 
TrackingParticleSelector dRtpSelectorNoPtCut
 
std::vector< MonitorElement * > h_assoc2_coll
 
std::vector< MonitorElement * > h_assoc_coll
 
std::vector< MonitorElement * > h_assoc_coll_allPt
 
std::vector< MonitorElement * > h_looper_coll
 
std::vector< MonitorElement * > h_pileup_coll
 
std::vector< MonitorElement * > h_reco_coll
 
std::vector< MonitorElement * > h_simul_coll
 
std::vector< MonitorElement * > h_simul_coll_allPt
 
edm::EDGetTokenT< edm::View
< reco::Track > > 
labelTokenForDrCalculation
 
edm::EDGetTokenT< edm::View
< reco::Vertex > > 
recoVertexToken_
 
TrackingParticleSelector tpSelector
 
bool useGsf
 
edm::EDGetTokenT
< reco::VertexToTrackingVertexAssociator
vertexAssociatorToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Member Functions inherited from MultiTrackValidatorBase
 MultiTrackValidatorBase (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC, bool isSeed=false)
 Constructor. More...
 
virtual ~MultiTrackValidatorBase ()
 Destructor. More...
 

Detailed Description

Class that prodecs histrograms to validate Track Reconstruction performances

Author
cerati

Definition at line 15 of file MultiTrackValidator.h.

Constructor & Destructor Documentation

MultiTrackValidator::MultiTrackValidator ( const edm::ParameterSet pset)

Constructor.

Definition at line 44 of file MultiTrackValidator.cc.

References _simHitTpMapTag, associatormapRtSs, associatormapStRs, MultiTrackValidatorBase::associators, associatorTokens, calculateDrSingleCollection_, edm::EDConsumerBase::consumesCollector(), cosmictpSelector, dirName_, dodEdxPlots_, doPlotsOnlyForTruePV_, doPVAssociationPlots_, dRtpSelector, dRtpSelectorNoPtCut, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), histoProducerAlgo_, MultiTrackValidatorBase::label_tv, labelTokenForDrCalculation, MultiTrackValidatorBase::m_dEdx1Tag, MultiTrackValidatorBase::m_dEdx2Tag, recoVertexToken_, alcazmumu_cfi::src, AlCaHLTBitMon_QueryRunRegistry::string, tpSelector, UseAssociators, useGsf, and vertexAssociatorToken_.

44  :
46  parametersDefinerIsCosmic_(parametersDefiner == "CosmicParametersDefinerForTP"),
47  calculateDrSingleCollection_(pset.getUntrackedParameter<bool>("calculateDrSingleCollection")),
48  doPlotsOnlyForTruePV_(pset.getUntrackedParameter<bool>("doPlotsOnlyForTruePV")),
49  doSummaryPlots_(pset.getUntrackedParameter<bool>("doSummaryPlots")),
50  doSimPlots_(pset.getUntrackedParameter<bool>("doSimPlots")),
51  doSimTrackPlots_(pset.getUntrackedParameter<bool>("doSimTrackPlots")),
52  doRecoTrackPlots_(pset.getUntrackedParameter<bool>("doRecoTrackPlots")),
53  dodEdxPlots_(pset.getUntrackedParameter<bool>("dodEdxPlots")),
54  doPVAssociationPlots_(pset.getUntrackedParameter<bool>("doPVAssociationPlots"))
55 {
56  ParameterSet psetForHistoProducerAlgo = pset.getParameter<ParameterSet>("histoProducerAlgoBlock");
57  histoProducerAlgo_ = std::make_unique<MTVHistoProducerAlgoForTracker>(psetForHistoProducerAlgo, consumesCollector());
58 
59  dirName_ = pset.getParameter<std::string>("dirName");
60  UseAssociators = pset.getParameter< bool >("UseAssociators");
61 
62  if(dodEdxPlots_) {
63  m_dEdx1Tag = consumes<edm::ValueMap<reco::DeDxData> >(pset.getParameter< edm::InputTag >("dEdx1Tag"));
64  m_dEdx2Tag = consumes<edm::ValueMap<reco::DeDxData> >(pset.getParameter< edm::InputTag >("dEdx2Tag"));
65  }
66 
68  label_tv = consumes<TrackingVertexCollection>(pset.getParameter< edm::InputTag >("label_tv"));
69  recoVertexToken_ = consumes<edm::View<reco::Vertex> >(pset.getUntrackedParameter<edm::InputTag>("label_vertex"));
70  vertexAssociatorToken_ = consumes<reco::VertexToTrackingVertexAssociator>(pset.getUntrackedParameter<edm::InputTag>("vertexAssociator"));
71  }
72 
73  tpSelector = TrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
74  pset.getParameter<double>("minRapidityTP"),
75  pset.getParameter<double>("maxRapidityTP"),
76  pset.getParameter<double>("tipTP"),
77  pset.getParameter<double>("lipTP"),
78  pset.getParameter<int>("minHitTP"),
79  pset.getParameter<bool>("signalOnlyTP"),
80  pset.getParameter<bool>("intimeOnlyTP"),
81  pset.getParameter<bool>("chargedOnlyTP"),
82  pset.getParameter<bool>("stableOnlyTP"),
83  pset.getParameter<std::vector<int> >("pdgIdTP"));
84 
86  pset.getParameter<double>("minRapidityTP"),
87  pset.getParameter<double>("maxRapidityTP"),
88  pset.getParameter<double>("tipTP"),
89  pset.getParameter<double>("lipTP"),
90  pset.getParameter<int>("minHitTP"),
91  pset.getParameter<bool>("chargedOnlyTP"),
92  pset.getParameter<std::vector<int> >("pdgIdTP"));
93 
94 
95  ParameterSet psetVsEta = psetForHistoProducerAlgo.getParameter<ParameterSet>("TpSelectorForEfficiencyVsEta");
96  dRtpSelector = TrackingParticleSelector(psetVsEta.getParameter<double>("ptMin"),
97  psetVsEta.getParameter<double>("minRapidity"),
98  psetVsEta.getParameter<double>("maxRapidity"),
99  psetVsEta.getParameter<double>("tip"),
100  psetVsEta.getParameter<double>("lip"),
101  psetVsEta.getParameter<int>("minHit"),
102  psetVsEta.getParameter<bool>("signalOnly"),
103  psetVsEta.getParameter<bool>("intimeOnly"),
104  psetVsEta.getParameter<bool>("chargedOnly"),
105  psetVsEta.getParameter<bool>("stableOnly"),
106  psetVsEta.getParameter<std::vector<int> >("pdgId"));
107 
109  psetVsEta.getParameter<double>("minRapidity"),
110  psetVsEta.getParameter<double>("maxRapidity"),
111  psetVsEta.getParameter<double>("tip"),
112  psetVsEta.getParameter<double>("lip"),
113  psetVsEta.getParameter<int>("minHit"),
114  psetVsEta.getParameter<bool>("signalOnly"),
115  psetVsEta.getParameter<bool>("intimeOnly"),
116  psetVsEta.getParameter<bool>("chargedOnly"),
117  psetVsEta.getParameter<bool>("stableOnly"),
118  psetVsEta.getParameter<std::vector<int> >("pdgId"));
119 
120  useGsf = pset.getParameter<bool>("useGsf");
121 
122  _simHitTpMapTag = mayConsume<SimHitTPAssociationProducer::SimHitTPAssociationList>(pset.getParameter<edm::InputTag>("simHitTpMapTag"));
123 
125  labelTokenForDrCalculation = consumes<edm::View<reco::Track> >(pset.getParameter<edm::InputTag>("trackCollectionForDrCalculation"));
126  }
127 
128  if(UseAssociators) {
129  for (auto const& src: associators) {
130  associatorTokens.push_back(consumes<reco::TrackToTrackingParticleAssociator>(src));
131  }
132  } else {
133  for (auto const& src: associators) {
134  associatormapStRs.push_back(consumes<reco::SimToRecoCollection>(src));
135  associatormapRtSs.push_back(consumes<reco::RecoToSimCollection>(src));
136  }
137  }
138 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx1Tag
T getUntrackedParameter(std::string const &, T const &) const
std::vector< edm::InputTag > associators
edm::EDGetTokenT< SimHitTPAssociationProducer::SimHitTPAssociationList > _simHitTpMapTag
std::vector< edm::EDGetTokenT< reco::SimToRecoCollection > > associatormapStRs
CosmicTrackingParticleSelector cosmictpSelector
edm::EDGetTokenT< TrackingVertexCollection > label_tv
TrackingParticleSelector dRtpSelector
TrackingParticleSelector dRtpSelectorNoPtCut
std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associatorTokens
const bool doPlotsOnlyForTruePV_
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
std::vector< edm::EDGetTokenT< reco::RecoToSimCollection > > associatormapRtSs
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
TrackingParticleSelector tpSelector
MultiTrackValidatorBase(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC, bool isSeed=false)
Constructor.
edm::EDGetTokenT< edm::View< reco::Track > > labelTokenForDrCalculation
ObjectSelector< CosmicTrackingParticleSelector > CosmicTrackingParticleSelector
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
edm::EDGetTokenT< reco::VertexToTrackingVertexAssociator > vertexAssociatorToken_
const bool doPVAssociationPlots_
edm::EDGetTokenT< edm::View< reco::Vertex > > recoVertexToken_
const bool calculateDrSingleCollection_
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx2Tag
const bool parametersDefinerIsCosmic_
MultiTrackValidator::~MultiTrackValidator ( )
virtual

Destructor.

Definition at line 141 of file MultiTrackValidator.cc.

141 {}

Member Function Documentation

void MultiTrackValidator::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Method called once per event.

Implements edm::stream::EDAnalyzerBase.

Reimplemented in MultiTrackValidatorGenPs.

Definition at line 229 of file MultiTrackValidator.cc.

References _simHitTpMapTag, associationMapFilterValues(), associatormapRtSs, associatormapStRs, MultiTrackValidatorBase::associators, associatorTokens, MultiTrackValidatorBase::bsSrc, EncodedEventId::bunchCrossing(), TrackingParticleNumberOfLayers::calculate(), calculateDrSingleCollection_, reco::TrackBase::charge(), funct::cos(), cosmictpSelector, reco::deltaR2(), dodEdxPlots_, doPlotsOnlyForTruePV_, doPVAssociationPlots_, doRecoTrackPlots_, doSimPlots_, doSimTrackPlots_, doSummaryPlots_, PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, dRtpSelector, dRtpSelectorNoPtCut, edm::AssociationMap< Tag >::end(), eta, EncodedEventId::event(), TrackingParticle::eventId(), TrackingVertex::eventId(), edm::AssociationMap< Tag >::find(), plotBeamSpotDB::first, edm::EventSetup::get(), edm::Event::getByToken(), h_assoc2_coll, h_assoc_coll, h_assoc_coll_allPt, h_looper_coll, h_pileup_coll, h_reco_coll, h_simul_coll, h_simul_coll_allPt, histoProducerAlgo_, i, MultiTrackValidatorBase::ignoremissingtkcollection_, CosmicTrackingParticleSelector::initEvent(), j, MultiTrackValidatorBase::label, MultiTrackValidatorBase::label_pileupinfo, MultiTrackValidatorBase::label_tp_effic, MultiTrackValidatorBase::label_tp_fake, MultiTrackValidatorBase::label_tv, MultiTrackValidatorBase::labelToken, labelTokenForDrCalculation, LogDebug, LogTrace, MultiTrackValidatorBase::m_dEdx1Tag, MultiTrackValidatorBase::m_dEdx2Tag, bookConverter::max, min(), TrackingParticle::momentum(), TrackingParticle::numberOfTrackerHits(), AlCaHLTBitMon_ParallelJobs::p, MultiTrackValidatorBase::parametersDefiner, parametersDefinerIsCosmic_, phi, edm::Handle< T >::product(), reco::TrackBase::pt(), dt_dqm_sourceclient_common_cff::reco, recoVertexToken_, MultiTrackValidatorBase::simHitTokens_, funct::sin(), edm::View< T >::size(), findQualityFiles::size, mathSSE::sqrt(), tpSelector, HLT_25ns14e33_v3_cff::trackCollection, UseAssociators, TrackingParticle::vertex(), vertexAssociatorToken_, and w.

229  {
230  using namespace reco;
231 
232  LogDebug("TrackValidator") << "\n====================================================" << "\n"
233  << "Analyzing new event" << "\n"
234  << "====================================================\n" << "\n";
235 
236 
237  edm::ESHandle<ParametersDefinerForTP> parametersDefinerTPHandle;
238  setup.get<TrackAssociatorRecord>().get(parametersDefiner,parametersDefinerTPHandle);
239  //Since we modify the object, we must clone it
240  auto parametersDefinerTP = parametersDefinerTPHandle->clone();
241 
242  edm::Handle<TrackingParticleCollection> TPCollectionHeff ;
243  event.getByToken(label_tp_effic,TPCollectionHeff);
244  TrackingParticleCollection const & tPCeff = *(TPCollectionHeff.product());
245 
246  edm::Handle<TrackingParticleCollection> TPCollectionHfake ;
247  event.getByToken(label_tp_fake,TPCollectionHfake);
248 
249 
252  //warning: make sure the TP collection used in the map is the same used in the MTV!
253  event.getByToken(_simHitTpMapTag,simHitsTPAssoc);
254  parametersDefinerTP->initEvent(simHitsTPAssoc);
255  cosmictpSelector.initEvent(simHitsTPAssoc);
256  }
257 
258  const reco::Vertex::Point *thePVposition = nullptr;
259  const TrackingVertex::LorentzVector *theSimPVPosition = nullptr;
262  event.getByToken(label_tv, htv);
263 
265  event.getByToken(recoVertexToken_, hvertex);
266 
268  event.getByToken(vertexAssociatorToken_, hvassociator);
269 
270  auto v_r2s = hvassociator->associateRecoToSim(hvertex, htv);
271  auto pvPtr = hvertex->refAt(0);
272  if(!(pvPtr->isFake() || pvPtr->ndof() < 0)) { // skip junk vertices
273  auto pvFound = v_r2s.find(pvPtr);
274  if(pvFound != v_r2s.end()) {
275  int simPVindex = -1;
276  int i=0;
277  for(const auto& vertexRefQuality: pvFound->val) {
278  const TrackingVertex& tv = *(vertexRefQuality.first);
279  if(tv.eventId().event() == 0 && tv.eventId().bunchCrossing() == 0) {
280  simPVindex = i;
281  }
282  ++i;
283  }
284  if(simPVindex >= 0) {
286  thePVposition = &(pvPtr->position());
287  theSimPVPosition = &(pvFound->val[simPVindex].first->position());
288  }
289  }
290  else if(doPlotsOnlyForTruePV_)
291  return;
292  }
293  else if(doPlotsOnlyForTruePV_)
294  return;
295  }
296  else if(doPlotsOnlyForTruePV_)
297  return;
298  }
299 
300  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
301  event.getByToken(bsSrc,recoBeamSpotHandle);
302  reco::BeamSpot const & bs = *recoBeamSpotHandle;
303 
305  event.getByToken(label_pileupinfo,puinfoH);
306  PileupSummaryInfo puinfo;
307 
308  for (unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
309  if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
310  puinfo=(*puinfoH)[puinfo_ite];
311  break;
312  }
313  }
314 
315  /*
316  edm::Handle<TrackingVertexCollection> tvH;
317  event.getByToken(label_tv,tvH);
318  TrackingVertexCollection const & tv = *tvH;
319  */
320 
321  // Calculate the number of 3D layers for TPs
322  //
323  // I would have preferred to produce the ValueMap to Event and read
324  // it from there, but there would have been quite some number of
325  // knock-on effects, and again the fact that we take two TP
326  // collections do not support Ref<TP>'s would have complicated that.
327  //
328  // In principle we could use the SimHitTPAssociationList read above
329  // for parametersDefinerIsCosmic_, but since we don't currently
330  // support Ref<TP>s, we can't in general use it since eff/fake TP
331  // collections can, in general, be different.
332  TrackingParticleNumberOfLayers tpNumberOfLayersAlgo(event, simHitTokens_);
333  auto nlayers_tPCeff_ptrs = tpNumberOfLayersAlgo.calculate(TPCollectionHeff, setup);
334  const auto& nLayers_tPCeff = *(std::get<TrackingParticleNumberOfLayers::nTrackerLayers>(nlayers_tPCeff_ptrs));
335  const auto& nPixelLayers_tPCeff = *(std::get<TrackingParticleNumberOfLayers::nPixelLayers>(nlayers_tPCeff_ptrs));
336  const auto& nStripMonoAndStereoLayers_tPCeff = *(std::get<TrackingParticleNumberOfLayers::nStripMonoAndStereoLayers>(nlayers_tPCeff_ptrs));
337 
338  // Precalculate TP selection (for efficiency), and momentum and vertex wrt PCA
339  //
340  // TODO: ParametersDefinerForTP ESProduct needs to be changed to
341  // EDProduct because of consumes.
342  //
343  // In principle, we could just precalculate the momentum and vertex
344  // wrt PCA for all TPs for once and put that to the event. To avoid
345  // repetitive calculations those should be calculated only once for
346  // each TP. That would imply that we should access TPs via Refs
347  // (i.e. View) in here, since, in general, the eff and fake TP
348  // collections can be different (and at least HI seems to use that
349  // feature). This would further imply that the
350  // RecoToSimCollection/SimToRecoCollection should be changed to use
351  // View<TP> instead of vector<TP>, and migrate everything.
352  //
353  // Or we could take only one input TP collection, and do another
354  // TP-selection to obtain the "fake" collection like we already do
355  // for "efficiency" TPs.
356  std::vector<size_t> selected_tPCeff;
357  std::vector<std::tuple<TrackingParticle::Vector, TrackingParticle::Point>> momVert_tPCeff;
358  selected_tPCeff.reserve(tPCeff.size());
359  momVert_tPCeff.reserve(tPCeff.size());
360  int nIntimeTPs = 0;
362  for(size_t j=0; j<tPCeff.size(); ++j) {
363  TrackingParticleRef tpr(TPCollectionHeff, j);
364 
365  TrackingParticle::Vector momentum = parametersDefinerTP->momentum(event,setup,tpr);
366  TrackingParticle::Point vertex = parametersDefinerTP->vertex(event,setup,tpr);
367  if(doSimPlots_) {
368  histoProducerAlgo_->fill_generic_simTrack_histos(momentum, vertex, tpr->eventId().bunchCrossing());
369  }
370  if(tpr->eventId().bunchCrossing() == 0)
371  ++nIntimeTPs;
372 
373  if(cosmictpSelector(tpr,&bs,event,setup)) {
374  selected_tPCeff.push_back(j);
375  momVert_tPCeff.emplace_back(momentum, vertex);
376  }
377  }
378  }
379  else {
380  size_t j=0;
381  for(auto const& tp: tPCeff) {
382 
383  // TODO: do we want to fill these from all TPs that include IT
384  // and OOT (as below), or limit to IT+OOT TPs passing tpSelector
385  // (as it was before)? The latter would require another instance
386  // of tpSelector with intimeOnly=False.
387  if(doSimPlots_) {
388  histoProducerAlgo_->fill_generic_simTrack_histos(tp.momentum(), tp.vertex(), tp.eventId().bunchCrossing());
389  }
390  if(tp.eventId().bunchCrossing() == 0)
391  ++nIntimeTPs;
392 
393  if(tpSelector(tp)) {
394  selected_tPCeff.push_back(j);
395  TrackingParticleRef tpr(TPCollectionHeff, j);
396  TrackingParticle::Vector momentum = parametersDefinerTP->momentum(event,setup,tpr);
397  TrackingParticle::Point vertex = parametersDefinerTP->vertex(event,setup,tpr);
398  momVert_tPCeff.emplace_back(momentum, vertex);
399  }
400  ++j;
401  }
402  }
403  if(doSimPlots_) {
404  histoProducerAlgo_->fill_simTrackBased_histos(nIntimeTPs);
405  }
406 
407  //calculate dR for TPs
408  float dR_tPCeff[tPCeff.size()];
409  {
410  float etaL[tPCeff.size()], phiL[tPCeff.size()];
411  for(size_t iTP: selected_tPCeff) {
412  //calculare dR wrt inclusive collection (also with PU, low pT, displaced)
413  auto const& tp2 = tPCeff[iTP];
414  auto && p = tp2.momentum();
415  etaL[iTP] = etaFromXYZ(p.x(),p.y(),p.z());
416  phiL[iTP] = atan2f(p.y(),p.x());
417  }
418  auto i=0U;
419  for ( auto const & tp : tPCeff) {
421  if(dRtpSelector(tp)) {//only for those needed for efficiency!
422  auto && p = tp.momentum();
423  float eta = etaFromXYZ(p.x(),p.y(),p.z());
424  float phi = atan2f(p.y(),p.x());
425  for(size_t iTP: selected_tPCeff) {
426  //calculare dR wrt inclusive collection (also with PU, low pT, displaced)
427  if (i==iTP) {continue;}
428  auto dR_tmp = reco::deltaR2(eta, phi, etaL[iTP], phiL[iTP]);
429  if (dR_tmp<dR) dR=dR_tmp;
430  } // ttp2 (iTP)
431  }
432  dR_tPCeff[i++] = std::sqrt(dR);
433  } // tp
434  }
435 
436  edm::Handle<View<Track> > trackCollectionForDrCalculation;
438  event.getByToken(labelTokenForDrCalculation, trackCollectionForDrCalculation);
439  }
440 
441  // dE/dx
442  // at some point this could be generalized, with a vector of tags and a corresponding vector of Handles
443  // I'm writing the interface such to take vectors of ValueMaps
444  std::vector<const edm::ValueMap<reco::DeDxData> *> v_dEdx;
445  if(dodEdxPlots_) {
448  event.getByToken(m_dEdx1Tag, dEdx1Handle);
449  event.getByToken(m_dEdx2Tag, dEdx2Handle);
450  v_dEdx.push_back(dEdx1Handle.product());
451  v_dEdx.push_back(dEdx2Handle.product());
452  }
453 
454  int w=0; //counter counting the number of sets of histograms
455  for (unsigned int ww=0;ww<associators.size();ww++){
456  for (unsigned int www=0;www<label.size();www++, w++){ // need to increment w here, since there are many continues in the loop body
457  //
458  //get collections from the event
459  //
461  if(!event.getByToken(labelToken[www], trackCollection)&&ignoremissingtkcollection_)continue;
462 
463  reco::RecoToSimCollection const * recSimCollP=nullptr;
464  reco::SimToRecoCollection const * simRecCollP=nullptr;
465  reco::RecoToSimCollection recSimCollL;
466  reco::SimToRecoCollection simRecCollL;
467 
468  //associate tracks
469  LogTrace("TrackValidator") << "Analyzing "
470  << label[www] << " with "
471  << associators[ww] <<"\n";
472  if(UseAssociators){
474  event.getByToken(associatorTokens[ww], theAssociator);
475 
476  LogTrace("TrackValidator") << "Calling associateRecoToSim method" << "\n";
477  recSimCollL = std::move(theAssociator->associateRecoToSim(trackCollection,
478  TPCollectionHfake));
479  recSimCollP = &recSimCollL;
480  LogTrace("TrackValidator") << "Calling associateSimToReco method" << "\n";
481  simRecCollL = std::move(theAssociator->associateSimToReco(trackCollection,
482  TPCollectionHeff));
483  simRecCollP = &simRecCollL;
484  }
485  else{
486  Handle<reco::SimToRecoCollection > simtorecoCollectionH;
487  event.getByToken(associatormapStRs[ww], simtorecoCollectionH);
488  simRecCollP = simtorecoCollectionH.product();
489 
490  // We need to filter the associations of the current track
491  // collection only from SimToReco collection, otherwise the
492  // SimToReco histograms get false entries
493  simRecCollL = associationMapFilterValues(*simRecCollP, *trackCollection);
494  simRecCollP = &simRecCollL;
495 
496  Handle<reco::RecoToSimCollection > recotosimCollectionH;
497  event.getByToken(associatormapRtSs[ww],recotosimCollectionH);
498  recSimCollP = recotosimCollectionH.product();
499 
500  // In general, we should filter also the RecoToSim collection.
501  // But, that would require changing the input type of TPs to
502  // View<TrackingParticle>, and either replace current
503  // associator interfaces with (View<Track>, View<TP>) or
504  // adding the View,View interface (same goes for
505  // RefToBaseVector,RefToBaseVector). Since there is currently
506  // no compelling-enough use-case, we do not filter the
507  // RecoToSim collection here. If an association using a subset
508  // of the Sim collection is needed, user has to produce such
509  // an association explicitly.
510  }
511 
512  reco::RecoToSimCollection const & recSimColl = *recSimCollP;
513  reco::SimToRecoCollection const & simRecColl = *simRecCollP;
514 
515 
516 
517  // ########################################################
518  // fill simulation histograms (LOOP OVER TRACKINGPARTICLES)
519  // ########################################################
520 
521  //compute number of tracks per eta interval
522  //
523  LogTrace("TrackValidator") << "\n# of TrackingParticles: " << tPCeff.size() << "\n";
524  int ats(0); //This counter counts the number of simTracks that are "associated" to recoTracks
525  int st(0); //This counter counts the number of simulated tracks passing the MTV selection (i.e. tpSelector(tp) )
526  unsigned sts(0); //This counter counts the number of simTracks surviving the bunchcrossing cut
527  unsigned asts(0); //This counter counts the number of simTracks that are "associated" to recoTracks surviving the bunchcrossing cut
528 
529  //loop over already-selected TPs for tracking efficiency
530  for(size_t i=0; i<selected_tPCeff.size(); ++i) {
531  size_t iTP = selected_tPCeff[i];
532  TrackingParticleRef tpr(TPCollectionHeff, iTP);
533  const TrackingParticle& tp = tPCeff[iTP];
534 
535  auto const& momVert = momVert_tPCeff[i];
536  TrackingParticle::Vector momentumTP;
537  TrackingParticle::Point vertexTP;
538 
539  double dxySim(0);
540  double dzSim(0);
541  double dxyPVSim = 0;
542  double dzPVSim = 0;
543  double dR=dR_tPCeff[iTP];
544 
545  //---------- THIS PART HAS TO BE CLEANED UP. THE PARAMETER DEFINER WAS NOT MEANT TO BE USED IN THIS WAY ----------
546  //If the TrackingParticle is collison like, get the momentum and vertex at production state
548  {
549  momentumTP = tp.momentum();
550  vertexTP = tp.vertex();
551  //Calcualte the impact parameters w.r.t. PCA
552  const TrackingParticle::Vector& momentum = std::get<TrackingParticle::Vector>(momVert);
553  const TrackingParticle::Point& vertex = std::get<TrackingParticle::Point>(momVert);
554  dxySim = (-vertex.x()*sin(momentum.phi())+vertex.y()*cos(momentum.phi()));
555  dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/sqrt(momentum.perp2())
556  * momentum.z()/sqrt(momentum.perp2());
557 
558  if(theSimPVPosition) {
559  // As in TrackBase::dxy(Point) and dz(Point)
560  dxyPVSim = -(vertex.x()-theSimPVPosition->x())*sin(momentum.phi()) + (vertex.y()-theSimPVPosition->y())*cos(momentum.phi());
561  dzPVSim = vertex.z()-theSimPVPosition->z() - ( (vertex.x()-theSimPVPosition->x()) + (vertex.y()-theSimPVPosition->y()) )/sqrt(momentum.perp2()) * momentum.z()/sqrt(momentum.perp2());
562  }
563  }
564  //If the TrackingParticle is comics, get the momentum and vertex at PCA
565  else
566  {
567  momentumTP = std::get<TrackingParticle::Vector>(momVert);
568  vertexTP = std::get<TrackingParticle::Point>(momVert);
569  dxySim = (-vertexTP.x()*sin(momentumTP.phi())+vertexTP.y()*cos(momentumTP.phi()));
570  dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/sqrt(momentumTP.perp2())
571  * momentumTP.z()/sqrt(momentumTP.perp2());
572 
573  // Do dxy and dz vs. PV make any sense for cosmics? I guess not
574  }
575  //---------- THE PART ABOVE HAS TO BE CLEANED UP. THE PARAMETER DEFINER WAS NOT MEANT TO BE USED IN THIS WAY ----------
576 
577  //This counter counts the number of simulated tracks passing the MTV selection (i.e. tpSelector(tp) ), but only for in-time TPs
578  if(tp.eventId().bunchCrossing() == 0) {
579  st++;
580  }
581 
582  // in the coming lines, histos are filled using as input
583  // - momentumTP
584  // - vertexTP
585  // - dxySim
586  // - dzSim
587  if(!doSimTrackPlots_)
588  continue;
589 
590  // ##############################################
591  // fill RecoAssociated SimTracks' histograms
592  // ##############################################
593  const reco::Track* matchedTrackPointer=0;
594  if(simRecColl.find(tpr) != simRecColl.end()){
595  auto const & rt = simRecColl[tpr];
596  if (rt.size()!=0) {
597  ats++; //This counter counts the number of simTracks that have a recoTrack associated
598  // isRecoMatched = true; // UNUSED
599  matchedTrackPointer = rt.begin()->first.get();
600  LogTrace("TrackValidator") << "TrackingParticle #" << st
601  << " with pt=" << sqrt(momentumTP.perp2())
602  << " associated with quality:" << rt.begin()->second <<"\n";
603  }
604  }else{
605  LogTrace("TrackValidator")
606  << "TrackingParticle #" << st
607  << " with pt,eta,phi: "
608  << sqrt(momentumTP.perp2()) << " , "
609  << momentumTP.eta() << " , "
610  << momentumTP.phi() << " , "
611  << " NOT associated to any reco::Track" << "\n";
612  }
613 
614 
615 
616 
617  int nSimHits = tp.numberOfTrackerHits();
618  int nSimLayers = nLayers_tPCeff[tpr];
619  int nSimPixelLayers = nPixelLayers_tPCeff[tpr];
620  int nSimStripMonoAndStereoLayers = nStripMonoAndStereoLayers_tPCeff[tpr];
621  histoProducerAlgo_->fill_recoAssociated_simTrack_histos(w,tp,momentumTP,vertexTP,dxySim,dzSim,dxyPVSim,dzPVSim,nSimHits,nSimLayers,nSimPixelLayers,nSimStripMonoAndStereoLayers,matchedTrackPointer,puinfo.getPU_NumInteractions(), dR, thePVposition);
622  sts++;
623  if(matchedTrackPointer)
624  asts++;
625  if(doSummaryPlots_) {
626  if(dRtpSelectorNoPtCut(tp)) {
627  h_simul_coll_allPt[ww]->Fill(www);
628  if (matchedTrackPointer) {
629  h_assoc_coll_allPt[ww]->Fill(www);
630  }
631 
632  if(dRtpSelector(tp)) {
633  h_simul_coll[ww]->Fill(www);
634  if (matchedTrackPointer) {
635  h_assoc_coll[ww]->Fill(www);
636  }
637  }
638  }
639  }
640 
641 
642 
643 
644  } // End for (TrackingParticleCollection::size_type i=0; i<tPCeff.size(); i++){
645 
646  // ##############################################
647  // fill recoTracks histograms (LOOP OVER TRACKS)
648  // ##############################################
649  if(!doRecoTrackPlots_)
650  continue;
651  LogTrace("TrackValidator") << "\n# of reco::Tracks with "
652  << label[www].process()<<":"
653  << label[www].label()<<":"
654  << label[www].instance()
655  << ": " << trackCollection->size() << "\n";
656 
657  int sat(0); //This counter counts the number of recoTracks that are associated to SimTracks from Signal only
658  int at(0); //This counter counts the number of recoTracks that are associated to SimTracks
659  int rT(0); //This counter counts the number of recoTracks in general
660 
661  //calculate dR for tracks
662  const edm::View<Track> *trackCollectionDr = trackCollection.product();
664  trackCollectionDr = trackCollectionForDrCalculation.product();
665  }
666  float dR_trk[trackCollection->size()];
667  int i=0;
668  float etaL[trackCollectionDr->size()];
669  float phiL[trackCollectionDr->size()];
670  for (auto const & track2 : *trackCollectionDr) {
671  auto && p = track2.momentum();
672  etaL[i] = etaFromXYZ(p.x(),p.y(),p.z());
673  phiL[i] = atan2f(p.y(),p.x());
674  ++i;
675  }
676  for(View<Track>::size_type i=0; i<trackCollection->size(); ++i){
677  auto const & track = (*trackCollection)[i];
679  auto && p = track.momentum();
680  float eta = etaFromXYZ(p.x(),p.y(),p.z());
681  float phi = atan2f(p.y(),p.x());
682  for(View<Track>::size_type j=0; j<trackCollectionDr->size(); ++j){
683  auto dR_tmp = reco::deltaR2(eta, phi, etaL[j], phiL[j]);
684  if ( (dR_tmp<dR) & (dR_tmp>std::numeric_limits<float>::min())) dR=dR_tmp;
685  }
686  dR_trk[i] = std::sqrt(dR);
687  }
688 
689  for(View<Track>::size_type i=0; i<trackCollection->size(); ++i){
690 
691  RefToBase<Track> track(trackCollection, i);
692  rT++;
693 
694  bool isSigSimMatched(false);
695  bool isSimMatched(false);
696  bool isChargeMatched(true);
697  int numAssocRecoTracks = 0;
698  int nSimHits = 0;
699  double sharedFraction = 0.;
700 
701  auto tpFound = recSimColl.find(track);
702  isSimMatched = tpFound != recSimColl.end();
703  if (isSimMatched) {
704  const auto& tp = tpFound->val;
705  nSimHits = tp[0].first->numberOfTrackerHits();
706  sharedFraction = tp[0].second;
707  if (tp[0].first->charge() != track->charge()) isChargeMatched = false;
708  if(simRecColl.find(tp[0].first) != simRecColl.end()) numAssocRecoTracks = simRecColl[tp[0].first].size();
709  at++;
710  for (unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
711  TrackingParticle trackpart = *(tp[tp_ite].first);
712  if ((trackpart.eventId().event() == 0) && (trackpart.eventId().bunchCrossing() == 0)){
713  isSigSimMatched = true;
714  sat++;
715  break;
716  }
717  }
718  LogTrace("TrackValidator") << "reco::Track #" << rT << " with pt=" << track->pt()
719  << " associated with quality:" << tp.begin()->second <<"\n";
720  } else {
721  LogTrace("TrackValidator") << "reco::Track #" << rT << " with pt=" << track->pt()
722  << " NOT associated to any TrackingParticle" << "\n";
723  }
724 
725  double dR=dR_trk[i];
726  histoProducerAlgo_->fill_generic_recoTrack_histos(w,*track,bs.position(), thePVposition, isSimMatched,isSigSimMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), nSimHits, sharedFraction, dR);
727  if(doSummaryPlots_) {
728  h_reco_coll[ww]->Fill(www);
729  if(isSimMatched) {
730  h_assoc2_coll[ww]->Fill(www);
731  if(numAssocRecoTracks>1) {
732  h_looper_coll[ww]->Fill(www);
733  }
734  if(!isSigSimMatched) {
735  h_pileup_coll[ww]->Fill(www);
736  }
737  }
738  }
739 
740  // dE/dx
741  if (dodEdxPlots_) histoProducerAlgo_->fill_dedx_recoTrack_histos(w,track, v_dEdx);
742 
743 
744  //Fill other histos
745  if (!isSimMatched) continue;
746 
747  histoProducerAlgo_->fill_simAssociated_recoTrack_histos(w,*track);
748 
749  TrackingParticleRef tpr = tpFound->val.begin()->first;
750 
751  /* TO BE FIXED LATER
752  if (associators[ww]=="trackAssociatorByChi2"){
753  //association chi2
754  double assocChi2 = -tp.begin()->second;//in association map is stored -chi2
755  h_assochi2[www]->Fill(assocChi2);
756  h_assochi2_prob[www]->Fill(TMath::Prob((assocChi2)*5,5));
757  }
758  else if (associators[ww]=="quickTrackAssociatorByHits"){
759  double fraction = tp.begin()->second;
760  h_assocFraction[www]->Fill(fraction);
761  h_assocSharedHit[www]->Fill(fraction*track->numberOfValidHits());
762  }
763  */
764 
765 
766  //Get tracking particle parameters at point of closest approach to the beamline
767  TrackingParticle::Vector momentumTP = parametersDefinerTP->momentum(event,setup,tpr);
768  TrackingParticle::Point vertexTP = parametersDefinerTP->vertex(event,setup,tpr);
769  int chargeTP = tpr->charge();
770 
771  histoProducerAlgo_->fill_ResoAndPull_recoTrack_histos(w,momentumTP,vertexTP,chargeTP,
772  *track,bs.position());
773 
774 
775  //TO BE FIXED
776  //std::vector<PSimHit> simhits=tpr.get()->trackPSimHit(DetId::Tracker);
777  //nrecHit_vs_nsimHit_rec2sim[w]->Fill(track->numberOfValidHits(), (int)(simhits.end()-simhits.begin() ));
778 
779  } // End of for(View<Track>::size_type i=0; i<trackCollection->size(); ++i){
780 
781  histoProducerAlgo_->fill_trackBased_histos(w,at,rT,st);
782 
783  LogTrace("TrackValidator") << "Total Simulated: " << st << "\n"
784  << "Total Associated (simToReco): " << ats << "\n"
785  << "Total Reconstructed: " << rT << "\n"
786  << "Total Associated (recoToSim): " << at << "\n"
787  << "Total Fakes: " << rT-at << "\n";
788  } // End of for (unsigned int www=0;www<label.size();www++){
789  } //END of for (unsigned int ww=0;ww<associators.size();ww++){
790 
791 }
#define LogDebug(id)
unsigned int size_type
Definition: View.h:89
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx1Tag
int i
Definition: DBlmapReader.cc:9
std::vector< edm::InputTag > associators
edm::EDGetTokenT< SimHitTPAssociationProducer::SimHitTPAssociationList > _simHitTpMapTag
int event() const
get the contents of the subdetector field (should be protected?)
std::vector< MonitorElement * > h_reco_coll
std::vector< edm::EDGetTokenT< reco::SimToRecoCollection > > associatormapStRs
const double w
Definition: UKUtility.cc:23
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > label_pileupinfo
CosmicTrackingParticleSelector cosmictpSelector
std::vector< TrackingParticle > TrackingParticleCollection
Vector momentum() const
spatial momentum vector
const_iterator end() const
last iterator over the map (read only)
std::vector< MonitorElement * > h_simul_coll
edm::EDGetTokenT< TrackingParticleCollection > label_tp_effic
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
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
size_type size() const
edm::EDGetTokenT< TrackingVertexCollection > label_tv
T_AssociationMap associationMapFilterValues(const T_AssociationMap &map, const T_RefVector &valueRefs)
TrackingParticleSelector dRtpSelector
TrackingParticleSelector dRtpSelectorNoPtCut
std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associatorTokens
const bool doPlotsOnlyForTruePV_
edm::EDGetTokenT< reco::BeamSpot > bsSrc
math::XYZPointD Point
point in the space
std::vector< MonitorElement * > h_looper_coll
math::XYZTLorentzVectorD LorentzVector
std::vector< MonitorElement * > h_pileup_coll
std::vector< MonitorElement * > h_assoc_coll
std::vector< edm::InputTag > label
std::vector< edm::EDGetTokenT< reco::RecoToSimCollection > > associatormapRtSs
T sqrt(T t)
Definition: SSEVec.h:48
int bunchCrossing() const
get the detector field from this detid
TrackingParticleSelector tpSelector
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< edm::View< reco::Track > > labelTokenForDrCalculation
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
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
#define LogTrace(id)
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
std::vector< MonitorElement * > h_assoc_coll_allPt
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< reco::VertexToTrackingVertexAssociator > vertexAssociatorToken_
const T & get() const
Definition: EventSetup.h:56
const bool doPVAssociationPlots_
EncodedEventId eventId() const
Signal source, crossing number.
Point vertex() const
Parent vertex position.
edm::EDGetTokenT< edm::View< reco::Vertex > > recoVertexToken_
const EncodedEventId & eventId() const
const bool calculateDrSingleCollection_
std::vector< MonitorElement * > h_simul_coll_allPt
std::vector< MonitorElement * > h_assoc2_coll
Monte Carlo truth information used for tracking validation.
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
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
tuple size
Write out results.
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx2Tag
const bool parametersDefinerIsCosmic_
void MultiTrackValidator::bookHistograms ( DQMStore::IBooker ibook,
edm::Run const &  ,
edm::EventSetup const &  setup 
)
overridevirtual

Method called to book the DQM histograms.

Implements DQMEDAnalyzer.

Definition at line 144 of file MultiTrackValidator.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, MultiTrackValidatorBase::associators, DQMStore::IBooker::book1D(), DQMStore::IBooker::cd(), TrackerOfflineValidation_Dqm_cff::dirName, dirName_, dodEdxPlots_, doPVAssociationPlots_, doRecoTrackPlots_, doSimPlots_, doSimTrackPlots_, doSummaryPlots_, h, h_assoc2_coll, h_assoc_coll, h_assoc_coll_allPt, h_looper_coll, h_pileup_coll, h_reco_coll, h_simul_coll, h_simul_coll_allPt, histoProducerAlgo_, i, edm::InputTag::instance(), edm::InputTag::label(), MultiTrackValidatorBase::label, edm::InputTag::process(), python.rootplot.root2matplotlib::replace(), and DQMStore::IBooker::setCurrentFolder().

144  {
145 
146  const auto minColl = -0.5;
147  const auto maxColl = label.size()-0.5;
148  const auto nintColl = label.size();
149 
150  auto binLabels = [&](MonitorElement *me) {
151  TH1 *h = me->getTH1();
152  for(size_t i=0; i<label.size(); ++i) {
153  h->GetXaxis()->SetBinLabel(i+1, label[i].label().c_str());
154  }
155  return me;
156  };
157 
158  //Booking histograms concerning with simulated tracks
159  if(doSimPlots_) {
160  ibook.cd();
161  ibook.setCurrentFolder(dirName_ + "simulation");
162 
163  histoProducerAlgo_->bookSimHistos(ibook);
164 
165  ibook.cd();
166  ibook.setCurrentFolder(dirName_);
167  }
168 
169  for (unsigned int ww=0;ww<associators.size();ww++){
170  ibook.cd();
171  // FIXME: these need to be moved to a subdirectory whose name depends on the associator
172  ibook.setCurrentFolder(dirName_);
173 
174  if(doSummaryPlots_) {
175  if(doSimTrackPlots_) {
176  h_assoc_coll.push_back(binLabels( ibook.book1D("num_assoc(simToReco)_coll", "N of associated (simToReco) tracks vs track collection", nintColl, minColl, maxColl) ));
177  h_simul_coll.push_back(binLabels( ibook.book1D("num_simul_coll", "N of simulated tracks vs track collection", nintColl, minColl, maxColl) ));
178 
179  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) ));
180  h_simul_coll_allPt.push_back(binLabels( ibook.book1D("num_simul_coll_allPt", "N of simulated tracks vs track collection", nintColl, minColl, maxColl) ));
181 
182  }
183  if(doRecoTrackPlots_) {
184  h_reco_coll.push_back(binLabels( ibook.book1D("num_reco_coll", "N of reco track vs track collection", nintColl, minColl, maxColl) ));
185  h_assoc2_coll.push_back(binLabels( ibook.book1D("num_assoc(recoToSim)_coll", "N of associated (recoToSim) tracks vs track collection", nintColl, minColl, maxColl) ));
186  h_looper_coll.push_back(binLabels( ibook.book1D("num_duplicate_coll", "N of associated (recoToSim) looper tracks vs track collection", nintColl, minColl, maxColl) ));
187  h_pileup_coll.push_back(binLabels( ibook.book1D("num_pileup_coll", "N of associated (recoToSim) pileup tracks vs track collection", nintColl, minColl, maxColl) ));
188  }
189  }
190 
191  for (unsigned int www=0;www<label.size();www++){
192  ibook.cd();
193  InputTag algo = label[www];
194  string dirName=dirName_;
195  if (algo.process()!="")
196  dirName+=algo.process()+"_";
197  if(algo.label()!="")
198  dirName+=algo.label()+"_";
199  if(algo.instance()!="")
200  dirName+=algo.instance()+"_";
201  if (dirName.find("Tracks")<dirName.length()){
202  dirName.replace(dirName.find("Tracks"),6,"");
203  }
204  string assoc= associators[ww].label();
205  if (assoc.find("Track")<assoc.length()){
206  assoc.replace(assoc.find("Track"),5,"");
207  }
208  dirName+=assoc;
209  std::replace(dirName.begin(), dirName.end(), ':', '_');
210 
211  ibook.setCurrentFolder(dirName.c_str());
212 
213  if(doSimTrackPlots_) {
214  histoProducerAlgo_->bookSimTrackHistos(ibook);
215  if(doPVAssociationPlots_) histoProducerAlgo_->bookSimTrackPVAssociationHistos(ibook);
216  }
217 
218  //Booking histograms concerning with reconstructed tracks
219  if(doRecoTrackPlots_) {
220  histoProducerAlgo_->bookRecoHistos(ibook);
221  if (dodEdxPlots_) histoProducerAlgo_->bookRecodEdxHistos(ibook);
222  if (doPVAssociationPlots_) histoProducerAlgo_->bookRecoPVAssociationHistos(ibook);
223  }
224  }//end loop www
225  }// end loop ww
226 }
int i
Definition: DBlmapReader.cc:9
std::vector< edm::InputTag > associators
std::vector< MonitorElement * > h_reco_coll
std::vector< MonitorElement * > h_simul_coll
void cd(void)
Definition: DQMStore.cc:266
std::vector< MonitorElement * > h_looper_coll
std::vector< MonitorElement * > h_pileup_coll
std::vector< MonitorElement * > h_assoc_coll
std::vector< edm::InputTag > label
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
std::vector< MonitorElement * > h_assoc_coll_allPt
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
const bool doPVAssociationPlots_
std::string const & label() const
Definition: InputTag.h:43
std::string const & process() const
Definition: InputTag.h:47
std::vector< MonitorElement * > h_simul_coll_allPt
std::vector< MonitorElement * > h_assoc2_coll
std::string const & instance() const
Definition: InputTag.h:44

Member Data Documentation

edm::EDGetTokenT<SimHitTPAssociationProducer::SimHitTPAssociationList> MultiTrackValidator::_simHitTpMapTag
private

Definition at line 59 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

std::vector<edm::EDGetTokenT<reco::RecoToSimCollection> > MultiTrackValidator::associatormapRtSs
private

Definition at line 47 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

std::vector<edm::EDGetTokenT<reco::SimToRecoCollection> > MultiTrackValidator::associatormapStRs
private

Definition at line 46 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

std::vector<edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> > MultiTrackValidator::associatorTokens
private

Definition at line 45 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

const bool MultiTrackValidator::calculateDrSingleCollection_
protected

Definition at line 34 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

CosmicTrackingParticleSelector MultiTrackValidator::cosmictpSelector
private

Definition at line 55 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

std::string MultiTrackValidator::dirName_
private

Definition at line 49 of file MultiTrackValidator.h.

Referenced by bookHistograms(), and MultiTrackValidator().

const bool MultiTrackValidator::dodEdxPlots_
protected
const bool MultiTrackValidator::doPlotsOnlyForTruePV_
protected

Definition at line 35 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

const bool MultiTrackValidator::doPVAssociationPlots_
protected

Definition at line 41 of file MultiTrackValidator.h.

Referenced by analyze(), bookHistograms(), and MultiTrackValidator().

const bool MultiTrackValidator::doRecoTrackPlots_
protected
const bool MultiTrackValidator::doSimPlots_
protected
const bool MultiTrackValidator::doSimTrackPlots_
protected
const bool MultiTrackValidator::doSummaryPlots_
protected

Definition at line 36 of file MultiTrackValidator.h.

Referenced by analyze(), and bookHistograms().

TrackingParticleSelector MultiTrackValidator::dRtpSelector
private

Definition at line 56 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

TrackingParticleSelector MultiTrackValidator::dRtpSelectorNoPtCut
private

Definition at line 57 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

std::vector<MonitorElement *> MultiTrackValidator::h_assoc2_coll
private

Definition at line 64 of file MultiTrackValidator.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> MultiTrackValidator::h_assoc_coll
private

Definition at line 64 of file MultiTrackValidator.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> MultiTrackValidator::h_assoc_coll_allPt
private

Definition at line 65 of file MultiTrackValidator.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> MultiTrackValidator::h_looper_coll
private

Definition at line 64 of file MultiTrackValidator.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> MultiTrackValidator::h_pileup_coll
private

Definition at line 64 of file MultiTrackValidator.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> MultiTrackValidator::h_reco_coll
private

Definition at line 64 of file MultiTrackValidator.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> MultiTrackValidator::h_simul_coll
private

Definition at line 64 of file MultiTrackValidator.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> MultiTrackValidator::h_simul_coll_allPt
private

Definition at line 65 of file MultiTrackValidator.h.

Referenced by analyze(), and bookHistograms().

std::unique_ptr<MTVHistoProducerAlgoForTracker> MultiTrackValidator::histoProducerAlgo_
protected
edm::EDGetTokenT<edm::View<reco::Track> > MultiTrackValidator::labelTokenForDrCalculation
private

Definition at line 60 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

const bool MultiTrackValidator::parametersDefinerIsCosmic_
protected

Definition at line 33 of file MultiTrackValidator.h.

Referenced by MultiTrackValidatorGenPs::analyze(), and analyze().

edm::EDGetTokenT<edm::View<reco::Vertex> > MultiTrackValidator::recoVertexToken_
private

Definition at line 61 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

TrackingParticleSelector MultiTrackValidator::tpSelector
private

Definition at line 54 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

bool MultiTrackValidator::UseAssociators
protected
bool MultiTrackValidator::useGsf
private

Definition at line 51 of file MultiTrackValidator.h.

Referenced by MultiTrackValidator().

edm::EDGetTokenT<reco::VertexToTrackingVertexAssociator> MultiTrackValidator::vertexAssociatorToken_
private

Definition at line 62 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().