diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..56c1683e308 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pyc +*.py diff --git a/AnalysisFW/interface/QCDEvent.h b/AnalysisFW/interface/QCDEvent.h index 0c9fcc55aee..6e10808541a 100644 --- a/AnalysisFW/interface/QCDEvent.h +++ b/AnalysisFW/interface/QCDEvent.h @@ -7,12 +7,12 @@ #include "SMPJ/AnalysisFW/interface/QCDMET.h" #include "SMPJ/AnalysisFW/interface/QCDCaloJet.h" #include "SMPJ/AnalysisFW/interface/QCDPFJet.h" -//#include "SMPJ/AnalysisFW/interface/MyElectron.h" -//#include "SMPJ/AnalysisFW/interface/MyMuon.h" #include "SMPJ/AnalysisFW/interface/QCDEventHdr.h" #include "DataFormats/JetReco/interface/Jet.h" #include +using std::vector; + class QCDEvent { public: @@ -22,116 +22,82 @@ class QCDEvent //------------ Destructor ------------------------------- ~QCDEvent(); //------------ Set methods ------------------------------ - void setCaloMET(const QCDMET& fCaloMET) {CaloMet_ = fCaloMET;} - void setPFMET(const QCDMET& fPFMET) {PFMet_ = fPFMET;} - void setMvaMET(const QCDMET& fMvaMET) {MvaMet_ = fMvaMET;} + void setPFMET(const QCDMET& fPFMET,const QCDMET& fPFMETt0, const QCDMET& fPFMETt0t1) { + PFMet_ = fPFMET; + PFMetT0_ = fPFMETt0; + PFMetT0T1_ = fPFMETt0t1; + } void setEvtHdr(const QCDEventHdr& fEvtHdr) {EvtHdr_ = fEvtHdr;} - //void setCaloJets(const std::vector& fCaloJets); - //void setPFJets(const std::vector& fPFJets); - void setPFJetsCHS(const std::vector& fPFJetsCHS); - //void setElectrons(const std::vector& fElectron); - //void setMuons(const std::vector& fMuon); + void setPFJetsCHS(const vector& fPFJetsCHS); - //void setFatJets(const std::vector& fFatJets); - void setGenJets(const std::vector& fGenJets); - void setL1Obj(const std::vector >& fL1Obj); - void setHLTObj(const std::vector >& fHLTObj); - void setFilterId(const std::vector >& filterIdList) {filterIdList_ = filterIdList;} - void setPrescales(const std::vector& fPreL1, const std::vector& fPreHLT) {L1Prescale_ = fPreL1; HLTPrescale_ = fPreHLT;} - void setTrigDecision(const std::vector& fTrigDecision) {TriggerDecision_ = fTrigDecision;} - void setTrigPathList(const std::vector& trigPathList) {triggerList_ = trigPathList;} + void setGenJets(const vector& fGenJets); + void setL1Obj(const vector >& fL1Obj); + void setHLTObj(const vector >& fHLTObj); + void setPrescales(const vector& fPreL1, const vector& fPreHLT) {L1Prescale_ = fPreL1; HLTPrescale_ = fPreHLT;} + void setTrigDecision(const vector& fTrigDecision) {TriggerDecision_ = fTrigDecision;} + void setFltDecision(const vector& fFltDecision) {FilterDecision_ = fFltDecision;} - void setGenFlavour(const std::vector GenFlavour){ genFlavour_= GenFlavour; } - void setGenHadronFlavour(const std::vector GenFlavourHadron){ genFlavourHadron_= GenFlavourHadron; } + void setGenFlavour( const vector& GenFlavour) { genFlavour_= GenFlavour;} + void setGenFlavourHadron( const vector& GenFlavourHadron) { genFlavourHadron_= GenFlavourHadron;} + void setGenFlavourPhysicsDef(const vector& GenPartonFlavourPhysicsDef) {genFlavourPartonPhysicsDef_= GenPartonFlavourPhysicsDef;} + void setGenBPt( const vector& fGenBPt) { genBPt_ = fGenBPt; } //------------ Get methods ------------------------------- unsigned int nTriggers() const {return TriggerDecision_.size();} unsigned int nL1Obj(int i) const {return L1Obj_[i].size();} unsigned int nHLTObj(int i) const {return HLTObj_[i].size();} - //unsigned int nPFJets() const {return PFJets_.size();} unsigned int nPFJetsCHS() const {return PFJetsCHS_.size();} - //unsigned int nFatJets() const {return FatJets_.size();} - //unsigned int nCaloJets() const {return CaloJets_.size();} unsigned int nGenJets() const {return GenJets_.size();} - int nGoodJets(int unc, int id, float ymax, float ptmin, std::vector jets); + int nGoodJets(int unc, int id, float ymax, float ptmin, vector jets); int fired(int i) const {return TriggerDecision_[i];} int preL1(int i) const {return L1Prescale_[i];} int preHLT(int i) const {return HLTPrescale_[i];} - float pfmjj(); - //unsigned int nMuons() const {return mMuon_.size();} - //unsigned int nEelctrons() const {return mElectron_.size();} - float GenJetFlavour(int i) const {return genFlavour_[i];} - float GenHadronJetFlavour(int i) const {return genFlavourHadron_[i];} + int GenJetFlavour(int i) const {return genFlavour_[i];} + int GenHadronJetFlavour(int i) const {return genFlavourHadron_[i];} + int GenPartonPhysicsDefJetFlavour(int i) const {return genFlavourPartonPhysicsDef_[i];} - float calomjj(); + float pfmjj(); float genmjj(); float pfchsmjjcor(int unc); float pfchsmjjcor(int unc,int src); - //float pfmjjcor(int unc); - //float pfmjjcor(int unc,int src); - //float fatmjjcor(int unc); - //float calomjjcor(int unc); float pfmjjgen(); - //float calomjjgen(); - const QCDMET& calomet() const {return CaloMet_;} const QCDMET& pfmet() const {return PFMet_;} - const QCDMET& mvamet() const {return MvaMet_;} const LorentzVector& hltobj(int itrig, int iobj) const {return (HLTObj_[itrig])[iobj];} const LorentzVector& l1obj(int itrig, int iobj) const {return (L1Obj_[itrig])[iobj];} const LorentzVector& genjet(int i) const {return GenJets_[i];} - //const QCDPFJet& pfjet(int i) const {return PFJets_[i];} const QCDPFJet& pfjetchs(int i) const {return PFJetsCHS_[i];} - //const QCDJet& fatjet(int i) const {return FatJets_[i];} - //const QCDCaloJet& calojet(int i) const {return CaloJets_[i];} const QCDEventHdr& evtHdr() const {return EvtHdr_;} - //const MyMuon& muon(int i) const {return mMuon_[i];} - //const MyElectron& electron(int i) const {return mElectron_[i];} - - const std::vector>& HLTObj() const {return HLTObj_;} - const std::vector& trigPathList() const {return triggerList_;} - const std::vector>& filterIdList() const {return filterIdList_;} - const std::vector& hltObjsForPath(int i) const {return HLTObj_[i];} - const std::vector& filterIdsForPath(int i) const {return filterIdList_[i];} + const vector>& HLTObj() const {return HLTObj_;} + const vector& hltObjsForPath(int i) const {return HLTObj_[i];} private: - std::vector > filterIdList_; - //---- event header (contains all the event info) -------------- QCDEventHdr EvtHdr_; - //---- CALO met object ----------------------------------------- - QCDMET CaloMet_; //---- PF met object ------------------------------------------- - QCDMET PFMet_; - QCDMET MvaMet_; + QCDMET PFMet_; // T1, implicit + QCDMET PFMetT0_; + QCDMET PFMetT0T1_; //---- trigger decision vector --------------------------------- - std::vector TriggerDecision_; - std::vector triggerList_; + vector TriggerDecision_; + //---- filter decision vector --------------------------------- + vector FilterDecision_; //---- L1 prescale vector -------------------------------------- - std::vector L1Prescale_; + vector L1Prescale_; //---- HLT prescale vector ------------------------------------- - std::vector HLTPrescale_; + vector HLTPrescale_; //---- HLT objects --------------------------------------------- - std::vector > HLTObj_; + vector > HLTObj_; //---- L1 objects ---------------------------------------------- - std::vector > L1Obj_; + vector > L1Obj_; //---- Genjets ------------------------------------------------- - std::vector GenJets_; - //---- CaloJets ------------------------------------------------ - //std::vector CaloJets_; - //---- PFJets -------------------------------------------------- - //std::vector PFJets_; + vector GenJets_; //---- PFJetsCHS ----------------------------------------------- - std::vector PFJetsCHS_; - //---- FatJets ------------------------------------------------- - //std::vector FatJets_; - std::vector genFlavour_; - std::vector genFlavourHadron_; - - //MyMuons - //std::vector mMuon_; - //std::vector mElectron_; - + vector PFJetsCHS_; + vector genFlavour_; + vector genFlavourHadron_; + vector genFlavourPartonPhysicsDef_; + vector genBPt_; }; #endif diff --git a/AnalysisFW/interface/QCDEventHdr.h b/AnalysisFW/interface/QCDEventHdr.h index a1885bca2ad..45929e5c970 100644 --- a/AnalysisFW/interface/QCDEventHdr.h +++ b/AnalysisFW/interface/QCDEventHdr.h @@ -3,6 +3,8 @@ #ifndef QCDEventHdr_h #define QCDEventHdr_h +#include + class QCDEventHdr { public: @@ -21,43 +23,43 @@ class QCDEventHdr void setVertices(int fNVtx, int fNVtxGood) {mNVtx = fNVtx; mNVtxGood = fNVtxGood;} void setPV(bool fIsPVgood, float fndof, float fx, float fy, float fz) {mIsPVgood = fIsPVgood; mPVndof = fndof; mPVx = fx; mPVy = fy; mPVz = fz;} void setBS(float fBSx, float fBSy, float fBSz) {mBSx = fBSx; mBSy = fBSy; mBSz = fBSz;} - void setHCALNoise(bool fNoise) {mHCALNoise = fNoise;} void setHCALNoiseNoMinZ(bool fNoise) {mHCALNoiseNoMinZ = fNoise;} void setPU(int fNBX, int fOOTPUEarly, int fOOTPULate, int fINTPU) {mNBX = fNBX; mOOTPUEarly = fOOTPUEarly; mOOTPULate = fOOTPULate; mINTPU = fINTPU;} void setTrPu(float fTrPu) {mTrPu = fTrPu;} // setting the true PU + void setPSWeight(size_t idx, float wgt) { + if (idx < mPSWeights.size()) mPSWeights[idx] = wgt; + else mPSWeights.push_back(wgt); + } //------------ Get methods ------------------------------ - int runNo() const {return mRun;} - long long int event() const {return mEvent;} - int lumi() const {return mLumi;} - int bunch() const {return mBunch;} - int nVtx() const {return mNVtx;} - int nVtxGood() const {return mNVtxGood;} - int ootpuEarly() const {return mOOTPUEarly;} - int ootpuLate() const {return mOOTPULate;} - int intpu() const {return mINTPU;} - int nbx() const {return mNBX;} - int pu() const {return mOOTPUEarly+mOOTPULate+mINTPU;} - float trpu() const {return mTrPu;} // get method for True number of interaction - bool isPVgood() const {return mIsPVgood;} - bool hcalNoise() const {return mHCALNoise;} - bool hcalNoiseNoMinZ() const {return mHCALNoiseNoMinZ;} - float PVndof() const {return mPVndof;} - float PVx() const {return mPVx;} - float PVy() const {return mPVy;} - float PVz() const {return mPVz;} - float BSx() const {return mBSx;} - float BSy() const {return mBSy;} - float BSz() const {return mBSz;} - float pthat() const {return mPthat;} - float weight() const {return mWeight;} - float caloRho() const {return mCaloRho;} - float pfRho() const {return mPFRho;} + int runNo() const {return mRun;} + long long int event() const {return mEvent;} + int lumi() const {return mLumi;} + int bunch() const {return mBunch;} + int nVtx() const {return mNVtx;} + int nVtxGood() const {return mNVtxGood;} + int ootpuEarly() const {return mOOTPUEarly;} + int ootpuLate() const {return mOOTPULate;} + int intpu() const {return mINTPU;} + int nbx() const {return mNBX;} + int pu() const {return mOOTPUEarly+mOOTPULate+mINTPU;} + float trpu() const {return mTrPu;} // get method for True number of interaction + bool isPVgood() const {return mIsPVgood;} + bool hcalNoiseNoMinZ() const {return mHCALNoiseNoMinZ;} + float PVndof() const {return mPVndof;} + float PVx() const {return mPVx;} + float PVy() const {return mPVy;} + float PVz() const {return mPVz;} + float BSx() const {return mBSx;} + float BSy() const {return mBSy;} + float BSz() const {return mBSz;} + float pthat() const {return mPthat;} + float weight() const {return mWeight;} + float caloRho() const {return mCaloRho;} + float pfRho() const {return mPFRho;} private: //---- flag about the PV quality -------------- bool mIsPVgood; //---- flags about the HCAL noise ------------- - bool mHCALNoise; - //---- flags about the HCAL noise ------------- bool mHCALNoiseNoMinZ; //---- run number ----------------------------- int mRun; @@ -95,6 +97,8 @@ class QCDEventHdr float mPthat; //---- simulation weight ---------------------- float mWeight; + //---- shower weight ---------------------- + std::vector mPSWeights; //---- median CALO pt density ----------------- float mCaloRho; //---- median PF pt density ------------------- diff --git a/AnalysisFW/interface/QCDJet.h b/AnalysisFW/interface/QCDJet.h index cf4135c05d2..2d3c24e1fb9 100644 --- a/AnalysisFW/interface/QCDJet.h +++ b/AnalysisFW/interface/QCDJet.h @@ -15,22 +15,20 @@ class QCDJet ~QCDJet() {} //------------ Sett methods ----------------------------- // void clear() {pfParticles_.clear();} - void setP4(LorentzVector fP4) {P4_ = fP4;} - void setGen(LorentzVector fP4, float fgenR) {genP4_ = fP4;genR_ = fgenR;} - void setCor(float fCor) {cor_ = fCor;} - void setUnc(float fUnc) {unc_ = fUnc;} - void setUncSrc(std::vector fUncSrc) {uncSrc_ = fUncSrc;} - void setJecLabels(std::vector fJecLabels) {jecLabels_ = fJecLabels;} - void setArea(float fArea) {area_ = fArea;} - void setLooseID(bool fLooseID) {looseID_ = fLooseID;} - void setTightID(bool fTightID) {tightID_ = fTightID;} + void setP4(LorentzVector fP4) { P4_ = fP4; } + void setGen(int fIdx, float fgenR) { genIdx_ = fIdx; genR_ = fgenR; } + void setCor(float fCor) { cor_ = fCor; } + void setUnc(float fUnc) { unc_ = fUnc; } + void setUncSrc(std::vector fUncSrc) { uncSrc_ = fUncSrc; } + void setJecLabels(std::vector fJecLabels) { jecLabels_ = fJecLabels; } + void setArea(float fArea) { area_ = fArea; } + void setLooseID(bool fLooseID) { looseID_ = fLooseID; } + void setTightID(bool fTightID) { tightID_ = fTightID; } // void setPFParticles(std::vector fpfFParticles) {pfParticles_ = fpfFParticles;} //------------ Get methods ------------------------------ const LorentzVector& p4() const {return P4_;} - const LorentzVector& genp4() const {return genP4_;} float pt() const {return P4_.pt()/cor_;} - float genpt() const {return genP4_.pt();} - float geneta() const {return genP4_.eta();} + int genidx() const {return genIdx_;} float genR() const {return genR_;} float ptCor() const {return P4_.pt();} float e() const {return P4_.energy()/cor_;} @@ -51,8 +49,8 @@ class QCDJet private: //------ jet 4-momentum vector------------------ LorentzVector P4_; - //------ matched genjet 4-momentum vector------- - LorentzVector genP4_; + //------ matched genjet index------------------- + int genIdx_; //------ matching radius ----------------------- float genR_; //------ jec factor ---------------------------- @@ -69,7 +67,5 @@ class QCDJet bool looseID_; //------ tight ID flag ------------------------- bool tightID_; - //------ LorentzVector For PF PARTICLES - // std::vector pfParticles_; }; #endif diff --git a/AnalysisFW/interface/QCDMET.h b/AnalysisFW/interface/QCDMET.h index 800e838a6ab..2fae49aa26f 100644 --- a/AnalysisFW/interface/QCDMET.h +++ b/AnalysisFW/interface/QCDMET.h @@ -13,10 +13,8 @@ class QCDMET ~QCDMET() {} //------- Set method ------------------------------------ void setVar(float fEt, float fSumEt, float fPhi) {et_ = fEt; sumEt_ = fSumEt; phi_ = fPhi;} - void setCaloMet(float fCaloMetPt) {CaloMetPt_ = fCaloMetPt;} //------- Get methods ----------------------------------- float met() const {return et_;} - float calometpt() const {return CaloMetPt_;} float phi() const {return phi_;} float sumet() const {return sumEt_;} float met_o_sumet() const {return et_/sumEt_;} @@ -24,7 +22,6 @@ class QCDMET private: //---- size of MET vector ---------- float et_; - float CaloMetPt_; //---- sumET ----------------------- float sumEt_; //---- phi of MET vector ----------- diff --git a/AnalysisFW/interface/QCDPFJet.h b/AnalysisFW/interface/QCDPFJet.h index a0ae1147407..8f31c29512f 100644 --- a/AnalysisFW/interface/QCDPFJet.h +++ b/AnalysisFW/interface/QCDPFJet.h @@ -9,36 +9,21 @@ class QCDPFJet : public QCDPFJetBTag { public: //------------ Constructor ------------------------------ - QCDPFJet() {chf_=0;nhf_=0;nemf_=0;cemf_=0;muf_=0;chm_=0;nhm_=0;phm_=0;elm_=0;mum_=0,cm_=0; -// pfParticles_.clear(); - } + QCDPFJet() {chf_=0;nhf_=0;nemf_=0;cemf_=0;muf_=0;chm_=0;nhm_=0;phm_=0;elm_=0;mum_=0,cm_=0;} //------------ Destructor ------------------------------- ~QCDPFJet() {} //------------ Set methods ------------------------------ void setFrac(float fchf, float fnhf, float fnemf, float fcemf, float fmuf) {chf_ = fchf; nhf_ = fnhf; nemf_ = fnemf; cemf_ = fcemf; muf_ = fmuf;} void setMulti(int fncand, int fchm, int fnhm, int fphm, int felm, int fmum, int fcm) {ncand_ = fncand; chm_ = fchm; nhm_ = fnhm; phm_ = fphm; elm_ = felm; mum_ = fmum; cm_ = fcm; } - void setBeta(float fbeta) {beta_ = fbeta;} - void setBetaStar(float fbetaStar) {betaStar_ = fbetaStar;} + void setBetaPrime(float fbetaPrime) {betaPrime_ = fbetaPrime;} void setHFFrac(float fhf_hf, float fhf_phf) {hf_hf_ = fhf_hf; hf_phf_ = fhf_phf;} void setHFMulti(int fhf_hm, int fhf_phm) {hf_hm_ = fhf_hm; hf_phm_ = fhf_phm;} void setVtxInfo(int mpuTrk, int mlvTrk, int mjtTrk) { mpuTrk_ = mpuTrk; mlvTrk_ = mlvTrk; mjtTrk_ = mjtTrk;} // Juska void setHO(float hof) {hof_ = hof;} // Juska void SetPUJetId(float pujid) { pujid_ = pujid; } - void SetCaloJetPt(float calojetpt) { calojetpt_ = calojetpt; } - void SetCaloJetEf(float calojetef) { calojetef_ = calojetef; } - - /* - void setPFParticles(std::vector& fpfFParticles) { - for(unsigned i=0; i pfParticles_; + //---- fraction of track pt NOT coming from the signal vertex, removed by chs --- + float betaPrime_; // Juska: int mpuTrk_; // PU-tracks in jet @@ -114,9 +90,5 @@ class QCDPFJet : public QCDPFJetBTag { float hof_; // Hadronic Outer energy fraction float pujid_; - - float calojetpt_; - float calojetef_; - - }; +}; #endif diff --git a/AnalysisFW/interface/QCDPFJetBTag.h b/AnalysisFW/interface/QCDPFJetBTag.h index 6de81d6164d..47afaadc606 100644 --- a/AnalysisFW/interface/QCDPFJetBTag.h +++ b/AnalysisFW/interface/QCDPFJetBTag.h @@ -6,127 +6,30 @@ #include "SMPJ/AnalysisFW/interface/QCDJet.h" #include "TLorentzVector.h" class QCDPFJetBTag : public QCDJet { - public: - //------------ Constructor ------------------------------ - QCDPFJetBTag() {} - //------------ Destructor ------------------------------- - ~QCDPFJetBTag() {} - //------------ Set methods ------------------------------ - /* - void setTCHETag(float ftche, float ftchp, float ftchepf, float ftchppf) {TCHE_ = ftche; TCHP_ = ftchp; TCHEpf_ = ftchepf; TCHPpf_ = ftchppf; } - void setSoftLeptonTag(float fsoftmuonbyip, float fsoftelectronbyip, float fsoftmuon, float fsoftelectron) {SoftMuonTagByIP_ = fsoftmuonbyip; SoftElectronTagByIP_ = fsoftelectronbyip; SoftMuonTag_ = fsoftmuon; SoftElectronTag_ = fsoftelectron; } - void setSimpleSecondaryVertexTag(float fsimplesecvertexhe, float fsimplesecvertexhp, float fsimplesecvertexhepf, float fsimplesecvertexhppf) {SimpleSecVertexHE_ = fsimplesecvertexhe; SimpleSecVertexHP_ = fsimplesecvertexhp; SimpleSecVertexHEpf_ = fsimplesecvertexhepf; SimpleSecVertexHPpf_ = fsimplesecvertexhppf; } - void setCombinedSecondaryVertexTag(float fcsv, float fcsvpf, float fcinclsvpf, float fcsvsoftleptonpf, float fcmvapf) {CSV_ = fcsv; CSVpf_ = fcsvpf; CinclSVpf_ = fcinclsvpf; CSVSoftLeptonpf_ = fcsvsoftleptonpf; CMVApf_= fcmvapf;} - */ - void setPositiveNegativeCSV(float fcsvpfpositive, float fcsvpfnegative) { CSVpfPositive_ = fcsvpfpositive; CSVpfNegative_ = fcsvpfnegative;} - - void setTagRecommended(float recommend1, float recommend2, float recommend3) { recommend1_ = recommend1; recommend2_ = recommend2; recommend3_ = recommend3; } - - void setDeepCSV (float DeepCSVb, float - DeepCSVc, float DeepCSVl, float DeepCSVbb , float DeepCSVcc , float DeepCSVbN , - float DeepCSVcN , float DeepCSVlN , float DeepCSVbbN, float DeepCSVccN, float - DeepCSVbP , float DeepCSVcP , float DeepCSVlP , float DeepCSVbbP, float - DeepCSVccP) { - DeepCSVb_ = DeepCSVb; - DeepCSVc_ = DeepCSVc; - DeepCSVl_ = DeepCSVl; - DeepCSVbb_ = DeepCSVbb; - DeepCSVcc_ = DeepCSVcc; - DeepCSVbN_ = DeepCSVbN; - DeepCSVcN_ = DeepCSVcN; - DeepCSVlN_ = DeepCSVlN; - DeepCSVbbN_ = DeepCSVbbN; - DeepCSVccN_ = DeepCSVccN; - DeepCSVbP_ = DeepCSVbP; - DeepCSVcP_ = DeepCSVcP; - DeepCSVlP_ = DeepCSVlP; - DeepCSVbbP_ = DeepCSVbbP; - DeepCSVccP_ = DeepCSVccP;} - - - void setFlavour(float fpartonflavour, float fhadronflavour) {partonFlavour_ = fpartonflavour; hadronFlavour_ = fhadronflavour;} - - void setQGTagger(float fQGTagger) {QGtagger_ = fQGTagger;} - - void setBoosted(float fboosted) {boosted_ = fboosted;} - void setCTagger(float fpfCombinedCvsL, float fpfCombinedCvsB) {pfCombinedCvsL_ = fpfCombinedCvsL; pfCombinedCvsB_ = fpfCombinedCvsB;} - - //------------ Get methods ------------------------------ - /* - float tche() const {return TCHE_;} - float tchp() const {return TCHP_;} - float tchepf() const {return TCHEpf_;} - float tchppf() const {return TCHPpf_;} - float softmuonbyip() const {return SoftMuonTagByIP_;} - float softelectronbyip() const {return SoftElectronTagByIP_;} - float softmuon() const {return SoftMuonTag_;} - float softelectron() const {return SoftElectronTag_;} - float simplesecvertexhe() const {return SimpleSecVertexHE_;} - float simplesecvertexhp() const {return SimpleSecVertexHP_;} - float simplesecvertexhepf() const {return SimpleSecVertexHEpf_;} - float simplesecvertexhppf() const {return SimpleSecVertexHPpf_;} - float csv() const {return CSV_;} - float csvpf() const {return CSVpf_;} - float cinclsvpf() const {return CinclSVpf_;} - float cmvapf() const {return CMVApf_;} - float csvsoftleptonpf() const {return CSVSoftLeptonpf_;} - */ - float csvpfpositive() const {return CSVpfPositive_;} - float csvpfnegative() const {return CSVpfNegative_;} - - float pfBoostedDouble() const {return boosted_;} - - float partonflavour() const {return partonFlavour_;} - float hadronflavour() const {return hadronFlavour_;} - - float qgtagger() const {return QGtagger_;} - - float pfJetProbabilityBJetTags() const {return recommend1_;} - float pfCombinedInclusiveSecondaryVertexV2BJetTags() const {return recommend2_;} - float pfCombinedMVAV2BJetTags() const {return recommend2_;} - float pfCombinedCvsL() const {return pfCombinedCvsL_;} - float pfCombinedCvsB() const {return pfCombinedCvsB_;} - - private: - /* - float TCHE_; - float TCHP_; - float TCHEpf_; - float TCHPpf_; - float SoftMuonTagByIP_; - float SoftElectronTagByIP_; - float SoftMuonTag_; - float SoftElectronTag_; - float SimpleSecVertexHE_; - float SimpleSecVertexHP_; - float SimpleSecVertexHEpf_; - float SimpleSecVertexHPpf_; - float CSV_; - float CSVpf_; - float CinclSVpf_; - float CMVApf_; - float CSVSoftLeptonpf_; - */ - float CSVpfPositive_; - float CSVpfNegative_; - - float boosted_; - - float QGtagger_; - - float partonFlavour_; - float hadronFlavour_; - float recommend1_; - float recommend2_; - float recommend3_; - // ctaggers - float pfCombinedCvsL_; - float pfCombinedCvsB_; - float DeepCSVb_, DeepCSVc_, DeepCSVl_, DeepCSVbb_, DeepCSVcc_, DeepCSVbN_, - DeepCSVcN_, DeepCSVlN_, DeepCSVbbN_, DeepCSVccN_, DeepCSVbP_, DeepCSVcP_, - DeepCSVlP_, DeepCSVbbP_, DeepCSVccP_; - - - - }; + public: + //------------ Constructor ------------------------------ + QCDPFJetBTag() {} + //------------ Destructor ------------------------------- + ~QCDPFJetBTag() {} + //------------ Set methods ------------------------------ + + void setQGTagger (float fQGL, float fQGAx2, int fQGMul, float fQGPtD) { QGL_ = fQGL; QGAx2_ = fQGAx2; QGMul_ = fQGMul; QGPtD_ = fQGPtD; } + + float pfCombinedCvsL_, pfCombinedCvsB_; + float pfDeepCSVb_, pfDeepCSVc_, pfDeepCSVl_, pfDeepCSVbb_; + float pfBTag_JetProb_; + float pfBTag_CombInclSecVtxV2_; + float pfBTag_CombMVAV2_; + + float QGL_; + float QGAx2_; + int QGMul_; + float QGPtD_; + + void setFlavour(int fpartonflavour, int fhadronflavour, int fpartonflavourPhysicsDef) { partonFlavour_ = fpartonflavour; hadronFlavour_ = fhadronflavour; partonFlavourPhysicsDef_ = fpartonflavourPhysicsDef;} + + int partonFlavour_; + int partonFlavourPhysicsDef_; + int hadronFlavour_; +}; #endif diff --git a/AnalysisFW/plugins/Analysis_Template_MC.cc b/AnalysisFW/plugins/Analysis_Template_MC.cc deleted file mode 100644 index 25f37e3ff4f..00000000000 --- a/AnalysisFW/plugins/Analysis_Template_MC.cc +++ /dev/null @@ -1,2282 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "TMath.h" -#include "TRandom.h" - -#include "parsePileUpJSON2.h" -#include "SMPJ/AnalysisFW/plugins/Analysis_Template_MC.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -//#include "../Unfolding/RooUnfold-1.1.1/src/RooUnfold.h" -//#include "../Unfolding/RooUnfold-1.1.1/src/RooUnfoldResponse.h" - -using namespace std; - -//---------------------------- Constructor Of The Class TriggerTurnOn -------------------------- // -Analysis_Template_MC::Analysis_Template_MC(edm::ParameterSet const& cfg) -{ - mFileName = cfg.getParameter> ("filename"); - mTreeName = cfg.getParameter ("treename"); - mDirName = cfg.getParameter ("dirname"); - - mMinPt = cfg.getParameter ("minPt"); - mYMax = cfg.getParameter ("ymax"); - mJetID = cfg.getParameter ("JetID"); - - mprintOk = cfg.getParameter ("printOk"); - - // mIsMCarlo = cfg.getUntrackedParameter ("isMCarlo"); - // mJECUncSrcNames = cfg.getParameter > ("jecUncSrcNames"); - //jecs = new JECs(mIsMCarlo, mGlobalTag, mjettype); - mGlobalTag = cfg.getParameter ("pseudoglobaltag"); - mjettype = cfg.getParameter ("jettype"); - - mIsMCarlo = cfg.getUntrackedParameter ("isMCarlo"); - mJECUncSrcNames = cfg.getParameter > ("jecUncSrcNames"); - mJECUncSrc = cfg.getParameter ("jecUncSrc"); - - mMCSlice= cfg.getParameter("MCSlice"); - mPUReweighting= cfg.getUntrackedParameter("PUReweighting"); - mLowPileUp= cfg.getUntrackedParameter("LowPileUp"); - -} - -//------------------------------ Declaration Of The Function beginjob() ------------------------// -void Analysis_Template_MC::beginJob() - { - - //for(unsigned i=0;iGet(mDirName.c_str()); - //TTree* mTreeFirst=(TTree*)mDir->Get(mTreeName.c_str()); - //mTree.push_back(mTreeFirst) - //Event = new QCDEvent(); - //TBranch *branch = mTree[i]->GetBranch("events"); - //branch->SetAddress(&Event); - //} - - //jecs = new JECs(mIsMCarlo, mGlobalTag, mjettype,mJECUncSrcNames); - - //Pt binning - double Ptbinning[81] = {0, 1, 5, 6, 8, 10, 12, 15, 18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84,97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468,507, 548, 592, 638, 686, 737, 790, 846, 905, 967,1032, 1101, 1172, 1248, 1327, 1410, 1497, 1588, 1684, 1784, 1890, 2000,2116, 2238, 2366, 2500, 2640, 2787, 2941, 3103, 3273, 3450, 3637, 3832,4037, 4252, 4477, 4713, 4961, 5220, 5492, 5777, 6076, 6389, 6717, 7000}; - - int Ptbins=80; - - //------------------ Histogram Booking --------------------------- // - num_of_Vtx = fs->make("num_of_Vtx","num_of_Vtx",100,0.,100.); - num_of_VtxGood = fs->make("num_of_VtxGood","num_of_VtxGood",100,0.,100.); - - mc_pthat = fs->make("mc_pthat","mc_pthat",200,0.,2000.); - mc_pthat_weighted = fs->make("mc_pthat_weighted","mc_pthat_weighted",100,0.,2000.); - mc_pthat_weighted->Sumw2(); - - pt0_GENJet = fs->make("pt0_GENJet","pt0_GENJet",Ptbins,Ptbinning); pt0_GENJet->Sumw2(); - pt1_GENJet = fs->make("pt1_GENJet","pt1_GENJet",Ptbins,Ptbinning); pt1_GENJet->Sumw2(); - y0_GENJet = fs->make("y0_GENJet","y0_GENJet",60,-5.,5.); y0_GENJet->Sumw2(); - y1_GENJet = fs->make("y1_GENJet","y1_GENJet",60,-5.,5.); y1_GENJet->Sumw2(); - phi0_GENJet = fs->make("phi0_GENJet","phi0_GENJet",60, -TMath::Pi(),TMath::Pi()); phi0_GENJet->Sumw2(); - phi1_GENJet = fs->make("phi1_GENJet","phi1_GENJet",60, -TMath::Pi(),TMath::Pi()); phi1_GENJet->Sumw2(); - - pt0_DETJet = fs->make("pt0_DETJet","pt0_DETJet",Ptbins,Ptbinning); pt0_DETJet->Sumw2(); - pt1_DETJet = fs->make("pt1_DETJet","pt1_DETJet",Ptbins,Ptbinning); pt1_DETJet->Sumw2(); - pt0_DETJetUncor = fs->make("pt0_DETJetUncor","pt0_DETJetUncor",Ptbins,Ptbinning); pt0_DETJetUncor->Sumw2(); - pt1_DETJetUncor = fs->make("pt1_DETJetUncor","pt1_DETJetUncor",Ptbins,Ptbinning); pt1_DETJetUncor->Sumw2(); - y0_DETJet = fs->make("y0_DETJet","y0_DETJet",60,-5.,5.); y0_DETJet->Sumw2(); - y1_DETJet = fs->make("y1_DETJet","y1_DETJet",60,-5.,5.); y1_DETJet->Sumw2(); - phi0_DETJet = fs->make("phi0_DETJet","phi0_DETJet",60, -TMath::Pi(),TMath::Pi()); phi0_DETJet->Sumw2(); - phi1_DETJet = fs->make("phi1_DETJet","phi1_DETJet",60, -TMath::Pi(),TMath::Pi()); phi1_DETJet->Sumw2(); - - Multiplicity_DETJet = fs->make("Multiplicity_DETJet","Multiplicity_DETJet",21, -0.5,20.5); Multiplicity_DETJet->Sumw2(); - Multiplicity_GENJet = fs->make("Multiplicity_GENJet","Multiplicity_GENJet",21, -0.5,20.5); Multiplicity_GENJet->Sumw2(); - - pt0_DETInclJet = fs->make("pt0_DETInclJet","pt0_DETInclJet",Ptbins,Ptbinning); pt0_DETInclJet->Sumw2(); - pt0_DETInclJetUncor = fs->make("pt0_DETInclJetUncor","pt0_DETInclJetUncor",Ptbins,Ptbinning); pt0_DETInclJetUncor->Sumw2(); - y0_DETInclJet = fs->make("y0_DETInclJet","y0_DETInclJet",60,-5.,5.); y0_DETInclJet->Sumw2(); - phi0_DETInclJet = fs->make("phi0_DETInclJet","phi0_DETInclJet",60, -TMath::Pi(),TMath::Pi()); phi0_DETInclJet->Sumw2(); - - PF_MatchedInclusiveJets = fs->make("PF_MatchedInclusiveJets","PF_MatchedInclusiveJets",Ptbins,Ptbinning); PF_MatchedInclusiveJets->Sumw2(); - Gen_MatchedInclusiveJets = fs->make("Gen_MatchedInclusiveJets","Gen_MatchedInclusiveJets",Ptbins,Ptbinning); Gen_MatchedInclusiveJets->Sumw2(); - TwoD_MatchedInclusiveJets = fs->make("TwoD_MatchedInclusiveJets","TwoD_MatchedInclusiveJets",Ptbins,Ptbinning,Ptbins,Ptbinning); TwoD_MatchedInclusiveJets->Sumw2(); - PF_FakeInclusiveJets = fs->make("PF_FakeInclusiveJets","PF_FakeInclusiveJets",Ptbins,Ptbinning); PF_FakeInclusiveJets->Sumw2(); - Gen_MissInclusiveJets = fs->make("Gen_MissInclusiveJets","Gen_MissInclusiveJets",Ptbins,Ptbinning); Gen_MissInclusiveJets->Sumw2(); - - PileUpVSVertex = fs->make("PileUpVSVertex","PileUpVSVertex",31,-0.5,30.5,31,-0.5,30.5); PileUpVSVertex->Sumw2(); - - DeltaR_Jets = fs->make("DeltaR_Jets","DeltaR_Jets",20, 0,10); DeltaR_Jets->Sumw2(); - - AcceptancePtJets= fs->make("AcceptancePtJets","AcceptancePtJets",Ptbins,Ptbinning); AcceptancePtJets->Sumw2(); - PurityPtJets= fs->make("PurityPtJets","PurityPtJets",Ptbins,Ptbinning); PurityPtJets->Sumw2(); - BackgroundPtJets= fs->make("BackgroundPtJets","BackgroundPtJets",Ptbins,Ptbinning); BackgroundPtJets->Sumw2(); - StabilityPtJets= fs->make("StabilityPtJets","StabilityPtJets",Ptbins,Ptbinning); StabilityPtJets->Sumw2(); - - AcceptancePtJets_1bin= fs->make("AcceptancePtJets_1bin","AcceptancePtJets_1bin",Ptbins,Ptbinning); - PurityPtJets_1bin= fs->make("PurityPtJets_1bin","PurityPtJets_1bin",Ptbins,Ptbinning); - AcceptancePtJets_2bin= fs->make("AcceptancePtJets_2bin","AcceptancePtJets_2bin",Ptbins,Ptbinning); - PurityPtJets_2bin= fs->make("PurityPtJets_2bin","PurityPtJets_2bin",Ptbins,Ptbinning); - AcceptancePtJets_3bin= fs->make("AcceptancePtJets_3bin","AcceptancePtJets_3bin",Ptbins,Ptbinning); - PurityPtJets_3bin= fs->make("PurityPtJets_3bin","PurityPtJets_3bin",Ptbins,Ptbinning); - AcceptancePtJets_4bin= fs->make("AcceptancePtJets_4bin","AcceptancePtJets_4bin",Ptbins,Ptbinning); - PurityPtJets_4bin= fs->make("PurityPtJets_4bin","PurityPtJets_4bin",Ptbins,Ptbinning); - AcceptancePtJets_5bin= fs->make("AcceptancePtJets_5bin","AcceptancePtJets_5bin",Ptbins,Ptbinning); - PurityPtJets_5bin= fs->make("PurityPtJets_5bin","PurityPtJets_5bin",Ptbins,Ptbinning); - AcceptancePtJets_6bin= fs->make("AcceptancePtJets_6bin","AcceptancePtJets_6bin",Ptbins,Ptbinning); - PurityPtJets_6bin= fs->make("PurityPtJets_6bin","PurityPtJets_6bin",Ptbins,Ptbinning); - AcceptancePtJets_7bin= fs->make("AcceptancePtJets_7bin","AcceptancePtJets_7bin",Ptbins,Ptbinning); - PurityPtJets_7bin= fs->make("PurityPtJets_7bin","PurityPtJets_7bin",Ptbins,Ptbinning); - - BackgroundPtJets_1bin= fs->make("BackgroundPtJets_1bin","BackgroundPtJets_1bin",Ptbins,Ptbinning); - StabilityPtJets_1bin= fs->make("StabilityPtJets_1bin","StabilityPtJets_1bin",Ptbins,Ptbinning); - BackgroundPtJets_2bin= fs->make("BackgroundPtJets_2bin","BackgroundPtJets_2bin",Ptbins,Ptbinning); - StabilityPtJets_2bin= fs->make("StabilityPtJets_2bin","StabilityPtJets_2bin",Ptbins,Ptbinning); - BackgroundPtJets_3bin= fs->make("BackgroundPtJets_3bin","BackgroundPtJets_3bin",Ptbins,Ptbinning); - StabilityPtJets_3bin= fs->make("StabilityPtJets_3bin","StabilityPtJets_3bin",Ptbins,Ptbinning); - BackgroundPtJets_4bin= fs->make("BackgroundPtJets_4bin","BackgroundPtJets_4bin",Ptbins,Ptbinning); - StabilityPtJets_4bin= fs->make("StabilityPtJets_4bin","StabilityPtJets_4bin",Ptbins,Ptbinning); - BackgroundPtJets_5bin= fs->make("BackgroundPtJets_5bin","BackgroundPtJets_5bin",Ptbins,Ptbinning); - StabilityPtJets_5bin= fs->make("StabilityPtJets_5bin","StabilityPtJets_5bin",Ptbins,Ptbinning); - BackgroundPtJets_6bin= fs->make("BackgroundPtJets_6bin","BackgroundPtJets_6bin",Ptbins,Ptbinning); - StabilityPtJets_6bin= fs->make("StabilityPtJets_6bin","StabilityPtJets_6bin",Ptbins,Ptbinning); - BackgroundPtJets_7bin= fs->make("BackgroundPtJets_7bin","BackgroundPtJets_7bin",Ptbins,Ptbinning); - StabilityPtJets_7bin= fs->make("StabilityPtJets_7bin","StabilityPtJets_7bin",Ptbins,Ptbinning); - - pt_DETInclJet_1bin = fs->make("pt_DETInclJet_1bin","pt_DETInclJet_1bin",Ptbins,Ptbinning); pt_DETInclJet_1bin->Sumw2(); - pt_DETInclJet_2bin = fs->make("pt_DETInclJet_2bin","pt_DETInclJet_2bin",Ptbins,Ptbinning); pt_DETInclJet_2bin->Sumw2(); - pt_DETInclJet_3bin = fs->make("pt_DETInclJet_3bin","pt_DETInclJet_3bin",Ptbins,Ptbinning); pt_DETInclJet_3bin->Sumw2(); - pt_DETInclJet_4bin = fs->make("pt_DETInclJet_4bin","pt_DETInclJet_4bin",Ptbins,Ptbinning); pt_DETInclJet_4bin->Sumw2(); - pt_DETInclJet_5bin = fs->make("pt_DETInclJet_5bin","pt_DETInclJet_5bin",Ptbins,Ptbinning); pt_DETInclJet_5bin->Sumw2(); - pt_DETInclJet_6bin = fs->make("pt_DETInclJet_6bin","pt_DETInclJet_6bin",Ptbins,Ptbinning); pt_DETInclJet_6bin->Sumw2(); - pt_DETInclJet_7bin = fs->make("pt_DETInclJet_7bin","pt_DETInclJet_7bin",Ptbins,Ptbinning); pt_DETInclJet_7bin->Sumw2(); - - pt_DETInclJetCrossSectNorm_1bin = fs->make("pt_DETInclJetCrossSectNorm_1bin","pt_DETInclJetCrossSectNorm_1bin",Ptbins,Ptbinning); pt_DETInclJetCrossSectNorm_1bin->Sumw2(); - pt_DETInclJetCrossSectNorm_2bin = fs->make("pt_DETInclJetCrossSectNorm_2bin","pt_DETInclJetCrossSectNorm_2bin",Ptbins,Ptbinning); pt_DETInclJetCrossSectNorm_2bin->Sumw2(); - pt_DETInclJetCrossSectNorm_3bin = fs->make("pt_DETInclJetCrossSectNorm_3bin","pt_DETInclJetCrossSectNorm_3bin",Ptbins,Ptbinning); pt_DETInclJetCrossSectNorm_3bin->Sumw2(); - pt_DETInclJetCrossSectNorm_4bin = fs->make("pt_DETInclJetCrossSectNorm_4bin","pt_DETInclJetCrossSectNorm_4bin",Ptbins,Ptbinning); pt_DETInclJetCrossSectNorm_4bin->Sumw2(); - pt_DETInclJetCrossSectNorm_5bin = fs->make("pt_DETInclJetCrossSectNorm_5bin","pt_DETInclJetCrossSectNorm_5bin",Ptbins,Ptbinning); pt_DETInclJetCrossSectNorm_5bin->Sumw2(); - pt_DETInclJetCrossSectNorm_6bin = fs->make("pt_DETInclJetCrossSectNorm_6bin","pt_DETInclJetCrossSectNorm_6bin",Ptbins,Ptbinning); pt_DETInclJetCrossSectNorm_6bin->Sumw2(); - pt_DETInclJetCrossSectNorm_7bin = fs->make("pt_DETInclJetCrossSectNorm_7bin","pt_DETInclJetCrossSectNorm_7bin",Ptbins,Ptbinning); pt_DETInclJetCrossSectNorm_7bin->Sumw2(); - - pt_DETInclJet60_1bin = fs->make("pt_DETInclJet60_1bin","pt_DETInclJet60_1bin",Ptbins,Ptbinning); pt_DETInclJet60_1bin->Sumw2(); - pt_DETInclJet60_2bin = fs->make("pt_DETInclJet60_2bin","pt_DETInclJet60_2bin",Ptbins,Ptbinning); pt_DETInclJet60_2bin->Sumw2(); - pt_DETInclJet60_3bin = fs->make("pt_DETInclJet60_3bin","pt_DETInclJet60_3bin",Ptbins,Ptbinning); pt_DETInclJet60_3bin->Sumw2(); - pt_DETInclJet60_4bin = fs->make("pt_DETInclJet60_4bin","pt_DETInclJet60_4bin",Ptbins,Ptbinning); pt_DETInclJet60_4bin->Sumw2(); - pt_DETInclJet60_5bin = fs->make("pt_DETInclJet60_5bin","pt_DETInclJet60_5bin",Ptbins,Ptbinning); pt_DETInclJet60_5bin->Sumw2(); - pt_DETInclJet60_6bin = fs->make("pt_DETInclJet60_6bin","pt_DETInclJet60_6bin",Ptbins,Ptbinning); pt_DETInclJet60_6bin->Sumw2(); - pt_DETInclJet60_7bin = fs->make("pt_DETInclJet60_7bin","pt_DETInclJet60_7bin",Ptbins,Ptbinning); pt_DETInclJet60_7bin->Sumw2(); - - pt_DETInclJet80_1bin = fs->make("pt_DETInclJet80_1bin","pt_DETInclJet80_1bin",Ptbins,Ptbinning); pt_DETInclJet80_1bin->Sumw2(); - pt_DETInclJet80_2bin = fs->make("pt_DETInclJet80_2bin","pt_DETInclJet80_2bin",Ptbins,Ptbinning); pt_DETInclJet80_2bin->Sumw2(); - pt_DETInclJet80_3bin = fs->make("pt_DETInclJet80_3bin","pt_DETInclJet80_3bin",Ptbins,Ptbinning); pt_DETInclJet80_3bin->Sumw2(); - pt_DETInclJet80_4bin = fs->make("pt_DETInclJet80_4bin","pt_DETInclJet80_4bin",Ptbins,Ptbinning); pt_DETInclJet80_4bin->Sumw2(); - pt_DETInclJet80_5bin = fs->make("pt_DETInclJet80_5bin","pt_DETInclJet80_5bin",Ptbins,Ptbinning); pt_DETInclJet80_5bin->Sumw2(); - pt_DETInclJet80_6bin = fs->make("pt_DETInclJet80_6bin","pt_DETInclJet80_6bin",Ptbins,Ptbinning); pt_DETInclJet80_6bin->Sumw2(); - pt_DETInclJet80_7bin = fs->make("pt_DETInclJet80_7bin","pt_DETInclJet80_7bin",Ptbins,Ptbinning); pt_DETInclJet80_7bin->Sumw2(); - - pt_DETInclJet140_1bin = fs->make("pt_DETInclJet140_1bin","pt_DETInclJet140_1bin",Ptbins,Ptbinning); pt_DETInclJet140_1bin->Sumw2(); - pt_DETInclJet140_2bin = fs->make("pt_DETInclJet140_2bin","pt_DETInclJet140_2bin",Ptbins,Ptbinning); pt_DETInclJet140_2bin->Sumw2(); - pt_DETInclJet140_3bin = fs->make("pt_DETInclJet140_3bin","pt_DETInclJet140_3bin",Ptbins,Ptbinning); pt_DETInclJet140_3bin->Sumw2(); - pt_DETInclJet140_4bin = fs->make("pt_DETInclJet140_4bin","pt_DETInclJet140_4bin",Ptbins,Ptbinning); pt_DETInclJet140_4bin->Sumw2(); - pt_DETInclJet140_5bin = fs->make("pt_DETInclJet140_5bin","pt_DETInclJet140_5bin",Ptbins,Ptbinning); pt_DETInclJet140_5bin->Sumw2(); - pt_DETInclJet140_6bin = fs->make("pt_DETInclJet140_6bin","pt_DETInclJet140_6bin",Ptbins,Ptbinning); pt_DETInclJet140_6bin->Sumw2(); - pt_DETInclJet140_7bin = fs->make("pt_DETInclJet140_7bin","pt_DETInclJet140_7bin",Ptbins,Ptbinning); pt_DETInclJet140_7bin->Sumw2(); - - pt_DETInclJet200_1bin = fs->make("pt_DETInclJet200_1bin","pt_DETInclJet200_1bin",Ptbins,Ptbinning); pt_DETInclJet200_1bin->Sumw2(); - pt_DETInclJet200_2bin = fs->make("pt_DETInclJet200_2bin","pt_DETInclJet200_2bin",Ptbins,Ptbinning); pt_DETInclJet200_2bin->Sumw2(); - pt_DETInclJet200_3bin = fs->make("pt_DETInclJet200_3bin","pt_DETInclJet200_3bin",Ptbins,Ptbinning); pt_DETInclJet200_3bin->Sumw2(); - pt_DETInclJet200_4bin = fs->make("pt_DETInclJet200_4bin","pt_DETInclJet200_4bin",Ptbins,Ptbinning); pt_DETInclJet200_4bin->Sumw2(); - pt_DETInclJet200_5bin = fs->make("pt_DETInclJet200_5bin","pt_DETInclJet200_5bin",Ptbins,Ptbinning); pt_DETInclJet200_5bin->Sumw2(); - pt_DETInclJet200_6bin = fs->make("pt_DETInclJet200_6bin","pt_DETInclJet200_6bin",Ptbins,Ptbinning); pt_DETInclJet200_6bin->Sumw2(); - pt_DETInclJet200_7bin = fs->make("pt_DETInclJet200_7bin","pt_DETInclJet200_7bin",Ptbins,Ptbinning); pt_DETInclJet200_7bin->Sumw2(); - - pt_DETInclJet260_1bin = fs->make("pt_DETInclJet260_1bin","pt_DETInclJet260_1bin",Ptbins,Ptbinning); pt_DETInclJet260_1bin->Sumw2(); - pt_DETInclJet260_2bin = fs->make("pt_DETInclJet260_2bin","pt_DETInclJet260_2bin",Ptbins,Ptbinning); pt_DETInclJet260_2bin->Sumw2(); - pt_DETInclJet260_3bin = fs->make("pt_DETInclJet260_3bin","pt_DETInclJet260_3bin",Ptbins,Ptbinning); pt_DETInclJet260_3bin->Sumw2(); - pt_DETInclJet260_4bin = fs->make("pt_DETInclJet260_4bin","pt_DETInclJet260_4bin",Ptbins,Ptbinning); pt_DETInclJet260_4bin->Sumw2(); - pt_DETInclJet260_5bin = fs->make("pt_DETInclJet260_5bin","pt_DETInclJet260_5bin",Ptbins,Ptbinning); pt_DETInclJet260_5bin->Sumw2(); - pt_DETInclJet260_6bin = fs->make("pt_DETInclJet260_6bin","pt_DETInclJet260_6bin",Ptbins,Ptbinning); pt_DETInclJet260_6bin->Sumw2(); - pt_DETInclJet260_7bin = fs->make("pt_DETInclJet260_7bin","pt_DETInclJet260_7bin",Ptbins,Ptbinning); pt_DETInclJet260_7bin->Sumw2(); - - pt_DETInclJet320_1bin = fs->make("pt_DETInclJet320_1bin","pt_DETInclJet320_1bin",Ptbins,Ptbinning); pt_DETInclJet320_1bin->Sumw2(); - pt_DETInclJet320_2bin = fs->make("pt_DETInclJet320_2bin","pt_DETInclJet320_2bin",Ptbins,Ptbinning); pt_DETInclJet320_2bin->Sumw2(); - pt_DETInclJet320_3bin = fs->make("pt_DETInclJet320_3bin","pt_DETInclJet320_3bin",Ptbins,Ptbinning); pt_DETInclJet320_3bin->Sumw2(); - pt_DETInclJet320_4bin = fs->make("pt_DETInclJet320_4bin","pt_DETInclJet320_4bin",Ptbins,Ptbinning); pt_DETInclJet320_4bin->Sumw2(); - pt_DETInclJet320_5bin = fs->make("pt_DETInclJet320_5bin","pt_DETInclJet320_5bin",Ptbins,Ptbinning); pt_DETInclJet320_5bin->Sumw2(); - pt_DETInclJet320_6bin = fs->make("pt_DETInclJet320_6bin","pt_DETInclJet320_6bin",Ptbins,Ptbinning); pt_DETInclJet320_6bin->Sumw2(); - pt_DETInclJet320_7bin = fs->make("pt_DETInclJet320_7bin","pt_DETInclJet320_7bin",Ptbins,Ptbinning); pt_DETInclJet320_7bin->Sumw2(); - - pt_DETInclJet400_1bin = fs->make("pt_DETInclJet400_1bin","pt_DETInclJet400_1bin",Ptbins,Ptbinning); pt_DETInclJet400_1bin->Sumw2(); - pt_DETInclJet400_2bin = fs->make("pt_DETInclJet400_2bin","pt_DETInclJet400_2bin",Ptbins,Ptbinning); pt_DETInclJet400_2bin->Sumw2(); - pt_DETInclJet400_3bin = fs->make("pt_DETInclJet400_3bin","pt_DETInclJet400_3bin",Ptbins,Ptbinning); pt_DETInclJet400_3bin->Sumw2(); - pt_DETInclJet400_4bin = fs->make("pt_DETInclJet400_4bin","pt_DETInclJet400_4bin",Ptbins,Ptbinning); pt_DETInclJet400_4bin->Sumw2(); - pt_DETInclJet400_5bin = fs->make("pt_DETInclJet400_5bin","pt_DETInclJet400_5bin",Ptbins,Ptbinning); pt_DETInclJet400_5bin->Sumw2(); - pt_DETInclJet400_6bin = fs->make("pt_DETInclJet400_6bin","pt_DETInclJet400_6bin",Ptbins,Ptbinning); pt_DETInclJet400_6bin->Sumw2(); - pt_DETInclJet400_7bin = fs->make("pt_DETInclJet400_7bin","pt_DETInclJet400_7bin",Ptbins,Ptbinning); pt_DETInclJet400_7bin->Sumw2(); - - pt_DETInclJet450_1bin = fs->make("pt_DETInclJet450_1bin","pt_DETInclJet450_1bin",Ptbins,Ptbinning); pt_DETInclJet450_1bin->Sumw2(); - pt_DETInclJet450_2bin = fs->make("pt_DETInclJet450_2bin","pt_DETInclJet450_2bin",Ptbins,Ptbinning); pt_DETInclJet450_2bin->Sumw2(); - pt_DETInclJet450_3bin = fs->make("pt_DETInclJet450_3bin","pt_DETInclJet450_3bin",Ptbins,Ptbinning); pt_DETInclJet450_3bin->Sumw2(); - pt_DETInclJet450_4bin = fs->make("pt_DETInclJet450_4bin","pt_DETInclJet450_4bin",Ptbins,Ptbinning); pt_DETInclJet450_4bin->Sumw2(); - pt_DETInclJet450_5bin = fs->make("pt_DETInclJet450_5bin","pt_DETInclJet450_5bin",Ptbins,Ptbinning); pt_DETInclJet450_5bin->Sumw2(); - pt_DETInclJet450_6bin = fs->make("pt_DETInclJet450_6bin","pt_DETInclJet450_6bin",Ptbins,Ptbinning); pt_DETInclJet450_6bin->Sumw2(); - pt_DETInclJet450_7bin = fs->make("pt_DETInclJet450_7bin","pt_DETInclJet450_7bin",Ptbins,Ptbinning); pt_DETInclJet450_7bin->Sumw2(); - - pt_GENInclJet_1bin = fs->make("pt_GENInclJet_1bin","pt_GENInclJet_1bin",Ptbins,Ptbinning); pt_GENInclJet_1bin->Sumw2(); - pt_GENInclJet_2bin = fs->make("pt_GENInclJet_2bin","pt_GENInclJet_2bin",Ptbins,Ptbinning); pt_GENInclJet_2bin->Sumw2(); - pt_GENInclJet_3bin = fs->make("pt_GENInclJet_3bin","pt_GENInclJet_3bin",Ptbins,Ptbinning); pt_GENInclJet_3bin->Sumw2(); - pt_GENInclJet_4bin = fs->make("pt_GENInclJet_4bin","pt_GENInclJet_4bin",Ptbins,Ptbinning); pt_GENInclJet_4bin->Sumw2(); - pt_GENInclJet_5bin = fs->make("pt_GENInclJet_5bin","pt_GENInclJet_5bin",Ptbins,Ptbinning); pt_GENInclJet_5bin->Sumw2(); - pt_GENInclJet_6bin = fs->make("pt_GENInclJet_6bin","pt_GENInclJet_6bin",Ptbins,Ptbinning); pt_GENInclJet_6bin->Sumw2(); - pt_GENInclJet_7bin = fs->make("pt_GENInclJet_7bin","pt_GENInclJet_7bin",Ptbins,Ptbinning); pt_GENInclJet_7bin->Sumw2(); - - pt_GENInclJetCrossSectNorm_1bin = fs->make("pt_GENInclJetCrossSectNorm_1bin","pt_GENInclJetCrossSectNorm_1bin",Ptbins,Ptbinning); pt_GENInclJetCrossSectNorm_1bin->Sumw2(); - pt_GENInclJetCrossSectNorm_2bin = fs->make("pt_GENInclJetCrossSectNorm_2bin","pt_GENInclJetCrossSectNorm_2bin",Ptbins,Ptbinning); pt_GENInclJetCrossSectNorm_2bin->Sumw2(); - pt_GENInclJetCrossSectNorm_3bin = fs->make("pt_GENInclJetCrossSectNorm_3bin","pt_GENInclJetCrossSectNorm_3bin",Ptbins,Ptbinning); pt_GENInclJetCrossSectNorm_3bin->Sumw2(); - pt_GENInclJetCrossSectNorm_4bin = fs->make("pt_GENInclJetCrossSectNorm_4bin","pt_GENInclJetCrossSectNorm_4bin",Ptbins,Ptbinning); pt_GENInclJetCrossSectNorm_4bin->Sumw2(); - pt_GENInclJetCrossSectNorm_5bin = fs->make("pt_GENInclJetCrossSectNorm_5bin","pt_GENInclJetCrossSectNorm_5bin",Ptbins,Ptbinning); pt_GENInclJetCrossSectNorm_5bin->Sumw2(); - pt_GENInclJetCrossSectNorm_6bin = fs->make("pt_GENInclJetCrossSectNorm_6bin","pt_GENInclJetCrossSectNorm_6bin",Ptbins,Ptbinning); pt_GENInclJetCrossSectNorm_6bin->Sumw2(); - pt_GENInclJetCrossSectNorm_7bin = fs->make("pt_GENInclJetCrossSectNorm_7bin","pt_GENInclJetCrossSectNorm_7bin",Ptbins,Ptbinning); pt_GENInclJetCrossSectNorm_7bin->Sumw2(); - - PF_FakeInclusiveJets_1bin = fs->make("PF_FakeInclusiveJets_1bin","PF_FakeInclusiveJets_1bin",Ptbins,Ptbinning); PF_FakeInclusiveJets_1bin->Sumw2(); - PF_FakeInclusiveJets_2bin = fs->make("PF_FakeInclusiveJets_2bin","PF_FakeInclusiveJets_2bin",Ptbins,Ptbinning); PF_FakeInclusiveJets_2bin->Sumw2(); - PF_FakeInclusiveJets_3bin = fs->make("PF_FakeInclusiveJets_3bin","PF_FakeInclusiveJets_3bin",Ptbins,Ptbinning); PF_FakeInclusiveJets_3bin->Sumw2(); - PF_FakeInclusiveJets_4bin = fs->make("PF_FakeInclusiveJets_4bin","PF_FakeInclusiveJets_4bin",Ptbins,Ptbinning); PF_FakeInclusiveJets_4bin->Sumw2(); - PF_FakeInclusiveJets_5bin = fs->make("PF_FakeInclusiveJets_5bin","PF_FakeInclusiveJets_5bin",Ptbins,Ptbinning); PF_FakeInclusiveJets_5bin->Sumw2(); - PF_FakeInclusiveJets_6bin = fs->make("PF_FakeInclusiveJets_6bin","PF_FakeInclusiveJets_6bin",Ptbins,Ptbinning); PF_FakeInclusiveJets_6bin->Sumw2(); - PF_FakeInclusiveJets_7bin = fs->make("PF_FakeInclusiveJets_7bin","PF_FakeInclusiveJets_7bin",Ptbins,Ptbinning); PF_FakeInclusiveJets_7bin->Sumw2(); - - Gen_MissInclusiveJets_1bin = fs->make("Gen_MissInclusiveJets_1bin","Gen_MissInclusiveJets_1bin",Ptbins,Ptbinning); Gen_MissInclusiveJets_1bin->Sumw2(); - Gen_MissInclusiveJets_2bin = fs->make("Gen_MissInclusiveJets_2bin","Gen_MissInclusiveJets_2bin",Ptbins,Ptbinning); Gen_MissInclusiveJets_2bin->Sumw2(); - Gen_MissInclusiveJets_3bin = fs->make("Gen_MissInclusiveJets_3bin","Gen_MissInclusiveJets_3bin",Ptbins,Ptbinning); Gen_MissInclusiveJets_3bin->Sumw2(); - Gen_MissInclusiveJets_4bin = fs->make("Gen_MissInclusiveJets_4bin","Gen_MissInclusiveJets_4bin",Ptbins,Ptbinning); Gen_MissInclusiveJets_4bin->Sumw2(); - Gen_MissInclusiveJets_5bin = fs->make("Gen_MissInclusiveJets_5bin","Gen_MissInclusiveJets_5bin",Ptbins,Ptbinning); Gen_MissInclusiveJets_5bin->Sumw2(); - Gen_MissInclusiveJets_6bin = fs->make("Gen_MissInclusiveJets_6bin","Gen_MissInclusiveJets_6bin",Ptbins,Ptbinning); Gen_MissInclusiveJets_6bin->Sumw2(); - Gen_MissInclusiveJets_7bin = fs->make("Gen_MissInclusiveJets_7bin","Gen_MissInclusiveJets_7bin",Ptbins,Ptbinning); Gen_MissInclusiveJets_7bin->Sumw2(); - - PF_MatchedInclusiveJets_1bin = fs->make("PF_MatchedInclusiveJets_1bin","PF_MatchedInclusiveJets_1bin",Ptbins,Ptbinning); PF_MatchedInclusiveJets_1bin->Sumw2(); - PF_MatchedInclusiveJets_2bin = fs->make("PF_MatchedInclusiveJets_2bin","PF_MatchedInclusiveJets_2bin",Ptbins,Ptbinning); PF_MatchedInclusiveJets_2bin->Sumw2(); - PF_MatchedInclusiveJets_3bin = fs->make("PF_MatchedInclusiveJets_3bin","PF_MatchedInclusiveJets_3bin",Ptbins,Ptbinning); PF_MatchedInclusiveJets_3bin->Sumw2(); - PF_MatchedInclusiveJets_4bin = fs->make("PF_MatchedInclusiveJets_4bin","PF_MatchedInclusiveJets_4bin",Ptbins,Ptbinning); PF_MatchedInclusiveJets_4bin->Sumw2(); - PF_MatchedInclusiveJets_5bin = fs->make("PF_MatchedInclusiveJets_5bin","PF_MatchedInclusiveJets_5bin",Ptbins,Ptbinning); PF_MatchedInclusiveJets_5bin->Sumw2(); - PF_MatchedInclusiveJets_6bin = fs->make("PF_MatchedInclusiveJets_6bin","PF_MatchedInclusiveJets_6bin",Ptbins,Ptbinning); PF_MatchedInclusiveJets_6bin->Sumw2(); - PF_MatchedInclusiveJets_7bin = fs->make("PF_MatchedInclusiveJets_7bin","PF_MatchedInclusiveJets_7bin",Ptbins,Ptbinning); PF_MatchedInclusiveJets_7bin->Sumw2(); - - Gen_MatchedInclusiveJets_1bin = fs->make("Gen_MatchedInclusiveJets_1bin","Gen_MatchedInclusiveJets_1bin",Ptbins,Ptbinning); Gen_MatchedInclusiveJets_1bin->Sumw2(); - Gen_MatchedInclusiveJets_2bin = fs->make("Gen_MatchedInclusiveJets_2bin","Gen_MatchedInclusiveJets_2bin",Ptbins,Ptbinning); Gen_MatchedInclusiveJets_2bin->Sumw2(); - Gen_MatchedInclusiveJets_3bin = fs->make("Gen_MatchedInclusiveJets_3bin","Gen_MatchedInclusiveJets_3bin",Ptbins,Ptbinning); Gen_MatchedInclusiveJets_3bin->Sumw2(); - Gen_MatchedInclusiveJets_4bin = fs->make("Gen_MatchedInclusiveJets_4bin","Gen_MatchedInclusiveJets_4bin",Ptbins,Ptbinning); Gen_MatchedInclusiveJets_4bin->Sumw2(); - Gen_MatchedInclusiveJets_5bin = fs->make("Gen_MatchedInclusiveJets_5bin","Gen_MatchedInclusiveJets_5bin",Ptbins,Ptbinning); Gen_MatchedInclusiveJets_5bin->Sumw2(); - Gen_MatchedInclusiveJets_6bin = fs->make("Gen_MatchedInclusiveJets_6bin","Gen_MatchedInclusiveJets_6bin",Ptbins,Ptbinning); Gen_MatchedInclusiveJets_6bin->Sumw2(); - Gen_MatchedInclusiveJets_7bin = fs->make("Gen_MatchedInclusiveJets_7bin","Gen_MatchedInclusiveJets_7bin",Ptbins,Ptbinning); Gen_MatchedInclusiveJets_7bin->Sumw2(); - - TwoD_MatchedInclusiveJets_1bin = fs->make("TwoD_MatchedInclusiveJets_1bin","TwoD_MatchedInclusiveJets_1bin",Ptbins,Ptbinning,Ptbins,Ptbinning); TwoD_MatchedInclusiveJets_1bin->Sumw2(); - TwoD_MatchedInclusiveJets_2bin = fs->make("TwoD_MatchedInclusiveJets_2bin","TwoD_MatchedInclusiveJets_2bin",Ptbins,Ptbinning,Ptbins,Ptbinning); TwoD_MatchedInclusiveJets_2bin->Sumw2(); - TwoD_MatchedInclusiveJets_3bin = fs->make("TwoD_MatchedInclusiveJets_3bin","TwoD_MatchedInclusiveJets_3bin",Ptbins,Ptbinning,Ptbins,Ptbinning); TwoD_MatchedInclusiveJets_3bin->Sumw2(); - TwoD_MatchedInclusiveJets_4bin = fs->make("TwoD_MatchedInclusiveJets_4bin","TwoD_MatchedInclusiveJets_4bin",Ptbins,Ptbinning,Ptbins,Ptbinning); TwoD_MatchedInclusiveJets_4bin->Sumw2(); - TwoD_MatchedInclusiveJets_5bin = fs->make("TwoD_MatchedInclusiveJets_5bin","TwoD_MatchedInclusiveJets_5bin",Ptbins,Ptbinning,Ptbins,Ptbinning); TwoD_MatchedInclusiveJets_5bin->Sumw2(); - TwoD_MatchedInclusiveJets_6bin = fs->make("TwoD_MatchedInclusiveJets_6bin","TwoD_MatchedInclusiveJets_6bin",Ptbins,Ptbinning,Ptbins,Ptbinning); TwoD_MatchedInclusiveJets_6bin->Sumw2(); - TwoD_MatchedInclusiveJets_7bin = fs->make("TwoD_MatchedInclusiveJets_7bin","TwoD_MatchedInclusiveJets_7bin",Ptbins,Ptbinning,Ptbins,Ptbinning); TwoD_MatchedInclusiveJets_7bin->Sumw2(); - - Resolution1D = fs->make("Resolution1D","Resolution1D",100,-5,5); - ResolutionForward1D = fs->make("ResolutionForward1D","ResolutionForward1D",100,-5,5); - - ResolutionInclusiveJets = fs->make("ResolutionInclusiveJets","ResolutionInclusiveJets",Ptbins,Ptbinning,0,5); - ResolutionInclusiveJets_1bin = fs->make("ResolutionInclusiveJets_1bin","ResolutionInclusiveJets_1bin",Ptbins,Ptbinning,0,5); - ResolutionInclusiveJets_2bin = fs->make("ResolutionInclusiveJets_2bin","ResolutionInclusiveJets_2bin",Ptbins,Ptbinning,0,5); - ResolutionInclusiveJets_3bin = fs->make("ResolutionInclusiveJets_3bin","ResolutionInclusiveJets_3bin",Ptbins,Ptbinning,0,5); - ResolutionInclusiveJets_4bin = fs->make("ResolutionInclusiveJets_4bin","ResolutionInclusiveJets_4bin",Ptbins,Ptbinning,0,5); - ResolutionInclusiveJets_5bin = fs->make("ResolutionInclusiveJets_5bin","ResolutionInclusiveJets_5bin",Ptbins,Ptbinning,0,5); - ResolutionInclusiveJets_6bin = fs->make("ResolutionInclusiveJets_6bin","ResolutionInclusiveJets_6bin",Ptbins,Ptbinning,0,5); - ResolutionInclusiveJets_7bin = fs->make("ResolutionInclusiveJets_7bin","ResolutionInclusiveJets_7bin",Ptbins,Ptbinning,0,5); - - ResolutionTagAndProbe = fs->make("ResolutionTagAndProbe","ResolutionTagAndProbe",Ptbins,Ptbinning,0,5); - - //trigger efficiency measurement - TagAndProbeNum= fs->make("TagAndProbeNum","TagAndProbeNum",Ptbins,Ptbinning); - TagAndProbeDen= fs->make("TagAndProbeDen","TagAndProbeDen",Ptbins,Ptbinning); - TagAndProbeEff= fs->make("TagAndProbeEff","TagAndProbeEff",Ptbins,Ptbinning); - - hist_leading_pt_emulated_Jet60= fs->make("hist_leading_pt_emulated_Jet60","hist_leading_pt_emulated_Jet60",Ptbins,Ptbinning); - hist_leading_pt_all_Jet60= fs->make("hist_leading_pt_all_Jet60","hist_leading_pt_all_Jet60",Ptbins,Ptbinning); - hist_leading_eta_emulated_Jet60= fs->make("hist_leading_eta_emulated_Jet60","hist_leading_eta_emulated_Jet60",24,-5.2,5.2); - hist_leading_eta_all_Jet60= fs->make("hist_leading_eta_all_Jet60","hist_leading_eta_all_Jet60",24,-5.2,5.2); - - hist_leading_pt_HLT_Jet60U_eff= fs->make("hist_leading_pt_HLT_Jet60U_eff","hist_leading_pt_HLT_Jet60U_eff",Ptbins,Ptbinning); - hist_leading_eta_HLT_Jet60U_eff= fs->make("hist_leading_eta_HLT_Jet60U_eff","hist_leading_eta_HLT_Jet60U_eff",24,-5.2,5.2); - - hist_leading_pt_emulated_Jet80= fs->make("hist_leading_pt_emulated_Jet80","hist_leading_pt_emulated_Jet80",Ptbins,Ptbinning); - hist_leading_pt_all_Jet80= fs->make("hist_leading_pt_all_Jet80","hist_leading_pt_all_Jet80",Ptbins,Ptbinning); - hist_leading_eta_emulated_Jet80= fs->make("hist_leading_eta_emulated_Jet80","hist_leading_eta_emulated_Jet80",24,-5.2,5.2); - hist_leading_eta_all_Jet80= fs->make("hist_leading_eta_all_Jet80","hist_leading_eta_all_Jet80",24,-5.2,5.2); - - hist_leading_pt_HLT_Jet80U_eff= fs->make("hist_leading_pt_HLT_Jet80U_eff","hist_leading_pt_HLT_Jet80U_eff",Ptbins,Ptbinning); - hist_leading_eta_HLT_Jet80U_eff= fs->make("hist_leading_eta_HLT_Jet80U_eff","hist_leading_eta_HLT_Jet80U_eff",24,-5.2,5.2); - - hist_leading_pt_emulated_Jet140= fs->make("hist_leading_pt_emulated_Jet140","hist_leading_pt_emulated_Jet140",Ptbins,Ptbinning); - hist_leading_pt_all_Jet140= fs->make("hist_leading_pt_all_Jet140","hist_leading_pt_all_Jet140",Ptbins,Ptbinning); - hist_leading_eta_emulated_Jet140= fs->make("hist_leading_eta_emulated_Jet140","hist_leading_eta_emulated_Jet140",24,-5.2,5.2); - hist_leading_eta_all_Jet140= fs->make("hist_leading_eta_all_Jet140","hist_leading_eta_all_Jet140",24,-5.2,5.2); - - hist_leading_pt_HLT_Jet140U_eff= fs->make("hist_leading_pt_HLT_Jet140U_eff","hist_leading_pt_HLT_Jet140U_eff",Ptbins,Ptbinning); - hist_leading_eta_HLT_Jet140U_eff= fs->make("hist_leading_eta_HLT_Jet140U_eff","hist_leading_eta_HLT_Jet140U_eff",24,-5.2,5.2); - - hist_leading_pt_emulated_Jet200= fs->make("hist_leading_pt_emulated_Jet200","hist_leading_pt_emulated_Jet200",Ptbins,Ptbinning); - hist_leading_pt_all_Jet200= fs->make("hist_leading_pt_all_Jet200","hist_leading_pt_all_Jet200",Ptbins,Ptbinning); - hist_leading_eta_emulated_Jet200= fs->make("hist_leading_eta_emulated_Jet200","hist_leading_eta_emulated_Jet200",24,-5.2,5.2); - hist_leading_eta_all_Jet200= fs->make("hist_leading_eta_all_Jet200","hist_leading_eta_all_Jet200",24,-5.2,5.2); - - hist_leading_pt_HLT_Jet200U_eff= fs->make("hist_leading_pt_HLT_Jet200U_eff","hist_leading_pt_HLT_Jet200U_eff",Ptbins,Ptbinning); - hist_leading_eta_HLT_Jet200U_eff= fs->make("hist_leading_eta_HLT_Jet200U_eff","hist_leading_eta_HLT_Jet200U_eff",24,-5.2,5.2); - - hist_leading_pt_emulated_Jet260= fs->make("hist_leading_pt_emulated_Jet260","hist_leading_pt_emulated_Jet260",Ptbins,Ptbinning); - hist_leading_pt_all_Jet260= fs->make("hist_leading_pt_all_Jet260","hist_leading_pt_all_Jet260",Ptbins,Ptbinning); - hist_leading_eta_emulated_Jet260= fs->make("hist_leading_eta_emulated_Jet260","hist_leading_eta_emulated_Jet260",24,-5.2,5.2); - hist_leading_eta_all_Jet260= fs->make("hist_leading_eta_all_Jet260","hist_leading_eta_all_Jet260",24,-5.2,5.2); - - hist_leading_pt_HLT_Jet260U_eff= fs->make("hist_leading_pt_HLT_Jet260U_eff","hist_leading_pt_HLT_Jet260U_eff",Ptbins,Ptbinning); - hist_leading_eta_HLT_Jet260U_eff= fs->make("hist_leading_eta_HLT_Jet260U_eff","hist_leading_eta_HLT_Jet260U_eff",24,-5.2,5.2); - - hist_leading_pt_emulated_Jet320= fs->make("hist_leading_pt_emulated_Jet320","hist_leading_pt_emulated_Jet320",Ptbins,Ptbinning); - hist_leading_pt_all_Jet320= fs->make("hist_leading_pt_all_Jet320","hist_leading_pt_all_Jet320",Ptbins,Ptbinning); - hist_leading_eta_emulated_Jet320= fs->make("hist_leading_eta_emulated_Jet320","hist_leading_eta_emulated_Jet320",24,-5.2,5.2); - hist_leading_eta_all_Jet320= fs->make("hist_leading_eta_all_Jet320","hist_leading_eta_all_Jet320",24,-5.2,5.2); - - hist_leading_pt_HLT_Jet320U_eff= fs->make("hist_leading_pt_HLT_Jet320U_eff","hist_leading_pt_HLT_Jet320U_eff",Ptbins,Ptbinning); - hist_leading_eta_HLT_Jet320U_eff= fs->make("hist_leading_eta_HLT_Jet320U_eff","hist_leading_eta_HLT_Jet320U_eff",24,-5.2,5.2); - - hist_leading_pt_emulated_Jet400= fs->make("hist_leading_pt_emulated_Jet400","hist_leading_pt_emulated_Jet400",Ptbins,Ptbinning); - hist_leading_pt_all_Jet400= fs->make("hist_leading_pt_all_Jet400","hist_leading_pt_all_Jet400",Ptbins,Ptbinning); - hist_leading_eta_emulated_Jet400= fs->make("hist_leading_eta_emulated_Jet400","hist_leading_eta_emulated_Jet400",24,-5.2,5.2); - hist_leading_eta_all_Jet400= fs->make("hist_leading_eta_all_Jet400","hist_leading_eta_all_Jet400",24,-5.2,5.2); - - hist_leading_pt_HLT_Jet400U_eff= fs->make("hist_leading_pt_HLT_Jet400U_eff","hist_leading_pt_HLT_Jet400U_eff",Ptbins,Ptbinning); - hist_leading_eta_HLT_Jet400U_eff= fs->make("hist_leading_eta_HLT_Jet400U_eff","hist_leading_eta_HLT_Jet400U_eff",24,-5.2,5.2); - - hist_leading_pt_emulated_Jet450= fs->make("hist_leading_pt_emulated_Jet450","hist_leading_pt_emulated_Jet450",Ptbins,Ptbinning); - hist_leading_pt_all_Jet450= fs->make("hist_leading_pt_all_Jet450","hist_leading_pt_all_Jet450",Ptbins,Ptbinning); - hist_leading_eta_emulated_Jet450= fs->make("hist_leading_eta_emulated_Jet450","hist_leading_eta_emulated_Jet450",24,-5.2,5.2); - hist_leading_eta_all_Jet450= fs->make("hist_leading_eta_all_Jet450","hist_leading_eta_all_Jet450",24,-5.2,5.2); - - hist_leading_pt_HLT_Jet450U_eff= fs->make("hist_leading_pt_HLT_Jet450U_eff","hist_leading_pt_HLT_Jet450U_eff",Ptbins,Ptbinning); - hist_leading_eta_HLT_Jet450U_eff= fs->make("hist_leading_eta_HLT_Jet450U_eff","hist_leading_eta_HLT_Jet450U_eff",24,-5.2,5.2); - - hist_leading_pt_emulated_Jet500= fs->make("hist_leading_pt_emulated_Jet500","hist_leading_pt_emulated_Jet500",Ptbins,Ptbinning); - hist_leading_pt_all_Jet500= fs->make("hist_leading_pt_all_Jet500","hist_leading_pt_all_Jet500",Ptbins,Ptbinning); - hist_leading_eta_emulated_Jet500= fs->make("hist_leading_eta_emulated_Jet500","hist_leading_eta_emulated_Jet500",24,-5.2,5.2); - hist_leading_eta_all_Jet500= fs->make("hist_leading_eta_all_Jet500","hist_leading_eta_all_Jet500",24,-5.2,5.2); - - hist_leading_pt_HLT_Jet500U_eff= fs->make("hist_leading_pt_HLT_Jet500U_eff","hist_leading_pt_HLT_Jet500U_eff",Ptbins,Ptbinning); - hist_leading_eta_HLT_Jet500U_eff= fs->make("hist_leading_eta_HLT_Jet500U_eff","hist_leading_eta_HLT_Jet500U_eff",24,-5.2,5.2); - - //Jet energy systematic uncertainty - pt_DETInclJetUP_1bin = fs->make("pt_DETInclJetUP_1bin","pt_DETInclJetUP_1bin",Ptbins,Ptbinning); pt_DETInclJetUP_1bin->Sumw2(); - pt_DETInclJetUP_2bin = fs->make("pt_DETInclJetUP_2bin","pt_DETInclJetUP_2bin",Ptbins,Ptbinning); pt_DETInclJetUP_2bin->Sumw2(); - pt_DETInclJetUP_3bin = fs->make("pt_DETInclJetUP_3bin","pt_DETInclJetUP_3bin",Ptbins,Ptbinning); pt_DETInclJetUP_3bin->Sumw2(); - pt_DETInclJetUP_4bin = fs->make("pt_DETInclJetUP_4bin","pt_DETInclJetUP_4bin",Ptbins,Ptbinning); pt_DETInclJetUP_4bin->Sumw2(); - pt_DETInclJetUP_5bin = fs->make("pt_DETInclJetUP_5bin","pt_DETInclJetUP_5bin",Ptbins,Ptbinning); pt_DETInclJetUP_5bin->Sumw2(); - pt_DETInclJetUP_6bin = fs->make("pt_DETInclJetUP_6bin","pt_DETInclJetUP_6bin",Ptbins,Ptbinning); pt_DETInclJetUP_6bin->Sumw2(); - pt_DETInclJetUP_7bin = fs->make("pt_DETInclJetUP_7bin","pt_DETInclJetUP_7bin",Ptbins,Ptbinning); pt_DETInclJetUP_7bin->Sumw2(); - - pt_DETInclJetDOWN_1bin = fs->make("pt_DETInclJetDOWN_1bin","pt_DETInclJetDOWN_1bin",Ptbins,Ptbinning); pt_DETInclJetDOWN_1bin->Sumw2(); - pt_DETInclJetDOWN_2bin = fs->make("pt_DETInclJetDOWN_2bin","pt_DETInclJetDOWN_2bin",Ptbins,Ptbinning); pt_DETInclJetDOWN_2bin->Sumw2(); - pt_DETInclJetDOWN_3bin = fs->make("pt_DETInclJetDOWN_3bin","pt_DETInclJetDOWN_3bin",Ptbins,Ptbinning); pt_DETInclJetDOWN_3bin->Sumw2(); - pt_DETInclJetDOWN_4bin = fs->make("pt_DETInclJetDOWN_4bin","pt_DETInclJetDOWN_4bin",Ptbins,Ptbinning); pt_DETInclJetDOWN_4bin->Sumw2(); - pt_DETInclJetDOWN_5bin = fs->make("pt_DETInclJetDOWN_5bin","pt_DETInclJetDOWN_5bin",Ptbins,Ptbinning); pt_DETInclJetDOWN_5bin->Sumw2(); - pt_DETInclJetDOWN_6bin = fs->make("pt_DETInclJetDOWN_6bin","pt_DETInclJetDOWN_6bin",Ptbins,Ptbinning); pt_DETInclJetDOWN_6bin->Sumw2(); - pt_DETInclJetDOWN_7bin = fs->make("pt_DETInclJetDOWN_7bin","pt_DETInclJetDOWN_7bin",Ptbins,Ptbinning); pt_DETInclJetDOWN_7bin->Sumw2(); - - Chargedhf0_DETJet = fs->make("Chargedhf0_DETJet","Chargedhf0_DETJet",50,0,1); Chargedhf0_DETJet->Sumw2(); - Chargedef0_DETJet = fs->make("Chargedef0_DETJet","Chargedef0_DETJet",50,0,1); Chargedef0_DETJet->Sumw2(); - Neutralhf0_DETJet = fs->make("Neutralhf0_DETJet","Neutralhf0_DETJet",50,0,1); Neutralhf0_DETJet->Sumw2(); - Photonef0_DETJet = fs->make("Photonef0_DETJet","Photonef0_DETJet",50,0,1); Photonef0_DETJet->Sumw2(); - Hadronef0_DETJet = fs->make("Hadronef0_DETJet","Hadronef0_DETJet",50,0,1); Hadronef0_DETJet->Sumw2(); - Muonef0_DETJet = fs->make("Muonef0_DETJet","Muonef0_DETJet",50,0,1); Muonef0_DETJet->Sumw2(); - Electromagneticef0_DETJet = fs->make("Electromagneticef0_DETJet","Electromagneticef0_DETJet",50,0,1); Electromagneticef0_DETJet->Sumw2(); - - ChargedhMultiplicity0_DETJet = fs->make("ChargedhMultiplicity0_DETJet","ChargedhMultiplicity0_DETJet",100,0,100); ChargedhMultiplicity0_DETJet->Sumw2(); - ChargedeMultiplicity0_DETJet = fs->make("ChargedeMultiplicity0_DETJet","ChargedeMultiplicity0_DETJet",100,0,100); ChargedeMultiplicity0_DETJet->Sumw2(); - NeutralhMultiplicity0_DETJet = fs->make("NeutralhMultiplicity0_DETJet","NeutralhMultiplicity0_DETJet",100,0,100); NeutralhMultiplicity0_DETJet->Sumw2(); - PhotoneMultiplicity0_DETJet = fs->make("PhotoneMultiplicity0_DETJet","PhotoneMultiplicity0_DETJet",100,0,100); PhotoneMultiplicity0_DETJet->Sumw2(); - HadroneMultiplicity0_DETJet = fs->make("HadroneMultiplicity0_DETJet","HadroneMultiplicity0_DETJet",100,0,100); HadroneMultiplicity0_DETJet->Sumw2(); - MuoneMultiplicity0_DETJet = fs->make("MuoneMultiplicity0_DETJet","MuoneMultiplicity0_DETJet",100,0,100); MuoneMultiplicity0_DETJet->Sumw2(); - ElectromagneticeMultiplicity0_DETJet = fs->make("ElectromagneticeMultiplicity0_DETJet","ElectromagneticeMultiplicity0_DETJet",100,0,100); ElectromagneticeMultiplicity0_DETJet->Sumw2(); - - TruePileUpMC = fs->make("TruePileUpMC","TruePileUpMC",100,0,100); TruePileUpMC->Sumw2(); - TruePileUpMCInteger = fs->make("TruePileUpMCInteger","TruePileUpMCInteger",100,0,100); TruePileUpMCInteger->Sumw2(); - - TruePileUpDataInteger = fs->make("TruePileUpDataInteger","TruePileUpDataInteger",100,0,100); TruePileUpDataInteger->Sumw2(); - - MET_DET = fs->make("MET_DET","MET_DET",500,0,2000); MET_DET->Sumw2(); - METPhi_DET = fs->make("METPhi_DET","METPhi_DET",35,-7,7); METPhi_DET->Sumw2(); - FractionMET_DET = fs->make("FractionMET_DET","FractionMET_DET",50,0,1); FractionMET_DET->Sumw2(); - - jecs = new JECs(mIsMCarlo, mGlobalTag, mjettype,mJECUncSrc,mJECUncSrcNames); - - //Unfolding - /*resp_jetpt1etabin = fs->make(pt0_DETJet,pt0_DETJet, "resp_jetpt1etabin", "jetpt1etabin"); - resp_jetpt2etabin = fs->make(pt0_DETJet,pt0_DETJet, "resp_jetpt2etabin", "jetpt2etabin"); - resp_jetpt3etabin = fs->make(pt0_DETJet,pt0_DETJet, "resp_jetpt3etabin", "jetpt3etabin"); - resp_jetpt4etabin = fs->make(pt0_DETJet,pt0_DETJet, "resp_jetpt4etabin", "jetpt4etabin"); - resp_jetpt5etabin = fs->make(pt0_DETJet,pt0_DETJet, "resp_jetpt5etabin", "jetpt5etabin"); - resp_jetpt6etabin = fs->make(pt0_DETJet,pt0_DETJet, "resp_jetpt6etabin", "jetpt6etabin"); - resp_jetpt7etabin = fs->make(pt0_DETJet,pt0_DETJet, "resp_jetpt7etabin", "jetpt7etabin");*/ - - } // end of function beginJob() - - - //------------------------ endjob() function declaration ---------------------- // - void Analysis_Template_MC::endJob() - { - - mInf->Close(); - - } // closing endJob() - - - - - - //--------------------------- analyze() fuction declaration ------------------ // -void Analysis_Template_MC::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) - { - - cout<<" Size "<Get(mDirName.c_str()); - mTree=(TTree*)mDir->Get(mTreeName.c_str()); - - Event = new QCDEvent(); - TBranch *branch = mTree->GetBranch("events"); - branch->SetAddress(&Event); - - unsigned NEntries = mTree->GetEntries(); - cout<<"Reading TREE: "<Get("ak4/TriggerNames"); - cout<<"Finding trigger mapping: "<GetNbinsX();ibin++) { - TString ss(hTrigNames->GetXaxis()->GetBinLabel(ibin+1)); - - for (int ii=0; ii "<GetEntry(l); - - //LOW PILE-UP - - double TruePileUpInteger=0; - if(mIsMCarlo) TruePileUpInteger=Event->evtHdr().pu()/Event->evtHdr().nbx(); - - if(mIsMCarlo){ - if(mMCSlice==0){WeightMC=2022100000*Event->evtHdr().weight()/NEntriesNorm;}//flat MC - if(mMCSlice==1){ - if(ifile==0){WeightMC=61018300000*Event->evtHdr().weight()/NEntriesNorm;}//5-10 Slice - if(ifile==1){WeightMC=5887580000*Event->evtHdr().weight()/NEntriesNorm;}//10-15 Slice - if(ifile==2){WeightMC=1837410000*Event->evtHdr().weight()/NEntriesNorm;}//15-30 - if(ifile==3){WeightMC=140932000*Event->evtHdr().weight()/NEntriesNorm;}//30-50 - if(ifile==4){WeightMC=19204300*Event->evtHdr().weight()/NEntriesNorm;}//50-80 - if(ifile==5){WeightMC=2762530*Event->evtHdr().weight()/NEntriesNorm;}//80-120 - if(ifile==6){WeightMC=471100*Event->evtHdr().weight()/NEntriesNorm;}//120-170 - if(ifile==7){WeightMC=117276*Event->evtHdr().weight()/NEntriesNorm;}//170-300 - if(ifile==8){WeightMC=7823*Event->evtHdr().weight()/NEntriesNorm;}//300-470 - if(ifile==9){WeightMC=648.2*Event->evtHdr().weight()/NEntriesNorm;}//470-600 - if(ifile==10){WeightMC=186.9*Event->evtHdr().weight()/NEntriesNorm;}//600-800 - if(ifile==11){WeightMC=32.293*Event->evtHdr().weight()/NEntriesNorm;}//800-1000 - if(ifile==12){WeightMC=9.4183*Event->evtHdr().weight()/NEntriesNorm;}//1000-1400 Slice - if(ifile==13){WeightMC=0.84265*Event->evtHdr().weight()/NEntriesNorm;}//1400-1800 Slice - if(ifile==14){WeightMC=0.114943*Event->evtHdr().weight()/NEntriesNorm;}//1800-2400 Slice - if(ifile==15){WeightMC=0.00682981*Event->evtHdr().weight()/NEntriesNorm;}//2400-3200 Slice - if(ifile==16){WeightMC=0.000165445*Event->evtHdr().weight()/NEntriesNorm;}//3200 Slice - } - - - if(mPUReweighting) { - double PUValue=Event->evtHdr().pu()/Event->evtHdr().nbx(); - /*if(PUValue==0) WeightMC=WeightMC*0; - if(PUValue==1) WeightMC=WeightMC*7.15108*5.58912*7.75622; - if(PUValue==2) WeightMC=WeightMC*0.719276*0.486575*0.491436; - if(PUValue==3) WeightMC=WeightMC*3.04295*2.22316*2.7563; - if(PUValue==4) WeightMC=WeightMC*1.1615*0.864842*1.0667; - if(PUValue==5) WeightMC=WeightMC*1.1548*0.871069*1.05845; - if(PUValue==6) WeightMC=WeightMC*1.05194*0.809438*0.973934; - if(PUValue==7) WeightMC=WeightMC*1.13305*0.877764*1.0274; - if(PUValue==8) WeightMC=WeightMC*1.1113*0.87246*0.993396; - if(PUValue==9) WeightMC=WeightMC*1.12867*0.897374*0.994636; - if(PUValue==10) WeightMC=WeightMC*1.37858*1.11327*1.19816; - if(PUValue==11) WeightMC=WeightMC*0.980989*0.809113*0.843709; - if(PUValue==12) WeightMC=WeightMC*1.05204*0.892604*0.906712; - if(PUValue==13) WeightMC=WeightMC*0.988467*0.863995*0.852765; - if(PUValue==14) WeightMC=WeightMC*1.02872*0.933885*0.900774; - if(PUValue==15) WeightMC=WeightMC*1.03825*0.993352*0.937782; - if(PUValue==16) WeightMC=WeightMC*1.06262*1.08708*1.01057; - if(PUValue==17) WeightMC=WeightMC*1.03728*1.13625*1.04205; - if(PUValue==18) WeightMC=WeightMC*1.08073*1.29543*1.17618; - if(PUValue==19) WeightMC=WeightMC*0.990623*1.30234*1.17403; - if(PUValue==20) WeightMC=WeightMC*0.837278*1.22644*1.1057; - if(PUValue==21) WeightMC=WeightMC*0.98399*1.62192*1.46057; - if(PUValue==22) WeightMC=WeightMC*0.659693*1.23017*1.13012; - if(PUValue==23) WeightMC=WeightMC*0.624227*1.31342*1.22292; - if(PUValue==24) WeightMC=WeightMC*0.604303*1.41144*1.35969; - if(PUValue==25) WeightMC=WeightMC*0.368001*0.934106*0.929623; - if(PUValue==26) WeightMC=WeightMC*0.681775*1.78803*1.86664; - if(PUValue==27) WeightMC=WeightMC*0.146738*0.384705*0.417471; - if(PUValue==28) WeightMC=WeightMC*0.100275*0.248257*0.276309; - if(PUValue==29) WeightMC=WeightMC*0.0101723*0.0215978*0.0245047; - if(PUValue==30) WeightMC=WeightMC*0.0920068*0.1853*0.212557; - if(PUValue==31) WeightMC=WeightMC*0.00156869*0.00278051*0.00324063; - if(PUValue==32) WeightMC=WeightMC*0.000224117*0.000361503*0.000429415; - if(PUValue==33) WeightMC=WeightMC*5.23446e-05*9.00635e-05*0.000106457; - if(PUValue==34) WeightMC=WeightMC*0.000863209*0.00110908*0.00131942; - if(PUValue==35) WeightMC=WeightMC*1.81972e-05*2.03696e-05*2.40029e-05;*/ - - //////////////////////// MIKKO METHOD ////////////////////////////////////////////// - - //RUNB - /*if(PUValue==0) WeightMC=WeightMC*5.02417; - if(PUValue==1) WeightMC=WeightMC*0.92605; - if(PUValue==2) WeightMC=WeightMC*98.52599; - if(PUValue==3) WeightMC=WeightMC*2.74279; - if(PUValue==4) WeightMC=WeightMC*0.04558; - if(PUValue==5) WeightMC=WeightMC*0.06637; - if(PUValue==6) WeightMC=WeightMC*0.00301; - if(PUValue==7) WeightMC=WeightMC*0.00496; - if(PUValue==8) WeightMC=WeightMC*0.19185; - if(PUValue==9) WeightMC=WeightMC*0.05482; - if(PUValue==10) WeightMC=WeightMC*0.00030; - if(PUValue==11) WeightMC=WeightMC*0.00407; - if(PUValue==12) WeightMC=WeightMC*0.34996; - if(PUValue==13) WeightMC=WeightMC*0.38465; - if(PUValue==14) WeightMC=WeightMC*0.26010; - if(PUValue==15) WeightMC=WeightMC*0.00091; - if(PUValue==16) WeightMC=WeightMC*0.92053; - if(PUValue==17) WeightMC=WeightMC*0.96500; - if(PUValue==18) WeightMC=WeightMC*1.94715; - if(PUValue==19) WeightMC=WeightMC*1.00000; - if(PUValue==20) WeightMC=WeightMC*0.79781; - if(PUValue==21) WeightMC=WeightMC*1.00942; - if(PUValue==22) WeightMC=WeightMC*0.83538; - if(PUValue==23) WeightMC=WeightMC*0.91728; - if(PUValue==24) WeightMC=WeightMC*0.37085; - if(PUValue>=25) WeightMC=WeightMC*0;*/ - - //RUNC - if(PUValue==0) WeightMC=WeightMC*467.57407; - if(PUValue==1) WeightMC=WeightMC*30.31823; - if(PUValue==2) WeightMC=WeightMC*26.30839; - if(PUValue==3) WeightMC=WeightMC*6.08921; - if(PUValue==4) WeightMC=WeightMC*0; - if(PUValue==5) WeightMC=WeightMC*0; - if(PUValue==6) WeightMC=WeightMC*0.97311; - if(PUValue==7) WeightMC=WeightMC*0.12387; - if(PUValue==8) WeightMC=WeightMC*0.00199; - if(PUValue==9) WeightMC=WeightMC*0; - if(PUValue==10) WeightMC=WeightMC*0.03264; - if(PUValue==11) WeightMC=WeightMC*0.05545; - if(PUValue==12) WeightMC=WeightMC*0.01525; - if(PUValue==13) WeightMC=WeightMC*0.00746; - if(PUValue==14) WeightMC=WeightMC*0.00383; - if(PUValue==15) WeightMC=WeightMC*0.43554; - if(PUValue==16) WeightMC=WeightMC*1.45626; - if(PUValue==17) WeightMC=WeightMC*1.07330; - if(PUValue==18) WeightMC=WeightMC*1.20143; - if(PUValue==19) WeightMC=WeightMC*1; - if(PUValue==20) WeightMC=WeightMC*0.98406; - if(PUValue==21) WeightMC=WeightMC*1.51376; - if(PUValue==22) WeightMC=WeightMC*1.24476; - if(PUValue==23) WeightMC=WeightMC*1.25060; - if(PUValue==24) WeightMC=WeightMC*0.97207; - if(PUValue==25) WeightMC=WeightMC*0.47589; - if(PUValue>=26) WeightMC=WeightMC*0; - } - - hweight=WeightMC; - - } - if(hweight<0){ continue; } - - //cout<<"************************* NEW EVENT ******************************************"< decade) - cout<<10*k<<" %"<fired(ihltj[j]) > 0) { - hltPassj[j] = true; - if(Event->preL1(ihltj[j])>=0){ prescalej[j] = Event->preL1(ihltj[j]) * Event->preHLT(ihltj[j]);} - else {prescalej[j] = Event->preHLT(ihltj[j]);} - if(mprintOk==4){ - cout<preL1(ihltj[j])<<" "<< Event->preHLT(ihltj[j])<evtHdr().lumi(); - - double pthat = Event->evtHdr().pthat(); - double mc_weight = Event->evtHdr().weight(); - if(mprintOk==10) printf("\npthat=%f mc_weight=%e\n",pthat,mc_weight); - - mc_pthat->Fill(pthat); - mc_pthat_weighted->Fill(pthat,hweight); - - unsigned n_genJets = Event->nGenJets(); - unsigned n_PFJets = Event->nPFJetsCHS(); - int DetJets=0; - int DETjet_ok[100]; for(int ii=0;ii<100;++ii){DETjet_ok[ii]=0;} - - jecs->JEC_CHScorrections(Event, Event->nPFJetsCHS(), mIsMCarlo,mJECUncSrcNames); - //jecs->JEC_corrections(Event, Event->nPFJetsCHS(), mIsMCarlo,mJECUncSrcNames); - - if(mIsMCarlo){ - - ///////////////////////////////////////////////////////////////////////////////////////////// - ///Examine GenJets - - /// Dump all GEN jets - if(mprintOk==2){ - printf("Number of GENJets=%d\n",n_genJets); - for(unsigned j=0; jgenjet(j).pt(),Event->genjet(j).Rapidity(),Event->genjet(j).phi()); - } - } - - ///Apply Jet cuts. Very General to all existing GEN Jets - int GENjet_ok[100]; for(int ii=0;ii<100;++ii){GENjet_ok[ii]=0;} - - int GenJets=0; - - if(mprintOk==1) cout<<"Vertex info: numVtx="<evtHdr().nVtx()<<" numVtxGood="<evtHdr().nVtxGood()<<" isPVgood()="<evtHdr().isPVgood()<Fill(Event->evtHdr().nVtx(),hweight); - /// Keep events with PVgood - if (Event->evtHdr().isPVgood() != 1) continue; - - for(unsigned j=0; j< n_genJets; ++j){ - if(Event->genjet(j).pt()genjet(j).Rapidity())>mYMax) continue; - GENjet_ok[j]=1; - - if(Event->genjet(j).pt()>=50){ - GenJets++; - - if(fabs(Event->genjet(j).Rapidity())<=0.5) pt_GENInclJet_1bin->Fill(Event->genjet(j).pt(),hweight); - if(fabs(Event->genjet(j).Rapidity())>0.5 && fabs(Event->genjet(j).Rapidity())<=1.0) pt_GENInclJet_2bin->Fill(Event->genjet(j).pt(),hweight); - if(fabs(Event->genjet(j).Rapidity())>1.0 && fabs(Event->genjet(j).Rapidity())<=1.5) pt_GENInclJet_3bin->Fill(Event->genjet(j).pt(),hweight); - if(fabs(Event->genjet(j).Rapidity())>1.5 && fabs(Event->genjet(j).Rapidity())<=2.0) pt_GENInclJet_4bin->Fill(Event->genjet(j).pt(),hweight); - if(fabs(Event->genjet(j).Rapidity())>2.0 && fabs(Event->genjet(j).Rapidity())<=2.5) pt_GENInclJet_5bin->Fill(Event->genjet(j).pt(),hweight); - if(fabs(Event->genjet(j).Rapidity())>2.5 && fabs(Event->genjet(j).Rapidity())<=3.0) pt_GENInclJet_6bin->Fill(Event->genjet(j).pt(),hweight); - if(fabs(Event->genjet(j).Rapidity())>3.2 && fabs(Event->genjet(j).Rapidity())<=4.7) pt_GENInclJet_7bin->Fill(Event->genjet(j).pt(),hweight); - } - } - - Multiplicity_GENJet->Fill(GenJets,hweight); - - /// Keep events where leading Jet[0] and Jet[1] survived cuts - if((GENjet_ok[0]==1)&&(GENjet_ok[1]==1)) { - - ///////////////////////////////////// Measurement with Gen Jets /////////////////////////////////////////////////// - - pt0_GENJet->Fill(Event->genjet(0).pt(),hweight); - pt1_GENJet->Fill(Event->genjet(1).pt(),hweight); - y0_GENJet->Fill(Event->genjet(0).Rapidity(),hweight); - y1_GENJet->Fill(Event->genjet(1).Rapidity(),hweight); - phi0_GENJet->Fill(Event->genjet(0).phi(),hweight); - phi1_GENJet->Fill(Event->genjet(1).phi(),hweight); - - } //end of GEN Jets - - - ///////////////////////////////////////////////////////////////////////////////////////////// - /// PFJets - /////////////////////////////////////////////Vertex!!!!//////////////////////////////////////////////////////// - - /// Vertex selection - TruePileUpMC->Fill(Event->evtHdr().trpu(),hweight); - PileUpVSVertex->Fill(TruePileUpInteger,Event->evtHdr().nVtx(),hweight); - - //cout<evtHdr().pu()<<" "<evtHdr().ootpuEarly()<<" "<evtHdr().ootpuLate()<<" "<evtHdr().intpu()<<" "<evtHdr().nbx()<pfjetchs(j).ptCor(),Event->pfjetchs(j).y(),Event->pfjetchs(j).phi());} - } - - ///Apply Jet cuts. Very Deteral to all existing DET Jets - - for(unsigned j=0; j< Event->nPFJetsCHS(); ++j){ - if(Event->pfjetchs(j).ptCor()pfjetchs(j).y())>mYMax) continue; - - //if(mLowPileUp) {if (TruePileUpInteger<=5) continue;} - - //if(Event->pfjetchs(j).ptCor()>=50 && TruePileUpInteger<=10){ - if(Event->pfjetchs(j).ptCor()>=50){ - - DetJets++; - DETjet_ok[j]=1; - - pt0_DETInclJet->Fill(Event->pfjetchs(j).ptCor(),hweight); - pt0_DETInclJetUncor->Fill(Event->pfjetchs(j).pt(),hweight); - y0_DETInclJet->Fill(Event->pfjetchs(j).y(),hweight); - phi0_DETInclJet->Fill(Event->pfjetchs(j).phi(),hweight); - - //new histograms - Chargedhf0_DETJet->Fill(Event->pfjetchs(j).chf(),hweight);//charged hadron energy fraction - Neutralhf0_DETJet->Fill(Event->pfjetchs(j).nhf(),hweight);//neutral hadron energy fraction - Chargedef0_DETJet->Fill(Event->pfjetchs(j).cemf(),hweight);//charged em energy fraction - Photonef0_DETJet->Fill(Event->pfjetchs(j).nemf(),hweight);//neutral em energy fraction - Hadronef0_DETJet->Fill(Event->pfjetchs(j).hf_hf(),hweight);//hadron fraction energy fraction - Electromagneticef0_DETJet->Fill(Event->pfjetchs(j).hf_phf(),hweight);//electromagnetic fraction energy fraction - Muonef0_DETJet->Fill(Event->pfjetchs(j).muf(),hweight); //muon fraction energy fraction - - ChargedhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).chm(),hweight);//charged hadron multiplicity - NeutralhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).nhm(),hweight);//neutral hadron multiplicity - ChargedeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).elm(),hweight);//electron em multiplicity - PhotoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).phm(),hweight);//neutral em multiplicity - HadroneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_hm(),hweight);//hadron fraction multiplicity - ElectromagneticeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_phm(),hweight);//electromagnetic fraction multiplicity - MuoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).mum(),hweight); //muon fraction multiplicity - - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); pt_DETInclJetUP_1bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_1bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_2bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_2bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_3bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_3bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_4bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_4bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_5bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_5bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_6bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_6bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) { - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)//tight JETID forward region - {pt_DETInclJet_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_7bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_7bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - } - } - } - - if(DETjet_ok[0]==1){ - TruePileUpMCInteger->Fill(TruePileUpInteger,hweight); - num_of_VtxGood->Fill(Event->evtHdr().nVtxGood(),hweight); - - if(fabs(Event->pfjetchs(0).y())<=3.0 && Event->pfjetchs(0).tightID()){ - MET_DET->Fill(Event->pfmet().met(),hweight); - METPhi_DET->Fill(fabs(Event->pfmet().phi()),hweight); - FractionMET_DET->Fill(Event->pfmet().met_o_sumet(),hweight); - } - if(fabs(Event->pfjetchs(0).y())>3.2){ - if(Event->pfjetchs(0).nemf()<0.90 && Event->pfjetchs(0).ncand()>10){//tight JETID forward region - MET_DET->Fill(Event->pfmet().met(),hweight); - METPhi_DET->Fill(fabs(Event->pfmet().phi()),hweight); - FractionMET_DET->Fill(Event->pfmet().met_o_sumet(),hweight); - } - } - } - - /// Keep events where leading Jet[0] and Jet[1] survived cuts - if((DETjet_ok[0]==1)&&(DETjet_ok[1]==1)) { - - ///////////////////////////////////// Measurement with Det Jets /////////////////////////////////////////////////// - - pt0_DETJet->Fill(Event->pfjetchs(0).ptCor(),hweight); - pt0_DETJetUncor->Fill(Event->pfjetchs(0).pt(),hweight); - pt1_DETJet->Fill(Event->pfjetchs(1).ptCor(),hweight); - pt1_DETJetUncor->Fill(Event->pfjetchs(1).pt(),hweight); - y0_DETJet->Fill(Event->pfjetchs(0).y(),hweight); - y1_DETJet->Fill(Event->pfjetchs(1).y(),hweight); - phi0_DETJet->Fill(Event->pfjetchs(0).phi(),hweight); - phi1_DETJet->Fill(Event->pfjetchs(1).phi(),hweight); - } - - /// Vertex selection - if(mprintOk==1) cout<<"Vertex info: numVtx="<evtHdr().nVtx()<<" numVtxGood="<evtHdr().nVtxGood()<<" isPVgood()="<evtHdr().isPVgood()<<" pfRho="<evtHdr().pfRho()<nPFJetsCHS()); - for(unsigned j=0; jnPFJetsCHS(); ++j){ - printf("j=%2d pt=%8.3f ptCor=%8.3f y=%6.3f phi=%6.3f cor=%6.3f tightID=%d\n",j,Event->pfjetchs(j).pt(),Event->pfjetchs(j).ptCor(),Event->pfjetchs(j).y(),Event->pfjetchs(j).phi(),Event->pfjetchs(j).cor(),Event->pfjetchs(j).tightID()); - } - } - - // PURITY AND STABILITY - for(unsigned j=0; j< Event->nPFJetsCHS(); ++j){ - if(Event->pfjetchs(j).ptCor()pfjetchs(j).y())>mYMax) continue; - - int histoEntry=0; - double matchJet=1000; - double matchJetCounter=1000; - - for(unsigned i=0; i< n_genJets; ++i){ - if(Event->genjet(i).pt()genjet(i).Rapidity())>mYMax) continue; - - double deltaPhiMatch=Event->genjet(i).phi()-Event->pfjetchs(j).phi(); - if(deltaPhiMatch<-TMath::Pi()) deltaPhiMatch=deltaPhiMatch+2*TMath::Pi(); - if(deltaPhiMatch>TMath::Pi()) deltaPhiMatch=deltaPhiMatch-2*TMath::Pi(); - deltaPhiMatch=fabs(deltaPhiMatch); - - matchJetCounter=sqrt(pow(Event->genjet(i).Rapidity()-Event->pfjetchs(j).y(),2)+pow(deltaPhiMatch,2)); - - if(matchJetCounter<=matchJet) matchJet=matchJetCounter; - - if (matchJetCounter<0.3 && histoEntry==0){ - histoEntry=1; - PF_MatchedInclusiveJets->Fill(Event->pfjetchs(j).ptCor(),hweight); - Gen_MatchedInclusiveJets->Fill(Event->genjet(i).pt(),hweight); - TwoD_MatchedInclusiveJets->Fill(Event->pfjetchs(j).ptCor(),Event->genjet(i).pt(),hweight); - - //Separation in eta bins - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) { PF_MatchedInclusiveJets_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); Gen_MatchedInclusiveJets_1bin->Fill(Event->genjet(i).pt(),hweight); TwoD_MatchedInclusiveJets_1bin->Fill(Event->pfjetchs(j).ptCor(),Event->genjet(i).pt(),hweight); } - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) { PF_MatchedInclusiveJets_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight); Gen_MatchedInclusiveJets_2bin->Fill(Event->genjet(i).pt(),hweight); TwoD_MatchedInclusiveJets_2bin->Fill(Event->pfjetchs(j).ptCor(),Event->genjet(i).pt(),hweight); } - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) { PF_MatchedInclusiveJets_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight); Gen_MatchedInclusiveJets_3bin->Fill(Event->genjet(i).pt(),hweight); TwoD_MatchedInclusiveJets_3bin->Fill(Event->pfjetchs(j).ptCor(),Event->genjet(i).pt(),hweight); } - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) { PF_MatchedInclusiveJets_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight); Gen_MatchedInclusiveJets_4bin->Fill(Event->genjet(i).pt(),hweight); TwoD_MatchedInclusiveJets_4bin->Fill(Event->pfjetchs(j).ptCor(),Event->genjet(i).pt(),hweight); } - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) { PF_MatchedInclusiveJets_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight); Gen_MatchedInclusiveJets_5bin->Fill(Event->genjet(i).pt(),hweight); TwoD_MatchedInclusiveJets_5bin->Fill(Event->pfjetchs(j).ptCor(),Event->genjet(i).pt(),hweight); } - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) { PF_MatchedInclusiveJets_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight); Gen_MatchedInclusiveJets_6bin->Fill(Event->genjet(i).pt(),hweight); TwoD_MatchedInclusiveJets_6bin->Fill(Event->pfjetchs(j).ptCor(),Event->genjet(i).pt(),hweight); } - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) { - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10){//tight JETID forward region - PF_MatchedInclusiveJets_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight); Gen_MatchedInclusiveJets_7bin->Fill(Event->genjet(i).pt(),hweight); TwoD_MatchedInclusiveJets_7bin->Fill(Event->pfjetchs(j).ptCor(),Event->genjet(i).pt(),hweight); } - } - - //Evaluation of resolution - double resolution=fabs(Event->pfjetchs(j).ptCor()-Event->genjet(i).pt())/Event->genjet(i).pt(); - double resolutionNoAbs=(Event->pfjetchs(j).ptCor()-Event->genjet(i).pt())/Event->genjet(i).pt(); - Resolution1D->Fill(resolutionNoAbs,hweight); - ResolutionInclusiveJets->Fill(Event->pfjetchs(j).ptCor(),resolution,hweight); - //Fill that for each eta bins - //ResolutionHistoPt1bin[0]->Fill(resolution,hweight); - - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) ResolutionInclusiveJets_1bin->Fill(Event->pfjetchs(j).ptCor(),resolution,hweight); - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) ResolutionInclusiveJets_2bin->Fill(Event->pfjetchs(j).ptCor(),resolution,hweight); - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) ResolutionInclusiveJets_3bin->Fill(Event->pfjetchs(j).ptCor(),resolution,hweight); - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) ResolutionInclusiveJets_4bin->Fill(Event->pfjetchs(j).ptCor(),resolution,hweight); - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) ResolutionInclusiveJets_5bin->Fill(Event->pfjetchs(j).ptCor(),resolution,hweight); - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) ResolutionInclusiveJets_6bin->Fill(Event->pfjetchs(j).ptCor(),resolution,hweight); - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7){ - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10){//tight JETID forward region - {ResolutionInclusiveJets_7bin->Fill(Event->pfjetchs(j).ptCor(),resolution,hweight); ResolutionForward1D->Fill(resolutionNoAbs,hweight);} - } - } - } - } - - DeltaR_Jets->Fill(matchJet,hweight); - - if (matchJet>0.3){ - PF_FakeInclusiveJets->Fill(Event->pfjetchs(j).ptCor(),hweight); - - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) PF_FakeInclusiveJets_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) PF_FakeInclusiveJets_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight); - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) PF_FakeInclusiveJets_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight); - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) PF_FakeInclusiveJets_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight); - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) PF_FakeInclusiveJets_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight); - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) PF_FakeInclusiveJets_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight); - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) PF_FakeInclusiveJets_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight); - - } - } - - // Missed Events at the Gen Level - for(unsigned i=0; i< n_genJets; ++i){ - if(Event->genjet(i).pt()genjet(i).Rapidity())>mYMax) continue; - double matchJet=1000; - double matchJetCounter=1000; - - for(unsigned j=0; j< Event->nPFJetsCHS(); ++j){ - if(Event->pfjetchs(j).ptCor()pfjetchs(j).y())>mYMax) continue; - - if(fabs(Event->pfjetchs(j).y())<=3.0 && !Event->pfjetchs(j).tightID()) continue; - - double deltaPhiMatch=Event->genjet(i).phi()-Event->pfjetchs(j).phi(); - if(deltaPhiMatch<-TMath::Pi()) deltaPhiMatch=deltaPhiMatch+2*TMath::Pi(); - if(deltaPhiMatch>TMath::Pi()) deltaPhiMatch=deltaPhiMatch-2*TMath::Pi(); - deltaPhiMatch=fabs(deltaPhiMatch); - - matchJetCounter=sqrt(pow(Event->genjet(i).Rapidity()-Event->pfjetchs(j).y(),2)+pow(deltaPhiMatch,2)); - if(matchJetCounter<=matchJet) matchJet=matchJetCounter; - } - - if (matchJet>0.3){ - Gen_MissInclusiveJets->Fill(Event->genjet(i).pt(),hweight); - - if(fabs(Event->genjet(i).Rapidity())<=0.5) Gen_MissInclusiveJets_1bin->Fill(Event->genjet(i).pt(),hweight); - if(fabs(Event->genjet(i).Rapidity())>0.5 && fabs(Event->genjet(i).Rapidity())<=1.0) Gen_MissInclusiveJets_2bin->Fill(Event->genjet(i).pt(),hweight); - if(fabs(Event->genjet(i).Rapidity())>1.0 && fabs(Event->genjet(i).Rapidity())<=1.5) Gen_MissInclusiveJets_3bin->Fill(Event->genjet(i).pt(),hweight); - if(fabs(Event->genjet(i).Rapidity())>1.5 && fabs(Event->genjet(i).Rapidity())<=2.0) Gen_MissInclusiveJets_4bin->Fill(Event->genjet(i).pt(),hweight); - if(fabs(Event->genjet(i).Rapidity())>2.0 && fabs(Event->genjet(i).Rapidity())<=2.5) Gen_MissInclusiveJets_5bin->Fill(Event->genjet(i).pt(),hweight); - if(fabs(Event->genjet(i).Rapidity())>2.5 && fabs(Event->genjet(i).Rapidity())<=3.0) Gen_MissInclusiveJets_6bin->Fill(Event->genjet(i).pt(),hweight); - if(fabs(Event->genjet(i).Rapidity())>3.2 && fabs(Event->genjet(i).Rapidity())<=4.7) Gen_MissInclusiveJets_7bin->Fill(Event->genjet(i).pt(),hweight); - - /*if(fabs(Event->genjet(i).y())<=0.5) { resp_jetpt1etabin->Miss(Event->genjet(i).pt(),hweight);} - if(fabs(Event->genjet(i).y())>0.5 && fabs(Event->genjet(i).y())<=1.0) { resp_jetpt2etabin->Miss(Event->genjet(i).pt(),hweight);} - if(fabs(Event->genjet(i).y())>1.0 && fabs(Event->genjet(i).y())<=1.5) { resp_jetpt3etabin->Miss(Event->genjet(i).pt(),hweight);} - if(fabs(Event->genjet(i).y())>1.5 && fabs(Event->genjet(i).y())<=2.0) { resp_jetpt4etabin->Miss(Event->genjet(i).pt(),hweight);} - if(fabs(Event->genjet(i).y())>2.0 && fabs(Event->genjet(i).y())<=2.5) { resp_jetpt5etabin->Miss(Event->genjet(i).pt(),hweight);} - if(fabs(Event->genjet(i).y())>2.5 && fabs(Event->genjet(i).y())<=3.0) { resp_jetpt6etabin->Miss(Event->genjet(i).pt(),hweight);} - if(fabs(Event->genjet(i).y())>3.2 && fabs(Event->genjet(i).y())<=4.7) { resp_jetpt7etabin->Miss(Event->genjet(i).pt(),hweight);}*/ - } - } - } - - // Trigger Ranges code - if(!mIsMCarlo){ - - double leading_pt = -10.0; - double leading_eta = -10.0; - - num_of_Vtx->Fill(Event->evtHdr().nVtx(),hweight); - /// Keep events with PVgood - - /* - if(mprintOk==1){ - for(unsigned j=0; jnPFJetsCHS(); ++j){ - if(Event->evtHdr().runNo()==251252){ - if(Event->evtHdr().lumi()==158 && Event->evtHdr().event()==95957128) { - cout<evtHdr().event()<pfjet(j).ptCor(),Event->pfjet(j).y(),Event->pfjet(j).phi());} - if(Event->evtHdr().lumi()==158 && Event->evtHdr().event()==95734424) { - cout<evtHdr().event()<pfjet(j).ptCor(),Event->pfjet(j).y(),Event->pfjet(j).phi());} - if(Event->evtHdr().lumi()==158 && Event->evtHdr().event()==95800780) { - cout<evtHdr().event()<pfjet(j).ptCor(),Event->pfjet(j).y(),Event->pfjet(j).phi());} - } - } - } - */ - if (Event->evtHdr().isPVgood() != 1) continue; - - for (int j=0; jnL1Obj(ihltj[j]); l1iobj++ ) - { - //cout << "L1 object id: "< " << Event->l1obj(ihltj[j],l1iobj).pt() << " > " << ATrig[j] << endl; - if (Event->l1obj(ihltj[j],l1iobj).pt() > ATrig[j]) //threshold for L1 trigger - { - l1cut[j] = true; - } - } - - //----------------- HLT Theshold Checking --------------------------// - for ( unsigned hltiobj=0; hltiobjnHLTObj(ihltj[j]); hltiobj++ ) - { - //cout << "HLT object id: " << hltiobj << " -> " << Event->hltobj(ihltj[j],hltiobj).pt() << " > " << HLTJetPtNThres[j] << endl; - if (Event->hltobj(ihltj[j],hltiobj).pt() > HLTJetPtNThres[j]) //threshold for HLT trigger - { - hltcut[j] = true; - } - } - } - } - - //Trigger tag-and-probe - - if(Event->nPFJetsCHS()>=2) { - int selectEventsLead=0; - int selectEventsSubLead=0; - - if(fabs(Event->pfjetchs(0).eta())<1.3){ - - for ( unsigned hltiobj=0; hltiobjnHLTObj(ihltj[1]); hltiobj++ ) - { - - double deltaPhiMatch=Event->pfjetchs(0).phi()-Event->hltobj(ihltj[1],hltiobj).phi(); - if(deltaPhiMatch<-TMath::Pi()) deltaPhiMatch=deltaPhiMatch+2*TMath::Pi(); - if(deltaPhiMatch>TMath::Pi()) deltaPhiMatch=deltaPhiMatch-2*TMath::Pi(); - deltaPhiMatch=fabs(deltaPhiMatch); - - double matchJetCounter=sqrt(pow(Event->pfjetchs(0).eta()-Event->hltobj(ihltj[1],hltiobj).eta(),2)+pow(deltaPhiMatch,2)); - - if (matchJetCounter<0.5 && Event->hltobj(ihltj[1],hltiobj).pt()>10){ - double ResHLT=(Event->pfjetchs(0).ptCor()-Event->hltobj(ihltj[1],hltiobj).pt())/Event->pfjetchs(0).ptCor(); - ResolutionTagAndProbe->Fill(Event->pfjetchs(0).ptCor(),ResHLT,hweight); - } - - if (matchJetCounter<0.5 && Event->hltobj(ihltj[1],hltiobj).pt()>60){ - selectEventsLead=1; - } - - } - } - - if(fabs(Event->pfjetchs(1).eta())<1.3){ - for ( unsigned hltiobj=0; hltiobjnHLTObj(ihltj[1]); hltiobj++ ) - { - - double deltaPhiMatch=Event->pfjetchs(1).phi()-Event->hltobj(ihltj[1],hltiobj).phi(); - if(deltaPhiMatch<-TMath::Pi()) deltaPhiMatch=deltaPhiMatch+2*TMath::Pi(); - if(deltaPhiMatch>TMath::Pi()) deltaPhiMatch=deltaPhiMatch-2*TMath::Pi(); - deltaPhiMatch=fabs(deltaPhiMatch); - - double matchJetCounter=sqrt(pow(Event->pfjetchs(1).eta()-Event->hltobj(ihltj[1],hltiobj).eta(),2)+pow(deltaPhiMatch,2)); - - if (matchJetCounter<0.5 && Event->hltobj(ihltj[1],hltiobj).pt()>10){ - double ResHLT=(Event->pfjetchs(1).ptCor()-Event->hltobj(ihltj[1],hltiobj).pt())/Event->pfjetchs(1).ptCor(); - ResolutionTagAndProbe->Fill(Event->pfjetchs(1).ptCor(),ResHLT,hweight); - } - - if (matchJetCounter<0.5 && Event->hltobj(ihltj[1],hltiobj).pt()>60) //threshold for HLT trigger - { - selectEventsSubLead=1; - } - } - } - - int TriggerDenLead=0; - int TriggerDenLeadMatch=0; - int TriggerNumLead=0; - - int TriggerDenSubLead=0; - int TriggerDenSubLeadMatch=0; - int TriggerNumSubLead=0; - - if(selectEventsLead){ - - if(fabs(Event->pfjetchs(1).eta())<1.5){ - - double deltaPhiMatch=Event->pfjetchs(0).phi()-Event->pfjetchs(1).phi(); - if(deltaPhiMatch<-TMath::Pi()) deltaPhiMatch=deltaPhiMatch+2*TMath::Pi(); - if(deltaPhiMatch>TMath::Pi()) deltaPhiMatch=deltaPhiMatch-2*TMath::Pi(); - deltaPhiMatch=fabs(deltaPhiMatch); - - if(Event->nPFJetsCHS()==2 && deltaPhiMatch>2.7){TriggerDenLead=1;} - double ptBalance=0.3*(Event->pfjetchs(0).ptCor()+Event->pfjetchs(1).ptCor())/2; - if(Event->nPFJetsCHS()>2 && deltaPhiMatch>2.7 && Event->pfjetchs(2).ptCor()nHLTObj(ihltj[1]); hltiobj++ ) - { - - double deltaPhiMatch2=Event->pfjetchs(1).phi()-Event->hltobj(ihltj[1],hltiobj).phi(); - if(deltaPhiMatch2<-TMath::Pi()) deltaPhiMatch2=deltaPhiMatch2+2*TMath::Pi(); - if(deltaPhiMatch2>TMath::Pi()) deltaPhiMatch2=deltaPhiMatch2-2*TMath::Pi(); - deltaPhiMatch2=fabs(deltaPhiMatch2); - - double matchJetCounter2=sqrt(pow(Event->pfjetchs(1).eta()-Event->hltobj(ihltj[1],hltiobj).eta(),2)+pow(deltaPhiMatch2,2)); - - if (matchJetCounter2<0.2){ - TriggerDenLeadMatch=1; - if(Event->hltobj(ihltj[1],hltiobj).pt()>60){ - //cout<pfjetchs(1).ptCor()<<" "<hltobj(ihltj[1],hltiobj).pt()<pfjetchs(0).eta())<1.5){ - - double deltaPhiMatch=Event->pfjetchs(0).phi()-Event->pfjetchs(1).phi(); - if(deltaPhiMatch<-TMath::Pi()) deltaPhiMatch=deltaPhiMatch+2*TMath::Pi(); - if(deltaPhiMatch>TMath::Pi()) deltaPhiMatch=deltaPhiMatch-2*TMath::Pi(); - deltaPhiMatch=fabs(deltaPhiMatch); - - if(Event->nPFJetsCHS()==2 && deltaPhiMatch>2.7){TriggerDenSubLead=1;} - double ptBalance=0.3*(Event->pfjetchs(0).ptCor()+Event->pfjetchs(1).ptCor())/2; - if(Event->nPFJetsCHS()>2 && deltaPhiMatch>2.7 && Event->pfjetchs(2).ptCor()nHLTObj(ihltj[1]); hltiobj++ ) - { - - double deltaPhiMatch2=Event->pfjetchs(0).phi()-Event->hltobj(ihltj[1],hltiobj).phi(); - if(deltaPhiMatch2<-TMath::Pi()) deltaPhiMatch2=deltaPhiMatch2+2*TMath::Pi(); - if(deltaPhiMatch2>TMath::Pi()) deltaPhiMatch2=deltaPhiMatch2-2*TMath::Pi(); - deltaPhiMatch2=fabs(deltaPhiMatch2); - - double matchJetCounter2=sqrt(pow(Event->pfjetchs(0).eta()-Event->hltobj(ihltj[1],hltiobj).eta(),2)+pow(deltaPhiMatch2,2)); - - if(matchJetCounter2<0.2){ - TriggerDenSubLeadMatch=1; - - if(Event->hltobj(ihltj[1],hltiobj).pt()>60){ - TriggerNumSubLead=1; - } - } - } - } - } - } - - if(random==1){ - random=0; - if(TriggerDenLeadMatch){TagAndProbeDen->Fill(Event->pfjetchs(1).ptCor(),hweight);} - if(TriggerNumLead){TagAndProbeNum->Fill(Event->pfjetchs(1).ptCor(),hweight);} - } - - if(random==0){ - random=1; - if(TriggerDenSubLeadMatch){TagAndProbeDen->Fill(Event->pfjetchs(0).ptCor(),hweight);} - if(TriggerNumSubLead){TagAndProbeNum->Fill(Event->pfjetchs(0).ptCor(),hweight);} - } - } - - //end of trigger tag-and-probe - - for(unsigned int j=0; jnPFJetsCHS(); j++) { - double pt = Event->pfjetchs(j).ptCor(); - double eta = Event->pfjetchs(j).eta(); - - if (pt >= 20){ - if((Event->pfjetchs(j).tightID() && fabs(Event->pfjetchs(j).eta())<=3.0) || (fabs(Event->pfjetchs(j).eta())>3.0 && fabs(Event->pfjetchs(j).eta())<=4.7 && Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)) { - if (leading_pt < pt) { leading_pt = pt; leading_eta = eta; } - } - } - } - - hweight=1.; - - if(fabs(leading_eta)<1.5){ - if(hltPassj[0]){ - //if(prescalej[0]>0) hweight=hweight*prescalej[0]; - //if(prescalej[0]<0) hweight=hweight*(-prescalej[0]); - hist_leading_pt_all_Jet60->Fill(leading_pt,hweight); - hist_leading_eta_all_Jet60->Fill(leading_eta,hweight); - } - if (hltPassj[0] && hltcut[0]){ - //if(prescalej[0]>0) hweight=hweight*prescalej[0]; - //if(prescalej[0]<0) hweight=hweight*(-prescalej[0]); - hist_leading_pt_emulated_Jet60->Fill(leading_pt,hweight); - hist_leading_eta_emulated_Jet60->Fill(leading_eta,hweight); - } - - if(hltPassj[1]){ - //if(prescalej[1]>0) hweight=hweight*prescalej[1]; - //if(prescalej[1]<0) hweight=hweight*(-prescalej[1]); - hist_leading_pt_all_Jet80->Fill(leading_pt,hweight); - hist_leading_eta_all_Jet80->Fill(leading_eta,hweight); - } - if (hltPassj[1] && l1cut[1] && hltcut[1]){ - //if(prescalej[1]>0) hweight=hweight*prescalej[1]; - //if(prescalej[1]<0) hweight=hweight*(-prescalej[1]); - hist_leading_pt_emulated_Jet80->Fill(leading_pt,hweight); - hist_leading_eta_emulated_Jet80->Fill(leading_eta,hweight); - } - - if(hltPassj[2]){ - //if(prescalej[2]>0) hweight=hweight*prescalej[2]; - //if(prescalej[2]<0) hweight=hweight*(-prescalej[2]); - hist_leading_pt_all_Jet140->Fill(leading_pt,hweight); - hist_leading_eta_all_Jet140->Fill(leading_eta,hweight); - } - if (hltPassj[2] && l1cut[2] && hltcut[2]){ - //if(prescalej[2]>0) hweight=hweight*prescalej[2]; - //if(prescalej[2]<0) hweight=hweight*(-prescalej[2]); - hist_leading_pt_emulated_Jet140->Fill(leading_pt,hweight); - hist_leading_eta_emulated_Jet140->Fill(leading_eta,hweight); - } - - if(hltPassj[3]){ - //if(prescalej[3]>0) hweight=hweight*prescalej[3]; - //if(prescalej[3]<0) hweight=hweight*(-prescalej[3]); - hist_leading_pt_all_Jet200->Fill(leading_pt,hweight); - hist_leading_eta_all_Jet200->Fill(leading_eta,hweight); - } - if (hltPassj[3] && l1cut[3] && hltcut[3]){ - //if(prescalej[3]>0) hweight=hweight*prescalej[3]; - //if(prescalej[3]<0) hweight=hweight*(-prescalej[3]); - hist_leading_pt_emulated_Jet200->Fill(leading_pt,hweight); - hist_leading_eta_emulated_Jet200->Fill(leading_eta,hweight); - } - - if(hltPassj[4]){ - //if(prescalej[3]>0) hweight=hweight*prescalej[3]; - //if(prescalej[3]<0) hweight=hweight*(-prescalej[3]); - hist_leading_pt_all_Jet260->Fill(leading_pt,hweight); - hist_leading_eta_all_Jet260->Fill(leading_eta,hweight); - } - if (hltPassj[4] && l1cut[4] && hltcut[4]){ - //if(prescalej[3]>0) hweight=hweight*prescalej[3]; - //if(prescalej[3]<0) hweight=hweight*(-prescalej[3]); - hist_leading_pt_emulated_Jet260->Fill(leading_pt,hweight); - hist_leading_eta_emulated_Jet260->Fill(leading_eta,hweight); - } - - if(hltPassj[5]){ - //if(prescalej[4]>0) hweight=hweight*prescalej[4]; - //if(prescalej[4]<0) hweight=hweight*(-prescalej[4]); - hist_leading_pt_all_Jet320->Fill(leading_pt,hweight); - hist_leading_eta_all_Jet320->Fill(leading_eta,hweight); - } - if (hltPassj[5] && l1cut[5] && hltcut[5]){ - //if(prescalej[4]>0) hweight=hweight*prescalej[4]; - //if(prescalej[4]<0) hweight=hweight*(-prescalej[4]); - hist_leading_pt_emulated_Jet320->Fill(leading_pt,hweight); - hist_leading_eta_emulated_Jet320->Fill(leading_eta,hweight); - } - - if(hltPassj[6]){ - //if(prescalej[5]>0) hweight=hweight*prescalej[5]; - //if(prescalej[5]<0) hweight=hweight*(-prescalej[5]); - hist_leading_pt_all_Jet400->Fill(leading_pt,hweight); - hist_leading_eta_all_Jet400->Fill(leading_eta,hweight); - } - if (hltPassj[6] && l1cut[6] && hltcut[6]){ - //if(prescalej[5]>0) hweight=hweight*prescalej[5]; - //if(prescalej[5]<0) hweight=hweight*(-prescalej[5]); - hist_leading_pt_emulated_Jet400->Fill(leading_pt,hweight); - hist_leading_eta_emulated_Jet400->Fill(leading_eta,hweight); - } - - if(hltPassj[7]){ - //if(prescalej[6]>0) hweight=hweight*prescalej[6]; - //if(prescalej[6]<0) hweight=hweight*(-prescalej[6]); - hist_leading_pt_all_Jet450->Fill(leading_pt,hweight); - hist_leading_eta_all_Jet450->Fill(leading_eta,hweight); - } - if (hltPassj[7] && l1cut[7] && hltcut[7]){ - //if(prescalej[6]>0) hweight=hweight*prescalej[6]; - //if(prescalej[6]<0) hweight=hweight*(-prescalej[6]); - hist_leading_pt_emulated_Jet450->Fill(leading_pt,hweight); - hist_leading_eta_emulated_Jet450->Fill(leading_eta,hweight); - } - - if(hltPassj[8]){ - //if(prescalej[7]>0) hweight=hweight*prescalej[7]; - //if(prescalej[7]<0) hweight=hweight*(-prescalej[7]); - hist_leading_pt_all_Jet500->Fill(leading_pt,hweight); - hist_leading_eta_all_Jet500->Fill(leading_eta,hweight); - } - if (hltPassj[8] && l1cut[8] && hltcut[8]){ - //if(prescalej[7]>0) hweight=hweight*prescalej[7]; - //if(prescalej[7]<0) hweight=hweight*(-prescalej[7]); - hist_leading_pt_emulated_Jet500->Fill(leading_pt,hweight); - hist_leading_eta_emulated_Jet500->Fill(leading_eta,hweight); - } - } - - hweight=1.; - - for(unsigned int j=0; jnPFJetsCHS(); j++) { - if(Event->pfjetchs(j).ptCor()pfjetchs(j).y())>mYMax) continue; - - hweight=1.; - - //parsePileUpJSON2(); - double PileUpData=-10; - //PileUpData=getAvgPU(int(Event->evtHdr().runNo()),int(Event->evtHdr().lumi())); - - //cout<evtHdr().runNo())<<" "<evtHdr().lumi())<evtHdr().runNo()),int(Event->evtHdr().lumi()))<<" "<evtHdr().runNo())<<" "<evtHdr().lumi())<0) hweight=hweight*prescalej[1]; - if(prescalej[1]<0) hweight=hweight*(-prescalej[1]); - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet60_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet60_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet60_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet60_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet60_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet60_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=3.2 && fabs(Event->pfjetchs(j).y())<=4.7 && Event->pfjetchs(j).tightID()) {pt_DETInclJet60_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - } - - hweight=1.; - - if(hltPassj[2]){ - if(prescalej[2]>0) hweight=hweight*prescalej[2]; - if(prescalej[2]<0) hweight=hweight*(-prescalej[2]); - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet80_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet80_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet80_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet80_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet80_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet80_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=3.2 && fabs(Event->pfjetchs(j).y())<=4.7 && Event->pfjetchs(j).tightID()) {pt_DETInclJet80_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - } - - hweight=1.; - - if(hltPassj[3]){ - if(prescalej[3]>0) hweight=hweight*prescalej[3]; - if(prescalej[3]<0) hweight=hweight*(-prescalej[3]); - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet140_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet140_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet140_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet140_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet140_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet140_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=3.2 && fabs(Event->pfjetchs(j).y())<=4.7 && Event->pfjetchs(j).tightID()) {pt_DETInclJet140_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - } - - hweight=1.; - - if(hltPassj[4]){ - if(prescalej[4]>0) hweight=hweight*prescalej[4]; - if(prescalej[4]<0) hweight=hweight*(-prescalej[4]); - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet200_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet200_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet200_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet200_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet200_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet200_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=3.2 && fabs(Event->pfjetchs(j).y())<=4.7 && Event->pfjetchs(j).tightID()) {pt_DETInclJet200_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - } - - hweight=1.; - - if(hltPassj[5]){ - if(prescalej[5]>0) hweight=hweight*prescalej[5]; - if(prescalej[5]<0) hweight=hweight*(-prescalej[5]); - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet260_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet260_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet260_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet260_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet260_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet260_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=3.2 && fabs(Event->pfjetchs(j).y())<=4.7 && Event->pfjetchs(j).tightID()) {pt_DETInclJet260_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - } - - hweight=1.; - - if(hltPassj[6]){ - if(prescalej[6]>0) hweight=hweight*prescalej[6]; - if(prescalej[6]<0) hweight=hweight*(-prescalej[6]); - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet320_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet320_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet320_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet320_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet320_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet320_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=3.2 && fabs(Event->pfjetchs(j).y())<=4.7 && Event->pfjetchs(j).tightID()) {pt_DETInclJet320_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - } - - hweight=1.; - - if(hltPassj[7]){ - if(prescalej[7]>0) hweight=hweight*prescalej[7]; - if(prescalej[7]<0) hweight=hweight*(-prescalej[7]); - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet400_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet400_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet400_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet400_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet400_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet400_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=3.2 && fabs(Event->pfjetchs(j).y())<=4.7 && Event->pfjetchs(j).tightID()) {pt_DETInclJet400_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - } - - hweight=1.; - - if(hltPassj[8]){ - if(prescalej[8]>0) hweight=hweight*prescalej[8]; - if(prescalej[8]<0) hweight=hweight*(-prescalej[8]); - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet450_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet450_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet450_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet450_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet450_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet450_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - if(fabs(Event->pfjetchs(j).y())>=3.2 && fabs(Event->pfjetchs(j).y())<=4.7 && Event->pfjetchs(j).tightID()) {pt_DETInclJet450_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);} - } - - hweight=1.; - - if(Event->pfjetchs(j).ptCor()>=mMinPt){ - - if(Event->pfjetchs(0).ptCor()>=mMinPt && Event->pfjetchs(0).ptCor()<114 && hltPassj[0]){ - //if(Event->pfjetchs(0).ptCor()>=mMinPt && Event->pfjetchs(0).ptCor()<137 && hltPassj[0]){ - - if(prescalej[0]>0) hweight=hweight*prescalej[0]; - if(prescalej[0]<0) hweight=hweight*(-prescalej[0]); - - if((fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID())||(fabs(Event->pfjetchs(j).y())>3.2 && Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)){ - DetJets++; - DETjet_ok[j]=1; - - pt0_DETInclJet->Fill(Event->pfjetchs(j).ptCor(),hweight); - pt0_DETInclJetUncor->Fill(Event->pfjetchs(j).pt(),hweight); - y0_DETInclJet->Fill(Event->pfjetchs(j).y(),hweight); - phi0_DETInclJet->Fill(Event->pfjetchs(j).phi(),hweight); - - //new histograms - Chargedhf0_DETJet->Fill(Event->pfjetchs(j).chf(),hweight);//charged hadron energy fraction - Neutralhf0_DETJet->Fill(Event->pfjetchs(j).nhf(),hweight);//neutral hadron energy fraction - Chargedef0_DETJet->Fill(Event->pfjetchs(j).cemf(),hweight);//charged em energy fraction - Photonef0_DETJet->Fill(Event->pfjetchs(j).nemf(),hweight);//neutral em energy fraction - Hadronef0_DETJet->Fill(Event->pfjetchs(j).hf_hf(),hweight);//hadron fraction energy fraction - Electromagneticef0_DETJet->Fill(Event->pfjetchs(j).hf_phf(),hweight);//electromagnetic fraction energy fraction - Muonef0_DETJet->Fill(Event->pfjetchs(j).muf(),hweight); //muon fraction energy fraction - - ChargedhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).chm(),hweight);//charged hadron multiplicity - NeutralhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).nhm(),hweight);//neutral hadron multiplicity - ChargedeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).elm(),hweight);//electron em multiplicity - PhotoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).phm(),hweight);//neutral em multiplicity - HadroneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_hm(),hweight);//hadron fraction multiplicity - ElectromagneticeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_phm(),hweight);//electromagnetic fraction multiplicity - MuoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).mum(),hweight); //muon fraction multiplicity - } - - if(Event->pfjetchs(j).ptCor()>=10){ - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); pt_DETInclJetUP_1bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_1bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_2bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_2bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_3bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_3bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_4bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_4bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_5bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_5bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_6bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_6bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7){ - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)//tight JETID forward region - {pt_DETInclJet_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_7bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_7bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - } - } - } - - if(Event->pfjetchs(0).ptCor()>=114 && Event->pfjetchs(0).ptCor()<133 && hltPassj[1]){ - - //if(Event->pfjetchs(0).ptCor()>=137 && Event->pfjetchs(0).ptCor()<200 && hltPassj[1]){ - if(prescalej[1]>0) hweight=hweight*prescalej[1]; - if(prescalej[1]<0) hweight=hweight*(-prescalej[1]); - - bool switchFillPU=1; - if(switchFillPU){ - TruePileUpDataInteger->Fill(PileUpData,hweight); - switchFillPU=0; - } - - if((fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID())||(fabs(Event->pfjetchs(j).y())>3.2 && Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)){ - DetJets++; - DETjet_ok[j]=1; - - pt0_DETInclJet->Fill(Event->pfjetchs(j).ptCor(),hweight); - pt0_DETInclJetUncor->Fill(Event->pfjetchs(j).pt(),hweight); - y0_DETInclJet->Fill(Event->pfjetchs(j).y(),hweight); - phi0_DETInclJet->Fill(Event->pfjetchs(j).phi(),hweight); - - //new histograms - Chargedhf0_DETJet->Fill(Event->pfjetchs(j).chf(),hweight);//charged hadron energy fraction - Neutralhf0_DETJet->Fill(Event->pfjetchs(j).nhf(),hweight);//neutral hadron energy fraction - Chargedef0_DETJet->Fill(Event->pfjetchs(j).cemf(),hweight);//charged em energy fraction - Photonef0_DETJet->Fill(Event->pfjetchs(j).nemf(),hweight);//neutral em energy fraction - Hadronef0_DETJet->Fill(Event->pfjetchs(j).hf_hf(),hweight);//hadron fraction energy fraction - Electromagneticef0_DETJet->Fill(Event->pfjetchs(j).hf_phf(),hweight);//electromagnetic fraction energy fraction - Muonef0_DETJet->Fill(Event->pfjetchs(j).muf(),hweight); //muon fraction energy fraction - - ChargedhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).chm(),hweight);//charged hadron multiplicity - NeutralhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).nhm(),hweight);//neutral hadron multiplicity - ChargedeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).elm(),hweight);//electron em multiplicity - PhotoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).phm(),hweight);//neutral em multiplicity - HadroneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_hm(),hweight);//hadron fraction multiplicity - ElectromagneticeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_phm(),hweight);//electromagnetic fraction multiplicity - MuoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).mum(),hweight); //muon fraction multiplicity - } - - if(Event->pfjetchs(j).ptCor()>=10){ - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); pt_DETInclJetUP_1bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_1bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_2bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_2bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_3bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_3bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_4bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_4bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_5bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_5bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_6bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_6bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) { - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)//tight JETID forward region - {pt_DETInclJet_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_7bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_7bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - } - } - } - - if(Event->pfjetchs(0).ptCor()>=133 && Event->pfjetchs(0).ptCor()<220 && hltPassj[2]){ - //if(Event->pfjetchs(0).ptCor()>=200 && Event->pfjetchs(0).ptCor()<300 && hltPassj[2]){ - if(prescalej[2]>0) hweight=hweight*prescalej[2]; - if(prescalej[2]<0) hweight=hweight*(-prescalej[2]); - - bool switchFillPU=1; - if(switchFillPU){ - TruePileUpDataInteger->Fill(PileUpData,hweight); - switchFillPU=0; - } - - - if((fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID())||(fabs(Event->pfjetchs(j).y())>3.2 && Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)){ - DetJets++; - DETjet_ok[j]=1; - - pt0_DETInclJet->Fill(Event->pfjetchs(j).ptCor(),hweight); - pt0_DETInclJetUncor->Fill(Event->pfjetchs(j).pt(),hweight); - y0_DETInclJet->Fill(Event->pfjetchs(j).y(),hweight); - phi0_DETInclJet->Fill(Event->pfjetchs(j).phi(),hweight); - - //new histograms - Chargedhf0_DETJet->Fill(Event->pfjetchs(j).chf(),hweight);//charged hadron energy fraction - Neutralhf0_DETJet->Fill(Event->pfjetchs(j).nhf(),hweight);//neutral hadron energy fraction - Chargedef0_DETJet->Fill(Event->pfjetchs(j).cemf(),hweight);//charged em energy fraction - Photonef0_DETJet->Fill(Event->pfjetchs(j).nemf(),hweight);//neutral em energy fraction - Hadronef0_DETJet->Fill(Event->pfjetchs(j).hf_hf(),hweight);//hadron fraction energy fraction - Electromagneticef0_DETJet->Fill(Event->pfjetchs(j).hf_phf(),hweight);//electromagnetic fraction energy fraction - Muonef0_DETJet->Fill(Event->pfjetchs(j).muf(),hweight); //muon fraction energy fraction - - ChargedhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).chm(),hweight);//charged hadron multiplicity - NeutralhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).nhm(),hweight);//neutral hadron multiplicity - ChargedeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).elm(),hweight);//electron em multiplicity - PhotoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).phm(),hweight);//neutral em multiplicity - HadroneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_hm(),hweight);//hadron fraction multiplicity - ElectromagneticeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_phm(),hweight);//electromagnetic fraction multiplicity - MuoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).mum(),hweight); //muon fraction multiplicity - } - - if(Event->pfjetchs(j).ptCor()>=10){ - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); pt_DETInclJetUP_1bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_1bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_2bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_2bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_3bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_3bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_4bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_4bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_5bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_5bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_6bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_6bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) { - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)//tight JETID forward region - {pt_DETInclJet_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_7bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_7bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - } - } - } - - if(Event->pfjetchs(0).ptCor()>=220 && Event->pfjetchs(0).ptCor()<300 && hltPassj[3]){ - //if(Event->pfjetchs(0).ptCor()>=300 && Event->pfjetchs(0).ptCor()<400 && hltPassj[3]){ - if(prescalej[3]>0) hweight=hweight*prescalej[3]; - if(prescalej[3]<0) hweight=hweight*(-prescalej[3]); - - bool switchFillPU=1; - if(switchFillPU){ - TruePileUpDataInteger->Fill(PileUpData,hweight); - switchFillPU=0; - } - - if((fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID())||(fabs(Event->pfjetchs(j).y())>3.2 && Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)){ - DetJets++; - DETjet_ok[j]=1; - - pt0_DETInclJet->Fill(Event->pfjetchs(j).ptCor(),hweight); - pt0_DETInclJetUncor->Fill(Event->pfjetchs(j).pt(),hweight); - y0_DETInclJet->Fill(Event->pfjetchs(j).y(),hweight); - phi0_DETInclJet->Fill(Event->pfjetchs(j).phi(),hweight); - - //new histograms - Chargedhf0_DETJet->Fill(Event->pfjetchs(j).chf(),hweight);//charged hadron energy fraction - Neutralhf0_DETJet->Fill(Event->pfjetchs(j).nhf(),hweight);//neutral hadron energy fraction - Chargedef0_DETJet->Fill(Event->pfjetchs(j).cemf(),hweight);//charged em energy fraction - Photonef0_DETJet->Fill(Event->pfjetchs(j).nemf(),hweight);//neutral em energy fraction - Hadronef0_DETJet->Fill(Event->pfjetchs(j).hf_hf(),hweight);//hadron fraction energy fraction - Electromagneticef0_DETJet->Fill(Event->pfjetchs(j).hf_phf(),hweight);//electromagnetic fraction energy fraction - Muonef0_DETJet->Fill(Event->pfjetchs(j).muf(),hweight); //muon fraction energy fraction - - ChargedhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).chm(),hweight);//charged hadron multiplicity - NeutralhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).nhm(),hweight);//neutral hadron multiplicity - ChargedeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).elm(),hweight);//electron em multiplicity - PhotoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).phm(),hweight);//neutral em multiplicity - HadroneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_hm(),hweight);//hadron fraction multiplicity - ElectromagneticeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_phm(),hweight);//electromagnetic fraction multiplicity - MuoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).mum(),hweight); //muon fraction multiplicity - } - - if(Event->pfjetchs(j).ptCor()>=10){ - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); pt_DETInclJetUP_1bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_1bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_2bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_2bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_3bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_3bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_4bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_4bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_5bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_5bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_6bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_6bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) { - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)//tight JETID forward region - {pt_DETInclJet_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_7bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_7bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - } - } - } - - if(Event->pfjetchs(0).ptCor()>=300 && Event->pfjetchs(0).ptCor()<430 && hltPassj[4]){ - //if(Event->pfjetchs(0).ptCor()>=400 && Event->pfjetchs(0).ptCor()<500 && hltPassj[4]){ - if(prescalej[4]>0) hweight=hweight*prescalej[4]; - if(prescalej[4]<0) hweight=hweight*(-prescalej[4]); - - bool switchFillPU=1; - if(switchFillPU){ - TruePileUpDataInteger->Fill(PileUpData,hweight); - switchFillPU=0; - } - - - if((fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID())||(fabs(Event->pfjetchs(j).y())>3.2 && Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)){ - DetJets++; - DETjet_ok[j]=1; - - pt0_DETInclJet->Fill(Event->pfjetchs(j).ptCor(),hweight); - pt0_DETInclJetUncor->Fill(Event->pfjetchs(j).pt(),hweight); - y0_DETInclJet->Fill(Event->pfjetchs(j).y(),hweight); - phi0_DETInclJet->Fill(Event->pfjetchs(j).phi(),hweight); - - //new histograms - Chargedhf0_DETJet->Fill(Event->pfjetchs(j).chf(),hweight);//charged hadron energy fraction - Neutralhf0_DETJet->Fill(Event->pfjetchs(j).nhf(),hweight);//neutral hadron energy fraction - Chargedef0_DETJet->Fill(Event->pfjetchs(j).cemf(),hweight);//charged em energy fraction - Photonef0_DETJet->Fill(Event->pfjetchs(j).nemf(),hweight);//neutral em energy fraction - Hadronef0_DETJet->Fill(Event->pfjetchs(j).hf_hf(),hweight);//hadron fraction energy fraction - Electromagneticef0_DETJet->Fill(Event->pfjetchs(j).hf_phf(),hweight);//electromagnetic fraction energy fraction - Muonef0_DETJet->Fill(Event->pfjetchs(j).muf(),hweight); //muon fraction energy fraction - - ChargedhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).chm(),hweight);//charged hadron multiplicity - NeutralhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).nhm(),hweight);//neutral hadron multiplicity - ChargedeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).elm(),hweight);//electron em multiplicity - PhotoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).phm(),hweight);//neutral em multiplicity - HadroneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_hm(),hweight);//hadron fraction multiplicity - ElectromagneticeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_phm(),hweight);//electromagnetic fraction multiplicity - MuoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).mum(),hweight); //muon fraction multiplicity - } - - if(Event->pfjetchs(j).ptCor()>=10){ - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); pt_DETInclJetUP_1bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_1bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_2bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_2bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_3bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_3bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_4bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_4bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_5bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_5bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_6bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_6bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) { - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)//tight JETID forward region - {pt_DETInclJet_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_7bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_7bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - } - } - } - - if(Event->pfjetchs(0).ptCor()>=430 && Event->pfjetchs(0).ptCor()<507 && hltPassj[5]){ - //if(Event->pfjetchs(0).ptCor()>=500 && Event->pfjetchs(0).ptCor()<600 && hltPassj[5]){ - if(prescalej[5]>0) hweight=hweight*prescalej[5]; - if(prescalej[5]<0) hweight=hweight*(-prescalej[5]); - - bool switchFillPU=1; - if(switchFillPU){ - TruePileUpDataInteger->Fill(PileUpData,hweight); - switchFillPU=0; - } - - - if((fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID())||(fabs(Event->pfjetchs(j).y())>3.2 && Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)){ - DetJets++; - DETjet_ok[j]=1; - - pt0_DETInclJet->Fill(Event->pfjetchs(j).ptCor(),hweight); - pt0_DETInclJetUncor->Fill(Event->pfjetchs(j).pt(),hweight); - y0_DETInclJet->Fill(Event->pfjetchs(j).y(),hweight); - phi0_DETInclJet->Fill(Event->pfjetchs(j).phi(),hweight); - - //new histograms - Chargedhf0_DETJet->Fill(Event->pfjetchs(j).chf(),hweight);//charged hadron energy fraction - Neutralhf0_DETJet->Fill(Event->pfjetchs(j).nhf(),hweight);//neutral hadron energy fraction - Chargedef0_DETJet->Fill(Event->pfjetchs(j).cemf(),hweight);//charged em energy fraction - Photonef0_DETJet->Fill(Event->pfjetchs(j).nemf(),hweight);//neutral em energy fraction - Hadronef0_DETJet->Fill(Event->pfjetchs(j).hf_hf(),hweight);//hadron fraction energy fraction - Electromagneticef0_DETJet->Fill(Event->pfjetchs(j).hf_phf(),hweight);//electromagnetic fraction energy fraction - Muonef0_DETJet->Fill(Event->pfjetchs(j).muf(),hweight); //muon fraction energy fraction - - ChargedhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).chm(),hweight);//charged hadron multiplicity - NeutralhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).nhm(),hweight);//neutral hadron multiplicity - ChargedeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).elm(),hweight);//electron em multiplicity - PhotoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).phm(),hweight);//neutral em multiplicity - HadroneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_hm(),hweight);//hadron fraction multiplicity - ElectromagneticeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_phm(),hweight);//electromagnetic fraction multiplicity - MuoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).mum(),hweight); //muon fraction multiplicity - } - - if(Event->pfjetchs(j).ptCor()>=10){ - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); pt_DETInclJetUP_1bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_1bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_2bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_2bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_3bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_3bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_4bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_4bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_5bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_5bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_6bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_6bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) { - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)//tight JETID forward region - {pt_DETInclJet_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_7bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_7bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - } - } - } - - if(Event->pfjetchs(0).ptCor()>=507 && Event->pfjetchs(0).ptCor()<638 && hltPassj[6]){ - //if(Event->pfjetchs(0).ptCor()>=600 && Event->pfjetchs(0).ptCor()<700 && hltPassj[6]){ - if(prescalej[6]>0) hweight=hweight*prescalej[6]; - if(prescalej[6]<0) hweight=hweight*(-prescalej[6]); - - bool switchFillPU=1; - if(switchFillPU){ - TruePileUpDataInteger->Fill(PileUpData,hweight); - switchFillPU=0; - } - - - if((fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID())||(fabs(Event->pfjetchs(j).y())>3.2 && Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)){ - DetJets++; - DETjet_ok[j]=1; - - pt0_DETInclJet->Fill(Event->pfjetchs(j).ptCor(),hweight); - pt0_DETInclJetUncor->Fill(Event->pfjetchs(j).pt(),hweight); - y0_DETInclJet->Fill(Event->pfjetchs(j).y(),hweight); - phi0_DETInclJet->Fill(Event->pfjetchs(j).phi(),hweight); - - //new histograms - Chargedhf0_DETJet->Fill(Event->pfjetchs(j).chf(),hweight);//charged hadron energy fraction - Neutralhf0_DETJet->Fill(Event->pfjetchs(j).nhf(),hweight);//neutral hadron energy fraction - Chargedef0_DETJet->Fill(Event->pfjetchs(j).cemf(),hweight);//charged em energy fraction - Photonef0_DETJet->Fill(Event->pfjetchs(j).nemf(),hweight);//neutral em energy fraction - Hadronef0_DETJet->Fill(Event->pfjetchs(j).hf_hf(),hweight);//hadron fraction energy fraction - Electromagneticef0_DETJet->Fill(Event->pfjetchs(j).hf_phf(),hweight);//electromagnetic fraction energy fraction - Muonef0_DETJet->Fill(Event->pfjetchs(j).muf(),hweight); //muon fraction energy fraction - - ChargedhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).chm(),hweight);//charged hadron multiplicity - NeutralhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).nhm(),hweight);//neutral hadron multiplicity - ChargedeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).elm(),hweight);//electron em multiplicity - PhotoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).phm(),hweight);//neutral em multiplicity - HadroneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_hm(),hweight);//hadron fraction multiplicity - ElectromagneticeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_phm(),hweight);//electromagnetic fraction multiplicity - MuoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).mum(),hweight); //muon fraction multiplicity - } - - if(Event->pfjetchs(j).ptCor()>=10){ - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); pt_DETInclJetUP_1bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_1bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_2bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_2bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_3bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_3bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_4bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_4bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_5bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_5bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_6bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_6bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) { - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)//tight JETID forward region - {pt_DETInclJet_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_7bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_7bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - } - } - } - - if(Event->pfjetchs(0).ptCor()>=638 && Event->pfjetchs(0).ptCor()<737 && hltPassj[7]){ - //if(Event->pfjetchs(0).ptCor()>=700 && Event->pfjetchs(0).ptCor()<800 && hltPassj[7]){ - if(prescalej[7]>0) hweight=hweight*prescalej[7]; - if(prescalej[7]<0) hweight=hweight*(-prescalej[7]); - - bool switchFillPU=1; - if(switchFillPU){ - TruePileUpDataInteger->Fill(PileUpData,hweight); - switchFillPU=0; - } - - - if((fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID())||(fabs(Event->pfjetchs(j).y())>3.2 && Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)){ - DetJets++; - DETjet_ok[j]=1; - - pt0_DETInclJet->Fill(Event->pfjetchs(j).ptCor(),hweight); - pt0_DETInclJetUncor->Fill(Event->pfjetchs(j).pt(),hweight); - y0_DETInclJet->Fill(Event->pfjetchs(j).y(),hweight); - phi0_DETInclJet->Fill(Event->pfjetchs(j).phi(),hweight); - - //new histograms - Chargedhf0_DETJet->Fill(Event->pfjetchs(j).chf(),hweight);//charged hadron energy fraction - Neutralhf0_DETJet->Fill(Event->pfjetchs(j).nhf(),hweight);//neutral hadron energy fraction - Chargedef0_DETJet->Fill(Event->pfjetchs(j).cemf(),hweight);//charged em energy fraction - Photonef0_DETJet->Fill(Event->pfjetchs(j).nemf(),hweight);//neutral em energy fraction - Hadronef0_DETJet->Fill(Event->pfjetchs(j).hf_hf(),hweight);//hadron fraction energy fraction - Electromagneticef0_DETJet->Fill(Event->pfjetchs(j).hf_phf(),hweight);//electromagnetic fraction energy fraction - Muonef0_DETJet->Fill(Event->pfjetchs(j).muf(),hweight); //muon fraction energy fraction - - ChargedhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).chm(),hweight);//charged hadron multiplicity - NeutralhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).nhm(),hweight);//neutral hadron multiplicity - ChargedeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).elm(),hweight);//electron em multiplicity - PhotoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).phm(),hweight);//neutral em multiplicity - HadroneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_hm(),hweight);//hadron fraction multiplicity - ElectromagneticeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_phm(),hweight);//electromagnetic fraction multiplicity - MuoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).mum(),hweight); //muon fraction multiplicity - } - - if(Event->pfjetchs(j).ptCor()>=10){ - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); pt_DETInclJetUP_1bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_1bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_2bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_2bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_3bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_3bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_4bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_4bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_5bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_5bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_6bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_6bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) { - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)//tight JETID forward region - {pt_DETInclJet_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_7bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_7bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - } - } - } - - if(Event->pfjetchs(0).ptCor()>=737 && hltPassj[8]){ - //if(Event->pfjetchs(0).ptCor()>=800 && hltPassj[8]){ - if(prescalej[8]>0) hweight=hweight*prescalej[8]; - if(prescalej[8]<0) hweight=hweight*(-prescalej[8]); - - bool switchFillPU=1; - if(switchFillPU){ - TruePileUpDataInteger->Fill(PileUpData,hweight); - switchFillPU=0; - } - - - if((fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID())||(fabs(Event->pfjetchs(j).y())>3.2 && Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)){ - DetJets++; - DETjet_ok[j]=1; - - pt0_DETInclJet->Fill(Event->pfjetchs(j).ptCor(),hweight); - pt0_DETInclJetUncor->Fill(Event->pfjetchs(j).pt(),hweight); - y0_DETInclJet->Fill(Event->pfjetchs(j).y(),hweight); - phi0_DETInclJet->Fill(Event->pfjetchs(j).phi(),hweight); - - //new histograms - Chargedhf0_DETJet->Fill(Event->pfjetchs(j).chf(),hweight);//charged hadron energy fraction - Neutralhf0_DETJet->Fill(Event->pfjetchs(j).nhf(),hweight);//neutral hadron energy fraction - Chargedef0_DETJet->Fill(Event->pfjetchs(j).cemf(),hweight);//charged em energy fraction - Photonef0_DETJet->Fill(Event->pfjetchs(j).nemf(),hweight);//neutral em energy fraction - Hadronef0_DETJet->Fill(Event->pfjetchs(j).hf_hf(),hweight);//hadron fraction energy fraction - Electromagneticef0_DETJet->Fill(Event->pfjetchs(j).hf_phf(),hweight);//electromagnetic fraction energy fraction - Muonef0_DETJet->Fill(Event->pfjetchs(j).muf(),hweight); //muon fraction energy fraction - - ChargedhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).chm(),hweight);//charged hadron multiplicity - NeutralhMultiplicity0_DETJet->Fill(Event->pfjetchs(j).nhm(),hweight);//neutral hadron multiplicity - ChargedeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).elm(),hweight);//electron em multiplicity - PhotoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).phm(),hweight);//neutral em multiplicity - HadroneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_hm(),hweight);//hadron fraction multiplicity - ElectromagneticeMultiplicity0_DETJet->Fill(Event->pfjetchs(j).hf_phm(),hweight);//electromagnetic fraction multiplicity - MuoneMultiplicity0_DETJet->Fill(Event->pfjetchs(j).mum(),hweight); //muon fraction multiplicity - } - - if(Event->pfjetchs(j).ptCor()>=10){ - if(fabs(Event->pfjetchs(j).y())<=0.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_1bin->Fill(Event->pfjetchs(j).ptCor(),hweight); pt_DETInclJetUP_1bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_1bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>0.5 && fabs(Event->pfjetchs(j).y())<=1.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_2bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_2bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_2bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.0 && fabs(Event->pfjetchs(j).y())<=1.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_3bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_3bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_3bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>1.5 && fabs(Event->pfjetchs(j).y())<=2.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_4bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_4bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_4bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.0 && fabs(Event->pfjetchs(j).y())<=2.5 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_5bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_5bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_5bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>2.5 && fabs(Event->pfjetchs(j).y())<=3.0 && Event->pfjetchs(j).tightID()) {pt_DETInclJet_6bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_6bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_6bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - if(fabs(Event->pfjetchs(j).y())>3.2 && fabs(Event->pfjetchs(j).y())<=4.7) { - if(Event->pfjetchs(j).nemf()<0.90 && Event->pfjetchs(j).ncand()>10)//tight JETID forward region - {pt_DETInclJet_7bin->Fill(Event->pfjetchs(j).ptCor(),hweight);pt_DETInclJetUP_7bin->Fill(Event->pfjetchs(j).ptCor()+Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);pt_DETInclJetDOWN_7bin->Fill(Event->pfjetchs(j).ptCor()-Event->pfjetchs(j).ptCor()*Event->pfjetchs(j).unc(),hweight);} - } - } - } - } - } - } - - if(DETjet_ok[0]==1 && DETjet_ok[1]==1){ - - pt0_DETJet->Fill(Event->pfjetchs(0).ptCor(),hweight); - pt0_DETJetUncor->Fill(Event->pfjetchs(0).pt(),hweight); - pt1_DETJet->Fill(Event->pfjetchs(1).ptCor(),hweight); - pt1_DETJetUncor->Fill(Event->pfjetchs(1).pt(),hweight); - y0_DETJet->Fill(Event->pfjetchs(0).y(),hweight); - y1_DETJet->Fill(Event->pfjetchs(1).y(),hweight); - phi0_DETJet->Fill(Event->pfjetchs(0).phi(),hweight); - phi1_DETJet->Fill(Event->pfjetchs(1).phi(),hweight); - } - - if(DETjet_ok[0]==1){ - - Multiplicity_DETJet->Fill(DetJets,hweight); - num_of_VtxGood->Fill(Event->evtHdr().nVtxGood(),hweight); - - if(fabs(Event->pfjetchs(0).y())<=3.0 && Event->pfjetchs(0).tightID()){ - MET_DET->Fill(Event->pfmet().met(),hweight); - METPhi_DET->Fill(fabs(Event->pfmet().phi()),hweight); - FractionMET_DET->Fill(Event->pfmet().met_o_sumet(),hweight); - } - if(fabs(Event->pfjetchs(0).y())>3.2 && Event->pfjetchs(0).nemf()<0.90 && Event->pfjetchs(0).ncand()>10){ - MET_DET->Fill(Event->pfmet().met(),hweight); - METPhi_DET->Fill(fabs(Event->pfmet().phi()),hweight); - FractionMET_DET->Fill(Event->pfmet().met_o_sumet(),hweight); - } - } - - //if(DetJets==2) {cout<evtHdr().lumi()<<" Event "<evtHdr().event()<<" Run Number "<evtHdr().runNo()<evtHdr().lumi()<<" Event "<evtHdr().event()<<" Run Number "<evtHdr().runNo()<evtHdr().lumi()<<" Event "<evtHdr().event()<<" Run Number "<evtHdr().runNo()<evtHdr().runNo()==251252){ - //if(Event->evtHdr().lumi()==158) { cout<evtHdr().event()<evtHdr().lumi()==158) { cout<evtHdr().event()<<" "<pfjetchs(0).ptCor()<<" "<pfjetchs(1).ptCor()<<" "<pfjetchs(2).ptCor()<<" "<pfjetchs(0).y()<<" "<pfjetchs(1).y()<<" "<pfjetchs(2).y()<evtHdr().lumi()==158) { cout<evtHdr().event()<<" "<pfjetchs(0).ptCor()<<" "<pfjetchs(1).ptCor()<<" "<pfjetchs(0).y()<<" "<pfjetchs(1).y()<evtHdr().lumi()==158) { cout<evtHdr().event()<<" "<pfjetchs(0).ptCor()<<" "<pfjetchs(1).ptCor()<<" "<pfjetchs(2).ptCor()<<" "<pfjetchs(0).y()<<" "<pfjetchs(1).y()<<" "<pfjetchs(2).y()<Close(); - - } - - float EntriesNumAcceptance[100][8]; - float EntriesDenAcceptance[100][8]; - float EntriesNumPurity[100][8]; - float EntriesDenPurity[100][8]; - float EntriesNumBackground[100][8]; - float EntriesDenBackground[100][8]; - float EntriesNumStability[100][8]; - float EntriesDenStability[100][8]; - - float Entries[8]; - float Errors[8]; - - for(int i=0;i<100;i++){ - for(int j=0;j<8;j++){ - EntriesNumAcceptance[i][j]=0; - EntriesDenAcceptance[i][j]=0; - EntriesNumStability[i][j]=0; - EntriesDenStability[i][j]=0; - EntriesNumBackground[i][j]=0; - EntriesDenBackground[i][j]=0; - EntriesNumPurity[i][j]=0; - EntriesDenPurity[i][j]=0; - Entries[j]=0; - Errors[j]=0; - } - } - - //Acceptance - - for(int i=1;iGetXaxis()->GetNbins()+1;i++){ - EntriesDenAcceptance[i][0]=Gen_MatchedInclusiveJets->GetBinContent(i); - EntriesDenAcceptance[i][1]=pt_GENInclJet_1bin->GetBinContent(i); - EntriesDenAcceptance[i][2]=pt_GENInclJet_2bin->GetBinContent(i); - EntriesDenAcceptance[i][3]=pt_GENInclJet_3bin->GetBinContent(i); - EntriesDenAcceptance[i][4]=pt_GENInclJet_4bin->GetBinContent(i); - EntriesDenAcceptance[i][5]=pt_GENInclJet_5bin->GetBinContent(i); - EntriesDenAcceptance[i][6]=pt_GENInclJet_6bin->GetBinContent(i); - EntriesDenAcceptance[i][7]=pt_GENInclJet_7bin->GetBinContent(i); - - for(int j=1;jGetYaxis()->GetNbins()+1;j++){ - EntriesNumAcceptance[i][0]=EntriesNumAcceptance[i][0]+TwoD_MatchedInclusiveJets->GetBinContent(j,i); - EntriesNumAcceptance[i][1]=EntriesNumAcceptance[i][1]+TwoD_MatchedInclusiveJets_1bin->GetBinContent(j,i); - EntriesNumAcceptance[i][2]=EntriesNumAcceptance[i][2]+TwoD_MatchedInclusiveJets_2bin->GetBinContent(j,i); - EntriesNumAcceptance[i][3]=EntriesNumAcceptance[i][3]+TwoD_MatchedInclusiveJets_3bin->GetBinContent(j,i); - EntriesNumAcceptance[i][4]=EntriesNumAcceptance[i][4]+TwoD_MatchedInclusiveJets_4bin->GetBinContent(j,i); - EntriesNumAcceptance[i][5]=EntriesNumAcceptance[i][5]+TwoD_MatchedInclusiveJets_5bin->GetBinContent(j,i); - EntriesNumAcceptance[i][6]=EntriesNumAcceptance[i][6]+TwoD_MatchedInclusiveJets_6bin->GetBinContent(j,i); - EntriesNumAcceptance[i][7]=EntriesNumAcceptance[i][7]+TwoD_MatchedInclusiveJets_7bin->GetBinContent(j,i); - } - - for(int j=0;j<8;j++){ - if(EntriesDenAcceptance[i][j]!=0){ - Entries[j]=EntriesNumAcceptance[i][j]/EntriesDenAcceptance[i][j]; - } - } - - AcceptancePtJets->SetBinContent(i,Entries[0]); - AcceptancePtJets->SetBinError(i,Errors[0]); - AcceptancePtJets_1bin->SetBinContent(i,Entries[1]); - AcceptancePtJets_2bin->SetBinContent(i,Entries[2]); - AcceptancePtJets_3bin->SetBinContent(i,Entries[3]); - AcceptancePtJets_4bin->SetBinContent(i,Entries[4]); - AcceptancePtJets_5bin->SetBinContent(i,Entries[5]); - AcceptancePtJets_6bin->SetBinContent(i,Entries[6]); - AcceptancePtJets_7bin->SetBinContent(i,Entries[7]); - AcceptancePtJets_1bin->SetBinError(i,Errors[0]); - AcceptancePtJets_2bin->SetBinError(i,Errors[0]); - AcceptancePtJets_3bin->SetBinError(i,Errors[0]); - AcceptancePtJets_4bin->SetBinError(i,Errors[0]); - AcceptancePtJets_5bin->SetBinError(i,Errors[0]); - AcceptancePtJets_6bin->SetBinError(i,Errors[0]); - AcceptancePtJets_7bin->SetBinError(i,Errors[0]); - } - - //Purity: matched detector and hadron level/ matched detector level - - for(int i=1;iGetXaxis()->GetNbins()+1;i++){ - EntriesNumPurity[i][0]=TwoD_MatchedInclusiveJets->GetBinContent(i,i); - - EntriesNumPurity[i][1]=TwoD_MatchedInclusiveJets_1bin->GetBinContent(i,i); - EntriesNumPurity[i][2]=TwoD_MatchedInclusiveJets_2bin->GetBinContent(i,i); - EntriesNumPurity[i][3]=TwoD_MatchedInclusiveJets_3bin->GetBinContent(i,i); - EntriesNumPurity[i][4]=TwoD_MatchedInclusiveJets_4bin->GetBinContent(i,i); - EntriesNumPurity[i][5]=TwoD_MatchedInclusiveJets_5bin->GetBinContent(i,i); - EntriesNumPurity[i][6]=TwoD_MatchedInclusiveJets_6bin->GetBinContent(i,i); - EntriesNumPurity[i][7]=TwoD_MatchedInclusiveJets_7bin->GetBinContent(i,i); - - for(int j=1;jGetYaxis()->GetNbins()+1;j++){ - EntriesDenPurity[i][0]=EntriesDenPurity[i][0]+TwoD_MatchedInclusiveJets->GetBinContent(j,i); - EntriesDenPurity[i][1]=EntriesDenPurity[i][1]+TwoD_MatchedInclusiveJets_1bin->GetBinContent(j,i); - EntriesDenPurity[i][2]=EntriesDenPurity[i][2]+TwoD_MatchedInclusiveJets_2bin->GetBinContent(j,i); - EntriesDenPurity[i][3]=EntriesDenPurity[i][3]+TwoD_MatchedInclusiveJets_3bin->GetBinContent(j,i); - EntriesDenPurity[i][4]=EntriesDenPurity[i][4]+TwoD_MatchedInclusiveJets_4bin->GetBinContent(j,i); - EntriesDenPurity[i][5]=EntriesDenPurity[i][5]+TwoD_MatchedInclusiveJets_5bin->GetBinContent(j,i); - EntriesDenPurity[i][6]=EntriesDenPurity[i][6]+TwoD_MatchedInclusiveJets_6bin->GetBinContent(j,i); - EntriesDenPurity[i][7]=EntriesDenPurity[i][7]+TwoD_MatchedInclusiveJets_7bin->GetBinContent(j,i); - } - - for(int j=0;j<8;j++){ - if(EntriesDenPurity[i][j]!=0){ - Entries[j]=EntriesNumPurity[i][j]/EntriesDenPurity[i][j]; - } - } - - PurityPtJets->SetBinContent(i,Entries[0]); - PurityPtJets_1bin->SetBinContent(i,Entries[1]); - PurityPtJets_2bin->SetBinContent(i,Entries[2]); - PurityPtJets_3bin->SetBinContent(i,Entries[3]); - PurityPtJets_4bin->SetBinContent(i,Entries[4]); - PurityPtJets_5bin->SetBinContent(i,Entries[5]); - PurityPtJets_6bin->SetBinContent(i,Entries[6]); - PurityPtJets_7bin->SetBinContent(i,Entries[7]); - - } - - //Stability:matched detector and hadron level / matched gen level - - for(int i=1;iGetXaxis()->GetNbins()+1;i++){ - EntriesNumStability[i][0]=TwoD_MatchedInclusiveJets->GetBinContent(i,i); - - EntriesNumStability[i][1]=TwoD_MatchedInclusiveJets_1bin->GetBinContent(i,i); - EntriesNumStability[i][2]=TwoD_MatchedInclusiveJets_2bin->GetBinContent(i,i); - EntriesNumStability[i][3]=TwoD_MatchedInclusiveJets_3bin->GetBinContent(i,i); - EntriesNumStability[i][4]=TwoD_MatchedInclusiveJets_4bin->GetBinContent(i,i); - EntriesNumStability[i][5]=TwoD_MatchedInclusiveJets_5bin->GetBinContent(i,i); - EntriesNumStability[i][6]=TwoD_MatchedInclusiveJets_6bin->GetBinContent(i,i); - EntriesNumStability[i][7]=TwoD_MatchedInclusiveJets_7bin->GetBinContent(i,i); - - for(int j=1;jGetYaxis()->GetNbins()+1;j++){ - EntriesDenStability[i][0]=EntriesDenStability[i][0]+TwoD_MatchedInclusiveJets->GetBinContent(i,j); - EntriesDenStability[i][1]=EntriesDenStability[i][1]+TwoD_MatchedInclusiveJets_1bin->GetBinContent(i,j); - EntriesDenStability[i][2]=EntriesDenStability[i][2]+TwoD_MatchedInclusiveJets_2bin->GetBinContent(i,j); - EntriesDenStability[i][3]=EntriesDenStability[i][3]+TwoD_MatchedInclusiveJets_3bin->GetBinContent(i,j); - EntriesDenStability[i][4]=EntriesDenStability[i][4]+TwoD_MatchedInclusiveJets_4bin->GetBinContent(i,j); - EntriesDenStability[i][5]=EntriesDenStability[i][5]+TwoD_MatchedInclusiveJets_5bin->GetBinContent(i,j); - EntriesDenStability[i][6]=EntriesDenStability[i][6]+TwoD_MatchedInclusiveJets_6bin->GetBinContent(i,j); - EntriesDenStability[i][7]=EntriesDenStability[i][7]+TwoD_MatchedInclusiveJets_7bin->GetBinContent(i,j); - } - - for(int j=0;j<8;j++){ - if(EntriesDenStability[i][j]!=0){ - Entries[j]=EntriesNumStability[i][j]/EntriesDenStability[i][j]; - } - } - - StabilityPtJets->SetBinContent(i,Entries[0]); - StabilityPtJets_1bin->SetBinContent(i,Entries[1]); - StabilityPtJets_2bin->SetBinContent(i,Entries[2]); - StabilityPtJets_3bin->SetBinContent(i,Entries[3]); - StabilityPtJets_4bin->SetBinContent(i,Entries[4]); - StabilityPtJets_5bin->SetBinContent(i,Entries[5]); - StabilityPtJets_6bin->SetBinContent(i,Entries[6]); - StabilityPtJets_7bin->SetBinContent(i,Entries[7]); - - } - - //Background - - for(int i=1;iGetXaxis()->GetNbins()+1;i++){ - EntriesDenBackground[i][0]=PF_MatchedInclusiveJets->GetBinContent(i); - - EntriesDenBackground[i][1]=pt_DETInclJet_1bin->GetBinContent(i); - EntriesDenBackground[i][2]=pt_DETInclJet_2bin->GetBinContent(i); - EntriesDenBackground[i][3]=pt_DETInclJet_3bin->GetBinContent(i); - EntriesDenBackground[i][4]=pt_DETInclJet_4bin->GetBinContent(i); - EntriesDenBackground[i][5]=pt_DETInclJet_5bin->GetBinContent(i); - EntriesDenBackground[i][6]=pt_DETInclJet_6bin->GetBinContent(i); - EntriesDenBackground[i][7]=pt_DETInclJet_7bin->GetBinContent(i); - - for(int j=1;jGetYaxis()->GetNbins()+1;j++){ - EntriesNumBackground[i][0]=EntriesNumBackground[i][0]+TwoD_MatchedInclusiveJets->GetBinContent(i,j); - - EntriesNumBackground[i][1]=EntriesNumBackground[i][1]+TwoD_MatchedInclusiveJets_1bin->GetBinContent(i,j); - EntriesNumBackground[i][2]=EntriesNumBackground[i][2]+TwoD_MatchedInclusiveJets_2bin->GetBinContent(i,j); - EntriesNumBackground[i][3]=EntriesNumBackground[i][3]+TwoD_MatchedInclusiveJets_3bin->GetBinContent(i,j); - EntriesNumBackground[i][4]=EntriesNumBackground[i][4]+TwoD_MatchedInclusiveJets_4bin->GetBinContent(i,j); - EntriesNumBackground[i][5]=EntriesNumBackground[i][5]+TwoD_MatchedInclusiveJets_5bin->GetBinContent(i,j); - EntriesNumBackground[i][6]=EntriesNumBackground[i][6]+TwoD_MatchedInclusiveJets_6bin->GetBinContent(i,j); - EntriesNumBackground[i][7]=EntriesNumBackground[i][7]+TwoD_MatchedInclusiveJets_7bin->GetBinContent(i,j); - } - - for(int j=0;j<8;j++){ - if(EntriesDenBackground[i][j]!=0){ - Entries[j]=1-EntriesNumBackground[i][j]/EntriesDenBackground[i][j]; - } - } - - BackgroundPtJets->SetBinContent(i,Entries[0]); - BackgroundPtJets_1bin->SetBinContent(i,Entries[1]); - BackgroundPtJets_2bin->SetBinContent(i,Entries[2]); - BackgroundPtJets_3bin->SetBinContent(i,Entries[3]); - BackgroundPtJets_4bin->SetBinContent(i,Entries[4]); - BackgroundPtJets_5bin->SetBinContent(i,Entries[5]); - BackgroundPtJets_6bin->SetBinContent(i,Entries[6]); - BackgroundPtJets_7bin->SetBinContent(i,Entries[7]); - - } - - int Ptbinwidth[81] = {1,1,4,1,2,2,2,3,3,3,3,4,4,5,6,6,7,8,10,10,13,17,19,20,21,22,24,25,27,28,30,32,33,35,38,39,41,44,46,48,51,53,56,59,62,65,69,71,76,79,83,87,91,96,100,106,110,116,122,128,134,140,147,154,162,170,177,187,195,205,215,225,236,248,259,272,285,299,313,328,283}; - - if(!mIsMCarlo){ - - double Entries=0; - for(int j=1;jGetXaxis()->GetNbins()+1;j++){ - Entries=pt_DETInclJet_1bin->GetBinContent(j)/(71.52*Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_1bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_2bin->GetBinContent(j)/(71.52*Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_2bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_3bin->GetBinContent(j)/(71.52*Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_3bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_4bin->GetBinContent(j)/(71.52*Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_4bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_5bin->GetBinContent(j)/(71.52*Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_5bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_6bin->GetBinContent(j)/(71.52*Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_6bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_7bin->GetBinContent(j)/(71.52*Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_7bin->SetBinContent(j,Entries); - } - } - - if(mIsMCarlo){ - - double Entries=0; - for(int j=1;jGetXaxis()->GetNbins()+1;j++){ - Entries=pt_DETInclJet_1bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_1bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_2bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_2bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_3bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_3bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_4bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_4bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_5bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_5bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_6bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_6bin->SetBinContent(j,Entries); - Entries=pt_DETInclJet_7bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_DETInclJetCrossSectNorm_7bin->SetBinContent(j,Entries); - - Entries=pt_GENInclJet_1bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_GENInclJetCrossSectNorm_1bin->SetBinContent(j,Entries); - Entries=pt_GENInclJet_2bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_GENInclJetCrossSectNorm_2bin->SetBinContent(j,Entries); - Entries=pt_GENInclJet_3bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_GENInclJetCrossSectNorm_3bin->SetBinContent(j,Entries); - Entries=pt_GENInclJet_4bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_GENInclJetCrossSectNorm_4bin->SetBinContent(j,Entries); - Entries=pt_GENInclJet_5bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_GENInclJetCrossSectNorm_5bin->SetBinContent(j,Entries); - Entries=pt_GENInclJet_6bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_GENInclJetCrossSectNorm_6bin->SetBinContent(j,Entries); - Entries=pt_GENInclJet_7bin->GetBinContent(j)/(Ptbinwidth[j]); - pt_GENInclJetCrossSectNorm_7bin->SetBinContent(j,Entries); - } - } - - TagAndProbeEff->Divide(TagAndProbeNum,TagAndProbeDen,1.,1.,"B"); - - hist_leading_pt_HLT_Jet60U_eff->Divide(hist_leading_pt_emulated_Jet60,hist_leading_pt_all_Jet60,1.,1.,"B"); - hist_leading_eta_HLT_Jet60U_eff->Divide(hist_leading_eta_emulated_Jet60,hist_leading_eta_all_Jet60,1.,1.,"B"); - - hist_leading_pt_HLT_Jet80U_eff->Divide(hist_leading_pt_emulated_Jet80,hist_leading_pt_all_Jet80,1.,1.,"B"); - hist_leading_eta_HLT_Jet80U_eff->Divide(hist_leading_eta_emulated_Jet80,hist_leading_eta_all_Jet80,1.,1.,"B"); - - hist_leading_pt_HLT_Jet140U_eff->Divide(hist_leading_pt_emulated_Jet140,hist_leading_pt_all_Jet140,1.,1.,"B"); - hist_leading_eta_HLT_Jet140U_eff->Divide(hist_leading_eta_emulated_Jet140,hist_leading_eta_all_Jet140,1.,1.,"B"); - - hist_leading_pt_HLT_Jet200U_eff->Divide(hist_leading_pt_emulated_Jet200,hist_leading_pt_all_Jet200,1.,1.,"B"); - hist_leading_eta_HLT_Jet200U_eff->Divide(hist_leading_eta_emulated_Jet200,hist_leading_eta_all_Jet200,1.,1.,"B"); - - hist_leading_pt_HLT_Jet260U_eff->Divide(hist_leading_pt_emulated_Jet260,hist_leading_pt_all_Jet260,1.,1.,"B"); - hist_leading_eta_HLT_Jet260U_eff->Divide(hist_leading_eta_emulated_Jet260,hist_leading_eta_all_Jet260,1.,1.,"B"); - - hist_leading_pt_HLT_Jet320U_eff->Divide(hist_leading_pt_emulated_Jet320,hist_leading_pt_all_Jet320,1.,1.,"B"); - hist_leading_eta_HLT_Jet320U_eff->Divide(hist_leading_eta_emulated_Jet320,hist_leading_eta_all_Jet320,1.,1.,"B"); - - hist_leading_pt_HLT_Jet400U_eff->Divide(hist_leading_pt_emulated_Jet400,hist_leading_pt_all_Jet400,1.,1.,"B"); - hist_leading_eta_HLT_Jet400U_eff->Divide(hist_leading_eta_emulated_Jet400,hist_leading_eta_all_Jet400,1.,1.,"B"); - - hist_leading_pt_HLT_Jet450U_eff->Divide(hist_leading_pt_emulated_Jet450,hist_leading_pt_all_Jet450,1.,1.,"B"); - hist_leading_eta_HLT_Jet450U_eff->Divide(hist_leading_eta_emulated_Jet450,hist_leading_eta_all_Jet450,1.,1.,"B"); - - hist_leading_pt_HLT_Jet500U_eff->Divide(hist_leading_pt_emulated_Jet500,hist_leading_pt_all_Jet500,1.,1.,"B"); - hist_leading_eta_HLT_Jet500U_eff->Divide(hist_leading_eta_emulated_Jet500,hist_leading_eta_all_Jet500,1.,1.,"B"); - - } // closing analyze() function - - - -Analysis_Template_MC::~Analysis_Template_MC() -{ -} - - -DEFINE_FWK_MODULE(Analysis_Template_MC); - diff --git a/AnalysisFW/plugins/Analysis_Template_MC.h b/AnalysisFW/plugins/Analysis_Template_MC.h deleted file mode 100644 index e681c6883ac..00000000000 --- a/AnalysisFW/plugins/Analysis_Template_MC.h +++ /dev/null @@ -1,426 +0,0 @@ -#ifndef My_azimuthal_MC_h -#define My_azimuthal_MC_h - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SMPJ/AnalysisFW/interface/QCDJet.h" -#include "SMPJ/AnalysisFW/interface/QCDEvent.h" -#include "SMPJ/AnalysisFW/interface/QCDEventHdr.h" -#include "SMPJ/AnalysisFW/interface/QCDCaloJet.h" -#include "SMPJ/AnalysisFW/interface/QCDPFJet.h" -#include "SMPJ/AnalysisFW/interface/QCDMET.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" -//#include "PhysicsTools/Utilities/interface/LumiReweighting.h" -#include "TTree.h" -#include "TH1F.h" -#include "TH2F.h" -#include "TFile.h" -#include "TProfile.h" -#include -#include -using namespace edm; -using namespace std; - -#include "SMPJ/AnalysisFW/plugins/JECs.h" -//#include "SMPJ/AnalysisFW/plugins/JECs_S15.h" - -//#include "../Unfolding/RooUnfold-1.1.1/src/RooUnfold.h" -//#include "../Unfolding/RooUnfold-1.1.1/src/RooUnfoldResponse.h" - - -class Analysis_Template_MC : public edm::EDAnalyzer - { - public: - explicit Analysis_Template_MC(edm::ParameterSet const& cfg); - virtual void beginJob(); - virtual void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup); - virtual void endJob(); - virtual ~Analysis_Template_MC(); - - private: - //---- configurable parameters -------- - std::string mjettype,mGlobalTag,mTreeName,mDirName; - std::vector mFileName; - double mMinPt, mYMax; - int mJetID; // looseID==1 tightID==2 - int mprintOk; // noPrint=0 Print=1 - int mMCSlice; // noPrint=0 Print=1 - bool mIsMCarlo; - bool mPUReweighting; - bool mLowPileUp; - std::vector mJECUncSrcNames; - string mJECUncSrc; - - edm::Service fs; - //std::vector *mTree; - //std::vector *mInf; - TFile *mPuf,*mInf; - TTree *mTree; - //std::vector *mDir; - TDirectoryFile *mDir; - - //---- TREE variable -------- - QCDEvent *Event; - - JECs *jecs; - - //--------- Histogram Declaration --------------------// - // Vertices - TH1F *num_of_Vtx; - TH1F *num_of_VtxGood; - - TH1F *mc_pthat; - TH1F *mc_pthat_weighted; - - ///Measurement Gen jets - TH1F *pt0_GENJet; - TH1F *pt1_GENJet; - TH1F *y0_GENJet; - TH1F *y1_GENJet; - TH1F *phi0_GENJet; - TH1F *phi1_GENJet; - - TH1F *Multiplicity_GENJet; - - ///Measurement Det jets - TH1F *pt0_DETJet; - TH1F *pt1_DETJet; - TH1F *pt0_DETJetUncor; - TH1F *pt1_DETJetUncor; - TH1F *y0_DETJet; - TH1F *y1_DETJet; - TH1F *phi0_DETJet; - TH1F *phi1_DETJet; - - TH1F *Multiplicity_DETJet; - - TH1F *pt0_DETInclJet; - TH1F *pt0_DETInclJetUncor; - TH1F *y0_DETInclJet; - TH1F *phi0_DETInclJet; - - // Purity and stability - TH1F *PF_MatchedInclusiveJets; - TH1F *Gen_MatchedInclusiveJets; - TH2F *TwoD_MatchedInclusiveJets; - TH1F *PF_FakeInclusiveJets; - - TH1F *Gen_MissInclusiveJets; - TH1F *DeltaR_Jets; - - TH2F *PileUpVSVertex; - - TH1F *AcceptancePtJets; - TH1F *PurityPtJets; - TH1F *BackgroundPtJets; - TH1F *StabilityPtJets; - - TH1F *AcceptancePtJets_1bin; - TH1F *PurityPtJets_1bin; - TH1F *AcceptancePtJets_2bin; - TH1F *PurityPtJets_2bin; - TH1F *AcceptancePtJets_3bin; - TH1F *PurityPtJets_3bin; - TH1F *AcceptancePtJets_4bin; - TH1F *PurityPtJets_4bin; - TH1F *AcceptancePtJets_5bin; - TH1F *PurityPtJets_5bin; - TH1F *AcceptancePtJets_6bin; - TH1F *PurityPtJets_6bin; - TH1F *AcceptancePtJets_7bin; - TH1F *PurityPtJets_7bin; - - TH1F *BackgroundPtJets_1bin; - TH1F *StabilityPtJets_1bin; - TH1F *BackgroundPtJets_2bin; - TH1F *StabilityPtJets_2bin; - TH1F *BackgroundPtJets_3bin; - TH1F *StabilityPtJets_3bin; - TH1F *BackgroundPtJets_4bin; - TH1F *StabilityPtJets_4bin; - TH1F *BackgroundPtJets_5bin; - TH1F *StabilityPtJets_5bin; - TH1F *BackgroundPtJets_6bin; - TH1F *StabilityPtJets_6bin; - TH1F *BackgroundPtJets_7bin; - TH1F *StabilityPtJets_7bin; - - TH1F* pt_DETInclJet_1bin; - TH1F* pt_DETInclJet_2bin; - TH1F* pt_DETInclJet_3bin; - TH1F* pt_DETInclJet_4bin; - TH1F* pt_DETInclJet_5bin; - TH1F* pt_DETInclJet_6bin; - TH1F* pt_DETInclJet_7bin; - - TH1F* pt_DETInclJetCrossSectNorm_1bin; - TH1F* pt_DETInclJetCrossSectNorm_2bin; - TH1F* pt_DETInclJetCrossSectNorm_3bin; - TH1F* pt_DETInclJetCrossSectNorm_4bin; - TH1F* pt_DETInclJetCrossSectNorm_5bin; - TH1F* pt_DETInclJetCrossSectNorm_6bin; - TH1F* pt_DETInclJetCrossSectNorm_7bin; - - TH1F* pt_GENInclJetCrossSectNorm_1bin; - TH1F* pt_GENInclJetCrossSectNorm_2bin; - TH1F* pt_GENInclJetCrossSectNorm_3bin; - TH1F* pt_GENInclJetCrossSectNorm_4bin; - TH1F* pt_GENInclJetCrossSectNorm_5bin; - TH1F* pt_GENInclJetCrossSectNorm_6bin; - TH1F* pt_GENInclJetCrossSectNorm_7bin; - - TH1F* pt_DETInclJet60_1bin; - TH1F* pt_DETInclJet60_2bin; - TH1F* pt_DETInclJet60_3bin; - TH1F* pt_DETInclJet60_4bin; - TH1F* pt_DETInclJet60_5bin; - TH1F* pt_DETInclJet60_6bin; - TH1F* pt_DETInclJet60_7bin; - - TH1F* pt_DETInclJet80_1bin; - TH1F* pt_DETInclJet80_2bin; - TH1F* pt_DETInclJet80_3bin; - TH1F* pt_DETInclJet80_4bin; - TH1F* pt_DETInclJet80_5bin; - TH1F* pt_DETInclJet80_6bin; - TH1F* pt_DETInclJet80_7bin; - - TH1F* pt_DETInclJet140_1bin; - TH1F* pt_DETInclJet140_2bin; - TH1F* pt_DETInclJet140_3bin; - TH1F* pt_DETInclJet140_4bin; - TH1F* pt_DETInclJet140_5bin; - TH1F* pt_DETInclJet140_6bin; - TH1F* pt_DETInclJet140_7bin; - - TH1F* pt_DETInclJet200_1bin; - TH1F* pt_DETInclJet200_2bin; - TH1F* pt_DETInclJet200_3bin; - TH1F* pt_DETInclJet200_4bin; - TH1F* pt_DETInclJet200_5bin; - TH1F* pt_DETInclJet200_6bin; - TH1F* pt_DETInclJet200_7bin; - - TH1F* pt_DETInclJet260_1bin; - TH1F* pt_DETInclJet260_2bin; - TH1F* pt_DETInclJet260_3bin; - TH1F* pt_DETInclJet260_4bin; - TH1F* pt_DETInclJet260_5bin; - TH1F* pt_DETInclJet260_6bin; - TH1F* pt_DETInclJet260_7bin; - - TH1F* pt_DETInclJet320_1bin; - TH1F* pt_DETInclJet320_2bin; - TH1F* pt_DETInclJet320_3bin; - TH1F* pt_DETInclJet320_4bin; - TH1F* pt_DETInclJet320_5bin; - TH1F* pt_DETInclJet320_6bin; - TH1F* pt_DETInclJet320_7bin; - - TH1F* pt_DETInclJet400_1bin; - TH1F* pt_DETInclJet400_2bin; - TH1F* pt_DETInclJet400_3bin; - TH1F* pt_DETInclJet400_4bin; - TH1F* pt_DETInclJet400_5bin; - TH1F* pt_DETInclJet400_6bin; - TH1F* pt_DETInclJet400_7bin; - - TH1F* pt_DETInclJet450_1bin; - TH1F* pt_DETInclJet450_2bin; - TH1F* pt_DETInclJet450_3bin; - TH1F* pt_DETInclJet450_4bin; - TH1F* pt_DETInclJet450_5bin; - TH1F* pt_DETInclJet450_6bin; - TH1F* pt_DETInclJet450_7bin; - - TH1F* pt_GENInclJet_1bin; - TH1F* pt_GENInclJet_2bin; - TH1F* pt_GENInclJet_3bin; - TH1F* pt_GENInclJet_4bin; - TH1F* pt_GENInclJet_5bin; - TH1F* pt_GENInclJet_6bin; - TH1F* pt_GENInclJet_7bin; - - TH1F* PF_MatchedInclusiveJets_1bin; - TH1F* PF_MatchedInclusiveJets_2bin; - TH1F* PF_MatchedInclusiveJets_3bin; - TH1F* PF_MatchedInclusiveJets_4bin; - TH1F* PF_MatchedInclusiveJets_5bin; - TH1F* PF_MatchedInclusiveJets_6bin; - TH1F* PF_MatchedInclusiveJets_7bin; - - TH1F* Gen_MatchedInclusiveJets_1bin; - TH1F* Gen_MatchedInclusiveJets_2bin; - TH1F* Gen_MatchedInclusiveJets_3bin; - TH1F* Gen_MatchedInclusiveJets_4bin; - TH1F* Gen_MatchedInclusiveJets_5bin; - TH1F* Gen_MatchedInclusiveJets_6bin; - TH1F* Gen_MatchedInclusiveJets_7bin; - - TH1F* PF_FakeInclusiveJets_1bin; - TH1F* PF_FakeInclusiveJets_2bin; - TH1F* PF_FakeInclusiveJets_3bin; - TH1F* PF_FakeInclusiveJets_4bin; - TH1F* PF_FakeInclusiveJets_5bin; - TH1F* PF_FakeInclusiveJets_6bin; - TH1F* PF_FakeInclusiveJets_7bin; - - TH1F* Gen_MissInclusiveJets_1bin; - TH1F* Gen_MissInclusiveJets_2bin; - TH1F* Gen_MissInclusiveJets_3bin; - TH1F* Gen_MissInclusiveJets_4bin; - TH1F* Gen_MissInclusiveJets_5bin; - TH1F* Gen_MissInclusiveJets_6bin; - TH1F* Gen_MissInclusiveJets_7bin; - - TH2F *TwoD_MatchedInclusiveJets_1bin; - TH2F *TwoD_MatchedInclusiveJets_2bin; - TH2F *TwoD_MatchedInclusiveJets_3bin; - TH2F *TwoD_MatchedInclusiveJets_4bin; - TH2F *TwoD_MatchedInclusiveJets_5bin; - TH2F *TwoD_MatchedInclusiveJets_6bin; - TH2F *TwoD_MatchedInclusiveJets_7bin; - - TH1F* Resolution1D; - TH1F* ResolutionForward1D; - - TProfile *ResolutionTagAndProbe; - - TProfile *ResolutionInclusiveJets; - TProfile *ResolutionInclusiveJets_1bin; - TProfile *ResolutionInclusiveJets_2bin; - TProfile *ResolutionInclusiveJets_3bin; - TProfile *ResolutionInclusiveJets_4bin; - TProfile *ResolutionInclusiveJets_5bin; - TProfile *ResolutionInclusiveJets_6bin; - TProfile *ResolutionInclusiveJets_7bin; - - TH1F *hist_leading_pt_emulated_Jet60; - TH1F *hist_leading_pt_all_Jet60; - TH1F *hist_leading_eta_emulated_Jet60; - TH1F *hist_leading_eta_all_Jet60; - TH1F *hist_leading_pt_HLT_Jet60U_eff; - TH1F *hist_leading_eta_HLT_Jet60U_eff; - - TH1F *hist_leading_pt_emulated_Jet80; - TH1F *hist_leading_pt_all_Jet80; - TH1F *hist_leading_eta_emulated_Jet80; - TH1F *hist_leading_eta_all_Jet80; - TH1F *hist_leading_pt_HLT_Jet80U_eff; - TH1F *hist_leading_eta_HLT_Jet80U_eff; - - TH1F *hist_leading_pt_emulated_Jet140; - TH1F *hist_leading_pt_all_Jet140; - TH1F *hist_leading_eta_emulated_Jet140; - TH1F *hist_leading_eta_all_Jet140; - TH1F *hist_leading_pt_HLT_Jet140U_eff; - TH1F *hist_leading_eta_HLT_Jet140U_eff; - - TH1F *hist_leading_pt_emulated_Jet200; - TH1F *hist_leading_pt_all_Jet200; - TH1F *hist_leading_eta_emulated_Jet200; - TH1F *hist_leading_eta_all_Jet200; - TH1F *hist_leading_pt_HLT_Jet200U_eff; - TH1F *hist_leading_eta_HLT_Jet200U_eff; - - TH1F *hist_leading_pt_emulated_Jet260; - TH1F *hist_leading_pt_all_Jet260; - TH1F *hist_leading_eta_emulated_Jet260; - TH1F *hist_leading_eta_all_Jet260; - TH1F *hist_leading_pt_HLT_Jet260U_eff; - TH1F *hist_leading_eta_HLT_Jet260U_eff; - - TH1F *hist_leading_pt_emulated_Jet320; - TH1F *hist_leading_pt_all_Jet320; - TH1F *hist_leading_eta_emulated_Jet320; - TH1F *hist_leading_eta_all_Jet320; - TH1F *hist_leading_pt_HLT_Jet320U_eff; - TH1F *hist_leading_eta_HLT_Jet320U_eff; - - TH1F *hist_leading_pt_emulated_Jet400; - TH1F *hist_leading_pt_all_Jet400; - TH1F *hist_leading_eta_emulated_Jet400; - TH1F *hist_leading_eta_all_Jet400; - TH1F *hist_leading_pt_HLT_Jet400U_eff; - TH1F *hist_leading_eta_HLT_Jet400U_eff; - - TH1F *hist_leading_pt_emulated_Jet450; - TH1F *hist_leading_pt_all_Jet450; - TH1F *hist_leading_eta_emulated_Jet450; - TH1F *hist_leading_eta_all_Jet450; - TH1F *hist_leading_pt_HLT_Jet450U_eff; - TH1F *hist_leading_eta_HLT_Jet450U_eff; - - TH1F *hist_leading_pt_emulated_Jet500; - TH1F *hist_leading_pt_all_Jet500; - TH1F *hist_leading_eta_emulated_Jet500; - TH1F *hist_leading_eta_all_Jet500; - TH1F *hist_leading_pt_HLT_Jet500U_eff; - TH1F *hist_leading_eta_HLT_Jet500U_eff; - - TH1F* TagAndProbeEff; - TH1F* TagAndProbeNum; - TH1F* TagAndProbeDen; - - TH1F* pt_DETInclJetUP_1bin; - TH1F* pt_DETInclJetUP_2bin; - TH1F* pt_DETInclJetUP_3bin; - TH1F* pt_DETInclJetUP_4bin; - TH1F* pt_DETInclJetUP_5bin; - TH1F* pt_DETInclJetUP_6bin; - TH1F* pt_DETInclJetUP_7bin; - - TH1F* pt_DETInclJetDOWN_1bin; - TH1F* pt_DETInclJetDOWN_2bin; - TH1F* pt_DETInclJetDOWN_3bin; - TH1F* pt_DETInclJetDOWN_4bin; - TH1F* pt_DETInclJetDOWN_5bin; - TH1F* pt_DETInclJetDOWN_6bin; - TH1F* pt_DETInclJetDOWN_7bin; - - TH1F* Chargedhf0_DETJet; - TH1F* Chargedef0_DETJet; - TH1F* Neutralhf0_DETJet; - TH1F* Photonef0_DETJet; - TH1F* Hadronef0_DETJet; - TH1F* Muonef0_DETJet; - TH1F* Electromagneticef0_DETJet; - - TH1F* ChargedhMultiplicity0_DETJet; - TH1F* ChargedeMultiplicity0_DETJet; - TH1F* NeutralhMultiplicity0_DETJet; - TH1F* PhotoneMultiplicity0_DETJet; - TH1F* HadroneMultiplicity0_DETJet; - TH1F* MuoneMultiplicity0_DETJet; - TH1F* ElectromagneticeMultiplicity0_DETJet; - - TH1F* Emf0_DETJet; - TH1F* Hpd0_DETJet; - TH1F* Chf0_DETJet; - TH1F* Nhf0_DETJet; - TH1F* Pef0_DETJet; - TH1F* Eef0_DETJet; - TH1F* Mef0_DETJet; - - TH1F* TruePileUpMC; - TH1F* TruePileUpMCInteger; - TH1F* TruePileUpDataInteger; - - TH1F* MET_DET; - TH1F* METPhi_DET; - TH1F* FractionMET_DET; - - /*RooUnfoldResponse resp_jetpt1etabin; - RooUnfoldResponse resp_jetpt2etabin; - RooUnfoldResponse resp_jetpt3etabin; - RooUnfoldResponse resp_jetpt4etabin; - RooUnfoldResponse resp_jetpt5etabin; - RooUnfoldResponse resp_jetpt6etabin; - RooUnfoldResponse resp_jetpt7etabin;*/ - - }; - -#endif - diff --git a/AnalysisFW/plugins/JECs.h b/AnalysisFW/plugins/JECs.h index 6a00b3d2531..074e4daa647 100644 --- a/AnalysisFW/plugins/JECs.h +++ b/AnalysisFW/plugins/JECs.h @@ -40,8 +40,7 @@ class JECs { std::vector mPFUncSrc; std::vector mCaloUncSrc; std::vector mJECUncSrcNames; - - /* + virtual void JEC_corrections(QCDEvent *Event, unsigned n_PFJets, bool IsMCarlo, vector jecUncSrcNames){ @@ -158,9 +157,9 @@ class JECs { // ----- pT sorting the PF jets ------- // sort(mPFJets.begin(),mPFJets.end(),sort_pfjets); - //Event->setPFJets(mPFJets); + Event->setPFJets(mPFJets); } - */ + virtual void JEC_CHScorrections(QCDEvent *Event, unsigned n_PFJetsCHS, bool IsMCarlo, vector jecUncSrcNames){ // ---- declaration of the vector of jets ---- // @@ -284,7 +283,6 @@ class JECs { Event->setPFJetsCHS(mPFJetsCHS); } - /* virtual void JEC_Calocorrections(QCDEvent *Event, unsigned n_CaloJets, bool IsMCarlo){ // ---- declaration of the vector of jets ---- // @@ -402,7 +400,6 @@ class JECs { sort(mCaloJets.begin(),mCaloJets.end(),sort_calojets); Event->setCaloJets(mCaloJets); } - */ }; JECs::JECs(bool IsMCarlo, string GlobalTag, string JETTYPE, string jecUncSrc, vector mJECUncSrcNames){ diff --git a/AnalysisFW/plugins/ProcessedGenJets.cc b/AnalysisFW/plugins/ProcessedGenJets.cc new file mode 100644 index 00000000000..61a2b392301 --- /dev/null +++ b/AnalysisFW/plugins/ProcessedGenJets.cc @@ -0,0 +1,246 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Utilities/interface/RandomNumberGenerator.h" + +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/PatCandidates/interface/Jet.h" +#include "DataFormats/PatCandidates/interface/JetCorrFactors.h" +#include "DataFormats/PatCandidates/interface/MET.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" +#include "DataFormats/PatCandidates/interface/PackedGenParticle.h" +#include "DataFormats/JetReco/interface/Jet.h" +#include "DataFormats/JetReco/interface/PFJet.h" +#include "DataFormats/JetReco/interface/PFJetCollection.h" +#include "DataFormats/JetReco/interface/GenJet.h" +#include "DataFormats/JetReco/interface/GenJetCollection.h" +#include "DataFormats/JetReco/interface/JetExtendedAssociation.h" +#include "DataFormats/JetReco/interface/JetID.h" +#include "DataFormats/METReco/interface/HcalNoiseSummary.h" +#include "DataFormats/BeamSpot/interface/BeamSpot.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" + +#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" +#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h" +#include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" +#include "SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h" +#include "SimDataFormats/JetMatching/interface/JetFlavourInfo.h" +#include "SimDataFormats/JetMatching/interface/JetFlavourInfoMatching.h" +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" + +#include "JetMETCorrections/Objects/interface/JetCorrector.h" +#include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h" +#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h" +#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h" + +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include "PhysicsTools/PatUtils/interface/bJetSelector.h" +#include "PhysicsTools/PatExamples/interface/BTagPerformance.h" +#include "PhysicsTools/PatExamples/interface/PatBTagCommonHistos.h" + +#include "CLHEP/Random/RandomEngine.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "TTree.h" +#include +#include +#include +#include +#include +#include + +using std::cout; +using std::endl; +using std::vector; +using std::set; +using std::map; + +class GenJettify : public edm::EDAnalyzer +{ +public: + using LorentzVector = reco::Particle::LorentzVector; + + GenJettify(edm::ParameterSet const& cfg) : + mGenJetsName (consumes(edm::InputTag("slimmedGenJets"))), + mEventInfo(consumes(edm::InputTag("generator"))) + { + mTree = fs->make("GenJets","GenJets"); + mTree->Branch("weight", &mWeight, "weight/F"); + mTree->Branch("Pt", &mPt, "Pt/F"); + mTree->Branch("Eta", &mEta, "Eta/F"); + mTree->Branch("Phi", &mPhi, "Phi/F"); + mTree->Branch("E", &mE, "E/F"); + mTree->Branch("JIdx", &mJid, "JIdx/I"); + mTree->Branch("EFracs", mEFracs, "EFracs[16]/F"); + } + virtual void beginRun(edm::Run const &, edm::EventSetup const& iSetup); + virtual void analyze(edm::Event const& evt, edm::EventSetup const& iSetup); + void beginJob() {} + void endJob() { + double totE = 0.; + for (auto &jaa : mPhot) totE += jaa.second; + cout << "Ene: " << totE << endl; + for (auto &jaa : mPhot) { + const double pers = 100.*jaa.second/totE; + if (pers > 0.01) cout << " > " << jaa.first << " " << pers << endl; + } + cout << "Happily finished processing! :)" << endl; + } + void beginLuminosityBlock(edm::LuminosityBlock const& iLumi, edm::EventSetup const& set) {} + ~GenJettify() {} +private: + // Configurable parameters + + // GEN // + edm::EDGetTokenT mGenJetsName; + edm::EDGetTokenT mEventInfo; + + edm::Service fs; + TTree *mTree; + map mPhot; + + float mWeight; + float mPt; + float mEta; + float mPhi; + float mE; + float mEfEr; + float mEfE; + float mEfHr; + float mEfH; + float mEFracs[16]; + int mJid; + double mFracs[16]; +}; +////////////////////////////////////////////////////////////////////////////////////////// +void GenJettify::beginRun(edm::Run const & iRun, edm::EventSetup const& iSetup) {} +////////////////////////////////////////////////////////////////////////////////////////// +void GenJettify::analyze(edm::Event const& event, edm::EventSetup const& iSetup) { + //---------------- GenJets ------------------------------------------ + // Setting up handy handles + edm::Handle genJets; + event.getByToken(mGenJetsName,genJets); + // Genjet loop + edm::Handle hEventInfo; + event.getByToken(mEventInfo, hEventInfo); + + mWeight = hEventInfo->weight(); + + mJid = 0; + for (auto igen = genJets->begin(); igen!=genJets->end(); ++igen) { + double cEta = igen->eta(); + if (fabs(cEta) > 5.2) continue; + const double cPt = igen->pt(); + if (cPt < 15.) continue; + + mPt = cPt; + mEta = cEta; + mPhi = igen->phi(); + mE = igen->energy(); + for (size_t i = 0; i < 16; ++i) mFracs[i] = 0.; + + for (unsigned idx = 0; idx < igen->numberOfDaughters(); ++idx) { + auto *dgt = dynamic_cast(igen->daughter(idx)); + int pid = dgt->pdgId(); + double ene = dgt->energy(); + if (pid == 211) { // pi+ + mFracs[0] += ene; + } else if (pid == -211) { // pi- + mFracs[1] += ene; + } else if (pid == 22) { // gamma + auto moth = dgt->motherRef(); + if (moth.isNonnull() && moth.isAvailable()) { + int mid = moth->pdgId(); + int amid = abs(mid); + const bool prot = mid == 2212 && moth->energy() > 6499.; + const bool noid = mid == 21 || amid < 10 || prot; + if (cPt > 2000.) { + ////if (cPt < 2000. && cPt > 1200.) { + ////if (cPt < 1200. && cPt > 600.) { + ////if (cPt < 600. && cPt > 200.) { + ////if (cPt < 200. && cPt > 50.) { + ////if (cPt < 50. && cPt > 30.) { + ////if (cPt < 30.) { + int recog = prot ? 0 : (moth->charge() == 0 ? (amid < 10 ? 2 : amid) : 1); + if (mPhot.find(recog) == mPhot.end()) { + mPhot[recog] = ene; + } else { + mPhot[recog] += ene; + } + } + if (noid) { + mFracs[2] += 0.87*ene; + mFracs[11] += 0.13*ene; + //mFracs[2] += 0.9594*ene; + //mFracs[11] += 0.0406*ene; + } else { + //if (amid == 111 || amid == 221 || amid == 223) { + if (amid == 111) { + mFracs[2] += ene; + } else { + //if (amid == 221 || amid == 331) { + // mFracs[2] += ene; + //} else { + mFracs[11] += ene; + //} + } + } + } else { + cout << "Not found!" << endl; + mFracs[11] += ene; + } + } else if (pid == 321) { // K+ + mFracs[3] += ene; + } else if (pid == -321) { // K- + mFracs[4] += ene; + } else if (abs(pid) == 310) { // KS + mFracs[5] += ene; + } else if (abs(pid) == 130) { // KL + mFracs[6] += ene; + } else if (pid == 2212) { // p+ + mFracs[7] += ene; + } else if (pid == -2212) { // p- + mFracs[8] += ene; + } else if (pid == 2112) { // n + mFracs[9] += ene; + } else if (pid == -2112) { // nbar + mFracs[10] += ene; + } else if (abs(pid) == 3122 || abs(pid) == 3322) { // Lambda0/Xi0 + mFracs[12] += ene; + } else if (abs(pid) == 3222 || abs(pid) == 3112) { // Sigma+-/Xi-/Omega- + mFracs[13] += ene; + } else if (abs(pid) == 3312 || abs(pid) == 3334) { // e/mu + mFracs[14] += ene; + } else if (abs(pid) == 11 || abs(pid) == 13) { + mFracs[15] += ene; + } else { + cout << pid << " " << dgt->energy() << endl; + } + } + for (size_t i = 0; i < 16; ++i) mEFracs[i] = mFracs[i]; + + mTree->Fill(); + if (++mJid > 10) break; + } +} + +////////////////////////////////////////////////////////////////////////////////////////// +DEFINE_FWK_MODULE(GenJettify); diff --git a/AnalysisFW/plugins/ProcessedHadrons.cc b/AnalysisFW/plugins/ProcessedHadrons.cc new file mode 100644 index 00000000000..8387824561a --- /dev/null +++ b/AnalysisFW/plugins/ProcessedHadrons.cc @@ -0,0 +1,405 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Common/interface/TriggerNames.h" +#include "FWCore/Common/interface/TriggerResultsByName.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Utilities/interface/RandomNumberGenerator.h" + +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/HLTReco/interface/TriggerEvent.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/PatCandidates/interface/Jet.h" +#include "DataFormats/PatCandidates/interface/JetCorrFactors.h" +#include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h" +#include "DataFormats/PatCandidates/interface/PackedTriggerPrescales.h" +#include "DataFormats/PatCandidates/interface/MET.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" +#include "DataFormats/PatCandidates/interface/PackedGenParticle.h" +#include "DataFormats/JetReco/interface/Jet.h" +#include "DataFormats/JetReco/interface/PFJet.h" +#include "DataFormats/JetReco/interface/PFJetCollection.h" +#include "DataFormats/JetReco/interface/GenJet.h" +#include "DataFormats/JetReco/interface/GenJetCollection.h" +#include "DataFormats/JetReco/interface/JetExtendedAssociation.h" +#include "DataFormats/JetReco/interface/JetID.h" +#include "DataFormats/METReco/interface/HcalNoiseSummary.h" +#include "DataFormats/BeamSpot/interface/BeamSpot.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/L1Trigger/interface/BXVector.h" +#include "DataFormats/L1Trigger/interface/Jet.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" + +#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" +#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h" +#include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" +#include "SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h" +#include "SimDataFormats/JetMatching/interface/JetFlavourInfo.h" +#include "SimDataFormats/JetMatching/interface/JetFlavourInfoMatching.h" +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" + +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" + +#include "JetMETCorrections/Objects/interface/JetCorrector.h" +#include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h" +#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h" +#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h" + +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include "PhysicsTools/PatUtils/interface/bJetSelector.h" +#include "PhysicsTools/PatExamples/interface/BTagPerformance.h" +#include "PhysicsTools/PatExamples/interface/PatBTagCommonHistos.h" + +#include "CLHEP/Random/RandomEngine.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "TTree.h" +#include +#include +#include +#include +#include + +using std::cout; +using std::endl; +using std::vector; + +class ProcessedHadrons : public edm::EDAnalyzer +{ +public: + using LorentzVector = reco::Particle::LorentzVector; + + ProcessedHadrons(edm::ParameterSet const& cfg) : + mIsMCarlo( cfg.getUntrackedParameter("isMCarlo",false)), + mGenParticles(consumes(cfg.getUntrackedParameter("packedGenParticles",edm::InputTag("")))), + mCands(mayConsume( edm::InputTag("packedPFCandidates"))), + // Trigger + mFilterNames( cfg.getParameter >("filterName")), + mFilterBitsRECO( mayConsume(edm::InputTag("TriggerResults","","RECO"))), + mFilterBitsPAT( mayConsume(edm::InputTag("TriggerResults","","PAT"))), + mTriggerNames( cfg.getParameter >("triggerName")), + mTriggerBits( mayConsume(edm::InputTag("TriggerResults","","HLT"))) + { + mTree = fs->make("ProcessedTree","ProcessedTree"); + mTree->Branch("prescale", &mPrescale, "prescale/F"); + mTree->Branch("PtTrk", &mPtTrk, "PtTrk/F"); + mTree->Branch("Pt", &mPt, "Pt/F"); + mTree->Branch("Eta", &mEta, "Eta/F"); + mTree->Branch("Phi", &mPhi, "Phi/F"); + mTree->Branch("E", &mE, "E/F"); + mTree->Branch("Ef_ECALRaw", &mEfEr, "Ef_ECALRaw/F"); + mTree->Branch("Ef_ECAL", &mEfE, "Ef_ECAL/F"); + mTree->Branch("Ef_HCALRaw", &mEfHr, "Ef_HCALRaw/F"); + mTree->Branch("Ef_HCAL", &mEfH, "Ef_HCAL/F"); + } + virtual void beginRun(edm::Run const &, edm::EventSetup const& iSetup); + virtual void analyze(edm::Event const& evt, edm::EventSetup const& iSetup); + void beginJob() { // Generic boolean indicators + mSatisfactory = true; + mNewTrigs = false; + } + void endJob() { cout << "Happily finished processing! :)" << endl; } + void beginLuminosityBlock(edm::LuminosityBlock const& iLumi, edm::EventSetup const& set) {} + ~ProcessedHadrons() {} +private: + // Configurable parameters + bool mSatisfactory; + + // GEN // + bool mIsMCarlo; + bool mNewTrigs; + edm::EDGetTokenT mGenParticles; + edm::EDGetTokenT mCands; + + // TRIGGER & FILTER // + bool mTrigObjs; + bool mFilterPAT; + vector mFilterMissing; + const vector mFilterNames; + vector mFilterIndex; + edm::EDGetTokenT mFilterBitsRECO; + edm::EDGetTokenT mFilterBitsPAT; + const vector mTriggerNames; + edm::EDGetTokenT mTriggerBits; + map> mTriggerNamesMap; + map mTriggerNamesIndexMap; + vector mTriggerIndex; + map> mTriggerIndexMap; + // MISC // + HLTConfigProvider mHLTConfig; + //HLTPrescaleProvider mHLTPrescale; + + edm::Service fs; + TTree *mTree; + + float mPrescale; + float mPtTrk; + float mPt; + float mEta; + float mPhi; + float mE; + float mEfEr; + float mEfE; + float mEfHr; + float mEfH; + + // Private functions for various purposes + bool trigUpdate(const vector &tNames, vector &tIndex); + + bool is_bhadr(int pdgid) { + int aid = abs(pdgid); + if (aid/100 == 5 or aid/1000==5) { + return true; + } + return false; + } +}; +////////////////////////////////////////////////////////////////////////////////////////// +void ProcessedHadrons::beginRun(edm::Run const & iRun, edm::EventSetup const& iSetup) { + bool changed = true; + if (!mHLTConfig.init(iRun,iSetup,"HLT",changed)) { + cout << "ProcessedHadrons::analyze: config extraction failure with process name HLT!" << endl; + return; + } + if (!changed) return; + cout << "Running on global tag " << mHLTConfig.globalTag() << "!!!" << endl; + + // Additional steps to be performed first time in the analysis loop! + mNewTrigs = true; + + cout << "New trigger menu found!!!" << endl; + + // The triggers that are actively and passively monitored will be set up according to the wishes of the user. + // We check mHLTConfig, which triggers of these are actually present. + mSatisfactory = mSatisfactory and trigUpdate(mTriggerNames,mTriggerIndex); +} +////////////////////////////////////////////////////////////////////////////////////////// +bool ProcessedHadrons::trigUpdate(const vector &tNames, vector &tIndex) { + tIndex.clear(); + const auto &hltNames = mHLTConfig.triggerNames(); + const unsigned int nHLTs = mHLTConfig.size(); + assert(hltNames.size()==nHLTs); + + mTriggerNamesIndexMap.clear(); + mTriggerNamesMap.clear(); + mTriggerIndexMap.clear(); + for (const auto &tName : tNames) { + // Create a temporary string and strip the zero from the end, in order to use this with regex. + string tmpName = tName; + tmpName.pop_back(); + regex trgversions(Form("%s([0-9]*)",tmpName.c_str())); + if (tName.back()!='0' and tmpName.back()!='v') { + cout << "In the simpleTrigs mode the trigger names should end with 'v0'! Please correct!" << endl; + return false; + } + // Loop through all the hlt names with any version number matching the generic trigger type. + int counter = 0; + for (const auto &hName : hltNames) { + if (regex_match(hName,trgversions)) { + ++counter; + if (mTriggerNamesMap.count(tName)==0) { + mTriggerNamesMap[tName] = vector(); + mTriggerIndexMap[tName] = vector(); + } + + mTriggerNamesIndexMap[hName] = tIndex.size(); + mTriggerNamesMap[tName].emplace_back(hName); + mTriggerIndexMap[tName].emplace_back(mHLTConfig.triggerIndex(hName)); + cout << "Monitored trigger " << hName << " " << mTriggerIndexMap[tName].back() << " exists" << endl; + } + } + tIndex.push_back(counter==0 ? -1 : counter); + } + return true; +} +////////////////////////////////////////////////////////////////////////////////////////// +void ProcessedHadrons::analyze(edm::Event const& event, edm::EventSetup const& iSetup) { + // If the trigger information is not satisfactory, we should not enter the event analysis. + if (!mSatisfactory) return; + + + //-------------- Filter Info ---------------------------------------- + + // Update the filter positions only when the trigger menu has changed. + // These steps cannot be taken within "beginRun", as event.triggerNames() is not available there. + if (mNewTrigs) { + mNewTrigs = false; // In data, this is set to false later. + + cout << "Found MET filters:" << endl; + mFilterPAT = false; + for (unsigned ifloc = 0; ifloc<2; ++ifloc) { + edm::Handle fBits; + if (ifloc==0) { + event.getByToken(mFilterBitsRECO,fBits); + } else { + event.getByToken(mFilterBitsPAT,fBits); + mFilterPAT = true; + } + + const edm::TriggerNames &fNames = event.triggerNames(*fBits); + mFilterMissing.clear(); + mFilterIndex.clear(); + for (unsigned fltpos = 0; fltpos < mFilterNames.size(); ++fltpos) { // Loop through the requested filter names + auto &flt = mFilterNames[fltpos]; + int fltIdx = -1; + for (unsigned int iflt=0; ifltsize(); ++iflt) { // Try to find this + string filterName = fNames.triggerName(iflt); + if (filterName==flt) { + fltIdx = iflt; + break; + } + } + mFilterIndex.push_back(fltIdx); + if (fltIdx==-1) mFilterMissing.emplace_back(fltpos); + else cout << " " << flt << " :)" << endl; + } + if (mFilterMissing.size() < mFilterNames.size()) break; + } + cout << "Using MET filters from " << (mFilterPAT ? "PAT" : "RECO") << endl; + if (mFilterMissing.size()>0) { + for (auto &fltpos : mFilterMissing) { + auto &flt = mFilterNames[fltpos]; + cout << "MET filter " << flt << " missing :(" << endl; + } + } + } + + // Fetching data using tokens. + edm::Handle filterBits; + event.getByToken(mFilterPAT ? mFilterBitsPAT : mFilterBitsRECO,filterBits); + const edm::TriggerNames &filterNames = event.triggerNames(*filterBits); + + // Go through the filters and check that all of them are good + assert(mFilterIndex.size()==mFilterNames.size()); + for (auto iflt = 0u; ifltaccept(fltIdx); + flt2 = filterNames.triggerName(fltIdx); + } + + string flt = mFilterNames[iflt]; + if (flt!=flt2) { + cout << "Mismatch in filter names: " << flt << " " << flt2 << endl; + mSatisfactory = false; + return; + } + if (reject) return; + } + + //-------------- Trigger Info (exlusively Data) --------------------- + edm::Handle triggerBits; + event.getByToken(mTriggerBits,triggerBits); + // Trigger counts + unsigned fire = 0; + // Primary triggers + for (auto itrig = 0u; itrigaccept(tIdx2)) ++fire; + } + } + // It seems that the ZB trigger is active only 50% of the time, so we suppress trigger features for now + if (!mIsMCarlo and fire==0) return; + + // PF Candidates (for beta calculus) + edm::Handle cands; + event.getByToken(mCands, cands); + + // Rng + //cout << "Setting up the rng!" << endl; + edm::Service rng; + CLHEP::HepRandomEngine& engine = rng->getEngine(event.streamID()); + //cout << "Rng setup successful!" << endl; + //cout << "A random number: " << engine.flat() << endl; + + // Pick the PF candidates removed by CHS (fromPV==0) + for (auto cidx = 0u; cidxsize(); ++cidx) { + const auto &c = cands->at(cidx); + // Prescale system for particles between 0.5 and 8 GeV + mPrescale = 1.; + if (c.pt()<8) { + double rand = engine.flat(); + if (c.pt()<6) { + if (c.pt()<5) { + if (c.pt()<4) { + if (c.pt()<3.5) { + if (c.pt()<3) { + if (c.pt()<2) { + if (c.pt()<1) { + if (c.pt()<0.5) continue; + else mPrescale = 0.0001; + } else mPrescale = 0.001; + } else mPrescale = 0.01; + } else mPrescale = 0.03125; + } else mPrescale = 0.0625; + } else mPrescale = 0.125; + } else mPrescale = 0.25; + } else mPrescale = 0.5; + if (rand>mPrescale) continue; + } + if (c.isPhoton() or c.isElectron() or c.isMuon()) continue; + //if (fabs(c.pdgId())!=211) continue; + if (!c.isIsolatedChargedHadron()) continue; + double calob = c.rawCaloFraction(); + double caloa = c.caloFraction(); + double hb = c.rawHcalFraction()*calob; + double ha = c.hcalFraction()*caloa; + double eb = calob-hb; + double ea = caloa-ha; + //hb *= c.energy(); + //ha *= c.energy(); + //ea *= c.energy(); + //eb *= c.energy(); + //cout << eb << "/" << ea << " " << hb << "/" << ha << endl; + //cout << "Good: " << c.pdgId() << " " << c.pt() << " " << c.ptTrk() << " " << c.ptTrk()/c.pt() << endl; + mPtTrk = c.ptTrk(); + mPt = c.pt(); + mEta = c.eta(); + mPhi = c.phi(); + mE = c.energy(); + mEfEr = eb; + mEfE = ea; + mEfHr = hb; + mEfH = ha; + + mTree->Fill(); + } + //edm::Handle gcands; + //event.getByToken(mGenParticles, gcands); + + //for (auto gidx = 0u; gidxsize(); ++gidx) { + // const auto &gc = gcands->at(gidx); + // cout << gc.pt() << endl; + //} +} + +////////////////////////////////////////////////////////////////////////////////////////// +DEFINE_FWK_MODULE(ProcessedHadrons); diff --git a/AnalysisFW/plugins/ProcessedMCJets.cc b/AnalysisFW/plugins/ProcessedMCJets.cc new file mode 100644 index 00000000000..c82bf6a950f --- /dev/null +++ b/AnalysisFW/plugins/ProcessedMCJets.cc @@ -0,0 +1,307 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Utilities/interface/RandomNumberGenerator.h" + +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/PatCandidates/interface/Jet.h" +#include "DataFormats/PatCandidates/interface/JetCorrFactors.h" +#include "DataFormats/PatCandidates/interface/MET.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" +#include "DataFormats/PatCandidates/interface/PackedGenParticle.h" +#include "DataFormats/JetReco/interface/Jet.h" +#include "DataFormats/JetReco/interface/PFJet.h" +#include "DataFormats/JetReco/interface/PFJetCollection.h" +#include "DataFormats/JetReco/interface/GenJet.h" +#include "DataFormats/JetReco/interface/GenJetCollection.h" +#include "DataFormats/JetReco/interface/JetExtendedAssociation.h" +#include "DataFormats/JetReco/interface/JetID.h" +#include "DataFormats/BeamSpot/interface/BeamSpot.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" + +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" +#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h" +#include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" +#include "SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h" +#include "SimDataFormats/JetMatching/interface/JetFlavourInfo.h" +#include "SimDataFormats/JetMatching/interface/JetFlavourInfoMatching.h" + +#include "JetMETCorrections/Objects/interface/JetCorrector.h" +#include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h" +#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h" +#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h" + +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "TTree.h" +#include +#include +#include +#include +#include +#include + +using std::cout; +using std::endl; +using std::vector; +using std::set; +using std::map; + +class MCJettify : public edm::EDAnalyzer +{ +public: + using LorentzVector = reco::Particle::LorentzVector; + + MCJettify(edm::ParameterSet const& cfg) : + mGenJetsName (consumes(edm::InputTag("ak4GenJetsNoNu"))), + mEventInfo(consumes(edm::InputTag("generator"))), + mGenParts(consumes(edm::InputTag("genParticles"))) + { + mTree = fs->make("GenJets","GenJets"); + mTree->Branch("weight", &mWeight, "weight/F"); + mTree->Branch("Pt", &mPt, "Pt/F"); + mTree->Branch("Eta", &mEta, "Eta/F"); + mTree->Branch("Phi", &mPhi, "Phi/F"); + mTree->Branch("E", &mE, "E/F"); + mTree->Branch("JIdx", &mJid, "JIdx/I"); + mTree->Branch("Status", &mStat, "Status/I"); + mTree->Branch("EFracs", mEFracs, "EFracs[19]/F"); + } + virtual void beginRun(edm::Run const &, edm::EventSetup const& iSetup); + virtual void analyze(edm::Event const& evt, edm::EventSetup const& iSetup); + void beginJob() { + //mCases[0] = 0.; + //mCases[1] = 0.; + //mCases[2] = 0.; + //mCases[3] = 0.; + //mCases[4] = 0.; + } + void endJob() { + //double totE = 0.; + //for (auto &jaa : mPhot) totE += jaa.second; + //cout << "Ene: " << totE << endl; + //for (auto &jaa : mPhot) { + // const double pers = 100.*jaa.second/totE; + // if (pers > 0.01) cout << " > " << jaa.first << " " << pers << endl; + //} + //double tots = mCases[0] + mCases[1] + mCases[2] + mCases[3]; + //if (tots > 0.) cout << 100.*mCases[0]/tots << " " << 100.*mCases[1]/tots << " " << 100.*mCases[2]/tots << " " << 100.*mCases[3]/tots << endl; + cout << "Happily finished processing! :)" << endl; + } + void beginLuminosityBlock(edm::LuminosityBlock const& iLumi, edm::EventSetup const& set) {} + ~MCJettify() {} +private: + // Configurable parameters + + // GEN // + edm::EDGetTokenT mGenJetsName; + edm::EDGetTokenT mEventInfo; + edm::EDGetTokenTmGenParts; + + edm::Service fs; + TTree *mTree; + //map mPhot; + + float mWeight; + float mPt; + float mEta; + float mPhi; + float mE; + float mEfEr; + float mEfE; + float mEfHr; + float mEfH; + float mEFracs[19]; + int mJid; + int mStat; + double mFracs[19]; + //double mCases[5]; +}; +////////////////////////////////////////////////////////////////////////////////////////// +void MCJettify::beginRun(edm::Run const & iRun, edm::EventSetup const& iSetup) {} +////////////////////////////////////////////////////////////////////////////////////////// +void MCJettify::analyze(edm::Event const& event, edm::EventSetup const& iSetup) { + //---------------- GenJets ------------------------------------------ + auto genJets = event.getHandle(mGenJetsName); + auto hEventInfo = event.getHandle(mEventInfo); + auto hParts = event.getHandle(mGenParts); + int pid1 = -10, pid2 = -10; + int oid1 = -10, oid2 = -10; + for (auto iprt = hParts->begin(); iprt!=hParts->end(); ++iprt) { + int pid = iprt->pdgId(); + if (pid == 2212) continue; + int stat = iprt->status(); + // Only works with pythia8! + if (stat == 21) { + if (pid1 < -9) pid1 = pid; + else if (pid2 < -9) pid2 = pid; + } else if (stat < 30) { + if (stat == 23) { + if (oid1 < -9) oid1 = pid; + else if (oid2 < -9) oid2 = pid; + } + } else if (pid1 > -10 && pid2 > -10) { + break; + } + } + if (pid1 < 0) { + int tmp = pid1; + pid1 = pid2; + pid2 = tmp; + } + if (oid1 < 0) { + int tmp = oid1; + oid1 = oid2; + oid2 = tmp; + } + if (pid1 == 21) { + pid1 = pid2; + pid2 = 21; + } + if (oid1 == 21) { + oid1 = oid2; + oid2 = 21; + } + if (pid1 == 21) { + if (oid1 != 21 || oid2 != 21) { + mStat = 10 + abs(oid1) + 5 * (abs(oid2) - 1); + //mCases[1] += 1.; + } else { + mStat = 0; + //mCases[0] += 1.; + } + } else if (pid2 == 21) { + if (pid1 > 0) { + mStat = pid1; + } else { + mStat = 5 + abs(pid1); + } + //mCases[2] += 1.; + } else { + if (pid1 == -pid2 && (pid1 != oid1 || pid2 != oid2)) { + mStat = 60 + abs(pid1) + 5 * (abs(pid2) - 1); + //mCases[4] += 1.; + } else { + mStat = 35 + abs(pid1) + 5 * (abs(pid2) - 1); + //mCases[3] += 1.; + } + } + + mWeight = hEventInfo->weight(); + + mJid = 0; + for (auto igen = genJets->begin(); igen!=genJets->end(); ++igen) { + double cEta = igen->eta(); + if (fabs(cEta) > 5.2) continue; + const double cPt = igen->pt(); + if (cPt < 15.) continue; + + mPt = cPt; + mEta = cEta; + mPhi = igen->phi(); + mE = igen->energy(); + for (size_t i = 0; i < 19; ++i) mFracs[i] = 0.; + + for (unsigned idx = 0; idx < igen->numberOfDaughters(); ++idx) { + auto *dgt = dynamic_cast(igen->daughter(idx)); + int pid = dgt->pdgId(); + double ene = dgt->energy(); + if (pid == 211) { // pi+ + mFracs[0] += ene; + } else if (pid == -211) { // pi- + mFracs[1] += ene; + } else if (pid == 22) { // gamma + auto moth = dgt->motherRef(); + if (moth.isNonnull() && moth.isAvailable()) { + int mid = moth->pdgId(); + while (mid == 22) { + moth = moth->motherRef(); + mid = moth->pdgId(); + } + int amid = abs(mid); + //const bool prot = mid == 2212 && moth->energy() > 6499.; + //const bool noid = mid == 21 || amid < 10 || prot; + //if (cPt > 2000.) { + ////if (cPt < 2000. && cPt > 1200.) { + ////if (cPt < 1200. && cPt > 600.) { + ////if (cPt < 600. && cPt > 200.) { + ////if (cPt < 200. && cPt > 50.) { + ////if (cPt < 50. && cPt > 30.) { + ////if (cPt < 30.) { + // int recog = prot ? 0 : (moth->charge() == 0 ? (amid < 10 ? 2 : amid) : 1); + // if (mPhot.find(recog) == mPhot.end()) { + // mPhot[recog] = ene; + // } else { + // mPhot[recog] += ene; + // } + //} + if (amid == 111) { // pi0 + mFracs[2] += ene; + } else if (amid == 221) { // eta + mFracs[3] += ene; + } else if (amid == 223) { // omega + mFracs[4] += ene; + } else { + mFracs[13] += ene; + } + } else { + cout << "Not found!" << endl; + mFracs[13] += ene; + } + } else if (pid == 321) { // K+ + mFracs[5] += ene; + } else if (pid == -321) { // K- + mFracs[6] += ene; + } else if (abs(pid) == 310) { // KS + mFracs[7] += ene; + } else if (abs(pid) == 130) { // KL + mFracs[8] += ene; + } else if (pid == 2212) { // p+ + mFracs[9] += ene; + } else if (pid == -2212) { // p- + mFracs[10] += ene; + } else if (pid == 2112) { // n + mFracs[11] += ene; + } else if (pid == -2112) { // nbar + mFracs[12] += ene; + } else if (abs(pid) == 3122 || abs(pid) == 3322) { // Lambda0/Xi0 + mFracs[14] += ene; + } else if (abs(pid) == 3222 || abs(pid) == 3112) { // Sigma+- + mFracs[15] += ene; + } else if (abs(pid) == 3312 || abs(pid) == 3334) { // Xi-/Omega- + mFracs[16] += ene; + } else if (abs(pid) == 11 || abs(pid) == 13) { // e/mu + mFracs[17] += ene; + } else { // Others: should be empty, but check + mFracs[18] += ene; + cout << pid << " " << dgt->energy() << endl; + } + } + for (size_t i = 0; i < 19; ++i) mEFracs[i] = mFracs[i]; + + mTree->Fill(); + if (++mJid > 10) break; + } +} + +////////////////////////////////////////////////////////////////////////////////////////// +DEFINE_FWK_MODULE(MCJettify); diff --git a/AnalysisFW/plugins/ProcessedTreeProducerBTag.cc b/AnalysisFW/plugins/ProcessedTreeProducerBTag.cc index ac56ebe5d87..89b85f73a29 100644 --- a/AnalysisFW/plugins/ProcessedTreeProducerBTag.cc +++ b/AnalysisFW/plugins/ProcessedTreeProducerBTag.cc @@ -1,1058 +1,1355 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "TTree.h" -#include -#include -#include - -#include "SMPJ/AnalysisFW/plugins/ProcessedTreeProducerBTag.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Common/interface/TriggerNames.h" -#include "FWCore/Common/interface/TriggerResultsByName.h" - -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "DataFormats/JetReco/interface/Jet.h" -#include "DataFormats/JetReco/interface/PFJet.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" -#include "DataFormats/JetReco/interface/GenJet.h" -#include "DataFormats/JetReco/interface/GenJetCollection.h" -#include "DataFormats/JetReco/interface/JetExtendedAssociation.h" -#include "DataFormats/JetReco/interface/JetID.h" -#include "DataFormats/METReco/interface/HcalNoiseSummary.h" -#include "DataFormats/BeamSpot/interface/BeamSpot.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" - -#include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h" -#include "DataFormats/PatCandidates/interface/PackedTriggerPrescales.h" -#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" - -#include "DataFormats/PatCandidates/interface/MET.h" -#include "DataFormats/PatCandidates/interface/PackedCandidate.h" - -#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" -#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" - -#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h" -#include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h" - -#include "PhysicsTools/PatUtils/interface/bJetSelector.h" -#include "PhysicsTools/PatExamples/interface/BTagPerformance.h" -#include "PhysicsTools/PatExamples/interface/PatBTagCommonHistos.h" - -#include "DataFormats/Math/interface/deltaR.h" -#include "DataFormats/Common/interface/ValueMap.h" - -//hadron-level definition -#include "SimDataFormats/JetMatching/interface/JetFlavourInfo.h" -#include "SimDataFormats/JetMatching/interface/JetFlavourInfoMatching.h" -#include "DataFormats/Math/interface/deltaR.h" - -ProcessedTreeProducerBTag::ProcessedTreeProducerBTag(edm::ParameterSet const& cfg): - mOfflineVertices(mayConsume(cfg.getParameter("offlineVertices"))), - mBeamSpot(mayConsume(cfg.getParameter("beamSpot"))), - //mPFJetsName(mayConsume(cfg.getParameter("pfjets"))), - //mPFJetsNameCHS(mayConsume(cfg.getParameter("pfjetschs"))), - mSrcCaloRho(mayConsume(cfg.getParameter("srcCaloRho"))), - mSrcPFRho(mayConsume(cfg.getParameter("srcPFRho"))), - mPFMET(mayConsume(cfg.getParameter("pfmet"))), - mGenJetsName(mayConsume(cfg.getUntrackedParameter("genjets",edm::InputTag("")))), - triggerResultsTag_(mayConsume(cfg.getParameter("triggerResults"))), - triggerEventTag_(mayConsume(cfg.getParameter("triggerEvent"))), - mHBHENoiseFilterResultLabel(mayConsume(cfg.getParameter("HBHENoiseFilterResultLabel"))), - mHBHENoiseFilterResultNoMinZLabel(mayConsume(cfg.getParameter("HBHENoiseFilterResultNoMinZLabel"))), - mSrcPU(mayConsume >(cfg.getUntrackedParameter("srcPULabel"))), - hltPrescale_(cfg, consumesCollector(), *this)// ",edm::InputTag("addPileupInfo")))) -{ -// mPFJECservice = cfg.getParameter ("pfjecService"); - //mPFPayloadName = cfg.getParameter("PFPayloadName"); - mPFPayloadNameCHS = cfg.getParameter ("PFPayloadNameCHS"); - //pfpujetid = cfg.getParameter ("pfpujetid"); - pfchsjetpuid = cfg.getParameter ("pfchsjetpuid"); - mGoodVtxNdof = cfg.getParameter ("goodVtxNdof"); - mGoodVtxZ = cfg.getParameter ("goodVtxZ"); - mMinPFPt = cfg.getParameter ("minPFPt"); - mMinJJMass = cfg.getParameter ("minJJMass"); - mMaxY = cfg.getParameter ("maxY"); - mMinNPFJets = cfg.getParameter ("minNPFJets"); - //mOfflineVertices = cfg.getParameter ("offlineVertices"); - mPrintTriggerMenu = cfg.getUntrackedParameter ("printTriggerMenu",false); - mIsMCarlo = cfg.getUntrackedParameter ("isMCarlo",false); - mAK4 = cfg.getUntrackedParameter ("AK4",false); - mUseGenInfo = cfg.getUntrackedParameter ("useGenInfo",false); - mMinGenPt = cfg.getUntrackedParameter ("minGenPt",30); - processName_ = cfg.getParameter ("processName"); - triggerNames_ = cfg.getParameter > ("triggerName"); - //mPFJECUncSrc = cfg.getParameter ("jecUncSrc"); - mPFJECUncSrcCHS = cfg.getParameter ("jecUncSrcCHS"); - mPFJECUncSrcNames = cfg.getParameter > ("jecUncSrcNames"); - //mPFJetsName = consumes >(cfg.getParameter("pfjets")); - mPFJetsNameCHS = consumes >(cfg.getParameter("pfjetschs")); - mhEventInfo = consumes(cfg.getParameter("EventInfo")); - mgenParticles = consumes(cfg.getParameter("GenParticles")); - qgToken = consumes>(edm::InputTag("QGTagger", "qgLikelihood")); - jetFlavourInfosToken_ = consumes( cfg.getParameter("jetFlavourInfos")); - //mPFJetsName = cfg.getParameter ("pfjets"); - //mPFJetsNameCHS = cfg.getParameter ("pfjetschs"); - //mSrcPU = cfg.getUntrackedParameter ("srcPU",edm::InputTag("addPileupInfo")); - //triggerResultsTag_ = cfg.getParameter ("triggerResults"); - //triggerEventTag_ = cfg.getParameter ("triggerEvent"); - //New additions - //beamSpot_(consumes(cfg.getParameter("offlineBeamSpot"))); - -} -////////////////////////////////////////////////////////////////////////////////////////// -void ProcessedTreeProducerBTag::beginJob() -{ - mTree = fs->make("ProcessedTree","ProcessedTree"); - mEvent = new QCDEvent(); - mTree->Branch("events","QCDEvent",&mEvent); - mTriggerNamesHisto = fs->make("TriggerNames","TriggerNames",1,0,1); - mTriggerNamesHisto->SetBit(TH1::kUserContour); - for(unsigned i=0;iFill(triggerNames_[i].c_str(),1); - mTriggerPassHisto = fs->make("TriggerPass","TriggerPass",1,0,1); - mTriggerPassHisto->SetBit(TH1::kUserContour); - //isPFJecUncSet_ = false; - isPFJecUncSetCHS_ = false; -} -////////////////////////////////////////////////////////////////////////////////////////// -void ProcessedTreeProducerBTag::endJob() -{ -} -////////////////////////////////////////////////////////////////////////////////////////// -void ProcessedTreeProducerBTag::beginRun(edm::Run const & iRun, edm::EventSetup const& iSetup) -{ - bool changed(true); - if (hltConfig_.init(iRun,iSetup,processName_,changed) && hltPrescale_.init(iRun, iSetup, processName_, changed) ) { - if (changed) { - // check if trigger names in (new) config - cout<<"New trigger menu found !!!"<= n) - cout<<"does not exist in the current menu"< mPFJets; - vector mPFJetsCHS; - vector mGenJets; - vector GenFlavour; - vector GenHadronFlavour; - QCDEventHdr mEvtHdr; - QCDMET mPFMet; - - //-------------- Basic Event Info ------------------------------ - mEvtHdr.setRun(event.id().run()); - mEvtHdr.setEvt(event.id().event()); - mEvtHdr.setLumi(event.luminosityBlock()); - mEvtHdr.setBunch(event.bunchCrossing()); - //-------------- Beam Spot -------------------------------------- - Handle beamSpot; - event.getByToken(mBeamSpot,beamSpot); - if (beamSpot.isValid()) - mEvtHdr.setBS(beamSpot->x0(),beamSpot->y0(),beamSpot->z0()); - else - mEvtHdr.setBS(-999,-999,-999); - - - //-------------- HCAL Noise Summary ----------------------------- - Handle noiseSummary; - Handle noiseSummary_NoMinZ; - - if (!mIsMCarlo) { - // event.getByLabel(mHBHENoiseFilter,noiseSummary); - event.getByToken(mHBHENoiseFilterResultLabel, noiseSummary); - //event.getByToken(mHBHENoiseFilterResultProducer, noiseSummary); - mEvtHdr.setHCALNoise(*noiseSummary); - - event.getByToken(mHBHENoiseFilterResultNoMinZLabel, noiseSummary_NoMinZ); - mEvtHdr.setHCALNoiseNoMinZ(*noiseSummary_NoMinZ); - - } - else{ - mEvtHdr.setHCALNoise(true); - mEvtHdr.setHCALNoiseNoMinZ(true); - } - //-------------- Trigger Info ----------------------------------- - event.getByToken(triggerResultsTag_,triggerResultsHandle_); - if (!triggerResultsHandle_.isValid()) { - cout << "ProcessedTreeProducerBTag::analyze: Error in getting TriggerResults product from Event!" << endl; - return; - } - event.getByToken(triggerEventTag_,triggerEventHandle_); - if (!triggerEventHandle_.isValid()) { - cout << "ProcessedTreeProducerBTag::analyze: Error in getting TriggerEvent product from Event!" << endl; - return; - } - vector L1Prescales,HLTPrescales,Fired; - vector > mL1Objects,mHLTObjects; - // sanity check - assert(triggerResultsHandle_->size() == hltConfig_.size()); - //------ loop over all trigger names --------- - for(unsigned itrig=0;itrig vvL1,vvHLT; - if (triggerIndex_[itrig] < hltConfig_.size()) { - accept = triggerResultsHandle_->accept(triggerIndex_[itrig]); - // const std::pair prescales(hltConfig_.prescaleValues(event,iSetup,triggerNames_[itrig])); - - ///In detail - //get prescale info from hltConfig_ - - std::pair >,int> detailedPrescaleInfo = hltPrescale_.prescaleValuesInDetail(event, iSetup, triggerNames_[itrig]); - preHLT = detailedPrescaleInfo.second ; - - // save l1 prescale values in standalone vector - std::vector l1prescalevals; - for( size_t varind = 0; varind < detailedPrescaleInfo.first.size(); varind++ ){ - l1prescalevals.push_back(detailedPrescaleInfo.first.at(varind).second); - } - - //find and save minimum l1 prescale of any ORed L1 that seeds the HLT - std::vector::iterator result = std::min_element(std::begin(l1prescalevals), std::end(l1prescalevals)); - size_t minind = std::distance(std::begin(l1prescalevals), result); - // sometimes there are no L1s associated with a HLT. In that case, this branch stores -1 for the l1prescale - preL1 = minind < l1prescalevals.size() ? l1prescalevals.at(minind) : -1 ;//commented for 76X - - ///end in detail - if (!accept) - tmpFired = 0; - else { - mTriggerPassHisto->Fill(triggerNames_[itrig].c_str(),1); - tmpFired = 1; - } - - //--------- modules on this trigger path-------------- - const vector& moduleLabels(hltConfig_.moduleLabels(triggerIndex_[itrig])); - const unsigned int moduleIndex(triggerResultsHandle_->index(triggerIndex_[itrig])); - bool foundL1(false); - for(unsigned int j=0; j<=moduleIndex; ++j) { - const string& moduleLabel(moduleLabels[j]); - const string moduleType(hltConfig_.moduleType(moduleLabel)); - //--------check whether the module is packed up in TriggerEvent product - const unsigned int filterIndex(triggerEventHandle_->filterIndex(InputTag(moduleLabel,"",processName_))); - if (filterIndexsizeFilters()) { - const Vids& VIDS (triggerEventHandle_->filterIds(filterIndex)); - const Keys& KEYS(triggerEventHandle_->filterKeys(filterIndex)); - const size_type nI(VIDS.size()); - const size_type nK(KEYS.size()); - assert(nI==nK); - const size_type n(max(nI,nK)); - const TriggerObjectCollection& TOC(triggerEventHandle_->getObjects()); - if (foundL1) { - for(size_type i=0; i!=n; ++i) { - const TriggerObject& TO(TOC[KEYS[i]]); - TLorentzVector P4; - P4.SetPtEtaPhiM(TO.pt(),TO.eta(),TO.phi(),TO.mass()); - LorentzVector qcdhltobj(P4.Px(),P4.Py(),P4.Pz(),P4.E()); - vvHLT.push_back(qcdhltobj); - //cout<setTrigDecision(Fired); - mEvent->setPrescales(L1Prescales,HLTPrescales); - mEvent->setL1Obj(mL1Objects); - mEvent->setHLTObj(mHLTObjects); - - //-------------- Vertex Info ----------------------------------- - Handle recVtxs; - event.getByToken(mOfflineVertices,recVtxs); - //------------- reject events without reco vertices ------------ - int VtxGood(0); - bool isPVgood(false); - float PVx(0),PVy(0),PVz(0),PVndof(0); - for(VertexCollection::const_iterator i_vtx = recVtxs->begin(); i_vtx != recVtxs->end(); i_vtx++) { - int index = i_vtx-recVtxs->begin(); - if (index == 0) { - PVx = i_vtx->x(); - PVy = i_vtx->y(); - PVz = i_vtx->z(); - PVndof = i_vtx->ndof(); - } - if (!(i_vtx->isFake()) && i_vtx->ndof() >= mGoodVtxNdof && fabs(i_vtx->z()) <= mGoodVtxZ) { - if (index == 0) { - isPVgood = true; - } - VtxGood++; - } - } - mEvtHdr.setVertices(recVtxs->size(),VtxGood); - mEvtHdr.setPV(isPVgood,PVndof,PVx,PVy,PVz); - //-------------- Rho ------------------------------------------------ - Handle rhoCalo; - event.getByToken(mSrcCaloRho,rhoCalo); - Handle rhoPF; - event.getByToken(mSrcPFRho,rhoPF); - mEvtHdr.setRho(*rhoCalo,*rhoPF); - //-------------- Generator Info ------------------------------------- - Handle hEventInfo; - //-------------- Simulated PU Info ---------------------------------- - Handle > PupInfo; - if (mIsMCarlo && mUseGenInfo) { - event.getByToken(mhEventInfo, hEventInfo); - if(hEventInfo->hasBinningValues()) - mEvtHdr.setPthat(hEventInfo->binningValues()[0]); - else - mEvtHdr.setPthat(0); - - mEvtHdr.setWeight(hEventInfo->weight()); - event.getByToken(mSrcPU, PupInfo); - std::vector::const_iterator PUI; - int nbx = PupInfo->size(); - int ootpuEarly(0),ootpuLate(0),intpu(0); - float Tnpv = -1.; // new variable for computing pileup weight factor for the event - - for(PUI = PupInfo->begin(); PUI != PupInfo->end(); ++PUI) { - if (PUI->getBunchCrossing() < 0) - ootpuEarly += PUI->getPU_NumInteractions(); - else if (PUI->getBunchCrossing() > 0) - ootpuLate += PUI->getPU_NumInteractions(); - else { - intpu += PUI->getPU_NumInteractions(); - Tnpv = PUI->getTrueNumInteractions(); - } - - } - - mEvtHdr.setPU(nbx,ootpuEarly,ootpuLate,intpu); - mEvtHdr.setTrPu(Tnpv); - } - else { - mEvtHdr.setPthat(0); - mEvtHdr.setWeight(0); - mEvtHdr.setPU(0,0,0,0); - mEvtHdr.setTrPu(0); - } - - //---------------- Jets --------------------------------------------- - //mPFJEC = JetCorrector::getJetCorrector(mPFJECservice,iSetup); - //event.getByToken(mvaFullPUDiscriminantToken_ ,puJetIdMva); - - /* LET's remove PFjets // Engin - edm::ESHandle PFJetCorParColl; - if (mPFPayloadName != "" && !isPFJecUncSet_){ - iSetup.get().get(mPFPayloadName,PFJetCorParColl); - JetCorrectorParameters const& PFJetCorPar = (*PFJetCorParColl)["Uncertainty"]; - mPFUnc = new JetCorrectionUncertainty(PFJetCorPar); - if (mPFJECUncSrc != "") { - for(unsigned isrc=0;isrc genjets; - if (mIsMCarlo) { - event.getByToken(mGenJetsName,genjets); - for(GenJetCollection::const_iterator i_gen = genjets->begin(); i_gen != genjets->end(); i_gen++) { - if (i_gen->pt() > mMinGenPt && fabs(i_gen->y()) < mMaxY) { - mGenJets.push_back(i_gen->p4()); - - //ADD FLAVOUR AT GEN LEVEL - int FlavourGen = getMatchedPartonGen(event,i_gen); - //if(FlavourGen<-100) cout<pt()<<" "<eta()<<" "<phi()<pt()<<" "<eta()<<" "<phi()< theJetFlavourInfos; - event.getByToken(jetFlavourInfosToken_, theJetFlavourInfos ); - - for ( reco::JetFlavourInfoMatchingCollection::const_iterator j = theJetFlavourInfos->begin();j != theJetFlavourInfos->end();++j ) { - //std::cout << "-------------------- Jet Flavour Info --------------------" << std::endl; - - //const reco::Jet *aJet = (*j).first.get(); - reco::JetFlavourInfo aInfo = (*j).second; - //std::cout << std::setprecision(2) << std::setw(6) << std::fixed - //<< "[printJetFlavourInfo] Jet " << (j - theJetFlavourInfos->begin()) << " pt, eta, rapidity, phi = " << aJet->pt() << ", " - //<< aJet->eta() << ", " - //<< aJet->rapidity() << ", " - //<< aJet->phi() - //<< std::endl; - // ----------------------- Hadrons ------------------------------- - //std::cout << " Hadron-based flavour: " << aInfo.getHadronFlavour() << std::endl; - - int FlavourGenHadron = aInfo.getHadronFlavour(); - //if(FlavourGenHadron==5) cout<pt()<<" "<eta()<<" "<phi()<<" HADRONFLAV"< > patjets; - //event.getByToken(mPFJetsName,patjets); - - /*edm::Handle btagDiscriminators; - event.getByLabel("pfCombinedInclusiveSecondaryVertexV2BJetTags", btagDiscriminators); */ - /* - for(edm::View::const_iterator i_pfjet=patjets->begin(); i_pfjet!=patjets->end(); ++i_pfjet) - { - QCDPFJet qcdpfjet; - - if(i_pfjet->isPFJet() ){ - - double scale = 1./i_pfjet->jecFactor(0); // --- the value of the JEC factor - - //---- preselection ----------------- - if (fabs(i_pfjet->y()) > mMaxY) continue; - - //---- vertex association ----------- - //---- get the vector of tracks ----- - reco::TrackRefVector vTrks(i_pfjet->associatedTracks()); - float sumTrkPt(0.0),sumTrkPtBeta(0.0),sumTrkPtBetaStar(0.0),beta(0.0),betaStar(0.0); - int mpuTrk(0), mlvTrk(0); // # of pile-up tracks & lead-vertex tracks ## Juska - int mjtTrk(0); // multiplicity of _all_ tracks in jet (also vtx-unassociated!) ## Juska - - //---- loop over the tracks of the jet ---- - //std::cout << "starting the loop yo!" << std::endl; // debug - //std::cout << "vTrks.size()" << vTrks.size() << std::endl; - for(reco::TrackRefVector::const_iterator i_trk = vTrks.begin(); i_trk != vTrks.end(); i_trk++) { - if (recVtxs->size() == 0) break; - sumTrkPt += (*i_trk)->pt(); - mjtTrk++; //Juska - //---- loop over all vertices ---------------------------- - for(unsigned ivtx = 0;ivtx < recVtxs->size();ivtx++) { - //---- loop over the tracks associated with the vertex --- - if (!((*recVtxs)[ivtx].isFake()) && (*recVtxs)[ivtx].ndof() >= mGoodVtxNdof && fabs((*recVtxs)[ivtx].z()) <= mGoodVtxZ) { - for(reco::Vertex::trackRef_iterator i_vtxTrk = (*recVtxs)[ivtx].tracks_begin(); i_vtxTrk != (*recVtxs)[ivtx].tracks_end(); ++i_vtxTrk) { - //---- match the jet track to the track from the vertex ---- - reco::TrackRef trkRef(i_vtxTrk->castTo()); - //---- check if the tracks match ------------------------- - if (trkRef == (*i_trk)) { - if (ivtx == 0) { - sumTrkPtBeta += (*i_trk)->pt(); - mlvTrk++; //Juska - } - else { - sumTrkPtBetaStar += (*i_trk)->pt(); - mpuTrk++; //Juska - } - break; - } // if (trkRef == (*i_trk)) - } // for(reco::Vertex::trackRef_iterator i_vtxTrk = (*recVtxs)[ivtx].tracks_begin(); i_vtxTrk != (*recVtxs)[ivtx].tracks_end(); ++i_vtxTrk) - } // if (!((*recVtxs)[ivtx].isFake()) && (*recVtxs)[ivtx].ndof() >= mGoodVtxNdof && fabs((*recVtxs)[ivtx].z()) <= mGoodVtxZ) - } // for(unsigned ivtx = 0;ivtx < recVtxs->size();ivtx++) - } // for(reco::TrackRefVector::const_iterator i_trk = vTrks.begin(); i_trk != vTrks.end(); i_trk++) - if (sumTrkPt > 0) { - beta = sumTrkPtBeta/sumTrkPt; - betaStar = sumTrkPtBetaStar/sumTrkPt; - } //if (sumTrkPt > 0) - qcdpfjet.setBeta(beta); - qcdpfjet.setBetaStar(betaStar); - - //---- jec uncertainty -------------- - double unc(0.0); - vector uncSrc(0); - if (mPFPayloadName != "") { - mPFUnc->setJetEta(i_pfjet->eta()); - mPFUnc->setJetPt(i_pfjet->pt()); - unc = mPFUnc->getUncertainty(true); - } // if (mPFPayloadName != "") - if (mPFJECUncSrc != "") { - for(unsigned isrc=0;isrcsetJetEta(i_pfjet->eta()); - mPFUncSrc[isrc]->setJetPt(i_pfjet->pt()); - float unc1 = mPFUncSrc[isrc]->getUncertainty(true); - uncSrc.push_back(unc1); - } // for(unsigned isrc=0;isrcp4()); - qcdpfjet.setCor(scale); - qcdpfjet.setUnc(unc); - qcdpfjet.setUncSrc(uncSrc); - qcdpfjet.setArea(i_pfjet->jetArea()); - - double chf = i_pfjet->chargedHadronEnergyFraction(); - double nhf = i_pfjet->neutralHadronEnergyFraction(); //+ i_pfjet->HFHadronEnergyFraction(); - double nemf = i_pfjet->neutralEmEnergyFraction(); // equals to old phf with HF info included - //double elf = i_pfjet->electronEnergyFraction(); equals to cemf - double cemf = i_pfjet->chargedEmEnergyFraction(); - double muf = i_pfjet->muonEnergyFraction(); - double hf_hf = i_pfjet->HFHadronEnergyFraction(); - double hf_phf= i_pfjet->HFEMEnergyFraction(); - - int hf_hm = i_pfjet->HFHadronMultiplicity(); - int hf_phm = i_pfjet->HFEMMultiplicity(); - int chm = i_pfjet->chargedHadronMultiplicity(); - int nhm = i_pfjet->neutralHadronMultiplicity(); - int phm = i_pfjet->photonMultiplicity(); - int elm = i_pfjet->electronMultiplicity(); - int mum = i_pfjet->muonMultiplicity(); - int npr = i_pfjet->chargedMultiplicity() + i_pfjet->neutralMultiplicity(); - //bool looseID = (npr>1 && phf<0.99 && nhf<0.99 && ((fabs(i_pfjet->eta())<=2.4 && elf<0.99 && chf>0 && chm>0) || fabs(i_pfjet->eta())>2.4)); - //bool tightID = (npr>1 && phf<0.99 && nhf<0.99 && ((fabs(i_pfjet->eta())<=2.4 && nhf<0.9 && phf<0.9 && elf<0.99 && chf>0 && chm>0) || fabs(i_pfjet->eta())>2.4)); - // https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetID - float eta = i_pfjet->eta(); - int cm = i_pfjet->chargedMultiplicity(); - bool looseID = (nhf<0.99 && nemf<0.99 && npr>1 && muf<0.8) && ((fabs(eta) <= 2.4 && chf>0 && cm>0 && cemf<0.99) || fabs(eta)>2.4); - bool tightID = (nhf<0.90 && nemf<0.90 && npr>1 && muf<0.8) && ((fabs(eta)<=2.4 && chf>0 && cm>0 && cemf<0.90) || fabs(eta)>2.4); - - double TCHE = i_pfjet->bDiscriminator("trackCountingHighEffBJetTags"); - double TCHP = i_pfjet->bDiscriminator("trackCountingHighPurBJetTags"); - double TCHEpf = i_pfjet->bDiscriminator("pfTrackCountingHighEffBJetTags"); - double TCHPpf = i_pfjet->bDiscriminator("pfTrackCountingHighPurBJetTags"); - - double SoftMuonTagByIP = i_pfjet->bDiscriminator("softPFMuonByIP3dBJetTags"); - double SoftElectronTagByIP = i_pfjet->bDiscriminator("softPFElectronByIP3dBJetTags"); - double SoftMuonTag = i_pfjet->bDiscriminator("softPFMuonBJetTags"); - double SoftElectronTag = i_pfjet->bDiscriminator("softPFElectronBJetTags"); - - double SimpleSecVertexHE = i_pfjet->bDiscriminator("simpleSecondaryVertexHighEffBJetTags"); - double SimpleSecVertexHP = i_pfjet->bDiscriminator("simpleSecondaryVertexHighPurBJetTags"); - double SimpleSecVertexHEpf = i_pfjet->bDiscriminator("pfSimpleSecondaryVertexHighEffBJetTags"); - double SimpleSecVertexHPpf = i_pfjet->bDiscriminator("pfSimpleSecondaryVertexHighPurBJetTags"); - - double CSV = i_pfjet->bDiscriminator("combinedSecondaryVertexBJetTags"); - double CSVpf = i_pfjet->bDiscriminator("pfCombinedSecondaryVertexBJetTags"); - double CinclSVpf = i_pfjet->bDiscriminator("pfCombinedInclusiveSecondaryVertexBJetTags"); - double CMVApf = i_pfjet->bDiscriminator("pfCombinedMVABJetTags"); - double CSVSoftLeptonpf = i_pfjet->bDiscriminator("pfCombinedSecondaryVertexSoftLeptonBJetTags"); - - double CSVpfPositive = i_pfjet->bDiscriminator("pfPositiveCombinedSecondaryVertexBJetTags"); - double CSVpfNegative = i_pfjet->bDiscriminator("pfNegativeCombinedSecondaryVertexBJetTags"); - - //the three recommended - double pfJetProbabilityBJetTags=i_pfjet->bDiscriminator("pfJetProbabilityBJetTags"); - double pfCombinedInclusiveSecondaryVertexV2BJetTags= i_pfjet->bDiscriminator("pfCombinedInclusiveSecondaryVertexV2BJetTags"); - double pfCombinedMVAV2BJetTags=i_pfjet->bDiscriminator("pfCombinedMVAV2BJetTags"); - - qcdpfjet.setLooseID(looseID); - qcdpfjet.setTightID(tightID); - qcdpfjet.setFrac(chf,nhf,nemf,cemf,muf); - qcdpfjet.setMulti(npr,chm,nhm,phm,elm,mum); - qcdpfjet.setHFFrac(hf_hf,hf_phf); - qcdpfjet.setHFMulti(hf_hm,hf_phm); - - float partonFlavour=-100; - float hadronFlavour=-100; - - if (mIsMCarlo && mUseGenInfo) { - partonFlavour = i_pfjet->partonFlavour(); - hadronFlavour = i_pfjet->hadronFlavour(); - } - - //if(i_pfjet->pt()>114) cout<pt()<<" "<eta()<<" "<phi()<<" "<hoEnergyFraction(); // Juska - qcdpfjet.setVtxInfo(mpuTrk,mlvTrk,mjtTrk); - qcdpfjet.setHO(hof); - - //Filling B-tag infos - qcdpfjet.setTCHETag(TCHE,TCHP,TCHEpf,TCHPpf); - qcdpfjet.setSoftLeptonTag(SoftMuonTagByIP,SoftElectronTagByIP,SoftMuonTag,SoftElectronTag); - qcdpfjet.setSimpleSecondaryVertexTag(SimpleSecVertexHE,SimpleSecVertexHP,SimpleSecVertexHEpf,SimpleSecVertexHPpf); - qcdpfjet.setCombinedSecondaryVertexTag(CSV,CSVpf,CinclSVpf,CSVSoftLeptonpf,CMVApf); - qcdpfjet.setPositiveNegativeCSV(CSVpfPositive,CSVpfNegative); - qcdpfjet.setTagRecommended(pfJetProbabilityBJetTags,pfCombinedInclusiveSecondaryVertexV2BJetTags,pfCombinedMVAV2BJetTags); - - float pileupJetId = -999; - if ( i_pfjet->hasUserFloat(pfpujetid) ) pileupJetId = i_pfjet->userFloat(pfpujetid); - qcdpfjet.SetPUJetId(pileupJetId); - - if (mIsMCarlo) { - GenJetCollection::const_iterator i_matched; - float rmin(999); - for(GenJetCollection::const_iterator i_gen = genjets->begin(); i_gen != genjets->end(); i_gen++) { - double deltaR = reco::deltaR(*i_pfjet,*i_gen); - if (deltaR < rmin) { - rmin = deltaR; - i_matched = i_gen; - } - } - if (genjets->size() == 0) { - LorentzVector tmpP4(0.0,0.0,0.0,0.0); - qcdpfjet.setGen(tmpP4,0); - } - else - qcdpfjet.setGen(i_matched->p4(),rmin); - } // if (mIsMCarlo) - else { - LorentzVector tmpP4(0.0,0.0,0.0,0.0); - qcdpfjet.setGen(tmpP4,0); - } - if (qcdpfjet.pt() >= mMinPFPt && qcdpfjet.ptCor() >= mMinPFPt/2.) - mPFJets.push_back(qcdpfjet); - - - } // if(iJet->isPFJet() ) - } // --- end of non chs patjet iterator loop -------------------- // - */ - - // ========================******************************************===================== // - - // -------- CHS Uncertainty part ----------------// - edm::ESHandle PFJetCorParCollCHS; - if (mPFPayloadNameCHS != "" && !isPFJecUncSetCHS_){ - iSetup.get().get(mPFPayloadNameCHS,PFJetCorParCollCHS); - JetCorrectorParameters const& PFJetCorParCHS = (*PFJetCorParCollCHS)["Uncertainty"]; - mPFUncCHS = new JetCorrectionUncertainty(PFJetCorParCHS); - if (mPFJECUncSrcCHS != "") { - for(unsigned isrc=0;isrc> qgHandle; - event.getByToken(qgToken, qgHandle); - - edm::Handle > patjetschs; - event.getByToken(mPFJetsNameCHS,patjetschs); - - /*for(edm::View::const_iterator i_pfjet=patjetschs->begin(); i_pfjet!=patjetschs->end(); ++i_pfjet){ - edm::RefToBase jetRef(edm::Ref >(patjetschs, i_pfjet - patjetschs->begin())); - float qgLikelihood = (*qgHandle)[jetRef]; - - cout<::const_iterator i_pfjetchs=patjetschs->begin(); i_pfjetchs!=patjetschs->end(); ++i_pfjetchs) - { - QCDPFJet qcdpfjetchs; - - if(i_pfjetchs->isPFJet() ){ - - double scaleCHS = 1./i_pfjetchs->jecFactor(0); // --- the value of the JEC factor - - //---- preselection ----------------- - if (fabs(i_pfjetchs->y()) > mMaxY) continue; - - //---- vertex association ----------- - //---- get the vector of tracks ----- - reco::TrackRefVector vTrksCHS(i_pfjetchs->associatedTracks()); - float sumTrkPtCHS(0.0),sumTrkPtBetaCHS(0.0),sumTrkPtBetaStarCHS(0.0),betaCHS(0.0),betaStarCHS(0.0); - - // Dunno how useful these are in chs jets... - int mpuTrk(0), mlvTrk(0); // # of pile-up tracks & lead-vertex tracks ## Juska - int mjtTrk(0); // multiplicity of _all_ tracks in jet (also vtx-unassociated!) ## Juska - - //---- loop over the tracks of the jet ---- - - for(reco::TrackRefVector::const_iterator i_trkchs = vTrksCHS.begin(); i_trkchs != vTrksCHS.end(); i_trkchs++) { - if (recVtxs->size() == 0) break; - sumTrkPtCHS += (*i_trkchs)->pt(); - mjtTrk++; //Juska - //---- loop over all vertices ---------------------------- - for(unsigned ivtx = 0;ivtx < recVtxs->size();ivtx++) { - //---- loop over the tracks associated with the vertex --- - if (!((*recVtxs)[ivtx].isFake()) && (*recVtxs)[ivtx].ndof() >= mGoodVtxNdof && fabs((*recVtxs)[ivtx].z()) <= mGoodVtxZ) { - for(reco::Vertex::trackRef_iterator i_vtxTrk = (*recVtxs)[ivtx].tracks_begin(); i_vtxTrk != (*recVtxs)[ivtx].tracks_end(); ++i_vtxTrk) { - //---- match the chsjet track to the track from the vertex ---- - reco::TrackRef trkRef(i_vtxTrk->castTo()); - //---- check if the tracks match ------------------------- - if (trkRef == (*i_trkchs)) { - if (ivtx == 0) { - sumTrkPtBetaCHS += (*i_trkchs)->pt(); - mlvTrk++; //Juska - } - else { - sumTrkPtBetaStarCHS += (*i_trkchs)->pt(); - mpuTrk++; //Juska - } - break; - } // if (trkRef == (*i_trk)) - } // for(reco::Vertex::trackRef_iterator i_vtxTrk = (*recVtxs)[ivtx].tracks_begin(); i_vtxTrk != (*recVtxs)[ivtx].tracks_end(); ++i_vtxTrk) - } // if (!((*recVtxs)[ivtx].isFake()) && (*recVtxs)[ivtx].ndof() >= mGoodVtxNdof && fabs((*recVtxs)[ivtx].z()) <= mGoodVtxZ) - } // for(unsigned ivtx = 0;ivtx < recVtxs->size();ivtx++) - } // for(reco::TrackRefVector::const_iterator i_trk = vTrks.begin(); i_trk != vTrks.end(); i_trk++) - if (sumTrkPtCHS > 0) { - betaCHS = sumTrkPtBetaCHS/sumTrkPtCHS; - betaStarCHS = sumTrkPtBetaStarCHS/sumTrkPtCHS; - } //if (sumTrkPt > 0) - qcdpfjetchs.setBeta(betaCHS); - qcdpfjetchs.setBetaStar(betaStarCHS); - - //---- jec uncertainty -------------- - double uncCHS(0.0); - vector uncSrcCHS(0); - if (mPFPayloadNameCHS != "") { - mPFUncCHS->setJetEta(i_pfjetchs->eta()); - mPFUncCHS->setJetPt(i_pfjetchs->pt()); - uncCHS = mPFUncCHS->getUncertainty(true); - } // if (mPFPayloadName != "") - if (mPFJECUncSrcCHS != "") { - for(unsigned isrc=0;isrcsetJetEta(i_pfjetchs->eta()); - mPFUncSrcCHS[isrc]->setJetPt(i_pfjetchs->pt()); - float unc1 = mPFUncSrcCHS[isrc]->getUncertainty(true); - uncSrcCHS.push_back(unc1); - } // for(unsigned isrc=0;isrcp4()); - qcdpfjetchs.setCor(scaleCHS); - qcdpfjetchs.setUnc(uncCHS); - qcdpfjetchs.setUncSrc(uncSrcCHS); - qcdpfjetchs.setArea(i_pfjetchs->jetArea()); - - double chf = i_pfjetchs->chargedHadronEnergyFraction(); - double nhf = i_pfjetchs->neutralHadronEnergyFraction();// + i_pfjetchs->HFHadronEnergyFraction(); - double nemf = i_pfjetchs->neutralEmEnergyFraction(); // equals to deprecated phf but has HF info too - double cemf = i_pfjetchs->chargedEmEnergyFraction(); // equals to deprecated elf - double muf = i_pfjetchs->muonEnergyFraction(); - double hf_hf = i_pfjetchs->HFHadronEnergyFraction(); - double hf_phf= i_pfjetchs->HFEMEnergyFraction(); - int hf_hm = i_pfjetchs->HFHadronMultiplicity(); - int hf_phm = i_pfjetchs->HFEMMultiplicity(); - int chm = i_pfjetchs->chargedHadronMultiplicity(); - int nhm = i_pfjetchs->neutralHadronMultiplicity(); - int phm = i_pfjetchs->photonMultiplicity(); - int elm = i_pfjetchs->electronMultiplicity(); - int mum = i_pfjetchs->muonMultiplicity(); - int npr = i_pfjetchs->chargedMultiplicity() + i_pfjetchs->neutralMultiplicity(); - - - float eta = i_pfjetchs->eta(); - int cm = i_pfjetchs->chargedMultiplicity(); - - bool looseID, tightID; - if ( fabs(eta) <= 2.7){ - looseID = (nhf<0.99 && nemf<0.99 && npr > 1) && ((fabs(eta)<=2.4 && chf>0 && chm>0 && cemf <0.99) || fabs(eta)>2.4); - tightID = (nhf<0.90 && nemf<0.90 && npr > 1) && ((fabs(eta)<=2.4 && chf>0 && chm>0 && cemf <0.99) || fabs(eta)>2.4); - } - else if ( fabs(eta) <= 3.0){ - looseID = (nemf<0.90 && (npr - cm)>2 ); - tightID = (nemf<0.90 && (npr - cm)>2 ); - } - else { - looseID = (nemf<0.90 && (npr - cm)>10 ); - tightID = (nemf<0.90 && (npr - cm)>10 ); - } - - // https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetID - - //OLD JET IDs, - // bool looseID = (nhf<0.99 && nemf<0.99 && npr>1 && muf<0.8) && ((fabs(eta) <= 2.4 && chf>0 && cm>0 && cemf<0.99) || fabs(eta)>2.4); - // bool tightID = (nhf<0.90 && nemf<0.90 && npr>1 && muf<0.8) && ((fabs(eta)<=2.4 && chf>0 && cm>0 && cemf<0.90) || fabs(eta)>2.4); - - qcdpfjetchs.setLooseID(looseID); - qcdpfjetchs.setTightID(tightID); - qcdpfjetchs.setFrac(chf,nhf,nemf,cemf,muf); - qcdpfjetchs.setMulti(npr,chm,nhm,phm,elm,mum,cm); - qcdpfjetchs.setHFFrac(hf_hf,hf_phf); - qcdpfjetchs.setHFMulti(hf_hm,hf_phm); - - - double hof = i_pfjetchs->hoEnergyFraction(); // Juska - qcdpfjetchs.setVtxInfo(mpuTrk,mlvTrk,mjtTrk); - qcdpfjetchs.setHO(hof); - - /* - double TCHE = i_pfjetchs->bDiscriminator("trackCountingHighEffBJetTags"); - double TCHP = i_pfjetchs->bDiscriminator("trackCountingHighPurBJetTags"); - double TCHEpf = i_pfjetchs->bDiscriminator("pfTrackCountingHighEffBJetTags"); - double TCHPpf = i_pfjetchs->bDiscriminator("pfTrackCountingHighPurBJetTags"); - - double SoftMuonTagByIP = i_pfjetchs->bDiscriminator("softPFMuonByIP3dBJetTags"); - double SoftElectronTagByIP = i_pfjetchs->bDiscriminator("softPFElectronByIP3dBJetTags"); - double SoftMuonTag = i_pfjetchs->bDiscriminator("softPFMuonBJetTags"); - double SoftElectronTag = i_pfjetchs->bDiscriminator("softPFElectronBJetTags"); - - double SimpleSecVertexHE = i_pfjetchs->bDiscriminator("simpleSecondaryVertexHighEffBJetTags"); - double SimpleSecVertexHP = i_pfjetchs->bDiscriminator("simpleSecondaryVertexHighPurBJetTags"); - double SimpleSecVertexHEpf = i_pfjetchs->bDiscriminator("pfSimpleSecondaryVertexHighEffBJetTags"); - double SimpleSecVertexHPpf = i_pfjetchs->bDiscriminator("pfSimpleSecondaryVertexHighPurBJetTags"); - - double CSV = i_pfjetchs->bDiscriminator("combinedSecondaryVertexBJetTags"); - double CSVpf = i_pfjetchs->bDiscriminator("pfCombinedSecondaryVertexBJetTags"); - double CinclSVpf = i_pfjetchs->bDiscriminator("pfCombinedInclusiveSecondaryVertexBJetTags"); - double CMVApf = i_pfjetchs->bDiscriminator("pfCombinedMVABJetTags"); - double CSVSoftLeptonpf = i_pfjetchs->bDiscriminator("pfCombinedSecondaryVertexSoftLeptonBJetTags"); - */ - double CSVpfPositive = i_pfjetchs->bDiscriminator("pfPositiveCombinedSecondaryVertexV2BJetTags"); - double CSVpfNegative = i_pfjetchs->bDiscriminator("pfNegativeCombinedSecondaryVertexV2BJetTags"); - - double pfBoostedDoubleSecondaryVertex = i_pfjetchs->bDiscriminator("pfBoostedDoubleSecondaryVertexAK8BJetTags"); - //C taggers - // - double pfCombinedCvsL = i_pfjetchs->bDiscriminator("pfCombinedCvsLJetTags"); - double pfCombinedCvsB = i_pfjetchs->bDiscriminator("pfCombinedCvsBJetTags"); - - // 'negativeDeepFlavourJetTags:probbb', - // 'deepFlavourJetTags:probudsg', - // 'negativeDeepFlavourJetTags:probcc', - // 'positiveDeepFlavourJetTags:probbb', 'deepFlavourJetTags:probcc', - // 'positiveDeepFlavourJetTags:probc', - // 'negativeDeepFlavourJetTags:probc', 'negativeDeepFlavourJetTags:probb', - // 'pfNegativeCombinedCvsBJetTags', - // 'negativeOnlyJetBProbabilityBJetTags', - // 'pfTrackCountingHighEffBJetTags', - // 'negativeDeepFlavourJetTags:probudsg', - // 'softPFMuonByIP2dBJetTags', - // 'deepFlavourJetTags:probbb', - // 'positiveDeepFlavourJetTags:probb', - // 'deepFlavourJetTags:probb', - // 'deepFlavourJetTags:probc', 'positiveDeepFlavourJetTags:probudsg', - // 'positiveDeepFlavourJetTags:probcc' - - float DeepCSVb = i_pfjetchs->bDiscriminator("deepFlavourJetTags:probb"); - float DeepCSVc = i_pfjetchs->bDiscriminator("deepFlavourJetTags:probc"); - float DeepCSVl = i_pfjetchs->bDiscriminator("deepFlavourJetTags:probudsg"); - float DeepCSVbb = i_pfjetchs->bDiscriminator("deepFlavourJetTags:probbb"); - float DeepCSVcc = i_pfjetchs->bDiscriminator("deepFlavourJetTags:probcc"); - float DeepCSVbN = i_pfjetchs->bDiscriminator("negativeDeepFlavourJetTags:probb"); - float DeepCSVcN = i_pfjetchs->bDiscriminator("negativeDeepFlavourJetTags:probc"); - float DeepCSVlN = i_pfjetchs->bDiscriminator("negativeDeepFlavourJetTags:probudsg"); - float DeepCSVbbN = i_pfjetchs->bDiscriminator("negativeDeepFlavourJetTags:probbb"); - float DeepCSVccN = i_pfjetchs->bDiscriminator("negativeDeepFlavourJetTags:probcc"); - float DeepCSVbP = i_pfjetchs->bDiscriminator("positiveDeepFlavourJetTags:probb"); - float DeepCSVcP = i_pfjetchs->bDiscriminator("positiveDeepFlavourJetTags:probc"); - float DeepCSVlP = i_pfjetchs->bDiscriminator("positiveDeepFlavourJetTags:probudsg"); - float DeepCSVbbP = i_pfjetchs->bDiscriminator("positiveDeepFlavourJetTags:probbb"); - float DeepCSVccP = i_pfjetchs->bDiscriminator("positiveDeepFlavourJetTags:probcc"); - - - //the three recommended - - double pfJetProbabilityBJetTags=i_pfjetchs->bDiscriminator("pfJetProbabilityBJetTags"); - double pfCombinedInclusiveSecondaryVertexV2BJetTags= i_pfjetchs->bDiscriminator("pfCombinedInclusiveSecondaryVertexV2BJetTags"); - double pfCombinedMVAV2BJetTags=i_pfjetchs->bDiscriminator("pfCombinedMVAV2BJetTags"); - - float partonFlavour=-100; - float hadronFlavour=-100; - - if (mIsMCarlo && mUseGenInfo) { - partonFlavour = i_pfjetchs->partonFlavour(); - hadronFlavour = i_pfjetchs->hadronFlavour(); - } - - qcdpfjetchs.setFlavour(partonFlavour,hadronFlavour); - - float QGTagger=-100; - - if(mAK4){ - QGTagger = i_pfjetchs->userFloat("QGTaggerAK4PFCHS:qgLikelihood"); - } - - - - //Filling B-tag infos - //qcdpfjetchs.setTCHETag(TCHE,TCHP,TCHEpf,TCHPpf); - //qcdpfjetchs.setSoftLeptonTag(SoftMuonTagByIP,SoftElectronTagByIP,SoftMuonTag,SoftElectronTag); - //qcdpfjetchs.setSimpleSecondaryVertexTag(SimpleSecVertexHE,SimpleSecVertexHP,SimpleSecVertexHEpf,SimpleSecVertexHPpf); - //qcdpfjetchs.setCombinedSecondaryVertexTag(CSV,CSVpf,CinclSVpf,CSVSoftLeptonpf,CMVApf); - qcdpfjetchs.setPositiveNegativeCSV(CSVpfPositive,CSVpfNegative); - qcdpfjetchs.setTagRecommended(pfJetProbabilityBJetTags,pfCombinedInclusiveSecondaryVertexV2BJetTags,pfCombinedMVAV2BJetTags); - qcdpfjetchs.setDeepCSV(DeepCSVb, DeepCSVc, DeepCSVl, DeepCSVbb, DeepCSVcc, - DeepCSVbN, DeepCSVcN, DeepCSVlN, DeepCSVbbN, DeepCSVccN, - DeepCSVbP, DeepCSVcP, DeepCSVlP, DeepCSVbbP, DeepCSVccP); - - qcdpfjetchs.setQGTagger(QGTagger); - qcdpfjetchs.setBoosted(pfBoostedDoubleSecondaryVertex); - qcdpfjetchs.setCTagger(pfCombinedCvsL,pfCombinedCvsB); - - float pileupJetId = -999; - if ( i_pfjetchs->hasUserFloat(pfchsjetpuid) ) { pileupJetId = i_pfjetchs->userFloat(pfchsjetpuid);} - qcdpfjetchs.SetPUJetId(pileupJetId); - - if (mIsMCarlo) { - GenJetCollection::const_iterator i_matchedchs; - float rmin(999); - for(GenJetCollection::const_iterator i_gen = genjets->begin(); i_gen != genjets->end(); i_gen++) { - double deltaR = reco::deltaR(*i_pfjetchs,*i_gen); - if (deltaR < rmin) { - rmin = deltaR; - i_matchedchs = i_gen; - } - } - if (genjets->size() == 0) { - LorentzVector tmpP4(0.0,0.0,0.0,0.0); - qcdpfjetchs.setGen(tmpP4,0); - } - else - qcdpfjetchs.setGen(i_matchedchs->p4(),rmin); - } // if (mIsMCarlo) - else { - LorentzVector tmpP4(0.0,0.0,0.0,0.0); - qcdpfjetchs.setGen(tmpP4,0); - } - if (qcdpfjetchs.pt() >= mMinPFPt) - mPFJetsCHS.push_back(qcdpfjetchs); - - - } // if(i_pfjetchs->isPFJet() ) - } // for(edm::View::const_iterator i_pfjetchs=patjetschs->begin(); i_pfjetchs!=patjetschs->end(); ++i_pfjetchs) - - - //---------------- met --------------------------------------------- - Handle pfmet; - event.getByToken(mPFMET, pfmet); - const pat::MET &met = pfmet->front(); - mPFMet.setVar(met.et(),met.sumEt(),met.phi()); - - - //-------------- fill the tree ------------------------------------- - sort(mPFJets.begin(),mPFJets.end(),sort_pfjets); - mEvent->setEvtHdr(mEvtHdr); - //mEvent->setPFJets(mPFJets); - mEvent->setPFJetsCHS(mPFJetsCHS); // -- later substitute chs jets - mEvent->setGenJets(mGenJets); - mEvent->setGenFlavour(GenFlavour); - mEvent->setGenHadronFlavour(GenHadronFlavour); - mEvent->setPFMET(mPFMet); - mEvent->setL1Obj(mL1Objects); - mEvent->setHLTObj(mHLTObjects); - if ((mEvent->nPFJetsCHS() >= (unsigned)mMinNPFJets) ) { - if ((mEvent->pfchsmjjcor(0) >= mMinJJMass) ) { - // cout<<"Feeling tree ----"<Fill(); - } - } - //if (mPFPayloadName != "") { - //delete mPFUnc; - //delete mPFUncSrc; - //} - -} - - -/////////////// Matching Flavour /////////////////////////////// - -int ProcessedTreeProducerBTag::getMatchedPartonGen(edm::Event const& event,GenJetCollection::const_iterator i_gen) -{ - - int jetFlavour=-100; - bool switchB=0; - bool switchC=0; - - edm::Handle genParticles; - event.getByToken(mgenParticles, genParticles); - - for (size_t i = 0; i < genParticles->size (); ++i) { - const GenParticle & genIt = (*genParticles)[i]; - int pdgId = genIt.pdgId(); - double DeltaR=deltaR(genIt.p4().eta(),genIt.p4().phi(),i_gen->eta(),i_gen->phi()); - double DeltaRmin=0.3; - if (DeltaR < DeltaRmin ){ - - DeltaRmin=DeltaR; - if(abs(pdgId)==5){ jetFlavour=5; switchB=true;} - if(abs(pdgId)==4){ jetFlavour=4; switchC=true;} - if(abs(pdgId)<=3 && abs(pdgId)>=1){ jetFlavour=1; } - if(abs(pdgId)==21){ jetFlavour=21; } - } - - if (switchB) {jetFlavour=5;} - if (switchC && !switchB) {jetFlavour=4;} - - } - - return jetFlavour; - -} - -int ProcessedTreeProducerBTag::getMatchedHadronGen(edm::Event const& event,GenJetCollection::const_iterator i_gen) -{ - - int jetFlavour=-100; - - edm::Handle genParticles; - event.getByToken(mgenParticles, genParticles); - - for (size_t i = 0; i < genParticles->size (); ++i) { - const GenParticle & genIt = (*genParticles)[i]; - - int aid = abs(genIt.pdgId()); - if (aid/100 == 5 || aid/1000==5) { - // 2J+1 == 1 (mesons) or 2 (baryons) - if (aid%10 == 1 || aid%10 == 2) { - // No B decaying to B - if (aid != 5222 && aid != 5112 && aid != 5212 && aid != 5322) { - double DeltaR=deltaR(genIt.p4().eta(),genIt.p4().phi(),i_gen->eta(),i_gen->phi()); - if(sqrt(DeltaR)<0.5){ - jetFlavour=5; - } - else jetFlavour=21; - } - } - } - } - - return jetFlavour; -} - - -////////////////////////////////////////////////////////////////////////////////////////// -ProcessedTreeProducerBTag::~ProcessedTreeProducerBTag() -{ - -} - -DEFINE_FWK_MODULE(ProcessedTreeProducerBTag); +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Common/interface/TriggerNames.h" +#include "FWCore/Common/interface/TriggerResultsByName.h" + +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/HLTReco/interface/TriggerEvent.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/PatCandidates/interface/Jet.h" +#include "DataFormats/PatCandidates/interface/JetCorrFactors.h" +#include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h" +#include "DataFormats/PatCandidates/interface/PackedTriggerPrescales.h" +#include "DataFormats/PatCandidates/interface/MET.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" +#include "DataFormats/PatCandidates/interface/PackedGenParticle.h" +#include "DataFormats/JetReco/interface/Jet.h" +#include "DataFormats/JetReco/interface/PFJet.h" +#include "DataFormats/JetReco/interface/PFJetCollection.h" +#include "DataFormats/JetReco/interface/GenJet.h" +#include "DataFormats/JetReco/interface/GenJetCollection.h" +#include "DataFormats/JetReco/interface/JetExtendedAssociation.h" +#include "DataFormats/JetReco/interface/JetID.h" +#include "DataFormats/METReco/interface/HcalNoiseSummary.h" +#include "DataFormats/BeamSpot/interface/BeamSpot.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/L1Trigger/interface/BXVector.h" +#include "DataFormats/L1Trigger/interface/Jet.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" + +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" + +#include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" +#include "SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h" +#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" +#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h" +#include "SimDataFormats/JetMatching/interface/JetFlavourInfo.h" +#include "SimDataFormats/JetMatching/interface/JetFlavourInfoMatching.h" +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" + +#include "JetMETCorrections/Objects/interface/JetCorrector.h" +#include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h" + +#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h" +#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h" + +#include "PhysicsTools/PatUtils/interface/bJetSelector.h" +#include "PhysicsTools/PatExamples/interface/BTagPerformance.h" +#include "PhysicsTools/PatExamples/interface/PatBTagCommonHistos.h" + +#include "SMPJ/AnalysisFW/interface/QCDJet.h" +#include "SMPJ/AnalysisFW/interface/QCDEvent.h" +#include "SMPJ/AnalysisFW/interface/QCDEventHdr.h" +#include "SMPJ/AnalysisFW/interface/QCDPFJet.h" +#include "SMPJ/AnalysisFW/interface/QCDMET.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "TTree.h" +#include +#include +#include +#include +#include + +using std::cout; +using std::endl; +using std::vector; +using std::string; +// Some compilers do not automatically understand this. +using std::size_t; + +class ProcessedTreeProducerBTag : public edm::EDAnalyzer +{ +public: + using LorentzVector = reco::Particle::LorentzVector; + // Public functions for the ED analyzer + explicit ProcessedTreeProducerBTag(edm::ParameterSet const& cfg); + virtual void beginRun(edm::Run const &, edm::EventSetup const& iSetup); + virtual void analyze(edm::Event const& evt, edm::EventSetup const& iSetup); + void beginJob() { + // Generic boolean indicators + mSatisfactory = true; + mNewTrigs = false; + mRedoPhysDef = false; + mRedoAlgoDef = false; + if (mIsMCarlo) { + if (mMCType==1) { // Herwig++ + if (mRunYear=="2016") { + mRedoPhysDef = true; + mRedoAlgoDef = true; + } + } + } + } + void endJob() { cout << "Happily finished processing! :)" << endl; } + void beginLuminosityBlock(edm::LuminosityBlock const& iLumi, edm::EventSetup const& set) { + if (mIsMCarlo and mMCType==0) { + edm::Handle header; + iLumi.getByToken(mLumiHeaderToken_, header); + cout << header->configDescription() << endl; + const auto &lheHead = header->lheHeaders(); + for (const auto &head : lheHead) cout << " " << head.first << " " << head.second << endl; + + const auto &wNames = header->weightNames(); + for (const auto &wn : wNames) mPSWeightHisto->Fill(wn.c_str(),1); + } + } + + ~ProcessedTreeProducerBTag() {} +private: + // Configurable parameters + bool mSaveWeights; // Not to be set by the user + bool mAK4; + bool mZB; + bool mPrintTriggerMenu; + bool mIsPFJecUncSet; // Not to be set by the user + int mGoodVtxNdof; + double mGoodVtxZ; + unsigned int mMinNPFJets; + double mMinPFPt,mMinPFPtThirdJet,mMinGenPt,mMaxEta; + string mPFPayloadName; + string mRunYear; + string mPFJetPUID; + bool mSatisfactory; + + // unc file for CHS jet + string mPFJECUncSrc; + vector mPFJECUncSrcNames; + edm::EDGetTokenT mOfflineVertices; + edm::EDGetTokenT mBeamSpot; + edm::EDGetTokenT > mPFJetsName; + edm::EDGetTokenT mSrcCaloRho; + edm::EDGetTokenT mSrcPFRho; + // MET // + edm::EDGetTokenT mPFMETt1; + // GEN // + bool mIsMCarlo; + bool mUseGenInfo; + bool mNewTrigs; + int mMCType; + edm::EDGetTokenT mGenJetsName; + edm::EDGetTokenT mGenParticles; + edm::Handle mGenParts; + edm::EDGetTokenT mEventInfo; + edm::EDGetTokenT > mSrcPU; + edm::EDGetTokenT mJetFlavourInfosToken; + edm::EDGetTokenT mJetFlavourInfosTokenPhysicsDef; + edm::EDGetTokenT> mQGLToken; + edm::EDGetTokenT> mQGAx2Token; + edm::EDGetTokenT> mQGMulToken; + edm::EDGetTokenT> mQGPtDToken; + + edm::InputTag mGenEventSrc_; + edm::EDGetTokenT mGenEventToken_; + edm::EDGetTokenT mLumiHeaderToken_; + + edm::InputTag mLHEEventSrc_; + edm::EDGetTokenT mLHEEventToken_; + edm::EDGetTokenT mLHEInfoToken_; + + // TRIGGER & FILTER // + bool mDiscardFilter; + bool mTrigSimple; + bool mTrigObjs; + bool mFilterPAT; + int mFilterEcalBad; + vector mFilterMissing; + const vector mFilterNames; + vector mFilterIndex; + edm::EDGetTokenT mFilterBitEcal; + edm::EDGetTokenT mFilterBitsRECO; + edm::EDGetTokenT mFilterBitsPAT; + const vector mTriggerNames; + const vector mTriggerNamesFlw; + map> mTriggerNamesMap; + map mTriggerNamesIndexMap; + vector mTriggerIndex; + vector mTriggerIndexFlw; + map> mTriggerIndexMap; + edm::EDGetTokenT mTriggerBits; + edm::EDGetTokenT mTriggerHLTObjs; + edm::EDGetTokenT > mTriggerL1Objs; + edm::EDGetTokenT > mTriggerL1HTObjs; + edm::EDGetTokenT mTriggerPrescales; + edm::EDGetTokenT mTriggerPrescalesL1Min; + edm::EDGetTokenT mTriggerPrescalesL1Max; + // CORRECTORS // + JetCorrectionUncertainty *mPFUnc; + vector mPFUncSrc; + // MISC // + edm::EDGetTokenT mHBHENoiseFilterResultNoMinZLabel; + edm::EDGetTokenT mCands; + HLTConfigProvider mHLTConfig; + HLTPrescaleProvider mHLTPrescale; + + edm::Service fs; + TTree *mTree; + TH1F *mTriggerPassHisto,*mTriggerNamesHisto,*mFilterActiveHisto,*mPSWeightHisto; + QCDEvent *mEvent; + + vector mGenFlavour; + vector mGenFlavourHadr; + vector mGenFlavourPhys; + vector mGenBPt; + vector mGenJets; + map mGenJetPhysFlav; + map mGenJetAlgoFlav; + + bool mRedoPhysDef; + bool mRedoAlgoDef; + + // Private functions for various purposes + bool trigUpdate(const vector &tNames, vector &tIndex, bool active); + bool trigCheck(const edm::TriggerNames &names, const vector &tNames, vector &tIndex, bool active); + + // Sort the QCDPFJet collection according to pt + static bool sort_pfjets(QCDPFJet j1, QCDPFJet j2) { return j1.ptCor() > j2.ptCor(); } + + // Search for the index of the given pt, genjets + unsigned gen_ptpos(double pt, unsigned blw, unsigned abv) { + unsigned nxt = (abv+blw)/2; + if (nxt==blw) return nxt; + double nxtpt = mGenJets[nxt].pt(); + if (nxtpt<=pt) return gen_ptpos(pt,blw,nxt); + else return gen_ptpos(pt,nxt,abv); + } + + bool is_bhadr(int pdgid) { + int aid = abs(pdgid); + if (aid/100 == 5 or aid/1000==5) { + return true; + } + return false; + } + + // Find the gen jet best matching to the current jet + template + pair best_genjet(const T &jet) { + int imin = -1; + float rmin = 999.; + + int limit = mGenJets.size(); + if (limit>0) { + float ratiouplim = (jet.pt()>20 ? 1.5 : 5.0); + float ratiololim = (jet.pt()>20 ? 0.4 : 0.2); + // Find approximately the closest pt and then iterate up and down + // If a good match is found, iteration stops + int dwn = (jet.pt()>20 ? gen_ptpos(jet.pt(),0,limit-1) : limit-1); + int up = dwn+1; + // Iterate the pt-ordered genjet set up & down + while (dwn>=0 or up=0) { + if ((mGenJets[dwn].pt())/(jet.pt())ratiololim) { + float deltaR = reco::deltaR(jet,mGenJets[up]); + if (deltaR < rmin) { + imin = up; + rmin = deltaR; + if (rmin<0.2) break; // Stop if the delta R match is good enough + } + ++up; + } else { + // Ignore the "up" end when we reach the pt threshold + up = limit; + } + } + } + } + return make_pair(imin,rmin); + } + + // Find the gen jet best matching to the current jet + template + pair best_jet4prtn(const T &prtn) { + int imin = -1; + float rmin = 999.; + + // Iterate the pt-ordered genjet set up & down + for (unsigned igen = 0; igen < mGenJets.size(); ++igen) { + float deltaR = reco::deltaR(prtn,mGenJets[igen]); + if (deltaR hpParts; + for (unsigned i = 0; isize(); ++i) { + if (hpParts.size()==2) break; + const auto &gPart = mGenParts->at(i); + int id = gPart.pdgId(); + int absId = abs(id); + if (absId>10 and absId!=21) continue; // Non-partons + if (fabs(gPart.eta())>5.0) continue; // Bad eta region + + if (mMCType==0) { // Pythia 8 + if (abs(gPart.pdgId())!=23) continue; + } else if (mMCType==1) { // Herwig++ + bool hardProc = false; + if (gPart.numberOfMothers()==1) { + auto &moths = gPart.motherRefVector(); + auto *moth = moths.at(0).get(); + if (moth!=nullptr and moth->pdgId()!=2212 and fabs(moth->eta())>10.0) hardProc = true; + } + if (!hardProc) continue; + } else { + return; + } + hpParts.push_back(i); + } + + for (auto &ihp : hpParts) { + auto &hp = mGenParts->at(ihp); + float drmin = 999.; + int imin = -1; + for (unsigned igen = 0; igen < mGenJets.size(); ++igen) { + auto &gjet = mGenJets[igen]; + float dR = reco::deltaR(gjet,hp); + if (dR jet2prtn; + for (unsigned i = 0; isize(); ++i) { + const auto &gPart = mGenParts->at(i); + int id = gPart.pdgId(); + int absId = abs(id); + if (absId>10 and absId!=21) continue; // Non-partons + if (fabs(gPart.eta())>5.0) continue; // Bad eta region + + if (mMCType!=0 and mMCType!=1) // Non- Pythia8 & Herwig++ + return; + + float drmin = 999.; + int imin = -1; + for (unsigned igen = 0; igen < mGenJets.size(); ++igen) { + auto &gjet = mGenJets[igen]; + float dR = reco::deltaR(gjet,gPart); + if (dRat(jet2prtn[imin]); + if (gPart.pt()>currBest.pt()) + jet2prtn[imin] = i; + } + } + } + for (auto &j2p : jet2prtn) { + auto &bestPrtn = mGenParts->at(j2p.second); + mGenJetAlgoFlav[j2p.first] = bestPrtn.pdgId(); + } + } +}; + +ProcessedTreeProducerBTag::ProcessedTreeProducerBTag(edm::ParameterSet const& cfg): + mSaveWeights( cfg.getParameter("saveWeights")), + mAK4( cfg.getUntrackedParameter("AK4",false)), + mZB( cfg.getUntrackedParameter("ZB",false)), + mPrintTriggerMenu( cfg.getUntrackedParameter("printTriggerMenu",false)), + mIsPFJecUncSet( false), + // Cut params + mGoodVtxNdof( cfg.getParameter("goodVtxNdof")), + mGoodVtxZ( cfg.getParameter("goodVtxZ")), + mMinNPFJets( cfg.getParameter("minNPFJets")), + mMinPFPt( cfg.getParameter("minPFPt")), + mMinPFPtThirdJet( cfg.getParameter("minPFPtThirdJet")), + mMinGenPt( cfg.getUntrackedParameter("minGenPt",20)), + mMaxEta( cfg.getParameter("maxEta")), + // Misc + mPFPayloadName( cfg.getParameter("PFPayloadName")), + mRunYear( cfg.getUntrackedParameter("runYear","2016")), + mPFJetPUID( cfg.getParameter("pfchsjetpuid")), + mPFJECUncSrc( cfg.getUntrackedParameter("jecUncSrc","")), + mPFJECUncSrcNames( cfg.getParameter >("jecUncSrcNames")), + mOfflineVertices(mayConsume( cfg.getParameter("offlineVertices"))), + mBeamSpot(mayConsume( cfg.getParameter("beamSpot"))), + mPFJetsName(consumes>( cfg.getParameter("pfjetschs"))), + // Rho + mSrcCaloRho(mayConsume( cfg.getParameter("srcCaloRho"))), + mSrcPFRho(mayConsume( cfg.getParameter("srcPFRho"))), + // MET + mPFMETt1(mayConsume( cfg.getParameter("pfmetT1"))), + // GEN + mIsMCarlo( cfg.getUntrackedParameter("isMCarlo",false)), + mUseGenInfo( cfg.getUntrackedParameter("useGenInfo",false)), + mMCType( cfg.getUntrackedParameter("mcType",0)), // 0 for Pythia, 1 for Herwig + mGenJetsName(mayConsume( cfg.getUntrackedParameter("genjets",edm::InputTag("")))), + mGenParticles(consumes( cfg.getUntrackedParameter("GenParticles",edm::InputTag("")))), + mEventInfo(consumes( cfg.getUntrackedParameter("EventInfo",edm::InputTag("")))), + mSrcPU(mayConsume >( cfg.getUntrackedParameter("srcPULabel",edm::InputTag("")))), + mJetFlavourInfosToken(consumes( cfg.getUntrackedParameter("jetFlavInfos",edm::InputTag("")))), + mJetFlavourInfosTokenPhysicsDef(consumes(cfg.getUntrackedParameter("jetFlavInfosPD",edm::InputTag("")))), + // Trigger + mDiscardFilter( cfg.getUntrackedParameter("discardFilter",true)), + mTrigSimple( cfg.getUntrackedParameter("trigSimple",false)), + mTrigObjs( cfg.getUntrackedParameter("trigObjs",false)), + mFilterNames( cfg.getParameter >("filterName")), + mFilterBitEcal(mayConsume( edm::InputTag("ecalBadCalibReducedMINIAODFilter"))), + mFilterBitsRECO(mayConsume( edm::InputTag("TriggerResults","","RECO"))), + mFilterBitsPAT(mayConsume( edm::InputTag("TriggerResults","","PAT"))), + mTriggerNames( cfg.getParameter >("triggerName")), + mTriggerNamesFlw( cfg.getParameter >("triggerFollow")), + mTriggerBits(mayConsume( edm::InputTag("TriggerResults","","HLT"))), + mTriggerHLTObjs(mayConsume( cfg.getUntrackedParameter("triggerHLTObjs",edm::InputTag("")))), + mTriggerL1Objs(mayConsume >( cfg.getUntrackedParameter("triggerL1Objs",edm::InputTag("")))), + mTriggerL1HTObjs(mayConsume >( cfg.getUntrackedParameter("triggerL1HTObjs",edm::InputTag("")))), + mTriggerPrescales(consumes( cfg.getParameter("prescales"))), + mTriggerPrescalesL1Min(consumes( cfg.getParameter("prescalesL1Min"))), + mTriggerPrescalesL1Max(consumes( cfg.getParameter("prescalesL1Max"))), + mHBHENoiseFilterResultNoMinZLabel(mayConsume( cfg.getUntrackedParameter("HBHENoiseFilterResultNoMinZLabel",edm::InputTag("")))), + mCands(mayConsume( edm::InputTag("packedPFCandidates"))), + mHLTPrescale(cfg, consumesCollector(), *this) +{ + if (mAK4) { + mQGLToken = consumes>(edm::InputTag("QGTagger", "qgLikelihood")); + mQGAx2Token = consumes>(edm::InputTag("QGTagger", "axis2")); + mQGMulToken = consumes> (edm::InputTag("QGTagger", "mult")); + mQGPtDToken = consumes>(edm::InputTag("QGTagger", "ptD")); + } + if (mIsMCarlo and mMCType==0) { + mGenEventSrc_ = edm::InputTag("generator"); + mGenEventToken_ = mayConsume (mGenEventSrc_); + mLumiHeaderToken_ = mayConsume(mGenEventSrc_); + + mLHEEventSrc_ = edm::InputTag("externalLHEProducer"); + mLHEEventToken_ = mayConsume (mLHEEventSrc_); + mLHEInfoToken_ = mayConsume(mLHEEventSrc_); + + mPSWeightHisto = fs->make("PSWeights","PSWeights",1,0,1); + mPSWeightHisto->SetBit(TH1::kUserContour); + } + + mTree = fs->make("ProcessedTree","ProcessedTree"); + mEvent = new QCDEvent(); + mTree->Branch("events","QCDEvent",&mEvent); + mTriggerNamesHisto = fs->make("TriggerNames","TriggerNames",1,0,1); + mTriggerNamesHisto->SetBit(TH1::kUserContour); + mTriggerPassHisto = fs->make("TriggerPass","TriggerPass",1,0,1); + mTriggerPassHisto->SetBit(TH1::kUserContour); + mFilterActiveHisto = fs->make("FilterActive","FilterActive",1,0,1); +} +////////////////////////////////////////////////////////////////////////////////////////// +void ProcessedTreeProducerBTag::beginRun(edm::Run const & iRun, edm::EventSetup const& iSetup) { + bool changed = true; + if (!mHLTConfig.init(iRun,iSetup,"HLT",changed) or !mHLTPrescale.init(iRun, iSetup,"HLT",changed)) { + cout << "ProcessedTreeProducerBTag::analyze: config extraction failure with process name HLT!" << endl; + return; + } + if (!changed) return; + cout << "Running on global tag " << mHLTConfig.globalTag() << "!!!" << endl; + + // Save MET filter pass information + for (auto &fName : mFilterNames) { + mFilterActiveHisto->Fill(fName.c_str(),0); + } + // As a last piece of info, we indicate if all filters are passed. + mFilterActiveHisto->Fill("PassAll",0); + + // Additional steps to be performed first time in the analysis loop! + // For MC, this means only updating MET Filter info + mNewTrigs = true; + + cout << "New trigger menu found!!!" << endl; + + // The triggers that are actively and passively monitored will be set up according to the wishes of the user. + // mTriggerNames(Flw) is the trigger name list set by the user. + // We check mHLTConfig, which triggers of these are actually present. + // Usage example for the passively monitored triggers: when AK4 and AK8 jets are saved into separate files, we still want the same events to be available in both. + mSatisfactory = mSatisfactory and trigUpdate(mTriggerNames,mTriggerIndex,true) and trigUpdate(mTriggerNamesFlw,mTriggerIndexFlw,false); + + if (mPrintTriggerMenu) { + cout << "Available TriggerNames are: " << endl; + mHLTConfig.dump("Triggers"); + } +} +////////////////////////////////////////////////////////////////////////////////////////// +bool ProcessedTreeProducerBTag::trigUpdate(const vector &tNames, vector &tIndex, bool active) { + tIndex.clear(); + const auto &hltNames = mHLTConfig.triggerNames(); + const unsigned int nHLTs = mHLTConfig.size(); + assert(hltNames.size()==nHLTs); + + if (mTrigSimple and active) { + mTriggerNamesIndexMap.clear(); + mTriggerNamesMap.clear(); + mTriggerIndexMap.clear(); + } + for (const auto &tName : tNames) { + // For active triggers, we will add the base information in any case. + if (active) { + mTriggerPassHisto->Fill(tName.c_str(),0); + mTriggerNamesHisto->Fill(tName.c_str(),0); + } + if (mTrigSimple) { + // Create a temporary string and strip the zero from the end, in order to use this with regex. + string tmpName = tName; + tmpName.pop_back(); + regex trgversions(Form("%s([0-9]*)",tmpName.c_str())); + if (tName.back()!='0' and tmpName.back()!='v') { + cout << "In the 'simpleTrigs = True' mode the trigger names should end with 'v0'! Please correct!" << endl; + return false; + } + // Loop through all the hlt names with any version number matching the generic trigger type. + int counter = 0; + for (const auto &hName : hltNames) { + if (regex_match(hName,trgversions)) { + ++counter; + if (mTriggerNamesMap.count(tName)==0) { + mTriggerNamesMap[tName] = vector(); + mTriggerIndexMap[tName] = vector(); + } + + mTriggerNamesIndexMap[hName] = tIndex.size(); + mTriggerNamesMap[tName].emplace_back(hName); + mTriggerIndexMap[tName].emplace_back(mHLTConfig.triggerIndex(hName)); + if (active) mTriggerNamesHisto->Fill(tName.c_str(),1); + cout << (active ? "Actively" : "Passively") << " monitored trigger " << hName << " " << mTriggerIndexMap[tName].back() << " exists" << endl; + } + } + tIndex.push_back(counter==0 ? -1 : counter); + } else { + unsigned tIdx = mHLTConfig.triggerIndex(tName); + bool accept = tIdx < nHLTs; + cout << (active ? "Actively" : "Passively") << " monitored trigger " << tName << " " << tIdx << " "; + cout << (accept ? "exists" : "does not exist in the current menu") << endl; + tIndex.push_back(accept ? tIdx : -1); + if (active and accept) mTriggerNamesHisto->Fill(tName.c_str(),1); + } + } + return true; +} +////////////////////////////////////////////////////////////////////////////////////////// +bool ProcessedTreeProducerBTag::trigCheck(const edm::TriggerNames &names, const vector &tNames, vector &tIndex, bool active) { + // Go trough all monitored triggers and check that these have the same names. + assert(tIndex.size()==tNames.size()); + for (auto itrig = 0u; itrig qPFJets; + QCDEventHdr qEvtHdr; + QCDMET qPFMet_t1, qPFMet_t0, qPFMet_t0t1; + + //-------------- Basic Event Info ----------------------------------- + qEvtHdr.setRun(event.id().run()); + qEvtHdr.setEvt(event.id().event()); + qEvtHdr.setLumi(event.luminosityBlock()); + qEvtHdr.setBunch(event.bunchCrossing()); + float refR = mAK4 ? 0.4 : 0.8; + + //-------------- Beam Spot ------------------------------------------ + edm::Handle beamSpot; + event.getByToken(mBeamSpot,beamSpot); + if (beamSpot.isValid()) qEvtHdr.setBS(beamSpot->x0(),beamSpot->y0(),beamSpot->z0()); + else qEvtHdr.setBS(-999,-999,-999); + + //-------------- HCAL Noise Summary --------------------------------- + if (mIsMCarlo) { + qEvtHdr.setHCALNoiseNoMinZ(true); + + if (mMCType==0) { + edm::Handle genEventInfo; + event.getByToken(mGenEventToken_, genEventInfo); + + if (genEventInfo.isValid()) { + const auto &ws = genEventInfo->weights(); + for (size_t i = 0; i < ws.size(); ++i) qEvtHdr.setPSWeight(i,ws[i]); + } + } + } else { + edm::Handle noiseSummary_NoMinZ; + event.getByToken(mHBHENoiseFilterResultNoMinZLabel, noiseSummary_NoMinZ); + qEvtHdr.setHCALNoiseNoMinZ(*noiseSummary_NoMinZ); + } + + //-------------- Filter Info ---------------------------------------- + + // Update the filter positions only when the trigger menu has changed. + // These steps cannot be taken within "beginRun", as event.triggerNames() is not available there. + if (mNewTrigs) { + //if (mIsMCarlo) mNewTrigs = false; // In data, this is set to false later. + + cout << "Found MET filters:" << endl; + mFilterPAT = false; + for (unsigned ifloc = 0; ifloc<2; ++ifloc) { + edm::Handle fBits; + if (ifloc==0) { + event.getByToken(mFilterBitsRECO,fBits); + } else { + event.getByToken(mFilterBitsPAT,fBits); + mFilterPAT = true; + } + + const edm::TriggerNames &fNames = event.triggerNames(*fBits); + mFilterMissing.clear(); + mFilterIndex.clear(); + for (unsigned fltpos = 0; fltpos < mFilterNames.size(); ++fltpos) { // Loop through the requested filter names + auto &flt = mFilterNames[fltpos]; + int fltIdx = -1; + for (unsigned int iflt=0; ifltsize(); ++iflt) { // Try to find this + string filterName = fNames.triggerName(iflt); + if (filterName==flt) { + fltIdx = iflt; + break; + } + } + mFilterIndex.push_back(fltIdx); + if (fltIdx==-1) mFilterMissing.emplace_back(fltpos); + else cout << " " << flt << " :)" << endl; + } + if (mFilterMissing.size() < mFilterNames.size()) break; + } + cout << "Using MET filters from " << (mFilterPAT ? "PAT" : "RECO") << endl; + mFilterEcalBad = -1; + if (mFilterMissing.size()>0) { + for (auto &fltpos : mFilterMissing) { + auto &flt = mFilterNames[fltpos]; + if (flt == "Flag_ecalBadCalibReducedMINIAODFilter") { + cout << "MET filter " << flt << " requires special attention." << endl; + mFilterEcalBad = fltpos; + } else { + cout << "MET filter " << flt << " missing :(" << endl; + } + } + } + } + + vector Filtered; + // Fetching data using tokens. + edm::Handle filterBits; + event.getByToken(mFilterPAT ? mFilterBitsPAT : mFilterBitsRECO,filterBits); + const edm::TriggerNames &filterNames = event.triggerNames(*filterBits); + + // Go through the filters and check that all of them are good + assert(mFilterIndex.size()==mFilterNames.size()); + bool passMET = true; + for (auto iflt = 0u; iflt=0 and iflt == abs(mFilterEcalBad)) { + // This filter needs to be fetched separately. + edm::Handle filterBitEcal; + event.getByToken(mFilterBitEcal,filterBitEcal); + reject = !(*filterBitEcal); + flt2 = "Flag_ecalBadCalibReducedMINIAODFilter"; + } else { + continue; // If a filter was not found, we skip it + } + } else { + reject = !filterBits->accept(fltIdx); + flt2 = filterNames.triggerName(fltIdx); + } + + string flt = mFilterNames[iflt]; + if (flt!=flt2) { + cout << "Mismatch in filter names: " << flt << " " << flt2 << endl; + mSatisfactory = false; + return; + } + if (reject) { + Filtered.push_back(iflt); + passMET = false; + mFilterActiveHisto->Fill(flt.c_str(),1); + } + } + // We log the knowledge that all filters have passed. This knowledge is not saved on a per-event + // basis, as an empty vector 'Filtered' already indicates that no MET filters have been active. + if (passMET) mFilterActiveHisto->Fill("PassAll",1); + // A filter is allowed to reject the event + if (mDiscardFilter and !passMET) return; + + mEvent->setFltDecision(Filtered); + + //-------------------------- Trigger Info --------------------------- + edm::Handle triggerBits; + event.getByToken(mTriggerBits,triggerBits); + const edm::TriggerNames &names = event.triggerNames(*triggerBits); + + vector L1Prescales, HLTPrescales, Fired; + map > vvHLT; + + // Fetching prescales + edm::Handle triggerPrescales; + event.getByToken(mTriggerPrescales, triggerPrescales); + edm::Handle triggerPrescalesL1Min; + event.getByToken(mTriggerPrescalesL1Min, triggerPrescalesL1Min); + edm::Handle triggerPrescalesL1Max; + event.getByToken(mTriggerPrescalesL1Max, triggerPrescalesL1Max); + + // When the triggers are changed, check that the info we got from hltConfig matches with that from event.triggerNames + if (mNewTrigs) { + mNewTrigs = false; + if ((!trigCheck(names,mTriggerNames,mTriggerIndex,true) or !trigCheck(names,mTriggerNamesFlw,mTriggerIndexFlw,false))) { + mSatisfactory = false; + return; + } + } + + // Trigger counts + unsigned fire = 0; + // Primary triggers + for (auto itrig = 0u; itrigaccept(tIdx2)) { + L1Prescales.push_back(max(triggerPrescalesL1Max->getPrescaleForIndex(tIdx2),triggerPrescalesL1Min->getPrescaleForIndex(tIdx2))); + HLTPrescales.push_back(triggerPrescales->getPrescaleForIndex(tIdx2)); + mTriggerPassHisto->Fill(tName.c_str(),1); + Fired.push_back(itrig); + ++fire; + if (mTrigObjs and vvHLT.find(tName)==vvHLT.end()) vvHLT[tName] = vector(); + } + } + } else { + if (triggerBits->accept(tIdx)) { + L1Prescales.push_back(max(triggerPrescalesL1Max->getPrescaleForIndex(tIdx),triggerPrescalesL1Min->getPrescaleForIndex(tIdx))); + HLTPrescales.push_back(triggerPrescales->getPrescaleForIndex(tIdx)); + mTriggerPassHisto->Fill(tName.c_str(),1); + Fired.push_back(itrig); + ++fire; + if (mTrigObjs and vvHLT.find(tName)==vvHLT.end()) vvHLT[tName] = vector(); + } + } + } + + // When the primary trigger has not fired, check if a "followed" secondary trigger has fired + if (fire==0) { + bool nofireoth = true; + for (auto itrig = 0u; itrigaccept(tIdx2)) { + nofireoth = false; + break; + } + } + if (!nofireoth) break; + } else { + if (triggerBits->accept(tIdx)) { + nofireoth = false; + break; + } + } + } + // If none of the actively/passively monitored triggers have fired, skip this as a redundant event + if (nofireoth) return; + } // Primary trigger not fired + + // Saving the info to the event + mEvent->setTrigDecision(Fired); + mEvent->setPrescales(L1Prescales,HLTPrescales); + + //-------------- Trigger Object Info (exlusively Data) --------------- + // The trigger objects are saved only when the actively monitored trigger has fired (in ZB events we pay no attention) + if (mTrigObjs and !mIsMCarlo and !mZB and fire>0) { + vector > qL1Objs, qHLTObjs; + + // Fetching data using tokens. + edm::Handle triggerHLTObjs; + event.getByToken(mTriggerHLTObjs, triggerHLTObjs); + edm::Handle > triggerL1Objs; + event.getByToken(mTriggerL1Objs, triggerL1Objs); + edm::Handle > triggerL1HTObjs; + event.getByToken(mTriggerL1HTObjs, triggerL1HTObjs); + + // HLT sector + regex pfjet(Form("HLT_%sPFJet([0-9]*)_v([0-9]*)",mAK4 ? "" : "AK8")); + for (pat::TriggerObjectStandAlone obj : *triggerHLTObjs) { // note: not "const &" since we want to call unpackPathNames + obj.unpackPathNames(names); + vector pathNamesAll = obj.pathNames(false); + vector pathNamesLast = obj.pathNames(true); + if (pathNamesAll.size()==0) continue; + + for (unsigned hpn = 0, npn = pathNamesAll.size(); hpn < npn; ++hpn) { + string tName = pathNamesAll[hpn]; + if (regex_match(tName,pfjet)) { + TLorentzVector P4; + P4.SetPtEtaPhiM(obj.pt(),obj.eta(),obj.phi(),obj.mass()); + string refName = tName; + if (mTrigSimple) { + if (mTriggerNamesIndexMap.count(tName)==0) { + cout << "Trigger name not found in trigger name map!" << endl; + mSatisfactory = false; + return; + } + unsigned refIdx = mTriggerNamesIndexMap[tName]; + if (refIdx vvL1; + for (auto obj = triggerL1Objs->begin(0); obj != triggerL1Objs->end(0); ++obj) { + TLorentzVector P4; + P4.SetPtEtaPhiM(obj->pt(),obj->eta(),obj->phi(),obj->mass()); + vvL1.emplace_back(P4.Px(),P4.Py(),P4.Pz(),P4.E()); + } + qL1Objs.push_back(vvL1); + + mEvent->setL1Obj(qL1Objs); + mEvent->setHLTObj(qHLTObjs); + } // !mIsMCarlo mTrigObjs and !mZB + + //-------------- Vertex Info ---------------------------------------- + edm::Handle recVtxs; + event.getByToken(mOfflineVertices,recVtxs); + + //------------- reject events without reco vertices ----------------- + int VtxGood(0); + bool isPVgood(false); + float PVx(0),PVy(0),PVz(0),PVndof(0); + for (auto ivtx = recVtxs->begin(); ivtx != recVtxs->end(); ++ivtx) { + int index = ivtx-recVtxs->begin(); + if (index == 0) { + PVx = ivtx->x(); + PVy = ivtx->y(); + PVz = ivtx->z(); + PVndof = ivtx->ndof(); + } + if (!(ivtx->isFake()) and ivtx->ndof() >= mGoodVtxNdof and fabs(ivtx->z()) <= mGoodVtxZ) { + if (index == 0) isPVgood = true; + ++VtxGood; + } + } + qEvtHdr.setVertices(recVtxs->size(),VtxGood); + qEvtHdr.setPV(isPVgood,PVndof,PVx,PVy,PVz); + + //-------------- Rho ------------------------------------------------ + edm::Handle rhoCalo; + event.getByToken(mSrcCaloRho,rhoCalo); + edm::Handle rhoPF; + event.getByToken(mSrcPFRho,rhoPF); + qEvtHdr.setRho(*rhoCalo,*rhoPF); + + //-------------- Generator (incl. simulated PU) Info ---------------- + if (mIsMCarlo and mUseGenInfo) { + edm::Handle hEventInfo; + edm::Handle > PupInfo; + event.getByToken(mEventInfo, hEventInfo); + if (hEventInfo->hasBinningValues()) qEvtHdr.setPthat(hEventInfo->binningValues()[0]); + else qEvtHdr.setPthat(0); + + qEvtHdr.setWeight(hEventInfo->weight()); + event.getByToken(mSrcPU, PupInfo); + int nbx = PupInfo->size(); + int ootpuEarly(0),ootpuLate(0),intpu(0); + float Tnpv = 0.; // new variable for computing pileup weight factor for the event + + for(auto PUI = PupInfo->begin(); PUI != PupInfo->end(); ++PUI) { + if (PUI->getBunchCrossing() < 0) { + ootpuEarly += PUI->getPU_NumInteractions(); + } else if (PUI->getBunchCrossing() > 0) { + ootpuLate += PUI->getPU_NumInteractions(); + } else { + intpu += PUI->getPU_NumInteractions(); + Tnpv += PUI->getTrueNumInteractions(); + } + } + qEvtHdr.setPU(nbx,ootpuEarly,ootpuLate,intpu); + qEvtHdr.setTrPu(Tnpv); + } else { + qEvtHdr.setPthat(0); + qEvtHdr.setWeight(0); + qEvtHdr.setPU(0,0,0,0); + qEvtHdr.setTrPu(0); + } + mEvent->setEvtHdr(qEvtHdr); + + //---------------- GenJets ------------------------------------------ + if (mIsMCarlo) { + // Setting up handy handles + edm::Handle genJets; + event.getByToken(mGenJetsName,genJets); + edm::Handle theJetFlavourInfos; + event.getByToken(mJetFlavourInfosToken, theJetFlavourInfos ); + edm::Handle theJetFlavourInfosPhys; + event.getByToken(mJetFlavourInfosTokenPhysicsDef, theJetFlavourInfosPhys ); + event.getByToken(mGenParticles, mGenParts); + // Genjet loop + auto igen = genJets->begin(); + auto j = theJetFlavourInfos->begin(); + auto k = theJetFlavourInfosPhys->begin(); + mGenJets.clear(); + mGenFlavour.clear(); + mGenFlavourHadr.clear(); + mGenFlavourPhys.clear(); + mGenBPt.clear(); + for (;igen!=genJets->end() and j!=theJetFlavourInfos->end() and k!=theJetFlavourInfosPhys->end();++igen,++j,++k) { + if (fabs(igen->eta()) > mMaxEta) continue; + + auto aInfo = j->second; + auto bInfo = k->second; + + mGenJets.push_back(igen->p4()); + mGenFlavour.push_back(aInfo.getPartonFlavour()); + mGenFlavourHadr.push_back(aInfo.getHadronFlavour()); + mGenFlavourPhys.push_back(bInfo.getPartonFlavour()); + } + map jet2bpt; + // Loop through all prunder particles and then the jets + for (auto gidx = 0u; gidx < mGenParts->size(); ++gidx) { + auto &gPart = mGenParts->at(gidx); + int absId = abs(gPart.pdgId()); + if (absId<100) continue; + if (is_bhadr(absId)) { + int imin = -1; + float rmin = -1.; + std::tie(imin,rmin) = best_jet4prtn(gPart); + if (rmin PFJetCorParColl; + if (mPFPayloadName != "" and !mIsPFJecUncSet) { + iSetup.get().get(mPFPayloadName,PFJetCorParColl); + JetCorrectorParameters const& PFJetCorPar = (*PFJetCorParColl)["Uncertainty"]; + mPFUnc = new JetCorrectionUncertainty(PFJetCorPar); + if (mPFJECUncSrc != "") { + for(unsigned isrc=0;isrc > patJets; + event.getByToken(mPFJetsName,patJets); + // PF Candidates (for beta calculus) + edm::Handle cands; + event.getByToken(mCands, cands); + + // Partons within the jet + vector< vector > jet2pu; + if (mAK4) { + for (auto jet=patJets->begin(); jet!=patJets->end(); ++jet) jet2pu.emplace_back(vector()); + + // Pick the PF candidates removed by CHS (fromPV==0) + for (auto cidx = 0u; cidxsize(); ++cidx) { + auto &c = cands->at(cidx); + if (c.fromPV()!=0) continue; + float dRMin = 999.; + int bestjet = -1; + // Find the jet that best matches this candidate + for (auto ijet=patJets->begin(); ijet!=patJets->end(); ++ijet) { + float dR = reco::deltaR(*ijet,c); + if (dRbegin(); + } + } + // If the candidate is closer than the jet radius to the jet axis, this is a PU particle for the selected jet + if (dRMin> qglHandle, qgax2Handle, qgptdHandle; + edm::Handle> qgmulHandle; + if (mAK4) { + event.getByToken(mQGLToken, qglHandle); + event.getByToken(mQGAx2Token, qgax2Handle); + event.getByToken(mQGMulToken, qgmulHandle); + event.getByToken(mQGPtDToken, qgptdHandle); + } + + // Jet loop + int maxGenMatch = -1; + for (auto ijet=patJets->begin(); ijet!=patJets->end(); ++ijet) { + // Preselection + if (!ijet->isPFJet()) continue; + if (fabs(ijet->eta()) > mMaxEta) continue; + int jetNo = int(ijet-patJets->begin()); + if (ijet->pt() < (jetNo<=2 ? mMinPFPtThirdJet : mMinPFPt)) continue; + double scale = 1./(ijet->jecSetsAvailable() ? ijet->jecFactor(0) : 1.); + + // Keep track of pt and energy for PU stuff + //double che = 0.0, poe = 0.0; + double pue = 0.0; + // Track parameters by Juska. Not-so-useful for chs jets. + int mpuTrk(0), mlvTrk(0), mjtTrk(0); // # of pile-up tracks & lead-vertex tracks & all tracks ## Juska + + if (mAK4) { + // Loop through the PF candidates within the jet. + //vector used; + for (auto pidx = 0u; pidx < ijet->numberOfDaughters(); ++pidx) { + auto dtr = dynamic_cast(ijet->daughter(pidx)); + if (dtr->charge()!=0) { + //che += dtr->energy(); + + ++mjtTrk; + if (dtr->fromPV()==0) { + // Note: dtr->pvAssociationQuality() is the modern alternative, but fromPV is the one used for CHS. + // Still for some reason, not all fromPV==0 cases are removed. These events fit the old "betaStar" definition (not-from-PV). + // Due to CHS, the trailing betaStar is a vanishing fraction (1/10k), so we don't store it anymore. + //++mpuTrk; + //used.push_back(dtr->energy()); + } else { + ++mlvTrk; + } + } + } + // Loop through the pileup PF candidates within the jet. + for (auto &pidx : jet2pu[jetNo]) { + auto dtr = cands->at(pidx); + // We take the charged. candidates that have not appeared before: these were removed by CHS + if (dtr.charge()!=0) { + ++mpuTrk; + pue += dtr.energy(); + //if (std::find(used.begin(),used.end(),dtr.energy())==used.end()) + // pue += dtr.energy(); + } + } + } + + QCDPFJet qcdJet; + + // The fraction of CHS-removed PU (defined similarly as the other fractions, w.r.t. unscaled jet energy). + float bPrime = (pue/ijet->energy())*scale; + qcdJet.setBetaPrime(bPrime); + + // JEC uncertainty + double unc(0.0); + vector uncSrc(0); + if (mPFPayloadName != "") { + mPFUnc->setJetEta(ijet->eta()); + mPFUnc->setJetPt(ijet->pt()); + unc = mPFUnc->getUncertainty(true); + } + if (mPFJECUncSrc != "") { + for(unsigned isrc=0;isrcsetJetEta(ijet->eta()); + mPFUncSrc[isrc]->setJetPt(ijet->pt()); + float unc1 = mPFUncSrc[isrc]->getUncertainty(true); + uncSrc.push_back(unc1); + } + } + + qcdJet.setP4(ijet->p4()); + qcdJet.setCor(scale); + qcdJet.setUnc(unc); + qcdJet.setUncSrc(uncSrc); + qcdJet.setArea(ijet->jetArea()); + + // This is a mixture of PF specific and more generic functions. + // Not entirely logical (e.g. cemf instead of electron), + // but these are the tags used by the jet ID's. + double nhf = ijet->neutralHadronEnergyFraction(); // includes hf hadrons + double nemf = ijet->neutralEmEnergyFraction(); // = phf + hfemf + double chf = ijet->chargedHadronEnergyFraction(); // only for barrel + double cemf = ijet->chargedEmEnergyFraction(); // = elf + double muf = ijet->muonEnergyFraction(); + double hf_hf = ijet->HFHadronEnergyFraction(); + double hf_phf= ijet->HFEMEnergyFraction(); + int hf_hm = ijet->HFHadronMultiplicity(); + int hf_phm = ijet->HFEMMultiplicity(); + int chm = ijet->chargedHadronMultiplicity(); + int nhm = ijet->neutralHadronMultiplicity(); + int phm = ijet->photonMultiplicity(); + int elm = ijet->electronMultiplicity(); + int mum = ijet->muonMultiplicity(); + + float abseta = fabs(ijet->eta()); + int nm = ijet->neutralMultiplicity(); + int cm = ijet->chargedMultiplicity(); + int npr = cm + nm; + // See, https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetID + bool tightID = true; + + // For the UL campaigns, the Jet IDs are provided in a purely hard-coded format: + // https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetID13TeVUL + if (abseta <= 2.6) + tightID = cemf<0.8 and cm>0 and chf>0 and npr>1 and nemf<0.9 and muf<0.8 and nhf<0.9; + else if (abseta <= 2.7) + tightID = cemf<0.8 and cm>0 and nemf<0.99 and muf<0.8 and nhf<0.9; + else if (abseta <= 3.0) + tightID = nemf<0.99 and nemf>0.01 and nm>1; + else + tightID = nemf<0.90 and nm>10 and nhf>0.2; + // Provided for backwards compatibility + bool looseID = tightID; + + qcdJet.setLooseID(looseID); + qcdJet.setTightID(tightID); + qcdJet.setFrac(chf,nhf,nemf,cemf,muf); + qcdJet.setMulti(npr,chm,nhm,phm,elm,mum,cm); + qcdJet.setHFFrac(hf_hf,hf_phf); + qcdJet.setHFMulti(hf_hm,hf_phm); + + double hof = ijet->hoEnergyFraction(); // Juska + qcdJet.setVtxInfo(mpuTrk,mlvTrk,mjtTrk); + qcdJet.setHO(hof); + + // Check what is available + //auto pdisc = ijet->getPairDiscri(); + //for (auto &disc : pdisc) cout << " " << disc.first << endl; + + // Jet flavour tagging discriminators + qcdJet.pfCombinedCvsL_ = ijet->bDiscriminator("pfCombinedCvsLJetTags"); + qcdJet.pfCombinedCvsB_ = ijet->bDiscriminator("pfCombinedCvsBJetTags"); + + qcdJet.pfDeepCSVb_ = ijet->bDiscriminator("pfDeepCSVJetTags:probb"); + qcdJet.pfDeepCSVc_ = ijet->bDiscriminator("pfDeepCSVJetTags:probc"); + qcdJet.pfDeepCSVl_ = ijet->bDiscriminator("pfDeepCSVJetTags:probudsg"); + qcdJet.pfDeepCSVbb_ = ijet->bDiscriminator("pfDeepCSVJetTags:probbb"); + + qcdJet.pfBTag_JetProb_ = ijet->bDiscriminator("pfJetProbabilityBJetTags"); + qcdJet.pfBTag_CombInclSecVtxV2_ = ijet->bDiscriminator("pfCombinedInclusiveSecondaryVertexV2BJetTags"); + qcdJet.pfBTag_CombMVAV2_ = ijet->bDiscriminator("pfCombinedMVAV2BJetTags"); + + float QGL = -1; + float QGAx2 = -1; + int QGMul = -1; + float QGPtD = -1; + // QGL variables only relevant for AK4 + if (mAK4) { + edm::RefToBase jetRef(edm::Ref >(patJets, jetNo)); + QGL = (*qglHandle)[jetRef]; + QGAx2 = (*qgax2Handle)[jetRef]; + QGMul = (*qgmulHandle)[jetRef]; + QGPtD = (*qgptdHandle)[jetRef]; + } + qcdJet.setQGTagger(QGL,QGAx2,QGMul,QGPtD); + qcdJet.SetPUJetId((ijet->hasUserFloat(mPFJetPUID) ? ijet->userFloat(mPFJetPUID) : -999)); + + if (mIsMCarlo) { + float partonFlavour=0; + float hadronFlavour=0; + float partonFlavourPhys=0; + + if (mUseGenInfo) { + partonFlavour = ijet->partonFlavour(); + hadronFlavour = ijet->hadronFlavour(); + if (ijet->genParton() != NULL) partonFlavourPhys = ijet->genParton()->pdgId(); + } + + float rmin; + int imin; + std::tie(imin,rmin) = best_genjet(*ijet); + if (imin>maxGenMatch) maxGenMatch = imin; + + if (imin!=-1 and rminsetPFJetsCHS(qPFJets); + + if (mIsMCarlo) { + // Find the first jet with too small pt (but include all matched gen jets) + unsigned starter = (maxGenMatch==-1 ? 0 : maxGenMatch+1); + unsigned limit = mGenJets.size(); + for (unsigned igen = starter; igenlimit) { + mGenJets.pop_back(); + mGenBPt.pop_back(); + mGenFlavour.pop_back(); + mGenFlavourHadr.pop_back(); + mGenFlavourPhys.pop_back(); + } + // Save only the interesting gen info + mEvent->setGenJets(mGenJets); + mEvent->setGenBPt(mGenBPt); + mEvent->setGenFlavour(mGenFlavour); + mEvent->setGenFlavourHadron(mGenFlavourHadr); + mEvent->setGenFlavourPhysicsDef(mGenFlavourPhys); + } + + //---------------- MET ---------------------------------------------- + edm::Handle pfmett1; + event.getByToken(mPFMETt1, pfmett1); + // MET T1 is available by default in MINIAOD + const pat::MET &mett1 = pfmett1->front(); + qPFMet_t1.setVar(mett1.et(),mett1.sumEt(),mett1.phi()); + //auto mettt1 = mett1.corP2(pat::MET::Type1); + // MET T0 is obtained through a custom patch + auto mett0 = mett1.corP2(pat::MET::RawChs); + qPFMet_t0.setVar(mett0.pt(),mett1.corSumEt(pat::MET::RawChs),mett0.phi()); + // MET T0T1 is found using standard routines + auto mett0t1 = mett1.corP2(pat::MET::Type01); + qPFMet_t0t1.setVar(mett0t1.pt(),mett1.corSumEt(pat::MET::Type01),mett0t1.phi()); + mEvent->setPFMET(qPFMet_t1,qPFMet_t0,qPFMet_t0t1); + //cout << "Def: " << mett1.px() << " " << mett1.py() << endl; + //cout << "T1: " << mettt1.px << " " << mettt1.py << endl; + //cout << "T0: " << mett0.px << " " << mett0.py << endl; + //cout << "T0T1: " << mett0t1.px << " " << mett0t1.py << endl; + + + //-------------- fill the tree -------------------------------------- + mTree->Fill(); +} + +////////////////////////////////////////////////////////////////////////////////////////// +DEFINE_FWK_MODULE(ProcessedTreeProducerBTag); diff --git a/AnalysisFW/plugins/ProcessedTreeProducerBTag.h b/AnalysisFW/plugins/ProcessedTreeProducerBTag.h deleted file mode 100644 index d2b42199051..00000000000 --- a/AnalysisFW/plugins/ProcessedTreeProducerBTag.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef ProcessedTreeProducerBTag_h -#define ProcessedTreeProducerBTag_h - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" -#include "DataFormats/Common/interface/TriggerResults.h" -#include "DataFormats/HLTReco/interface/TriggerEvent.h" -#include "JetMETCorrections/Objects/interface/JetCorrector.h" -#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h" -#include "DataFormats/PatCandidates/interface/Jet.h" -#include "DataFormats/PatCandidates/interface/JetCorrFactors.h" -#include "SMPJ/AnalysisFW/interface/QCDJet.h" -#include "SMPJ/AnalysisFW/interface/QCDEvent.h" -#include "SMPJ/AnalysisFW/interface/QCDEventHdr.h" -#include "SMPJ/AnalysisFW/interface/QCDPFJet.h" -#include "SMPJ/AnalysisFW/interface/QCDPFJetBTag.h" -#include "SMPJ/AnalysisFW/interface/QCDMET.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "DataFormats/PatCandidates/interface/MET.h" -#include "DataFormats/PatCandidates/interface/PackedCandidate.h" -#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" -#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" -#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" - -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/VertexReco/interface/Vertex.h" - -//Hadron level definition -#include "SimDataFormats/JetMatching/interface/JetFlavourInfo.h" -#include "SimDataFormats/JetMatching/interface/JetFlavourInfoMatching.h" -#include "DataFormats/Math/interface/deltaR.h" - -using namespace edm; -using namespace reco; -using namespace std; -using namespace trigger; - -class ProcessedTreeProducerBTag : public edm::EDAnalyzer -{ - public: - typedef reco::Particle::LorentzVector LorentzVector; - explicit ProcessedTreeProducerBTag(edm::ParameterSet const& cfg); - virtual void beginJob(); - virtual void beginRun(edm::Run const &, edm::EventSetup const& iSetup); - virtual void analyze(edm::Event const& evt, edm::EventSetup const& iSetup); - virtual void endJob(); - virtual ~ProcessedTreeProducerBTag(); - private: - void buildTree(); - static bool sort_pfjets(QCDPFJet j1, QCDPFJet j2) { - return j1.ptCor() > j2.ptCor(); - } - //---- configurable parameters -------- - bool mIsMCarlo; - bool mAK4; - bool mUseGenInfo; - bool mPrintTriggerMenu; - //bool isPFJecUncSet_ - bool isPFJecUncSetCHS_; - int mGoodVtxNdof,mMinNPFJets; - double mGoodVtxZ; - double mMinPFPt,mMinPFFatPt,mMaxPFFatEta,mMinGenPt,mMaxY,mMinJJMass; - std::string mPFJECservice; - std::string mPFPayloadName; - std::string mPFPayloadNameCHS; - std::string pfpujetid; - std::string pfchsjetpuid; - - // unc file for non CHS jet ---- // - //std::string mPFJECUncSrc; - // unc file for CHS jet ---- // - std::string mPFJECUncSrcCHS; - std::vector mPFJECUncSrcNames; - std::vector mBDiscriminators; - // ---- non CHS jet input tag ----- // - edm::EDGetTokenT mOfflineVertices; - edm::EDGetTokenT mBeamSpot; - //edm::EDGetTokenT >mPFJetsName; - edm::EDGetTokenT >mPFJetsNameCHS; - edm::EDGetTokenT mhEventInfo; - edm::EDGetTokenT> qgToken; - // ----CHS jet input tag ----- // - //edm::InputTag mPFJetsName; - //edm::InputTag mPFJetsNameCHS; - - edm::EDGetTokenT mSrcCaloRho; - edm::EDGetTokenT mSrcPFRho; - //edm::InputTag triggerResultsTag_; - //edm::InputTag triggerEventTag_; - //edm::InputTag mPFMET; - edm::EDGetTokenT mPFMET; - edm::EDGetTokenT mGenJetsName; - edm::EDGetTokenT mgenParticles; - //edm::InputTag mHBHENoiseFilter; - //---- TRIGGER ------------------------- - std::string processName_; - std::vector triggerNames_; - std::vector triggerIndex_; - //edm::InputTag mSrcPU; - edm::EDGetTokenT triggerResultsTag_; - edm::EDGetTokenT triggerEventTag_; - edm::EDGetTokenT mHBHENoiseFilterResultLabel; - edm::EDGetTokenT mHBHENoiseFilterResultNoMinZLabel; - edm::EDGetTokenT > mSrcPU; - edm::Handle triggerResultsHandle_; - edm::Handle triggerEventHandle_; - //hadron jet definition - edm::EDGetTokenT jetFlavourInfosToken_; - - HLTConfigProvider hltConfig_; - //---- CORRECTORS ---------------------- - const JetCorrector *mPFJEC; - // ---- non CHS jet uncertainty ------ // - //JetCorrectionUncertainty *mPFUnc; - // ---- non CHS jet uncertainty ------ // - JetCorrectionUncertainty *mPFUncCHS; - //------- non CHS jet uncertainty sources -------- // - //std::vector mPFUncSrc; - // -------- CHS jet uncertainty sources -------- // - std::vector mPFUncSrcCHS; - - edm::Service fs; - TTree *mTree; - TH1F *mTriggerPassHisto,*mTriggerNamesHisto; - //---- TREE variables -------- - QCDEvent *mEvent; - - int getMatchedPartonGen(edm::Event const& event, GenJetCollection::const_iterator i_gen); - int getMatchedHadronGen(edm::Event const& event, GenJetCollection::const_iterator i_gen); - - HLTPrescaleProvider hltPrescale_; -}; - -#endif diff --git a/AnalysisFW/python/.gitignore b/AnalysisFW/python/.gitignore new file mode 100644 index 00000000000..881a5ad88a5 --- /dev/null +++ b/AnalysisFW/python/.gitignore @@ -0,0 +1,6 @@ +*.pyc +*swp +cfg/* +*.log +*.root +runs* diff --git a/AnalysisFW/python/__init__.py b/AnalysisFW/python/__init__.py index 143c377c635..82b38dd3760 100644 --- a/AnalysisFW/python/__init__.py +++ b/AnalysisFW/python/__init__.py @@ -1,3 +1,3 @@ #Automatically created by SCRAM import os -__path__.append(os.path.dirname(os.path.abspath(__file__).rsplit('/SMPJ/AnalysisFW/',1)[0])+'/cfipython/slc6_amd64_gcc472/SMPJ/AnalysisFW') +__path__.append(os.path.dirname(os.path.abspath(__file__).rsplit('/SMPJ/AnalysisFW/',1)[0])+'/cfipython/slc7_amd64_gcc630/SMPJ/AnalysisFW') diff --git a/AnalysisFW/python/__init__.pyc b/AnalysisFW/python/__init__.pyc deleted file mode 100644 index 4f20393a7bf..00000000000 Binary files a/AnalysisFW/python/__init__.pyc and /dev/null differ diff --git a/AnalysisFW/python/cfg/gen.py b/AnalysisFW/python/cfg/gen.py new file mode 100644 index 00000000000..d86f6604fab --- /dev/null +++ b/AnalysisFW/python/cfg/gen.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +import FWCore.ParameterSet.Config as cms + +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets +from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters +from RecoJets.JetProducers.PFJetParameters_cfi import * +from RecoJets.JetProducers.GenJetParameters_cfi import * +from RecoJets.JetProducers.AnomalousCellParameters_cfi import * +import sys + +process = cms.Process("Ntuplizer") +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Conditions +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") +from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag +process.load("Configuration.EventContent.EventContent_cff") +process.load("Configuration.StandardSequences.GeometryRecoDB_cff") +process.load("Configuration.StandardSequences.MagneticField_38T_cff") +process.load("RecoJets.Configuration.GenJetParticles_cff") +process.load("RecoJets.Configuration.RecoGenJets_cff") +process.load("RecoJets.JetProducers.TrackJetParameters_cfi") + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Input +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +process.GlobalTag.globaltag = "106X_upgrade2018_realistic_v16_L1v1" + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1)) + +#files= cms.untracked.vstring('file:toast.root') +files= cms.untracked.vstring( +# '/store/mc/RunIISummer20UL18GEN/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/GEN/106X_upgrade2018_realistic_v4-v2/2520000/040A5B53-2B91-8446-8246-538E79DC4D0D.root', +# '/store/mc/RunIISummer20UL18GEN/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/GEN/106X_upgrade2018_realistic_v4-v2/2520000/048D2590-79EF-B247-BBED-E21AA301CDAF.root', +# '/store/mc/RunIISummer20UL18GEN/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/GEN/106X_upgrade2018_realistic_v4-v2/2520000/08E37DD6-1E3E-404D-8F03-DC4FE1D3FE37.root', + '/store/mc/RunIISummer20UL18GEN/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/GEN/106X_upgrade2018_realistic_v4-v2/2520000/0A959079-E71F-954B-AC7E-90213765717A.root', +# '/store/mc/RunIISummer20UL18GEN/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/GEN/106X_upgrade2018_realistic_v4-v2/2520000/0B368815-8A20-CD4E-B239-47FC82D28324.root', +) +process.source = cms.Source("PoolSource", fileNames = files) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Services +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.FwkReport.reportEvery = 100 +process.MessageLogger.cerr.threshold = cms.untracked.string("ERROR") +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring( + "errors" + ), + errors = cms.untracked.PSet( + threshold = cms.untracked.string("ERROR") + ), +) +process.load("CommonTools.UtilAlgos.TFileService_cfi") +process.TFileService.fileName=cms.string("out.root") +process.jets = cms.EDAnalyzer('MCJettify', +) + +process.path = cms.Path(process.jets) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Output and Log +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) +process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/python/cfgProducer.py b/AnalysisFW/python/cfgProducer.py new file mode 100644 index 00000000000..e1d91729f8f --- /dev/null +++ b/AnalysisFW/python/cfgProducer.py @@ -0,0 +1,285 @@ +# This is a handy handle for producing crab parameter files +# -*- coding: utf-8 -*- + +######### +# Lists # +######### + +# Global tags +from gtaglists import * +# MET filters are fetched +from filterlists import * +# Triggers are fetched +from triggerlists import * + +############# +# Main text # +############# + +importer = [ + '# -*- coding: utf-8 -*-', + 'import FWCore.ParameterSet.Config as cms\n', + 'from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets', + 'from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters', + 'from RecoJets.JetProducers.PFJetParameters_cfi import *', + 'from RecoJets.JetProducers.GenJetParameters_cfi import *', + 'from RecoJets.JetProducers.AnomalousCellParameters_cfi import *', + 'from RecoJets.JetProducers.QGTagger_cfi import QGTagger', + 'from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import *', + 'from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets', + 'from PhysicsTools.PatAlgos.tools.jetTools import *', + 'from PhysicsTools.PatAlgos.patSequences_cff import *', + 'from PhysicsTools.PatAlgos.patTemplate_cfg import *', + 'from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos', + 'import sys\n', + 'from gtaglists import *', + 'from triggerlists import *', + 'from filterlists import *', + 'from filelists import *\n', +] + +process = [ + 'process = cms.Process("Ntuplizer")', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + '#! Conditions', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + 'process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff")', + 'from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag', + 'process.load("Configuration.EventContent.EventContent_cff")', + 'process.load("Configuration.StandardSequences.GeometryRecoDB_cff")', + 'process.load("Configuration.StandardSequences.MagneticField_38T_cff")', + 'process.load("RecoJets.Configuration.GenJetParticles_cff")', + 'process.load("RecoJets.Configuration.RecoGenJets_cff")', + 'process.load("RecoJets.JetProducers.TrackJetParameters_cfi")', + 'process.load("RecoJets.JetProducers.PileupJetIDParams_cfi")', + 'process.load("PhysicsTools.PatAlgos.patSequences_cff")\n', + '##-------------------- Import the JEC services -----------------------', + 'process.load("JetMETCorrections.Configuration.DefaultJEC_cff")\n', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + '#! Input', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', +] + +inputs = [ + 'process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(5000))\n', + 'process.source = cms.Source("PoolSource", fileNames = inFiles )\n', + 'process.load("CommonTools.RecoAlgos.HBHENoiseFilterResultProducer_cfi")', + 'process.load("CommonTools.RecoAlgos.HBHENoiseFilter_cfi")\n', + 'process.HBHENoiseFilterResultProducerNoMinZ = process.HBHENoiseFilterResultProducer.clone(minZeros = cms.int32(99999))\n', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + '#! Services', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + 'process.load("FWCore.MessageLogger.MessageLogger_cfi")', + 'process.MessageLogger.cerr.FwkReport.reportEvery = 100', + 'process.MessageLogger.cerr.threshold = cms.untracked.string("ERROR")', + 'process.MessageLogger = cms.Service("MessageLogger",', + ' destinations = cms.untracked.vstring(', + ' "errors"', + ' ),', + ' errors = cms.untracked.PSet(', + ' threshold = cms.untracked.string("ERROR")', + ' ),', + ')', + 'process.load("CommonTools.UtilAlgos.TFileService_cfi")', + 'process.TFileService.fileName=cms.string("DATA.root")', +] + +flavors = [ + 'process.load("PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi")', + 'process.selectedHadronsAndPartons.particles = "prunedGenParticles"', + 'process.selectedHadronsAndPartons.partonMode = cms.string("Auto")', + 'process.selectedHadronsAndPartons.src = "generator"', + 'process.physDefHadronsAndPartons = process.selectedHadronsAndPartons.clone( fullChainPhysPartons = cms.bool(False) )\n', + 'process.jetFlavs = ak4JetFlavourInfos.clone( jets = gjetname,', + ' partons = cms.InputTag("selectedHadronsAndPartons","physicsPartons") )', + 'process.jetFlavsPD = process.jetFlavs.clone( partons = cms.InputTag("physDefHadronsAndPartons","physicsPartons") )', +] + +logging = [ + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + '#! Output and Log', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + 'process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) )', + 'process.options.allowUnscheduled = cms.untracked.bool(True)', +] + +# jettype: 'ak4', 'ak8', 'zb' +def producer(RunYear,era,jettype,Mode): + add='PreVFP' if len(Mode)!=2 else '' + fname="cfg/"+jettype+RunYear+('' if era=='dt' else era)+add+".py" + with open(fname, 'w') as f: + # Import lines + for line in importer: + f.write(line+'\n') + f.write('\n') + # Process.load lines + for line in process: + f.write(line+'\n') + f.write('\n') + # Global tag is set + GTag = GTags[RunYear][Mode] + Mode=Mode[:2] + f.write('process.GlobalTag.globaltag = "'+GTag+'"\n') + if GTag=='DEFAULT': + f.write('process.GlobalTag = GlobalTag(process.GlobalTag, "auto:run2_' + ('data' if Mode=='dt' else 'mc') + '" )\n') + f.write('\n') + # Triggers: + ## Active + f.write('triggers=') + if Mode=='dt': + f.write('trglist["'+RunYear+'"]["dt"]["'+jettype+'"]\n\n') + else: + f.write('trglist["'+RunYear+'"]["mc"]["'+jettype+'"]\n\n') + ## Followed + f.write('follows=') + if Mode=='dt' and jettype!='zb': + f.write('trglist["'+RunYear+'"]["dt"]["ak'+('4' if jettype=='ak8' else '8')+'"]\n\n') + else: + f.write('cms.vstring()\n\n') + # MET filters + f.write('filters=fltlist["'+RunYear+'"]["'+Mode+'"]\n\n') + # Testing input files + f.write('inFiles=') + if RunYear=='16': + if jettype=='zb': + f.write('ZBD16\n') + elif Mode=='dt': + f.write('JHTG16\n') + elif MC=='py': + f.write('QCD16Mor17P8M1\n') + elif MC=='hw': + f.write('QCD16Mor17HS1\n') + elif MC=='mg': + f.write('QCD16MG\n') + elif MC=='nu': + f.write('QCD16NU\n') + else: + f.write('cms.untracked.vstring()\n') + elif RunYear=='17': + if jettype=='zb': + f.write('ZBDUL17\n') + elif Mode=='dt': + f.write('JHTDUL17\n') + elif MC=='py': + f.write('QCDUL17P8CP5\n') + elif MC=='nu': + f.write('QCDUL17NU\n') + elif MC=='hw': + f.write('QCD17HS1\n') + elif MC=='mg': + f.write('QCD17MG\n') + else: + f.write('cms.untracked.vstring()\n') + elif RunYear=='18': + if jettype=='zb': + f.write('ZBAUL18\n') + elif Mode=='dt': + f.write('JHTAUL18\n') + elif MC=='py': + f.write('QCDUL18P8CP5\n') + #f.write('QCD18P8CP5\n') + elif MC=='mg': + f.write('QCD18MG\n') + else: + f.write('cms.untracked.vstring()\n') + else: + f.write('cms.untracked.vstring()\n') + # Remaining input stuff + for line in inputs: + f.write(line+'\n') + # Jet collections + f.write("jetname='slimmedJets"+("AK8" if jettype=='ak8' else "")+"'\n") + f.write("gjetname='slimmedGenJets"+("AK8" if jettype=='ak8' else "")+"'\n\n") + # QGL: Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion + if jettype!='ak8': + f.write("process.load('RecoJets.JetProducers.QGTagger_cfi')\n") + f.write("process.QGTagger.srcJets = cms.InputTag(jetname)\n") + f.write("process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs')\n\n") + if Mode=='mc': + for line in flavors: + f.write(line+'\n') + # EDAnalyzer for PatJets + f.write('process.load("PhysicsTools.PatAlgos.patSequences_cff")\n') + f.write("process.ak"+("8" if jettype=='ak8' else "4")+" = cms.EDAnalyzer('ProcessedTreeProducerBTag',\n") + f.write(" ## jet collections ###########################\n") + f.write(" pfjetschs = cms.InputTag(jetname),\n") + f.write(" pfchsjetpuid = cms.string('pileupJetId:fullDiscriminant'),\n") + f.write(" runYear = cms.untracked.string('20"+RunYear+"'),\n") + f.write(" ## MET collection ####\n") + f.write(" pfmetT1 = cms.InputTag('slimmedMETs'),\n") + f.write(" genjets = cms.untracked.InputTag(gjetname),\n") + f.write(" ## database entry for the uncertainties ######\n") + f.write(" PFPayloadName = cms.string(''),\n") + f.write(" jecUncSrc = cms.untracked.string(''),\n") + f.write(" jecUncSrcNames = cms.vstring(''),\n") + f.write(" ## set the conditions for good Vtx counting ##\n") + f.write(" offlineVertices = cms.InputTag('offlineSlimmedPrimaryVertices'),\n") + f.write(" beamSpot = cms.InputTag('offlineBeamSpot'),\n") + f.write(" goodVtxNdof = cms.double(4),\n") + f.write(" goodVtxZ = cms.double(24),\n") + f.write(" ## rho #######################################\n") + f.write(" srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'),\n") + f.write(" srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'),\n") + f.write(" srcPULabel = cms.untracked.InputTag('slimmedAddPileupInfo'),\n") + f.write(" ## preselection cuts #########################\n") + f.write(" maxEta = cms.double(5.0),\n") + f.write(" minPFPt = cms.double(15.0),\n") + f.write(" minPFPtThirdJet = cms.double(5.0),\n") + f.write(" minNPFJets = cms.uint32("+repr(0 if jettype=='ak8' else 1)+"),\n") + f.write(" minGenPt = cms.untracked.double(15.0),\n") + f.write(" isMCarlo = cms.untracked.bool("+("False" if Mode=="dt" else "True")+"),\n") + f.write(" useGenInfo = cms.untracked.bool("+("False" if Mode=="dt" else "True")+"),\n") + f.write(" AK4 = cms.untracked.bool("+("False" if jettype=='ak8' else "True")+"),\n") + f.write(" ZB = cms.untracked.bool("+("True" if jettype=='zb' else "False")+"),\n") + f.write(" ## trigger ###################################\n") + f.write(" printTriggerMenu= cms.untracked.bool(False),\n") + f.write(" discardFilter = cms.untracked.bool(False),\n") + f.write(" trigSimple = cms.untracked.bool(True),\n") + f.write(" trigObjs = cms.untracked.bool(False),\n") + f.write(" filterName = filters,\n") + f.write(" triggerName = triggers,\n") + f.write(" triggerFollow = follows,\n") + f.write(" triggerHLTObjs = cms.untracked.InputTag('"+("selected" if RunYear=='16' else "slimmed")+"PatTrigger'),\n") + f.write(" triggerL1Objs = cms.untracked.InputTag('caloStage2Digis','Jet'),\n") + f.write(" triggerL1HTObjs = cms.untracked.InputTag('caloStage2Digis','EtSum'),\n") + f.write(" #triggerAllObjs = cms.untracked.InputTag('gtStage2Digis','GlobalAlgBlk'),\n") + f.write(" prescales = cms.InputTag('patTrigger'),\n") + f.write(" prescalesL1Min = cms.InputTag('patTrigger','l1min'),\n") + f.write(" prescalesL1Max = cms.InputTag('patTrigger','l1max'),\n") + if Mode=="mc": + f.write(" ## gen ##############################\n") + f.write(" EventInfo = cms.untracked.InputTag('generator'),\n") + f.write(" GenParticles = cms.untracked.InputTag('prunedGenParticles'),\n") + f.write(" jetFlavInfos = cms.untracked.InputTag('jetFlavs'),\n") + f.write(" jetFlavInfosPD = cms.untracked.InputTag('jetFlavsPD'),\n") + if MC!='py': + f.write(" mcType = cms.untracked.int32(1),\n") + else: + f.write(" HBHENoiseFilterResultNoMinZLabel = cms.untracked.InputTag('HBHENoiseFilterResultProducerNoMinZ', 'HBHENoiseFilterResult'),\n") + f.write(" saveWeights = cms.bool(False)\n") + f.write(")\n\n") + f.write("process.path = cms.Path(") + if jettype!='ak8': + f.write("process.QGTagger*\n ") + if Mode=="dt": + f.write("process.HBHENoiseFilterResultProducerNoMinZ*\n ") + else: + f.write("process.selectedHadronsAndPartons*\n ") + f.write("process.jetFlavs*\n ") + f.write("process.physDefHadronsAndPartons*\n ") + f.write("process.jetFlavsPD*\n ") + f.write("process.ak"+("8" if jettype=='ak8' else "4")+")\n\n") + for line in logging: + f.write(line+'\n') + +# Produce the run files +for RunYear in ['16','17','18']: + for MC in ['py','nu','hw','mg']: + producer(RunYear,MC,'ak4','mc') + producer(RunYear,MC,'ak8','mc') + if RunYear=='16': + producer(RunYear,MC,'ak4','mcPreVFP') + producer(RunYear,MC,'ak8','mcPreVFP') + producer(RunYear,'dt','zb','dt') + producer(RunYear,'dt','ak4','dt') + producer(RunYear,'dt','ak8','dt') diff --git a/AnalysisFW/python/crabConfig.py b/AnalysisFW/python/crabConfig.py new file mode 100644 index 00000000000..4d0e55f2124 --- /dev/null +++ b/AnalysisFW/python/crabConfig.py @@ -0,0 +1,289 @@ +from CRABClient.UserUtilities import config +config = config() + +## Configurable parameters begin +import sys + +if len(sys.argv)<5: + sys.exit() +args = sys.argv + +# Choose 16/17/18 +RunYear=args[1] +# Era +Era=args[2] +# Choose ak4/ak8, zb (DT only) +Mode=args[3] + +# True for DT, False for MC +DTMode=False +# Choose py/pylong/hw/nu/mg (MC only) +MCType='py' +if args[4]=='dt': DTMode=True +else: MCType = args[4] + +# Run extensions (MC) +ExtMode=False +if not DTMode and len(Era)>1: ExtMode=True + +# In case of pylong (0-14) or mg (0-8) +RangeIdx = 0 +if len(sys.argv)>5 and not DTMode: + if MCType=='pylong' or MCType=='mg': RangeIdx = int(args[5]) + +# Extra identifier +TagTag='' +if len(sys.argv)>6: TagTag = args[6] + +print(RunYear,Era,Mode,DTMode,MCType,RangeIdx) +## Configurable parameters end + +PtRanges = ['15to30','30to50','50to80','80to120','120to170','170to300','300to470','470to600','600to800','800to1000','1000to1400','1400to1800','1800to2400','2400to3200','3200toInf'] +HTRanges = ['HT50to100','HT100to200','HT200to300','HT300to500','HT500to700','HT700to1000','HT1000to1500','HT1500to2000','HT2000toInf'] + +Tag='' +DTLoc='/JetHT' +if Mode=='ak8': + Tag='_AK8' +elif Mode=='zb': + if DTMode: + Tag='_ZB' + DTLoc='/ZeroBias' + else: + Mode='ak4' + +config.General.transferOutputs = True +config.General.transferLogs = False + +config.Data.inputDBS = 'global' +config.Data.outLFNDirBase = '/store/user/hsiikone' +config.Data.publication = False +# Temporary flag for UL16 datasets in production +config.Data.allowNonValidInputDataset = True + +config.JobType.pluginName = 'Analysis' +config.Site.storageSite = 'T2_FI_HIP' + + +if __name__ == '__main__': + from CRABAPI.RawCommand import crabCommand + from CRABClient.ClientExceptions import ClientException + from httplib import HTTPException + + def submit(config): + try: + crabCommand('submit', config = config) + except HTTPException as hte: + print "Failed submitting task: %s" % (hte.headers) + except ClientException as cle: + print "Failed submitting task: %s" % (cle) + + Good = True + if DTMode: + config.General.workArea = 'runs_dt' + config.Data.splitting = 'LumiBased' + config.Data.unitsPerJob = 55 + config.JobType.psetName = 'cfg/'+Mode+RunYear+'.py' + config.General.requestName = 'Run'+RunYear+Era+Tag+TagTag + Ver = '1' + Campaign = '' + # UL ReReco + if RunYear=='16': + # CMSSW 10_6_8_patch1: Era == Be/Bl/C/D/E/Fe/Fl/G/H + config.Data.lumiMask = '/afs/cern.ch/user/h/hsiikone/work/certificates/Cert_271036-284044_13TeV_Legacy2016_Collisions16_JSON.txt' + Ver = '2' + Campaign = '' + + # Era specific + if Era=='Be': + Campaign += 'ver1_' + Era = 'B' + elif Era=='Bl': + Campaign += 'ver2_' + Era = 'B' + elif Era=='Fe': + Era = 'F' + + # HIP issue mitigation + if Era=='B' or Era=='C' or Era=='D' or Era=='E' or Era=='F': + Campaign += 'HIPM_' + elif Era=='Fl': + Era = 'F' + + Campaign += 'UL2016_MiniAODv2' + elif RunYear=='17': + # CMSSW 10_6_2: Era == B/C/D/E/F + config.Data.lumiMask = '/afs/cern.ch/user/h/hsiikone/work/certificates/Cert_294927-306462_13TeV_UL2017_Collisions17_GoldenJSONmod.txt' + Campaign = 'UL2017_MiniAODv2' + if Era=='F': config.Data.unitsPerJob = 80 + elif RunYear=='18': + # CMSSW 10_6_4_patch1: Era == A/B/C/D + config.Data.lumiMask = '/afs/cern.ch/user/h/hsiikone/work/certificates/Cert_314472-325175_13TeV_Legacy2018_Collisions18_JSON.txt' + Campaign = 'UL2018_MiniAODv2' + if Era=='A': config.Data.unitsPerJob = 100 + elif Era=='D': config.Data.unitsPerJob = 160 + if Mode=='ak4': + if Era=='D': Ver = '2' + config.Data.inputDataset = DTLoc+'/Run20'+RunYear+Era+'-'+Campaign+'-v'+Ver+'/MINIAOD' + else: + if not ExtMode: + config.General.workArea = 'runs_mc' + else: + config.General.workArea = 'runs_extmc' + DoPreVFP = RunYear=='16' and Era[0]=='e' + config.Data.splitting = 'FileBased' + config.Data.unitsPerJob = 5 + config.JobType.psetName = 'cfg/'+Mode+RunYear+MCType[:2]+("PreVFP" if DoPreVFP else "")+'.py' + if MCType=='nu': config.Data.unitsPerJob = 1 + elif MCType!='py' and MCType!='pylong' and MCType!='hw' and MCType!='mg': + print "Unknown MC Type, ", MCType + Good = False + + if RunYear=='16': + if MCType=='nu': + ##### Neutrino Gun + if DoPreVFP: + config.General.requestName = 'QCD16'+Tag+'_SingleNu_S19UL16_mcr2a_PreVFP_v8_e3_2' + config.Data.inputDataset = '' + else: + config.General.requestName = 'QCD16'+Tag+'_SingleNu_S19UL16_mcr2a_v17_2' + config.Data.inputDataset = '/SingleNeutrino/RunIISummer20UL16MiniAODv2-106X_mcRun2_asymptotic_v17-v2/MINIAODSIM' + + elif MCType=='hw': + ##### Herwig7 Flat + if DoPreVFP: + config.General.requestName = 'QCD16'+Tag+'_CH3_15to7k_S19UL16_mcr2a_PreVFP_v8_4' + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL16MiniAODAPV-106X_mcRun2_asymptotic_preVFP_v8-v4/MINIAODSIM' + else: + config.General.requestName = 'QCD16'+Tag+'_CH3_15to7k_S19UL16_mcr2a_v13_2' + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL16MiniAOD-106X_mcRun2_asymptotic_v13-v2/MINIAODSIM' + + elif MCType=='py': + ##### Pythia 8 Flat + if DoPreVFP: + if not ExtMode: + config.General.requestName = 'QCD16'+Tag+'_CP5_15to7k_S19UL16_mcr2a_PreVFP_v11_1' + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL16MiniAODAPVv2-106X_mcRun2_asymptotic_preVFP_v11-v1/MINIAODSIM' + else: + Good = False + else: + if not ExtMode: + config.General.requestName = 'QCD16'+Tag+'_CP5_15to7k_S19UL16_mcr2a_v17_1' + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL16MiniAODv2-106X_mcRun2_asymptotic_v17-v1/MINIAODSIM' + else: + Good = False + + elif MCType=='pylong': + ##### Pythia 8 Pthat slices + if DoPreVFP: + config.General.requestName = 'QCD16'+Tag+'_CP5_'+PtRanges[RangeIdx]+'_S19UL16_mcr2a_PreVFP_v8_2'+TagTag + config.Data.inputDataset = '/QCD_Pt_'+PtRanges[RangeIdx]+'_TuneCP5_13TeV_pythia8/RunIISummer19UL16MiniAODAPV-106X_mcRun2_asymptotic_preVFP_v8-v2/MINIAODSIM' + else: + config.General.requestName = 'QCD16'+Tag+'_CP5_'+PtRanges[RangeIdx]+'_S19UL16_mcr2a_v13_2'+TagTag + config.Data.inputDataset = '/QCD_Pt_'+PtRanges[RangeIdx]+'_TuneCP5_13TeV_pythia8/RunIISummer19UL16MiniAOD-106X_mcRun2_asymptotic_v13-v2/MINIAODSIM' + + elif MCType=='mg': + ##### Madgraph + Pythia8 HT slices + if DoPreVFP: + config.General.requestName = 'QCD16'+Tag+'_MgMLMP8_'+HTRanges[RangeIdx]+'_S19UL16_mcr2a_PreVFP_v8_1'+TagTag + config.Data.inputDataset = '/QCD_'+HTRanges[RangeIdx]+'_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/RunIISummer19UL16MiniAODAPV-106X_mcRun2_asymptotic_preVFP_v8-v1/MINIAODSIM' + else: + config.General.requestName = 'QCD16'+Tag+'_MgMLMP8_'+HTRanges[RangeIdx]+'_S19UL16_mcr2a_v13_2'+TagTag + config.Data.inputDataset = '/QCD_'+HTRanges[RangeIdx]+'_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/RunIISummer19UL16MiniAOD-106X_mcRun2_asymptotic_v13-v2/MINIAODSIM' + + elif RunYear=='17': + if MCType=='nu': + ##### Neutrino Gun + config.General.requestName = 'QCD17'+Tag+'_SingleNu_PU2017_S19UL17_mc17r_v6_2'+TagTag + + if not ExtMode: + config.Data.inputDataset = '/SingleNeutrino/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM' + else: + Good = False + + elif MCType=='hw': + # Herwig7 Flat + config.General.requestName = 'QCD17'+Tag+'_CH3_15to7k_S19UL17_mc17r_v6_2'+TagTag + + if not ExtMode: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM' + else: + Good = False + + elif MCType=='py': + ##### Pythia 8 Flat + config.General.requestName = 'QCD17'+Tag+'_CP5_15to7k_S19UL17_mc17r_v9_2'+TagTag + + if not ExtMode: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2/MINIAODSIM' + else: + Good = False + + elif MCType=='pylong': + ##### Pythia 8 Pthat slices + config.General.requestName = 'QCD17'+Tag+'_CP5_'+PtRanges[RangeIdx]+'_S19UL17_mc17r_v6_2'+TagTag + + if not ExtMode: + config.Data.inputDataset = '/QCD_Pt_'+PtRanges[RangeIdx]+'_TuneCP5_13TeV_pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM' + else: + Good = False + + elif MCType=='mg': + ##### Madgraph + Pythia8 HT slices + config.General.requestName = 'QCD17'+Tag+'_MgMLMP8_'+HTRanges[RangeIdx]+'_S19UL17_mc17r_v6_2'+TagTag + + if not ExtMode: + config.Data.inputDataset = '/QCD_'+HTRanges[RangeIdx]+'_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM' + else: + Good = False + + elif RunYear=='18': + if MCType=='nu': + ##### Neutrino Gun + config.General.requestName = 'QCD18'+Tag+'_SingleNu_S19UL18_mc18r_v11_L1v1_v2'+TagTag + + if not ExtMode: + config.Data.inputDataset = '/SingleNeutrino/RunIISummer19UL18MiniAOD-FlatPU0to70_106X_upgrade2018_realistic_v11_L1v1-v1/MINIAODSIM' + #config.General.requestName += '_HEM' + #config.Data.inputDataset = '/SingleNeutrino/RunIISummer19UL18MiniAOD-FlatPU0to70_UL18HEMreReco_106X_upgrade2018_realistic_v11_L1v1-v1/MINIAODSIM' + else: + Good = False + + elif MCType=='hw': + # Herwig7 Flat + config.General.requestName = 'QCD18'+Tag+'_CH3_15to7k_S19UL18_mc18r_v11_L1v1_v2'+TagTag + + if not ExtMode: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL18MiniAOD-106X_upgrade2018_realistic_v11_L1v1-v2/MINIAODSIM' + else: + Good = False + + elif MCType=='py': + # Pythia 8 Flat + config.General.requestName = 'QCD18'+Tag+'_CP5_15to7k_S19UL18_mc18r_v16_L1v1_v2'+TagTag + + if not ExtMode: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL18MiniAODv2-106X_upgrade2018_realistic_v16_L1v1-v2/MINIAODSIM' + else: + Good = False + + elif MCType=='pylong': + ##### Pythia 8 Pthat slices + config.General.requestName = 'QCD18'+Tag+'_CP5_'+PtRanges[RangeIdx]+'_S19UL18_mc18r_v11_L1v1_v2'+TagTag + + if not ExtMode: + config.Data.inputDataset = '/QCD_Pt_'+PtRanges[RangeIdx]+'_TuneCP5_13TeV_pythia8/RunIISummer19UL18MiniAOD-106X_upgrade2018_realistic_v11_L1v1-v2/MINIAODSIM' + else: + Good = False + + elif MCType=='mg': + ##### Madgraph + Pythia8 HT slices + config.General.requestName = 'QCD18'+Tag+'_MgMLMP8_'+HTRanges[RangeIdx]+'_S19UL18_mc18r_v11_L1v1_v2'+TagTag + + if not ExtMode: + config.Data.inputDataset = '/QCD_'+HTRanges[RangeIdx]+'_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/RunIISummer19UL18MiniAOD-106X_upgrade2018_realistic_v11_L1v1-v2/MINIAODSIM' + else: + Good = False + + if Good: submit(config) + diff --git a/AnalysisFW/python/filelists.py b/AnalysisFW/python/filelists.py new file mode 100644 index 00000000000..b0b31a07d25 --- /dev/null +++ b/AnalysisFW/python/filelists.py @@ -0,0 +1,125 @@ +import FWCore.ParameterSet.Config as cms + +JHTG16 = cms.untracked.vstring( + '/store/data/Run2016G/JetHT/MINIAOD/17Jul2018-v1/90000/C01E5165-3992-E811-829C-0025905C3E38.root' +) + +JHTD16 = cms.untracked.vstring( + '/store/data/Run2016D/JetHT/MINIAOD/07Aug17-v1/110000/006E5601-D189-E711-9EDC-0025905A60E4.root' +) + +ZBD16 = cms.untracked.vstring( + '/store/data/Run2016G/ZeroBias/MINIAOD/07Aug17-v1/90000/005086DB-3688-E711-844C-842B2B0646ED.root' +) + +QCD16Mor17P8M1 = cms.untracked.vstring( + '/store/mc/RunIISummer16MiniAODv3/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8/MINIAODSIM/PUMoriond17_magnetOn_94X_mcRun2_asymptotic_v3-v2/40000/FA41F4B8-D320-E911-9AC4-0CC47AC52CFE.root' +) + +QCD16Mor17HS1 = cms.untracked.vstring( + '/store/mc/RunIISummer16MiniAODv3/QCD_Pt-15to7000_TuneCUETHS1_Flat_13TeV_herwigpp/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v2/280000/FE251B18-D420-E911-8570-0090FAA57730.root' +) + +QCD16MG = cms.untracked.vstring( + '/store/mc/RunIISummer16MiniAODv3/QCD_HT300to500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v2/110000/FCE7FD1A-D8EA-E811-9A91-0025905C2CB8.root', + '/store/mc/RunIISummer16MiniAODv3/QCD_HT300to500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v2/110000/FA38AFD9-EBEA-E811-9523-0CC47AFCC3EA.root', + '/store/mc/RunIISummer16MiniAODv3/QCD_HT300to500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v2/110000/FA09D351-D9EA-E811-8956-0025904C68DC.root', + '/store/mc/RunIISummer16MiniAODv3/QCD_HT300to500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v2/110000/F620F065-E5EA-E811-B70F-0025904CF764.root', + '/store/mc/RunIISummer16MiniAODv3/QCD_HT300to500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v2/110000/F49053C7-DAEA-E811-A8D5-0025905C2CD0.root' +) + +QCD17P8M1 = cms.untracked.vstring( + '/store/mc/RunIIFall17MiniAODv2/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/70000/FE205E21-8042-E811-BA86-509A4C730E2E.root' +) + +QCD16NU = cms.untracked.vstring( + '/store/mc/RunIISummer16MiniAODv3/SingleNeutrino/MINIAODSIM/PUMoriond17_magnetOff_94X_mcRun2_asymptotic_v3-v2/40000/F8DD9168-1E21-E911-A81B-A0369F7FC714.root' +) + +QCD17P8CP5 = cms.untracked.vstring( + '/store/mc/RunIIFall17MiniAODv2/QCD_Pt-15to7000_TuneCP5_Flat_13TeV_pythia8/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/70000/F89DC5FC-5742-E811-B61C-782BCB20E921.root' +) + +QCD17HS1 = cms.untracked.vstring( + '/store/mc/RunIIFall17MiniAODv2/QCD_Pt-15to7000_TuneCUETHS1_Flat_13TeV_herwigpp/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/70000/FE935FB1-DD44-E811-B398-0CC47AA53D66.root' +) + +QCD17MG = cms.untracked.vstring( + '/store/mc/RunIIFall17MiniAODv2/QCD_HT100to200_TuneCP5_13TeV-madgraph-pythia8/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v2/00000/860EBA88-26B3-E811-8FC4-0025907859B8.root' +) + +JHTB17 = cms.untracked.vstring( + '/store/data/Run2017B/JetHT/MINIAOD/31Mar2018-v1/00000/0205C4D3-463A-E811-86BD-0CC47A4C8E2A.root' +) + +ZBB17 = cms.untracked.vstring( + '/store/data/Run2017B/ZeroBias/MINIAOD/31Mar2018-v1/30000/FE5B9607-7837-E811-82E7-EC0D9A8222CE.root' +) + +QCDUL17P8CP5 = cms.untracked.vstring( + '/store/mc/RunIISummer20UL17MiniAODv2/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/MINIAODSIM/EpsilonPU_106X_mc2017_realistic_v9-v1/2810000/1D413F75-7470-6E4D-A9F4-249016CE6E4C.root', + '/store/mc/RunIISummer20UL17MiniAODv2/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/MINIAODSIM/EpsilonPU_106X_mc2017_realistic_v9-v1/2810000/336E5E65-8897-8F4D-931D-6DE53F8E0D71.root', + '/store/mc/RunIISummer20UL17MiniAODv2/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/MINIAODSIM/EpsilonPU_106X_mc2017_realistic_v9-v1/2810000/4485D631-F6EB-2B44-A417-E20E56778524.root', + '/store/mc/RunIISummer20UL17MiniAODv2/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/MINIAODSIM/EpsilonPU_106X_mc2017_realistic_v9-v1/2810000/98369465-62A5-B24F-BAF3-1CC03E3EBFD1.root' +) + +QCDUL17NU = cms.untracked.vstring( + '/store/mc/RunIISummer19UL17MiniAOD/SingleNeutrino/MINIAODSIM/106X_mc2017_realistic_v6-v2/70000/F62C83FE-2284-4341-86FA-72B4F5F9AC17.root' +) + +ZBBUL17 = cms.untracked.vstring( + '/store/data/Run2017B/ZeroBias/MINIAOD/09Aug2019_UL2017-v1/50000/D07AD09F-0463-7B43-B4EF-FD29E4CA5D0D.root' +) + +ZBCUL17 = cms.untracked.vstring( + '/store/data/Run2017C/ZeroBias/MINIAOD/09Aug2019_UL2017-v1/50000/FE22660B-0B16-E34E-BDEA-B84326F55B61.root' +) + +ZBDUL17 = cms.untracked.vstring( + '/store/data/Run2017D/ZeroBias/MINIAOD/09Aug2019_UL2017-v1/130000/087CA264-F0F4-CB4A-8BB6-980BC3269BCA.root' +) + +ZBEUL17 = cms.untracked.vstring( + '/store/data/Run2017E/ZeroBias/MINIAOD/09Aug2019_UL2017-v1/130000/AC9C245B-1F6C-6248-BEB1-B3B1DB81C03B.root' +) + +ZBFUL17 = cms.untracked.vstring( + '/store/data/Run2017F/ZeroBias/MINIAOD/09Aug2019_UL2017-v1/50000/F60FCB4F-0251-C54A-A12A-65A1FC34A933.root' +) + +JHTDUL17 = cms.untracked.vstring( + '/store/data/Run2017D/JetHT/MINIAOD/09Aug2019_UL2017-v1/50000/F7CE3C72-66C1-CA4B-9742-57E6EA8664B8.root' +# '/store/data/Run2017C/JetHT/MINIAOD/09Aug2019_UL2017-v1/130000/328E6989-96F4-8543-9EA5-5AAAFC267960.root' +) + +FSQ17 = cms.untracked.vstring( + '/store/data/Run2017H/FSQJet2/MINIAOD/17Nov2017-v1/00000/D4DE8239-5E3E-E811-8069-002618FDA287.root' +) + +QCD18P8CP5 = cms.untracked.vstring( + '/store/mc/RunIIAutumn18MiniAOD/QCD_Pt-15to7000_TuneCP5_Flat_13TeV_pythia8/MINIAODSIM/102X_upgrade2018_realistic_v15_ext1-v1/110000/02CCAE3F-A631-3D4D-B5A6-6B5B81B4E210.root' +) + +QCD18MG = cms.untracked.vstring( + '/store/mc/RunIIAutumn18MiniAOD/QCD_HT100to200_TuneCP5_13TeV-madgraphMLM-pythia8/MINIAODSIM/102X_upgrade2018_realistic_v15-v1/60000/FD3F4D79-58BB-A442-BA89-66190498EFEB.root' +) + +QCDUL18P8CP5 = cms.untracked.vstring( +# '/store/mc/RunIISummer19UL18MiniAOD/QCD_Pt-15to7000_TuneCP5_Flat_13TeV_pythia8/MINIAODSIM/FlatPU0to70_106X_upgrade2018_realistic_v11_L1v1-v2/40000/F8EE4D72-7A79-A54E-B3A9-5DCBDE4FF8CE.root' +# '/store/mc/RunIISummer19UL18MiniAOD/QCD_Pt-15to7000_TuneCP5_Flat_13TeV_pythia8/MINIAODSIM/FlatPU0to70_106X_upgrade2018_realistic_v11_L1v1-v2/40000/E15DB014-9F37-7145-AA67-23E13B978E15.root' + '/store/mc/RunIISummer19UL18MiniAOD/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/MINIAODSIM/FlatPU0to70_106X_upgrade2018_realistic_v11_L1v1-v2/240000/EA3B1C7C-711B-1D4F-B3EA-801BACD83BC2.root' +) + +JHTA18 = cms.untracked.vstring( + '/store/data/Run2018A/JetHT/MINIAOD/PromptReco-v1/000/316/219/00000/78A33133-E758-E811-823B-FA163E3E5B56.root' +) + +ZBAUL18 = cms.untracked.vstring( + '/store/data/Run2018A/ZeroBias/MINIAOD/12Nov2019_UL2018-v2/70000/FC349574-5961-CD43-8AD9-80F9CF7842DA.root' +) + +JHTAUL18 = cms.untracked.vstring( + '/store/data/Run2018A/JetHT/MINIAOD/12Nov2019_UL2018-v2/270000/EA0E0A70-D4E2-BB40-B190-FBDE8B2AC53F.root' +) + + diff --git a/AnalysisFW/python/filterlists.py b/AnalysisFW/python/filterlists.py new file mode 100644 index 00000000000..b31b8dca667 --- /dev/null +++ b/AnalysisFW/python/filterlists.py @@ -0,0 +1,44 @@ +import FWCore.ParameterSet.Config as cms + +# These should be reviewed from time to time. See the listings at: +# https://twiki.cern.ch/twiki/bin/viewauth/CMS/MissingETOptionalFiltersRun2 + +fltlist = { + '16' : { # 8_0_X and 9_4_X MINIAOD (which originates from 8_0_X AOD) + 'dt' : cms.vstring( + "Flag_goodVertices","Flag_globalSuperTightHalo2016Filter","Flag_HBHENoiseFilter","Flag_HBHENoiseIsoFilter", + "Flag_EcalDeadCellTriggerPrimitiveFilter","Flag_BadPFMuonFilter", + "Flag_eeBadScFilter" + ), + 'mc' : cms.vstring( + "Flag_goodVertices","Flag_globalSuperTightHalo2016Filter","Flag_HBHENoiseFilter","Flag_HBHENoiseIsoFilter", + "Flag_EcalDeadCellTriggerPrimitiveFilter","Flag_BadPFMuonFilter" + ) + }, + '17' : { # 9_4_0 and further + 'dt' : cms.vstring( + "Flag_goodVertices","Flag_globalSuperTightHalo2016Filter","Flag_HBHENoiseFilter","Flag_HBHENoiseIsoFilter", + "Flag_EcalDeadCellTriggerPrimitiveFilter","Flag_BadPFMuonFilter", + "Flag_eeBadScFilter"#, +# "Flag_ecalBadCalibReducedMINIAODFilter" + ), + 'mc' : cms.vstring( + "Flag_goodVertices","Flag_globalSuperTightHalo2016Filter","Flag_HBHENoiseFilter","Flag_HBHENoiseIsoFilter", + "Flag_EcalDeadCellTriggerPrimitiveFilter","Flag_BadPFMuonFilter"#, +# "Flag_ecalBadCalibReducedMINIAODFilter" + ) + }, + '18' : { # 10_1_X and further + 'dt' : cms.vstring( + "Flag_goodVertices","Flag_globalSuperTightHalo2016Filter","Flag_HBHENoiseFilter","Flag_HBHENoiseIsoFilter", + "Flag_EcalDeadCellTriggerPrimitiveFilter","Flag_BadPFMuonFilter", + "Flag_eeBadScFilter"#, +# "Flag_ecalBadCalibReducedMINIAODFilter" + ), + 'mc' : cms.vstring( + "Flag_goodVertices","Flag_globalSuperTightHalo2016Filter","Flag_HBHENoiseFilter","Flag_HBHENoiseIsoFilter", + "Flag_EcalDeadCellTriggerPrimitiveFilter","Flag_BadPFMuonFilter"#, +# "Flag_ecalBadCalibReducedMINIAODFilter" + ) + } +} diff --git a/AnalysisFW/python/genConfig.py b/AnalysisFW/python/genConfig.py new file mode 100644 index 00000000000..2b3c823f28f --- /dev/null +++ b/AnalysisFW/python/genConfig.py @@ -0,0 +1,43 @@ +from CRABClient.UserUtilities import config +config = config() + +config.General.transferOutputs = True +config.General.transferLogs = False + +config.Data.inputDBS = 'global' +config.Data.outLFNDirBase = '/store/user/hsiikone' +config.Data.publication = False + +config.JobType.pluginName = 'Analysis' +config.Site.storageSite = 'T2_FI_HIP' + +if __name__ == '__main__': + from CRABAPI.RawCommand import crabCommand + from CRABClient.ClientExceptions import ClientException + from httplib import HTTPException + + def submit(config): + try: + crabCommand('submit', config = config) + except HTTPException as hte: + print "Failed submitting task: %s" % (hte.headers) + except ClientException as cle: + print "Failed submitting task: %s" % (cle) + + config.General.workArea = 'runs_mc' + config.Data.splitting = 'FileBased' + config.Data.unitsPerJob = 10 + + config.JobType.psetName = 'cfg/gen.py' + + config.General.requestName = 'GJetsRunUL16' + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL16GENAPV-106X_mcRun2_asymptotic_preVFP_v8-v2/GEN' + + #config.General.requestName = 'GJetsRunUL17' + #config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL17GEN-106X_mc2017_realistic_v6-v1/GEN' + + #config.General.requestName = 'GJetsRunUL18' + #config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL18GEN-106X_upgrade2018_realistic_v4-v2/GEN' + + print(config.Data.inputDataset) + submit(config) diff --git a/AnalysisFW/python/gengenConfig.py b/AnalysisFW/python/gengenConfig.py new file mode 100644 index 00000000000..4c41f2d324d --- /dev/null +++ b/AnalysisFW/python/gengenConfig.py @@ -0,0 +1,37 @@ +from CRABClient.UserUtilities import config +config = config() + +config.General.requestName = 'GJetsForEFracs' +config.General.workArea = 'runs_mc' +config.General.transferOutputs = True +config.General.transferLogs = False + +config.JobType.pluginName = 'PrivateMC' +config.JobType.psetName = 'cfg/gengen.py' + +config.Data.outputPrimaryDataset = 'MinBias' +config.Data.splitting = 'EventBased' +config.Data.unitsPerJob = 10000 +NJOBS = 1000 # This is not a configuration parameter, but an auxiliary variable that we use in the next line. +config.Data.totalUnits = config.Data.unitsPerJob * NJOBS +config.Data.publication = True +config.Data.outputDatasetTag = 'GenForEFracs' + +config.Site.storageSite = 'T2_FI_HIP' + +config.Data.outLFNDirBase = '/store/user/hsiikone' + +if __name__ == '__main__': + from CRABAPI.RawCommand import crabCommand + from CRABClient.ClientExceptions import ClientException + from httplib import HTTPException + + def submit(config): + try: + crabCommand('submit', config = config) + except HTTPException as hte: + print "Failed submitting task: %s" % (hte.headers) + except ClientException as cle: + print "Failed submitting task: %s" % (cle) + + submit(config) diff --git a/AnalysisFW/python/gjetsConfig.py b/AnalysisFW/python/gjetsConfig.py new file mode 100644 index 00000000000..100c9381a39 --- /dev/null +++ b/AnalysisFW/python/gjetsConfig.py @@ -0,0 +1,113 @@ +from CRABClient.UserUtilities import config +config = config() + +## Configurable parameters begin +import sys + +args = sys.argv +if len(args)<3: + sys.exit() + +Tag='' +# Choose 16/17/18 (for MC, 16e/16l and 18e/18l) +RunYear=args[1] +# Era or MC Type +Era=args[2] + +# True for DT, False for MC +DTMode=True +# Choose py/hw/nu/mg (MC only, only nu is implemented) +MCType='nu' +if Era=='nu' or Era=='py' or Era=='hw' or Era=='mg': + DTMode = False + MCType = Era + +config.General.transferOutputs = True +config.General.transferLogs = False + +config.Data.inputDBS = 'global' +config.Data.outLFNDirBase = '/store/user/hsiikone' +config.Data.publication = False + +config.JobType.pluginName = 'Analysis' +config.Site.storageSite = 'T2_FI_HIP' + +if __name__ == '__main__': + from CRABAPI.RawCommand import crabCommand + from CRABClient.ClientExceptions import ClientException + from httplib import HTTPException + Good=True + + def submit(config): + try: + crabCommand('submit', config = config) + except HTTPException as hte: + print "Failed submitting task: %s" % (hte.headers) + except ClientException as cle: + print "Failed submitting task: %s" % (cle) + + if not DTMode: + config.General.workArea = 'runs_mc' + IsEarly = RunYear[2:]=='e' # For 16 and 18, we have 'early' and 'late' campaigns (MC only) + RunYear = RunYear[:2] # Stripping the early/late tags + config.Data.splitting = 'FileBased' + config.Data.unitsPerJob = 10 + + # Neutrino Gun settings + add = "" + split = "" + if RunYear=='16': + split = "_PreVFP" if IsEarly else "_PostVFP" + add = "PreVFP" if IsEarly else "" + elif RunYear=='18': split = "" if IsEarly else "_HEM" + config.JobType.psetName = 'cfg/genj'+RunYear+MCType+add+'.py' + config.General.requestName = 'GJetsRun'+RunYear+MCType+split+Tag + if RunYear=='16': + if MCType=='nu': + Good=False + elif MCType=='py': # Not implemented + ##### Pythia 8 Flat + if IsEarly: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL16MiniAODAPVv2-EpsilonPU_106X_mcRun2_asymptotic_preVFP_v11-v1/MINIAODSIM' + #config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL16MiniAODAPVv2-106X_mcRun2_asymptotic_preVFP_v11-v1/MINIAODSIM' + else: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL16MiniAODv2-EpsilonPU_106X_mcRun2_asymptotic_v17-v1/MINIAODSIM' + #config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL16MiniAODv2-106X_mcRun2_asymptotic_v17-v1/MINIAODSIM' + elif MCType=='hw': # Not implemented + ##### Herwig7 Flat + if IsEarly: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL16MiniAODAPV-106X_mcRun2_asymptotic_preVFP_v8-v4/MINIAODSIM' + else: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL16MiniAOD-106X_mcRun2_asymptotic_v13-v2/MINIAODSIM' + Good=False + elif MCType=='mg': # Not implemented + Good=False + elif RunYear=='17': + # The files presented here are produced on CMSSW_9_2_8-9_4_6 + if MCType=='nu': + Good=False + elif MCType=='py': + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL17MiniAODv2-EpsilonPU_106X_mc2017_realistic_v9-v1/MINIAODSIM' + #config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2/MINIAODSIM' + elif MCType=='hw': + # Herwig7 Flat + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM' + Good=False + elif MCType=='mg': + Good=False + elif RunYear=='18': + if MCType=='nu': + Good=False + elif MCType=='py': + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL18MiniAODv2-EpsilonPU_106X_upgrade2018_realistic_v16_L1v1-v2/MINIAODSIM' + #config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer20UL18MiniAODv2-106X_upgrade2018_realistic_v16_L1v1-v2/MINIAODSIM' + elif MCType=='hw': + # Herwig7 Flat + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL18MiniAOD-106X_upgrade2018_realistic_v11_L1v1-v2/MINIAODSIM' + Good=False + elif MCType=='mg': + Good=False + + if Good: + print(config.Data.inputDataset) + submit(config) diff --git a/AnalysisFW/python/gtaglists.py b/AnalysisFW/python/gtaglists.py new file mode 100644 index 00000000000..1cf14b610f3 --- /dev/null +++ b/AnalysisFW/python/gtaglists.py @@ -0,0 +1,22 @@ +import FWCore.ParameterSet.Config as cms + +# The global tags should be checked from time to time. +# See: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideFrontierConditions#Global_Tags_for_2016_legacy_data +# However, the info on this page is not always up-to-date. +# If in doubt, use the browser https://cms-conddb.cern.ch/cmsDbBrowser/index/Prod +# Ultra Legacy summary: https://twiki.cern.ch/twiki/bin/view/CMS/PdmVRun2LegacyAnalysisSummaryTable +GTags = { + '16' : { + 'dt' : "106X_dataRun2_v35", + 'mc' : "106X_mcRun2_asymptotic_v17", + 'mcPreVFP' : "106X_mcRun2_asymptotic_preVFP_v11" + }, + '17' : { + 'dt' : "106X_dataRun2_v35", + 'mc' : "106X_mc2017_realistic_v9" + }, + '18' : { + 'dt' : "106X_dataRun2_v35", + 'mc' : "106X_upgrade2018_realistic_v16_L1v1" + } +} diff --git a/AnalysisFW/python/hadCfgProducer.py b/AnalysisFW/python/hadCfgProducer.py new file mode 100644 index 00000000000..592e831e149 --- /dev/null +++ b/AnalysisFW/python/hadCfgProducer.py @@ -0,0 +1,201 @@ +# This is a handy handle for producing crab parameter files +# -*- coding: utf-8 -*- + +######### +# Lists # +######### + +# Global tags +from gtaglists import * +# MET filters are fetched +from filterlists import * +# Triggers are fetched +from triggerlists import * + +############# +# Main text # +############# + +importer = [ + '# -*- coding: utf-8 -*-', + 'import FWCore.ParameterSet.Config as cms\n', + 'from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets', + 'from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters', + 'from RecoJets.JetProducers.PFJetParameters_cfi import *', + 'from RecoJets.JetProducers.GenJetParameters_cfi import *', + 'from RecoJets.JetProducers.AnomalousCellParameters_cfi import *', + 'from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import *', + 'from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets', + 'from PhysicsTools.PatAlgos.tools.jetTools import *', + 'from PhysicsTools.PatAlgos.patSequences_cff import *', + 'from PhysicsTools.PatAlgos.patTemplate_cfg import *', + 'from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos', + 'import sys\n', + 'from gtaglists import *', + 'from triggerlists import *', + 'from filterlists import *', + 'from filelists import *\n', +] + +process = [ + 'process = cms.Process("Ntuplizer")', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + '#! Conditions', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + 'process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff")', + 'from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag', + 'process.load("Configuration.EventContent.EventContent_cff")', + 'process.load("Configuration.StandardSequences.GeometryRecoDB_cff")', + 'process.load("Configuration.StandardSequences.MagneticField_38T_cff")', + 'process.load("RecoJets.Configuration.GenJetParticles_cff")', + 'process.load("RecoJets.Configuration.RecoGenJets_cff")', + 'process.load("RecoJets.JetProducers.TrackJetParameters_cfi")', + 'process.load("RecoJets.JetProducers.PileupJetIDParams_cfi")', + 'process.load("PhysicsTools.PatAlgos.patSequences_cff")\n', + '##-------------------- Import the JEC services -----------------------', + 'process.load("JetMETCorrections.Configuration.DefaultJEC_cff")\n', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + '#! Input', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', +] + +inputs = [ + 'process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(5000))\n', + 'process.source = cms.Source("PoolSource", fileNames = inFiles )\n', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + '#! Services', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + 'process.load("FWCore.MessageLogger.MessageLogger_cfi")', + 'process.MessageLogger.cerr.FwkReport.reportEvery = 100', + 'process.MessageLogger.cerr.threshold = cms.untracked.string("ERROR")', + 'process.MessageLogger = cms.Service("MessageLogger",', + ' destinations = cms.untracked.vstring(', + ' "errors"', + ' ),', + ' errors = cms.untracked.PSet(', + ' threshold = cms.untracked.string("ERROR")', + ' ),', + ')', + 'process.load("CommonTools.UtilAlgos.TFileService_cfi")', + 'process.TFileService.fileName=cms.string("DATA.root")', + 'process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",', + ' ak4 = cms.PSet(', + ' initialSeed = cms.untracked.uint32(81)', + ' ),', + ')', + 'process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer")', +] + +logging = [ + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + '#! Output and Log', + '#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + 'process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) )', + 'process.options.allowUnscheduled = cms.untracked.bool(True)', +] + +# jettype: 'ak4', 'ak8', 'zb' +def producer(RunYear,era,Mode): + if era=='mc' or era=='hw' or era=='mg': + print("MC mode",era,"not implemented, exiting!") + return + add='' if era=='dt' else era + add+='PreVFP' if len(Mode)!=2 else '' + jettype='zb' + fname="cfg/had"+RunYear+add+".py" + with open(fname, 'w') as f: + # Import lines + for line in importer: + f.write(line+'\n') + f.write('\n') + # Process.load lines + for line in process: + f.write(line+'\n') + f.write('\n') + # Global tag is set + GTag = GTags[RunYear][Mode] + Mode=Mode[:2] + f.write('process.GlobalTag.globaltag = "'+GTag+'"\n') + if GTag=='DEFAULT': + f.write('process.GlobalTag = GlobalTag(process.GlobalTag, "auto:run2_' + ('data' if Mode=='dt' else 'mc') + '" )\n') + f.write('\n') + # Triggers: + ## Active + f.write('triggers=') + if Mode=='dt': + f.write('trglist["'+RunYear+'"]["dt"]["'+jettype+'"]\n\n') + else: + f.write('trglist["'+RunYear+'"]["mc"]["'+jettype+'"]\n\n') + # MET filters + f.write('filters=fltlist["'+RunYear+'"]["'+Mode+'"]\n\n') + # Testing input files + f.write('inFiles=') + if RunYear=='16': + if jettype=='zb': + f.write('ZBD16\n') + elif Mode=='dt': + f.write('JHTG16\n') + elif MC=='py': + f.write('QCD16Mor17P8M1\n') + elif MC=='hw': + f.write('QCD16Mor17HS1\n') + elif MC=='mg': + f.write('QCD16MG\n') + elif MC=='nu': + f.write('QCD16NU\n') + else: + f.write('cms.untracked.vstring()\n') + elif RunYear=='17': + if jettype=='zb': + f.write('ZBDUL17\n') + elif Mode=='dt': + f.write('JHTDUL17\n') + elif MC=='py': + f.write('QCDUL17P8CP5\n') + elif MC=='nu': + f.write('QCDUL17NU\n') + elif MC=='hw': + f.write('QCD17HS1\n') + elif MC=='mg': + f.write('QCD17MG\n') + else: + f.write('cms.untracked.vstring()\n') + elif RunYear=='18': + if jettype=='zb': + f.write('ZBAUL18\n') + elif Mode=='dt': + f.write('JHTAUL18\n') + elif MC=='py': + f.write('QCDUL18P8CP5\n') + #f.write('QCD18P8CP5\n') + elif MC=='mg': + f.write('QCD18MG\n') + else: + f.write('cms.untracked.vstring()\n') + else: + f.write('cms.untracked.vstring()\n') + # Remaining input stuff + for line in inputs: + f.write(line+'\n') + # EDAnalyzer for PatJets + f.write('process.load("PhysicsTools.PatAlgos.patSequences_cff")\n') + f.write("process.ak4 = cms.EDAnalyzer('ProcessedHadrons',\n") + f.write(" isMCarlo = cms.untracked.bool("+("False" if Mode=="dt" else "True")+"),\n") + f.write(" filterName = filters,\n") + f.write(" triggerName = triggers,\n") + f.write(")\n\n") + f.write("process.path = cms.Path(") + f.write("process.ak4*\n") + f.write("process.randomEngineStateProducer)\n") + f.write("\n") + for line in logging: + f.write(line+'\n') + +# Produce the run files +for RunYear in ['16','17','18']: + #for MC in ['py','nu','hw','mg']: + for MC in ['nu']: + producer(RunYear,MC,'mc') + if RunYear=='16': + producer(RunYear,MC,'mcPreVFP') + producer(RunYear,'dt','dt') diff --git a/AnalysisFW/python/hadsConfig.py b/AnalysisFW/python/hadsConfig.py new file mode 100644 index 00000000000..d562dfcfe02 --- /dev/null +++ b/AnalysisFW/python/hadsConfig.py @@ -0,0 +1,176 @@ +from CRABClient.UserUtilities import config +config = config() + +## Configurable parameters begin +import sys + +args = sys.argv +if len(args)<3: + sys.exit() + +Tag='' +# Choose 16/17/18 (for MC, 16e/16l and 18e/18l) +RunYear=args[1] +# Era or MC Type +Era=args[2] + +# True for DT, False for MC +DTMode=True +# Choose py/hw/nu/mg (MC only, only nu is implemented) +MCType='nu' +if Era=='nu' or Era=='py' or Era=='hw' or Era=='mg': + DTMode = False + MCType = Era + +config.General.transferOutputs = True +config.General.transferLogs = False + +config.Data.inputDBS = 'global' +config.Data.outLFNDirBase = '/store/user/hsiikone' +config.Data.publication = False + +config.JobType.pluginName = 'Analysis' +config.Site.storageSite = 'T2_FI_HIP' + +if __name__ == '__main__': + from CRABAPI.RawCommand import crabCommand + from CRABClient.ClientExceptions import ClientException + from httplib import HTTPException + Good=True + + def submit(config): + try: + crabCommand('submit', config = config) + except HTTPException as hte: + print "Failed submitting task: %s" % (hte.headers) + except ClientException as cle: + print "Failed submitting task: %s" % (cle) + + if DTMode: + config.General.workArea = 'runs_dt' + config.Data.splitting = 'LumiBased' + config.Data.unitsPerJob = 100 + config.JobType.psetName = 'cfg/had'+RunYear+'.py' + config.General.requestName = 'PartsRun'+RunYear+Era+Tag + Ver = '1' + Campaign = '' + # UL ReReco + # UL ReReco + if RunYear=='16': + # CMSSW 10_6_8_patch1: Era == Be/Bl/C/D/E/Fe/Fl/G/H + config.Data.lumiMask = '/afs/cern.ch/user/h/hsiikone/work/certificates/Cert_271036-284044_13TeV_Legacy2016_Collisions16_JSON.txt' + if Era=='Be': + Campaign = '21Feb2020_ver1_UL2016' + Era = 'B' + elif Era=='Bl': + Campaign = '21Feb2020_ver2_UL2016' + Era = 'B' + else: + Campaign = '21Feb2020_UL2016' + # HIP issue mitigation + if Era=='B' or Era=='C' or Era=='D' or Era=='E' or Era=='Fe': + Campaign += '_HIPM' + # Late F produced without HIP mitigation + if Era=='Fe': Era = 'F' + if Era=='Fl': Era = 'F' + elif RunYear=='17': + # CMSSW 10_6_2: Era == B/C/D/E/F + config.Data.lumiMask = '/afs/cern.ch/user/h/hsiikone/work/certificates/Cert_294927-306462_13TeV_UL2017_Collisions17_GoldenJSONmod.txt' + Campaign = '09Aug2019_UL2017' + if Era=='C': Campaign += '_MiniAODv2' + elif Era=='F': config.Data.unitsPerJob = 80 + elif RunYear=='18': + # CMSSW 10_6_4_patch1: Era == A/B/C/D + config.Data.lumiMask = '/afs/cern.ch/user/h/hsiikone/work/certificates/Cert_314472-325175_13TeV_Legacy2018_Collisions18_JSON.txt' + Ver = '2' + Campaign = '12Nov2019_UL2018' + if Era=='A': config.Data.unitsPerJob = 100 + elif Era=='D': config.Data.unitsPerJob = 160 + if Era=='C' or Era=='D': + Campaign += '_rsb' + Ver = '1' + # For now, only ZeroBias is used + config.Data.inputDataset = '/ZeroBias/Run20'+RunYear+Era+'-'+Campaign+'-v'+Ver+'/MINIAOD' + else: + config.General.workArea = 'runs_mc' + IsEarly = RunYear[2:]=='e' # For 16 and 18, we have 'early' and 'late' campaigns (MC only) + RunYear = RunYear[:2] # Stripping the early/late tags + config.Data.splitting = 'FileBased' + config.Data.unitsPerJob = 1 + + # Neutrino Gun settings + add = "" + split = "" + if RunYear=='16': + split = "_PreVFP" if IsEarly else "_PostVFP" + add = "PreVFP" if IsEarly else "" + elif RunYear=='18': split = "" if IsEarly else "_HEM" + config.JobType.psetName = 'cfg/had'+RunYear+MCType+add+'.py' + config.General.requestName = 'PartsRun'+RunYear+MCType+split+Tag + if RunYear=='16': + if MCType=='nu': + ##### Neutrino Gun + if IsEarly: + config.Data.inputDataset = '/SingleNeutrino/RunIISummer19UL16MiniAODAPV-106X_mcRun2_asymptotic_preVFP_v8_ext3-v2/MINIAODSIM' + else: + config.Data.inputDataset = '/SingleNeutrino/RunIISummer19UL16MiniAOD-106X_mcRun2_asymptotic_v13-v2/MINIAODSIM' + elif MCType=='py': # Not implemented + ##### Pythia 8 Flat + if IsEarly: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer19UL16MiniAODAPV-106X_mcRun2_asymptotic_preVFP_v8_ext1-v2/MINIAODSIM' + else: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer19UL16MiniAOD-106X_mcRun2_asymptotic_v13-v2/MINIAODSIM' + Good=False + elif MCType=='hw': # Not implemented + ##### Herwig7 Flat + if IsEarly: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL16MiniAODAPV-106X_mcRun2_asymptotic_preVFP_v8-v4/MINIAODSIM' + else: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL16MiniAOD-106X_mcRun2_asymptotic_v13-v2/MINIAODSIM' + Good=False + elif MCType=='mg': # Not implemented + ##### Madgraph + Pythia8 HT slices + if IsEarly: + config.Data.inputDataset = '/QCD_'+HTRanges[RangeIdx]+'_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/RunIISummer19UL16MiniAODAPV-106X_mcRun2_asymptotic_preVFP_v8-v1/MINIAODSIM' + else: + config.Data.inputDataset = '/QCD_'+HTRanges[RangeIdx]+'_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/RunIISummer19UL16MiniAOD-106X_mcRun2_asymptotic_v13-v2/MINIAODSIM' + Good=False + elif RunYear=='17': + # The files presented here are produced on CMSSW_9_2_8-9_4_6 + if MCType=='nu': + config.Data.inputDataset = '/SingleNeutrino/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM' + elif MCType=='py': + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM' + Good=False + elif MCType=='hw': + # Herwig7 Flat + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM' + Good=False + elif MCType=='mg': + ##### Madgraph + Pythia8 HT slices + config.Data.inputDataset = '/QCD_'+HTRanges[RangeIdx]+'_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM' + Good=False + elif RunYear=='18': + if MCType=='nu': + if IsEarly: + config.Data.inputDataset = '/SingleNeutrino/RunIISummer19UL18MiniAOD-FlatPU0to70_106X_upgrade2018_realistic_v11_L1v1-v1/MINIAODSIM' + else: + config.Data.inputDataset = '/SingleNeutrino/RunIISummer19UL18MiniAOD-FlatPU0to70_UL18HEMreReco_106X_upgrade2018_realistic_v11_L1v1-v1/MINIAODSIM' + elif MCType=='py': + if IsEarly: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer19UL18MiniAOD-FlatPU0to70_106X_upgrade2018_realistic_v11_L1v1-v2/MINIAODSIM' + else: + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIISummer19UL18MiniAOD-FlatPU0to70_UL18HEMreReco_106X_upgrade2018_realistic_v11_L1v1-v2/MINIAODSIM' + Good=False + elif MCType=='hw': + # Herwig7 Flat + config.Data.inputDataset = '/QCD_Pt-15to7000_TuneCH3_Flat_13TeV_herwig7/RunIISummer19UL18MiniAOD-106X_upgrade2018_realistic_v11_L1v1-v2/MINIAODSIM' + Good=False + elif MCType=='mg': + ##### Madgraph + Pythia8 HT slices + config.Data.inputDataset = '/QCD_'+HTRanges[RangeIdx]+'_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/RunIISummer19UL18MiniAOD-106X_upgrade2018_realistic_v11_L1v1-v2/MINIAODSIM' + Good=False + + if Good: + print(config.Data.inputDataset) + submit(config) diff --git a/AnalysisFW/python/legacycfg/ProcessedTreeProducer16DTm.py b/AnalysisFW/python/legacycfg/ProcessedTreeProducer16DTm.py new file mode 100644 index 00000000000..897bba3d08a --- /dev/null +++ b/AnalysisFW/python/legacycfg/ProcessedTreeProducer16DTm.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- + +import FWCore.ParameterSet.Config as cms + +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets +from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters +from RecoJets.JetProducers.PFJetParameters_cfi import * +from RecoJets.JetProducers.GenJetParameters_cfi import * +from RecoJets.JetProducers.AnomalousCellParameters_cfi import * +from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * +from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets +from PhysicsTools.PatAlgos.tools.jetTools import * +from PhysicsTools.PatAlgos.patSequences_cff import * +from PhysicsTools.PatAlgos.patTemplate_cfg import * +from PhysicsTools.PatAlgos.tools.jetTools import * +from RecoJets.JetProducers.QGTagger_cfi import QGTagger +from triggerlists import * +from filelists import * +from filterlists import * + +import FWCore.ParameterSet.Config as cms +import sys + +process = cms.Process("Ntuplizer") +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Conditions +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") +process.load("Configuration.EventContent.EventContent_cff") +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('RecoJets.Configuration.GenJetParticles_cff') +process.load('RecoJets.Configuration.RecoGenJets_cff') +process.load('RecoJets.JetProducers.TrackJetParameters_cfi') +process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.GlobalTag.globaltag = "80X_dataRun2_2016LegacyRepro_v4" + +##-------------------- Import the JEC services ----------------------- +process.load('JetMETCorrections.Configuration.DefaultJEC_cff') + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Input +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1000)) + +trgs = trglist['16']['D'] +inFiles = JHTD16 +#inFiles = cms.untracked.vstring() +filters = fltlist['16']['dt'] + +ak4flag = True +zbflag = False + +process.source = cms.Source("PoolSource", fileNames = inFiles ) + +process.load('CommonTools.RecoAlgos.HBHENoiseFilterResultProducer_cfi') +process.load('CommonTools.RecoAlgos.HBHENoiseFilter_cfi') + +process.HBHENoiseFilterResultProducerNoMinZ = process.HBHENoiseFilterResultProducer.clone(minZeros = cms.int32(99999)) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Services +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 100 +process.load('CommonTools.UtilAlgos.TFileService_cfi') +process.TFileService.fileName=cms.string('DATA.root') + +triggers=cms.vstring() +follows=cms.vstring() +jetname='slimmedJets' +gjetname='slimmedGenJets' +jetnolim=1 +if ak4flag: + # Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion + process.load('RecoJets.JetProducers.QGTagger_cfi') + process.QGTagger.srcJets = cms.InputTag('slimmedJets') + process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') + + if zbflag: + triggers=trgs['zb'] + else: + triggers=trgs['ak4'] + follows=trgs['ak8'] +else: + jetname='slimmedJetsAK8' + gjetname='slimmedGenJetsAK8' + jetnolim=0 + if zbflag: + sys.exit() + else: + triggers=trgs['ak8'] + follows=trgs['ak4'] + +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +#process.ak8 = cms.EDAnalyzer('ProcessedTreeProducerBTag', +process.ak4 = cms.EDAnalyzer('ProcessedTreeProducerBTag', + ## jet collections ########################### + pfjetschs = cms.InputTag(jetname), + pfchsjetpuid = cms.string("pileupJetId:fullDiscriminant"), + runYear = cms.untracked.string("2016"), + ## MET collection #### + pfmetT1 = cms.InputTag('slimmedMETs'), + genjets = cms.untracked.InputTag(gjetname), + ## database entry for the uncertainties ###### + PFPayloadName = cms.string(''), + jecUncSrc = cms.untracked.string(''), + jecUncSrcNames = cms.vstring(''), + ## set the conditions for good Vtx counting ## + offlineVertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + beamSpot = cms.InputTag('offlineBeamSpot'), + goodVtxNdof = cms.double(4), + goodVtxZ = cms.double(24), + ## rho ####################################### + srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), + srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), + srcPULabel = cms.untracked.InputTag('slimmedAddPileupInfo'), + ## preselection cuts ######################### + maxEta = cms.double(5.0), + minPFPt = cms.double(15.0), + minPFPtThirdJet = cms.double(5.0), + minNPFJets = cms.uint32(jetnolim), + minGenPt = cms.untracked.double(20), + isMCarlo = cms.untracked.bool(False), + useGenInfo = cms.untracked.bool(False), + AK4 = cms.untracked.bool(ak4flag), + ZB = cms.untracked.bool(zbflag), + ## trigger ################################### + printTriggerMenu= cms.untracked.bool(False), + processName = cms.untracked.string('HLT'), + filterName = filters, + triggerName = triggers, + triggerFollow = follows, + filterFlags = cms.untracked.InputTag("TriggerResults","","RECO"), + triggerResults = cms.untracked.InputTag("TriggerResults","","HLT"), + triggerHLTObjs = cms.untracked.InputTag("selectedPatTrigger"), + triggerL1Objs = cms.untracked.InputTag("caloStage2Digis","Jet"), + triggerL1HTObjs = cms.untracked.InputTag("caloStage2Digis","EtSum"), + #triggerAllObjs = cms.untracked.InputTag("gtStage2Digis","GlobalAlgBlk"), + prescales = cms.InputTag("patTrigger"), + prescalesL1Min = cms.InputTag("patTrigger","l1min"), + prescalesL1Max = cms.InputTag("patTrigger","l1max"), + ## jec services ############################## + EventInfo = cms.untracked.InputTag("generator"), + GenParticles = cms.untracked.InputTag("genparticles"), + jetFlavourInfos = cms.untracked.InputTag("genJetFlavourInfos"), + saveWeights = cms.bool(False), + HBHENoiseFilterResultNoMinZLabel = cms.untracked.InputTag("HBHENoiseFilterResultProducerNoMinZ", "HBHENoiseFilterResult") +) + +#Try scheduled processs +process.path = cms.Path(process.HBHENoiseFilterResultProducerNoMinZ* + process.ak4) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Output and Log +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) +process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/python/legacycfg/ProcessedTreeProducer16Hpm.py b/AnalysisFW/python/legacycfg/ProcessedTreeProducer16Hpm.py new file mode 100644 index 00000000000..52aeba0a155 --- /dev/null +++ b/AnalysisFW/python/legacycfg/ProcessedTreeProducer16Hpm.py @@ -0,0 +1,169 @@ +# -*- coding: utf-8 -*- + +import FWCore.ParameterSet.Config as cms + +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets +from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters +from RecoJets.JetProducers.PFJetParameters_cfi import * +from RecoJets.JetProducers.GenJetParameters_cfi import * +from RecoJets.JetProducers.AnomalousCellParameters_cfi import * +from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * +from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets +from PhysicsTools.PatAlgos.tools.jetTools import * +from PhysicsTools.PatAlgos.patSequences_cff import * +from PhysicsTools.PatAlgos.patTemplate_cfg import * +from PhysicsTools.PatAlgos.tools.jetTools import * +from RecoJets.JetProducers.QGTagger_cfi import QGTagger +from triggerlists import * +from filelists import * +from filterlists import * + +# -*- coding: utf-8 -*- +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Ntuplizer") +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Conditions +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") +process.load("Configuration.EventContent.EventContent_cff") +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('RecoJets.Configuration.GenJetParticles_cff') +process.load('RecoJets.Configuration.RecoGenJets_cff') +process.load('RecoJets.JetProducers.TrackJetParameters_cfi') +process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.GlobalTag.globaltag = "80X_mcRun2_asymptotic_2016_TrancheIV_v6" + +##-------------------- Import the JEC services ----------------------- +process.load('JetMETCorrections.Configuration.DefaultJEC_cff') + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Input +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10000)) + +triggers = cms.vstring() +follows = cms.vstring() +inFiles = QCD16Mor17HS1 +filters = flt16MC + +zbflag = False +ak4flag = False + +process.source = cms.Source("PoolSource", fileNames = inFiles ) + +process.load('CommonTools.RecoAlgos.HBHENoiseFilterResultProducer_cfi') +process.load('CommonTools.RecoAlgos.HBHENoiseFilter_cfi') + +process.HBHENoiseFilterResultProducerNoMinZ = process.HBHENoiseFilterResultProducer.clone(minZeros = cms.int32(99999)) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Services +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 100 +process.MessageLogger.cerr.threshold = cms.untracked.string("ERROR") +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring( + 'errors' + ), + errors = cms.untracked.PSet( + threshold = cms.untracked.string( 'ERROR' ) + ), +) +process.load('CommonTools.UtilAlgos.TFileService_cfi') +process.TFileService.fileName=cms.string('DATA.root') + +genParticleCollection = 'prunedGenParticles' +#jetname='slimmedJets' +#gjetname='slimmedGenJets' +jetname='slimmedJetsAK8' +gjetname='slimmedGenJetsAK8' + +# Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion +#process.load('RecoJets.JetProducers.QGTagger_cfi') +#process.QGTagger.srcJets = cms.InputTag(jetname) +#process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') + +genSrc = "generator" +process.load('PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi') +process.selectedHadronsAndPartons.src = genSrc +process.selectedHadronsAndPartons.particles = genParticleCollection +process.selectedHadronsAndPartons.partonMode = cms.string("Auto") +process.physDefHadronsAndPartons = process.selectedHadronsAndPartons.clone( fullChainPhysPartons = cms.bool(False) ) + +from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos +process.jetFlavs = ak4JetFlavourInfos.clone( jets = gjetname, + partons = cms.InputTag("selectedHadronsAndPartons","algorithmicPartons") ) +process.jetFlavsPD = process.jetFlavs.clone( partons = cms.InputTag("physDefHadronsAndPartons","physicsPartons") ) + +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.ak8 = cms.EDAnalyzer('ProcessedTreeProducerBTag', + ## jet collections ########################### + pfjetschs = cms.InputTag(jetname), + pfchsjetpuid = cms.string('pileupJetId:fullDiscriminant'), + runYear = cms.untracked.string("2016"), + ## MET collection #### + pfmetT1 = cms.InputTag('slimmedMETs'), + genjets = cms.untracked.InputTag(gjetname), + ## database entry for the uncertainties ###### + PFPayloadName = cms.string(''), + jecUncSrc = cms.untracked.string(''), + jecUncSrcNames = cms.vstring(''), + ## set the conditions for good Vtx counting ## + offlineVertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + beamSpot = cms.InputTag('offlineBeamSpot'), + goodVtxNdof = cms.double(4), + goodVtxZ = cms.double(24), + ## rho ####################################### + srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), + srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), + srcPULabel = cms.untracked.InputTag('slimmedAddPileupInfo'), + ## preselection cuts ######################### + maxEta = cms.double(5.0), + minPFPt = cms.double(15.0), + minPFPtThirdJet = cms.double(5.0), +# minNPFJets = cms.uint32(1), #AK4 + minNPFJets = cms.uint32(0), #AK8 + minGenPt = cms.untracked.double(15.0), + isMCarlo = cms.untracked.bool(True), + useGenInfo = cms.untracked.bool(True), + AK4 = cms.untracked.bool(ak4flag), + mcType = cms.untracked.int32(1), + ZB = cms.untracked.bool(zbflag), + ## trigger ################################### + printTriggerMenu= cms.untracked.bool(False), + processName = cms.untracked.string('HLT'), + filterName = filters, + triggerName = triggers, + triggerFollow = follows, + filterFlags = cms.untracked.InputTag("TriggerResults","","RECO"), + triggerResults = cms.untracked.InputTag("TriggerResults","","HLT"), + triggerHLTObjs = cms.untracked.InputTag("selectedPatTrigger"), + triggerL1Objs = cms.untracked.InputTag("caloStage2Digis","Jet"), + triggerL1HTObjs = cms.untracked.InputTag("caloStage2Digis","EtSum"), + #triggerAllObjs = cms.untracked.InputTag("gtStage2Digis","GlobalAlgBlk"), + prescales = cms.InputTag("patTrigger"), + prescalesL1Min = cms.InputTag("patTrigger","l1min"), + prescalesL1Max = cms.InputTag("patTrigger","l1max"), + ## jec services ############################## + EventInfo = cms.untracked.InputTag(genSrc), + GenParticles = cms.untracked.InputTag(genParticleCollection), + jetFlavInfos = cms.untracked.InputTag("jetFlavs"), + jetFlavInfosPD = cms.untracked.InputTag("jetFlavsPD"), + saveWeights = cms.bool(False) +) + +#Try scheduled processs +process.path = cms.Path(process.ak8) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Output and Log +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) +process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/python/legacycfg/ProcessedTreeProducer16PYm.py b/AnalysisFW/python/legacycfg/ProcessedTreeProducer16PYm.py new file mode 100644 index 00000000000..373afc2206e --- /dev/null +++ b/AnalysisFW/python/legacycfg/ProcessedTreeProducer16PYm.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- + +import FWCore.ParameterSet.Config as cms + +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets +from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters +from RecoJets.JetProducers.PFJetParameters_cfi import * +from RecoJets.JetProducers.GenJetParameters_cfi import * +from RecoJets.JetProducers.AnomalousCellParameters_cfi import * +from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * +from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets +from PhysicsTools.PatAlgos.tools.jetTools import * +from PhysicsTools.PatAlgos.patSequences_cff import * +from PhysicsTools.PatAlgos.patTemplate_cfg import * +from PhysicsTools.PatAlgos.tools.jetTools import * +from RecoJets.JetProducers.QGTagger_cfi import QGTagger +from filelists import * +from filterlists import * + +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Ntuplizer") +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Conditions +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") +process.load("Configuration.EventContent.EventContent_cff") +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('RecoJets.Configuration.GenJetParticles_cff') +process.load('RecoJets.Configuration.RecoGenJets_cff') +process.load('RecoJets.JetProducers.TrackJetParameters_cfi') +process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.GlobalTag.globaltag = "80X_mcRun2_asymptotic_2016_TrancheIV_v6" + +##-------------------- Import the JEC services ----------------------- +process.load('JetMETCorrections.Configuration.DefaultJEC_cff') + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Input +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10000)) + +triggers = cms.vstring() +follows = cms.vstring() +inFiles = QCD16Mor17P8M1 +filters = fltlist['16']['mc'] + +ak4flag = False +zbflag = False + +process.source = cms.Source("PoolSource", fileNames = inFiles ) + +process.load('CommonTools.RecoAlgos.HBHENoiseFilterResultProducer_cfi') +process.load('CommonTools.RecoAlgos.HBHENoiseFilter_cfi') + +process.HBHENoiseFilterResultProducerNoMinZ = process.HBHENoiseFilterResultProducer.clone(minZeros = cms.int32(99999)) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Services +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 100 +process.MessageLogger.cerr.threshold = cms.untracked.string("ERROR") +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring( + 'errors' + ), + errors = cms.untracked.PSet( + threshold = cms.untracked.string( 'ERROR' ) + ), +) +process.load('CommonTools.UtilAlgos.TFileService_cfi') +process.TFileService.fileName=cms.string('DATA.root') + +genParticleCollection = 'prunedGenParticles' +#jetname='slimmedJets' +#gjetname='slimmedGenJets' +jetname='slimmedJetsAK8' +gjetname='slimmedGenJetsAK8' + +# Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion +#process.load('RecoJets.JetProducers.QGTagger_cfi') +#process.QGTagger.srcJets = cms.InputTag(jetname) +#process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') + +process.load('PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi') +process.selectedHadronsAndPartons.particles = genParticleCollection +process.physDefHadronsAndPartons = process.selectedHadronsAndPartons.clone( fullChainPhysPartons = cms.bool(False) ) + +from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos +process.jetFlavs = ak4JetFlavourInfos.clone( jets = gjetname, + partons = cms.InputTag("selectedHadronsAndPartons","algorithmicPartons") ) +process.jetFlavsPD = process.jetFlavs.clone( partons = cms.InputTag("physDefHadronsAndPartons","physicsPartons") ) + +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.ak8 = cms.EDAnalyzer('ProcessedTreeProducerBTag', + ## jet collections ########################### + pfjetschs = cms.InputTag(jetname), + pfchsjetpuid = cms.string('pileupJetId:fullDiscriminant'), + runYear = cms.untracked.string("2016"), + ## MET collection #### + pfmetT1 = cms.InputTag('slimmedMETs'), + genjets = cms.untracked.InputTag(gjetname), + ## database entry for the uncertainties ###### + PFPayloadName = cms.string(''), + jecUncSrc = cms.untracked.string(''), + jecUncSrcNames = cms.vstring(''), + ## set the conditions for good Vtx counting ## + offlineVertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + beamSpot = cms.InputTag('offlineBeamSpot'), + goodVtxNdof = cms.double(4), + goodVtxZ = cms.double(24), + ## rho ####################################### + srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), + srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), + srcPULabel = cms.untracked.InputTag('slimmedAddPileupInfo'), + ## preselection cuts ######################### + maxEta = cms.double(5.0), + minPFPt = cms.double(15.0), + minPFPtThirdJet = cms.double(5.0), +# minNPFJets = cms.uint32(1), #AK4 + minNPFJets = cms.uint32(0), #AK8 + minGenPt = cms.untracked.double(15.0), + isMCarlo = cms.untracked.bool(True), + useGenInfo = cms.untracked.bool(True), + AK4 = cms.untracked.bool(ak4flag), + ZB = cms.untracked.bool(zbflag), + ## trigger ################################### + printTriggerMenu= cms.untracked.bool(False), + processName = cms.untracked.string('HLT'), + filterName = filters, + triggerName = triggers, + triggerFollow = follows, + filterFlags = cms.untracked.InputTag("TriggerResults","","RECO"), + triggerResults = cms.untracked.InputTag("TriggerResults","","HLT"), + triggerHLTObjs = cms.untracked.InputTag("selectedPatTrigger"), + triggerL1Objs = cms.untracked.InputTag("caloStage2Digis","Jet"), + triggerL1HTObjs = cms.untracked.InputTag("caloStage2Digis","EtSum"), + #triggerAllObjs = cms.untracked.InputTag("gtStage2Digis","GlobalAlgBlk"), + prescales = cms.InputTag("patTrigger"), + prescalesL1Min = cms.InputTag("patTrigger","l1min"), + prescalesL1Max = cms.InputTag("patTrigger","l1max"), + ## jec services ############################## + EventInfo = cms.untracked.InputTag("generator"), + GenParticles = cms.untracked.InputTag(genParticleCollection), + jetFlavInfos = cms.untracked.InputTag("jetFlavs"), + jetFlavInfosPD = cms.untracked.InputTag("jetFlavsPD"), + saveWeights = cms.bool(False) +) + +#Try scheduled processs +process.path = cms.Path(process.ak8) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Output and Log +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) +process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/python/legacycfg/ProcessedTreeProducer16ZBm.py b/AnalysisFW/python/legacycfg/ProcessedTreeProducer16ZBm.py new file mode 100644 index 00000000000..b3fe2b7c3db --- /dev/null +++ b/AnalysisFW/python/legacycfg/ProcessedTreeProducer16ZBm.py @@ -0,0 +1,140 @@ +# -*- coding: utf-8 -*- + +import FWCore.ParameterSet.Config as cms + +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets +from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters +from RecoJets.JetProducers.PFJetParameters_cfi import * +from RecoJets.JetProducers.GenJetParameters_cfi import * +from RecoJets.JetProducers.AnomalousCellParameters_cfi import * +from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * +from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets +from PhysicsTools.PatAlgos.tools.jetTools import * +from PhysicsTools.PatAlgos.patSequences_cff import * +from PhysicsTools.PatAlgos.patTemplate_cfg import * +from PhysicsTools.PatAlgos.tools.jetTools import * +from RecoJets.JetProducers.QGTagger_cfi import QGTagger +from triggerlists import * +from filelists import * +from filterlists import * + +# -*- coding: utf-8 -*- +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Ntuplizer") +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Conditions +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") +process.load("Configuration.EventContent.EventContent_cff") +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('RecoJets.Configuration.GenJetParticles_cff') +process.load('RecoJets.Configuration.RecoGenJets_cff') +process.load('RecoJets.JetProducers.TrackJetParameters_cfi') +process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.GlobalTag.globaltag = "80X_dataRun2_2016LegacyRepro_v4" + +##-------------------- Import the JEC services ----------------------- +process.load('JetMETCorrections.Configuration.DefaultJEC_cff') + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Input +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10000)) + +triggers = trgZBFl16 +follows = cms.vstring() +inFiles = cms.untracked.vstring() +filters = flt16DT + +zbflag = True + +process.source = cms.Source("PoolSource", fileNames = inFiles ) + +process.load('CommonTools.RecoAlgos.HBHENoiseFilterResultProducer_cfi') +process.load('CommonTools.RecoAlgos.HBHENoiseFilter_cfi') + +process.HBHENoiseFilterResultProducerNoMinZ = process.HBHENoiseFilterResultProducer.clone(minZeros = cms.int32(99999)) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Services +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 100 +process.load('CommonTools.UtilAlgos.TFileService_cfi') +process.TFileService.fileName=cms.string('DATA.root') + +# Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion +process.load('RecoJets.JetProducers.QGTagger_cfi') +process.QGTagger.srcJets = cms.InputTag('slimmedJets') +process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') + +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.ak4 = cms.EDAnalyzer('ProcessedTreeProducerBTag', + ## jet collections ########################### + pfjetschs = cms.InputTag('slimmedJets'), + pfchsjetpuid = cms.string("pileupJetId:fullDiscriminant"), + runYear = cms.untracked.string("2016"), + ## MET collection #### + pfmetT1 = cms.InputTag('slimmedMETs'), + genjets = cms.untracked.InputTag('slimmedGenJets'), + ## database entry for the uncertainties ###### + PFPayloadName = cms.string(''), + jecUncSrc = cms.untracked.string(''), + jecUncSrcNames = cms.vstring(''), + ## set the conditions for good Vtx counting ## + offlineVertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + beamSpot = cms.InputTag('offlineBeamSpot'), + goodVtxNdof = cms.double(4), + goodVtxZ = cms.double(24), + ## rho ####################################### + srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), + srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), + srcPULabel = cms.untracked.InputTag('slimmedAddPileupInfo'), + ## preselection cuts ######################### + maxEta = cms.double(5.0), + minPFPt = cms.double(15.0), + minPFPtThirdJet = cms.double(5.0), + minNPFJets = cms.uint32(1), + minGenPt = cms.untracked.double(20), + isMCarlo = cms.untracked.bool(False), + useGenInfo = cms.untracked.bool(False), + AK4 = cms.untracked.bool(True), + ZB = cms.untracked.bool(zbflag), + ## trigger ################################### + printTriggerMenu= cms.untracked.bool(False), + processName = cms.untracked.string('HLT'), + filterName = filters, + triggerName = triggers, + triggerFollow = follows, + filterFlags = cms.untracked.InputTag("TriggerResults","","RECO"), + triggerResults = cms.untracked.InputTag("TriggerResults","","HLT"), + triggerHLTObjs = cms.untracked.InputTag("selectedPatTrigger"), + triggerL1Objs = cms.untracked.InputTag("caloStage2Digis","Jet"), + triggerL1HTObjs = cms.untracked.InputTag("caloStage2Digis","EtSum"), + #triggerAllObjs = cms.untracked.InputTag("gtStage2Digis","GlobalAlgBlk"), + prescales = cms.InputTag("patTrigger"), + prescalesL1Min = cms.InputTag("patTrigger","l1min"), + prescalesL1Max = cms.InputTag("patTrigger","l1max"), + ## jec services ############################## + EventInfo = cms.untracked.InputTag("generator"), + GenParticles = cms.untracked.InputTag("genparticles"), + jetFlavourInfos = cms.untracked.InputTag("genJetFlavourInfos"), + saveWeights = cms.bool(False), + HBHENoiseFilterResultNoMinZLabel = cms.untracked.InputTag("HBHENoiseFilterResultProducerNoMinZ", "HBHENoiseFilterResult") +) + +#Try scheduled processs +process.path = cms.Path(process.HBHENoiseFilterResultProducerNoMinZ* + process.ak4) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Output and Log +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) +process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/python/legacycfg/ProcessedTreeProducer17DTm.py b/AnalysisFW/python/legacycfg/ProcessedTreeProducer17DTm.py new file mode 100644 index 00000000000..d310b9b10e6 --- /dev/null +++ b/AnalysisFW/python/legacycfg/ProcessedTreeProducer17DTm.py @@ -0,0 +1,142 @@ +# -*- coding: utf-8 -*- + +import FWCore.ParameterSet.Config as cms + +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets +from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters +from RecoJets.JetProducers.PFJetParameters_cfi import * +from RecoJets.JetProducers.GenJetParameters_cfi import * +from RecoJets.JetProducers.AnomalousCellParameters_cfi import * +from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * +from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets +from PhysicsTools.PatAlgos.tools.jetTools import * +from PhysicsTools.PatAlgos.patSequences_cff import * +from PhysicsTools.PatAlgos.patTemplate_cfg import * +from PhysicsTools.PatAlgos.tools.jetTools import * +from RecoJets.JetProducers.QGTagger_cfi import QGTagger +from triggerlists import * +from filelists import * +from filterlists import * + +# -*- coding: utf-8 -*- +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Ntuplizer") +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Conditions +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") +process.load("Configuration.EventContent.EventContent_cff") +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('RecoJets.Configuration.GenJetParticles_cff') +process.load('RecoJets.Configuration.RecoGenJets_cff') +process.load('RecoJets.JetProducers.TrackJetParameters_cfi') +process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.GlobalTag.globaltag = "94X_dataRun2_v6" + +##-------------------- Import the JEC services ----------------------- +process.load('JetMETCorrections.Configuration.DefaultJEC_cff') + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Input +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1000)) + +triggers = trgAK4B17 +follows = cms.vstring() +inFiles = JHTB17 +#inFiles = cms.untracked.vstring() +filters = flt17DT + +zbflag = False + +process.source = cms.Source("PoolSource", fileNames = inFiles ) + +process.load('CommonTools.RecoAlgos.HBHENoiseFilterResultProducer_cfi') +process.load('CommonTools.RecoAlgos.HBHENoiseFilter_cfi') + +process.HBHENoiseFilterResultProducerNoMinZ = process.HBHENoiseFilterResultProducer.clone(minZeros = cms.int32(99999)) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Services +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 100 +process.load('CommonTools.UtilAlgos.TFileService_cfi') +process.TFileService.fileName=cms.string('DATA.root') + +# Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion +process.load('RecoJets.JetProducers.QGTagger_cfi') +process.QGTagger.srcJets = cms.InputTag('slimmedJets') +process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') + +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.ak4 = cms.EDAnalyzer('ProcessedTreeProducerBTag', + ## jet collections ########################### + pfjetschs = cms.InputTag('slimmedJets'), + pfchsjetpuid = cms.string("pileupJetId:fullDiscriminant"), + runYear = cms.untracked.string("2017"), + ## MET collection #### + pfmetT1 = cms.InputTag('slimmedMETs'), + genjets = cms.untracked.InputTag('slimmedGenJets'), + ## database entry for the uncertainties ###### + PFPayloadName = cms.string(''), + jecUncSrc = cms.untracked.string(''), + jecUncSrcNames = cms.vstring(''), + ## set the conditions for good Vtx counting ## + offlineVertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + beamSpot = cms.InputTag('offlineBeamSpot'), + goodVtxNdof = cms.double(4), + goodVtxZ = cms.double(24), + ## rho ####################################### + srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), + srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), + srcPULabel = cms.untracked.InputTag('slimmedAddPileupInfo'), + ## preselection cuts ######################### + maxEta = cms.double(5.0), + minPFPt = cms.double(15.0), + minPFPtThirdJet = cms.double(5.0), + minNPFJets = cms.uint32(1), + minGenPt = cms.untracked.double(20), + isMCarlo = cms.untracked.bool(False), + useGenInfo = cms.untracked.bool(False), + AK4 = cms.untracked.bool(True), + ZB = cms.untracked.bool(zbflag), + ## trigger ################################### + printTriggerMenu= cms.untracked.bool(False), + processName = cms.untracked.string('HLT'), + filterName = filters, + triggerName = triggers, + triggerFollow = follows, + filterFlags = cms.untracked.InputTag("TriggerResults","","RECO"), + triggerResults = cms.untracked.InputTag("TriggerResults","","HLT"), + triggerHLTObjs = cms.untracked.InputTag("slimmedPatTrigger"), + triggerL1Objs = cms.untracked.InputTag("caloStage2Digis","Jet"), + triggerL1HTObjs = cms.untracked.InputTag("caloStage2Digis","EtSum"), + #triggerAllObjs = cms.untracked.InputTag("gtStage2Digis","GlobalAlgBlk"), + prescales = cms.InputTag("patTrigger"), + prescalesL1Min = cms.InputTag("patTrigger","l1min"), + prescalesL1Max = cms.InputTag("patTrigger","l1max"), + ## jec services ############################## + EventInfo = cms.untracked.InputTag("generator"), + GenParticles = cms.untracked.InputTag("genparticles"), + jetFlavourInfos = cms.untracked.InputTag("genJetFlavourInfos"), + saveWeights = cms.bool(False), + HBHENoiseFilterResultNoMinZLabel = cms.untracked.InputTag("HBHENoiseFilterResultProducerNoMinZ", "HBHENoiseFilterResult") +) + +#Try scheduled processs +process.path = cms.Path(process.QGTagger* + process.HBHENoiseFilterResultProducerNoMinZ* + process.ak4) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Output and Log +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) +process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/python/legacycfg/ProcessedTreeProducer17PYm.py b/AnalysisFW/python/legacycfg/ProcessedTreeProducer17PYm.py new file mode 100644 index 00000000000..ac07f987bb9 --- /dev/null +++ b/AnalysisFW/python/legacycfg/ProcessedTreeProducer17PYm.py @@ -0,0 +1,165 @@ +# -*- coding: utf-8 -*- + +import FWCore.ParameterSet.Config as cms + +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets +from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters +from RecoJets.JetProducers.PFJetParameters_cfi import * +from RecoJets.JetProducers.GenJetParameters_cfi import * +from RecoJets.JetProducers.AnomalousCellParameters_cfi import * +from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * +from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets +from PhysicsTools.PatAlgos.tools.jetTools import * +from PhysicsTools.PatAlgos.patSequences_cff import * +from PhysicsTools.PatAlgos.patTemplate_cfg import * +from PhysicsTools.PatAlgos.tools.jetTools import * +from RecoJets.JetProducers.QGTagger_cfi import QGTagger +from triggerlists import * +from filelists import * +from filterlists import * + +# -*- coding: utf-8 -*- +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Ntuplizer") +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Conditions +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") +process.load("Configuration.EventContent.EventContent_cff") +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('RecoJets.Configuration.GenJetParticles_cff') +process.load('RecoJets.Configuration.RecoGenJets_cff') +process.load('RecoJets.JetProducers.TrackJetParameters_cfi') +process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.GlobalTag.globaltag = "94X_mc2017_realistic_v14" + +##-------------------- Import the JEC services ----------------------- +process.load('JetMETCorrections.Configuration.DefaultJEC_cff') + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Input +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1000)) + +triggers = cms.vstring() +follows = cms.vstring() +inFiles = QCD17P8CP5 +filters = flt17MC + +zbflag = False + +process.source = cms.Source("PoolSource", fileNames = inFiles ) + +process.load('CommonTools.RecoAlgos.HBHENoiseFilterResultProducer_cfi') +process.load('CommonTools.RecoAlgos.HBHENoiseFilter_cfi') +process.HBHENoiseFilterResultProducerNoMinZ = process.HBHENoiseFilterResultProducer.clone(minZeros = cms.int32(99999)) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Services +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 100 +process.MessageLogger.cerr.threshold = cms.untracked.string("ERROR") +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring( + 'errors' + ), + errors = cms.untracked.PSet( + threshold = cms.untracked.string( 'ERROR' ) + ), +) +process.load('CommonTools.UtilAlgos.TFileService_cfi') +process.TFileService.fileName=cms.string('DATA.root') + +# Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion +process.load('RecoJets.JetProducers.QGTagger_cfi') +process.QGTagger.srcJets = cms.InputTag('slimmedJets') +process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') + +genParticleCollection = 'prunedGenParticles' +genJetCollection = 'slimmedGenJets' + +process.load('PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi') +process.selectedHadronsAndPartons.particles = genParticleCollection +process.physDefHadronsAndPartons = process.selectedHadronsAndPartons.clone( fullChainPhysPartons = cms.bool(False) ) + +process.load('PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi') +#from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos +process.jetFlavs = process.ak4JetFlavourInfos.clone( jets = genJetCollection, + partons = cms.InputTag("selectedHadronsAndPartons","algorithmicPartons") ) +process.jetFlavsPD = process.jetFlavs.clone( partons = cms.InputTag("physDefHadronsAndPartons","physicsPartons") ) + +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.ak4 = cms.EDAnalyzer('ProcessedTreeProducerBTag', + ## jet collections ########################### + pfjetschs = cms.InputTag('slimmedJets'), + pfchsjetpuid = cms.string('pileupJetId:fullDiscriminant'), + runYear = cms.untracked.string("2017"), + ## MET collection #### + pfmetT1 = cms.InputTag('slimmedMETs'), + genjets = cms.untracked.InputTag(genJetCollection), + ## database entry for the uncertainties ###### + PFPayloadName = cms.string(''), + jecUncSrc = cms.untracked.string(''), + jecUncSrcNames = cms.vstring(''), + ## set the conditions for good Vtx counting ## + offlineVertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + beamSpot = cms.InputTag('offlineBeamSpot'), + goodVtxNdof = cms.double(4), + goodVtxZ = cms.double(24), + ## rho ####################################### + srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), + srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), + srcPULabel = cms.untracked.InputTag('slimmedAddPileupInfo'), + ## preselection cuts ######################### + maxEta = cms.double(5.0), + minPFPt = cms.double(15.0), + minPFPtThirdJet = cms.double(5.0), + minNPFJets = cms.uint32(1), + minGenPt = cms.untracked.double(15.0), + isMCarlo = cms.untracked.bool(True), + useGenInfo = cms.untracked.bool(True), + AK4 = cms.untracked.bool(True), + ZB = cms.untracked.bool(zbflag), + ## trigger ################################### + printTriggerMenu= cms.untracked.bool(False), + processName = cms.untracked.string('HLT'), + filterName = filters, + triggerName = triggers, + triggerFollow = follows, + filterFlags = cms.untracked.InputTag("TriggerResults","","RECO"), + triggerResults = cms.untracked.InputTag("TriggerResults","","HLT"), + triggerHLTObjs = cms.untracked.InputTag("selectedPatTrigger"), + triggerL1Objs = cms.untracked.InputTag("caloStage2Digis","Jet"), + triggerL1HTObjs = cms.untracked.InputTag("caloStage2Digis","EtSum"), + #triggerAllObjs = cms.untracked.InputTag("gtStage2Digis","GlobalAlgBlk"), + prescales = cms.InputTag("patTrigger"), + prescalesL1Min = cms.InputTag("patTrigger","l1min"), + prescalesL1Max = cms.InputTag("patTrigger","l1max"), + ## jec services ############################## + EventInfo = cms.untracked.InputTag("generator"), + GenParticles = cms.untracked.InputTag(genParticleCollection), + jetFlavInfos = cms.untracked.InputTag("jetFlavs"), + jetFlavInfosPD = cms.untracked.InputTag("jetFlavsPD"), + saveWeights = cms.bool(False) +) + +#Try scheduled processs +process.path = cms.Path(process.QGTagger* + process.selectedHadronsAndPartons* + process.jetFlavs* + process.physDefHadronsAndPartons* + process.jetFlavsPD* + process.ak4) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Output and Log +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) +process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/python/legacycfg/ProcessedTreeProducer18DTm.py b/AnalysisFW/python/legacycfg/ProcessedTreeProducer18DTm.py new file mode 100644 index 00000000000..9c13ac32d45 --- /dev/null +++ b/AnalysisFW/python/legacycfg/ProcessedTreeProducer18DTm.py @@ -0,0 +1,141 @@ +# -*- coding: utf-8 -*- + +import FWCore.ParameterSet.Config as cms + +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets +from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters +from RecoJets.JetProducers.PFJetParameters_cfi import * +from RecoJets.JetProducers.GenJetParameters_cfi import * +from RecoJets.JetProducers.AnomalousCellParameters_cfi import * +from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * +from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets +from PhysicsTools.PatAlgos.tools.jetTools import * +from PhysicsTools.PatAlgos.patSequences_cff import * +from PhysicsTools.PatAlgos.patTemplate_cfg import * +from PhysicsTools.PatAlgos.tools.jetTools import * +from RecoJets.JetProducers.QGTagger_cfi import QGTagger +from triggerlists import * +from filelists import * +from filterlists import * + +# -*- coding: utf-8 -*- +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Ntuplizer") +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Conditions +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") +process.load("Configuration.EventContent.EventContent_cff") +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('RecoJets.Configuration.GenJetParticles_cff') +process.load('RecoJets.Configuration.RecoGenJets_cff') +process.load('RecoJets.JetProducers.TrackJetParameters_cfi') +process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.GlobalTag.globaltag = "101X_dataRun2_Prompt_v11" + +##-------------------- Import the JEC services ----------------------- +process.load('JetMETCorrections.Configuration.DefaultJEC_cff') + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Input +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10000)) + +triggers = trgAK4A18 +follows = cms.vstring() +inFiles = JHTA18 +filters = flt18DT + +zbflag = False + +process.source = cms.Source("PoolSource", fileNames = inFiles ) + +process.load('CommonTools.RecoAlgos.HBHENoiseFilterResultProducer_cfi') +process.load('CommonTools.RecoAlgos.HBHENoiseFilter_cfi') + +process.HBHENoiseFilterResultProducerNoMinZ = process.HBHENoiseFilterResultProducer.clone(minZeros = cms.int32(99999)) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Services +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 100 +process.load('CommonTools.UtilAlgos.TFileService_cfi') +process.TFileService.fileName=cms.string('DATA.root') + +# Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion +process.load('RecoJets.JetProducers.QGTagger_cfi') +process.QGTagger.srcJets = cms.InputTag('slimmedJets') +process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') + +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.ak4 = cms.EDAnalyzer('ProcessedTreeProducerBTag', + ## jet collections ########################### + pfjetschs = cms.InputTag('slimmedJets'), + pfchsjetpuid = cms.string("pileupJetId:fullDiscriminant"), + runYear = cms.untracked.string("2016"), + ## MET collection #### + pfmetT1 = cms.InputTag('slimmedMETs'), + genjets = cms.untracked.InputTag('slimmedGenJets'), + ## database entry for the uncertainties ###### + PFPayloadName = cms.string(''), + jecUncSrc = cms.untracked.string(''), + jecUncSrcNames = cms.vstring(''), + ## set the conditions for good Vtx counting ## + offlineVertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + beamSpot = cms.InputTag('offlineBeamSpot'), + goodVtxNdof = cms.double(4), + goodVtxZ = cms.double(24), + ## rho ####################################### + srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), + srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), + srcPULabel = cms.untracked.InputTag('slimmedAddPileupInfo'), + ## preselection cuts ######################### + maxEta = cms.double(5.0), + minPFPt = cms.double(15.0), + minPFPtThirdJet = cms.double(5.0), + minNPFJets = cms.uint32(1), + minGenPt = cms.untracked.double(20), + isMCarlo = cms.untracked.bool(False), + useGenInfo = cms.untracked.bool(False), + AK4 = cms.untracked.bool(True), + ZB = cms.untracked.bool(zbflag), + ## trigger ################################### + printTriggerMenu= cms.untracked.bool(False), + processName = cms.untracked.string('HLT'), + filterName = filters, + triggerName = triggers, + triggerFollow = follows, + filterFlags = cms.untracked.InputTag("TriggerResults","","RECO"), + triggerResults = cms.untracked.InputTag("TriggerResults","","HLT"), + triggerHLTObjs = cms.untracked.InputTag("slimmedPatTrigger"), + triggerL1Objs = cms.untracked.InputTag("caloStage2Digis","Jet"), + triggerL1HTObjs = cms.untracked.InputTag("caloStage2Digis","EtSum"), + #triggerAllObjs = cms.untracked.InputTag("gtStage2Digis","GlobalAlgBlk"), + prescales = cms.InputTag("patTrigger"), + prescalesL1Min = cms.InputTag("patTrigger","l1min"), + prescalesL1Max = cms.InputTag("patTrigger","l1max"), + ## jec services ############################## + EventInfo = cms.untracked.InputTag("generator"), + GenParticles = cms.untracked.InputTag("genparticles"), + jetFlavourInfos = cms.untracked.InputTag("genJetFlavourInfos"), + saveWeights = cms.bool(False), + HBHENoiseFilterResultNoMinZLabel = cms.untracked.InputTag("HBHENoiseFilterResultProducerNoMinZ", "HBHENoiseFilterResult") +) + +#Try scheduled processs +process.path = cms.Path(process.QGTagger* + process.HBHENoiseFilterResultProducerNoMinZ* + process.ak4) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Output and Log +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) +process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/python/refresh.sh b/AnalysisFW/python/refresh.sh new file mode 100755 index 00000000000..3186b0057bf --- /dev/null +++ b/AnalysisFW/python/refresh.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +for dir in runs_dt/crab_*; do + crab resubmit -d $dir +done + +for dir in runs_mc/crab_*; do + crab resubmit -d $dir +done diff --git a/AnalysisFW/python/serialgjets.sh b/AnalysisFW/python/serialgjets.sh new file mode 100755 index 00000000000..b6ce38fa3a9 --- /dev/null +++ b/AnalysisFW/python/serialgjets.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# 1: Choose 16/17/18 (for MC: 16e/16l and 18e/18l) +# 2: Era or MC type (only 'py' supported) + +#python gjetsConfig.py '16e' 'py' +#python gjetsConfig.py '16l' 'py' + +#python gjetsConfig.py '17' 'py' + +python gjetsConfig.py '18' 'py' diff --git a/AnalysisFW/python/serialhadrons.sh b/AnalysisFW/python/serialhadrons.sh new file mode 100755 index 00000000000..193fff9bedc --- /dev/null +++ b/AnalysisFW/python/serialhadrons.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# 1: Choose 16/17/18 (for MC: 16e/16l and 18e/18l) +# 2: Era or MC type (only 'nu' supported) + +# Note: Be (B-ver1) is completely rejected by gtag +##python hadsConfig.py '16' 'Be' +#python hadsConfig.py '16' 'Bl' +#python hadsConfig.py '16' 'C' +#python hadsConfig.py '16' 'D' +#python hadsConfig.py '16' 'E' +#python hadsConfig.py '16' 'Fe' +#python hadsConfig.py '16' 'Fl' +#python hadsConfig.py '16' 'G' +#python hadsConfig.py '16' 'H' + +#python hadsConfig.py '16e' 'nu' +#python hadsConfig.py '16l' 'nu' + +#python hadsConfig.py '17' 'B' +#python hadsConfig.py '17' 'C' +#python hadsConfig.py '17' 'D' +#python hadsConfig.py '17' 'E' +#python hadsConfig.py '17' 'F' + +#python hadsConfig.py '17' 'nu' + +#python hadsConfig.py '18' 'A' +#python hadsConfig.py '18' 'B' +#python hadsConfig.py '18' 'C' +#python hadsConfig.py '18' 'D' + +#python hadsConfig.py '18e' 'nu' +#python hadsConfig.py '18l' 'nu' diff --git a/AnalysisFW/python/serialrun.sh b/AnalysisFW/python/serialrun.sh new file mode 100755 index 00000000000..6be0af489ed --- /dev/null +++ b/AnalysisFW/python/serialrun.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +# 1: Choose 16/17/18 +# 2: Era (DT only) +# 3: ak4/ak8, zb (DT only) +# 4: Choose dt/py/pylong/hw/nu/mg (MC only) +# 5: In case of pylong (0-14) or mg (0-8) + +# For data samples: choose ak4/zb (ak8 possible, but not used) +MODE='ak4' +#MODE='zb' + +# Note: Be (B-ver1) is completely rejected by gtag +##python crabConfig.py '16' 'Be' '$MODE' 'dt' +#python crabConfig.py '16' 'Bl' $MODE 'dt' +#python crabConfig.py '16' 'C' $MODE 'dt' +#python crabConfig.py '16' 'D' $MODE 'dt' +#python crabConfig.py '16' 'E' $MODE 'dt' +#python crabConfig.py '16' 'Fe' $MODE 'dt' +#python crabConfig.py '16' 'Fl' $MODE 'dt' +#python crabConfig.py '16' 'G' $MODE 'dt' +#python crabConfig.py '16' 'H' $MODE 'dt' + +#python crabConfig.py '16' 'e' 'ak4' 'hw' +#python crabConfig.py '16' 'l' 'ak4' 'hw' +#python crabConfig.py '16' 'e' 'ak4' 'nu' +#python crabConfig.py '16' 'l' 'ak4' 'nu' +#python crabConfig.py '16' 'e' 'ak4' 'py' +#python crabConfig.py '16' 'l' 'ak4' 'py' +#python crabConfig.py '16' 'eext' 'ak4' 'py' +#python crabConfig.py '16' 'lext' 'ak4' 'py' + +for i in $(seq 0 8); +do + python crabConfig.py '16' 'e' 'ak4' 'mg' $i +# python crabConfig.py '16' 'l' 'ak4' 'mg' $i +done + +#python crabConfig.py '17' 'B' $MODE 'dt' 0 'qq' +#python crabConfig.py '17' 'C' $MODE 'dt' 0 'qq' +#python crabConfig.py '17' 'D' $MODE 'dt' 0 'qq' +#python crabConfig.py '17' 'E' $MODE 'dt' 0 'qq' +#python crabConfig.py '17' 'F' $MODE 'dt' 0 'qq' + +#python crabConfig.py '17' 'X' 'ak4' 'hw' +#python crabConfig.py '17' 'X' 'ak4' 'nu' +#python crabConfig.py '17' 'X' 'ak4' 'py' +#python crabConfig.py '17' 'ext' 'ak4' 'py' + +#for i in $(seq 0 8); +#do +# python crabConfig.py '17' 'B' 'ak4' 'mg' $i +#done + +#for i in $(seq 0 14); +#do +# python crabConfig.py '17' 'B' 'ak4' 'pylong' $i +#done + +#python crabConfig.py '18' 'A' $MODE 'dt' +#python crabConfig.py '18' 'B' $MODE 'dt' +#python crabConfig.py '18' 'C' $MODE 'dt' +#python crabConfig.py '18' 'D' $MODE 'dt' + +#python crabConfig.py '18' 'X' 'ak4' 'hw' +#python crabConfig.py '18' 'X' 'ak4' 'nu' +#python crabConfig.py '18' 'X' 'ak4' 'py' +#python crabConfig.py '18' 'ext' 'ak4' 'py' + +#for i in $(seq 0 8); +#do +# python crabConfig.py '18' 'B' 'ak4' 'mg' $i +#done + diff --git a/AnalysisFW/python/statuslist.sh b/AnalysisFW/python/statuslist.sh new file mode 100755 index 00000000000..0bec4a86b97 --- /dev/null +++ b/AnalysisFW/python/statuslist.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +for dir in runs_dt/crab_*; do + crab status -d $dir +done + +for dir in runs_mc/crab_*; do + crab status -d $dir +done diff --git a/AnalysisFW/python/statusrefresh.sh b/AnalysisFW/python/statusrefresh.sh new file mode 100644 index 00000000000..94537c88a3c --- /dev/null +++ b/AnalysisFW/python/statusrefresh.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +CASES=4 +RESTARTS=0 +while [ $CASES -gt 0 ]; do + echo ">>>>>>>>>>>>>>>>>>>>>>>>>>" + echo "Starting a new iteration!" + now=$(date +"%T") + echo "Current time: $now" + echo "Jobs refreshed: $RESTARTS" + echo "<<<<<<<<<<<<<<<<<<<<<<<<<<" + + CASES=0 + echo "Data runs:" + if [ -z "$(ls -A runs_dt)" ]; then + echo "None!" + else + for dir in runs_dt/crab_*; do + echo ">>>>>>" + echo $dir + JSON=$(crab status -d $dir --json | tail -n 2 | head -n 1 | python3 -c "import sys, json; states = [v['State'] for a,v in json.load(sys.stdin).items()]; print(' '.join(states));") + all=$(echo $JSON | python3 -c "import sys; print(len(sys.stdin.read().rstrip().split(' ')));") + queue=$(echo $JSON | python3 -c "import sys; states = list(filter(lambda a: a != 'finished', sys.stdin.read().rstrip().split(' '))); print(len(states))") + fin=$((all-queue)) + if [ $queue -gt 0 ]; then + CASES=$((CASES+1)) + echo "Finished $fin/$all jobs!" + run=$(echo $JSON | tail -n 2 | head -n 1 | python3 -c "import sys; states = list(filter(lambda a: a == 'running', sys.stdin.read().rstrip().split(' '))); print(len(states))") + fails=$(echo $JSON | tail -n 2 | head -n 1 | python3 -c "import sys; states = list(filter(lambda a: a == 'failed', sys.stdin.read().rstrip().split(' '))); print(len(states))") + other=$((queue-run-fails)) + if [ $fails -gt 0 ]; then + echo "Resubmitting failures: $fails" + crab resubmit -d $dir + RESTARTS=$((RESTARTS+1)) + fi + if [ $run -gt 0 ]; then + echo "Running jobs: $run" + fi + if [ $other -gt 0 ]; then + echo "Other jobs in the mill: $other" + fi + else + echo "Finished all $fin jobs!" + fi + done + echo "<<<<<<" + fi + + echo "MC runs:" + if [ -z "$(ls -A runs_mc)" ]; then + echo "None!" + else + for dir in runs_mc/crab_*; do + echo ">>>>>>" + echo $dir + JSON=$(crab status -d $dir --json | tail -n 2 | head -n 1 | python3 -c "import sys, json; states = [v['State'] for a,v in json.load(sys.stdin).items()]; print(' '.join(states));") + all=$(echo $JSON | python3 -c "import sys; print(len(sys.stdin.read().rstrip().split(' ')));") + queue=$(echo $JSON | python3 -c "import sys; states = list(filter(lambda a: a != 'finished', sys.stdin.read().rstrip().split(' '))); print(len(states))") + fin=$((all-queue)) + if [ $queue -gt 0 ]; then + CASES=$((CASES+1)) + echo "Finished $fin/$all jobs!" + run=$(echo $JSON | tail -n 2 | head -n 1 | python3 -c "import sys; states = list(filter(lambda a: a == 'running', sys.stdin.read().rstrip().split(' '))); print(len(states))") + fails=$(echo $JSON | tail -n 2 | head -n 1 | python3 -c "import sys; states = list(filter(lambda a: a == 'failed', sys.stdin.read().rstrip().split(' '))); print(len(states))") + other=$((queue-run-fails)) + if [ $fails -gt 0 ]; then + echo "Resubmitting failures: $fails" + crab resubmit -d $dir + RESTARTS=$((RESTARTS+1)) + fi + if [ $run -gt 0 ]; then + echo "Running jobs: $run" + fi + if [ $other -gt 0 ]; then + echo "Other jobs in the mill: $other" + fi + else + echo "Finished all $fin jobs!" + fi + done + echo "<<<<<<" + fi + + echo "Loop finished, going to sleep!" + sleep 4m +done diff --git a/AnalysisFW/python/triggerlists.py b/AnalysisFW/python/triggerlists.py new file mode 100644 index 00000000000..764297e233f --- /dev/null +++ b/AnalysisFW/python/triggerlists.py @@ -0,0 +1,143 @@ +import FWCore.ParameterSet.Config as cms +# The trigger lists for each era follow this convention: AK4 - AK8 (incl. PFHT) - ZB +# Nesting: year - era - ak4/ak8/zb + +trglist = { + '16' : { + "mc" : { + 'ak4' : cms.vstring("HLT_ZeroBias_v0","HLT_PFJet40_v0","HLT_PFJet60_v0","HLT_PFJet80_v0","HLT_PFJet140_v0","HLT_PFJet200_v0","HLT_PFJet260_v0","HLT_PFJet320_v0","HLT_PFJet400_v0","HLT_PFJet450_v0","HLT_PFJet500_v0"), + 'ak8' : cms.vstring(), + #'ak8' : cms.vstring("HLT_AK8PFJet40_v0","HLT_AK8PFJet60_v0","HLT_AK8PFJet80_v0","HLT_AK8PFJet140_v0","HLT_AK8PFJet200_v0","HLT_AK8PFJet260_v0","HLT_AK8PFJet320_v0","HLT_AK8PFJet400_v0","HLT_AK8PFJet450_v0","HLT_AK8PFJet500_v0") + 'zb' : cms.vstring("HLT_ZeroBias_v0","HLT_PFJet40_v0","HLT_PFJet60_v0","HLT_PFJet80_v0","HLT_PFJet140_v0","HLT_PFJet200_v0","HLT_PFJet260_v0","HLT_PFJet320_v0","HLT_PFJet400_v0","HLT_PFJet450_v0","HLT_PFJet500_v0") + }, + "dt" : { + 'ak4' : cms.vstring("HLT_PFJet40_v0","HLT_PFJet60_v0","HLT_PFJet80_v0","HLT_PFJet140_v0","HLT_PFJet200_v0","HLT_PFJet260_v0","HLT_PFJet320_v0","HLT_PFJet400_v0","HLT_PFJet450_v0","HLT_PFJet500_v0"), + 'ak8' : cms.vstring(), + #'ak8' : cms.vstring("HLT_AK8PFJet40_v0","HLT_AK8PFJet60_v0","HLT_AK8PFJet80_v0","HLT_AK8PFJet140_v0","HLT_AK8PFJet200_v0","HLT_AK8PFJet260_v0","HLT_AK8PFJet320_v0","HLT_AK8PFJet400_v0","HLT_AK8PFJet450_v0","HLT_AK8PFJet500_v0"), + 'zb' : cms.vstring("HLT_ZeroBias_v0") + }, + "Be" : { # This does not pass the DATACERT and AK8 triggers are missing + 'ak4' : cms.vstring("HLT_PFJet40_v4","HLT_PFJet60_v4","HLT_PFJet80_v4","HLT_PFJet140_v4","HLT_PFJet200_v4","HLT_PFJet260_v4","HLT_PFJet320_v4","HLT_PFJet400_v4","HLT_PFJet450_v4","HLT_PFJet500_v4"), + 'ak8' : cms.vstring(), + 'zb' : cms.vstring("HLT_ZeroBias_v2") + }, + "Bl" : { + 'ak4' : cms.vstring("HLT_PFJet40_v4","HLT_PFJet40_v5","HLT_PFJet60_v4","HLT_PFJet60_v5","HLT_PFJet80_v4","HLT_PFJet80_v5","HLT_PFJet140_v4","HLT_PFJet140_v5","HLT_PFJet200_v4","HLT_PFJet200_v5","HLT_PFJet260_v4","HLT_PFJet260_v5","HLT_PFJet320_v4","HLT_PFJet320_v5","HLT_PFJet400_v4","HLT_PFJet400_v5","HLT_PFJet450_v4","HLT_PFJet450_v5","HLT_PFJet500_v4","HLT_PFJet500_v5"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v1","HLT_AK8PFJet60_v1","HLT_AK8PFJet80_v1","HLT_AK8PFJet140_v1","HLT_AK8PFJet200_v1","HLT_AK8PFJet260_v1","HLT_AK8PFJet320_v1","HLT_AK8PFJet400_v1","HLT_AK8PFJet450_v1","HLT_AK8PFJet500_v1"), + 'zb' : cms.vstring("HLT_ZeroBias_v2","HLT_ZeroBias_v3") + }, + "C" : { + 'ak4' : cms.vstring("HLT_PFJet40_v5","HLT_PFJet40_v6","HLT_PFJet60_v5","HLT_PFJet60_v6","HLT_PFJet80_v5","HLT_PFJet140_v5","HLT_PFJet200_v5","HLT_PFJet260_v5","HLT_PFJet320_v5","HLT_PFJet400_v5","HLT_PFJet450_v5","HLT_PFJet500_v5"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v1","HLT_AK8PFJet40_v2","HLT_AK8PFJet60_v1","HLT_AK8PFJet80_v1","HLT_AK8PFJet140_v1","HLT_AK8PFJet200_v1","HLT_AK8PFJet260_v1","HLT_AK8PFJet320_v1","HLT_AK8PFJet400_v1","HLT_AK8PFJet450_v1","HLT_AK8PFJet500_v1"), + 'zb' : cms.vstring("HLT_ZeroBias_v3","HLT_ZeroBias_v4") + }, + "D" : { + 'ak4' : cms.vstring("HLT_PFJet40_v6","HLT_PFJet60_v6","HLT_PFJet80_v5","HLT_PFJet140_v5","HLT_PFJet200_v5","HLT_PFJet260_v5","HLT_PFJet320_v5","HLT_PFJet400_v5","HLT_PFJet450_v5","HLT_PFJet500_v5"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v2","HLT_AK8PFJet60_v1","HLT_AK8PFJet80_v1","HLT_AK8PFJet140_v1","HLT_AK8PFJet200_v1","HLT_AK8PFJet260_v1","HLT_AK8PFJet320_v1","HLT_AK8PFJet400_v1","HLT_AK8PFJet450_v1","HLT_AK8PFJet500_v1"), + 'zb' : cms.vstring("HLT_ZeroBias_v4") + }, + "E" : { + 'ak4' : cms.vstring("HLT_PFJet40_v6","HLT_PFJet60_v6","HLT_PFJet80_v5","HLT_PFJet140_v5","HLT_PFJet200_v5","HLT_PFJet260_v5","HLT_PFJet320_v5","HLT_PFJet400_v5","HLT_PFJet450_v5","HLT_PFJet500_v5"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v2","HLT_AK8PFJet60_v1","HLT_AK8PFJet80_v1","HLT_AK8PFJet140_v1","HLT_AK8PFJet200_v1","HLT_AK8PFJet260_v1","HLT_AK8PFJet320_v1","HLT_AK8PFJet400_v1","HLT_AK8PFJet450_v1","HLT_AK8PFJet500_v1"), + 'zb' : cms.vstring("HLT_ZeroBias_v4") + }, + "Fe" : { + 'ak4' : cms.vstring("HLT_PFJet40_v6","HLT_PFJet40_v7","HLT_PFJet60_v6","HLT_PFJet60_v7","HLT_PFJet80_v5","HLT_PFJet80_v6","HLT_PFJet140_v5","HLT_PFJet140_v6","HLT_PFJet200_v5","HLT_PFJet200_v6","HLT_PFJet260_v5","HLT_PFJet260_v7","HLT_PFJet320_v5","HLT_PFJet320_v7","HLT_PFJet400_v5","HLT_PFJet400_v7","HLT_PFJet450_v5","HLT_PFJet450_v7","HLT_PFJet500_v5","HLT_PFJet500_v7"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v2","HLT_AK8PFJet40_v3","HLT_AK8PFJet60_v1","HLT_AK8PFJet60_v2","HLT_AK8PFJet80_v1","HLT_AK8PFJet80_v2","HLT_AK8PFJet140_v1","HLT_AK8PFJet140_v2","HLT_AK8PFJet200_v1","HLT_AK8PFJet200_v2","HLT_AK8PFJet260_v1","HLT_AK8PFJet260_v3","HLT_AK8PFJet320_v1","HLT_AK8PFJet320_v3","HLT_AK8PFJet400_v1","HLT_AK8PFJet400_v3","HLT_AK8PFJet450_v1","HLT_AK8PFJet450_v3","HLT_AK8PFJet500_v1","HLT_AK8PFJet500_v3"), + 'zb' : cms.vstring("HLT_ZeroBias_v4") + }, + 'Fl' : { + 'ak4' : cms.vstring("HLT_PFJet40_v7","HLT_PFJet60_v7","HLT_PFJet80_v6","HLT_PFJet140_v6","HLT_PFJet200_v6","HLT_PFJet260_v7","HLT_PFJet320_v7","HLT_PFJet400_v7","HLT_PFJet450_v7","HLT_PFJet500_v7"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v3","HLT_AK8PFJet60_v2","HLT_AK8PFJet80_v2","HLT_AK8PFJet140_v2","HLT_AK8PFJet200_v2","HLT_AK8PFJet260_v3","HLT_AK8PFJet320_v3","HLT_AK8PFJet400_v3","HLT_AK8PFJet450_v3","HLT_AK8PFJet500_v3"), + 'zb' : cms.vstring("HLT_ZeroBias_v4") + }, + 'G' : { + 'ak4' : cms.vstring("HLT_PFJet40_v7","HLT_PFJet60_v7","HLT_PFJet80_v6","HLT_PFJet140_v6","HLT_PFJet200_v6","HLT_PFJet260_v7","HLT_PFJet320_v7","HLT_PFJet400_v7","HLT_PFJet450_v7","HLT_PFJet500_v7"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v3","HLT_AK8PFJet60_v2","HLT_AK8PFJet80_v2","HLT_AK8PFJet140_v2","HLT_AK8PFJet200_v2","HLT_AK8PFJet260_v3","HLT_AK8PFJet320_v3","HLT_AK8PFJet400_v3","HLT_AK8PFJet450_v3","HLT_AK8PFJet500_v3"), + 'zb' : cms.vstring("HLT_ZeroBias_v4") + }, + 'H' : { + 'ak4' : cms.vstring("HLT_PFJet40_v9","HLT_PFJet60_v9","HLT_PFJet80_v8","HLT_PFJet140_v8","HLT_PFJet200_v8","HLT_PFJet260_v9","HLT_PFJet320_v9","HLT_PFJet400_v9","HLT_PFJet450_v9","HLT_PFJet500_v9"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v5","HLT_AK8PFJet60_v4","HLT_AK8PFJet80_v4","HLT_AK8PFJet140_v4","HLT_AK8PFJet200_v4","HLT_AK8PFJet260_v5","HLT_AK8PFJet320_v5","HLT_AK8PFJet400_v5","HLT_AK8PFJet450_v5","HLT_AK8PFJet500_v5"), + 'zb' : cms.vstring("HLT_ZeroBias_v4") + } + }, + '17' : { + 'mc' : { + 'ak4' : cms.vstring("HLT_ZeroBias_v0","HLT_PFJet40_v0","HLT_PFJet60_v0","HLT_PFJet80_v0","HLT_PFJet140_v0","HLT_PFJet200_v0","HLT_PFJet260_v0","HLT_PFJet320_v0","HLT_PFJet400_v0","HLT_PFJet450_v0","HLT_PFJet500_v0","HLT_PFJet550_v0"), + 'ak8' : cms.vstring(), + #'ak8' : cms.vstring("HLT_AK8PFJet40_v0","HLT_AK8PFJet60_v0","HLT_AK8PFJet80_v0","HLT_AK8PFJet140_v0","HLT_AK8PFJet200_v0","HLT_AK8PFJet260_v0","HLT_AK8PFJet320_v0","HLT_AK8PFJet400_v0","HLT_AK8PFJet450_v0","HLT_AK8PFJet500_v0","HLT_AK8PFJet550_v0") + 'zb' : cms.vstring("HLT_ZeroBias_v0","HLT_PFJet40_v0","HLT_PFJet60_v0","HLT_PFJet80_v0","HLT_PFJet140_v0","HLT_PFJet200_v0","HLT_PFJet260_v0","HLT_PFJet320_v0","HLT_PFJet400_v0","HLT_PFJet450_v0","HLT_PFJet500_v0") + }, + 'dt' : { + 'ak4' : cms.vstring("HLT_PFJet40_v0","HLT_PFJet60_v0","HLT_PFJet80_v0","HLT_PFJet140_v0","HLT_PFJet200_v0","HLT_PFJet260_v0","HLT_PFJet320_v0","HLT_PFJet400_v0","HLT_PFJet450_v0","HLT_PFJet500_v0","HLT_PFJet550_v0"), + 'ak8' : cms.vstring(), + #'ak8' : cms.vstring("HLT_AK8PFJet40_v0","HLT_AK8PFJet60_v0","HLT_AK8PFJet80_v0","HLT_AK8PFJet140_v0","HLT_AK8PFJet200_v0","HLT_AK8PFJet260_v0","HLT_AK8PFJet320_v0","HLT_AK8PFJet400_v0","HLT_AK8PFJet450_v0","HLT_AK8PFJet500_v0","HLT_AK8PFJet550_v0"), + 'zb' : cms.vstring("HLT_ZeroBias_v0") + }, + 'B' : { + 'ak4' : cms.vstring("HLT_PFJet40_v10","HLT_PFJet40_v11","HLT_PFJet40_v12","HLT_PFJet60_v10","HLT_PFJet60_v11","HLT_PFJet60_v12","HLT_PFJet80_v10","HLT_PFJet80_v11","HLT_PFJet80_v9","HLT_PFJet140_v10","HLT_PFJet140_v9","HLT_PFJet200_v10","HLT_PFJet200_v9","HLT_PFJet260_v10","HLT_PFJet260_v11","HLT_PFJet320_v10","HLT_PFJet320_v11","HLT_PFJet400_v10","HLT_PFJet400_v11","HLT_PFJet450_v10","HLT_PFJet450_v11","HLT_PFJet450_v12","HLT_PFJet500_v10","HLT_PFJet500_v11","HLT_PFJet500_v12","HLT_PFJet550_v1","HLT_PFJet550_v2"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v6","HLT_AK8PFJet40_v7","HLT_AK8PFJet60_v5","HLT_AK8PFJet60_v6","HLT_AK8PFJet80_v5","HLT_AK8PFJet80_v6","HLT_AK8PFJet140_v5","HLT_AK8PFJet140_v6","HLT_AK8PFJet200_v5","HLT_AK8PFJet200_v6","HLT_AK8PFJet260_v6","HLT_AK8PFJet260_v7","HLT_AK8PFJet320_v6","HLT_AK8PFJet320_v7","HLT_AK8PFJet400_v6","HLT_AK8PFJet400_v7","HLT_AK8PFJet450_v6","HLT_AK8PFJet450_v7","HLT_AK8PFJet500_v6","HLT_AK8PFJet500_v7","HLT_AK8PFJet550_v1","HLT_AK8PFJet550_v2"), + 'zb' : cms.vstring("HLT_ZeroBias_v5") + }, + 'C' : { + 'ak4' : cms.vstring("HLT_PFJet40_v13","HLT_PFJet40_v14","HLT_PFJet40_v15","HLT_PFJet40_v16","HLT_PFJet60_v13","HLT_PFJet60_v14","HLT_PFJet60_v15","HLT_PFJet60_v16","HLT_PFJet80_v12","HLT_PFJet80_v13","HLT_PFJet80_v14","HLT_PFJet80_v15","HLT_PFJet140_v11","HLT_PFJet140_v12","HLT_PFJet140_v13","HLT_PFJet140_v14","HLT_PFJet200_v11","HLT_PFJet200_v12","HLT_PFJet200_v13","HLT_PFJet200_v14","HLT_PFJet260_v12","HLT_PFJet260_v13","HLT_PFJet260_v14","HLT_PFJet260_v15","HLT_PFJet320_v12","HLT_PFJet320_v13","HLT_PFJet320_v14","HLT_PFJet320_v15","HLT_PFJet400_v12","HLT_PFJet400_v13","HLT_PFJet400_v14","HLT_PFJet400_v15","HLT_PFJet450_v13","HLT_PFJet450_v14","HLT_PFJet450_v15","HLT_PFJet450_v16","HLT_PFJet500_v13","HLT_PFJet500_v14","HLT_PFJet500_v15","HLT_PFJet500_v16","HLT_PFJet550_v3","HLT_PFJet550_v4","HLT_PFJet550_v5","HLT_PFJet550_v6"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v10","HLT_AK8PFJet40_v11","HLT_AK8PFJet40_v8","HLT_AK8PFJet40_v9","HLT_AK8PFJet60_v10","HLT_AK8PFJet60_v7","HLT_AK8PFJet60_v8","HLT_AK8PFJet60_v9","HLT_AK8PFJet80_v10","HLT_AK8PFJet80_v7","HLT_AK8PFJet80_v8","HLT_AK8PFJet80_v9","HLT_AK8PFJet140_v10","HLT_AK8PFJet140_v7","HLT_AK8PFJet140_v8","HLT_AK8PFJet140_v9","HLT_AK8PFJet200_v10","HLT_AK8PFJet200_v7","HLT_AK8PFJet200_v8","HLT_AK8PFJet200_v9","HLT_AK8PFJet260_v10","HLT_AK8PFJet260_v11","HLT_AK8PFJet260_v8","HLT_AK8PFJet260_v9","HLT_AK8PFJet320_v10","HLT_AK8PFJet320_v11","HLT_AK8PFJet320_v8","HLT_AK8PFJet320_v9","HLT_AK8PFJet400_v10","HLT_AK8PFJet400_v11","HLT_AK8PFJet400_v8","HLT_AK8PFJet400_v9","HLT_AK8PFJet450_v10","HLT_AK8PFJet450_v11","HLT_AK8PFJet450_v8","HLT_AK8PFJet450_v9","HLT_AK8PFJet500_v10","HLT_AK8PFJet500_v11","HLT_AK8PFJet500_v8","HLT_AK8PFJet500_v9","HLT_AK8PFJet550_v3","HLT_AK8PFJet550_v4","HLT_AK8PFJet550_v5","HLT_AK8PFJet550_v6"), + 'zb' : cms.vstring("HLT_ZeroBias_v6") + }, + 'D' : { + 'ak4' : cms.vstring("HLT_PFJet40_v16","HLT_PFJet40_v17","HLT_PFJet60_v16","HLT_PFJet60_v17","HLT_PFJet80_v15","HLT_PFJet80_v16","HLT_PFJet140_v14","HLT_PFJet140_v15","HLT_PFJet200_v14","HLT_PFJet200_v15","HLT_PFJet260_v15","HLT_PFJet260_v16","HLT_PFJet320_v15","HLT_PFJet320_v16","HLT_PFJet400_v15","HLT_PFJet400_v16","HLT_PFJet450_v16","HLT_PFJet450_v17","HLT_PFJet500_v16","HLT_PFJet500_v17","HLT_PFJet550_v6","HLT_PFJet550_v7"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v11","HLT_AK8PFJet40_v12","HLT_AK8PFJet60_v10","HLT_AK8PFJet60_v11","HLT_AK8PFJet80_v10","HLT_AK8PFJet80_v11","HLT_AK8PFJet140_v10","HLT_AK8PFJet140_v11","HLT_AK8PFJet200_v10","HLT_AK8PFJet200_v11","HLT_AK8PFJet260_v11","HLT_AK8PFJet260_v12","HLT_AK8PFJet320_v11","HLT_AK8PFJet320_v12","HLT_AK8PFJet400_v11","HLT_AK8PFJet400_v12","HLT_AK8PFJet450_v11","HLT_AK8PFJet450_v12","HLT_AK8PFJet500_v11","HLT_AK8PFJet500_v12","HLT_AK8PFJet550_v6","HLT_AK8PFJet550_v7"), + 'zb' : cms.vstring("HLT_ZeroBias_v6","HLT_ZeroBias_part0_v6","HLT_ZeroBias_part1_v6","HLT_ZeroBias_part2_v6","HLT_ZeroBias_part3_v6","HLT_ZeroBias_part4_v6","HLT_ZeroBias_part5_v6","HLT_ZeroBias_part6_v6","HLT_ZeroBias_part7_v6") + }, + 'E' : { + 'ak4' : cms.vstring("HLT_PFJet40_v17","HLT_PFJet60_v17","HLT_PFJet80_v16","HLT_PFJet140_v15","HLT_PFJet200_v15","HLT_PFJet260_v16","HLT_PFJet320_v16","HLT_PFJet400_v16","HLT_PFJet450_v17","HLT_PFJet500_v17","HLT_PFJet550_v7"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v12","HLT_AK8PFJet60_v11","HLT_AK8PFJet80_v11","HLT_AK8PFJet140_v11","HLT_AK8PFJet200_v11","HLT_AK8PFJet260_v12","HLT_AK8PFJet320_v12","HLT_AK8PFJet400_v12","HLT_AK8PFJet450_v12","HLT_AK8PFJet500_v12","HLT_AK8PFJet550_v7"), + 'zb' : cms.vstring("HLT_ZeroBias_v6") + }, + 'F' : { + 'ak4' : cms.vstring("HLT_PFJet40_v17","HLT_PFJet40_v18","HLT_PFJet40_v19","HLT_PFJet60_v17","HLT_PFJet60_v18","HLT_PFJet60_v19","HLT_PFJet80_v16","HLT_PFJet80_v17","HLT_PFJet80_v18","HLT_PFJet140_v15","HLT_PFJet140_v16","HLT_PFJet140_v17","HLT_PFJet200_v15","HLT_PFJet200_v16","HLT_PFJet200_v17","HLT_PFJet260_v16","HLT_PFJet260_v17","HLT_PFJet260_v18","HLT_PFJet320_v16","HLT_PFJet320_v17","HLT_PFJet320_v18","HLT_PFJet400_v16","HLT_PFJet400_v17","HLT_PFJet400_v18","HLT_PFJet450_v17","HLT_PFJet450_v18","HLT_PFJet450_v19","HLT_PFJet500_v17","HLT_PFJet500_v18","HLT_PFJet500_v19","HLT_PFJet550_v7","HLT_PFJet550_v8","HLT_PFJet550_v9"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v12","HLT_AK8PFJet40_v13","HLT_AK8PFJet40_v14","HLT_AK8PFJet60_v11","HLT_AK8PFJet60_v12","HLT_AK8PFJet60_v13","HLT_AK8PFJet80_v11","HLT_AK8PFJet80_v12","HLT_AK8PFJet80_v13","HLT_AK8PFJet140_v11","HLT_AK8PFJet140_v12","HLT_AK8PFJet140_v13","HLT_AK8PFJet200_v11","HLT_AK8PFJet200_v12","HLT_AK8PFJet200_v13","HLT_AK8PFJet260_v12","HLT_AK8PFJet260_v13","HLT_AK8PFJet260_v14","HLT_AK8PFJet320_v12","HLT_AK8PFJet320_v13","HLT_AK8PFJet320_v14","HLT_AK8PFJet400_v12","HLT_AK8PFJet400_v13","HLT_AK8PFJet400_v14","HLT_AK8PFJet450_v12","HLT_AK8PFJet450_v13","HLT_AK8PFJet450_v14","HLT_AK8PFJet500_v12","HLT_AK8PFJet500_v13","HLT_AK8PFJet500_v14","HLT_AK8PFJet550_v7","HLT_AK8PFJet550_v8","HLT_AK8PFJet550_v9"), + 'zb' : cms.vstring("HLT_ZeroBias_v6") + }, + 'H' : { + 'ak4' : cms.vstring("HLT_HIAK4PFJet15_v1","HLT_HIPFJet25_v1","HLT_HIAK4PFJet40_v1","HLT_HIAK4PFJet60_v1","HLT_HIAK4PFJet80_v1","HLT_HIPFJet140_v1","HLT_HIPFJetFwd15_v1","HLT_HIPFJetFwd25_v1","HLT_HIAK4PFJet40FWD_v1","HLT_HIAK4PFJet60FWD_v1","HLT_HIAK4PFJet80FWD_v1","HLT_HIPFJetFwd140_v1"), + 'ak8' : cms.vstring("HLT_HIAK8PFJet15_v1","HLT_HIAK8PFJet25_v1","HLT_HIAK8PFJet40_v1","HLT_HIAK8PFJet60_v1","HLT_HIAK8PFJet80_v1","HLT_HIAK8PFJet140_v1","HLT_HIAK8PFJetFwd15_v1","HLT_HIAK8PFJetFwd25_v1","HLT_HIAK8PFJetFwd40_v1","HLT_HIAK8PFJetFwd60_v1","HLT_HIAK8PFJetFwd80_v1","HLT_HIAK8PFJetFwd140_v1"), + 'zb' : cms.vstring("HLT_ZeroBias_v6") + }, + }, + '18' : { + 'mc' : { + 'ak4' : cms.vstring("HLT_ZeroBias_v0","HLT_PFJet40_v0","HLT_PFJet60_v0","HLT_PFJet80_v0","HLT_PFJet140_v0","HLT_PFJet200_v0","HLT_PFJet260_v0","HLT_PFJet320_v0","HLT_PFJet400_v0","HLT_PFJet450_v0","HLT_PFJet500_v0","HLT_PFJet550_v0"), + 'ak8' : cms.vstring(), + #'ak8' : cms.vstring("HLT_AK8PFJet40_v0","HLT_AK8PFJet60_v0","HLT_AK8PFJet80_v0","HLT_AK8PFJet140_v0","HLT_AK8PFJet200_v0","HLT_AK8PFJet260_v0","HLT_AK8PFJet320_v0","HLT_AK8PFJet400_v0","HLT_AK8PFJet450_v0","HLT_AK8PFJet500_v0","HLT_AK8PFJet550_v0") + 'zb' : cms.vstring("HLT_ZeroBias_v0","HLT_PFJet40_v0","HLT_PFJet60_v0","HLT_PFJet80_v0","HLT_PFJet140_v0","HLT_PFJet200_v0","HLT_PFJet260_v0","HLT_PFJet320_v0","HLT_PFJet400_v0","HLT_PFJet450_v0","HLT_PFJet500_v0") + }, + 'dt' : { + 'ak4' : cms.vstring("HLT_PFJet40_v0","HLT_PFJet60_v0","HLT_PFJet80_v0","HLT_PFJet140_v0","HLT_PFJet200_v0","HLT_PFJet260_v0","HLT_PFJet320_v0","HLT_PFJet400_v0","HLT_PFJet450_v0","HLT_PFJet500_v0","HLT_PFJet550_v0"), + 'ak8' : cms.vstring(), + #'ak8' : cms.vstring("HLT_AK8PFJet40_v0","HLT_AK8PFJet60_v0","HLT_AK8PFJet80_v0","HLT_AK8PFJet140_v0","HLT_AK8PFJet200_v0","HLT_AK8PFJet260_v0","HLT_AK8PFJet320_v0","HLT_AK8PFJet400_v0","HLT_AK8PFJet450_v0","HLT_AK8PFJet500_v0","HLT_AK8PFJet550_v0"), + 'zb' : cms.vstring("HLT_ZeroBias_v0") + }, + 'A' : { + 'ak4' : cms.vstring("HLT_PFJet40_v19","HLT_PFJet40_v20","HLT_PFJet40_v21","HLT_PFJet60_v19","HLT_PFJet60_v20","HLT_PFJet60_v21","HLT_PFJet80_v18","HLT_PFJet80_v19","HLT_PFJet80_v20","HLT_PFJet140_v17","HLT_PFJet140_v18","HLT_PFJet140_v19","HLT_PFJet200_v17","HLT_PFJet200_v18","HLT_PFJet200_v19","HLT_PFJet260_v18","HLT_PFJet260_v19","HLT_PFJet260_v20","HLT_PFJet320_v18","HLT_PFJet320_v19","HLT_PFJet320_v20","HLT_PFJet400_v18","HLT_PFJet400_v19","HLT_PFJet400_v20","HLT_PFJet450_v19","HLT_PFJet450_v20","HLT_PFJet450_v21","HLT_PFJet500_v19","HLT_PFJet500_v20","HLT_PFJet500_v21","HLT_PFJet550_v10","HLT_PFJet550_v11","HLT_PFJet550_v9"), + 'ak8' : cms.vstring("HLT_AK8PFJet40_v14","HLT_AK8PFJet40_v15","HLT_AK8PFJet40_v16","HLT_AK8PFJet60_v13","HLT_AK8PFJet60_v14","HLT_AK8PFJet60_v15","HLT_AK8PFJet80_v13","HLT_AK8PFJet80_v14","HLT_AK8PFJet80_v15","HLT_AK8PFJet140_v13","HLT_AK8PFJet140_v14","HLT_AK8PFJet140_v15","HLT_AK8PFJet200_v13","HLT_AK8PFJet200_v14","HLT_AK8PFJet200_v15","HLT_AK8PFJet260_v14","HLT_AK8PFJet260_v15","HLT_AK8PFJet260_v16","HLT_AK8PFJet320_v14","HLT_AK8PFJet320_v15","HLT_AK8PFJet320_v16","HLT_AK8PFJet400_v14","HLT_AK8PFJet400_v15","HLT_AK8PFJet400_v16","HLT_AK8PFJet450_v14","HLT_AK8PFJet450_v15","HLT_AK8PFJet450_v16","HLT_AK8PFJet500_v14","HLT_AK8PFJet500_v15","HLT_AK8PFJet500_v16","HLT_AK8PFJet550_v10","HLT_AK8PFJet550_v11","HLT_AK8PFJet550_v9"), + 'zb' : cms.vstring("HLT_ZeroBias_v6") + }, + 'B' : { + 'ak4' : cms.vstring("HLT_PFJet40_v21","HLT_PFJet60_v21","HLT_PFJet80_v20","HLT_PFJet140_v19","HLT_PFJet200_v19","HLT_PFJet260_v20","HLT_PFJet320_v20","HLT_PFJet400_v20","HLT_PFJet450_v21","HLT_PFJet500_v21","HLT_PFJet550_v11"), + 'ak8' : cms.vstring("HLT_AK8PFJet15_v3","HLT_AK8PFJet25_v3","HLT_AK8PFJet40_v16","HLT_AK8PFJet60_v15","HLT_AK8PFJet80_v15","HLT_AK8PFJet140_v15","HLT_AK8PFJet200_v15","HLT_AK8PFJet260_v16","HLT_AK8PFJet320_v16","HLT_AK8PFJet400_v16","HLT_AK8PFJet450_v16","HLT_AK8PFJet500_v16","HLT_AK8PFJet550_v11"), + 'zb' : cms.vstring("HLT_ZeroBias_v6") + }, + 'C' : { + 'ak4' : cms.vstring("HLT_PFJet40_v21","HLT_PFJet60_v21","HLT_PFJet80_v20","HLT_PFJet140_v19","HLT_PFJet200_v19","HLT_PFJet260_v20","HLT_PFJet320_v20","HLT_PFJet400_v20","HLT_PFJet450_v21","HLT_PFJet500_v21","HLT_PFJet550_v11"), + 'ak8' : cms.vstring(), + 'zb' : cms.vstring("HLT_ZeroBias_v6") + }, + 'D' : { + 'ak4' : cms.vstring("HLT_PFJet40_v21","HLT_PFJet60_v21","HLT_PFJet80_v20","HLT_PFJet140_v19","HLT_PFJet200_v19","HLT_PFJet260_v20","HLT_PFJet320_v20","HLT_PFJet400_v20","HLT_PFJet450_v21","HLT_PFJet500_v21","HLT_PFJet550_v11"), + 'ak8' : cms.vstring(), + 'zb' : cms.vstring("HLT_ZeroBias_v6") + } + } +} diff --git a/AnalysisFW/src/QCDEvent.cc b/AnalysisFW/src/QCDEvent.cc index dd29f964f2b..3c0696ca565 100644 --- a/AnalysisFW/src/QCDEvent.cc +++ b/AnalysisFW/src/QCDEvent.cc @@ -2,35 +2,13 @@ //--------------------------------------------------- QCDEvent::QCDEvent() { + HLTObj_.clear(); L1Obj_.clear(); - //PFJets_.clear(); PFJetsCHS_.clear(); GenJets_.clear(); } //--------------------------------------------------- -QCDEvent::~QCDEvent() -{ -} -//--------------------------------------------------- -/* -void QCDEvent::setCaloJets(const std::vector& fCaloJets) -{ - CaloJets_.clear(); - for(unsigned i=0;i& fPFJets) -{ - PFJets_.clear(); - for(unsigned i=0;i& fPFJetsCHS) { @@ -39,33 +17,6 @@ void QCDEvent::setPFJetsCHS(const std::vector& fPFJetsCHS) PFJetsCHS_.push_back(fPFJetsCHS[i]); } } -//--------------------------------------------------- -// -//void QCDEvent::setElectrons(const std::vector& fElectrons) -//{ -// mElectron_.clear(); -// for(unsigned i=0;i& fMuon) -//{ -// mMuon_.clear(); -// for(unsigned i=0;i& fFatJets) -//{ -// FatJets_.clear(); -// for(unsigned i=0;i& fGenJets) { @@ -133,41 +84,17 @@ float QCDEvent::genmjj() } } //--------------------------------------------------- -/* float QCDEvent::pfmjj() { - if (PFJets_.size() < 2) + if (PFJetsCHS_.size() < 2) return 0.0; else { - const LorentzVector& P0 = PFJets_[0].p4(); - const LorentzVector& P1 = PFJets_[1].p4(); + const LorentzVector& P0 = PFJetsCHS_[0].p4(); + const LorentzVector& P1 = PFJetsCHS_[1].p4(); return (P0+P1).mass(); } } - //--------------------------------------------------- - -float QCDEvent::pfmjjcor(int k) -{ - int sign(0); - if (PFJets_.size() < 2) - return 0.0; - else { - if (k>0) - sign = 1; - if (k<0) - sign = -1; - const LorentzVector& P0 = PFJets_[0].p4(); - const LorentzVector& P1 = PFJets_[1].p4(); - double cor0 = PFJets_[0].cor(); - double cor1 = PFJets_[1].cor(); - double unc0 = PFJets_[0].unc(); - double unc1 = PFJets_[1].unc(); - return (cor0*(1+sign*unc0)*P0+cor1*(1+sign*unc1)*P1).mass(); - } -} -*/ -//-------------------------------------------------- float QCDEvent::pfchsmjjcor(int k) { int sign(0); @@ -185,30 +112,7 @@ float QCDEvent::pfchsmjjcor(int k) return ((1+sign*unc0)*P0+(1+sign*unc1)*P1).mass(); } } - //--------------------------------------------------- -/* -float QCDEvent::pfmjjcor(int k,int src) -{ - int sign(0); - if (PFJets_.size() < 2) - return 0.0; - else { - if (k>0) - sign = 1; - if (k<0) - sign = -1; - const LorentzVector& P0 = PFJets_[0].p4(); - const LorentzVector& P1 = PFJets_[1].p4(); - double cor0 = PFJets_[0].cor(); - double cor1 = PFJets_[1].cor(); - double unc0 = PFJets_[0].uncSrc(src); - double unc1 = PFJets_[1].uncSrc(src); - return (cor0*(1+sign*unc0)*P0+cor1*(1+sign*unc1)*P1).mass(); - } -} -*/ -//-------------------------------------------------- float QCDEvent::pfchsmjjcor(int k,int src) { int sign(0); @@ -226,83 +130,3 @@ float QCDEvent::pfchsmjjcor(int k,int src) return ((1+sign*unc0)*P0+(1+sign*unc1)*P1).mass(); } } - - -////--------------------------------------------------- -//float QCDEvent::fatmjjcor(int k) -//{ -// int sign(0); -// if (FatJets_.size() < 2) -// return 0.0; -// else { -// if (k>0) -// sign = 1; -// if (k<0) -// sign = -1; -// const LorentzVector& P0 = FatJets_[0].p4(); -// const LorentzVector& P1 = FatJets_[1].p4(); -// double cor0 = FatJets_[0].cor(); -// double cor1 = FatJets_[1].cor(); -// double unc0 = FatJets_[0].unc(); -// double unc1 = FatJets_[1].unc(); -// return (cor0*(1+sign*unc0)*P0+cor1*(1+sign*unc1)*P1).mass(); -// } -//} -//--------------------------------------------------- -// -/* -float QCDEvent::calomjj() -{ - if (CaloJets_.size() < 2) - return 0.0; - else { - const LorentzVector& P0 = CaloJets_[0].p4(); - const LorentzVector& P1 = CaloJets_[1].p4(); - return (P0+P1).mass(); - } -} -////--------------------------------------------------- - -float QCDEvent::calomjjcor(int k) -{ - int sign(0); - if (CaloJets_.size() < 2) - return 0.0; - else { - if (k>0) - sign = 1; - if (k<0) - sign = -1; - const LorentzVector& P0 = CaloJets_[0].p4(); - const LorentzVector& P1 = CaloJets_[1].p4(); - double cor0 = CaloJets_[0].cor(); - double cor1 = CaloJets_[1].cor(); - double unc0 = CaloJets_[0].unc(); - double unc1 = CaloJets_[1].unc(); - return (cor0*(1+sign*unc0)*P0+cor1*(1+sign*unc1)*P1).mass(); - } -} -//--------------------------------------------------- -float QCDEvent::pfmjjgen() -{ - if (PFJetsCHS_.size() < 2) - return 0.0; - else { - const LorentzVector& P0 = PFJetsCHS_[0].genp4(); - const LorentzVector& P1 = PFJetsCHS_[1].genp4(); - return (P0+P1).mass(); - } -} -//--------------------------------------------------- -float QCDEvent::calomjjgen() -{ - if (CaloJets_.size() < 2) - return 0.0; - else { - const LorentzVector& P0 = CaloJets_[0].genp4(); - const LorentzVector& P1 = CaloJets_[1].genp4(); - return (P0+P1).mass(); - } -} -*/ - diff --git a/AnalysisFW/test/.DS_Store b/AnalysisFW/test/.DS_Store deleted file mode 100644 index af1815a79a6..00000000000 Binary files a/AnalysisFW/test/.DS_Store and /dev/null differ diff --git a/AnalysisFW/test/._.DS_Store b/AnalysisFW/test/._.DS_Store deleted file mode 100644 index 55db7320996..00000000000 Binary files a/AnalysisFW/test/._.DS_Store and /dev/null differ diff --git a/AnalysisFW/test/ProcessedTreeProducer_MC2017_MiniAOD_cfg.py b/AnalysisFW/test/ProcessedTreeProducer_MC2017_MiniAOD_cfg.py new file mode 100644 index 00000000000..85a36b87632 --- /dev/null +++ b/AnalysisFW/test/ProcessedTreeProducer_MC2017_MiniAOD_cfg.py @@ -0,0 +1,171 @@ +# -*- coding: utf-8 -*- + +import FWCore.ParameterSet.Config as cms + +from RecoJets.Configuration.RecoPFJets_cff import ak4PFJets, ak4PFJetsCHS +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets +from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters +from RecoJets.JetProducers.PFJetParameters_cfi import * +from RecoJets.JetProducers.GenJetParameters_cfi import * +from RecoJets.JetProducers.AnomalousCellParameters_cfi import * +from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * +from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets +from PhysicsTools.PatAlgos.tools.jetTools import * +#from PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi import patMETs +from PhysicsTools.PatAlgos.patSequences_cff import * +#nnfrom PhysicsTools.PatAlgos.tools.metTools import addMETCollection +#from RecoJets.JetProducers.pileupjetidproducer_cfi import * +from PhysicsTools.PatAlgos.patTemplate_cfg import * +from PhysicsTools.PatAlgos.tools.jetTools import * +from RecoJets.JetProducers.QGTagger_cfi import QGTagger + +## Modified version of jetToolBox from https://github.com/cms-jet/jetToolbox +## Options for PUMethod: Puppi, CS, SK, CHS + +# -*- coding: utf-8 -*- +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Ntuplizer") +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Conditions +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") +process.load("Configuration.EventContent.EventContent_cff") +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('RecoJets.Configuration.GenJetParticles_cff') +process.load('RecoJets.Configuration.RecoGenJets_cff') +process.load('RecoJets.JetProducers.TrackJetParameters_cfi') +process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.load('RecoJets.JetProducers.QGTagger_cfi') +process.QGTagger.srcJets = cms.InputTag('ak4PFJetsCHS') # Could be reco::PFJetCollection or pat::JetCollection (both AOD and miniAOD) +process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') # Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion + +process.GlobalTag.globaltag = "92X_dataRun2_HLT_v7" + +##-------------------- Import the JEC services ----------------------- +process.load('JetMETCorrections.Configuration.DefaultJEC_cff') + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Input +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +inFiles = cms.untracked.vstring( +'file:0635E57E-CC87-E711-93AB-44A842CF0634.root' + ) + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10000)) +process.source = cms.Source("PoolSource", fileNames = inFiles ) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Services +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 100 +process.load('CommonTools.UtilAlgos.TFileService_cfi') +process.TFileService.fileName=cms.string('MC_ProcessedTreeProducer.root') + +process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff") +process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff") + +process.patJets.addTagInfos = True +process.patJets.addAssociatedTracks = True + +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets, ak8GenJets + +genParticleCollection = 'prunedGenParticles' + +from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets +from RecoJets.JetProducers.GenJetParameters_cfi import * + +process.ak4GenJetsCustom = ak4GenJets.clone( + src = genParticleCollection, + rParam = cms.double(0.4), + jetAlgorithm = cms.string("AntiKt") +) + +genParticleCollection = 'prunedGenParticles' +genJetCollection = 'slimmedGenJets' + +from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons +process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone( + particles = genParticleCollection +) + +from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos +process.genJetFlavourInfos = ak4JetFlavourInfos.clone( + jets = genJetCollection, + rParam = cms.double(0.4), +) + +#process.out.outputCommands += ['keep *_QGTagger_*_*'] +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.ak4 = cms.EDAnalyzer('ProcessedTreeProducerBTag', + ## jet collections ########################### + pfjets = cms.InputTag('slimmedJets'), + pfjetschs = cms.InputTag('slimmedJets'), + pfpujetid = cms.string('AK4PFpileupJetIdEvaluator:fullDiscriminant'), + pfchsjetpuid = cms.string('AK4PFCHSpileupJetIdEvaluator:fullDiscriminant'), + ## MET collection #### + pfmet = cms.InputTag('slimmedMETs'), + genjets = cms.untracked.InputTag('slimmedGenJets'), + ## database entry for the uncertainties ###### + PFPayloadName = cms.string(''), + PFPayloadNameCHS= cms.string(''), + jecUncSrc = cms.string(''), + jecUncSrcCHS = cms.string(''), + jecUncSrcNames = cms.vstring(''), + ## set the conditions for good Vtx counting ## + offlineVertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + beamSpot = cms.InputTag('offlineBeamSpot'), + goodVtxNdof = cms.double(4), + goodVtxZ = cms.double(24), + ## rho ####################################### + srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), + srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), + srcPULabel = cms.untracked.InputTag('slimmedAddPileupInfo'), + ## preselection cuts ######################### + maxY = cms.double(5.0), + minPFPt = cms.double(30), + minNPFJets = cms.int32(1), + minGenPt = cms.untracked.double(20), + isMCarlo = cms.untracked.bool(True), + useGenInfo = cms.untracked.bool(True), + AK4 = cms.untracked.bool(True), + ## trigger ################################### + printTriggerMenu = cms.untracked.bool(False), + processName = cms.string('HLT'), + triggerName = cms.vstring(''), + triggerResults = cms.InputTag("TriggerResults","","HLT"), + triggerEvent = cms.InputTag("hltTriggerSummaryAOD","","HLT"), + prescales = cms.InputTag("patTrigger"), + triggerObjects = cms.InputTag("slimmedPatTrigger"), + ## jec services ############################## + #new tokens + EventInfo = cms.InputTag("generator"), + GenParticles = cms.InputTag("prunedGenParticles"), + jetFlavourInfos = cms.InputTag("genJetFlavourInfos"), + saveWeights = cms.bool(False) +) + +process.goodVertices = cms.EDFilter("VertexSelector", + filter = cms.bool(False), + src = cms.InputTag("offlineSlimmedPrimaryVertices"), + cut = cms.string("!isFake && ndof >= 4 && abs(z) <= 24 && position.rho <= 2"), +) + +#Try scheduled processs +process.path = cms.Path(process.goodVertices + *process.selectedHadronsAndPartons*process.genJetFlavourInfos + #process.patMETCorrections*process.patMETs + *process.ak4) + + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Output and Log +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) +process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/test/ProcessedTreeProducer_MCPAT25ns_BTag_cfg.py b/AnalysisFW/test/ProcessedTreeProducer_MCPAT25ns_BTag_cfg.py deleted file mode 100644 index 48133548431..00000000000 --- a/AnalysisFW/test/ProcessedTreeProducer_MCPAT25ns_BTag_cfg.py +++ /dev/null @@ -1,373 +0,0 @@ -# -*- coding: utf-8 -*- - -import FWCore.ParameterSet.Config as cms - -from RecoJets.Configuration.RecoPFJets_cff import ak4PFJets, ak4PFJetsCHS -from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets -from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters -from RecoJets.JetProducers.PFJetParameters_cfi import * -from RecoJets.JetProducers.GenJetParameters_cfi import * -from RecoJets.JetProducers.AnomalousCellParameters_cfi import * -from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * -from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets -from PhysicsTools.PatAlgos.tools.jetTools import * -#from PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi import patMETs -from PhysicsTools.PatAlgos.patSequences_cff import * -#nnfrom PhysicsTools.PatAlgos.tools.metTools import addMETCollection -#from RecoJets.JetProducers.pileupjetidproducer_cfi import * -from PhysicsTools.PatAlgos.patTemplate_cfg import * -from PhysicsTools.PatAlgos.tools.jetTools import * -from RecoJets.JetProducers.QGTagger_cfi import QGTagger - -## Modified version of jetToolBox from https://github.com/cms-jet/jetToolbox -## Options for PUMethod: Puppi, CS, SK, CHS - -# -*- coding: utf-8 -*- -import FWCore.ParameterSet.Config as cms - -process = cms.Process("Ntuplizer") -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! Conditions -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") -process.load("Configuration.EventContent.EventContent_cff") -process.load('Configuration.StandardSequences.GeometryRecoDB_cff') -process.load('Configuration.StandardSequences.MagneticField_38T_cff') -process.load('RecoJets.Configuration.GenJetParticles_cff') -process.load('RecoJets.Configuration.RecoGenJets_cff') -process.load('RecoJets.JetProducers.TrackJetParameters_cfi') -process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') -process.load("PhysicsTools.PatAlgos.patSequences_cff") - -#process.load("PhysicsTools.PatAlgos.slimming.pileupJetId_cfi") -from Configuration.AlCa.GlobalTag import GlobalTag -#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:mc', '') -process.GlobalTag.globaltag = "80X_mcRun2_asymptotic_2016_TrancheIV_v6" -#process.GlobalTag.globaltag = "80X_mcRun2_asymptotic_2016_miniAODv2_v1" - -process.load('RecoJets.JetProducers.QGTagger_cfi') -process.QGTagger.srcJets = cms.InputTag('ak4PFJetsCHS') # Could be reco::PFJetCollection or pat::JetCollection (both AOD and miniAOD) -process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') # Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion - -##-------------------- Import the JEC services ----------------------- -process.load('JetMETCorrections.Configuration.DefaultJEC_cff') - -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! Input -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -inFiles = cms.untracked.vstring( -#'file:00430D8B-320F-E611-BC64-02163E00EA8C.root' -#/afs/cern.ch/work/e/eeren/public/04E758F7-34F9-E411-AFF0-002618FDA259.root' -#'root://eoscms.cern.ch//eos/cms/store/mc/RunIISpring16DR80/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8/AODSIM/PUSpring16_magnetOn_80X_mcRun2_asymptotic_2016_v3-v1/00000/1276C35E-EA0F-E611-8336-02163E00F718.root' -#'root://cms-xrd-global.cern.ch//store/mc/RunIISpring16DR80/QCD_Pt_1400to1800_TuneCUETP8M1_13TeV_pythia8/AODSIM/PUSpring16_80X_mcRun2_asymptotic_2016_v3-v1/60000/381409B5-9B08-E611-98F3-0025905B85A0.root' -'root://cms-xrd-global.cern.ch//store/mc/RunIISummer16DR80Premix/QCD_Pt_300to470_TuneCUETP8M1_13TeV_pythia8/AODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/110000/02CD261D-10A9-E611-8521-FA163E5CAE75.root' - ) - -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(700)) -process.source = cms.Source("PoolSource", fileNames = inFiles ) - -def jetToolbox( proc, jetType, jetSequence,PUMethod='', bTagDiscriminators = None): - - JETCorrPayload='None' - JETCorrLevels = [ 'None' ] - bTagDiscriminators = [#'trackCountingHighEffBJetTags', - #'trackCountingHighPurBJetTags', - #'pfTrackCountingHighEffBJetTags', - #'pfTrackCountingHighPurBJetTags', - #'softPFMuonByIP3dBJetTags', - #'softPFElectronByIP3dBJetTags', - #'softPFMuonBJetTags', - #'softPFElectronBJetTags', - #'simpleSecondaryVertexHighEffBJetTags', - #'simpleSecondaryVertexHighPurBJetTags', - #'pfSimpleSecondaryVertexHighEffBJetTags', - #'pfSimpleSecondaryVertexHighPurBJetTags', - #'combinedSecondaryVertexV2BJetTags', - 'deepFlavourJetTags:probb', - 'deepFlavourJetTags:probc', - 'deepFlavourJetTags:probudsg', - 'deepFlavourJetTags:probbb', - 'deepFlavourJetTags:probcc', - 'negativeDeepFlavourJetTags:probb', - 'negativeDeepFlavourJetTags:probc', - 'negativeDeepFlavourJetTags:probudsg', - 'negativeDeepFlavourJetTags:probbb', - 'negativeDeepFlavourJetTags:probcc', - 'positiveDeepFlavourJetTags:probb', - 'positiveDeepFlavourJetTags:probc', - 'positiveDeepFlavourJetTags:probudsg', - 'positiveDeepFlavourJetTags:probbb', - 'positiveDeepFlavourJetTags:probcc', - 'pfCombinedCvsLJetTags', - 'pfCombinedCvsBJetTags', - 'pfBoostedDoubleSecondaryVertexAK8BJetTags', - 'pfCombinedSecondaryVertexV2BJetTags', - 'pfPositiveCombinedSecondaryVertexV2BJetTags', #implemented - 'pfNegativeCombinedSecondaryVertexV2BJetTags', #implemented - 'pfCombinedInclusiveSecondaryVertexV2BJetTags', #implemented - 'pfCombinedMVAV2BJetTags', #implemented - 'pfJetProbabilityBJetTags'] #implemented - - GetJetMCFlavour = ['True'] - #JECLevels = [ 'L1Offset', 'L1FastJet', 'L1JPTOffset', 'L2Relative', 'L3Absolute', 'L5Falvour', 'L7Parton' ] - - algorithm='AntiKt' # CambridgeAachen' , 'Kt' - size = jetType[-1:] #[-1:] takes the last char from string 'akX' - jetSize = float('0.'+jetType[-1:]) - jetALGO = jetType.upper() - jetalgo = jetType.lower() - elemToKeep = [] - - print 'Running processes with: '+str(jetALGO)+' PF '+PUMethod+' jet algorithm with radius parameter '+str(jetSize) - - JETCorrPayload = 'AK'+size+'PF'+PUMethod.lower() - JETCorrLevels = ['L1FastJet', 'L2Relative', 'L3Absolute'] - #JETCorrLevels = [] #No JEC corrections - JEC = ( JETCorrPayload, JETCorrLevels , 'None') - - ################################################################################# - ####### Toolbox start - ################################################################################# - - elemToKeep = [] - jetSeq = cms.Sequence() - genParticlesLabel = '' - pvLabel = '' - tvLabel = '' - toolsUsed = [] - - proc.load('RecoJets.Configuration.GenJetParticles_cff') - setattr( proc, jetalgo+'GenJetsNoNu', ak4GenJets.clone( src = 'genParticlesForJetsNoNu', rParam = jetSize, jetAlgorithm = algorithm ) ) - jetSeq += getattr(proc, jetalgo+'GenJetsNoNu' ) - - proc.load('CommonTools.ParticleFlow.pfNoPileUpJME_cff') - #### Creating PATjets - if( PUMethod=='CHS') : - setattr( proc, jetalgo+'PFJetsCHS', ak4PFJets.clone( rParam = jetSize, jetAlgorithm = algorithm ) ) - jetSeq += getattr(proc, jetalgo+'PFJetsCHS' ) - - setattr( proc, jetalgo+'PFJetsCHS', - ak4PFJetsCHS.clone( - doAreaFastjet = True, - rParam = jetSize, - jetAlgorithm = algorithm ) ) - jetSeq += getattr(proc, jetalgo+'PFJetsCHS' ) - - else : - setattr( proc, jetalgo+'PFJets', ak4PFJets.clone( rParam = jetSize, jetAlgorithm = algorithm ) ) - jetSeq += getattr(proc, jetalgo+'PFJets' ) - - setattr( proc, jetalgo+'PFJets', - ak4PFJets.clone( - doAreaFastjet = True, - rParam = jetSize, - jetAlgorithm = algorithm ) ) - jetSeq += getattr(proc, jetalgo+'PFJets' ) - PUMethod='' - - - addJetCollection( - proc, - labelName = jetALGO+'PF'+PUMethod, - jetSource = cms.InputTag( jetalgo+'PFJets'+PUMethod), - algo = jetalgo, - btagDiscriminators = bTagDiscriminators, - rParam = jetSize, - jetCorrections = JEC, #( 'AK'+size+'PFchs', cms.vstring( ['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'), - pfCandidates = cms.InputTag( 'particleFlow' ), #'packedPFCandidates'), - svSource = cms.InputTag('inclusiveCandidateSecondaryVertices'), - genJetCollection = cms.InputTag( jetalgo+'GenJetsNoNu'), - pvSource = cms.InputTag( 'offlinePrimaryVertices' ), #'offlineSlimmedPrimaryVertices'), - jetTrackAssociation = True, - - ) - - #setattr( proc, jetALGO+'PF'+PUMethod+'pileupJetIdCalculator', -# pileupJetIdCalculator.clone( -# jets = cms.InputTag(jetalgo+'PFJets'+PUMethod), -# rho = cms.InputTag("fixedGridRhoFastjetAll"), -# vertexes = cms.InputTag('offlinePrimaryVertices'), -# applyJec = cms.bool(True), -# inputIsCorrected = cms.bool(False) -# )) - -# setattr( proc, jetALGO+'PF'+PUMethod+'pileupJetIdEvaluator', -# pileupJetIdEvaluator.clone( -# jetids = cms.InputTag(jetALGO+'PF'+PUMethod+'pileupJetIdCalculator'), -# jets = cms.InputTag(jetalgo+'PFJets'+PUMethod), -# rho = cms.InputTag("fixedGridRhoFastjetAll"), -# vertexes = cms.InputTag('offlinePrimaryVertices'), -# applyJec = cms.bool(True), -# inputIsCorrected = cms.bool(False) -# -# ) -# ) - - #getattr( proc, 'patJets'+jetALGO+'PF'+PUMethod).userData.userFloats.src += [jetALGO+'PF'+PUMethod+'pileupJetIdEvaluator:fullDiscriminant'] - #getattr( proc, 'patJets'+jetALGO+'PF'+PUMethod).userData.userInts.src += [jetALGO+'PF'+PUMethod+'pileupJetIdEvaluator:cutbasedId',jetALGO+'PF'+PUMethod+'pileupJetIdEvaluator:fullId'] - - QGjetsLabel='chs' - - setattr( proc, 'QGTagger'+jetALGO+'PF'+PUMethod, - QGTagger.clone( - srcJets = cms.InputTag(jetalgo+'PFJets'+PUMethod), # Could be reco::PFJetCollection or pat::JetCollection (both AOD and miniAOD) - jetsLabel = cms.string('QGL_AK4PF'+QGjetsLabel) # Other options (might need to add an ESSource for it): see https://twiki.cern.ch/twiki/bi - ) - ) - elemToKeep += [ 'keep *_QGTagger'+jetALGO+'PF'+PUMethod+'_*_*' ] - getattr( proc, 'patJets'+jetALGO+'PF'+PUMethod).userData.userFloats.src += ['QGTagger'+jetALGO+'PF'+PUMethod+':qgLikelihood'] - jetSeq += getattr(proc, 'QGTagger'+jetALGO+'PF'+PUMethod ) - - toolsUsed.append( 'QGTagger'+jetALGO+'PF'+PUMethod ) - - getattr(proc,'patJetPartons').particles = cms.InputTag( 'genParticles' ) #'prunedGenParticles') - setattr(proc, 'selectedPatJets'+jetALGO+'PF'+PUMethod, selectedPatJets.clone( src = 'patJets'+jetALGO+'PF'+PUMethod ) ) - setattr(proc, jetSequence, jetSeq) - - -#jetToolbox( process, 'ak4', 'ak4JetSubs') -jetToolbox( process, 'ak4', 'ak4JetSubs','CHS') - -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! Services -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -process.load('FWCore.MessageLogger.MessageLogger_cfi') -process.MessageLogger.cerr.FwkReport.reportEvery = 100 -process.load('CommonTools.UtilAlgos.TFileService_cfi') -process.TFileService.fileName=cms.string('MC_ProcessedTreeProducer_without_L2L3.root') - -# PAT Layer 1 -#process.load("PhysicsTools.PatAlgos.patLayer0_cff") # need to load this -#process.load("PhysicsTools.PatAlgos.patLayer1_cff") # even if we run only layer 1 - -process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff") -process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff") -#from PhysicsTools.PatAlgos.tools.metTools import addMETCollection -#addMETCollection(process,'patMETPF','pfMetT1') -#patMETs.addGenMet = cms.bool(False) -#patMETs.genMETSource = cms.InputTag("") -process.patJets.addTagInfos = True -process.patJets.getJetMCFlavour = True - -genJetCollection = 'ak4GenJetsNoNu' -genParticleCollection = 'genParticles' - -from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons -process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone( - particles = genParticleCollection -) - -from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos - -process.genJetFlavourInfos = ak4JetFlavourInfos.clone( - jets = genJetCollection, -) - -process.ak4 = cms.EDAnalyzer('ProcessedTreeProducerBTag', - ## jet collections ########################### - #pfjets = cms.InputTag('selectedPatJetsAK4PF'), - pfjetschs = cms.InputTag('selectedPatJetsAK4PFCHS'), - #pfpujetid = cms.string('AK4PFpileupJetIdEvaluator:fullDiscriminant'), - pfchsjetpuid = cms.string('AK4PFCHSpileupJetIdEvaluator:fullDiscriminant'), - ## MET collection #### - pfmet = cms.InputTag('patMETs'), - genjets = cms.untracked.InputTag('ak4GenJetsNoNu'), - ## database entry for the uncertainties ###### - #PFPayloadName = cms.string('AK4PF'), - PFPayloadNameCHS= cms.string('AK4PFchs'), - #jecUncSrc = cms.string(''), - jecUncSrcCHS = cms.string(''), - jecUncSrcNames = cms.vstring(''), - AK4 = cms.untracked.bool(True), - ## set the conditions for good Vtx counting ## - offlineVertices = cms.InputTag('offlinePrimaryVertices'), - goodVtxNdof = cms.double(4), - goodVtxZ = cms.double(24), - ## rho ####################################### - srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), - srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), - srcPULabel = cms.untracked.InputTag('addPileupInfo'), - ## preselection cuts ######################### - maxY = cms.double(5.0), - minPFPt = cms.double(20), - minNPFJets = cms.int32(1), - minGenPt = cms.untracked.double(20), - minJJMass = cms.double(-1), - isMCarlo = cms.untracked.bool(True), - useGenInfo = cms.untracked.bool(True), - ## trigger ################################### - printTriggerMenu = cms.untracked.bool(False), - processName = cms.string('HLT'), - triggerName = cms.vstring(''), - triggerResults = cms.InputTag("TriggerResults","","HLT"), - triggerEvent = cms.InputTag("hltTriggerSummaryAOD","","HLT"), - ## jec services ############################## - HBHENoiseFilterResultLabel = cms.InputTag("HBHENoiseFilterResultProducer", "HBHENoiseFilterResult"), - HBHENoiseFilterResultNoMinZLabel = cms.InputTag("HBHENoiseFilterResultProducerNoMinZ", "HBHENoiseFilterResult"), - EventInfo = cms.InputTag("generator"), - GenParticles = cms.InputTag("genParticles"), - beamSpot = cms.InputTag('offlineBeamSpot'), - jetFlavourInfos = cms.InputTag("genJetFlavourInfos") - - #pfjecService = cms.string('ak7PFL1FastL2L3Residual'), -) - -#jetToolbox( process, 'ak8', 'ak8JetSubs','CHS') -#jetToolbox( process, 'ak8', 'ak8JetSubs') - -#process.ak8 = process.ak4.clone( - #pfjets = cms.InputTag('selectedPatJetsAK8PF'), -# pfjetschs = cms.InputTag('selectedPatJetsAK8PFCHS'), -# pfpujetid = cms.string('AK8PFpileupJetIdEvaluator:fullDiscriminant'), -# pfchsjetpuid = cms.string('AK8PFCHSpileupJetIdEvaluator:fullDiscriminant'), -# #PFPayloadName = cms.string('AK8PF'), -# PFPayloadNameCHS= cms.string('AK8PFchs'), -# AK4 = cms.untracked.bool(False), -#) - -jetToolbox( process, 'ak7', 'ak7JetSubs','CHS') -#jetToolbox( process, 'ak7', 'ak7JetSubs') - -process.ak7 = process.ak4.clone( - pfjets = cms.InputTag('selectedPatJetsAK7PF'), - pfjetschs = cms.InputTag('selectedPatJetsAK7PFCHS'), - pfpujetid = cms.string('AK7PFpileupJetIdEvaluator:fullDiscriminant'), - pfchsjetpuid = cms.string('AK7PFCHSpileupJetIdEvaluator:fullDiscriminant'), - PFPayloadNameCHS= cms.string('AK7PFchs'), - AK4 = cms.untracked.bool(False), - genjets = cms.untracked.InputTag('ak7GenJetsNoNu') -) - -#jetToolbox( process, 'ak5', 'ak5JetSubs','CHS') -#jetToolbox( process, 'ak5', 'ak5JetSubs') - -#process.ak5 = process.ak4.clone( -# pfjets = cms.InputTag('selectedPatJetsAK5PF'), -# pfjetschs = cms.InputTag('selectedPatJetsAK5PFCHS'), -# pfpujetid = cms.string('AK5PFpileupJetIdEvaluator:fullDiscriminant'), -# pfchsjetpuid = cms.string('AK5PFCHSpileupJetIdEvaluator:fullDiscriminant'), - #PFPayloadName = cms.string('AK5PF'), -# PFPayloadNameCHS= cms.string('AK5PFchs'), -# AK4 = cms.untracked.bool(False), -#) - -process.goodVertices = cms.EDFilter("VertexSelector", - filter = cms.bool(False), - src = cms.InputTag("offlinePrimaryVertices"), - cut = cms.string("!isFake && ndof >= 4 && abs(z) <= 24 && position.rho <= 2"), -) -process.load('RecoMET.METFilters.trackingFailureFilter_cfi') - -##Type1 patMET Producer -process.load('PhysicsTools.PatAlgos.recoLayer0.metCorrections_cff') -process.load('PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi') -process.patMETs.addGenMET = cms.bool(False) -#Try scheduled processs -process.path = cms.Path(process.ak4*process.ak7) - -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! Output and Log -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) -process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/test/ProcessedTreeProducer_data2017_MiniAOD_cfg.py b/AnalysisFW/test/ProcessedTreeProducer_data2017_MiniAOD_cfg.py new file mode 100644 index 00000000000..3abc39ca96c --- /dev/null +++ b/AnalysisFW/test/ProcessedTreeProducer_data2017_MiniAOD_cfg.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- + +import FWCore.ParameterSet.Config as cms + +from RecoJets.Configuration.RecoPFJets_cff import ak4PFJets, ak4PFJetsCHS +from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets +from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters +from RecoJets.JetProducers.PFJetParameters_cfi import * +from RecoJets.JetProducers.GenJetParameters_cfi import * +from RecoJets.JetProducers.AnomalousCellParameters_cfi import * +from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * +from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets +from PhysicsTools.PatAlgos.tools.jetTools import * +#from PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi import patMETs +from PhysicsTools.PatAlgos.patSequences_cff import * +#nnfrom PhysicsTools.PatAlgos.tools.metTools import addMETCollection +#from RecoJets.JetProducers.pileupjetidproducer_cfi import * +from PhysicsTools.PatAlgos.patTemplate_cfg import * +from PhysicsTools.PatAlgos.tools.jetTools import * +from RecoJets.JetProducers.QGTagger_cfi import QGTagger + +## Modified version of jetToolBox from https://github.com/cms-jet/jetToolbox +## Options for PUMethod: Puppi, CS, SK, CHS + +# -*- coding: utf-8 -*- +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Ntuplizer") +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Conditions +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") +process.load("Configuration.EventContent.EventContent_cff") +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('RecoJets.Configuration.GenJetParticles_cff') +process.load('RecoJets.Configuration.RecoGenJets_cff') +process.load('RecoJets.JetProducers.TrackJetParameters_cfi') +process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.load('RecoJets.JetProducers.QGTagger_cfi') +process.QGTagger.srcJets = cms.InputTag('ak4PFJetsCHS') # Could be reco::PFJetCollection or pat::JetCollection (both AOD and miniAOD) +process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') # Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion + +process.GlobalTag.globaltag = "92X_dataRun2_HLT_v7" + +##-------------------- Import the JEC services ----------------------- +process.load('JetMETCorrections.Configuration.DefaultJEC_cff') + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Input +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +inFiles = cms.untracked.vstring( +'file:006233DA-3599-E711-911B-0025905A6118.root' + ) + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10000)) +process.source = cms.Source("PoolSource", fileNames = inFiles ) + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Services +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 100 +process.load('CommonTools.UtilAlgos.TFileService_cfi') +process.TFileService.fileName=cms.string('DATA_ProcessedTreeProducer_2.root') + +process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff") +process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff") + +process.patJets.addTagInfos = True +process.patJets.addAssociatedTracks = True + +#process.out.outputCommands += ['keep *_QGTagger_*_*'] +process.load("PhysicsTools.PatAlgos.patSequences_cff") + +process.ak4 = cms.EDAnalyzer('ProcessedTreeProducerBTag', + ## jet collections ########################### + pfjets = cms.InputTag('slimmedJets'), + pfjetschs = cms.InputTag('slimmedJets'), + pfpujetid = cms.string('AK4PFpileupJetIdEvaluator:fullDiscriminant'), + pfchsjetpuid = cms.string('AK4PFCHSpileupJetIdEvaluator:fullDiscriminant'), + ## MET collection #### + pfmet = cms.InputTag('slimmedMETs'), + genjets = cms.untracked.InputTag('slimmedGenJets'), + ## database entry for the uncertainties ###### + PFPayloadName = cms.string(''), + PFPayloadNameCHS= cms.string(''), + jecUncSrc = cms.string(''), + jecUncSrcCHS = cms.string(''), + jecUncSrcNames = cms.vstring(''), + ## set the conditions for good Vtx counting ## + offlineVertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + beamSpot = cms.InputTag('offlineBeamSpot'), + goodVtxNdof = cms.double(4), + goodVtxZ = cms.double(24), + ## rho ####################################### + srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), + srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), + srcPULabel = cms.untracked.InputTag('slimmedAddPileupInfo'), + ## preselection cuts ######################### + maxY = cms.double(5.0), + minPFPt = cms.double(30), + minNPFJets = cms.int32(1), + minGenPt = cms.untracked.double(20), + isMCarlo = cms.untracked.bool(False), + useGenInfo = cms.untracked.bool(False), + AK4 = cms.untracked.bool(True), + ## trigger ################################### + printTriggerMenu = cms.untracked.bool(True), + processName = cms.string('HLT'), + triggerName = cms.vstring('HLT_PFJet40_v1','HLT_PFJet60_v1', 'HLT_PFJet80_v1', 'HLT_PFJet140_v', 'HLT_PFJet200_v1', 'HLT_PFJet260_v1','HLT_PFJet320_v1', 'HLT_PFJet400_v1', 'HLT_PFJet450_v1','HLT_PFJet500_v1'), + triggerResults = cms.InputTag("TriggerResults","","HLT"), + triggerEvent = cms.InputTag("hltTriggerSummaryAOD","","HLT"), + prescales = cms.InputTag("patTrigger"), + prescalesL1Min = cms.InputTag("patTrigger","l1min"), + prescalesL1Max = cms.InputTag("patTrigger","l1max"), + triggerObjects = cms.InputTag("slimmedPatTrigger"), + ## jec services ############################## + #new tokens + EventInfo = cms.InputTag("generator"), + GenParticles = cms.InputTag("genparticles"), + jetFlavourInfos = cms.InputTag("genJetFlavourInfos"), + saveWeights = cms.bool(False), +) + +process.goodVertices = cms.EDFilter("VertexSelector", + filter = cms.bool(False), + src = cms.InputTag("offlineSlimmedPrimaryVertices"), + cut = cms.string("!isFake && ndof >= 4 && abs(z) <= 24 && position.rho <= 2"), +) + +#Try scheduled processs +process.path = cms.Path(process.goodVertices + #process.patMETCorrections*process.patMETs + *process.ak4) + + +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Output and Log +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) +process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/AnalysisFW/test/ProcessedTreeProducer_dataPAT25ns_BTag_cfg.py b/AnalysisFW/test/ProcessedTreeProducer_dataPAT25ns_BTag_cfg.py deleted file mode 100644 index 74821b13f7b..00000000000 --- a/AnalysisFW/test/ProcessedTreeProducer_dataPAT25ns_BTag_cfg.py +++ /dev/null @@ -1,398 +0,0 @@ -# -*- coding: utf-8 -*- - -import FWCore.ParameterSet.Config as cms - -from RecoJets.Configuration.RecoPFJets_cff import ak4PFJets, ak4PFJetsCHS -from RecoJets.Configuration.RecoGenJets_cff import ak4GenJets -from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters -from RecoJets.JetProducers.PFJetParameters_cfi import * -from RecoJets.JetProducers.GenJetParameters_cfi import * -from RecoJets.JetProducers.AnomalousCellParameters_cfi import * -from PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff import * -from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets -from PhysicsTools.PatAlgos.tools.jetTools import * -#from PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi import patMETs -from PhysicsTools.PatAlgos.patSequences_cff import * -#nnfrom PhysicsTools.PatAlgos.tools.metTools import addMETCollection -#from RecoJets.JetProducers.pileupjetidproducer_cfi import * -from PhysicsTools.PatAlgos.patTemplate_cfg import * -from PhysicsTools.PatAlgos.tools.jetTools import * -from RecoJets.JetProducers.QGTagger_cfi import QGTagger - -## Modified version of jetToolBox from https://github.com/cms-jet/jetToolbox -## Options for PUMethod: Puppi, CS, SK, CHS - -# -*- coding: utf-8 -*- -import FWCore.ParameterSet.Config as cms - -process = cms.Process("Ntuplizer") -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! Conditions -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") -process.load("Configuration.EventContent.EventContent_cff") -process.load('Configuration.StandardSequences.GeometryRecoDB_cff') -process.load('Configuration.StandardSequences.MagneticField_38T_cff') -process.load('RecoJets.Configuration.GenJetParticles_cff') -process.load('RecoJets.Configuration.RecoGenJets_cff') -process.load('RecoJets.JetProducers.TrackJetParameters_cfi') -process.load('RecoJets.JetProducers.PileupJetIDParams_cfi') -process.load("PhysicsTools.PatAlgos.patSequences_cff") - -#process.load("PhysicsTools.PatAlgos.slimming.pileupJetId_cfi") -process.load('RecoJets.JetProducers.QGTagger_cfi') -process.QGTagger.srcJets = cms.InputTag('ak4PFJetsCHS') # Could be reco::PFJetCollection or pat::JetCollection (both AOD and miniAOD) -process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') # Other options: see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion - -#process.GlobalTag.globaltag = "80X_dataRun2_ICHEP16_repro_v0" -process.GlobalTag.globaltag = "80X_dataRun2_2016SeptRepro_v7" #ReReco RunB-G -#process.GlobalTag.globaltag = "80X_dataRun2_Prompt_v16" - -process.GlobalTag.toGet = cms.VPSet( - cms.PSet(record = cms.string("BTagTrackProbability3DRcd"), - tag = cms.string("JPcalib_Data80X_2016_v3"), - connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") - ) - ) - - - -##-------------------- Import the JEC services ----------------------- -process.load('JetMETCorrections.Configuration.DefaultJEC_cff') - -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! Input -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -inFiles = cms.untracked.vstring( -#'root://cms-xrd-global.cern.ch//store/data/Run2016G/JetHT/AOD/23Sep2016-v1/100000/0645BD20-F486-E611-A724-002590D0B054.root' -'root://cms-xrd-global.cern.ch//store/data/Run2016G/JetHT/AOD/23Sep2016-v1/100000/0006CE1E-9986-E611-8DFB-6C3BE5B5C0B0.root' -#'root://cms-xrd-global.cern.ch//store/data/Run2016G/JetHT/AOD/18Apr2017-v1/100000/001D282A-9134-E711-9003-0090FAA57780.root' -#'0002DAEF-97EA-E611-8DEC-001E67E69DEC.root' -) - -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1000)) -process.source = cms.Source("PoolSource", fileNames = inFiles ) - -def jetToolbox( proc, jetType, jetSequence,PUMethod='', bTagDiscriminators = None): - - JETCorrPayload='None' - JETCorrLevels = [ 'None' ] - bTagDiscriminators = [#'trackCountingHighEffBJetTags', - #'trackCountingHighPurBJetTags', - #'pfTrackCountingHighEffBJetTags', - #'pfTrackCountingHighPurBJetTags', - #'softPFMuonByIP3dBJetTags', - #'softPFElectronByIP3dBJetTags', - #'softPFMuonBJetTags', - #'softPFElectronBJetTags', - #'simpleSecondaryVertexHighEffBJetTags', - #'simpleSecondaryVertexHighPurBJetTags', - #'pfSimpleSecondaryVertexHighEffBJetTags', - #'pfSimpleSecondaryVertexHighPurBJetTags', - #'combinedSecondaryVertexV2BJetTags', - 'deepFlavourJetTags:probb', - 'deepFlavourJetTags:probc', - 'deepFlavourJetTags:probudsg', - 'deepFlavourJetTags:probbb', - 'deepFlavourJetTags:probcc', - 'negativeDeepFlavourJetTags:probb', - 'negativeDeepFlavourJetTags:probc', - 'negativeDeepFlavourJetTags:probudsg', - 'negativeDeepFlavourJetTags:probbb', - 'negativeDeepFlavourJetTags:probcc', - 'positiveDeepFlavourJetTags:probb', - 'positiveDeepFlavourJetTags:probc', - 'positiveDeepFlavourJetTags:probudsg', - 'positiveDeepFlavourJetTags:probbb', - 'positiveDeepFlavourJetTags:probcc', - 'pfCombinedCvsLJetTags', - 'pfCombinedCvsBJetTags', - 'pfBoostedDoubleSecondaryVertexAK8BJetTags', - 'pfCombinedSecondaryVertexV2BJetTags', - 'pfPositiveCombinedSecondaryVertexV2BJetTags', #implemented - 'pfNegativeCombinedSecondaryVertexV2BJetTags', #implemented - 'pfCombinedInclusiveSecondaryVertexV2BJetTags', #implemented - 'pfCombinedMVAV2BJetTags', #implemented - 'pfJetProbabilityBJetTags'] #implemented - - algorithm='AntiKt' # CambridgeAachen' , 'Kt' - size = jetType[-1:] #[-1:] takes the last char from string 'akX' - jetSize = float('0.'+jetType[-1:]) - jetALGO = jetType.upper() - jetalgo = jetType.lower() - elemToKeep = [] - - print 'Running processes with: '+str(jetALGO)+' PF '+PUMethod+' jet algorithm with radius parameter '+str(jetSize) - - JETCorrPayload = 'AK'+size+'PF'+PUMethod.lower() - JETCorrLevels = ['L1FastJet', 'L2Relative', 'L3Absolute','L2L3Residual'] - #JETCorrLevels = [] #No JEC corrections - JEC = ( JETCorrPayload, JETCorrLevels , 'None') - - ################################################################################# - ####### Toolbox start - ################################################################################# - - elemToKeep = [] - jetSeq = cms.Sequence() - genParticlesLabel = '' - pvLabel = '' - tvLabel = '' - toolsUsed = [] - - proc.load('RecoJets.Configuration.GenJetParticles_cff') - setattr( proc, jetalgo+'GenJetsNoNu', ak4GenJets.clone( src = 'genParticlesForJetsNoNu', rParam = jetSize, jetAlgorithm = algorithm ) ) - jetSeq += getattr(proc, jetalgo+'GenJetsNoNu' ) - - proc.load('CommonTools.ParticleFlow.pfNoPileUpJME_cff') - #### Creating PATjets - if( PUMethod=='CHS') : - setattr( proc, jetalgo+'PFJetsCHS', ak4PFJets.clone( rParam = jetSize, jetAlgorithm = algorithm ) ) - jetSeq += getattr(proc, jetalgo+'PFJetsCHS' ) - - setattr( proc, jetalgo+'PFJetsCHS', - ak4PFJetsCHS.clone( - doAreaFastjet = True, - rParam = jetSize, - jetAlgorithm = algorithm ) ) - jetSeq += getattr(proc, jetalgo+'PFJetsCHS' ) - - else : - setattr( proc, jetalgo+'PFJets', ak4PFJets.clone( rParam = jetSize, jetAlgorithm = algorithm ) ) - jetSeq += getattr(proc, jetalgo+'PFJets' ) - - setattr( proc, jetalgo+'PFJets', - ak4PFJets.clone( - doAreaFastjet = True, - rParam = jetSize, - jetAlgorithm = algorithm ) ) - jetSeq += getattr(proc, jetalgo+'PFJets' ) - PUMethod='' - - addJetCollection( - proc, - labelName = jetALGO+'PF'+PUMethod, - jetSource = cms.InputTag( jetalgo+'PFJets'+PUMethod), - algo = jetalgo, - btagDiscriminators = bTagDiscriminators, - rParam = jetSize, - jetCorrections = JEC, #( 'AK'+size+'PFchs', cms.vstring( ['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'), - pfCandidates = cms.InputTag( 'particleFlow' ), #'packedPFCandidates'), - svSource = cms.InputTag('inclusiveCandidateSecondaryVertices'), - genJetCollection = cms.InputTag( jetalgo+'GenJetsNoNu'), - pvSource = cms.InputTag( 'offlinePrimaryVertices' ), #'offlineSlimmedPrimaryVertices'), - jetTrackAssociation = True, - ) - - getattr(proc,'patJetPartons').particles = cms.InputTag( 'genParticles' ) #'prunedGenParticles') - - QGjetsLabel='chs' - - setattr( proc, 'QGTagger'+jetALGO+'PF'+PUMethod, - QGTagger.clone( - srcJets = cms.InputTag(jetalgo+'PFJets'+PUMethod), # Could be reco::PFJetCollection or pat::JetCollection (both AOD and miniAOD) - jetsLabel = cms.string('QGL_AK4PF'+QGjetsLabel) # Other options (might need to add an ESSource for it): see https://twiki.cern.ch/twiki/bin/viewauth/CMS/QGDataBaseVersion - ) - ) - elemToKeep += [ 'keep *_QGTagger'+jetALGO+'PF'+PUMethod+'_*_*' ] - getattr( proc, 'patJets'+jetALGO+'PF'+PUMethod).userData.userFloats.src += ['QGTagger'+jetALGO+'PF'+PUMethod+':qgLikelihood'] - jetSeq += getattr(proc, 'QGTagger'+jetALGO+'PF'+PUMethod ) - - toolsUsed.append( 'QGTagger'+jetALGO+'PF'+PUMethod ) - - #getattr( proc, 'selectedPatJets').userData.userFloats.src += ['QGTagger:qgLikelihood'] - #setattr(proc, 'selectedPatJets'+jetALGO+'PF'+PUMethod, selectedPatJets.clone( src = 'patJets'+jetALGO+'PF'+PUMethod ) ) - #jetSeq += getattr(proc, 'QGTagger') - - setattr(proc, jetSequence, jetSeq) - - - - -#jetToolbox( process, 'ak4', 'ak4JetSubs') -jetToolbox( process, 'ak4', 'ak4JetSubs','CHS') - -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! Services -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -process.load('FWCore.MessageLogger.MessageLogger_cfi') -process.MessageLogger.cerr.FwkReport.reportEvery = 100 -process.load('CommonTools.UtilAlgos.TFileService_cfi') -process.TFileService.fileName=cms.string('DATA_ProcessedTreeProducer_2.root') - -# PAT Layer 1 -#process.load("PhysicsTools.PatAlgos.patLayer0_cff") # need to load this -#process.load("PhysicsTools.PatAlgos.patLayer1_cff") # even if we run only layer 1 - -process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff") -process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff") -#from PhysicsTools.PatAlgos.tools.metTools import addMETCollection -#addMETCollection(process,'patMETPF','pfMetT1') -#patMETs.addGenMet = cms.bool(False) -#patMETs.genMETSource = cms.InputTag("") -process.patJets.addTagInfos = True -process.patJets.addAssociatedTracks = True - -#process.out.outputCommands += ['keep *_QGTagger_*_*'] -process.load("PhysicsTools.PatAlgos.patSequences_cff") - -process.ak4 = cms.EDAnalyzer('ProcessedTreeProducerBTag', - ## jet collections ########################### - pfjetschs = cms.InputTag('selectedPatJetsAK4PFCHS'), - pfpujetid = cms.string('AK4PFpileupJetIdEvaluator:fullDiscriminant'), - pfchsjetpuid = cms.string('AK4PFCHSpileupJetIdEvaluator:fullDiscriminant'), - ## MET collection #### - pfmet = cms.InputTag('patMETs'), - genjets = cms.untracked.InputTag('ak4GenJetsNoNu'), - ## database entry for the uncertainties ###### - PFPayloadNameCHS= cms.string('AK4PFchs'), - jecUncSrcCHS = cms.string(''), - jecUncSrcNames = cms.vstring(''), - ## set the conditions for good Vtx counting ## - offlineVertices = cms.InputTag('offlinePrimaryVertices'), - beamSpot = cms.InputTag('offlineBeamSpot'), - goodVtxNdof = cms.double(4), - goodVtxZ = cms.double(24), - ## rho ####################################### - srcCaloRho = cms.InputTag('fixedGridRhoFastjetAllCalo'), - srcPFRho = cms.InputTag('fixedGridRhoFastjetAll'), - srcPULabel = cms.untracked.InputTag('addPileupInfo','addPileupInfo'), - ## preselection cuts ######################### - maxY = cms.double(5.0), - minPFPt = cms.double(64.0), - minNPFJets = cms.int32(1), - minGenPt = cms.untracked.double(20), - minJJMass = cms.double(-1), - isMCarlo = cms.untracked.bool(False), - useGenInfo = cms.untracked.bool(False), - AK4 = cms.untracked.bool(True), - ## trigger ################################### - printTriggerMenu = cms.untracked.bool(True), - processName = cms.string('HLT'), - triggerName = cms.vstring( - 'HLT_PFJet40_v9','HLT_PFJet60_v9','HLT_PFJet80_v9','HLT_PFJet140_v9','HLT_PFJet200_v9','HLT_PFJet260_v9','HLT_PFJet320_v9','HLT_PFJet400_v9','HLT_PFJet450_v9','HLT_PFJet500_v9', - 'HLT_PFJet40_v8','HLT_PFJet60_v8','HLT_PFJet80_v8','HLT_PFJet140_v8','HLT_PFJet200_v8','HLT_PFJet260_v8','HLT_PFJet320_v8','HLT_PFJet400_v8','HLT_PFJet450_v8','HLT_PFJet500_v8', - 'HLT_PFJet40_v7','HLT_PFJet60_v7','HLT_PFJet80_v7','HLT_PFJet140_v7','HLT_PFJet200_v7','HLT_PFJet260_v7','HLT_PFJet320_v7','HLT_PFJet400_v7','HLT_PFJet450_v7','HLT_PFJet500_v7', - 'HLT_PFJet40_v6','HLT_PFJet60_v6','HLT_PFJet80_v6','HLT_PFJet140_v6','HLT_PFJet200_v6','HLT_PFJet260_v6','HLT_PFJet320_v6','HLT_PFJet400_v6','HLT_PFJet450_v6','HLT_PFJet500_v6', - 'HLT_PFJet40_v5','HLT_PFJet60_v5','HLT_PFJet80_v5','HLT_PFJet140_v5','HLT_PFJet200_v5','HLT_PFJet260_v5','HLT_PFJet320_v5','HLT_PFJet400_v5','HLT_PFJet450_v5','HLT_PFJet500_v5', - 'HLT_PFJet40_v4','HLT_PFJet60_v4', 'HLT_PFJet80_v4', 'HLT_PFJet140_v4','HLT_PFJet200_v4','HLT_PFJet260_v4','HLT_PFJet320_v4','HLT_PFJet400_v4','HLT_PFJet450_v4','HLT_PFJet500_v4', - 'HLT_PFHT125_v2','HLT_PFHT200_v2','HLT_PFHT250_v2','HLT_PFHT300_v2','HLT_PFHT350_v2','HLT_PFHT400_v2','HLT_PFHT475_v2','HLT_PFHT600_v2','HLT_PFHT650_v2','HLT_PFHT800_v2','HLT_PFHT900_v2', - 'HLT_PFHT125_v3','HLT_PFHT200_v3','HLT_PFHT250_v3','HLT_PFHT300_v3','HLT_PFHT350_v3','HLT_PFHT400_v3','HLT_PFHT475_v3','HLT_PFHT600_v3','HLT_PFHT650_v3','HLT_PFHT800_v3','HLT_PFHT900_v3', - 'HLT_PFHT125_v4','HLT_PFHT200_v4','HLT_PFHT250_v4','HLT_PFHT300_v4','HLT_PFHT350_v4','HLT_PFHT400_v4','HLT_PFHT475_v4','HLT_PFHT600_v4','HLT_PFHT650_v4','HLT_PFHT800_v4','HLT_PFHT900_v4', - 'HLT_PFHT125_v5','HLT_PFHT200_v5','HLT_PFHT250_v5','HLT_PFHT300_v5','HLT_PFHT350_v5','HLT_PFHT400_v5','HLT_PFHT475_v5','HLT_PFHT600_v5','HLT_PFHT650_v5','HLT_PFHT800_v5','HLT_PFHT900_v5', - 'HLT_PFHT125_v1','HLT_PFHT200_v1','HLT_PFHT250_v1','HLT_PFHT300_v1','HLT_PFHT350_v1','HLT_PFHT400_v1','HLT_PFHT475_v1','HLT_PFHT600_v1','HLT_PFHT650_v1','HLT_PFHT800_v1','HLT_PFHT900_v1', - 'HLT_AK8PFJet40_v1','HLT_AK8PFJet60_v1','HLT_AK8PFJet80_v1','HLT_AK8PFJet140_v1','HLT_AK8PFJet200_v1','HLT_AK8PFJet260_v1','HLT_AK8PFJet320_v1','HLT_AK8PFJet400_v1','HLT_AK8PFJet450_v1','HLT_AK8PFJet500_v1', - 'HLT_AK8PFJet40_v2','HLT_AK8PFJet60_v2','HLT_AK8PFJet80_v2','HLT_AK8PFJet140_v2','HLT_AK8PFJet200_v2','HLT_AK8PFJet260_v2','HLT_AK8PFJet320_v2','HLT_AK8PFJet400_v2','HLT_AK8PFJet450_v2','HLT_AK8PFJet500_v2', - 'HLT_AK8PFJet40_v3','HLT_AK8PFJet60_v3','HLT_AK8PFJet80_v3','HLT_AK8PFJet140_v3','HLT_AK8PFJet200_v3','HLT_AK8PFJet260_v3','HLT_AK8PFJet320_v3','HLT_AK8PFJet400_v3','HLT_AK8PFJet450_v3','HLT_AK8PFJet500_v3', - 'HLT_AK8PFJet40_v4','HLT_AK8PFJet60_v4','HLT_AK8PFJet80_v4','HLT_AK8PFJet140_v4','HLT_AK8PFJet200_v4','HLT_AK8PFJet260_v4','HLT_AK8PFJet320_v4','HLT_AK8PFJet400_v4','HLT_AK8PFJet450_v4','HLT_AK8PFJet500_v4', - 'HLT_AK8PFJet40_v5','HLT_AK8PFJet60_v5','HLT_AK8PFJet80_v5','HLT_AK8PFJet140_v5','HLT_AK8PFJet200_v5','HLT_AK8PFJet260_v5','HLT_AK8PFJet320_v5','HLT_AK8PFJet400_v5','HLT_AK8PFJet450_v5','HLT_AK8PFJet500_v5'), - triggerResults = cms.InputTag("TriggerResults","","HLT"), - triggerEvent = cms.InputTag("hltTriggerSummaryAOD","","HLT"), - ## jec services ############################## - #new tokens - EventInfo = cms.InputTag("generator"), - GenParticles = cms.InputTag("genparticles"), - HBHENoiseFilterResultLabel = cms.InputTag("HBHENoiseFilterResultProducer", "HBHENoiseFilterResult"), - HBHENoiseFilterResultNoMinZLabel = cms.InputTag("HBHENoiseFilterResultProducerNoMinZ", "HBHENoiseFilterResult"), - jetFlavourInfos = cms.InputTag("genJetFlavourInfos"), - #pfjecService = cms.string('ak7PFL1FastL2L3Residual'), -) - -#jetToolbox( process, 'ak8', 'ak8JetSubs','CHS') - -#process.ak8 = process.ak4.clone( -# pfjetschs = cms.InputTag('selectedPatJetsAK8PFCHS'), -# pfpujetid = cms.string('AK8PFpileupJetIdEvaluator:fullDiscriminant'), -# pfchsjetpuid = cms.string('AK8PFCHSpileupJetIdEvaluator:fullDiscriminant'), -# PFPayloadNameCHS= cms.string('AK8PFchs'), -# AK4 = cms.untracked.bool(False), -#) - -jetToolbox( process, 'ak7', 'ak7JetSubs','CHS') - -process.ak7 = process.ak4.clone( - pfjetschs = cms.InputTag('selectedPatJetsAK7PFCHS'), - pfpujetid = cms.string('AK7PFpileupJetIdEvaluator:fullDiscriminant'), - pfchsjetpuid = cms.string('AK7PFCHSpileupJetIdEvaluator:fullDiscriminant'), - PFPayloadNameCHS= cms.string('AK7PFchs'), - AK4 = cms.untracked.bool(False), -) - -#jetToolbox( process, 'ak2', 'ak2JetSubs','CHS') - -#process.ak2 = process.ak4.clone( -# pfjetschs = cms.InputTag('selectedPatJetsAK4PFCHS'), -# pfpujetid = cms.string('AK4PFpileupJetIdEvaluator:fullDiscriminant'), -# pfchsjetpuid = cms.string('AK4PFCHSpileupJetIdEvaluator:fullDiscriminant'), -# PFPayloadNameCHS= cms.string('AK4PFchs'), -# AK4 = cms.untracked.bool(False), -#) - -############# hlt filter ######################### -process.hltFilter = cms.EDFilter('HLTHighLevel', - TriggerResultsTag = cms.InputTag('TriggerResults','','HLT'), - HLTPaths = cms.vstring( - 'HLT_PFJet40_v9','HLT_PFJet60_v9','HLT_PFJet80_v9','HLT_PFJet140_v9','HLT_PFJet200_v9','HLT_PFJet260_v9','HLT_PFJet320_v9','HLT_PFJet400_v9','HLT_PFJet450_v9','HLT_PFJet500_v9', - 'HLT_PFJet40_v8','HLT_PFJet60_v8','HLT_PFJet80_v8','HLT_PFJet140_v8','HLT_PFJet200_v8','HLT_PFJet260_v8','HLT_PFJet320_v8','HLT_PFJet400_v8','HLT_PFJet450_v8','HLT_PFJet500_v8', - 'HLT_PFJet40_v7','HLT_PFJet60_v7','HLT_PFJet80_v7','HLT_PFJet140_v7','HLT_PFJet200_v7','HLT_PFJet260_v7','HLT_PFJet320_v7','HLT_PFJet400_v7','HLT_PFJet450_v7','HLT_PFJet500_v7', - 'HLT_PFJet40_v6','HLT_PFJet60_v6','HLT_PFJet80_v6','HLT_PFJet140_v6','HLT_PFJet200_v6','HLT_PFJet260_v6','HLT_PFJet320_v6','HLT_PFJet400_v6','HLT_PFJet450_v6','HLT_PFJet500_v6', - 'HLT_PFJet40_v5','HLT_PFJet60_v5','HLT_PFJet80_v5','HLT_PFJet140_v5','HLT_PFJet200_v5','HLT_PFJet260_v5','HLT_PFJet320_v5','HLT_PFJet400_v5','HLT_PFJet450_v5','HLT_PFJet500_v5', - 'HLT_PFJet40_v4','HLT_PFJet60_v4', 'HLT_PFJet80_v4', 'HLT_PFJet140_v4','HLT_PFJet200_v4','HLT_PFJet260_v4','HLT_PFJet320_v4','HLT_PFJet400_v4','HLT_PFJet450_v4','HLT_PFJet500_v4', - 'HLT_PFHT125_v2','HLT_PFHT200_v2','HLT_PFHT250_v2','HLT_PFHT300_v2','HLT_PFHT350_v2','HLT_PFHT400_v2','HLT_PFHT475_v2','HLT_PFHT600_v2','HLT_PFHT650_v2','HLT_PFHT800_v2','HLT_PFHT900_v2', - 'HLT_PFHT125_v3','HLT_PFHT200_v3','HLT_PFHT250_v3','HLT_PFHT300_v3','HLT_PFHT350_v3','HLT_PFHT400_v3','HLT_PFHT475_v3','HLT_PFHT600_v3','HLT_PFHT650_v3','HLT_PFHT800_v3','HLT_PFHT900_v3', - 'HLT_PFHT125_v4','HLT_PFHT200_v4','HLT_PFHT250_v4','HLT_PFHT300_v4','HLT_PFHT350_v4','HLT_PFHT400_v4','HLT_PFHT475_v4','HLT_PFHT600_v4','HLT_PFHT650_v4','HLT_PFHT800_v4','HLT_PFHT900_v4', - 'HLT_PFHT125_v5','HLT_PFHT200_v5','HLT_PFHT250_v5','HLT_PFHT300_v5','HLT_PFHT350_v5','HLT_PFHT400_v5','HLT_PFHT475_v5','HLT_PFHT600_v5','HLT_PFHT650_v5','HLT_PFHT800_v5','HLT_PFHT900_v5', - 'HLT_PFHT125_v1','HLT_PFHT200_v1','HLT_PFHT250_v1','HLT_PFHT300_v1','HLT_PFHT350_v1','HLT_PFHT400_v1','HLT_PFHT475_v1','HLT_PFHT600_v1','HLT_PFHT650_v1','HLT_PFHT800_v1','HLT_PFHT900_v1', - 'HLT_AK8PFJet40_v1','HLT_AK8PFJet60_v1','HLT_AK8PFJet80_v1','HLT_AK8PFJet140_v1','HLT_AK8PFJet200_v1','HLT_AK8PFJet260_v1','HLT_AK8PFJet320_v1','HLT_AK8PFJet400_v1','HLT_AK8PFJet450_v1','HLT_AK8PFJet500_v1', - 'HLT_AK8PFJet40_v2','HLT_AK8PFJet60_v2','HLT_AK8PFJet80_v2','HLT_AK8PFJet140_v2','HLT_AK8PFJet200_v2','HLT_AK8PFJet260_v2','HLT_AK8PFJet320_v2','HLT_AK8PFJet400_v2','HLT_AK8PFJet450_v2','HLT_AK8PFJet500_v2', - 'HLT_AK8PFJet40_v3','HLT_AK8PFJet60_v3','HLT_AK8PFJet80_v3','HLT_AK8PFJet140_v3','HLT_AK8PFJet200_v3','HLT_AK8PFJet260_v3','HLT_AK8PFJet320_v3','HLT_AK8PFJet400_v3','HLT_AK8PFJet450_v3','HLT_AK8PFJet500_v3', - 'HLT_AK8PFJet40_v4','HLT_AK8PFJet60_v4','HLT_AK8PFJet80_v4','HLT_AK8PFJet140_v4','HLT_AK8PFJet200_v4','HLT_AK8PFJet260_v4','HLT_AK8PFJet320_v4','HLT_AK8PFJet400_v4','HLT_AK8PFJet450_v4','HLT_AK8PFJet500_v4', - 'HLT_AK8PFJet40_v5','HLT_AK8PFJet60_v5','HLT_AK8PFJet80_v5','HLT_AK8PFJet140_v5','HLT_AK8PFJet200_v5','HLT_AK8PFJet260_v5','HLT_AK8PFJet320_v5','HLT_AK8PFJet400_v5','HLT_AK8PFJet450_v5','HLT_AK8PFJet500_v5'), - eventSetupPathsKey = cms.string(''), - andOr = cms.bool(True), #----- True = OR, False = AND between the HLTPaths - throw = cms.bool(False) -) - -##MET Filters -process.load('RecoMET.METFilters.CSCTightHaloFilter_cfi') -process.load('CommonTools.RecoAlgos.HBHENoiseFilterResultProducer_cfi') -process.load('CommonTools.RecoAlgos.HBHENoiseFilter_cfi') - -process.HBHENoiseFilterResultProducerNoMinZ = process.HBHENoiseFilterResultProducer.clone(minZeros = cms.int32(99999)) - -process.goodVertices = cms.EDFilter("VertexSelector", - filter = cms.bool(False), - src = cms.InputTag("offlinePrimaryVertices"), - cut = cms.string("!isFake && ndof >= 4 && abs(z) <= 24 && position.rho <= 2"), -) - -process.load('RecoMET.METFilters.trackingFailureFilter_cfi') -process.load('RecoMET.METFilters.EcalDeadCellTriggerPrimitiveFilter_cfi') -process.load('RecoMET.METFilters.eeBadScFilter_cfi') -process.load('RecoMET.METFilters.BadChargedCandidateFilter_cfi') -process.load('RecoMET.METFilters.BadPFMuonFilter_cfi') -process.load('RecoMET.METFilters.globalTightHalo2016Filter_cfi') - -process.allMetFilterPaths=cms.Sequence(process.HBHENoiseFilter*process.HBHENoiseIsoFilter*process.EcalDeadCellTriggerPrimitiveFilter*process.eeBadScFilter*process.BadPFMuonFilter*process.BadChargedCandidateFilter*process.globalTightHalo2016Filter) - -##Type1 patMET Producer -process.load('PhysicsTools.PatAlgos.recoLayer0.metCorrections_cff') -process.load('PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi') -process.patMETs.addGenMET = cms.bool(False) -#process.patMETs.metSource = cms.InputTag("pfChMet") - -#Try scheduled processs -process.path = cms.Path(process.goodVertices*process.trackingFailureFilter* - process.hltFilter* - process.HBHENoiseFilterResultProducer* - process.HBHENoiseFilterResultProducerNoMinZ*process.allMetFilterPaths* - process.patMETCorrections*process.patMETs - *process.QGTagger*process.ak4*process.ak7) - - -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! Output and Log -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) -process.options.allowUnscheduled = cms.untracked.bool(True) diff --git a/README.md b/README.md index f8d0eda1685..dbfad489cf9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ -# SMPJ +SMPJ ntuplizer, legacy version. +Forked from https://github.com/cms-smpj/SMPJ/ +Support will be dropped, when most of the analyses have moved to NANOAOD. + +The AOD version has been preserved in a secondary branch. +The MINIAOD branch was placed at master in October 2020. Twiki page: https://twiki.cern.ch/twiki/bin/viewauth/CMS/SMPJAnalysisFW