]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Bug fixes - use array instad of TArray - conserve memory
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 12 Mar 2009 21:51:59 +0000 (21:51 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 12 Mar 2009 21:51:59 +0000 (21:51 +0000)
FMD/AliFMDBaseDigit.cxx
FMD/AliFMDBaseDigitizer.cxx
FMD/AliFMDDigit.cxx
FMD/AliFMDDigit.h
FMD/AliFMDEdepMap.cxx
FMD/AliFMDHitDigitizer.cxx
FMD/AliFMDSDigit.cxx
FMD/AliFMDSDigit.h

index 41d69200d486a0c6d952585a046cc5939c730bd3..6f1356c252a1973faf972520468872a1668d7ac9 100644 (file)
@@ -204,7 +204,7 @@ AliFMDBaseDigit::AddTrack(Int_t track)
   else if (fTracks[2] == -1) fTracks[2] = track;
   else 
     AliWarning(Form("While adding track label to %s for %s: "
-                   "All 3 track labels used, cannot add reference to track %d",
+                   "All 3 track labels used, can't add reference to track %d",
                    ClassName(), GetName(), track));
 }
 
index 36bf25549b796ba25057b8af693d5b7dec665c04..cf88ee26b44993ad74500506beb2e403705014b5 100644 (file)
@@ -319,7 +319,15 @@ AliFMDBaseDigitizer::AddContribution(UShort_t detector,
 {
   // Add edep contribution from (detector,ring,sector,strip) to cache
   AliFMDParameters* param = AliFMDParameters::Instance();
-
+  AliFMDDebug(10, ("Adding contribution %7.5f for FMD%d%c[%2d,%3d] "
+                 " from %d tracks (%s)", 
+                 edep,
+                 detector, 
+                 ring,
+                 sector, 
+                 strip, 
+                 nTrack, 
+                 (isPrimary ? "primary" : "secondary")));
   // Check if strip is `dead' 
   if (param->IsDead(detector, ring, sector, strip)) { 
     AliFMDDebug(5, ("FMD%d%c[%2d,%3d] is marked as dead", 
@@ -341,18 +349,25 @@ AliFMDBaseDigitizer::AddContribution(UShort_t detector,
                    detector, ring, sector, strip));
       
   // Sum energy deposition
+  Int_t oldN  =  entry.fN;
   entry.fEdep += edep;
   entry.fN    += nTrack;
   if (isPrimary) entry.fNPrim += nTrack;
   if (fStoreTrackRefs) { 
-    Int_t oldN = entry.fLabels.fN;
-    entry.fLabels.Set(entry.fN);
-    for (Int_t i = 0; i < nTrack; i++) 
+    if (entry.fLabels.fN < entry.fN) {
+      AliFMDDebug(15, ("== New label array size %d, was %d, added %d", 
+                      entry.fN, entry.fLabels.fN, nTrack));
+      entry.fLabels.Set(entry.fN);
+    }
+    for (Int_t i = 0; i < nTrack; i++) {
+      AliFMDDebug(15, ("=> Setting track label # %d", oldN+i));
       entry.fLabels[oldN + i] = tracknos[i];
+      AliFMDDebug(15, ("<= Setting track label # %d", oldN+i));
+    }
   }
-  AliFMDDebug(15, ("Adding contribution %f to FMD%d%c[%2d,%3d] (%f) track %d", 
-                  edep, detector, ring, sector, strip,
-                  entry.fEdep, (nTrack > 0 ? tracknos[0] : -1)));
+  AliFMDDebug(15,("Adding contribution %f to FMD%d%c[%2d,%3d] (%f) track %d", 
+                 edep, detector, ring, sector, strip,
+                 entry.fEdep, (nTrack > 0 ? tracknos[0] : -1)));
   
 }
 
@@ -551,14 +566,14 @@ AliFMDBaseDigitizer::AddDigit(UShort_t        detector,
                              Short_t         count2, 
                              Short_t         count3,
                              Short_t         count4,
-                             UShort_t        /* ntot */
+                             UShort_t        ntot
                              UShort_t        /* nprim */,
                              const TArrayI&  refs) const
 {
   // Add a digit or summable digit
-  
   fFMD->AddDigitByFields(detector, ring, sector, strip, 
-                        count1, count2, count3, count4, refs);
+                        count1, count2, count3, count4, 
+                        ntot, fStoreTrackRefs ? refs.fArray : 0);
 }
 
 //____________________________________________________________________
index 5941b9c0e5189031f8e4650012a90f795f65ba6c..35757ddb6df0cac9ebfc07faed6e483d3c03f9db 100644 (file)
@@ -91,7 +91,8 @@ AliFMDDigit::AliFMDDigit(UShort_t       detector,
                         Short_t        count2, 
                         Short_t        count3,
                         Short_t        count4, 
-                        const TArrayI& refs)
+                        UShort_t       nrefs,
+                        Int_t*         refs)
   : AliFMDBaseDigit(detector, ring, sector, strip), 
     fCount1(count1),
     fCount2(count2),
@@ -110,7 +111,8 @@ AliFMDDigit::AliFMDDigit(UShort_t       detector,
   //    count1    ADC count (a 10-bit word)
   //    count2    ADC count (a 10-bit word) -1 if not used
   //    count3    ADC count (a 10-bit word) -1 if not used
-  for (Int_t i = 0; i < refs.fN; i++) AddTrack(refs.fArray[i]);
+  if (!refs) return;
+  for (Int_t i = 0; i < nrefs; i++) AddTrack(refs[i]);
 }
 
 //____________________________________________________________________
index 815f90e5d91cffda8ee98f22bdc3f02e6cb69962..53cec0005897d48f13b8fcc22ceaa4e503ce0701 100644 (file)
@@ -50,7 +50,8 @@ public:
              Short_t        count2=-1, 
              Short_t        count3=-1, 
              Short_t        count4=-1, 
-             const TArrayI& refs=TArrayI());
+             UShort_t       nrefs=0,
+             Int_t*         refs=0);
   /** 
    * DTOR 
    */
index cc1e8c6d7a5adf2aa6a3c8c3df6f792654e13244..1de27cc69ed4294201c720fa7e6dd7bb58ecfcd9 100644 (file)
@@ -96,6 +96,7 @@ AliFMDEdepMap::Reset()
     fData[i].fEdep  = 0; 
     fData[i].fN     = 0; 
     fData[i].fNPrim = 0;
+    fData[i].fLabels.Reset();
   };
 }
 
@@ -105,10 +106,10 @@ AliFMDEdepMap::Reset(const AliFMDEdepHitPair& val)
 {
   // Reset to val
   for (Int_t i = 0; i < fTotal; i++) { 
-    fData[i].fEdep  = val.fEdep; 
-    fData[i].fN     = val.fN; 
-    fData[i].fNPrim = val.fNPrim;
-    fData[i].fLabels.Set(0);
+    fData[i].fEdep   = val.fEdep; 
+    fData[i].fN      = val.fN; 
+    fData[i].fNPrim  = val.fNPrim;
+    fData[i].fLabels = val.fLabels;
   };
 }
 
index 50132d81b4e82fdcce779f954762f58adf242838..ad389f0d8793b008845fa6947dc9aa421666930d 100644 (file)
@@ -266,7 +266,7 @@ AliFMDHitDigitizer::Exec(Option_t* /*option*/)
     }
     
     // Read in the event
-    AliFMDDebug(5, ("Now digitizing (Hits->%s) event # %d", 
+    AliFMDDebug(1, ("Now digitizing (Hits->%s) event # %d", 
                    (fOutput == kDigits ? "digits" : "sdigits"), event));
     thisLoader->GetEvent(event);
     
@@ -424,6 +424,15 @@ AliFMDHitDigitizer::SumContributions(TBranch* hitsBranch)
       }
     
       // Extract parameters 
+      AliFMDDebug(15,("Adding contribution %7.5f for FMD%d%c[%2d,%3d] "
+                     " for trackno %6d (%s)", 
+                     fmdHit->Edep(),
+                     fmdHit->Detector(), 
+                     fmdHit->Ring(),
+                     fmdHit->Sector(), 
+                     fmdHit->Strip(), 
+                     trackno, 
+                     (isPrimary ? "primary" : "secondary")));
       AddContribution(fmdHit->Detector(),
                      fmdHit->Ring(),
                      fmdHit->Sector(),
@@ -474,7 +483,8 @@ AliFMDHitDigitizer::AddDigit(UShort_t        detector,
                    detector, ring, sector, strip, 
                    count1, count2, count3, count4));
     AliFMDBaseDigitizer::AddDigit(detector, ring, sector, strip, 0,
-                                 count1, count2, count3, count4, 0, 0, refs);
+                                 count1, count2, count3, count4, 
+                                 ntotal, nprim, refs);
     return;
   }
   if (edep <= 0) { 
@@ -494,7 +504,7 @@ AliFMDHitDigitizer::AddDigit(UShort_t        detector,
                   count1, count2, count3, count4, nprim, ntotal, refs.fN));
   fFMD->AddSDigitByFields(detector, ring, sector, strip, edep,
                          count1, count2, count3, count4, 
-                         ntotal, nprim, refs);
+                         ntotal, nprim, fStoreTrackRefs ? refs.fArray : 0);
 }
 
 //____________________________________________________________________
index e4aeabdf2e57b10117db781232c912b330df0155..a85a59e03c9a8cb75dbc63d7adf447a616ea0edf 100644 (file)
@@ -98,7 +98,7 @@ AliFMDSDigit::AliFMDSDigit(UShort_t       detector,
                           Short_t        count4,
                           UShort_t       npart,
                           UShort_t       nprim,
-                          const TArrayI& refs)
+                          Int_t*         refs)
   : AliFMDBaseDigit(detector, ring, sector, strip), 
     fEdep(edep),
     fCount1(count1),
@@ -122,7 +122,8 @@ AliFMDSDigit::AliFMDSDigit(UShort_t       detector,
   //    count1    ADC count (a 10-bit word)
   //    count2    ADC count (a 10-bit word) -1 if not used
   //    count3    ADC count (a 10-bit word) -1 if not used
-  for (Int_t i = 0; i < refs.fN; i++) AddTrack(refs.fArray[i]);
+  if (!refs) return;
+  for (Int_t i = 0; i < npart; i++) AddTrack(refs[i]);
 }
 
 //____________________________________________________________________
index c786cc264014b63a559ba3e999202d8b311b46b1..4b88f15bf5d0dfeb49029f0876ede1a1a156e129 100644 (file)
@@ -15,9 +15,9 @@
 #ifndef ALIFMDBASEDIGIT_H
 # include <AliFMDBaseDigit.h>
 #endif
-#ifndef ROOT_TArrayI
-# include <TArrayI.h>
-#endif
+// #ifndef ROOT_TArrayI
+// # include <TArrayI.h>
+// #endif
 
 //____________________________________________________________________
 /** @class AliFMDSDigit AliFMDDigit.h <FMD/AliFMDDigit.h>
@@ -54,7 +54,7 @@ public:
               Short_t        count4=-1,
               UShort_t       npart=0,
               UShort_t       nprim=0, 
-              const TArrayI& refs=TArrayI());
+              Int_t*         refs=0);
   /** 
    * DTOR 
    */