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

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