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"
29 #include "AliCDBManager.h"
30 #include "AliCDBEntry.h"
31 #include "AliHLTPHOSConstant.h"
32 #include "AliHLTPHOSMapper.h"
34 /** global instance for agent registration */
35 AliHLTPHOSAgent gAliHLTPHOSAgent;
38 #include "AliHLTPHOSCalibrationComponent.h"
39 #include "AliHLTPHOSClusterAnalyserComponent.h"
40 #include "AliHLTPHOSClusterizerComponent.h"
41 #include "AliHLTPHOSDigitMakerComponent.h"
42 #include "AliHLTPHOSESDEntriesMakerComponent.h"
43 #include "AliHLTPHOSHistogramProducerComponent.h"
44 #include "AliHLTPHOSModuleCalibrationProcessorComponent.h"
45 #include "AliHLTPHOSMonitorTriggerComponent.h"
46 #include "AliHLTPHOSRawAnalyzerComponent.h"
47 #include "AliHLTPHOSRawAnalyzerCrudeComponentv2.h"
48 #include "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
49 #include "AliHLTPHOSRcuCalibrationProcessorComponent.h"
50 #include "AliHLTPHOSRcuDAComponent.h"
52 /** ROOT macro for the implementation of ROOT specific class methods */
53 ClassImp(AliHLTPHOSAgent)
55 AliHLTPHOSAgent::AliHLTPHOSAgent()
57 AliHLTModuleAgent("PHOS"),
60 // see header file for class documentation
62 // refer to README to build package
64 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
67 AliHLTPHOSAgent::~AliHLTPHOSAgent()
69 // see header file for class documentation
72 int AliHLTPHOSAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
73 AliRawReader* /*rawReader*/,
74 AliRunLoader* /*runloader*/) const
76 // see header file for class documentation
79 // const char* cdbEntry="PHOS/Calib/Parameters";
80 // AliCDBManager* pMan=AliCDBManager::Instance();
81 // AliPHOSParam* pPHOSParam=NULL;
84 // AliCDBEntry *pEntry = pMan->Get(cdbEntry);
86 // pEntry->GetObject() &&
87 // (pPHOSParam=dynamic_cast<AliPHOSParam*>(pEntry->GetObject())))
91 // HLTWarning("can not load AliPHOSParam from CDB entry %s", cdbEntry);
97 int moduleEnd = PhosHLTConst::NMODULES - 1;
99 int rcuEnd = PhosHLTConst::NRCUSPERMODULE - 1;
102 TString sinkClusterInput;
104 for (int module = moduleStart; module < moduleEnd; module++)
108 for(int rcu = rcuStart; rcu < rcuEnd; rcu++)
110 TString arg, publisher, ra, dm;
111 // raw data publisher components
112 publisher.Form("PHOS-RP_%02d_%d", module, rcu);
114 arg.Form("-datatype 'DDL_RAW ' 'PHOS' -dataspec 0x ", 0x1 << (module*PhosHLTConst::NRCUSPERMODULE + rcu));
115 handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
119 ra.Form("PHOS-RA_%02d_%d", module, rcu);
120 handler->CreateConfiguration(ra.Data(), "PhosRawCrudev2", publisher.Data(), arg.Data());
122 // digit maker components
123 dm.Form("PHOS-DM_%02d_%d", module, rcu);
125 arg.Form("-sethighgainfactor 0.005 -setlowgainfactor 0.08 -setdigitthresholds 0.005 0.002");
126 handler->CreateConfiguration(dm.Data(), "PhosDigitMaker", ra.Data(), arg.Data());
128 if(clInput.Length() > 0) clInput += " ";
133 cl.Form("PHOS-CF_%02d", module);
135 arg.Form("-digitthreshold 0.005 -recpointthreshold 0.1 -modulemode");
136 handler->CreateConfiguration(cl.Data(), "PhosClusterizer", clInput.Data(), arg.Data());
138 ca.Form("PHOS-CA_%02d", module);
140 handler->CreateConfiguration(ca.Data(), "PhosClusterAnalyser", cl.Data(), arg.Data());
142 if(emInput.Length() > 0) emInput += " ";
148 // tracker finder components
151 handler->CreateConfiguration(em.Data(), "PhosEsdEntriesMaker", emInput.Data(), " ");
156 const char* AliHLTPHOSAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
157 AliRunLoader* runloader) const
159 // see header file for class documentation
161 // reconstruction chains for AliRoot simulation
162 // Note: run loader is only available while running embedded into
163 // AliRoot simulation
164 if (runloader->GetLoader("PHOSLoader") != NULL)
170 const char* AliHLTPHOSAgent::GetRequiredComponentLibraries() const
172 // see header file for class documentation
176 int AliHLTPHOSAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
178 // see header file for class documentation
179 if (!pHandler) return -EINVAL;
180 pHandler->AddComponent(new AliHLTPHOSRawAnalyzerCrudeComponentv2);
181 pHandler->AddComponent(new AliHLTPHOSDigitMakerComponent);
182 pHandler->AddComponent(new AliHLTPHOSClusterizerComponent);
183 pHandler->AddComponent(new AliHLTPHOSClusterAnalyserComponent);
184 pHandler->AddComponent(new AliHLTPHOSESDEntriesMakerComponent);
189 int AliHLTPHOSAgent::GetHandlerDescription(AliHLTComponentDataType dt,
191 AliHLTOUTHandlerDesc& desc) const
193 // see header file for class documentation
195 AliHLTPHOSMapper mapper;
196 mapper.InitDDLSpecificationMapping();
198 // raw data blocks to be fed into offline reconstruction
199 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginPHOS))
201 if(mapper.GetDDLFromSpec(spec) >= 0)
203 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
208 HLTWarning("Handler can not process data inconsistent with a single PHOS DDL from specification % d", spec);
215 AliHLTOUTHandler* AliHLTPHOSAgent::GetOutputHandler(AliHLTComponentDataType dt,
216 AliHLTUInt32_t /*spec*/)
218 // see header file for class documentation
220 // raw data blocks to be fed into offline reconstruction
221 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginPHOS))
223 if (!fRawDataHandler)
225 fRawDataHandler = new AliHLTPHOSAgent::AliHLTPHOSRawDataHandler;
227 return fRawDataHandler;
233 int AliHLTPHOSAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
235 // see header file for class documentation
236 if (pInstance==NULL) return -EINVAL;
238 if (pInstance==fRawDataHandler) {
239 delete fRawDataHandler;
240 fRawDataHandler=NULL;
245 AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::AliHLTPHOSRawDataHandler()
247 // see header file for class documentation
250 AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::~AliHLTPHOSRawDataHandler()
252 // see header file for class documentation
255 int AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::ProcessData(AliHLTOUT* pData)
257 // see header file for class documentation
258 if (!pData) return -EINVAL;
260 AliHLTPHOSMapper mapper;
261 mapper.InitDDLSpecificationMapping();
263 AliHLTComponentDataType dt = kAliHLTVoidDataType;
264 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
265 int iResult = pData->GetDataBlockDescription(dt, spec);
269 if((ddl = mapper.GetDDLFromSpec(spec)) >=0)
276 HLTError("Handler can not process data inconsistent with a single PHOS DDL from specification % d", spec);