StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSvtPedMaker.cxx
1 /***************************************************************************
2  *
3  * $Id: StSvtPedMaker.cxx,v 1.10 2007/04/28 17:57:03 perev Exp $
4  *
5  * Author: Marcelo Munhoz
6  ***************************************************************************
7  *
8  * Description: SVT Pedestal calculation Maker
9  *
10  ***************************************************************************
11  *
12  * $Log: StSvtPedMaker.cxx,v $
13  * Revision 1.10 2007/04/28 17:57:03 perev
14  * Redundant StChain.h removed
15  *
16  * Revision 1.9 2007/04/20 17:26:31 caines
17  * Removing print statements
18  *
19  * Revision 1.8 2004/01/26 23:12:55 perev
20  * Leak off
21  *
22  * Revision 1.7 2003/12/01 00:53:10 caines
23  * Dont follow zero pointer if raw data not there
24  *
25  * Revision 1.6 2003/12/01 00:19:43 caines
26  * Version of pedestal maker to go with EMbedding
27  *
28  * Revision 1.5 2003/07/18 18:31:49 perev
29  * test for nonexistance of XXXReader added
30  *
31  * Revision 1.4 2001/10/24 16:47:52 munhoz
32  * adding RMS methods
33  *
34  * Revision 1.3 2001/07/11 23:30:47 munhoz
35  * modification to allow pedestal reading from daq file
36  *
37  * Revision 1.2 2000/11/30 20:32:02 caines
38  * Use MessMgr
39  *
40  * Revision 1.1 2000/08/23 13:08:12 munhoz
41  * SVT pedestal calculation
42  *
43  *
44  **************************************************************************/
45 
46 #include "TH2.h"
47 #include "TFile.h"
48 #include "TKey.h"
49 #include "StSvtPedMaker.h"
50 #include "St_DataSetIter.h"
51 #include "TObjectSet.h"
52 #include "StMessMgr.h"
53 #include "StarClassLibrary/StSequence.hh"
54 #include "StSvtClassLibrary/StSvtHybridData.hh"
55 #include "StSvtClassLibrary/StSvtHybridCollection.hh"
56 #include "StSvtClassLibrary/StSvtData.hh"
57 #include "StSvtClassLibrary/StSvtHybridPed.hh"
58 #include "StSvtClassLibrary/StSvtHybridPixels2.hh"
59 #include "StSvtClassLibrary/StSvtHybridStat.hh"
60 #include "StSvtClassLibrary/StSvtHybridStat2.hh"
61 #include "StSvtClassLibrary/StSvtConfig.hh"
62 #include "StSvtDaqMaker/StSvtHybridDaqPed.hh"
63 
64 ClassImp(StSvtPedMaker)
65 
66 //_____________________________________________________________________________
67  StSvtPedMaker::StSvtPedMaker(const char *name, pedestalType type):StMaker(name)
68 {
69  fType = type;
70 
71  fStat = NULL;
72  fPed = NULL;
73  fPedRms = NULL;
74  fData = NULL;
75 
76  fSvtStat = NULL;
77  fSvtStat2 = NULL;
78  fSvtPed = NULL;
79  fSvtPedRms= NULL;
80  fSvtData = NULL;
81  mConfig = NULL;
82 }
83 
84 //______________________________________________________________________________
85 StSvtPedMaker::~StSvtPedMaker()
86 {
87  delete fStat;
88 
89  delete fPed;
90  delete fPedRms;
91  delete fData;
92 
93  delete fSvtStat;
94  delete fSvtStat2;
95  // delete fSvtPed;
96  //delete fSvtData;
97 }
98 
99 //_____________________________________________________________________________
100 Int_t StSvtPedMaker::Init()
101 {
102  //cout << "StSvtPedMaker::Init" << endl;
103 
104  SetSvtData();
105  getConfig();
106 
107  SetSvtPed();
108 
109  SetSvtRMSPed();
110 
111  return StMaker::Init();
112 }
113 
114 //____________________________________________________________________________
115 Int_t StSvtPedMaker::getConfig()
116 {
117  mConfig=NULL;
118  St_DataSet *dataSet = NULL;
119  dataSet = GetDataSet("StSvtConfig");
120 
121  if (!dataSet)
122  {
123  gMessMgr->Warning() << " No SvtConfig data set" << endm;
124  dataSet = new St_ObjectSet("StSvtConfig");
125  AddConst(dataSet);
126  mConfig=NULL;
127  }
128 
129  mConfig=((StSvtConfig*)(dataSet->GetObject()));
130 
131  if (!mConfig) {
132  gMessMgr->Warning() << "SvtConfig data set is empty- using raw data"<< endm;
133  mConfig=new StSvtConfig();
134 
135  if (!fSvtData) //this should not be used- for backward compatibility
136  {
137  gMessMgr->Warning() << "no raw data -seting default full configuration" << endm;
138  mConfig->setConfiguration("FULL");
139  } else mConfig->setConfiguration(fSvtData->getConfiguration());
140 
141  dataSet->SetObject(mConfig);
142  }
143 
144 
145 
146  return kStOK;
147 }
148 
149 
150 //_____________________________________________________________________________
151 Int_t StSvtPedMaker::SetType(pedestalType option)
152 {
153  fType = option;
154 
155  ResetStat();
156  ResetPed();
157 
158  return Init();
159 }
160 
161 //_____________________________________________________________________________
162 Int_t StSvtPedMaker::SetSvtData()
163 {
164  St_DataSet *dataSet;
165 
166  dataSet = GetDataSet("StSvtRawData");
167  //assert(dataSet);
168  if( dataSet) fSvtData = (StSvtData*)(dataSet->GetObject());
169  //assert(fSvtData);
170 
171  return kStOK;
172 }
173 
174 //_____________________________________________________________________________
175 Int_t StSvtPedMaker::SetSvtPed()
176 {
177  fSvtStat = new StSvtHybridCollection(mConfig->getConfiguration());
178 
179  St_DataSet *dataSet;
180  dataSet = (TObjectSet*)GetDataSet("StSvtPedestal");
181 
182  if (!dataSet) {
183  fPedSet = new TObjectSet("StSvtPedestal");
184  AddConst(fPedSet);
185 
186  fSvtPed = new StSvtHybridCollection(mConfig->getConfiguration());
187  fPedSet->SetObject((TObject*)fSvtPed);
188  assert(fSvtPed);
189  }
190  else {
191  fSvtPed = (StSvtHybridCollection*)(dataSet->GetObject());
192  assert(fSvtPed);
193  }
194 
195  return kStOK;
196 }
197 
198 //_____________________________________________________________________________
199 Int_t StSvtPedMaker::SetSvtPed2ndOrd()
200 {
201  fSvtStat2 = new StSvtHybridCollection(mConfig->getConfiguration());
202 
203  fPedSet2 = new TObjectSet("StSvtPedestal2ndOrd");
204  AddConst(fPedSet2);
205 
206  fSvtPed2 = new StSvtHybridCollection(mConfig->getConfiguration());
207  fPedSet2->SetObject((TObject*)fSvtPed2);
208 
209  return kStOK;
210 }
211 
212 //_____________________________________________________________________________
213 Int_t StSvtPedMaker::SetSvtRMSPed()
214 {
215  St_DataSet *dataSet;
216  dataSet = (TObjectSet*)GetDataSet("StSvtRMSPedestal");
217 
218  if (!dataSet) {
219  fPedRmsSet = new TObjectSet("StSvtRMSPedestal");
220  AddConst(fPedRmsSet);
221 
222  fSvtPedRms = new StSvtHybridCollection(mConfig->getConfiguration());
223  fPedRmsSet->SetObject((TObject*)fSvtPedRms);
224  assert(fSvtPedRms);
225  }
226  else {
227  fSvtPedRms = (StSvtHybridCollection*)(dataSet->GetObject());
228  assert(fSvtPedRms);
229  }
230 
231  return kStOK;
232 }
233 
234 //_____________________________________________________________________________
236 {
237  if (Debug()) gMessMgr->Debug() << "StSvtPedMaker::Make" << endm;
238 
239  return kStOK;
240 }
241 
242 //_____________________________________________________________________________
243 Int_t StSvtPedMaker::AddStat()
244 {
245  if (Debug()) gMessMgr->Debug() << "StSvtPedMaker::AddStat" << endm;
246 
247  int anodeID, nAnodes, nSeq, iseq, time, timeSeq, status;
248  int capacitor, nSCAZero;
249  int* anodeList;
250  StSequence* Seq;
251  int previousBin, nextBin, timeCap0th;
252 
253  for (int barrel = 1;barrel <= fSvtData->getNumberOfBarrels();barrel++) {
254  for (int ladder = 1;ladder <= fSvtData->getNumberOfLadders(barrel);ladder++) {
255  for (int wafer = 1;wafer <= fSvtData->getNumberOfWafers(barrel);wafer++) {
256  for (int hybrid = 1;hybrid <= fSvtData->getNumberOfHybrids();hybrid++) {
257 
258  // check if the hybrid is part of the SVT
259  if (fSvtData->getHybridIndex(barrel, ladder, wafer, hybrid) < 0) continue;
260 
261  fData = (StSvtHybridData*)fSvtData->at(fSvtData->getHybridIndex(barrel, ladder, wafer, hybrid));
262 
263  if (!fData) continue;
264 
265  nSCAZero = fData->getSCAZero();
266 
267  // Calculate time bin of capacitor = 0
268  timeCap0th = 128 - nSCAZero;
269  if (timeCap0th == 128)
270  timeCap0th = 0;
271 
272  // and time bin of capacitor = 127
273  if (timeCap0th == 0)
274  previousBin = 127;
275  else
276  previousBin = timeCap0th - 1;
277 
278  // and time bin of capacitor = 1
279  if (timeCap0th == 127)
280  nextBin = 0;
281  else
282  nextBin = timeCap0th + 1;
283 
284  /*
285  //Skip events where the capacitor number of 0th time bin is wrong
286  status = fData->getSequences(120,nSeq,Seq);
287 
288  if ((timeCap0th != 1) && (timeCap0th != 2))
289  if (((int)Seq[0].firstAdc[previousBin]) > ((int)Seq[0].firstAdc[timeCap0th])) {
290  return kStOK;
291  }
292  */
293 
294  int idx = fSvtStat->getHybridIndex(barrel, ladder, wafer, hybrid);
295  fStat = (StSvtHybridStat*)fSvtStat->at(idx);
296  if (!fStat) {
297  fStat = new StSvtHybridStat(barrel, ladder, wafer, hybrid);
298  fSvtStat->put_at(fStat,idx);
299  }
300 
301  anodeList = NULL;
302  nAnodes = fData->getAnodeList(anodeList);
303 
304  for (int ianode=0;ianode<nAnodes;ianode++) {
305 
306  anodeID = anodeList[ianode];
307  Seq = NULL;
308  nSeq = 0;
309 
310  status = fData->getSequences(anodeID,nSeq,Seq);
311 
312  for (iseq=0;iseq<nSeq;iseq++) {
313  for (timeSeq=0; timeSeq<Seq[iseq].length; timeSeq++) {
314 
315  time = Seq[iseq].startTimeBin + timeSeq;
316 
317  if ( fType == kCapacitor ) {
318  // Exclude first two time bins from capacitor-related pedestal calculation
319  if ((time == 0) || (time == 1)) continue;
320 
321  capacitor = time + nSCAZero;
322  if (capacitor > 127)
323  capacitor -= 128;
324 
325  fStat->fillMom((int)Seq[iseq].firstAdc[timeSeq],anodeID,capacitor);
326 
327  }
328  else if ( fType == kTime ) {
329  // Exclude last and first capacitors from time bin-related pedestal calculation
330  if ((time == previousBin) || (time == timeCap0th) || (time == nextBin)) continue;
331 
332  fStat->fillMom((int)Seq[iseq].firstAdc[timeSeq],anodeID,time);
333  }
334  }
335  }
336  }
337  }
338  }
339  }
340  }
341 
342  return kStOK;
343 }
344 
345 //_____________________________________________________________________________
346 Int_t StSvtPedMaker::AddStat2ndOrd()
347 {
348  int anodeID, nAnodes, nSeq, iseq, time, timeSeq, status;
349  int capacitor, nSCAZero;
350  int* anodeList;
351  StSequence* Seq;
352  int previousBin, nextBin, timeCap0th;
353 
354  for (int barrel = 1;barrel <= fSvtData->getNumberOfBarrels();barrel++) {
355  for (int ladder = 1;ladder <= fSvtData->getNumberOfLadders(barrel);ladder++) {
356  for (int wafer = 1;wafer <= fSvtData->getNumberOfWafers(barrel);wafer++) {
357  for (int hybrid = 1;hybrid <= fSvtData->getNumberOfHybrids();hybrid++) {
358 
359  // check if the hybrid is part of the SVT
360  if (fSvtData->getHybridIndex(barrel, ladder, wafer, hybrid) < 0) continue;
361 
362  fData = (StSvtHybridData*)fSvtData->at(fSvtData->getHybridIndex(barrel, ladder, wafer, hybrid));
363 
364  if (!fData) continue;
365 
366  nSCAZero = fData->getSCAZero();
367 
368  // Calculate time bin of capacitor = 0
369  timeCap0th = 128 - nSCAZero;
370  if (timeCap0th == 128)
371  timeCap0th = 0;
372 
373  // and time bin of capacitor = 127
374  if (timeCap0th == 0)
375  previousBin = 127;
376  else
377  previousBin = timeCap0th - 1;
378 
379  // and time bin of capacitor = 1
380  if (timeCap0th == 127)
381  nextBin = 0;
382  else
383  nextBin = timeCap0th + 1;
384 
385  /*
386  //Skip events where the capacitor number of 0th time bin is wrong
387  status = fData->getSequences(120,nSeq,Seq);
388 
389  if ((timeCap0th != 1) && (timeCap0th != 2))
390  if (((int)Seq[0].firstAdc[previousBin]) > ((int)Seq[0].firstAdc[timeCap0th])) {
391  test[129] += 7;
392  return kStOK;
393  }
394  // end of skip
395  */
396 
397  int idx = fSvtStat2->getHybridIndex(barrel, ladder, wafer, hybrid);
398  fStat2 = (StSvtHybridStat2*)fSvtStat2->at(idx);
399  if (!fStat2) {
400  fStat2 = new StSvtHybridStat2(barrel, ladder, wafer, hybrid);
401  fSvtStat2->put_at(fStat2,idx);
402  }
403 
404  anodeList = NULL;
405  nAnodes = fData->getAnodeList(anodeList);
406 
407  for (int ianode=0;ianode<nAnodes;ianode++) {
408 
409  anodeID = anodeList[ianode];
410  Seq = NULL;
411  nSeq = 0;
412 
413  status = fData->getSequences(anodeID,nSeq,Seq);
414 
415  for (iseq=0;iseq<nSeq;iseq++) {
416  for (timeSeq=0; timeSeq<Seq[iseq].length; timeSeq++) {
417 
418  time = Seq[iseq].startTimeBin + timeSeq;
419 
420  capacitor = time + nSCAZero;
421  if (capacitor > 127)
422  capacitor -= 128;
423 
424  // Exclude first two time bins from capacitor-related pedestal calculation and
425  // last and first capacitors from time bin-related pedestal calculation
426  if ((time == 0) || (time == 1) ||
427  (time == previousBin) || (time == timeCap0th) || (time == nextBin)) continue;
428  fStat2->fillMom((int)Seq[iseq].firstAdc[timeSeq],anodeID,time,capacitor);
429  }
430  }
431  }
432  }
433  }
434  }
435  }
436 
437  return kStOK;
438 }
439 
440 //_____________________________________________________________________________
441 Int_t StSvtPedMaker::CalcPed()
442 {
443  if (Debug()) gMessMgr->Debug() << "StSvtPedMaker::CalcPed" << endm;
444 
445  float rms = 0;
446 
447  for (int barrel = 1;barrel <= fSvtData->getNumberOfBarrels();barrel++) {
448  for (int ladder = 1;ladder <= fSvtData->getNumberOfLadders(barrel);ladder++) {
449  for (int wafer = 1;wafer <= fSvtData->getNumberOfWafers(barrel);wafer++) {
450  for (int hybrid = 1;hybrid <= fSvtData->getNumberOfHybrids();hybrid++) {
451 
452  if (fSvtData->getHybridIndex(barrel, ladder, wafer, hybrid) < 0) continue;
453  fStat = (StSvtHybridStat*)fSvtStat->at(fSvtStat->getHybridIndex(barrel, ladder, wafer, hybrid));
454  if (!fStat) continue;
455 
456  int idxPed = fSvtPed->getHybridIndex(barrel, ladder, wafer, hybrid);
457  fPed = (StSvtHybridPed*)fSvtPed->at(idxPed);
458 
459  if (!fPed) {
460  fPed = new StSvtHybridPed(barrel, ladder, wafer, hybrid);
461  fPed->setType(fType);
462  fSvtPed->put_at(fPed,idxPed);
463  }
464 
465  int idxRms=0;
466  if (fSvtPedRms) {
467  idxRms = fSvtPedRms->getHybridIndex(barrel, ladder, wafer, hybrid);
468  fPedRms = (StSvtHybridPixels*)fSvtPedRms->at(idxRms);
469  if (!fPedRms) {
470  fPedRms = new StSvtHybridPixels(barrel, ladder, wafer, hybrid);
471  fSvtPedRms->put_at(fPedRms,idxRms);
472  }
473  }
474 
475 
476  for (int anode=1; anode<=fPed->getNumberOfAnodes();anode++) {
477  for (int time=0; time<fPed->getNumberOfTimeBins();time++) {
478 
479  fPed->AddAt(fStat->getMean(anode,time),fPed->getPixelIndex(anode,time));
480  //if ((anode == 120) && (time == 64))
481  // cout << fPed->getPixelContent(anode,time) << endl;
482  rms += fStat->getRMS(anode,time);
483 
484  if (fPedRms)
485  fPedRms->AddAt(fStat->getRMS(anode,time),fPedRms->getPixelIndex(anode,time));
486  }
487  }
488 
489  rms /= fPed->getNumberOfAnodes()*fPed->getNumberOfTimeBins();
490  fPed->setRMS(rms);
491 
492  // cout << "rms = " << fPed->getRMS() << endl;
493 
494  }
495  }
496  }
497  }
498 
499  return kStOK;
500 }
501 
502 //_____________________________________________________________________________
503 Int_t StSvtPedMaker::CalcPed2ndOrd()
504 {
505  for (int barrel = 1;barrel <= fSvtData->getNumberOfBarrels();barrel++) {
506  for (int ladder = 1;ladder <= fSvtData->getNumberOfLadders(barrel);ladder++) {
507  for (int wafer = 1;wafer <= fSvtData->getNumberOfWafers(barrel);wafer++) {
508  for (int hybrid = 1;hybrid <= fSvtData->getNumberOfHybrids();hybrid++) {
509 
510  if (fSvtData->getHybridIndex(barrel, ladder, wafer, hybrid) < 0) continue;
511 
512  fPed2 = (StSvtHybridPixels2*)fSvtPed2->at(fSvtPed2->getHybridIndex(barrel, ladder, wafer, hybrid));
513  if (!fPed2)
514  fPed2 = new StSvtHybridPixels2(barrel, ladder, wafer, hybrid);
515 
516  fStat2 = (StSvtHybridStat2*)fSvtStat2->at(fSvtStat2->getHybridIndex(barrel, ladder, wafer, hybrid));
517 
518  if (!fStat2) continue;
519 
520  for (int time2=0; time2<fPed2->getNumberOfCapacitors();time2++) {
521 
522  fPed = (StSvtHybridPed*)fPed2->getSvtHybridPixels(time2);
523  if (!fPed)
524  fPed = new StSvtHybridPed(barrel, ladder, wafer, hybrid);
525  fPed->setType(fType);
526 
527  for (int anode=1; anode<=fPed->getNumberOfAnodes();anode++) {
528  for (int time=0; time<fPed->getNumberOfTimeBins();time++) {
529 
530  fPed->AddAt( fStat2->getMean(anode,time,time2),fPed->getPixelIndex(anode,time));
531 
532  }
533  }
534 
535  fPed2->setSvtHybridPixels(fPed,time2);
536 
537  }
538 
539  fSvtPed2->at(fSvtPed2->getHybridIndex(barrel, ladder, wafer, hybrid))
540  = fPed2;
541  }
542  }
543  }
544  }
545 
546  return kStOK;
547 }
548 
549 //_____________________________________________________________________________
550 Int_t StSvtPedMaker::WriteToFile(const char* fileName)
551 {
552  if (Debug()) gMessMgr->Debug() << "StSvtPedMaker::WriteToFile" << endm;
553 
554  TFile *file = new TFile(fileName,"RECREATE");
555  char name[20];
556 
557  for (int barrel = 1;barrel <= fSvtData->getNumberOfBarrels();barrel++) {
558  for (int ladder = 1;ladder <= fSvtData->getNumberOfLadders(barrel);ladder++) {
559  for (int wafer = 1;wafer <= fSvtData->getNumberOfWafers(barrel);wafer++) {
560  for (int hybrid = 1;hybrid <= fSvtData->getNumberOfHybrids();hybrid++) {
561 
562  if (fSvtData->getHybridIndex(barrel, ladder, wafer, hybrid) < 0) continue;
563 
564  fPed = (StSvtHybridPed*)fSvtPed->at(fSvtPed->getHybridIndex(barrel, ladder, wafer, hybrid));
565 
566  if (fPed) {
567  sprintf(name,"Ped_%d_%d_%d_%d",barrel, ladder, wafer, hybrid);
568  fPed->Write(name);
569  }
570  }
571  }
572  }
573  }
574 
575  file->Close();
576 
577  return kStOK;
578 }
579 
580 //_____________________________________________________________________________
581 Int_t StSvtPedMaker::WriteRMSToFile(const char* fileName)
582 {
583  if (Debug()) gMessMgr->Debug() << "StSvtPedMaker::WriteToFile" << endm;
584 
585  TFile *file = new TFile(fileName,"RECREATE");
586  char name[20];
587 
588  for (int barrel = 1;barrel <= fSvtData->getNumberOfBarrels();barrel++) {
589  for (int ladder = 1;ladder <= fSvtData->getNumberOfLadders(barrel);ladder++) {
590  for (int wafer = 1;wafer <= fSvtData->getNumberOfWafers(barrel);wafer++) {
591  for (int hybrid = 1;hybrid <= fSvtData->getNumberOfHybrids();hybrid++) {
592 
593  if (fSvtData->getHybridIndex(barrel, ladder, wafer, hybrid) < 0) continue;
594 
595  fPedRms = (StSvtHybridPixels*)fSvtPedRms->at(fSvtPed->getHybridIndex(barrel, ladder, wafer, hybrid));
596 
597  if (fPedRms) {
598  sprintf(name,"Ped_%d_%d_%d_%d",barrel, ladder, wafer, hybrid);
599  fPedRms->Write(name);
600  }
601  }
602  }
603  }
604  }
605 
606  file->Close();
607 
608  return kStOK;
609 }
610 
611 //_____________________________________________________________________________
612 Int_t StSvtPedMaker::ReadFromFile(const char* fileName)
613 {
614  if (Debug()) gMessMgr->Debug() << "StSvtPedMaker::ReadFromFile" << endm;
615 
616  TFile *file = new TFile(fileName);
617  if (file->IsZombie()){
618  gMessMgr->Info() << "Error reading file:" <<fileName<< endm;
619  return kStOk;
620  }
621  char name[20];
622 
623  for (int barrel = 1;barrel <= mConfig->getNumberOfBarrels();barrel++) {
624  for (int ladder = 1;ladder <= mConfig->getNumberOfLadders(barrel);ladder++) {
625  for (int wafer = 1;wafer <= mConfig->getNumberOfWafers(barrel);wafer++) {
626  for (int hybrid = 1;hybrid <= mConfig->getNumberOfHybrids();hybrid++) {
627  //cout<<"chp1"<<endl;
628  if (mConfig->getHybridIndex(barrel, ladder, wafer, hybrid) < 0) continue;
629 
630  sprintf(name,"Ped_%d_%d_%d_%d",barrel, ladder, wafer, hybrid);
631  fPed = (StSvtHybridPed*)file->Get(name);
632 
633  if (fPed) {
634  int idx = fSvtPed->getHybridIndex(barrel, ladder, wafer, hybrid);
635  delete fSvtPed->at(idx); fSvtPed->at(idx)=0;
636  fSvtPed->put_at(fPed,idx);
637  }
638  }
639  }
640  }
641  }
642 
643  file->Close();
644 
645  return kStOK;
646 }
647 
648 //_____________________________________________________________________________
649 Int_t StSvtPedMaker::ReadRMSFromFile(const char* fileName)
650 {
651  if (Debug()) gMessMgr->Debug() << "StSvtPedMaker::ReadRMSFromFile" << endm;
652 
653  TFile *file = new TFile(fileName);
654  if (file->IsZombie()){
655  gMessMgr->Info() << "Error reading file:" <<fileName<< endm;
656  return kStOk;
657  }
658  char name[20];
659 
660  for (int barrel = 1;barrel <= mConfig->getNumberOfBarrels();barrel++) {
661  for (int ladder = 1;ladder <= mConfig->getNumberOfLadders(barrel);ladder++) {
662  for (int wafer = 1;wafer <= mConfig->getNumberOfWafers(barrel);wafer++) {
663  for (int hybrid = 1;hybrid <= mConfig->getNumberOfHybrids();hybrid++) {
664 
665  if (mConfig->getHybridIndex(barrel, ladder, wafer, hybrid) < 0) continue;
666 
667  sprintf(name,"Ped_%d_%d_%d_%d",barrel, ladder, wafer, hybrid);
668  fPedRms = (StSvtHybridPixels*)file->Get(name);
669 
670  if (fPedRms) {
671  int idx = fSvtPedRms->getHybridIndex(barrel, ladder, wafer, hybrid);
672  delete fSvtPedRms->at(idx); fSvtPedRms->at(idx)=0;
673  fSvtPedRms->put_at(fPedRms,idx);
674 
675  }
676  }
677  }
678  }
679  }
680 
681  file->Close();
682 
683  return kStOK;
684 }
685 
686 //_____________________________________________________________________________
687 Int_t StSvtPedMaker::ResetStat()
688 {
689  if (Debug()) gMessMgr->Debug() << "StSvtPedMaker::ResetStat" << endm;
690 
691  for (int i=0; i<fSvtStat->getTotalNumberOfHybrids();i++) {
692  fStat = (StSvtHybridStat*)fSvtStat->at(i);
693  if (fStat)
694  fStat->reset();
695  }
696 
697  return kStOK;
698 }
699 
700 //_____________________________________________________________________________
701 Int_t StSvtPedMaker::ResetPed()
702 {
703  if (Debug()) gMessMgr->Debug() << "StSvtPedMaker::ResetPed" << endm;
704 
705  for (int i=0; i<fSvtPed->getTotalNumberOfHybrids();i++) {
706  fPed = (StSvtHybridPed*)fSvtPed->at(i);
707  if (fPed)
708  fPed->reset();
709  }
710 
711  return kStOK;
712 }
713 
714 //_____________________________________________________________________________
716 {
717  if (Debug()) gMessMgr->Debug() << "StSvtPedMaker::Finish" << endm;
718 
719  return kStOK;
720 }
721 
722 //_____________________________________________________________________________
723 void StSvtPedMaker::PrintInfo()
724 {
725 
726  if (Debug()) StMaker::PrintInfo();
727 }
728 
virtual void SetObject(TObject *obj)
The depricated method (left here for the sake of the backward compatibility)
Definition: TDataSet.cxx:480
virtual void SetObject(TObject *obj)
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:59
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TDataSet.cxx:428
Definition: Stypes.h:40
virtual Int_t Finish()
virtual Int_t Make()
Definition: Stypes.h:41