StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtPedMaker.h
1 
6 /***************************************************************************
7  *
8  * $Id: StFgtPedMaker.h,v 1.2 2014/08/06 11:43:11 jeromel Exp $
9  * Author: S. Gliske, Sept 2011
10  *
11  ***************************************************************************
12  *
13  * Description: Computes the pedistals, with the option of writing
14  * them to disc or (eventually) to the DB.
15  *
16  ***************************************************************************
17  *
18  * $Log: StFgtPedMaker.h,v $
19  * Revision 1.2 2014/08/06 11:43:11 jeromel
20  * Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
21  *
22  * Revision 1.1 2012/01/31 08:52:51 sgliske
23  * StFgtPedMaker moved to StFgtPool
24  *
25  * Revision 1.6 2012/01/26 13:13:11 sgliske
26  * Updated to use StFgtConsts, which
27  * replaces StFgtEnums and StFgtGeomDefs
28  *
29  * Revision 1.5 2012/01/25 11:25:02 sgliske
30  * Added GetCVS tag
31  *
32  * Revision 1.4 2012/01/17 20:08:20 sgliske
33  * Many updates
34  *
35  * Revision 1.3 2011/11/01 18:54:55 sgliske
36  * Updated to correspond with StEvent containers, take 2.
37  *
38  * Revision 1.2 2011/09/22 21:21:06 sgliske
39  * first working version
40  *
41  * Revision 1.1 2011/09/22 14:10:13 sgliske
42  * minor update
43  *
44  *
45  **************************************************************************/
46 
47 #ifndef _ST_FGT_PED_MAKER_
48 #define _ST_FGT_PED_MAKER_
49 
50 #include <string>
51 #include "StMaker.h"
52 class StFgtDbMaker;
53 
54 class StFgtPedMaker : public StMaker {
55  public:
56  // constructors
57  StFgtPedMaker( const Char_t* name = "FgtPedMaker" );
58 
59  // default OK
60  // StFgtPedMaker(const StFgtPedMaker&);
61 
62  // equals operator -- default OK
63  // StFgtPedMaker& operator=(const StFgtPedMaker&);
64 
65  // deconstructor
66  virtual ~StFgtPedMaker();
67 
68  Int_t Init();
69  Int_t Make();
70  Int_t Finish();
71 
72  // modifiers
73  void setToSaveToFile( const Char_t* filename ); // filename == "" forces not to save to file
74  void setTimeBinMask( Short_t mask = 0xFF );
75  void setFgtDbMkrName( std::string& name );
76  void setIsCosmic();
77 
78  // Get CVS
79  virtual const char *GetCVS() const;
80 
81  // to hold sums
82  struct pedData_t {
83  Int_t n;
84  union { // i.e. two names for the same piece of memory
85  Float_t sum;
86  Float_t ped;
87  };
88  union {
89  Float_t sumsq;
90  Float_t RMS;
91  };
92  Float_t fracClose;
93 
94  pedData_t( Int_t nIn=0, Float_t s=0, Float_t ssq=0, Float_t f=0 ) : n(nIn), sum(s), sumsq(ssq), fracClose(f) { /* */ };
95  };
96 
97  protected:
98  // mask for which time bins to save
99  Short_t mTimeBinMask;
100 
101  typedef std::vector< pedData_t > pedDataVec_t;
102 
103  pedDataVec_t mDataVec;
104 
105  // for saving to file
106  std::string mFilename;
107 
108  // functions that actually do the saving
109  Int_t saveToFile();
110 
111  // and for accessing the DB
112  // if name is "", then use naive cosmic setup
113  std::string mDbMkrName;
114  StFgtDbMaker *mFgtDbMkr;
115 
116  // has finished
117  Bool_t mHasFinished;
118 
119  private:
120  friend class StFgtStatusMaker;
121  friend class StFgtPedStatQA;
122 
123  ClassDef(StFgtPedMaker,1);
124 
125 };
126 
127 // inline functions
128 
129 // deconstructor
130 inline StFgtPedMaker::~StFgtPedMaker(){ /* */ };
131 
132 // modifiers
133 inline void StFgtPedMaker::setToSaveToFile( const Char_t* filename ){ mFilename = filename; };
134 inline void StFgtPedMaker::setTimeBinMask( Short_t mask ){ mTimeBinMask = mask; };
135 inline void StFgtPedMaker::setFgtDbMkrName( std::string& name ){ mDbMkrName = name; };
136 inline void StFgtPedMaker::setIsCosmic(){ mDbMkrName = ""; };
137 inline const char *StFgtPedMaker::GetCVS() const {
138  static const char cvs[] = "Tag $Name: $ $Id: StFgtPedMaker.h,v 1.2 2014/08/06 11:43:11 jeromel Exp $ built " __DATE__ " " __TIME__ ;
139  return cvs;
140 }
141 
142 #endif