2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project *
4 //* ALICE Experiment at CERN, All rights reserved. *
6 //* Primary Authors: Federico Ronchetti *
8 //* Permission to use, copy, modify and distribute this software and its *
9 //* documentation strictly for non-commercial purposes is hereby granted *
10 //* without fee, provided that the above copyright notice appears in all *
11 //* copies and that both the copyright notice and this permission notice *
12 //* appear in the supporting documentation. The authors make no claims *
13 //* about the suitability of this software for any purpose. It is *
14 //* provided "as is" without express or implied warranty. *
15 //**************************************************************************
17 /** @file AliHLTEMCALAgent.cxx
18 @author Federico Ronchetti
20 @brief Agent of the libAliHLTEMCAL library
23 #include "AliHLTEMCALAgent.h"
24 #include "AliHLTConfiguration.h"
25 #include "AliHLTEMCALDefinitions.h"
26 #include "AliHLTOUT.h"
27 #include "AliHLTOUTHandlerChain.h"
28 #include "AliRunLoader.h"
29 #include "AliCDBManager.h"
30 #include "AliCDBEntry.h"
33 // #include "AliHLTEMCALConstant.h"
34 #include "AliHLTEMCALConstants.h"
35 #include "AliHLTEMCALMapper.h"
37 /** global instance for agent registration */
38 AliHLTEMCALAgent gAliHLTEMCALAgent;
41 //#include "AliHLTEMCALCalibrationComponent.h"
42 #include "AliHLTCaloClusterAnalyser.h"
43 #include "AliHLTEMCALClusterizerComponent.h"
44 #include "AliHLTEMCALDigitMakerComponent.h"
45 //#include "AliHLTEMCALESDEntriesMakerComponent.h"
46 //#include "AliHLTEMCALHistogramProducerComponent.h"
47 //#include "AliHLTEMCALModuleCalibrationProcessorComponent.h"
48 //#include "AliHLTEMCALMonitorTriggerComponent.h"
49 #include "AliHLTEMCALRawAnalyzerComponent.h"
50 #include "AliHLTEMCALRawAnalyzerCrudeComponent.h"
51 #include "AliHLTEMCALRawAnalyzerPeakFinderComponent.h"
52 //#include "AliHLTEMCALRcuCalibrationProcessorComponent.h"
53 //#include "AliHLTEMCALRcuDAComponent.h"
55 /** ROOT macro for the implementation of ROOT specific class methods */
56 ClassImp(AliHLTEMCALAgent)
58 AliHLTEMCALAgent::AliHLTEMCALAgent() : AliHLTModuleAgent("EMCAL"),
61 // see header file for class documentation
63 // refer to README to build package
65 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
68 AliHLTEMCALAgent::~AliHLTEMCALAgent()
70 // see header file for class documentation
73 int AliHLTEMCALAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
74 AliRawReader* /*rawReader*/,
75 AliRunLoader* /*runloader*/) const
77 // see header file for class documentation
80 // const char* cdbEntry="EMCAL/Calib/Parameters";
81 //AliCDBManager* pMan=AliCDBManager::Instance();
82 //AliEMCALParam* pEMCALParam=NULL;
86 // AliCDBEntry *pEntry = pMan->Get(cdbEntry);
88 // pEntry->GetObject() &&
89 // (pEMCALParam=dynamic_cast<AliEMCALParam*>(pEntry->GetObject())))
93 // HLTWarning("can not load AliEMCALParam from CDB entry %s", cdbEntry);
103 Int_t rcusPerModule = 2;
104 Int_t ddlOffset = 4608;
107 TString sinkClusterInput;
110 for (int module = moduleStart; module < moduleEnd; module++)
114 for(int rcu = rcuStart; rcu < rcuEnd; rcu++)
116 TString arg, publisher, ra, dm;
117 // raw data publisher components
118 publisher.Form("EMCAL-RP_%02d_%d", module, rcu);
119 arg.Form("-verbose -minid %d -datatype 'DDL_RAW ' 'EMCA' -dataspec 0x%x ", ddlOffset + module*(rcusPerModule) + rcu, 0x1 << (module*rcusPerModule + rcu));
121 handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
125 ra.Form("EMCAL-RA_%02d_%d", module, rcu);
126 handler->CreateConfiguration(ra.Data(), "EmcalRawCrude", publisher.Data(), arg.Data());
128 // digit maker components
129 dm.Form("EMCAL-DM_%02d_%d", module, rcu);
131 arg.Form("-sethighgainfactor 0.0153 -setlowgainfactor 0.2448 -setdigitthresholds 0.005 0.002");
132 handler->CreateConfiguration(dm.Data(), "EmcalDigitMaker", ra.Data(), arg.Data());
134 if(clInput.Length() > 0) clInput += " ";
140 cl.Form("EMCAL-CF_%02d", module);
142 arg.Form("-digitthreshold 0.005 -recpointthreshold 0.1 -modulemode");
143 handler->CreateConfiguration(cl.Data(), "EmcalClusterizer", clInput.Data(), arg.Data());
145 //ca.Form("EMCAL-CA_%02d", module);
147 //handler->CreateConfiguration(ca.Data(), "CaloClusterAnalyser", cl.Data(), arg.Data());
149 if(emInput.Length() > 0) emInput += " ";
156 // tracker finder components
159 // em.Form("EMCAL-EM");
161 //handler->CreateConfiguration(em.Data(), "EmcalEsdEntriesMaker", emInput.Data(), " ");
168 const char* AliHLTEMCALAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
169 AliRunLoader* runloader) const
171 // see header file for class documentation
173 // reconstruction chains for AliRoot simulation
174 // Note: run loader is only available while running embedded into
175 // AliRoot simulation
177 if (runloader->GetLoader("EMCALLoader") != NULL)
183 const char* AliHLTEMCALAgent::GetRequiredComponentLibraries() const
185 // see header file for class documentation
189 int AliHLTEMCALAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
191 // see header file for class documentation
192 if (!pHandler) return -EINVAL;
194 pHandler->AddComponent(new AliHLTEMCALRawAnalyzerCrudeComponent);
195 pHandler->AddComponent(new AliHLTEMCALDigitMakerComponent);
196 pHandler->AddComponent(new AliHLTEMCALClusterizerComponent);
197 //pHandler->AddComponent(new AliHLTCaloClusterAnalyserComponent);
198 //pHandler->AddComponent(new AliHLTEMCALESDEntriesMakerComponent);
204 int AliHLTEMCALAgent::GetHandlerDescription(AliHLTComponentDataType dt,
206 AliHLTOUTHandlerDesc& desc) const
208 // see header file for class documentation
210 AliHLTEMCALMapper mapper(spec);
211 mapper.InitDDLSpecificationMapping();
213 // raw data blocks to be fed into offline reconstruction
214 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginEMCAL))
216 if(mapper.GetDDLFromSpec(spec) >= 0)
218 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
223 HLTWarning("Handler can not process data inconsistent with a single EMCAL DDL from specification % d", spec);
230 AliHLTOUTHandler* AliHLTEMCALAgent::GetOutputHandler(AliHLTComponentDataType dt,
231 AliHLTUInt32_t /*spec*/)
233 // see header file for class documentation
235 // raw data blocks to be fed into offline reconstruction
236 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginEMCAL))
238 if (!fRawDataHandler)
240 fRawDataHandler = new AliHLTEMCALAgent::AliHLTEMCALRawDataHandler;
242 return fRawDataHandler;
248 int AliHLTEMCALAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
250 // see header file for class documentation
251 if (pInstance==NULL) return -EINVAL;
253 if (pInstance==fRawDataHandler) {
254 delete fRawDataHandler;
255 fRawDataHandler=NULL;
260 AliHLTEMCALAgent::AliHLTEMCALRawDataHandler::AliHLTEMCALRawDataHandler()
262 // see header file for class documentation
265 AliHLTEMCALAgent::AliHLTEMCALRawDataHandler::~AliHLTEMCALRawDataHandler()
267 // see header file for class documentation
270 int AliHLTEMCALAgent::AliHLTEMCALRawDataHandler::ProcessData(AliHLTOUT* pData)
272 // see header file for class documentation
273 if (!pData) return -EINVAL;
275 AliHLTComponentDataType dt = kAliHLTVoidDataType;
276 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
278 AliHLTEMCALMapper mapper(spec);
279 mapper.InitDDLSpecificationMapping();
281 int iResult = pData->GetDataBlockDescription(dt, spec);
285 if((ddl = mapper.GetDDLFromSpec(spec)) >=0)
292 HLTError("Handler can not process data inconsistent with a single EMCAL DDL from specification % d", spec);