]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding component to generate histograms for clusters.
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Nov 2009 11:07:55 +0000 (11:07 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Nov 2009 11:07:55 +0000 (11:07 +0000)
Also updating ESD convertion to include MUON data.

15 files changed:
HLT/MUON/AliHLTMUONConstants.cxx
HLT/MUON/AliHLTMUONConstants.h
HLT/MUON/AliHLTMUONLinkDef.h
HLT/MUON/Makefile.am
HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx
HLT/MUON/OfflineInterface/AliHLTMUONESDMaker.cxx
HLT/MUON/OfflineInterface/AliHLTMUONESDMaker.h
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx
HLT/MUON/macros/CreateHitRecoLookupTables.C
HLT/MUON/macros/RunChain.C
HLT/MUON/utils/AliHLTMUONClusterHistoComponent.cxx [new file with mode: 0644]
HLT/MUON/utils/AliHLTMUONClusterHistoComponent.h [new file with mode: 0644]
HLT/global/AliHLTGlobalEsdConverterComponent.cxx
HLT/libAliHLTMUON.pkg

index 6a7f7216aa94a569979eb4602836df89a7ca786c..51edf3da532a2f7cabcf463475be85442cbfc2db 100644 (file)
@@ -155,6 +155,7 @@ const char* AliHLTMUONConstants::fgkEmptyEventFilterComponentId = "MUONEmptyEven
 const char* AliHLTMUONConstants::fgkDataCheckerComponentId = "MUONDataChecker";
 const char* AliHLTMUONConstants::fgkClusterFinderId = "MUONClusterFinder";
 const char* AliHLTMUONConstants::fgkRawDataHistogrammerId = "MUONRawDataHistogrammer";
+const char* AliHLTMUONConstants::fgkClusterHistogrammerId = "MUONClusterHistogrammer";
 
 const char* AliHLTMUONConstants::fgkTriggerReconstructorCDBPath = "HLT/ConfigMUON/TriggerReconstructor";
 const char* AliHLTMUONConstants::fgkHitReconstructorCDBPath = "HLT/ConfigMUON/HitReconstructor";
index 955ba492e23225c70e66b97313eb17c5fdebd6f4..e01579340e99060c0210fe099bc3d114195ac732 100644 (file)
@@ -247,6 +247,11 @@ public:
        {
                return fgkRawDataHistogrammerId;
        }
+
+       static const char* ClusterHistogrammerId()
+       {
+               return fgkClusterHistogrammerId;
+       }
        
        static const char* TriggerReconstructorCDBPath()
        {
@@ -331,6 +336,7 @@ private:
        static const char* fgkDataCheckerComponentId; // Name of data checking component for debugging.
        static const char* fgkClusterFinderId; // Name of cluster finder implementing offline algorithms.
        static const char* fgkRawDataHistogrammerId; // Raw data histogrammer component name.
+       static const char* fgkClusterHistogrammerId; // Cluster data histogrammer component name.
        
        // CDB path entries to configuration information.
        static const char* fgkTriggerReconstructorCDBPath; // Path to CDB entry for the trigger reconstruction component.
index f552d096e00d6198759356e62a89bdcd9f76ec8b..53c938d6960d46111ea02c351bb4951791755151 100644 (file)
@@ -62,5 +62,6 @@
 #pragma link C++ class AliHLTMUONDataCheckerComponent+;
 #pragma link C++ class AliHLTMUONClusterFinderComponent+;
 #pragma link C++ class AliHLTMUONRawDataHistoComponent+;
+#pragma link C++ class AliHLTMUONClusterHistoComponent+;
 
 #endif // __CINT__
index 7b6f974221b42ee624adc1c2c919b839b54e837e..556b481a17ebced9214d13122c02c77308807a87 100644 (file)
@@ -11,7 +11,7 @@ include $(top_srcdir)/libAliHLTMUON.pkg
 
 lib_LTLIBRARIES                        =  libAliHLTMUON.la
 
-LIBRARY_VERSION                        = '2:0:0'
+LIBRARY_VERSION                        = '3:0:0'
 
 # library sources
 # The source files are specified in libAliHLTMUON.pkg
index 82f3147b71d753f40aecf1246d601abc5ffe6f0a..5f765a1d758084c276a940cf622f83e8a177eada 100644 (file)
@@ -37,6 +37,7 @@
 #include "AliHLTMUONDataCheckerComponent.h"
 #include "AliHLTMUONClusterFinderComponent.h"
 #include "AliHLTMUONRawDataHistoComponent.h"
+#include "AliHLTMUONClusterHistoComponent.h"
 #include "AliHLTOUTHandlerChain.h"
 #include "AliRawReader.h"
 #include "AliRunLoader.h"
@@ -387,6 +388,7 @@ int AliHLTMUONAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
        pHandler->AddComponent(new AliHLTMUONDataCheckerComponent);
        pHandler->AddComponent(new AliHLTMUONClusterFinderComponent);
        pHandler->AddComponent(new AliHLTMUONRawDataHistoComponent);
+       pHandler->AddComponent(new AliHLTMUONClusterHistoComponent);
        return 0;
 }
 
index e674377e524ee44280fcef44cdcde98a4f8ad124..184ba9dd3c0ff07f376ec76f74c3e63300139f28 100644 (file)
@@ -41,6 +41,7 @@
 #include "AliESDMuonTrack.h"
 #include "AliESDMuonCluster.h"
 #include "TClonesArray.h"
+#include "TList.h"
 #include <cmath>
 #include <cassert>
 
@@ -52,7 +53,9 @@ AliHLTMUONESDMaker::AliHLTMUONESDMaker() :
        AliHLTMUONProcessor(),
        fWarnForUnexpecedBlock(false),
        fMakeMinimalESD(false),
-       fAddCustomData(false)
+       fAddCustomData(false),
+       fMakeClonesArray(false),
+       fMakeESDDataBlock(true)
 {
        /// Default constructor.
 }
@@ -94,6 +97,8 @@ int AliHLTMUONESDMaker::DoInit(int argc, const char** argv)
        
        fWarnForUnexpecedBlock = false;
        fMakeMinimalESD = false;
+       fMakeClonesArray = false;
+       fMakeESDDataBlock = true;
        
        for (int i = 0; i < argc; i++)
        {
@@ -117,6 +122,20 @@ int AliHLTMUONESDMaker::DoInit(int argc, const char** argv)
                        continue;
                }
 
+               if (strcmp(argv[i], "-makeclonesarray") == 0)
+               {
+                       fMakeClonesArray = true;
+                       continue;
+               }
+
+               if (strcmp(argv[i], "-makeonlyclonesarray") == 0)
+               {
+                       fMakeMinimalESD = true;
+                       fMakeClonesArray = true;
+                       fMakeESDDataBlock = false;
+                       continue;
+               }
+
                HLTError("Unknown option '%s'.", argv[i]);
                return -EINVAL;
        }
@@ -143,11 +162,22 @@ const char* AliHLTMUONESDMaker::GetComponentID()
 
 
 AliHLTComponentDataType AliHLTMUONESDMaker::GetOutputDataType()
+{
+       /// Inherited from AliHLTComponent. Returns kAliHLTMultipleDataType.
+       /// Refer to GetOutputDataTypes for all returned data types.
+       
+       return kAliHLTMultipleDataType;
+}
+
+
+int AliHLTMUONESDMaker::GetOutputDataTypes(AliHLTComponentDataTypeList& list)
 {
        /// Inherited from AliHLTComponent.
-       /// Returns the ESD object data type with MUON origin.
+       /// Returns the ESD object and kAliHLTDataTypeTObject data type with MUON origin.
        
-       return AliHLTMUONConstants::ESDDataType();
+       list.push_back(AliHLTMUONConstants::ESDDataType());
+       list.push_back(kAliHLTDataTypeTObject | kAliHLTDataOriginMUON);
+       return list.size();
 }
 
 
@@ -195,7 +225,7 @@ int AliHLTMUONESDMaker::DoEvent(
        // tracks array if so requested.
        if (fMakeMinimalESD)
        {
-               TClonesArray* muonTracks = new TClonesArray("AliESDMuonTrack",0);
+               TClonesArray* muonTracks = new TClonesArray("AliESDMuonTrack",2);
                muonTracks->SetName("MuonTracks");
                event.AddObject(muonTracks);
                event.GetStdContent();
@@ -425,8 +455,18 @@ int AliHLTMUONESDMaker::DoEvent(
                }
        }
        
-       PushBack(&event, AliHLTMUONConstants::ESDDataType(), specification);
-       
+       if (fMakeClonesArray and event.GetList() != NULL)
+       {
+               PushBack(
+                       event.GetList()->FindObject("MuonTracks"),
+                       kAliHLTDataTypeTObject | kAliHLTDataOriginMUON,
+                       specification
+               );
+       }
+       if (fMakeESDDataBlock)
+       {
+               PushBack(&event, AliHLTMUONConstants::ESDDataType(), specification);
+       }
        return 0;
 }
 
index b65c185d5a7b0064e4a2c02d5850de258da9ba0c..b979d7637199201e649b26d6af8e023455f41aac 100644 (file)
  * \li -add_rootified_objects <br>
  *       If specified then the any rootified dHLT event data that is found is added to the
  *       ESD list of objects as a custom data object.<br>
+ * \li -makeclonesarray <br>
+ *      This option will cause the component to generate a TClonesArray of MUON ESD tracks
+ *      and send it as a kAliHLTDataTypeTObject data block type. <br>
+ * \li -makeonlyclonesarray <br>
+ *      Same as the -makeclonesarray option, however the data block with the AliESDEvent
+ *      object is not generated at all. <br>
  * \li -warn_on_unexpected_block <br>
  *       If set, then warning messages are generated for any data block types that
  *       were not expected. (default is to generate only debug messages)<br>
@@ -60,6 +66,7 @@ public:
 
        virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
        virtual AliHLTComponentDataType GetOutputDataType();
+       virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list);
        virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
 
        virtual AliHLTComponent* Spawn();
@@ -81,6 +88,8 @@ private:
        bool fWarnForUnexpecedBlock;  /// Flag indicating if we should log a warning if we got a block of an unexpected type.
        bool fMakeMinimalESD;  /// Flag to indicate if a minimal ESD object should be created.
        bool fAddCustomData;  /// Flag to turn on adding of all dHLT rootified objects to the ESD.
+       bool fMakeClonesArray;  /// Flag indicating if a data block of TClonesArray with AliESDMuonTrack objects should be generated.
+       bool fMakeESDDataBlock;  /// Flag indicating if the ESD data block should generated.
 
        ClassDef(AliHLTMUONESDMaker, 0); // Component for converting dHLT reconstructed data into the ESD format.
 };
index 3ba337e99d5c8631563c5c6fe6f7c05b9b4333ae..b50335030519fd9ba2dcff7e70172b9a2733dc4b 100644 (file)
@@ -43,8 +43,8 @@
 
 
 const AliHLTInt32_t AliHLTMUONHitReconstructor::fgkDetectorId = 0xA00;
-const AliHLTInt32_t AliHLTMUONHitReconstructor::fgkDDLOffSet = 12;
-const AliHLTInt32_t AliHLTMUONHitReconstructor::fgkNofDDL = 8;
+const AliHLTInt32_t AliHLTMUONHitReconstructor::fgkDDLOffSet = 0;
+const AliHLTInt32_t AliHLTMUONHitReconstructor::fgkNofDDL = 20;
 const AliHLTInt32_t AliHLTMUONHitReconstructor::fgkDDLHeaderSize = 8;
 const AliHLTInt32_t AliHLTMUONHitReconstructor::fgkLutLine = 59648 + 1;
 
index c2d4bf1b2d2fe226ba19e6633db951a126834ffc..cfb30f4116bfbd214f3c813d7b2ecde0d9c378e0 100644 (file)
@@ -223,7 +223,7 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
                        
                        if (argc <= i+1)
                        {
-                               HLTError("The DDL number was not specified. Must be in the range [13..20].");
+                               HLTError("The DDL number was not specified. Must be in the range [1..20].");
                                return -EINVAL;
                        }
                        
@@ -234,12 +234,12 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
                                HLTError("Cannot convert '%s' to DDL a number.", argv[i+1] );
                                return -EINVAL;
                        }
-                       if (num < 13 or 20 < num)
+                       if (num < 1 or 20 < num)
                        {
-                               HLTError("The DDL number must be in the range [13..20].");
+                               HLTError("The DDL number must be in the range [1..20].");
                                return -EINVAL;
                        }
-                       fDDL = num - 1;  // convert to range [12..19]
+                       fDDL = num - 1;  // convert to range [0..19]
                        
                        i++;
                        continue;
@@ -256,7 +256,7 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
                        
                        if ( argc <= i+1 )
                        {
-                               HLTError("DDL equipment ID number not specified. It must be in the range [2572..2579]" );
+                               HLTError("DDL equipment ID number not specified. It must be in the range [2560..2579]" );
                                return -EINVAL;
                        }
                
@@ -268,9 +268,9 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
                                return -EINVAL;
                        }
                        fDDL = AliHLTMUONUtils::EquipIdToDDLNumber(num); // Convert to DDL number in the range 0..21
-                       if (fDDL < 12 or 19 < fDDL)
+                       if (fDDL < 0 or 19 < fDDL)
                        {
-                               HLTError("The DDL equipment ID number must be in the range [2572..2579].");
+                               HLTError("The DDL equipment ID number must be in the range [2560..2579].");
                                return -EINVAL;
                        }
                        
@@ -1313,7 +1313,7 @@ bool AliHLTMUONHitReconstructorComponent::GenerateLookupTable(
        /// Generates a ASCII text file containing the lookup table (LUT) from
        /// the CDB, which can be used for the hit reconstructor component later.
        /// @param ddl  Must be the DDL for which to generate the DDL,
-       ///             in the range [13..20].
+       ///             in the range [0..19].
        /// @param filename  The name of the LUT file to generate.
        /// @param cdbPath  The CDB path to use.
        /// @param run  The run number to use for the CDB.
@@ -1321,9 +1321,9 @@ bool AliHLTMUONHitReconstructorComponent::GenerateLookupTable(
        
        AliHLTMUONHitReconstructorComponent comp;
        
-       if (ddl < 12 or 19 < ddl)
+       if (ddl < 0 or 19 < ddl)
        {
-               std::cerr << "ERROR: the DDL number must be in the range [12..19]." << std::endl;
+               std::cerr << "ERROR: the DDL number must be in the range [0..19]." << std::endl;
                return false;
        }
        
index 71f979724e8e6694e5fd174abe0546cd577994ab..207c8b2bcef02320068d18700b59ae4bcdcf14c2 100644 (file)
@@ -82,7 +82,7 @@ void CreateHitRecoLookupTables(const char* CDBPath = "local://$ALICE_ROOT/OCDB",
 {
        gSystem->Load("libAliHLTMUON.so");
 
-       for (Int_t ddl = 12; ddl < 20; ddl++)
+       for (Int_t ddl = 0; ddl < 20; ddl++)
        {
                Char_t filename[64];
                sprintf(filename, "Lut%d.dat", ddl+1);
index 8bef234018e3d8afc2825824fc2aa72b8ca1ddd1..67bedeb50fca1049532ced6d6b7c89677d07f4c4 100644 (file)
@@ -523,7 +523,7 @@ void RunChain(
        if (checkData)
        {
                AliHLTConfiguration checker("checker", "MUONDataChecker", sources, "-warn_on_unexpected_block");
-               sources = "checker";
+               sources = "checker"; // Only add the checker to the sources in this case since it will forward just the bad events.
        }
        
        if (useRootWriter)
diff --git a/HLT/MUON/utils/AliHLTMUONClusterHistoComponent.cxx b/HLT/MUON/utils/AliHLTMUONClusterHistoComponent.cxx
new file mode 100644 (file)
index 0000000..27469e1
--- /dev/null
@@ -0,0 +1,276 @@
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        *
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Author: Arshad Ahmad Masoodi <Arshad.Ahmad@cern.ch>            *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
+
+/** @file   AliHLTMUONClusterHistoComponent.cxx
+    @author Arshad Ahmad <Arshad.Ahmad@cern.ch>
+    @date  27 Nov 2009
+    @brief  Component for onlinehistograms
+*/
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include "AliHLTMUONClusterHistoComponent.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "AliHLTDataTypes.h"
+#include "AliHLTMUONConstants.h"
+#include "AliHLTMUONClustersBlockStruct.h"
+#include "AliHLTMUONDataBlockReader.h"
+#include <TFile.h>
+#include <TString.h>
+#include "TObjString.h"
+#include "TObjArray.h"
+
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTMUONClusterHistoComponent);
+
+AliHLTMUONClusterHistoComponent::AliHLTMUONClusterHistoComponent() :
+  AliHLTMUONProcessor(),
+  fChargePerClusterBending(NULL),
+  fChargePerClusterNonBending(NULL),
+  fNumberOfClusters(NULL),
+  fPlotChargePerClusterBending(kTRUE),
+  fPlotChargePerClusterNonBending(kTRUE),
+  fPlotNClusters(kTRUE)
+{
+  // see header file for class documentation
+}
+
+AliHLTMUONClusterHistoComponent::~AliHLTMUONClusterHistoComponent()
+{
+  // see header file for class documentation
+  
+ if (fChargePerClusterBending)         delete fChargePerClusterBending;
+ if (fChargePerClusterNonBending)      delete fChargePerClusterNonBending;
+ if (fNumberOfClusters)                delete fNumberOfClusters;
+}
+
+// Public functions to implement AliHLTComponent's interface.
+// These functions are required for the registration process
+
+const char* AliHLTMUONClusterHistoComponent::GetComponentID()
+{
+  // see header file for class documentation
+  
+  return AliHLTMUONConstants::ClusterHistogrammerId();
+//   return "MUONClusterHistogrammer";
+
+}
+
+void AliHLTMUONClusterHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
+{
+  // see header file for class documentation
+  list.clear();
+  list.push_back(AliHLTMUONConstants::ClusterBlockDataType() );
+  //list.push_back( AliHLTMUONConstants::RecHitsBlockDataType() );
+  //list.push_back( AliHLTMUONConstants::TriggerRecordsBlockDataType() );
+}
+
+AliHLTComponentDataType AliHLTMUONClusterHistoComponent::GetOutputDataType()
+{
+  // see header file for class documentation
+  return kAliHLTDataTypeHistogram;
+}
+
+
+int AliHLTMUONClusterHistoComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
+
+{
+  // see header file for class documentation
+  tgtList.clear();
+  tgtList.push_back( AliHLTMUONConstants::HistogramDataType() );
+  return tgtList.size();
+}
+
+void AliHLTMUONClusterHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+  // see header file for class documentation
+  
+  // The total constant size is the size of the TH1F object, the space needed for
+  // the arrays of data points and finally we add 4k for any extra streamer meta data
+  // etc. added by ROOT.
+  constBase = sizeof(TH1F)*3 + sizeof(Double_t)*(400*2+101) + 4*1024*3;
+  
+  // The multiplier can be zero since the histograms generated are a constant size
+  // independent of the input data size.
+  inputMultiplier = 0;
+}
+
+AliHLTComponent* AliHLTMUONClusterHistoComponent::Spawn()
+{
+  // see header file for class documentation
+  return new AliHLTMUONClusterHistoComponent;
+}
+
+int AliHLTMUONClusterHistoComponent::DoInit( int argc, const char** argv )
+{
+  // see header file for class documentation
+  
+  fPlotChargePerClusterBending=kTRUE;
+  fPlotChargePerClusterNonBending=kTRUE;
+  fPlotNClusters=kTRUE;
+   
+  if(fPlotChargePerClusterBending)
+    fChargePerClusterBending = new TH1F("fChargePerClusterBending","Total Charge of clusters ",400,0,4000);
+  
+  if(fPlotChargePerClusterNonBending)
+    fChargePerClusterNonBending = new TH1F("fChargePerClusterNonBending","Total Charge of clusters ",400,0,4000);
+  
+  if(fPlotNClusters)
+    fNumberOfClusters = new TH1F("fNumberOfClusters","Total Number of Clusters",101,0,100);
+  
+  int iResult=0;
+  TString configuration="";
+  TString argument="";
+  for (int i=0; i<argc && iResult>=0; i++) {
+    argument=argv[i];
+    if (!configuration.IsNull()) configuration+=" ";
+    configuration+=argument;
+  }
+  
+  if (!configuration.IsNull()) {
+    iResult=Configure(configuration.Data());
+  }
+
+  return iResult;
+}
+
+int AliHLTMUONClusterHistoComponent::DoDeinit()
+{
+  // see header file for class documentation
+  if(fChargePerClusterBending!=NULL) delete fChargePerClusterBending;
+  if(fChargePerClusterNonBending!=NULL) delete fChargePerClusterNonBending;
+  if(fNumberOfClusters!=NULL) delete fNumberOfClusters;
+  return 0;
+}
+
+int AliHLTMUONClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
+                                                const AliHLTComponentBlockData* /*blocks*/,
+                                                AliHLTComponentTriggerData& /*trigData*/,
+                                                AliHLTUInt8_t* /*outputPtr*/,
+                                                AliHLTUInt32_t& size,
+                                                AliHLTComponentBlockDataList& /*outputBlocks*/)
+{
+  AliHLTUInt32_t specification = 0x0;
+  
+  if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) ) return 0;
+     
+  for (const AliHLTComponentBlockData* block = GetFirstInputBlock(AliHLTMUONConstants::ClusterBlockDataType());
+       block != NULL;block = GetNextInputBlock()){
+    
+    if (block->fDataType != AliHLTMUONConstants::ClusterBlockDataType()) continue;
+    specification |= block->fSpecification;  // The specification bit pattern should indicate all the DDLs that contributed.
+    
+    HLTDebug("Handling block: %u, with fDataType = '%s', fPtr = %p and fSize = %u bytes.",
+            i, DataType2Text(block->fDataType).c_str(), block->fPtr, block->fSize
+            );
+    
+    AliHLTMUONClustersBlockReader clusterBlock(block->fPtr, block->fSize);
+    if (not BlockStructureOk(clusterBlock))
+    {
+      //FIXME: Need to inherit AliHLTMUONProcessor DoInit functionality properly for
+      // the following Dump feature to work properly. Like in AliHLTMUONRawDataHistoComponent.
+      //if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
+      continue;
+    }
+    
+    const AliHLTMUONClusterStruct *cluster=clusterBlock.GetArray();
+    for (AliHLTUInt32_t i = 0; i < clusterBlock.Nentries(); ++i){
+      
+      //commented for future use
+      //AliHLTInt32_t detelement=cluster->fDetElemId;  // Detector ID number from AliRoot geometry
+
+      AliHLTUInt16_t nchannelsB=cluster->fNchannelsB; // Number of channels/pads in the cluster in bending plane.
+      AliHLTUInt16_t nchannelsNB=cluster->fNchannelsNB; // Number of channels/pads in the cluster in non-bending plane.
+      
+
+      AliHLTFloat32_t BCharge= cluster->fChargeB; // Cluster charge in bending plane. Can be -1 if invalid or uncomputed.
+      AliHLTFloat32_t NBCharge= cluster->fChargeNB; // Cluster charge in bending plane. Can be -1 if invalid or uncomputed.
+      
+      if(fPlotChargePerClusterBending)
+       fChargePerClusterBending->Fill(BCharge);
+      if(fPlotChargePerClusterNonBending)      
+       fChargePerClusterNonBending->Fill(NBCharge);
+      cluster++;
+    }  // forloop clusterBlock.Nentries
+    if(fPlotNClusters and clusterBlock.Nentries()>0)
+           fNumberOfClusters->Fill(clusterBlock.Nentries());
+    
+  }//forloop clusterblock
+  
+  if( fPlotChargePerClusterBending ) PushBack( fChargePerClusterBending, AliHLTMUONConstants::HistogramDataType(), specification);
+  if( fPlotChargePerClusterNonBending ) PushBack( fChargePerClusterBending, AliHLTMUONConstants::HistogramDataType(), specification);
+  if( fPlotNClusters ) PushBack( fNumberOfClusters, AliHLTMUONConstants::HistogramDataType(), specification);
+
+  return 0;
+}
+
+
+int AliHLTMUONClusterHistoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
+{
+  // see header file for class documentation
+  int iResult=0;
+  const char* path="HLT/ConfigMUON/MUONHistoComponent";
+  const char* defaultNotify="";
+  if (cdbEntry) {
+    path=cdbEntry;
+    defaultNotify=" (default)";
+  }
+  if (path) {
+    HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+    AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
+        if (pEntry) {
+        TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+        if (pString) {
+        HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
+        iResult=Configure(pString->GetString().Data());
+        } else {
+        HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+      }
+        } else {
+      HLTError("can not fetch object \"%s\" from CDB", path);
+    }
+  }
+
+  return iResult;
+}
+
+
+int AliHLTMUONClusterHistoComponent::Configure(const char* arguments)
+{
+  
+  int iResult=0;
+  if (!arguments) return iResult;
+  
+  TString allArgs=arguments;
+  TString argument;
+  
+  TObjArray* pTokens=allArgs.Tokenize(" ");
+  
+  if (pTokens) {
+    for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
+      argument=((TObjString*)pTokens->At(i))->GetString();
+      if (argument.IsNull()) continue;
+      
+    }
+    delete pTokens;
+  }
+  
+  return iResult;
+}
diff --git a/HLT/MUON/utils/AliHLTMUONClusterHistoComponent.h b/HLT/MUON/utils/AliHLTMUONClusterHistoComponent.h
new file mode 100644 (file)
index 0000000..70189a2
--- /dev/null
@@ -0,0 +1,97 @@
+#ifndef ALIHLTMUONCLUSTERHISTOCOMPONENT_H
+#define ALIHLTMUONCLUSTERHISTOCOMPONENT_H
+//* This file is property of and copyright by the ALICE HLT Project        *
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
+
+/** @file   AliHLTMUONClusterHistoComponent.h
+    @author Arshad Ahmad <Arshad.Ahmad@cern.ch>
+    @date  27 Nov 2009
+    @brief  Component for ploting charge in clusters
+*/
+
+#include "TH1F.h"
+#include "AliHLTMUONProcessor.h"
+/**
+ * @class AliHLTMUONClusterHistoComponent
+ * Component for ploting charge in clusters
+ * 
+ * Component ID: \b MUONQHisto <br>
+ * Library: \b libAliHLTMUON.so <br>
+ *
+ * Mandatory arguments: <br>
+ * 
+ * 
+ * Optional arguments: <br>
+ * 
+ *
+ * @ingroup alihlt_dimuon_components
+ */
+
+class AliHLTMUONClusterHistoComponent : public AliHLTMUONProcessor
+{
+public:
+  /** default constructor */
+  AliHLTMUONClusterHistoComponent();
+  /** destructor */
+  virtual ~AliHLTMUONClusterHistoComponent();
+
+  // Public functions to implement AliHLTComponent's interface.
+  // These functions are required for the registration process
+
+  /** interface function, see AliHLTComponent for description */
+  const char* GetComponentID();
+  /** interface function, see AliHLTComponent for description */
+  void GetInputDataTypes(AliHLTComponentDataTypeList& list);
+  /** interface function, see AliHLTComponent for description */
+  AliHLTComponentDataType GetOutputDataType();
+  int GetOutputDataTypes(AliHLTComponentDataTypeList& list);
+  /** interface function, see AliHLTComponent for description */
+  virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+  /** interface function, see AliHLTComponent for description */
+  AliHLTComponent* Spawn();
+
+private:
+
+  // Protected functions to implement AliHLTComponent's interface.
+  // These functions provide initialization as well as the actual processing
+  // capabilities of the component.
+
+  /** interface function, see AliHLTComponent for description */
+  int DoInit( int argc, const char** argv );
+  /** interface function, see AliHLTComponent for description */
+  int DoDeinit();
+  /** interface function, see AliHLTComponent for description */
+  /*   int DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ); */
+  int DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
+              AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
+              AliHLTUInt32_t& size, AliHLTComponentBlockDataList& outputBlocks);
+
+  int Reconfigure(const char* cdbEntry, const char* chainId);
+
+  using AliHLTProcessor::DoEvent;
+  
+  /** copy constructor prohibited */
+  AliHLTMUONClusterHistoComponent(const AliHLTMUONClusterHistoComponent&);
+  /** assignment operator prohibited */
+  AliHLTMUONClusterHistoComponent& operator=(const AliHLTMUONClusterHistoComponent&);
+  /**
+   * Configure the component.
+   * Parse a string for the configuration arguments and set the component
+   * properties.
+   */ 
+  int Configure(const char* arguments);
+
+  
+  TH1F * fChargePerClusterBending;                                 //! transient
+  TH1F * fChargePerClusterNonBending;                              //! transient
+  TH1F * fNumberOfClusters;                                        //! transient
+  
+  Bool_t fPlotChargePerClusterBending;                             //! transient
+  Bool_t fPlotChargePerClusterNonBending;                          //! transient
+  Bool_t fPlotNClusters;                                           //! transient
+  ClassDef(AliHLTMUONClusterHistoComponent, 0);
+
+};
+#endif //ALIHLTMUONCLUSTERHISTOCOMPONENT_H
index 775ac059aae2112c16cfa6dc5db7d16f5fa319d7..9781b4c0820b77226be5ff4ae6c3af2fb9a278ff 100644 (file)
 #include "AliHLTCTPData.h"
 #include "AliESDEvent.h"
 #include "AliESDtrack.h"
+#include "AliESDMuonTrack.h"
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
 #include "AliPID.h"
 #include "TTree.h"
 #include "TList.h"
+#include "TClonesArray.h"
 #include "AliHLTESDCaloClusterMaker.h"
 #include "AliHLTCaloClusterDataStruct.h"
 #include "AliHLTCaloClusterReader.h"
@@ -143,6 +145,8 @@ void AliHLTGlobalEsdConverterComponent::GetInputDataTypes(AliHLTComponentDataTyp
   list.push_back(kAliHLTDataTypeCaloCluster);
   list.push_back(kAliHLTDataTypedEdx );
   list.push_back(kAliHLTDataTypeESDVertex );
+  list.push_back(kAliHLTDataTypeESDObject);
+  list.push_back(kAliHLTDataTypeTObject);
 }
 
 AliHLTComponentDataType AliHLTGlobalEsdConverterComponent::GetOutputDataType()
@@ -472,11 +476,52 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
       HLTInfo("converted %d cluster(s) to AliESDCaloCluster and added to ESD", nClusters);
       iAddedDataBlocks++;
     }
-      
-       
-      if (iAddedDataBlocks>0 && pTree) {
-       pTree->Fill();
+  
+  // Add tracks from MUON.
+  for (const TObject* obj = GetFirstInputObject(kAliHLTAnyDataType | kAliHLTDataOriginMUON);
+       obj != NULL;
+       obj = GetNextInputObject()
+      )
+  {
+    const TClonesArray* tracklist = NULL;
+    if (obj->IsA() == AliESDEvent::Class())
+    {
+      const AliESDEvent* event = static_cast<const AliESDEvent*>(obj);
+      HLTDebug("Received a MUON ESD with specification: 0x%X", GetSpecification(obj));
+      if (event->GetList() == NULL) continue;
+      tracklist = dynamic_cast<const TClonesArray*>(event->GetList()->FindObject("MuonTracks"));
+      if (tracklist == NULL) continue;
+    }
+    else if (obj->IsA() == TClonesArray::Class())
+    {
+      tracklist = static_cast<const TClonesArray*>(obj);
+      HLTDebug("Received a MUON TClonesArray of tracks with specification: 0x%X", GetSpecification(obj));
+    }
+    else
+    {
+      // Cannot handle this object type.
+      continue;
+    }
+    HLTDebug("Received %d MUON tracks.", tracklist->GetEntriesFast());
+    if (tracklist->GetEntriesFast() > 0)
+    {
+      const AliESDMuonTrack* track = dynamic_cast<const AliESDMuonTrack*>(tracklist->UncheckedAt(0));
+      if (track == NULL)
+      {
+        HLTError(Form("%s from MUON does not contain AliESDMuonTrack objects.", obj->ClassName()));
+        continue;
       }
+    }
+    for (Int_t i = 0; i < tracklist->GetEntriesFast(); ++i)
+    {
+      const AliESDMuonTrack* track = static_cast<const AliESDMuonTrack*>(tracklist->UncheckedAt(i));
+      pESD->AddMuonTrack(track);
+    }
+  }
+  
+  if (iAddedDataBlocks>0 && pTree) {
+    pTree->Fill();
+  }
   
   if (iResult>=0) iResult=iAddedDataBlocks;
   return iResult;
index f9861685e94aa9cc508b0f9c99323e0689f0ca18..a8958056339ee8a8de7a88fdd9908d818511b399 100644 (file)
@@ -18,6 +18,7 @@ CLASS_HDRS :=         AliHLTMUONUtils.h \
                utils/AliHLTMUONEmptyEventFilterComponent.h \
                utils/AliHLTMUONDataCheckerComponent.h \
                utils/AliHLTMUONRawDataHistoComponent.h \
+               utils/AliHLTMUONClusterHistoComponent.h \
                AliHLTMUONConstants.h \
                AliHLTMUONProcessor.h \
                AliHLTMUONRecHit.h \