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() ;
78 void bookRecoToSim(std::string
const &);
79 void bookSimToReco(std::string
const &);
123 "Frequency for the different track categories",
126 numberVertexClassifier_ - 0.5
130 TH1Index_[
"rs_All_MatchQuality"]=
fs_->
make<TH1D>(
"rs_All_MatchQuality",
"Quality of Match", 51, -0.01, 1.01 );
131 TH1Index_[
"rs_All_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_All_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
132 TH1Index_[
"rs_SecondaryVertex_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_SecondaryVertex_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
133 TH1Index_[
"rs_BSV_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_BSV_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
134 TH1Index_[
"rs_BWeakDecay_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_BWeakDecay_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
135 TH1Index_[
"rs_CWeakDecay_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_CWeakDecay_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
136 TH1Index_[
"rs_Light_FlightDistance2d"]=
fs_->
make<TH1D>(
"rs_Light_FlightDistance2d",
"Transverse flight distance [cm]", 100, 0, 5 );
138 TH1Index_[
"rs_All_nRecVtx"]=
fs_->
make<TH1D>(
"rs_All_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
139 TH1Index_[
"rs_SecondaryVertex_nRecVtx"]=
fs_->
make<TH1D>(
"rs_SecondaryVertex_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
140 TH1Index_[
"rs_BSV_nRecVtx"]=
fs_->
make<TH1D>(
"rs_BSV_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
141 TH1Index_[
"rs_BWeakDecay_nRecVtx"]=
fs_->
make<TH1D>(
"rs_BWeakDecay_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
142 TH1Index_[
"rs_CWeakDecay_nRecVtx"]=
fs_->
make<TH1D>(
"rs_CWeakDecay_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
143 TH1Index_[
"rs_Light_nRecVtx"]=
fs_->
make<TH1D>(
"rs_Light_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
147 TH1Index_[
"sr_All_MatchQuality"]=
fs_->
make<TH1D>(
"sr_All_MatchQuality",
"Quality of Match", 51, -0.01, 1.01);
148 TH1Index_[
"sr_All_nRecVtx"]=
fs_->
make<TH1D>(
"sr_All_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
149 TH1Index_[
"sr_SecondaryVertex_nRecVtx"]=
fs_->
make<TH1D>(
"sr_SecondaryVertex_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
150 TH1Index_[
"sr_BSV_nRecVtx"]=
fs_->
make<TH1D>(
"sr_BSV_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
151 TH1Index_[
"sr_BWeakDecay_nRecVtx"]=
fs_->
make<TH1D>(
"sr_BWeakDecay_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
152 TH1Index_[
"sr_CWeakDecay_nRecVtx"]=
fs_->
make<TH1D>(
"sr_CWeakDecay_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
153 TH1Index_[
"sr_Light_nRecVtx"]=
fs_->
make<TH1D>(
"sr_Light_nRecVtx",
"Number of Vertices per event", 11, -0.5, 10.5 );
181 std::cout <<
"*** Analyzing " <<
event.id() <<
" n_event = " <<
n_event << std::endl << std::endl;
194 cout <<
"* Event " <<
n_event <<
" ; svTagInfoCollection->size() = " << svTagInfoCollection->size() << endl;
213 for (std::size_t
index = 0;
index < svTagInfoCollection->size(); ++
index){
218 for ( std::size_t vindex = 0; vindex < svTagInfo->nVertices(); ++vindex ){
225 double rs_quality = tracer.
quality();
238 cout <<
"R2S: MatchQuality = " << rs_quality << endl;
240 TH1Index_[
"rs_All_MatchQuality"]->Fill( rs_quality );
242 TH1Index_[
"rs_All_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
249 TH1Index_[
"rs_SecondaryVertex_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
257 TH1Index_[
"rs_BWeakDecay_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
263 TH1Index_[
"rs_BSV_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
273 TH1Index_[
"rs_CWeakDecay_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
280 TH1Index_[
"rs_Light_FlightDistance2d"]->Fill( svTagInfo->flightDistance( vindex,
true ).value() );
286 cout <<
" VertexCategories::Fake!!" << endl;
294 TH1Index_[
"rs_All_nRecVtx"]->Fill( rs_nall );
295 TH1Index_[
"rs_SecondaryVertex_nRecVtx"]->Fill( rs_nsv );
296 TH1Index_[
"rs_BWeakDecay_nRecVtx"]->Fill( rs_nbv );
297 TH1Index_[
"rs_BSV_nRecVtx"]->Fill( rs_nbsv );
298 TH1Index_[
"rs_CWeakDecay_nRecVtx"]->Fill( rs_ncv );
299 TH1Index_[
"rs_Light_nRecVtx"]->Fill( rs_nlv );
316 double sr_quality = tracer.
quality();
320 cout <<
"S2R: MatchQuality = " << sr_quality << endl;
323 TH1Index_[
"sr_All_MatchQuality"]->Fill( sr_quality );
371 TH1Index_[
"sr_All_nRecVtx"]->Fill( sr_nall );
372 TH1Index_[
"sr_SecondaryVertex_nRecVtx"]->Fill( sr_nsv );
373 TH1Index_[
"sr_BWeakDecay_nRecVtx"]->Fill( sr_nbv );
374 TH1Index_[
"sr_BSV_nRecVtx"]->Fill( sr_nbsv );
375 TH1Index_[
"sr_CWeakDecay_nRecVtx"]->Fill( sr_ncv );
376 TH1Index_[
"sr_Light_nRecVtx"]->Fill( rs_nlv );
401 std::string
name = prefix +
"_Pullx";
403 name = prefix +
"_Pully";
405 name = prefix +
"_Pullz";
408 name = prefix +
"_Resx";
410 name = prefix +
"_Resy";
412 name = prefix +
"_Resz";
415 name = prefix +
"_Chi2Norm";
417 name = prefix +
"_Chi2Prob";
420 name = prefix +
"_nRecTrks";
423 name = prefix +
"_AverageTrackWeight";
426 name = prefix +
"_Mass";
429 name = prefix +
"_RecPt";
432 name = prefix +
"_RecEta";
435 name = prefix +
"_RecCharge";
438 name = prefix +
"_RecTrackPt";
441 name = prefix +
"_RecTrackEta";
444 name = prefix +
"_nSimTrks";
447 name = prefix +
"_SimPt";
450 name = prefix +
"_SimEta";
453 name = prefix +
"_SimCharge";
456 name = prefix +
"_SimTrackPt";
459 name = prefix +
"_SimTrackEta";
469 std::string
name = prefix +
"_Pullx";
471 name = prefix +
"_Pully";
473 name = prefix +
"_Pullz";
476 name = prefix +
"_Resx";
478 name = prefix +
"_Resy";
480 name = prefix +
"_Resz";
483 name = prefix +
"_Chi2Norm";
485 name = prefix +
"_Chi2Prob";
488 name = prefix +
"_nRecTrks";
491 name = prefix +
"_AverageTrackWeight";
494 name = prefix +
"_Mass";
497 name = prefix +
"_RecPt";
500 name = prefix +
"_RecEta";
503 name = prefix +
"_RecCharge";
506 name = prefix +
"_RecTrackPt";
509 name = prefix +
"_RecTrackEta";
512 name = prefix +
"_nSimTrks";
515 name = prefix +
"_SimPt";
518 name = prefix +
"_SimEta";
521 name = prefix +
"_SimCharge";
524 name = prefix +
"_SimTrackPt";
527 name = prefix +
"_SimTrackEta";
537 double pullx = (vertex.
x() - simVertex->position().x())/vertex.
xError();
538 double pully = (vertex.
y() - simVertex->position().y())/vertex.
yError();
539 double pullz = (vertex.
z() - simVertex->position().z())/vertex.
zError();
541 double resx = vertex.
x() - simVertex->position().x();
542 double resy = vertex.
y() - simVertex->position().y();
543 double resz = vertex.
z() - simVertex->position().z();
548 double sum_weight = 0.;
554 double thePiMass = 0.13957;
557 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;
559 vec.SetPx( (**recDaughter).px() );
560 vec.SetPy( (**recDaughter).py() );
561 vec.SetPz( (**recDaughter).pz() );
570 p = (**recDaughter).momentum();
573 charge += (*recDaughter)->charge();
575 TH1Index_[prefix +
"_RecTrackPt"]->Fill( (*recDaughter)->pt() );
576 TH1Index_[prefix +
"_RecTrackEta"]->Fill( (*recDaughter)->eta() );
580 double mass = sum.M();
581 double pt =
sqrt( momentum.Perp2() );
582 double eta = momentum.Eta();
586 for (
TrackingVertex::tp_iterator simDaughter = simVertex->daughterTracks_begin(); simDaughter != simVertex->daughterTracks_end(); ++simDaughter ){
589 p = (**simDaughter).momentum();
592 simcharge += (*simDaughter)->charge();
594 TH1Index_[prefix +
"_SimTrackPt"]->Fill( (*simDaughter)->pt() );
595 TH1Index_[prefix +
"_SimTrackEta"]->Fill( (*simDaughter)->eta() );
598 double simpt =
sqrt( simmomentum.Perp2() );
599 double simeta = simmomentum.Eta();
604 TH1Index_[prefix +
"_nSimTrks"]->Fill( simVertex->nDaughterTracks() );
605 TH1Index_[prefix +
"_Pullx"]->Fill(pullx);
606 TH1Index_[prefix +
"_Pully"]->Fill(pully);
607 TH1Index_[prefix +
"_Pullz"]->Fill(pullz);
611 TH1Index_[prefix +
"_AverageTrackWeight"]->Fill( sum_weight/tracksize );
612 TH1Index_[prefix +
"_Chi2Norm"]->Fill(chi2norm);
613 TH1Index_[prefix +
"_Chi2Prob"]->Fill(chi2prob);
615 TH1Index_[prefix +
"_RecEta"]->Fill(eta);
616 TH1Index_[prefix +
"_RecCharge"]->Fill(charge);
618 TH1Index_[prefix +
"_SimPt"]->Fill(simpt);
619 TH1Index_[prefix +
"_SimEta"]->Fill(simeta);
620 TH1Index_[prefix +
"_SimCharge"]->Fill(simcharge);
627 double pullx = (vertex->
x() - simVertex->position().x())/vertex->
xError();
628 double pully = (vertex->
y() - simVertex->position().y())/vertex->
yError();
629 double pullz = (vertex->
z() - simVertex->position().z())/vertex->
zError();
631 double resx = vertex->
x() - simVertex->position().x();
632 double resy = vertex->
y() - simVertex->position().y();
633 double resz = vertex->
z() - simVertex->position().z();
638 double sum_weight = 0.;
644 double thePiMass = 0.13957;
647 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;
649 vec.SetPx( (**recDaughter).px() );
650 vec.SetPy( (**recDaughter).py() );
651 vec.SetPz( (**recDaughter).pz() );
660 p = (**recDaughter).momentum();
663 charge += (*recDaughter)->charge();
665 TH1Index_[prefix +
"_RecTrackPt"]->Fill( (*recDaughter)->pt() );
666 TH1Index_[prefix +
"_RecTrackEta"]->Fill( (*recDaughter)->eta() );
671 double mass = sum.M();
672 double pt =
sqrt( momentum.Perp2() );
673 double eta = momentum.Eta();
677 for (
TrackingVertex::tp_iterator simDaughter = simVertex->daughterTracks_begin(); simDaughter != simVertex->daughterTracks_end(); ++simDaughter ){
680 p = (**simDaughter).momentum();
683 simcharge += (*simDaughter)->charge();
685 TH1Index_[prefix +
"_SimTrackPt"]->Fill( (*simDaughter)->pt() );
686 TH1Index_[prefix +
"_SimTrackEta"]->Fill( (*simDaughter)->eta() );
689 double simpt =
sqrt( simmomentum.Perp2() );
690 double simeta = simmomentum.Eta();
695 TH1Index_[prefix +
"_nSimTrks"]->Fill( simVertex->nDaughterTracks() );
696 TH1Index_[prefix +
"_Pullx"]->Fill(pullx);
697 TH1Index_[prefix +
"_Pully"]->Fill(pully);
698 TH1Index_[prefix +
"_Pullz"]->Fill(pullz);
702 TH1Index_[prefix +
"_AverageTrackWeight"]->Fill( sum_weight/tracksize );
703 TH1Index_[prefix +
"_Chi2Norm"]->Fill(chi2norm);
704 TH1Index_[prefix +
"_Chi2Prob"]->Fill(chi2prob);
706 TH1Index_[prefix +
"_RecEta"]->Fill(eta);
707 TH1Index_[prefix +
"_RecCharge"]->Fill(charge);
709 TH1Index_[prefix +
"_SimPt"]->Fill(simpt);
710 TH1Index_[prefix +
"_SimEta"]->Fill(simeta);
711 TH1Index_[prefix +
"_SimCharge"]->Fill(simcharge);
720 std::cout <<
" ====== Total Number of analyzed events: " <<
n_event <<
" ====== " << std::endl;
722 std::cout <<
" ====== Total Number of R2S SecondaryVertex: " <<
rs_total_nsv <<
" ====== " << std::endl;
724 std::cout <<
" ====== Total Number of R2S BWeakDecay::SecondaryVertex: " <<
rs_total_nbsv <<
" ====== " << std::endl;
729 std::cout <<
" ====== Total Number of S2R SecondaryVertex: " <<
sr_total_nsv <<
" ====== " << std::endl;
731 std::cout <<
" ====== Total Number of S2R BWeakDecay::SecondaryVertex: " <<
sr_total_nbsv <<
" ====== " << std::endl;
735 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
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.
virtual void analyze(const edm::Event &, const edm::EventSetup &)
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.
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>
T * make() const
make new ROOT object
double normalizedChi2() const
chi-squared divided by n.d.o.f.
static const char * Names[]
Name of the different categories.
double quality() const
Return the quality of the match.
SVTagInfoValidationAnalyzer(const edm::ParameterSet &)
trackRef_iterator tracks_begin() const
first iterator over tracks
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