46 string histoProducerAlgoName = psetForHistoProducerAlgo.
getParameter<
string>(
"ComponentName");
83 if (!UseAssociators) {
98 for (
unsigned int www=0;www<
label.size();www++){
105 dirName+=algo.
label()+
"_";
108 if (dirName.find(
"Tracks")<dirName.length()){
109 dirName.replace(dirName.find(
"Tracks"),6,
"");
112 if (assoc.find(
"Track")<assoc.length()){
113 assoc.replace(assoc.find(
"Track"),5,
"");
123 string subDirName = dirName +
"/simulation";
149 using namespace reco;
151 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
152 <<
"Analyzing new event" <<
"\n"
153 <<
"====================================================\n" <<
"\n";
157 auto parametersDefinerTP = parametersDefinerTPHandle->clone();
171 parametersDefinerTP->initEvent(simHitsTPAssoc);
181 event.getByToken(
bsSrc,recoBeamSpotHandle);
188 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
189 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
190 puinfo=(*puinfoH)[puinfo_ite];
200 for (
unsigned int ww=0;ww<
associators.size();ww++){
201 for (
unsigned int www=0;www<
label.size();www++){
216 <<
label[www].process()<<
":"
217 <<
label[www].label()<<
":"
218 <<
label[www].instance()<<
" with "
221 LogTrace(
"TrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
222 recSimColl=
associator[ww]->associateRecoToSim(trackCollection,
225 LogTrace(
"TrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
226 simRecColl=
associator[ww]->associateSimToReco(trackCollection,
232 <<
label[www].process()<<
":"
233 <<
label[www].label()<<
":"
234 <<
label[www].instance()<<
" with "
241 simRecColl= *(simtorecoCollectionH.
product());
245 recSimColl= *(recotosimCollectionH.
product());
256 edm::LogVerbatim(
"TrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
279 dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
280 dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
281 * momentum.z()/
sqrt(momentum.perp2());
287 momentumTP = parametersDefinerTP->momentum(event,setup,tpr);
288 vertexTP = parametersDefinerTP->vertex(event,setup,tpr);
289 dxySim = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
290 dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2())
291 * momentumTP.z()/
sqrt(momentumTP.perp2());
311 std::vector<std::pair<RefToBase<Track>,
double> > rt;
312 if(simRecColl.
find(tpr) != simRecColl.
end()){
313 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) simRecColl[tpr];
317 matchedTrackPointer = rt.begin()->first.get();
319 <<
" with pt=" <<
sqrt(momentumTP.perp2())
320 <<
" associated with quality:" << rt.begin()->second <<
"\n";
324 <<
"TrackingParticle #" << st
325 <<
" with pt,eta,phi: "
326 <<
sqrt(momentumTP.perp2()) <<
" , "
327 << momentumTP.eta() <<
" , "
328 << momentumTP.phi() <<
" , "
329 <<
" NOT associated to any reco::Track" <<
"\n";
337 double vtx_z_PU = vertexTP.z();
338 for (
size_t j = 0;
j < tv.size();
j++) {
340 vtx_z_PU = tv[
j].position().z();
347 if (matchedTrackPointer) asts++;
361 <<
label[www].process()<<
":"
362 <<
label[www].label()<<
":"
363 <<
label[www].instance()
364 <<
": " << trackCollection->size() <<
"\n";
376 std::vector<edm::ValueMap<reco::DeDxData> > v_dEdx;
385 v_dEdx.push_back(dEdx1);
386 v_dEdx.push_back(dEdx2);
388 LogTrace(
"TrackValidator") <<
"exception found: " << e.
what() <<
"\n";
398 bool isSigSimMatched(
false);
399 bool isSimMatched(
false);
400 bool isChargeMatched(
true);
401 int numAssocRecoTracks = 0;
404 double sharedFraction = 0.;
405 std::vector<std::pair<TrackingParticleRef, double> > tp;
406 if(recSimColl.
find(track) != recSimColl.
end()){
407 tp = recSimColl[track];
409 nSimHits = tp[0].first->numberOfTrackerHits();
410 sharedFraction = tp[0].second;
412 if (tp[0].
first->charge() != track->
charge()) isChargeMatched =
false;
413 if(simRecColl.
find(tp[0].first) != simRecColl.
end()) numAssocRecoTracks = simRecColl[tp[0].
first].
size();
415 tpbx = tp[0].first->eventId().bunchCrossing();
417 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
420 isSigSimMatched =
true;
425 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
426 <<
" associated with quality:" << tp.begin()->second <<
"\n";
429 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
430 <<
" NOT associated to any TrackingParticle" <<
"\n";
434 histoProducerAlgo_->
fill_generic_recoTrack_histos(
w,*track,bs.position(),isSimMatched,isSigSimMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), tpbx, nSimHits, sharedFraction);
445 if (tp.size()==0)
continue;
469 int chargeTP = tpr->charge();
472 *track,bs.position());
491 <<
"Total Associated (simToReco): " << ats <<
"\n"
492 <<
"Total Reconstructed: " << rT <<
"\n"
493 <<
"Total Associated (recoToSim): " << at <<
"\n"
494 <<
"Total Fakes: " << rT-at <<
"\n";
504 for (
unsigned int ww=0;ww<
associators.size();ww++){
505 for (
unsigned int www=0;www<
label.size();www++){
virtual char const * what() const
T getParameter(std::string const &) const
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
Point vertex() const
Parent vertex position.
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
edm::EDGetTokenT< TrackingVertexCollection > label_tv
virtual void bookRecoHistosForStandaloneRunning(DQMStore::IBooker &ibook)=0
edm::EDGetTokenT< reco::SimToRecoCollection > associatormapStR
edm::EDGetTokenT< reco::BeamSpot > bsSrc
math::XYZPointD Point
point in the space
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
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
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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
double pt() const
track transverse momentum
TrackingParticleSelector tpSelector
Cos< T >::type cos(const T &t)
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
edm::EDGetTokenT< reco::DeDxData > m_dEdx1Tag
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
std::vector< TrackingVertex > TrackingVertexCollection
virtual void fillHistosFromVectors(int counter)=0
T const * product() const
virtual void fill_trackBased_histos(int count, int assTracks, int numRecoTracks, int numSimTracks)=0
T const * product() const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Method called to book the DQM histograms.
EncodedEventId eventId() const
Signal source, crossing number.
edm::EDGetTokenT< reco::DeDxData > m_dEdx2Tag
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
T const * get() const
Returns C++ pointer to the item.
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)
virtual ~MultiTrackValidator()
Destructor.