FairRoot/PandaRoot
GFBookkeeping.h
Go to the documentation of this file.
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 
21 
22 #ifndef GFBOOKKEEPING_H
23 #define GFBOOKKEEPING_H
24 
25 #include"TObject.h"
26 #include"TMatrixT.h"
27 #include<vector>
28 #include<cassert>
29 #include<iostream>
30 #include<utility>
31 #include<map>
32 #include"GFDetPlane.h"
33 
34 class GFBookkeeping : public TObject {
35  private:
36 
37  //the string keys will in general be different, so this cant
38  //be unified to one container
39  std::map<std::string, TMatrixT<double>* > fMatrices;
40  std::map<std::string, GFDetPlane* > fPlanes;
41  /* this is a work-around: we want to save doubles, but ROOT has problems
42  * with TObjects that contain map<string,double*>. We take a 1x1 matrix
43  * as a work-around to hold the double internally */
44  std::map<std::string, TMatrixT<double>* > fNumbers;
45  std::vector< unsigned int > fFailedHits;
46  int fNhits;
47 
48  public:
49  void reset();
50  void setNhits(int n){fNhits=n; reset();}
51 
52  void bookMatrices(std::string key);
53  void bookGFDetPlanes(std::string key);
54  void bookNumbers(std::string key,double val=0.);
55 
56  void setMatrix(std::string key,unsigned int index,const TMatrixT<double>& mat);
57  void setDetPlane(std::string key,unsigned int index,const GFDetPlane& pl);
58  void setNumber(std::string key,unsigned int index, const double& num);
59 
60  bool getMatrix(std::string key, unsigned int index, TMatrixT<double>& mat) ;
61  bool getDetPlane(std::string key, unsigned int index, GFDetPlane& pl) ;
62  bool getNumber(std::string key, unsigned int index, double& num) ;
63 
64  std::vector< std::string > getMatrixKeys() ;
65  std::vector< std::string > getGFDetPlaneKeys() ;
66  std::vector< std::string > getNumberKeys() ;
67 
68  void addFailedHit(unsigned int);
69  unsigned int hitFailed(unsigned int);
70  unsigned int getNumFailed();
71 
72  GFBookkeeping(){fNhits=-1;}
74  virtual ~GFBookkeeping(){clearAll();}
75 
76  void clearAll();
77  void clearFailedHits();
78 
79  void Print() ;
80 
81  private:
82  //protect from call of net yet defined assignement operator
83  GFBookkeeping& operator=(const GFBookkeeping&){return *this;}
84 
85  public:
86  ClassDef(GFBookkeeping,2)
87 
88 };
89 
90 #endif
unsigned int getNumFailed()
void setNumber(std::string key, unsigned int index, const double &num)
unsigned int hitFailed(unsigned int)
int num[96]
Definition: ranlxd.cxx:381
Detector plane genfit geometry class.
Definition: GFDetPlane.h:59
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
int n
std::vector< std::string > getGFDetPlaneKeys()
bool getDetPlane(std::string key, unsigned int index, GFDetPlane &pl)
void addFailedHit(unsigned int)
void bookGFDetPlanes(std::string key)
void setDetPlane(std::string key, unsigned int index, const GFDetPlane &pl)
void setNhits(int n)
Definition: GFBookkeeping.h:50
std::map< std::string, TMatrixT< double > * > fNumbers
Definition: GFBookkeeping.h:44
std::vector< std::string > getMatrixKeys()
void bookNumbers(std::string key, double val=0.)
std::map< std::string, TMatrixT< double > * > fMatrices
Definition: GFBookkeeping.h:39
std::vector< std::string > getNumberKeys()
void setMatrix(std::string key, unsigned int index, const TMatrixT< double > &mat)
virtual ~GFBookkeeping()
Definition: GFBookkeeping.h:74
void bookMatrices(std::string key)
bool getNumber(std::string key, unsigned int index, double &num)
bool getMatrix(std::string key, unsigned int index, TMatrixT< double > &mat)
std::map< std::string, GFDetPlane * > fPlanes
Definition: GFBookkeeping.h:40
GFBookkeeping & operator=(const GFBookkeeping &)
Definition: GFBookkeeping.h:83
std::vector< unsigned int > fFailedHits
Definition: GFBookkeeping.h:45
void clearFailedHits()