]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulationSSD.cxx
Continuation of TFlukaGeo based on TGeo.
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationSSD.cxx
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
16 /* $Id$ */
17
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <Riostream.h>
21 #include <TObjArray.h>
22 #include <TParticle.h>
23 #include <TRandom.h>
24 #include <TMath.h>
25 #include <TH1.h>
26
27 #include "AliITSmodule.h"
28 #include "AliITSMapA2.h"
29 #include "AliITSpList.h"
30 #include "AliITSresponseSSD.h"
31 #include "AliITSsegmentationSSD.h"
32 #include "AliITSdcsSSD.h"
33 #include "AliITS.h"
34 #include "AliITShit.h"
35 #include "AliITSdigitSSD.h"
36 #include "AliRun.h"
37 #include "AliITSgeom.h"
38 #include "AliITSsimulationSSD.h"
39 #include "AliITSTableSSD.h"
40
41 ClassImp(AliITSsimulationSSD);
42 ////////////////////////////////////////////////////////////////////////
43 // Version: 0
44 // Written by Enrico Fragiacomo
45 // July 2000
46 //
47 // AliITSsimulationSSD is the simulation of SSDs.
48
49 //----------------------------------------------------------------------
50 AliITSsimulationSSD::AliITSsimulationSSD():AliITSsimulation(),
51 fDCS(0),
52 fMapA2(0),
53 fIonE(0.0),
54 fDifConst(),
55 fDriftVel(){
56     //default Constructor
57     //Inputs:
58     // none.
59     // Outputs:
60     // none.
61     // Return:
62     //  A default construction AliITSsimulationSSD class
63 }
64 //----------------------------------------------------------------------
65 AliITSsimulationSSD::AliITSsimulationSSD(AliITSsegmentation *seg,
66                                          AliITSresponse *res):
67 AliITSsimulation(seg,res),
68 fDCS(0),
69 fMapA2(0),
70 fIonE(0.0),
71 fDifConst(),
72 fDriftVel(){
73     // Constructor 
74     // Input:
75     //   AliITSsegmentationSSD *seg  Pointer to the SSD segmentation to be used
76     //   AliITSresponseSSD   *resp Pointer to the SSD responce class to be used
77     // Outputs:
78     //   none.
79     // Return
80     //   A standard constructed AliITSsimulationSSD class
81
82     Init();
83 }
84 //----------------------------------------------------------------------
85 void AliITSsimulationSSD::Init(){
86     // Inilizer, Inilizes all of the variable as needed in a standard place.
87     // Input:
88     //   AliITSsegmentationSSD *seg  Pointer to the SSD segmentation to be used
89     //   AliITSresponseSSD   *resp Pointer to the SSD responce class to be used
90     // Outputs:
91     //   none.
92     // Return
93     //   none.
94
95     Double_t noise[2] = {0.,0.};
96     GetResp()->GetNoiseParam(noise[0],noise[1]); // retrieves noise parameters
97     fDCS = new AliITSdcsSSD((AliITSsegmentationSSD*)GetSegmentationModel(),
98                             (AliITSresponseSSD*)GetResponseModel()); 
99
100     SetDriftVelocity(); // use default values in .h file
101     SetIonizeE();       // use default values in .h file
102     SetDiffConst();     // use default values in .h file
103     fpList           = new AliITSpList(2,GetNStrips());
104     fMapA2           = new AliITSMapA2(GetSegmentationModel());
105 }
106 //______________________________________________________________________
107 AliITSsimulationSSD& AliITSsimulationSSD::operator=(
108                                          const AliITSsimulationSSD &s){
109   // Operator =
110
111   if(this==&s) return *this;
112
113   this->fDCS         = new AliITSdcsSSD(*(s.fDCS));
114   this->fMapA2       = s.fMapA2;
115   this->fIonE        = s.fIonE;
116   this->fDifConst[0] = s.fDifConst[0];
117   this->fDifConst[1] = s.fDifConst[1];
118   this->fDriftVel[0] = s.fDriftVel[0];
119   this->fDriftVel[1] = s.fDriftVel[1];
120   return *this;
121 }
122 //______________________________________________________________________
123 AliITSsimulationSSD::AliITSsimulationSSD(const AliITSsimulationSSD &source):
124     AliITSsimulation(source){
125   // copy constructor
126
127   *this = source;
128 }
129 //______________________________________________________________________
130 AliITSsimulationSSD::~AliITSsimulationSSD() {
131   // destructor
132   delete fMapA2;
133   delete fDCS;
134 }
135 //______________________________________________________________________
136 void AliITSsimulationSSD::InitSimulationModule(Int_t module,Int_t event){
137     // Creates maps to build the list of tracks for each sumable digit
138     // Inputs:
139     //   Int_t module    // Module number to be simulated
140     //   Int_t event     // Event number to be simulated
141     // Outputs:
142     //   none.
143     // Return
144     //    none.
145
146     SetModuleNumber(module);
147     SetEventNumber(event);
148     fMapA2->ClearMap();
149     fpList->ClearMap();
150 }
151 //______________________________________________________________________
152 void AliITSsimulationSSD::FinishSDigitiseModule(){
153     // Does the Sdigits to Digits work
154     // Inputs:
155     //   none.
156     // Outputs:
157     //   none.
158     // Return:
159     //   none.
160
161     FillMapFrompList(fpList);  // need to check if needed here or not????
162     SDigitToDigit(fModule,fpList);
163     fpList->ClearMap();
164     fMapA2->ClearMap();
165 }
166 //______________________________________________________________________
167 void AliITSsimulationSSD::DigitiseModule(AliITSmodule *mod,Int_t,Int_t) {
168   // Digitizes hits for one SSD module
169   SetModuleNumber(mod->GetIndex());
170
171   HitsToAnalogDigits(mod,fpList);
172   SDigitToDigit(GetModuleNumber(),fpList);
173
174   fpList->ClearMap();
175   fMapA2->ClearMap();
176 }
177 //______________________________________________________________________
178 void AliITSsimulationSSD::SDigitiseModule(AliITSmodule *mod,Int_t,Int_t) {
179   // Produces Summable/Analog digits and writes them to the SDigit tree. 
180
181     HitsToAnalogDigits(mod,fpList);
182
183     WriteSDigits(fpList);
184
185     fpList->ClearMap();
186     fMapA2->ClearMap();
187 }
188 //______________________________________________________________________
189 void AliITSsimulationSSD::SDigitToDigit(Int_t module,AliITSpList *pList){
190   // Takes the pList and finishes the digitization.
191
192   ApplyNoise(pList,module);
193   ApplyCoupling(pList,module);
194
195   ChargeToSignal(pList);
196 }
197 //______________________________________________________________________
198 void AliITSsimulationSSD::HitsToAnalogDigits(AliITSmodule *mod,
199                                              AliITSpList *pList){
200     // Loops over all hits to produce Analog/floating point digits. This
201     // is also the first task in producing standard digits.
202     Int_t lasttrack     = -2;
203     Int_t idtrack       = -2;
204     Double_t x0=0.0, y0=0.0, z0=0.0;
205     Double_t x1=0.0, y1=0.0, z1=0.0;
206     Double_t de=0.0;
207     Int_t module = mod->GetIndex();
208
209     TObjArray *hits = mod->GetHits();
210     Int_t nhits     = hits->GetEntriesFast();
211     if (nhits<=0) return;
212     AliITSTableSSD * tav = new AliITSTableSSD(GetNStrips());
213     module = mod->GetIndex();
214     if ( mod->GetLayer() == 6 ) GetSegmentation()->SetLayer(6);
215     if ( mod->GetLayer() == 5 ) GetSegmentation()->SetLayer(5);
216     for(Int_t i=0; i<nhits; i++) {    
217         // LineSegmentL returns 0 if the hit is entering
218         // If hits is exiting returns positions of entering and exiting hits
219         // Returns also energy loss
220         if(GetDebug(4)){
221             cout << i << " ";
222             cout << mod->GetHit(i)->GetXL() << " "<<mod->GetHit(i)->GetYL();
223             cout << " " << mod->GetHit(i)->GetZL();
224             cout << endl;
225         } // end if
226         if (mod->LineSegmentL(i, x0, x1, y0, y1, z0, z1, de, idtrack)) {
227             HitToDigit(module, x0, y0, z0, x1, y1, z1, de,tav);
228             if (lasttrack != idtrack || i==(nhits-1)) {
229                 GetList(idtrack,i,module,pList,tav);
230             } // end if
231             lasttrack=idtrack;
232         } // end if
233     }  // end loop over hits
234     delete tav; tav=0;
235     return;
236 }
237 //----------------------------------------------------------------------
238 void AliITSsimulationSSD::HitToDigit(Int_t module, Double_t x0, Double_t y0, 
239                                      Double_t z0, Double_t x1, Double_t y1, 
240                                      Double_t z1, Double_t de,
241                                      AliITSTableSSD *tav) {
242     // Turns hits in SSD module into one or more digits.
243     Float_t tang[2] = {0.0,0.0};
244     GetSegmentation()->Angles(tang[0], tang[1]);//stereo<<->tan(stereo)~=stereo
245     Double_t x, y, z;
246     Double_t dex=0.0, dey=0.0, dez=0.0; 
247     Double_t pairs; // pair generation energy per step.
248     Double_t sigma[2] = {0.,0.};// standard deviation of the diffusion gaussian
249     Double_t tdrift[2] = {0.,0.}; // time of drift
250     Double_t w;
251     Double_t inf[2], sup[2], par0[2];                 
252
253     // Steps in the module are determined "manually" (i.e. No Geant)
254     // NumOfSteps divide path between entering and exiting hits in steps 
255     Int_t numOfSteps = NumOfSteps(x1, y1, z1, dex, dey, dez);
256     // Enery loss is equally distributed among steps
257     de    = de/numOfSteps;
258     pairs = de/GetIonizeE(); // e-h pairs generated
259     for(Int_t j=0; j<numOfSteps; j++) {     // stepping
260         x = x0 + (j+0.5)*dex;
261         y = y0 + (j+0.5)*dey;
262         if ( y > (GetSegmentation()->Dy()/2+10)*1.0E-4 ) {
263             // check if particle is within the detector
264             Warning("HitToDigit",
265                     "hit out of detector y0=%e,y=%e,dey=%e,j =%e module=%d",
266                     y0,y,dey,j,module);
267             return;
268         } // end if
269         z = z0 + (j+0.5)*dez;
270         if(GetDebug(4)) cout <<"HitToDigit "<<x<<" "<<y<<" "<<z<< " "
271                             <<dex<<" "<<dey<<" "<<dez<<endl;
272         // calculate drift time
273         // y is the minimum path
274         tdrift[0] = (y+(GetSegmentation()->Dy()*1.0E-4)/2)/GetDriftVelocity(0);
275         tdrift[1] = ((GetSegmentation()->Dy()*1.0E-4)/2-y)/GetDriftVelocity(1);
276
277         for(Int_t k=0; k<2; k++) {   // both sides    remember: 0=Pside 1=Nside
278
279             tang[k]=TMath::Tan(tang[k]);
280
281             // w is the coord. perpendicular to the strips
282             /*
283               if(k==0) {
284               w = (x+(GetSegmentation()->Dx()*1.0E-4)/2) -
285                     (z+(GetSegmentation()->Dz()*1.0E-4)/2)*tang[k]; 
286               }else{
287               w = (x+(GetSegmentation()->Dx()*1.0E-4)/2) + 
288                     (z-(GetSegmentation()->Dz()*1.0E-4)/2)*tang[k];
289               } // end if
290               w /= (GetStripPitch()*1.0E-4); //w is converted in units of pitch
291             */
292             { // replacement block for the above.
293                 Float_t xp=x*1.e+4,zp=z*1.e+4; // microns
294                 GetSegmentation()->GetPadTxz(xp,zp);
295                 if(k==0) w = xp; // P side strip number
296                 else w = zp; // N side strip number
297             } // end test block
298
299             if((w<(-0.5)) || (w>(GetNStrips()-0.5))) {
300                 // this check rejects hits in regions not covered by strips
301                 // 0.5 takes into account boundaries 
302                 if(GetDebug(4)) cout << "x,z="<<x<<","<<z<<" w="<<w
303                                     <<" Nstrips="<<GetNStrips()<<endl;
304                 return; // There are dead region on the SSD sensitive volume.
305             } // end if
306
307             // sigma is the standard deviation of the diffusion gaussian
308             if(tdrift[k]<0) return;
309             sigma[k] = TMath::Sqrt(2*GetDiffConst(k)*tdrift[k]);
310             sigma[k] /= (GetStripPitch()*1.0E-4);  //units of Pitch
311             if(sigma[k]==0.0) {         
312                 Error("HitToDigit"," sigma[%d]=0",k);
313                 exit(0);
314             } // end if
315
316             par0[k] = pairs;
317             // we integrate the diffusion gaussian from -3sigma to 3sigma 
318             inf[k] = w - 3*sigma[k]; // 3 sigma from the gaussian average  
319             sup[k] = w + 3*sigma[k]; // 3 sigma from the gaussian average
320             // IntegrateGaussian does the actual
321             // integration of diffusion gaussian
322             IntegrateGaussian(k, par0[k], w, sigma[k], inf[k], sup[k],tav);
323         }  // end for loop over side (0=Pside, 1=Nside)      
324     } // end stepping
325 }
326 //______________________________________________________________________
327 void AliITSsimulationSSD::ApplyNoise(AliITSpList *pList,Int_t module){
328     // Apply Noise.
329     Int_t    k,ix;
330     Double_t signal,noise;
331     Double_t noiseP[2] = {0.,0.};
332     Double_t a,b;
333
334     GetResp()->GetNoiseParam(a,b); // retrieves noise parameters
335     noiseP[0] = a; noiseP[1] = b;
336     for(k=0;k<2;k++){                    // both sides (0=Pside, 1=Nside)
337         for(ix=0;ix<GetNStrips();ix++){      // loop over strips
338             noise  = gRandom->Gaus(0,noiseP[k]);// get noise to signal
339             signal = noise + fMapA2->GetSignal(k,ix);//get signal from map
340             if(signal<0.) signal=0.0;           // in case noise is negative...
341             fMapA2->SetHit(k,ix,signal); // give back signal to map
342             if(signal>0.0) pList->AddNoise(k,ix,module,noise);
343         } // loop over strip 
344     } // loop over k (P or N side)
345 }
346 //______________________________________________________________________
347 void AliITSsimulationSSD::ApplyCoupling(AliITSpList *pList,Int_t module) {
348     // Apply the effect of electronic coupling between channels
349     Int_t ix;
350     Double_t signalLeft=0, signalRight=0,signal=0;
351
352     for(ix=0;ix<GetNStrips();ix++){
353         // P side coupling
354         if(ix>0.)signalLeft = fMapA2->GetSignal(0,ix-1)*fDCS->GetCouplingPL();
355         else signalLeft = 0.0;
356         if(ix<(GetNStrips()-1)) signalRight = fMapA2->GetSignal(0,ix+1)*
357                                     fDCS->GetCouplingPR();
358         else signalRight = 0.0;
359         signal = signalLeft + signalRight;
360         fMapA2->AddSignal(0,ix,signal);
361         if(signal>0.0) pList->AddNoise(0,ix,module,signal);
362
363         signalLeft = signalRight = signal = 0.0;
364         // N side coupling
365         if(ix>0.) signalLeft = fMapA2->GetSignal(1,ix-1)*fDCS->GetCouplingNL();
366         else signalLeft = 0.0;
367         if(ix<(GetNStrips()-1)) signalRight = fMapA2->GetSignal(1,ix+1)*
368                                     fDCS->GetCouplingNR();
369         else signalRight = 0.0;
370         signal = signalLeft + signalRight;
371         fMapA2->AddSignal(1,ix,signal);
372         if(signal>0.0) pList->AddNoise(1,ix,module,signal);
373     } // loop over strips 
374 }
375 //______________________________________________________________________
376 Float_t AliITSsimulationSSD::F(Float_t av, Float_t x, Float_t s) {
377     // Computes the integral of a gaussian using Error Function
378     Float_t sqrt2 = TMath::Sqrt(2.0);
379     Float_t sigm2 = sqrt2*s;
380     Float_t integral;
381
382     integral = 0.5 * TMath::Erf( (x - av) / sigm2);
383     return integral;
384 }
385 //______________________________________________________________________
386 void AliITSsimulationSSD::IntegrateGaussian(Int_t k,Double_t par, Double_t w,
387                                             Double_t sigma, 
388                                             Double_t inf, Double_t sup,
389                                             AliITSTableSSD *tav) {
390     // integrate the diffusion gaussian
391     // remind: inf and sup are w-3sigma and w+3sigma
392     //         we could define them here instead of passing them
393     //         this way we are free to introduce asimmetry
394
395     Double_t a=0.0, b=0.0;
396     Double_t dXCharge1 = 0.0, dXCharge2 = 0.0;
397     // dXCharge1 and 2 are the charge to two neighbouring strips
398     // Watch that we only involve at least two strips
399     // Numbers greater than 2 of strips in a cluster depend on
400     //  geometry of the track and delta rays, not charge diffusion!   
401
402     Double_t strip = TMath::Floor(w);         // closest strip on the left
403
404     if ( TMath::Abs((strip - w)) < 0.5) { 
405         // gaussian mean is closer to strip on the left
406         a = inf;                         // integration starting point
407         if((strip+0.5)<=sup) {
408             // this means that the tail of the gaussian goes beyond
409             // the middle point between strips ---> part of the signal
410             // is given to the strip on the right
411             b = strip + 0.5;               // integration stopping point
412             dXCharge1 = F( w, b, sigma) - F(w, a, sigma);
413             dXCharge2 = F( w, sup, sigma) - F(w ,b, sigma); 
414         }else { 
415             // this means that all the charge is given to the strip on the left
416             b = sup;
417             dXCharge1 = 0.9973;   // gaussian integral at 3 sigmas
418             dXCharge2 = 0.0;
419         } // end if
420         dXCharge1 = par * dXCharge1;// normalize by mean of number of carriers
421         dXCharge2 = par * dXCharge2;
422
423         // for the time being, signal is the charge
424         // in ChargeToSignal signal is converted in ADC channel
425         fMapA2->AddSignal(k,(Int_t)strip,dXCharge1);
426         tav->Add(k,(Int_t)strip);
427         if(((Int_t) strip) < (GetNStrips()-1)) {
428             // strip doesn't have to be the last (remind: last=GetNStrips()-1)
429             // otherwise part of the charge is lost
430             fMapA2->AddSignal(k,((Int_t)strip+1),dXCharge2);
431             tav->Add(k,((Int_t)(strip+1)));
432         } // end if
433     }else{
434         // gaussian mean is closer to strip on the right
435         strip++;     // move to strip on the rigth
436         b = sup;     // now you know where to stop integrating
437         if((strip-0.5)>=inf) { 
438             // tail of diffusion gaussian on the left goes left of
439             // middle point between strips
440             a = strip - 0.5;        // integration starting point
441             dXCharge1 = F(w, b, sigma) - F(w, a, sigma);
442             dXCharge2 = F(w, a, sigma) - F(w, inf, sigma);
443         }else {
444             a = inf;
445             dXCharge1 = 0.9973;   // gaussian integral at 3 sigmas
446             dXCharge2 = 0.0;
447         } // end if
448         dXCharge1 = par * dXCharge1;    // normalize by means of carriers
449         dXCharge2 = par * dXCharge2;
450         // for the time being, signal is the charge
451         // in ChargeToSignal signal is converted in ADC channel
452         fMapA2->AddSignal(k,(Int_t)strip,dXCharge1);
453         tav->Add(k,(Int_t)strip);
454         if(((Int_t) strip) > 0) {
455             // strip doesn't have to be the first
456             // otherwise part of the charge is lost
457             fMapA2->AddSignal(k,((Int_t)strip-1),dXCharge2);
458             tav->Add(k,((Int_t)(strip-1)));
459         } // end if
460     } // end if
461 }
462 //______________________________________________________________________
463 Int_t AliITSsimulationSSD::NumOfSteps(Double_t x, Double_t y, Double_t z,
464                                       Double_t &dex,Double_t &dey,
465                                       Double_t &dez){
466     // number of steps
467     // it also returns steps for each coord
468     //AliITSsegmentationSSD *seg = new AliITSsegmentationSSD();
469
470     Double_t step = 25E-4;
471     //step = (Double_t) seg->GetStepSize();  // step size (cm)
472     Int_t numOfSteps = (Int_t) (TMath::Sqrt(x*x+y*y+z*z)/step); 
473
474     if (numOfSteps < 1) numOfSteps = 1;       // one step, at least
475
476     // we could condition the stepping depending on the incident angle
477     // of the track
478     dex = x/numOfSteps;
479     dey = y/numOfSteps;
480     dez = z/numOfSteps;
481     
482     return numOfSteps;
483 }
484 //----------------------------------------------------------------------
485 void AliITSsimulationSSD::GetList(Int_t label,Int_t hit,Int_t mod,
486                                   AliITSpList *pList,AliITSTableSSD *tav) {
487     // loop over nonzero digits
488     Int_t ix,i;
489     Double_t signal=0.;
490
491     for(Int_t k=0; k<2; k++) {
492         ix=tav->Use(k);
493         while(ix>-1){
494             signal = fMapA2->GetSignal(k,ix);
495             if(signal==0.0) {
496                 ix=tav->Use(k);
497                 continue;
498             } // end if signal==0.0
499             // check the signal magnitude
500             for(i=0;i<pList->GetNSignals(k,ix);i++){
501                 signal -= pList->GetTSignal(k,ix,i);
502             } // end for i
503             //  compare the new signal with already existing list
504             if(signal>0)pList->AddSignal(k,ix,label,hit,mod,signal);
505             ix=tav->Use(k);
506         } // end of loop on strips
507     } // end of loop on P/N side
508     tav->Clear();
509 }
510 //----------------------------------------------------------------------
511 void AliITSsimulationSSD::ChargeToSignal(AliITSpList *pList) {
512     // charge to signal
513     static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
514     Float_t threshold = 0.;
515     Int_t size = AliITSdigitSSD::GetNTracks();
516     Int_t * digits = new Int_t[size];
517     Int_t * tracks = new Int_t[size];
518     Int_t * hits = new Int_t[size];
519     Int_t j1;
520     Float_t charges[3] = {0.0,0.0,0.0};
521     Float_t signal;
522     Double_t noise[2] = {0.,0.};
523
524     GetResp()->GetNoiseParam(noise[0],noise[1]);
525
526     for(Int_t k=0;k<2;k++){         // both sides (0=Pside, 1=Nside)
527         // Threshold for zero-suppression
528         // It can be defined in AliITSresponseSSD
529         //             threshold = (Float_t)GetResp()->MinVal(k);
530         // I prefer to think adjusting the threshold "manually", looking
531         // at the scope, and considering noise standard deviation
532         threshold = 4.0*noise[k]; // 4 times noise is a choice
533         for(Int_t ix=0;ix<GetNStrips();ix++){     // loop over strips
534             if(fMapA2->GetSignal(k,ix) <= threshold)continue;
535             // convert to ADC signal
536             signal = GetResp()->DEvToADC(
537                 fMapA2->GetSignal(k,ix));
538             if(signal>1024.) signal = 1024.;//if exceeding, accumulate last one
539             digits[0] = k;
540             digits[1] = ix;
541             digits[2] = (Int_t) signal;
542             for(j1=0;j1<size;j1++)if(j1<pList->GetNEnteries()){
543                 // only three in digit.
544                 tracks[j1]  = pList->GetTrack(k,ix,j1);
545                 hits[j1]    = pList->GetHit(k,ix,j1);
546             }else{
547                 tracks[j1]  = -3;
548                 hits[j1]    = -1;
549             } // end for j1
550             // finally add digit
551             aliITS->AddSimDigit(2,0,digits,tracks,hits,charges);
552         } // end for ix
553     } // end for k
554     delete [] digits;
555     delete [] tracks;
556     delete [] hits;
557 }
558 //______________________________________________________________________
559 void AliITSsimulationSSD::WriteSDigits(AliITSpList *pList){
560     // Fills the Summable digits Tree
561     Int_t i,ni,j,nj;
562     static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
563
564     pList->GetMaxMapIndex(ni,nj);
565     for(i=0;i<ni;i++)for(j=0;j<nj;j++){
566         if(pList->GetSignalOnly(i,j)>0.0){
567             aliITS->AddSumDigit(*(pList->GetpListItem(i,j)));
568             if(GetDebug(4)) cout << "pListSSD: "<<*(pList->GetpListItem(i,j))
569                                 << endl;
570         } // end if
571     } // end for i,j
572   return;
573 }
574 //______________________________________________________________________
575 void AliITSsimulationSSD::FillMapFrompList(AliITSpList *pList){
576     // Fills fMap2A from the pList of Summable digits
577     Int_t k,ix;
578
579     for(k=0;k<2;k++)for(ix=0;ix<GetNStrips();ix++) 
580         fMapA2->AddSignal(k,ix,pList->GetSignal(k,ix));
581     return;
582 }
583 //______________________________________________________________________
584 void AliITSsimulationSSD::Print(ostream *os){
585     //Standard output format for this class
586
587     //AliITSsimulation::Print(os);
588     *os << fIonE <<",";
589     *os << fDifConst[0] <<","<< fDifConst[1] <<",";
590     *os << fDriftVel[0] <<","<< fDriftVel[1];
591     //*os <<","; fDCS->Print(os);
592     //*os <<","; fMapA2->Print(os);
593 }
594 //______________________________________________________________________
595 void AliITSsimulationSSD::Read(istream *is){
596     // Standard output streaming function.
597
598     //AliITSsimulation::Read(is);
599     *is >> fIonE;
600     *is >> fDifConst[0] >> fDifConst[1];
601     *is >> fDriftVel[0] >> fDriftVel[1];
602     //fDCS->Read(is);
603     //fMapA2->Read(is);
604 }
605 //______________________________________________________________________
606 ostream &operator<<(ostream &os,AliITSsimulationSSD &source){
607     // Standard output streaming function.
608
609     source.Print(&os);
610     return os;
611 }
612 //______________________________________________________________________
613 istream &operator>>(istream &os,AliITSsimulationSSD &source){
614     // Standard output streaming function.
615
616     source.Read(&os);
617     return os;
618 }
619 //______________________________________________________________________
620
621
622
623
624