source: branches/start/MagicSoft/Mars/mdatacheck/MHistosAdc.cc@ 9492

Last change on this file since 9492 was 462, checked in by harald, 24 years ago
Import the files for the datacheck section in this subdir.
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1///////////////////////////////////////////////////////////////////////
2//
3// MHistosAdc
4//
5// This class contains a list of all ADC spektra histograms
6//
7///////////////////////////////////////////////////////////////////////
8
9#include "MHistosAdc.h"
10
11#include <iostream.h>
12
13#include <TH1.h>
14#include <TFile.h>
15
16ClassImp(MHistosAdc)
17
18MHistosAdc::MHistosAdc (const char *name, const char *title)
19{
20 //
21 // default constructor
22 // creates an a list of histograms for all pixels and both gain channels
23 //
24
25 fHistHigh = new TObjArray(577);
26 fHistLow = new TObjArray(577);
27
28 //
29 // set the name and title of this object
30 //
31
32 *fName = name ? name : "MHistosAdc" ;
33 *fTitle = title ? title : "Container for ADC spectra histograms" ;
34
35 //
36 // loop over all Pixels and create two histograms
37 // one for the Low and one for the High gain
38 // connect all the histogram with the container fHist
39 //
40
41 Char_t tmp1[40];
42 Char_t tmp2[40];
43 TH1F *h1;
44
45 for ( Int_t i = 0 ; i < 577 ; i++)
46 {
47 sprintf ( tmp1, "high%d", i ) ;
48 sprintf ( tmp2, "high gain Pixel %d", i ) ;
49
50 h1 = new TH1F ( tmp1, tmp2, 256, 0., 255. ) ;
51
52 fHistHigh->Add( h1 ) ;
53
54 sprintf ( tmp1, "low %d", i ) ;
55 sprintf ( tmp2, "low gain Pixel %d", i ) ;
56
57 h1 = new TH1F ( tmp1, tmp2, 256, 0., 255. ) ;
58
59 fHistLow->Add( h1 ) ;
60
61 }
62}
63
64MHistosAdc::~MHistosAdc ()
65{
66
67 // default destructor
68 //
69 delete fHistHigh ;
70 delete fHistLow ;
71}
72
73void MHistosAdc::Print(Option_t *)
74{
75 for ( Int_t i = 0 ; i < 576 ; i++)
76 {
77 fHistHigh[i].Print() ;
78 }
79}
80
81void MHistosAdc::FillAdcHistHigh ( Int_t iPix, Byte_t data)
82{
83 //
84
85 ((TH1F*) (fHistHigh->At(iPix)))->Fill( (Float_t) data ) ;
86}
87
88void MHistosAdc::FillAdcHistLow ( Int_t iPix, Byte_t data)
89{
90 //
91
92 ((TH1F*) (fHistLow->At(iPix)))->Fill( (Float_t) data ) ;
93}
94
95void MHistosAdc::SaveHist ( char *name )
96{
97 //
98 // save all histogram in this class to a root file
99 //
100
101 TFile out( name, "recreate") ;
102
103 //
104 // loop over all pixels and write the files out
105 //
106
107 fHistLow->Write() ;
108 fHistHigh->Write() ;
109}
110
Note: See TracBrowser for help on using the repository browser.