1 /*******************************************************************************
2 * Copyright(c) 2003, IceCube Experiment at the South Pole. All rights reserved.
4 * Author: The IceCube RALICE-based Offline Project.
5 * Contributors are mentioned in the code where appropriate.
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 *******************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////
20 // TTask derived class to perform hit cleaning.
22 // The code in this processor is based on the algorithms as developed
23 // by Oladipo Fadiran and George Japaridze (Clark Atlanta University, USA).
25 // Criteria applied for Amanda modules :
26 // -------------------------------------
27 // 1) ADC within [min,max] Default : [0.3,999999] PE
28 // 2) TOT within [min,max] Default : electrical [125,2000] optical [20,2000] ns
29 // 3) abs(LE-Ttrig)<=win Default : win=2250 TDC counts
30 // where : LE=uncalibrated hit LE (i.e. TDC counts) Ttrig=trigger pulse LE in TDC counts
31 // 4) At least one hit in another OM within radius R and time difference dt
32 // to remove isolated hits. Defaults : R=70 m dt=500 ns
34 // The defaults of the various parameters can be changed by the corresponding
35 // Set memberfunctions.
37 // Information about the actual parameter settings can be found in the event
38 // structure itself via the device named "IceCleanHits".
40 // Concerning the trigger time :
41 // -----------------------------
42 // By default the trigger time is obtained automatically from the IceEvent structure
43 // via the device called "Trigger".
44 // The uncalibrated LE (i.e. TDC counts) of a specified trigger pulse is used.
45 // The user can impose a specific trigger name or time to be used
46 // by invokation of the memberfunctions SetTnameA or SetTtimeA, respectively.
47 // Specification of a negative trigger time will result in the automatic
48 // trigger time setting corresponding to the "main" trigger.
49 // By default the trigger time of the "main" trigger will be used.
51 // The hits which do not fullfill the criteria are flagged "dead" for the
52 // corresponding signal slot. This means they are still present in the
53 // IceEvent structure and are as such still accessible.
54 // It is left to the user to decide (based on the various "dead" flag settings)
55 // whether or not to use these hits in his/her reconstruction or analysis.
57 // Note : This processor only works properly on Time and ADC calibrated data.
59 //--- Author: Nick van Eijndhoven 13-oct-2005 Utrecht University
60 //- Modified: NvE $Date$ Utrecht University
61 ///////////////////////////////////////////////////////////////////////////
63 #include "IceCleanHits.h"
64 #include "Riostream.h"
66 ClassImp(IceCleanHits) // Class implementation to enable ROOT I/O
68 IceCleanHits::IceCleanHits(const char* name,const char* title) : TTask(name,title)
70 // Default constructor.
84 ///////////////////////////////////////////////////////////////////////////
85 IceCleanHits::~IceCleanHits()
87 // Default destructor.
89 ///////////////////////////////////////////////////////////////////////////
90 void IceCleanHits::SetAdcRangeA(Float_t min,Float_t max)
92 // Set Amanda ADC range in PE.
93 // The default for the maximum is 999999.
97 ///////////////////////////////////////////////////////////////////////////
98 void IceCleanHits::SetTotRangeAE(Float_t min,Float_t max)
100 // Set Amanda electrical TOT range in ns.
101 // The default for the maximum is 2000.
105 ///////////////////////////////////////////////////////////////////////////
106 void IceCleanHits::SetTotRangeAO(Float_t min,Float_t max)
108 // Set Amanda optical TOT range in ns.
109 // The default for the maximum is 2000.
113 ///////////////////////////////////////////////////////////////////////////
114 void IceCleanHits::SetIsolationA(Float_t rmax,Float_t dtmax)
116 // Set Amanda isolation radius (in m) and time difference (in ns).
120 ///////////////////////////////////////////////////////////////////////////
121 void IceCleanHits::SetTwindowA(Float_t dtmax)
123 // Set Amanda maximal trigger window (in TDC counts).
124 // Only hits which occur in [T-dtmax,T+dtmax] will be kept,
125 // where T indicates the trigger time in TDC counts.
126 // For the Amanda DAQ hardware, 1 TDC corresponds to about 1.04 ns.
129 ///////////////////////////////////////////////////////////////////////////
130 void IceCleanHits::SetTtimeA(Float_t t)
132 // Set Amanda trigger time (in TDC counts).
133 // A negative value will induce automatic trigger time setting based
134 // on "main" trigger as recorded in the IceEvent structure.
137 if (t<0) fTnamA="main";
139 ///////////////////////////////////////////////////////////////////////////
140 void IceCleanHits::SetTnameA(TString name)
142 // Set Amanda trigger name.
143 // Specification of a non-existing trigger name will result in a trigger time
148 ///////////////////////////////////////////////////////////////////////////
149 void IceCleanHits::Exec(Option_t* opt)
151 // Implementation of the hit cleaning procedures.
154 AliJob* parent=(AliJob*)(gROOT->GetListOfTasks()->FindObject(name.Data()));
158 fEvt=(IceEvent*)parent->GetObject("IceEvent");
161 // Storage of the used parameters in the IceCleanHits device
163 params.SetNameTitle("IceCleanHits","IceCleanHits processor parameters");
164 params.SetSlotName("AdcminA",1);
165 params.SetSlotName("AdcmaxA",2);
166 params.SetSlotName("TotminAE",3);
167 params.SetSlotName("TotmaxAE",4);
168 params.SetSlotName("TotminAO",5);
169 params.SetSlotName("TotmaxAO",6);
170 params.SetSlotName("RmaxA",7);
171 params.SetSlotName("DtmaxA",8);
172 params.SetSlotName("TwinA",9);
173 params.SetSlotName("TtimA",10);
175 params.SetSignal(fAdcminA,1);
176 params.SetSignal(fAdcmaxA,2);
177 params.SetSignal(fTotminAE,3);
178 params.SetSignal(fTotmaxAE,4);
179 params.SetSignal(fTotminAO,5);
180 params.SetSignal(fTotmaxAO,6);
181 params.SetSignal(fRmaxA,7);
182 params.SetSignal(fDtmaxA,8);
183 params.SetSignal(fTwinA,9);
184 params.SetSignal(fTtimA,10);
186 fEvt->AddDevice(params);
192 ///////////////////////////////////////////////////////////////////////////
193 void IceCleanHits::Amanda()
195 // Hit cleaning for Amanda modules.
197 // Trigger time setting according to the user selection.
198 // By default the "main" trigger of the event will be used.
199 if (fTnamA != "user")
201 AliDevice* tdev=(AliDevice*)fEvt->GetDevice("Trigger");
204 AliSignal* trig=tdev->GetHit(fTnamA);
205 if (trig) fTtimA=trig->GetSignal("trig_pulse_le");
209 // All Amanda OMs with a signal
210 TObjArray* aoms=fEvt->GetDevices("IceAOM");
212 // Local OM array with bad/dead OMs (as indicated via IceCalibrate) discarded
215 for (Int_t i=0; i<aoms->GetEntries(); i++)
217 omx=(IceAOM*)aoms->At(i);
219 if (omx->GetDeadValue("ADC") || omx->GetDeadValue("LE") || omx->GetDeadValue("TOT")) continue;
223 // Local array with clean hits
229 for (Int_t iom=0; iom<oms.GetEntries(); iom++)
231 omx=(IceAOM*)oms.At(iom);
233 omid=omx->GetUniqueID();
234 for (Int_t ih=1; ih<=omx->GetNhits(); ih++)
238 adc=sx->GetSignal("ADC",7);
239 le=sx->GetSignal("LE",7);
240 tot=sx->GetSignal("TOT",7);
242 // Remove hits with an ADC value outside the range
243 if (adc<fAdcminA || adc>fAdcmaxA)
248 // Remove hits with a TOT value outside the range
249 // Note : Different ranges for electrical and optical modules
250 if (omid<303) // Electrical OMs
252 if (tot<fTotminAE || tot>fTotmaxAE)
260 if (tot<fTotminAO || tot>fTotmaxAO)
266 // Remove hits that are outside the trigger time window.
267 // Since the trigger time was determined from uncalibrated LE's
268 // (to include cable length effects) the uncalibrated LE of each
269 // hit should be used here as well.
270 le=sx->GetSignal("LE",-7);
271 if (fabs(le-fTtimA)>fTwinA)
276 // Store only the current clean hits in our local hit array
277 // This will save CPU time for the isolation criterion
278 if (clean) hits.Add(sx);
283 // Only retain hits that have at least one hit of another OM within a certain
284 // radius and within a certain time window
285 Int_t nhits=hits.GetEntries();
295 for (Int_t jh1=0; jh1<nhits; jh1++)
297 sx1=(AliSignal*)hits.At(jh1);
301 for (Int_t jh2=0; jh2<nhits; jh2++)
303 sx2=(AliSignal*)hits.At(jh2);
306 omx1=(IceAOM*)sx1->GetDevice();
307 omx2=(IceAOM*)sx2->GetDevice();
308 if (omx1==omx2) continue;
310 t1=sx1->GetSignal("LE",7);
311 t2=sx2->GetSignal("LE",7);
313 if (dt>fDtmaxA) continue;
317 r1=omx1->GetPosition();
318 r2=omx2->GetPosition();
319 dr=r1.GetDistance(r2);
320 if (dr>fRmaxA) continue;
324 if (iso) sx1->SetDead("LE");
327 ///////////////////////////////////////////////////////////////////////////
328 void IceCleanHits::InIce()
330 // Hit cleaning for IceCube InIce DOMs.
332 ///////////////////////////////////////////////////////////////////////////
333 void IceCleanHits::IceTop()
335 // Hit cleaning for IceTop DOMs.
337 ///////////////////////////////////////////////////////////////////////////