EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GFBookkeeping.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GFBookkeeping.h
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) const;
61  bool getDetPlane(std::string key, unsigned int index, GFDetPlane& pl) const;
62  bool getNumber(std::string key, unsigned int index, double& num) const;
63 
64  std::vector< std::string > getMatrixKeys() const;
65  std::vector< std::string > getGFDetPlaneKeys() const;
66  std::vector< std::string > getNumberKeys() const;
67 
68  void addFailedHit(unsigned int);
69  unsigned int hitFailed(unsigned int);
70  unsigned int getNumFailed();
71 
74  virtual ~GFBookkeeping(){clearAll();}
75 
76  void clearAll();
77  void clearFailedHits();
78 
79  void Print(const Option_t* = "") const;
80 
81  private:
82  //protect from call of not yet defined assignement operator
84  return *this;
85  }
86 
87  public:
88  ClassDef(GFBookkeeping,2)
89 
90 };
91 
92 #endif