2 // $Id: AliHLTVZERORecoComponent.cxx $
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: Jochen Thaeder <jochen@thaeder.de> *
8 * for The ALICE HLT Project. *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
19 /** @file AliHLTVZERORecoComponent.cxx
20 @author Jochen Thaeder <jochen@thaeder.de>
21 @brief VZERO reconstruction component
30 #include "TObjString.h"
33 #include "AliRunInfo.h"
34 #include "AliGRPObject.h"
35 #include "AliRawReaderMemory.h"
36 #include "AliGeomManager.h"
38 #include "AliVZERORecoParam.h"
39 #include "AliVZEROReconstructor.h"
41 #include "AliHLTErrorGuard.h"
42 #include "AliHLTDataTypes.h"
43 #include "AliHLTVZERORecoComponent.h"
45 /** ROOT macro for the implementation of ROOT specific class methods */
46 ClassImp(AliHLTVZERORecoComponent)
49 * ---------------------------------------------------------------------------------
50 * Constructor / Destructor
51 * ---------------------------------------------------------------------------------
54 // #################################################################################
55 AliHLTVZERORecoComponent::AliHLTVZERORecoComponent() :
58 fVZERORecoParam(NULL),
59 fVZEROReconstructor(NULL),
61 // an example component which implements the ALICE HLT processor
62 // interface and does some analysis on the input raw data
64 // see header file for class documentation
66 // refer to README to build package
68 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
70 // NOTE: all helper classes should be instantiated in DoInit()
73 // #################################################################################
74 AliHLTVZERORecoComponent::~AliHLTVZERORecoComponent() {
75 // see header file for class documentation
79 * ---------------------------------------------------------------------------------
80 * Public functions to implement AliHLTComponent's interface.
81 * These functions are required for the registration process
82 * ---------------------------------------------------------------------------------
85 // #################################################################################
86 const Char_t* AliHLTVZERORecoComponent::GetComponentID() {
87 // see header file for class documentation
88 return "VZEROReconstruction";
91 // #################################################################################
92 void AliHLTVZERORecoComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
93 // see header file for class documentation
94 list.push_back(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginVZERO);
97 // #################################################################################
98 AliHLTComponentDataType AliHLTVZERORecoComponent::GetOutputDataType() {
99 // see header file for class documentation
100 return kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO;
103 // #################################################################################
104 void AliHLTVZERORecoComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
105 // see header file for class documentation
107 inputMultiplier = 0.5;
110 // #################################################################################
111 void AliHLTVZERORecoComponent::GetOCDBObjectDescription( TMap* const targetMap) {
112 // see header file for class documentation
114 if (!targetMap) return;
115 targetMap->Add(new TObjString("HLT/ConfigVZERO/VZEROReconstruction"),
116 new TObjString("configuration object"));
118 targetMap->Add(new TObjString("GRP/GRP/Data"),
119 new TObjString("GRP object - run information"));
120 targetMap->Add(new TObjString("GRP/CTP/CTPtiming"),
121 new TObjString("GRP object - CTP information"));
122 targetMap->Add(new TObjString("GRP/CTP/TimeAlign"),
123 new TObjString("GRP object - CTP information"));
124 targetMap->Add(new TObjString("GRP/Calib/LHCClockPhase"),
125 new TObjString("GRP object - time calibration"));
127 targetMap->Add(new TObjString("VZERO/Calib/Data"),
128 new TObjString("VZERO calibration object"));
129 targetMap->Add(new TObjString("VZERO/Calib/TimeDelays"),
130 new TObjString("VZERO calibration object"));
131 targetMap->Add(new TObjString("VZERO/Calib/TimeSlewing"),
132 new TObjString("VZERO calibration object"));
137 // #################################################################################
138 AliHLTComponent* AliHLTVZERORecoComponent::Spawn() {
139 // see header file for class documentation
140 return new AliHLTVZERORecoComponent;
144 * ---------------------------------------------------------------------------------
145 * Protected functions to implement AliHLTComponent's interface.
146 * These functions provide initialization as well as the actual processing
147 * capabilities of the component.
148 * ---------------------------------------------------------------------------------
151 // #################################################################################
152 Int_t AliHLTVZERORecoComponent::DoInit( Int_t argc, const Char_t** argv ) {
153 // see header file for class documentation
157 // -- Load GeomManager
158 if(AliGeomManager::GetGeometry()==NULL){
159 AliGeomManager::LoadGeometry();
162 // -- Read configuration object : HLT/ConfigVZERO/VZEROReconstruction
163 TString cdbPath="HLT/ConfigVZERO/";
164 cdbPath+=GetComponentID();
165 iResult=ConfigureFromCDBTObjString(cdbPath);
167 // -- Read the component arguments
169 iResult=ConfigureFromArgumentString(argc, argv);
172 // -- Get AliRunInfo variables
173 // -----------------------------
174 TObject* pOCDBEntry=LoadAndExtractOCDBObject("GRP/GRP/Data");
175 AliGRPObject* pGRP=pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
177 TString beamType = "";
178 TString lhcState = "";
179 TString runType = "";
180 Float_t beamEnergy = 0.;
181 UInt_t activeDetectors = 0;
184 lhcState = pGRP->GetLHCState();
185 beamType = pGRP->GetBeamType();
186 runType = pGRP->GetRunType();
187 beamEnergy = pGRP->GetBeamEnergy();
188 activeDetectors = pGRP->GetDetectorMask();
191 // -- Initialize members
192 // -----------------------
194 if (iResult<0) break;
196 fRawReader = new AliRawReaderMemory;
202 // AliGRPManager grpMan;
203 // Bool_t status = grpMan.ReadGRPEntry(); // Read the corresponding OCDB entry
204 // status = grpMan.SetMagField(); // Set global field instanton
205 // AliRunInfo *runInfo = grpMan.GetRunInfo(); // Get instance of run info
207 fRunInfo = new AliRunInfo(lhcState.Data(), beamType.Data(),
208 beamEnergy, runType.Data(), activeDetectors);
214 fVZERORecoParam = new AliVZERORecoParam;
215 if (!fVZERORecoParam) {
220 fVZEROReconstructor = new AliVZEROReconstructor;
221 if (!fVZEROReconstructor) {
226 // implement further initialization
237 delete fVZERORecoParam;
238 fVZERORecoParam = NULL;
240 if (fVZEROReconstructor)
241 delete fVZEROReconstructor;
242 fVZEROReconstructor = NULL;
250 fVZEROReconstructor->SetRunInfo(fRunInfo);
251 fVZEROReconstructor->Init();
253 fVZEROReconstructor->SetRecoParam(fVZERORecoParam);
259 // #################################################################################
260 Int_t AliHLTVZERORecoComponent::ScanConfigurationArgument(Int_t /*argc*/, const Char_t** argv) {
261 // Scan configuration arguments
262 // Return the number of processed arguments
263 // -EPROTO if argument format error (e.g. number expected but not found)
265 // The AliHLTComponent base class implements a parsing loop for argument strings and
266 // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
267 // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
270 TString argument=argv[ii];
272 if (argument.IsNull()) return 0;
277 // #################################################################################
278 Int_t AliHLTVZERORecoComponent::DoDeinit() {
279 // see header file for class documentation
286 delete fVZERORecoParam;
287 fVZERORecoParam = NULL;
289 if (fVZEROReconstructor)
290 delete fVZEROReconstructor;
291 fVZEROReconstructor = NULL;
300 // #################################################################################
301 Int_t AliHLTVZERORecoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
302 AliHLTComponentTriggerData& /*trigData*/) {
303 // see header file for class documentation
307 // -- Only use data event
311 // -- Get VZERO raw dat a input block and set up the rawreader
312 const AliHLTComponentBlockData* pBlock = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginVZERO);
314 HLTInfo("No VZERO input block !!!");
318 // -- Add input block to raw reader
319 if (!fRawReader->SetMemory((UChar_t*) pBlock->fPtr, pBlock->fSize )){
320 HLTError("Could not add buffer of data block %s, 0x%08x to rawreader",
321 DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification);
325 TTree *digitsTree = new TTree("D", "Digits Tree");
332 // -- Set VZERO EquipmentID
333 fRawReader->SetEquipmentID(3584);
335 // -- 1. step VZERO reconstruction
336 fVZEROReconstructor->ConvertDigits(fRawReader, digitsTree);
338 // -- 2. step VZERO reconstruction -- fill AliESDVZERO object
339 fVZEROReconstructor->FillESD(digitsTree, NULL, NULL);
341 AliESDVZERO *esdVZERO = fVZEROReconstructor->GetESDVZERO();
343 HLTInfo("VZERO Multiplicity A %f - C %f", esdVZERO->GetMTotV0A(), esdVZERO->GetMTotV0A() );
345 // -- Send AliESDVZERO
346 PushBack(static_cast<TObject*>(esdVZERO),
347 kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO,0);
352 fRawReader->ClearBuffers();
357 // #################################################################################
358 Int_t AliHLTVZERORecoComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) {
359 // see header file for class documentation
366 cdbPath="HLT/ConfigVZERO/";
367 cdbPath+=GetComponentID();
370 AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
371 iResult=ConfigureFromCDBTObjString(cdbPath);
376 // #################################################################################
377 Int_t AliHLTVZERORecoComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
378 // see header file for class documentation
379 ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component");