27 for (
auto& parameterName : parameterNames) {
28 if (parameterName ==
"Monte")
30 else if (parameterName ==
"GenTracks")
32 else if (parameterName ==
"Debug")
36 const int kMaxMcTruth = 10000;
37 mcpid =
new int[kMaxMcTruth];
39 mcvx =
new float[kMaxMcTruth];
40 mcvy =
new float[kMaxMcTruth];
41 mcvz =
new float[kMaxMcTruth];
42 mcpt =
new float[kMaxMcTruth];
43 mceta =
new float[kMaxMcTruth];
44 mcphi =
new float[kMaxMcTruth];
47 HltTree->Branch(
"NMCpart", &
nmcpart,
"NMCpart/I");
48 HltTree->Branch(
"MCpid",
mcpid,
"MCpid[NMCpart]/I");
49 HltTree->Branch(
"MCstatus",
mcstatus,
"MCstatus[NMCpart]/I");
50 HltTree->Branch(
"MCvtxX",
mcvx,
"MCvtxX[NMCpart]/F");
51 HltTree->Branch(
"MCvtxY",
mcvy,
"MCvtxY[NMCpart]/F");
52 HltTree->Branch(
"MCvtxZ",
mcvz,
"MCvtxZ[NMCpart]/F");
53 HltTree->Branch(
"MCpt",
mcpt,
"MCpt[NMCpart]/F");
54 HltTree->Branch(
"MCeta",
mceta,
"MCeta[NMCpart]/F");
55 HltTree->Branch(
"MCphi",
mcphi,
"MCphi[NMCpart]/F");
56 HltTree->Branch(
"MCPtHat", &
pthatf,
"MCPtHat/F");
57 HltTree->Branch(
"MCWeight", &
weightf,
"MCWeight/F");
58 HltTree->Branch(
"MCWeightSign", &
weightsignf,
"MCWeightSign/F");
59 HltTree->Branch(
"MCmu3", &
nmu3,
"MCmu3/I");
60 HltTree->Branch(
"MCel3", &
nel3,
"MCel3/I");
61 HltTree->Branch(
"MCbb", &
nbb,
"MCbb/I");
62 HltTree->Branch(
"MCab", &
nab,
"MCab/I");
63 HltTree->Branch(
"MCWenu", &
nwenu,
"MCWenu/I");
64 HltTree->Branch(
"MCWmunu", &
nwmunu,
"MCmunu/I");
65 HltTree->Branch(
"MCZee", &
nzee,
"MCZee/I");
66 HltTree->Branch(
"MCZmumu", &
nzmumu,
"MCZmumu/I");
67 HltTree->Branch(
"MCptEleMax", &
ptEleMax,
"MCptEleMax/F");
68 HltTree->Branch(
"MCptMuMax", &
ptMuMax,
"MCptMuMax/F");
69 HltTree->Branch(
"NPUTrueBX0", &
npubx0,
"NPUTrueBX0/I");
70 HltTree->Branch(
"NPUgenBX0", &
npuvertbx0,
"NPUgenBX0/I");
78 const edm::Handle<std::vector<SimVertex> >& simVertices,
79 const edm::Handle<std::vector<PileupSummaryInfo> >& PupInfo,
105 if (PupInfo.isValid()) {
106 std::vector<PileupSummaryInfo>::const_iterator PVI;
107 for (PVI = PupInfo->begin(); PVI != PupInfo->end(); ++PVI) {
108 int BX = PVI->getBunchCrossing();
109 npvtrue = PVI->getTrueNumInteractions();
110 npuvert = PVI->getPU_NumInteractions();
119 if ((
simTracks.isValid()) && (simVertices.isValid())) {
124 double pt =
j.momentum().pt();
127 double eta =
j.momentum().eta();
132 int vertIndex =
j.vertIndex();
133 double x = simVertices->at(vertIndex).position().x();
134 double y = simVertices->at(vertIndex).position().y();
138 double z = simVertices->at(vertIndex).position().z();
147 for (
size_t i = 0;
i <
mctruth->size(); ++
i) {
159 if ((
mcpid[nmc] == 24) || (
mcpid[nmc] == -24)) {
160 size_t idg =
p.numberOfDaughters();
161 for (
size_t j = 0;
j != idg; ++
j) {
163 if ((
d.pdgId() == 11) || (
d.pdgId() == -11)) {
166 if ((
d.pdgId() == 13) || (
d.pdgId() == -13)) {
173 if (
mcpid[nmc] == 23) {
174 size_t idg =
p.numberOfDaughters();
175 for (
size_t j = 0;
j != idg; ++
j) {
177 if (
d.pdgId() == 11) {
180 if (
d.pdgId() == -11) {
183 if (
d.pdgId() == 13) {
186 if (
d.pdgId() == -13) {
195 if (((
mcpid[nmc] == 11) || (
mcpid[nmc] == -11)) && (
mcpt[nmc] > 2.5)) {
199 if (
mcpid[nmc] == -5) {
202 if (
mcpid[nmc] == 5) {
206 if ((
mcpid[nmc] == 13) || (
mcpid[nmc] == -13)) {
211 if ((
mcpid[nmc] == 11) || (
mcpid[nmc] == -11)) {
228 if ((zee % 3) == 0) {
232 if ((zmumu % 3) == 0) {
T getParameter(std::string const &) const
Abs< T >::type abs(const T &t)
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)
std::vector< std::string > getParameterNames() const