]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSsimulationSPD.cxx
New classes for finding multiple vertices (in case of pile-up). They will be used...
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationSPD.cxx
CommitLineData
c7a4dac0 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line 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. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
5bfe44ce 16/*
85f5e9c2 17$Id$
5bfe44ce 18*/
f8d9a5b8 19
5bfe44ce 20#include <Riostream.h>
b0f5e3fc 21#include <TH1.h>
9f033001 22#include <TString.h>
e8189707 23#include "AliITS.h"
e869281d 24#include "AliITSdigitSPD.h"
5bfe44ce 25#include "AliITShit.h"
9f033001 26#include "AliITSmodule.h"
c7a4dac0 27#include "AliITSpList.h"
5bfe44ce 28#include "AliITSCalibrationSPD.h"
29#include "AliITSsegmentationSPD.h"
b0f5e3fc 30#include "AliITSsimulationSPD.h"
f77f13c8 31#include "AliLog.h"
5bfe44ce 32#include "AliRun.h"
a4005be7 33#include "AliMagF.h"
9f033001 34
bb6b39bf 35//#define DEBUG
e8189707 36
b0f5e3fc 37ClassImp(AliITSsimulationSPD)
38////////////////////////////////////////////////////////////////////////
5bfe44ce 39// Version: 1
590d15ee 40// Modified by D. Elia, G.E. Bruno, H. Tydesjo
41// Fast diffusion code by Bjorn S. Nilsen
5bfe44ce 42// March-April 2006
8e2f60b2 43// October 2007: GetCalibrationObjects() removed
b0f5e3fc 44//
5bfe44ce 45// Version: 0
46// Written by Boris Batyunya
47// December 20 1999
21b825a4 48//
5bfe44ce 49//
50// AliITSsimulationSPD is to do the simulation of SPDs.
51//
52////////////////////////////////////////////////////////////////////////
53
c7a4dac0 54//______________________________________________________________________
5bfe44ce 55AliITSsimulationSPD::AliITSsimulationSPD():
56AliITSsimulation(),
57fHis(0),
58fSPDname(),
a4005be7 59fCoupling(),
60fLorentz(kFALSE),
61fTanLorAng(0){
5bfe44ce 62 // Default constructor.
63 // Inputs:
aacedc3e 64 // none.
65 // Outputs:
66 // none.
67 // Return:
68 // A default constructed AliITSsimulationSPD class.
5bfe44ce 69
70 AliDebug(1,Form("Calling default constructor"));
71// Init();
b0f5e3fc 72}
c7a4dac0 73//______________________________________________________________________
8ba39da9 74AliITSsimulationSPD::AliITSsimulationSPD(AliITSDetTypeSim *dettyp):
75AliITSsimulation(dettyp),
5bfe44ce 76fHis(0),
77fSPDname(),
a4005be7 78fCoupling(),
79fLorentz(kFALSE),
80fTanLorAng(0){
5bfe44ce 81 // standard constructor
82 // Inputs:
83 // AliITSsegmentation *seg A pointer to the segmentation class
84 // to be used for this simulation
85 // AliITSCalibration *resp A pointer to the responce class to
86 // be used for this simulation
aacedc3e 87 // Outputs:
88 // none.
89 // Return:
5bfe44ce 90 // A default constructed AliITSsimulationSPD class.
aacedc3e 91
5bfe44ce 92 AliDebug(1,Form("Calling standard constructor "));
aacedc3e 93 Init();
94}
95//______________________________________________________________________
5bfe44ce 96void AliITSsimulationSPD::Init(){
97 // Initilization
aacedc3e 98 // Inputs:
99 // none.
100 // Outputs:
101 // none.
102 // Return:
103 // none.
5bfe44ce 104 const Double_t kmictocm = 1.0e-4; // convert microns to cm.
c7a4dac0 105
5bfe44ce 106 SetModuleNumber(0);
107 SetEventNumber(0);
108 SetMap(new AliITSpList(GetNPixelsZ(),GetNPixelsX()));
2ae37d58 109 AliITSSimuParam* simpar = fDetType->GetSimuParam();
8ba39da9 110 AliITSsegmentationSPD* seg = (AliITSsegmentationSPD*)GetSegmentationModel(0);
2ae37d58 111 Double_t bias = simpar->GetSPDBiasVoltage();
5bfe44ce 112// cout << "Bias Voltage --> " << bias << endl; // dom
2ae37d58 113 simpar->SetDistanceOverVoltage(kmictocm*seg->Dy(),bias);
5bfe44ce 114// set kind of coupling ("old" or "new")
115 char opt[20];
2ae37d58 116 simpar->GetSPDCouplingOption(opt);
5bfe44ce 117 char *old = strstr(opt,"old");
118 if (old) {
119 fCoupling=2;
120 } else {
121 fCoupling=1;
122 } // end if
a4005be7 123 //SetLorentzDrift(kTRUE);
124 if (fLorentz) SetTanLorAngle();
125}
126//______________________________________________________________________
127Bool_t AliITSsimulationSPD::SetTanLorAngle(Double_t WeightHole) {
128 // This function set the Tangent of the Lorentz angle.
129 // A weighted average is used for electrons and holes
130 // Input: Double_t WeightHole: wheight for hole: it should be in the range [0,1]
131 // output: Bool_t : kTRUE in case of success
132 //
133 if(!fDetType) {
134 AliError("AliITSsimulationSPD::SetTanLorAngle: AliITSDetTypeSim* fDetType not set ");
135 return kFALSE;}
136 if(WeightHole<0) {
137 WeightHole=0.;
138 AliWarning("AliITSsimulationSPD::SetTanLorAngle: You have asked for negative Hole weight");
139 AliWarning("AliITSsimulationSPD::SetTanLorAngle: I'm going to use only electrons");
140 }
141 if(WeightHole>1) {
142 WeightHole=1.;
143 AliWarning("AliITSsimulationSPD::SetTanLorAngle: You have asked for weight > 1");
144 AliWarning("AliITSsimulationSPD::SetTanLorAngle: I'm going to use only holes");
145 }
146 Double_t WeightEle=1.-WeightHole;
2ae37d58 147 AliITSSimuParam* simpar = fDetType->GetSimuParam();
a4005be7 148 AliMagF *mf = gAlice->Field();
149 Float_t pos[3]={0.,0.,0.};
150 Float_t B[3]={0.,0.,0.};
151 mf->Field(pos,B);
2ae37d58 152 fTanLorAng = TMath::Tan(WeightHole*simpar->LorentzAngleHole(B[2]) +
153 WeightEle*simpar->LorentzAngleElectron(B[2]));
a4005be7 154 fTanLorAng*=-1.; // this only for the old geometry
155 // comment the upper line for the new geometry
156 return kTRUE;
c7a4dac0 157}
158//______________________________________________________________________
5bfe44ce 159AliITSsimulationSPD::~AliITSsimulationSPD(){
c7a4dac0 160 // destructor
5bfe44ce 161 // Inputs:
aacedc3e 162 // none.
163 // Outputs:
164 // none.
165 // Return:
5bfe44ce 166 // none.
b0f5e3fc 167
c7a4dac0 168 if (fHis) {
aacedc3e 169 fHis->Delete();
170 delete fHis;
5bfe44ce 171 } // end if fHis
b0f5e3fc 172}
c7a4dac0 173//______________________________________________________________________
5bfe44ce 174AliITSsimulationSPD::AliITSsimulationSPD(const
175 AliITSsimulationSPD
7537d03c 176 &s) : AliITSsimulation(s),
177fHis(s.fHis),
178fSPDname(s.fSPDname),
a4005be7 179fCoupling(s.fCoupling),
180fLorentz(s.fLorentz),
181fTanLorAng(s.fTanLorAng){
5bfe44ce 182 // Copy Constructor
183 // Inputs:
184 // AliITSsimulationSPD &s The original class for which
185 // this class is a copy of
aacedc3e 186 // Outputs:
187 // none.
188 // Return:
c7a4dac0 189
b0f5e3fc 190}
c7a4dac0 191//______________________________________________________________________
5bfe44ce 192AliITSsimulationSPD& AliITSsimulationSPD::operator=(const
193 AliITSsimulationSPD &s){
c7a4dac0 194 // Assignment operator
5bfe44ce 195 // Inputs:
196 // AliITSsimulationSPD &s The original class for which
197 // this class is a copy of
aacedc3e 198 // Outputs:
199 // none.
200 // Return:
c7a4dac0 201
5bfe44ce 202 if(&s == this) return *this;
203 this->fHis = s.fHis;
204 fCoupling = s.fCoupling;
205 fSPDname = s.fSPDname;
a4005be7 206 fLorentz = s.fLorentz;
207 fTanLorAng = s.fTanLorAng;
c7a4dac0 208 return *this;
5bfe44ce 209}
85f5e9c2 210/*
d2f55a22 211//______________________________________________________________________
5bfe44ce 212AliITSsimulation& AliITSsimulationSPD::operator=(const
213 AliITSsimulation &s){
d2f55a22 214 // Assignment operator
5bfe44ce 215 // Inputs:
216 // AliITSsimulationSPD &s The original class for which
217 // this class is a copy of
d2f55a22 218 // Outputs:
219 // none.
220 // Return:
d2f55a22 221
5bfe44ce 222 if(&s == this) return *this;
d2f55a22 223 Error("AliITSsimulationSPD","Not allowed to make a = with "
5bfe44ce 224 "AliITSsimulationSPD","Using default creater instead");
d2f55a22 225
226 return *this;
5bfe44ce 227}
85f5e9c2 228*/
5bfe44ce 229//______________________________________________________________________
230void AliITSsimulationSPD::InitSimulationModule(Int_t module, Int_t event){
231 // This function creates maps to build the list of tracks for each
232 // summable digit. Inputs defined by base class.
233 // Inputs:
234 // Int_t module // Module number to be simulated
235 // Int_t event // Event number to be simulated
236 // Outputs:
237 // none
238 // Returns:
239 // none
240
241 AliDebug(1,Form("(module=%d,event=%d)",module,event));
2ae37d58 242 const Double_t kmictocm = 1.0e-4; // convert microns to cm.
243 AliITSSimuParam* simpar = fDetType->GetSimuParam();
244 AliITSsegmentationSPD* seg = (AliITSsegmentationSPD*)GetSegmentationModel(0);
5bfe44ce 245 SetModuleNumber(module);
246 SetEventNumber(event);
2ae37d58 247 simpar->SetDistanceOverVoltage(kmictocm*seg->Dy(),simpar->GetSPDBiasVoltage(module));
5bfe44ce 248 ClearMap();
249}
250//_____________________________________________________________________
251void AliITSsimulationSPD::SDigitiseModule(AliITSmodule *mod,Int_t,
252 Int_t event){
253 // This function begins the work of creating S-Digits. Inputs defined
254 // by base class.
255 // Inputs:
256 // AliITSmodule *mod // module
257 // Int_t // not used
258 // Int_t event // Event number
259 // Outputs:
260 // none
261 // Return:
262 // test // test returns kTRUE if the module contained hits
263 // // test returns kFALSE if it did not contain hits
264
265 AliDebug(1,Form("(mod=%p, ,event=%d)",mod,event));
266 if(!(mod->GetNhits())){
267 AliDebug(1,Form("In event %d module %d there are %d hits returning.",
268 event, mod->GetIndex(),mod->GetNhits()));
269 return;// if module has no hits don't create Sdigits
270 } // end if
271 SetModuleNumber(mod->GetIndex());
272 SetEventNumber(event);
2ae37d58 273 InitSimulationModule( GetModuleNumber() , event );
5bfe44ce 274 // HitToSDigit(mod);
275 HitToSDigitFast(mod);
590d15ee 276 RemoveDeadPixels(mod);
277// cout << "After Remove in SDigitiseModule !!!!!" << endl; // dom
278// cout << "Module " << mod->GetIndex() << " Event " << event << endl; // dom
5bfe44ce 279 WriteSDigits();
280 ClearMap();
281}
282//______________________________________________________________________
283void AliITSsimulationSPD::WriteSDigits(){
284 // This function adds each S-Digit to pList
285 // Inputs:
3a97c582 286 // none.
5bfe44ce 287 // Outputs:
288 // none.
289 // Return:
290 // none
291 Int_t ix, nix, iz, niz;
292 static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
293
294 AliDebug(1,Form("Writing SDigits for module %d",GetModuleNumber()));
590d15ee 295// cout << "WriteSDigits for module " << GetModuleNumber() << endl; // dom
5bfe44ce 296 GetMap()->GetMaxMapIndex(niz, nix);
297 for(iz=0; iz<niz; iz++)for(ix=0; ix<nix; ix++){
298 if(GetMap()->GetSignalOnly(iz,ix)>0.0){
590d15ee 299// cout << " Signal gt 0 iz ix " << iz << ix << " Module " << GetModuleNumber() << endl; // dom
5bfe44ce 300 aliITS->AddSumDigit(*(GetMap()->GetpListItem(iz,ix)));
301 if(AliDebugLevel()>0) {
302 AliDebug(1,Form("%d, %d",iz,ix));
303 cout << *(GetMap()->GetpListItem(iz,ix)) << endl;
304 } // end if GetDebug
305 } // end if GetMap()->GetSignalOnly(iz,ix)>0.0
306 } // end for iz,ix
307 return;
3a97c582 308}
309//______________________________________________________________________
310void AliITSsimulationSPD::FinishSDigitiseModule(){
5bfe44ce 311 // This function calls SDigitsToDigits which creates Digits from SDigits
312 // Inputs:
313 // none
314 // Outputs:
315 // none
316 // Return
317 // none
318
319 AliDebug(1,"()");
590d15ee 320// cout << "FinishSDigitiseModule for module " << GetModuleNumber() << endl; // dom
321 FrompListToDigits(); // Charge To Signal both adds noise and
5bfe44ce 322 ClearMap();
323 return;
324}
325//______________________________________________________________________
326void AliITSsimulationSPD::DigitiseModule(AliITSmodule *mod,Int_t,
2ae37d58 327 Int_t event){
5bfe44ce 328 // This function creates Digits straight from the hits and then adds
329 // electronic noise to the digits before adding them to pList
330 // Each of the input variables is passed along to HitToSDigit
331 // Inputs:
332 // AliITSmodule *mod module
333 // Int_t Dummy.
334 // Int_t Dummy
335 // Outputs:
336 // none.
337 // Return:
338 // none.
3a97c582 339
5bfe44ce 340 AliDebug(1,Form("(mod=%p,,)",mod));
341 // HitToSDigit(mod);
2ae37d58 342 InitSimulationModule( mod->GetIndex(), event );
5bfe44ce 343 HitToSDigitFast(mod);
344 RemoveDeadPixels(mod);
590d15ee 345// cout << "After Remove in DigitiseModule in module " << mod->GetIndex() << endl; // dom
346 FrompListToDigits();
5bfe44ce 347 ClearMap();
c7a4dac0 348}
349//______________________________________________________________________
5bfe44ce 350void AliITSsimulationSPD::HitToSDigit(AliITSmodule *mod){
351 // Does the charge distributions using Gaussian diffusion charge charing.
aacedc3e 352 // Inputs:
5bfe44ce 353 // AliITSmodule *mod Pointer to this module
354 // Output:
355 // none.
aacedc3e 356 // Return:
5bfe44ce 357 // none.
358 const Double_t kmictocm = 1.0e-4; // convert microns to cm.
359 TObjArray *hits = mod->GetHits();
360 Int_t nhits = hits->GetEntriesFast();
361 Int_t h,ix,iz,i;
362 Int_t idtrack;
a4005be7 363 Double_t x0=0.0,x1=0.0,y0=0.0,y1=0.0,z0=0.0,z1=0.0,de=0.0,ld=0.0;
5bfe44ce 364 Double_t x,y,z,t,tp,st,dt=0.2,el,sig,sigx,sigz,fda;
365 AliITSsegmentationSPD* seg = (AliITSsegmentationSPD*)GetSegmentationModel(0);
2ae37d58 366 AliITSSimuParam *simpar = fDetType->GetSimuParam();
5bfe44ce 367 Double_t thick = 0.5*kmictocm*seg->Dy(); // Half Thickness
2ae37d58 368 simpar->GetSPDSigmaDiffusionAsymmetry(fda); //
5bfe44ce 369
370 AliDebug(1,Form("(mod=%p) fCoupling=%d",mod,fCoupling));
371 if(nhits<=0) return;
372 for(h=0;h<nhits;h++){
373 if(AliDebugLevel()>0) {
374 AliDebug(1,Form("Hits, %d", h));
375 cout << *(mod->GetHit(h)) << endl;
376 } // end if GetDebug
377 if(!mod->LineSegmentL(h,x0,x1,y0,y1,z0,z1,de,idtrack)) continue;
378 st = TMath::Sqrt(x1*x1+y1*y1+z1*z1);
379 if(st>0.0){
380 st = (Double_t)((Int_t)(st/kmictocm)); // number of microns
381 if(st<=1.0) st = 1.0;
382 dt = 1.0/st;
383 for(t=0.0;t<1.0;t+=dt){ // Integrate over t
384 tp = t+0.5*dt;
385 x = x0+x1*tp;
386 y = y0+y1*tp;
387 z = z0+z1*tp;
388 if(!(seg->LocalToDet(x,z,ix,iz))) continue; // outside
2ae37d58 389 //el = res->GeVToCharge((Double_t)(dt*de));
390 el = dt * de / simpar->GetGeVToCharge();
5bfe44ce 391 if(GetDebug(1)){
392 if(el<=0.0) cout<<"el="<<el<<" dt="<<dt
393 <<" de="<<de<<endl;
394 } // end if GetDebug
2ae37d58 395 sig = simpar->SigmaDiffusion1D(TMath::Abs(thick + y));
5bfe44ce 396 sigx=sig;
397 sigz=sig*fda;
a4005be7 398 if (fLorentz) ld=(y+thick)*fTanLorAng;
399 SpreadChargeAsym(x,z,ix,iz,el,sigx,sigz,ld,idtrack,h);
5bfe44ce 400 } // end for t
401 } else { // st == 0.0 deposit it at this point
402 x = x0;
403 y = y0;
404 z = z0;
405 if(!(seg->LocalToDet(x,z,ix,iz))) continue; // outside
2ae37d58 406 //el = res->GeVToCharge((Double_t)de);
407 el = de / simpar->GetGeVToCharge();
408 sig = simpar->SigmaDiffusion1D(TMath::Abs(thick + y));
5bfe44ce 409 sigx=sig;
410 sigz=sig*fda;
a4005be7 411 if (fLorentz) ld=(y+thick)*fTanLorAng;
412 SpreadChargeAsym(x,z,ix,iz,el,sigx,sigz,ld,idtrack,h);
5bfe44ce 413 } // end if st>0.0
3ee464f0 414
415 } // Loop over all hits h
416
5bfe44ce 417 // Coupling
418 switch (fCoupling) {
419 default:
420 break;
421 case 1: //case 3:
5bfe44ce 422 for(i=0;i<GetMap()->GetEntries();i++)
423 if(GetMap()->GetpListItem(i)==0) continue;
424 else{
590d15ee 425 GetMap()->GetMapIndex(GetMap()->GetpListItem(i)->GetIndex(),iz,ix);
5bfe44ce 426 SetCoupling(iz,ix,idtrack,h);
427 } // end for i
428 break;
429 case 2: // case 4:
5bfe44ce 430 for(i=0;i<GetMap()->GetEntries();i++)
431 if(GetMap()->GetpListItem(i)==0) continue;
432 else{
590d15ee 433 GetMap()->GetMapIndex(GetMap()->GetpListItem(i)->GetIndex(),iz,ix);
5bfe44ce 434 SetCouplingOld(iz,ix,idtrack,h);
435 } // end for i
436 break;
437 } // end switch
5bfe44ce 438 if(GetDebug(2))Info("HitToSDigit","Finished fCoupling=%d",fCoupling);
c7a4dac0 439}
440//______________________________________________________________________
5bfe44ce 441void AliITSsimulationSPD::HitToSDigitFast(AliITSmodule *mod){
442 // Does the charge distributions using Gaussian diffusion charge charing. // Inputs:
443 // AliITSmodule *mod Pointer to this module
444 // Output:
445 // none.
aacedc3e 446 // Return:
5bfe44ce 447 // none.
448 const Double_t kmictocm = 1.0e-4; // convert microns to cm.
590d15ee 449 const Int_t kn10=10;
450 const Double_t kti[kn10]={7.443716945e-3,2.166976971e-1,3.397047841e-1,
5bfe44ce 451 4.325316833e-1,4.869532643e-1,5.130467358e-1,
452 5.674683167e-1,6.602952159e-1,7.833023029e-1,
453 9.255628306e-1};
590d15ee 454 const Double_t kwi[kn10]={1.477621124e-1,1.346333597e-1,1.095431813e-1,
5bfe44ce 455 7.472567455e-2,3.333567215e-2,3.333567215e-2,
456 7.472567455e-2,1.095431813e-1,1.346333597e-1,
457 1.477621124e-1};
458 TObjArray *hits = mod->GetHits();
459 Int_t nhits = hits->GetEntriesFast();
460 Int_t h,ix,iz,i;
461 Int_t idtrack;
a4005be7 462 Double_t x0=0.0,x1=0.0,y0=0.0,y1=0.0,z0=0.0,z1=0.0,de=0.0,ld=0.0;
5bfe44ce 463 Double_t x,y,z,t,st,el,sig,sigx,sigz,fda;
464 AliITSsegmentationSPD* seg = (AliITSsegmentationSPD*)GetSegmentationModel(0);
2ae37d58 465 AliITSSimuParam* simpar = fDetType->GetSimuParam();
5bfe44ce 466 Double_t thick = 0.5*kmictocm*seg->Dy(); // Half thickness
2ae37d58 467 simpar->GetSPDSigmaDiffusionAsymmetry(fda);
5bfe44ce 468// cout << "Half Thickness " << thick << endl; // dom
469// cout << "Diffusion asymm " << fda << endl; // dom
470
471 AliDebug(1,Form("(mod=%p) fCoupling=%d",mod,fCoupling));
472 if(nhits<=0) return;
473 for(h=0;h<nhits;h++){
474 if(AliDebugLevel()>0) {
475 AliDebug(1,Form("Hits, %d", h));
476 cout << *(mod->GetHit(h)) << endl;
477 } // end if GetDebug
478 if(!mod->LineSegmentL(h,x0,x1,y0,y1,z0,z1,de,idtrack)) continue;
479 st = TMath::Sqrt(x1*x1+y1*y1+z1*z1);
590d15ee 480 if(st>0.0) for(i=0;i<kn10;i++){ // Integrate over t
481 t = kti[i];
5bfe44ce 482 x = x0+x1*t;
483 y = y0+y1*t;
484 z = z0+z1*t;
485 if(!(seg->LocalToDet(x,z,ix,iz))) continue; // outside
2ae37d58 486 el = kwi[i]*de/simpar->GetGeVToCharge();
5bfe44ce 487 if(GetDebug(1)){
590d15ee 488 if(el<=0.0) cout<<"el="<<el<<" kwi["<<i<<"]="<<kwi[i]
5bfe44ce 489 <<" de="<<de<<endl;
490 } // end if GetDebug
2ae37d58 491 sig = simpar->SigmaDiffusion1D(TMath::Abs(thick + y));
5bfe44ce 492 sigx=sig;
493 sigz=sig*fda;
a4005be7 494 if (fLorentz) ld=(y+thick)*fTanLorAng;
495 SpreadChargeAsym(x,z,ix,iz,el,sigx,sigz,ld,idtrack,h);
8e2f60b2 496// cout << "sigx sigz " << sigx << " " << sigz << endl; // dom
5bfe44ce 497 } // end for i // End Integrate over t
498 else { // st == 0.0 deposit it at this point
499 x = x0;
500 y = y0;
501 z = z0;
502 if(!(seg->LocalToDet(x,z,ix,iz))) continue; // outside
2ae37d58 503 el = de / simpar->GetGeVToCharge();
504 sig = simpar->SigmaDiffusion1D(TMath::Abs(thick + y));
5bfe44ce 505 sigx=sig;
506 sigz=sig*fda;
a4005be7 507 if (fLorentz) ld=(y+thick)*fTanLorAng;
508 SpreadChargeAsym(x,z,ix,iz,el,sigx,sigz,ld,idtrack,h);
5bfe44ce 509 } // end if st>0.0
3ee464f0 510
511 } // Loop over all hits h
512
5bfe44ce 513 // Coupling
514 switch (fCoupling) {
515 default:
516 break;
517 case 1: // case 3:
5bfe44ce 518 for(i=0;i<GetMap()->GetEntries();i++)
519 if(GetMap()->GetpListItem(i)==0) continue;
520 else{
590d15ee 521 GetMap()->GetMapIndex(GetMap()->GetpListItem(i)->GetIndex(),iz,ix);
5bfe44ce 522 SetCoupling(iz,ix,idtrack,h);
523 } // end for i
524 break;
525 case 2: // case 4:
5bfe44ce 526 for(i=0;i<GetMap()->GetEntries();i++)
527 if(GetMap()->GetpListItem(i)==0) continue;
528 else{
590d15ee 529 GetMap()->GetMapIndex(GetMap()->GetpListItem(i)->GetIndex(),iz,ix);
530 SetCouplingOld(iz,ix,idtrack,h);
5bfe44ce 531 } // end for i
532 break;
533 } // end switch
5bfe44ce 534 if(GetDebug(2))Info("HitToSDigit","Finished fCoupling=%d",fCoupling);
21b825a4 535}
c7a4dac0 536//______________________________________________________________________
5bfe44ce 537void AliITSsimulationSPD::SpreadCharge(Double_t x0,Double_t z0,
538 Int_t ix0,Int_t iz0,
a4005be7 539 Double_t el,Double_t sig,Double_t ld,
540 Int_t t,Int_t hi){
5bfe44ce 541 // Spreads the charge over neighboring cells. Assume charge is distributed
542 // as charge(x,z) = (el/2*pi*sig*sig)*exp(-arg)
543 // arg=((x-x0)*(x-x0)/2*sig*sig)+((z-z0*z-z0)/2*sig*sig)
a4005be7 544 // if fLorentz=kTRUE, then x0=x0+ld (Lorentz drift taken into account)
5bfe44ce 545 // Defined this way, the integral over all x and z is el.
aacedc3e 546 // Inputs:
5bfe44ce 547 // Double_t x0 x position of point where charge is liberated
5bfe44ce 548 // Double_t z0 z position of point where charge is liberated
549 // Int_t ix0 row of cell corresponding to point x0
550 // Int_t iz0 columb of cell corresponding to point z0
551 // Double_t el number of electrons liberated in this step
552 // Double_t sig Sigma difusion for this step (y0 dependent)
a4005be7 553 // Double_t ld lorentz drift in x for this step (y0 dependent)
5bfe44ce 554 // Int_t t track number
555 // Int_t ti hit track index number
556 // Int_t hi hit "hit" index number
aacedc3e 557 // Outputs:
5bfe44ce 558 // none.
aacedc3e 559 // Return:
5bfe44ce 560 // none.
561 const Int_t knx = 3,knz = 2;
562 const Double_t kRoot2 = 1.414213562; // Sqrt(2).
563 const Double_t kmictocm = 1.0e-4; // convert microns to cm.
564 Int_t ix,iz,ixs,ixe,izs,ize;
565 Float_t x,z;
566 Double_t x1,x2,z1,z2,s,sp;
567 AliITSsegmentationSPD* seg = (AliITSsegmentationSPD*)GetSegmentationModel(0);
21b825a4 568
3a97c582 569
5bfe44ce 570 if(GetDebug(4)) Info("SpreadCharge","(x0=%e,z0=%e,ix0=%d,iz0=%d,el=%e,"
571 "sig=%e,t=%d,i=%d)",x0,z0,ix0,iz0,el,sig,t,hi);
572 if(sig<=0.0) { // if sig<=0 No diffusion to simulate.
573 GetMap()->AddSignal(iz0,ix0,t,hi,GetModuleNumber(),el);
574 if(GetDebug(2)){
575 cout << "sig<=0.0=" << sig << endl;
576 } // end if GetDebug
577 return;
578 } // end if
579 sp = 1.0/(sig*kRoot2);
580 if(GetDebug(2)){
581 cout << "sig=" << sig << " sp=" << sp << endl;
582 } // end if GetDebug
583 ixs = TMath::Max(-knx+ix0,0);
584 ixe = TMath::Min(knx+ix0,seg->Npx()-1);
585 izs = TMath::Max(-knz+iz0,0);
586 ize = TMath::Min(knz+iz0,seg->Npz()-1);
587 for(ix=ixs;ix<=ixe;ix++) for(iz=izs;iz<=ize;iz++){
588 seg->DetToLocal(ix,iz,x,z); // pixel center
589 x1 = x;
590 z1 = z;
591 x2 = x1 + 0.5*kmictocm*seg->Dpx(ix); // Upper
592 x1 -= 0.5*kmictocm*seg->Dpx(ix); // Lower
593 z2 = z1 + 0.5*kmictocm*seg->Dpz(iz); // Upper
594 z1 -= 0.5*kmictocm*seg->Dpz(iz); // Lower
a4005be7 595 x1 -= x0+ld; // Distance from where track traveled (taking into account the Lorentz drift)
596 x2 -= x0+ld; // Distance from where track traveled (taking into account the Lorentz drift)
5bfe44ce 597 z1 -= z0; // Distance from where track traveled
598 z2 -= z0; // Distance from where track traveled
599 s = 0.25; // Correction based on definision of Erfc
600 s *= TMath::Erfc(sp*x1) - TMath::Erfc(sp*x2);
601 if(GetDebug(3)){
602 cout <<"el="<<el<<" ix0="<<ix0<<" ix="<<ix<<" x0="<<x<<
603 " iz0="<<iz0<<" iz="<<iz<<" z0="<<z<<
604 " sp*x1="<<sp*x1<<" sp*x2="<<sp*x2<<" s="<<s;
605 } // end if GetDebug
606 s *= TMath::Erfc(sp*z1) - TMath::Erfc(sp*z2);
607 if(GetDebug(3)){
608 cout<<" sp*z1="<<sp*z1<<" sp*z2="<<sp*z2<<" s="<<s<< endl;
609 } // end if GetDebug
610 GetMap()->AddSignal(iz,ix,t,hi,GetModuleNumber(),s*el);
611 } // end for ix, iz
c7a4dac0 612}
613//______________________________________________________________________
5bfe44ce 614void AliITSsimulationSPD::SpreadChargeAsym(Double_t x0,Double_t z0,
615 Int_t ix0,Int_t iz0,
616 Double_t el,Double_t sigx,Double_t sigz,
a4005be7 617 Double_t ld,Int_t t,Int_t hi){
5bfe44ce 618 // Spreads the charge over neighboring cells. Assume charge is distributed
619 // as charge(x,z) = (el/2*pi*sigx*sigz)*exp(-arg)
620 // arg=((x-x0)*(x-x0)/2*sigx*sigx)+((z-z0*z-z0)/2*sigz*sigz)
a4005be7 621 // if fLorentz=kTRUE, then x0=x0+ld (Lorentz drift taken into account)
5bfe44ce 622 // Defined this way, the integral over all x and z is el.
aacedc3e 623 // Inputs:
5bfe44ce 624 // Double_t x0 x position of point where charge is liberated
5bfe44ce 625 // Double_t z0 z position of point where charge is liberated
626 // Int_t ix0 row of cell corresponding to point x0
627 // Int_t iz0 columb of cell corresponding to point z0
628 // Double_t el number of electrons liberated in this step
629 // Double_t sigx Sigma difusion along x for this step (y0 dependent)
630 // Double_t sigz Sigma difusion along z for this step (y0 dependent)
a4005be7 631 // Double_t ld lorentz drift in x for this stip (y0 dependent)
5bfe44ce 632 // Int_t t track number
633 // Int_t ti hit track index number
634 // Int_t hi hit "hit" index number
aacedc3e 635 // Outputs:
5bfe44ce 636 // none.
aacedc3e 637 // Return:
5bfe44ce 638 // none.
639 const Int_t knx = 3,knz = 2;
640 const Double_t kRoot2 = 1.414213562; // Sqrt(2).
641 const Double_t kmictocm = 1.0e-4; // convert microns to cm.
642 Int_t ix,iz,ixs,ixe,izs,ize;
643 Float_t x,z;
644 Double_t x1,x2,z1,z2,s,spx,spz;
645 AliITSsegmentationSPD* seg = (AliITSsegmentationSPD*)GetSegmentationModel(0);
646
c7a4dac0 647
a4005be7 648 if(GetDebug(4)) Info("SpreadChargeAsym","(x0=%e,z0=%e,ix0=%d,iz0=%d,el=%e,"
5bfe44ce 649 "sig=%e,t=%d,i=%d)",x0,z0,ix0,iz0,el,sigx,sigz,t,hi);
650 if(sigx<=0.0 || sigz<=0.0) { // if sig<=0 No diffusion to simulate.
651 GetMap()->AddSignal(iz0,ix0,t,hi,GetModuleNumber(),el);
652 if(GetDebug(2)){
653 cout << "sigx<=0.0=" << sigx << endl;
654 cout << "sigz<=0.0=" << sigz << endl;
655 } // end if GetDebug
656 return;
657 } // end if
658 spx = 1.0/(sigx*kRoot2); spz = 1.0/(sigz*kRoot2);
659 if(GetDebug(2)){
660 cout << "sigx=" << sigx << " spx=" << spx << endl;
661 cout << "sigz=" << sigz << " spz=" << spz << endl;
662 } // end if GetDebug
663 ixs = TMath::Max(-knx+ix0,0);
664 ixe = TMath::Min(knx+ix0,seg->Npx()-1);
665 izs = TMath::Max(-knz+iz0,0);
666 ize = TMath::Min(knz+iz0,seg->Npz()-1);
667 for(ix=ixs;ix<=ixe;ix++) for(iz=izs;iz<=ize;iz++){
668 seg->DetToLocal(ix,iz,x,z); // pixel center
669 x1 = x;
670 z1 = z;
671 x2 = x1 + 0.5*kmictocm*seg->Dpx(ix); // Upper
672 x1 -= 0.5*kmictocm*seg->Dpx(ix); // Lower
673 z2 = z1 + 0.5*kmictocm*seg->Dpz(iz); // Upper
674 z1 -= 0.5*kmictocm*seg->Dpz(iz); // Lower
a4005be7 675 x1 -= x0+ld; // Distance from where track traveled (taking into account the Lorentz drift)
676 x2 -= x0+ld; // Distance from where track traveled (taking into account the Lorentz drift)
5bfe44ce 677 z1 -= z0; // Distance from where track traveled
678 z2 -= z0; // Distance from where track traveled
679 s = 0.25; // Correction based on definision of Erfc
680 s *= TMath::Erfc(spx*x1) - TMath::Erfc(spx*x2);
681 if(GetDebug(3)){
682 cout <<"el="<<el<<" ix0="<<ix0<<" ix="<<ix<<" x0="<<x<<
683 " iz0="<<iz0<<" iz="<<iz<<" z0="<<z<<
684 " spx*x1="<<spx*x1<<" spx*x2="<<spx*x2<<" s="<<s;
685 } // end if GetDebug
686 s *= TMath::Erfc(spz*z1) - TMath::Erfc(spz*z2);
687 if(GetDebug(3)){
688 cout<<" spz*z1="<<spz*z1<<" spz*z2="<<spz*z2<<" s="<<s<< endl;
689 } // end if GetDebug
690 GetMap()->AddSignal(iz,ix,t,hi,GetModuleNumber(),s*el);
691 } // end for ix, iz
c7a4dac0 692}
693//______________________________________________________________________
5bfe44ce 694void AliITSsimulationSPD::RemoveDeadPixels(AliITSmodule *mod){
590d15ee 695 // Removes dead pixels on each module (ladder)
696 // Inputs:
697 // Module Index (0,239)
698 // Outputs:
699 // none.
700 // Return:
701 // none.
702
703 Int_t moduleNr = mod->GetIndex();
8e2f60b2 704 AliITSCalibrationSPD* calObj = (AliITSCalibrationSPD*) GetCalibrationModel(moduleNr);
705
6727e2db 706 Int_t nrDead = calObj->GetNrBad();
8e2f60b2 707// cout << "Module --> " << moduleNr << endl; // dom
708// cout << "nr of dead " << nrDead << endl; // dom
590d15ee 709 for (Int_t i=0; i<nrDead; i++) {
6727e2db 710 GetMap()->DeleteHit(calObj->GetBadColAt(i),calObj->GetBadRowAt(i));
8e2f60b2 711// cout << "dead index " << i << endl; // dom
712// cout << "col row --> " << calObj->GetDeadColAt(i) << " " << calObj->GetDeadRowAt(i) << endl; // dom
5bfe44ce 713 }
714}
715//______________________________________________________________________
590d15ee 716void AliITSsimulationSPD::FrompListToDigits(){
5bfe44ce 717 // add noise and electronics, perform the zero suppression and add the
718 // digit to the list
aacedc3e 719 // Inputs:
5bfe44ce 720 // none.
aacedc3e 721 // Outputs:
5bfe44ce 722 // none.
aacedc3e 723 // Return:
5bfe44ce 724 // none.
725 static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
726 Int_t j,ix,iz;
727 Double_t electronics;
728 Double_t sig;
0599a018 729 const Int_t knmaxtrk=AliITSdigit::GetNTracks();
5bfe44ce 730 static AliITSdigitSPD dig;
2ae37d58 731 AliITSSimuParam *simpar = fDetType->GetSimuParam();
590d15ee 732 if(GetDebug(1)) Info("FrompListToDigits","()");
5bfe44ce 733 for(iz=0; iz<GetNPixelsZ(); iz++) for(ix=0; ix<GetNPixelsX(); ix++){
734// NEW (for the moment plugged by hand, in the future possibly read from Data Base)
735// here parametrize the efficiency of the pixel along the row for the test columns (1,9,17,25)
736// if(iz==1 || iz == 9 || iz == 17 || iz == 25) {
737// Double_t eff,p1=0.,p2=0.;
738// Double_t x=ix;
739// switch (iz) {
740// case 1: p1=0.63460;p2=0.42438E-01;break;
741// case 9: p1=0.41090;p2=0.75914E-01;break;
742// case 17: p1=0.31883;p2=0.91502E-01;break;
743// case 25: p1=0.48828;p2=0.57975E-01;break;
744// } // end switch
745// eff=1.-p1*exp(-p2*x);
746// if (gRandom->Rndm() >= eff) continue;
747// } // end if
2ae37d58 748// END parametrize the efficiency
749//
750 electronics = simpar->ApplySPDBaselineAndNoise();
5bfe44ce 751 UpdateMapNoise(ix,iz,electronics);
752 //
753 // Apply Threshold and write Digits.
754 sig = GetMap()->GetSignalOnly(iz,ix);
755 FillHistograms(ix,iz,sig+electronics);
756 if(GetDebug(3)){
757 cout<<sig<<"+"<<electronics<<">threshold("<<ix<<","<<iz
758 <<")="<<GetThreshold() <<endl;
759 } // end if GetDebug
760 if (sig+electronics <= GetThreshold()) continue;
761 dig.SetCoord1(iz);
762 dig.SetCoord2(ix);
763 dig.SetSignal(1);
590d15ee 764
765// dig.SetSignalSPD((Int_t) GetMap()->GetSignal(iz,ix));
766 Double_t aSignal = GetMap()->GetSignal(iz,ix);
767 if (TMath::Abs(aSignal)>2147483647.0) {
768 //PH 2147483647 is the max. integer
769 //PH This apparently is a problem which needs investigation
770 AliWarning(Form("Too big or too small signal value %f",aSignal));
771 aSignal = TMath::Sign((Double_t)2147483647,aSignal);
772 }
773 dig.SetSignalSPD((Int_t)aSignal);
774
775 for(j=0;j<knmaxtrk;j++){
5bfe44ce 776 if (j<GetMap()->GetNEntries()) {
777 dig.SetTrack(j,GetMap()->GetTrack(iz,ix,j));
778 dig.SetHit(j,GetMap()->GetHit(iz,ix,j));
779 }else { // Default values
780 dig.SetTrack(j,-3);
781 dig.SetHit(j,-1);
782 } // end if GetMap()
783 } // end for j
784 if(GetDebug(3)){
785 cout<<iz<<","<<ix<<","<<*(GetMap()->GetpListItem(iz,ix))<<endl;
786 } // end if GetDebug
787 aliITS->AddSimDigit(0,&dig);
788 } // for ix/iz
c7a4dac0 789}
790//______________________________________________________________________
5bfe44ce 791void AliITSsimulationSPD::CreateHistograms(){
792 // create 1D histograms for tests
aacedc3e 793 // Inputs:
5bfe44ce 794 // none.
aacedc3e 795 // Outputs:
5bfe44ce 796 // none.
aacedc3e 797 // Return:
5bfe44ce 798 // none.
799
800 if(GetDebug(1)) Info("CreateHistograms","create histograms");
801
802 fHis = new TObjArray(GetNPixelsZ());
3162e1f9 803 fSPDname="spd_";
5bfe44ce 804 for(Int_t i=0;i<GetNPixelsZ();i++) {
805 Char_t pixelz[4];
806 sprintf(pixelz,"%d",i);
807 fSPDname.Append(pixelz);
808 fHis->AddAt(new TH1F(fSPDname.Data(),"SPD maps",
809 GetNPixelsX(),0.,(Double_t)GetNPixelsX()),i);
810 } // end for i
c7a4dac0 811}
812//______________________________________________________________________
5bfe44ce 813void AliITSsimulationSPD::FillHistograms(Int_t ix,Int_t iz,Double_t v){
814 // Fill the histogram
aacedc3e 815 // Inputs:
5bfe44ce 816 // none.
aacedc3e 817 // Outputs:
5bfe44ce 818 // none.
aacedc3e 819 // Return:
5bfe44ce 820 // none.
821
822 if(!GetHistArray()) return; // Only fill if setup.
823 if(GetDebug(2)) Info("FillHistograms","fill histograms");
824 GetHistogram(iz)->Fill(ix,v);
c7a4dac0 825}
826//______________________________________________________________________
5bfe44ce 827void AliITSsimulationSPD::ResetHistograms(){
828 // Reset histograms for this detector
aacedc3e 829 // Inputs:
5bfe44ce 830 // none.
aacedc3e 831 // Outputs:
5bfe44ce 832 // none.
aacedc3e 833 // Return:
5bfe44ce 834 // none.
835
836 if(!GetHistArray()) return; // Only fill if setup.
837 if(GetDebug(2)) Info("FillHistograms","fill histograms");
838 for ( int i=0;i<GetNPixelsZ();i++ ) {
839 if (fHis->At(i)) ((TH1F*)fHis->At(i))->Reset();
840 } // end for i
21b825a4 841}
5bfe44ce 842
c7a4dac0 843//______________________________________________________________________
590d15ee 844void AliITSsimulationSPD::SetCoupling(Int_t col, Int_t row, Int_t ntrack,
5bfe44ce 845 Int_t idhit) {
c7a4dac0 846 // Take into account the coupling between adiacent pixels.
f8d9a5b8 847 // The parameters probcol and probrow are the probability of the
848 // signal in one pixel shared in the two adjacent pixels along
849 // the column and row direction, respectively.
5bfe44ce 850 // Note pList is goten via GetMap() and module is not need any more.
851 // Otherwise it is identical to that coded by Tiziano Virgili (BSN).
f8d9a5b8 852 //Begin_Html
853 /*
854 <img src="picts/ITS/barimodel_3.gif">
855 </pre>
856 <br clear=left>
857 <font size=+2 color=red>
858 <a href="mailto:tiziano.virgili@cern.ch"></a>.
859 </font>
860 <pre>
861 */
862 //End_Html
5bfe44ce 863 // Inputs:
590d15ee 864 // Int_t col z cell index
865 // Int_t row x cell index
5bfe44ce 866 // Int_t ntrack track incex number
867 // Int_t idhit hit index number
868 // Outputs:
869 // none.
870 // Return:
871 // none.
f8d9a5b8 872 Int_t j1,j2,flag=0;
873 Double_t pulse1,pulse2;
aacedc3e 874 Double_t couplR=0.0,couplC=0.0;
f8d9a5b8 875 Double_t xr=0.;
876
5bfe44ce 877 GetCouplings(couplC,couplR);
590d15ee 878 if(GetDebug(3)) Info("SetCoupling","(col=%d,row=%d,ntrack=%d,idhit=%d) "
879 "Calling SetCoupling couplC=%e couplR=%e",
880 col,row,ntrack,idhit,couplC,couplR);
881 j1 = col;
882 j2 = row;
883 pulse1 = GetMap()->GetSignalOnly(col,row);
f8d9a5b8 884 pulse2 = pulse1;
590d15ee 885 for (Int_t isign=-1;isign<=1;isign+=2){// loop in col direction
aacedc3e 886 do{
887 j1 += isign;
aacedc3e 888 xr = gRandom->Rndm();
590d15ee 889 if ((j1<0) || (j1>GetNPixelsZ()-1) || (xr>couplC)){
890 j1 = col;
aacedc3e 891 flag = 1;
892 }else{
590d15ee 893 UpdateMapSignal(row,j1,ntrack,idhit,pulse1);
aacedc3e 894 // flag = 0;
895 flag = 1; // only first next!!
896 } // end if
897 } while(flag == 0);
590d15ee 898 // loop in row direction
aacedc3e 899 do{
900 j2 += isign;
aacedc3e 901 xr = gRandom->Rndm();
590d15ee 902 if ((j2<0) || (j2>GetNPixelsX()-1) || (xr>couplR)){
903 j2 = row;
aacedc3e 904 flag = 1;
905 }else{
590d15ee 906 UpdateMapSignal(j2,col,ntrack,idhit,pulse2);
aacedc3e 907 // flag = 0;
908 flag = 1; // only first next!!
909 } // end if
910 } while(flag == 0);
f8d9a5b8 911 } // for isign
912}
913//______________________________________________________________________
590d15ee 914void AliITSsimulationSPD::SetCouplingOld(Int_t col, Int_t row,
5bfe44ce 915 Int_t ntrack,Int_t idhit) {
f8d9a5b8 916 // Take into account the coupling between adiacent pixels.
c7a4dac0 917 // The parameters probcol and probrow are the fractions of the
918 // signal in one pixel shared in the two adjacent pixels along
919 // the column and row direction, respectively.
c7a4dac0 920 //Begin_Html
921 /*
922 <img src="picts/ITS/barimodel_3.gif">
923 </pre>
924 <br clear=left>
925 <font size=+2 color=red>
926 <a href="mailto:Rocco.Caliandro@ba.infn.it"></a>.
927 </font>
928 <pre>
929 */
930 //End_Html
5bfe44ce 931 // Inputs:
590d15ee 932 // Int_t col z cell index
933 // Int_t row x cell index
5bfe44ce 934 // Int_t ntrack track incex number
935 // Int_t idhit hit index number
936 // Int_t module module number
937 // Outputs:
938 // none.
939 // Return:
940 // none.
c7a4dac0 941 Int_t j1,j2,flag=0;
942 Double_t pulse1,pulse2;
aacedc3e 943 Double_t couplR=0.0,couplC=0.0;
c7a4dac0 944
5bfe44ce 945 GetCouplings(couplC,couplR);
946
947 // Debugging ...
948// cout << "Threshold --> " << GetThreshold() << endl; // dom
8e2f60b2 949// cout << "Couplings --> " << couplC << " " << couplR << endl; // dom
5bfe44ce 950
590d15ee 951 if(GetDebug(3)) Info("SetCouplingOld","(col=%d,row=%d,ntrack=%d,idhit=%d) "
952 "Calling SetCoupling couplC=%e couplR=%e",
953 col,row,ntrack,idhit,couplC,couplR);
954 for (Int_t isign=-1;isign<=1;isign+=2){// loop in col direction
955 pulse1 = GetMap()->GetSignalOnly(col,row);
5bfe44ce 956 pulse2 = pulse1;
590d15ee 957 j1 = col;
958 j2 = row;
aacedc3e 959 do{
960 j1 += isign;
590d15ee 961 pulse1 *= couplC;
5bfe44ce 962 if ((j1<0)||(j1>GetNPixelsZ()-1)||(pulse1<GetThreshold())){
590d15ee 963 pulse1 = GetMap()->GetSignalOnly(col,row);
964 j1 = col;
aacedc3e 965 flag = 1;
966 }else{
590d15ee 967 UpdateMapSignal(row,j1,ntrack,idhit,pulse1);
5bfe44ce 968 // flag = 0;
969 flag = 1; // only first next !!
aacedc3e 970 } // end if
971 } while(flag == 0);
590d15ee 972 // loop in row direction
aacedc3e 973 do{
974 j2 += isign;
590d15ee 975 pulse2 *= couplR;
5bfe44ce 976 if((j2<0)||(j2>(GetNPixelsX()-1))||(pulse2<GetThreshold())){
590d15ee 977 pulse2 = GetMap()->GetSignalOnly(col,row);
978 j2 = row;
aacedc3e 979 flag = 1;
980 }else{
590d15ee 981 UpdateMapSignal(j2,col,ntrack,idhit,pulse2);
5bfe44ce 982 // flag = 0;
983 flag = 1; // only first next!!
aacedc3e 984 } // end if
985 } while(flag == 0);
c7a4dac0 986 } // for isign
21b825a4 987}