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): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)
|
---|
19 | ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2001
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | ///////////////////////////////////////////////////////////////////////
|
---|
27 | //
|
---|
28 | // MHFadcCam
|
---|
29 | //
|
---|
30 | // This class contains a list of MHFadcPix.
|
---|
31 | //
|
---|
32 | ///////////////////////////////////////////////////////////////////////
|
---|
33 |
|
---|
34 | #include "MHFadcCam.h"
|
---|
35 |
|
---|
36 | #include "MRawEvtData.h"
|
---|
37 | #include "MRawEvtPixelIter.h"
|
---|
38 |
|
---|
39 | ClassImp(MHFadcCam);
|
---|
40 |
|
---|
41 | // --------------------------------------------------------------------------
|
---|
42 | //
|
---|
43 | // default constructor
|
---|
44 | // creates an a list of histograms for all pixels and both gain channels
|
---|
45 | //
|
---|
46 | #include <iostream.h>
|
---|
47 | MHFadcCam::MHFadcCam(const char *name, const char *title)
|
---|
48 | {
|
---|
49 | //
|
---|
50 | // set the name and title of this object
|
---|
51 | //
|
---|
52 | fName = name ? name : "MHFadcCam";
|
---|
53 | fTitle = title ? title : "Container for ADC spectra histograms";
|
---|
54 |
|
---|
55 | //
|
---|
56 | // loop over all Pixels and create two histograms
|
---|
57 | // one for the Low and one for the High gain
|
---|
58 | // connect all the histogram with the container fHist
|
---|
59 | //
|
---|
60 | fArray = new TObjArray(577);
|
---|
61 |
|
---|
62 | for (Int_t i=0; i<577; i++)
|
---|
63 | (*fArray)[i] = new MHFadcPix(i);
|
---|
64 | }
|
---|
65 |
|
---|
66 | // --------------------------------------------------------------------------
|
---|
67 | MHFadcCam::~MHFadcCam()
|
---|
68 | {
|
---|
69 | delete fArray;
|
---|
70 | }
|
---|
71 |
|
---|
72 | // --------------------------------------------------------------------------
|
---|
73 | //
|
---|
74 | // Our own clone function is necessary since root 3.01/06 or Mars 0.4
|
---|
75 | // I don't know the reason
|
---|
76 | //
|
---|
77 | TObject *MHFadcCam::Clone(const char *) const
|
---|
78 | {
|
---|
79 | MHFadcCam *cam = new MHFadcCam;
|
---|
80 |
|
---|
81 | for (int i=0; i<577; i++)
|
---|
82 | {
|
---|
83 | delete (*cam->fArray)[i];
|
---|
84 | (*cam->fArray)[i] = (MHFadcPix*)(*fArray)[i]->Clone();
|
---|
85 | }
|
---|
86 | return cam;
|
---|
87 | }
|
---|
88 |
|
---|
89 | // --------------------------------------------------------------------------
|
---|
90 | void MHFadcCam::Fill(const MParContainer *par)
|
---|
91 | {
|
---|
92 | MRawEvtData *evt = (MRawEvtData*)par;
|
---|
93 |
|
---|
94 | MRawEvtPixelIter pixel(evt);
|
---|
95 |
|
---|
96 | const Int_t nhisamples = evt->GetNumHiGainSamples();
|
---|
97 | const Int_t nlosamples = evt->GetNumLoGainSamples();
|
---|
98 |
|
---|
99 | while (pixel.Next())
|
---|
100 | {
|
---|
101 | const UInt_t id = pixel.GetPixelId();
|
---|
102 |
|
---|
103 | for (Int_t i=0; i<nhisamples; i++)
|
---|
104 | FillHi(id, pixel.GetHiGainFadcSamples()[i]);
|
---|
105 |
|
---|
106 | if (!pixel.HasLoGain())
|
---|
107 | continue;
|
---|
108 |
|
---|
109 | for (Int_t i=0; i<nlosamples; i++)
|
---|
110 | FillLo(id, pixel.GetLoGainFadcSamples()[i]);
|
---|
111 | }
|
---|
112 |
|
---|
113 | }
|
---|
114 | /*void MHFadcCam::SaveHist(char *name)
|
---|
115 | {
|
---|
116 | //
|
---|
117 | // save all histogram in this class to a root file
|
---|
118 | //
|
---|
119 |
|
---|
120 | //
|
---|
121 | // FIXME: Don't open a file and write to this file!
|
---|
122 | // just Fill the current container (or the two histograms
|
---|
123 | // to an open file. The user must choose a file before.
|
---|
124 | //
|
---|
125 | TFile out( name, "recreate") ;
|
---|
126 |
|
---|
127 | //
|
---|
128 | // loop over all pixels and write the files out
|
---|
129 | //
|
---|
130 |
|
---|
131 | fHistLo->Write();
|
---|
132 | fHistHi->Write();
|
---|
133 | }
|
---|
134 |
|
---|
135 | */ |
---|