-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBambuGenDumperMod.cc
More file actions
136 lines (115 loc) · 4.05 KB
/
BambuGenDumperMod.cc
File metadata and controls
136 lines (115 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#include "EWKAna/Ntupler/interface/BambuGenDumperMod.hh"
#include "MitAna/DataTree/interface/Names.h"
#include "MitAna/DataTree/interface/MCParticleCol.h"
#include <iostream>
#include <iomanip>
#include <vector>
using namespace mithep;
using namespace std;
ClassImp(mithep::BambuGenDumperMod)
//--------------------------------------------------------------------------------------------------
BambuGenDumperMod::BambuGenDumperMod(const char *name, const char *title) :
BaseMod(name,title),
fPartName(Names::gkMCPartBrn),
fParticles(0)
{
// Constructor.
}
//--------------------------------------------------------------------------------------------------
BambuGenDumperMod::~BambuGenDumperMod(){}
//--------------------------------------------------------------------------------------------------
void BambuGenDumperMod::SlaveBegin()
{
//
// Request BAMBU branches
//
ReqBranch(fPartName, fParticles);
}
//--------------------------------------------------------------------------------------------------
void BambuGenDumperMod::Process()
{
LoadBranch(fPartName);
if(!fParticles) return;
IncNEventsProcessed();
cout << "Event: " << GetNEventsProcessed() << endl;
cout << "Particles: " << fParticles->GetEntries() << endl;
cout << endl;
cout << "Index";
cout << setw(8) << "PDG ID";
cout << setw(8) << "Status";
cout << setw(8) << "From";
cout << setw(10) << "E ";
cout << setw(10) << "px ";
cout << setw(10) << "py ";
cout << setw(10) << "pz ";
cout << setw(25) << "decay vertex " << endl;
cout << "____________________________________________________________________________________________________" << endl;
//
// Scan generator level info
//
vector<const MCParticle*> index;
for(UInt_t i=0; i<fParticles->GetEntries(); ++i) {
const MCParticle *p = fParticles->At(i);
index.push_back(p);
cout << setw(5) << i+1;
cout << setw(9) << p->PdgId();
cout << setw(7) << p->Status();
if(p->HasMother()) {
for(UInt_t idx=0; idx<index.size(); idx++) {
const MCParticle *m = p->Mother();
if(m == index[idx]) {
cout << setw(8) << idx+1;
break;
}
}
} else {
cout << setw(8) << " ";
}
cout << setw(10) << setprecision(3) << p->E();
cout << setw(10) << setprecision(3) << p->Px();
cout << setw(10) << setprecision(3) << p->Py();
cout << setw(10) << setprecision(3) << p->Pz();
ThreeVector v = p->DecayVertex();
if( (v.X()!=0) || (v.Y()!=0) || (v.Z()!=0) ) { // stable particles have decay vertex (0,0,0)
cout << " (";
cout << setw(7) << setprecision(3) << v.X();
cout << ",";
cout << setw(7) << setprecision(3) << v.Y();
cout << ",";
cout << setw(7) << setprecision(3) << v.Z();
cout << ")";
}
cout << endl;
}
cout << "====================================================================================================" << endl;
}
//--------------------------------------------------------------------------------------------------
void BambuGenDumperMod::SlaveTerminate()
{
cout << endl;
cout << "Finished with " << GetNEventsProcessed() << " events processed!" << endl;
}
//--------------------------------------------------------------------------------------------------
void BambuGenDumperMod::Begin()
{
// Run startup code on the client machine. For this module, we dont
// do anything here.
}
//--------------------------------------------------------------------------------------------------
void BambuGenDumperMod::BeginRun()
{
// Run startup code on the client machine. For this module, we dont
// do anything here.
}
//--------------------------------------------------------------------------------------------------
void BambuGenDumperMod::EndRun()
{
// Run startup code on the client machine. For this module, we dont
// do anything here.
}
//--------------------------------------------------------------------------------------------------
void BambuGenDumperMod::Terminate()
{
// Run finishing code on the client computer.
// For this module, we dont do anything here.
}