3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Federico Ronchetti *
9 //* Permission to use, copy, modify and distribute this software and its *
10 //* documentation strictly for non-commercial purposes is hereby granted *
11 //* without fee, provided that the above copyright notice appears in all *
12 //* copies and that both the copyright notice and this permission notice *
13 //* appear in the supporting documentation. The authors make no claims *
14 //* about the suitability of this software for any purpose. It is *
15 //* provided "as is" without express or implied warranty. *
16 //**************************************************************************
18 /** @file AliHLTEMCALAgent.cxx
19 @author Federico Ronchetti
21 @brief Agent of the libAliHLTEMCAL library
24 #include "AliHLTEMCALAgent.h"
25 #include "AliHLTConfiguration.h"
26 #include "AliHLTEMCALDefinitions.h"
27 #include "AliHLTOUT.h"
28 #include "AliHLTOUTHandlerChain.h"
29 #include "AliRunLoader.h"
30 #include "AliCDBManager.h"
31 #include "AliCDBEntry.h"
34 // #include "AliHLTEMCALConstant.h"
35 #include "AliHLTEMCALConstants.h"
36 #include "AliHLTEMCALMapper.h"
38 /** global instance for agent registration */
39 AliHLTEMCALAgent gAliHLTEMCALAgent;
42 //#include "AliHLTEMCALCalibrationComponent.h"
43 #include "AliHLTCaloClusterAnalyser.h"
44 #include "AliHLTEMCALClusterizerComponent.h"
45 #include "AliHLTEMCALDigitMakerComponent.h"
46 //#include "AliHLTEMCALESDEntriesMakerComponent.h"
47 //#include "AliHLTEMCALHistogramProducerComponent.h"
48 //#include "AliHLTEMCALModuleCalibrationProcessorComponent.h"
49 //#include "AliHLTEMCALMonitorTriggerComponent.h"
50 #include "AliHLTEMCALRawAnalyzerComponent.h"
51 #include "AliHLTEMCALRawAnalyzerCrudeComponent.h"
52 #include "AliHLTEMCALRawAnalyzerPeakFinderComponent.h"
53 //#include "AliHLTEMCALRcuCalibrationProcessorComponent.h"
54 //#include "AliHLTEMCALRcuDAComponent.h"
56 /** ROOT macro for the implementation of ROOT specific class methods */
57 ClassImp(AliHLTEMCALAgent)
59 AliHLTEMCALAgent::AliHLTEMCALAgent() : AliHLTModuleAgent("EMCAL"),
62 // see header file for class documentation
64 // refer to README to build package
66 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
69 AliHLTEMCALAgent::~AliHLTEMCALAgent()
71 // see header file for class documentation
74 int AliHLTEMCALAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
75 AliRawReader* /*rawReader*/,
76 AliRunLoader* /*runloader*/) const
78 // see header file for class documentation
81 // const char* cdbEntry="EMCAL/Calib/Parameters";
82 //AliCDBManager* pMan=AliCDBManager::Instance();
83 //AliEMCALParam* pEMCALParam=NULL;
87 // AliCDBEntry *pEntry = pMan->Get(cdbEntry);
89 // pEntry->GetObject() &&
90 // (pEMCALParam=dynamic_cast<AliEMCALParam*>(pEntry->GetObject())))
94 // HLTWarning("can not load AliEMCALParam from CDB entry %s", cdbEntry);
104 Int_t rcusPerModule = 2;
105 Int_t ddlOffset = 4608;
108 TString sinkClusterInput;
111 for (int module = moduleStart; module <= moduleEnd; module++)
115 for(int rcu = rcuStart; rcu < rcuEnd; rcu++)
117 TString arg, publisher, ra, dm;
118 // raw data publisher components
119 publisher.Form("EMCAL-RP_%02d_%d", module, rcu);
120 arg.Form("-verbose -minid %d -datatype 'DDL_RAW ' 'EMCA' -dataspec 0x%x ", ddlOffset + module*(rcusPerModule) + rcu, 0x1 << (module*rcusPerModule + rcu));
122 handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
126 ra.Form("EMCAL-RA_%02d_%d", module, rcu);
127 handler->CreateConfiguration(ra.Data(), "EmcalRawCrude", publisher.Data(), arg.Data());
129 // digit maker components
130 dm.Form("EMCAL-DM_%02d_%d", module, rcu);
132 arg.Form("-sethighgainfactor 0.0153 -setlowgainfactor 0.2448 -setdigitthresholds 0.005 0.002");
133 handler->CreateConfiguration(dm.Data(), "EmcalDigitMaker", ra.Data(), arg.Data());
135 if(clInput.Length() > 0) clInput += " ";
141 cl.Form("EMCAL-CF_%02d", module);
143 arg.Form("-digitthreshold 0.005 -recpointthreshold 0.1 -modulemode");
144 handler->CreateConfiguration(cl.Data(), "EmcalClusterizer", clInput.Data(), arg.Data());
146 //ca.Form("EMCAL-CA_%02d", module);
148 //handler->CreateConfiguration(ca.Data(), "CaloClusterAnalyser", cl.Data(), arg.Data());
150 if(emInput.Length() > 0) emInput += " ";
157 // tracker finder components
160 // em.Form("EMCAL-EM");
162 //handler->CreateConfiguration(em.Data(), "EmcalEsdEntriesMaker", emInput.Data(), " ");
169 const char* AliHLTEMCALAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
170 AliRunLoader* runloader) const
172 // see header file for class documentation
174 // reconstruction chains for AliRoot simulation
175 // Note: run loader is only available while running embedded into
176 // AliRoot simulation
178 // if (runloader->GetLoader("EMCALLoader") != NULL)
179 // return "EMCAL-EM";
184 const char* AliHLTEMCALAgent::GetRequiredComponentLibraries() const
186 // see header file for class documentation
190 int AliHLTEMCALAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
192 // see header file for class documentation
193 if (!pHandler) return -EINVAL;
195 pHandler->AddComponent(new AliHLTEMCALRawAnalyzerCrudeComponent);
196 pHandler->AddComponent(new AliHLTEMCALDigitMakerComponent);
197 pHandler->AddComponent(new AliHLTEMCALClusterizerComponent);
198 //pHandler->AddComponent(new AliHLTCaloClusterAnalyserComponent);
199 //pHandler->AddComponent(new AliHLTEMCALESDEntriesMakerComponent);
205 int AliHLTEMCALAgent::GetHandlerDescription(AliHLTComponentDataType dt,
207 AliHLTOUTHandlerDesc& desc) const
209 // see header file for class documentation
211 // FIXME: there is memory allocated in the mapper, this happens for every event
212 // and is time consuming, think about initializing the mappers only once, or make
213 // the mapper class more flexible to handle more than one specification
214 AliHLTEMCALMapper mapper(spec);
216 // raw data blocks to be fed into offline reconstruction
217 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginEMCAL))
219 if(mapper.GetDDLFromSpec(spec) >= 0)
221 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
226 HLTWarning("Handler can not process data inconsistent with a single EMCAL DDL from specification % d", spec);
233 AliHLTOUTHandler* AliHLTEMCALAgent::GetOutputHandler(AliHLTComponentDataType dt,
234 AliHLTUInt32_t /*spec*/)
236 // see header file for class documentation
238 // raw data blocks to be fed into offline reconstruction
239 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginEMCAL))
241 if (!fRawDataHandler)
243 fRawDataHandler = new AliHLTEMCALAgent::AliHLTEMCALRawDataHandler;
245 return fRawDataHandler;
251 int AliHLTEMCALAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
253 // see header file for class documentation
254 if (pInstance==NULL) return -EINVAL;
256 if (pInstance==fRawDataHandler) {
257 delete fRawDataHandler;
258 fRawDataHandler=NULL;
263 AliHLTEMCALAgent::AliHLTEMCALRawDataHandler::AliHLTEMCALRawDataHandler()
265 // see header file for class documentation
268 AliHLTEMCALAgent::AliHLTEMCALRawDataHandler::~AliHLTEMCALRawDataHandler()
270 // see header file for class documentation
273 int AliHLTEMCALAgent::AliHLTEMCALRawDataHandler::ProcessData(AliHLTOUT* pData)
275 // see header file for class documentation
276 if (!pData) return -EINVAL;
278 AliHLTComponentDataType dt = kAliHLTVoidDataType;
279 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
281 AliHLTEMCALMapper mapper(spec);
282 mapper.InitDDLSpecificationMapping();
284 int iResult = pData->GetDataBlockDescription(dt, spec);
288 if((ddl = mapper.GetDDLFromSpec(spec)) >=0)
295 HLTError("Handler can not process data inconsistent with a single EMCAL DDL from specification % d", spec);