BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TDigiEvent.cxx
Go to the documentation of this file.
2#include <iostream>
3#include "TCollection.h" // Declares TIter
4
6
7// Allocate the TObjArray just once
8TObjArray *TDigiEvent::s_staticMdcDigiCol = 0;
9TObjArray *TDigiEvent::s_staticEmcDigiCol = 0;
10TObjArray *TDigiEvent::s_staticTofDigiCol = 0;
11TObjArray *TDigiEvent::s_staticMucDigiCol = 0;
12TObjArray *TDigiEvent::s_staticLumiDigiCol = 0;
13
14
15//***************************************************************
17{
18 if (!s_staticMdcDigiCol) {
19 s_staticMdcDigiCol = new TObjArray();
20 }
21 m_mdcDigiCol = s_staticMdcDigiCol;
22
23 if (!s_staticEmcDigiCol ){
24 s_staticEmcDigiCol = new TObjArray();
25 }
26 m_emcDigiCol = s_staticEmcDigiCol;
27
28 if (! s_staticTofDigiCol ){
29 s_staticTofDigiCol = new TObjArray();
30 }
31 m_tofDigiCol = s_staticTofDigiCol;
32
33 if (! s_staticMucDigiCol ){
34 s_staticMucDigiCol = new TObjArray();
35 }
36 m_mucDigiCol = s_staticMucDigiCol;
37
38 if (! s_staticLumiDigiCol ) {
39 s_staticLumiDigiCol = new TObjArray();
40 }
41 m_lumiDigiCol = s_staticLumiDigiCol;
42
43 Clear();
44
45}
46
47//*****************************************************************
49
50 if(m_mdcDigiCol == s_staticMdcDigiCol) s_staticMdcDigiCol = 0;
51 m_mdcDigiCol->Delete();
52 delete m_mdcDigiCol;
53 m_mdcDigiCol = 0;
54
55 if(m_emcDigiCol == s_staticEmcDigiCol) s_staticEmcDigiCol = 0;
56 m_emcDigiCol->Delete();
57 delete m_emcDigiCol;
58 m_emcDigiCol = 0;
59
60 if(m_tofDigiCol == s_staticTofDigiCol ) s_staticTofDigiCol = 0;
61 m_tofDigiCol->Delete();
62 delete m_tofDigiCol;
63 m_tofDigiCol = 0;
64
65 if(m_mucDigiCol == s_staticMucDigiCol ) s_staticMucDigiCol = 0;
66 m_mucDigiCol->Delete();
67 delete m_mucDigiCol;
68 m_mucDigiCol = 0;
69
70 if ( m_lumiDigiCol == s_staticLumiDigiCol ) s_staticLumiDigiCol = 0;
71 m_lumiDigiCol->Delete();
72 delete m_lumiDigiCol;
73 m_lumiDigiCol = 0;
74
75}
76
77//*****************************************************************
78void TDigiEvent::initialize(Bool_t fromMc){
79 m_fromMc = fromMc;
80}
81
82//*****************************************************************
83void TDigiEvent::Clear(Option_t *option) {
84 /*
85 const Int_t nd = 20000;
86 static Int_t limit = 100;
87 static Int_t ind=0;
88 static TMdcDigi* keep[nd];
89
90
91 Int_t n = m_mdcDigiCol->GetEntries();
92 if (n>limit) {
93 limit=n+10;
94 if (limit > nd)
95 std::cout << "!!!Warning: limit for TMdcDigi is greater than " << nd << std::endl;
96 for (Int_t j=0;j<ind;j++) delete keep[j];
97 ind = 0;
98 }
99 for (Int_t i=0;i<n;i++) keep[ind+i] = (TMdcDigi*)m_mdcDigiCol->At(i);
100 ind += n;
101 if (ind > nd-limit) {
102 for (Int_t j=0;j<ind;j++) delete keep[j];
103 ind = 0;
104 }
105 m_mdcDigiCol->Clear();
106*/
107}
108
109//*****************************************************************************
110void TDigiEvent::Print(Option_t *option) const {
111 TObject::Print(option);
112 std::cout.precision(2);
113 if (m_mdcDigiCol)
114 std::cout << "Number of TMdcDigis " << m_mdcDigiCol->GetEntries() << std::endl;
115 else
116 std::cout << "Number of TMdcDigis 0" << std::endl;
117}
118
119/// Mdc
121 m_mdcDigiCol->Add(digi);
122}
123
124const TMdcDigi* TDigiEvent::getMdcDigi(Int_t i) const {
125 if (Int_t(i) >= m_mdcDigiCol->GetEntries())
126 return 0;
127 return (TMdcDigi*)m_mdcDigiCol->At(i);
128}
129///Emc
131 m_emcDigiCol->Add(digi);
132}
133
134const TEmcDigi* TDigiEvent::getEmcDigi( Int_t i) const {
135 if(Int_t(i) >= m_emcDigiCol->GetEntries())
136 return 0;
137 return (TEmcDigi*)m_emcDigiCol->At(i);
138}
139
140///Tof
142 m_tofDigiCol->Add(digi);
143}
144
145
146const TTofDigi* TDigiEvent::getTofDigi(Int_t i) const {
147 if(Int_t(i) >=m_tofDigiCol->GetEntries())
148 return 0;
149 return (TTofDigi*) m_tofDigiCol->At(i);
150}
151
152///Muc
154 m_mucDigiCol->Add(digi);
155}
156
157
158const TMucDigi* TDigiEvent::getMucDigi(Int_t i) const {
159 if(Int_t(i) >=m_mucDigiCol->GetEntries())
160 return 0;
161 return (TMucDigi*) m_mucDigiCol->At(i);
162}
163
164///Lumi
166 m_lumiDigiCol->Add(digi);
167}
168
169const TLumiDigi* TDigiEvent::getLumiDigi(Int_t i) const {
170 if ( i >= m_lumiDigiCol->GetEntries() )
171 return 0;
172 return (TLumiDigi*) m_lumiDigiCol->At(i);
173}
ClassImp(TBossFullEvent) TBossFullEvent
void addMucDigi(TMucDigi *digi)
Add a MucDigi into the MUC Data collection.
Definition: TDigiEvent.cxx:153
void addEmcDigi(TEmcDigi *digi)
Add a TkrDigi into the TKR data collection.
Definition: TDigiEvent.cxx:130
const TMucDigi * getMucDigi(Int_t i) const
retrieve a MucDigi From the collection, using the index into the array
Definition: TDigiEvent.cxx:158
virtual ~TDigiEvent()
Definition: TDigiEvent.cxx:48
void Print(Option_t *option="") const
Definition: TDigiEvent.cxx:110
void initialize(Bool_t fromMc=true)
Definition: TDigiEvent.cxx:78
void Clear(Option_t *option="")
Definition: TDigiEvent.cxx:83
const TMdcDigi * getMdcDigi(Int_t i) const
retrieve a TkrDigi from the collection, using the index into the array
Definition: TDigiEvent.cxx:124
void addTofDigi(TTofDigi *digi)
Add a TofDigi into the TOF Data collection.
Definition: TDigiEvent.cxx:141
const TEmcDigi * getEmcDigi(Int_t i) const
retrieve a EmcDigi from the collection, using the index into the array
Definition: TDigiEvent.cxx:134
void addMdcDigi(TMdcDigi *digi)
Add a TkrDigi into the TKR data collection.
Definition: TDigiEvent.cxx:120
const TLumiDigi * getLumiDigi(Int_t i) const
retrieve a LumiDigi From the collection, using the index into the array
Definition: TDigiEvent.cxx:169
void addLumiDigi(TLumiDigi *digi)
Add a LumiDigi into the MUC Data collection.
Definition: TDigiEvent.cxx:165
const TTofDigi * getTofDigi(Int_t i) const
retrieve a TofDigi From the collection, using the index into the array
Definition: TDigiEvent.cxx:146