]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITSupgrade.cxx
b7e24df1e21198696f3e3d30a9cb5e1a2545119a
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSupgrade.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 <TArrayD.h>            //new constructor
19 #include <TFile.h>  
20 #include <TGeoManager.h>        //CreateGeometry()
21 #include <TGeoVolume.h>         //CreateGeometry()
22 #include <TVirtualMC.h>         //->gMC in StepManager
23 #include <TPDGCode.h>           //StepHistory
24 #include <TClonesArray.h>
25 #include "AliRun.h"             //CreateMaterials()    
26 #include "AliMC.h"             //CreateMaterials()    
27 #include "AliMagF.h"            //CreateMaterials()
28 #include "AliCDBManager.h"      //CreateMaterials()
29 #include "AliCDBEntry.h"        //CreateMaterials()
30 #include "AliITSupgrade.h"      //class header
31 #include "AliITShit.h"           // StepManager()
32 #include "AliITSDigitUpgrade.h"
33 #include "AliTrackReference.h"   // StepManager()
34 #include "AliITSDetTypeSim.h"
35 ClassImp(AliITSupgrade) 
36 //__________________________________________________________________________________________________
37   AliITSupgrade::AliITSupgrade():
38     AliITS(),
39     fWidths(0),
40     fRadii(0),
41     fRadiiCu(0),
42     fWidthsCu(0),
43     fCopper(0),
44     fBeampipe(0), 
45     fRadiusBP(0),
46     fWidthBP(0),
47     fHalfLengthBP(0),
48     fNlayers(0),
49     fHalfLength(0),
50     fSdigits(0),
51     fDigits(0),
52     fClusters(0),
53     fSegmentation(0x0)
54 {
55   //
56   // default ctor
57 }
58 //__________________________________________________________________________________________________
59 AliITSupgrade::AliITSupgrade(const char *name,const char *title, TArrayD widths, TArrayD radii,TArrayD halfLengths, TArrayD radiiCu, TArrayD widthsCu, TArrayS copper,Bool_t bp,Double_t radiusBP, Double_t widthBP, Double_t halfLengthBP):
60   AliITS(name,title),
61   fWidths(0),
62   fRadii(0),
63   fRadiiCu(radiiCu),
64   fWidthsCu(widthsCu),
65   fCopper(copper),
66   fBeampipe(bp),
67   fRadiusBP(radiusBP),
68   fWidthBP(widthBP),
69   fHalfLengthBP(halfLengthBP),
70   fNlayers(widths.GetSize()),
71   fHalfLength(halfLengths),
72   fSdigits(0),
73   fDigits(0),
74   fClusters(0),
75   fSegmentation(0x0)
76 {
77
78   //
79   // constructor
80   for(Int_t i=0;i<fNlayers;i++){
81     fWidths.Set(i+1);
82     fWidths.AddAt(widths.At(i),i);
83     fRadii.Set(i+1);
84     fRadii.AddAt(radii.At(i),i);
85     AliDebug(1,"Creating Volume");
86   }
87   Init();
88
89 }
90
91 AliITSupgrade::~AliITSupgrade(){
92
93   if(fSdigits) {fSdigits->Delete(); delete fSdigits;}
94   if(fDigits)  {fDigits->Delete(); delete fDigits;}
95 }
96
97
98  
99 //_________________________________________________________________________________________________
100 void AliITSupgrade::AddAlignableVolumes()const
101 {
102   //not needed
103   return;
104 }
105
106 //__________________________________________________________________________________________________
107
108 void AliITSupgrade::CreateMaterials()
109 {
110   //
111   // Definition of ITS materials  
112   //
113   
114   AliInfo("Start ITS materials");
115   //data from PDG booklet 2002     density [gr/cm^3] rad len [cm] abs len [cm]    
116   Float_t   aAir[4]={12,14,16,36} ,   zAir[4]={6,7,8,18} ,   wAir[4]={0.000124,0.755267,0.231781,0.012827} , dAir=0.00120479; Int_t nAir=4;//mixture
117   Float_t       aBe = 9.012 ,          zBe   = 4 ,            dBe   =  1.848    ,   radBe   =  65.19/dBe , absBe   = 77.8/dBe  ; // UPGRADE -> beryllium beampipe
118   Float_t       aSi = 28.085 ,         zSi   = 14 ,           dSi   =  2.329    ,   radSi   =  21.82/dSi , absSi   = 108.4/dSi  ; // UPGRADE -> Si tube
119   Float_t aCu = 63.54, zCu = 29 , dCu= 8.96 , radCu = 12.86/dCu, absCu= 137.3/dCu;//Upgrade -> Copper Tube
120
121   Int_t   matId=0;                           //tmp material id number
122   Int_t   unsens = 0, sens=1;                //sensitive or unsensitive medium
123   Int_t   itgfld = 3;                        //type of field intergration 0 no field -1 user in guswim 1 Runge Kutta 2 helix 3 const field along z
124   Float_t maxfld = 5.;                       //max field value
125   Float_t tmaxfd = -10.0;                    //max deflection angle due to magnetic field in one step
126   Float_t deemax = - 0.2;                    //max fractional energy loss in one step   
127   Float_t stemax = - 0.1;                    //max step allowed [cm]
128   Float_t epsil  =   0.001;                  //abs tracking precision [cm]   
129   Float_t stmin  = - 0.001;                  //min step size [cm] in continius process transport, negative value: choose it automatically
130   Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree
131   Float_t stemaxSi = 0.0075; //  .10000E+01; // cm
132   Float_t deemaxSi = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
133   Float_t epsilSi  = 1.0E-4;// .10000E+01;
134   Float_t stminSi  = 0.0; // cm "Default value used"
135
136   Float_t epsilBe  = .001;    // Tracking precision,
137   Float_t stemaxBe = -0.01;   // Maximum displacement for multiple scat
138   Float_t tmaxfdBe = -20.;    // Maximum angle due to field deflection
139   Float_t deemaxBe = -.3;     // Maximum fractional energy loss, DLS
140   Float_t stminBe  = -.8;
141
142       
143   AliMixture(++matId,"UpgradeAir"  ,aAir  ,zAir  ,dAir  ,nAir  ,wAir  ); 
144   AliMedium(kAir  ,"UpgradeAir"  ,matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
145     
146   AliMaterial(++matId,"UpgradeSi"  ,aSi  ,zSi  ,dSi  ,radSi  ,absSi  );  
147   AliMedium(kSi  ,"UpgradeSi"  , matId, sens, itgfld, maxfld, tmaxfdSi, stemaxSi, deemaxSi, epsilSi, stminSi);
148     
149   AliMaterial(++matId,"UpgradeBe"  ,aBe  ,zBe  ,dBe  ,radBe  ,absBe  );  
150   AliMedium(kBe  ,"UpgradeBe"  , matId, unsens, itgfld, maxfld, tmaxfdBe, stemaxBe, deemaxBe, epsilBe, stminBe);
151
152   AliMaterial(++matId, "UpgradeCu", aCu, zCu, dCu, radCu, absCu);
153   AliMedium(kCu, "UpgradeCu", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
154    
155   AliInfo("End ITS materials");
156           
157 }//void AliITS::CreateMaterials()
158 //__________________________________________________________________________________________________
159 void AliITSupgrade::CreateGeometry()
160 {
161   //
162   //Creates detailed geometry simulation (currently GEANT volumes tree)        
163   //
164   AliInfo("Start ITS upgrade preliminary version building");
165   if(!gMC->IsRootGeometrySupported()) return;                
166   TGeoVolumeAssembly *vol= CreateVol();
167   gGeoManager->GetVolume("ALIC")->AddNode(vol,0);
168   AliInfo("Stop ITS upgrade preliminary version building");
169
170 //__________________________________________________________________________________________________
171 void AliITSupgrade::Init()
172 {
173   // This method defines ID for sensitive volumes, i.e. such geometry volumes for which there are if(gMC->CurrentVolID()==XXX) 
174   // statements in StepManager()
175   // Arguments: none
176   //   Returns: none      
177   AliDebug(1,"Init ITS upgrade preliminary version.");    
178 }
179 //__________________________________________________________________________________________________
180 void AliITSupgrade::StepManager()
181 {
182   // Full Step Manager.
183   // Arguments: none
184   //   Returns: none           
185   //  StepHistory(); return; //uncomment to print tracks history
186   //  StepCount(); return;   //uncomment to count photons
187   if(!(this->IsActive())) return;
188   if(!(gMC->TrackCharge())) return;
189   TString volumeName=gMC->CurrentVolName();
190   if(gMC->IsTrackExiting() && !volumeName.Contains("Cu") && !volumeName.Contains("Be")) {
191     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
192   } // if Outer ITS mother Volume
193
194   static TLorentzVector position, momentum; // Saves on calls to construtors
195   static AliITShit hit;// Saves on calls to constructors
196
197   
198   Int_t  status = 0;
199   
200   //
201   // Track status
202   if(gMC->IsTrackInside())      status +=  1;
203   if(gMC->IsTrackEntering())    status +=  2;
204   if(gMC->IsTrackExiting())     status +=  4;
205   if(gMC->IsTrackOut())         status +=  8;
206   if(gMC->IsTrackDisappeared()) status += 16;
207   if(gMC->IsTrackStop())        status += 32;
208   if(gMC->IsTrackAlive())       status += 64;
209
210   //
211   // Fill hit structure.
212   //
213   TString volname = gMC->CurrentVolName();
214   if(volname.Contains("Cu"))return;
215   if(volname.Contains("Be"))return; 
216   //AliInfo(Form("volume name %s ",volname.Data()));
217   volname.Remove(0,12);          // remove letters to get the layer number
218   //AliInfo(Form("volume name %s ",volname.Data()));
219   hit.SetModule(volname.Atoi()); // this will be the layer, not the module
220   hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
221     
222   gMC->TrackPosition(position);
223   gMC->TrackMomentum(momentum);
224   hit.SetPosition(position);
225     
226   hit.SetTime(gMC->TrackTime());
227   hit.SetMomentum(momentum);
228   hit.SetStatus(status);
229   hit.SetEdep(gMC->Edep());
230   hit.SetShunt(GetIshunt());
231   if(gMC->IsTrackEntering()){
232     hit.SetStartPosition(position);
233     hit.SetStartTime(gMC->TrackTime());
234     hit.SetStartStatus(status);
235     return; // don't save entering hit.
236   } 
237     // Fill hit structure with this new hit.
238     
239   new((*fHits)[fNhits++]) AliITShit(hit); // Use Copy Construtor.
240   // Save old position... for next hit.
241   hit.SetStartPosition(position);
242   hit.SetStartTime(gMC->TrackTime());
243   hit.SetStartStatus(status);
244   return;
245
246 }
247 //__________________________________________________________________________________________________
248 TGeoVolumeAssembly * AliITSupgrade::CreateVol()
249 {
250   TGeoVolumeAssembly *vol = new TGeoVolumeAssembly("ITSupgrade");
251   TGeoMedium *si   =gGeoManager->GetMedium("ITS_UpgradeSi");
252   TGeoMedium *cu   =gGeoManager->GetMedium("ITS_UpgradeCu");
253   TGeoMedium *be   =gGeoManager->GetMedium("ITS_UpgradeBe");
254   for(Int_t ivol=0;ivol<fNlayers;ivol++){
255     TGeoVolume *layer=gGeoManager->MakeTube(Form("LayerSilicon%i",ivol),si   ,    fRadii.At(ivol)   ,   fRadii.At(ivol)+fWidths.At(ivol)  ,   fHalfLength.At(ivol)); //upgraded situation 
256     
257     TGeoVolume *layerCu=gGeoManager->MakeTube(Form("LayerCu%i",ivol),cu   ,    fRadiiCu.At(ivol)   ,   fRadiiCu.At(ivol)+fWidthsCu.At(ivol) ,  fHalfLength.At(ivol)  ); //upgraded situation 
258     
259
260     vol ->AddNode(layer,ivol);
261     if(fCopper.At(ivol)){
262       vol->AddNode(layerCu,ivol);
263     }
264   }
265   TGeoVolume *beampipe=gGeoManager->MakeTube("BeamPipe", be   ,    fRadiusBP   ,  fRadiusBP+ fWidthBP ,  fHalfLengthBP  ); //upgraded situation
266
267   if(fBeampipe) vol->AddNode(beampipe,0);
268   return vol; 
269   
270 }
271 //_________________________________________________________________________________________________
272 void AliITSupgrade::SetFullSegmentation(TArrayD xsize,TArrayD zsize){
273   TFile *file= TFile::Open("Segmentation.root","recreate");
274   file->WriteObjectAny(&xsize,"TArrayD","CellSizeX");
275   file->WriteObjectAny(&zsize,"TArrayD","CellSizeZ");    
276   file->Close();
277 }
278 //_________________________________________________________________________________________________
279 void AliITSupgrade::StepHistory()
280 {
281   // This methode is invoked from StepManager() in order to print out
282   static Int_t iStepN;
283   const char *sParticle;
284   switch(gMC->TrackPid()){
285   case kProton:      sParticle="PROTON"    ;break;
286   case kNeutron:     sParticle="neutron"   ;break;
287   case kGamma:       sParticle="gamma"     ;break;
288   case kPi0:         sParticle="Pi0"       ;break;
289   case kPiPlus:      sParticle="Pi+"       ;break;
290   case kPiMinus:     sParticle="Pi-"       ;break;
291   case kElectron:    sParticle="electron"  ;break;
292   default:           sParticle="not known" ;break;
293   }
294
295   TString flag="fanny combination";
296   if(gMC->IsTrackAlive())
297     if(gMC->IsTrackEntering())      flag="enters to";
298     else if(gMC->IsTrackExiting())  flag="exits from";
299     else if(gMC->IsTrackInside())   flag="inside";
300     else if(gMC->IsTrackStop())     flag="stopped in";
301   
302   Int_t vid=0,copy=0;
303   TString path=gMC->CurrentVolName(); path.Prepend("-");path.Prepend(gMC->CurrentVolOffName(1));//current volume and his mother are always there
304   vid=gMC->CurrentVolOffID(2,copy);  if(vid) {path.Prepend("-");path.Prepend(gMC->VolName(vid));}
305   vid=gMC->CurrentVolOffID(3,copy);  if(vid) {path.Prepend("-");path.Prepend(gMC->VolName(vid));}
306
307   AliDebug(10, Form("Step %i: %s (%i) %s %s m=%.6f GeV q=%.1f dEdX=%.4f Etot=%.4f",iStepN,sParticle,gMC->TrackPid(),flag.Data(),path.Data(),gMC->TrackMass(),gMC->TrackCharge(),gMC->Edep()*1e9,gMC->Etot()));
308
309   Double_t gMcTrackPos[3]; gMC->TrackPosition(gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2]);
310   Double_t  gMcTrackPosLoc[3]; gMC->Gmtod(gMcTrackPos,gMcTrackPosLoc,1);
311   AliDebug(10,Form("gMC Track Position (MARS) x: %5.3lf, y: %5.3lf, z: %5.3lf (r: %5.3lf) ---> (LOC) x: %5.3f, y: %5.3f, z: %5.3f",gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2],TMath::Sqrt(gMcTrackPos[0]*gMcTrackPos[0]+gMcTrackPos[1]*gMcTrackPos[1]+gMcTrackPos[2]*gMcTrackPos[2]),gMcTrackPosLoc[0],gMcTrackPosLoc[1],gMcTrackPosLoc[2]));
312
313
314   AliDebug(10,Form("Step %i: tid=%i flags alive=%i disap=%i enter=%i exit=%i inside=%i out=%i stop=%i new=%i",
315                    iStepN, gAlice->GetMCApp()->GetCurrentTrackNumber(),
316                    gMC->IsTrackAlive(), gMC->IsTrackDisappeared(),gMC->IsTrackEntering(), gMC->IsTrackExiting(),
317                    gMC->IsTrackInside(),gMC->IsTrackOut(),        gMC->IsTrackStop(),     gMC->IsNewTrack()));
318
319   Float_t a,z,den,rad,abs; a=z=den=rad=abs=-1;
320   Int_t mid=gMC->CurrentMaterial(a,z,den,rad,abs);
321   AliDebug(10, Form("Step %i: mid=%i a=%7.2f z=%7.2f den=%9.4f rad=%9.2f abs=%9.2f\n\n",iStepN,mid,a,z,den,rad,abs));
322
323   TArrayI proc;  gMC->StepProcesses(proc);
324   AliDebug(1,"Processes in this step:");
325   for ( int i = 0 ; i < proc.GetSize(); i++)
326     {
327       AliDebug(10, Form("%s",TMCProcessName[proc.At(i)]));
328     }
329   AliDebug(1,"End process list");
330   iStepN++;
331 }//StepHistory()
332 //______________________________________________________
333 void AliITSupgrade::Hits2SDigits(){
334   
335   // Interface method ivoked from AliSimulation to create a list of sdigits corresponding to list of hits. Every hit generates one or more sdigits.
336   // Arguments: none
337   //   Returns: none
338   AliDebug(1,"Start Hits2SDigits.");
339   
340   if(!fSegmentation)fSegmentation=new AliITSsegmentationUpgrade();
341  
342   if(!GetLoader()->TreeH()) {GetLoader()->LoadHits();}
343   if(!GetLoader()->TreeS())
344
345     for(Int_t iEvt=0;iEvt < GetLoader()->GetRunLoader()->GetNumberOfEvents();iEvt++){//events loop
346       GetLoader()->GetRunLoader()->GetEvent(iEvt);                          //get next event
347       {
348         GetLoader()->MakeTree("S");
349         MakeBranch("S");
350       }
351       SetTreeAddress();
352       Int_t nSdigit[10]; for(Int_t i=0;i<10;i++)  nSdigit[i] =0; 
353       for(Int_t iEnt=0;iEnt<GetLoader()->TreeH()->GetEntries();iEnt++){//prims loop
354         GetLoader()->TreeH()->GetEntry(iEnt);     
355         Hit2SumDig(Hits(),SDigitsList(),nSdigit);//convert this hit to list of sdigits  
356       }//prims loop
357       GetLoader()->TreeS()->Fill();
358       GetLoader()->WriteSDigits("OVERWRITE");
359       SDigitsReset();
360     }//events loop
361   GetLoader()->UnloadHits();
362   GetLoader()->UnloadSDigits();
363   AliDebug(1,"Stop Hits2SDigits.");
364   
365 }
366 //____________________________
367 void AliITSupgrade::Hit2SumDig(TClonesArray *hits,TObjArray *pSDig, Int_t *nSdigit)
368 {
369   // Adds  sdigits of this hit to the list
370   //   Returns: none
371   
372   AliDebug(1,"Start Hit2SumDig");
373   
374   
375   if(!fSegmentation){    
376     AliDebug(1,"Segmentation Not inizialized!!");
377     return ;
378   }
379   
380   TClonesArray *pSdigList[10]; 
381   
382   for(Int_t i=0;i<fNlayers;i++){ 
383     pSdigList[i]=(TClonesArray*)(*pSDig)[i];
384     if(pSdigList[i]->GetEntries()!=0) AliErrorClass("Some of sdigits lists is not empty");         //in principle those lists should be empty 
385   }
386   
387   AliInfo(Form("Number of hits %i ",hits->GetEntries()));
388   for(Int_t iHit=0;iHit<hits->GetEntries();iHit++){         //hits loop
389     AliITShit *hit = (AliITShit*)hits->At(iHit);
390     Double_t xz[2];
391     if(!fSegmentation->GlobalToDet(hit->GetModule(),hit->GetXG(),hit->GetYG(),hit->GetZG(),xz[0],xz[1])) continue;
392     AliITSDigitUpgrade digit;
393     digit.SetSignal(hit->GetIonization());
394     digit.SetNelectrons(hit->GetIonization()/(3.62*1e-09));
395     digit.SetLayer(hit->GetModule()); 
396     digit.SetTrackID(hit->GetTrack()); 
397     
398     Int_t xpix = 999;
399     if(fSegmentation->GetCellSizeX(hit->GetModule())!=0) xpix =(Int_t) (xz[0]/ fSegmentation->GetCellSizeX(hit->GetModule()));
400     
401     Int_t zpix = 999; // shift at the next line to have zpix always positive. Such numbers are used to build the Pixel Id in the layer (> 0!) 
402     if(fSegmentation->GetCellSizeZ(hit->GetModule())!=0){
403       zpix =(Int_t)((xz[1]+fHalfLength.At(hit->GetModule())) / fSegmentation->GetCellSizeZ(hit->GetModule())); 
404     }
405     digit.SetPixId(xpix,zpix);
406
407     
408     new((*pSdigList[hit->GetModule()])[nSdigit[hit->GetModule()]++]) AliITSDigitUpgrade(digit);
409   }
410   
411   AliDebug(1,"Stop Hit2SumDig.");
412 }
413 //_______________________________________________________________________________________________
414 void AliITSupgrade::MakeBranch(Option_t *option){
415   //Create Tree branches 
416   AliDebug(1,Form("Start with option= %s.",option));
417   
418   const Int_t kBufSize = 4000;
419   
420   const char *cH = strstr(option,"H");
421   const char *cD = strstr(option,"D");
422   const char *cR = strstr(option,"R");
423   const char *cS = strstr(option,"S");
424
425   if(cH&&fLoader->TreeH()){
426
427     HitCreate();
428     MakeBranchInTree(fLoader->TreeH(),"ITSupgrade",&fHits,kBufSize,0);   
429   }
430
431     
432   if(cS&&fLoader->TreeS()){
433     SDigitsCreate();
434     for(Int_t i=0;i<fNlayers;i++) MakeBranchInTree(fLoader->TreeS(),Form("Layer%d",i),&((*fSdigits)[i]),kBufSize,0);
435   }
436
437
438   if(cD&&fLoader->TreeD()){
439     DigitsCreate();
440     for(Int_t i=0;i<fNlayers;i++) MakeBranchInTree(fLoader->TreeD(),Form("Layer%d",i),&((*fDigits)[i]),kBufSize,0);
441   }
442
443   if(cR&&fLoader->TreeR()){
444     ClustersCreate();
445     for(Int_t i=0;i<fNlayers;i++) MakeBranchInTree(fLoader->TreeR(),Form("Layer%d",i),&((*fClusters)[i]),kBufSize,0);
446   }
447
448   AliDebug(1,"Stop.");
449 }
450 //____________________________________________________________________________________________________ 
451 void AliITSupgrade::SetTreeAddress()
452 {
453   //Set branch address for the Hits and Digits Tree.
454   AliDebug(1,"Start.");
455   if(fLoader->TreeH() && fLoader->TreeH()->GetBranch("ITSupgrade" )){
456     HitCreate();
457     fLoader->TreeH()->SetBranchAddress("ITSupgrade",&fHits);
458
459   }
460
461
462     
463   if(fLoader->TreeS() && fLoader->TreeS()->GetBranch("Layer0" )){
464     SDigitsCreate();
465     for(int i=0;i<fNlayers;i++){
466       fLoader->TreeS()->SetBranchAddress(Form("Layer%d",i),&((*fSdigits)[i]));
467     }
468   }
469
470     
471   if(fLoader->TreeD() && fLoader->TreeD()->GetBranch("Layer0")){
472     DigitsCreate(); 
473     for(int i=0;i<fNlayers;i++){
474       fLoader->TreeD()->SetBranchAddress(Form("Layer%d",i),&((*fDigits)[i]));
475     }
476   }
477   if(fLoader->TreeR() && fLoader->TreeR()->GetBranch("Layer0")){
478     ClustersCreate(); 
479     for(int i=0;i<fNlayers;i++){
480       fLoader->TreeR()->SetBranchAddress(Form("Layer%d",i),&((*fClusters)[i]));
481     }
482   }
483   AliDebug(1,"Stop.");
484 }
485
486
487
488
489