StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtA2CMaker.cxx
1 /***************************************************************************
2  *
3  * $Id: StFgtA2CMaker.cxx,v 1.52 2013/03/14 01:45:43 akio Exp $
4  *
5  ***************************************************************************
6  *
7  * Description: See header.
8  *
9  ***************************************************************************
10  *
11  * $Log: StFgtA2CMaker.cxx,v $
12  * Revision 1.52 2013/03/14 01:45:43 akio
13  * fix some kStFgtNumTimebins -> dynamic local mMaxTimeBin from StFgtCollection
14  * Seed Type 3 & 4 changed, and 5 goone
15  * 3 = 3 timbins in row above thr, tbin0<peak/3, last tbin<peak
16  * 4 = 3 timbins in row above thr, tbin0<peak/3
17  *
18  * Revision 1.51 2012/11/27 17:32:51 akio
19  * Adding option to read ped & status from text file. Default is reading from DB.
20  *
21  * Revision 1.50 2012/11/08 18:28:15 akio
22  * - Split seedTypes3 into raising (kFgtSeedTypes3) and falling (kFgtSeedTypes4)
23  * - Adding new seed Type (kFgtSeedTypes5) with 3 timebins in row above 3 sigma, and not raising nor falling
24  * You can disable this by setLeastRestrictiveSeed(false)
25  * - Charge uncertainty factor can be adjusted by setPedSigFactor4Charge() [default is 1.0]
26  *
27  * Revision 1.49 2012/08/02 05:42:05 avossen
28  * removed printout, set accept long pulses as default
29  *
30  * Revision 1.48 2012/08/02 05:41:06 avossen
31  * *** empty log message ***
32  *
33  * Revision 1.47 2012/07/31 20:40:01 jeromel
34  * Agreed with Anselm, changed default param - future should be Db based
35  *
36  * Revision 1.46 2012/07/31 20:08:11 jeromel
37  * Changes to make maker compatible with running in chain (was not)
38  *
39  * Revision 1.45 2012/07/10 21:47:24 avossen
40  * random update
41  *
42  * Revision 1.44 2012/07/06 01:12:17 avossen
43  * implemented scaled pulse finder
44  *
45  * Revision 1.43 2012/07/05 21:49:44 avossen
46  * *** empty log message ***
47  *
48  * Revision 1.42 2012/07/05 21:39:47 avossen
49  * added flag to allow long pulses
50  *
51  * Revision 1.41 2012/06/14 12:36:49 avossen
52  * *** empty log message ***
53  *
54  * Revision 1.40 2012/06/12 19:28:44 avossen
55  * *** empty log message ***
56  *
57  * Revision 1.39 2012/05/10 14:37:19 avossen
58  * modified pulse finder
59  *
60  * Revision 1.38 2012/04/17 17:47:51 avossen
61  * changed seedType3
62  *
63  * Revision 1.37 2012/04/13 18:56:56 sgliske
64  * More adjustments based on the review:
65  * - Lastest StEvents from Thomas U.
66  * - StFgtA2CMaker can no longer remove strips other than bad status or bad ped
67  * - other related updates
68  *
69  * Revision 1.36 2012/03/21 19:25:06 sgliske
70  * fixed bug in changed from geoId to elecId for DB lookups
71  *
72  * Revision 1.35 2012/03/07 18:34:29 sgliske
73  * Missing a few default value in the constructor
74  *
75  * Revision 1.34 2012/03/07 18:07:18 sgliske
76  * StFgtStrip::getClusterSeed() -> StFgtStrip::getClusterSeedType
77  * StFgtStrip::setClusterSeed() -> StFgtStrip::setClusterSeedType
78  *
79  * Revision 1.33 2012/03/07 17:46:55 sgliske
80  * Added options for not removing strips
81  *
82  * Revision 1.32 2012/03/07 17:09:05 sgliske
83  * code removed from compiling by #ifdef completely removed
84  *
85  * Revision 1.31 2012/03/07 15:32:41 sgliske
86  * Last update was commenting out 'strip->setType( 1 );'
87  * But final version should not commented out code,
88  * either real used code or real explanatory comments.
89  * Commented 'strip->setType' has been removed.
90  *
91  * Revision 1.30 2012/03/07 03:57:22 avossen
92  * various updates
93  *
94  * Revision 1.29 2012/03/06 21:21:17 sgliske
95  * Responces to reviewers incoorperated.
96  * White space and comments cleaned up.
97  * Few remaining items offset with #ifdef,
98  * which may get removed before final move to DEV
99  *
100  * Revision 1.28 2012/03/05 16:13:13 avossen
101  * changed maxAdc default to -9999
102  *
103  * Revision 1.27 2012/03/05 03:42:00 avossen
104  * added reset of max adc, so that the max adc contains the max adc after ped substraction
105  *
106  * Revision 1.26 2012/03/01 16:38:13 avossen
107  * implemented tweaks to clustering
108  *
109  * Revision 1.25 2012/02/29 20:29:08 avossen
110  * changes to seed and cluster algo
111  *
112  * Revision 1.24 2012/02/28 19:32:25 avossen
113  * many changes to enable new clustering algo: New strip fields, identification of seed strips, passing neighboring strips, new order in strip collections
114  *
115  * Revision 1.23 2012/02/06 17:18:05 avossen
116  * fixed negative charge clusters
117  *
118  * Revision 1.22 2012/02/02 15:38:58 sgliske
119  * bu fixed: getAdc not in timebin loop
120  *
121  * Revision 1.21 2012/02/01 18:21:51 avossen
122  * changed error on the charge to pedRMS and replaced fit with sum over timebins
123  *
124  * Revision 1.20 2012/02/01 17:56:33 avossen
125  * changed error on the charge to pedRMS and replaced fit with sum over timebins
126  *
127  * Revision 1.19 2012/01/31 11:23:02 sgliske
128  * If no cut on ped, than skip fit.
129  * Still cut based on status mask in either case
130  *
131  * Revision 1.18 2012/01/31 08:26:53 sgliske
132  * cleaned up, and removed need to use setFgtDb.
133  * Now, if not set, will try to find it using
134  * GetMakerInheritsFrom
135  *
136  * Revision 1.17 2012/01/30 21:49:33 avossen
137  * removed references to files
138  *
139  * Revision 1.16 2012/01/30 13:38:38 sgliske
140  * made mistake in last update. Now it is fixed
141  *
142  * Revision 1.15 2012/01/30 13:08:37 sgliske
143  * updated charge uncertainty to include portion from
144  * adc Poisson uncertainty.
145  *
146  * Revision 1.14 2012/01/30 11:40:04 sgliske
147  * a2cMaker now fits the pulse shape,
148  * strip containers updated
149  *
150  * Revision 1.13 2012/01/30 10:42:22 sgliske
151  * strip containers now contain adc values for
152  * all time bins. Also fixed bug where setType modified the timebin
153  * rather than the type.
154  *
155  * Revision 1.12 2012/01/28 20:10:12 avossen
156  * addec cluster uncertainty
157  *
158  * Revision 1.11 2012/01/28 11:22:53 sgliske
159  * changed status check to status map
160  * changed setDb to setFgtDb
161  * cleaned up few other minor things
162  *
163  * Revision 1.10 2012/01/27 13:38:29 sgliske
164  * updated to correspond with new Status/Ped readers,
165  * Now keyed by elecId
166  *
167  * Revision 1.9 2012/01/24 06:52:45 sgliske
168  * made status cuts optional
169  * and updated status to a fail condition--
170  * i.e. status == 0x0 is good, otherwise is bad.
171  * WARNING--this may be different than that used at first
172  * in for the cosmic test stand.
173  *
174  * Revision 1.8 2012/01/24 05:52:13 sgliske
175  * Surrounded printf's with #ifdef,
176  * cleaned up a little whitespace,
177  * added strip->SetType( 1 );
178  *
179  * Revision 1.7 2012/01/04 20:23:02 sgliske
180  * fixed spelling of iDsic to iDisc
181  *
182  * Revision 1.6 2011/12/01 00:13:23 avossen
183  * included use of db. Note: For DB use it hast to be set with setDb.
184  * Instantiate StFgtDBMaker, get the StFgtDb from the getTables method
185  * and give the pointer to the A2C maker
186  *
187  * Revision 1.5 2011/11/25 20:24:13 ckriley
188  * added statusmaker functionality
189  *
190  * Revision 1.4 2011/11/17 18:40:40 sgliske
191  * Bug fixed: need to always call stripCollectionPtr->removeFlagged();
192  * Also implemented check to invalidate strip if weird ped. value
193  *
194  * Revision 1.3 2011/11/04 17:01:06 balewski
195  * added printouts
196  *
197  * Revision 1.2 2011/11/01 18:46:14 sgliske
198  * Updated to correspond with StEvent containers, take 2.
199  *
200  * Revision 1.1 2011/10/28 14:58:49 sgliske
201  * replacement to StFgtCorAdcMaker
202  *
203  *
204  **************************************************************************/
205 
206 #include "StRoot/StEvent/StEvent.h"
207 #include "StRoot/StEvent/StFgtCollection.h"
208 #include "StRoot/StEvent/StFgtStripCollection.h"
209 #include "StRoot/StEvent/StFgtStrip.h"
210 #include "StRoot/StFgtDbMaker/StFgtDbMaker.h"
211 #include "StRoot/StFgtDbMaker/StFgtDb.h"
212 #include "StFgtA2CMaker.h"
213 
215 StFgtA2CMaker::StFgtA2CMaker( const Char_t* name ) : StMaker( name ), mAcceptLongPulses(true),
216  mStatusMask(0xff), mAbsThres(-10000), mRelThres(4.0),mClusterThreshold(1.0),
217  mPedSigFactor4Charge(1.0), mUseLeastRestrictiveSeed(true) ,mReadPedFile(0), mReadStatusFile(0), mDb(0) {
218  // do nothing
219 }
220 
223 {
224  // nothing to do
225 }
226 
227 
230  LOG_INFO << "StFgtA2CMaker::Init we are named " << GetName() << endm;
231  return kStOk;
232 }
233 
235 Int_t StFgtA2CMaker::InitRun(Int_t runumber){
236  Int_t ierr = kStOk;
237 
238  LOG_INFO << "StFgtA2CMaker::InitRun for " << runumber << endm;
239  if( !mDb ){
240  LOG_INFO << "No fgtDb yet, trying to get a hold" << endm;
241  //StFgtDbMaker *fgtDbMkr = static_cast< StFgtDbMaker* >( GetMakerInheritsFrom( "StFgtDbMaker" ) );
242  StFgtDbMaker *fgtDbMkr = static_cast<StFgtDbMaker * >( GetMaker("fgtDb"));
243  if( !fgtDbMkr ){
244  LOG_FATAL << "StFgtDb not provided and error finding StFgtDbMaker" << endm;
245  ierr = kStFatal;
246 
247  } else {
248  mDb = fgtDbMkr->getDbTables();
249 
250  if( !mDb ){
251  LOG_FATAL << "StFgtDb not provided and error retrieving pointer from StFgtDbMaker '"
252  << fgtDbMkr->GetName() << endm;
253  ierr = kStFatal;
254  } else {
255  LOG_INFO << "Got on hold on fgtDb, all OK" << endm;
256  }
257  }
258  }
259  //TString a("dbdump.txt");
260  //mDb->printFgtDumpCSV1(a,1,1);
261  return ierr;
262 }
263 
264 
266  Int_t ierr = kStOk;
267 
268  if( !mDb ){
269  // warning message already given in init,
270  // so just silently skip the event
271  return kStFatal;
272  }
273  // cout <<"in a2cmaker " << endl;
274  StEvent* eventPtr = 0;
275  eventPtr = (StEvent*) GetInputDS("StEvent");
276 
277  if( !eventPtr ) {
278  LOG_ERROR << "Error getting pointer to StEvent from '" << ClassName() << "'" << endm;
279  ierr = kStErr;
280  }
281 
282  StFgtCollection* fgtCollectionPtr = 0;
283 
284  if( eventPtr ) {
285  fgtCollectionPtr=eventPtr->fgtCollection();
286  }
287 
288  if( !fgtCollectionPtr) {
289  LOG_ERROR << "Error getting pointer to StFgtCollection from '" << ClassName() << "'" << endm;
290  ierr = kStErr;
291  }
292 
293  if( !ierr ){
294  mMaxTimeBin=fgtCollectionPtr->getNumTimeBins();
295  if(mMaxTimeBin==0) return 0;
296  for( UInt_t discIdx=0; discIdx<fgtCollectionPtr->getNumDiscs(); ++discIdx ){
297  //cout <<"looking at disc: " << discIdx << endl;
298  StFgtStripCollection *stripCollectionPtr = fgtCollectionPtr->getStripCollection( discIdx );
299  if( stripCollectionPtr ){
300  //cout <<"got strip coll" <<endl;
301  StSPtrVecFgtStrip& stripVec = stripCollectionPtr->getStripVec();
302  StSPtrVecFgtStripIterator stripIter;
303  //cout <<stripVec.size() <<" strips " << endl;
304  for( stripIter = stripVec.begin(); stripIter != stripVec.end(); ++stripIter ){
305  //cout <<" running over strips .. " <<endl;
306  StFgtStrip *strip = *stripIter;
307  Float_t ped = 0, pedErr = 0;
308  if( strip ){
309  Int_t nTbAboveThres = 0;
310 
311  //set max adc back so that the new max adc is set by the adc -ped
312  strip->setMaxAdc(-9999);
313 
314  Int_t rdo, arm, apv, chan;
315  strip->getElecCoords( rdo, arm, apv, chan );
316  Int_t elecId = StFgtGeom::encodeElectronicId( rdo, arm, apv, chan );
317 
318  // sum of adc-ped values
319  Float_t sumC=0;
320 
321  // get the pedestal
322  if(mPedFilename.empty()){
323  ped = mDb->getPedestalFromElecId( elecId );
324  pedErr = mDb->getPedestalSigmaFromElecId( elecId );
325  }else{
326  readPedFile(elecId,ped,pedErr);
327  }
328 
329  strip->setPed(ped);
330  strip->setPedErr(pedErr);
331  //cout <<"we got ped: " << ped << " error: " << pedErr <<endl;
332 
333  if( ped > kFgtMaxAdc || ped < 0 ){
334  strip->setGeoId( -1 ); // flag for removal
335  } else {
336  for( Int_t timebin = 0; timebin < mMaxTimeBin && strip->getGeoId() > -1; ++timebin ){
337  Int_t adc = strip->getAdc( timebin );
338 
339  // subract the ped, and set
340  Int_t adcMinusPed = adc - ped;
341  strip->setAdc(adcMinusPed, timebin );
342 
343  // sum over all (averages out fluctuations), but avoid invalid tb with large negative adc values
344  if( adcMinusPed > -1000)
345  sumC += adcMinusPed;
346 
347  if( (mRelThres && adcMinusPed > mRelThres*pedErr) || (mAbsThres>-kFgtMaxAdc && adcMinusPed > mAbsThres)) {
348  // only add if it is above pedestal, otherwise negative values can be added...
349  ++nTbAboveThres;
350  }
351  }
352  }
353 
354  // if(strip->getGeoId() >=13092 && strip->getGeoId()<=13105)
355  // cout <<"" <<endl;
356 
357  // get gain
358  Double_t gain = mDb->getGainFromElecId( elecId );
359 
360  // set the charge
361  strip->setCharge( sumC/gain );
362  int idebug=0;
363  //if(sumC/gain==4713.0 || sumC/gain==5250.0) {
364  // idebug=1;
365  // printf("charge=%f\n ",sumC/gain);
366  //}
367  // for seven timebins... change to some variable...., but does this actuall make sense for high nTB?? then the
368  // error on the charge is higher than it should be.... (Anselm)
369  strip->setChargeUncert(gain ? mPedSigFactor4Charge*sqrt(7)*pedErr/gain : 10000);
370 
371  // check if any signal here
372  if( !nTbAboveThres && (mRelThres || mAbsThres>-kFgtMaxAdc) ){
373  // No time bins above thresholds for this strip
374  // and thresholds are set, thus no signal
375  strip->setClusterSeedType(kFgtSeedTypeNo);
376 
377  } else if( mRelThres || mAbsThres>-kFgtMaxAdc ){
378  // but if it is +/- n strips from valid pulse, keep it
379  // if(strip->getGeoId() >=13092 && strip->getGeoId()<=13105)
380  // cout <<"checking pulse for geoID: " << strip->getGeoId() <<" adc : " << strip->getAdc(0)<<" " << strip->getAdc(1) <<" " << strip->getAdc(2)<<" " << strip->getAdc(3)<<" " << strip->getAdc(4)<<" " << strip->getAdc(5)<<" " << strip->getAdc(6)<<endl;
381  strip->setClusterSeedType(checkValidPulse(strip, pedErr));
382 
383  } else {
384  strip->invalidateCharge();
385  };
386 
387  if( mStatusMask != 0x0 ){
388  UInt_t status;
389  if(mStatusFilename.empty()){
390  status=mDb->getStatusFromElecId( elecId );
391  }else{
392  readStatusFile(elecId,status);
393  }
394  if( status & mStatusMask )
395  strip->setClusterSeedType(kFgtDeadStrip);
396  }
397 
398  //if(idebug==1){
399  //if(nTbAboveThres>2 && strip->getCharge()>500 && strip->getClusterSeedType()==0)
400  //printf("geoid=%5d %4.1f %4.1f %4.1f %4.1f %4.1f %4.1f %4.1f gain=%3.1f sum=%6.1f pedrms=%6.1f nTbAboveThres=%1d type=%5d\n",
401  // strip->getGeoId(),
402  // strip->getAdc(0)/pedErr,
403  // strip->getAdc(1)/pedErr,
404  // strip->getAdc(2)/pedErr,
405  // strip->getAdc(3)/pedErr,
406  // strip->getAdc(4)/pedErr,
407  // strip->getAdc(5)/pedErr,
408  // strip->getAdc(6)/pedErr,
409  // gain,
410  // strip->getCharge(),
411  // pedErr,
412  // nTbAboveThres,
413  // strip->getClusterSeedType());
414  //}
415 
416  // if(strip->getGeoId() >=13092 && strip->getGeoId()<=13105)
417  // cout <<" seed type is: " << strip->getSeedType() <<endl;
418  }
419 
420  }
421 
422 
423  // always check if any need removed, as it is possible
424  // some ``bad'' strips may have abnormally large st. dev.
425  //this also removes dead strips
426  stripCollectionPtr->removeFlagged();
427  }
428  }
429  }
430 
431  return ierr;
432 }
433 
435 Short_t StFgtA2CMaker::checkValidPulse( StFgtStrip* pStrip, Float_t ped ){
436 
437  if( ped <=0 )
438  return false;
439 
440  Float_t peakAdc = -9999;
441  Int_t leadEdgeBin = -9999;
442  Float_t sumAdc = 0;
443  Int_t numHighBins = 0;
444  Int_t numAlmostHighBins = 0; //3 sigma
445  Int_t numTailHighBins = 0; //2 sigma in the tails
446  Int_t numHighBinsAfterLeadingEdge = 0; //3 sigma
447  Int_t numPlateau = 0;
448  Int_t numMaxPlateau = 0;
449  Float_t prvAdc = -1;
450 
451  if(pStrip->getGeoId()<0) return kFgtSeedTypeNo;
452 
453  for( Int_t timebin = 0; timebin < mMaxTimeBin; ++timebin ) {
454  Float_t adc=pStrip->getAdc(timebin);
455 
456  // to remove seeds where all tbs are high and close together
457  if(prvAdc>0 && fabs(prvAdc-adc)<ped && adc>3*ped) {
458  numPlateau++;
459  }
460 
461  if(numPlateau>numMaxPlateau) {
462  numMaxPlateau=numPlateau;
463  } else {
464  //end of plateau
465  numPlateau=0;
466  }
467 
468  prvAdc=adc;
469 
470  // this excludes the leading edge, don't count if there is a hole after the leading edge
471  // if(leadEdgeBin>=0 && adc>3*ped && (timebin-numHighBinsAfterLeadingEdge)>(leadEdgeBin+1))
472  // numHighBinsAfterLeadingEdge++;
473 
474  sumAdc += adc;
475 
476  if( leadEdgeBin<0 && adc>5*ped )
477  leadEdgeBin=timebin;
478 
479  if(2<=timebin && timebin <=4 && peakAdc<adc)
480  peakAdc = adc;
481  if(2<=timebin && timebin <=4 && adc>5*ped)
482  numHighBins++;
483  if(2<=timebin && timebin <=4 && adc>3*ped)
484  numAlmostHighBins++;
485  if(5<=timebin && timebin <=6)
486  numTailHighBins++;
487  }
488 
489  // deciding on max plateau
490  if(!mAcceptLongPulses)
491  {
492  if(numMaxPlateau>=3) { //means basically 4 because we start counting after the first one
493  //cout <<"not accepting long pulses..." <<endl;
494  return kFgtSeedTypeNo;
495  }
496  }
497 
498 
499 
500  //most restrictive condition
501  if(pStrip->getAdc(0) <3*ped && numHighBins==3 && peakAdc > pStrip->getAdc(6) && numAlmostHighBins>=3 && numHighBinsAfterLeadingEdge>=2) {
502  return kFgtSeedType1;
503  }
504 
505  if(pStrip->getAdc(0) <3*ped && numHighBins==2 && peakAdc > pStrip->getAdc(6)&& numHighBinsAfterLeadingEdge>=2)
506  return kFgtSeedType2;
507 
508  // if(pStrip->getAdc(0) <3*ped && numHighBins==1 && peakAdc > pStrip->getAdc(6)&& numHighBinsAfterLeadingEdge>=1&& numAlmostHighBins>=2)
509 
510 
511  //Akio Adding a requirement that sum is above sqrt(3bins)*5*mClusterThreshold*pedrms
512  if(pStrip->getCharge() < 1.732*mClusterThreshold*5*ped) return kFgtSeedTypeNo;
513 
514  float maxadc=0, adc[kFgtNumTimeBins];
515  int maxt=-1;
516  for( Int_t t=0; t < mMaxTimeBin; t++ ) {
517  adc[t]=pStrip->getAdc(t);
518  if(adc[t]>maxadc) {maxadc=adc[t]; maxt=t;}
519  }
520  if(maxt==0) return kFgtSeedTypeNo; //eaarly pulse
521  if(maxt>=9) return kFgtSeedTypeNo; //late pulse
522  int flag=0;
523  for( Int_t t = 0; t < mMaxTimeBin-2; t++ ) {
524  float thr=mClusterThreshold*5*ped;
525  if(adc[t]>thr && adc[t+1]>thr && adc[t+2]>thr) {flag=1; break;}
526  //found some sort of rising edge
527  //if(adc1 < adc2 && adc2 < adc3) {iseed=10; break;}
528  //falling edge for grossly out of time pulses
529  //if(adc1 > adc2 && adc2 > adc3 && iseed<10) {iseed=9;}
530  // Akio-- adding if charge sum is above x3 threshold
531  //if(pStrip->getCharge()> mClusterThreshold*15*ped && mUseLeastRestrictiveSeed && iseed<9) {iseed=8;} }
532  }
533  if(flag==0) return kFgtSeedTypeNo; //no 3 tbin in row above threshold
534  if(adc[0]>=maxadc/3.0) return kFgtSeedTypeNo; //first timebin is not low enough
535  //we may have a good pulse....
536  if(adc[mMaxTimeBin-1]<maxadc) return kFgtSeedType3; // saw falling edge as well
537  return kFgtSeedType4; //didn't see falling edge... but maybe ok?
538  //switch(iseed){
539  //case 10: return kFgtSeedType3;
540  //case 9: return kFgtSeedType4;
541  //case 8: return kFgtSeedType5;
542  //default: return kFgtSeedTypeNo;
543  //}
544  // cout <<" no seed found! " << endl;
545  // if(pStrip->getGeoId() >=13092 && pStrip->getGeoId()<=13105)
546  // cout <<"nope..." << endl;
547 }
548 
549 void StFgtA2CMaker::readPedFile(Int_t elecid, Float_t &ped, Float_t &pedrms){
550  if(mReadPedFile==0){
551  LOG_INFO << "Reading pedestal from a text file ="<<mPedFilename.data()<<endm;
552  int eid,tbin;
553  float p,s;
554  ifstream file;
555  memset(mPed,0,sizeof(mPed));
556  memset(mPedRMS,0,sizeof(mPedRMS));
557  file.open(mPedFilename.data());
558  if(file.is_open()){
559  while(file.good()){
560  file>>eid>>tbin>>p>>s;
561  LOG_DEBUG<<"Reading Ped: "<<eid<<" "<<tbin<<" "<<p<<" "<<s<<endm;
562  mPed[eid]=p;
563  mPedRMS[eid]=s;
564  }
565  }else{
566  LOG_INFO<<"Reading pedestal from a text file failed"<<endm;
567  }
568  file.close();
569  mReadPedFile=1;
570  }
571  ped=mPed[elecid];
572  pedrms=mPedRMS[elecid];
573 }
574 
575 void StFgtA2CMaker::readStatusFile(Int_t elecid, UInt_t &status){
576  if(mReadStatusFile==0){
577  LOG_INFO << "Reading status from a text file ="<<mStatusFilename.data()<<endm;
578  unsigned int eid,stat;
579  TString statread;
580  ifstream file;
581  memset(mStatus,1,sizeof(mStatus));
582  file.open(mStatusFilename.data());
583  if(file.is_open()){
584  while(file.good()){
585  file>>eid>>statread;
586  statread.Remove(0,2);
587  stat = statread.Atoi();
588  LOG_DEBUG<<"Reading Status: "<<eid<<" "<<stat<<endm;
589  mStatus[eid]=stat;
590  }
591  }else{
592  LOG_INFO<<"Reading status from a text file failed"<<endm;
593  }
594  mReadStatusFile=1;
595  file.close();
596  }
597  status=mStatus[elecid];
598 }
599 
600 ClassImp(StFgtA2CMaker);
Int_t Init()
Does nothing else than printing &quot;we are here&quot;.
Int_t InitRun(Int_t runumber)
Get pointer to fgtDb.
virtual const char * GetName() const
special overload
Definition: StMaker.cxx:237
~StFgtA2CMaker()
destructor - really does nothing
StFgtA2CMaker(const Char_t *name="fgtA2CMaker")
Class constructors - does nothing else than setting name.
Definition: Stypes.h:44
Short_t checkValidPulse(StFgtStrip *pStrip, Float_t ped)
Returns true for a valid pulse.
Definition: Stypes.h:41