]>
Commit | Line | Data |
---|---|---|
48a2e3eb | 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 | **************************************************************************/ | |
18 | #include "AliCaloRawAnalyzerComparison.h" | |
19 | ||
20 | #include "AliCaloRawAnalyzerCrude.h" | |
ccfdd67f | 21 | #include "AliCaloRawAnalyzerKStandard.h" |
48a2e3eb | 22 | #include "AliCaloRawAnalyzerFastFit.h" |
23 | #include "AliCaloRawAnalyzerNN.h" | |
24 | #include "AliCaloRawAnalyzerPeakFinder.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 | ||
35 | AliCaloRawAnalyzerComparison::AliCaloRawAnalyzerComparison() : fMod(0), | |
36 | fMonCol1(1), | |
37 | fMonRow1(15), | |
38 | fMonCol2(1), | |
39 | fMonRow2(16) | |
ccfdd67f | 40 | { |
41 | // ctor | |
42 | ||
43 | fReferenceAnalyzer = new AliCaloRawAnalyzerKStandard(); | |
48a2e3eb | 44 | |
ccfdd67f | 45 | AliCaloRawAnalyzerCrude *crude = new AliCaloRawAnalyzerCrude(); |
46 | AliCaloRawAnalyzerKStandard *lms = new AliCaloRawAnalyzerKStandard(); | |
47 | AliCaloRawAnalyzerFastFit *fastfit = new AliCaloRawAnalyzerFastFit(); | |
48 | AliCaloRawAnalyzerNN *neuralnet = new AliCaloRawAnalyzerNN(); | |
48a2e3eb | 49 | AliCaloRawAnalyzerPeakFinder *peakfinder = new AliCaloRawAnalyzerPeakFinder(); |
50 | ||
51 | fReferenceAnalyzer->SetIsZeroSuppressed(); | |
ccfdd67f | 52 | peakfinder ->SetIsZeroSuppressed(); |
53 | lms ->SetIsZeroSuppressed(); | |
54 | fastfit ->SetIsZeroSuppressed(); | |
55 | neuralnet ->SetIsZeroSuppressed(); | |
56 | crude ->SetIsZeroSuppressed(); | |
48a2e3eb | 57 | |
58 | fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)crude); | |
59 | fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)lms); | |
60 | fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)fastfit); | |
61 | fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)neuralnet); | |
62 | ||
63 | fRawAnalyzers.push_back( (AliCaloRawAnalyzer*)peakfinder); | |
85a699d8 | 64 | InitHistograms( fRawAnalyzers, fReferenceAnalyzer ); |
ccfdd67f | 65 | } |
48a2e3eb | 66 | |
67 | void | |
68 | AliCaloRawAnalyzerComparison::Evaluate( const vector<AliCaloBunchInfo> &bunchvector, const UInt_t altrocfg1, | |
69 | const UInt_t altrocfg2, const int event, const int col, const int row ) | |
85a699d8 | 70 | { // evaluate methods |
48a2e3eb | 71 | // cout << __FILE__ << __LINE__ << endl; |
ccfdd67f | 72 | |
48a2e3eb | 73 | AliCaloFitResults ref = fReferenceAnalyzer->Evaluate( bunchvector, altrocfg1, altrocfg2 ); |
74 | // AliCaloFitResults ref; | |
ccfdd67f | 75 | |
48a2e3eb | 76 | for(int i=0; i < fRawAnalyzers.size(); i++ ) |
ccfdd67f | 77 | { |
78 | AliCaloFitResults an = fRawAnalyzers.at(i)->Evaluate( bunchvector, altrocfg1, altrocfg2 ); | |
79 | ||
80 | // cout << __FILE__ << __LINE__ << ":" << fRawAnalyzers.at(i)->GetAlgoAbbr() << " col = " << col << " row " << row << " amp= " << an.GetAmp() << endl ; | |
81 | ||
82 | // fAmplitudeVsEvent[i]->Fill( event, an.GetAmp() ); | |
83 | // fTofVsEvent[i]->Fill( event, an.GetTof() ); | |
84 | ||
85 | fRefAmpVsAnalyzers[i]->Fill(ref.GetAmp(), an.GetAmp() ); | |
86 | fRefTofVsAnalyzers[i]->Fill(ref.GetTof(), an.GetTof() ); | |
87 | fAmpDiff[i]->Fill(ref.GetAmp() - an.GetAmp() ); | |
88 | fTofDiff[i]->Fill(ref.GetTof() - an.GetTof() ); | |
89 | ||
90 | if(col == fMonCol1 && fMonRow1 == row ) | |
48a2e3eb | 91 | { |
ccfdd67f | 92 | fAmplitudeVsEvent[i]->Fill( event, an.GetAmp() ); |
93 | fTofVsEvent[i]->Fill( event, an.GetTof() ); | |
94 | fMon1[i] = an; | |
95 | } | |
96 | ||
97 | if(col == fMonCol2 && row == fMonRow2 ) | |
98 | { | |
99 | fMon2[i] = an; | |
100 | } | |
101 | ||
102 | if(row >= 0 && col >= 0 ) | |
103 | { | |
104 | fAmpHistograms[i][col][row]->Fill( an.GetAmp() ); | |
48a2e3eb | 105 | } |
ccfdd67f | 106 | } |
48a2e3eb | 107 | } |
108 | ||
48a2e3eb | 109 | void |
110 | AliCaloRawAnalyzerComparison::EventChanged() | |
85a699d8 | 111 | { // new event |
48a2e3eb | 112 | for(int i=0; i < fRawAnalyzers.size(); i++ ) |
ccfdd67f | 113 | { |
114 | /* | |
115 | if( ( fMon1[i].GetAmp() > 50 && fMon2[i].GetAmp() > 50 ) && ( fMon1[i].GetAmp() < 1023 && fMon2[i].GetAmp() < 1023 ) ) | |
116 | { | |
117 | cout << __FILE__ << __LINE__ << fRawAnalyzers.at(i)->GetAlgoAbbr() << "\tamp1=" << fMon1[i].GetAmp() << "\tamp2 = " << fMon2[i].GetAmp() << endl; | |
118 | } | |
119 | */ | |
120 | ||
121 | if( fMon1[i].GetAmp() > 50 && fMon2[i].GetAmp() > 50 ) | |
48a2e3eb | 122 | { |
ccfdd67f | 123 | // if( fMon1[i].GetTof() != fMon2[i].GetTof()) |
124 | { | |
125 | // fTofResDifferential[i]->Fill( ( fMon1[i].GetTof() - fMon2[i].GetTof())/TMath::Sqrt(2) ); | |
126 | fTofResDifferential[i]->Fill( ( fMon1[i].GetTof() - fMon2[i].GetTof()) ); | |
127 | fTofResAbsolute[i]->Fill( fMon1[i].GetTof() ); | |
128 | } | |
48a2e3eb | 129 | } |
ccfdd67f | 130 | } |
48a2e3eb | 131 | } |
132 | ||
133 | ||
134 | void | |
135 | AliCaloRawAnalyzerComparison::WriteHistograms() | |
ccfdd67f | 136 | { // write histograms |
48a2e3eb | 137 | TFile *f = new TFile("comparison2.root", "recreate"); |
138 | ||
139 | /* | |
ccfdd67f | 140 | for(int col=0; col < NZCOLSSMOD; col ++ ) |
141 | { | |
142 | for(int row=0; row < NXROWSSMOD; row ++ ) | |
143 | { | |
144 | fAmpHistograms[col][row]->Write(); | |
145 | } | |
146 | } | |
147 | */ | |
148 | ||
48a2e3eb | 149 | for(int i=0; i < fRawAnalyzers.size(); i++ ) |
ccfdd67f | 150 | { |
151 | for(int col=0; col < NZCOLSSMOD; col ++ ) | |
48a2e3eb | 152 | { |
ccfdd67f | 153 | for(int row=0; row < NXROWSSMOD; row ++ ) |
48a2e3eb | 154 | { |
155 | fAmpHistograms[i][col][row]->Write(); | |
156 | } | |
ccfdd67f | 157 | } |
158 | ||
159 | fAmplitudeVsEvent[i]->Write(); | |
160 | fTofVsEvent[i]->Write(); | |
161 | fRefAmpVsAnalyzers[i]->Write(); | |
162 | fRefTofVsAnalyzers[i]->Write(); | |
163 | fAmpDiff[i]->Write(); | |
164 | fTofDiff[i]->Write(); | |
165 | fTofResDifferential[i]->Write(); | |
166 | fTofResAbsolute[i]->Write(); | |
167 | ||
168 | } | |
169 | ||
48a2e3eb | 170 | f->Close(); |
171 | } | |
172 | ||
173 | ||
174 | void | |
85a699d8 | 175 | AliCaloRawAnalyzerComparison::InitHistograms( vector <AliCaloRawAnalyzer*> analyzers, AliCaloRawAnalyzer* ref ) |
ccfdd67f | 176 | { // init histograms |
48a2e3eb | 177 | char tmpname[256]; |
ccfdd67f | 178 | |
179 | /* | |
180 | for(int col=0; col < NZCOLSSMOD; col ++ ) | |
181 | { | |
182 | for(int row=0; row < NXROWSSMOD; row ++ ) | |
183 | { | |
184 | sprintf(tmpname, "z(col)%d_x(row)%d_amplitude;Counts;Amplitude/ADC counts", col, row); | |
185 | fAmpHistograms[col][row] = new TH1D(tmpname, tmpname, 1024, 0, 1023 ); | |
186 | } | |
187 | } | |
188 | */ | |
189 | ||
48a2e3eb | 190 | // TH1D *fAmpHistograms[NZCOLSSMOD][NXROWSSMOD]; |
ccfdd67f | 191 | |
48a2e3eb | 192 | for(int i=0; i < analyzers.size(); i++ ) |
ccfdd67f | 193 | { |
194 | for(int col=0; col < NZCOLSSMOD; col ++ ) | |
48a2e3eb | 195 | { |
ccfdd67f | 196 | for(int row=0; row < NXROWSSMOD; row ++ ) |
48a2e3eb | 197 | { |
198 | sprintf(tmpname, "z(col)%d_x(row)%d_amplitude_%s;Amplitude/ADC counts;Counts", col, row, analyzers.at(i)->GetAlgoAbbr() ); | |
199 | fAmpHistograms[i][col][row] = new TH1D(tmpname, tmpname, 1024, 0, 1023 ); | |
200 | } | |
48a2e3eb | 201 | } |
ccfdd67f | 202 | |
203 | sprintf(tmpname, "%s_amplitude_vs_event_row%d_col%d;Event;Amplitude/ADC counts", analyzers.at(i)->GetAlgoAbbr(), fMonRow1, fMonCol1 ); | |
204 | fAmplitudeVsEvent[i]=new TH2D(tmpname, tmpname, 8000, 0, 7999, 1024, 0, 1023 ); | |
205 | ||
206 | sprintf(tmpname, "%s_tof_vs_event_row%d_col%d;Event;Amplitude/ADC counts", analyzers.at(i)->GetAlgoAbbr(), fMonRow1, fMonCol1 ); | |
207 | ||
208 | // fTofVsEvent[i]=new TH2D(tmpname, tmpname, 8000, 0, 7999, 2000, 3000, 5000); | |
209 | fTofVsEvent[i]=new TH2D(tmpname, tmpname, 8000, 0, 7999, 2000, 1000, 4000); | |
210 | ||
211 | ||
212 | sprintf(tmpname, "%s_vs_%s_ampltude; Amplitude_{%s}/ADC counts; Amplitude_{%s}/ADC counts", ref->GetAlgoAbbr(), | |
213 | analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr() ); | |
214 | fRefAmpVsAnalyzers[i] = new TH2D(tmpname, tmpname, 1024, 0, 1023, 1024, 0, 1023); | |
215 | sprintf(tmpname, "%s_vs_%s_tof; tof_{%s}/ns; tof_{%s}/ns", ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr() ); | |
216 | fRefTofVsAnalyzers[i] = new TH2D(tmpname, tmpname, 500, 2000, 4999, 500, 2000, 4999 ); | |
217 | sprintf( tmpname, "%s-%s amplitude;counts;A_{%s} - A_{%s}", ref->GetAlgoAbbr(), | |
218 | analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr()); | |
219 | fAmpDiff[i] = new TH1D(tmpname, tmpname, 100, -10, 10 ); | |
220 | sprintf( tmpname, "%s-%s tof;counts;A_{%s} - A_{%s}", ref->GetAlgoAbbr(), | |
221 | analyzers.at(i)->GetAlgoAbbr(), ref->GetAlgoAbbr(), analyzers.at(i)->GetAlgoAbbr()); | |
222 | fTofDiff[i] = new TH1D(tmpname, tmpname, 1000, -5000, 5000 ); | |
223 | sprintf( tmpname, "%s Differential tof resolution (%d, %d) vs (%d, %d);#sigma_{tof}^{%s}/ns;Counts", analyzers.at(i)->GetAlgoAbbr(), fMonCol1, fMonRow1, fMonCol2, fMonRow2, | |
224 | analyzers.at(i)->GetAlgoAbbr() ); | |
225 | fTofResDifferential[i] = new TH1D(tmpname, tmpname, 1000, -250, 250 ); | |
226 | sprintf( tmpname, "%s Absolute tof distribution (%d, %d);#sigma_{tof}^{%s}/ns;Counts", analyzers.at(i)->GetAlgoAbbr(), fMonCol1, fMonRow1, analyzers.at(i)->GetAlgoAbbr() ); | |
227 | ||
228 | fTofResAbsolute[i] = new TH1D(tmpname, tmpname, 2000 , -1000, 7000 ); | |
229 | ||
230 | ||
231 | } | |
48a2e3eb | 232 | } |
233 |