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

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(), dqmdumpme::first, get, 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, ParametersDefinerForTP::momentum(), MultiTrackValidator::parametersDefiner, MultiTrackValidator::parametersDefinerIsCosmic_, edm::Handle< T >::product(), hcal_runs::rt, singleTopDQM_cfi::setup, funct::sin(), findQualityFiles::size, mathSSE::sqrt(), cmsswSequenceInfo::tp, HLT_FULL_cff::track, duplicaterechits_cfi::trackCollection, MultiTrackValidator::useAssociators_, bphysicsOniaDQM_cfi::vertex, ParametersDefinerForTP::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:68
edm::Handle::product
T const * product() const
Definition: Handle.h:70
MultiTrackValidator::label
std::vector< edm::InputTag > label
Definition: MultiTrackValidator.h:67
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
ParametersDefinerForTP::momentum
virtual TrackingParticle::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
Definition: ParametersDefinerForTP.cc:17
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
dqmdumpme.first
first
Definition: dqmdumpme.py:55
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:57
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
TrackAssociatorRecord
Definition: TrackAssociatorRecord.h:18
edm::ESHandle
Definition: DTSurvey.h:22
MultiTrackValidator::doRecoTrackPlots_
const bool doRecoTrackPlots_
Definition: MultiTrackValidator.h:85
MultiTrackValidator::parametersDefiner
std::string parametersDefiner
Definition: MultiTrackValidator.h:75
MultiTrackValidator::ignoremissingtkcollection_
const bool ignoremissingtkcollection_
Definition: MultiTrackValidator.h:78
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
MultiTrackValidator::doSimPlots_
const bool doSimPlots_
Definition: MultiTrackValidator.h:83
MultiTrackValidator::dodEdxPlots_
const bool dodEdxPlots_
Definition: MultiTrackValidator.h:86
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
MultiTrackValidator::doSimTrackPlots_
const bool doSimTrackPlots_
Definition: MultiTrackValidator.h:84
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:72
MultiTrackValidator::MultiTrackValidator
MultiTrackValidator(const edm::ParameterSet &pset)
Constructor.
Definition: MultiTrackValidator.cc:49
histograms
Definition: histograms.py:1
get
#define get
reco::modules::GenParticleCustomSelector
SingleObjectSelector< GenParticleCollection, ::GenParticleCustomSelector > GenParticleCustomSelector
Definition: GenParticleCustomSelector.cc:15
MultiTrackValidator::useAssociators_
const bool useAssociators_
Definition: MultiTrackValidator.h:79
MultiTrackValidator::parametersDefinerIsCosmic_
const bool parametersDefinerIsCosmic_
Definition: MultiTrackValidator.h:77
MultiTrackValidator::histoProducerAlgo_
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
Definition: MultiTrackValidator.h:93
MultiTrackValidator::label_tp_fake
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
Definition: MultiTrackValidator.h:59
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:63
edm::RefToBase
Definition: AssociativeIterator.h:54
MultiTrackValidatorGenPs::gpSelector
GenParticleCustomSelector gpSelector
Definition: MultiTrackValidatorGenPs.h:26
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
MultiTrackValidator::bsSrc
edm::EDGetTokenT< reco::BeamSpot > bsSrc
Definition: MultiTrackValidator.h:70
event
Definition: event.py:1
MultiTrackValidator::m_dEdx2Tag
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx2Tag
Definition: MultiTrackValidator.h:73
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:58
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
ParametersDefinerForTP::vertex
virtual TrackingParticle::Point vertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
Definition: ParametersDefinerForTP.cc:50
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443