source: trunk/MagicSoft/MarsOctober/mocttest/MAdcSpect.cc@ 1825

Last change on this file since 1825 was 447, checked in by harald, 24 years ago
Bringing the sources for the octobertest under CVS controll. (november, 3rd, 2000)
  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#include "MAdcSpect.h"
2
3#include <iostream.h>
4#include <stdlib.h>
5
6#include <TFile.h>
7
8#include "MRawEvt.h"
9#include "MParList.h"
10#include "MHistosAdc.h"
11
12
13////////////////////////////////////////////////////////////////////////
14//
15// MAdcSpect.h
16//
17// A Task to fill the raw ADC values in the histograms to create
18// the ADC raw spectra
19//
20
21ClassImp(MAdcSpect)
22
23MAdcSpect::MAdcSpect( char* treeName, char *rootfile)
24{
25 //
26 // default constructor
27 //
28 sprintf(fTreeName, "%s", treeName ) ;
29
30 sprintf(fOutFile, "%s", rootfile);
31}
32
33
34Bool_t MAdcSpect::PreProcess(MParList *pList)
35{
36 //
37 // Do the preprocessing for MAdcSpect
38 //
39 // Connects the event in MRawEvtBuf as the input for this task
40 // and the MHistosAdc container as the output
41 //
42
43 //
44 // first look for the input buffer MRawEvtBuf
45 //
46 fEvtBuf = (MObjBuffer*) pList->FindObject(fTreeName);
47 if (!fEvtBuf)
48 {
49 cout << "ERROR: MAdcSpect::PreProc(): " << fTreeName << " not found!" << endl;
50 exit(1);
51 }
52
53 //
54 // second connect the output container
55 //
56 fHists = (MHistosAdc*) pList->FindObject("MHistosAdc");
57
58 if (!fHists)
59 {
60 cout << "ERROR: MAdcSpect::PreProc(): MHistosAdc not found!" << endl;
61 exit(1);
62 }
63
64 return kTRUE ;
65}
66
67Bool_t MAdcSpect::Process()
68{
69 //
70 // fill the raw data values in the corresponding histograms
71 //
72
73 //
74 // loop over the pixels in the events
75 //
76
77 MRawEvt *fRawEvt = (MRawEvt*)(*fEvtBuf)();
78
79 for ( Int_t i=0 ; i< (Int_t) fRawEvt->GetMultPixel(); i++ )
80 {
81 fHists->FillAdcHist ( fRawEvt->GetPixelId(i),
82 fRawEvt->GetPixelData(i) );
83
84 }
85
86 return kTRUE ;
87}
88
89
90Bool_t MAdcSpect::PostProcess()
91{
92 //
93 // PostProessing
94 //
95 // after the loop over all events this routine is executed.
96 // Here the postprecessing is checking the contents of
97 // fOutFile.
98 // If it is "nooutput", nothing is done.
99 // Else the histograms in the MHistosAdc are written to a file.
100 //
101
102 if (strcmp (fOutFile, "nooutput"))
103 {
104 //
105 // write the histograms to File
106 //
107 cout << endl << "--> INFO: write the histograms to file: "
108 << fOutFile << endl ;
109
110 //
111 // call the containers save function
112 //
113
114 fHists->SaveHist(fOutFile);
115 }
116
117 return kTRUE;
118}
Note: See TracBrowser for help on using the repository browser.