]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDBaseDigitizer.cxx
new macro to handle setting of default event species for reco params
[u/mrichter/AliRoot.git] / FMD / AliFMDBaseDigitizer.cxx
index 36bf25549b796ba25057b8af693d5b7dec665c04..1970eb348a35e2758d13ff83f6ccc712fcfd4441 100644 (file)
@@ -242,10 +242,7 @@ AliFMDBaseDigitizer::AliFMDBaseDigitizer(AliRunDigitizer* manager)
   : AliDigitizer(manager, "AliFMDBaseDigitizer", "FMD Digitizer base class"), 
     fFMD(0),
     fRunLoader(0),
-    fEdep(AliFMDMap::kMaxDetectors, 
-         AliFMDMap::kMaxRings, 
-         AliFMDMap::kMaxSectors, 
-         AliFMDMap::kMaxStrips), 
+    fEdep(0),        // nDet==0 means 51200 slots
     fShapingTime(6),
     fStoreTrackRefs(kTRUE)
 {
@@ -260,10 +257,7 @@ AliFMDBaseDigitizer::AliFMDBaseDigitizer(const Char_t* name,
   : AliDigitizer(name, title),
     fFMD(0),
     fRunLoader(0),
-    fEdep(AliFMDMap::kMaxDetectors, 
-         AliFMDMap::kMaxRings, 
-         AliFMDMap::kMaxSectors, 
-         AliFMDMap::kMaxStrips),
+    fEdep(0),        // nDet==0 means 51200 slots
     fShapingTime(6),
     fStoreTrackRefs(kTRUE)
 {
@@ -319,7 +313,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 +343,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 +560,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);
 }
 
 //____________________________________________________________________