CMS 3D CMS Logo

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

#include <MultiTrackValidator.h>

Inheritance diagram for MultiTrackValidator:
edm::EDAnalyzer MultiTrackValidatorBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 Method called once per event. More...
 
void beginRun (edm::Run const &, edm::EventSetup const &)
 Method called before the event loop. More...
 
void endRun (edm::Run const &, edm::EventSetup const &)
 Method called at the end of the event loop. More...
 
 MultiTrackValidator (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~MultiTrackValidator ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

edm::InputTag associatormap
 
CosmicTrackingParticleSelector cosmictpSelector
 
std::string dirName_
 
MTVHistoProducerAlgohistoProducerAlgo_
 
bool runStandalone
 
TrackingParticleSelector tpSelector
 
bool UseAssociators
 
bool useGsf
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from MultiTrackValidatorBase
 MultiTrackValidatorBase (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~MultiTrackValidatorBase ()
 Destructor. More...
 
- Protected Attributes inherited from MultiTrackValidatorBase
std::vector< const
TrackAssociatorBase * > 
associator
 
std::vector< std::string > associators
 
edm::InputTag bsSrc
 
DQMStoredbe_
 
bool ignoremissingtkcollection_
 
std::vector< edm::InputTaglabel
 
edm::InputTag label_pileupinfo
 
edm::InputTag label_tp_effic
 
edm::InputTag label_tp_fake
 
edm::InputTag label_tv
 
edm::InputTag m_dEdx1Tag
 
edm::InputTag m_dEdx2Tag
 
std::string out
 
std::string parametersDefiner
 
std::string sim
 
bool skipHistoFit
 
edm::ESHandle< MagneticFieldtheMF
 

Detailed Description

Class that prodecs histrograms to validate Track Reconstruction performances

Date:
2011/02/02 11:41:16
Revision:
1.51
Author
cerati

Definition at line 17 of file MultiTrackValidator.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 42 of file MultiTrackValidator.cc.

References associatormap, MultiTrackValidatorBase::associators, cosmictpSelector, MultiTrackValidatorBase::dbe_, dirName_, reco::get(), edm::ParameterSet::getParameter(), histoProducerAlgo_, MultiTrackValidatorBase::m_dEdx1Tag, MultiTrackValidatorBase::m_dEdx2Tag, runStandalone, tpSelector, UseAssociators, and useGsf.

43  //theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet);
44 
45  ParameterSet psetForHistoProducerAlgo = pset.getParameter<ParameterSet>("histoProducerAlgoBlock");
46  string histoProducerAlgoName = psetForHistoProducerAlgo.getParameter<string>("ComponentName");
47  histoProducerAlgo_ = MTVHistoProducerAlgoFactory::get()->create(histoProducerAlgoName ,psetForHistoProducerAlgo);
48  histoProducerAlgo_->setDQMStore(dbe_);
49 
50  dirName_ = pset.getParameter<std::string>("dirName");
51  associatormap = pset.getParameter< edm::InputTag >("associatormap");
52  UseAssociators = pset.getParameter< bool >("UseAssociators");
53 
54  m_dEdx1Tag = pset.getParameter< edm::InputTag >("dEdx1Tag");
55  m_dEdx2Tag = pset.getParameter< edm::InputTag >("dEdx2Tag");
56 
57  tpSelector = TrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
58  pset.getParameter<double>("minRapidityTP"),
59  pset.getParameter<double>("maxRapidityTP"),
60  pset.getParameter<double>("tipTP"),
61  pset.getParameter<double>("lipTP"),
62  pset.getParameter<int>("minHitTP"),
63  pset.getParameter<bool>("signalOnlyTP"),
64  pset.getParameter<bool>("chargedOnlyTP"),
65  pset.getParameter<bool>("stableOnlyTP"),
66  pset.getParameter<std::vector<int> >("pdgIdTP"));
67 
69  pset.getParameter<double>("minRapidityTP"),
70  pset.getParameter<double>("maxRapidityTP"),
71  pset.getParameter<double>("tipTP"),
72  pset.getParameter<double>("lipTP"),
73  pset.getParameter<int>("minHitTP"),
74  pset.getParameter<bool>("chargedOnlyTP"),
75  pset.getParameter<std::vector<int> >("pdgIdTP"));
76 
77  useGsf = pset.getParameter<bool>("useGsf");
78  runStandalone = pset.getParameter<bool>("runStandalone");
79 
80 
81 
82  if (!UseAssociators) {
83  associators.clear();
84  associators.push_back(associatormap.label());
85  }
86 
87 }
T getParameter(std::string const &) const
CosmicTrackingParticleSelector cosmictpSelector
MultiTrackValidatorBase(const edm::ParameterSet &pset)
Constructor.
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
TrackingParticleSelector tpSelector
edm::InputTag associatormap
ObjectSelector< CosmicTrackingParticleSelector > CosmicTrackingParticleSelector
MTVHistoProducerAlgo * histoProducerAlgo_
std::vector< std::string > associators
T get(const Candidate &c)
Definition: component.h:56
MultiTrackValidator::~MultiTrackValidator ( )
virtual

Destructor.

Definition at line 90 of file MultiTrackValidator.cc.

References histoProducerAlgo_.

90 {delete histoProducerAlgo_;}
MTVHistoProducerAlgo * histoProducerAlgo_

Member Function Documentation

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

Method called once per event.

Implements edm::EDAnalyzer.

Definition at line 147 of file MultiTrackValidator.cc.

References MultiTrackValidatorBase::associator, associatormap, MultiTrackValidatorBase::associators, asciidump::at, MultiTrackValidatorBase::bsSrc, EncodedEventId::bunchCrossing(), reco::TrackBase::charge(), edm::HandleBase::clear(), funct::cos(), cosmictpSelector, alignCSCRings::e, edm::AssociationMap< Tag >::end(), EncodedEventId::event(), TrackingParticle::eventId(), MTVHistoProducerAlgo::fill_dedx_recoTrack_histos(), MTVHistoProducerAlgo::fill_generic_recoTrack_histos(), MTVHistoProducerAlgo::fill_generic_simTrack_histos(), MTVHistoProducerAlgo::fill_recoAssociated_simTrack_histos(), MTVHistoProducerAlgo::fill_ResoAndPull_recoTrack_histos(), MTVHistoProducerAlgo::fill_simAssociated_recoTrack_histos(), MTVHistoProducerAlgo::fill_trackBased_histos(), edm::AssociationMap< Tag >::find(), first, edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByLabel(), histoProducerAlgo_, i, MultiTrackValidatorBase::ignoremissingtkcollection_, edm::InputTag::instance(), j, edm::InputTag::label(), MultiTrackValidatorBase::label, MultiTrackValidatorBase::label_pileupinfo, MultiTrackValidatorBase::label_tp_effic, MultiTrackValidatorBase::label_tp_fake, MultiTrackValidatorBase::label_tv, LogTrace, MultiTrackValidatorBase::m_dEdx1Tag, MultiTrackValidatorBase::m_dEdx2Tag, ParticleBase::momentum(), MultiTrackValidatorBase::parametersDefiner, edm::InputTag::process(), edm::Handle< T >::product(), reco::TrackBase::pt(), dt_dqm_sourceclient_common_cff::reco, funct::sin(), findQualityFiles::size, mathSSE::sqrt(), tpSelector, DetId::Tracker, TrackingParticle::trackPSimHit(), UseAssociators, ParticleBase::vertex(), w(), and cms::Exception::what().

147  {
148  using namespace reco;
149 
150  edm::LogInfo("TrackValidator") << "\n====================================================" << "\n"
151  << "Analyzing new event" << "\n"
152  << "====================================================\n" << "\n";
153  edm::ESHandle<ParametersDefinerForTP> parametersDefinerTP;
154  setup.get<TrackAssociatorRecord>().get(parametersDefiner,parametersDefinerTP);
155 
156  edm::Handle<TrackingParticleCollection> TPCollectionHeff ;
157  event.getByLabel(label_tp_effic,TPCollectionHeff);
158  const TrackingParticleCollection tPCeff = *(TPCollectionHeff.product());
159 
160  edm::Handle<TrackingParticleCollection> TPCollectionHfake ;
161  event.getByLabel(label_tp_fake,TPCollectionHfake);
162  const TrackingParticleCollection tPCfake = *(TPCollectionHfake.product());
163 
164  //if (tPCeff.size()==0) {edm::LogInfo("TrackValidator")
165  //<< "TP Collection for efficiency studies has size = 0! Skipping Event." ; return;}
166  //if (tPCfake.size()==0) {edm::LogInfo("TrackValidator")
167  //<< "TP Collection for fake rate studies has size = 0! Skipping Event." ; return;}
168 
169  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
170  event.getByLabel(bsSrc,recoBeamSpotHandle);
171  reco::BeamSpot bs = *recoBeamSpotHandle;
172 
174  event.getByLabel(label_pileupinfo,puinfoH);
175  PileupSummaryInfo puinfo;
176 
177  for (unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
178  if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
179  puinfo=(*puinfoH)[puinfo_ite];
180  break;
181  }
182  }
183 
185  event.getByLabel(label_tv,tvH);
186  TrackingVertexCollection tv = *tvH;
187 
188  int w=0; //counter counting the number of sets of histograms
189  for (unsigned int ww=0;ww<associators.size();ww++){
190  for (unsigned int www=0;www<label.size();www++){
191  //
192  //get collections from the event
193  //
194  edm::Handle<View<Track> > trackCollection;
195  if(!event.getByLabel(label[www], trackCollection)&&ignoremissingtkcollection_)continue;
196  //if (trackCollection->size()==0)
197  //edm::LogInfo("TrackValidator") << "TrackCollection size = 0!" ;
198  //continue;
199  //}
200  reco::RecoToSimCollection recSimColl;
201  reco::SimToRecoCollection simRecColl;
202  //associate tracks
203  if(UseAssociators){
204  edm::LogVerbatim("TrackValidator") << "Analyzing "
205  << label[www].process()<<":"
206  << label[www].label()<<":"
207  << label[www].instance()<<" with "
208  << associators[ww].c_str() <<"\n";
209 
210  LogTrace("TrackValidator") << "Calling associateRecoToSim method" << "\n";
211  recSimColl=associator[ww]->associateRecoToSim(trackCollection,
212  TPCollectionHfake,
213  &event);
214  LogTrace("TrackValidator") << "Calling associateSimToReco method" << "\n";
215  simRecColl=associator[ww]->associateSimToReco(trackCollection,
216  TPCollectionHeff,
217  &event);
218  }
219  else{
220  edm::LogVerbatim("TrackValidator") << "Analyzing "
221  << label[www].process()<<":"
222  << label[www].label()<<":"
223  << label[www].instance()<<" with "
224  << associatormap.process()<<":"
225  << associatormap.label()<<":"
226  << associatormap.instance()<<"\n";
227 
228  Handle<reco::SimToRecoCollection > simtorecoCollectionH;
229  event.getByLabel(associatormap,simtorecoCollectionH);
230  simRecColl= *(simtorecoCollectionH.product());
231 
232  Handle<reco::RecoToSimCollection > recotosimCollectionH;
233  event.getByLabel(associatormap,recotosimCollectionH);
234  recSimColl= *(recotosimCollectionH.product());
235  }
236 
237 
238 
239  // ########################################################
240  // fill simulation histograms (LOOP OVER TRACKINGPARTICLES)
241  // ########################################################
242 
243  //compute number of tracks per eta interval
244  //
245  edm::LogVerbatim("TrackValidator") << "\n# of TrackingParticles: " << tPCeff.size() << "\n";
246  int ats(0); //This counter counts the number of simTracks that are "associated" to recoTracks
247  int st(0); //This counter counts the number of simulated tracks passing the MTV selection (i.e. tpSelector(tp) )
248  unsigned sts(0); //This counter counts the number of simTracks surviving the bunchcrossing cut
249  unsigned asts(0); //This counter counts the number of simTracks that are "associated" to recoTracks surviving the bunchcrossing cut
250  for (TrackingParticleCollection::size_type i=0; i<tPCeff.size(); i++){ //loop over TPs collection for tracking efficiency
251  TrackingParticleRef tpr(TPCollectionHeff, i);
252  TrackingParticle* tp=const_cast<TrackingParticle*>(tpr.get());
253  ParticleBase::Vector momentumTP;
254  ParticleBase::Point vertexTP;
255  double dxySim(0);
256  double dzSim(0);
257 
258  //---------- THIS PART HAS TO BE CLEANED UP. THE PARAMETER DEFINER WAS NOT MEANT TO BE USED IN THIS WAY ----------
259  //If the TrackingParticle is collison like, get the momentum and vertex at production state
260  if(parametersDefiner=="LhcParametersDefinerForTP")
261  {
262  if(! tpSelector(*tp)) continue;
263  momentumTP = tp->momentum();
264  vertexTP = tp->vertex();
265  //Calcualte the impact parameters w.r.t. PCA
266  ParticleBase::Vector momentum = parametersDefinerTP->momentum(event,setup,*tp);
267  ParticleBase::Point vertex = parametersDefinerTP->vertex(event,setup,*tp);
268  dxySim = (-vertex.x()*sin(momentum.phi())+vertex.y()*cos(momentum.phi()));
269  dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/sqrt(momentum.perp2())
270  * momentum.z()/sqrt(momentum.perp2());
271  }
272  //If the TrackingParticle is comics, get the momentum and vertex at PCA
273  if(parametersDefiner=="CosmicParametersDefinerForTP")
274  {
275  if(! cosmictpSelector(*tp,&bs,event,setup)) continue;
276  momentumTP = parametersDefinerTP->momentum(event,setup,*tp);
277  vertexTP = parametersDefinerTP->vertex(event,setup,*tp);
278  dxySim = (-vertexTP.x()*sin(momentumTP.phi())+vertexTP.y()*cos(momentumTP.phi()));
279  dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/sqrt(momentumTP.perp2())
280  * momentumTP.z()/sqrt(momentumTP.perp2());
281  }
282  //---------- THE PART ABOVE HAS TO BE CLEANED UP. THE PARAMETER DEFINER WAS NOT MEANT TO BE USED IN THIS WAY ----------
283 
284  st++; //This counter counts the number of simulated tracks passing the MTV selection (i.e. tpSelector(tp) )
285 
286  // in the coming lines, histos are filled using as input
287  // - momentumTP
288  // - vertexTP
289  // - dxySim
290  // - dzSim
291 
293 
294 
295  // ##############################################
296  // fill RecoAssociated SimTracks' histograms
297  // ##############################################
298  // bool isRecoMatched(false); // UNUSED
299  const reco::Track* matchedTrackPointer=0;
300  std::vector<std::pair<RefToBase<Track>, double> > rt;
301  if(simRecColl.find(tpr) != simRecColl.end()){
302  rt = (std::vector<std::pair<RefToBase<Track>, double> >) simRecColl[tpr];
303  if (rt.size()!=0) {
304  ats++; //This counter counts the number of simTracks that have a recoTrack associated
305  // isRecoMatched = true; // UNUSED
306  matchedTrackPointer = rt.begin()->first.get();
307  edm::LogVerbatim("TrackValidator") << "TrackingParticle #" << st
308  << " with pt=" << sqrt(momentumTP.perp2())
309  << " associated with quality:" << rt.begin()->second <<"\n";
310  }
311  }else{
312  edm::LogVerbatim("TrackValidator")
313  << "TrackingParticle #" << st
314  << " with pt,eta,phi: "
315  << sqrt(momentumTP.perp2()) << " , "
316  << momentumTP.eta() << " , "
317  << momentumTP.phi() << " , "
318  << " NOT associated to any reco::Track" << "\n";
319  }
320 
321 
322 
323 
324  std::vector<PSimHit> simhits=tp->trackPSimHit(DetId::Tracker);
325  int nSimHits = simhits.end()-simhits.begin();
326 
327  double vtx_z_PU = vertexTP.z();
328  for (size_t j = 0; j < tv.size(); j++) {
329  if (tp->eventId().event() == tv[j].eventId().event()) {
330  vtx_z_PU = tv[j].position().z();
331  break;
332  }
333  }
334 
335  histoProducerAlgo_->fill_recoAssociated_simTrack_histos(w,*tp,momentumTP,vertexTP,dxySim,dzSim,nSimHits,matchedTrackPointer,puinfo.getPU_NumInteractions(), vtx_z_PU);
336  sts++;
337  if (matchedTrackPointer) asts++;
338 
339 
340 
341 
342  } // End for (TrackingParticleCollection::size_type i=0; i<tPCeff.size(); i++){
343 
344  //if (st!=0) h_tracksSIM[w]->Fill(st); // TO BE FIXED
345 
346 
347  // ##############################################
348  // fill recoTracks histograms (LOOP OVER TRACKS)
349  // ##############################################
350  edm::LogVerbatim("TrackValidator") << "\n# of reco::Tracks with "
351  << label[www].process()<<":"
352  << label[www].label()<<":"
353  << label[www].instance()
354  << ": " << trackCollection->size() << "\n";
355 
356  int sat(0); //This counter counts the number of recoTracks that are associated to SimTracks from Signal only
357  int at(0); //This counter counts the number of recoTracks that are associated to SimTracks
358  int rT(0); //This counter counts the number of recoTracks in general
359 
360 
361  // dE/dx
362  // at some point this could be generalized, with a vector of tags and a corresponding vector of Handles
363  // I'm writing the interface such to take vectors of ValueMaps
366  std::vector<edm::ValueMap<reco::DeDxData> > v_dEdx;
367  v_dEdx.clear();
368  //std::cout << "PIPPO: label is " << label[www] << std::endl;
369  if (label[www].label()=="generalTracks") {
370  try {
371  event.getByLabel(m_dEdx1Tag, dEdx1Handle);
372  const edm::ValueMap<reco::DeDxData> dEdx1 = *dEdx1Handle.product();
373  event.getByLabel(m_dEdx2Tag, dEdx2Handle);
374  const edm::ValueMap<reco::DeDxData> dEdx2 = *dEdx2Handle.product();
375  v_dEdx.push_back(dEdx1);
376  v_dEdx.push_back(dEdx2);
377  } catch (cms::Exception e){
378  LogTrace("TrackValidator") << "exception found: " << e.what() << "\n";
379  }
380  }
381  //end dE/dx
382 
383  for(View<Track>::size_type i=0; i<trackCollection->size(); ++i){
384 
385  RefToBase<Track> track(trackCollection, i);
386  rT++;
387 
388  bool isSigSimMatched(false);
389  bool isSimMatched(false);
390  bool isChargeMatched(true);
391  int numAssocRecoTracks = 0;
392  int tpbx = 0;
393  int nSimHits = 0;
394  double sharedFraction = 0.;
395  std::vector<std::pair<TrackingParticleRef, double> > tp;
396  if(recSimColl.find(track) != recSimColl.end()){
397  tp = recSimColl[track];
398  if (tp.size()!=0) {
399  std::vector<PSimHit> simhits=tp[0].first->trackPSimHit(DetId::Tracker);
400  nSimHits = simhits.end()-simhits.begin();
401  sharedFraction = tp[0].second;
402  isSimMatched = true;
403  if (tp[0].first->charge() != track->charge()) isChargeMatched = false;
404  if(simRecColl.find(tp[0].first) != simRecColl.end()) numAssocRecoTracks = simRecColl[tp[0].first].size();
405  //std::cout << numAssocRecoTracks << std::endl;
406  tpbx = tp[0].first->eventId().bunchCrossing();
407  at++;
408  for (unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
409  TrackingParticle trackpart = *(tp[tp_ite].first);
410  if ((trackpart.eventId().event() == 0) && (trackpart.eventId().bunchCrossing() == 0)){
411  isSigSimMatched = true;
412  sat++;
413  break;
414  }
415  }
416  edm::LogVerbatim("TrackValidator") << "reco::Track #" << rT << " with pt=" << track->pt()
417  << " associated with quality:" << tp.begin()->second <<"\n";
418  }
419  } else {
420  edm::LogVerbatim("TrackValidator") << "reco::Track #" << rT << " with pt=" << track->pt()
421  << " NOT associated to any TrackingParticle" << "\n";
422  }
423 
424 
425  histoProducerAlgo_->fill_generic_recoTrack_histos(w,*track,bs.position(),isSimMatched,isSigSimMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), tpbx, nSimHits, sharedFraction);
426 
427  // dE/dx
428  // reco::TrackRef track2 = reco::TrackRef( trackCollection, i );
429  if (v_dEdx.size() > 0) histoProducerAlgo_->fill_dedx_recoTrack_histos(w,track, v_dEdx);
430  //if (v_dEdx.size() > 0) histoProducerAlgo_->fill_dedx_recoTrack_histos(track2, v_dEdx);
431 
432 
433  //Fill other histos
434  //try{ //Is this really necessary ????
435 
436  if (tp.size()==0) continue;
437 
439 
440  TrackingParticleRef tpr = tp.begin()->first;
441 
442  /* TO BE FIXED LATER
443  if (associators[ww]=="TrackAssociatorByChi2"){
444  //association chi2
445  double assocChi2 = -tp.begin()->second;//in association map is stored -chi2
446  h_assochi2[www]->Fill(assocChi2);
447  h_assochi2_prob[www]->Fill(TMath::Prob((assocChi2)*5,5));
448  }
449  else if (associators[ww]=="quickTrackAssociatorByHits"){
450  double fraction = tp.begin()->second;
451  h_assocFraction[www]->Fill(fraction);
452  h_assocSharedHit[www]->Fill(fraction*track->numberOfValidHits());
453  }
454  */
455 
456 
457  //Get tracking particle parameters at point of closest approach to the beamline
458  ParticleBase::Vector momentumTP = parametersDefinerTP->momentum(event,setup,*(tpr.get()));
459  ParticleBase::Point vertexTP = parametersDefinerTP->vertex(event,setup,*(tpr.get()));
460  int chargeTP = tpr->charge();
461 
462  histoProducerAlgo_->fill_ResoAndPull_recoTrack_histos(w,momentumTP,vertexTP,chargeTP,
463  *track,bs.position());
464 
465 
466  //TO BE FIXED
467  //std::vector<PSimHit> simhits=tpr.get()->trackPSimHit(DetId::Tracker);
468  //nrecHit_vs_nsimHit_rec2sim[w]->Fill(track->numberOfValidHits(), (int)(simhits.end()-simhits.begin() ));
469 
470  /*
471  } // End of try{
472  catch (cms::Exception e){
473  LogTrace("TrackValidator") << "exception found: " << e.what() << "\n";
474  }
475  */
476 
477  } // End of for(View<Track>::size_type i=0; i<trackCollection->size(); ++i){
478 
480 
481  edm::LogVerbatim("TrackValidator") << "Total Simulated: " << st << "\n"
482  << "Total Associated (simToReco): " << ats << "\n"
483  << "Total Reconstructed: " << rT << "\n"
484  << "Total Associated (recoToSim): " << at << "\n"
485  << "Total Fakes: " << rT-at << "\n";
486 
487  w++;
488  } // End of for (unsigned int www=0;www<label.size();www++){
489  } //END of for (unsigned int ww=0;ww<associators.size();ww++){
490 
491 }
virtual char const * what() const
Definition: Exception.cc:141
int i
Definition: DBlmapReader.cc:9
int event() const
get the contents of the subdetector field (should be protected?)
CosmicTrackingParticleSelector cosmictpSelector
std::vector< TrackingParticle > TrackingParticleCollection
const_iterator end() const
last iterator over the map (read only)
virtual void fill_dedx_recoTrack_histos(int count, edm::RefToBase< reco::Track > &trackref, std::vector< edm::ValueMap< reco::DeDxData > > v_dEdx)=0
const std::vector< PSimHit > & trackPSimHit() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< const TrackAssociatorBase * > associator
math::XYZVectorD Vector
point in the space
Definition: ParticleBase.h:30
virtual void fill_generic_simTrack_histos(int counter, ParticleBase::Vector, ParticleBase::Point vertex, int bx)=0
virtual void fill_recoAssociated_simTrack_histos(int count, const TrackingParticle &tp, ParticleBase::Vector momentumTP, ParticleBase::Point vertexTP, double dxy, double dz, int nSimHits, const reco::Track *track, int numVertices, double vertz)=0
uint16_t size_type
virtual void fill_ResoAndPull_recoTrack_histos(int count, ParticleBase::Vector momentumTP, ParticleBase::Point vertexTP, int chargeTP, const reco::Track &track, math::XYZPoint bsPosition)=0
virtual void fill_generic_recoTrack_histos(int count, const reco::Track &track, math::XYZPoint bsPosition, bool isMatched, bool isSigMatched, bool isChargeMatched, int numAssocRecoTracks, int numVertices, int tpbunchcrossing, int nSimHits, double sharedFraction)=0
math::XYZPointD Point
point in the space
Definition: ParticleBase.h:28
std::vector< edm::InputTag > label
T sqrt(T t)
Definition: SSEVec.h:46
int bunchCrossing() const
get the detector field from this detid
TrackingParticleSelector tpSelector
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::InputTag associatormap
unsigned int size_type
Definition: View.h:85
int j
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
#define LogTrace(id)
MTVHistoProducerAlgo * histoProducerAlgo_
virtual void fill_simAssociated_recoTrack_histos(int count, const reco::Track &track)=0
std::vector< TrackingVertex > TrackingVertexCollection
const T & get() const
Definition: EventSetup.h:55
virtual void fill_trackBased_histos(int count, int assTracks, int numRecoTracks, int numSimTracks)=0
Vector momentum() const
spatial momentum vector
Definition: ParticleBase.h:86
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:25
EncodedEventId eventId() const
std::string const & process() const
Definition: InputTag.h:29
std::vector< std::string > associators
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
const Point & vertex() const
vertex position
Definition: ParticleBase.h:228
std::string const & instance() const
Definition: InputTag.h:26
tuple size
Write out results.
T w() const
list at
Definition: asciidump.py:428
void MultiTrackValidator::beginRun ( edm::Run const &  ,
edm::EventSetup const &  setup 
)
virtual

Method called before the event loop.

Reimplemented from edm::EDAnalyzer.

Definition at line 92 of file MultiTrackValidator.cc.

References algo, MultiTrackValidatorBase::associator, MultiTrackValidatorBase::associators, MTVHistoProducerAlgo::bookRecoHistos(), MTVHistoProducerAlgo::bookRecoHistosForStandaloneRunning(), MTVHistoProducerAlgo::bookSimHistos(), DQMStore::cd(), MultiTrackValidatorBase::dbe_, TrackerOfflineValidation_Dqm_cff::dirName, dirName_, edm::EventSetup::get(), DQMStore::goUp(), histoProducerAlgo_, MTVHistoProducerAlgo::initialize(), edm::InputTag::instance(), edm::InputTag::label(), MultiTrackValidatorBase::label, edm::InputTag::process(), edm::ESHandle< class >::product(), linker::replace(), runStandalone, DQMStore::setCurrentFolder(), UseAssociators, and w().

92  {
93  // dbe_->showDirStructure();
94 
95  //int j=0; //is This Necessary ???
96  for (unsigned int ww=0;ww<associators.size();ww++){
97  for (unsigned int www=0;www<label.size();www++){
98  dbe_->cd();
99  InputTag algo = label[www];
100  string dirName=dirName_;
101  if (algo.process()!="")
102  dirName+=algo.process()+"_";
103  if(algo.label()!="")
104  dirName+=algo.label()+"_";
105  if(algo.instance()!="")
106  dirName+=algo.instance()+"_";
107  if (dirName.find("Tracks")<dirName.length()){
108  dirName.replace(dirName.find("Tracks"),6,"");
109  }
110  string assoc= associators[ww];
111  if (assoc.find("Track")<assoc.length()){
112  assoc.replace(assoc.find("Track"),5,"");
113  }
114  dirName+=assoc;
115  std::replace(dirName.begin(), dirName.end(), ':', '_');
116 
117  dbe_->setCurrentFolder(dirName.c_str());
118 
119  // vector of vector initialization
120  histoProducerAlgo_->initialize(); //TO BE FIXED. I'D LIKE TO AVOID THIS CALL
121 
122  dbe_->goUp(); //Is this really necessary ???
123  string subDirName = dirName + "/simulation";
124  dbe_->setCurrentFolder(subDirName.c_str());
125 
126  //Booking histograms concerning with simulated tracks
128 
129  dbe_->cd();
130  dbe_->setCurrentFolder(dirName.c_str());
131 
132  //Booking histograms concerning with reconstructed tracks
135 
136  if (UseAssociators) {
138  for (unsigned int w=0;w<associators.size();w++) {
139  setup.get<TrackAssociatorRecord>().get(associators[w],theAssociator);
140  associator.push_back( theAssociator.product() );
141  }//end loop w
142  }
143  }//end loop www
144  }// end loop ww
145 }
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:406
std::vector< const TrackAssociatorBase * > associator
virtual void bookSimHistos()=0
def replace
Definition: linker.py:10
virtual void bookRecoHistos()=0
std::vector< edm::InputTag > label
virtual void initialize()=0
MTVHistoProducerAlgo * histoProducerAlgo_
T const * product() const
Definition: ESHandle.h:62
std::string const & label() const
Definition: InputTag.h:25
std::string const & process() const
Definition: InputTag.h:29
virtual void bookRecoHistosForStandaloneRunning()=0
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:440
std::vector< std::string > associators
LimitAlgo * algo
Definition: Combine.cc:60
std::string const & instance() const
Definition: InputTag.h:26
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
T w() const
void MultiTrackValidator::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
virtual

Method called at the end of the event loop.

Reimplemented from edm::EDAnalyzer.

Definition at line 493 of file MultiTrackValidator.cc.

References MultiTrackValidatorBase::associators, MultiTrackValidatorBase::dbe_, MTVHistoProducerAlgo::fillHistosFromVectors(), MTVHistoProducerAlgo::fillProfileHistosFromVectors(), MTVHistoProducerAlgo::finalHistoFits(), histoProducerAlgo_, MultiTrackValidatorBase::label, MultiTrackValidatorBase::out, runStandalone, DQMStore::save(), MultiTrackValidatorBase::skipHistoFit, and w().

493  {
494  int w=0;
495  for (unsigned int ww=0;ww<associators.size();ww++){
496  for (unsigned int www=0;www<label.size();www++){
500  w++;
501  }
502  }
503  if ( out.size() != 0 && dbe_ ) dbe_->save(out);
504 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
std::vector< edm::InputTag > label
virtual void fillProfileHistosFromVectors(int counter)=0
virtual void finalHistoFits(int counter)=0
MTVHistoProducerAlgo * histoProducerAlgo_
virtual void fillHistosFromVectors(int counter)=0
std::vector< std::string > associators
T w() const

Member Data Documentation

edm::InputTag MultiTrackValidator::associatormap
private

Definition at line 37 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

CosmicTrackingParticleSelector MultiTrackValidator::cosmictpSelector
private

Definition at line 48 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

std::string MultiTrackValidator::dirName_
private

Definition at line 36 of file MultiTrackValidator.h.

Referenced by beginRun(), and MultiTrackValidator().

MTVHistoProducerAlgo* MultiTrackValidator::histoProducerAlgo_
private
bool MultiTrackValidator::runStandalone
private

Definition at line 44 of file MultiTrackValidator.h.

Referenced by beginRun(), endRun(), and MultiTrackValidator().

TrackingParticleSelector MultiTrackValidator::tpSelector
private

Definition at line 47 of file MultiTrackValidator.h.

Referenced by analyze(), and MultiTrackValidator().

bool MultiTrackValidator::UseAssociators
private

Definition at line 38 of file MultiTrackValidator.h.

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

bool MultiTrackValidator::useGsf
private

Definition at line 43 of file MultiTrackValidator.h.

Referenced by MultiTrackValidator().