source: trunk/MagicSoft/Mars/mhist/MFillHFadc.cc@ 717

Last change on this file since 717 was 711, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.2 KB
Line 
1////////////////////////////////////////////////////////////////////////
2//
3// MFillHFadc
4//
5// This task fill the n time slices from all pixels
6// (stored in a MRawEvtData container) into histograms.
7// This histograms (one per pixel) are stored in MHFadcCam, MHFadcPix
8//
9////////////////////////////////////////////////////////////////////////
10
11#include "MFillHFadc.h"
12
13#include "MLog.h"
14#include "MLogManip.h"
15#include "MParList.h"
16#include "MHFadcCam.h"
17#include "MRawEvtData.h"
18#include "MRawEvtPixelIter.h"
19
20ClassImp(MFillHFadc)
21
22MFillHFadc::MFillHFadc (const char *name, const char *title) : fRawEvtData(NULL)
23{
24 *fName = name ? name : "MFillHFadc";
25 *fTitle = title ? title : "Task to fill the adc spectra with raw data";
26}
27
28Bool_t MFillHFadc::PreProcess (MParList *pList)
29{
30 //
31 // The PrProcess function checks for the existance of all necessary
32 // parameter containers
33 //
34
35 //
36 // check if all necessary input containers are existing
37 //
38 fRawEvtData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData");
39 if (!fRawEvtData)
40 {
41 *fLog << dbginf << " Error: MRawEvtData not found... exit." << endl;
42 return kFALSE;
43 }
44
45 //
46 // check if the output containers are existing, if not craete them
47 //
48 fHistos = (MHFadcCam*)pList->FindCreateObj("MHFadcCam");
49 if (!fHistos)
50 return kFALSE;
51
52 return kTRUE;
53}
54
55Bool_t MFillHFadc::Process()
56{
57 //
58 // This process function loops over all pixels in an MRawEvtData
59 // event and fills the values into histograms
60 //
61
62 // loop over the pixels and fill the values in the histograms
63
64 MRawEvtPixelIter pixel(fRawEvtData);
65
66 const Int_t nhisamples = fRawEvtData->GetNumHiGainSamples() ;
67 const Int_t nlosamples = fRawEvtData->GetNumLoGainSamples() ;
68
69 // cout << "HighSamples " << iHighSamples ;
70
71 while ( pixel.Next() )
72 {
73 const UInt_t id = pixel.GetPixelId();
74
75 for (Int_t i=0; i<nhisamples; i++)
76 fHistos->FillHi(id, pixel.GetHiGainFadcSamples()[i]);
77
78 if (!pixel.HasLoGain())
79 continue;
80
81 for (Int_t i=0; i<nlosamples; i++)
82 fHistos->FillLo(id, pixel.GetLoGainFadcSamples()[i]);
83 }
84
85 return kTRUE;
86
87}
Note: See TracBrowser for help on using the repository browser.