StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTrgReader.cxx
1 // $Id: StjTrgReader.cxx,v 1.5 2008/08/22 16:12:40 tai Exp $
2 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
3 #include "StjTrgReader.h"
4 
5 #include <TTree.h>
6 
7 ClassImp(StjTrgReader)
8 
9 void StjTrgReader::SetBranchAddress(TTree *tree)
10 {
11  tree->SetBranchAddress("runNumber" , &_runNumber );
12  tree->SetBranchAddress("eventId" , &_eventId );
13  tree->SetBranchAddress("vertexZ" , &_vertexZ );
14  tree->SetBranchAddress("trigID" , &_trigID );
15  tree->SetBranchAddress("prescale" , &_prescale );
16  tree->SetBranchAddress("passed" , &_passed );
17  tree->SetBranchAddress("hard" , &_hard );
18  tree->SetBranchAddress("soft" , &_soft );
19  if(tree->GetBranch("nTowers")) {
20  tree->SetBranchAddress("nTowers" , &_nTowers );
21  tree->SetBranchAddress("towerId" , _towerId );
22  tree->SetBranchAddress("towerDsmAdc" , _towerDsmAdc );
23  tree->SetBranchAddress("towerAdc" , _towerAdc );
24  tree->SetBranchAddress("towerEnergy" , _towerEnergy );
25  tree->SetBranchAddress("towerEt" , _towerEt );
26  }
27  if(tree->GetBranch("nJetPatches")) {
28  tree->SetBranchAddress("nJetPatches" , &_nJetPatches );
29  tree->SetBranchAddress("jetPatchId" , _jetPatchId );
30  tree->SetBranchAddress("jetPatchDsmAdc", _jetPatchDsmAdc );
31  tree->SetBranchAddress("jetPatchAdc" , _jetPatchAdc );
32  tree->SetBranchAddress("jetPatchEnergy", _jetPatchEnergy );
33  tree->SetBranchAddress("jetPatchEt" , _jetPatchEt );
34  }
35 }
36 
37 void StjTrgReader::clearEntry()
38 {
39  __id = 0;
40  __runNumber = 0;
41  __eventId = 0;
42  __hard = false;
43  __soft = false;
44  __passed = false;
45  __prescale = 0;
46  __vertexZ = 0;
47 
48  __towers.clear();
49  __towerDsmAdc.clear();
50  __towerAdc.clear();
51  __towerEnergy.clear();
52  __towerEt.clear();
53 
54  __jetPatches.clear();
55  __jetPatchDsmAdc.clear();
56  __jetPatchAdc.clear();
57  __jetPatchEnergy.clear();
58  __jetPatchEt.clear();
59 
60  _nTowers = 0;
61  _nJetPatches = 0;
62 }
63 
64 void StjTrgReader::readEntry()
65 {
66  __id = _trigID;
67  __runNumber = _runNumber;
68  __eventId = _eventId;
69  __hard = _hard;
70  __soft = _soft;
71  __passed = _passed;
72  __prescale = _prescale;
73  __vertexZ = _vertexZ;
74 
75  for(int i = 0; i != _nTowers; ++i) {
76  __towers.push_back(_towerId[i]);
77  __towerDsmAdc.push_back(_towerDsmAdc[i]);
78  __towerAdc.push_back(_towerAdc[i]);
79  __towerEnergy.push_back(_towerEnergy[i]);
80  __towerEt.push_back(_towerEt[i]);
81  }
82 
83  for(int i = 0; i != _nJetPatches; ++i) {
84  __jetPatches.push_back(_jetPatchId[i]);
85  __jetPatchDsmAdc.push_back(_jetPatchDsmAdc[i]);
86  __jetPatchAdc.push_back(_jetPatchAdc[i]);
87  __jetPatchEnergy.push_back(_jetPatchEnergy[i]);
88  __jetPatchEt.push_back(_jetPatchEt[i]);
89  }
90 }
91 
92