47 string histoProducerAlgoName = psetForHistoProducerAlgo.
getParameter<
string>(
"ComponentName");
49 histoProducerAlgo_->setDQMStore(
dbe_);
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,
"");
124 string subDirName = dirName +
"/simulation";
149 using namespace reco;
151 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
152 <<
"Analyzing new event" <<
"\n"
153 <<
"====================================================\n" <<
"\n";
169 parametersDefinerTP->initEvent(simHitsTPAssoc);
179 event.getByLabel(
bsSrc,recoBeamSpotHandle);
186 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
187 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
188 puinfo=(*puinfoH)[puinfo_ite];
198 for (
unsigned int ww=0;ww<
associators.size();ww++){
199 for (
unsigned int www=0;www<
label.size();www++){
214 <<
label[www].process()<<
":"
215 <<
label[www].label()<<
":"
216 <<
label[www].instance()<<
" with "
219 LogTrace(
"TrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
220 recSimColl=
associator[ww]->associateRecoToSim(trackCollection,
223 LogTrace(
"TrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
224 simRecColl=
associator[ww]->associateSimToReco(trackCollection,
230 <<
label[www].process()<<
":"
231 <<
label[www].label()<<
":"
232 <<
label[www].instance()<<
" with "
239 simRecColl= *(simtorecoCollectionH.
product());
243 recSimColl= *(recotosimCollectionH.
product());
254 edm::LogVerbatim(
"TrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
277 dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
278 dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
279 * momentum.z()/
sqrt(momentum.perp2());
285 momentumTP = parametersDefinerTP->momentum(event,setup,tpr);
286 vertexTP = parametersDefinerTP->vertex(event,setup,tpr);
287 dxySim = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
288 dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2())
289 * momentumTP.z()/
sqrt(momentumTP.perp2());
309 std::vector<std::pair<RefToBase<Track>,
double> > rt;
310 if(simRecColl.
find(tpr) != simRecColl.
end()){
311 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) simRecColl[tpr];
315 matchedTrackPointer = rt.begin()->first.get();
317 <<
" with pt=" <<
sqrt(momentumTP.perp2())
318 <<
" associated with quality:" << rt.begin()->second <<
"\n";
322 <<
"TrackingParticle #" << st
323 <<
" with pt,eta,phi: "
324 <<
sqrt(momentumTP.perp2()) <<
" , "
325 << momentumTP.eta() <<
" , "
326 << momentumTP.phi() <<
" , "
327 <<
" NOT associated to any reco::Track" <<
"\n";
335 double vtx_z_PU = vertexTP.z();
336 for (
size_t j = 0;
j < tv.size();
j++) {
338 vtx_z_PU = tv[
j].position().z();
345 if (matchedTrackPointer) asts++;
359 <<
label[www].process()<<
":"
360 <<
label[www].label()<<
":"
361 <<
label[www].instance()
362 <<
": " << trackCollection->size() <<
"\n";
374 std::vector<edm::ValueMap<reco::DeDxData> > v_dEdx;
383 v_dEdx.push_back(dEdx1);
384 v_dEdx.push_back(dEdx2);
386 LogTrace(
"TrackValidator") <<
"exception found: " << e.
what() <<
"\n";
396 bool isSigSimMatched(
false);
397 bool isSimMatched(
false);
398 bool isChargeMatched(
true);
399 int numAssocRecoTracks = 0;
402 double sharedFraction = 0.;
403 std::vector<std::pair<TrackingParticleRef, double> > tp;
404 if(recSimColl.
find(track) != recSimColl.
end()){
405 tp = recSimColl[track];
407 nSimHits = tp[0].first->numberOfTrackerHits();
408 sharedFraction = tp[0].second;
410 if (tp[0].
first->charge() != track->
charge()) isChargeMatched =
false;
411 if(simRecColl.
find(tp[0].first) != simRecColl.
end()) numAssocRecoTracks = simRecColl[tp[0].
first].
size();
413 tpbx = tp[0].first->eventId().bunchCrossing();
415 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
418 isSigSimMatched =
true;
423 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
424 <<
" associated with quality:" << tp.begin()->second <<
"\n";
427 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
428 <<
" NOT associated to any TrackingParticle" <<
"\n";
432 histoProducerAlgo_->
fill_generic_recoTrack_histos(
w,*track,bs.position(),isSimMatched,isSigSimMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), tpbx, nSimHits, sharedFraction);
443 if (tp.size()==0)
continue;
467 int chargeTP = tpr->charge();
470 *track,bs.position());
489 <<
"Total Associated (simToReco): " << ats <<
"\n"
490 <<
"Total Reconstructed: " << rT <<
"\n"
491 <<
"Total Associated (recoToSim): " << at <<
"\n"
492 <<
"Total Fakes: " << rT-at <<
"\n";
502 for (
unsigned int ww=0;ww<
associators.size();ww++){
503 for (
unsigned int www=0;www<
label.size();www++){
virtual char const * what() const
T getParameter(std::string const &) const
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_
CosmicTrackingParticleSelector cosmictpSelector
std::vector< TrackingParticle > TrackingParticleCollection
const_iterator end() const
last iterator over the map (read only)
edm::InputTag _simHitTpMapTag
void cd(void)
go to top directory (ie. root)
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.
virtual void bookSimHistos()=0
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
void beginRun(edm::Run const &, edm::EventSetup const &)
Method called before the event loop.
virtual void bookRecoHistos()=0
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
edm::InputTag label_tp_fake
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)
edm::InputTag associatormap
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
void initEvent(edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssocToSet) const
virtual void fillProfileHistosFromVectors(int counter)=0
virtual void initialize()=0
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.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
ObjectSelector< CosmicTrackingParticleSelector > CosmicTrackingParticleSelector
virtual void finalHistoFits(int counter)=0
edm::InputTag label_pileupinfo
MTVHistoProducerAlgo * histoProducerAlgo_
std::string parametersDefiner
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
EncodedEventId eventId() const
Signal source, crossing number.
virtual void bookRecoHistosForStandaloneRunning()=0
Vector momentum() const
spatial momentum vector
void goUp(void)
equivalent to "cd .."
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.
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::InputTag label_tp_effic
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
void setCurrentFolder(const std::string &fullpath)
T get(const Candidate &c)
virtual ~MultiTrackValidator()
Destructor.