StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtStatusMaker.h
1 /***************************************************************************
2  *
3  * $Id: StFgtStatusMaker.h,v 1.2 2014/08/06 11:43:13 jeromel Exp $
4  * Author: C. K. Riley, Nov 2011 & S. Gliske, Jan 2012
5  *
6  ***************************************************************************
7  *
8  * Description: computes the strip status.
9  *
10  ***************************************************************************
11  *
12  * $Log: StFgtStatusMaker.h,v $
13  * Revision 1.2 2014/08/06 11:43:13 jeromel
14  * Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
15  *
16  * Revision 1.1 2012/01/31 08:59:43 sgliske
17  * moved StFgtStatus maker to StFgtPool
18  *
19  * Revision 1.6 2012/01/28 11:34:34 sgliske
20  * changed the name of the not connected bit to masked out
21  *
22  * Revision 1.5 2012/01/26 13:13:12 sgliske
23  * Updated to use StFgtConsts, which
24  * replaces StFgtEnums and StFgtGeomDefs
25  *
26  * Revision 1.4 2012/01/25 11:25:10 sgliske
27  * Added GetCVS tag
28  *
29  * Revision 1.3 2012/01/18 18:07:35 sgliske
30  * directly use elec coord domian--no geoIds
31  *
32  * Revision 1.2 2012/01/17 20:13:12 sgliske
33  * Completely new system, based on pedestal and RMS values.
34  *
35  * Revision 1.1 2011/11/25 20:22:37 ckriley
36  * creation of statusmaker
37  *
38  *
39  *
40  **************************************************************************/
41 
42 #ifndef _ST_FGT_STATUS_MAKER_
43 #define _ST_FGT_STATUS_MAKER_
44 
45 #include <string>
46 #include "StMaker.h"
47 #include "StRoot/StFgtUtil/StFgtConsts.h"
48 class StFgtPedMaker;
49 
50 class StFgtStatusMaker : public StMaker {
51  public:
52  // enum of status bits
53  enum { PED_OUT_OF_RANGE = 0, RMS_OUT_OF_RANGE = 1, FRAC_OUT_OF_RANGE = 2, APV_DEAD = 4,
54  MASKED_OUT = 5, INVALID_ID = 6 };
55 
56  // constructors
57  StFgtStatusMaker( const Char_t* name = "FgtStatusMaker", const Char_t* pedMakerName = "FgtPedMaker" );
58 
59  // default OK
60  // StFgtStatusMaker(const StFgtStatusMaker&);
61 
62  // equals operator -- default OK
63  // StFgtStatusMaker& operator=(const StFgtStatusMaker&);
64 
65  // deconstructor
66  virtual ~StFgtStatusMaker();
67 
68  Int_t Init();
69  Int_t Finish();
70 
71  // Int_t Make(); No make--just uses output from StFgtPedMaker
72 
73 
74  // modifiers
75  void setToSaveToFile( const Char_t* filename ); // filename == "" forces not to save to file
76  void setTimeBin( Short_t timeBin = 2 ); // only uses the pedestals from one time bin
77  void setPedRange( Float_t min, Float_t max );
78  void setRmsRange( Float_t min, Float_t max );
79  void setFracRange( Float_t min, Float_t max );
80  void setMaxDeadPerApv( Float_t max );
81 
82  // Get CVS
83  virtual const char *GetCVS() const;
84 
85  typedef UChar_t status_t;
86 
87  struct apvData_t {
88  Int_t numDead;
89  std::vector< status_t* > stripStatusVec;
90 
91  apvData_t() : numDead( kFgtNumChannels ) { /* */ }; // Default to 128, i.e. all dead
92  };
93 
94  protected:
95  // for the ped maker
96  std::string mPedMkrName;
97  StFgtPedMaker *mPedMkr;
98 
99  // which time bins to use
100  Short_t mTimeBin;
101 
102  // for saving to file
103  std::string mFilename;
104 
105  // parameters
106  Float_t mMinPed, mMaxPed, mMinRMS, mMaxRMS, mMinFrac, mMaxFrac;
107  Int_t mMaxDead;
108 
109  // function that actually does the saving
110  Int_t saveToFile();
111 
112  // internal data
113  typedef std::vector< apvData_t > apvDataVec_t;
114 
115  status_t* mStatus;
116 
117  // to count number of dead strips per APV
118  apvDataVec_t mApvData;
119 
120  // if has finished
121  Bool_t mHasFinished;
122 
123  private:
124  friend class StFgtPedStatQA;
125 
126  ClassDef(StFgtStatusMaker,1);
127 };
128 
129 // inline functions
130 
131 // modifiers
132 inline void StFgtStatusMaker::setToSaveToFile( const Char_t* filename ){ mFilename = filename; };
133 inline void StFgtStatusMaker::setTimeBin( Short_t bin ){ mTimeBin = bin; };
134 
135 inline void StFgtStatusMaker::setPedRange( Float_t min, Float_t max ){ mMinPed = min; mMaxPed = max; };
136 inline void StFgtStatusMaker::setRmsRange( Float_t min, Float_t max ){ mMinRMS = min; mMaxRMS = max; };
137 inline void StFgtStatusMaker::setFracRange( Float_t min, Float_t max ){ mMinFrac = min; mMaxFrac = max; };
138 inline void StFgtStatusMaker::setMaxDeadPerApv( Float_t max ){ mMaxDead = max; };
139 inline const char *StFgtStatusMaker::GetCVS() const {
140  static const char cvs[] = "Tag $Name: $ $Id: StFgtStatusMaker.h,v 1.2 2014/08/06 11:43:13 jeromel Exp $ built " __DATE__ " " __TIME__ ;
141  return cvs;
142 }
143 
144 #endif