4 #include <Math/Functions.h>
5 #include <Math/SVector.h>
6 #include <Math/SMatrix.h>
25 #include "Math/VectorUtil.h"
27 #include <Math/GenVector/PxPyPzE4D.h>
28 #include <Math/GenVector/PxPyPzM4D.h>
47 virtual void endJob()
override ;
125 "Frequency for the different track categories",
128 numberVertexClassifier_ - 0.5
132 TH1Index_[
"rs_All_MatchQuality"]=
fs_->
make<TH1D>(
"rs_All_MatchQuality",
"Quality of Match", 51, -0.01, 1.01 );
133 TH1Index_[
"rs_All_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_All_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
134 TH1Index_[
"rs_SecondaryVertex_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_SecondaryVertex_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
135 TH1Index_[
"rs_BSV_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_BSV_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
136 TH1Index_[
"rs_BWeakDecay_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_BWeakDecay_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
137 TH1Index_[
"rs_CWeakDecay_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_CWeakDecay_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
138 TH1Index_[
"rs_Light_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_Light_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
140 TH1Index_[
"rs_All_nRecVtx"]=
fs_->
make<TH1D>(
"rs_All_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
141 TH1Index_[
"rs_SecondaryVertex_nRecVtx"]=
fs_->
make<TH1D>(
"rs_SecondaryVertex_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
142 TH1Index_[
"rs_BSV_nRecVtx"]=
fs_->
make<TH1D>(
"rs_BSV_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
143 TH1Index_[
"rs_BWeakDecay_nRecVtx"]=
fs_->
make<TH1D>(
"rs_BWeakDecay_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
144 TH1Index_[
"rs_CWeakDecay_nRecVtx"]=
fs_->
make<TH1D>(
"rs_CWeakDecay_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
145 TH1Index_[
"rs_Light_nRecVtx"]=
fs_->
make<TH1D>(
"rs_Light_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
149 TH1Index_[
"sr_All_MatchQuality"]=
fs_->
make<TH1D>(
"sr_All_MatchQuality",
"Quality of Match", 51, -0.01, 1.01);
150 TH1Index_[
"sr_All_nRecVtx"]=
fs_->
make<TH1D>(
"sr_All_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
151 TH1Index_[
"sr_SecondaryVertex_nRecVtx"]=
fs_->
make<TH1D>(
"sr_SecondaryVertex_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
152 TH1Index_[
"sr_BSV_nRecVtx"]=
fs_->
make<TH1D>(
"sr_BSV_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
153 TH1Index_[
"sr_BWeakDecay_nRecVtx"]=
fs_->
make<TH1D>(
"sr_BWeakDecay_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
154 TH1Index_[
"sr_CWeakDecay_nRecVtx"]=
fs_->
make<TH1D>(
"sr_CWeakDecay_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
155 TH1Index_[
"sr_Light_nRecVtx"]=
fs_->
make<TH1D>(
"sr_Light_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
183 std::cout <<
"*** Analyzing " <<
event.id() <<
" n_event = " <<
n_event << std::endl << std::endl;
196 cout <<
"* Event " <<
n_event <<
" ; svTagInfoCollection->size() = " << svTagInfoCollection->size() << endl;
215 for (std::size_t
index = 0;
index < svTagInfoCollection->size(); ++
index){
220 for ( std::size_t vindex = 0; vindex < svTagInfo->nVertices(); ++vindex ){
227 double rs_quality = tracer.
quality();
240 cout <<
"R2S: MatchQuality = " << rs_quality << endl;
242 TH1Index_[
"rs_All_MatchQuality"]->Fill( rs_quality );
244 TH1Index_[
"rs_All_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
251 TH1Index_[
"rs_SecondaryVertex_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
259 TH1Index_[
"rs_BWeakDecay_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
265 TH1Index_[
"rs_BSV_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
275 TH1Index_[
"rs_CWeakDecay_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
282 TH1Index_[
"rs_Light_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
288 cout <<
" VertexCategories::Fake!!" << endl;
296 TH1Index_[
"rs_All_nRecVtx"]->Fill( rs_nall );
297 TH1Index_[
"rs_SecondaryVertex_nRecVtx"]->Fill( rs_nsv );
298 TH1Index_[
"rs_BWeakDecay_nRecVtx"]->Fill( rs_nbv );
299 TH1Index_[
"rs_BSV_nRecVtx"]->Fill( rs_nbsv );
300 TH1Index_[
"rs_CWeakDecay_nRecVtx"]->Fill( rs_ncv );
301 TH1Index_[
"rs_Light_nRecVtx"]->Fill( rs_nlv );
318 double sr_quality = tracer.
quality();
322 cout <<
"S2R: MatchQuality = " << sr_quality << endl;
325 TH1Index_[
"sr_All_MatchQuality"]->Fill( sr_quality );
373 TH1Index_[
"sr_All_nRecVtx"]->Fill( sr_nall );
374 TH1Index_[
"sr_SecondaryVertex_nRecVtx"]->Fill( sr_nsv );
375 TH1Index_[
"sr_BWeakDecay_nRecVtx"]->Fill( sr_nbv );
376 TH1Index_[
"sr_BSV_nRecVtx"]->Fill( sr_nbsv );
377 TH1Index_[
"sr_CWeakDecay_nRecVtx"]->Fill( sr_ncv );
378 TH1Index_[
"sr_Light_nRecVtx"]->Fill( rs_nlv );
405 name = prefix +
"_Pully";
407 name = prefix +
"_Pullz";
410 name = prefix +
"_Resx";
412 name = prefix +
"_Resy";
414 name = prefix +
"_Resz";
417 name = prefix +
"_Chi2Norm";
419 name = prefix +
"_Chi2Prob";
422 name = prefix +
"_nRecTrks";
425 name = prefix +
"_AverageTrackWeight";
428 name = prefix +
"_Mass";
431 name = prefix +
"_RecPt";
434 name = prefix +
"_RecEta";
437 name = prefix +
"_RecCharge";
440 name = prefix +
"_RecTrackPt";
443 name = prefix +
"_RecTrackEta";
446 name = prefix +
"_nSimTrks";
449 name = prefix +
"_SimPt";
452 name = prefix +
"_SimEta";
455 name = prefix +
"_SimCharge";
458 name = prefix +
"_SimTrackPt";
461 name = prefix +
"_SimTrackEta";
473 name = prefix +
"_Pully";
475 name = prefix +
"_Pullz";
478 name = prefix +
"_Resx";
480 name = prefix +
"_Resy";
482 name = prefix +
"_Resz";
485 name = prefix +
"_Chi2Norm";
487 name = prefix +
"_Chi2Prob";
490 name = prefix +
"_nRecTrks";
493 name = prefix +
"_AverageTrackWeight";
496 name = prefix +
"_Mass";
499 name = prefix +
"_RecPt";
502 name = prefix +
"_RecEta";
505 name = prefix +
"_RecCharge";
508 name = prefix +
"_RecTrackPt";
511 name = prefix +
"_RecTrackEta";
514 name = prefix +
"_nSimTrks";
517 name = prefix +
"_SimPt";
520 name = prefix +
"_SimEta";
523 name = prefix +
"_SimCharge";
526 name = prefix +
"_SimTrackPt";
529 name = prefix +
"_SimTrackEta";
539 double pullx = (vertex.
x() - simVertex->position().x())/vertex.
xError();
540 double pully = (vertex.
y() - simVertex->position().y())/vertex.
yError();
541 double pullz = (vertex.
z() - simVertex->position().z())/vertex.
zError();
543 double resx = vertex.
x() - simVertex->position().x();
544 double resy = vertex.
y() - simVertex->position().y();
545 double resz = vertex.
z() - simVertex->position().z();
550 double sum_weight = 0.;
556 double thePiMass = 0.13957;
559 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;
561 vec.SetPx( (**recDaughter).px() );
562 vec.SetPy( (**recDaughter).py() );
563 vec.SetPz( (**recDaughter).pz() );
572 p = (**recDaughter).momentum();
575 charge += (*recDaughter)->charge();
577 TH1Index_[prefix +
"_RecTrackPt"]->Fill( (*recDaughter)->pt() );
578 TH1Index_[prefix +
"_RecTrackEta"]->Fill( (*recDaughter)->eta() );
582 double mass = sum.M();
583 double pt =
sqrt( momentum.Perp2() );
584 double eta = momentum.Eta();
588 for (
TrackingVertex::tp_iterator simDaughter = simVertex->daughterTracks_begin(); simDaughter != simVertex->daughterTracks_end(); ++simDaughter ){
591 p = (**simDaughter).momentum();
594 simcharge += (*simDaughter)->charge();
596 TH1Index_[prefix +
"_SimTrackPt"]->Fill( (*simDaughter)->pt() );
597 TH1Index_[prefix +
"_SimTrackEta"]->Fill( (*simDaughter)->eta() );
600 double simpt =
sqrt( simmomentum.Perp2() );
601 double simeta = simmomentum.Eta();
606 TH1Index_[prefix +
"_nSimTrks"]->Fill( simVertex->nDaughterTracks() );
607 TH1Index_[prefix +
"_Pullx"]->Fill(pullx);
608 TH1Index_[prefix +
"_Pully"]->Fill(pully);
609 TH1Index_[prefix +
"_Pullz"]->Fill(pullz);
613 TH1Index_[prefix +
"_AverageTrackWeight"]->Fill( sum_weight/tracksize );
614 TH1Index_[prefix +
"_Chi2Norm"]->Fill(chi2norm);
615 TH1Index_[prefix +
"_Chi2Prob"]->Fill(chi2prob);
617 TH1Index_[prefix +
"_RecEta"]->Fill(eta);
618 TH1Index_[prefix +
"_RecCharge"]->Fill(charge);
620 TH1Index_[prefix +
"_SimPt"]->Fill(simpt);
621 TH1Index_[prefix +
"_SimEta"]->Fill(simeta);
622 TH1Index_[prefix +
"_SimCharge"]->Fill(simcharge);
629 double pullx = (vertex->
x() - simVertex->position().x())/vertex->
xError();
630 double pully = (vertex->
y() - simVertex->position().y())/vertex->
yError();
631 double pullz = (vertex->
z() - simVertex->position().z())/vertex->
zError();
633 double resx = vertex->
x() - simVertex->position().x();
634 double resy = vertex->
y() - simVertex->position().y();
635 double resz = vertex->
z() - simVertex->position().z();
640 double sum_weight = 0.;
646 double thePiMass = 0.13957;
649 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;
651 vec.SetPx( (**recDaughter).px() );
652 vec.SetPy( (**recDaughter).py() );
653 vec.SetPz( (**recDaughter).pz() );
662 p = (**recDaughter).momentum();
665 charge += (*recDaughter)->charge();
667 TH1Index_[prefix +
"_RecTrackPt"]->Fill( (*recDaughter)->pt() );
668 TH1Index_[prefix +
"_RecTrackEta"]->Fill( (*recDaughter)->eta() );
673 double mass = sum.M();
674 double pt =
sqrt( momentum.Perp2() );
675 double eta = momentum.Eta();
679 for (
TrackingVertex::tp_iterator simDaughter = simVertex->daughterTracks_begin(); simDaughter != simVertex->daughterTracks_end(); ++simDaughter ){
682 p = (**simDaughter).momentum();
685 simcharge += (*simDaughter)->charge();
687 TH1Index_[prefix +
"_SimTrackPt"]->Fill( (*simDaughter)->pt() );
688 TH1Index_[prefix +
"_SimTrackEta"]->Fill( (*simDaughter)->eta() );
691 double simpt =
sqrt( simmomentum.Perp2() );
692 double simeta = simmomentum.Eta();
697 TH1Index_[prefix +
"_nSimTrks"]->Fill( simVertex->nDaughterTracks() );
698 TH1Index_[prefix +
"_Pullx"]->Fill(pullx);
699 TH1Index_[prefix +
"_Pully"]->Fill(pully);
700 TH1Index_[prefix +
"_Pullz"]->Fill(pullz);
704 TH1Index_[prefix +
"_AverageTrackWeight"]->Fill( sum_weight/tracksize );
705 TH1Index_[prefix +
"_Chi2Norm"]->Fill(chi2norm);
706 TH1Index_[prefix +
"_Chi2Prob"]->Fill(chi2prob);
708 TH1Index_[prefix +
"_RecEta"]->Fill(eta);
709 TH1Index_[prefix +
"_RecCharge"]->Fill(charge);
711 TH1Index_[prefix +
"_SimPt"]->Fill(simpt);
712 TH1Index_[prefix +
"_SimEta"]->Fill(simeta);
713 TH1Index_[prefix +
"_SimCharge"]->Fill(simcharge);
722 std::cout <<
" ====== Total Number of analyzed events: " <<
n_event <<
" ====== " << std::endl;
724 std::cout <<
" ====== Total Number of R2S SecondaryVertex: " <<
rs_total_nsv <<
" ====== " << std::endl;
726 std::cout <<
" ====== Total Number of R2S BWeakDecay::SecondaryVertex: " <<
rs_total_nbsv <<
" ====== " << std::endl;
731 std::cout <<
" ====== Total Number of S2R SecondaryVertex: " <<
sr_total_nsv <<
" ====== " << std::endl;
733 std::cout <<
" ====== Total Number of S2R BWeakDecay::SecondaryVertex: " <<
sr_total_nbsv <<
" ====== " << std::endl;
737 std::cout <<
" ====== Total Number of Fake Vertices: " <<
total_nfake <<
" ====== " << std::endl;
This class traces the simulated and generated history of a given track.
T getUntrackedParameter(std::string const &, T const &) const
VertexHistory const & history() const
Returns a reference to the vertex history used in the classification.
trackRef_iterator tracks_end() const
last iterator over tracks
double zError() const
error on z
#define DEFINE_FWK_MODULE(type)
double y() const
y coordinate
T * make(const Args &...args) const
make new ROOT object
const reco::VertexBaseRef & recoVertex() const
Return a reference to the reconstructed track.
void fillRecoToSim(std::string const &, reco::Vertex const &, TrackingVertexRef const &)
edm::Service< TFileService > fs_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Int_t numberVertexClassifier_
edm::InputTag svTagInfoProducer_
float trackWeight(const TrackBaseRef &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Category
Categories available to vertexes.
void bookSimToReco(std::string const &)
std::map< std::string, TH1D * > TH1Index_
double chi2() const
chi-squares
double z() const
y coordinate
float ChiSquaredProbability(double chiSquared, double nrDOF)
bool is(Category category) const
Returns track flag for a given category.
virtual void endJob() override
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
const TrackingVertexRef & simVertex() const
Return the initial tracking vertex from the history.
void bookRecoToSim(std::string const &)
double x() const
x coordinate
double xError() const
error on x
XYZVectorD XYZVector
spatial vector with cartesian internal representation
VertexClassifierByProxy< Collection > const & evaluate(TrackingVertexRef const &vertex)
Classify the TrackingVertex in categories.
void fillSimToReco(std::string const &, reco::VertexBaseRef const &, TrackingVertexRef const &)
VertexClassifierByProxy< reco::SecondaryVertexTagInfoCollection > classifier_
virtual void newEvent(edm::Event const &event, edm::EventSetup const &config)
Pre-process event information (for accessing reconstraction information).
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
double normalizedChi2() const
chi-squared divided by n.d.o.f.
double quality() const
Return the quality of the match.
static const char *const Names[]
Name of the different categories.
SVTagInfoValidationAnalyzer(const edm::ParameterSet &)
trackRef_iterator tracks_begin() const
first iterator over tracks
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
edm::InputTag trackingTruth_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
double yError() const
error on y
size_t tracksSize() const
number of tracks