source: trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc@ 733

Last change on this file since 733 was 717, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 1.8 KB
Line 
1/////////////////////////////////////////////////////////////////////////////
2// //
3// MMcPedestalCopy //
4// //
5/////////////////////////////////////////////////////////////////////////////
6
7#include "MMcPedestalCopy.h"
8
9#include "MParList.h"
10
11#include "MLog.h"
12#include "MLogManip.h"
13
14#include "MPedestalCam.h"
15#include "MMcFadcHeader.hxx"
16
17ClassImp(MMcPedestalCopy)
18
19MMcPedestalCopy::MMcPedestalCopy(const char *name, const char *title)
20{
21 *fName = name ? name : "MMcPedestalCopy";
22 *fTitle = title ? title : "Task to copy monte carlo pedestals into MPedestal Container";
23}
24
25Bool_t MMcPedestalCopy::PreProcess( MParList *pList )
26{
27 fMcPedestals = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
28 if (!fMcPedestals)
29 {
30 *fLog << dbginf << "MMcFadcHeader not found... aborting." << endl;
31 return kFALSE;
32 }
33
34 fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
35 if (!fPedestals)
36 return kFALSE;
37
38 return kTRUE;
39}
40
41Bool_t MMcPedestalCopy::Process()
42{
43 const int num = fMcPedestals->GetNumPixel();
44
45 fPedestals->InitSize(num);
46
47 for (int i=0; i<num; i++)
48 {
49 MPedestalPix &pix = (*fPedestals)[i];
50
51 const Float_t pedest = fMcPedestals->GetPedestal(i);
52 const Float_t pedrms = fMcPedestals->GetPedestalRms(i);
53
54 const Float_t sigma = pedest*sqrt(num);
55 const Float_t sigrms = sigma/sqrt(2*num);
56
57 pix.SetPedestal(pedest, sigma);
58 pix.SetPedestalRms(pedrms, sigrms);
59
60 *fLog << pedest << " " << sigma << " " << pedrms << " " << sigrms << endl;
61 }
62
63 return kTRUE;
64}
65
Note: See TracBrowser for help on using the repository browser.