00001
00002 #include "StjMCParticleListReader.h"
00003
00004 #include <TTree.h>
00005
00006 #include <iostream>
00007
00008 ClassImp(StjMCParticleListReader)
00009
00010 using namespace std;
00011
00012 void StjMCParticleListReader::SetBranchAddress(TTree *tree)
00013 {
00014 tree->SetBranchAddress("eventId" , &_eventId );
00015 tree->SetBranchAddress("nMCParticles" , &_nMCParticles );
00016 tree->SetBranchAddress("mcparticleId" , _mcparticleId );
00017 tree->SetBranchAddress("status" , _status );
00018 tree->SetBranchAddress("pdg" , _pdg );
00019 tree->SetBranchAddress("pt" , _pt );
00020 tree->SetBranchAddress("eta" , _eta );
00021 tree->SetBranchAddress("phi" , _phi );
00022 tree->SetBranchAddress("m" , _m );
00023 tree->SetBranchAddress("e" , _e );
00024 tree->SetBranchAddress("firstMotherId" , _firstMotherId );
00025 tree->SetBranchAddress("lastMotherId" , _lastMotherId );
00026 tree->SetBranchAddress("firstDaughterId" , _firstDaughterId );
00027 tree->SetBranchAddress("lastDaughterId" , _lastDaughterId );
00028 tree->SetBranchAddress("vertexZ" , &_vertexZ );
00029 tree->SetBranchAddress("runNumber" , &_runNumber );
00030 }
00031
00032 void StjMCParticleListReader::clearEntry()
00033 {
00034 _list.clear();
00035 }
00036
00037 void StjMCParticleListReader::readEntry()
00038 {
00039 clearEntry();
00040
00041 for(int i = 0; i < _nMCParticles; ++i) {
00042
00043 StjMCParticle mcparticle;
00044
00045 mcparticle.runNumber = _runNumber;
00046 mcparticle.eventId = _eventId;
00047 mcparticle.mcparticleId = _mcparticleId[i];
00048 mcparticle.pdg = _pdg[i];
00049 mcparticle.firstMotherId = _firstMotherId[i];
00050 mcparticle.lastMotherId = _lastMotherId[i];
00051 mcparticle.firstDaughterId = _firstDaughterId[i];
00052 mcparticle.lastDaughterId = _lastDaughterId[i];
00053 mcparticle.pt = _pt[i];
00054 mcparticle.eta = _eta[i];
00055 mcparticle.phi = _phi[i];
00056 mcparticle.m = _m[i];
00057 mcparticle.e = _e[i];
00058 mcparticle.status = _status[i];
00059 mcparticle.vertexZ = _vertexZ;
00060
00061 _list.push_back(mcparticle);
00062 }
00063 }