Classes | |
struct | Plots |
Public Member Functions | |
virtual void | analyze (const edm::Event &event, const edm::EventSetup &es) |
virtual void | beginJob () |
PatBJetVertexAnalyzer (const edm::ParameterSet ¶ms) | |
constructor and destructor | |
~PatBJetVertexAnalyzer () | |
Private Types | |
enum | Flavour { ALL_JETS = 0, UDSG_JETS, C_JETS, B_JETS, NONID_JETS, N_JET_TYPES } |
Private Attributes | |
TH1 * | flavours_ |
double | jetEtaCut_ |
double | jetPtCut_ |
edm::InputTag | jets_ |
double | maxDeltaR_ |
struct PatBJetVertexAnalyzer::Plots | plots_ [N_JET_TYPES] |
Definition at line 33 of file PatBJetVertexAnalyzer.cc.
enum PatBJetVertexAnalyzer::Flavour [private] |
Definition at line 53 of file PatBJetVertexAnalyzer.cc.
{ ALL_JETS = 0, UDSG_JETS, C_JETS, B_JETS, NONID_JETS, N_JET_TYPES };
PatBJetVertexAnalyzer::PatBJetVertexAnalyzer | ( | const edm::ParameterSet & | params | ) |
constructor and destructor
Definition at line 72 of file PatBJetVertexAnalyzer.cc.
: jets_(params.getParameter<edm::InputTag>("jets")), jetPtCut_(params.getParameter<double>("jetPtCut")), jetEtaCut_(params.getParameter<double>("jetEtaCut")) { }
PatBJetVertexAnalyzer::~PatBJetVertexAnalyzer | ( | ) |
Definition at line 79 of file PatBJetVertexAnalyzer.cc.
{ }
void PatBJetVertexAnalyzer::analyze | ( | const edm::Event & | event, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 148 of file PatBJetVertexAnalyzer.cc.
References abs, ALL_JETS, B_JETS, C_JETS, PatBJetVertexAnalyzer::Plots::chi2, reco::Vertex::chi2(), deltaR(), PatBJetVertexAnalyzer::Plots::deltaR, dir, PatBJetVertexAnalyzer::Plots::dist, PatBJetVertexAnalyzer::Plots::distErr, PatBJetVertexAnalyzer::Plots::distSig, Measurement1D::error(), reco::flavour(), flavours_, reco::SecondaryVertexTagInfo::flightDirection(), reco::SecondaryVertexTagInfo::flightDistance(), metsig::jet, jetEtaCut_, jetPtCut_, jets_, PatBJetVertexAnalyzer::Plots::mass, NONID_JETS, PatBJetVertexAnalyzer::Plots::nTracks, PatBJetVertexAnalyzer::Plots::nVertices, reco::SecondaryVertexTagInfo::nVertices(), plots_, reco::SecondaryVertexTagInfo::secondaryVertex(), Measurement1D::significance(), ExpressReco_HICollisions_FallBack::track, reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), reco::Vertex::tracksSize(), UDSG_JETS, Measurement1D::value(), reco::btau::vertexMass, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ // handle to the jets collection edm::Handle<pat::JetCollection> jetsHandle; event.getByLabel(jets_, jetsHandle); // now go through all jets for(pat::JetCollection::const_iterator jet = jetsHandle->begin(); jet != jetsHandle->end(); ++jet) { // only look at jets that pass the pt and eta cut if (jet->pt() < jetPtCut_ || std::abs(jet->eta()) > jetEtaCut_) continue; Flavour flavour; // find out the jet flavour (differs between quark and anti-quark) switch(std::abs(jet->partonFlavour())) { case 1: case 2: case 3: case 21: flavour = UDSG_JETS; break; case 4: flavour = C_JETS; break; case 5: flavour = B_JETS; break; default: flavour = NONID_JETS; } // simply count the number of accepted jets flavours_->Fill(ALL_JETS); flavours_->Fill(flavour); // retrieve the "secondary vertex tag infos" // this is the output of the b-tagging reconstruction code // and contains secondary vertices in the jets const reco::SecondaryVertexTagInfo &svTagInfo = *jet->tagInfoSecondaryVertex(); // count the number of secondary vertices plots_[ALL_JETS].nVertices->Fill(svTagInfo.nVertices()); plots_[flavour].nVertices->Fill(svTagInfo.nVertices()); // ignore jets without SV from now on if (svTagInfo.nVertices() < 1) continue; // pick the first secondary vertex (the "best" one) const reco::Vertex &sv = svTagInfo.secondaryVertex(0); // and plot number of tracks and chi^2 plots_[ALL_JETS].nTracks->Fill(sv.tracksSize()); plots_[flavour].nTracks->Fill(sv.tracksSize()); plots_[ALL_JETS].chi2->Fill(sv.chi2()); plots_[flavour].chi2->Fill(sv.chi2()); // the precomputed transverse distance to the primary vertex Measurement1D distance = svTagInfo.flightDistance(0, true); plots_[ALL_JETS].dist->Fill(distance.value()); plots_[flavour].dist->Fill(distance.value()); plots_[ALL_JETS].distErr->Fill(distance.error()); plots_[flavour].distErr->Fill(distance.error()); plots_[ALL_JETS].distSig->Fill(distance.significance()); plots_[flavour].distSig->Fill(distance.significance()); // the precomputed direction with respect to the primary vertex GlobalVector dir = svTagInfo.flightDirection(0); // unfortunately CMSSW hsa all kinds of vectors, // and sometimes we need to convert them *sigh* math::XYZVector dir2(dir.x(), dir.y(), dir.z()); // compute a few variables that we are plotting double deltaR = ROOT::Math::VectorUtil::DeltaR( jet->momentum(), dir2); plots_[ALL_JETS].deltaR->Fill(deltaR); plots_[flavour].deltaR->Fill(deltaR); // compute the invariant mass from a four-vector sum math::XYZTLorentzVector trackFourVectorSum; // loop over all tracks in the vertex for(reco::Vertex::trackRef_iterator track = sv.tracks_begin(); track != sv.tracks_end(); ++track) { ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec; vec.SetPx((*track)->px()); vec.SetPy((*track)->py()); vec.SetPz((*track)->pz()); vec.SetM(0.13957); // pion mass trackFourVectorSum += vec; } // get the invariant mass: sqrt(E² - px² - py² - pz²) double vertexMass = trackFourVectorSum.M(); plots_[ALL_JETS].mass->Fill(vertexMass); plots_[flavour].mass->Fill(vertexMass); } }
void PatBJetVertexAnalyzer::beginJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 83 of file PatBJetVertexAnalyzer.cc.
References ALL_JETS, B_JETS, C_JETS, PatBJetVertexAnalyzer::Plots::chi2, PatBJetVertexAnalyzer::Plots::deltaR, PatBJetVertexAnalyzer::Plots::dist, PatBJetVertexAnalyzer::Plots::distErr, PatBJetVertexAnalyzer::Plots::distSig, reco::flavour(), flavours_, i, PatBJetVertexAnalyzer::Plots::mass, N_JET_TYPES, AlCaRecoCosmics_cfg::name, PatBJetVertexAnalyzer::Plots::nTracks, PatBJetVertexAnalyzer::Plots::nVertices, plots_, and UDSG_JETS.
{ // retrieve handle to auxiliary service // used for storing histograms into ROOT file edm::Service<TFileService> fs; flavours_ = fs->make<TH1F>("flavours", "jet flavours", 5, 0, 5); // book histograms for all jet flavours for(unsigned int i = 0; i < N_JET_TYPES; i++) { Plots &plots = plots_[i]; const char *flavour, *name; switch((Flavour)i) { case ALL_JETS: flavour = "all jets"; name = "all"; break; case UDSG_JETS: flavour = "light flavour jets"; name = "udsg"; break; case C_JETS: flavour = "charm jets"; name = "c"; break; case B_JETS: flavour = "bottom jets"; name = "b"; break; default: flavour = "unidentified jets"; name = "ni"; break; } plots.nVertices = fs->make<TH1F>(Form("nVertices_%s", name), Form("number of secondary vertices in %s", flavour), 5, 0, 5); plots.deltaR = fs->make<TH1F>(Form("deltaR_%s", name), Form("\\DeltaR between vertex direction and jet direction in %s", flavour), 100, 0, 0.5); plots.mass = fs->make<TH1F>(Form("mass_%s", name), Form("vertex mass in %s", flavour), 100, 0, 10); plots.dist = fs->make<TH1F>(Form("dist_%s", name), Form("Transverse distance between PV and SV in %s", flavour), 100, 0, 2); plots.distErr = fs->make<TH1F>(Form("distErr_%s", name), Form("Transverse distance error between PV and SV in %s", flavour), 100, 0, 0.5); plots.distSig = fs->make<TH1F>(Form("distSig_%s", name), Form("Transverse distance significance between PV and SV in %s", flavour), 100, 0, 50); plots.nTracks = fs->make<TH1F>(Form("nTracks_%s", name), Form("number of tracks at secondary vertex in %s", flavour), 20, 0, 20); plots.chi2 = fs->make<TH1F>(Form("chi2_%s", name), Form("secondary vertex fit \\chi^{2} in %s", flavour), 100, 0, 50); } }
TH1* PatBJetVertexAnalyzer::flavours_ [private] |
Definition at line 62 of file PatBJetVertexAnalyzer.cc.
Referenced by analyze(), and beginJob().
double PatBJetVertexAnalyzer::jetEtaCut_ [private] |
Definition at line 48 of file PatBJetVertexAnalyzer.cc.
Referenced by analyze().
double PatBJetVertexAnalyzer::jetPtCut_ [private] |
Definition at line 47 of file PatBJetVertexAnalyzer.cc.
Referenced by analyze().
edm::InputTag PatBJetVertexAnalyzer::jets_ [private] |
Definition at line 45 of file PatBJetVertexAnalyzer.cc.
Referenced by analyze().
double PatBJetVertexAnalyzer::maxDeltaR_ [private] |
Definition at line 49 of file PatBJetVertexAnalyzer.cc.
struct PatBJetVertexAnalyzer::Plots PatBJetVertexAnalyzer::plots_[N_JET_TYPES] [private] |
Referenced by analyze(), and beginJob().