AliRoot Core  edcc906 (edcc906)
AliCaloRawAnalyzerComparison.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * This file is property of and copyright by the Experimental Nuclear *
3  * Physics Group, Dep. of Physics *
4  * University of Oslo, Norway, 2007 *
5  * *
6  * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
7  * Contributors are mentioned in the code where appropriate. *
8  * Please report bugs to perthi@fys.uio.no *
9  * *
10  * Permission to use, copy, modify and distribute this software and its *
11  * documentation strictly for non-commercial purposes is hereby granted *
12  * without fee, provided that the above copyright notice appears in all *
13  * copies and that both the copyright notice and this permission notice *
14  * appear in the supporting documentation. The authors make no claims *
15  * about the suitability of this software for any purpose. It is *
16  * provided "as is" without express or implied warranty. *
17  **************************************************************************/
19 
23 #include "AliCaloRawAnalyzerNN.h"
25 
26 #include "AliCaloFitResults.h"
27 #include "TH2D.h"
28 #include "TMath.h"
29 #include "TFile.h"
30 
31 #include <iostream>
32 
33 using namespace std;
34 
39  fMonCol1(1),
40  fMonRow1(15),
41  fMonCol2(1),
42  fMonRow2(16)
43 {
45 
49  AliCaloRawAnalyzerNN *neuralnet = new AliCaloRawAnalyzerNN();
51 
53  peakfinder ->SetIsZeroSuppressed();
54  lms ->SetIsZeroSuppressed();
55  fastfit ->SetIsZeroSuppressed();
56  neuralnet ->SetIsZeroSuppressed();
57  crude ->SetIsZeroSuppressed();
58 
59  fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)crude);
60  fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)lms);
61  fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)fastfit);
62  fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)neuralnet);
63 
64  fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)peakfinder);
66 }
67 
71 void
72 AliCaloRawAnalyzerComparison::Evaluate( const vector<AliCaloBunchInfo> &bunchvector, const UInt_t altrocfg1,
73  const UInt_t altrocfg2, const int event, const int col, const int row )
74 {
75  // cout << __FILE__ << __LINE__ << endl;
76 
77  AliCaloFitResults ref = fReferenceAnalyzer->Evaluate( bunchvector, altrocfg1, altrocfg2 );
78  // AliCaloFitResults ref;
79 
80  Int_t nsize = fRawAnalyzers.size();
81  for(int i=0; i < nsize; i++ )
82  {
83  AliCaloFitResults an = fRawAnalyzers.at(i)->Evaluate( bunchvector, altrocfg1, altrocfg2 );
84 
85  // cout << __FILE__ << __LINE__ << ":" << fRawAnalyzers.at(i)->GetAlgoAbbr() << " col = " << col << " row " << row << " amp= " << an.GetAmp() << endl ;
86 
87  // fAmplitudeVsEvent[i]->Fill( event, an.GetAmp() );
88  // fTofVsEvent[i]->Fill( event, an.GetTof() );
89 
90  fRefAmpVsAnalyzers[i]->Fill(ref.GetAmp(), an.GetAmp() );
91  fRefTofVsAnalyzers[i]->Fill(ref.GetTof(), an.GetTof() );
92  fAmpDiff[i]->Fill(ref.GetAmp() - an.GetAmp() );
93  fTofDiff[i]->Fill(ref.GetTof() - an.GetTof() );
94 
95  if(col == fMonCol1 && fMonRow1 == row )
96  {
97  fAmplitudeVsEvent[i]->Fill( event, an.GetAmp() );
98  fTofVsEvent[i]->Fill( event, an.GetTof() );
99  fMon1[i] = an;
100  }
101 
102  if(col == fMonCol2 && row == fMonRow2 )
103  {
104  fMon2[i] = an;
105  }
106 
107  if(row >= 0 && col >= 0 )
108  {
109  fAmpHistograms[i][col][row]->Fill( an.GetAmp() );
110  }
111  }
112 }
113 
117 void
119 {
120  Int_t nsize = fRawAnalyzers.size();
121  for(int i=0; i < nsize; i++ )
122  {
123  /*
124  if( ( fMon1[i].GetAmp() > 50 && fMon2[i].GetAmp() > 50 ) && ( fMon1[i].GetAmp() < 1023 && fMon2[i].GetAmp() < 1023 ) )
125  {
126  cout << __FILE__ << __LINE__ << fRawAnalyzers.at(i)->GetAlgoAbbr() << "\tamp1=" << fMon1[i].GetAmp() << "\tamp2 = " << fMon2[i].GetAmp() << endl;
127  }
128  */
129 
130  if( fMon1[i].GetAmp() > 50 && fMon2[i].GetAmp() > 50 )
131  {
132  // if( fMon1[i].GetTof() != fMon2[i].GetTof())
133  {
134  // fTofResDifferential[i]->Fill( ( fMon1[i].GetTof() - fMon2[i].GetTof())/TMath::Sqrt(2) );
135  fTofResDifferential[i]->Fill( ( fMon1[i].GetTof() - fMon2[i].GetTof()) );
136  fTofResAbsolute[i]->Fill( fMon1[i].GetTof() );
137  }
138  }
139  }
140 }
141 
145 void
147 {
148  TFile *f = new TFile("comparison2.root", "recreate");
149 
150  /*
151  for(int col=0; col < NZCOLSSMOD; col ++ )
152  {
153  for(int row=0; row < NXROWSSMOD; row ++ )
154  {
155  fAmpHistograms[col][row]->Write();
156  }
157  }
158  */
159 
160  Int_t nsize = fRawAnalyzers.size();
161  for(int i=0; i < nsize; i++ )
162  {
163  for(int col=0; col < NZCOLSSMOD; col ++ )
164  {
165  for(int row=0; row < NXROWSSMOD; row ++ )
166  {
167  fAmpHistograms[i][col][row]->Write();
168  }
169  }
170 
171  fAmplitudeVsEvent[i]->Write();
172  fTofVsEvent[i]->Write();
173  fRefAmpVsAnalyzers[i]->Write();
174  fRefTofVsAnalyzers[i]->Write();
175  fAmpDiff[i]->Write();
176  fTofDiff[i]->Write();
177  fTofResDifferential[i]->Write();
178  fTofResAbsolute[i]->Write();
179 
180  }
181 
182  f->Close();
183 }
184 
188 void
189 AliCaloRawAnalyzerComparison::InitHistograms( vector <AliCaloRawAnalyzer*> analyzers, AliCaloRawAnalyzer* ref )
190 {
191  char tmpname[256];
192 
193  /*
194  for(int col=0; col < NZCOLSSMOD; col ++ )
195  {
196  for(int row=0; row < NXROWSSMOD; row ++ )
197  {
198  sprintf(tmpname, "z(col)%d_x(row)%d_amplitude;Counts;Amplitude/ADC counts", col, row);
199  fAmpHistograms[col][row] = new TH1D(tmpname, tmpname, 1024, 0, 1023 );
200  }
201  }
202  */
203 
204  // TH1D *fAmpHistograms[NZCOLSSMOD][NXROWSSMOD];
205  Int_t nsize = analyzers.size();
206  for(int i=0; i < nsize; i++ )
207  {
208  for(int col=0; col < NZCOLSSMOD; col ++ )
209  {
210  for(int row=0; row < NXROWSSMOD; row ++ )
211  {
212  sprintf(tmpname, "z(col)%d_x(row)%d_amplitude_%s;Amplitude/ADC counts;Counts", col, row, analyzers.at(i)->GetAlgoAbbr() );
213  fAmpHistograms[i][col][row] = new TH1D(tmpname, tmpname, 1024, 0, 1023 );
214  }
215  }
216 
217  sprintf(tmpname, "%s_amplitude_vs_event_row%d_col%d;Event;Amplitude/ADC counts", analyzers.at(i)->GetAlgoAbbr(), fMonRow1, fMonCol1 );
218  fAmplitudeVsEvent[i]=new TH2D(tmpname, tmpname, 8000, 0, 7999, 1024, 0, 1023 );
219 
220  sprintf(tmpname, "%s_tof_vs_event_row%d_col%d;Event;Amplitude/ADC counts", analyzers.at(i)->GetAlgoAbbr(), fMonRow1, fMonCol1 );
221 
222  // fTofVsEvent[i]=new TH2D(tmpname, tmpname, 8000, 0, 7999, 2000, 3000, 5000);
223  fTofVsEvent[i]=new TH2D(tmpname, tmpname, 8000, 0, 7999, 2000, 1000, 4000);
224 
225 
226  sprintf(tmpname, "%s_vs_%s_ampltude; Amplitude_{%s}/ADC counts; Amplitude_{%s}/ADC counts", ref->GetAlgoAbbr(),
227  analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr() );
228  fRefAmpVsAnalyzers[i] = new TH2D(tmpname, tmpname, 1024, 0, 1023, 1024, 0, 1023);
229  sprintf(tmpname, "%s_vs_%s_tof; tof_{%s}/ns; tof_{%s}/ns", ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr() );
230  fRefTofVsAnalyzers[i] = new TH2D(tmpname, tmpname, 500, 2000, 4999, 500, 2000, 4999 );
231  sprintf( tmpname, "%s-%s amplitude;counts;A_{%s} - A_{%s}", ref->GetAlgoAbbr(),
232  analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr());
233  fAmpDiff[i] = new TH1D(tmpname, tmpname, 100, -10, 10 );
234  sprintf( tmpname, "%s-%s tof;counts;A_{%s} - A_{%s}", ref->GetAlgoAbbr(),
235  analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr());
236  fTofDiff[i] = new TH1D(tmpname, tmpname, 1000, -5000, 5000 );
237  sprintf( tmpname, "%s Differential tof resolution (%d, %d) vs (%d, %d);#sigma_{tof}^{%s}/ns;Counts", analyzers.at(i)->GetAlgoAbbr(), fMonCol1, fMonRow1, fMonCol2, fMonRow2,
238  analyzers.at(i)->GetAlgoAbbr() );
239  fTofResDifferential[i] = new TH1D(tmpname, tmpname, 1000, -250, 250 );
240  sprintf( tmpname, "%s Absolute tof distribution (%d, %d);#sigma_{tof}^{%s}/ns;Counts", analyzers.at(i)->GetAlgoAbbr(), fMonCol1, fMonRow1, analyzers.at(i)->GetAlgoAbbr() );
241 
242  fTofResAbsolute[i] = new TH1D(tmpname, tmpname, 2000 , -1000, 7000 );
243  }
244 }
245 
Raw data fitting: crude fit.
Base class for extraction of signal amplitude and peak position.
TH1D * fTofResDifferential[NANALYZERS]
Differntial tof resolution.
Raw data fitting: special fast fit.
std::vector< AliCaloRawAnalyzer * > fRawAnalyzers
Raw analyzers.
AliCaloRawAnalyzer * fReferenceAnalyzer
Reference analyzer.
TH1D * fTofResAbsolute[NANALYZERS]
Differntial tof resolution.
AliCaloFitResults fMon1[NANALYZERS]
results for tower 1
TH2D * fRefAmpVsAnalyzers[NANALYZERS]
Amplidue from give analyzer vs reference.
Float_t GetTof() const
Container class to hold results from fitting.
Raw data fitting: Neural network.
TH2D * fTofVsEvent[NANALYZERS]
Tof vs event number.
const char * GetAlgoAbbr() const
void Evaluate(const std::vector< AliCaloBunchInfo > &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2, const int event, const int col, const int row)
int fMonCol1
column index, for tower 1
virtual AliCaloFitResults Evaluate(const std::vector< AliCaloBunchInfo > &, UInt_t, UInt_t)=0
TH2D * fRefTofVsAnalyzers[NANALYZERS]
Amplidue from give analyzer vs reference.
#define NZCOLSSMOD
TF1 * f
Definition: interpolTest.C:21
#define NXROWSSMOD
Float_t GetAmp() const
Raw data fitting: standard TMinuit fit.
int fMonCol2
column index, for tower 2
void InitHistograms(std::vector< AliCaloRawAnalyzer * > analyzers, AliCaloRawAnalyzer *ref)
TH1D * fAmpHistograms[NANALYZERS][NZCOLSSMOD][NXROWSSMOD]
amplitude histos
void SetIsZeroSuppressed(bool iszs=true)
TH2D * fAmplitudeVsEvent[NANALYZERS]
Amplitude vs envent number.
TH1D * fTofDiff[NANALYZERS]
Difference in tof between reference.
Raw data fitting: Peak Finder.
AliCaloFitResults fMon2[NANALYZERS]
results for tower 2
TH1D * fAmpDiff[NANALYZERS]
Difference in amplitude between reference.