31 #include "HepMC/WeightContainer.h"
32 #include "HepMC/GenEvent.h"
46 z_(pset.getParameter<
InputTag>(
"z")),
47 gen_(pset.getParameter<
InputTag>(
"gen")),
48 match_(pset.getParameter<
InputTag>(
"match")),
49 nbinsMass_(pset.getUntrackedParameter<unsigned int>(
"nbinsMass")),
50 nbinsPt_(pset.getUntrackedParameter<unsigned int>(
"nbinsPt")),
51 nbinsAng_(pset.getUntrackedParameter<unsigned int>(
"nbinsAng")),
52 nbinsMassRes_(pset.getUntrackedParameter<unsigned int>(
"nbinsMassRes")),
53 massMax_(pset.getUntrackedParameter<double>(
"massMax")),
54 ptMax_(pset.getUntrackedParameter<double>(
"ptMax")),
55 angMax_(pset.getUntrackedParameter<double>(
"angMax")),
56 massResMax_(pset.getUntrackedParameter<double>(
"massResMax")),
57 isMCatNLO_(pset.getUntrackedParameter<bool>(
"isMCatNLO")) {
58 cout <<
">>> Z Histogrammer constructor" << endl;
64 h_nZ_ = ZHisto.
make<TH1F>(
"ZNumber",
"number of Z particles", 11, -0.5, 10.5);
73 h_nZMC_ = ZMCHisto.
make<TH1F>(
"ZMCNumber",
"number of Z MC particles", 11, -0.5, 10.5);
96 h_mResZ_ = ZResHisto.
make<TH1F>(
"ZMassResolution",
"Z mass Resolution (GeV/c^{2})",
98 h_ptResZ_ = ZResHisto.
make<TH1F>(
"ZPtResolution",
"Z p_{t} Resolution (GeV/c)",
100 h_phiResZ_ = ZResHisto.
make<TH1F>(
"ZPhiResolution",
"Z #phi Resolution",
102 h_thetaResZ_ = ZResHisto.
make<TH1F>(
"ZThetaResolution",
"Z #theta Resolution",
104 h_etaResZ_ = ZResHisto.
make<TH1F>(
"ZEtaResolution",
"Z #eta Resolution",
109 "Z Reco vs matched final state #mu #mu mass Difference (GeV/c^{2})",
112 "Z Reco vs matched final state #mu #mu mass Ratio",
115 "Z vs final state #mu #mu MC mass Difference (GeV/c^{2})",
118 "Z vs final state #mu #mu MC mass Ratio",
123 cout <<
">>> Z Histogrammer analyze" << endl;
127 event.getByLabel(
z_, z);
128 event.getByLabel(
gen_, gen);
129 event.getByLabel(
match_, match);
130 h_nZ_->Fill(z->size());
134 event.getByType(evt_h);
135 HepMC::GenEvent* evt =
new HepMC::GenEvent(*(evt_h->GetEvent()));
139 HepMC::WeightContainer
weights = evt->weights();
140 double weight = weights.front();
141 if(!weight) weight=1.;
145 weight > 0 ? weight=1. : weight=-1.;
148 for(
unsigned int i = 0;
i < z->size(); ++
i) {
159 if(zMCMatch.
isNonnull() && zMCMatch->pdgId()==23) {
166 const Candidate * dau0 = zMCMatch->daughter(0);
167 const Candidate * dau1 = zMCMatch->daughter(1);
182 double invMass = (dau0->
p4()+dau1->
p4()).
mass();
189 for(
unsigned int i = 0;
i < gen->size(); ++
i) {
191 if((genCand.
pdgId() == 23) && (genCand.
status() == 2))
193 <<
" daughters" << endl;
194 if((genCand.
pdgId() == 23)&&(genCand.
status() == 3)) {
196 <<
" daughters" << endl;
219 cout <<
">>> The muon " <<
j
223 cout <<
">>> Mu " <<
j
224 <<
" daughter MC " <<
k
225 <<
" PDG Id " << dauMuGen->
pdgId()
226 <<
", status " << dauMuGen->
status()
227 <<
", charge " << dauMuGen->
charge()
230 pZ += dauMuGen->
p4();
237 double mZ = pZ.mass();
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
ZMCHistogrammer(const edm::ParameterSet &pset)
virtual double mass() const =0
mass
virtual int status() const =0
status word
virtual double rapidity() const =0
rapidity
bool isNonnull() const
Checks for non-null.
virtual size_type numberOfDaughters() const =0
number of daughters
virtual double theta() const =0
momentum polar angle
virtual int charge() const =0
electric charge
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.
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
T * make() const
make new ROOT object
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
unsigned int nbinsMassRes_