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))
58 nEvt = i.
book1D(
"nEvt",
"n analyzed Events", 1, 0., 1.);
61 nNoFwdTrig = i.
book1D(
"nNoFwdTrig",
"n Events no forward trigger", 1, 0., 1.);
64 nSaFwdTrig = i.
book1D(
"nSaFwdTrig",
"n Events single arm forward trigger", 1, 0., 1.);
67 nbquark = i.
book1D(
"nbquark",
"n Events with b quark", 1, 0., 1.);
73 ncnobquark = i.
book1D(
"ncnobquark",
"n Events with c and no b quark", 1, 0., 1.);
77 nEvt1 = i.
book1D(
"nEvt1",
"n Events QCD-09-010", 1, 0., 1.);
81 dNchdeta1 = i.
book1D(
"dNchdeta1",
"dNchdeta QCD-09-010", 10, -2.5, 2.5);
84 nEvt2 = i.
book1D(
"nEvt2",
"n Events QCD-10-001", 1, 0., 1.);
86 leadTrackpt = i.
book1D(
"leadTrackpt",
"leading track pt QCD-10-001", 200, 0., 100.);
88 leadTracketa = i.
book1D(
"leadTracketa",
"leading track eta QCD-10-001", 50., -2.5,2.5);
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.,
" ");
94 dNchdpt2 = i.
book1D(
"dNchdpt2",
"dNchdpt QCD-10-001", 200, 0., 100.);
96 dNchdeta2 = i.
book1D(
"dNchdeta2",
"dNchdeta QCD-10-001", 50, -2.5, 2.5);
98 nCha = i.
book1D(
"nCha",
"n charged QCD-10-001", 100, 0., 100.);
100 dNchdSpt = i.
book1D(
"dNchdSpt",
"dNchdSpt QCD-10-001", 300, 0., 300.);
107 nChj = i.
book1D(
"nChj",
"n charged jets QCD-10-001", 30, 0, 30.);
109 dNchjdeta = i.
book1D(
"dNchjdeta",
"dNchjdeta QCD-10-001", 50, -2.5, 2.5);
111 dNchjdpt = i.
book1D(
"dNchjdpt",
"dNchjdpt QCD-10-001", 100, 0., 100.);
113 leadChjpt = i.
book1D(
"leadChjpt",
"leadChjpt QCD-10-001", 100, 0., 100.);
115 leadChjeta = i.
book1D(
"leadChjeta",
"leadChjeta QCD-10-001", 50, -2.5, 2.5);
120 nPPbar = i.
book1D(
"nPPbar",
"nPPbar QCD-10-001", 30, 0., 30.);
121 nKpm = i.
book1D(
"nKpm",
"nKpm QCD-10-001", 30, 0., 30.);
122 nK0s = i.
book1D(
"nK0s",
"nK0s QCD-10-001", 30, 0., 30.);
123 nL0 = i.
book1D(
"nL0",
"nL0 QCD-10-001", 30, 0., 30.);
124 nXim = i.
book1D(
"nXim",
"nXim QCD-10-001", 30, 0., 30.);
125 nOmega = i.
book1D(
"nOmega",
"nOmega QCD-10-001", 30, 0., 30.);
127 pPPbar = i.
book1D(
"pPPbar",
"Log10(pt) PPbar QCD-10-001", 25, -2., 3.);
128 pKpm = i.
book1D(
"pKpm",
"Log10(pt) Kpm QCD-10-001", 25, -2., 3.);
129 pK0s = i.
book1D(
"pK0s",
"Log10(pt) K0s QCD-10-001", 25, -2., 3.);
130 pL0 = i.
book1D(
"pL0",
"Log10(pt) L0 QCD-10-001", 25, -2., 3.);
131 pXim = i.
book1D(
"pXim",
"Log10(pt) Xim QCD-10-001", 25, -2., 3.);
132 pOmega = i.
book1D(
"pOmega",
"Log10(pt) Omega QCD-10-001", 25, -2., 3.);
135 nNNbar = i.
book1D(
"nNNbar",
"nNNbar QCD-10-001", 30, 0., 30.);
136 nGamma = i.
book1D(
"nGamma",
"nGamma QCD-10-001", 50, 0., 200.);
138 pNNbar = i.
book1D(
"pNNbar",
"Log10(pt) NNbar QCD-10-001", 25, -2., 3.);
139 pGamma = i.
book1D(
"pGamma",
"Log10(pt) Gamma QCD-10-001", 25, -2., 3.);
142 elePt = i.
book1D(
"elePt",
"highest pt electron Log10(pt)", 30, -2., 4.);
145 muoPt = i.
book1D(
"muoPt",
"highest pt muon Log10(pt)", 30, -2., 4.);
149 nDijet = i.
book1D(
"nDijet",
"n Dijet Events", 1, 0., 1.);
151 nj = i.
book1D(
"nj",
"n jets ", 30, 0, 30.);
163 pt1pt2InvM = i.
book1D(
"pt1pt2InvM",
"pt1 pt2 invariant mass ", 60, 0., 600.);
165 pt3Frac = i.
book1D(
"pt3Frac",
"2 pt3 over pt1+pt2 ", 30, 0., 1.);
167 sumJEt = i.
book1D(
"sumJEt",
"sum Jet Et ", 60, 0., 300.);
171 sumPt = i.
book1D(
"sumPt",
"sum particle Pt ", 60, 0., 600.);
173 sumChPt = i.
book1D(
"sumChPt",
"sum charged particle Pt ", 60, 0., 300.);
176 nHFflow = i.
book1D(
"nHFflow",
"n HF flow events", 1, 0., 1.);
180 dEdetaHFdj = i.
bookProfile(
"dEdetaHFdj",
"dEdeta HF QCD dijet", (
int)CaloCellManager::nForwardEta, 0, (
double)CaloCellManager::nForwardEta, 0., 300.,
" ");
183 nHFSD = i.
book1D(
"nHFSD",
"n single diffraction in HF", 1, 0., 1.);
187 ntHFm = i.
book1D(
"ntHFm",
"number of HF- tower SD", 20, 0., 20.);
208 djr10 = i.
book1D(
"djr10",
"Differential Jet Rate 1#rightarrow0", 60, -1., 5.);
209 djr21 = i.
book1D(
"djr21",
"Differential Jet Rate 2#rightarrow1", 60, -1., 5.);
210 djr32 = i.
book1D(
"djr32",
"Differential Jet Rate 3#rightarrow2", 60, -1., 5.);
211 djr43 = i.
book1D(
"djr43",
"Differential Jet Rate 4#rightarrow3", 60, -1., 5.);
214 _sumEt = i.
book1D(
"sumET",
"Sum of stable particles Et", 150, 0, 600.);
215 _sumEt1 = i.
book1D(
"sumET1",
"Sum of stable particles Et (eta<0.5)", 150, 0, 200.);
216 _sumEt2 = i.
book1D(
"sumET2",
"Sum of stable particles Et (0.5<eta<1.0)", 150, 0, 200.);
217 _sumEt3 = i.
book1D(
"sumET3",
"Sum of stable particles Et (1.0<eta<1.5)", 150, 0, 200.);
218 _sumEt4 = i.
book1D(
"sumET4",
"Sum of stable particles Et (1.5<eta<2.0)", 150, 0, 200.);
219 _sumEt5 = i.
book1D(
"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();
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.
MonitorElement * book1D(Args &&...args)
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 * 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