34 #include "HepMC/WeightContainer.h" 35 #include "HepMC/GenEvent.h" 53 nbinsMass_(pset.getUntrackedParameter<unsigned
int>(
"nbinsMass")),
54 nbinsPt_(pset.getUntrackedParameter<unsigned
int>(
"nbinsPt")),
55 nbinsAng_(pset.getUntrackedParameter<unsigned
int>(
"nbinsAng")),
57 massMax_(pset.getUntrackedParameter<double>(
"massMax")),
58 ptMax_(pset.getUntrackedParameter<double>(
"ptMax")),
59 angMax_(pset.getUntrackedParameter<double>(
"angMax")),
60 massResMax_(pset.getUntrackedParameter<double>(
"massResMax")),
61 isMCatNLO_(pset.getUntrackedParameter<bool>(
"isMCatNLO")) {
62 cout <<
">>> Z Histogrammer constructor" << endl;
68 h_nZ_ = ZHisto.
make<TH1F>(
"ZNumber",
"number of Z particles", 11, -0.5, 10.5);
77 h_nZMC_ = ZMCHisto.
make<TH1F>(
"ZMCNumber",
"number of Z MC particles", 11, -0.5, 10.5);
100 h_mResZ_ = ZResHisto.
make<TH1F>(
"ZMassResolution",
"Z mass Resolution (GeV/c^{2})",
102 h_ptResZ_ = ZResHisto.
make<TH1F>(
"ZPtResolution",
"Z p_{t} Resolution (GeV/c)",
104 h_phiResZ_ = ZResHisto.
make<TH1F>(
"ZPhiResolution",
"Z #phi Resolution",
106 h_thetaResZ_ = ZResHisto.
make<TH1F>(
"ZThetaResolution",
"Z #theta Resolution",
108 h_etaResZ_ = ZResHisto.
make<TH1F>(
"ZEtaResolution",
"Z #eta Resolution",
113 "Z Reco vs matched final state #mu #mu mass Difference (GeV/c^{2})",
116 "Z Reco vs matched final state #mu #mu mass Ratio",
119 "Z vs final state #mu #mu MC mass Difference (GeV/c^{2})",
122 "Z vs final state #mu #mu MC mass Ratio",
127 cout <<
">>> Z Histogrammer analyze" << endl;
139 HepMC::GenEvent* evt =
new HepMC::GenEvent(*(evt_h->
GetEvent()));
143 HepMC::WeightContainer
weights = evt->weights();
144 double weight = weights.front();
145 if(!weight) weight=1.;
149 weight > 0 ? weight=1. : weight=-1.;
152 for(
unsigned int i = 0;
i < z->
size(); ++
i) {
163 if(zMCMatch.
isNonnull() && zMCMatch->pdgId()==23) {
170 const Candidate * dau0 = zMCMatch->daughter(0);
171 const Candidate * dau1 = zMCMatch->daughter(1);
186 double invMass = (dau0->
p4()+dau1->
p4()).
mass();
193 for(
unsigned int i = 0;
i < gen->
size(); ++
i) {
195 if((genCand.
pdgId() == 23) && (genCand.
status() == 2))
197 <<
" daughters" << endl;
198 if((genCand.
pdgId() == 23)&&(genCand.
status() == 3)) {
200 <<
" daughters" << endl;
223 cout <<
">>> The muon " << j
227 cout <<
">>> Mu " << j
228 <<
" daughter MC " <<
k 229 <<
" PDG Id " << dauMuGen->
pdgId()
230 <<
", status " << dauMuGen->
status()
231 <<
", charge " << dauMuGen->
charge()
234 pZ += dauMuGen->
p4();
241 double mZ = pZ.mass();
bool isNonnull() const
Checks for non-null.
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) override
#define DEFINE_FWK_MODULE(type)
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) ...
def setup(process, global_tag, zero_tesla=False)
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
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_