- amp = Float_t(dig->GetAmp()); // Energy of the digit (arbitrary units)
- id = dig->GetId() ; // Id label of the cell
- timeR = dig->GetTimeR() ; // Earliest time of the digit
- if(amp<=0.0) AliInfo(Form(" id %i amp %f \n", id, amp));
- // printf(" FILLTRU : timeR %10.5e time %10.5e : amp %10.5e \n", timeR, dig->GetTime(), amp);
- // Get eta and phi cell position in supermodule
- Bool_t bCell = fGeom->GetCellIndex(id, iSupMod, nModule, nIphi, nIeta) ;
- if(!bCell)
- AliError(Form("FillTRU","%i Wrong cell id number %i ", idig, id)) ;
-
- fGeom->GetCellPhiEtaIndexInSModule(iSupMod,nModule,nIphi, nIeta,iphi,ieta);
- // iphim, ietam - module indexes in SM
- fGeom->GetModuleIndexesFromCellIndexesInSModule(iSupMod,iphi,ieta, iphim, ietam, nModule);
- //if(iSupMod >9)
- //printf("iSupMod %i nModule %i iphi %i ieta %i iphim %i ietam %i \n",
- //iSupMod,nModule, iphi, ieta, iphim, ietam);
-
- // Check to which TRU in the supermodule belongs the cell.
- // Supermodules are divided in a TRU matrix of dimension
- // (fNTRUPhi,fNTRUEta).
- // Each TRU is a cell matrix of dimension (nModulesPhi,nModulesEta)
-
- // First calculate the row and column in the supermodule
- // of the TRU to which the cell belongs.
- Int_t row = iphim / nModulesPhi;
- Int_t col = ietam / nModulesEta;
- //Calculate label number of the TRU
- Int_t itru = fGeom->GetAbsTRUNumberFromNumberInSm(row, col, iSupMod);
-
- //Fill TRU matrix with cell values
- TMatrixD * amptrus = dynamic_cast<TMatrixD *>(ampmatrix->At(itru)) ;
- TMatrixD * timeRtrus = dynamic_cast<TMatrixD *>(timeRmatrix->At(itru)) ;
-
- //Calculate row and column of the module inside the TRU with number itru
- Int_t irow = iphim - row * nModulesPhi;
- if(iSupMod > 9)
- irow = iphim - row * nModulesPhi2; // size of matrix the same
- Int_t icol = ietam - col * nModulesEta;
-
- (*amptrus)(irow,icol) += amp ;
- if((*timeRtrus)(irow,icol) <0.0 || (*timeRtrus)(irow,icol) <= timeR){ // ??
- (*timeRtrus)(irow,icol) = timeR ;
+ if(dig){
+ amp = Float_t(dig->GetAmplitude()); // Energy of the digit (arbitrary units)
+ id = dig->GetId() ; // Id label of the cell
+ timeR = dig->GetTimeR() ; // Earliest time of the digit
+ if(amp<=0.0) AliDebug(1,Form(" id %i amp %f \n", id, amp));
+ // printf(" FILLTRU : timeR %10.5e time %10.5e : amp %10.5e \n", timeR, dig->GetTime(), amp);
+ // Get eta and phi cell position in supermodule
+ Bool_t bCell = fGeom->GetCellIndex(id, iSupMod, nModule, nIphi, nIeta) ;
+ if(!bCell)
+ AliError(Form("%i Wrong cell id number %i ", idig, id)) ;
+
+ fGeom->GetCellPhiEtaIndexInSModule(iSupMod,nModule,nIphi, nIeta,iphi,ieta);
+ // iphim, ietam - module indexes in SM
+ fGeom->GetModuleIndexesFromCellIndexesInSModule(iSupMod,iphi,ieta, iphim, ietam, nModule);
+ //if(iSupMod >9)
+ //printf("iSupMod %i nModule %i iphi %i ieta %i iphim %i ietam %i \n",
+ //iSupMod,nModule, iphi, ieta, iphim, ietam);
+
+ // Check to which TRU in the supermodule belongs the cell.
+ // Supermodules are divided in a TRU matrix of dimension
+ // (fNTRUPhi,fNTRUEta).
+ // Each TRU is a cell matrix of dimension (nModulesPhi,nModulesEta)
+
+ // First calculate the row and column in the supermodule
+ // of the TRU to which the cell belongs.
+ Int_t row = iphim / nModulesPhi;
+ Int_t col = ietam / nModulesEta;
+ //Calculate label number of the TRU
+ Int_t itru = fGeom->GetAbsTRUNumberFromNumberInSm(row, col, iSupMod);
+
+ //Fill TRU matrix with cell values
+ TMatrixD * amptrus = dynamic_cast<TMatrixD *>(ampmatrix->At(itru)) ;
+ TMatrixD * timeRtrus = dynamic_cast<TMatrixD *>(timeRmatrix->At(itru)) ;
+
+ if(!amptrus || !timeRtrus){
+ AliError("Could not recover the TRU matrix with amplitudes or times");
+ }
+ else{
+ //Calculate row and column of the module inside the TRU with number itru
+ Int_t irow = iphim - row * nModulesPhi;
+ if(iSupMod > 9)
+ irow = iphim - row * nModulesPhi2; // size of matrix the same
+ Int_t icol = ietam - col * nModulesEta;
+
+ (*amptrus)(irow,icol) += amp ;
+ if((*timeRtrus)(irow,icol) <0.0 || (*timeRtrus)(irow,icol) <= timeR){ // ??
+ (*timeRtrus)(irow,icol) = timeR ;
+ }
+ }
+ //printf(" ieta %i iphi %i iSM %i || col %i row %i : itru %i -> amp %f\n",
+ // ieta, iphi, iSupMod, col, row, itru, amp);
+ //####################SUPERMODULE MATRIX ##################
+ TMatrixD * ampsmods = dynamic_cast<TMatrixD *>(ampmatrixsmod->At(iSupMod)) ;
+ if(!ampsmods){
+ AliError("Could not recover the matrix per SM");
+ continue;
+ }
+ (*ampsmods)(iphim,ietam) += amp ;
+ // printf(" id %i iphim %i ietam %i SM %i : irow %i icol %i itru %i : amp %6.0f\n",
+ //id, iphim, ietam, iSupMod, irow, icol, itru, amp);