CGEM BOSS 6.6.5.i
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_staticCgemDigiCol = 0;
10TObjArray *TDigiEvent::s_staticEmcDigiCol = 0;
11TObjArray *TDigiEvent::s_staticTofDigiCol = 0;
12TObjArray *TDigiEvent::s_staticMucDigiCol = 0;
13TObjArray *TDigiEvent::s_staticLumiDigiCol = 0;
14
15
16//***************************************************************
18{
19 if (!s_staticMdcDigiCol) {
20 s_staticMdcDigiCol = new TObjArray();
21 }
22 m_mdcDigiCol = s_staticMdcDigiCol;
23
24 if (!s_staticCgemDigiCol) {
25 s_staticCgemDigiCol = new TObjArray();
26 }
27 m_cgemDigiCol = s_staticCgemDigiCol;
28
29 if (!s_staticEmcDigiCol ){
30 s_staticEmcDigiCol = new TObjArray();
31 }
32 m_emcDigiCol = s_staticEmcDigiCol;
33
34 if (! s_staticTofDigiCol ){
35 s_staticTofDigiCol = new TObjArray();
36 }
37 m_tofDigiCol = s_staticTofDigiCol;
38
39 if (! s_staticMucDigiCol ){
40 s_staticMucDigiCol = new TObjArray();
41 }
42 m_mucDigiCol = s_staticMucDigiCol;
43
44 if (! s_staticLumiDigiCol ) {
45 s_staticLumiDigiCol = new TObjArray();
46 }
47 m_lumiDigiCol = s_staticLumiDigiCol;
48
49 Clear();
50
51}
52
53//*****************************************************************
55
56 if(m_mdcDigiCol == s_staticMdcDigiCol) s_staticMdcDigiCol = 0;
57 m_mdcDigiCol->Delete();
58 delete m_mdcDigiCol;
59 m_mdcDigiCol = 0;
60
61 if(m_cgemDigiCol == s_staticCgemDigiCol) s_staticCgemDigiCol = 0;
62 m_cgemDigiCol->Delete();
63 delete m_cgemDigiCol;
64 m_cgemDigiCol = 0;
65
66 if(m_emcDigiCol == s_staticEmcDigiCol) s_staticEmcDigiCol = 0;
67 m_emcDigiCol->Delete();
68 delete m_emcDigiCol;
69 m_emcDigiCol = 0;
70
71 if(m_tofDigiCol == s_staticTofDigiCol ) s_staticTofDigiCol = 0;
72 m_tofDigiCol->Delete();
73 delete m_tofDigiCol;
74 m_tofDigiCol = 0;
75
76 if(m_mucDigiCol == s_staticMucDigiCol ) s_staticMucDigiCol = 0;
77 m_mucDigiCol->Delete();
78 delete m_mucDigiCol;
79 m_mucDigiCol = 0;
80
81 if ( m_lumiDigiCol == s_staticLumiDigiCol ) s_staticLumiDigiCol = 0;
82 m_lumiDigiCol->Delete();
83 delete m_lumiDigiCol;
84 m_lumiDigiCol = 0;
85
86}
87
88//*****************************************************************
89void TDigiEvent::initialize(Bool_t fromMc){
90 m_fromMc = fromMc;
91}
92
93//*****************************************************************
94void TDigiEvent::Clear(Option_t *option) {
95 /*
96 const Int_t nd = 20000;
97 static Int_t limit = 100;
98 static Int_t ind=0;
99 static TMdcDigi* keep[nd];
100
101
102 Int_t n = m_mdcDigiCol->GetEntries();
103 if (n>limit) {
104 limit=n+10;
105 if (limit > nd)
106 std::cout << "!!!Warning: limit for TMdcDigi is greater than " << nd << std::endl;
107 for (Int_t j=0;j<ind;j++) delete keep[j];
108 ind = 0;
109 }
110 for (Int_t i=0;i<n;i++) keep[ind+i] = (TMdcDigi*)m_mdcDigiCol->At(i);
111 ind += n;
112 if (ind > nd-limit) {
113 for (Int_t j=0;j<ind;j++) delete keep[j];
114 ind = 0;
115 }
116 m_mdcDigiCol->Clear();
117*/
118}
119
120//*****************************************************************************
121void TDigiEvent::Print(Option_t *option) const {
122 TObject::Print(option);
123 std::cout.precision(2);
124 if (m_mdcDigiCol)
125 std::cout << "Number of TMdcDigis " << m_mdcDigiCol->GetEntries() << std::endl;
126 else
127 std::cout << "Number of TMdcDigis 0" << std::endl;
128
129 if (m_cgemDigiCol)
130 std::cout << "Number of TCgemDigis " << m_cgemDigiCol->GetEntries() << std::endl;
131 else
132 std::cout << "Number of TCgemDigis 0" << std::endl;
133}
134
135/// Mdc
137 m_mdcDigiCol->Add(digi);
138}
139
140const TMdcDigi* TDigiEvent::getMdcDigi(Int_t i) const {
141 if (Int_t(i) >= m_mdcDigiCol->GetEntries())
142 return 0;
143 return (TMdcDigi*)m_mdcDigiCol->At(i);
144}
145/// Cgem
147 m_cgemDigiCol->Add(digi);
148}
149
150const TCgemDigi* TDigiEvent::getCgemDigi(Int_t i) const {
151 if (Int_t(i) >= m_cgemDigiCol->GetEntries())
152 return 0;
153 return (TCgemDigi*)m_cgemDigiCol->At(i);
154}
155///Emc
157 m_emcDigiCol->Add(digi);
158}
159
160const TEmcDigi* TDigiEvent::getEmcDigi( Int_t i) const {
161 if(Int_t(i) >= m_emcDigiCol->GetEntries())
162 return 0;
163 return (TEmcDigi*)m_emcDigiCol->At(i);
164}
165
166///Tof
168 m_tofDigiCol->Add(digi);
169}
170
171
172const TTofDigi* TDigiEvent::getTofDigi(Int_t i) const {
173 if(Int_t(i) >=m_tofDigiCol->GetEntries())
174 return 0;
175 return (TTofDigi*) m_tofDigiCol->At(i);
176}
177
178///Muc
180 m_mucDigiCol->Add(digi);
181}
182
183
184const TMucDigi* TDigiEvent::getMucDigi(Int_t i) const {
185 if(Int_t(i) >=m_mucDigiCol->GetEntries())
186 return 0;
187 return (TMucDigi*) m_mucDigiCol->At(i);
188}
189
190///Lumi
192 m_lumiDigiCol->Add(digi);
193}
194
195const TLumiDigi* TDigiEvent::getLumiDigi(Int_t i) const {
196 if ( i >= m_lumiDigiCol->GetEntries() )
197 return 0;
198 return (TLumiDigi*) m_lumiDigiCol->At(i);
199}
ClassImp(TBossFullEvent) TBossFullEvent
void addMucDigi(TMucDigi *digi)
Add a MucDigi into the MUC Data collection.
void addEmcDigi(TEmcDigi *digi)
Add a TkrDigi into the TKR data collection.
const TMucDigi * getMucDigi(Int_t i) const
retrieve a MucDigi From the collection, using the index into the array
virtual ~TDigiEvent()
void Print(Option_t *option="") const
void initialize(Bool_t fromMc=true)
void Clear(Option_t *option="")
const TMdcDigi * getMdcDigi(Int_t i) const
retrieve a TkrDigi from the collection, using the index into the array
void addTofDigi(TTofDigi *digi)
Add a TofDigi into the TOF Data collection.
const TEmcDigi * getEmcDigi(Int_t i) const
retrieve a EmcDigi from the collection, using the index into the array
void addMdcDigi(TMdcDigi *digi)
Add a TkrDigi into the TKR data collection.
const TLumiDigi * getLumiDigi(Int_t i) const
retrieve a LumiDigi From the collection, using the index into the array
void addLumiDigi(TLumiDigi *digi)
Add a LumiDigi into the MUC Data collection.
const TCgemDigi * getCgemDigi(Int_t i) const
retrieve a TkrDigi from the collection, using the index into the array
const TTofDigi * getTofDigi(Int_t i) const
retrieve a TofDigi From the collection, using the index into the array
void addCgemDigi(TCgemDigi *digi)
Add a TkrDigi into the TKR data collection.