FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
GFBookkeeping Class Reference

#include <GFBookkeeping.h>

Inheritance diagram for 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 > &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 > &mat)
 
bool getDetPlane (std::string key, unsigned int index, GFDetPlane &pl)
 
bool getNumber (std::string key, unsigned int index, double &num)
 
std::vector< std::string > getMatrixKeys ()
 
std::vector< std::string > getGFDetPlaneKeys ()
 
std::vector< std::string > getNumberKeys ()
 
void addFailedHit (unsigned int)
 
unsigned int hitFailed (unsigned int)
 
unsigned int getNumFailed ()
 
 GFBookkeeping ()
 
 GFBookkeeping (const GFBookkeeping &)
 
virtual ~GFBookkeeping ()
 
void clearAll ()
 
void clearFailedHits ()
 
void Print ()
 

Private Member Functions

GFBookkeepingoperator= (const GFBookkeeping &)
 

Private Attributes

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

Detailed Description

Definition at line 34 of file GFBookkeeping.h.

Constructor & Destructor Documentation

GFBookkeeping::GFBookkeeping ( )
inline

Definition at line 72 of file GFBookkeeping.h.

72 {fNhits=-1;}
GFBookkeeping::GFBookkeeping ( const GFBookkeeping bk)

Definition at line 26 of file GFBookkeeping.cxx.

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

26  : TObject(bk) {
27  fNhits = bk.fNhits;
28  fMatrices = bk.fMatrices; //implicit copy constructor call
29  fNumbers = bk.fNumbers;
30  fPlanes = bk.fPlanes;
32 
33  //deep copy
34 
35  std::map<std::string,TMatrixT<double>*>::const_iterator it;
36  std::map<std::string,TMatrixT<double>*>::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>[fNhits];
42  for(int i=0;i<fNhits;++i){
43  (it_here->second)[i].ResizeTo((it->second)[i]);
44  (it_here->second)[i] = (it->second)[i];
45  }
46  it++;
47  it_here++;
48  }
49 
50  it = bk.fNumbers.begin();
51  it_here = fNumbers.begin();
52  while(it!=bk.fNumbers.end()){
53  it_here->second = new TMatrixT<double>[fNhits];
54  for(int i=0;i<fNhits;++i){
55  (it_here->second)[i].ResizeTo((it->second)[i]);
56  (it_here->second)[i] = (it->second)[i];
57  }
58  it++;
59  it_here++;
60  }
61 
62  std::map<std::string,GFDetPlane*>::const_iterator ip;
63  std::map<std::string,GFDetPlane*>::iterator ip_here;
64 
65  ip = bk.fPlanes.begin();
66  ip_here = fPlanes.begin();
67  while(ip!=bk.fPlanes.end()){
68  ip_here->second = new GFDetPlane[fNhits];
69  for(int i=0;i<fNhits;++i){
70  (ip_here->second)[i] = ((ip->second)[i]);
71  }
72  ip++;
73  ip_here++;
74  }
75 
76 
77 }
Int_t i
Definition: run_full.C:25
Detector plane genfit geometry class.
Definition: GFDetPlane.h:59
std::map< std::string, TMatrixT< double > * > fNumbers
Definition: GFBookkeeping.h:44
std::map< std::string, TMatrixT< double > * > fMatrices
Definition: GFBookkeeping.h:39
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:40
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:45
virtual GFBookkeeping::~GFBookkeeping ( )
inlinevirtual

Definition at line 74 of file GFBookkeeping.h.

References clearAll().

74 {clearAll();}

Member Function Documentation

void GFBookkeeping::addFailedHit ( unsigned int  id)

Definition at line 363 of file GFBookkeeping.cxx.

References fFailedHits.

363  {
364  fFailedHits.push_back( id );
365 }
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:45
void GFBookkeeping::bookGFDetPlanes ( std::string  key)

Definition at line 214 of file GFBookkeeping.cxx.

References fNhits, and fPlanes.

Referenced by GFDaf::copySmoothing(), GFKalman::processTrack(), and reset().

214  {
215  if(fNhits<0){
216  GFException exc("fNhits not defined",__LINE__,__FILE__);
217  throw exc;
218  }
219  if(fPlanes[key] != NULL){
220  std::ostringstream ostr;
221  ostr << "The key " << key
222  << " is already occupied in GFBookkeeping::bookGFDetPlanes()";
223  GFException exc(ostr.str(),__LINE__,__FILE__);
224  throw exc;
225  }
226  fPlanes[key] = new GFDetPlane[fNhits];
227 }
Detector plane genfit geometry class.
Definition: GFDetPlane.h:59
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:40
void GFBookkeeping::bookMatrices ( std::string  key)

Definition at line 199 of file GFBookkeeping.cxx.

References fMatrices, and fNhits.

Referenced by GFDaf::copySmoothing(), GFKalman::processTrack(), and reset().

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

Definition at line 230 of file GFBookkeeping.cxx.

References fNhits, fNumbers, fPlanes, i, and val.

Referenced by reset().

230  {
231  if(fNhits<0){
232  GFException exc("fNhits not defined",__LINE__,__FILE__);
233  throw exc;
234  }
235  if(fPlanes[key] != NULL){
236  std::ostringstream ostr;
237  ostr << "The key " << key
238  << " is already occupied in GFBookkeeping::bookNumbers()";
239  GFException exc(ostr.str(),__LINE__,__FILE__);
240  throw exc;
241  }
242  fNumbers[key] = new TMatrixT<double>[fNhits];
243  for(int i=0;i<fNhits;++i){
244  ((fNumbers[key])[i]).ResizeTo(1,1);
245  ((fNumbers[key])[i])[0][0] = val;
246  }
247 
248 }
Int_t i
Definition: run_full.C:25
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
std::map< std::string, TMatrixT< double > * > fNumbers
Definition: GFBookkeeping.h:44
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:40
void GFBookkeeping::clearAll ( )

Definition at line 405 of file GFBookkeeping.cxx.

References fMatrices, fNumbers, and fPlanes.

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

405  {
406  std::map<std::string, TMatrixT<double>* >::iterator itMat;
407  for(itMat=fMatrices.begin();itMat!=fMatrices.end();itMat++){
408  if(itMat->second!=NULL) delete [] itMat->second;
409  }
410  std::map<std::string, GFDetPlane* >::iterator itPl;
411  for(itPl=fPlanes.begin();itPl!=fPlanes.end();itPl++){
412  if(itPl->second!=NULL) delete [] itPl->second;
413  }
414  std::map<std::string, TMatrixT<double>* >::iterator itNum;
415  for(itNum=fNumbers.begin();itNum!=fNumbers.end();itNum++){
416  if(itNum->second!=NULL) delete [] itNum->second;
417  }
418  fMatrices.clear();
419  fPlanes.clear();
420  fNumbers.clear();
421 }
std::map< std::string, TMatrixT< double > * > fNumbers
Definition: GFBookkeeping.h:44
std::map< std::string, TMatrixT< double > * > fMatrices
Definition: GFBookkeeping.h:39
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:40
void GFBookkeeping::clearFailedHits ( )

Definition at line 381 of file GFBookkeeping.cxx.

References fFailedHits.

Referenced by GFKalman::fittingPass(), and reset().

381  {
382  fFailedHits.clear();
383 }
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:45
bool GFBookkeeping::getDetPlane ( std::string  key,
unsigned int  index,
GFDetPlane pl 
)

Definition at line 323 of file GFBookkeeping.cxx.

References fNhits, and fPlanes.

Referenced by GFDaf::copySmoothing(), GFTools::getBiasedSmoothedData(), GFTools::getSmoothedData(), GFTools::getSmoothingPlane(), and Print().

325  {
326 
327  if(fPlanes[key] == NULL){
328  std::ostringstream ostr;
329  ostr << "The key " << key << " is unknown in GFBookkeeping::getGFDetPlane()";
330  GFException exc(ostr.str(),__LINE__,__FILE__);
331  throw exc;
332  }
333  if(index>=(unsigned int)fNhits){
334  std::ostringstream ostr;
335  ostr << "The index " << index
336  << " is out of range in GFBookkeeping::getGFDetPlane()";
337  GFException exc(ostr.str(),__LINE__,__FILE__);
338  throw exc;
339  }
340  pl = (fPlanes[key])[index];
341  return true;
342 }
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:40
std::vector< std::string > GFBookkeeping::getGFDetPlaneKeys ( )

Definition at line 431 of file GFBookkeeping.cxx.

References fPlanes.

Referenced by Print(), and reset().

431  {
432  std::vector< std::string > keys;
433  std::map<std::string, GFDetPlane* >::iterator it;
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:40
bool GFBookkeeping::getMatrix ( std::string  key,
unsigned int  index,
TMatrixT< double > &  mat 
)

Definition at line 303 of file GFBookkeeping.cxx.

References fMatrices, and fNhits.

Referenced by GFDaf::copySmoothing(), GFTools::getBiasedSmoothedData(), GFTools::getSmoothedData(), and Print().

305  {
306  if(fMatrices[key] == NULL){
307  std::ostringstream ostr;
308  ostr << "The key " << key << " is unknown in GFBookkeeping::getMatrix()";
309  GFException exc(ostr.str(),__LINE__,__FILE__);
310  throw exc;
311  }
312  if(index>=(unsigned int)fNhits){
313  std::ostringstream ostr;
314  ostr << "The index " << index
315  << " is out of range in GFBookkeeping::getMatrix()";
316  GFException exc(ostr.str(),__LINE__,__FILE__);
317  throw exc;
318  }
319  mat.ResizeTo((fMatrices[key])[index]);
320  mat = (fMatrices[key])[index];
321  return true;
322 }
std::map< std::string, TMatrixT< double > * > fMatrices
Definition: GFBookkeeping.h:39
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45
std::vector< std::string > GFBookkeeping::getMatrixKeys ( )

Definition at line 423 of file GFBookkeeping.cxx.

References fMatrices.

Referenced by GFDaf::copySmoothing(), Print(), GFKalman::processTrack(), and reset().

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

Definition at line 343 of file GFBookkeeping.cxx.

References fNhits, and fNumbers.

Referenced by Print().

345  {
346  if(fNumbers[key] == NULL){
347  std::ostringstream ostr;
348  ostr << "The key " << key << " is unknown in GFBookkeeping::getNumber()";
349  GFException exc(ostr.str(),__LINE__,__FILE__);
350  throw exc;
351  }
352  if(index>=(unsigned int)fNhits){
353  std::ostringstream ostr;
354  ostr << "The index " << index
355  << " is out of range in GFBookkeeping::getNumber()";
356  GFException exc(ostr.str(),__LINE__,__FILE__);
357  throw exc;
358  }
359  num = ((fNumbers[key])[index])[0][0];
360  return true;
361 }
int num[96]
Definition: ranlxd.cxx:381
std::map< std::string, TMatrixT< double > * > fNumbers
Definition: GFBookkeeping.h:44
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45
std::vector< std::string > GFBookkeeping::getNumberKeys ( )

Definition at line 439 of file GFBookkeeping.cxx.

References fNumbers.

Referenced by Print(), and reset().

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

Definition at line 367 of file GFBookkeeping.cxx.

References fFailedHits.

367  {
368  return fFailedHits.size();
369 }
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:45
unsigned int GFBookkeeping::hitFailed ( unsigned int  id)

Definition at line 371 of file GFBookkeeping.cxx.

References fFailedHits, and i.

371  {
372  unsigned int retVal = 0;
373  for(unsigned int i=0;i<fFailedHits.size();++i){
374  if(fFailedHits.at(i) == id){
375  ++retVal;
376  }
377  }
378  return retVal;
379 }
Int_t i
Definition: run_full.C:25
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:45
GFBookkeeping& GFBookkeeping::operator= ( const GFBookkeeping )
inlineprivate

Definition at line 83 of file GFBookkeeping.h.

83 {return *this;}
void GFBookkeeping::Print ( )

Definition at line 449 of file GFBookkeeping.cxx.

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

449  {
450  std::cout << "=============GFBookkeeping::print()==============" << std::endl;
451  std::cout << "-----printing all matrices:------" << std::endl;
452  std::vector<std::string> keys = getMatrixKeys();
453  for(unsigned int i=0;i<keys.size();++i){
454  std::cout << "key " << keys.at(i) << " has " << fNhits
455  << " entries:" << std::endl;
456  for(int j=0;j<fNhits;++j){
457  TMatrixT<double> m;
458  getMatrix(keys.at(i),j,m);
459  m.Print();
460  }
461  }
462  std::cout << "-----printing all GFDetPlanes:------" << std::endl;
463  keys = getGFDetPlaneKeys();
464  for(unsigned int i=0;i<keys.size();++i){
465  std::cout << "key " << keys.at(i) << " has " << fNhits
466  << " entries:" << std::endl;
467  for(int j=0;j<fNhits;++j){
468  GFDetPlane p;
469  getDetPlane(keys.at(i),j,p);
470  p.Print();
471  }
472  }
473  std::cout << "-----printing all numbers:------" << std::endl;
474  keys = getNumberKeys();
475  for(unsigned int i=0;i<keys.size();++i){
476  std::cout << "key " << keys.at(i) << " has " << fNhits
477  << " entries:" << std::endl;
478  for(int j=0;j<fNhits;++j){
479  double n(-1111.);
480  getNumber(keys.at(i),j,n);
481  std::cout << n << std::endl;
482  }
483  }
484  std::cout << "-----failed hits:------" << std::endl;
485  for(unsigned int i=0;i<fFailedHits.size();++i){
486  std::cout << fFailedHits.at(i) << " ";
487  }
488  std::cout << std::endl;
489 }
Int_t i
Definition: run_full.C:25
__m128 m
Definition: P4_F32vec4.h:28
Detector plane genfit geometry class.
Definition: GFDetPlane.h:59
int n
std::vector< std::string > getGFDetPlaneKeys()
bool getDetPlane(std::string key, unsigned int index, GFDetPlane &pl)
Double_t p
Definition: anasim.C:58
std::vector< std::string > getMatrixKeys()
std::vector< std::string > getNumberKeys()
bool getNumber(std::string key, unsigned int index, double &num)
bool getMatrix(std::string key, unsigned int index, TMatrixT< double > &mat)
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:45
void Print() const
Definition: GFDetPlane.cxx:238
void GFBookkeeping::reset ( )

Definition at line 385 of file GFBookkeeping.cxx.

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

Referenced by setNhits().

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

Definition at line 268 of file GFBookkeeping.cxx.

References fNhits, and fPlanes.

Referenced by GFDaf::copySmoothing(), and GFKalman::processHit().

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

Definition at line 250 of file GFBookkeeping.cxx.

References fMatrices, and fNhits.

Referenced by GFDaf::copySmoothing(), and GFKalman::processHit().

251  {
252  if(fMatrices[key] == NULL){
253  std::ostringstream ostr;
254  ostr << "The key " << key << " is unknown in GFBookkeeping::setMatrix()";
255  GFException exc(ostr.str(),__LINE__,__FILE__);
256  throw exc;
257  }
258  if(index>=(unsigned int)fNhits){
259  std::ostringstream ostr;
260  ostr << "The index " << index
261  << " is out of range in GFBookkeeping::setMatrix()";
262  GFException exc(ostr.str(),__LINE__,__FILE__);
263  throw exc;
264  }
265  (fMatrices[key])[index].ResizeTo(mat);
266  (fMatrices[key])[index] = mat;
267 }
std::map< std::string, TMatrixT< double > * > fMatrices
Definition: GFBookkeeping.h:39
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45
void GFBookkeeping::setNhits ( int  n)
inline

Definition at line 50 of file GFBookkeeping.h.

References n, and reset().

Referenced by GFDaf::copySmoothing(), and GFKalman::processTrack().

50 {fNhits=n; reset();}
int n
void GFBookkeeping::setNumber ( std::string  key,
unsigned int  index,
const double &  num 
)

Definition at line 285 of file GFBookkeeping.cxx.

References fNhits, fNumbers, and num.

286  {
287  if(fNumbers[key] == NULL){
288  std::ostringstream ostr;
289  ostr << "The key " << key << " is unknown in GFBookkeeping::setNumber()";
290  GFException exc(ostr.str(),__LINE__,__FILE__);
291  throw exc;
292  }
293  if(index>=(unsigned int)fNhits){
294  std::ostringstream ostr;
295  ostr << "The index " << index
296  << " is out of range in GFBookkeeping::setNumber()";
297  GFException exc(ostr.str(),__LINE__,__FILE__);
298  throw exc;
299  }
300  ((fNumbers[key])[index])[0][0] = num;
301 }
int num[96]
Definition: ranlxd.cxx:381
std::map< std::string, TMatrixT< double > * > fNumbers
Definition: GFBookkeeping.h:44
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45

Member Data Documentation

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

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