source: trunk/MagicSoft/Mars/mdatacheck/MFillAdcSpect.cc@ 665

Last change on this file since 665 was 665, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 1.7 KB
Line 
1#include "MFillAdcSpect.h"
2
3#include <iostream.h>
4
5#include "MParList.h"
6#include "MHistosAdc.h"
7#include "MRawEvtData.h"
8#include "MRawEvtPixelIter.h"
9
10//ClassImp(MFillAdcSpect)
11
12MFillAdcSpect::MFillAdcSpect (const char *name, const char *title)
13{
14 *fName = name ? name : "MFillAdcSpect";
15 *fTitle = title ? title : "Task to fill the adc spectra with raw data";
16
17 fRawEvtData = NULL ;
18 fPixelIter = NULL ;
19}
20
21
22
23Bool_t MFillAdcSpect::PreProcess (MParList *pList)
24{
25 // connect the raw data with this task
26
27 fHistos = (MHistosAdc*)pList->FindObject("MHistosAdc");
28 if (!fHistos)
29 {
30 cout << "MRawFileRead::PreProcess - WARNING: MHistosAdc not found... creating." << endl;
31 fHistos = new MHistosAdc;
32 pList->AddToList(fHistos);
33 }
34
35 fRawEvtData = (MRawEvtData*)pList->FindObject("MRawEvtData");
36 if (!fRawEvtData)
37 {
38 cout << "MRawFileRead::PreProcess - WARNING: MRawEvtData not found... exit." << endl;
39 return kFALSE;
40 }
41
42 fPixelIter = new MRawEvtPixelIter( fRawEvtData );
43
44 return kTRUE ;
45
46}
47
48
49Bool_t MFillAdcSpect::Process()
50{
51 // loop over the pixels and fill the values in the histograms
52
53 fPixelIter->Reset() ;
54
55 const Int_t nhisamples = fRawEvtData->GetNumHiGainSamples() ;
56 const Int_t nlosamples = fRawEvtData->GetNumLoGainSamples() ;
57
58 // cout << "HighSamples " << iHighSamples ;
59
60 while ( fPixelIter->Next() )
61 {
62 for (Int_t i=0 ; i<nhisamples ; i++ )
63 {
64 fHistos->FillAdcHistHi ( fPixelIter->GetPixelId(),
65 fPixelIter->GetHiGainFadcSamples()[i] );
66 }
67
68 for (Int_t i=0 ; i<nlosamples ; i++ )
69 {
70 fHistos->FillAdcHistLo ( fPixelIter->GetPixelId(),
71 fPixelIter->GetLoGainFadcSamples()[i] );
72 }
73 }
74
75 return kTRUE;
76
77}
Note: See TracBrowser for help on using the repository browser.