47 string histoProducerAlgoName = psetForHistoProducerAlgo.
getParameter<
string>(
"ComponentName");
99 if (!UseAssociators) {
104 consumes<reco::TrackToTrackingParticleAssociator>(
edm::InputTag(associatorName));
116 for (
unsigned int ww=0;ww<
associators.size();ww++){
117 for (
unsigned int www=0;www<
label.size();www++){
124 dirName+=algo.
label()+
"_";
127 if (dirName.find(
"Tracks")<dirName.length()){
128 dirName.replace(dirName.find(
"Tracks"),6,
"");
131 if (assoc.find(
"Track")<assoc.length()){
132 assoc.replace(assoc.find(
"Track"),5,
"");
142 string subDirName = dirName +
"/simulation";
161 using namespace reco;
163 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
164 <<
"Analyzing new event" <<
"\n"
165 <<
"====================================================\n" <<
"\n";
167 std::vector<const reco::TrackToTrackingParticleAssociator*> associator;
171 event.getByLabel(associatorName,theAssociator);
172 associator.push_back( theAssociator.
product() );
180 auto parametersDefinerTP = parametersDefinerTPHandle->clone();
194 parametersDefinerTP->initEvent(simHitsTPAssoc);
200 event.getByToken(
bsSrc,recoBeamSpotHandle);
207 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
208 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
209 puinfo=(*puinfoH)[puinfo_ite];
221 float dR_tPCeff[(*TPCollectionHeff).size()];
224 float etaL[(*TPCollectionHeff).size()], phiL[(*TPCollectionHeff).size()];
225 bool okL[(*TPCollectionHeff).size()];
226 for (
auto const & tp2 : *TPCollectionHeff) {
230 auto &&
p = tp2.momentum();
231 etaL[
j] = etaFromXYZ(
p.x(),
p.y(),
p.z());
232 phiL[
j] = atan2f(
p.y(),
p.x());
238 for (
auto const & tp : *TPCollectionHeff) {
241 auto &&
p = tp.momentum();
242 float eta = etaFromXYZ(
p.x(),
p.y(),
p.z());
243 float phi = atan2f(
p.y(),
p.x());
244 for (
auto j=0U; j< (*TPCollectionHeff).size(); ++
j ) {
245 if (
i==j) {
continue;}
248 if (dR_tmp<dR) dR=dR_tmp;
260 for (
unsigned int ww=0;ww<
associators.size();ww++){
261 for (
unsigned int www=0;www<
label.size();www++){
276 <<
label[www].process()<<
":"
277 <<
label[www].label()<<
":"
278 <<
label[www].instance()<<
" with "
281 LogTrace(
"TrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
282 recSimCollL = std::move(associator[ww]->associateRecoToSim(trackCollection,
284 recSimCollP = &recSimCollL;
285 LogTrace(
"TrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
286 simRecCollL = std::move(associator[ww]->associateSimToReco(trackCollection,
288 simRecCollP = &simRecCollL;
292 <<
label[www].process()<<
":"
293 <<
label[www].label()<<
":"
294 <<
label[www].instance()<<
" with "
301 simRecCollP = simtorecoCollectionH.
product();
305 recSimCollP = recotosimCollectionH.
product();
319 edm::LogVerbatim(
"TrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
331 double dR=dR_tPCeff[
i];
343 dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
344 dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
345 * momentum.z()/
sqrt(momentum.perp2());
351 momentumTP = parametersDefinerTP->momentum(event,setup,tpr);
352 vertexTP = parametersDefinerTP->vertex(event,setup,tpr);
353 dxySim = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
354 dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2())
355 * momentumTP.z()/
sqrt(momentumTP.perp2());
374 if(simRecColl.
find(tpr) != simRecColl.
end()){
375 auto const & rt = simRecColl[tpr];
379 matchedTrackPointer = rt.begin()->first.get();
381 <<
" with pt=" <<
sqrt(momentumTP.perp2())
382 <<
" associated with quality:" << rt.begin()->second <<
"\n";
386 <<
"TrackingParticle #" << st
387 <<
" with pt,eta,phi: "
388 <<
sqrt(momentumTP.perp2()) <<
" , "
389 << momentumTP.eta() <<
" , "
390 << momentumTP.phi() <<
" , "
391 <<
" NOT associated to any reco::Track" <<
"\n";
400 if (matchedTrackPointer) asts++;
414 <<
label[www].process()<<
":"
415 <<
label[www].label()<<
":"
416 <<
label[www].instance()
417 <<
": " << trackCollection->size() <<
"\n";
429 std::vector<edm::ValueMap<reco::DeDxData> > v_dEdx;
437 v_dEdx.push_back(dEdx1);
438 v_dEdx.push_back(dEdx2);
440 LogTrace(
"TrackValidator") <<
"exception found: " << e.
what() <<
"\n";
447 float dR_trk[trackCollection->size()];
449 float etaL[trackCollectionForDrCalculation->size()];
450 float phiL[trackCollectionForDrCalculation->size()];
451 for (
auto const & track2 : *trackCollectionForDrCalculation) {
452 auto &&
p = track2.momentum();
453 etaL[
i] = etaFromXYZ(
p.x(),
p.y(),
p.z());
454 phiL[
i] = atan2f(
p.y(),
p.x());
458 auto const & track = (*trackCollection)[
i];
460 auto &&
p = track.momentum();
461 float eta = etaFromXYZ(
p.x(),
p.y(),
p.z());
462 float phi = atan2f(
p.y(),
p.x());
477 bool isSigSimMatched(
false);
478 bool isSimMatched(
false);
479 bool isChargeMatched(
true);
480 int numAssocRecoTracks = 0;
482 double sharedFraction = 0.;
483 auto const & tp = (recSimColl.
find(track) != recSimColl.
end()) ? recSimColl[track] : dummyTP;
486 nSimHits = tp[0].first->numberOfTrackerHits();
487 sharedFraction = tp[0].second;
489 if (tp[0].
first->charge() != track->
charge()) isChargeMatched =
false;
490 if(simRecColl.
find(tp[0].first) != simRecColl.
end()) numAssocRecoTracks = simRecColl[tp[0].
first].
size();
492 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
495 isSigSimMatched =
true;
500 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
501 <<
" associated with quality:" << tp.begin()->second <<
"\n";
503 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
504 <<
" NOT associated to any TrackingParticle" <<
"\n";
508 histoProducerAlgo_->
fill_generic_recoTrack_histos(
w,*track,bs.position(),isSimMatched,isSigSimMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), nSimHits, sharedFraction,
dR);
519 if (tp.size()==0)
continue;
543 int chargeTP = tpr->charge();
546 *track,bs.position());
565 <<
"Total Associated (simToReco): " << ats <<
"\n"
566 <<
"Total Reconstructed: " << rT <<
"\n"
567 <<
"Total Associated (recoToSim): " << at <<
"\n"
568 <<
"Total Fakes: " << rT-at <<
"\n";
578 for (
unsigned int ww=0;ww<
associators.size();ww++){
579 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
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
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.
Point vertex() const
Parent vertex position.
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.