49 string histoProducerAlgoName = psetForHistoProducerAlgo.
getParameter<
string>(
"ComponentName");
101 if (!UseAssociators) {
114 for (
unsigned int ww=0;ww<
associators.size();ww++){
115 for (
unsigned int www=0;www<
label.size();www++){
122 dirName+=algo.
label()+
"_";
125 if (dirName.find(
"Tracks")<dirName.length()){
126 dirName.replace(dirName.find(
"Tracks"),6,
"");
129 if (assoc.find(
"Track")<assoc.length()){
130 assoc.replace(assoc.find(
"Track"),5,
"");
140 string subDirName = dirName +
"/simulation";
166 using namespace reco;
168 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
169 <<
"Analyzing new event" <<
"\n"
170 <<
"====================================================\n" <<
"\n";
174 auto parametersDefinerTP = parametersDefinerTPHandle->clone();
188 parametersDefinerTP->initEvent(simHitsTPAssoc);
194 event.getByToken(
bsSrc,recoBeamSpotHandle);
201 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
202 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
203 puinfo=(*puinfoH)[puinfo_ite];
215 float dR_tPCeff[(*TPCollectionHeff).size()];
218 float etaL[(*TPCollectionHeff).size()], phiL[(*TPCollectionHeff).size()];
219 bool okL[(*TPCollectionHeff).size()];
220 for (
auto const & tp2 : *TPCollectionHeff) {
224 auto &&
p = tp2.momentum();
225 etaL[
j] = etaFromXYZ(
p.x(),
p.y(),
p.z());
226 phiL[
j] = atan2f(
p.y(),
p.x());
232 for (
auto const & tp : *TPCollectionHeff) {
235 auto &&
p = tp.momentum();
236 float eta = etaFromXYZ(
p.x(),
p.y(),
p.z());
237 float phi = atan2f(
p.y(),
p.x());
238 for (
auto j=0U; j< (*TPCollectionHeff).size(); ++
j ) {
239 if (
i==j) {
continue;}
242 if (dR_tmp<dR) dR=dR_tmp;
254 for (
unsigned int ww=0;ww<
associators.size();ww++){
255 for (
unsigned int www=0;www<
label.size();www++){
270 <<
label[www].process()<<
":"
271 <<
label[www].label()<<
":"
272 <<
label[www].instance()<<
" with "
275 LogTrace(
"TrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
276 recSimCollL = std::move(
associator[ww]->associateRecoToSim(trackCollection,
279 recSimCollP = &recSimCollL;
280 LogTrace(
"TrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
281 simRecCollL = std::move(
associator[ww]->associateSimToReco(trackCollection,
284 simRecCollP = &simRecCollL;
288 <<
label[www].process()<<
":"
289 <<
label[www].label()<<
":"
290 <<
label[www].instance()<<
" with "
297 simRecCollP = simtorecoCollectionH.
product();
301 recSimCollP = recotosimCollectionH.
product();
315 edm::LogVerbatim(
"TrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
327 double dR=dR_tPCeff[
i];
339 dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
340 dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
341 * momentum.z()/
sqrt(momentum.perp2());
347 momentumTP = parametersDefinerTP->momentum(event,setup,tpr);
348 vertexTP = parametersDefinerTP->vertex(event,setup,tpr);
349 dxySim = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
350 dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2())
351 * momentumTP.z()/
sqrt(momentumTP.perp2());
370 if(simRecColl.
find(tpr) != simRecColl.
end()){
371 auto const & rt = simRecColl[tpr];
375 matchedTrackPointer = rt.begin()->first.get();
377 <<
" with pt=" <<
sqrt(momentumTP.perp2())
378 <<
" associated with quality:" << rt.begin()->second <<
"\n";
382 <<
"TrackingParticle #" << st
383 <<
" with pt,eta,phi: "
384 <<
sqrt(momentumTP.perp2()) <<
" , "
385 << momentumTP.eta() <<
" , "
386 << momentumTP.phi() <<
" , "
387 <<
" NOT associated to any reco::Track" <<
"\n";
396 if (matchedTrackPointer) asts++;
410 <<
label[www].process()<<
":"
411 <<
label[www].label()<<
":"
412 <<
label[www].instance()
413 <<
": " << trackCollection->size() <<
"\n";
425 std::vector<edm::ValueMap<reco::DeDxData> > v_dEdx;
433 v_dEdx.push_back(dEdx1);
434 v_dEdx.push_back(dEdx2);
436 LogTrace(
"TrackValidator") <<
"exception found: " << e.
what() <<
"\n";
443 float dR_trk[trackCollection->size()];
445 float etaL[trackCollectionForDrCalculation->size()];
446 float phiL[trackCollectionForDrCalculation->size()];
447 for (
auto const & track2 : *trackCollectionForDrCalculation) {
448 auto &&
p = track2.momentum();
449 etaL[
i] = etaFromXYZ(
p.x(),
p.y(),
p.z());
450 phiL[
i] = atan2f(
p.y(),
p.x());
454 auto const & track = (*trackCollection)[
i];
456 auto &&
p = track.momentum();
457 float eta = etaFromXYZ(
p.x(),
p.y(),
p.z());
458 float phi = atan2f(
p.y(),
p.x());
473 bool isSigSimMatched(
false);
474 bool isSimMatched(
false);
475 bool isChargeMatched(
true);
476 int numAssocRecoTracks = 0;
478 double sharedFraction = 0.;
479 auto const & tp = (recSimColl.
find(track) != recSimColl.
end()) ? recSimColl[track] : dummyTP;
482 nSimHits = tp[0].first->numberOfTrackerHits();
483 sharedFraction = tp[0].second;
485 if (tp[0].
first->charge() != track->
charge()) isChargeMatched =
false;
486 if(simRecColl.
find(tp[0].first) != simRecColl.
end()) numAssocRecoTracks = simRecColl[tp[0].
first].
size();
488 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
491 isSigSimMatched =
true;
496 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
497 <<
" associated with quality:" << tp.begin()->second <<
"\n";
499 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
500 <<
" NOT associated to any TrackingParticle" <<
"\n";
504 histoProducerAlgo_->
fill_generic_recoTrack_histos(
w,*track,bs.position(),isSimMatched,isSigSimMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), nSimHits, sharedFraction,
dR);
515 if (tp.size()==0)
continue;
539 int chargeTP = tpr->charge();
542 *track,bs.position());
561 <<
"Total Associated (simToReco): " << ats <<
"\n"
562 <<
"Total Reconstructed: " << rT <<
"\n"
563 <<
"Total Associated (recoToSim): " << at <<
"\n"
564 <<
"Total Fakes: " << rT-at <<
"\n";
574 for (
unsigned int ww=0;ww<
associators.size();ww++){
575 for (
unsigned int www=0;www<
label.size();www++){
virtual char const * what() const
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx1Tag
edm::EDGetTokenT< SimHitTPAssociationProducer::SimHitTPAssociationList > _simHitTpMapTag
void endRun(edm::Run const &, edm::EventSetup const &)
Method called at the end of the event loop.
int event() const
get the contents of the subdetector field (should be protected?)
bool ignoremissingtkcollection_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > label_pileupinfo
CosmicTrackingParticleSelector cosmictpSelector
std::vector< TrackingParticle > TrackingParticleCollection
const_iterator end() const
last iterator over the map (read only)
edm::EDGetTokenT< TrackingParticleCollection > label_tp_effic
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void fill_dedx_recoTrack_histos(int count, edm::RefToBase< reco::Track > &trackref, const std::vector< edm::ValueMap< reco::DeDxData > > &v_dEdx)=0
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
Sin< T >::type sin(const T &t)
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< const TrackAssociatorBase * > associator
void analyze(const edm::Event &, const edm::EventSetup &)
Method called once per event.
edm::EDGetTokenT< reco::RecoToSimCollection > associatormapRtS
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
virtual void bookRecoHistosForStandaloneRunning(DQMStore::IBooker &ibook)=0
TrackingParticleSelector dRtpSelector
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 dR)=0
edm::EDGetTokenT< reco::SimToRecoCollection > associatormapStR
edm::EDGetTokenT< reco::BeamSpot > bsSrc
math::XYZPointD Point
point in the space
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
std::vector< edm::InputTag > label
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
int bunchCrossing() const
get the detector field from this detid
double pt() const
track transverse momentum
TrackingParticleSelector tpSelector
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< edm::View< reco::Track > > labelTokenForDrCalculation
double deltaR2(const T1 &t1, const T2 &t2)
void initEvent(edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssocToSet) const
virtual void bookRecoHistos(DQMStore::IBooker &ibook)=0
virtual void fillProfileHistosFromVectors(int counter)=0
virtual void initialize()=0
virtual void bookSimHistos(DQMStore::IBooker &ibook)=0
T const * get() const
Returns C++ pointer to the item.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
MultiTrackValidator(const edm::ParameterSet &pset)
Constructor.
ObjectSelector< CosmicTrackingParticleSelector > CosmicTrackingParticleSelector
virtual void finalHistoFits(int counter)=0
edm::InputTag assMapInput
MTVHistoProducerAlgo * histoProducerAlgo_
std::string parametersDefiner
void setCurrentFolder(const std::string &fullpath)
virtual void fill_simAssociated_recoTrack_histos(int count, const reco::Track &track)=0
T const * product() const
T const * product() const
virtual void fill_trackBased_histos(int count, int assTracks, int numRecoTracks, int numSimTracks)=0
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Method called to book the DQM histograms.
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
Vector momentum() const
spatial momentum vector
Monte Carlo truth information used for tracking validation.
int charge() const
track electric charge
std::vector< std::string > associators
int numberOfTrackerHits() const
The number of hits in the tracker. Hits on overlaps in the same layer count separately.
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > labelToken
math::XYZVectorD Vector
point in the space
virtual void fill_generic_simTrack_histos(int counter, const TrackingParticle::Vector &, const TrackingParticle::Point &vertex, int bx)=0
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
T get(const Candidate &c)
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx2Tag
virtual ~MultiTrackValidator()
Destructor.