Adding extensions and bug fixes to AliHLTMUONHitReconstructor from Indra.
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 28 May 2009 15:55:42 +0000 (15:55 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 28 May 2009 15:55:42 +0000 (15:55 +0000)
Adding functionality to AliHLTMUONHitReconstructor to generate extra cluster information and write this out at CLUSTERS blocks.
Fixing handling of internal HLT data blocks and special events in AliHLTMUONRootifierComponent and AliHLTMUONDataCheckerComponent.

16 files changed:
HLT/MUON/AliHLTMUONClustersBlockStruct.cxx
HLT/MUON/AliHLTMUONClustersBlockStruct.h
HLT/MUON/AliHLTMUONConstants.cxx
HLT/MUON/AliHLTMUONRecHit.cxx
HLT/MUON/AliHLTMUONRecHit.h
HLT/MUON/AliHLTMUONRecHitsBlockStruct.cxx
HLT/MUON/AliHLTMUONRecHitsBlockStruct.h
HLT/MUON/AliHLTMUONUtils.cxx
HLT/MUON/AliHLTMUONUtils.h
HLT/MUON/OfflineInterface/AliHLTMUONRootifierComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.h
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.h
HLT/MUON/utils/AliHLTMUONDataCheckerComponent.cxx
HLT/MUON/utils/dHLTdumpraw.cxx

index cb068e5..d94f871 100644 (file)
@@ -18,7 +18,7 @@
 /**
  * @file   AliHLTMUONClustersBlockStruct.cxx
  * @author Artur Szostak <artursz@iafrica.com>
- * @date   
+ * @date   18 May 2007
  * @brief  Implementation of the stream and comparison operators.
  */
 
@@ -34,7 +34,8 @@ std::ostream& operator << (
        stream  << "{fId = " << cluster.fId
                << ", fHit = " << cluster.fHit
                << ", fDetElemId = " << cluster.fDetElemId
-               << ", fNchannels = " << cluster.fNchannels << "}";
+               << ", fNchannels = " << cluster.fNchannels
+               << ", fCharge = " << cluster.fCharge << "}";
        return stream;
 }
 
index 1c4b5a0..f0ed574 100644 (file)
@@ -8,11 +8,14 @@
 /**
  * @file   AliHLTMUONClustersBlockStruct.h
  * @author Artur Szostak <artursz@iafrica.com>
- * @date   
- * @brief  Definition of internal dimuon HLT block structure containing
- *         debugging information about clusters and their corresponding
- *         reconstructed hits.
- * 
+ * @date   18 May 2007
+ * @brief  Definition of internal dimuon HLT block structure.
+ *
+ * The structure contains extra information about a cluster and its corresponding
+ * reconstructed hit, such as total charge and number of channels.
+ * The individual channel information is contained in AliHLTMUONChannelStruct structures.
+ * The extra information is useful for debugging purposes.
+ *
  * The structures are defined with C linkage since C generally gives us more
  * binary compatibility between compilers.
  */
@@ -25,7 +28,7 @@ extern "C"
 {
 
 /**
- * Debugging information about a cluster and its reconstructed hit.
+ * Extra debugging information about a cluster and its reconstructed hit.
  */
 struct AliHLTMUONClusterStruct
 {
@@ -38,6 +41,8 @@ struct AliHLTMUONClusterStruct
                                   // on which the cluster was found.
 
        AliHLTUInt32_t fNchannels; // Number of channels/pads in the cluster.
+       
+       AliHLTFloat32_t fCharge; // Total cluster charge. Can be -1 if invalid or uncomputed.
 };
 
 /**
@@ -80,7 +85,8 @@ inline bool operator == (
        )
 {
        return  a.fId == b.fId and a.fHit == b.fHit and
-               a.fDetElemId == b.fDetElemId and a.fNchannels == b.fNchannels;
+               a.fDetElemId == b.fDetElemId and a.fNchannels == b.fNchannels and
+               a.fCharge == b.fCharge;
 }
 
 inline bool operator != (
index c273cfc..19116ce 100644 (file)
@@ -57,7 +57,7 @@ AliHLTMUONConstants::fgkNilRecHitStruct = {0, 0, 0, 0};
 
 const AliHLTMUONClusterStruct
 AliHLTMUONConstants::fgkNilClusterStruct = {
-       0, AliHLTMUONConstants::fgkNilRecHitStruct, 0, 0
+       0, AliHLTMUONConstants::fgkNilRecHitStruct, 0, 0, 0
 };
 
 const AliHLTMUONChannelStruct
index 66b36ad..3fe506e 100644 (file)
@@ -50,19 +50,22 @@ std::ostream& operator << (std::ostream& stream, const AliHLTMUONRecHit& hit)
 
 
 void AliHLTMUONRecHit::SetDebugInfo(
-               Int_t detElemId, Int_t clusterId, UInt_t nChExp, Int_t sourceDDL
+               Int_t detElemId, Int_t clusterId, UInt_t nChExp,
+               Float_t charge, Int_t sourceDDL
        )
 {
 /// Sets the debugging information.
 /// @param detElemId  The detector element ID.
 /// @param clusterId  Cluster ID of the hit's cluster.
 /// @param nChExp     Number of expected channels forming the cluster.
+/// @param charge  The total charge of the cluster.
 /// @param sourceDDL  The source DDL of this hit.
 
        fSourceDDL = sourceDDL;
        fDetElemId = detElemId;
        fClusterId = clusterId;
        fNchExp = nChExp;
+       fCharge = charge;
 }
        
 
@@ -123,6 +126,7 @@ void AliHLTMUONRecHit::Print(Option_t* option) const
                        << " cm); source DDL = " << fSourceDDL
                        << "; DetElemID = " << fDetElemId
                        << "; cluster ID = " << fClusterId
+                       << "; total charge = " << fCharge
                        << "; expected #ch = " << fNchExp << endl;
        }
        else if (strcmp(option, "all") == 0)
@@ -132,6 +136,7 @@ void AliHLTMUONRecHit::Print(Option_t* option) const
                        << " cm); source DDL = " << fSourceDDL
                        << "; DetElemID = " << fDetElemId
                        << "; cluster ID = " << fClusterId
+                       << "; total charge = " << fCharge
                        << "; expected #ch = " << fNchExp << endl;
                if (fChannels.GetEntriesFast() == 0)
                {
index 60d2afe..4811882 100644 (file)
@@ -133,6 +133,7 @@ public:
         *                    which this hit resides.
         * @param clusterId   The cluster ID number assigned to the hit's cluster.
         * @param nChExp      The expected number of channels that form the cluster.
+        * @param charge      The total charge of the cluster.
         */
        AliHLTMUONRecHit(
                        Float_t x = 0,
@@ -141,11 +142,12 @@ public:
                        Int_t sourceDDL = -1,
                        Int_t detElemId = -1,
                        Int_t clusterId = -1,
-                       Int_t nChExp = 0
+                       Int_t nChExp = 0,
+                       Float_t charge = 0
                ) :
                TObject(), fCoordinate(x, y, z), fSourceDDL(sourceDDL),
                fDetElemId(detElemId), fClusterId(clusterId), fNchExp(nChExp),
-               fChannels("AliHLTMUONRecHit::AliChannel", 6)
+               fChannels("AliHLTMUONRecHit::AliChannel", 6), fCharge(charge)
        {}
        
        /**
@@ -206,15 +208,21 @@ public:
        UInt_t ExpectedNchannels() const { return fNchExp; }
        
        /**
-        * Sets the debugging information for this hit.
+        * Returns the total charge of the cluster.
+        */
+       Float_t TotalCharge() const { return fCharge; }
+       
+       /**
+        * Sets the extra debugging information for this hit.
         * @param detElemId  The detector element ID.
         * @param clusterId  Cluster ID of the hit's cluster.
         * @param nChExp     Number of expected channels forming the cluster.
+        * @param charge     The total charge of the cluster
         * @param sourceDDL  The source DDL of this hit.
         */
        void SetDebugInfo(
                        Int_t detElemId, Int_t clusterId, UInt_t nChExp,
-                       Int_t sourceDDL = -1
+                       Float_t charge, Int_t sourceDDL = -1
                );
        
        /**
@@ -290,8 +298,9 @@ private:
        Int_t fClusterId;  ///< The cluster ID number used to relate all the channels to each other.
        UInt_t fNchExp;    ///< The number of channels that were supposed to be found.
        TClonesArray fChannels; ///< The channels forming part of the cluster from which this hit was reconstructed.
+       Float_t fCharge;   ///< The total charge of the cluster.
 
-       ClassDef(AliHLTMUONRecHit, 3); // A reconstructed hit translated from dHLT raw data into ROOT format.
+       ClassDef(AliHLTMUONRecHit, 4); // A reconstructed hit translated from dHLT raw data into ROOT format.
 };
 
 #endif // ALIHLTMUONRECHIT_H
index c601582..78dc1f9 100644 (file)
@@ -19,7 +19,7 @@
  * @file   AliHLTMUONRecHitsBlockStruct.h
  * @author Indranil Das <indra.das@saha.ac.in>,
  *         Artur Szostak <artursz@iafrica.com>
- * @date   
+ * @date   17 May 2007
  * @brief  Implementation of useful stream and comparison operators.
  */
 
index 7b4a58e..b7edcb4 100644 (file)
@@ -9,7 +9,7 @@
  * @file   AliHLTMUONRecHitsBlockStruct.h
  * @author Indranil Das <indra.das@saha.ac.in>,
  *         Artur Szostak <artursz@iafrica.com>
- * @date   
+ * @date   17 May 2007
  * @brief  Definition of internal dimuon HLT reconstructed hit data block structure.
  * 
  * The structures are defined with C linkage since C generally gives us more
index 025e958..0b2d3bf 100644 (file)
@@ -522,6 +522,7 @@ const char* AliHLTMUONUtils::FailureReasonToString(WhyNotValid reason)
        case kInvalidChamberNumber: return "kInvalidChamberNumber";
        case kHitIsNil: return "kHitIsNil";
        case kInvalidChannelCount: return "kInvalidChannelCount";
+       case kInvalidTotalCharge: return "kInvalidTotalCharge";
        case kInvalidBusPatchId: return "kInvalidBusPatchId";
        case kInvalidManuId: return "kInvalidManuId";
        case kInvalidChannelAddress: return "kInvalidChannelAddress";
@@ -583,6 +584,8 @@ const char* AliHLTMUONUtils::FailureReasonToMessage(WhyNotValid reason)
        case kInvalidChannelCount:
                return "The number of channels indicated is zero or outside"
                        " the valid range.";
+       case kInvalidTotalCharge:
+               return "The total charge does not have a valid value.";
        case kInvalidBusPatchId:
                return "The bus patch identifier is outside the valid range.";
        case kInvalidManuId:
@@ -1622,6 +1625,17 @@ bool AliHLTMUONUtils::IntegrityOk(
                }
                result = false;
        }
+       
+       // The charge must be a positive value of -1.
+       if (not (cluster.fCharge >= 0 or cluster.fCharge == -1))
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kInvalidTotalCharge;
+                       reasonCount++;
+               }
+               result = false;
+       }
 
        return result;
 }
index c4412e1..53295dc 100644 (file)
@@ -362,6 +362,7 @@ public:
                kInvalidChamberNumber,  ///< An invalid chamber number was found.
                kHitIsNil,  ///< The hit cannot be set to a nil value.
                kInvalidChannelCount,  ///< The number of channels indicated is zero or outside the valid range.
+               kInvalidTotalCharge, ///< The total charge does not have a valid value.
                kInvalidBusPatchId,  ///< The bus patch ID is outside the valid range.
                kInvalidManuId,  ///< The MANU ID is outside the valid range.
                kInvalidChannelAddress,  ///< The MANU channel address is outside the valid range.
index 490f50f..01906b4 100644 (file)
@@ -186,6 +186,8 @@ int AliHLTMUONRootifierComponent::DoEvent(
        /// Inherited from AliHLTProcessor. Processes the new event data.
        ///
        
+       if (not IsDataEvent()) return 0;
+       
        AliHLTMUONEvent event(evtData.fEventID);
        const AliHLTComponentBlockData* block = NULL;
        AliHLTUInt32_t specification = 0;  // Contains the output data block spec bits.
@@ -244,7 +246,7 @@ int AliHLTMUONRootifierComponent::DoEvent(
                                AliHLTUInt8_t chamber;
                                AliHLTUInt16_t detElemId;
                                AliHLTMUONUtils::UnpackRecHitFlags(h.fFlags, chamber, detElemId);
-                               event.Add(new AliHLTMUONRecHit(h.fX, h.fY, h.fZ, sourceDDL, detElemId, chamber));
+                               event.Add(new AliHLTMUONRecHit(h.fX, h.fY, h.fZ, sourceDDL, detElemId));
                        }
                }
                else if (block->fDataType == AliHLTMUONConstants::TriggerRecordsBlockDataType())
@@ -326,6 +328,99 @@ int AliHLTMUONRootifierComponent::DoEvent(
                }
        }
        
+       // We need to check if there are any cluster data blocks and add their
+       // information to the AliHLTMUONRecHit objects.
+       for (block = GetFirstInputBlock(AliHLTMUONConstants::ClusterBlockDataType());
+            block != NULL;
+            block = GetNextInputBlock()
+           )
+       {
+               specification |= block->fSpecification;
+               AliHLTMUONClustersBlockReader inblock(block->fPtr, block->fSize);
+               if (not BlockStructureOk(inblock))
+               {
+                       if (DumpDataOnError()) DumpEvent(evtData, trigData);
+                       continue;
+               }
+               
+               for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
+               {
+                       const AliHLTMUONClusterStruct& clust = inblock[n];
+                       
+                       AliHLTUInt8_t chamber;
+                       AliHLTUInt16_t detElemId;
+                       AliHLTMUONUtils::UnpackRecHitFlags(clust.fHit.fFlags, chamber, detElemId);
+                       if (clust.fDetElemId != detElemId)
+                       {
+                               HLTWarning("Found a cluster with a different detector element ID (%d)"
+                                       " from its corresponding hit (x,y,z = %f,%f,%f and detElemId = %d).",
+                                       clust.fDetElemId,
+                                       clust.fHit.fX, clust.fHit.fY, clust.fHit.fZ,
+                                       detElemId
+                               );
+                       }
+                       
+                       // Try find the corresponding reconstructed hit in 'event'.
+                       AliHLTMUONRecHit* hit = NULL;
+                       for (Int_t k = 0; k < event.Array().GetEntriesFast(); k++)
+                       {
+                               if (event.Array()[k]->IsA() != AliHLTMUONRecHit::Class())
+                                       continue;
+                               AliHLTMUONRecHit* h = static_cast<AliHLTMUONRecHit*>(event.Array()[k]);
+                               if (h->DetElemId() == detElemId and h->X() == clust.fHit.fX
+                                   and h->Y() == clust.fHit.fY and h->Z() == clust.fHit.fZ)
+                               {
+                                       hit = h;
+                                       break;
+                               }
+                       }
+                       
+                       // If we could not find the corresponding hit then we need to create
+                       // a new hit object, otherwise we can just append the information.
+                       if (hit == NULL)
+                       {
+                               // Decode the source DDL from the specification bits.
+                               Int_t sourceDDL = -1;
+                               bool ddl[22];
+                               AliHLTMUONUtils::UnpackSpecBits(block->fSpecification, ddl);
+                               for (int k = 0; k < 22; k++)
+                               {
+                                       if (ddl[k])
+                                       {
+                                               if (sourceDDL == -1)
+                                               {
+                                                       sourceDDL = k+1;
+                                               }
+                                               else
+                                               {
+                                                       HLTWarning("An input block of cluster data contains"
+                                                               " data from multiple DDL sources."
+                                                       );
+                                               }
+                                       }
+                               }
+                               if (sourceDDL > 20)
+                               {
+                                       HLTWarning("The source DDL of a cluster data input block is %d."
+                                               " The expected range for the DDL is [1..20].",
+                                               sourceDDL
+                                       );
+                               }
+                               event.Add(new AliHLTMUONRecHit(
+                                               clust.fHit.fX, clust.fHit.fY, clust.fHit.fZ,
+                                               sourceDDL, detElemId
+                                       ));
+                       }
+                       else
+                       {
+                               hit->SetDebugInfo(
+                                       detElemId, clust.fId, clust.fNchannels,
+                                       clust.fCharge, hit->SourceDDL()
+                               );
+                       }
+               }
+       }
+       
        // Now we can look for tracks to add. We needed the ROOT trigger records
        // and reco hits created before we can create track objects.
        for (block = GetFirstInputBlock(AliHLTMUONConstants::MansoTracksBlockDataType());
index fe13911..cc59bfc 100644 (file)
@@ -35,6 +35,8 @@
 
 #include "AliHLTMUONHitReconstructor.h"
 #include "AliHLTMUONRecHitsBlockStruct.h"
+#include "AliHLTMUONClustersBlockStruct.h"
+#include "AliHLTMUONChannelsBlockStruct.h"
 #include "AliHLTMUONUtils.h"
 #include <cstring>
 #include <strings.h>
@@ -59,6 +61,17 @@ AliHLTMUONHitReconstructor::AliHLTMUONHitReconstructor() :
        fRecPoints(NULL),
        fRecPointsCount(NULL),
        fMaxRecPointsCount(0),
+       fClusters(NULL),
+       fClusterCount(0),
+       fMaxClusters(0),
+       fGenerateClusterInfo(false),
+       fNewClusterId(0),
+       fDDL(0),
+       fChannels(NULL),
+       fChannelCount(0),
+       fMaxChannels(0),
+       fGenerateChannelInfo(false),
+       fMaxChannelMult(6),
        fCentralCountB(0),
        fCentralCountNB(0),
        fDigitPerDDL(0),
@@ -68,10 +81,13 @@ AliHLTMUONHitReconstructor::AliHLTMUONHitReconstructor() :
        fRecY(NULL),
        fAvgChargeX(NULL),
        fAvgChargeY(NULL),
+       fTotChargeX(NULL),
+       fTotChargeY(NULL),
        fNofBChannel(NULL),
        fNofNBChannel(NULL),
        fNofFiredDetElem(0),
        fIdToEntry(),
+       fMaxEntryPerBusPatch(0),
        fRecoveryMode(kDontTryRecover)
 {
        /// Default constructor
@@ -113,12 +129,22 @@ AliHLTMUONHitReconstructor::~AliHLTMUONHitReconstructor()
                delete [] fPadData;
                fPadData = NULL;
        }
+       
+       if (fClusters != NULL)
+       {
+               delete [] fClusters;
+       }
+       if (fChannels != NULL)
+       {
+               delete [] fChannels;
+       }
 }
 
 
 void AliHLTMUONHitReconstructor::SetLookUpTable(
                const AliHLTMUONHitRecoLutRow* lookupTable,
-               const IdManuChannelToEntry* idToEntry
+               const IdManuChannelToEntry* idToEntry,
+               const MaxEntryPerBusPatch* maxEntryPerBP
        )
 {
        /// Sets the Lookup table (LUT) containing the position of each pad with
@@ -127,9 +153,11 @@ void AliHLTMUONHitReconstructor::SetLookUpTable(
 
        assert( lookupTable != NULL );
        assert( idToEntry != NULL );
+       assert( maxEntryPerBP != NULL );
        
-       fIdToEntry = idToEntry;
        fLookUpTableData = lookupTable;
+       fIdToEntry = idToEntry;
+       fMaxEntryPerBusPatch = maxEntryPerBP;
 }
 
 
@@ -185,6 +213,8 @@ bool AliHLTMUONHitReconstructor::Run(
   fRecPointsCount = &nofHit;
   *fRecPointsCount = 0;
   fDigitPerDDL = 0;
+  fClusterCount = 0;
+  fChannelCount = 0;
 
   if (not DecodeDDL(rawData, rawDataSize)) {
     // Dont need to log any message again. Already done so in DecodeDDL.
@@ -196,6 +226,37 @@ bool AliHLTMUONHitReconstructor::Run(
     // There are no digits to process so stop here.
     return true;
   }
+  
+  // Allocate fClusters and fChannels if required to do so and only if the allocated
+  // size of the arrays is too small.
+  try
+  {
+    if (fGenerateClusterInfo and fMaxClusters < fMaxRecPointsCount)
+    {
+      if (fClusters != NULL)
+      {
+        delete [] fClusters;
+        fMaxClusters = 0;
+      }
+      fClusters = new AliHLTMUONClusterStruct[fMaxRecPointsCount];
+      fMaxClusters = fMaxRecPointsCount;
+    }
+    if (fGenerateChannelInfo and fMaxChannels < fMaxRecPointsCount*fMaxChannelMult)
+    {
+      if (fChannels != NULL)
+      {
+        delete [] fChannels;
+        fMaxChannels = 0;
+      }
+      fChannels = new AliHLTMUONChannelStruct[fMaxRecPointsCount*fMaxChannelMult];
+      fMaxChannels = fMaxRecPointsCount*fMaxChannelMult;
+    }
+  }
+  catch(const std::bad_alloc&)
+  {
+    HLTError("Could not allocate memory for the extra cluster and channel information.");
+    return false;
+  }
 
   if (not FindRecHits()) {
     HLTError("Failed to generate RecHits");
@@ -206,6 +267,34 @@ bool AliHLTMUONHitReconstructor::Run(
 }
 
 
+bool AliHLTMUONHitReconstructor::FillClusterData(
+               AliHLTMUONClusterStruct* clusters, AliHLTUInt32_t& nofClusters
+       )
+{
+       /// Fills the output clusters array with extra cluster information.
+       
+       bool sizeOk = fClusterCount <= nofClusters;
+       AliHLTUInt32_t n = sizeOk ? fClusterCount : nofClusters;
+       memcpy(clusters, fClusters, sizeof(AliHLTMUONClusterStruct)*n);
+       nofClusters = n;
+       return sizeOk;
+}
+
+
+bool AliHLTMUONHitReconstructor::FillChannelData(
+               AliHLTMUONChannelStruct* channels, AliHLTUInt32_t& nofChannels
+       )
+{
+       /// Fills the output channels array with extra channel information for each cluster.
+       
+       bool sizeOk = fChannelCount <= nofChannels;
+       AliHLTUInt32_t n = sizeOk ? fChannelCount : nofChannels;
+       memcpy(channels, fChannels, sizeof(AliHLTMUONChannelStruct)*n);
+       nofChannels = n;
+       return sizeOk;
+}
+
+
 bool AliHLTMUONHitReconstructor::DecodeDDL(const AliHLTUInt32_t* rawData,AliHLTUInt32_t rawDataSize)
 {
   //function to decode Raw Data 
@@ -219,6 +308,7 @@ bool AliHLTMUONHitReconstructor::DecodeDDL(const AliHLTUInt32_t* rawData,AliHLTU
   handler.SetIdManuChannelToEntry(fIdToEntry);
   handler.SetNofFiredDetElemId(fNofFiredDetElem);
   handler.SetMaxFiredPerDetElem(fMaxFiredPerDetElem);
+  handler.SetMaxEntryPerBusPatch(fMaxEntryPerBusPatch);
  
   if(!fHLTMUONDecoder.Decode(rawData,bufferSize))
   {
@@ -284,6 +374,8 @@ bool AliHLTMUONHitReconstructor::FindRecHits()
   assert( fRecY == NULL );
   assert( fAvgChargeX == NULL );
   assert( fAvgChargeY == NULL );
+  assert( fTotChargeX == NULL );
+  assert( fTotChargeY == NULL );
   assert( fNofBChannel == NULL );
   assert( fNofNBChannel == NULL );
   
@@ -363,6 +455,10 @@ bool AliHLTMUONHitReconstructor::FindRecHits()
         HLTDebug("Allocated fAvgChargeY with %d elements.", fCentralCountB);
         fAvgChargeX = new float[fCentralCountNB];
         HLTDebug("Allocated fAvgChargeX with %d elements.", fCentralCountNB);
+        fTotChargeY = new float[fCentralCountB];
+        HLTDebug("Allocated fTotChargeY with %d elements.", fCentralCountB);
+        fTotChargeX = new float[fCentralCountNB];
+        HLTDebug("Allocated fTotChargeX with %d elements.", fCentralCountNB);
         fNofBChannel = new int[fCentralCountB];
         HLTDebug("Allocated fNofBChannel with %d elements.", fCentralCountB);
         fNofNBChannel = new int[fCentralCountNB];
@@ -431,6 +527,18 @@ bool AliHLTMUONHitReconstructor::FindRecHits()
       HLTDebug("Released fAvgChargeY array.");
       fAvgChargeY = NULL;
     }
+    if (fTotChargeX != NULL)
+    {
+      delete [] fTotChargeX;
+      HLTDebug("Released fTotChargeX array.");
+      fTotChargeX = NULL;
+    }
+    if (fTotChargeY != NULL)
+    {
+      delete [] fTotChargeY;
+      HLTDebug("Released fTotChargeY array.");
+      fTotChargeY = NULL;
+    }
     if (fNofBChannel != NULL)
     {
       delete [] fNofBChannel;
@@ -467,6 +575,8 @@ void AliHLTMUONHitReconstructor::FindCentralHits(int minPadId, int maxPadId)
     fGetIdTotalData[fPadData[iPad].fIX]
       [fPadData[iPad].fIY]
       [fPadData[iPad].fPlane] = iPad ;
+
+    if(fPadData[iPad].fCharge <= fDCCut ) continue;
     
     if(fPadData[iPad].fPlane == 0 ){//&& fPadData[iPad].fIY > (0+1) && fPadData[iPad].fIY < (79 - 1)){
       //if(fPadData[iPad].fIY > 0){
@@ -548,7 +658,6 @@ void AliHLTMUONHitReconstructor::FindCentralHits(int minPadId, int maxPadId)
 
 }
 
-
 void AliHLTMUONHitReconstructor::RecXRecY()
 {
   // find reconstructed X and Y for each plane separately
@@ -557,6 +666,8 @@ void AliHLTMUONHitReconstructor::RecXRecY()
   assert( fRecY != NULL );
   assert( fAvgChargeX != NULL );
   assert( fAvgChargeY != NULL );
+  assert( fTotChargeX != NULL );
+  assert( fTotChargeY != NULL );
   assert( fNofBChannel != NULL );
   assert( fNofNBChannel != NULL );
 
@@ -564,8 +675,13 @@ void AliHLTMUONHitReconstructor::RecXRecY()
   int idCentral;
   int idLower = 0;
   int idUpper = 0;
+  int idLower1 = 0;
+  int idUpper1 = 0;
+
   int idRight = 0;
   int idLeft = 0;
+  int idRight1 = 0;
+  int idLeft1 = 0;
   
   for(b=0;b<fCentralCountB;b++){
     idCentral = fCentralChargeB[b];
@@ -574,12 +690,22 @@ void AliHLTMUONHitReconstructor::RecXRecY()
       idLower = 0;
     else
       idLower = fGetIdTotalData[fPadData[idCentral].fIX][fPadData[idCentral].fIY-1][0];
-
-    if(fPadData[idCentral].fIX==236)
+    
+    if(fPadData[idCentral].fIY==236)
       idUpper = 0;
     else
       idUpper = fGetIdTotalData[fPadData[idCentral].fIX][fPadData[idCentral].fIY+1][0];
 
+    if(fPadData[idCentral].fIY==1)
+      idLower1 = 0;
+    else
+      idLower1 = fGetIdTotalData[fPadData[idCentral].fIX][fPadData[idCentral].fIY-2][0];
+    
+    if(fPadData[idCentral].fIY==235)
+      idUpper1 = 0;
+    else
+      idUpper1 = fGetIdTotalData[fPadData[idCentral].fIX][fPadData[idCentral].fIY+2][0];
+    
 
     fRecY[b] = (fPadData[idCentral].fRealY*fPadData[idCentral].fCharge
               +
@@ -589,7 +715,9 @@ void AliHLTMUONHitReconstructor::RecXRecY()
                )/(fPadData[idCentral].fCharge + fPadData[idUpper].fCharge + fPadData[idLower].fCharge) ;
     
     fAvgChargeY[b] = (fPadData[idCentral].fCharge + fPadData[idUpper].fCharge + fPadData[idLower].fCharge)/3.0 ;
-    
+    fTotChargeY[b] = (fPadData[idCentral].fCharge + fPadData[idUpper].fCharge + fPadData[idLower].fCharge);
+//                   + fPadData[idUpper1].fCharge + fPadData[idLower1].fCharge) ;
     fNofBChannel[b] = 0;
     if(fPadData[idLower].fCharge>0)
       fNofBChannel[b]++ ;
@@ -597,14 +725,86 @@ void AliHLTMUONHitReconstructor::RecXRecY()
       fNofBChannel[b]++ ;
     if(fPadData[idUpper].fCharge>0)
       fNofBChannel[b]++ ;
+   
+    //collect left coloumn
+    if((fPadData[idCentral].fIX-1)>=0){
+      
+      idLeft = fGetIdTotalData[fPadData[idCentral].fIX-1][fPadData[idCentral].fIY][0];
+      
+      if(fPadData[idLeft].fIY==0)
+       idLower = 0;
+      else
+       idLower = fGetIdTotalData[fPadData[idLeft].fIX][fPadData[idLeft].fIY-1][0];
+      
+      if(fPadData[idLeft].fIY==236)
+       idUpper = 0;
+      else
+       idUpper = fGetIdTotalData[fPadData[idLeft].fIX][fPadData[idLeft].fIY+1][0];
 
-    HLTDebug("detelem : %d :--(charge,pos) lower[%d]  : (%d,%f), middle[%d]  : (%d,%f), upper[%d] : (%d,%f), nofChannel : %d",
-            fPadData[idCentral].fDetElemId,
-            idLower, fPadData[idLower].fCharge, fPadData[idLower].fRealY,
-            idCentral, fPadData[idCentral].fCharge,fPadData[idCentral].fRealY,
-            idUpper, fPadData[idUpper].fCharge, fPadData[idUpper].fRealY,
-            fNofBChannel[b]
-    );
+//       if(fPadData[idLeft].fIY==1)
+//     idLower1 = 0;
+//       else
+//     idLower1 = fGetIdTotalData[fPadData[idLeft].fIX][fPadData[idLeft].fIY-2][0];
+    
+//       if(fPadData[idLeft].fIY==235)
+//     idUpper1 = 0;
+//       else
+//     idUpper1 = fGetIdTotalData[fPadData[idLeft].fIX][fPadData[idLeft].fIY+2][0];
+
+      fTotChargeY[b] += (fPadData[idLeft].fCharge + fPadData[idUpper].fCharge + fPadData[idLower].fCharge);
+//                      + fPadData[idUpper1].fCharge + fPadData[idLower1].fCharge) ;
+
+      if(fPadData[idLower].fCharge>0)
+       fNofBChannel[b]++ ;
+      if(fPadData[idLeft].fCharge>0)
+       fNofBChannel[b]++ ;
+      if(fPadData[idUpper].fCharge>0)
+       fNofBChannel[b]++ ;
+
+    }
+    ////////////////////////////////////////////////////
+
+    //collect right coloumn
+    if((fPadData[idCentral].fIX+1)<=335){
+
+      idRight = fGetIdTotalData[fPadData[idCentral].fIX+1][fPadData[idCentral].fIY][0];
+    
+      if(fPadData[idRight].fIY==0)
+       idLower = 0;
+      else
+       idLower = fGetIdTotalData[fPadData[idRight].fIX][fPadData[idRight].fIY-1][0];
+      
+      if(fPadData[idRight].fIY==236)
+       idUpper = 0;
+      else
+       idUpper = fGetIdTotalData[fPadData[idRight].fIX][fPadData[idRight].fIY+1][0];
+  
+//       if(fPadData[idRight].fIY==1)
+//     idLower1 = 0;
+//       else
+//     idLower1 = fGetIdTotalData[fPadData[idRight].fIX][fPadData[idRight].fIY-2][0];
+      
+//       if(fPadData[idRight].fIY==235)
+//     idUpper1 = 0;
+//       else
+//     idUpper1 = fGetIdTotalData[fPadData[idRight].fIX][fPadData[idRight].fIY+2][0];
+
+      fTotChargeY[b] += (fPadData[idRight].fCharge + fPadData[idUpper].fCharge + fPadData[idLower].fCharge);
+//                      + fPadData[idUpper1].fCharge + fPadData[idLower1].fCharge) ;
+
+      if(fPadData[idLower].fCharge>0)
+       fNofBChannel[b]++ ;
+      if(fPadData[idRight].fCharge>0)
+       fNofBChannel[b]++ ;
+      if(fPadData[idUpper].fCharge>0)
+       fNofBChannel[b]++ ;
+
+    }
+    //////////////////////////////////////////////////////////////////////////////////
+
+
+    HLTDebug("lower : %d, middle : %d, upper : %d, nofChannel : %d",fPadData[idLower].fCharge,
+           fPadData[idCentral].fCharge,fPadData[idUpper].fCharge,fNofBChannel[b]);
 
     HLTDebug("RecY[%d] : %f",b,fRecY[b]);
   }
@@ -622,6 +822,17 @@ void AliHLTMUONHitReconstructor::RecXRecY()
     else
       idRight = fGetIdTotalData[fPadData[idCentral].fIX+1][fPadData[idCentral].fIY][1];
 
+    if(fPadData[idCentral].fIX==1)
+      idLeft1 = 0;
+    else
+      idLeft1 = fGetIdTotalData[fPadData[idCentral].fIX-2][fPadData[idCentral].fIY][1];
+    
+    if(fPadData[idCentral].fIX==334)
+      idRight1 = 0 ;
+    else
+      idRight1 = fGetIdTotalData[fPadData[idCentral].fIX+2][fPadData[idCentral].fIY][1];
+    
+
     fRecX[nb] = (fPadData[idCentral].fRealX*fPadData[idCentral].fCharge
                 +
                 fPadData[idRight].fRealX*fPadData[idRight].fCharge
@@ -631,8 +842,8 @@ void AliHLTMUONHitReconstructor::RecXRecY()
     
 
     fAvgChargeX[nb] = (fPadData[idCentral].fCharge + fPadData[idRight].fCharge + fPadData[idLeft].fCharge)/3.0 ;
-    
-    
+    fTotChargeX[nb] = (fPadData[idCentral].fCharge + fPadData[idRight].fCharge + fPadData[idLeft].fCharge);
+//                    + fPadData[idRight1].fCharge + fPadData[idLeft1].fCharge) ;
     fNofNBChannel[nb] = 0;
     if(fPadData[idLeft].fCharge>0)
       fNofNBChannel[nb]++ ;
@@ -641,13 +852,85 @@ void AliHLTMUONHitReconstructor::RecXRecY()
     if(fPadData[idRight].fCharge>0)
       fNofNBChannel[nb]++ ;
 
-    HLTDebug("detelem : %d:--(charge,pos) left[%d] : (%d,%f), middle[%d] : (%d,%f), right[%d] : (%d,%f), nofChannel : %d",
-            fPadData[idLeft].fDetElemId,
-            idLeft, fPadData[idLeft].fCharge, fPadData[idLeft].fRealX,
-            idCentral, fPadData[idCentral].fCharge, fPadData[idCentral].fRealX,
-            idRight, fPadData[idRight].fCharge, fPadData[idRight].fRealX,
-            fNofNBChannel[nb]
-    );
+    // lower row 
+    if((fPadData[idCentral].fIY-1)>=0){
+
+      idLower = fGetIdTotalData[fPadData[idCentral].fIX][fPadData[idCentral].fIY-1][1];
+      
+      if(fPadData[idLower].fIX==0)
+       idLeft = 0;
+      else
+       idLeft = fGetIdTotalData[fPadData[idLower].fIX-1][fPadData[idLower].fIY][1];
+    
+      if(fPadData[idLower].fIX==335)
+       idRight = 0 ;
+      else
+       idRight = fGetIdTotalData[fPadData[idLower].fIX+1][fPadData[idLower].fIY][1];
+
+//       if(fPadData[idLower].fIX==1)
+//     idLeft1 = 0;
+//       else
+//     idLeft1 = fGetIdTotalData[fPadData[idLower].fIX-2][fPadData[idLower].fIY][1];
+      
+//       if(fPadData[idLower].fIX==334)
+//     idRight1 = 0 ;
+//       else
+//     idRight1 = fGetIdTotalData[fPadData[idLower].fIX+2][fPadData[idLower].fIY][1];
+      
+      fTotChargeX[nb] += (fPadData[idLower].fCharge + fPadData[idRight].fCharge + fPadData[idLeft].fCharge);
+//                       + fPadData[idRight1].fCharge + fPadData[idLeft1].fCharge) ;
+
+      if(fPadData[idLeft].fCharge>0)
+       fNofNBChannel[nb]++ ;
+      if(fPadData[idLower].fCharge>0)
+       fNofNBChannel[nb]++ ;
+      if(fPadData[idRight].fCharge>0)
+       fNofNBChannel[nb]++ ;
+
+    }
+    ////////////////////////////////////////////////////////////
+
+    // Upper row
+    if((fPadData[idCentral].fIY+1)<=236){
+
+      idUpper = fGetIdTotalData[fPadData[idCentral].fIX][fPadData[idCentral].fIY+1][1];
+
+      if(fPadData[idUpper].fIX==0)
+       idLeft = 0;
+      else
+       idLeft = fGetIdTotalData[fPadData[idUpper].fIX-1][fPadData[idUpper].fIY][1];
+      
+      if(fPadData[idUpper].fIX==335)
+       idRight = 0 ;
+      else
+       idRight = fGetIdTotalData[fPadData[idUpper].fIX+1][fPadData[idUpper].fIY][1];
+      
+//       if(fPadData[idUpper].fIX==1)
+//     idLeft1 = 0;
+//       else
+//     idLeft1 = fGetIdTotalData[fPadData[idUpper].fIX-2][fPadData[idUpper].fIY][1];
+      
+//       if(fPadData[idUpper].fIX==334)
+//     idRight1 = 0 ;
+//       else
+//     idRight1 = fGetIdTotalData[fPadData[idUpper].fIX+2][fPadData[idUpper].fIY][1];
+
+      fTotChargeX[nb] += (fPadData[idUpper].fCharge + fPadData[idRight].fCharge + fPadData[idLeft].fCharge);
+//                       + fPadData[idRight1].fCharge + fPadData[idLeft1].fCharge) ;
+
+      if(fPadData[idLeft].fCharge>0)
+       fNofNBChannel[nb]++ ;
+      if(fPadData[idRight].fCharge>0)
+       fNofNBChannel[nb]++ ;
+      if(fPadData[idRight].fCharge>0)
+       fNofNBChannel[nb]++ ;
+
+    }
+    ////////////////////////////////////////////////////////////
+
+
+    HLTDebug("left : %d, middle : %d, right : %d, nofChannel : %d",fPadData[idLeft].fCharge,
+           fPadData[idCentral].fCharge,fPadData[idRight].fCharge,fNofNBChannel[nb]);
 
     HLTDebug("RecX[%d] : %f",nb,fRecX[nb]);
 
@@ -663,6 +946,8 @@ bool AliHLTMUONHitReconstructor::MergeRecHits()
   assert( fRecY != NULL );
   assert( fAvgChargeX != NULL );
   assert( fAvgChargeY != NULL );
+  assert( fTotChargeX != NULL );
+  assert( fTotChargeY != NULL );
   assert( fNofBChannel != NULL );
   assert( fNofNBChannel != NULL );
 
@@ -803,16 +1088,46 @@ bool AliHLTMUONHitReconstructor::MergeRecHits()
            fRecPoints[(*fRecPointsCount)].fX = fRecX[nb];
            fRecPoints[(*fRecPointsCount)].fY = fRecY[b];
            fRecPoints[(*fRecPointsCount)].fZ = fPadData[idCentralB].fRealZ;
+           
+           if (fGenerateClusterInfo)
+           {
+             if (fClusterCount >= fMaxClusters)
+             {
+               HLTError("Ran out of space in internal cluster array of size %d.", fMaxClusters);
+               return false;
+             }
+             
+             fClusters[fClusterCount].fId = (fNewClusterId << 5) | fDDL;
+             
+             // Increment the cluster ID and warp it around at 0x03FFFFFF since
+             // the bottom 5 bits are filled with the source DDL number and the
+             // sign bit in fClusters[fClusterCount].fId must be positive.
+             fNewClusterId = (fNewClusterId + 1) & 0x03FFFFFF;
+             
+             fClusters[fClusterCount].fHit = fRecPoints[(*fRecPointsCount)];
+             fClusters[fClusterCount].fDetElemId = fPadData[idCentralB].fDetElemId;
+             fClusters[fClusterCount].fNchannels = (fNofBChannel[b] + fNofNBChannel[nb]);
+             fClusters[fClusterCount].fCharge = (fTotChargeX[nb] + fTotChargeY[b]);
+             fClusterCount++;
+           }
+           
+           if (fGenerateChannelInfo)
+           {
+             //TODO: need to complete the code to generate channels data
+             //fChannels[fChannelCount].fClusterId = fGenerateClusterInfo ? fClusters[fClusterCount].fId : -1;
+             //fChannels[fChannelCount].fBusPatch = ;
+             //fChannels[fChannelCount].fManu = ;
+             //fChannels[fChannelCount].fChannelAddress = ;
+             //fChannels[fChannelCount].fSignal = ;
+             //fChannels[fChannelCount].fRawDataWord = ;
+             //fChannelCount++;
+           }
+
            HLTDebug("Reconstructed hit (X,Y,Z) : (%f,%f,%f)",
                      fRecPoints[(*fRecPointsCount)].fX,
                      fRecPoints[(*fRecPointsCount)].fY,
                      fRecPoints[(*fRecPointsCount)].fZ
             );
-//         fRecPoints[(*fRecPointsCount)].fXCenter = fPadData[idCentralNB].fRealX;
-//         fRecPoints[(*fRecPointsCount)].fYCenter = fPadData[idCentralB].fRealY;
-//         fRecPoints[(*fRecPointsCount)].fNofBChannel = fNofBChannel[b];
-//         fRecPoints[(*fRecPointsCount)].fNofNBChannel = fNofNBChannel[nb];
-//         fRecPoints[(*fRecPointsCount)].fDetElemId = (AliHLTUInt32_t)fPadData[idCentralB].fDetElemId;
            (*fRecPointsCount)++;
          }//if lies wihtin 5.0 mm
        }// condn over fRecX ! = 0.0
@@ -857,6 +1172,7 @@ AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::AliHLTMUONRawDecoder() :
        fNofFiredDetElem(NULL),
        fMaxFiredPerDetElem(NULL),
        fIdToEntry(),
+       fMaxEntryPerBusPatch(),
        fDataCount(1),
        fPrevDetElemId(0),
        fPadCharge(0),
@@ -867,7 +1183,8 @@ AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::AliHLTMUONRawDecoder() :
        fSkipParityErrors(false),
        fDontPrintParityErrors(false),
        fPrintParityErrorAsWarning(false),
-       fNonParityErrorFound(false)
+       fNonParityErrorFound(false),
+       fIsMuchNoisy(false)
 {
        // ctor
 }
@@ -929,6 +1246,8 @@ void AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::OnData(UInt_t dataWord, b
 
   if (fSkipParityErrors and parityError) return;
 
+  if(fIsMuchNoisy) return;
+
   fIdManuChannel = 0x0;
   fIdManuChannel = (fIdManuChannel|fBusPatchId)<<17;
   fIdManuChannel |= (dataWord >> 12) & 0x1FFFF;
@@ -943,7 +1262,7 @@ void AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::OnData(UInt_t dataWord, b
   fPadCharge = int(((unsigned short)(dataWord & 0xFFF)) - fLookUpTableData[fLutEntry].fPed);
   
   fCharge = 0;   
-  if(fPadCharge > fDCCut && fPadCharge > 5.0*fLookUpTableData[fLutEntry].fSigma){  // (charge > 4) is due cut out the noise level                      
+  if(fPadCharge > 5.0*fLookUpTableData[fLutEntry].fSigma){  // (charge > 4) is due cut out the noise level                     
       
     fPadData[fDataCount].fDetElemId = fLookUpTableData[fLutEntry].fDetElemId;
     fPadData[fDataCount].fIX = fLookUpTableData[fLutEntry].fIX;
@@ -978,15 +1297,12 @@ void AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::OnData(UInt_t dataWord, b
       fPrevDetElemId =  fLookUpTableData[fLutEntry].fDetElemId ;
     }
     
-    HLTDebug("LUT address: %p, lutEntry : %d, buspatch : %d, detElem : %d, id : %d, manu : %d,"
-              " channel : %d, iX : %d, iY: %d, (X,Y) : (%f, %f), charge : %d, padsize : %f, plane : %d",
-             fLookUpTableData, fLutEntry, fBusPatchId, fPadData[fDataCount].fDetElemId,
-             fIdManuChannel, ((dataWord >> 18) & 0x7FF), ((dataWord >> 12) & 0x3F),
-             fPadData[fDataCount].fIX, fPadData[fDataCount].fIY,
-             fPadData[fDataCount].fRealX, fPadData[fDataCount].fRealY,
-             fPadData[fDataCount].fCharge, fPadData[fDataCount].fHalfPadSize,
-             fPadData[fDataCount].fPlane
-    );
+    HLTDebug("%x, fLutEntry : %d, buspatch : %d, detele : %d, id : %d, manu : %d, channel : %d, iX : %d, iY: %d, (X,Y) : (%f, %f, %f), charge : %f, padsize : %f, plane : %d, ped : %f, sigma : %f",
+            fLookUpTableData,fLutEntry,fBusPatchId,fPadData[fDataCount].fDetElemId,
+            fIdManuChannel,((dataWord >> 18) & 0x7FF),((dataWord >> 12) & 0x3F),
+            fPadData[fDataCount].fIX,fPadData[fDataCount].fIY,
+            fPadData[fDataCount].fRealX,fPadData[fDataCount].fRealY,fPadData[fDataCount].fRealZ,
+            fPadData[fDataCount].fCharge,fLookUpTableData[fLutEntry].fHalfPadSize,fPadData[fDataCount].fPlane,fLookUpTableData[fLutEntry].fPed,fLookUpTableData[fLutEntry].fSigma);
     
     fDataCount++;
   }// if charge is more than DC Cut limit condition
index c729819..9d91386 100644 (file)
 
 
 extern "C" struct AliHLTMUONRecHitStruct;
-
-//TODO: Change code to not use std::map to avoid too many AliRoot coding rule violations.
+extern "C" struct AliHLTMUONClusterStruct;
+extern "C" struct AliHLTMUONChannelStruct;
 typedef std::map<AliHLTInt32_t, AliHLTInt32_t> IdManuChannelToEntry;
-
+typedef IdManuChannelToEntry MaxEntryPerBusPatch;
 
 class AliHLTMUONHitReconstructor : public AliHLTLogging
 {
@@ -50,7 +50,8 @@ public:
        
        void SetLookUpTable(
                        const AliHLTMUONHitRecoLutRow* lookupTable,
-                       const IdManuChannelToEntry* idToEntry
+                       const IdManuChannelToEntry* idToEntry,
+                       const MaxEntryPerBusPatch* maxEntryPerBP
                );
        
        void SetDCCut(AliHLTInt32_t dcCut) { fDCCut = dcCut; }
@@ -63,6 +64,32 @@ public:
                        AliHLTUInt32_t& nofHit
                );
        
+       /**
+        * Fills the output clusters array with the extra cluster information generated.
+        * If the method GenerateClusterInfo(true) was not called, then no cluster information
+        * is generated and this method will not do anything.
+        * [out] \param clusters  This is the output array that will be filled.
+        * [in/out] \param nofClusters Initially this contains the maximum number of elements
+        *     that can be stored in the clusters array. The method will fill this with
+        *     the actual number of elements stored.
+        * \returns true if all elements were copied and false if there is not enough space in
+        *     the output array.
+        */
+       bool FillClusterData(AliHLTMUONClusterStruct* clusters, AliHLTUInt32_t& nofClusters);
+       
+       /**
+        * Fills the output channels array with the extra channel information generated.
+        * If the method GenerateChannelInfo(true) was not called, then no extra channel
+        * information is generated and this method will not do anything.
+        * [out] \param channels  This is the output array that will be filled.
+        * [in/out] \param nofChannels Initially this contains the maximum number of elements
+        *     that can be stored in the channels array. The method will fill this with
+        *     the actual number of elements stored.
+        * \returns true if all elements were copied and false if there is not enough space in
+        *     the output array.
+        */
+       bool FillChannelData(AliHLTMUONChannelStruct* channels, AliHLTUInt32_t& nofChannels);
+       
        static AliHLTInt32_t GetkDetectorId() { return fgkDetectorId; }
        static AliHLTInt32_t GetkDDLOffSet() { return fgkDDLOffSet; }
        static AliHLTInt32_t GetkNofDDL() { return fgkNofDDL; }
@@ -96,6 +123,33 @@ public:
        
        /// Sets the flag indicating if messages about parity errors are not printed.
        void DontPrintParityErrors(bool value) { fHLTMUONDecoder.GetHandler().DontPrintParityErrors(value); }
+       
+       /// Returns true if the extra cluster information should be generated.
+       bool GenerateClusterInfo() const { return fGenerateClusterInfo; }
+       
+       /// Sets the flag to indicate if the extra cluster information should be generated.
+       void GenerateClusterInfo(bool value) { fGenerateClusterInfo = value; }
+       
+       /// Returns true if the extra channel information should be generated.
+       bool GenerateChannelInfo() const { return fGenerateChannelInfo; }
+       
+       /// Sets the flag to indicate if the extra channel information should be generated.
+       void GenerateChannelInfo(bool value) { fGenerateChannelInfo = value; }
+       
+       /// Returns the maximum channel multiplicity allowed per cluster.
+       bool MaxChannelMultiplicity() const { return fMaxChannelMult; }
+       
+       /// Sets the maximum channel multiplicity allowed per cluster.
+       /// \note This effects the memory allocation required. Generally M*N number of
+       ///   channel structures will be allocated, where M = fMaxChannelMult and
+       ///   N = the maximum number of hits that can be filled into the output buffers.
+       void MaxChannelMultiplicity(bool value) { fMaxChannelMult = value; }
+       
+       /// Returns the DDL number the component expects data to be received from.
+       AliHLTInt32_t DDLNumber() const { return fDDL; }
+       
+       /// Sets the DDL number the component expects data to be received from.
+       void DDLNumber(AliHLTInt32_t value) { fDDL = (value & 0x1F); }  // 0x1F forces value into our required range.
 
 private:
 
@@ -133,7 +187,13 @@ private:
                void OnData(UInt_t dataWord, bool /*parityError*/);
                void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/) 
                {
-                       fBusPatchId = int(header->fBusPatchId);
+                 fBusPatchId = int(header->fBusPatchId);
+                 MaxEntryPerBusPatch& maxEntryPerBusPatch 
+                   = * const_cast<MaxEntryPerBusPatch*>(fMaxEntryPerBusPatch);
+                 fIsMuchNoisy = false;
+                 if(AliHLTInt32_t(header->fLength)> maxEntryPerBusPatch[fBusPatchId])
+                   fIsMuchNoisy = true;
+                 
                };
                
                void OnNewBuffer(const void* buffer, UInt_t bufferSize);
@@ -144,6 +204,7 @@ private:
                void SetLookUpTable(const AliHLTMUONHitRecoLutRow* lookUpTableData) {fLookUpTableData = lookUpTableData;}
                void SetNofFiredDetElemId(AliHLTInt32_t& nofFiredDetElem) {fNofFiredDetElem = &nofFiredDetElem;}
                void SetIdManuChannelToEntry(const IdManuChannelToEntry* idToEntry) {fIdToEntry = idToEntry;}
+               void SetMaxEntryPerBusPatch(const MaxEntryPerBusPatch* maxEntryPerBP) {fMaxEntryPerBusPatch = maxEntryPerBP;}
                void SetMaxFiredPerDetElem(AliHLTInt32_t* maxFiredPerDetElem) {fMaxFiredPerDetElem = maxFiredPerDetElem;}
                
                AliHLTInt32_t GetDataCount() {return fDataCount;}
@@ -210,6 +271,7 @@ private:
                AliHLTInt32_t* fNofFiredDetElem;         // counter for detector elements that are fired 
                AliHLTInt32_t* fMaxFiredPerDetElem;      // array for detector elements that are fired 
                const IdManuChannelToEntry* fIdToEntry;  // Mapping between Linenumber to IdManuChannel;
+               const MaxEntryPerBusPatch* fMaxEntryPerBusPatch;   // Maximum allowed entry per Buspatch.
                
                AliHLTInt32_t fDataCount;           // Data Counter
                AliHLTInt32_t fPrevDetElemId;       // previous detection elementId
@@ -223,6 +285,8 @@ private:
                bool fDontPrintParityErrors;  ///< Flag for controlling if messages about parity errors should be printed.
                bool fPrintParityErrorAsWarning;  ///< Flag for controlling if parity error messages are printed as warnings.
                bool fNonParityErrorFound;  ///< Flag which indicates if a non parity error code was found after a decoding pass.
+
+              bool fIsMuchNoisy;  ///< tag for noisy buspatch.
        };
 
        AliMUONTrackerDDLDecoder<AliHLTMUONRawDecoder> fHLTMUONDecoder; // robust HLTMUON Decoder
@@ -240,16 +304,31 @@ private:
        AliHLTUInt32_t *fRecPointsCount;         // nof reconstructed hit.
        AliHLTUInt32_t fMaxRecPointsCount;       // max nof reconstructed hit.
        
+       AliHLTMUONClusterStruct* fClusters;  // Array of output cluster infromation.
+       AliHLTUInt32_t fClusterCount;       // Number of elemenets in fClusters.
+       AliHLTUInt32_t fMaxClusters;        // Maximum number of clusters in fClusters.
+       bool fGenerateClusterInfo;   // Flag indicating if extra cluster information should be generated.
+       AliHLTInt32_t fNewClusterId;  // The ID to use for a new cluster structure.
+       AliHLTInt32_t fDDL;   // The source DDL number of the raw data.
+       
+       AliHLTMUONChannelStruct* fChannels;  // Array of output channel infromation.
+       AliHLTUInt32_t fChannelCount;       // Number of elemenets in fChannels.
+       AliHLTUInt32_t fMaxChannels;        // Maximum number of channels in fChannels.
+       bool fGenerateChannelInfo;   // Flag indicating if extra channel information should be generated.
+       AliHLTUInt32_t fMaxChannelMult;  // Indicates the maximum channel multiplicity per cluster allowed.
+       
        AliHLTInt32_t fCentralCountB, fCentralCountNB;   // centeral hits.
        AliHLTInt32_t fDigitPerDDL;                      // Total nof Digits perDDL.
        
        AliHLTInt32_t *fCentralChargeB, *fCentralChargeNB;       // pointer to an array of central hit
        AliHLTFloat32_t *fRecX, *fRecY;                          // pointer to an array of reconstructed hit
        AliHLTFloat32_t *fAvgChargeX, *fAvgChargeY;              // average charge on central pad found using CG method
+       AliHLTFloat32_t *fTotChargeX, *fTotChargeY;              // Total charge in bending and nonbending direction
        AliHLTInt32_t *fNofBChannel, *fNofNBChannel;             // number of channels bending and non-bending.
        AliHLTInt32_t fGetIdTotalData[336][237][2];              // an array of idManuChannel with argument of centralX, centralY and planeType.
        AliHLTInt32_t fNofFiredDetElem,fMaxFiredPerDetElem[130];  // counter for detector elements that are fired
        const IdManuChannelToEntry* fIdToEntry;   // Mapping between Linenumber to IdManuChannel (The object is not owned by this component).
+       const MaxEntryPerBusPatch* fMaxEntryPerBusPatch;   // Maximum allowed entry per Buspatch.
        
        ERecoveryMode fRecoveryMode;  ///< The recovery mode for the decoder.
        
index 8a2be31..98fd165 100644 (file)
@@ -76,6 +76,7 @@ AliHLTMUONHitReconstructorComponent::AliHLTMUONHitReconstructorComponent() :
        fLutSize(0),
        fLut(NULL),
        fIdToEntry(),
+       fMaxEntryPerBusPatch(),
        fWarnForUnexpecedBlock(false),
        fUseIdealGain(false)
 {
@@ -173,6 +174,7 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
        // Initialise fields with default values then parse the command line.
        fDDL = -1;
        fIdToEntry.clear();
+       fMaxEntryPerBusPatch.clear();
        fWarnForUnexpecedBlock = false;
        fUseIdealGain = false;
        const char* lutFileName = NULL;
@@ -182,6 +184,8 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
        AliHLTInt32_t dccut = -1;
        bool skipParityErrors = false;
        bool dontPrintParityErrors = false;
+       bool makeClusters = false;
+       bool makeChannels = false;
        
        for (int i = 0; i < argc; i++)
        {
@@ -371,6 +375,18 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
                        fUseIdealGain = true;
                        continue;
                }
+               
+               if (strcmp( argv[i], "-makeclusters" ) == 0)
+               {
+                       makeClusters = true;
+                       continue;
+               }
+               
+               if (strcmp( argv[i], "-makechannels" ) == 0)
+               {
+                       makeChannels = true;
+                       continue;
+               }
        
                HLTError("Unknown option '%s'", argv[i]);
                return -EINVAL;
@@ -425,7 +441,7 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
                                FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
                                return result;
                        }
-                       fHitRec->SetLookUpTable(fLut, &fIdToEntry);
+                       fHitRec->SetLookUpTable(fLut, &fIdToEntry, &fMaxEntryPerBusPatch);
                }
        }
        else
@@ -438,7 +454,7 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
                        FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
                        return result;
                }
-               fHitRec->SetLookUpTable(fLut, &fIdToEntry);
+               fHitRec->SetLookUpTable(fLut, &fIdToEntry, &fMaxEntryPerBusPatch);
        }
        
        if (dccut == -1)
@@ -472,6 +488,9 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
        fHitRec->TryRecover(recoveryMode);
        fHitRec->SkipParityErrors(skipParityErrors);
        fHitRec->DontPrintParityErrors(dontPrintParityErrors);
+       fHitRec->GenerateClusterInfo(makeClusters);
+       fHitRec->GenerateChannelInfo(makeChannels);
+       fHitRec->DDLNumber(fDDL);
        HLTDebug("dHLT hit reconstruction component is initialized.");
        return 0;
 }
@@ -520,10 +539,10 @@ int AliHLTMUONHitReconstructorComponent::Reconfigure(
                }
                
                fIdToEntry.clear();
-       
+               fMaxEntryPerBusPatch.clear();   
                int result = ReadLutFromCDB();
                if (result != 0) return result;
-               fHitRec->SetLookUpTable(fLut, &fIdToEntry);
+               fHitRec->SetLookUpTable(fLut, &fIdToEntry, &fMaxEntryPerBusPatch);
        }
        
        if (cdbEntry == NULL or not startsWithMUON)
@@ -618,7 +637,7 @@ int AliHLTMUONHitReconstructorComponent::DoEvent(
                        int result = ReadLutFromCDB();
                        if (result != 0) return result;
                        
-                       fHitRec->SetLookUpTable(fLut, &fIdToEntry);
+                       fHitRec->SetLookUpTable(fLut, &fIdToEntry, &fMaxEntryPerBusPatch);
                }
                
                // Check that the DC cut was not already loaded in DoInit.
@@ -740,6 +759,88 @@ int AliHLTMUONHitReconstructorComponent::DoEvent(
 
                // Increase the total amount of data written so far to our output memory
                totalSize += block.BytesUsed();
+               
+               if (fHitRec->GenerateClusterInfo())
+               {
+                       // Create a new output clusters data block and initialise the header.
+                       AliHLTMUONClustersBlockWriter clustblock(outputPtr+totalSize, size-totalSize);
+                       if (not clustblock.InitCommonHeader())
+                       {
+                               HLTError("There is not enough space in the output buffer for the new clusters data block."
+                                       " We require at least %u bytes, but have %u bytes left.",
+                                       sizeof(AliHLTMUONClustersBlockWriter::HeaderType),
+                                       clustblock.BufferSize()
+                               );
+                               break;
+                       }
+                       
+                       AliHLTUInt32_t nofClusters = clustblock.MaxNumberOfEntries();
+                       bool filledOk = fHitRec->FillClusterData(clustblock.GetArray(), nofClusters);
+                       // nofClusters should now contain the number of clusters filled.
+                       assert( nofClusters <= clustblock.MaxNumberOfEntries() );
+                       clustblock.SetNumberOfEntries(nofClusters);
+                       
+                       // Fill a block data structure for our output block.
+                       AliHLTComponentBlockData bdc;
+                       FillBlockData(bdc);
+                       bdc.fPtr = outputPtr;
+                       // This block's start (offset) is after all other blocks written so far.
+                       bdc.fOffset = totalSize;
+                       bdc.fSize = clustblock.BytesUsed();
+                       bdc.fDataType = AliHLTMUONConstants::ClusterBlockDataType();
+                       bdc.fSpecification = blocks[n].fSpecification;
+                       outputBlocks.push_back(bdc);
+       
+                       // Increase the total amount of data written so far to our output memory
+                       totalSize += clustblock.BytesUsed();
+                       
+                       if (not filledOk)
+                       {
+                               HLTError("We have overflowed the output buffer space for the new clusters data block.");
+                               break;
+                       }
+               }
+               
+               if (fHitRec->GenerateChannelInfo())
+               {
+                       // Create a new output channels data block and initialise the header.
+                       AliHLTMUONChannelsBlockWriter channelblock(outputPtr+totalSize, size-totalSize);
+                       if (not channelblock.InitCommonHeader())
+                       {
+                               HLTError("There is not enough space in the output buffer for the new channels data block."
+                                       " We require at least %u bytes, but have %u bytes left.",
+                                       sizeof(AliHLTMUONChannelsBlockWriter::HeaderType),
+                                       channelblock.BufferSize()
+                               );
+                               break;
+                       }
+                       
+                       AliHLTUInt32_t nofChannels = channelblock.MaxNumberOfEntries();
+                       bool filledOk = fHitRec->FillChannelData(channelblock.GetArray(), nofChannels);
+                       // nofChannels should now contain the number of channels filled.
+                       assert( nofChannels <= channelblock.MaxNumberOfEntries() );
+                       channelblock.SetNumberOfEntries(nofChannels);
+                       
+                       // Fill a block data structure for our output block.
+                       AliHLTComponentBlockData bdc;
+                       FillBlockData(bdc);
+                       bdc.fPtr = outputPtr;
+                       // This block's start (offset) is after all other blocks written so far.
+                       bdc.fOffset = totalSize;
+                       bdc.fSize = channelblock.BytesUsed();
+                       bdc.fDataType = AliHLTMUONConstants::ChannelBlockDataType();
+                       bdc.fSpecification = blocks[n].fSpecification;
+                       outputBlocks.push_back(bdc);
+       
+                       // Increase the total amount of data written so far to our output memory
+                       totalSize += channelblock.BytesUsed();
+                       
+                       if (not filledOk)
+                       {
+                               HLTError("We have overflowed the output buffer space for the new channels data block.");
+                               break;
+                       }
+               }
        }
        // Finally we set the total size of output memory we consumed.
        size = totalSize;
@@ -768,6 +869,7 @@ void AliHLTMUONHitReconstructorComponent::FreeMemory()
        }
        
        fIdToEntry.clear();
+       fMaxEntryPerBusPatch.clear();
 }
 
 
@@ -780,6 +882,7 @@ int AliHLTMUONHitReconstructorComponent::ReadLookUpTable(const char* lutFileName
        assert( fLut == NULL );
        assert( fLutSize == 0 );
        assert( fIdToEntry.empty() );
+       assert( fMaxEntryPerBusPatch.empty() );
        
        std::ifstream file(lutFileName);
        if (not file.good())
@@ -844,7 +947,7 @@ int AliHLTMUONHitReconstructorComponent::ReadLookUpTable(const char* lutFileName
                return -EIO;
        }
        
-       AliHLTInt32_t idManuChannel;
+       AliHLTInt32_t idManuChannel,buspatchId;
        for (AliHLTUInt32_t i = 1; i < fLutSize; i++)
        {
                if (std::getline(file, str).fail())
@@ -868,8 +971,18 @@ int AliHLTMUONHitReconstructorComponent::ReadLookUpTable(const char* lutFileName
                        HLTError("Line %d in LUT file %s does not contain 15 elements.", i, lutFileName);
                        return -EIO;
                }
-               
+               buspatchId = (idManuChannel>>17) & 0x7FF;
                fIdToEntry[idManuChannel] = i;
+               fMaxEntryPerBusPatch[buspatchId] = fMaxEntryPerBusPatch[buspatchId] + 1;  
+               
+       }
+
+       MaxEntryPerBusPatch::iterator it;
+       for(it=fMaxEntryPerBusPatch.begin();it!=fMaxEntryPerBusPatch.end();it++){
+         HLTDebug("fMaxEntryPerBusPatch[%d] : %d",it->first,it->second);
+         fMaxEntryPerBusPatch[it->first] = AliHLTInt32_t(0.05*(it->second));///< for 10% occupancy 
+         HLTDebug("fMaxEntryPerBusPatch[%d] : %d",it->first,it->second);
+         
        }
        
        return 0;
@@ -886,6 +999,7 @@ int AliHLTMUONHitReconstructorComponent::ReadLutFromCDB()
        assert( fLut == NULL );
        assert( fLutSize == 0 );
        assert( fIdToEntry.empty() );
+       assert( fMaxEntryPerBusPatch.empty() );
        
        if (fDDL == -1)
        {
@@ -1043,7 +1157,8 @@ int AliHLTMUONHitReconstructorComponent::ReadLutFromCDB()
                                                halfPadSize = padSizeY;
                                        
                                        fIdToEntry[idManuChannel] = iEntry+1;
-                       
+                                       fMaxEntryPerBusPatch[buspatchId] = fMaxEntryPerBusPatch[buspatchId] + 1;  
+                                       
                                        lut.fDetElemId = detElemId;
                                        lut.fIX = iX;
                                        lut.fIY = iY;
@@ -1103,7 +1218,15 @@ int AliHLTMUONHitReconstructorComponent::ReadLutFromCDB()
        
        for (AliHLTUInt32_t i = 0; i < iEntry; i++)
                fLut[i+1] = lutList[i];
-       
+       lutList.clear();
+
+       MaxEntryPerBusPatch::iterator it;
+       for(it=fMaxEntryPerBusPatch.begin();it!=fMaxEntryPerBusPatch.end();it++){
+         HLTDebug("fMaxEntryPerBusPatch[%d] : %d",it->first,it->second);
+         fMaxEntryPerBusPatch[it->first] = AliHLTInt32_t(0.05*(it->second));///< for 10% occupancy 
+         HLTDebug("fMaxEntryPerBusPatch[%d] : %d",it->first,it->second);
+       }
+
        return 0;
 }
 
index 07aacf7..77d48a6 100644 (file)
@@ -105,6 +105,12 @@ extern "C" struct AliHLTMUONHitRecoLutRow;
  * \li -useidealgain <br>
  *      When this option is used then the gain correction parameters are not loaded
  *      from the CDB but ideal linear gain is assumed. <br>
+ * \li -makeclusters <br>
+ *      This option will cause the component to generate extra cluster information
+ *      in the form of CLUSTERS data blocks. <br>
+ * \li -makechannels <br>
+ *      This option will cause the component to generate extra channel information
+ *      for each cluster found in the form of CHANNELS data blocks. <br>
  *
  * <h2>Standard configuration:</h2>
  * This component should normally be configured with either of the two sets of
@@ -199,6 +205,7 @@ private:
        AliHLTUInt32_t fLutSize;  ///< The number of rows / entries in the LUT.
        AliHLTMUONHitRecoLutRow* fLut;  ///< The lookup table used by the hit reconstruction algorithm (Owned by this component however).
        IdManuChannelToEntry fIdToEntry; ///< id to line mapping.
+       MaxEntryPerBusPatch fMaxEntryPerBusPatch ;///< map to load maximum allowed buspatch entries for each buspatch
        bool fWarnForUnexpecedBlock;  ///< Flag indicating if we should log a warning if we got a block of an unexpected type.
        bool fUseIdealGain;  ///< Flag to indicate that ideal gain should be used and not loaded from the CDB.
        
index 5e5975c..3c3fc3d 100644 (file)
@@ -254,6 +254,8 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
        /// Here we go through the list of input data blocks and apply extensive
        /// data integrity checking on the data found.
        
+       if (not IsDataEvent()) return 0;
+       
        HLTDebug("Processing event %llu with %u input data blocks.",
                evtData.fEventID, evtData.fBlockCnt
        );
@@ -311,6 +313,10 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
                return -ENOMEM;
        }
        
+       AliHLTComponentDataType anyPrivateType = AliHLTComponentDataTypeInitializer(
+                       kAliHLTAnyDataType, kAliHLTDataOriginPrivate
+               );
+       
        try
        {
                // Clear all the flags indicating if the blocks are ok.
@@ -329,7 +335,7 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
                        
                        if (fIgnoreType)
                        {
-                               // Decode the block type of we must ignore the block type
+                               // Decode the block type if we must ignore the block type
                                // as given by the HLT framework.
                                if (blocks[n].fSize >= sizeof(AliHLTMUONDataBlockHeader))
                                {
@@ -340,7 +346,13 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
                        }
                        else
                        {
-                               if (blocks[n].fDataType == AliHLTMUONConstants::DDLRawDataType())
+                               if (blocks[n].fDataType == anyPrivateType)
+                               {
+                                       // Completely ignore any private HLT internal block types.
+                                       blockOk[n] = true;
+                                       continue;
+                               }
+                               else if (blocks[n].fDataType == AliHLTMUONConstants::DDLRawDataType())
                                {
                                        blockOk[n] = CheckRawDataBlock(blocks[n], n);
                                        continue;
@@ -2032,7 +2044,7 @@ bool AliHLTMUONDataCheckerComponent::CheckTrigRecsDebugBlock(
                        }
                        
                        if (fIgnoreSpec) continue;
-                       if (0 <= de->GetDdlId() and de->GetDdlId() < 22 and ddl[de->GetDdlId()])
+                       if (0 <= de->GetDdlId() and de->GetDdlId() < 22 and not ddl[de->GetDdlId()])
                        {
                                HLTError("Problem found with data block %d, fDataType = '%s',"
                                         " fPtr = %p and fSize = %u bytes."
@@ -2228,7 +2240,7 @@ bool AliHLTMUONDataCheckerComponent::CheckClustersBlock(
                        // Make sure the corresponding DDL bit is set in the data
                        // block specification.
                        if (fIgnoreSpec) continue;
-                       if (0 <= de->GetDdlId() and de->GetDdlId() < 22 and ddl[de->GetDdlId()])
+                       if (0 <= de->GetDdlId() and de->GetDdlId() < 22 and not ddl[de->GetDdlId()])
                        {
                                HLTError("Problem found with data block %d, fDataType = '%s',"
                                         " fPtr = %p and fSize = %u bytes."
@@ -2249,6 +2261,26 @@ bool AliHLTMUONDataCheckerComponent::CheckClustersBlock(
                                );
                                result = false;
                        }
+                       
+                       // Check that the total cluster charge is a reasonable value.
+                       if (cluster.fCharge < 0 and 1e4 < cluster.fCharge)
+                       {
+                               HLTError("Problem found with data block %d, fDataType = '%s',"
+                                        " fPtr = %p and fSize = %u bytes."
+                                        " Assuming this is a %s data block."
+                                        " Problem: The total charge %f for the cluster"
+                                        " %d is not in a reasonable range [0..1e4].",
+                                       blockNumber,
+                                       DataType2Text(block.fDataType).c_str(),
+                                       block.fPtr,
+                                       block.fSize,
+                                       name,
+                                       cluster.fCharge,
+                                       i
+                               );
+                               result = false;
+                               continue;
+                       }
                }
        }
        else
@@ -3227,7 +3259,7 @@ void AliHLTMUONDataCheckerComponent::MakeGlobalChecks(
                        
                        if (inblocki[i].fNchannels != count)
                        {
-                               HLTError("Problem found with cluster data block %d,"
+                               HLTWarning("Problem found with cluster data block %d,"
                                        " fDataType = '%s', fPtr = %p and fSize = %u bytes."
                                        " Problem with entry %d in block: The number of"
                                        " channels in the cluster is reported as %d, but"
index ce323ce..9592885 100644 (file)
@@ -1524,8 +1524,12 @@ int DumpClusterStruct(
        cout << "Detector Element ID: " << cluster->fDetElemId << endl;
 
        result = CheckField(cluster->fNchannels, buffer, bufferSize, continueParse);
-       if(result != EXIT_SUCCESS) return result;
+       if (result != EXIT_SUCCESS) return result;
        cout << " Number of channels: " << cluster->fNchannels << endl;
+       
+       result = CheckField(cluster->fCharge, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "       Total charge: " << cluster->fCharge << endl;
 
        cout << "Corresponding Hit: "<< endl;
        cout << "Chamber | DetElemID | X (cm)     | Y (cm)     | Z (cm)" << endl;
@@ -1553,8 +1557,8 @@ int DumpClustersBlock(
        const AliHLTMUONClusterStruct* entry = block.GetArray();
        for(AliHLTUInt32_t i = 0; i < nentries; i++)
        {
-               cout << " ===================================================== Cluster Number "
-                       << i+1 << "==================================================" << endl; 
+               cout << "===================================================== Cluster Number "
+                       << i+1 << " ==================================================" << endl;
                int subResult = DumpClusterStruct(buffer, bufferSize, entry++, continueParse);
                if (subResult != EXIT_SUCCESS) return subResult;
        }