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
TrackerSeedValidator Class Reference

#include <TrackerSeedValidator.h>

Inheritance diagram for TrackerSeedValidator:
edm::EDAnalyzer MultiTrackValidatorBase edm::EDConsumerBase

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...
 
 TrackerSeedValidator (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~TrackerSeedValidator ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::string builderName
 
CosmicTrackingParticleSelector cosmictpSelector
 
std::string dirName_
 
MTVHistoProducerAlgohistoProducerAlgo_
 
bool runStandalone
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theTTRHBuilder
 
TrackingParticleSelector tpSelector
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Member Functions inherited from MultiTrackValidatorBase
 MultiTrackValidatorBase (const edm::ParameterSet &pset)
 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

Author
cerati

Definition at line 18 of file TrackerSeedValidator.h.

Constructor & Destructor Documentation

TrackerSeedValidator::TrackerSeedValidator ( const edm::ParameterSet pset)

Constructor.

Definition at line 37 of file TrackerSeedValidator.cc.

References builderName, edm::EDConsumerBase::consumesCollector(), MultiTrackValidatorBase::dbe_, dirName_, reco::get(), edm::ParameterSet::getParameter(), histoProducerAlgo_, runStandalone, AlCaHLTBitMon_QueryRunRegistry::string, and tpSelector.

38  //theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet, consumesCollector());
39 
40  ParameterSet psetForHistoProducerAlgo = pset.getParameter<ParameterSet>("histoProducerAlgoBlock");
41  string histoProducerAlgoName = psetForHistoProducerAlgo.getParameter<string>("ComponentName");
42  histoProducerAlgo_ = MTVHistoProducerAlgoFactory::get()->create(histoProducerAlgoName ,psetForHistoProducerAlgo, consumesCollector());
43  histoProducerAlgo_->setDQMStore(dbe_);
44 
45  dirName_ = pset.getParameter<std::string>("dirName");
46 
47  tpSelector = TrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
48  pset.getParameter<double>("minRapidityTP"),
49  pset.getParameter<double>("maxRapidityTP"),
50  pset.getParameter<double>("tipTP"),
51  pset.getParameter<double>("lipTP"),
52  pset.getParameter<int>("minHitTP"),
53  pset.getParameter<bool>("signalOnlyTP"),
54  pset.getParameter<bool>("chargedOnlyTP"),
55  pset.getParameter<bool>("stableOnlyTP"),
56  pset.getParameter<std::vector<int> >("pdgIdTP"));
57 
58  runStandalone = pset.getParameter<bool>("runStandalone");
59 
60  builderName = pset.getParameter<std::string>("TTRHBuilder");
61 }
T getParameter(std::string const &) const
MultiTrackValidatorBase(const edm::ParameterSet &pset)
Constructor.
TrackingParticleSelector tpSelector
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
MTVHistoProducerAlgo * histoProducerAlgo_
T get(const Candidate &c)
Definition: component.h:55
TrackerSeedValidator::~TrackerSeedValidator ( )
virtual

Destructor.

Definition at line 63 of file TrackerSeedValidator.cc.

References histoProducerAlgo_.

63 {delete histoProducerAlgo_;}
MTVHistoProducerAlgo * histoProducerAlgo_

Member Function Documentation

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

Method called once per event.

Implements edm::EDAnalyzer.

Definition at line 119 of file TrackerSeedValidator.cc.

References MultiTrackValidatorBase::associator, MultiTrackValidatorBase::associators, asciidump::at, MultiTrackValidatorBase::bsSrc, EncodedEventId::bunchCrossing(), LocalTrajectoryParameters::charge(), funct::cos(), alignCSCRings::e, edm::AssociationMap< Tag >::end(), EncodedEventId::event(), TrackingParticle::eventId(), 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, TrajectoryStateOnSurface::freeState(), PerigeeConversions::ftsToPerigeeError(), edm::EventSetup::get(), PileupSummaryInfo::getPU_NumInteractions(), histoProducerAlgo_, i, j, MultiTrackValidatorBase::label, MultiTrackValidatorBase::label_pileupinfo, MultiTrackValidatorBase::label_tp_effic, MultiTrackValidatorBase::label_tp_fake, MultiTrackValidatorBase::label_tv, LogTrace, PTrajectoryStateOnDet::parameters(), MultiTrackValidatorBase::parametersDefiner, reco::BeamSpot::position(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), TrajectorySeed::recHits(), reco::TrackBase::setHitPattern(), funct::sin(), findQualityFiles::size, mathSSE::sqrt(), TrajectorySeed::startingState(), MultiTrackValidatorBase::theMF, theTTRHBuilder, tpSelector, trajectoryStateTransform::transientState(), w(), and cms::Exception::what().

119  {
120 
121  edm::LogInfo("TrackValidator") << "\n====================================================" << "\n"
122  << "Analyzing new event" << "\n"
123  << "====================================================\n" << "\n";
124 
125  edm::ESHandle<ParametersDefinerForTP> parametersDefinerTP;
126  setup.get<TrackAssociatorRecord>().get(parametersDefiner,parametersDefinerTP);
127 
128  edm::Handle<TrackingParticleCollection> TPCollectionHeff ;
129  event.getByLabel(label_tp_effic,TPCollectionHeff);
130  const TrackingParticleCollection tPCeff = *(TPCollectionHeff.product());
131 
132  edm::Handle<TrackingParticleCollection> TPCollectionHfake ;
133  event.getByLabel(label_tp_fake,TPCollectionHfake);
134  const TrackingParticleCollection tPCfake = *(TPCollectionHfake.product());
135 
136  if (tPCeff.size()==0) {edm::LogInfo("TrackValidator") << "TP Collection for efficiency studies has size = 0! Skipping Event." ; return;}
137  if (tPCfake.size()==0) {edm::LogInfo("TrackValidator") << "TP Collection for fake rate studies has size = 0! Skipping Event." ; return;}
138 
139  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
140  event.getByLabel(bsSrc,recoBeamSpotHandle);
141  reco::BeamSpot bs = *recoBeamSpotHandle;
142 
144  event.getByLabel(label_pileupinfo,puinfoH);
145  PileupSummaryInfo puinfo;
146 
147  for (unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
148  if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
149  puinfo=(*puinfoH)[puinfo_ite];
150  break;
151  }
152  }
153 
155  event.getByLabel(label_tv,tvH);
156  TrackingVertexCollection tv = *tvH;
157 
158  int w=0;
159  for (unsigned int ww=0;ww<associators.size();ww++){
160  for (unsigned int www=0;www<label.size();www++){
161  edm::LogVerbatim("TrackValidator") << "Analyzing "
162  << label[www].process()<<":"
163  << label[www].label()<<":"
164  << label[www].instance()<<" with "
165  << associators[ww].c_str() <<"\n";
166  //
167  //get collections from the event
168  //
169  edm::Handle<edm::View<TrajectorySeed> > seedCollection;
170  event.getByLabel(label[www], seedCollection);
171  if (seedCollection->size()==0) {
172  edm::LogInfo("TrackValidator") << "SeedCollection size = 0!" ;
173  continue;
174  }
175 
176  //associate seeds
177  LogTrace("TrackValidator") << "Calling associateRecoToSim method" << "\n";
178  reco::RecoToSimCollectionSeed recSimColl=associator[ww]->associateRecoToSim(seedCollection,
179  TPCollectionHfake,
180  &event,&setup);
181  LogTrace("TrackValidator") << "Calling associateSimToReco method" << "\n";
182  reco::SimToRecoCollectionSeed simRecColl=associator[ww]->associateSimToReco(seedCollection,
183  TPCollectionHeff,
184  &event,&setup);
185 
186  //
187  //fill simulation histograms
188  //compute number of seeds per eta interval
189  //
190  edm::LogVerbatim("TrackValidator") << "\n# of TrackingParticles: " << tPCeff.size() << "\n";
191  int ats(0); //This counter counts the number of simTracks that are "associated" to recoTracks
192  int st(0); //This counter counts the number of simulated tracks passing the MTV selection (i.e. tpSelector(tp) )
193  unsigned sts(0); //This counter counts the number of simTracks surviving the bunchcrossing cut
194  unsigned asts(0); //This counter counts the number of simTracks that are "associated" to recoTracks surviving the bunchcrossing cut
195  for (TrackingParticleCollection::size_type i=0; i<tPCeff.size(); i++){
196  TrackingParticleRef tp(TPCollectionHeff, i);
197 
198  if (tp->charge()==0) continue;
199 
200  if(! tpSelector(*tp)) continue;
201 
202  TrackingParticle::Vector momentumTP = tp->momentum();
203  TrackingParticle::Point vertexTP = tp->vertex();
204  //Calcualte the impact parameters w.r.t. PCA
205  TrackingParticle::Vector momentum = parametersDefinerTP->momentum(event,setup,tp);
206  TrackingParticle::Point vertex = parametersDefinerTP->vertex(event,setup,tp);
207  double dxySim = (-vertex.x()*sin(momentum.phi())+vertex.y()*cos(momentum.phi()));
208  double dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/sqrt(momentum.perp2())
209  * momentum.z()/sqrt(momentum.perp2());
210 
211  st++;
212 
213  histoProducerAlgo_->fill_generic_simTrack_histos(w,momentumTP,vertexTP, tp->eventId().bunchCrossing());
214 
215  const TrajectorySeed* matchedSeedPointer=0;
216  std::vector<std::pair<edm::RefToBase<TrajectorySeed>, double> > rt;
217  if(simRecColl.find(tp) != simRecColl.end()){
218  rt = simRecColl[tp];
219  if (rt.size()!=0) {
220  ats++;
221  matchedSeedPointer = rt.begin()->first.get();
222  edm::LogVerbatim("TrackValidator") << "TrackingParticle #" << st
223  << " with pt=" << sqrt(tp->momentum().perp2())
224  << " associated with quality:" << rt.begin()->second <<"\n";
225  }
226  }else{
227  edm::LogVerbatim("TrackValidator") << "TrackingParticle #" << st
228  << " with pt=" << sqrt(tp->momentum().perp2())
229  << " NOT associated to any TrajectorySeed" << "\n";
230  }
231 
232  int nSimHits = tp->numberOfTrackerHits();
233 
234  double vtx_z_PU = tp->vertex().z();
235  for (size_t j = 0; j < tv.size(); j++) {
236  if (tp->eventId().event() == tv[j].eventId().event()) {
237  vtx_z_PU = tv[j].position().z();
238  break;
239  }
240  }
241 
242 
243  //fixme convert seed into track
244  reco::Track* matchedTrackPointer = 0;
245  if (matchedSeedPointer) {
246  TSCBLBuilderNoMaterial tscblBuilder;
247  TransientTrackingRecHit::RecHitPointer recHit = theTTRHBuilder->build(&*(matchedSeedPointer->recHits().second-1));
248  TrajectoryStateOnSurface state = trajectoryStateTransform::transientState( matchedSeedPointer->startingState(), recHit->surface(), theMF.product());
249  TrajectoryStateClosestToBeamLine tsAtClosestApproachSeed = tscblBuilder(*state.freeState(),bs);//as in TrackProducerAlgorithm
250  if(!(tsAtClosestApproachSeed.isValid())){
251  edm::LogVerbatim("SeedValidator")<<"TrajectoryStateClosestToBeamLine not valid";
252  continue;
253  }
254  const reco::TrackBase::Point vSeed1(tsAtClosestApproachSeed.trackStateAtPCA().position().x(),
255  tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
256  tsAtClosestApproachSeed.trackStateAtPCA().position().z());
257  const reco::TrackBase::Vector pSeed(tsAtClosestApproachSeed.trackStateAtPCA().momentum().x(),
258  tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
259  tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
260  //GlobalPoint vSeed(vSeed1.x()-bs.x0(),vSeed1.y()-bs.y0(),vSeed1.z()-bs.z0());
261  PerigeeTrajectoryError seedPerigeeErrors = PerigeeConversions::ftsToPerigeeError(tsAtClosestApproachSeed.trackStateAtPCA());
262  matchedTrackPointer = new reco::Track(0.,0., vSeed1, pSeed, 1, seedPerigeeErrors.covarianceMatrix());
263  matchedTrackPointer->setHitPattern(matchedSeedPointer->recHits().first,matchedSeedPointer->recHits().second);
264  }
265 
266  histoProducerAlgo_->fill_recoAssociated_simTrack_histos(w,*tp,tp->momentum(),tp->vertex(),dxySim,dzSim,nSimHits,
267  matchedTrackPointer,puinfo.getPU_NumInteractions(), vtx_z_PU);
268 
269  sts++;
270  if (matchedTrackPointer) asts++;
271 
272  } // End for (TrackingParticleCollection::size_type i=0; i<tPCeff.size(); i++){
273 
274  //
275  //fill reconstructed seed histograms
276  //
277  edm::LogVerbatim("TrackValidator") << "\n# of TrajectorySeeds with "
278  << label[www].process()<<":"
279  << label[www].label()<<":"
280  << label[www].instance()
281  << ": " << seedCollection->size() << "\n";
282  int sat(0); //This counter counts the number of recoTracks that are associated to SimTracks from Signal only
283  int at(0); //This counter counts the number of recoTracks that are associated to SimTracks
284  int rT(0); //This counter counts the number of recoTracks in general
285 
286  TSCBLBuilderNoMaterial tscblBuilder;
287  for(TrajectorySeedCollection::size_type i=0; i<seedCollection->size(); ++i){
288  edm::RefToBase<TrajectorySeed> seed(seedCollection, i);
289  rT++;
290 
291  //get parameters and errors from the seed state
292  TransientTrackingRecHit::RecHitPointer recHit = theTTRHBuilder->build(&*(seed->recHits().second-1));
293  TrajectoryStateOnSurface state = trajectoryStateTransform::transientState( seed->startingState(), recHit->surface(), theMF.product());
294  TrajectoryStateClosestToBeamLine tsAtClosestApproachSeed = tscblBuilder(*state.freeState(),bs);//as in TrackProducerAlgorithm
295  if(!(tsAtClosestApproachSeed.isValid())){
296  edm::LogVerbatim("SeedValidator")<<"TrajectoryStateClosestToBeamLine not valid";
297  continue;
298  }
299  const reco::TrackBase::Point vSeed1(tsAtClosestApproachSeed.trackStateAtPCA().position().x(),
300  tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
301  tsAtClosestApproachSeed.trackStateAtPCA().position().z());
302  const reco::TrackBase::Vector pSeed(tsAtClosestApproachSeed.trackStateAtPCA().momentum().x(),
303  tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
304  tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
305  //GlobalPoint vSeed(vSeed1.x()-bs.x0(),vSeed1.y()-bs.y0(),vSeed1.z()-bs.z0());
306  PerigeeTrajectoryError seedPerigeeErrors = PerigeeConversions::ftsToPerigeeError(tsAtClosestApproachSeed.trackStateAtPCA());
307 
308  //fixme
309  reco::Track* trackFromSeed = new reco::Track(0.,0., vSeed1, pSeed, 1, seedPerigeeErrors.covarianceMatrix());
310  trackFromSeed->setHitPattern(seed->recHits().first,seed->recHits().second);
311 
312  bool isSigSimMatched(false);
313  bool isSimMatched(false);
314  bool isChargeMatched(true);
315  int numAssocSeeds = 0;
316  int tpbx = 0;
317  int nSimHits = 0;
318  double sharedFraction = 0.;
319  std::vector<std::pair<TrackingParticleRef, double> > tp;
320  if(recSimColl.find(seed) != recSimColl.end()) {
321  tp = recSimColl[seed];
322  if (tp.size()!=0) {
323 
324  nSimHits = tp[0].first->numberOfTrackerHits();
325  sharedFraction = tp[0].second;
326  isSimMatched = true;
327  if (tp[0].first->charge() != seed->startingState().parameters().charge()) isChargeMatched = false;
328  if(simRecColl.find(tp[0].first) != simRecColl.end()) numAssocSeeds = simRecColl[tp[0].first].size();
329  //std::cout << numAssocRecoTracks << std::endl;
330  tpbx = tp[0].first->eventId().bunchCrossing();
331 
332  at++;
333 
334  for (unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
335  TrackingParticle trackpart = *(tp[tp_ite].first);
336  if ((trackpart.eventId().event() == 0) && (trackpart.eventId().bunchCrossing() == 0)){
337  isSigSimMatched = true;
338  sat++;
339  break;
340  }
341  }
342 
343 
344  edm::LogVerbatim("SeedValidator") << "TrajectorySeed #" << rT << " associated with quality:" << tp.begin()->second <<"\n";
345  }
346  } else {
347  edm::LogVerbatim("SeedValidator") << "TrajectorySeed #" << rT << " NOT associated to any TrackingParticle" << "\n";
348  }
349 
350  histoProducerAlgo_->fill_generic_recoTrack_histos(w,*trackFromSeed,bs.position(),isSimMatched,isSigSimMatched,
351  isChargeMatched, numAssocSeeds, puinfo.getPU_NumInteractions(),
352  tpbx, nSimHits, sharedFraction);
353 
354  //Fill other histos
355  try{
356  if (tp.size()==0) continue;
357 
359 
360  TrackingParticleRef tpr = tp.begin()->first;
361 
362  //compute tracking particle parameters at point of closest approach to the beamline
363  TrackingParticle::Vector momentumTP = parametersDefinerTP->momentum(event,setup,tpr);
364  TrackingParticle::Point vertexTP = parametersDefinerTP->vertex(event,setup,tpr);
365 
366  // LogTrace("SeedValidatorTEST") << "assocChi2=" << tp.begin()->second << "\n"
367  // << "" << "\n"
368  // << "ptREC=" << ptSeed << "\n"
369  // << "etaREC=" << etaSeed << "\n"
370  // << "qoverpREC=" << qoverpSeed << "\n"
371  // << "dxyREC=" << dxySeed << "\n"
372  // << "dzREC=" << dzSeed << "\n"
373  // << "thetaREC=" << thetaSeed << "\n"
374  // << "phiREC=" << phiSeed << "\n"
375  // << "" << "\n"
376  // << "qoverpError()=" << qoverpErrorSeed << "\n"
377  // << "dxyError()=" << dxyErrorSeed << "\n"
378  // << "dzError()=" << dzErrorSeed << "\n"
379  // << "thetaError()=" << lambdaErrorSeed << "\n"
380  // << "phiError()=" << phiErrorSeed << "\n"
381  // << "" << "\n"
382  // << "ptSIM=" << sqrt(assocTrack->momentum().perp2()) << "\n"
383  // << "etaSIM=" << assocTrack->momentum().Eta() << "\n"
384  // << "qoverpSIM=" << qoverpSim << "\n"
385  // << "dxySIM=" << dxySim << "\n"
386  // << "dzSIM=" << dzSim << "\n"
387  // << "thetaSIM=" << M_PI/2-lambdaSim << "\n"
388  // << "phiSIM=" << phiSim << "\n"
389  // << "" << "\n"
390  // << "contrib_Qoverp=" << contrib_Qoverp << "\n"
391  // << "contrib_dxy=" << contrib_dxy << "\n"
392  // << "contrib_dz=" << contrib_dz << "\n"
393  // << "contrib_theta=" << contrib_theta << "\n"
394  // << "contrib_phi=" << contrib_phi << "\n"
395  // << "" << "\n"
396  // <<"chi2PULL="<<contrib_Qoverp+contrib_dxy+contrib_dz+contrib_theta+contrib_phi<<"\n";
397 
398  histoProducerAlgo_->fill_ResoAndPull_recoTrack_histos(w,momentumTP,vertexTP,tpr->charge(),
399  *trackFromSeed,bs.position());
400 
401 
402  } catch (cms::Exception e){
403  LogTrace("SeedValidator") << "exception found: " << e.what() << "\n";
404  }
405  }// End of for(TrajectorySeedCollection::size_type i=0; i<seedCollection->size(); ++i)
406 
408 
409  edm::LogVerbatim("SeedValidator") << "Total Simulated: " << st << "\n"
410  << "Total Associated (simToReco): " << ats << "\n"
411  << "Total Reconstructed: " << rT << "\n"
412  << "Total Associated (recoToSim): " << at << "\n"
413  << "Total Fakes: " << rT-at << "\n";
414  w++;
415  }
416  }
417 }
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?)
std::vector< TrackingParticle > TrackingParticleCollection
const_iterator end() const
last iterator over the map (read only)
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
virtual void fill_ResoAndPull_recoTrack_histos(int count, const TrackingParticle::Vector &momentumTP, const TrackingParticle::Point &vertexTP, int chargeTP, const reco::Track &track, const math::XYZPoint &bsPosition)=0
uint16_t size_type
TrackingParticleSelector tpSelector
math::XYZPointD Point
point in the space
virtual void fill_recoAssociated_simTrack_histos(int count, const TrackingParticle &tp, const TrackingParticle::Vector &momentumTP, const TrackingParticle::Point &vertexTP, double dxy, double dz, int nSimHits, const reco::Track *track, int numVertices, double vertz)=0
std::vector< edm::InputTag > label
T sqrt(T t)
Definition: SSEVec.h:48
virtual void fill_generic_recoTrack_histos(int count, const reco::Track &track, const math::XYZPoint &bsPosition, bool isMatched, bool isSigMatched, bool isChargeMatched, int numAssocRecoTracks, int numVertices, int tpbunchcrossing, int nSimHits, double sharedFraction)=0
int bunchCrossing() const
get the detector field from this detid
FreeTrajectoryState const * freeState(bool withErrors=true) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int j
Definition: DBlmapReader.cc:9
math::XYZPoint Point
point in the space
Definition: TrackBase.h:74
bool first
Definition: L1TdeRCT.cc:79
edm::ESHandle< TransientTrackingRecHitBuilder > theTTRHBuilder
#define LogTrace(id)
void setHitPattern(const C &c)
set hit patterns from vector of hit references
Definition: TrackBase.h:244
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
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
T const * product() const
Definition: ESHandle.h:62
range recHits() const
virtual void fill_trackBased_histos(int count, int assTracks, int numRecoTracks, int numSimTracks)=0
T const * product() const
Definition: Handle.h:81
const int getPU_NumInteractions() const
EncodedEventId eventId() const
Signal source, crossing number.
Monte Carlo truth information used for tracking validation.
PerigeeTrajectoryError ftsToPerigeeError(const FTS &originalFTS)
const Point & position() const
position
Definition: BeamSpot.h:62
T w() const
std::vector< std::string > associators
math::XYZVectorD Vector
point in the space
MTVHistoProducerAlgo * histoProducerAlgo_
virtual void fill_generic_simTrack_histos(int counter, const TrackingParticle::Vector &, const TrackingParticle::Point &vertex, int bx)=0
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:72
tuple size
Write out results.
edm::ESHandle< MagneticField > theMF
list at
Definition: asciidump.py:428
void TrackerSeedValidator::beginRun ( edm::Run const &  ,
edm::EventSetup const &  setup 
)
virtual

Method called before the event loop.

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file TrackerSeedValidator.cc.

References MultiTrackValidatorBase::associator, MultiTrackValidatorBase::associators, MTVHistoProducerAlgo::bookRecoHistos(), MTVHistoProducerAlgo::bookRecoHistosForStandaloneRunning(), MTVHistoProducerAlgo::bookSimHistos(), builderName, 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(), python.rootplot.root2matplotlib::replace(), runStandalone, DQMStore::setCurrentFolder(), MultiTrackValidatorBase::theMF, theTTRHBuilder, and w().

65  {
68 
69  for (unsigned int ww=0;ww<associators.size();ww++){
70  for (unsigned int www=0;www<label.size();www++){
71 
72  dbe_->cd();
73  InputTag algo = label[www];
74  string dirName=dirName_;
75  if (algo.process()!="")
76  dirName+=algo.process()+"_";
77  if(algo.label()!="")
78  dirName+=algo.label()+"_";
79  if(algo.instance()!="")
80  dirName+=algo.instance()+"_";
81  // if (dirName.find("Seeds")<dirName.length()){
82  // dirName.replace(dirName.find("Seeds"),6,"");
83  // }
84  string assoc= associators[ww];
85  if (assoc.find("Track")<assoc.length()){
86  assoc.replace(assoc.find("Track"),5,"");
87  }
88  dirName+=assoc;
89  std::replace(dirName.begin(), dirName.end(), ':', '_');
90 
91  dbe_->setCurrentFolder(dirName.c_str());
92 
93 
94  // vector of vector initialization
95  histoProducerAlgo_->initialize(); //TO BE FIXED. I'D LIKE TO AVOID THIS CALL
96 
97  dbe_->goUp(); //Is this really necessary ???
98  string subDirName = dirName + "/simulation";
99  dbe_->setCurrentFolder(subDirName.c_str());
100 
101  //Booking histograms concerning with simulated tracks
103 
104  dbe_->cd();
105  dbe_->setCurrentFolder(dirName.c_str());
106 
107  //Booking histograms concerning with reconstructed tracks
110  }//end loop www
112  for (unsigned int w=0;w<associators.size();w++) {
113  setup.get<TrackAssociatorRecord>().get(associators[w],theAssociator);
114  associator.push_back( theAssociator.product() );
115  }//end loop w
116  }// end loop ww
117 }
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:562
std::vector< const TrackAssociatorBase * > associator
virtual void bookSimHistos()=0
virtual void bookRecoHistos()=0
std::vector< edm::InputTag > label
virtual void initialize()=0
edm::ESHandle< TransientTrackingRecHitBuilder > theTTRHBuilder
T const * product() const
Definition: ESHandle.h:62
std::string const & label() const
Definition: InputTag.h:42
std::string const & process() const
Definition: InputTag.h:46
virtual void bookRecoHistosForStandaloneRunning()=0
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:596
T w() const
std::vector< std::string > associators
MTVHistoProducerAlgo * histoProducerAlgo_
std::string const & instance() const
Definition: InputTag.h:43
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:585
edm::ESHandle< MagneticField > theMF
void TrackerSeedValidator::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
virtual

Method called at the end of the event loop.

Reimplemented from edm::EDAnalyzer.

Definition at line 419 of file TrackerSeedValidator.cc.

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

419  {
420  LogTrace("SeedValidator") << "TrackerSeedValidator::endRun()";
421  int w=0;
422  for (unsigned int ww=0;ww<associators.size();ww++){
423  for (unsigned int www=0;www<label.size();www++){
424 
428 
429  w++;
430  }
431  }
432  if ( out.size() != 0 && dbe_ ) dbe_->save(out);
433 }
std::vector< edm::InputTag > label
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2297
virtual void fillProfileHistosFromVectors(int counter)=0
#define LogTrace(id)
virtual void finalHistoFits(int counter)=0
virtual void fillHistosFromVectors(int counter)=0
T w() const
std::vector< std::string > associators
MTVHistoProducerAlgo * histoProducerAlgo_

Member Data Documentation

std::string TrackerSeedValidator::builderName
private

Definition at line 35 of file TrackerSeedValidator.h.

Referenced by beginRun(), and TrackerSeedValidator().

CosmicTrackingParticleSelector TrackerSeedValidator::cosmictpSelector
private

Definition at line 43 of file TrackerSeedValidator.h.

std::string TrackerSeedValidator::dirName_
private

Definition at line 37 of file TrackerSeedValidator.h.

Referenced by beginRun(), and TrackerSeedValidator().

MTVHistoProducerAlgo* TrackerSeedValidator::histoProducerAlgo_
private
bool TrackerSeedValidator::runStandalone
private

Definition at line 39 of file TrackerSeedValidator.h.

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

edm::ESHandle<TransientTrackingRecHitBuilder> TrackerSeedValidator::theTTRHBuilder
private

Definition at line 36 of file TrackerSeedValidator.h.

Referenced by analyze(), and beginRun().

TrackingParticleSelector TrackerSeedValidator::tpSelector
private

Definition at line 42 of file TrackerSeedValidator.h.

Referenced by analyze(), and TrackerSeedValidator().