CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MultiTrackValidatorGenPs Class Reference

#include <MultiTrackValidatorGenPs.h>

Inheritance diagram for MultiTrackValidatorGenPs:
MultiTrackValidator DQMGlobalEDAnalyzer< MultiTrackValidatorHistograms > DQMGlobalEDAnalyzerBase< MultiTrackValidatorHistograms, Args... > edm::global::EDProducer< edm::RunCache< MultiTrackValidatorHistograms >, edm::EndRunProducer, edm::Accumulator, Args... > edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void dqmAnalyze (const edm::Event &, const edm::EventSetup &, const Histograms &) const override
 Method called once per event. More...
 
 MultiTrackValidatorGenPs (const edm::ParameterSet &pset)
 Constructor. More...
 
 ~MultiTrackValidatorGenPs () override
 Destructor. More...
 
- Public Member Functions inherited from MultiTrackValidator
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, Histograms &) const override
 Method called to book the DQM histograms. More...
 
 MultiTrackValidator (const edm::ParameterSet &pset)
 Constructor. More...
 
 ~MultiTrackValidator () override
 Destructor. More...
 
- Public Member Functions inherited from DQMGlobalEDAnalyzer< MultiTrackValidatorHistograms >
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &, MultiTrackValidatorHistograms const &) const
 
void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup) const final
 
- Public Member Functions inherited from DQMGlobalEDAnalyzerBase< MultiTrackValidatorHistograms, Args... >
void accumulate (edm::StreamID id, edm::Event const &event, edm::EventSetup const &setup) const final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &, MultiTrackValidatorHistograms &) const
 
 DQMGlobalEDAnalyzerBase ()
 
std::shared_ptr< MultiTrackValidatorHistogramsglobalBeginRun (edm::Run const &run, edm::EventSetup const &setup) const final
 
void globalEndRun (edm::Run const &, edm::EventSetup const &) const final
 
- Public Member Functions inherited from edm::global::EDProducer< edm::RunCache< MultiTrackValidatorHistograms >, edm::EndRunProducer, edm::Accumulator, Args... >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< reco::GenToRecoCollectionassociatormapGtR
 
edm::EDGetTokenT< reco::RecoToGenCollectionassociatormapRtG
 
GenParticleCustomSelector gpSelector
 
edm::EDGetTokenT< reco::TrackToGenParticleAssociatorlabel_gen_associator
 

Additional Inherited Members

- Public Types inherited from MultiTrackValidator
using Histograms = MultiTrackValidatorHistograms
 
- Public Types inherited from DQMGlobalEDAnalyzerBase< MultiTrackValidatorHistograms, Args... >
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from DQMGlobalEDAnalyzerBase< MultiTrackValidatorHistograms, Args... >
uint64_t meId (edm::Run const &run) const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
- Protected Attributes inherited from MultiTrackValidator
std::vector< edm::InputTagassociators
 
edm::EDGetTokenT< reco::BeamSpotbsSrc
 
const bool calculateDrSingleCollection_
 
const bool dodEdxPlots_
 
const bool doMVAPlots_
 
const bool doPlotsOnlyForTruePV_
 
const bool doPVAssociationPlots_
 
const bool doRecoTrackPlots_
 
std::vector< bool > doResolutionPlots_
 
const bool doSeedPlots_
 
const bool doSimPlots_
 
const bool doSimTrackPlots_
 
const bool doSummaryPlots_
 
std::unique_ptr< MTVHistoProducerAlgoForTrackerhistoProducerAlgo_
 
const bool ignoremissingtkcollection_
 
std::vector< edm::InputTaglabel
 
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > label_pileupinfo
 
edm::EDGetTokenT< TrackingParticleCollectionlabel_tp_effic
 
edm::EDGetTokenT< TrackingParticleRefVectorlabel_tp_effic_refvector
 
edm::EDGetTokenT< TrackingParticleCollectionlabel_tp_fake
 
edm::EDGetTokenT< TrackingParticleRefVectorlabel_tp_fake_refvector
 
edm::EDGetTokenT< TrackingVertexCollectionlabel_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
 
const bool parametersDefinerIsCosmic_
 
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
 
const edm::ESGetToken< ParametersDefinerForTP, TrackAssociatorRecordtpDefinerEsToken
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoEsToken
 
const bool useAssociators_
 
- Protected Attributes inherited from DQMGlobalEDAnalyzerBase< MultiTrackValidatorHistograms, Args... >
DQMStoredqmstore_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Class that prodecs histrograms to validate Track Reconstruction performances

Author
cerati

Definition at line 14 of file MultiTrackValidatorGenPs.h.

Constructor & Destructor Documentation

◆ MultiTrackValidatorGenPs()

MultiTrackValidatorGenPs::MultiTrackValidatorGenPs ( const edm::ParameterSet pset)

Constructor.

Definition at line 37 of file MultiTrackValidatorGenPs.cc.

38  gpSelector = GenParticleCustomSelector(pset.getParameter<double>("ptMinGP"),
39  pset.getParameter<double>("minRapidityGP"),
40  pset.getParameter<double>("maxRapidityGP"),
41  pset.getParameter<double>("tipGP"),
42  pset.getParameter<double>("lipGP"),
43  pset.getParameter<bool>("chargedOnlyGP"),
44  pset.getParameter<int>("statusGP"),
45  pset.getParameter<std::vector<int> >("pdgIdGP"));
46 
47  if (useAssociators_) {
48  for (auto const& src : associators) {
49  if (src.label() == kTrackAssociatorByChi2) {
50  label_gen_associator = consumes<reco::TrackToGenParticleAssociator>(src);
51  break;
52  }
53  }
54  } else {
55  for (auto const& src : associators) {
56  associatormapGtR = consumes<reco::GenToRecoCollection>(src);
57  associatormapRtG = consumes<reco::RecoToGenCollection>(src);
58  break;
59  }
60  }
61 }

References associatormapGtR, associatormapRtG, MultiTrackValidator::associators, gpSelector, kTrackAssociatorByChi2(), label_gen_associator, muonDTDigis_cfi::pset, TrackRefitter_38T_cff::src, and MultiTrackValidator::useAssociators_.

◆ ~MultiTrackValidatorGenPs()

MultiTrackValidatorGenPs::~MultiTrackValidatorGenPs ( )
override

Destructor.

Definition at line 63 of file MultiTrackValidatorGenPs.cc.

63 {}

Member Function Documentation

◆ dqmAnalyze()

void MultiTrackValidatorGenPs::dqmAnalyze ( const edm::Event event,
const edm::EventSetup setup,
const Histograms histograms 
) const
overridevirtual

Method called once per event.

Reimplemented from MultiTrackValidator.

Definition at line 65 of file MultiTrackValidatorGenPs.cc.

67  {
68  using namespace reco;
69 
70  edm::LogInfo("TrackValidator") << "\n===================================================="
71  << "\n"
72  << "Analyzing new event"
73  << "\n"
74  << "====================================================\n"
75  << "\n";
76 
77  const auto& parametersDefinerTP = &setup.getData(tpDefinerEsToken);
78  const TrackerTopology& ttopo = setup.getData(tTopoEsToken);
79 
80  edm::Handle<GenParticleCollection> TPCollectionHeff;
81  event.getByToken(label_tp_effic, TPCollectionHeff);
82  const GenParticleCollection tPCeff = *(TPCollectionHeff.product());
83 
84  edm::Handle<GenParticleCollection> TPCollectionHfake;
85  event.getByToken(label_tp_fake, TPCollectionHfake);
86  const GenParticleCollection tPCfake = *(TPCollectionHfake.product());
87 
88  //if (tPCeff.size()==0) {edm::LogInfo("TrackValidator")
89  //<< "TP Collection for efficiency studies has size = 0! Skipping Event." ; return;}
90  //if (tPCfake.size()==0) {edm::LogInfo("TrackValidator")
91  //<< "TP Collection for fake rate studies has size = 0! Skipping Event." ; return;}
92 
93  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
94  event.getByToken(bsSrc, recoBeamSpotHandle);
95  reco::BeamSpot bs = *recoBeamSpotHandle;
96 
98  event.getByToken(label_pileupinfo, puinfoH);
99  PileupSummaryInfo puinfo;
100 
101  for (unsigned int puinfo_ite = 0; puinfo_ite < (*puinfoH).size(); ++puinfo_ite) {
102  if ((*puinfoH)[puinfo_ite].getBunchCrossing() == 0) {
103  puinfo = (*puinfoH)[puinfo_ite];
104  break;
105  }
106  }
107 
108  const reco::TrackToGenParticleAssociator* trackGenAssociator = nullptr;
109  if (useAssociators_) {
111  return;
112  } else {
114  event.getByToken(label_gen_associator, trackGenAssociatorH);
115  trackGenAssociator = trackGenAssociatorH.product();
116  }
117  } else if (associatormapGtR.isUninitialized()) {
118  return;
119  }
120 
121  // dE/dx
122  // at some point this could be generalized, with a vector of tags and a corresponding vector of Handles
123  // I'm writing the interface such to take vectors of ValueMaps
124  std::vector<const edm::ValueMap<reco::DeDxData>*> v_dEdx;
125  if (dodEdxPlots_) {
128  event.getByToken(m_dEdx1Tag, dEdx1Handle);
129  event.getByToken(m_dEdx2Tag, dEdx2Handle);
130  v_dEdx.push_back(dEdx1Handle.product());
131  v_dEdx.push_back(dEdx2Handle.product());
132  }
133 
134  std::vector<float> mvaDummy;
135 
136  int w = 0; //counter counting the number of sets of histograms
137  for (unsigned int www = 0; www < label.size(); www++) {
138  //
139  //get collections from the event
140  //
143  continue;
144  //if (trackCollection->size()==0)
145  //edm::LogInfo("TrackValidator") << "TrackCollection size = 0!" ;
146  //continue;
147  //}
148  reco::RecoToGenCollection recGenColl;
149  reco::GenToRecoCollection genRecColl;
150  //associate tracks
151  if (useAssociators_) {
152  edm::LogVerbatim("TrackValidator") << "Analyzing " << label[www].process() << ":" << label[www].label() << ":"
153  << label[www].instance() << " with " << kTrackAssociatorByChi2 << "\n";
154 
155  LogTrace("TrackValidator") << "Calling associateRecoToGen method"
156  << "\n";
157  recGenColl = trackGenAssociator->associateRecoToGen(trackCollection, TPCollectionHfake);
158  LogTrace("TrackValidator") << "Calling associateGenToReco method"
159  << "\n";
160  genRecColl = trackGenAssociator->associateGenToReco(trackCollection, TPCollectionHeff);
161  } else {
162  edm::LogVerbatim("TrackValidator") << "Analyzing " << label[www].process() << ":" << label[www].label() << ":"
163  << label[www].instance() << " with " << associators[0] << "\n";
164 
165  Handle<reco::GenToRecoCollection> gentorecoCollectionH;
166  event.getByToken(associatormapGtR, gentorecoCollectionH);
167  genRecColl = *(gentorecoCollectionH.product());
168 
169  Handle<reco::RecoToGenCollection> recotogenCollectionH;
170  event.getByToken(associatormapRtG, recotogenCollectionH);
171  recGenColl = *(recotogenCollectionH.product());
172  }
173 
174  // ########################################################
175  // fill simulation histograms (LOOP OVER TRACKINGPARTICLES)
176  // ########################################################
177 
178  //compute number of tracks per eta interval
179  //
180  edm::LogVerbatim("TrackValidator") << "\n# of GenParticles: " << tPCeff.size() << "\n";
181  int ats(0); //This counter counts the number of simTracks that are "associated" to recoTracks
182  int st(0); //This counter counts the number of simulated tracks passing the MTV selection (i.e. tpSelector(tp) )
183  unsigned sts(0); //This counter counts the number of simTracks surviving the bunchcrossing cut
184  unsigned asts(
185  0); //This counter counts the number of simTracks that are "associated" to recoTracks surviving the bunchcrossing cut
186  for (GenParticleCollection::size_type i = 0; i < tPCeff.size();
187  i++) { //loop over TPs collection for tracking efficiency
188  GenParticleRef tpr(TPCollectionHeff, i);
189  GenParticle* tp = const_cast<GenParticle*>(tpr.get());
190  TrackingParticle::Vector momentumTP;
191  TrackingParticle::Point vertexTP;
192  double dxyGen(0);
193  double dzGen(0);
194 
195  //---------- THIS PART HAS TO BE CLEANED UP. THE PARAMETER DEFINER WAS NOT MEANT TO BE USED IN THIS WAY ----------
196  //If the GenParticle is collison like, get the momentum and vertex at production state
198  //fixme this one shold be implemented
199  if (!gpSelector(*tp))
200  continue;
201  momentumTP = tp->momentum();
202  vertexTP = tp->vertex();
203  //Calcualte the impact parameters w.r.t. PCA
204  TrackingParticle::Vector momentum = parametersDefinerTP->momentum(event, setup, *tp);
205  TrackingParticle::Point vertex = parametersDefinerTP->vertex(event, setup, *tp);
206  dxyGen = (-vertex.x() * sin(momentum.phi()) + vertex.y() * cos(momentum.phi()));
207  dzGen = vertex.z() - (vertex.x() * momentum.x() + vertex.y() * momentum.y()) / sqrt(momentum.perp2()) *
208  momentum.z() / sqrt(momentum.perp2());
209  }
210  //If the GenParticle is comics, get the momentum and vertex at PCA
211  else {
212  //if(! cosmictpSelector(*tp,&bs,event,setup)) continue;
213  momentumTP = parametersDefinerTP->momentum(event, setup, *tp);
214  vertexTP = parametersDefinerTP->vertex(event, setup, *tp);
215  dxyGen = (-vertexTP.x() * sin(momentumTP.phi()) + vertexTP.y() * cos(momentumTP.phi()));
216  dzGen = vertexTP.z() - (vertexTP.x() * momentumTP.x() + vertexTP.y() * momentumTP.y()) /
217  sqrt(momentumTP.perp2()) * momentumTP.z() / sqrt(momentumTP.perp2());
218  }
219  //---------- THE PART ABOVE HAS TO BE CLEANED UP. THE PARAMETER DEFINER WAS NOT MEANT TO BE USED IN THIS WAY ----------
220 
221  st++; //This counter counts the number of simulated tracks passing the MTV selection (i.e. tpSelector(tp) )
222 
223  // in the coming lines, histos are filled using as input
224  // - momentumTP
225  // - vertexTP
226  // - dxyGen
227  // - dzGen
228 
229  if (doSimPlots_ && w == 0) {
230  histoProducerAlgo_->fill_generic_simTrack_histos(histograms.histoProducerAlgo,
231  momentumTP,
232  vertexTP,
233  tp->collisionId()); //fixme: check meaning of collisionId
234  }
235  if (!doSimTrackPlots_)
236  continue;
237 
238  // ##############################################
239  // fill RecoAssociated GenTracks' histograms
240  // ##############################################
241  // bool isRecoMatched(false); // UNUSED
242  const reco::Track* matchedTrackPointer = nullptr;
243  std::vector<std::pair<RefToBase<Track>, double> > rt;
244  if (genRecColl.find(tpr) != genRecColl.end()) {
245  rt = (std::vector<std::pair<RefToBase<Track>, double> >)genRecColl[tpr];
246  if (!rt.empty()) {
247  ats++; //This counter counts the number of simTracks that have a recoTrack associated
248  // isRecoMatched = true; // UNUSED
249  matchedTrackPointer = rt.begin()->first.get();
250  edm::LogVerbatim("TrackValidator") << "GenParticle #" << st << " with pt=" << sqrt(momentumTP.perp2())
251  << " associated with quality:" << rt.begin()->second << "\n";
252  }
253  } else {
254  edm::LogVerbatim("TrackValidator") << "GenParticle #" << st << " with pt,eta,phi: " << sqrt(momentumTP.perp2())
255  << " , " << momentumTP.eta() << " , " << momentumTP.phi() << " , "
256  << " NOT associated to any reco::Track"
257  << "\n";
258  }
259 
260  int nSimHits = 0;
261  histoProducerAlgo_->fill_recoAssociated_simTrack_histos(histograms.histoProducerAlgo,
262  w,
263  *tp,
264  momentumTP,
265  vertexTP,
266  dxyGen,
267  dzGen,
268  nSimHits,
269  matchedTrackPointer,
270  puinfo.getPU_NumInteractions());
271 
272  sts++;
273  if (matchedTrackPointer)
274  asts++;
275 
276  } // End for (GenParticleCollection::size_type i=0; i<tPCeff.size(); i++){
277 
278  if (doSimPlots_ && w == 0) {
279  histoProducerAlgo_->fill_simTrackBased_histos(histograms.histoProducerAlgo, st);
280  }
281 
282  // ##############################################
283  // fill recoTracks histograms (LOOP OVER TRACKS)
284  // ##############################################
285  if (!doRecoTrackPlots_)
286  continue;
287  edm::LogVerbatim("TrackValidator") << "\n# of reco::Tracks with " << label[www].process() << ":"
288  << label[www].label() << ":" << label[www].instance() << ": "
289  << trackCollection->size() << "\n";
290 
291  //int sat(0); //This counter counts the number of recoTracks that are associated to GenTracks from Signal only
292  int at(0); //This counter counts the number of recoTracks that are associated to GenTracks
293  int rT(0); //This counter counts the number of recoTracks in general
294 
295  for (View<Track>::size_type i = 0; i < trackCollection->size(); ++i) {
297  rT++;
298 
299  bool isSigGenMatched(false);
300  bool isGenMatched(false);
301  bool isChargeMatched(true);
302  int numAssocRecoTracks = 0;
303  int nSimHits = 0;
304  double sharedFraction = 0.;
305  std::vector<std::pair<GenParticleRef, double> > tp;
306  if (recGenColl.find(track) != recGenColl.end()) {
307  tp = recGenColl[track];
308  if (!tp.empty()) {
309  /*
310  std::vector<PSimHit> simhits=tp[0].first->trackPSimHit(DetId::Tracker);
311  nSimHits = simhits.end()-simhits.begin();
312  */
313  sharedFraction = tp[0].second;
314  isGenMatched = true;
315  if (tp[0].first->charge() != track->charge())
316  isChargeMatched = false;
317  if (genRecColl.find(tp[0].first) != genRecColl.end())
318  numAssocRecoTracks = genRecColl[tp[0].first].size();
319  //std::cout << numAssocRecoTracks << std::endl;
320  at++;
321  for (unsigned int tp_ite = 0; tp_ite < tp.size(); ++tp_ite) {
322  GenParticle trackpart = *(tp[tp_ite].first);
323  /*
324  if ((trackpart.eventId().event() == 0) && (trackpart.eventId().bunchCrossing() == 0)){
325  isSigGenMatched = true;
326  sat++;
327  break;
328  }
329  */
330  }
331  edm::LogVerbatim("TrackValidator") << "reco::Track #" << rT << " with pt=" << track->pt()
332  << " associated with quality:" << tp.begin()->second << "\n";
333  }
334  } else {
335  edm::LogVerbatim("TrackValidator")
336  << "reco::Track #" << rT << " with pt=" << track->pt() << " NOT associated to any GenParticle"
337  << "\n";
338  }
339 
340  double dR = 0; //fixme: plots vs dR and vs dRjet not implemented for now
341  histoProducerAlgo_->fill_generic_recoTrack_histos(histograms.histoProducerAlgo,
342  w,
343  *track,
344  ttopo,
345  bs.position(),
346  nullptr,
347  nullptr,
348  isGenMatched,
349  isSigGenMatched,
350  isChargeMatched,
351  numAssocRecoTracks,
352  puinfo.getPU_NumInteractions(),
353  nSimHits,
354  sharedFraction,
355  dR,
356  dR,
357  mvaDummy,
358  0,
359  0);
360 
361  // dE/dx
362  if (dodEdxPlots_)
363  histoProducerAlgo_->fill_dedx_recoTrack_histos(histograms.histoProducerAlgo, w, track, v_dEdx);
364 
365  //Fill other histos
366  //try{ //Is this really necessary ????
367 
368  if (tp.empty())
369  continue;
370 
371  histoProducerAlgo_->fill_simAssociated_recoTrack_histos(histograms.histoProducerAlgo, w, *track);
372 
373  GenParticleRef tpr = tp.begin()->first;
374 
375  /* TO BE FIXED LATER
376  if (associators[ww]=="TrackAssociatorByChi2"){
377  //association chi2
378  double assocChi2 = -tp.begin()->second;//in association map is stored -chi2
379  h_assochi2[www]->Fill(assocChi2);
380  h_assochi2_prob[www]->Fill(TMath::Prob((assocChi2)*5,5));
381  }
382  else if (associators[ww]=="quickTrackAssociatorByHits"){
383  double fraction = tp.begin()->second;
384  h_assocFraction[www]->Fill(fraction);
385  h_assocSharedHit[www]->Fill(fraction*track->numberOfValidHits());
386  }
387  */
388 
389  //Get tracking particle parameters at point of closest approach to the beamline
390  TrackingParticle::Vector momentumTP = parametersDefinerTP->momentum(event, setup, *(tpr.get()));
391  TrackingParticle::Point vertexTP = parametersDefinerTP->vertex(event, setup, *(tpr.get()));
392  int chargeTP = tpr->charge();
393 
394  histoProducerAlgo_->fill_ResoAndPull_recoTrack_histos(
395  histograms.histoProducerAlgo, w, momentumTP, vertexTP, chargeTP, *track, bs.position());
396 
397  //TO BE FIXED
398  //std::vector<PSimHit> simhits=tpr.get()->trackPSimHit(DetId::Tracker);
399  //nrecHit_vs_nsimHit_rec2sim[w]->Fill(track->numberOfValidHits(), (int)(simhits.end()-simhits.begin() ));
400 
401  /*
402  } // End of try{
403  catch (cms::Exception e){
404  LogTrace("TrackValidator") << "exception found: " << e.what() << "\n";
405  }
406  */
407 
408  } // End of for(View<Track>::size_type i=0; i<trackCollection->size(); ++i){
409 
410  histoProducerAlgo_->fill_trackBased_histos(histograms.histoProducerAlgo, w, at, rT, rT, st);
411 
412  edm::LogVerbatim("TrackValidator") << "Total Simulated: " << st << "\n"
413  << "Total Associated (genToReco): " << ats << "\n"
414  << "Total Reconstructed: " << rT << "\n"
415  << "Total Associated (recoToGen): " << at << "\n"
416  << "Total Fakes: " << rT - at << "\n";
417 
418  w++;
419  } // End of for (unsigned int www=0;www<label.size();www++){
420 }

References reco::TrackToGenParticleAssociator::associateGenToReco(), reco::TrackToGenParticleAssociator::associateRecoToGen(), associatormapGtR, associatormapRtG, MultiTrackValidator::associators, cms::cuda::bs, MultiTrackValidator::bsSrc, funct::cos(), MultiTrackValidator::dodEdxPlots_, MultiTrackValidator::doRecoTrackPlots_, MultiTrackValidator::doSimPlots_, MultiTrackValidator::doSimTrackPlots_, HGC3DClusterGenMatchSelector_cfi::dR, edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), first, edm::Ref< C, T, F >::get(), PileupSummaryInfo::getPU_NumInteractions(), gpSelector, MultiTrackValidator::histoProducerAlgo_, mps_fire::i, MultiTrackValidator::ignoremissingtkcollection_, edm::EDGetTokenT< T >::isUninitialized(), kTrackAssociatorByChi2(), MultiTrackValidator::label, label_gen_associator, MultiTrackValidator::label_pileupinfo, MultiTrackValidator::label_tp_effic, MultiTrackValidator::label_tp_fake, MultiTrackValidator::labelToken, LogTrace, MultiTrackValidator::m_dEdx1Tag, MultiTrackValidator::m_dEdx2Tag, MultiTrackValidator::parametersDefinerIsCosmic_, edm::Handle< T >::product(), hcal_runs::rt, singleTopDQM_cfi::setup, funct::sin(), findQualityFiles::size, mathSSE::sqrt(), cmsswSequenceInfo::tp, MultiTrackValidator::tpDefinerEsToken, HLT_FULL_cff::track, duplicaterechits_cfi::trackCollection, MultiTrackValidator::tTopoEsToken, MultiTrackValidator::useAssociators_, bphysicsOniaDQM_cfi::vertex, and w.

Member Data Documentation

◆ associatormapGtR

edm::EDGetTokenT<reco::GenToRecoCollection> MultiTrackValidatorGenPs::associatormapGtR
private

Definition at line 28 of file MultiTrackValidatorGenPs.h.

Referenced by dqmAnalyze(), and MultiTrackValidatorGenPs().

◆ associatormapRtG

edm::EDGetTokenT<reco::RecoToGenCollection> MultiTrackValidatorGenPs::associatormapRtG
private

Definition at line 29 of file MultiTrackValidatorGenPs.h.

Referenced by dqmAnalyze(), and MultiTrackValidatorGenPs().

◆ gpSelector

GenParticleCustomSelector MultiTrackValidatorGenPs::gpSelector
private

Definition at line 26 of file MultiTrackValidatorGenPs.h.

Referenced by dqmAnalyze(), and MultiTrackValidatorGenPs().

◆ label_gen_associator

edm::EDGetTokenT<reco::TrackToGenParticleAssociator> MultiTrackValidatorGenPs::label_gen_associator
private

Definition at line 27 of file MultiTrackValidatorGenPs.h.

Referenced by dqmAnalyze(), and MultiTrackValidatorGenPs().

kTrackAssociatorByChi2
static const std::string kTrackAssociatorByChi2("trackAssociatorByChi2")
edm::AssociationMap::find
const_iterator find(const key_type &k) const
find element with specified reference key
Definition: AssociationMap.h:173
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
MultiTrackValidator::labelToken
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > labelToken
Definition: MultiTrackValidator.h:76
edm::Handle::product
T const * product() const
Definition: Handle.h:70
MultiTrackValidator::label
std::vector< edm::InputTag > label
Definition: MultiTrackValidator.h:75
MultiTrackValidatorGenPs::label_gen_associator
edm::EDGetTokenT< reco::TrackToGenParticleAssociator > label_gen_associator
Definition: MultiTrackValidatorGenPs.h:27
TrackerTopology
Definition: TrackerTopology.h:16
hcal_runs.rt
rt
Definition: hcal_runs.py:76
reco::GenParticleCollection
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Definition: GenParticleFwd.h:13
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
edm::EDGetTokenT::isUninitialized
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
TrackingParticle::Vector
math::XYZVectorD Vector
point in the space
Definition: TrackingParticle.h:37
reco::TrackToGenParticleAssociator
Definition: TrackToGenParticleAssociator.h:34
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
GenParticle
Definition: GenParticle.py:1
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::Ref< GenParticleCollection >
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
cms::cuda::bs
bs
Definition: HistoContainer.h:127
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MultiTrackValidator::associators
std::vector< edm::InputTag > associators
Definition: MultiTrackValidator.h:65
w
const double w
Definition: UKUtility.cc:23
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
MultiTrackValidatorGenPs::associatormapRtG
edm::EDGetTokenT< reco::RecoToGenCollection > associatormapRtG
Definition: MultiTrackValidatorGenPs.h:29
reco::BeamSpot
Definition: BeamSpot.h:21
reco::Track
Definition: Track.h:27
MultiTrackValidator::doRecoTrackPlots_
const bool doRecoTrackPlots_
Definition: MultiTrackValidator.h:90
MultiTrackValidator::tTopoEsToken
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoEsToken
Definition: MultiTrackValidator.h:57
MultiTrackValidator::ignoremissingtkcollection_
const bool ignoremissingtkcollection_
Definition: MultiTrackValidator.h:83
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
MultiTrackValidator::doSimPlots_
const bool doSimPlots_
Definition: MultiTrackValidator.h:88
MultiTrackValidator::dodEdxPlots_
const bool dodEdxPlots_
Definition: MultiTrackValidator.h:91
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
MultiTrackValidator::doSimTrackPlots_
const bool doSimTrackPlots_
Definition: MultiTrackValidator.h:89
MultiTrackValidatorGenPs::associatormapGtR
edm::EDGetTokenT< reco::GenToRecoCollection > associatormapGtR
Definition: MultiTrackValidatorGenPs.h:28
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
reco::TrackToGenParticleAssociator::associateRecoToGen
reco::RecoToGenCollection associateRecoToGen(const edm::RefToBaseVector< reco::Track > &tracks, const edm::RefVector< reco::GenParticleCollection > &gens) const
Association Sim To Reco with Collections (Gen Particle version)
Definition: TrackToGenParticleAssociator.h:46
edm::AssociationMap
Definition: AssociationMap.h:48
MultiTrackValidator::m_dEdx1Tag
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx1Tag
Definition: MultiTrackValidator.h:80
MultiTrackValidator::MultiTrackValidator
MultiTrackValidator(const edm::ParameterSet &pset)
Constructor.
Definition: MultiTrackValidator.cc:49
histograms
Definition: histograms.py:1
reco::modules::GenParticleCustomSelector
SingleObjectSelector< GenParticleCollection, ::GenParticleCustomSelector > GenParticleCustomSelector
Definition: GenParticleCustomSelector.cc:15
MultiTrackValidator::useAssociators_
const bool useAssociators_
Definition: MultiTrackValidator.h:84
MultiTrackValidator::parametersDefinerIsCosmic_
const bool parametersDefinerIsCosmic_
Definition: MultiTrackValidator.h:61
MultiTrackValidator::histoProducerAlgo_
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
Definition: MultiTrackValidator.h:98
MultiTrackValidator::tpDefinerEsToken
const edm::ESGetToken< ParametersDefinerForTP, TrackAssociatorRecord > tpDefinerEsToken
Definition: MultiTrackValidator.h:60
MultiTrackValidator::label_tp_fake
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
Definition: MultiTrackValidator.h:67
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
PileupSummaryInfo::getPU_NumInteractions
const int getPU_NumInteractions() const
Definition: PileupSummaryInfo.h:62
MultiTrackValidator::label_pileupinfo
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > label_pileupinfo
Definition: MultiTrackValidator.h:71
edm::RefToBase
Definition: AssociativeIterator.h:54
MultiTrackValidatorGenPs::gpSelector
GenParticleCustomSelector gpSelector
Definition: MultiTrackValidatorGenPs.h:26
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
MultiTrackValidator::bsSrc
edm::EDGetTokenT< reco::BeamSpot > bsSrc
Definition: MultiTrackValidator.h:78
event
Definition: event.py:1
MultiTrackValidator::m_dEdx2Tag
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx2Tag
Definition: MultiTrackValidator.h:81
TrackingParticle::Point
math::XYZPointD Point
point in the space
Definition: TrackingParticle.h:36
MultiTrackValidator::label_tp_effic
edm::EDGetTokenT< TrackingParticleCollection > label_tp_effic
Definition: MultiTrackValidator.h:66
reco::TrackToGenParticleAssociator::associateGenToReco
reco::GenToRecoCollection associateGenToReco(const edm::RefToBaseVector< reco::Track > &tracks, const edm::RefVector< reco::GenParticleCollection > &gens) const
Association Sim To Reco with Collections (Gen Particle version)
Definition: TrackToGenParticleAssociator.h:51
PileupSummaryInfo
Definition: PileupSummaryInfo.h:22
edm::View::size_type
unsigned int size_type
Definition: View.h:90
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443