LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
genf::GFBookkeeping Class Reference

#include "GFBookkeeping.h"

Inheritance diagram for genf::GFBookkeeping:

Public Member Functions

void reset ()
 
void setNhits (int n)
 
void bookMatrices (std::string key)
 
void bookGFDetPlanes (std::string key)
 
void bookNumbers (std::string key, double val=0.)
 
void setMatrix (std::string key, unsigned int index, const TMatrixT< Double_t > &mat)
 
void setDetPlane (std::string key, unsigned int index, const GFDetPlane &pl)
 
void setNumber (std::string key, unsigned int index, const double &num)
 
bool getMatrix (std::string key, unsigned int index, TMatrixT< Double_t > &mat) const
 
bool getDetPlane (std::string key, unsigned int index, GFDetPlane &pl) const
 
bool getNumber (std::string key, unsigned int index, double &num) const
 
std::vector< std::string > getMatrixKeys () const
 
std::vector< std::string > getGFDetPlaneKeys () const
 
std::vector< std::string > getNumberKeys () const
 
void addFailedHit (unsigned int)
 
unsigned int hitFailed (unsigned int)
 
unsigned int getNumFailed ()
 
 GFBookkeeping ()
 
 GFBookkeeping (const GFBookkeeping &)
 
virtual ~GFBookkeeping ()
 
void Streamer (TBuffer &)
 
void clearAll ()
 
void clearFailedHits ()
 
void Print (std::ostream &out=std::cout) const
 

Private Member Functions

GFBookkeepingoperator= (const GFBookkeeping &)=delete
 
virtual void Print (Option_t *) const
 

Private Attributes

std::map< std::string, TMatrixT< Double_t > * > fMatrices
 
std::map< std::string, GFDetPlane * > fPlanes
 
std::map< std::string, TMatrixT< Double_t > * > fNumbers
 
std::vector< unsigned int > fFailedHits
 
int fNhits
 

Detailed Description

Definition at line 32 of file GFBookkeeping.h.

Constructor & Destructor Documentation

genf::GFBookkeeping::GFBookkeeping ( )
inline

Definition at line 73 of file GFBookkeeping.h.

73 : fNhits(-1) {}
genf::GFBookkeeping::GFBookkeeping ( const GFBookkeeping bk)

Definition at line 25 of file GFBookkeeping.cxx.

References fFailedHits, fMatrices, fNhits, fNumbers, and fPlanes.

25  : TObject(bk)
26 {
27  fNhits = bk.fNhits;
28  fMatrices = bk.fMatrices; //implicit copy constructor call
29  fNumbers = bk.fNumbers;
30  fPlanes = bk.fPlanes;
31  fFailedHits = bk.fFailedHits;
32 
33  //deep copy
34 
35  std::map<std::string, TMatrixT<Double_t>*>::const_iterator it;
36  std::map<std::string, TMatrixT<Double_t>*>::iterator it_here;
37 
38  it = bk.fMatrices.begin();
39  it_here = fMatrices.begin();
40  while (it != bk.fMatrices.end()) {
41  it_here->second = new TMatrixT<Double_t>[fNhits];
42  for (int i = 0; i < fNhits; ++i) {
43  (it_here->second)[i] = (it->second)[i];
44  }
45  it++;
46  it_here++;
47  }
48 
49  it = bk.fNumbers.begin();
50  it_here = fNumbers.begin();
51  while (it != bk.fNumbers.end()) {
52  it_here->second = new TMatrixT<Double_t>[fNhits];
53  for (int i = 0; i < fNhits; ++i) {
54  (it_here->second)[i] = (it->second)[i];
55  }
56  it++;
57  it_here++;
58  }
59 
62 
63  ip = bk.fPlanes.begin();
64  ip_here = fPlanes.begin();
65  while (ip != bk.fPlanes.end()) {
66  ip_here->second = new genf::GFDetPlane[fNhits];
67  for (int i = 0; i < fNhits; ++i) {
68  (ip_here->second)[i] = ((ip->second)[i]);
69  }
70  ip++;
71  ip_here++;
72  }
73 }
intermediate_table::iterator iterator
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:37
intermediate_table::const_iterator const_iterator
std::map< std::string, TMatrixT< Double_t > * > fNumbers
Definition: GFBookkeeping.h:41
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:42
std::map< std::string, TMatrixT< Double_t > * > fMatrices
Definition: GFBookkeeping.h:36
virtual genf::GFBookkeeping::~GFBookkeeping ( )
inlinevirtual

Definition at line 75 of file GFBookkeeping.h.

References clearAll(), clearFailedHits(), operator=(), Print(), and Streamer().

75 { clearAll(); }

Member Function Documentation

void genf::GFBookkeeping::addFailedHit ( unsigned int  id)

Definition at line 358 of file GFBookkeeping.cxx.

References fFailedHits.

Referenced by setNhits().

359 {
360  fFailedHits.push_back(id);
361 }
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:42
void genf::GFBookkeeping::bookGFDetPlanes ( std::string  key)

Definition at line 208 of file GFBookkeeping.cxx.

References fNhits, and fPlanes.

Referenced by genf::GFDaf::processTrack(), reset(), setNhits(), and Streamer().

209 {
210  if (fNhits < 0) {
211  GFException exc("fNhits not defined", __LINE__, __FILE__);
212  throw exc;
213  }
214  if (fPlanes[key] != NULL) {
215  std::ostringstream ostr;
216  ostr << "The key " << key << " is already occupied in genf::GFBookkeeping::bookGFDetPlanes()";
217  GFException exc(ostr.str(), __LINE__, __FILE__);
218  throw exc;
219  }
220  fPlanes[key] = new genf::GFDetPlane[fNhits];
221 }
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:37
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
void genf::GFBookkeeping::bookMatrices ( std::string  key)

Definition at line 193 of file GFBookkeeping.cxx.

References fMatrices, and fNhits.

Referenced by genf::GFDaf::processTrack(), reset(), setNhits(), and Streamer().

194 {
195  if (fNhits < 0) {
196  GFException exc("fNhits not defined", __LINE__, __FILE__);
197  throw exc;
198  }
199  if (fMatrices[key] != NULL) {
200  std::ostringstream ostr;
201  ostr << "The key " << key << " is already occupied in genf::GFBookkeeping::bookMatrices()";
202  GFException exc(ostr.str(), __LINE__, __FILE__);
203  throw exc;
204  }
205  fMatrices[key] = new TMatrixT<Double_t>[fNhits];
206 }
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
std::map< std::string, TMatrixT< Double_t > * > fMatrices
Definition: GFBookkeeping.h:36
void genf::GFBookkeeping::bookNumbers ( std::string  key,
double  val = 0. 
)

Definition at line 224 of file GFBookkeeping.cxx.

References fNhits, fNumbers, and fPlanes.

Referenced by genf::GFDaf::processTrack(), reset(), setNhits(), and Streamer().

225 {
226  if (fNhits < 0) {
227  GFException exc("fNhits not defined", __LINE__, __FILE__);
228  throw exc;
229  }
230  if (fPlanes[key] != NULL) {
231  std::ostringstream ostr;
232  ostr << "The key " << key << " is already occupied in genf::GFBookkeeping::bookNumbers()";
233  GFException exc(ostr.str(), __LINE__, __FILE__);
234  throw exc;
235  }
236  fNumbers[key] = new TMatrixT<Double_t>[fNhits];
237  for (int i = 0; i < fNhits; ++i) {
238  ((fNumbers[key])[i]).ResizeTo(1, 1);
239  ((fNumbers[key])[i])[0][0] = val;
240  }
241 }
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:37
std::map< std::string, TMatrixT< Double_t > * > fNumbers
Definition: GFBookkeeping.h:41
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
void genf::GFBookkeeping::clearAll ( )

Definition at line 402 of file GFBookkeeping.cxx.

References fMatrices, fNumbers, and fPlanes.

Referenced by reset(), Streamer(), and ~GFBookkeeping().

403 {
404  std::map<std::string, TMatrixT<Double_t>*>::iterator itMat;
405  for (itMat = fMatrices.begin(); itMat != fMatrices.end(); itMat++) {
406  if (itMat->second != NULL) delete[] itMat->second;
407  }
409  for (itPl = fPlanes.begin(); itPl != fPlanes.end(); itPl++) {
410  if (itPl->second != NULL) delete[] itPl->second;
411  }
412  std::map<std::string, TMatrixT<Double_t>*>::iterator itNum;
413  for (itNum = fNumbers.begin(); itNum != fNumbers.end(); itNum++) {
414  if (itNum->second != NULL) delete[] itNum->second;
415  }
416  fMatrices.clear();
417  fPlanes.clear();
418  fNumbers.clear();
419 }
intermediate_table::iterator iterator
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:37
std::map< std::string, TMatrixT< Double_t > * > fNumbers
Definition: GFBookkeeping.h:41
std::map< std::string, TMatrixT< Double_t > * > fMatrices
Definition: GFBookkeeping.h:36
void genf::GFBookkeeping::clearFailedHits ( )

Definition at line 377 of file GFBookkeeping.cxx.

References fFailedHits.

Referenced by genf::GFKalman::fittingPass(), reset(), Streamer(), and ~GFBookkeeping().

378 {
379  fFailedHits.clear();
380 }
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:42
bool genf::GFBookkeeping::getDetPlane ( std::string  key,
unsigned int  index,
genf::GFDetPlane pl 
) const

Definition at line 318 of file GFBookkeeping.cxx.

References fNhits, and fPlanes.

Referenced by Print(), genf::GFDaf::processTrack(), and setNhits().

321 {
322 
323  auto iPlane = fPlanes.find(key);
324  if (iPlane == fPlanes.end()) {
325  std::ostringstream ostr;
326  ostr << "The key " << key << " is unknown in genf::GFBookkeeping::getGFDetPlane()";
327  GFException exc(ostr.str(), __LINE__, __FILE__);
328  throw exc;
329  }
330  if (index >= (unsigned int)fNhits) {
331  std::ostringstream ostr;
332  ostr << "The index " << index << " is out of range in genf::GFBookkeeping::getGFDetPlane()";
333  GFException exc(ostr.str(), __LINE__, __FILE__);
334  throw exc;
335  }
336  pl = iPlane->second[index];
337  return true;
338 }
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:37
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
std::vector< std::string > genf::GFBookkeeping::getGFDetPlaneKeys ( ) const

Definition at line 430 of file GFBookkeeping.cxx.

References fPlanes.

Referenced by Print(), reset(), setNhits(), and Streamer().

431 {
432  std::vector<std::string> keys;
434  for (it = fPlanes.begin(); it != fPlanes.end(); it++) {
435  if (it->second != NULL) keys.push_back(it->first);
436  }
437  return keys;
438 }
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:37
intermediate_table::const_iterator const_iterator
bool genf::GFBookkeeping::getMatrix ( std::string  key,
unsigned int  index,
TMatrixT< Double_t > &  mat 
) const

Definition at line 297 of file GFBookkeeping.cxx.

References fMatrices, and fNhits.

Referenced by Print(), genf::GFDaf::processTrack(), and setNhits().

300 {
301  auto iMatrix = fMatrices.find(key);
302  if (iMatrix == fMatrices.end()) {
303  std::ostringstream ostr;
304  ostr << "The key " << key << " is unknown in genf::GFBookkeeping::getMatrix()";
305  GFException exc(ostr.str(), __LINE__, __FILE__);
306  throw exc;
307  }
308  if (index >= (unsigned int)fNhits) {
309  std::ostringstream ostr;
310  ostr << "The index " << index << " is out of range in genf::GFBookkeeping::getMatrix()";
311  GFException exc(ostr.str(), __LINE__, __FILE__);
312  throw exc;
313  }
314  mat.ResizeTo(iMatrix->second[index]);
315  mat = iMatrix->second[index];
316  return true;
317 }
Float_t mat
Definition: plot.C:38
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
std::map< std::string, TMatrixT< Double_t > * > fMatrices
Definition: GFBookkeeping.h:36
std::vector< std::string > genf::GFBookkeeping::getMatrixKeys ( ) const

Definition at line 421 of file GFBookkeeping.cxx.

References fMatrices.

Referenced by Print(), reset(), setNhits(), and Streamer().

422 {
423  std::vector<std::string> keys;
424  std::map<std::string, TMatrixT<Double_t>*>::const_iterator it;
425  for (it = fMatrices.begin(); it != fMatrices.end(); it++) {
426  if (it->second != NULL) keys.push_back(it->first);
427  }
428  return keys;
429 }
std::map< std::string, TMatrixT< Double_t > * > fMatrices
Definition: GFBookkeeping.h:36
bool genf::GFBookkeeping::getNumber ( std::string  key,
unsigned int  index,
double &  num 
) const

Definition at line 339 of file GFBookkeeping.cxx.

References fNhits, and fNumbers.

Referenced by Print(), genf::GFDaf::processTrack(), and setNhits().

340 {
341  auto iNumber = fNumbers.find(key);
342  if (iNumber == fNumbers.end()) {
343  std::ostringstream ostr;
344  ostr << "The key " << key << " is unknown in genf::GFBookkeeping::getNumber()";
345  GFException exc(ostr.str(), __LINE__, __FILE__);
346  throw exc;
347  }
348  if (index >= (unsigned int)fNhits) {
349  std::ostringstream ostr;
350  ostr << "The index " << index << " is out of range in genf::GFBookkeeping::getNumber()";
351  GFException exc(ostr.str(), __LINE__, __FILE__);
352  throw exc;
353  }
354  num = iNumber->second[index][0][0];
355  return true;
356 }
std::map< std::string, TMatrixT< Double_t > * > fNumbers
Definition: GFBookkeeping.h:41
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
std::vector< std::string > genf::GFBookkeeping::getNumberKeys ( ) const

Definition at line 439 of file GFBookkeeping.cxx.

References fNumbers.

Referenced by Print(), reset(), setNhits(), and Streamer().

440 {
441  std::vector<std::string> keys;
442  std::map<std::string, TMatrixT<Double_t>*>::const_iterator it;
443  for (it = fNumbers.begin(); it != fNumbers.end(); it++) {
444  if (it->second != NULL) keys.push_back(it->first);
445  }
446  return keys;
447 }
std::map< std::string, TMatrixT< Double_t > * > fNumbers
Definition: GFBookkeeping.h:41
unsigned int genf::GFBookkeeping::getNumFailed ( )

Definition at line 363 of file GFBookkeeping.cxx.

References fFailedHits.

Referenced by setNhits().

364 {
365  return fFailedHits.size();
366 }
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:42
unsigned int genf::GFBookkeeping::hitFailed ( unsigned int  id)

Definition at line 368 of file GFBookkeeping.cxx.

References fFailedHits.

Referenced by genf::GFDaf::processTrack(), and setNhits().

369 {
370  unsigned int retVal = 0;
371  for (unsigned int i = 0; i < fFailedHits.size(); ++i) {
372  if (fFailedHits.at(i) == id) { ++retVal; }
373  }
374  return retVal;
375 }
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:42
GFBookkeeping& genf::GFBookkeeping::operator= ( const GFBookkeeping )
privatedelete

Referenced by ~GFBookkeeping().

void genf::GFBookkeeping::Print ( std::ostream &  out = std::cout) const

Definition at line 449 of file GFBookkeeping.cxx.

References fFailedHits, fNhits, getDetPlane(), getGFDetPlaneKeys(), getMatrix(), getMatrixKeys(), getNumber(), getNumberKeys(), n, and genf::GFDetPlane::Print().

Referenced by ~GFBookkeeping().

450 {
451  out << "=============genf::GFBookkeeping::print()==============" << std::endl;
452  out << "-----printing all matrices:------" << std::endl;
453  std::vector<std::string> keys = getMatrixKeys();
454  for (unsigned int i = 0; i < keys.size(); ++i) {
455  out << "key " << keys.at(i) << " has " << fNhits << " entries:" << std::endl;
456  for (int j = 0; j < fNhits; ++j) {
457  TMatrixT<Double_t> m;
458  getMatrix(keys.at(i), j, m);
459  m.Print(); // TODO print the matrix outself
460  }
461  }
462  out << "-----printing all GFDetPlanes:------" << std::endl;
463  keys = getGFDetPlaneKeys();
464  for (unsigned int i = 0; i < keys.size(); ++i) {
465  out << "key " << keys.at(i) << " has " << fNhits << " entries:" << std::endl;
466  for (int j = 0; j < fNhits; ++j) {
468  getDetPlane(keys.at(i), j, p);
469  p.Print(out);
470  }
471  }
472  out << "-----printing all numbers:------" << std::endl;
473  keys = getNumberKeys();
474  for (unsigned int i = 0; i < keys.size(); ++i) {
475  out << "key " << keys.at(i) << " has " << fNhits << " entries:" << std::endl;
476  for (int j = 0; j < fNhits; ++j) {
477  double n(-1111.);
478  getNumber(keys.at(i), j, n);
479  out << n << std::endl;
480  }
481  }
482  out << "-----failed hits:------" << std::endl;
483  for (unsigned int i = 0; i < fFailedHits.size(); ++i) {
484  out << fFailedHits.at(i) << " ";
485  }
486  out << std::endl;
487 }
void Print(std::ostream &out=std::cout) const
Definition: GFDetPlane.cxx:228
bool getNumber(std::string key, unsigned int index, double &num) const
std::vector< std::string > getMatrixKeys() const
std::vector< std::string > getGFDetPlaneKeys() const
bool getMatrix(std::string key, unsigned int index, TMatrixT< Double_t > &mat) const
Char_t n[5]
std::vector< std::string > getNumberKeys() const
bool getDetPlane(std::string key, unsigned int index, GFDetPlane &pl) const
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:42
virtual void genf::GFBookkeeping::Print ( Option_t *  ) const
inlineprivatevirtual

Definition at line 87 of file GFBookkeeping.h.

References GFException::setFatal().

88  {
89  throw GFException(
90  std::string(__func__) + "::Print(Option_t*) not available", __LINE__, __FILE__)
91  .setFatal();
92  }
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
void genf::GFBookkeeping::reset ( )

Definition at line 382 of file GFBookkeeping.cxx.

References bookGFDetPlanes(), bookMatrices(), bookNumbers(), clearAll(), clearFailedHits(), getGFDetPlaneKeys(), getMatrixKeys(), and getNumberKeys().

Referenced by setNhits().

383 {
384  std::vector<std::string> matKeys = getMatrixKeys();
385  std::vector<std::string> planeKeys = getGFDetPlaneKeys();
386  std::vector<std::string> numKeys = getNumberKeys();
387 
388  clearAll();
389  clearFailedHits();
390 
391  for (unsigned int i = 0; i < matKeys.size(); ++i) {
392  bookMatrices(matKeys.at(i));
393  }
394  for (unsigned int i = 0; i < planeKeys.size(); ++i) {
395  bookGFDetPlanes(planeKeys.at(i));
396  }
397  for (unsigned int i = 0; i < numKeys.size(); ++i) {
398  bookNumbers(numKeys.at(i));
399  }
400 }
void bookGFDetPlanes(std::string key)
void bookMatrices(std::string key)
std::vector< std::string > getMatrixKeys() const
std::vector< std::string > getGFDetPlaneKeys() const
void bookNumbers(std::string key, double val=0.)
std::vector< std::string > getNumberKeys() const
void genf::GFBookkeeping::setDetPlane ( std::string  key,
unsigned int  index,
const GFDetPlane pl 
)

Definition at line 262 of file GFBookkeeping.cxx.

References fNhits, and fPlanes.

Referenced by genf::GFDaf::processTrack(), setNhits(), and Streamer().

265 {
266  if (fPlanes[key] == NULL) {
267  std::ostringstream ostr;
268  ostr << "The key " << key << " is unknown in genf::GFBookkeeping::setGFDetPlane()";
269  GFException exc(ostr.str(), __LINE__, __FILE__);
270  throw exc;
271  }
272  if (index >= (unsigned int)fNhits) {
273  std::ostringstream ostr;
274  ostr << "The index " << index << " is out of range in genf::GFBookkeeping::setGFDetPlane()";
275  GFException exc(ostr.str(), __LINE__, __FILE__);
276  throw exc;
277  }
278  (fPlanes[key])[index] = pl;
279 }
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:37
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
void genf::GFBookkeeping::setMatrix ( std::string  key,
unsigned int  index,
const TMatrixT< Double_t > &  mat 
)

Definition at line 243 of file GFBookkeeping.cxx.

References fMatrices, and fNhits.

Referenced by genf::GFDaf::processTrack(), setNhits(), and Streamer().

246 {
247  if (fMatrices[key] == NULL) {
248  std::ostringstream ostr;
249  ostr << "The key " << key << " is unknown in genf::GFBookkeeping::setMatrix()";
250  GFException exc(ostr.str(), __LINE__, __FILE__);
251  throw exc;
252  }
253  if (index >= (unsigned int)fNhits) {
254  std::ostringstream ostr;
255  ostr << "The index " << index << " is out of range in genf::GFBookkeeping::setMatrix()";
256  GFException exc(ostr.str(), __LINE__, __FILE__);
257  throw exc;
258  }
259  (fMatrices[key])[index].ResizeTo(mat);
260  (fMatrices[key])[index] = mat;
261 }
Float_t mat
Definition: plot.C:38
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
std::map< std::string, TMatrixT< Double_t > * > fMatrices
Definition: GFBookkeeping.h:36
void genf::GFBookkeeping::setNumber ( std::string  key,
unsigned int  index,
const double &  num 
)

Definition at line 280 of file GFBookkeeping.cxx.

References fNhits, and fNumbers.

Referenced by genf::GFDaf::processTrack(), setNhits(), and Streamer().

281 {
282  if (fNumbers[key] == NULL) {
283  std::ostringstream ostr;
284  ostr << "The key " << key << " is unknown in genf::GFBookkeeping::setNumber()";
285  GFException exc(ostr.str(), __LINE__, __FILE__);
286  throw exc;
287  }
288  if (index >= (unsigned int)fNhits) {
289  std::ostringstream ostr;
290  ostr << "The index " << index << " is out of range in genf::GFBookkeeping::setNumber()";
291  GFException exc(ostr.str(), __LINE__, __FILE__);
292  throw exc;
293  }
294  ((fNumbers[key])[index])[0][0] = num;
295 }
std::map< std::string, TMatrixT< Double_t > * > fNumbers
Definition: GFBookkeeping.h:41
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
void genf::GFBookkeeping::Streamer ( TBuffer &  R__b)

Definition at line 75 of file GFBookkeeping.cxx.

References bookGFDetPlanes(), bookMatrices(), bookNumbers(), clearAll(), clearFailedHits(), fFailedHits, fMatrices, fNhits, fNumbers, fPlanes, getGFDetPlaneKeys(), getMatrixKeys(), getNumberKeys(), mat, setDetPlane(), setMatrix(), and setNumber().

Referenced by ~GFBookkeeping().

76 {
77 
78  // Stream an object of class GFBookkeeping.
79  if (R__b.IsReading()) {
80 
81  // Version_t R__v = R__b.ReadVersion();
82  TObject::Streamer(R__b);
83 
84  clearAll();
85 
86  R__b >> fNhits;
87 
88  TString s;
89  std::string key;
90  unsigned int nkeys;
91  TMatrixT<Double_t> mat;
93 
94  { //reading matrices
95  R__b >> nkeys;
96  for (unsigned int i = 0; i < nkeys; ++i) {
97  s.Streamer(R__b);
98  key = s.Data();
99  bookMatrices(key);
100  for (int j = 0; j < fNhits; ++j) {
101  mat.Streamer(R__b);
102  setMatrix(key, j, mat);
103  }
104  }
105  } //done reading matrices
106  { //reading planes
107  R__b >> nkeys;
108  for (unsigned int i = 0; i < nkeys; ++i) {
109  s.Streamer(R__b);
110  key = s.Data();
111  bookGFDetPlanes(key);
112  for (int j = 0; j < fNhits; ++j) {
113  pl.Streamer(R__b);
114  setDetPlane(key, j, pl);
115  }
116  }
117  } //done reading planes
118  { //reading numbers
119  R__b >> nkeys;
120  for (unsigned int i = 0; i < nkeys; ++i) {
121  s.Streamer(R__b);
122  key = s.Data();
123  bookNumbers(key);
124  for (int j = 0; j < fNhits; ++j) {
125  mat.Streamer(R__b);
126  setNumber(key, j, mat[0][0]);
127  }
128  }
129  } //done reading numbers
130  { //read failed hits
131  clearFailedHits();
132  unsigned int nFailedHits;
133  R__b >> nFailedHits;
134  unsigned int aFailedHit;
135  for (unsigned int i = 0; i < nFailedHits; ++i) {
136  R__b >> aFailedHit;
137  fFailedHits.push_back(aFailedHit);
138  }
139  } //done reading failed hits
140  }
141  else {
142  // R__b.WriteVersion(genf::GFBookkeeping::IsA());
143  TObject::Streamer(R__b);
144 
145  //write number of hits
146  R__b << fNhits;
147 
148  std::vector<std::string> keys;
149  { //save matrices
150  keys = getMatrixKeys();
151  R__b << (unsigned int)(keys.size());
152  for (unsigned int i = 0; i < keys.size(); ++i) {
153  TString s(keys.at(i));
154  s.Streamer(R__b);
155  for (int j = 0; j < fNhits; ++j) {
156  ((fMatrices[keys.at(i)])[j]).Streamer(R__b);
157  }
158  }
159  }
160  keys.clear();
161  { //save GFDetPlanes
162  keys = getGFDetPlaneKeys();
163  R__b << (unsigned int)(keys.size());
164  for (unsigned int i = 0; i < keys.size(); ++i) {
165  TString s(keys.at(i));
166  s.Streamer(R__b);
167  for (int j = 0; j < fNhits; ++j) {
168  ((fPlanes[keys.at(i)])[j]).Streamer(R__b);
169  }
170  }
171  } //done saving GFDetPlanes
172  keys.clear();
173  { //save numbers
174  keys = getNumberKeys();
175  R__b << (unsigned int)(keys.size());
176  for (unsigned int i = 0; i < keys.size(); ++i) {
177  TString s(keys.at(i));
178  s.Streamer(R__b);
179  for (int j = 0; j < fNhits; ++j) {
180  ((fNumbers[keys.at(i)])[j]).Streamer(R__b);
181  }
182  }
183  } //done saving numbers
184  { //save failedHits
185  R__b << ((unsigned int)fFailedHits.size());
186  for (unsigned int i = 0; i < fFailedHits.size(); ++i) {
187  R__b << fFailedHits.at(i);
188  }
189  } //done saving failed Hits
190  }
191 }
void setDetPlane(std::string key, unsigned int index, const GFDetPlane &pl)
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:37
void setNumber(std::string key, unsigned int index, const double &num)
void setMatrix(std::string key, unsigned int index, const TMatrixT< Double_t > &mat)
void bookGFDetPlanes(std::string key)
Float_t mat
Definition: plot.C:38
std::map< std::string, TMatrixT< Double_t > * > fNumbers
Definition: GFBookkeeping.h:41
void bookMatrices(std::string key)
std::vector< std::string > getMatrixKeys() const
std::vector< std::string > getGFDetPlaneKeys() const
void bookNumbers(std::string key, double val=0.)
std::vector< std::string > getNumberKeys() const
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:42
std::map< std::string, TMatrixT< Double_t > * > fMatrices
Definition: GFBookkeeping.h:36

Member Data Documentation

std::vector<unsigned int> genf::GFBookkeeping::fFailedHits
private
std::map<std::string, TMatrixT<Double_t>*> genf::GFBookkeeping::fMatrices
private
int genf::GFBookkeeping::fNhits
private
std::map<std::string, TMatrixT<Double_t>*> genf::GFBookkeeping::fNumbers
private
std::map<std::string, GFDetPlane*> genf::GFBookkeeping::fPlanes
private

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