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 *
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 *
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 **************************************************************************/
18 #include "AliCaloRawAnalyzerComparison.h"
20 #include "AliCaloRawAnalyzerCrude.h"
21 #include "AliCaloRawAnalyzerLMS.h"
22 #include "AliCaloRawAnalyzerFastFit.h"
23 #include "AliCaloRawAnalyzerNN.h"
24 #include "AliCaloRawAnalyzerPeakFinder.h"
26 #include "AliCaloFitResults.h"
35 AliCaloRawAnalyzerComparison::AliCaloRawAnalyzerComparison() : fMod(0),
41 fReferenceAnalyzer = new AliCaloRawAnalyzerLMS();
43 AliCaloRawAnalyzerCrude *crude = new AliCaloRawAnalyzerCrude();
44 AliCaloRawAnalyzerLMS *lms = new AliCaloRawAnalyzerLMS();
45 AliCaloRawAnalyzerFastFit *fastfit = new AliCaloRawAnalyzerFastFit();
46 AliCaloRawAnalyzerNN *neuralnet = new AliCaloRawAnalyzerNN();
47 AliCaloRawAnalyzerPeakFinder *peakfinder = new AliCaloRawAnalyzerPeakFinder();
49 fReferenceAnalyzer->SetIsZeroSuppressed();
50 peakfinder->SetIsZeroSuppressed();
51 lms->SetIsZeroSuppressed();
52 fastfit->SetIsZeroSuppressed();
53 neuralnet->SetIsZeroSuppressed();
54 crude->SetIsZeroSuppressed();
56 fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)crude);
57 fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)lms);
58 fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)fastfit);
59 fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)neuralnet);
61 fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)peakfinder);
62 InitHistograms( fRawAnalyzers, fReferenceAnalyzer );
66 AliCaloRawAnalyzerComparison::~AliCaloRawAnalyzerComparison()
73 AliCaloRawAnalyzerComparison::Evaluate( const vector<AliCaloBunchInfo> &bunchvector, const UInt_t altrocfg1,
74 const UInt_t altrocfg2, const int event, const int col, const int row )
76 // cout << __FILE__ << __LINE__ << endl;
78 AliCaloFitResults ref = fReferenceAnalyzer->Evaluate( bunchvector, altrocfg1, altrocfg2 );
79 // AliCaloFitResults ref;
81 for(int i=0; i < fRawAnalyzers.size(); i++ )
83 AliCaloFitResults an = fRawAnalyzers.at(i)->Evaluate( bunchvector, altrocfg1, altrocfg2 );
85 // cout << __FILE__ << __LINE__ << ":" << fRawAnalyzers.at(i)->GetAlgoAbbr() << " col = " << col << " row " << row << " amp= " << an.GetAmp() << endl ;
87 // fAmplitudeVsEvent[i]->Fill( event, an.GetAmp() );
88 // fTofVsEvent[i]->Fill( event, an.GetTof() );
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() );
95 if(col == fMonCol1 && fMonRow1 == row )
97 fAmplitudeVsEvent[i]->Fill( event, an.GetAmp() );
98 fTofVsEvent[i]->Fill( event, an.GetTof() );
102 if(col == fMonCol2 && row == fMonRow2 )
107 if(row >= 0 && col >= 0 )
109 fAmpHistograms[i][col][row]->Fill( an.GetAmp() );
117 AliCaloRawAnalyzerComparison::EventChanged()
119 for(int i=0; i < fRawAnalyzers.size(); i++ )
122 if( ( fMon1[i].GetAmp() > 50 && fMon2[i].GetAmp() > 50 ) && ( fMon1[i].GetAmp() < 1023 && fMon2[i].GetAmp() < 1023 ) )
124 cout << __FILE__ << __LINE__ << fRawAnalyzers.at(i)->GetAlgoAbbr() << "\tamp1=" << fMon1[i].GetAmp() << "\tamp2 = " << fMon2[i].GetAmp() << endl;
128 if( fMon1[i].GetAmp() > 50 && fMon2[i].GetAmp() > 50 )
130 // if( fMon1[i].GetTof() != fMon2[i].GetTof())
132 // fTofResDifferential[i]->Fill( ( fMon1[i].GetTof() - fMon2[i].GetTof())/TMath::Sqrt(2) );
133 fTofResDifferential[i]->Fill( ( fMon1[i].GetTof() - fMon2[i].GetTof()) );
134 fTofResAbsolute[i]->Fill( fMon1[i].GetTof() );
142 AliCaloRawAnalyzerComparison::WriteHistograms()
143 { // write histograms
144 TFile *f = new TFile("comparison2.root", "recreate");
147 for(int col=0; col < NZCOLSSMOD; col ++ )
149 for(int row=0; row < NXROWSSMOD; row ++ )
151 fAmpHistograms[col][row]->Write();
156 for(int i=0; i < fRawAnalyzers.size(); i++ )
158 for(int col=0; col < NZCOLSSMOD; col ++ )
160 for(int row=0; row < NXROWSSMOD; row ++ )
162 fAmpHistograms[i][col][row]->Write();
166 fAmplitudeVsEvent[i]->Write();
167 fTofVsEvent[i]->Write();
168 fRefAmpVsAnalyzers[i]->Write();
169 fRefTofVsAnalyzers[i]->Write();
170 fAmpDiff[i]->Write();
171 fTofDiff[i]->Write();
172 fTofResDifferential[i]->Write();
173 fTofResAbsolute[i]->Write();
182 AliCaloRawAnalyzerComparison::InitHistograms( vector <AliCaloRawAnalyzer*> analyzers, AliCaloRawAnalyzer* ref )
187 for(int col=0; col < NZCOLSSMOD; col ++ )
189 for(int row=0; row < NXROWSSMOD; row ++ )
191 sprintf(tmpname, "z(col)%d_x(row)%d_amplitude;Counts;Amplitude/ADC counts", col, row);
192 fAmpHistograms[col][row] = new TH1D(tmpname, tmpname, 1024, 0, 1023 );
197 // TH1D *fAmpHistograms[NZCOLSSMOD][NXROWSSMOD];
199 for(int i=0; i < analyzers.size(); i++ )
201 for(int col=0; col < NZCOLSSMOD; col ++ )
203 for(int row=0; row < NXROWSSMOD; row ++ )
205 sprintf(tmpname, "z(col)%d_x(row)%d_amplitude_%s;Amplitude/ADC counts;Counts", col, row, analyzers.at(i)->GetAlgoAbbr() );
206 fAmpHistograms[i][col][row] = new TH1D(tmpname, tmpname, 1024, 0, 1023 );
210 sprintf(tmpname, "%s_amplitude_vs_event_row%d_col%d;Event;Amplitude/ADC counts", analyzers.at(i)->GetAlgoAbbr(), fMonRow1, fMonCol1 );
211 fAmplitudeVsEvent[i]=new TH2D(tmpname, tmpname, 8000, 0, 7999, 1024, 0, 1023 );
213 sprintf(tmpname, "%s_tof_vs_event_row%d_col%d;Event;Amplitude/ADC counts", analyzers.at(i)->GetAlgoAbbr(), fMonRow1, fMonCol1 );
215 // fTofVsEvent[i]=new TH2D(tmpname, tmpname, 8000, 0, 7999, 2000, 3000, 5000);
216 fTofVsEvent[i]=new TH2D(tmpname, tmpname, 8000, 0, 7999, 2000, 1000, 4000);
219 sprintf(tmpname, "%s_vs_%s_ampltude; Amplitude_{%s}/ADC counts; Amplitude_{%s}/ADC counts", ref->GetAlgoAbbr(),
220 analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr() );
221 fRefAmpVsAnalyzers[i] = new TH2D(tmpname, tmpname, 1024, 0, 1023, 1024, 0, 1023);
222 sprintf(tmpname, "%s_vs_%s_tof; tof_{%s}/ns; tof_{%s}/ns", ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr() );
223 fRefTofVsAnalyzers[i] = new TH2D(tmpname, tmpname, 500, 2000, 4999, 500, 2000, 4999 );
224 sprintf( tmpname, "%s-%s amplitude;counts;A_{%s} - A_{%s}", ref->GetAlgoAbbr(),
225 analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr());
226 fAmpDiff[i] = new TH1D(tmpname, tmpname, 100, -10, 10 );
227 sprintf( tmpname, "%s-%s tof;counts;A_{%s} - A_{%s}", ref->GetAlgoAbbr(),
228 analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr());
229 fTofDiff[i] = new TH1D(tmpname, tmpname, 1000, -5000, 5000 );
230 sprintf( tmpname, "%s Differential tof resolution (%d, %d) vs (%d, %d);#sigma_{tof}^{%s}/ns;Counts", analyzers.at(i)->GetAlgoAbbr(), fMonCol1, fMonRow1, fMonCol2, fMonRow2,
231 analyzers.at(i)->GetAlgoAbbr() );
232 fTofResDifferential[i] = new TH1D(tmpname, tmpname, 1000, -250, 250 );
233 sprintf( tmpname, "%s Absolute tof distribution (%d, %d);#sigma_{tof}^{%s}/ns;Counts", analyzers.at(i)->GetAlgoAbbr(), fMonCol1, fMonRow1, analyzers.at(i)->GetAlgoAbbr() );
235 fTofResAbsolute[i] = new TH1D(tmpname, tmpname, 2000 , -1000, 7000 );