2 #include "StjMCParticleListWriter.h"
4 #include <TDirectory.h>
17 _tree =
new TTree(treeName, treeName);
18 _tree->SetAutoSave(kMaxLong64);
19 _tree->SetMaxTreeSize(kMaxLong64);
21 _tree->Branch(
"eventId" , &_eventId ,
"eventId/I" );
22 _tree->Branch(
"nMCParticles" , &_nMCParticles ,
"nMCParticles/I" );
23 _tree->Branch(
"mcparticleId" , _mcparticleId ,
"mcparticleId[nMCParticles]/I" );
24 _tree->Branch(
"status" , _status ,
"status[nMCParticles]/I" );
25 _tree->Branch(
"pdg" , _pdg ,
"pdg[nMCParticles]/I" );
26 _tree->Branch(
"pt" , _pt ,
"pt[nMCParticles]/D" );
27 _tree->Branch(
"eta" , _eta ,
"eta[nMCParticles]/D" );
28 _tree->Branch(
"phi" , _phi ,
"phi[nMCParticles]/D" );
29 _tree->Branch(
"m" , _m ,
"m[nMCParticles]/D" );
30 _tree->Branch(
"e" , _e ,
"e[nMCParticles]/D" );
31 _tree->Branch(
"firstMotherId" , _firstMotherId ,
"firstMotherId[nMCParticles]/I" );
32 _tree->Branch(
"lastMotherId" , _lastMotherId ,
"lastMotherId[nMCParticles]/I" );
33 _tree->Branch(
"firstDaughterId" , _firstDaughterId ,
"firstDaughterId[nMCParticles]/I" );
34 _tree->Branch(
"lastDaughterId" , _lastDaughterId ,
"lastDaughterId[nMCParticles]/I" );
35 _tree->Branch(
"vertexZ" , &_vertexZ ,
"vertexZ/D" );
36 _tree->Branch(
"runNumber" , &_runNumber ,
"runNumber/I" );
39 void StjMCParticleListWriter::Fill(
const StjMCParticleList& theList)
41 if(theList.empty())
return;
43 _runNumber = theList[0].runNumber;
44 _eventId = theList[0].eventId;
45 _vertexZ = theList[0].vertexZ;
47 _nMCParticles = theList.size();
48 for(
int i = 0; i < _nMCParticles; ++i) {
50 _mcparticleId[i] = particle.mcparticleId;
51 _pdg[i] = particle.pdg;
52 _firstMotherId[i] = particle.firstMotherId;
53 _lastMotherId[i] = particle.lastMotherId;
54 _firstDaughterId[i] = particle.firstDaughterId;
55 _lastDaughterId[i] = particle.lastDaughterId;
57 _eta[i] = particle.eta;
58 _phi[i] = particle.phi;
61 _status[i] = particle.status;
67 void StjMCParticleListWriter::Finish()
69 _tree->BuildIndex(
"runNumber",
"eventId");