2 #include "StjTowerEnergyListWriter.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(
"nTowers" , &_nTowers ,
"nTowers/I" );
23 _tree->Branch(
"energy" , _energy ,
"energy[nTowers]/D" );
24 _tree->Branch(
"towerId" , _towerId ,
"towerId[nTowers]/I" );
25 _tree->Branch(
"towerEta" , _towerEta ,
"towerEta[nTowers]/D" );
26 _tree->Branch(
"towerPhi" , _towerPhi ,
"towerPhi[nTowers]/D" );
27 _tree->Branch(
"adc" , _adc ,
"adc[nTowers]/i" );
28 _tree->Branch(
"pedestal" , _pedestal ,
"pedestal[nTowers]/D" );
29 _tree->Branch(
"rms" , _rms ,
"rms[nTowers]/D" );
30 _tree->Branch(
"towerR" , _towerR ,
"towerR[nTowers]/D" );
31 _tree->Branch(
"vertexX" , &_vertexX ,
"vertexX/D" );
32 _tree->Branch(
"vertexY" , &_vertexY ,
"vertexY/D" );
33 _tree->Branch(
"vertexZ" , &_vertexZ ,
"vertexZ/D" );
34 _tree->Branch(
"status" , _status ,
"status[nTowers]/I" );
35 _tree->Branch(
"detectorId" , &_detectorId ,
"detectorId/I" );
36 _tree->Branch(
"runNumber" , &_runNumber ,
"runNumber/I" );
39 void StjTowerEnergyListWriter::Fill(
const StjTowerEnergyList& energyList)
41 if(energyList.empty())
return;
43 _runNumber = energyList[0].runNumber;
44 _eventId = energyList[0].eventId;
45 _detectorId = energyList[0].detectorId;
47 _vertexX = energyList[0].vertexX;
48 _vertexY = energyList[0].vertexY;
49 _vertexZ = energyList[0].vertexZ;
51 _nTowers = energyList.size();
52 for(
int i = 0; i < _nTowers; ++i) {
54 _towerId[i] = tower.towerId;
55 _towerR[i] = tower.towerR;
56 _towerEta[i] = tower.towerEta;
57 _towerPhi[i] = tower.towerPhi;
58 _energy[i] = tower.energy;
60 _pedestal[i] = tower.pedestal;
62 _status[i] = tower.status;
68 void StjTowerEnergyListWriter::Finish()
70 _tree->BuildIndex(
"runNumber",
"eventId");