32 #include "HepMC/WeightContainer.h"
33 #include "HepMC/GenEvent.h"
48 weightsToken_(consumes<double>(
pset.getParameter<
InputTag>(
"weights"))),
49 nbinsMass_(
pset.getUntrackedParameter<unsigned
int>(
"nbinsMass")),
50 nbinsPt_(
pset.getUntrackedParameter<unsigned
int>(
"nbinsPt")),
51 nbinsAng_(
pset.getUntrackedParameter<unsigned
int>(
"nbinsAng")),
52 massMax_(
pset.getUntrackedParameter<double>(
"massMax")),
53 ptMax_(
pset.getUntrackedParameter<double>(
"ptMax")),
54 angMax_(
pset.getUntrackedParameter<double>(
"angMax")),
55 accPtMin_(
pset.getUntrackedParameter<double>(
"accPtMin")),
56 accMassMin_(
pset.getUntrackedParameter<double>(
"accMassMin")),
57 accMassMax_(
pset.getUntrackedParameter<double>(
"accMassMax")),
58 accEtaMin_(
pset.getUntrackedParameter<double>(
"accEtaMin")),
59 accEtaMax_(
pset.getUntrackedParameter<double>(
"accEtaMax")),
60 isMCatNLO_(
pset.getUntrackedParameter<
bool>(
"isMCatNLO")) {
61 cout <<
">>> Z Histogrammer constructor" << endl;
65 h_nZ_ = ZHisto.
make<TH1F>(
"ZNumber",
"number of Z particles", 11, -0.5, 10.5);
91 cout <<
">>> Z Histogrammer analyze" << endl;
110 std::vector<GenParticle>
muons;
113 for (
unsigned int i = 0;
i <
gen->size(); ++
i) {
118 cout <<
"I'm getting a muon \n"
120 <<
"muMC.numberOfMothers() " << muMC.
numberOfMothers() <<
"\n the first mother has pdgId "
123 <<
"\n the first grandma has pdgId " << muMC.
mother()->
mother()->
pdgId() << endl;
125 muons.push_back(muMC);
131 for (
unsigned int i = 0;
i <
gen->size(); ++
i) {
135 cout <<
"I'm getting a muon \n"
137 <<
"muMC.numberOfMothers() " << muMC.
numberOfMothers() <<
"\n the first mother has pdgId "
140 <<
"\n the first grandma has pdgId " << muMC.
mother()->
mother()->
pdgId() << endl;
142 muons.push_back(muMC);
148 cout <<
"finally I selected " <<
muons.size() <<
" muons" << endl;
155 double inv_mass = 0.0;
158 double Ztheta_ = 0.0;
160 double Zrapidity_ = 0.0;
162 if (
muons.size() > 1) {
163 if (
muons[0].mother()->mother()->pdgId() == 23 &&
muons[1].mother()->mother()->pdgId() == 23)
167 tot_momentum += mom2;
168 inv_mass =
sqrt(tot_momentum.mass2());
169 Zpt_ = tot_momentum.pt();
170 Zeta_ = tot_momentum.eta();
171 Ztheta_ = tot_momentum.theta();
172 Zphi_ = tot_momentum.phi();
173 Zrapidity_ = tot_momentum.Rapidity();
177 double weight_sign = (
weight > 0) ? 1. : -1.;
179 h_mZMC_->Fill(inv_mass, weight_sign);
211 cout <<
" number of events accepted :" <<
nAcc_ << endl;
212 cout <<
" number of total events :" <<
h_mZMC_->GetEntries() << endl;
214 double eff = (double)
nAcc_ / (
double)
h_mZMC_->GetEntries();
215 double err =
sqrt(eff * (1. - eff) / (
double)
h_mZMC_->GetEntries());
216 cout <<
" geometric acceptance: " << eff <<
"+/-" <<
err << endl;