46 string histoProducerAlgoName = psetForHistoProducerAlgo.
getParameter<
string>(
"ComponentName");
48 histoProducerAlgo_->setDQMStore(
dbe_);
82 if (!UseAssociators) {
97 for (
unsigned int www=0;www<
label.size();www++){
104 dirName+=algo.
label()+
"_";
107 if (dirName.find(
"Tracks")<dirName.length()){
108 dirName.replace(dirName.find(
"Tracks"),6,
"");
111 if (assoc.find(
"Track")<assoc.length()){
112 assoc.replace(assoc.find(
"Track"),5,
"");
123 string subDirName = dirName +
"/simulation";
148 using namespace reco;
150 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
151 <<
"Analyzing new event" <<
"\n"
152 <<
"====================================================\n" <<
"\n";
168 parametersDefinerTP->initEvent(simHitsTPAssoc);
178 event.getByLabel(
bsSrc,recoBeamSpotHandle);
185 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
186 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
187 puinfo=(*puinfoH)[puinfo_ite];
197 for (
unsigned int ww=0;ww<
associators.size();ww++){
198 for (
unsigned int www=0;www<
label.size();www++){
213 <<
label[www].process()<<
":"
214 <<
label[www].label()<<
":"
215 <<
label[www].instance()<<
" with "
218 LogTrace(
"TrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
219 recSimColl=
associator[ww]->associateRecoToSim(trackCollection,
222 LogTrace(
"TrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
223 simRecColl=
associator[ww]->associateSimToReco(trackCollection,
229 <<
label[www].process()<<
":"
230 <<
label[www].label()<<
":"
231 <<
label[www].instance()<<
" with "
238 simRecColl= *(simtorecoCollectionH.
product());
242 recSimColl= *(recotosimCollectionH.
product());
253 edm::LogVerbatim(
"TrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
276 dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
277 dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
278 * momentum.z()/
sqrt(momentum.perp2());
284 momentumTP = parametersDefinerTP->momentum(event,setup,tpr);
285 vertexTP = parametersDefinerTP->vertex(event,setup,tpr);
286 dxySim = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
287 dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2())
288 * momentumTP.z()/
sqrt(momentumTP.perp2());
308 std::vector<std::pair<RefToBase<Track>,
double> > rt;
309 if(simRecColl.
find(tpr) != simRecColl.
end()){
310 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) simRecColl[tpr];
314 matchedTrackPointer = rt.begin()->first.get();
316 <<
" with pt=" <<
sqrt(momentumTP.perp2())
317 <<
" associated with quality:" << rt.begin()->second <<
"\n";
321 <<
"TrackingParticle #" << st
322 <<
" with pt,eta,phi: "
323 <<
sqrt(momentumTP.perp2()) <<
" , "
324 << momentumTP.eta() <<
" , "
325 << momentumTP.phi() <<
" , "
326 <<
" NOT associated to any reco::Track" <<
"\n";
334 double vtx_z_PU = vertexTP.z();
335 for (
size_t j = 0;
j < tv.size();
j++) {
337 vtx_z_PU = tv[
j].position().z();
344 if (matchedTrackPointer) asts++;
358 <<
label[www].process()<<
":"
359 <<
label[www].label()<<
":"
360 <<
label[www].instance()
361 <<
": " << trackCollection->size() <<
"\n";
373 std::vector<edm::ValueMap<reco::DeDxData> > v_dEdx;
382 v_dEdx.push_back(dEdx1);
383 v_dEdx.push_back(dEdx2);
385 LogTrace(
"TrackValidator") <<
"exception found: " << e.
what() <<
"\n";
395 bool isSigSimMatched(
false);
396 bool isSimMatched(
false);
397 bool isChargeMatched(
true);
398 int numAssocRecoTracks = 0;
401 double sharedFraction = 0.;
402 std::vector<std::pair<TrackingParticleRef, double> > tp;
403 if(recSimColl.
find(track) != recSimColl.
end()){
404 tp = recSimColl[track];
406 nSimHits = tp[0].first->numberOfTrackerHits();
407 sharedFraction = tp[0].second;
409 if (tp[0].
first->charge() != track->
charge()) isChargeMatched =
false;
410 if(simRecColl.
find(tp[0].first) != simRecColl.
end()) numAssocRecoTracks = simRecColl[tp[0].
first].
size();
412 tpbx = tp[0].first->eventId().bunchCrossing();
414 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
417 isSigSimMatched =
true;
422 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
423 <<
" associated with quality:" << tp.begin()->second <<
"\n";
426 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
427 <<
" NOT associated to any TrackingParticle" <<
"\n";
431 histoProducerAlgo_->
fill_generic_recoTrack_histos(
w,*track,bs.position(),isSimMatched,isSigSimMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), tpbx, nSimHits, sharedFraction);
442 if (tp.size()==0)
continue;
466 int chargeTP = tpr->charge();
469 *track,bs.position());
488 <<
"Total Associated (simToReco): " << ats <<
"\n"
489 <<
"Total Reconstructed: " << rT <<
"\n"
490 <<
"Total Associated (recoToSim): " << at <<
"\n"
491 <<
"Total Fakes: " << rT-at <<
"\n";
501 for (
unsigned int ww=0;ww<
associators.size();ww++){
502 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.
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
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
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 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.