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

Last change on this file since 1013 was 1010, 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// The PreProcess searches for the following input containers:
72// - MRawEvtData
73// - MPedestalCam
74//
75// The following output containers are also searched and created if
76// they were not found:
77// - MCerPhotEvt
78//
79Bool_t MCerPhotCalc::PreProcess( MParList *pList )
80{
81 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
82 if (!fRawEvt)
83 {
84 *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
85 return kFALSE;
86 }
87
88 fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
89 if (!fPedestals)
90 {
91 *fLog << dbginf << "MPedestalCam not found... aborting." << endl;
92 return kFALSE;
93 }
94
95 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
96 if (!fCerPhotEvt)
97 return kFALSE;
98
99 return kTRUE;
100}
101
102// --------------------------------------------------------------------------
103//
104// Calculate the integral of the FADC time slaices and store them as a new
105// pixel in the MCerPhotEvt container.
106//
107Bool_t MCerPhotCalc::Process()
108{
109 fCerPhotEvt->Clear();
110
111 MRawEvtPixelIter pixel(fRawEvt);
112
113 while (pixel.Next())
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.