30 #include "HepMC/WeightContainer.h"
31 #include "HepMC/GenEvent.h"
45 gen_(pset.getParameter<
InputTag>(
"genParticles")),
46 weights_(pset.getParameter<
InputTag>(
"weights")),
47 nbinsMass_(pset.getUntrackedParameter<unsigned int>(
"nbinsMass")),
48 nbinsPt_(pset.getUntrackedParameter<unsigned int>(
"nbinsPt")),
49 nbinsAng_(pset.getUntrackedParameter<unsigned int>(
"nbinsAng")),
50 massMax_(pset.getUntrackedParameter<double>(
"massMax")),
51 ptMax_(pset.getUntrackedParameter<double>(
"ptMax")),
52 angMax_(pset.getUntrackedParameter<double>(
"angMax")),
53 accPtMin_(pset.getUntrackedParameter<double>(
"accPtMin")),
54 accMassMin_(pset.getUntrackedParameter<double>(
"accMassMin")),
55 accMassMax_(pset.getUntrackedParameter<double>(
"accMassMax")),
56 accEtaMin_(pset.getUntrackedParameter<double>(
"accEtaMin")),
57 accEtaMax_(pset.getUntrackedParameter<double>(
"accEtaMax")),
58 isMCatNLO_(pset.getUntrackedParameter<bool>(
"isMCatNLO")) {
59 cout <<
">>> Z Histogrammer constructor" << endl;
63 h_nZ_ = ZHisto.
make<TH1F>(
"ZNumber",
"number of Z particles", 11, -0.5, 10.5);
91 cout <<
">>> Z Histogrammer analyze" << endl;
96 event.getByLabel(
gen_, gen);
97 event.getByLabel(
weights_, weights );
103 double weight = * weights;
104 if(!weight) weight=1.;
108 weight > 0 ? weight=1. : weight=-1.;
113 std::vector<GenParticle>
muons;
116 for(
unsigned int i = 0;
i < gen->size(); ++
i){
121 cout <<
"I'm getting a muon \n"
122 <<
"with " <<
"muMC.numberOfMothers() " << muMC.
numberOfMothers() <<
"\n the first mother has pdgId " << muMC.
mother()->
pdgId()
130 for(
unsigned int i = 0;
i < gen->size(); ++
i){
133 cout <<
"I'm getting a muon \n"
134 <<
"with " <<
"muMC.numberOfMothers() " << muMC.
numberOfMothers() <<
"\n the first mother has pdgId " << muMC.
mother()->
pdgId()
137 muons.push_back(muMC);
143 cout <<
"finally I selected " << muons.size() <<
" muons" << endl;
157 double inv_mass = 0.0;
160 double Ztheta_ = 0.0;
162 double Zrapidity_ = 0.0;
165 if (muons[0].mother()->mother()->pdgId()==23 && muons[1].mother()->mother()->pdgId()==23)
nBothMuHasZHasGrandMa_ ++;
168 tot_momentum += mom2;
169 inv_mass =
sqrt(tot_momentum.mass2());
170 Zpt_=tot_momentum.pt();
171 Zeta_ = tot_momentum.eta();
172 Ztheta_ = tot_momentum.theta();
173 Zphi_ = tot_momentum.phi();
174 Zrapidity_ = tot_momentum.Rapidity();
180 double weight_sign = (weight > 0) ? 1. : -1.;
182 h_mZMC_->Fill(inv_mass,weight_sign);
189 double pt1 = muons[0].pt();
190 double pt2 = muons[1].pt();
191 double eta1 = muons[0].eta();
192 double eta2 = muons[1].eta();
197 hardpt->Fill(pt1,weight_sign);
198 softpt->Fill(pt2,weight_sign);
199 hardeta->Fill(eta1,weight_sign);
200 softeta->Fill(eta2,weight_sign);
202 hardpt->Fill(pt2,weight_sign);
203 softpt->Fill(pt1,weight_sign);
204 hardeta->Fill(eta2,weight_sign);
205 softeta->Fill(eta1,weight_sign);
219 cout <<
" number of events accepted :" <<
nAcc_ << endl;
220 cout <<
" number of total events :" <<
h_mZMC_->GetEntries() << endl;
222 double eff = (double)
nAcc_ / (
double)
h_mZMC_->GetEntries();
223 double err =
sqrt( eff * (1. - eff) / (
double)
h_mZMC_->GetEntries() );
224 cout <<
" geometric acceptance: " << eff <<
"+/-" << err << endl;
virtual int pdgId() const
PDG identifier.
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
#define DEFINE_FWK_MODULE(type)
virtual int status() const
status word
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual size_t numberOfMothers() const
number of mothers
ZLONLOHistogrammer(const edm::ParameterSet &pset)
unsigned int nBothMuHasZHasGrandMa_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual int pdgId() const =0
PDG identifier.
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
T * make() const
make new ROOT object
virtual const Candidate * mother(size_type=0) const
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")