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:
DQMEDAnalyzer MultiTrackValidatorBase edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 Method called once per event. More...
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 Method called to book the DQM histograms. More...
 
 TrackerSeedValidator (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~TrackerSeedValidator ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::vector< edm::EDGetTokenT
< reco::TrackToTrackingParticleAssociator > > 
associatorTokens
 
std::string builderName
 
CosmicTrackingParticleSelector cosmictpSelector
 
std::string dirName_
 
MTVHistoProducerAlgohistoProducerAlgo_
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theTTRHBuilder
 
TrackingParticleSelector tpSelector
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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< edm::InputTagassociators
 
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
< edm::ValueMap
< reco::DeDxData > > 
m_dEdx1Tag
 
edm::EDGetTokenT
< edm::ValueMap
< reco::DeDxData > > 
m_dEdx2Tag
 
std::string parametersDefiner
 
std::vector< edm::EDGetTokenT
< std::vector< PSimHit > > > 
simHitTokens_
 
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 36 of file TrackerSeedValidator.cc.

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

37  //theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet, consumesCollector());
38 
39  ParameterSet psetForHistoProducerAlgo = pset.getParameter<ParameterSet>("histoProducerAlgoBlock");
40  string histoProducerAlgoName = psetForHistoProducerAlgo.getParameter<string>("ComponentName");
41  histoProducerAlgo_ = MTVHistoProducerAlgoFactory::get()->create(histoProducerAlgoName ,psetForHistoProducerAlgo, consumesCollector());
42 
43  dirName_ = pset.getParameter<std::string>("dirName");
44 
45  tpSelector = TrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
46  pset.getParameter<double>("minRapidityTP"),
47  pset.getParameter<double>("maxRapidityTP"),
48  pset.getParameter<double>("tipTP"),
49  pset.getParameter<double>("lipTP"),
50  pset.getParameter<int>("minHitTP"),
51  pset.getParameter<bool>("signalOnlyTP"),
52  pset.getParameter<bool>("chargedOnlyTP"),
53  pset.getParameter<bool>("stableOnlyTP"),
54  pset.getParameter<std::vector<int> >("pdgIdTP"));
55 
56  builderName = pset.getParameter<std::string>("TTRHBuilder");
57 
58  for (auto const& associator: associators) {
59  associatorTokens.push_back(consumes<reco::TrackToTrackingParticleAssociator>(associator));
60  }
61 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > associators
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
std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associatorTokens
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 
)
overridevirtual

Method called once per event.

Implements edm::stream::EDAnalyzerBase.

Definition at line 110 of file TrackerSeedValidator.cc.

References reco::TrackBase::appendHits(), reco::TrackToTrackingParticleAssociator::associateRecoToSim(), reco::TrackToTrackingParticleAssociator::associateSimToReco(), MultiTrackValidatorBase::associators, associatorTokens, asciidump::at, MultiTrackValidatorBase::bsSrc, EncodedEventId::bunchCrossing(), TrackingParticleNumberOfLayers::calculate(), LocalTrajectoryParameters::charge(), funct::cos(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, 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_simTrackBased_histos(), MTVHistoProducerAlgo::fill_trackBased_histos(), edm::AssociationMap< Tag >::find(), plotBeamSpotDB::first, TrajectoryStateOnSurface::freeState(), PerigeeConversions::ftsToPerigeeError(), edm::EventSetup::get(), PileupSummaryInfo::getPU_NumInteractions(), histoProducerAlgo_, i, 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, MultiTrackValidatorBase::simHitTokens_, funct::sin(), findQualityFiles::size, mathSSE::sqrt(), TrajectorySeed::startingState(), MultiTrackValidatorBase::theMF, theTTRHBuilder, tpSelector, trajectoryStateTransform::transientState(), w, and cms::Exception::what().

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

Method called to book the DQM histograms.

Implements DQMEDAnalyzer.

Definition at line 65 of file TrackerSeedValidator.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, MultiTrackValidatorBase::associators, MTVHistoProducerAlgo::bookRecoHistos(), MTVHistoProducerAlgo::bookSimHistos(), MTVHistoProducerAlgo::bookSimTrackHistos(), builderName, DQMStore::IBooker::cd(), TrackerOfflineValidation_Dqm_cff::dirName, dirName_, edm::EventSetup::get(), histoProducerAlgo_, edm::InputTag::instance(), edm::InputTag::label(), MultiTrackValidatorBase::label, edm::InputTag::process(), python.rootplot.root2matplotlib::replace(), DQMStore::IBooker::setCurrentFolder(), MultiTrackValidatorBase::theMF, and theTTRHBuilder.

65  {
68 
69  for (unsigned int ww=0;ww<associators.size();ww++){
70  for (unsigned int www=0;www<label.size();www++){
71 
72  ibook.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].label();;
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  ibook.setCurrentFolder(dirName.c_str());
92 
93  string subDirName = dirName + "/simulation";
94  ibook.setCurrentFolder(subDirName.c_str());
95 
96  //Booking histograms concerning with simulated tracks
98 
99  ibook.cd();
100  ibook.setCurrentFolder(dirName.c_str());
101 
102  //Booking histograms concerning with reconstructed tracks
105  }//end loop www
106  }// end loop ww
107 }
std::vector< edm::InputTag > associators
void cd(void)
Definition: DQMStore.cc:266
std::vector< edm::InputTag > label
virtual void bookRecoHistos(DQMStore::IBooker &ibook)=0
virtual void bookSimHistos(DQMStore::IBooker &ibook)=0
virtual void bookSimTrackHistos(DQMStore::IBooker &ibook)=0
edm::ESHandle< TransientTrackingRecHitBuilder > theTTRHBuilder
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
std::string const & label() const
Definition: InputTag.h:43
std::string const & process() const
Definition: InputTag.h:47
MTVHistoProducerAlgo * histoProducerAlgo_
std::string const & instance() const
Definition: InputTag.h:44
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
edm::ESHandle< MagneticField > theMF

Member Data Documentation

std::vector<edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> > TrackerSeedValidator::associatorTokens
private

Definition at line 33 of file TrackerSeedValidator.h.

Referenced by analyze(), and TrackerSeedValidator().

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 42 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
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 41 of file TrackerSeedValidator.h.

Referenced by analyze(), and TrackerSeedValidator().