]>
Commit | Line | Data |
---|---|---|
deeffe5c | 1 | /******************************************************************************* |
2 | * Copyright(c) 2003, IceCube Experiment at the South Pole. All rights reserved. | |
3 | * | |
4 | * Author: The IceCube RALICE-based Offline 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. | |
12 | * The authors make no claims about the suitability of this software for | |
13 | * any purpose. It is provided "as is" without express or implied warranty. | |
14 | *******************************************************************************/ | |
15 | ||
16 | // $Id$ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////// | |
19 | // Class IceXtalk | |
20 | // TTask derived class to perform cross talk hit correction. | |
21 | // | |
95f2b820 | 22 | // Note : This processor only acts on MuDaq data. |
23 | // | |
deeffe5c | 24 | // This task takes the current event in memory and uses the attached |
25 | // OM database to identify pairs of OMs which might induce cross talk. | |
26 | // For each particular transmitter and receiver pair within the event | |
27 | // a probability for cross talk induction is determined on basis of | |
28 | // the hit data and the cross talk probability functions from the OM database. | |
29 | // If this probability is above a certain threshold "pmin" and the difference | |
30 | // in LE between transmitter and receiver signal is within the bounds as | |
31 | // given by the Xtalk calibration data, the occurrence of a cross talk signal | |
32 | // of "pe" photo-electrons in the receiver is assumed and this signal is | |
33 | // lateron subtracted from the receiver ADC signal. | |
34 | // The subtraction of the Xtalk signal from the various hits is delayed | |
35 | // until the very end, since receiver OMs may also act as transmitter OMs | |
36 | // for other pair combinations. | |
37 | // In case a transmitter OM was flagged as a bad module, the check on the | |
38 | // LE time difference will not be performed and a cross talk induction | |
39 | // decision will be solely based on the corresponding probability, since | |
40 | // the latter only depends on the un-calibrated signal amplitude of the | |
41 | // transmitter hit. | |
42 | // So, hits which have induced cross talk are not completely removed | |
43 | // but their signal is corrected for the cross talk. | |
44 | // This will prevent severe losses when studying UHE events, where cross | |
45 | // talk effects are expected to have negligible effects on the observed | |
46 | // large module signals. | |
47 | // | |
6f94f699 | 48 | // Note : The amount with which the ADC value was corrected is stored |
49 | // in the signal as an ADC offset. This will allow easy investigation | |
50 | // of Xtalk corrected signals and also enables successive | |
51 | // applications of this Xtalk processor to investigate (systematic) | |
52 | // effects of various criteria. | |
53 | // Example : In case an amount of 1 pe was subtracted from the ADC | |
54 | // value, the ADC offset will be set to 1. | |
55 | // | |
deeffe5c | 56 | // The values of "pmin" and "pe" can be set by the user via the |
57 | // SetMinProb() and SetXtalkPE() memberfunctions. | |
58 | // The default values are pmin=0.5 and pe=1. | |
59 | // | |
25eefd00 | 60 | // Information about the actual parameter settings can be found in the event |
61 | // structure itself via the device named "IceXtalk". | |
62 | // | |
deeffe5c | 63 | // In case this processor is followed by an ADC threshold hit cleaning |
64 | // procedure, hits which only contained cross talk can be efficiently | |
65 | // skipped or removed from the event. | |
66 | // In case one would like to always remove a hit which containes induced | |
67 | // cross talk, one could set the "pe" parameter to some very large value. | |
68 | // This will result in cross talk induced hits to get large negative ADC | |
69 | // signals and can as such easily be skipped/removed afterwards. | |
70 | // | |
71 | // Note : This processor only works properly on Time and ADC calibrated data. | |
eb90778a | 72 | // In case no OM database has been specified for this processor, |
73 | // no cross talk hit correction will be performed. | |
deeffe5c | 74 | // |
75 | //--- Author: Nick van Eijndhoven 11-aug-2005 Utrecht University | |
76 | //- Modified: NvE $Date$ Utrecht University | |
77 | /////////////////////////////////////////////////////////////////////////// | |
78 | ||
79 | #include "IceXtalk.h" | |
80 | #include "Riostream.h" | |
81 | ||
82 | ClassImp(IceXtalk) // Class implementation to enable ROOT I/O | |
83 | ||
84 | IceXtalk::IceXtalk(const char* name,const char* title) : TTask(name,title) | |
85 | { | |
86 | // Default constructor. | |
87 | fCalfile=0; | |
88 | fOmdb=0; | |
89 | fPmin=0.5; | |
90 | fPe=1; | |
91 | } | |
92 | /////////////////////////////////////////////////////////////////////////// | |
93 | IceXtalk::~IceXtalk() | |
94 | { | |
95 | // Default destructor. | |
96 | if (fCalfile) | |
97 | { | |
98 | delete fCalfile; | |
99 | fCalfile=0; | |
100 | } | |
101 | } | |
102 | /////////////////////////////////////////////////////////////////////////// | |
103 | void IceXtalk::SetOMdbase(AliObjMatrix* omdb) | |
104 | { | |
105 | // Set the pointer to the OM database. | |
106 | // Note : this will overrule a previously attached database. | |
107 | fOmdb=omdb; | |
108 | } | |
109 | /////////////////////////////////////////////////////////////////////////// | |
110 | void IceXtalk::SetCalibFile(TString name) | |
111 | { | |
112 | // Set the calibration ROOT file as created with IceCal2Root. | |
113 | // Note : this will overrule a previously attached database. | |
114 | fCalfile=new TFile(name.Data()); | |
deeffe5c | 115 | } |
116 | /////////////////////////////////////////////////////////////////////////// | |
117 | void IceXtalk::SetMinProb(Float_t pmin) | |
118 | { | |
119 | // Set the minimal probability for cross talk induction. | |
120 | fPmin=pmin; | |
121 | } | |
122 | /////////////////////////////////////////////////////////////////////////// | |
123 | void IceXtalk::SetXtalkPE(Float_t pe) | |
124 | { | |
125 | // Set the nominal Xtalk signal in photo-electron equivalent. | |
126 | fPe=pe; | |
127 | } | |
128 | /////////////////////////////////////////////////////////////////////////// | |
129 | void IceXtalk::Exec(Option_t* opt) | |
130 | { | |
131 | // Implementation of cross talk hit correction. | |
132 | ||
133 | TString name=opt; | |
134 | AliJob* parent=(AliJob*)(gROOT->GetListOfTasks()->FindObject(name.Data())); | |
135 | ||
136 | if (!parent) return; | |
137 | ||
138 | IceEvent* evt=(IceEvent*)parent->GetObject("IceEvent"); | |
139 | if (!evt) return; | |
140 | ||
95f2b820 | 141 | Int_t mudaq=0; |
142 | Int_t twrdaq=0; | |
143 | AliSignal* daq=(AliSignal*)evt->GetDevice("Daq"); | |
eff2c77c | 144 | mudaq=int(daq->GetSignal("Muon")); |
145 | twrdaq=int(daq->GetSignal("TWR")); | |
95f2b820 | 146 | |
147 | // This cross talk correction processor is only for MuDaq data | |
148 | if (!mudaq) return; | |
149 | ||
150 | if (fCalfile) | |
151 | { | |
152 | fOmdb=(AliObjMatrix*)fCalfile->Get("MuDaq-OMDBASE"); | |
153 | // Next statement for compatibility with old calibration file format | |
154 | if (!fOmdb) fOmdb=(AliObjMatrix*)fCalfile->Get("Cal-OMDBASE"); | |
155 | } | |
156 | ||
157 | if (!fOmdb) return; | |
158 | ||
25eefd00 | 159 | // Storage of the used parameters in the IceXtalk device |
160 | AliSignal params; | |
161 | params.SetNameTitle("IceXtalk","IceXtalk processor parameters"); | |
162 | params.SetSlotName("Pmin",1); | |
163 | params.SetSlotName("Pe",2); | |
164 | ||
165 | params.SetSignal(fPmin,1); | |
166 | params.SetSignal(fPe,2); | |
167 | ||
168 | evt->AddDevice(params); | |
169 | ||
69884331 | 170 | // All Amanda OMs with a signal |
171 | TObjArray* mods=evt->GetDevices("IceAOM"); | |
172 | ||
173 | Int_t nmods=mods->GetEntries(); | |
174 | if (!nmods) return; | |
175 | ||
deeffe5c | 176 | TObjArray xhits; // Array with pointers to Xtalk hits to be corrected |
177 | ||
178 | IceAOM* omt=0; // Transmitter OM | |
179 | IceAOM* omr=0; // Receiver OM | |
180 | TF1* fxtalk=0; // The Xtalk probability function | |
181 | Int_t idtrans=0; | |
182 | Int_t idrec=0; | |
183 | Float_t adct=0,let=0; | |
184 | Float_t p=0; | |
185 | Float_t adcr=0,ler=0; | |
186 | Int_t ibad=0; | |
187 | Float_t cpar=0,bpar=0,dlemin=0,dlemax=0,test=0; | |
188 | Float_t dle=0; | |
189 | Float_t sigcor=0; | |
69884331 | 190 | for (Int_t imod=0; imod<nmods; imod++) |
deeffe5c | 191 | { |
69884331 | 192 | omt=(IceAOM*)mods->At(imod); |
deeffe5c | 193 | if (!omt) continue; |
194 | idtrans=omt->GetUniqueID(); | |
195 | ||
196 | // Also take bad transmitter modules into account | |
197 | ibad=omt->GetDeadValue("ADC"); | |
198 | if (ibad) omt->SetAlive("ADC"); | |
199 | ||
200 | // Check for corresponding receiver modules | |
69884331 | 201 | for (Int_t jmod=0; jmod<nmods; jmod++) |
deeffe5c | 202 | { |
203 | // No Xtalk from a module to itself | |
69884331 | 204 | if (jmod==imod) continue; |
deeffe5c | 205 | |
69884331 | 206 | omr=(IceAOM*)mods->At(jmod); |
deeffe5c | 207 | if (!omr) continue; |
208 | idrec=omr->GetUniqueID(); | |
209 | ||
210 | fxtalk=(TF1*)fOmdb->GetObject(idtrans,idrec+1); | |
211 | if (!fxtalk) continue; | |
212 | ||
213 | // Determine Xtalk probability for each transmitter hit | |
214 | for (Int_t ithit=1; ithit<=omt->GetNhits(); ithit++) | |
215 | { | |
216 | AliSignal* st=omt->GetHit(ithit); | |
217 | if (!st) continue; | |
218 | ||
6f94f699 | 219 | // Eliminate possible previous Xtalk correction |
220 | sigcor=st->GetOffset("ADC"); | |
221 | st->AddSignal(sigcor,"ADC"); | |
222 | st->ResetOffset("ADC"); | |
deeffe5c | 223 | adct=st->GetSignal("ADC",-4); // Get uncalibrated amplitude |
224 | dlemin=fxtalk->GetParameter("dLE-min"); | |
225 | dlemax=fxtalk->GetParameter("dLE-max"); | |
226 | // Protection against overflow in Xtalk prob. function | |
227 | cpar=fxtalk->GetParameter("C"); | |
228 | bpar=fxtalk->GetParameter("B"); | |
229 | test=(adct-cpar)/bpar; | |
230 | if (test>100) | |
231 | { | |
232 | p=1; | |
233 | } | |
234 | else if (test<-100) | |
235 | { | |
236 | p=0; | |
237 | } | |
238 | else | |
239 | { | |
240 | p=fxtalk->Eval(adct); | |
241 | } | |
242 | if (p<fPmin) continue; | |
243 | ||
244 | // Xtalk flagging for each receiver hit | |
245 | for (Int_t irhit=1; irhit<=omr->GetNhits(); irhit++) | |
246 | { | |
247 | AliSignal* sr=omr->GetHit(irhit); | |
248 | if (!sr) continue; | |
249 | ||
250 | // Check calibrated LE time differences | |
251 | if (!ibad) | |
252 | { | |
253 | let=st->GetSignal("LE",4); | |
254 | ler=sr->GetSignal("LE",4); | |
255 | dle=ler-let; | |
256 | if (dle<dlemin || dle>dlemax) continue; | |
257 | } | |
258 | // Register this receiver hit to be corrected | |
259 | xhits.Add(sr); | |
260 | } | |
261 | } // end of transmitter hit loop | |
262 | } // end of receiver OM loop | |
263 | ||
264 | // Restore the original transmitter dead flag value | |
265 | if (ibad) omt->SetDead("ADC"); | |
266 | } // end of transmitter OM loop | |
267 | ||
268 | // Perform the Xtalk signal correction to the registered receiver hits | |
6f94f699 | 269 | // The correction value is stored in the signal data as an offset value |
deeffe5c | 270 | for (Int_t ix=0; ix<xhits.GetEntries(); ix++) |
271 | { | |
272 | AliSignal* sx=(AliSignal*)xhits.At(ix); | |
273 | if (!sx) continue; | |
6f94f699 | 274 | |
275 | // Eliminate possible previous Xtalk correction | |
276 | sigcor=sx->GetOffset("ADC"); | |
277 | adcr=sx->GetSignal("ADC")+sigcor; | |
deeffe5c | 278 | sigcor=fPe; |
279 | // If stored ADC data is un-calibrated, convert fPe to raw ADC value | |
280 | AliSignal* parent=(AliSignal*)sx->GetDevice(); | |
281 | if (parent) | |
282 | { | |
283 | if (parent->GetCalFunction("ADC")); | |
284 | { | |
285 | idrec=parent->GetUniqueID(); | |
286 | omr=(IceAOM*)fOmdb->GetObject(idrec,1); | |
287 | TF1* fdecal=0; | |
288 | if (omr) fdecal=omr->GetDecalFunction("ADC"); | |
289 | if (fdecal) sigcor=fdecal->Eval(fPe); | |
290 | } | |
291 | } | |
292 | adcr=adcr-sigcor; | |
293 | sx->SetSignal(adcr,"ADC"); | |
6f94f699 | 294 | sx->SetOffset(sigcor,"ADC"); |
deeffe5c | 295 | } |
296 | } | |
297 | /////////////////////////////////////////////////////////////////////////// |