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 |
|
---|
12 | MFillAdcSpect::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 |
|
---|
23 | Bool_t MFillAdcSpect::PreProcess (MParList *pList)
|
---|
24 | {
|
---|
25 | // connect the raw data with this task
|
---|
26 |
|
---|
27 | fRawEvtData = (MRawEvtData*)pList->FindObject("MRawEvtData");
|
---|
28 |
|
---|
29 | if (!fRawEvtData)
|
---|
30 | {
|
---|
31 | cout << "MRawFileRead::PreProcess - WARNING: MRawEvtData not found... creating." << endl;
|
---|
32 | return kFALSE ;
|
---|
33 | }
|
---|
34 |
|
---|
35 | fPixelIter = new MRawEvtPixelIter( fRawEvtData );
|
---|
36 |
|
---|
37 | fHistos = (MHistosAdc*)pList->FindObject("MHistosAdc");
|
---|
38 |
|
---|
39 | if (!fHistos)
|
---|
40 | {
|
---|
41 | cout << "MRawFileRead::PreProcess - WARNING: MHistosAdc not found... exit..." << endl;
|
---|
42 | return kFALSE ;
|
---|
43 | }
|
---|
44 |
|
---|
45 |
|
---|
46 | return kTRUE ;
|
---|
47 |
|
---|
48 | }
|
---|
49 |
|
---|
50 |
|
---|
51 | Bool_t MFillAdcSpect::Process()
|
---|
52 | {
|
---|
53 | // loop over the pixels and fill the values in the histograms
|
---|
54 |
|
---|
55 | fPixelIter->Reset() ;
|
---|
56 |
|
---|
57 | Int_t iHighSamples = fRawEvtData->GetNumHiGainSamples() ;
|
---|
58 | Int_t iLowSamples = fRawEvtData->GetNumLoGainSamples() ;
|
---|
59 |
|
---|
60 | // cout << "HighSamples " << iHighSamples ;
|
---|
61 |
|
---|
62 | while ( fPixelIter->Next() )
|
---|
63 | {
|
---|
64 | for (Int_t i=0 ; i< iHighSamples ; i++ )
|
---|
65 | {
|
---|
66 | fHistos->FillAdcHistHigh ( fPixelIter->GetPixelId(),
|
---|
67 | fPixelIter->GetHiGainFadcSamples()[i] );
|
---|
68 | }
|
---|
69 |
|
---|
70 | for (Int_t i=0 ; i< iLowSamples ; i++ )
|
---|
71 | {
|
---|
72 | fHistos->FillAdcHistLow ( fPixelIter->GetPixelId(),
|
---|
73 | fPixelIter->GetLoGainFadcSamples()[i] );
|
---|
74 | }
|
---|
75 | }
|
---|
76 |
|
---|
77 | return kTRUE;
|
---|
78 |
|
---|
79 | }
|
---|