1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line 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. 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 **************************************************************************/
23 #include <TStopwatch.h>
35 #include "AliITShit.h"
36 #include "AliITSdigit.h"
37 #include "AliITSmodule.h"
38 #include "AliITSpList.h"
39 #include "AliITSMapA1.h"
40 #include "AliITSMapA2.h"
41 #include "AliITSetfSDD.h"
42 #include "AliITSRawData.h"
43 #include "AliITSHuffman.h"
44 #include "AliITSsegmentation.h"
45 #include "AliITSresponse.h"
46 #include "AliITSsegmentationSDD.h"
47 #include "AliITSresponseSDD.h"
48 #include "AliITSsimulationSDD.h"
50 ClassImp(AliITSsimulationSDD)
51 ////////////////////////////////////////////////////////////////////////
53 // Written by Piergiorgio Cerello
56 // AliITSsimulationSDD is the simulation of SDDs.
60 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
63 <font size=+2 color=red>
64 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
69 //______________________________________________________________________
70 Int_t power(Int_t b, Int_t e) {
71 // compute b to the e power, where both b and e are Int_ts.
74 for(i=0; i<e; i++) power *= b;
77 //______________________________________________________________________
78 void FastFourierTransform(AliITSetfSDD *alisddetf,Double_t *real,
79 Double_t *imag,Int_t direction) {
80 // Do a Fast Fourier Transform
82 Int_t samples = alisddetf->GetSamples();
83 Int_t l = (Int_t) ((log((Float_t) samples)/log(2.))+0.5);
86 Int_t m2 = samples/m1;
89 for(j=0; j<samples; j += m1) {
91 for(k=j; k<= j+m-1; k++) {
92 Double_t wsr = alisddetf->GetWeightReal(p);
93 Double_t wsi = alisddetf->GetWeightImag(p);
94 if(direction == -1) wsi = -wsi;
95 Double_t xr = *(real+k+m);
96 Double_t xi = *(imag+k+m);
97 *(real+k+m) = wsr*(*(real+k)-xr) - wsi*(*(imag+k)-xi);
98 *(imag+k+m) = wsr*(*(imag+k)-xi) + wsi*(*(real+k)-xr);
109 for(j=0; j<samples; j++) {
113 for(i1=1; i1<=l; i1++) {
116 p = p + p + j2 - j1 - j1;
119 Double_t xr = *(real+j);
120 Double_t xi = *(imag+j);
121 *(real+j) = *(real+p);
122 *(imag+j) = *(imag+p);
127 if(direction == -1) {
128 for(i=0; i<samples; i++) {
129 *(real+i) /= samples;
130 *(imag+i) /= samples;
132 } // end if direction == -1
135 //______________________________________________________________________
136 AliITSsimulationSDD::AliITSsimulationSDD(){
137 // Default constructor
155 SetPerpendTracksFlag();
159 //______________________________________________________________________
160 AliITSsimulationSDD::AliITSsimulationSDD(AliITSsimulationSDD &source){
161 // Copy constructor to satify Coding roules only.
163 if(this==&source) return;
164 Error("AliITSsimulationSSD","Not allowed to make a copy of "
165 "AliITSsimulationSDD Using default creater instead");
166 AliITSsimulationSDD();
168 //______________________________________________________________________
169 AliITSsimulationSDD& AliITSsimulationSDD::operator=(AliITSsimulationSDD &src){
170 // Assignment operator to satify Coding roules only.
172 if(this==&src) return *this;
173 Error("AliITSsimulationSSD","Not allowed to make a = with "
174 "AliITSsimulationSDD Using default creater instead");
177 //______________________________________________________________________
178 AliITSsimulationSDD::AliITSsimulationSDD(AliITSsegmentation *seg,
179 AliITSresponse *resp){
180 // Standard Constructor
199 Init((AliITSsegmentationSDD*)seg,(AliITSresponseSDD*)resp);
201 //______________________________________________________________________
202 void AliITSsimulationSDD::Init(AliITSsegmentationSDD *seg,
203 AliITSresponseSDD *resp){
204 // Standard Constructor
209 SetPerpendTracksFlag();
213 fHitMap2 = new AliITSMapA2(fSegmentation,fScaleSize,1);
214 fHitMap1 = new AliITSMapA1(fSegmentation);
216 fNofMaps = fSegmentation->Npz();
217 fMaxNofSamples = fSegmentation->Npx();
219 Float_t sddLength = fSegmentation->Dx();
220 Float_t sddWidth = fSegmentation->Dz();
223 Float_t anodePitch = fSegmentation->Dpz(dummy);
224 Double_t timeStep = (Double_t)fSegmentation->Dpx(dummy);
225 Float_t driftSpeed = fResponse->DriftSpeed();
227 if(anodePitch*(fNofMaps/2) > sddWidth) {
228 Warning("AliITSsimulationSDD",
229 "Too many anodes %d or too big pitch %f \n",
230 fNofMaps/2,anodePitch);
233 if(timeStep*fMaxNofSamples < sddLength/driftSpeed) {
234 Error("AliITSsimulationSDD",
235 "Time Interval > Allowed Time Interval: exit\n");
239 fElectronics = new AliITSetfSDD(timeStep/fScaleSize,
240 fResponse->Electronics());
242 char opt1[20], opt2[20];
243 fResponse->ParamOptions(opt1,opt2);
245 char *same = strstr(opt1,"same");
250 fNoise.Set(fNofMaps);
251 fBaseline.Set(fNofMaps);
254 const char *kopt=fResponse->ZeroSuppOption();
255 if (strstr(fParam,"file") ) {
258 if (strstr(kopt,"2D")) {
261 Init2D(); // desactivate if param change module by module
262 } else if(strstr(kopt,"1D")) {
265 Init1D(); // desactivate if param change module by module
273 } // end if else strstr
275 Bool_t write = fResponse->OutputOption();
276 if(write && strstr(kopt,"2D")) MakeTreeB();
278 // call here if baseline does not change by module
281 fITS = (AliITS*)gAlice->GetModule("ITS");
282 Int_t size = fNofMaps*fMaxNofSamples;
283 fStream = new AliITSInStream(size);
285 fInZR = new Double_t [fScaleSize*fMaxNofSamples];
286 fInZI = new Double_t [fScaleSize*fMaxNofSamples];
287 fOutZR = new Double_t [fScaleSize*fMaxNofSamples];
288 fOutZI = new Double_t [fScaleSize*fMaxNofSamples];
291 //______________________________________________________________________
292 AliITSsimulationSDD::~AliITSsimulationSDD() {
306 if(fTreeB) delete fTreeB;
307 if(fInZR) delete [] fInZR;
308 if(fInZI) delete [] fInZI;
309 if(fOutZR) delete [] fOutZR;
310 if(fOutZI) delete [] fOutZI;
312 //______________________________________________________________________
313 void AliITSsimulationSDD::SDigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev){
314 // create maps to build the lists of tracks for each summable digit
316 TObjArray *fHits = mod->GetHits();
317 Int_t nhits = fHits->GetEntriesFast();
323 AliITSpList *pList = new AliITSpList(2*fSegmentation->Npz(),
324 fScaleSize*fSegmentation->Npx());
326 // inputs to ListOfFiredCells.
327 TObjArray *alist = new TObjArray();
328 fHitMap1->SetArray(alist);
329 static TClonesArray *padr = 0;
330 if(!padr) padr = new TClonesArray("TVector",1000);
332 HitsToAnalogDigits(mod,alist,padr,pList);
341 fHitMap1->ClearMap();
342 fHitMap2->ClearMap();
344 //______________________________________________________________________
345 void AliITSsimulationSDD::DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev){
346 // create maps to build the lists of tracks for each digit
348 TObjArray *fHits = mod->GetHits();
349 Int_t nhits = fHits->GetEntriesFast();
353 if (!nhits && fCheckNoise) {
356 fHitMap2->ClearMap();
358 } else if (!nhits) return;
360 AliITSpList *pList = new AliITSpList(2*fSegmentation->Npz(),
361 fScaleSize*fSegmentation->Npx());
363 // inputs to ListOfFiredCells.
364 TObjArray *alist = new TObjArray();
365 fHitMap1->SetArray(alist);
366 static TClonesArray *padr = 0;
367 if(!padr) padr = new TClonesArray("TVector",1000);
369 HitsToAnalogDigits(mod,alist,padr,pList);
378 fHitMap1->ClearMap();
379 fHitMap2->ClearMap();
381 //______________________________________________________________________
382 void AliITSsimulationSDD::SDigitsToDigits(AliITSpList *pList){
383 // Take Summable digits and create Digits.
385 // inputs to ListOfFiredCells.
386 TObjArray *alist = new TObjArray();
387 fHitMap1->SetArray(alist);
388 static TClonesArray *padr = 0;
389 if(!padr) padr = new TClonesArray("TVector",1000);
390 Int_t arg[6] = {0,0,0,0,0,0};
391 Double_t timeAmplitude;
394 // Fill maps from pList.
395 for(i=0;i<pList->GetMaxIndex();i++){
396 pList->GetMapIndex(i,arg[0],arg[1]);
397 for(j=0;j<pList->GetNEnteries();j++){
398 timeAmplitude = pList->GetTSignal(arg[0],arg[1],j);
399 if(timeAmplitude>0.0) continue;
400 arg[2] = pList->GetTrack(arg[0],arg[1],j);
401 arg[3] = pList->GetHit(arg[0],arg[1],j);
402 ListOfFiredCells(arg,timeAmplitude,alist,padr);
404 // Make sure map has full signal in it.
405 fHitMap2->SetHit(arg[0],arg[1],pList->GetSignal(arg[0],arg[1]));
414 fHitMap1->ClearMap();
415 fHitMap2->ClearMap();
417 //______________________________________________________________________
418 void AliITSsimulationSDD::FinishDigits(TObjArray *alist){
419 // introduce the electronics effects and do zero-suppression if required
420 Int_t nentries=alist->GetEntriesFast();
422 if(!nentries) return;
424 const char *kopt=fResponse->ZeroSuppOption();
425 ZeroSuppression(kopt);
427 //______________________________________________________________________
428 void AliITSsimulationSDD::HitsToAnalogDigits(AliITSmodule *mod,TObjArray *alst,
431 // create maps to build the lists of tracks for each digit
433 TObjArray *fHits = mod->GetHits();
434 Int_t nhits = fHits->GetEntriesFast();
435 Int_t arg[6] = {0,0,0,0,0,0};
437 Int_t nofAnodes = fNofMaps/2;
438 Float_t sddLength = fSegmentation->Dx();
439 Float_t sddWidth = fSegmentation->Dz();
440 Float_t anodePitch = fSegmentation->Dpz(dummy);
441 Float_t timeStep = fSegmentation->Dpx(dummy);
442 Float_t driftSpeed = fResponse->DriftSpeed();
443 Float_t maxadc = fResponse->MaxAdc();
444 Float_t topValue = fResponse->DynamicRange();
445 Float_t cHloss = fResponse->ChargeLoss();
446 Float_t norm = maxadc/topValue;
447 Float_t dfCoeff, s1; fResponse->DiffCoeff(dfCoeff,s1); // Signal 2d Shape
448 Double_t eVpairs = 3.6; // electron pair energy eV.
449 Float_t nsigma = fResponse->NSigmaIntegration(); //
450 Int_t nlookups = fResponse->GausNLookUp(); //
452 // Piergiorgio's part (apart for few variables which I made float
453 // when i thought that can be done
454 // Fill detector maps with GEANT hits
455 // loop over hits in the module
457 const Float_t kconv = 1.0e+6; // GeV->KeV
459 Int_t hitDetector; // detector number (lay,lad,hitDetector)
460 Int_t iWing; // which detector wing/side.
461 Int_t detector; // 2*(detector-1)+iWing
462 Int_t ii,kk,ka,kt; // loop indexs
463 Int_t ia,it,index; // sub-pixel integration indexies
464 Int_t iAnode; // anode number.
465 Int_t timeSample; // time buckett.
466 Int_t anodeWindow; // anode direction charge integration width
467 Int_t timeWindow; // time direction charge integration width
468 Int_t jamin,jamax; // anode charge integration window
469 Int_t jtmin,jtmax; // time charge integration window
470 Int_t ndiv; // Anode window division factor.
471 Int_t nsplit; // the number of splits in anode and time windows==1.
472 Int_t nOfSplits; // number of times track length is split into
473 Float_t nOfSplitsF; // Floating point version of nOfSplits.
474 Float_t kkF; // Floating point version of loop index kk.
475 Float_t pathInSDD; // Track length in SDD.
476 Float_t drPath; // average position of track in detector. in microns
477 Float_t drTime; // Drift time
478 Float_t nmul; // drift time window multiplication factor.
479 Float_t avDrft; // x position of path length segment in cm.
480 Float_t avAnode; // Anode for path length segment in Anode number (float)
481 Float_t xAnode; // Floating point anode number.
482 Float_t driftPath; // avDrft in microns.
483 Float_t width; // width of signal at anodes.
484 Double_t depEnergy; // Energy deposited in this GEANT step.
485 Double_t xL[3],dxL[3]; // local hit coordinates and diff.
486 Double_t sigA; // sigma of signal at anode.
487 Double_t sigT; // sigma in time/drift direction for track segment
488 Double_t aStep,aConst; // sub-pixel size and offset anode
489 Double_t tStep,tConst; // sub-pixel size and offset time
490 Double_t amplitude; // signal amplitude for track segment in nanoAmpere
491 Double_t chargeloss; // charge loss for track segment.
492 Double_t anodeAmplitude; // signal amplitude in anode direction
493 Double_t aExpo; // exponent of Gaussian anode direction
494 Double_t timeAmplitude; // signal amplitude in time direction
495 Double_t tExpo; // exponent of Gaussian time direction
496 // Double_t tof; // Time of flight in ns of this step.
498 for(ii=0; ii<nhits; ii++) {
499 if(!mod->LineSegmentL(ii,xL[0],dxL[0],xL[1],dxL[1],xL[2],dxL[2],
500 depEnergy,itrack)) continue;
502 hitDetector = mod->GetDet();
503 //tof = 1.E+09*(mod->GetHit(ii)->GetTOF()); // tof in ns.
504 //if(tof>sddLength/driftSpeed) continue; // hit happed too late.
506 // scale path to simulate a perpendicular track
507 // continue if the particle did not lose energy
508 // passing through detector
510 Warning("HitsToAnalogDigits",
511 "fTrack = %d hit=%d module=%d This particle has"
512 " passed without losing energy!",
513 itrack,ii,mod->GetIndex());
515 } // end if !depEnergy
517 pathInSDD = TMath::Sqrt(dxL[0]*dxL[0]+dxL[1]*dxL[1]+dxL[2]*dxL[2]);
519 if (fFlag && pathInSDD) { depEnergy *= (0.03/pathInSDD); }
520 drPath = 10000.*(dxL[0]+2.*xL[0])*0.5;
521 if(drPath < 0) drPath = -drPath;
522 drPath = sddLength-drPath;
524 Warning("HitsToAnalogDigits",
525 "negative drift path drPath=%e sddLength=%e dxL[0]=%e "
527 drPath,sddLength,dxL[0],xL[0]);
529 } // end if drPath < 0
531 // Compute number of segments to brake step path into
532 drTime = drPath/driftSpeed; // Drift Time
533 sigA = TMath::Sqrt(2.*dfCoeff*drTime+s1*s1);// Sigma along the anodes
534 // calcuate the number of time the path length should be split into.
535 nOfSplits = (Int_t) (1. + 10000.*pathInSDD/sigA);
536 if(fFlag) nOfSplits = 1;
538 // loop over path segments, init. some variables.
539 depEnergy /= nOfSplits;
540 nOfSplitsF = (Float_t) nOfSplits;
541 for(kk=0;kk<nOfSplits;kk++) { // loop over path segments
542 kkF = (Float_t) kk + 0.5;
543 avDrft = xL[0]+dxL[0]*kkF/nOfSplitsF;
544 avAnode = xL[2]+dxL[2]*kkF/nOfSplitsF;
545 driftPath = 10000.*avDrft;
547 iWing = 2; // Assume wing is 2
548 if(driftPath < 0) { // if wing is not 2 it is 1.
550 driftPath = -driftPath;
551 } // end if driftPath < 0
552 driftPath = sddLength-driftPath;
553 detector = 2*(hitDetector-1) + iWing;
555 Warning("HitsToAnalogDigits","negative drift path "
556 "driftPath=%e sddLength=%e avDrft=%e dxL[0]=%e "
557 "xL[0]=%e",driftPath,sddLength,avDrft,dxL[0],xL[0]);
559 } // end if driftPath < 0
562 drTime = driftPath/driftSpeed; // drift time for segment.
563 timeSample = (Int_t) (fScaleSize*drTime/timeStep + 1);
564 // compute time Sample including tof information. The tof only
565 // effects the time of the signal is recoreded and not the
567 // timeSample = (Int_t) (fScaleSize*(drTime+tof)/timeStep + 1);
568 if(timeSample > fScaleSize*fMaxNofSamples) {
569 Warning("HItsToAnalogDigits","Wrong Time Sample: %e",
572 } // end if timeSample > fScaleSize*fMaxNoofSamples
575 xAnode = 10000.*(avAnode)/anodePitch + nofAnodes/2; // +1?
576 if(xAnode*anodePitch > sddWidth || xAnode*anodePitch < 0.)
577 Warning("HitsToAnalogDigits",
578 "Exceedubg sddWidth=%e Z = %e",
579 sddWidth,xAnode*anodePitch);
580 iAnode = (Int_t) (1.+xAnode); // xAnode?
581 if(iAnode < 1 || iAnode > nofAnodes) {
582 Warning("HitToAnalogDigits","Wrong iAnode: 1<%d>%d",
585 } // end if iAnode < 1 || iAnode > nofAnodes
587 // store straight away the particle position in the array
588 // of particles and take idhit=ii only when part is entering (this
589 // requires FillModules() in the macro for analysis) :
591 // Sigma along the anodes for track segment.
592 sigA = TMath::Sqrt(2.*dfCoeff*drTime+s1*s1);
593 sigT = sigA/driftSpeed;
594 // Peak amplitude in nanoAmpere
595 amplitude = fScaleSize*160.*depEnergy/
596 (timeStep*eVpairs*2.*acos(-1.)*sigT*sigA);
597 amplitude *= timeStep/25.; // WARNING!!!!! Amplitude scaling to
598 // account for clock variations
599 // (reference value: 40 MHz)
600 chargeloss = 1.-cHloss*driftPath/1000;
601 amplitude *= chargeloss;
602 width = 2.*nsigma/(nlookups-1);
610 } // end if drTime > 1200.
612 nsplit = 4; // hard-wired //nsplit=4;nsplit = (nsplit+1)/2*2;
613 // Sub-pixel size see computation of aExpo and tExpo.
614 aStep = anodePitch/(nsplit*fScaleSize*sigA);
615 aConst = xAnode*anodePitch/sigA;
616 tStep = timeStep/(nsplit*fScaleSize*sigT);
617 tConst = drTime/sigT;
618 // Define SDD window corresponding to the hit
619 anodeWindow = (Int_t)(fScaleSize*nsigma*sigA/anodePitch+1);
620 timeWindow = (Int_t) (fScaleSize*nsigma*sigT/timeStep+1.);
621 jamin = (iAnode - anodeWindow/ndiv - 1)*fScaleSize*nsplit +1;
622 jamax = (iAnode + anodeWindow/ndiv)*fScaleSize*nsplit;
623 if(jamin <= 0) jamin = 1;
624 if(jamax > fScaleSize*nofAnodes*nsplit)
625 jamax = fScaleSize*nofAnodes*nsplit;
626 // jtmin and jtmax are Hard-wired
627 jtmin = (Int_t)(timeSample-timeWindow*nmul-1)*nsplit+1;
628 jtmax = (Int_t)(timeSample+timeWindow*nmul)*nsplit;
629 if(jtmin <= 0) jtmin = 1;
630 if(jtmax > fScaleSize*fMaxNofSamples*nsplit)
631 jtmax = fScaleSize*fMaxNofSamples*nsplit;
632 // Spread the charge in the anode-time window
633 for(ka=jamin; ka <=jamax; ka++) {
634 ia = (ka-1)/(fScaleSize*nsplit) + 1;
636 Warning("HitsToAnalogDigits","ia < 1: ");
639 if(ia > nofAnodes) ia = nofAnodes;
640 aExpo = (aStep*(ka-0.5)-aConst);
641 if(TMath::Abs(aExpo) > nsigma) anodeAmplitude = 0.;
643 dummy = (Int_t) ((aExpo+nsigma)/width);
644 anodeAmplitude = amplitude*fResponse->GausLookUp(dummy);
645 } // end if TMath::Abs(aEspo) > nsigma
646 // index starts from 0
647 index = ((detector+1)%2)*nofAnodes+ia-1;
648 if(anodeAmplitude) for(kt=jtmin; kt<=jtmax; kt++) {
649 it = (kt-1)/nsplit+1; // it starts from 1
651 Warning("HitsToAnalogDigits","it < 1:");
654 if(it>fScaleSize*fMaxNofSamples)
655 it = fScaleSize*fMaxNofSamples;
656 tExpo = (tStep*(kt-0.5)-tConst);
657 if(TMath::Abs(tExpo) > nsigma) timeAmplitude = 0.;
659 dummy = (Int_t) ((tExpo+nsigma)/width);
660 timeAmplitude = anodeAmplitude*
661 fResponse->GausLookUp(dummy);
662 } // end if TMath::Abs(tExpo) > nsigma
663 // build the list of digits for this module
666 arg[2] = itrack; // track number
667 arg[3] = ii-1; // hit number.
668 timeAmplitude *= norm;
670 ListOfFiredCells(arg,timeAmplitude,alst,padr);
671 pList->AddSignal(index,it,itrack,ii-1,
672 mod->GetIndex(),timeAmplitude);
673 } // end if anodeAmplitude and loop over time in window
674 } // loop over anodes in window
675 } // end loop over "sub-hits"
676 } // end loop over hits
678 //______________________________________________________________________
679 void AliITSsimulationSDD::ListOfFiredCells(Int_t *arg,Double_t timeAmplitude,
680 TObjArray *alist,TClonesArray *padr){
681 // Returns the list of "fired" cells.
683 Int_t index = arg[0];
685 Int_t idtrack = arg[2];
686 Int_t idhit = arg[3];
687 Int_t counter = arg[4];
688 Int_t countadr = arg[5];
689 Double_t charge = timeAmplitude;
690 charge += fHitMap2->GetSignal(index,ik-1);
691 fHitMap2->SetHit(index, ik-1, charge);
694 Int_t it = (Int_t)((ik-1)/fScaleSize);
697 digits[2] = (Int_t)timeAmplitude;
699 if (idtrack >= 0) phys = (Float_t)timeAmplitude;
702 Double_t cellcharge = 0.;
703 AliITSTransientDigit* pdigit;
704 // build the list of fired cells and update the info
705 if (!fHitMap1->TestHit(index, it)) {
706 new((*padr)[countadr++]) TVector(3);
707 TVector &trinfo=*((TVector*) (*padr)[countadr-1]);
708 trinfo(0) = (Float_t)idtrack;
709 trinfo(1) = (Float_t)idhit;
710 trinfo(2) = (Float_t)timeAmplitude;
712 alist->AddAtAndExpand(new AliITSTransientDigit(phys,digits),counter);
713 fHitMap1->SetHit(index, it, counter);
715 pdigit=(AliITSTransientDigit*)alist->At(alist->GetLast());
717 TObjArray *trlist=(TObjArray*)pdigit->TrackList();
718 trlist->Add(&trinfo);
720 pdigit = (AliITSTransientDigit*) fHitMap1->GetHit(index, it);
721 for(Int_t kk=0;kk<fScaleSize;kk++) {
722 cellcharge += fHitMap2->GetSignal(index,fScaleSize*it+kk);
725 (*pdigit).fSignal = (Int_t)cellcharge;
726 (*pdigit).fPhysics += phys;
727 // update list of tracks
728 TObjArray* trlist = (TObjArray*)pdigit->TrackList();
729 Int_t lastentry = trlist->GetLast();
730 TVector *ptrkp = (TVector*)trlist->At(lastentry);
731 TVector &trinfo = *ptrkp;
732 Int_t lasttrack = Int_t(trinfo(0));
733 Float_t lastcharge=(trinfo(2));
734 if (lasttrack==idtrack ) {
735 lastcharge += (Float_t)timeAmplitude;
736 trlist->RemoveAt(lastentry);
737 trinfo(0) = lasttrack;
739 trinfo(2) = lastcharge;
740 trlist->AddAt(&trinfo,lastentry);
742 new((*padr)[countadr++]) TVector(3);
743 TVector &trinfo=*((TVector*) (*padr)[countadr-1]);
744 trinfo(0) = (Float_t)idtrack;
745 trinfo(1) = (Float_t)idhit;
746 trinfo(2) = (Float_t)timeAmplitude;
747 trlist->Add(&trinfo);
748 } // end if lasttrack==idtrack
751 // check the track list - debugging
752 Int_t trk[20], htrk[20];
754 Int_t nptracks = trlist->GetEntriesFast();
757 for (tr=0;tr<nptracks;tr++) {
758 TVector *pptrkp = (TVector*)trlist->At(tr);
759 TVector &pptrk = *pptrkp;
760 trk[tr] = Int_t(pptrk(0));
761 htrk[tr] = Int_t(pptrk(1));
762 chtrk[tr] = (pptrk(2));
763 cout << "nptracks "<<nptracks << endl;
769 // update counter and countadr for next call.
773 //____________________________________________
775 void AliITSsimulationSDD::AddDigit(Int_t i, Int_t j, Int_t signal){
777 // tag with -1 signals coming from background tracks
778 // tag with -2 signals coming from pure electronic noise
780 Int_t digits[3], tracks[3], hits[3];
781 Float_t phys, charges[3];
783 Int_t trk[20], htrk[20];
786 Bool_t do10to8=fResponse->Do10to8();
788 if(do10to8) signal=Convert8to10(signal);
789 AliITSTransientDigit *obj = (AliITSTransientDigit*)fHitMap1->GetHit(i,j);
801 fITS->AddSimDigit(1,phys,digits,tracks,hits,charges);
804 TObjArray* trlist=(TObjArray*)obj->TrackList();
805 Int_t nptracks=trlist->GetEntriesFast();
807 Warning("AddDigit","nptracks=%d > 20 nptracks set to 20",nptracks);
809 } // end if nptracks > 20
811 for (tr=0;tr<nptracks;tr++) {
812 TVector &pp =*((TVector*)trlist->At(tr));
813 trk[tr]=Int_t(pp(0));
814 htrk[tr]=Int_t(pp(1));
818 SortTracks(trk,chtrk,htrk,nptracks);
819 } // end if nptracks > 1
822 for (i=0; i<nptracks; i++) {
827 for (i=nptracks; i<3; i++) {
833 for (i=0; i<3; i++) {
838 } // end if/else nptracks < 3
840 fITS->AddSimDigit(1,phys,digits,tracks,hits,charges);
842 } // end if/else !obj
844 //______________________________________________________________________
845 void AliITSsimulationSDD::SortTracks(Int_t *tracks,Float_t *charges,
846 Int_t *hits,Int_t ntr){
847 // Sort the list of tracks contributing to a given digit
848 // Only the 3 most significant tracks are acctually sorted
849 // Loop over signals, only 3 times
853 Int_t idx[3] = {-3,-3,-3};
854 Float_t jch[3] = {-3,-3,-3};
855 Int_t jtr[3] = {-3,-3,-3};
856 Int_t jhit[3] = {-3,-3,-3};
859 if (ntr<3) imax = ntr;
865 if((i == 1 && j == idx[i-1] )
866 ||(i == 2 && (j == idx[i-1] || j == idx[i-2]))) continue;
867 if(charges[j] > qmax) {
870 } // end if charges[j]>qmax
874 jch[i] = charges[jmax];
875 jtr[i] = tracks[jmax];
876 jhit[i] = hits[jmax];
889 } // end if jtr[i] == -3
892 //______________________________________________________________________
893 void AliITSsimulationSDD::ChargeToSignal() {
894 // add baseline, noise, electronics and ADC saturation effects
896 char opt1[20], opt2[20];
897 fResponse->ParamOptions(opt1,opt2);
898 char *read = strstr(opt1,"file");
899 Float_t baseline, noise;
902 static Bool_t readfile=kTRUE;
903 //read baseline and noise from file
904 if (readfile) ReadBaseline();
906 } else fResponse->GetNoiseParam(noise,baseline);
910 Float_t maxadc = fResponse->MaxAdc();
912 for (i=0;i<fNofMaps;i++) {
913 if (read && i<fNofMaps) GetAnodeBaseline(i,baseline,noise);
914 for(k=0; k<fScaleSize*fMaxNofSamples; k++) {
915 fInZR[k] = fHitMap2->GetSignal(i,k);
916 contrib = (baseline + noise*gRandom->Gaus());
919 for(k=0; k<fMaxNofSamples; k++) {
920 Double_t newcont = 0.;
921 Double_t maxcont = 0.;
922 for(kk=0;kk<fScaleSize;kk++) {
923 newcont = fInZR[fScaleSize*k+kk];
924 if(newcont > maxcont) maxcont = newcont;
927 if (newcont >= maxadc) newcont = maxadc -1;
928 if(newcont >= baseline){
929 Warning("","newcont=%d>=baseline=%d",newcont,baseline);
932 fHitMap2->SetHit(i,k,newcont);
934 } // end for i loop over anodes
938 for (i=0;i<fNofMaps;i++) {
939 if (read && i<fNofMaps) GetAnodeBaseline(i,baseline,noise);
940 for(k=0; k<fScaleSize*fMaxNofSamples; k++) {
941 fInZR[k] = fHitMap2->GetSignal(i,k);
942 contrib = (baseline + noise*gRandom->Gaus());
946 FastFourierTransform(fElectronics,&fInZR[0],&fInZI[0],1);
947 for(k=0; k<fScaleSize*fMaxNofSamples; k++) {
948 Double_t rw = fElectronics->GetTraFunReal(k);
949 Double_t iw = fElectronics->GetTraFunImag(k);
950 fOutZR[k] = fInZR[k]*rw - fInZI[k]*iw;
951 fOutZI[k] = fInZR[k]*iw + fInZI[k]*rw;
953 FastFourierTransform(fElectronics,&fOutZR[0],&fOutZI[0],-1);
954 for(k=0; k<fMaxNofSamples; k++) {
955 Double_t newcont1 = 0.;
956 Double_t maxcont1 = 0.;
957 for(kk=0;kk<fScaleSize;kk++) {
958 newcont1 = fOutZR[fScaleSize*k+kk];
959 if(newcont1 > maxcont1) maxcont1 = newcont1;
962 if (newcont1 >= maxadc) newcont1 = maxadc -1;
963 fHitMap2->SetHit(i,k,newcont1);
965 } // end for i loop over anodes
968 //______________________________________________________________________
969 void AliITSsimulationSDD::GetAnodeBaseline(Int_t i,Float_t &baseline,
971 // Returns the Baseline for a particular anode.
972 baseline = fBaseline[i];
975 //______________________________________________________________________
976 void AliITSsimulationSDD::CompressionParam(Int_t i,Int_t &db,Int_t &tl,
978 // Returns the compression alogirthm parameters
979 Int_t size = fD.GetSize();
981 db=fD[i]; tl=fT1[i]; th=fT2[i];
983 if (size <= 2 && i>=fNofMaps/2) {
984 db=fD[1]; tl=fT1[1]; th=fT2[1];
986 db=fD[0]; tl=fT1[0]; th=fT2[0];
987 } // end if size <=2 && i>=fNofMaps/2
990 //______________________________________________________________________
991 void AliITSsimulationSDD::CompressionParam(Int_t i,Int_t &db,Int_t &tl){
992 // returns the compression alogirthm parameters
993 Int_t size = fD.GetSize();
998 if (size <= 2 && i>=fNofMaps/2) {
1001 db=fD[0]; tl=fT1[0];
1002 } // end if size <=2 && i>=fNofMaps/2
1003 } // end if size > 2
1005 //______________________________________________________________________
1006 void AliITSsimulationSDD::SetCompressParam(){
1007 // Sets the compression alogirthm parameters
1010 fResponse->GiveCompressParam(cp);
1011 for (i=0; i<2; i++) {
1018 //______________________________________________________________________
1019 void AliITSsimulationSDD::ReadBaseline(){
1020 // read baseline and noise from file - either a .root file and in this
1021 // case data should be organised in a tree with one entry for each
1022 // module => reading should be done accordingly
1023 // or a classic file and do smth. like this:
1024 // Read baselines and noise for SDD
1028 char input[100], base[100], param[100];
1031 fResponse->Filenames(input,base,param);
1034 filtmp = gSystem->ExpandPathName(fFileName.Data());
1035 FILE *bline = fopen(filtmp,"r");
1039 while(fscanf(bline,"%d %f %f",&pos, &bl, &n) != EOF) {
1041 Error("ReadBaseline","Anode number not in increasing order!",
1044 } // end if pos != na+1
1050 Error("ReadBaseline"," THE BASELINE FILE %s DOES NOT EXIST !",filtmp);
1057 //______________________________________________________________________
1058 Int_t AliITSsimulationSDD::Convert10to8(Int_t signal) const {
1059 // To the 10 to 8 bit lossive compression.
1060 // code from Davide C. and Albert W.
1062 if (signal < 128) return signal;
1063 if (signal < 256) return (128+((signal-128)>>1));
1064 if (signal < 512) return (192+((signal-256)>>3));
1065 if (signal < 1024) return (224+((signal-512)>>4));
1068 //______________________________________________________________________
1069 Int_t AliITSsimulationSDD::Convert8to10(Int_t signal) const {
1070 // Undo the lossive 10 to 8 bit compression.
1071 // code from Davide C. and Albert W.
1072 if (signal < 0 || signal > 255) {
1073 Warning("Convert8to10","out of range signal=%d",signal);
1075 } // end if signal <0 || signal >255
1077 if (signal < 128) return signal;
1079 if (TMath::Odd(signal)) return (128+((signal-128)<<1));
1080 else return (128+((signal-128)<<1)+1);
1081 } // end if signal < 192
1083 if (TMath::Odd(signal)) return (256+((signal-192)<<3)+3);
1084 else return (256+((signal-192)<<3)+4);
1085 } // end if signal < 224
1086 if (TMath::Odd(signal)) return (512+((signal-224)<<4)+7);
1087 return (512+((signal-224)<<4)+7);
1089 //______________________________________________________________________
1090 AliITSMap* AliITSsimulationSDD::HitMap(Int_t i){
1091 //Return the correct map.
1093 return ((i==0)? fHitMap1 : fHitMap2);
1095 //______________________________________________________________________
1096 void AliITSsimulationSDD::ZeroSuppression(const char *option) {
1097 // perform the zero suppresion
1099 if (strstr(option,"2D")) {
1100 //Init2D(); // activate if param change module by module
1102 } else if (strstr(option,"1D")) {
1103 //Init1D(); // activate if param change module by module
1105 } else StoreAllDigits();
1107 //______________________________________________________________________
1108 void AliITSsimulationSDD::Init2D(){
1109 // read in and prepare arrays: fD, fT1, fT2
1110 // savemu[nanodes], savesigma[nanodes]
1111 // read baseline and noise from file - either a .root file and in this
1112 // case data should be organised in a tree with one entry for each
1113 // module => reading should be done accordingly
1114 // or a classic file and do smth. like this ( code from Davide C. and
1116 // Read 2D zero-suppression parameters for SDD
1118 if (!strstr(fParam,"file")) return;
1120 Int_t na,pos,tempTh;
1122 Float_t *savemu = new Float_t [fNofMaps];
1123 Float_t *savesigma = new Float_t [fNofMaps];
1124 char input[100],basel[100],par[100];
1126 Int_t minval = fResponse->MinVal();
1128 fResponse->Filenames(input,basel,par);
1131 filtmp = gSystem->ExpandPathName(fFileName.Data());
1132 FILE *param = fopen(filtmp,"r");
1136 while(fscanf(param,"%d %f %f",&pos, &mu, &sigma) != EOF) {
1138 Error("Init2D","Anode number not in increasing order!",filtmp);
1140 } // end if pos != na+1
1142 savesigma[na] = sigma;
1143 if ((2.*sigma) < mu) {
1144 fD[na] = (Int_t)floor(mu - 2.0*sigma + 0.5);
1147 tempTh = (Int_t)floor(mu+2.25*sigma+0.5) - minval;
1148 if (tempTh < 0) tempTh=0;
1150 tempTh = (Int_t)floor(mu+3.0*sigma+0.5) - minval;
1151 if (tempTh < 0) tempTh=0;
1156 Error("Init2D","THE FILE %s DOES NOT EXIST !",filtmp);
1163 delete [] savesigma;
1165 //______________________________________________________________________
1166 void AliITSsimulationSDD::Compress2D(){
1167 // simple ITS cluster finder -- online zero-suppression conditions
1170 Int_t minval = fResponse->MinVal();
1171 Bool_t write = fResponse->OutputOption();
1172 Bool_t do10to8 = fResponse->Do10to8();
1173 Int_t nz, nl, nh, low, i, j;
1175 for (i=0; i<fNofMaps; i++) {
1176 CompressionParam(i,db,tl,th);
1181 for (j=0; j<fMaxNofSamples; j++) {
1182 Int_t signal=(Int_t)(fHitMap2->GetSignal(i,j));
1183 signal -= db; // if baseline eq. is done here
1184 if (signal <= 0) {nz++; continue;}
1185 if ((signal - tl) < minval) low++;
1186 if ((signal - th) >= minval) {
1189 FindCluster(i,j,signal,minval,cond);
1191 ((TMath::Abs(fHitMap2->GetSignal(i,j-1))-th)>=minval)){
1192 if(do10to8) signal = Convert10to8(signal);
1193 AddDigit(i,j,signal);
1194 } // end if cond&&j&&()
1195 } else if ((signal - tl) >= minval) nl++;
1196 } // end for j loop time samples
1197 if (write) TreeB()->Fill(nz,nl,nh,low,i+1);
1198 } //end for i loop anodes
1202 sprintf(hname,"TNtuple%d_%d",fModule,fEvent);
1203 TreeB()->Write(hname);
1208 //______________________________________________________________________
1209 void AliITSsimulationSDD::FindCluster(Int_t i,Int_t j,Int_t signal,
1210 Int_t minval,Bool_t &cond){
1211 // Find clusters according to the online 2D zero-suppression algorithm
1212 Bool_t do10to8 = fResponse->Do10to8();
1213 Bool_t high = kFALSE;
1215 fHitMap2->FlagHit(i,j);
1217 // check the online zero-suppression conditions
1219 const Int_t kMaxNeighbours = 4;
1222 Int_t xList[kMaxNeighbours], yList[kMaxNeighbours];
1223 fSegmentation->Neighbours(i,j,&nn,xList,yList);
1225 for (in=0; in<nn; in++) {
1228 if (fHitMap2->TestHit(ix,iy)==kUnused) {
1229 CompressionParam(ix,dbx,tlx,thx);
1230 Int_t qn = (Int_t)(fHitMap2->GetSignal(ix,iy));
1231 qn -= dbx; // if baseline eq. is done here
1232 if ((qn-tlx) < minval) {
1233 fHitMap2->FlagHit(ix,iy);
1236 if ((qn - thx) >= minval) high=kTRUE;
1238 if(do10to8) signal = Convert10to8(signal);
1239 AddDigit(i,j,signal);
1241 if(do10to8) qns = Convert10to8(qn);
1243 if (!high) AddDigit(ix,iy,qns);
1245 if(!high) fHitMap2->FlagHit(ix,iy);
1246 } // end if qn-tlx < minval
1248 } // end for in loop over neighbours
1250 //______________________________________________________________________
1251 void AliITSsimulationSDD::Init1D(){
1252 // this is just a copy-paste of input taken from 2D algo
1253 // Torino people should give input
1254 // Read 1D zero-suppression parameters for SDD
1256 if (!strstr(fParam,"file")) return;
1258 Int_t na,pos,tempTh;
1260 Float_t *savemu = new Float_t [fNofMaps];
1261 Float_t *savesigma = new Float_t [fNofMaps];
1262 char input[100],basel[100],par[100];
1264 Int_t minval = fResponse->MinVal();
1266 fResponse->Filenames(input,basel,par);
1269 // set first the disable and tol param
1272 filtmp = gSystem->ExpandPathName(fFileName.Data());
1273 FILE *param = fopen(filtmp,"r");
1277 fscanf(param,"%d %d %d %d ", &fT2[0], &fT2[1], &fTol[0], &fTol[1]);
1278 while(fscanf(param,"%d %f %f",&pos, &mu, &sigma) != EOF) {
1280 Error("Init1D","Anode number not in increasing order!",filtmp);
1282 } // end if pos != na+1
1284 savesigma[na]=sigma;
1285 if ((2.*sigma) < mu) {
1286 fD[na] = (Int_t)floor(mu - 2.0*sigma + 0.5);
1289 tempTh = (Int_t)floor(mu+2.25*sigma+0.5) - minval;
1290 if (tempTh < 0) tempTh=0;
1295 Error("Init1D","THE FILE %s DOES NOT EXIST !",filtmp);
1302 delete [] savesigma;
1304 //______________________________________________________________________
1305 void AliITSsimulationSDD::Compress1D(){
1306 // 1D zero-suppression algorithm (from Gianluca A.)
1307 Int_t dis,tol,thres,decr,diff;
1308 UChar_t *str=fStream->Stream();
1310 Bool_t do10to8=fResponse->Do10to8();
1314 for (k=0; k<2; k++) {
1317 for (i=0; i<fNofMaps/2; i++) {
1318 Bool_t firstSignal=kTRUE;
1319 Int_t idx=i+k*fNofMaps/2;
1320 CompressionParam(idx,decr,thres);
1321 for (j=0; j<fMaxNofSamples; j++) {
1322 Int_t signal=(Int_t)(fHitMap2->GetSignal(idx,j));
1323 signal -= decr; // if baseline eq.
1324 if(do10to8) signal = Convert10to8(signal);
1325 if (signal <= thres) {
1329 // write diff in the buffer for HuffT
1330 str[counter]=(UChar_t)diff;
1333 } // end if signal <= thres
1335 if (diff > 127) diff=127;
1336 if (diff < -128) diff=-128;
1338 // tol has changed to 8 possible cases ? - one can write
1339 // this if(TMath::Abs(diff)<tol) ... else ...
1340 if(TMath::Abs(diff)<tol) diff=0;
1341 // or keep it as it was before
1343 if (tol==1 && (diff >= -2 && diff <= 1)) diff=0;
1344 if (tol==2 && (diff >= -4 && diff <= 3)) diff=0;
1345 if (tol==3 && (diff >= -16 && diff <= 15)) diff=0;
1347 AddDigit(idx,j,last+diff);
1349 AddDigit(idx,j,signal);
1350 } // end if singal < dis
1352 // write diff in the buffer used to compute Huffman tables
1353 if (firstSignal) str[counter]=(UChar_t)signal;
1354 else str[counter]=(UChar_t)diff;
1358 } // end for j loop time samples
1359 } // end for i loop anodes one half of detector
1363 fStream->CheckCount(counter);
1365 // open file and write out the stream of diff's
1366 static Bool_t open=kTRUE;
1367 static TFile *outFile;
1368 Bool_t write = fResponse->OutputOption();
1369 TDirectory *savedir = gDirectory;
1373 SetFileName("stream.root");
1374 cout<<"filename "<<fFileName<<endl;
1375 outFile=new TFile(fFileName,"recreate");
1376 cout<<"I have opened "<<fFileName<<" file "<<endl;
1383 fStream->ClearStream();
1385 // back to galice.root file
1386 if(savedir) savedir->cd();
1388 //______________________________________________________________________
1389 void AliITSsimulationSDD::StoreAllDigits(){
1390 // if non-zero-suppressed data
1391 Bool_t do10to8 = fResponse->Do10to8();
1392 Int_t i, j, digits[3];
1394 for (i=0; i<fNofMaps; i++) {
1395 for (j=0; j<fMaxNofSamples; j++) {
1396 Int_t signal=(Int_t)(fHitMap2->GetSignal(i,j));
1397 if(do10to8) signal = Convert10to8(signal);
1398 if(do10to8) signal = Convert8to10(signal);
1402 fITS->AddRealDigit(1,digits);
1406 //______________________________________________________________________
1407 void AliITSsimulationSDD::CreateHistograms(Int_t scale){
1408 // Creates histograms of maps for debugging
1411 fHis=new TObjArray(fNofMaps);
1412 for (i=0;i<fNofMaps;i++) {
1413 TString sddName("sdd_");
1415 sprintf(candNum,"%d",i+1);
1416 sddName.Append(candNum);
1417 fHis->AddAt(new TH1F(sddName.Data(),"SDD maps",scale*fMaxNofSamples,
1418 0.,(Float_t) scale*fMaxNofSamples), i);
1421 //______________________________________________________________________
1422 void AliITSsimulationSDD::FillHistograms(){
1423 // fill 1D histograms from map
1427 for( Int_t i=0; i<fNofMaps; i++) {
1428 TH1F *hist =(TH1F *)fHis->UncheckedAt(i);
1429 Int_t nsamples = hist->GetNbinsX();
1430 for( Int_t j=0; j<nsamples; j++) {
1431 Double_t signal=fHitMap2->GetSignal(i,j);
1432 hist->Fill((Float_t)j,signal);
1436 //______________________________________________________________________
1437 void AliITSsimulationSDD::ResetHistograms(){
1438 // Reset histograms for this detector
1441 for (i=0;i<fNofMaps;i++ ) {
1442 if (fHis->At(i)) ((TH1F*)fHis->At(i))->Reset();
1445 //______________________________________________________________________
1446 TH1F *AliITSsimulationSDD::GetAnode(Int_t wing, Int_t anode) {
1447 // Fills a histogram from a give anode.
1449 if (!fHis) return 0;
1451 if(wing <=0 || wing > 2) {
1452 Warning("GetAnode","Wrong wing number: %d",wing);
1454 } // end if wing <=0 || wing >2
1455 if(anode <=0 || anode > fNofMaps/2) {
1456 Warning("GetAnode","Wrong anode number: %d",anode);
1458 } // end if ampde <=0 || andoe > fNofMaps/2
1460 Int_t index = (wing-1)*fNofMaps/2 + anode-1;
1461 return (TH1F*)(fHis->At(index));
1463 //______________________________________________________________________
1464 void AliITSsimulationSDD::WriteToFile(TFile *hfile) {
1465 // Writes the histograms to a file
1471 for(i=0; i<fNofMaps; i++) fHis->At(i)->Write(); //fAdcs[i]->Write();
1474 //______________________________________________________________________
1475 Float_t AliITSsimulationSDD::GetNoise() {
1476 // Returns the noise value
1477 //Bool_t do10to8=fResponse->Do10to8();
1478 //noise will always be in the liniar part of the signal
1480 Int_t threshold = fT1[0];
1481 char opt1[20], opt2[20];
1483 fResponse->ParamOptions(opt1,opt2);
1485 char *same = strstr(opt1,"same");
1486 Float_t noise,baseline;
1488 fResponse->GetNoiseParam(noise,baseline);
1490 static Bool_t readfile=kTRUE;
1491 //read baseline and noise from file
1492 if (readfile) ReadBaseline();
1496 TCanvas *c2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("c2");
1497 if(c2) delete c2->GetPrimitive("noisehist");
1498 if(c2) delete c2->GetPrimitive("anode");
1499 else c2=new TCanvas("c2");
1501 c2->SetFillColor(0);
1503 TH1F *noisehist = new TH1F("noisehist","noise",100,0.,(float)2*threshold);
1504 TH1F *anode = new TH1F("anode","Anode Projection",fMaxNofSamples,0.,
1505 (float)fMaxNofSamples);
1507 for (i=0;i<fNofMaps;i++) {
1508 CompressionParam(i,decr,threshold);
1509 if (!same) GetAnodeBaseline(i,baseline,noise);
1511 for (k=0;k<fMaxNofSamples;k++) {
1512 Float_t signal=(Float_t)fHitMap2->GetSignal(i,k);
1513 //if (signal <= (float)threshold) noisehist->Fill(signal-baseline);
1514 if (signal <= (float)threshold) noisehist->Fill(signal);
1515 anode->Fill((float)k,signal);
1520 TF1 *gnoise = new TF1("gnoise","gaus",0.,threshold);
1521 noisehist->Fit("gnoise","RQ");
1524 Float_t mnoise = gnoise->GetParameter(1);
1525 cout << "mnoise : " << mnoise << endl;
1526 Float_t rnoise = gnoise->GetParameter(2);
1527 cout << "rnoise : " << rnoise << endl;
1530 }//______________________________________________________________________
1531 void AliITSsimulationSDD::WriteSDigits(AliITSpList *pList){
1532 // Fills the Summable digits Tree
1534 static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
1536 pList->GetMaxMapIndex(ni,nj);
1537 for(i=0;i<ni;i++)for(j=0;j<nj;j++){
1538 if(pList->GetSignalOnly(i,j)>0.5*fT1[0]){ // above small threshold.
1539 aliITS->AddSumDigit(*(pList->GetpListItem(i,j)));
1540 // cout << "pListSDD: " << *(pList->GetpListItem(i,j)) << endl;
1545 //______________________________________________________________________
1546 void AliITSsimulationSDD::Print() {
1547 // Print SDD simulation Parameters
1549 cout << "**************************************************" << endl;
1550 cout << " Silicon Drift Detector Simulation Parameters " << endl;
1551 cout << "**************************************************" << endl;
1552 cout << "Flag for Perpendicular tracks: " << (Int_t) fFlag << endl;
1553 cout << "Flag for noise checking: " << (Int_t) fCheckNoise << endl;
1554 cout << "Flag to switch off electronics: " << (Int_t) fDoFFT << endl;
1555 cout << "Number pf Anodes used: " << fNofMaps << endl;
1556 cout << "Number of Time Samples: " << fMaxNofSamples << endl;
1557 cout << "Scale size factor: " << fScaleSize << endl;
1558 cout << "**************************************************" << endl;