StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtA2CMaker.h
1 
6 /***************************************************************************
7  *
8  * $Id: StFgtA2CMaker.h,v 1.24 2014/08/06 11:43:09 jeromel Exp $
9  * Author: S. Gliske, Oct 2011
10  *
11  ***************************************************************************
12  *
13  * Description: Converts the ADC value to charge and optionally
14  * removes strips with status not passing the mask. Computing the
15  * charge currently involves
16  *
17  * 1) pedestal subtraction
18  * 2) applying minimum threshold (both fixed and multiples of the pedistal st. err.)
19  * 3) fitting the pulse shape
20  * 3) applying gain
21  *
22  * The status map is applied as follows: status 0x00 is good, all else
23  * is bad. Strips are removed if the status bit anded with the mask
24  * is non-zero. To remove all strips with any status bit set
25  * set the mask to 0xFF. To ignore status, set the mask to 0x00. To remove only
26  * strips with bit 3 set, set the mask to 0x04, etc. Status is
27  * currently only a uchar.
28  *
29  * Strips with no "signal" (as defined by the thresholds) are marked
30  * as no signal, and the strip charge is marked as invalid.
31  *
32  * Strips are only removed from StEvent if the status bit bitwise
33  * anded with the mask is non-zero or if the pedestal value is outside
34  * the possible dynamic range (0-kFgtMaxAdc).
35  *
36  ***************************************************************************
37  *
38  * $Log: StFgtA2CMaker.h,v $
39  * Revision 1.24 2014/08/06 11:43:09 jeromel
40  * Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
41  *
42  * Revision 1.23 2013/03/14 01:45:43 akio
43  * fix some kStFgtNumTimebins -> dynamic local mMaxTimeBin from StFgtCollection
44  * Seed Type 3 & 4 changed, and 5 goone
45  * 3 = 3 timbins in row above thr, tbin0<peak/3, last tbin<peak
46  * 4 = 3 timbins in row above thr, tbin0<peak/3
47  *
48  * Revision 1.22 2012/11/27 17:32:51 akio
49  * Adding option to read ped & status from text file. Default is reading from DB.
50  *
51  * Revision 1.21 2012/11/08 18:28:15 akio
52  * - Split seedTypes3 into raising (kFgtSeedTypes3) and falling (kFgtSeedTypes4)
53  * - Adding new seed Type (kFgtSeedTypes5) with 3 timebins in row above 3 sigma, and not raising nor falling
54  * You can disable this by setLeastRestrictiveSeed(false)
55  * - Charge uncertainty factor can be adjusted by setPedSigFactor4Charge() [default is 1.0]
56  *
57  * Revision 1.20 2012/07/31 20:08:11 jeromel
58  * Changes to make maker compatible with running in chain (was not)
59  *
60  * Revision 1.19 2012/07/06 01:12:17 avossen
61  * implemented scaled pulse finder
62  *
63  * Revision 1.18 2012/07/05 21:39:47 avossen
64  * added flag to allow long pulses
65  *
66  * Revision 1.17 2012/04/13 18:56:56 sgliske
67  * More adjustments based on the review:
68  * - Lastest StEvents from Thomas U.
69  * - StFgtA2CMaker can no longer remove strips other than bad status or bad ped
70  * - other related updates
71  *
72  * Revision 1.16 2012/03/07 17:46:55 sgliske
73  * Added options for not removing strips
74  *
75  * Revision 1.15 2012/03/07 17:09:05 sgliske
76  * code removed from compiling by #ifdef completely removed
77  *
78  * Revision 1.14 2012/03/06 21:21:32 sgliske
79  * Responces to reviewers incoorperated.
80  * White space and comments cleaned up.
81  * Few remaining items offset with #ifdef,
82  * which may get removed before final move to DEV
83  *
84  * Revision 1.13 2012/02/28 19:32:25 avossen
85  * many changes to enable new clustering algo: New strip fields, identification of seed strips, passing neighboring strips, new order in strip collections
86  *
87  * Revision 1.12 2012/01/31 08:26:53 sgliske
88  * cleaned up, and removed need to use setFgtDb.
89  * Now, if not set, will try to find it using
90  * GetMakerInheritsFrom
91  *
92  * Revision 1.11 2012/01/30 21:49:33 avossen
93  * removed references to files
94  *
95  * Revision 1.10 2012/01/30 11:40:04 sgliske
96  * a2cMaker now fits the pulse shape,
97  * strip containers updated
98  *
99  * Revision 1.9 2012/01/30 10:42:22 sgliske
100  * strip containers now contain adc values for
101  * all time bins. Also fixed bug where setType modified the timebin
102  * rather than the type.
103  *
104  * Revision 1.8 2012/01/28 11:22:53 sgliske
105  * changed status check to status map
106  * changed setDb to setFgtDb
107  * cleaned up few other minor things
108  *
109  * Revision 1.7 2012/01/24 06:52:46 sgliske
110  * made status cuts optional
111  * and updated status to a fail condition--
112  * i.e. status == 0x0 is good, otherwise is bad.
113  * WARNING--this may be different than that used at first
114  * in for the cosmic test stand.
115  *
116  * Revision 1.6 2012/01/24 05:54:51 sgliske
117  * changed default name to reflect A2C,
118  * as opposed to old CorMaker
119  *
120  * Revision 1.5 2012/01/06 17:48:00 sgliske
121  * Added requested GetCVS tag
122  *
123  * Revision 1.4 2011/12/01 00:13:23 avossen
124  * included use of db. Note: For DB use it hast to be set with
125  * setDb. Instantiate StFgtDBMaker, get the StFgtDb from the getTables
126  * method and give the pointer to the A2C maker
127  *
128  * Revision 1.3 2011/11/25 20:24:13 ckriley
129  * added statusmaker functionality
130  *
131  * Revision 1.2 2011/11/01 18:46:14 sgliske
132  * Updated to correspond with StEvent containers, take 2.
133  *
134  * Revision 1.1 2011/10/28 14:58:49 sgliske
135  * replacement to StFgtCorAdcMaker
136  *
137  *
138  **************************************************************************/
139 
140 #ifndef _ST_FGT_A2C_MAKER_H_
141 #define _ST_FGT_A2C_MAKER_H_
142 
143 #include <string>
144 #include "StMaker.h"
145 #include "StRoot/StEvent/StFgtStrip.h"
147 
148 class StFgtDb;
149 
150 class StFgtA2CMaker : public StMaker {
151  public:
152  // constructors
153  StFgtA2CMaker( const Char_t* name = "fgtA2CMaker" );
154 
155  // default OK
156  // StFgtA2CMaker(const StFgtA2CMaker&);
157 
158  // deconstructor
159  ~StFgtA2CMaker();
160 
161  // equals operator -- default OK
162  // StFgtA2CMaker& operator=(const StFgtA2CMaker&);
163 
164  Int_t Init();
165  Int_t InitRun(Int_t runumber);
166  Int_t Make();
167 
168  // modifiers
169  void setAbsThres( Float_t thres );
170  void setRelThres( Float_t thres );
171  void setFgtDb( StFgtDb *fgtDb);
172  void doCutBadStatus();
173  void setStatusMask( UChar_t mask );
174  void acceptLongPulses(Bool_t accept );
175  void setClusterThreshold( Float_t threshold );
176  void setPedSigFactor4Charge( Float_t factor);
177  void useLeastRestrictiveSeed(Bool_t v);
178 
179  // reading pedestal from text file. filename="" (default) forces to read from DB
180  void setPedestalFile(const Char_t* filename);
181  void setStatusFile(const Char_t* filename);
182 
183  // cvs tag
184  virtual const char *GetCVS() const
185  {static const char cvs[]="Tag $Name: $ $Id: StFgtA2CMaker.h,v 1.24 2014/08/06 11:43:09 jeromel Exp $ built " __DATE__ " " __TIME__ ; return cvs;}
186 
187  protected:
188  Short_t checkValidPulse(StFgtStrip* pStrip, Float_t ped);
189  // parameters
190  Bool_t mAcceptLongPulses;
191  UChar_t mStatusMask;
192  Float_t mAbsThres, mRelThres,mClusterThreshold,mPedSigFactor4Charge;
193  Bool_t mUseLeastRestrictiveSeed;
194 
195  // for reading pedestal from a text file
196  std::string mPedFilename;
197  Float_t mPed[kFgtNumElecIds],mPedRMS[kFgtNumElecIds];
198  Bool_t mReadPedFile;
199  std::string mStatusFilename;
200  Int_t mStatus[kFgtNumElecIds];
201  Bool_t mReadStatusFile;
202 
203  // pointer to the DB
204  StFgtDb* mDb;
205 
206  private:
207  void readPedFile(Int_t elecId, Float_t &ped, Float_t &pedrms);
208  void readStatusFile(Int_t elecId, UInt_t &status);
209  ClassDef(StFgtA2CMaker,1);
210  int mMaxTimeBin;
211 };
212 
213 // inline functions
214 
215 // deconstructor
216 // inline StFgtA2CMaker::~StFgtA2CMaker(){ /* */ };
217 
218 // modifiers
219 inline void StFgtA2CMaker::acceptLongPulses( Bool_t accept ){ mAcceptLongPulses = accept; };
220 inline void StFgtA2CMaker::setClusterThreshold( Float_t threshold ){ mClusterThreshold = threshold; };
221 inline void StFgtA2CMaker::setAbsThres( Float_t thres ){ mAbsThres = thres; };
222 inline void StFgtA2CMaker::setRelThres( Float_t thres ){ mRelThres = thres; };
223 inline void StFgtA2CMaker::setFgtDb(StFgtDb* db ){ mDb=db; };
224 inline void StFgtA2CMaker::doCutBadStatus(){ mStatusMask = 0xFF; };
225 inline void StFgtA2CMaker::setStatusMask( UChar_t mask ){ mStatusMask = mask; };
226 inline void StFgtA2CMaker::setPedSigFactor4Charge( Float_t factor){ mPedSigFactor4Charge=factor;}
227 inline void StFgtA2CMaker::useLeastRestrictiveSeed(Bool_t v){ mUseLeastRestrictiveSeed=v;}
228 inline void StFgtA2CMaker::setPedestalFile(const Char_t* filename ){ mPedFilename = filename; };
229 inline void StFgtA2CMaker::setStatusFile(const Char_t* filename ){ mStatusFilename = filename; };
230 
231 #endif
void acceptLongPulses(Bool_t accept)
set status mask to some other value
void setRelThres(Float_t thres)
set to below -kFgtMaxAdc (-4096) to skip cut
Int_t Init()
Does nothing else than printing &quot;we are here&quot;.
void doCutBadStatus()
set pointer to StFgtDb
void setFgtDb(StFgtDb *fgtDb)
set to zero to skip cut
Int_t InitRun(Int_t runumber)
Get pointer to fgtDb.
~StFgtA2CMaker()
destructor - really does nothing
void setStatusMask(UChar_t mask)
set status mask to 0xFF, so any bad status is cut
StFgtA2CMaker(const Char_t *name="fgtA2CMaker")
Class constructors - does nothing else than setting name.
Short_t checkValidPulse(StFgtStrip *pStrip, Float_t ped)
Returns true for a valid pulse.