source: tags/Mars-V0.5/manalysis/MCerPhotCalc.cc

Last change on this file was 1032, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 4.2 KB
Line 
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// This is a task which calculates the number of photons from the FADC //
30// time slices. At the moment it integrates simply the FADC values. //
31// //
32// Input Containers: //
33// MRawEvtData, MPedesdtalCam //
34// //
35// Output Containers: //
36// MCerPhotEvt //
37// //
38//////////////////////////////////////////////////////////////////////////////
39
40#include "MCerPhotCalc.h"
41
42#include "MParList.h"
43
44#include "MLog.h"
45#include "MLogManip.h"
46
47#include "MRawEvtPixelIter.h"
48#include "MCerPhotEvt.h"
49#include "MPedestalPix.h"
50#include "MPedestalCam.h"
51
52ClassImp(MCerPhotCalc);
53
54// --------------------------------------------------------------------------
55//
56// Default constructor.
57//
58MCerPhotCalc::MCerPhotCalc(const char *name, const char *title)
59{
60 fName = name ? name : "MCerPhotCalc";
61 fTitle = title ? title : "Task to calculate Cerenkov photons from raw data";
62
63 AddToBranchList("fHiGainPixId");
64 AddToBranchList("fLoGainPixId");
65 AddToBranchList("fHiGainFadcSamples");
66 AddToBranchList("fLoGainFadcSamples");
67
68}
69
70// --------------------------------------------------------------------------
71//
72// The PreProcess searches for the following input containers:
73// - MRawEvtData
74// - MPedestalCam
75//
76// The following output containers are also searched and created if
77// they were not found:
78// - MCerPhotEvt
79//
80Bool_t MCerPhotCalc::PreProcess(MParList *pList)
81{
82 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
83 if (!fRawEvt)
84 {
85 *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
86 return kFALSE;
87 }
88
89 fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
90 if (!fPedestals)
91 {
92 *fLog << dbginf << "MPedestalCam not found... aborting." << endl;
93 return kFALSE;
94 }
95
96 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
97 if (!fCerPhotEvt)
98 return kFALSE;
99
100 return kTRUE;
101}
102
103// --------------------------------------------------------------------------
104//
105// Calculate the integral of the FADC time slaices and store them as a new
106// pixel in the MCerPhotEvt container.
107//
108Bool_t MCerPhotCalc::Process()
109{
110 MRawEvtPixelIter pixel(fRawEvt);
111
112 while (pixel.Next())
113 {
114
115 const UInt_t pixid = pixel.GetPixelId();
116
117 const MPedestalPix &ped = (*fPedestals)[pixid];
118
119 const Float_t nphot = (Float_t)pixel.GetSumHiGainFadcSamples() - ped.GetMean();
120
121 fCerPhotEvt->AddPixel(pixid, nphot, ped.GetMeanRms());
122
123 // FIXME! Handling of Lo Gains is missing!
124 }
125
126 fCerPhotEvt->SetReadyToSave();
127
128 return kTRUE;
129}
130
Note: See TracBrowser for help on using the repository browser.