]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/AliPMDCalibPedestal.cxx
Disabling cluster sorting - breaks the MLEM algorithm.
[u/mrichter/AliRoot.git] / PMD / AliPMDCalibPedestal.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16
17 //Root includes
18 #include <TObjArray.h>
19 #include <TH1F.h>
20 #include <TString.h>
21 #include <TMath.h>
22 #include <TF1.h>
23 #include <TRandom.h>
24 #include <TDirectory.h>
25 #include <TFile.h>
26 #include "TTreeStream.h"
27
28 //AliRoot includes
29 #include "AliRawReader.h"
30 #include "AliPMDRawStream.h"
31 #include "AliPMDddldata.h"
32
33 //header file
34 #include "AliPMDCalibPedestal.h"
35
36
37 ClassImp(AliPMDCalibPedestal)
38
39
40 AliPMDCalibPedestal::AliPMDCalibPedestal() :
41   TObject()
42 {
43     //
44     // default constructor
45     //
46
47     for (int i = 0; i < 2; i++)
48     {
49         for (int j = 0; j < 24; j++)
50         {
51             for (int k = 0; k < 96; k++)
52             {
53                 for (int l = 0; l < 96; l++)
54                 {
55
56                     fPedHisto[i][j][k][l] = new TH1F("","",300,0.,300.);
57                 }
58             }
59         }
60     }
61
62
63 }
64 //_____________________________________________________________________
65 AliPMDCalibPedestal::AliPMDCalibPedestal(const AliPMDCalibPedestal &ped) :
66   TObject(ped)
67 {
68     //
69     // copy constructor
70     //
71     for (int i = 0; i < 2; i++)
72     {
73         for (int j = 0; j < 24; j++)
74         {
75             for (int k = 0; k < 96; k++)
76             {
77                 for (int l = 0; l < 96; l++)
78                 {
79                     
80                     fPedHisto[i][j][k][l] = ped.fPedHisto[i][j][k][l];
81                 }
82             }
83         }
84     }
85     
86 }
87 //_____________________________________________________________________
88 AliPMDCalibPedestal& AliPMDCalibPedestal::operator = (const  AliPMDCalibPedestal &source)
89 {
90   //
91   // assignment operator
92   //
93   if (&source == this) return *this;
94   new (this) AliPMDCalibPedestal(source);
95
96   return *this;
97 }
98 //_____________________________________________________________________
99 AliPMDCalibPedestal::~AliPMDCalibPedestal()
100 {
101     //
102     // destructor
103     //
104     delete fPedHisto;
105 }
106 //_____________________________________________________________________
107 Bool_t AliPMDCalibPedestal::ProcessEvent(AliRawReader *rawReader)
108 {
109   //
110   //  Event processing loop - AliRawReader
111   //
112     AliPMDRawStream rawStream(rawReader);
113
114     TObjArray pmdddlcont;
115     Bool_t streamout = kTRUE;
116
117     for (Int_t iddl = 0; iddl < 6; iddl++)
118     {
119         
120         rawReader->Select("PMD", iddl, iddl);
121         //cout << reader.GetDataSize() << endl;
122         streamout = rawStream.DdlData(iddl, &pmdddlcont);
123         Int_t ientries = pmdddlcont.GetEntries();
124         for (Int_t ient = 0; ient < ientries; ient++)
125         {
126             AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
127             
128             Int_t det = pmdddl->GetDetector();
129             Int_t smn = pmdddl->GetSMN();
130             //Int_t mcm = pmdddl->GetMCM();
131             //Int_t chno = pmdddl->GetChannel();
132             Int_t row = pmdddl->GetRow();
133             Int_t col = pmdddl->GetColumn();
134             Int_t sig = pmdddl->GetSignal();
135
136             fPedHisto[det][smn][row][col]->Fill((Float_t) sig);
137             
138         }
139         pmdddlcont.Clear();
140     }
141     return streamout;
142 }
143 //_____________________________________________________________________
144
145 void AliPMDCalibPedestal::Analyse()
146 {
147     //
148     //  Calculate pedestal Mean and RMS
149     //
150     for (int i = 0; i < 2; i++)
151     {
152         for (int j = 0; j < 24; j++)
153         {
154             for (int k = 0; k < 96; k++)
155             {
156                 for (int l = 0; l < 96; l++)
157                 {
158
159                     Float_t mean = fPedHisto[i][j][k][l]->GetMean();
160                     Float_t rms  = fPedHisto[i][j][k][l]->GetRMS();
161                 }
162             }
163         }
164     }
165 }
166 //_____________________________________________________________________