source: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc@ 724

Last change on this file since 724 was 717, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 2.0 KB
Line 
1/////////////////////////////////////////////////////////////////////////////
2// //
3// MCerPhotCalc //
4// //
5/////////////////////////////////////////////////////////////////////////////
6
7#include "MCerPhotCalc.h"
8
9#include "MParList.h"
10
11#include "MLog.h"
12#include "MLogManip.h"
13
14#include "MRawEvtPixelIter.h"
15#include "MCerPhotEvt.h"
16#include "MPedestalPix.h"
17#include "MPedestalCam.h"
18
19ClassImp(MCerPhotCalc)
20
21 MRawEvtData *fRawEvt; // raw event data (time slices)
22 MPedestalCam *fPedestals; // Pedestals of all pixels in the camera
23 MCerPhotEvt *fCerPhotEvt; // Cerenkov Photon Event used for calculation
24
25MCerPhotCalc::MCerPhotCalc(const char *name, const char *title)
26{
27 *fName = name ? name : "MCerPhotCalc";
28 *fTitle = title ? title : "Task to calculate Cerenkov photons from raw data";
29}
30
31Bool_t MCerPhotCalc::PreProcess( MParList *pList )
32{
33 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
34 if (!fRawEvt)
35 {
36 *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
37 return kFALSE;
38 }
39
40 fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
41 if (!fPedestals)
42 {
43 *fLog << dbginf << "MPedestalCam not found... aborting." << endl;
44 return kFALSE;
45 }
46
47 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
48 if (!fCerPhotEvt)
49 return kFALSE;
50
51 return kTRUE;
52}
53
54Bool_t MCerPhotCalc::Process()
55{
56 fCerPhotEvt->Clear();
57
58 MRawEvtPixelIter pixel(fRawEvt);
59
60 while (pixel.Next())
61 {
62 const UInt_t pixid = pixel.GetPixelId();
63
64 const MPedestalPix &ped = (*fPedestals)[pixid];
65
66 const Float_t nphot = (Float_t)pixel.GetSumHiGainFadcSamples() - ped.GetMean();
67
68 fCerPhotEvt->AddPixel(pixid, nphot, ped.GetMeanRms());
69
70 // FIXME! Handling of Lo Gains is missing!
71 }
72
73 return kTRUE;
74}
75
Note: See TracBrowser for help on using the repository browser.