|
| 1 | +#ifndef ANALYZERBASE_H |
| 2 | +#define ANALYZERBASE_H |
| 3 | + |
| 4 | +// system include files |
| 5 | +#include <memory> |
| 6 | + |
| 7 | +// user include files |
| 8 | +#include "FWCore/Framework/interface/Frameworkfwd.h" |
| 9 | +#include "FWCore/Framework/interface/EDAnalyzer.h" |
| 10 | +#include "FWCore/Framework/interface/Event.h" |
| 11 | +#include "FWCore/Framework/interface/MakerMacros.h" |
| 12 | +#include "FWCore/ParameterSet/interface/ParameterSet.h" |
| 13 | + |
| 14 | +#include "DataFormats/Common/interface/RefToPtr.h" |
| 15 | +#include "DataFormats/JetReco/interface/JetTracksAssociation.h" |
| 16 | +#include "DataFormats/BTauReco/interface/CandIPTagInfo.h" |
| 17 | +#include "DataFormats/BTauReco/interface/CandSoftLeptonTagInfo.h" |
| 18 | +#include "DataFormats/BTauReco/interface/BoostedDoubleSVTagInfo.h" |
| 19 | +#include "DataFormats/BTauReco/interface/TrackIPTagInfo.h" |
| 20 | +#include "DataFormats/Math/interface/deltaR.h" |
| 21 | + |
| 22 | +#include "DataFormats/GeometrySurface/interface/Line.h" |
| 23 | +#include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h" |
| 24 | + |
| 25 | +//#include "SimTracker/Records/interface/TrackAssociatorRecord.h" |
| 26 | +#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" |
| 27 | + |
| 28 | +#include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" |
| 29 | +#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" |
| 30 | +#include "RecoBTag/PerformanceMeasurements/interface/CategoryFinder.h" |
| 31 | + |
| 32 | +// reco track and vertex |
| 33 | +#include "DataFormats/Candidate/interface/VertexCompositePtrCandidate.h" |
| 34 | +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" |
| 35 | +#include "DataFormats/TrackReco/interface/Track.h" |
| 36 | +#include "DataFormats/VertexReco/interface/Vertex.h" |
| 37 | +#include "RecoVertex/VertexPrimitives/interface/TransientVertex.h" |
| 38 | +#include "DataFormats/BTauReco/interface/JetTag.h" |
| 39 | +#include "DataFormats/JetReco/interface/JetCollection.h" |
| 40 | +#include "DataFormats/JetReco/interface/Jet.h" |
| 41 | + |
| 42 | +#include "DataFormats/TrackReco/interface/TrackFwd.h" |
| 43 | +#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" |
| 44 | +#include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h" |
| 45 | +#include "TH1F.h" |
| 46 | +#include "TH2F.h" |
| 47 | +#include "TFile.h" |
| 48 | +#include "TTree.h" |
| 49 | +#include "TVector3.h" |
| 50 | +#include "TLorentzVector.h" |
| 51 | +#include "Math/GenVector/VectorUtil.h" |
| 52 | +#include "Math/GenVector/PxPyPzE4D.h" |
| 53 | +#include "TGraphErrors.h" |
| 54 | + |
| 55 | +#include "DataFormats/BTauReco/interface/SecondaryVertexTagInfo.h" |
| 56 | + |
| 57 | +#include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h" |
| 58 | +#include "SimTracker/TrackHistory/interface/TrackCategories.h" |
| 59 | +#include "SimTracker/TrackHistory/interface/TrackClassifier.h" |
| 60 | +#include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h" |
| 61 | +#include "DataFormats/BTauReco/interface/DeepFlavourFeatures.h" |
| 62 | +#include "DataFormats/BTauReco/interface/DeepDoubleXFeatures.h" |
| 63 | +#include "DataFormats/BTauReco/interface/DeepBoostedJetFeatures.h" |
| 64 | +#include "DataFormats/MuonReco/interface/Muon.h" |
| 65 | +#include "DataFormats/PatCandidates/interface/Electron.h" |
| 66 | +#include "DataFormats/PatCandidates/interface/MET.h" |
| 67 | + |
| 68 | +// trigger |
| 69 | +#include "DataFormats/Common/interface/TriggerResults.h" |
| 70 | +#include "FWCore/Framework/interface/TriggerNamesService.h" |
| 71 | +#include "FWCore/ServiceRegistry/interface/Service.h" |
| 72 | +#include "CommonTools/UtilAlgos/interface/TFileService.h" |
| 73 | + |
| 74 | +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" |
| 75 | +#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" |
| 76 | +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" |
| 77 | +#include "DataFormats/JetReco/interface/JetCollection.h" |
| 78 | +#include "DataFormats/JetReco/interface/GenJetCollection.h" |
| 79 | +#include "DataFormats/PatCandidates/interface/Jet.h" |
| 80 | +#include "DataFormats/PatCandidates/interface/Muon.h" |
| 81 | + |
| 82 | +// reconstruct IP |
| 83 | +#include "TrackingTools/IPTools/interface/IPTools.h" |
| 84 | + |
| 85 | +// Math clusters to TrackingParticles |
| 86 | +#include "SimTracker/TrackerHitAssociation/interface/ClusterTPAssociation.h" |
| 87 | + |
| 88 | +#include "RecoBTau/JetTagComputer/interface/GenericMVAJetTagComputer.h" |
| 89 | +#include "RecoBTau/JetTagComputer/interface/GenericMVAJetTagComputerWrapper.h" |
| 90 | +#include "RecoBTau/JetTagComputer/interface/JetTagComputer.h" |
| 91 | +#include "RecoBTau/JetTagComputer/interface/JetTagComputerRecord.h" |
| 92 | +#include "RecoBTag/SecondaryVertex/interface/CombinedSVComputer.h" |
| 93 | +#include "RecoBTag/SecondaryVertex/interface/TrackKinematics.h" |
| 94 | +#include "RecoBTag/SecondaryVertex/interface/V0Filter.h" |
| 95 | +// #include "RecoBTag/ImpactParameter/plugins/IPProducer.h" |
| 96 | +#include "RecoVertex/VertexPrimitives/interface/ConvertToFromReco.h" |
| 97 | + |
| 98 | +#include "TrackingTools/GeomPropagators/interface/AnalyticalImpactPointExtrapolator.h" |
| 99 | + |
| 100 | +#include "FWCore/Utilities/interface/RegexMatch.h" |
| 101 | +#include <boost/regex.hpp> |
| 102 | + |
| 103 | +#include "RecoBTag/PerformanceMeasurements/interface/JetInfoBranches.h" |
| 104 | +#include "RecoBTag/PerformanceMeasurements/interface/EventInfoBranches.h" |
| 105 | +#include "RecoBTag/PerformanceMeasurements/interface/BookHistograms.h" |
| 106 | +#include "RecoBTag/PerformanceMeasurements/interface/VariableParser.h" |
| 107 | + |
| 108 | +#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" |
| 109 | +#include "FWCore/Common/interface/Provenance.h" |
| 110 | +#include "PhysicsTools/SelectorUtils/interface/PFJetIDSelectionFunctor.h" |
| 111 | +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" |
| 112 | +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" |
| 113 | + |
| 114 | +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" |
| 115 | +#include "TrackingTools/Records/interface/TransientTrackRecord.h" |
| 116 | +#include "TrackingTools/IPTools/interface/IPTools.h" |
| 117 | + |
| 118 | +#include "fastjet/contrib/Njettiness.hh" |
| 119 | + |
| 120 | +// #include "RecoBTag/SecondaryVertex/interface/CombinedSVSoftLeptonComputer.h" |
| 121 | +#include "DataFormats/BTauReco/interface/DeepFlavourTagInfo.h" |
| 122 | +#include "DataFormats/BTauReco/interface/DeepDoubleXTagInfo.h" |
| 123 | +#include "DataFormats/BTauReco/interface/DeepBoostedJetTagInfo.h" |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | +namespace analyzerBase{ |
| 128 | + |
| 129 | + // |
| 130 | + // constants, enums and typedefs |
| 131 | + // |
| 132 | + typedef edm::View<pat::Jet> PatJetCollection; |
| 133 | + typedef std::vector<edm::Ptr<pat::Jet> > PatJetPtrCollection; |
| 134 | + |
| 135 | + // |
| 136 | + // class declaration |
| 137 | + // |
| 138 | + |
| 139 | + struct orderByPt { |
| 140 | + const std::string mCorrLevel; |
| 141 | + orderByPt(const std::string& fCorrLevel) : mCorrLevel(fCorrLevel) {} |
| 142 | + bool operator ()(edm::Ptr<pat::Jet> const& a, edm::Ptr<pat::Jet> const& b) { |
| 143 | + if( mCorrLevel=="Uncorrected" ) |
| 144 | + return a->correctedJet("Uncorrected").pt() > b->correctedJet("Uncorrected").pt(); |
| 145 | + else |
| 146 | + return a->pt() > b->pt(); |
| 147 | + } |
| 148 | + }; |
| 149 | + |
| 150 | + class simPrimaryVertex { |
| 151 | + public: |
| 152 | + simPrimaryVertex(double x1,double y1,double z1):x(x1),y(y1),z(z1),ptsq(0),nGenTrk(0){}; |
| 153 | + double x,y,z; |
| 154 | + HepMC::FourVector ptot; |
| 155 | + //HepLorentzVector ptot; |
| 156 | + double ptsq; |
| 157 | + int nGenTrk; |
| 158 | + std::vector<int> finalstateParticles; |
| 159 | + std::vector<int> simTrackIndex; |
| 160 | + std::vector<int> genVertex; |
| 161 | + const reco::Vertex *recVtx; |
| 162 | + }; |
| 163 | + |
| 164 | + const reco::TrackBaseRef toTrackRef(const reco::TrackRef & trk); |
| 165 | + const reco::TrackBaseRef toTrackRef(const edm::Ptr<reco::Candidate> & cnd); |
| 166 | + |
| 167 | + const math::XYZPoint & position(const reco::Vertex & sv); |
| 168 | + const math::XYZPoint & position(const reco::VertexCompositePtrCandidate & sv); |
| 169 | + const double xError(const reco::Vertex & sv); |
| 170 | + const double xError(const reco::VertexCompositePtrCandidate & sv); |
| 171 | + const double yError(const reco::Vertex & sv); |
| 172 | + const double yError(const reco::VertexCompositePtrCandidate & sv); |
| 173 | + const double zError(const reco::Vertex & sv); |
| 174 | + const double zError(const reco::VertexCompositePtrCandidate & sv); |
| 175 | + const double chi2(const reco::Vertex & sv); |
| 176 | + const double chi2(const reco::VertexCompositePtrCandidate & sv); |
| 177 | + const double ndof(const reco::Vertex & sv); |
| 178 | + const double ndof(const reco::VertexCompositePtrCandidate & sv); |
| 179 | + const unsigned int vtxTracks(const reco::Vertex & sv); |
| 180 | + const unsigned int vtxTracks(const reco::VertexCompositePtrCandidate & sv); |
| 181 | + |
| 182 | + // This is needed to get a TrackingParticle --> Cluster match (instead of Cluster-->TP) (only needed in processJets) |
| 183 | + using P = std::pair<OmniClusterRef, TrackingParticleRef>; |
| 184 | + bool compare(const P& i, const P& j); |
| 185 | + |
| 186 | + |
| 187 | + enum JetFlavor {UNDEFINED, G, UD, S, C, GCC, CC, B, GBB, BB, LeptonicB, LeptonicB_C, TAU}; |
| 188 | + |
| 189 | + JetFlavor jet_flavour(const pat::Jet& jet, |
| 190 | + const std::vector<reco::GenParticle>& gToBB, |
| 191 | + const std::vector<reco::GenParticle>& gToCC, |
| 192 | + const std::vector<reco::GenParticle>& neutrinosLepB, |
| 193 | + const std::vector<reco::GenParticle>& neutrinosLepB_C, |
| 194 | + const std::vector<reco::GenParticle>& alltaus, |
| 195 | + bool usePhysForLightAndUndefined=false); |
| 196 | + |
| 197 | +} |
| 198 | +#endif |
0 commit comments