ATLAS Offline Software
Loading...
Searching...
No Matches
CompBHist Class Reference
Collaboration diagram for CompBHist:

Public Member Functions

 CompBHist (int, const std::vector< int > &, int, int)
 ~CompBHist ()
 CompBHist (const CompBHist &)=delete
CompBHistoperator= (const CompBHist &)=delete
int Print ()
void Write (ofstream *)
int GetStat (int)

Public Attributes

int * hist {}
int id {}
int npop {}

Detailed Description

Definition at line 142 of file TRTCalib_bhadd.cxx.

Constructor & Destructor Documentation

◆ CompBHist() [1/2]

CompBHist::CompBHist ( int sid,
const std::vector< int > & uchist,
int ntbins,
int nrbins )

Definition at line 159 of file TRTCalib_bhadd.cxx.

160{
161
162 id = sid;
163 npop = 0;
164 std::vector<std::vector<int>> tmp(2, std::vector<int>(ntbins * nrbins + 200, 0));
165
166 for (int ibin = 0; ibin < ntbins * nrbins + 200; ibin++)
167 {
168 if (uchist.at(ibin) > 0)
169 {
170 tmp.at(0).at(npop) = ibin;
171 tmp.at(1).at(npop) = uchist.at(ibin);
172 npop++;
173 }
174 }
175
176 hist = new int[npop * 2 + 2];
177 hist[0] = npop;
178 hist[npop * 2 + 1] = id;
179 for (int ipop = 0; ipop < npop; ipop++)
180 {
181 hist[ipop * 2 + 1] = tmp.at(0).at(ipop);
182 hist[ipop * 2 + 2] = tmp.at(1).at(ipop);
183 }
184}

◆ ~CompBHist()

CompBHist::~CompBHist ( )

Definition at line 186 of file TRTCalib_bhadd.cxx.

187{
188 delete[] hist;
189}

◆ CompBHist() [2/2]

CompBHist::CompBHist ( const CompBHist & )
delete

Member Function Documentation

◆ GetStat()

int CompBHist::GetStat ( int val)

Definition at line 207 of file TRTCalib_bhadd.cxx.

208{
209
210 int stat[3];
211 stat[0] = 0;
212 stat[1] = 0;
213 stat[2] = 0;
214
215 for (int ipop = 0; ipop < 2 * npop; ipop = ipop + 2)
216 {
217 if (hist[ipop] < 100)
218 stat[0] += hist[ipop + 1];
219 else if (hist[ipop] >= 100 && hist[ipop] < 200)
220 stat[1] += hist[ipop + 1];
221 else
222 stat[2] += hist[ipop + 1];
223 }
224
225 return stat[val];
226}

◆ operator=()

CompBHist & CompBHist::operator= ( const CompBHist & )
delete

◆ Print()

int CompBHist::Print ( )

Definition at line 191 of file TRTCalib_bhadd.cxx.

192{
193 // for(int ipop=0;ipop<1;ipop++) cout << hist[ipop] << " ";
194 cout << npop << " " << id << " ";
195 for (int ipop = 0; ipop < 2 * npop + 2; ipop++)
196 cout << hist[ipop] << " ";
197 cout << endl;
198 return 0;
199}

◆ Write()

void CompBHist::Write ( ofstream * file)

Definition at line 201 of file TRTCalib_bhadd.cxx.

202{
203 //dangerous cast, reproduces previous c-style cast
204 file->write(reinterpret_cast<char*>(hist), (npop * 2 + 2) * sizeof(int));
205}
TFile * file

Member Data Documentation

◆ hist

int* CompBHist::hist {}

Definition at line 154 of file TRTCalib_bhadd.cxx.

154{};

◆ id

int CompBHist::id {}

Definition at line 155 of file TRTCalib_bhadd.cxx.

155{};

◆ npop

int CompBHist::npop {}

Definition at line 156 of file TRTCalib_bhadd.cxx.

156{};

The documentation for this class was generated from the following file: