10 #include "CLHEP/Units/defs.h"
11 #include "CLHEP/Units/PhysicalConstants.h"
12 #include "CLHEP/Units/SystemOfUnits.h"
14 #include "fastjet/JetDefinition.hh"
15 #include "fastjet/ClusterSequence.hh"
20 wmanager_(iPSet,consumesCollector()),
21 hepmcCollection_(iPSet.getParameter<edm::
InputTag>(
"hepmcCollection")),
22 genchjetCollection_(iPSet.getParameter<edm::
InputTag>(
"genChjetsCollection")),
23 genjetCollection_(iPSet.getParameter<edm::
InputTag>(
"genjetsCollection")),
24 verbosity_(iPSet.getUntrackedParameter<unsigned int>(
"verbosity",0))
90 nChaDenLpt = i.
bookProfile(
"nChaDenLpt",
"charged density vs leading pt", 200, 0., 100., 0., 100.,
" ");
92 sptDenLpt = i.
bookProfile(
"sptDenLpt",
"sum pt density vs leading pt", 200, 0., 100., 0., 300.,
" ");
107 nChj = dqm.
book1dHisto(
"nChj",
"n charged jets QCD-10-001", 30, 0, 30.);
128 pKpm = dqm.
book1dHisto(
"pKpm",
"Log10(pt) Kpm QCD-10-001", 25, -2., 3.);
129 pK0s = dqm.
book1dHisto(
"pK0s",
"Log10(pt) K0s QCD-10-001", 25, -2., 3.);
130 pL0 = dqm.
book1dHisto(
"pL0",
"Log10(pt) L0 QCD-10-001", 25, -2., 3.);
131 pXim = dqm.
book1dHisto(
"pXim",
"Log10(pt) Xim QCD-10-001", 25, -2., 3.);
142 elePt = dqm.
book1dHisto(
"elePt",
"highest pt electron Log10(pt)", 30, -2., 4.);
180 dEdetaHFdj = i.
bookProfile(
"dEdetaHFdj",
"dEdeta HF QCD dijet", (
int)CaloCellManager::nForwardEta, 0, (
double)CaloCellManager::nForwardEta, 0., 300.,
" ");
208 djr10 = dqm.
book1dHisto(
"djr10",
"Differential Jet Rate 1#rightarrow0", 60, -1., 5.);
209 djr21 = dqm.
book1dHisto(
"djr21",
"Differential Jet Rate 2#rightarrow1", 60, -1., 5.);
210 djr32 = dqm.
book1dHisto(
"djr32",
"Differential Jet Rate 3#rightarrow2", 60, -1., 5.);
211 djr43 = dqm.
book1dHisto(
"djr43",
"Differential Jet Rate 4#rightarrow3", 60, -1., 5.);
215 _sumEt1 = dqm.
book1dHisto(
"sumET1",
"Sum of stable particles Et (eta<0.5)", 150, 0, 200.);
216 _sumEt2 = dqm.
book1dHisto(
"sumET2",
"Sum of stable particles Et (0.5<eta<1.0)", 150, 0, 200.);
217 _sumEt3 = dqm.
book1dHisto(
"sumET3",
"Sum of stable particles Et (1.0<eta<1.5)", 150, 0, 200.);
218 _sumEt4 = dqm.
book1dHisto(
"sumET4",
"Sum of stable particles Et (1.5<eta<2.0)", 150, 0, 200.);
219 _sumEt5 = dqm.
book1dHisto(
"sumET5",
"Sum of stable particles Et (2.0<eta<5.0)", 150, 0, 200.);
233 HepMC::GenEvent *myGenEvent =
new HepMC::GenEvent(*(evt->GetEvent()));
238 if (
verbosity_ > 0 ) { myGenEvent->print(); }
252 for (HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin(); iter != myGenEvent->particles_end(); ++iter){
253 if ( std::fabs((*iter)->pdg_id()) == 4 ) { nc++; }
254 if ( std::fabs((*iter)->pdg_id()) == 5 ) { nb++; }
255 if ( (*iter)->status() == 1) {
258 if(PData==0) { charge = -999.; }
260 charge = PData->charge();
265 std::cout <<
"HepMC " << std::setw(14) << std::fixed << (*iter)->barcode()
266 << std::setw(14) << std::fixed << (*iter)->pdg_id()
267 << std::setw(14) << std::fixed << (*iter)->momentum().perp()
268 << std::setw(14) << std::fixed << (*iter)->momentum().eta()
269 << std::setw(14) << std::fixed << (*iter)->momentum().phi() << std::endl;
275 int nBSCp = 0;
int nBSCm = 0;
double eneHFp = 0.;
double eneHFm = 0.;
int nChapt05 = 0;
int nChaVtx = 0;
302 if ( (nBSCp > 0 || nBSCm > 0) && eneHFp >= 3. && eneHFm >= 3. ) { sel1 =
true; }
306 if ( (nBSCp >0 || nBSCm > 0) && nChaVtx >= 3 && nChapt05 > 1 ) { sel2 =
true; }
310 if ( nBSCp == 0 && nBSCm == 0 ) { sel3 =
true; }
314 if ( ( nBSCp>0 && nBSCm == 0 ) || ( nBSCm>0 && nBSCp == 0 ) ) { sel4 =
true; }
318 if ( nBSCp > 0 && nBSCm > 0 ) { sel5 =
true; }
322 if ( sel5 && nChaVtx > 3 ) { sel6 =
true; }
326 if ( nChaVtx >= 3 && nBSCm > 0 && eneHFp < 8. ) { sel7 =
true; }
342 unsigned int iMax = 0;
344 unsigned int ppbar = 0;
unsigned int nnbar = 0;
unsigned int kpm = 0;
unsigned int k0s = 0;
unsigned int l0 = 0;
unsigned int gamma = 0;
345 unsigned int xim = 0;
unsigned int omega = 0;
346 unsigned int ele = 0;
unsigned int muo = 0;
347 unsigned int eleMax = 0;
348 unsigned int muoMax = 0;
367 if ( pt > ptMax ) { ptMax =
pt; iMax =
i; }
397 else if ( sel2 &&
isNeutral(
i) && std::fabs(eta) < 2.5 ) {
404 pL0->
Fill(std::log10(pt),weight);
407 else if ( sel2 &&
isNeutral(
i) && std::fabs(eta) < 5.19 ) {
449 unsigned int nCellOvTh = 0;
452 for (
unsigned int icell = 0; icell <
eneInCell.size(); icell++ ) {
455 else { threshold = 4.; }
472 std::vector<unsigned int> nchvsphi (
nphiBin,0);
473 std::vector<double> sptvsphi (
nphiBin,0.);
474 unsigned int nChaTra = 0;
482 if ( thePhi < -180. ) { thePhi += 360.; }
483 else if ( thePhi > 180. ) { thePhi -= 360.; }
484 unsigned int thePhiBin = (int)((thePhi+180.)/binPhiW);
485 if ( thePhiBin ==
nphiBin ) { thePhiBin -= 1; }
486 nchvsphi[thePhiBin]++;
489 if ( std::fabs(thePhi) > 60. && std::fabs(thePhi) < 120. ) {
505 for (
unsigned int i = 0;
i <
nphiBin;
i++ ) {
506 double thisPhi = -180.+(
i+0.5)*binPhiW;
516 unsigned int nJets = 0;
519 reco::GenJetCollection::const_iterator ij1 = genChJets->begin();
520 reco::GenJetCollection::const_iterator ij2 = genChJets->begin();
522 for (reco::GenJetCollection::const_iterator iter=genChJets->begin();iter!=genChJets->end();++iter){
523 double eta = (*iter).eta();
524 double pt = (*iter).pt();
526 std::cout <<
"GenJet " << std::setw(14) << std::fixed << (*iter).pt()
527 << std::setw(14) << std::fixed << (*iter).eta()
528 << std::setw(14) << std::fixed << (*iter).phi() << std::endl;
530 if ( std::fabs(eta) < 2. ) {
536 if ( pt >= pt1 ) { pt1 =
pt; ij1 = iter; }
537 if ( pt < pt1 && pt >= pt2 ) { pt2 =
pt; ij2 = iter; }
542 if ( nJets > 0 && ij1 != genChJets->end() ) {
545 if ( nJets > 1 && ij2 != genChJets->end() ) {
579 reco::GenJetCollection::const_iterator ij3 = genJets->begin();
581 for (reco::GenJetCollection::const_iterator iter=genJets->begin();iter!=genJets->end();++iter){
582 double eta = (*iter).eta();
583 double pt = (*iter).pt();
585 std::cout <<
"GenJet " << std::setw(14) << std::fixed << (*iter).pt()
586 << std::setw(14) << std::fixed << (*iter).eta()
587 << std::setw(14) << std::fixed << (*iter).phi() << std::endl;
589 if ( std::fabs(eta) < 5. ) {
591 if ( pt >= pt1 ) { pt1 =
pt; ij1 = iter; }
592 if ( pt < pt1 && pt >= pt2 ) { pt2 =
pt; ij2 = iter; }
593 if ( pt < pt2 && pt >= pt3 ) { pt3 =
pt; ij3 = iter; }
597 if(fabs(iter->eta()) < 3. && iter->pt()>25.) {
599 jm25HT += iter->pt();
600 if(iter->pt()>jm25pt1) {
604 jm25pt1 = iter->pt();
605 }
else if(iter->pt()>jm25pt2) {
608 jm25pt2 = iter->pt();
609 }
else if(iter->pt()>jm25pt3) {
611 jm25pt3 = iter->pt();
612 }
else if(iter->pt()>jm25pt4) {
613 jm25pt4 = iter->pt();
618 jm80HT += iter->pt();
619 if(iter->pt()>jm80pt1) {
623 jm80pt1 = iter->pt();
624 }
else if(iter->pt()>jm80pt2) {
627 jm80pt2 = iter->pt();
628 }
else if(iter->pt()>jm80pt3) {
630 jm80pt3 = iter->pt();
631 }
else if(iter->pt()>jm80pt4) {
632 jm80pt4 = iter->pt();
657 double sumJetEt = 0;
double sumPartPt = 0.;
double sumChPartPt = 0.;
658 double jpx = 0;
double jpy = 0;
659 if ( nJets >= 2 && ij1 != genJets->end() && ij2 != genJets->end() ) {
660 if ( (*ij1).pt() > 25. && (*ij1).pt() > 25. ) {
661 double deltaPhi = std::fabs((*ij1).phi()-(*ij2).phi())/CLHEP::degree;
662 if ( deltaPhi > 180. ) deltaPhi = 360.-
deltaPhi;
664 if ( std::fabs(deltaPhi) > 2.5*CLHEP::degree ) {
671 if ( !
isNeutrino(
i) && iBin < CaloCellManager::nForwardEta ) {
686 double invMass = (*ij1).energy()*(*ij2).energy()-(*ij1).px()*(*ij2).px()-(*ij1).py()*(*ij2).py()-(*ij1).pz()*(*ij2).pz();
693 unsigned int nSelJets = 0;
694 for (reco::GenJetCollection::const_iterator iter=genJets->begin();iter!=genJets->end();++iter){
695 double pt = (*iter).pt();
696 double eta = (*iter).eta();
697 if ( std::fabs(eta) < 5. ) {
703 sumJetEt += (*iter).pt();
709 nj->
Fill(nSelJets,weight);
714 if ( nSelJets >= 3 ) {
pt3Frac->
Fill((*ij3).pt()/(pt1+pt2),weight); }
725 std::vector<const HepMC::GenParticle*> qcdActivity;
729 std::vector<fastjet::PseudoJet> vecs;
731 std::vector<const HepMC::GenParticle*>::const_iterator iqcdact;
732 for (iqcdact = qcdActivity.begin(); iqcdact != qcdActivity.end(); ++iqcdact){
733 const HepMC::FourVector& fmom = (*iqcdact)->momentum();
734 fastjet::PseudoJet pseudoJet(fmom.px(), fmom.py(), fmom.pz(), fmom.e());
735 pseudoJet.set_user_index(counterUser);
736 vecs.push_back(pseudoJet);
740 fastjet::ClusterSequence cseq(vecs, fastjet::JetDefinition(fastjet::kt_algorithm, 1., fastjet::E_scheme));
749 std::vector<const HepMC::GenParticle*> allStable;
759 for(std::vector<const HepMC::GenParticle*>::const_iterator iter=allStable.begin();
760 iter != allStable.end(); ++iter) {
762 double thisEta=fabs((*iter)->momentum().eta());
765 const HepMC::FourVector mom=(*iter)->momentum();
771 sqrt(px*px + py*py)*E /
772 sqrt(px*px + py*py + pz*pz)
775 if(thisEta<1.0) sumEt1 += thisSumEt;
776 else if(thisEta<2.0) sumEt2 += thisSumEt;
777 else if(thisEta<3.0) sumEt3 += thisSumEt;
778 else if(thisEta<4.0) sumEt4 += thisSumEt;
779 else sumEt5 += thisSumEt;
814 else { status = (
hepmcCharge[
i] == 0. && pdgId != 12 && pdgId != 14 && pdgId != 16) ; }
824 else { status = (pdgId == 12 || pdgId == 14 || pdgId == 16) ; }
831 unsigned int iBin = 999;
837 if ( std::fabs(eta) >= theEtaRanges[
i] && std::fabs(eta) < theEtaRanges[
i+1] )
bool isCharged(unsigned int i)
MonitorElement * ncnobquark
MonitorElement * _JM25pt3
MonitorElement * _JM80pt1
static const unsigned int nphiBin
std::vector< const HepMC::GenParticle * > hepmcGPCollection
status 1 GenParticle collection
MonitorElement * sptDenLpt
MonitorElement * leadTracketa
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static const unsigned int nForwardEta
MonitorElement * leadTrackpt
MBUEandQCDValidation(const edm::ParameterSet &)
static const unsigned int nBarrelCell
MonitorElement * dSptdphi
MonitorElement * dNchdpt1
MonitorElement * dNchdSpt
MonitorElement * _JM25pt1
MonitorElement * _JM80njets
void allStatus1(const HepMC::GenEvent *all, std::vector< const HepMC::GenParticle * > &status1)
MonitorElement * dNchjdeta
CaloCellManager * theCalo
manager of calorimetric cell structure
MonitorElement * dNchdeta1
static const unsigned int nEndcapEta
edm::InputTag genjetCollection_
MonitorElement * pt1pt2Dphi
MonitorElement * dNchdeta2
void getData(T &iHolder) const
MonitorElement * _JM25njets
std::vector< double > hepmcCharge
bool isNeutrino(unsigned int i)
MonitorElement * pt1pt2InvM
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
std::vector< double > getEtaRanges()
CaloCellId * getCellFromIndex(unsigned int id)
void removeIsolatedLeptons(const HepMC::GenEvent *all, double deltaR, double sumPt, std::vector< const HepMC::GenParticle * > &pruned)
MonitorElement * eneHFmSel
MonitorElement * nSaFwdTrig
MonitorElement * pt1pt2optot
MonitorElement * pt1pt2optotch
static const unsigned int nCaloCell
MonitorElement * leadChjpt
MonitorElement * dNchjdpt
MonitorElement * _JM25pt2
virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Cos< T >::type cos(const T &t)
MonitorElement * dNchdpt2
MonitorElement * nEvt1
QCD-09-010 analysis.
Abs< T >::type abs(const T &t)
MonitorElement * dNchdphi
virtual void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
MonitorElement * dEdetaHFdj
std::vector< double > eneInCell
static const unsigned int nEndcapCell
MonitorElement * pt1pt2balance
edm::InputTag hepmcCollection_
HepPDT::ParticleData ParticleData
static const unsigned int nBarrelEta
edm::InputTag genchjetCollection_
MonitorElement * leadChjeta
edm::EDGetTokenT< reco::GenJetCollection > genchjetCollectionToken_
MonitorElement * _JM80pt2
MonitorElement * nNoFwdTrig
edm::EDGetTokenT< reco::GenJetCollection > genjetCollectionToken_
MonitorElement * _JM80pt3
void setCurrentFolder(const std::string &fullpath)
MonitorElement * _JM25pt4
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
MonitorElement * book1dHisto(const std::string &name, const std::string &title, int n, double xmin, double xmax)
MonitorElement * ncandbquark
unsigned int getHFbin(double eta)
MonitorElement * _JM80pt4
bool isNeutral(unsigned int i)
T perp() const
Magnitude of transverse component.
MonitorElement * dEdetaHFmb
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * nChaDenLpt
unsigned int getCellIndexFromAngle(double eta, double phi)
double weight(const edm::Event &)
static const unsigned int initSize
virtual ~MBUEandQCDValidation()
MonitorElement * missEtosumJEt