29 for (
auto & parameterName : parameterNames){
30 if ( parameterName ==
"Monte" )
_Monte = myMCParams.
getParameter<
bool>( parameterName );
31 else if ( parameterName ==
"GenTracks" )
_Gen = myMCParams.
getParameter<
bool>( parameterName );
32 else if ( parameterName ==
"Debug" )
_Debug = myMCParams.
getParameter<
bool>( parameterName );
35 const int kMaxMcTruth = 10000;
36 mcpid =
new int[kMaxMcTruth];
38 mcvx =
new float[kMaxMcTruth];
39 mcvy =
new float[kMaxMcTruth];
40 mcvz =
new float[kMaxMcTruth];
41 mcpt =
new float[kMaxMcTruth];
42 mceta =
new float[kMaxMcTruth];
43 mcphi =
new float[kMaxMcTruth];
46 HltTree->Branch(
"NMCpart",&
nmcpart,
"NMCpart/I");
47 HltTree->Branch(
"MCpid",
mcpid,
"MCpid[NMCpart]/I");
48 HltTree->Branch(
"MCstatus",
mcstatus,
"MCstatus[NMCpart]/I");
49 HltTree->Branch(
"MCvtxX",
mcvx,
"MCvtxX[NMCpart]/F");
50 HltTree->Branch(
"MCvtxY",
mcvy,
"MCvtxY[NMCpart]/F");
51 HltTree->Branch(
"MCvtxZ",
mcvz,
"MCvtxZ[NMCpart]/F");
52 HltTree->Branch(
"MCpt",
mcpt,
"MCpt[NMCpart]/F");
53 HltTree->Branch(
"MCeta",
mceta,
"MCeta[NMCpart]/F");
54 HltTree->Branch(
"MCphi",
mcphi,
"MCphi[NMCpart]/F");
55 HltTree->Branch(
"MCPtHat",&
pthatf,
"MCPtHat/F");
56 HltTree->Branch(
"MCWeight",&
weightf,
"MCWeight/F");
57 HltTree->Branch(
"MCWeightSign",&
weightsignf,
"MCWeightSign/F");
58 HltTree->Branch(
"MCmu3",&
nmu3,
"MCmu3/I");
59 HltTree->Branch(
"MCel3",&
nel3,
"MCel3/I");
60 HltTree->Branch(
"MCbb",&
nbb,
"MCbb/I");
61 HltTree->Branch(
"MCab",&
nab,
"MCab/I");
62 HltTree->Branch(
"MCWenu",&
nwenu,
"MCWenu/I");
63 HltTree->Branch(
"MCWmunu",&
nwmunu,
"MCmunu/I");
64 HltTree->Branch(
"MCZee",&
nzee,
"MCZee/I");
65 HltTree->Branch(
"MCZmumu",&
nzmumu,
"MCZmumu/I");
66 HltTree->Branch(
"MCptEleMax",&
ptEleMax,
"MCptEleMax/F");
67 HltTree->Branch(
"MCptMuMax",&
ptMuMax,
"MCptMuMax/F");
68 HltTree->Branch(
"NPUTrueBX0",&
npubx0,
"NPUTrueBX0/I");
69 HltTree->Branch(
"NPUgenBX0",&
npuvertbx0,
"NPUgenBX0/I");
78 const edm::Handle<std::vector<SimVertex> > & simVertices,
79 const edm::Handle<std::vector< PileupSummaryInfo > > & PupInfo,
106 if(PupInfo.isValid()) {
107 std::vector<PileupSummaryInfo>::const_iterator PVI;
108 for(PVI = PupInfo->begin(); PVI != PupInfo->end(); ++PVI) {
110 int BX = PVI->getBunchCrossing();
111 npvtrue = PVI->getTrueNumInteractions();
112 npuvert = PVI->getPU_NumInteractions();
122 if((
simTracks.isValid())&&(simVertices.isValid())){
124 int pdgid = j.type();
125 if (
abs(pdgid)!=13)
continue;
126 double pt = j.momentum().pt();
127 if (pt<5.0)
continue;
128 double eta = j.momentum().eta();
129 if (
abs(eta)>2.5)
continue;
130 if (j.noVertex())
continue;
131 int vertIndex = j.vertIndex();
132 double x = simVertices->at(vertIndex).position().x();
133 double y = simVertices->at(vertIndex).position().y();
134 double r =
sqrt(x*x+y*y);
135 if (r>200.)
continue;
136 double z = simVertices->at(vertIndex).position().z();
137 if (
abs(z)>400.)
continue;
146 for (
size_t i = 0;
i < mctruth->
size(); ++
i) {
160 for (
size_t j=0; j != idg; ++j){
162 if ((d.
pdgId()==11)||(d.
pdgId()==-11)){wel += 1;}
163 if ((d.
pdgId()==13)||(d.
pdgId()==-13)){wmu += 1;}
168 if (
mcpid[nmc]==23) {
170 for (
size_t j=0; j != idg; ++j){
172 if (d.
pdgId()==11){zee += 1;}
173 if (d.
pdgId()==-11){zee += 2;}
174 if (d.
pdgId()==13){zmumu += 1;}
175 if (d.
pdgId()==-13){zmumu += 2;}
182 if (((
mcpid[nmc]==11)||(
mcpid[nmc]==-11))&&(
mcpt[nmc]>2.5)) {el3 += 1;}
184 if (
mcpid[nmc]==-5) {mab += 1;}
185 if (
mcpid[nmc]==5) {mbb += 1;}
205 if((zee%3)==0){
nzee = zee/3;}
207 if ((zmumu%3)==0){
nzmumu = zmumu/3;}
T getParameter(std::string const &) const
virtual double vx() const =0
x coordinate of vertex position
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual double vy() const =0
y coordinate of vertex position
virtual int status() const =0
status word
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
std::vector< std::string > getParameterNames() const
virtual double eta() const =0
momentum pseudorapidity
virtual double pt() const =0
transverse momentum
void analyze(const edm::Handle< reco::CandidateView > &mctruth, const double &pthat, const double &weight, const edm::Handle< std::vector< SimTrack > > &simTracks, const edm::Handle< std::vector< SimVertex > > &simVertices, const edm::Handle< std::vector< PileupSummaryInfo > > &PupInfo, TTree *tree)
void setup(const edm::ParameterSet &pSet, TTree *tree)
virtual double vz() const =0
z coordinate of vertex position
virtual size_type numberOfDaughters() const =0
number of daughters
virtual double phi() const =0
momentum azimuthal angle