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: Oystein Djuvsland *
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 AliHLTPHOSAgent.cxx
18 @author Oystein Djuvsland
20 @brief Agent of the libAliHLTPHOS library
23 #include "AliHLTPHOSAgent.h"
24 #include "AliHLTConfiguration.h"
25 #include "AliHLTPHOSDefinitions.h"
26 #include "AliHLTOUT.h"
27 #include "AliHLTOUTHandlerChain.h"
28 #include "AliRunLoader.h"
30 #include "AliCDBManager.h"
31 #include "AliCDBEntry.h"
34 // #include "AliHLTPHOSConstant.h"
35 #include "AliHLTPHOSConstants.h"
38 #include "AliHLTPHOSMapper.h"
40 /** global instance for agent registration */
41 AliHLTPHOSAgent gAliHLTPHOSAgent;
44 #include "AliHLTPHOSCalibrationComponent.h"
45 #include "AliHLTPHOSClusterAnalyserComponent.h"
46 #include "AliHLTPHOSClusterizerComponent.h"
47 #include "AliHLTPHOSClusterizerComponentNbyN.h"
48 #include "AliHLTPHOSDigitMakerComponent.h"
49 #include "AliHLTPHOSESDEntriesMakerComponent.h"
50 #include "AliHLTPHOSHistogramProducerComponent.h"
51 #include "AliHLTPHOSModuleCalibrationProcessorComponent.h"
52 #include "AliHLTPHOSMonitorTriggerComponent.h"
53 #include "AliHLTPHOSRawAnalyzerComponent.h"
54 #include "AliHLTPHOSRawAnalyzerCrudeComponentv2.h"
55 #include "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
56 #include "AliHLTPHOSRcuCalibrationProcessorComponent.h"
57 #include "AliHLTPHOSRcuDAComponent.h"
59 /** ROOT macro for the implementation of ROOT specific class methods */
60 ClassImp(AliHLTPHOSAgent)
62 AliHLTPHOSAgent::AliHLTPHOSAgent()
64 AliHLTModuleAgent("PHOS"),
67 // see header file for class documentation
69 // refer to README to build package
71 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
74 AliHLTPHOSAgent::~AliHLTPHOSAgent()
76 // see header file for class documentation
79 UInt_t AliHLTPHOSAgent::GetDetectorMask() const
84 int AliHLTPHOSAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
85 AliRawReader* /*rawReader*/,
86 AliRunLoader* /*runloader*/) const
88 // see header file for class documentation
91 // const char* cdbEntry="PHOS/Calib/Parameters";
92 // AliCDBManager* pMan=AliCDBManager::Instance();
93 // AliPHOSParam* pPHOSParam=NULL;
96 // AliCDBEntry *pEntry = pMan->Get(cdbEntry);
98 // pEntry->GetObject() &&
99 // (pPHOSParam=dynamic_cast<AliPHOSParam*>(pEntry->GetObject())))
103 // HLTWarning("can not load AliPHOSParam from CDB entry %s", cdbEntry);
109 // int moduleEnd = PhosHLTConst::NMODULES - 1;
110 int moduleEnd = 5 - 1;
113 // int rcuEnd = PhosHLTConst::NRCUSPERMODULE - 1;
114 int rcuEnd = PhosHLTConst::4 - 1;
117 TString sinkClusterInput;
119 for (int module = moduleStart; module < moduleEnd; module++)
123 for(int rcu = rcuStart; rcu < rcuEnd; rcu++)
125 TString arg, publisher, ra, dm;
126 // raw data publisher components
127 publisher.Form("PHOS-RP_%02d_%d", module, rcu);
129 // arg.Form("-datatype 'DDL_RAW ' 'PHOS' -dataspec 0x ", 0x1 << (module*PhosHLTConst::NRCUSPERMODULE + rcu));
130 arg.Form("-datatype 'DDL_RAW ' 'PHOS' -dataspec 0x ", 0x1 << (module*4 + rcu));
132 handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
136 ra.Form("PHOS-RA_%02d_%d", module, rcu);
137 handler->CreateConfiguration(ra.Data(), "PhosRawCrudev2", publisher.Data(), arg.Data());
139 // digit maker components
140 dm.Form("PHOS-DM_%02d_%d", module, rcu);
142 arg.Form("-sethighgainfactor 0.005 -setlowgainfactor 0.08 -setdigitthresholds 0.005 0.002");
143 handler->CreateConfiguration(dm.Data(), "PhosDigitMaker", ra.Data(), arg.Data());
145 if(clInput.Length() > 0) clInput += " ";
150 cl.Form("PHOS-CF_%02d", module);
152 arg.Form("-digitthreshold 0.005 -recpointthreshold 0.1 -modulemode");
153 handler->CreateConfiguration(cl.Data(), "PhosClusterizer", clInput.Data(), arg.Data());
155 ca.Form("PHOS-CA_%02d", module);
157 handler->CreateConfiguration(ca.Data(), "PhosClusterAnalyser", cl.Data(), arg.Data());
159 if(emInput.Length() > 0) emInput += " ";
165 // tracker finder components
168 handler->CreateConfiguration(em.Data(), "PhosEsdEntriesMaker", emInput.Data(), " ");
173 const char* AliHLTPHOSAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
174 AliRunLoader* runloader) const
176 // see header file for class documentation
178 // reconstruction chains for AliRoot simulation
179 // Note: run loader is only available while running embedded into
180 // AliRoot simulation
181 if (runloader->GetLoader("PHOSLoader") != NULL)
187 const char* AliHLTPHOSAgent::GetRequiredComponentLibraries() const
189 // see header file for class documentation
193 int AliHLTPHOSAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
195 // see header file for class documentation
196 if (!pHandler) return -EINVAL;
197 pHandler->AddComponent(new AliHLTPHOSRawAnalyzerCrudeComponentv2);
198 pHandler->AddComponent(new AliHLTPHOSDigitMakerComponent);
199 pHandler->AddComponent(new AliHLTPHOSClusterizerComponent);
200 pHandler->AddComponent(new AliHLTPHOSClusterizerComponentNbyN);
201 pHandler->AddComponent(new AliHLTPHOSClusterAnalyserComponent);
202 pHandler->AddComponent(new AliHLTPHOSESDEntriesMakerComponent);
207 int AliHLTPHOSAgent::GetHandlerDescription(AliHLTComponentDataType dt,
209 AliHLTOUTHandlerDesc& desc) const
211 // see header file for class documentation
213 AliHLTPHOSMapper mapper;
214 mapper.InitDDLSpecificationMapping();
216 // raw data blocks to be fed into offline reconstruction
217 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginPHOS))
219 if(mapper.GetDDLFromSpec(spec) >= 0)
221 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
226 HLTWarning("Handler can not process data inconsistent with a single PHOS DDL from specification % d", spec);
233 AliHLTOUTHandler* AliHLTPHOSAgent::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|kAliHLTDataOriginPHOS))
241 if (!fRawDataHandler)
243 fRawDataHandler = new AliHLTPHOSAgent::AliHLTPHOSRawDataHandler;
245 return fRawDataHandler;
251 int AliHLTPHOSAgent::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 AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::AliHLTPHOSRawDataHandler()
265 // see header file for class documentation
268 AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::~AliHLTPHOSRawDataHandler()
270 // see header file for class documentation
273 int AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::ProcessData(AliHLTOUT* pData)
275 // see header file for class documentation
276 if (!pData) return -EINVAL;
278 AliHLTPHOSMapper mapper;
279 mapper.InitDDLSpecificationMapping();
281 AliHLTComponentDataType dt = kAliHLTVoidDataType;
282 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
283 int iResult = pData->GetDataBlockDescription(dt, spec);
287 if((ddl = mapper.GetDDLFromSpec(spec)) >=0)
294 HLTError("Handler can not process data inconsistent with a single PHOS DDL from specification % d", spec);