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 143 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 160 of file TRTCalib_bhadd.cxx.

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

◆ ~CompBHist()

CompBHist::~CompBHist ( )

Definition at line 187 of file TRTCalib_bhadd.cxx.

188{
189 delete[] hist;
190}

◆ CompBHist() [2/2]

CompBHist::CompBHist ( const CompBHist & )
delete

Member Function Documentation

◆ GetStat()

int CompBHist::GetStat ( int val)

Definition at line 208 of file TRTCalib_bhadd.cxx.

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

◆ operator=()

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

◆ Print()

int CompBHist::Print ( )

Definition at line 192 of file TRTCalib_bhadd.cxx.

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

◆ Write()

void CompBHist::Write ( ofstream * file)

Definition at line 202 of file TRTCalib_bhadd.cxx.

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

Member Data Documentation

◆ hist

int* CompBHist::hist {}

Definition at line 155 of file TRTCalib_bhadd.cxx.

155{};

◆ id

int CompBHist::id {}

Definition at line 156 of file TRTCalib_bhadd.cxx.

156{};

◆ npop

int CompBHist::npop {}

Definition at line 157 of file TRTCalib_bhadd.cxx.

157{};

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