1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2001
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | // //
|
---|
27 | // MCerPhotCalc //
|
---|
28 | // //
|
---|
29 | /////////////////////////////////////////////////////////////////////////////
|
---|
30 |
|
---|
31 | #include "MCerPhotCalc.h"
|
---|
32 |
|
---|
33 | #include "MParList.h"
|
---|
34 |
|
---|
35 | #include "MLog.h"
|
---|
36 | #include "MLogManip.h"
|
---|
37 |
|
---|
38 | #include "MRawEvtPixelIter.h"
|
---|
39 | #include "MCerPhotEvt.h"
|
---|
40 | #include "MPedestalPix.h"
|
---|
41 | #include "MPedestalCam.h"
|
---|
42 |
|
---|
43 | ClassImp(MCerPhotCalc)
|
---|
44 |
|
---|
45 | MRawEvtData *fRawEvt; // raw event data (time slices)
|
---|
46 | MPedestalCam *fPedestals; // Pedestals of all pixels in the camera
|
---|
47 | MCerPhotEvt *fCerPhotEvt; // Cerenkov Photon Event used for calculation
|
---|
48 |
|
---|
49 | MCerPhotCalc::MCerPhotCalc(const char *name, const char *title)
|
---|
50 | {
|
---|
51 | *fName = name ? name : "MCerPhotCalc";
|
---|
52 | *fTitle = title ? title : "Task to calculate Cerenkov photons from raw data";
|
---|
53 | }
|
---|
54 |
|
---|
55 | Bool_t MCerPhotCalc::PreProcess( MParList *pList )
|
---|
56 | {
|
---|
57 | fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
|
---|
58 | if (!fRawEvt)
|
---|
59 | {
|
---|
60 | *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
|
---|
61 | return kFALSE;
|
---|
62 | }
|
---|
63 |
|
---|
64 | fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
|
---|
65 | if (!fPedestals)
|
---|
66 | {
|
---|
67 | *fLog << dbginf << "MPedestalCam not found... aborting." << endl;
|
---|
68 | return kFALSE;
|
---|
69 | }
|
---|
70 |
|
---|
71 | fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
|
---|
72 | if (!fCerPhotEvt)
|
---|
73 | return kFALSE;
|
---|
74 |
|
---|
75 | return kTRUE;
|
---|
76 | }
|
---|
77 |
|
---|
78 | Bool_t MCerPhotCalc::Process()
|
---|
79 | {
|
---|
80 | fCerPhotEvt->Clear();
|
---|
81 |
|
---|
82 | MRawEvtPixelIter pixel(fRawEvt);
|
---|
83 |
|
---|
84 | while (pixel.Next())
|
---|
85 | {
|
---|
86 | const UInt_t pixid = pixel.GetPixelId();
|
---|
87 |
|
---|
88 | const MPedestalPix &ped = (*fPedestals)[pixid];
|
---|
89 |
|
---|
90 | const Float_t nphot = (Float_t)pixel.GetSumHiGainFadcSamples() - ped.GetMean();
|
---|
91 |
|
---|
92 | fCerPhotEvt->AddPixel(pixid, nphot, ped.GetMeanRms());
|
---|
93 |
|
---|
94 | // FIXME! Handling of Lo Gains is missing!
|
---|
95 | }
|
---|
96 |
|
---|
97 | return kTRUE;
|
---|
98 | }
|
---|
99 |
|
---|