14 virtual void endJob()
override;
31 #include "HepMC/WeightContainer.h"
32 #include "HepMC/GenEvent.h"
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 accMassMinDen_(pset.getUntrackedParameter<double>(
"accMassMinDen")),
57 accMassMaxDen_(pset.getUntrackedParameter<double>(
"accMassMaxDen")),
58 accEtaMin_(pset.getUntrackedParameter<double>(
"accEtaMin")),
59 accEtaMax_(pset.getUntrackedParameter<double>(
"accEtaMax")),
60 ptScale_(pset.getUntrackedParameter<double>(
"ptScale")),
61 muPdgStatus_(pset.getUntrackedParameter<int>(
"muPdgStatus")){
63 cout <<
">>> Z Histogrammer constructor" << endl;
90 cout <<
">>> Z HistogrammerZLONLOHistogrammer.cc analyze" << endl;
105 std::vector<GenParticle>
muons;
109 for(
unsigned int i = 0;
i < gen->size(); ++
i){
114 cout <<
"I'm getting a muon \n"
115 <<
"with " <<
"muMC.numberOfMothers() " << muMC.
numberOfMothers() <<
"\n the first mother has pdgId " << muMC.
mother()->
pdgId()
117 cout <<
"with muMC.eta() " << muMC.
eta()<<endl;
118 muons.push_back(muMC);
136 cout <<
"I'm selecting a Z MC with mass " << mZGen << endl;
145 cout <<
"finally I selected " << muons.size() <<
" muons" << endl;
156 double inv_mass = 0.0;
159 double Ztheta_ = 0.0;
161 double Zrapidity_ = 0.0;
166 if (muons[0].mother()->mother()->pdgId()==23 && muons[1].mother()->mother()->pdgId()==23)
nBothMuHasZHasGrandMa_ ++;
169 tot_momentum += mom2;
170 inv_mass =
sqrt(tot_momentum.mass2());
171 Zpt_=tot_momentum.pt();
172 Zeta_ = tot_momentum.eta();
173 Ztheta_ = tot_momentum.theta();
174 Zphi_ = tot_momentum.phi();
175 Zrapidity_ = tot_momentum.Rapidity();
180 double weight_sign = 1. ;
189 double pt1 = muons[0].pt();
190 double pt2 = muons[1].pt();
191 double eta1 = muons[0].eta();
192 double eta2 = muons[1].eta();
199 hardpt->Fill(pt1,weight_sign);
200 softpt->Fill(pt2,weight_sign);
201 hardeta->Fill(eta1,weight_sign);
202 softeta->Fill(eta2,weight_sign);
204 hardpt->Fill(pt2,weight_sign);
205 softpt->Fill(pt1,weight_sign);
206 hardeta->Fill(eta2,weight_sign);
207 softeta->Fill(eta1,weight_sign);
214 cout <<
"pt1" << pt1 << endl;
217 double pt1ScaledP = pt1* ( 1. +
ptScale_);
219 cout <<
"pt1ScaledP" << pt1ScaledP << endl;
221 double pt2ScaledP = pt2 * ( 1. +
ptScale_);
232 double pt1ScaledN = pt1* ( 1. -
ptScale_);
233 double pt2ScaledN = pt2 * ( 1. -
ptScale_);
243 f.SetSeed(123456789);
244 double pt1SmearedFlat = pt1* ( 1. +
ptScale_ * f.Uniform() );
245 double pt2SmearedFlat = pt2 * ( 1. +
ptScale_ * f.Uniform() ) ;
255 ff.SetSeed(123456789);
256 double pt1SmearedGaus = pt1* ( 1. +
ptScale_ * f.Gaus() );
257 double pt2SmearedGaus = pt2 * ( 1. +
ptScale_ * f.Gaus() ) ;
273 cout <<
" number of events accepted :" <<
nAcc_ << endl;
274 cout <<
" number of total events :" <<
h_mZMC_->GetEntries() << endl;
276 cout <<
" number of events pt scaled positively accepted :" <<
nAccPtScaleP_ << endl;
278 cout <<
" number of events pt scaled negatively accepted :" <<
nAccPtScaleN_ << endl;
285 double eff = (double)
nAcc_ / (
double)
h_mZMC_->GetEntries();
286 double err =
sqrt( eff * (1. - eff) / (
double)
h_mZMC_->GetEntries() );
287 cout <<
" geometric acceptance: " << eff <<
"+/-" << err << endl;
290 double errScaledP =
sqrt( effScaledP * (1. - effScaledP) / (
double)
h_mZMC_->GetEntries() );
291 cout <<
" geometric acceptance when pt muon is positively scaled: " << effScaledP <<
"+/-" << errScaledP << endl;
294 double errScaledN =
sqrt( effScaledN * (1. - effScaledN) / (
double)
h_mZMC_->GetEntries() );
295 cout <<
" geometric acceptance when pt muon is negatively scaled: " << effScaledN <<
"+/-" << errScaledN << endl;
298 double errSmearedFlat =
sqrt( effSmearedFlat * (1. - effSmearedFlat) / (
double)
h_mZMC_->GetEntries() );
299 cout <<
" geometric acceptance when pt muon is scaled with a flat smaering: " << effSmearedFlat <<
"+/-" << errSmearedFlat << endl;
302 double errSmearedGaus =
sqrt( effSmearedGaus * (1. - effSmearedGaus) / (
double)
h_mZMC_->GetEntries() );
303 cout <<
" geometric acceptance when pt muon is scaled with a gaussian smearing: " << effSmearedGaus <<
"+/-" << errSmearedGaus << endl;
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
ZMuPtScaleAnalyzer(const edm::ParameterSet &pset)
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
#define DEFINE_FWK_MODULE(type)
unsigned int nAccPtScaleP_
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
edm::EDGetTokenT< reco::GenParticleCollection > genToken_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual int status() const final
status word
unsigned int nBothMuHasZHasGrandMa_
unsigned int nAccPtScaleN_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual size_t numberOfMothers() const
number of mothers
virtual size_t numberOfDaughters() const
number of daughters
virtual void endJob() override
Abs< T >::type abs(const T &t)
T * make(const Args &...args) const
make new ROOT object
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 double mass() const final
mass
virtual int pdgId() const =0
PDG identifier.
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
virtual int pdgId() const final
PDG identifier.
unsigned int nAccPtScaleSmearedFlat_
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) override
unsigned int nAccPtScaleSmearedGaus_
virtual double eta() const final
momentum pseudorapidity
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="")