35 #include "HepMC/WeightContainer.h" 36 #include "HepMC/GenEvent.h" 54 nbinsMass_(pset.getUntrackedParameter<unsigned
int>(
"nbinsMass")),
55 nbinsPt_(pset.getUntrackedParameter<unsigned
int>(
"nbinsPt")),
56 nbinsAng_(pset.getUntrackedParameter<unsigned
int>(
"nbinsAng")),
58 massMax_(pset.getUntrackedParameter<double>(
"massMax")),
59 ptMax_(pset.getUntrackedParameter<double>(
"ptMax")),
60 angMax_(pset.getUntrackedParameter<double>(
"angMax")),
61 massResMax_(pset.getUntrackedParameter<double>(
"massResMax")),
63 cout <<
">>> Z Histogrammer constructor" << endl;
69 h_nZ_ = ZHisto.
make<TH1F>(
"ZNumber",
"number of Z particles", 11, -0.5, 10.5);
78 h_nZMC_ = ZMCHisto.
make<TH1F>(
"ZMCNumber",
"number of Z MC particles", 11, -0.5, 10.5);
108 "Z Reco vs matched final state #mu #mu mass Difference (GeV/c^{2})",
113 ZResHisto.
make<TH1F>(
"ZToMuMuRecoMassRatio",
"Z Reco vs matched final state #mu #mu mass Ratio", 4000, 0, 2);
115 "Z vs final state #mu #mu MC mass Difference (GeV/c^{2})",
116 nbinsMassRes_ / 2 + 1,
120 ZResHisto.
make<TH1F>(
"ZToMuMuMCMassRatio",
"Z vs final state #mu #mu MC mass Ratio", 2002, 0.999, 2);
124 cout <<
">>> Z Histogrammer analyze" << endl;
139 HepMC::WeightContainer
weights = evt->weights();
140 double weight = weights.front();
146 weight > 0 ? weight = 1. : weight = -1.;
149 for (
unsigned int i = 0;
i < z->
size(); ++
i) {
160 if (zMCMatch.
isNonnull() && zMCMatch->pdgId() == 23) {
167 const Candidate *dau0 = zMCMatch->daughter(0);
168 const Candidate *dau1 = zMCMatch->daughter(1);
185 double invMass = (dau0->
p4() + dau1->
p4()).
mass();
192 for (
unsigned int i = 0;
i < gen->
size(); ++
i) {
194 if ((genCand.
pdgId() == 23) && (genCand.
status() == 2))
196 if ((genCand.
pdgId() == 23) && (genCand.
status() == 3)) {
223 cout <<
">>> Mu " <<
j <<
" daughter MC " <<
k <<
" PDG Id " << dauMuGen->
pdgId() <<
", status " 224 << dauMuGen->
status() <<
", charge " << dauMuGen->
charge() << endl;
226 pZ += dauMuGen->
p4();
233 double mZ = pZ.mass();
bool isNonnull() const
Checks for non-null.
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
ZMCHistogrammer(const edm::ParameterSet &pset)
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
edm::EDGetTokenT< std::vector< reco::GenParticleRef > > matchToken_
edm::EDGetTokenT< reco::CandidateView > zToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
RefToBase< value_type > refAt(size_type i) const
virtual int status() const =0
status word
#define DEFINE_FWK_MODULE(type)
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
T * make(const Args &...args) const
make new ROOT object
def gen(fragment, howMuch)
Production test section ####.
virtual double theta() const =0
momentum polar angle
virtual double eta() const =0
momentum pseudorapidity
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
const HepMC::GenEvent * GetEvent() const
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
edm::EDGetTokenT< reco::CandidateView > genToken_
virtual double rapidity() const =0
rapidity
virtual int charge() const =0
electric charge
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
virtual size_type numberOfDaughters() const =0
number of daughters
virtual double phi() const =0
momentum azimuthal angle
edm::EDGetTokenT< edm::HepMCProduct > hepMCProductToken_
math::PtEtaPhiELorentzVectorF LorentzVector
unsigned int nbinsMassRes_