StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTowerEnergyListReader.cxx
1 // $Id: StjTowerEnergyListReader.cxx,v 1.5 2008/08/11 03:50:59 tai Exp $
2 #include "StjTowerEnergyListReader.h"
3 
4 #include <TTree.h>
5 
7 
8 void StjTowerEnergyListReader::SetBranchAddress(TTree *tree)
9  {
10  tree->SetBranchAddress("eventId" , &_eventId );
11  tree->SetBranchAddress("nTowers" , &_nTowers );
12  tree->SetBranchAddress("energy" , _energy );
13  tree->SetBranchAddress("towerId" , _towerId );
14  tree->SetBranchAddress("towerEta" , _towerEta );
15  tree->SetBranchAddress("towerPhi" , _towerPhi );
16  tree->SetBranchAddress("adc" , _adc );
17  tree->SetBranchAddress("pedestal" , _pedestal );
18  tree->SetBranchAddress("rms" , _rms );
19  tree->SetBranchAddress("towerR" , _towerR );
20  tree->SetBranchAddress("vertexX" , &_vertexX );
21  tree->SetBranchAddress("vertexY" , &_vertexY );
22  tree->SetBranchAddress("vertexZ" , &_vertexZ );
23  tree->SetBranchAddress("status" , _status );
24  tree->SetBranchAddress("detectorId" , &_detectorId );
25  tree->SetBranchAddress("runNumber" , &_runNumber );
26  }
27 
28 void StjTowerEnergyListReader::clearEntry()
29 {
30  _list.clear();
31 }
32 
33 void StjTowerEnergyListReader::readEntry()
34 {
35  clearEntry();
36 
37  for(int i = 0; i < _nTowers; ++i) {
38 
39  StjTowerEnergy energy;
40 
41  energy.runNumber = _runNumber;
42  energy.eventId = _eventId;
43  energy.detectorId = _detectorId; // 9: BEMC, 13: EEMC
44  energy.towerId = _towerId[i];
45  energy.towerR = _towerR[i];
46  energy.towerEta = _towerEta[i];
47  energy.towerPhi = _towerPhi[i];
48  energy.vertexX = _vertexX;
49  energy.vertexY = _vertexY;
50  energy.vertexZ = _vertexZ;
51  energy.energy = _energy[i];
52  energy.adc = _adc[i];
53  energy.pedestal = _pedestal[i];
54  energy.rms = _rms[i];
55  energy.status = _status[i]; // 1 is good for BEMC. 0 is good for EEMC
56 
57  _list.push_back(energy);
58  }
59 
60 }