From f064ef447c91ae3aa477f754f97ab3bad5a0f145 Mon Sep 17 00:00:00 2001 From: aszostak Date: Fri, 27 Nov 2009 11:07:55 +0000 Subject: [PATCH 1/1] Adding component to generate histograms for clusters. Also updating ESD convertion to include MUON data. --- HLT/MUON/AliHLTMUONConstants.cxx | 1 + HLT/MUON/AliHLTMUONConstants.h | 6 + HLT/MUON/AliHLTMUONLinkDef.h | 1 + HLT/MUON/Makefile.am | 2 +- HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx | 2 + .../OfflineInterface/AliHLTMUONESDMaker.cxx | 52 +++- .../OfflineInterface/AliHLTMUONESDMaker.h | 9 + .../AliHLTMUONHitReconstructor.cxx | 4 +- .../AliHLTMUONHitReconstructorComponent.cxx | 20 +- HLT/MUON/macros/CreateHitRecoLookupTables.C | 2 +- HLT/MUON/macros/RunChain.C | 2 +- .../utils/AliHLTMUONClusterHistoComponent.cxx | 276 ++++++++++++++++++ .../utils/AliHLTMUONClusterHistoComponent.h | 97 ++++++ .../AliHLTGlobalEsdConverterComponent.cxx | 53 +++- HLT/libAliHLTMUON.pkg | 1 + 15 files changed, 503 insertions(+), 25 deletions(-) create mode 100644 HLT/MUON/utils/AliHLTMUONClusterHistoComponent.cxx create mode 100644 HLT/MUON/utils/AliHLTMUONClusterHistoComponent.h diff --git a/HLT/MUON/AliHLTMUONConstants.cxx b/HLT/MUON/AliHLTMUONConstants.cxx index 6a7f7216aa9..51edf3da532 100644 --- a/HLT/MUON/AliHLTMUONConstants.cxx +++ b/HLT/MUON/AliHLTMUONConstants.cxx @@ -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"; diff --git a/HLT/MUON/AliHLTMUONConstants.h b/HLT/MUON/AliHLTMUONConstants.h index 955ba492e23..e01579340e9 100644 --- a/HLT/MUON/AliHLTMUONConstants.h +++ b/HLT/MUON/AliHLTMUONConstants.h @@ -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. diff --git a/HLT/MUON/AliHLTMUONLinkDef.h b/HLT/MUON/AliHLTMUONLinkDef.h index f552d096e00..53c938d6960 100644 --- a/HLT/MUON/AliHLTMUONLinkDef.h +++ b/HLT/MUON/AliHLTMUONLinkDef.h @@ -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__ diff --git a/HLT/MUON/Makefile.am b/HLT/MUON/Makefile.am index 7b6f974221b..556b481a17e 100644 --- a/HLT/MUON/Makefile.am +++ b/HLT/MUON/Makefile.am @@ -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 diff --git a/HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx b/HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx index 82f3147b71d..5f765a1d758 100644 --- a/HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx +++ b/HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx @@ -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; } diff --git a/HLT/MUON/OfflineInterface/AliHLTMUONESDMaker.cxx b/HLT/MUON/OfflineInterface/AliHLTMUONESDMaker.cxx index e674377e524..184ba9dd3c0 100644 --- a/HLT/MUON/OfflineInterface/AliHLTMUONESDMaker.cxx +++ b/HLT/MUON/OfflineInterface/AliHLTMUONESDMaker.cxx @@ -41,6 +41,7 @@ #include "AliESDMuonTrack.h" #include "AliESDMuonCluster.h" #include "TClonesArray.h" +#include "TList.h" #include #include @@ -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; } diff --git a/HLT/MUON/OfflineInterface/AliHLTMUONESDMaker.h b/HLT/MUON/OfflineInterface/AliHLTMUONESDMaker.h index b65c185d5a7..b979d763719 100644 --- a/HLT/MUON/OfflineInterface/AliHLTMUONESDMaker.h +++ b/HLT/MUON/OfflineInterface/AliHLTMUONESDMaker.h @@ -37,6 +37,12 @@ * \li -add_rootified_objects
* 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.
+ * \li -makeclonesarray
+ * This option will cause the component to generate a TClonesArray of MUON ESD tracks + * and send it as a kAliHLTDataTypeTObject data block type.
+ * \li -makeonlyclonesarray
+ * Same as the -makeclonesarray option, however the data block with the AliESDEvent + * object is not generated at all.
* \li -warn_on_unexpected_block
* If set, then warning messages are generated for any data block types that * were not expected. (default is to generate only debug messages)
@@ -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. }; diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx index 3ba337e99d5..b5033503051 100644 --- a/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx +++ b/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx @@ -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; diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx index c2d4bf1b2d2..cfb30f4116b 100644 --- a/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx +++ b/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx @@ -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; } diff --git a/HLT/MUON/macros/CreateHitRecoLookupTables.C b/HLT/MUON/macros/CreateHitRecoLookupTables.C index 71f979724e8..207c8b2bcef 100644 --- a/HLT/MUON/macros/CreateHitRecoLookupTables.C +++ b/HLT/MUON/macros/CreateHitRecoLookupTables.C @@ -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); diff --git a/HLT/MUON/macros/RunChain.C b/HLT/MUON/macros/RunChain.C index 8bef234018e..67bedeb50fc 100644 --- a/HLT/MUON/macros/RunChain.C +++ b/HLT/MUON/macros/RunChain.C @@ -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 index 00000000000..27469e16764 --- /dev/null +++ b/HLT/MUON/utils/AliHLTMUONClusterHistoComponent.cxx @@ -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 * +//* 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 + @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 +#include +#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=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:""); + AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); + if (pEntry) { + TObjString* pString=dynamic_cast(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; iGetEntries() && 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 index 00000000000..70189a2b58d --- /dev/null +++ b/HLT/MUON/utils/AliHLTMUONClusterHistoComponent.h @@ -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 + @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
+ * Library: \b libAliHLTMUON.so
+ * + * Mandatory arguments:
+ * + * + * Optional arguments:
+ * + * + * @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 diff --git a/HLT/global/AliHLTGlobalEsdConverterComponent.cxx b/HLT/global/AliHLTGlobalEsdConverterComponent.cxx index 775ac059aae..9781b4c0820 100644 --- a/HLT/global/AliHLTGlobalEsdConverterComponent.cxx +++ b/HLT/global/AliHLTGlobalEsdConverterComponent.cxx @@ -36,11 +36,13 @@ #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(obj); + HLTDebug("Received a MUON ESD with specification: 0x%X", GetSpecification(obj)); + if (event->GetList() == NULL) continue; + tracklist = dynamic_cast(event->GetList()->FindObject("MuonTracks")); + if (tracklist == NULL) continue; + } + else if (obj->IsA() == TClonesArray::Class()) + { + tracklist = static_cast(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(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(tracklist->UncheckedAt(i)); + pESD->AddMuonTrack(track); + } + } + + if (iAddedDataBlocks>0 && pTree) { + pTree->Fill(); + } if (iResult>=0) iResult=iAddedDataBlocks; return iResult; diff --git a/HLT/libAliHLTMUON.pkg b/HLT/libAliHLTMUON.pkg index f9861685e94..a8958056339 100644 --- a/HLT/libAliHLTMUON.pkg +++ b/HLT/libAliHLTMUON.pkg @@ -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 \ -- 2.43.5