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"
33 // #include "AliHLTPHOSConstant.h"
34 #include "AliHLTPHOSConstants.h"
37 #include "AliHLTPHOSMapper.h"
39 /** global instance for agent registration */
40 AliHLTPHOSAgent gAliHLTPHOSAgent;
43 #include "AliHLTPHOSCalibrationComponent.h"
44 #include "AliHLTPHOSClusterAnalyserComponent.h"
45 #include "AliHLTPHOSClusterizerComponent.h"
46 #include "AliHLTPHOSDigitMakerComponent.h"
47 #include "AliHLTPHOSESDEntriesMakerComponent.h"
48 #include "AliHLTPHOSHistogramProducerComponent.h"
49 #include "AliHLTPHOSModuleCalibrationProcessorComponent.h"
50 #include "AliHLTPHOSMonitorTriggerComponent.h"
51 #include "AliHLTPHOSRawAnalyzerComponent.h"
52 #include "AliHLTPHOSRawAnalyzerCrudeComponentv2.h"
53 #include "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
54 #include "AliHLTPHOSRcuCalibrationProcessorComponent.h"
55 #include "AliHLTPHOSRcuDAComponent.h"
57 /** ROOT macro for the implementation of ROOT specific class methods */
58 ClassImp(AliHLTPHOSAgent)
60 AliHLTPHOSAgent::AliHLTPHOSAgent()
62 AliHLTModuleAgent("PHOS"),
65 // see header file for class documentation
67 // refer to README to build package
69 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
72 AliHLTPHOSAgent::~AliHLTPHOSAgent()
74 // see header file for class documentation
77 int AliHLTPHOSAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
78 AliRawReader* /*rawReader*/,
79 AliRunLoader* /*runloader*/) const
81 // see header file for class documentation
84 // const char* cdbEntry="PHOS/Calib/Parameters";
85 // AliCDBManager* pMan=AliCDBManager::Instance();
86 // AliPHOSParam* pPHOSParam=NULL;
89 // AliCDBEntry *pEntry = pMan->Get(cdbEntry);
91 // pEntry->GetObject() &&
92 // (pPHOSParam=dynamic_cast<AliPHOSParam*>(pEntry->GetObject())))
96 // HLTWarning("can not load AliPHOSParam from CDB entry %s", cdbEntry);
102 // int moduleEnd = PhosHLTConst::NMODULES - 1;
103 int moduleEnd = 5 - 1;
106 // int rcuEnd = PhosHLTConst::NRCUSPERMODULE - 1;
107 int rcuEnd = PhosHLTConst::4 - 1;
110 TString sinkClusterInput;
112 for (int module = moduleStart; module < moduleEnd; module++)
116 for(int rcu = rcuStart; rcu < rcuEnd; rcu++)
118 TString arg, publisher, ra, dm;
119 // raw data publisher components
120 publisher.Form("PHOS-RP_%02d_%d", module, rcu);
122 // arg.Form("-datatype 'DDL_RAW ' 'PHOS' -dataspec 0x ", 0x1 << (module*PhosHLTConst::NRCUSPERMODULE + rcu));
123 arg.Form("-datatype 'DDL_RAW ' 'PHOS' -dataspec 0x ", 0x1 << (module*4 + rcu));
125 handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
129 ra.Form("PHOS-RA_%02d_%d", module, rcu);
130 handler->CreateConfiguration(ra.Data(), "PhosRawCrudev2", publisher.Data(), arg.Data());
132 // digit maker components
133 dm.Form("PHOS-DM_%02d_%d", module, rcu);
135 arg.Form("-sethighgainfactor 0.005 -setlowgainfactor 0.08 -setdigitthresholds 0.005 0.002");
136 handler->CreateConfiguration(dm.Data(), "PhosDigitMaker", ra.Data(), arg.Data());
138 if(clInput.Length() > 0) clInput += " ";
143 cl.Form("PHOS-CF_%02d", module);
145 arg.Form("-digitthreshold 0.005 -recpointthreshold 0.1 -modulemode");
146 handler->CreateConfiguration(cl.Data(), "PhosClusterizer", clInput.Data(), arg.Data());
148 ca.Form("PHOS-CA_%02d", module);
150 handler->CreateConfiguration(ca.Data(), "PhosClusterAnalyser", cl.Data(), arg.Data());
152 if(emInput.Length() > 0) emInput += " ";
158 // tracker finder components
161 handler->CreateConfiguration(em.Data(), "PhosEsdEntriesMaker", emInput.Data(), " ");
166 const char* AliHLTPHOSAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
167 AliRunLoader* runloader) const
169 // see header file for class documentation
171 // reconstruction chains for AliRoot simulation
172 // Note: run loader is only available while running embedded into
173 // AliRoot simulation
174 if (runloader->GetLoader("PHOSLoader") != NULL)
180 const char* AliHLTPHOSAgent::GetRequiredComponentLibraries() const
182 // see header file for class documentation
186 int AliHLTPHOSAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
188 // see header file for class documentation
189 if (!pHandler) return -EINVAL;
190 pHandler->AddComponent(new AliHLTPHOSRawAnalyzerCrudeComponentv2);
191 pHandler->AddComponent(new AliHLTPHOSDigitMakerComponent);
192 pHandler->AddComponent(new AliHLTPHOSClusterizerComponent);
193 pHandler->AddComponent(new AliHLTPHOSClusterAnalyserComponent);
194 pHandler->AddComponent(new AliHLTPHOSESDEntriesMakerComponent);
199 int AliHLTPHOSAgent::GetHandlerDescription(AliHLTComponentDataType dt,
201 AliHLTOUTHandlerDesc& desc) const
203 // see header file for class documentation
205 AliHLTPHOSMapper mapper;
206 mapper.InitDDLSpecificationMapping();
208 // raw data blocks to be fed into offline reconstruction
209 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginPHOS))
211 if(mapper.GetDDLFromSpec(spec) >= 0)
213 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
218 HLTWarning("Handler can not process data inconsistent with a single PHOS DDL from specification % d", spec);
225 AliHLTOUTHandler* AliHLTPHOSAgent::GetOutputHandler(AliHLTComponentDataType dt,
226 AliHLTUInt32_t /*spec*/)
228 // see header file for class documentation
230 // raw data blocks to be fed into offline reconstruction
231 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginPHOS))
233 if (!fRawDataHandler)
235 fRawDataHandler = new AliHLTPHOSAgent::AliHLTPHOSRawDataHandler;
237 return fRawDataHandler;
243 int AliHLTPHOSAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
245 // see header file for class documentation
246 if (pInstance==NULL) return -EINVAL;
248 if (pInstance==fRawDataHandler) {
249 delete fRawDataHandler;
250 fRawDataHandler=NULL;
255 AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::AliHLTPHOSRawDataHandler()
257 // see header file for class documentation
260 AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::~AliHLTPHOSRawDataHandler()
262 // see header file for class documentation
265 int AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::ProcessData(AliHLTOUT* pData)
267 // see header file for class documentation
268 if (!pData) return -EINVAL;
270 AliHLTPHOSMapper mapper;
271 mapper.InitDDLSpecificationMapping();
273 AliHLTComponentDataType dt = kAliHLTVoidDataType;
274 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
275 int iResult = pData->GetDataBlockDescription(dt, spec);
279 if((ddl = mapper.GetDDLFromSpec(spec)) >=0)
286 HLTError("Handler can not process data inconsistent with a single PHOS DDL from specification % d", spec);