test
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 bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
 Method called to book the DQM histograms. 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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, edm::ConsumesCollector &&iC, bool isSeed=false)
 Constructor. More...
 
virtual ~MultiTrackValidatorBase ()
 Destructor. More...
 
- Protected Attributes inherited from MultiTrackValidatorBase
std::vector< const
TrackAssociatorBase * > 
associator
 
std::vector< std::string > associators
 
edm::EDGetTokenT< reco::BeamSpotbsSrc
 
bool ignoremissingtkcollection_
 
std::vector< edm::InputTaglabel
 
edm::EDGetTokenT< std::vector
< PileupSummaryInfo > > 
label_pileupinfo
 
edm::EDGetTokenT
< TrackingParticleCollection
label_tp_effic
 
edm::EDGetTokenT
< TrackingParticleCollection
label_tp_fake
 
edm::EDGetTokenT
< TrackingVertexCollection
label_tv
 
std::vector< edm::EDGetTokenT
< edm::View< reco::Track > > > 
labelToken
 
std::vector< edm::EDGetTokenT
< edm::View< TrajectorySeed > > > 
labelTokenSeed
 
edm::EDGetTokenT< reco::DeDxDatam_dEdx1Tag
 
edm::EDGetTokenT< reco::DeDxDatam_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(), 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 
44  dirName_ = pset.getParameter<std::string>("dirName");
45 
46  tpSelector = TrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
47  pset.getParameter<double>("minRapidityTP"),
48  pset.getParameter<double>("maxRapidityTP"),
49  pset.getParameter<double>("tipTP"),
50  pset.getParameter<double>("lipTP"),
51  pset.getParameter<int>("minHitTP"),
52  pset.getParameter<bool>("signalOnlyTP"),
53  pset.getParameter<bool>("chargedOnlyTP"),
54  pset.getParameter<bool>("stableOnlyTP"),
55  pset.getParameter<std::vector<int> >("pdgIdTP"));
56 
57  runStandalone = pset.getParameter<bool>("runStandalone");
58 
59  builderName = pset.getParameter<std::string>("TTRHBuilder");
60 }
T getParameter(std::string const &) const
TrackingParticleSelector tpSelector
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
MultiTrackValidatorBase(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC, bool isSeed=false)
Constructor.
MTVHistoProducerAlgo * histoProducerAlgo_
T get(const Candidate &c)
Definition: component.h:55
TrackerSeedValidator::~TrackerSeedValidator ( )
virtual

Destructor.

Definition at line 62 of file TrackerSeedValidator.cc.

References histoProducerAlgo_.

62 {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 117 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, MultiTrackValidatorBase::labelTokenSeed, LogTrace, PTrajectoryStateOnDet::parameters(), MultiTrackValidatorBase::parametersDefiner, reco::BeamSpot::position(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), TrajectorySeed::recHits(), fileCollector::seed, reco::TrackBase::setHitPattern(), funct::sin(), findQualityFiles::size, mathSSE::sqrt(), TrajectorySeed::startingState(), MultiTrackValidatorBase::theMF, theTTRHBuilder, tpSelector, trajectoryStateTransform::transientState(), w, and cms::Exception::what().

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

Method called to book the DQM histograms.

Definition at line 64 of file TrackerSeedValidator.cc.

References MultiTrackValidatorBase::associator, MultiTrackValidatorBase::associators, MTVHistoProducerAlgo::bookRecoHistos(), MTVHistoProducerAlgo::bookRecoHistosForStandaloneRunning(), MTVHistoProducerAlgo::bookSimHistos(), builderName, DQMStore::IBooker::cd(), TrackerOfflineValidation_Dqm_cff::dirName, dirName_, edm::EventSetup::get(), histoProducerAlgo_, MTVHistoProducerAlgo::initialize(), edm::InputTag::instance(), edm::InputTag::label(), MultiTrackValidatorBase::label, edm::InputTag::process(), edm::ESHandle< class >::product(), python.rootplot.root2matplotlib::replace(), runStandalone, DQMStore::IBooker::setCurrentFolder(), MultiTrackValidatorBase::theMF, theTTRHBuilder, and w.

64  {
67 
68  for (unsigned int ww=0;ww<associators.size();ww++){
69  for (unsigned int www=0;www<label.size();www++){
70 
71  ibook.cd();
72  InputTag algo = label[www];
73  string dirName=dirName_;
74  if (algo.process()!="")
75  dirName+=algo.process()+"_";
76  if(algo.label()!="")
77  dirName+=algo.label()+"_";
78  if(algo.instance()!="")
79  dirName+=algo.instance()+"_";
80  // if (dirName.find("Seeds")<dirName.length()){
81  // dirName.replace(dirName.find("Seeds"),6,"");
82  // }
83  string assoc= associators[ww];
84  if (assoc.find("Track")<assoc.length()){
85  assoc.replace(assoc.find("Track"),5,"");
86  }
87  dirName+=assoc;
88  std::replace(dirName.begin(), dirName.end(), ':', '_');
89 
90  ibook.setCurrentFolder(dirName.c_str());
91 
92  // vector of vector initialization
93  histoProducerAlgo_->initialize(); //TO BE FIXED. I'D LIKE TO AVOID THIS CALL
94 
95  string subDirName = dirName + "/simulation";
96  ibook.setCurrentFolder(subDirName.c_str());
97 
98  //Booking histograms concerning with simulated tracks
100 
101  ibook.cd();
102  ibook.setCurrentFolder(dirName.c_str());
103 
104  //Booking histograms concerning with reconstructed tracks
107  }//end loop www
109  for (unsigned int w=0;w<associators.size();w++) {
110  setup.get<TrackAssociatorRecord>().get(associators[w],theAssociator);
111  associator.push_back( theAssociator.product() );
112  }//end loop w
113  }// end loop ww
114 }
const double w
Definition: UKUtility.cc:23
void cd(void)
Definition: DQMStore.cc:266
std::vector< const TrackAssociatorBase * > associator
virtual void bookRecoHistosForStandaloneRunning(DQMStore::IBooker &ibook)=0
std::vector< edm::InputTag > label
virtual void bookRecoHistos(DQMStore::IBooker &ibook)=0
virtual void initialize()=0
virtual void bookSimHistos(DQMStore::IBooker &ibook)=0
edm::ESHandle< TransientTrackingRecHitBuilder > theTTRHBuilder
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
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
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="")
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 417 of file TrackerSeedValidator.cc.

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

417  {
418  LogTrace("SeedValidator") << "TrackerSeedValidator::endRun()";
419  int w=0;
420  for (unsigned int ww=0;ww<associators.size();ww++){
421  for (unsigned int www=0;www<label.size();www++){
422 
426 
427  w++;
428  }
429  }
430  //if ( out.size() != 0 && dbe_ ) dbe_->save(out);
431 }
const double w
Definition: UKUtility.cc:23
std::vector< edm::InputTag > label
virtual void fillProfileHistosFromVectors(int counter)=0
#define LogTrace(id)
virtual void finalHistoFits(int counter)=0
virtual void fillHistosFromVectors(int counter)=0
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 bookHistograms(), 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 bookHistograms(), and TrackerSeedValidator().

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

Definition at line 39 of file TrackerSeedValidator.h.

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

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

Definition at line 36 of file TrackerSeedValidator.h.

Referenced by analyze(), and bookHistograms().

TrackingParticleSelector TrackerSeedValidator::tpSelector
private

Definition at line 42 of file TrackerSeedValidator.h.

Referenced by analyze(), and TrackerSeedValidator().