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"
34 #include "AliRunInfo.h"
35 #include "AliGRPObject.h"
36 #include "AliRawReaderMemory.h"
37 #include "AliGeomManager.h"
39 #include "AliVZERORecoParam.h"
40 #include "AliVZEROReconstructor.h"
42 #include "AliHLTErrorGuard.h"
43 #include "AliHLTDataTypes.h"
44 #include "AliHLTVZERORecoComponent.h"
46 /** ROOT macro for the implementation of ROOT specific class methods */
47 ClassImp(AliHLTVZERORecoComponent)
50 * ---------------------------------------------------------------------------------
51 * Constructor / Destructor
52 * ---------------------------------------------------------------------------------
55 // #################################################################################
56 AliHLTVZERORecoComponent::AliHLTVZERORecoComponent() :
59 fVZERORecoParam(NULL),
60 fVZEROReconstructor(NULL),
62 // an example component which implements the ALICE HLT processor
63 // interface and does some analysis on the input raw data
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
71 // NOTE: all helper classes should be instantiated in DoInit()
74 // #################################################################################
75 AliHLTVZERORecoComponent::~AliHLTVZERORecoComponent() {
76 // see header file for class documentation
80 * ---------------------------------------------------------------------------------
81 * Public functions to implement AliHLTComponent's interface.
82 * These functions are required for the registration process
83 * ---------------------------------------------------------------------------------
86 // #################################################################################
87 const Char_t* AliHLTVZERORecoComponent::GetComponentID() {
88 // see header file for class documentation
89 return "VZEROReconstruction";
92 // #################################################################################
93 void AliHLTVZERORecoComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
94 // see header file for class documentation
95 list.push_back(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginVZERO);
98 // #################################################################################
99 AliHLTComponentDataType AliHLTVZERORecoComponent::GetOutputDataType() {
100 // see header file for class documentation
101 return kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO;
104 // #################################################################################
105 void AliHLTVZERORecoComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
106 // see header file for class documentation
108 inputMultiplier = 0.5;
111 // #################################################################################
112 void AliHLTVZERORecoComponent::GetOCDBObjectDescription( TMap* const targetMap) {
113 // see header file for class documentation
115 if (!targetMap) return;
116 targetMap->Add(new TObjString("HLT/ConfigVZERO/VZEROReconstruction"),
117 new TObjString("configuration object"));
119 targetMap->Add(new TObjString("GRP/GRP/Data"),
120 new TObjString("GRP object - run information"));
121 targetMap->Add(new TObjString("GRP/CTP/CTPtiming"),
122 new TObjString("GRP object - CTP information"));
123 targetMap->Add(new TObjString("GRP/CTP/TimeAlign"),
124 new TObjString("GRP object - CTP information"));
125 targetMap->Add(new TObjString("GRP/Calib/LHCClockPhase"),
126 new TObjString("GRP object - time calibration"));
128 targetMap->Add(new TObjString("VZERO/Calib/Data"),
129 new TObjString("VZERO calibration object"));
130 targetMap->Add(new TObjString("VZERO/Calib/TimeDelays"),
131 new TObjString("VZERO calibration object"));
132 targetMap->Add(new TObjString("VZERO/Calib/TimeSlewing"),
133 new TObjString("VZERO calibration object"));
138 // #################################################################################
139 AliHLTComponent* AliHLTVZERORecoComponent::Spawn() {
140 // see header file for class documentation
141 return new AliHLTVZERORecoComponent;
145 * ---------------------------------------------------------------------------------
146 * Protected functions to implement AliHLTComponent's interface.
147 * These functions provide initialization as well as the actual processing
148 * capabilities of the component.
149 * ---------------------------------------------------------------------------------
152 // #################################################################################
153 Int_t AliHLTVZERORecoComponent::DoInit( Int_t argc, const Char_t** argv ) {
154 // see header file for class documentation
158 // -- Load GeomManager
159 if(AliGeomManager::GetGeometry()==NULL){
160 AliGeomManager::LoadGeometry();
163 // -- Read configuration object : HLT/ConfigVZERO/VZEROReconstruction
164 TString cdbPath="HLT/ConfigVZERO/";
165 cdbPath+=GetComponentID();
166 iResult=ConfigureFromCDBTObjString(cdbPath);
168 // -- Read the component arguments
170 iResult=ConfigureFromArgumentString(argc, argv);
173 // -- Get AliRunInfo variables
174 // -----------------------------
175 TObject* pOCDBEntry=LoadAndExtractOCDBObject("GRP/GRP/Data");
176 AliGRPObject* pGRP=pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
178 TString beamType = "";
179 TString lhcState = "";
180 TString runType = "";
181 Float_t beamEnergy = 0.;
182 UInt_t activeDetectors = 0;
185 lhcState = pGRP->GetLHCState();
186 beamType = pGRP->GetBeamType();
187 runType = pGRP->GetRunType();
188 beamEnergy = pGRP->GetBeamEnergy();
189 activeDetectors = pGRP->GetDetectorMask();
192 // -- Initialize members
193 // -----------------------
195 if (iResult<0) break;
197 fRawReader = new AliRawReaderMemory;
203 // AliGRPManager grpMan;
204 // Bool_t status = grpMan.ReadGRPEntry(); // Read the corresponding OCDB entry
205 // status = grpMan.SetMagField(); // Set global field instanton
206 // AliRunInfo *runInfo = grpMan.GetRunInfo(); // Get instance of run info
208 fRunInfo = new AliRunInfo(lhcState.Data(), beamType.Data(),
209 beamEnergy, runType.Data(), activeDetectors);
215 fVZERORecoParam = new AliVZERORecoParam;
216 if (!fVZERORecoParam) {
221 fVZEROReconstructor = new AliVZEROReconstructor;
222 if (!fVZEROReconstructor) {
227 // implement further initialization
238 delete fVZERORecoParam;
239 fVZERORecoParam = NULL;
241 if (fVZEROReconstructor)
242 delete fVZEROReconstructor;
243 fVZEROReconstructor = NULL;
251 fVZEROReconstructor->SetRunInfo(fRunInfo);
252 fVZEROReconstructor->Init();
254 fVZEROReconstructor->SetRecoParam(fVZERORecoParam);
260 // #################################################################################
261 Int_t AliHLTVZERORecoComponent::ScanConfigurationArgument(Int_t /*argc*/, const Char_t** argv) {
262 // Scan configuration arguments
263 // Return the number of processed arguments
264 // -EPROTO if argument format error (e.g. number expected but not found)
266 // The AliHLTComponent base class implements a parsing loop for argument strings and
267 // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
268 // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
271 TString argument=argv[ii];
273 if (argument.IsNull()) return 0;
278 // #################################################################################
279 Int_t AliHLTVZERORecoComponent::DoDeinit() {
280 // see header file for class documentation
287 delete fVZERORecoParam;
288 fVZERORecoParam = NULL;
290 if (fVZEROReconstructor)
291 delete fVZEROReconstructor;
292 fVZEROReconstructor = NULL;
301 // #################################################################################
302 Int_t AliHLTVZERORecoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
303 AliHLTComponentTriggerData& /*trigData*/) {
304 // see header file for class documentation
308 // -- Only use data event
312 // -- Get VZERO raw dat a input block and set up the rawreader
313 const AliHLTComponentBlockData* pBlock = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginVZERO);
315 HLTInfo("No VZERO input block !!!");
319 // -- Add input block to raw reader
320 if (!fRawReader->SetMemory((UChar_t*) pBlock->fPtr, pBlock->fSize )){
321 HLTError("Could not add buffer of data block %s, 0x%08x to rawreader",
322 DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification);
326 TTree *digitsTree = new TTree("D", "Digits Tree");
333 // -- Set VZERO EquipmentID
334 fRawReader->SetEquipmentID(3584);
336 // -- 1. step VZERO reconstruction
337 fVZEROReconstructor->ConvertDigits(fRawReader, digitsTree);
339 // -- 2. step VZERO reconstruction -- fill AliESDVZERO object
340 fVZEROReconstructor->FillESD(digitsTree, NULL, NULL);
342 AliESDVZERO *esdVZERO = fVZEROReconstructor->GetESDVZERO();
344 // Send info every 10 s
346 static UInt_t lastTime=0;
347 if (time.Get()-lastTime>10) {
349 HLTInfo("VZERO Multiplicity A %f - C %f", esdVZERO->GetMTotV0A(), esdVZERO->GetMTotV0A() );
352 // -- Send AliESDVZERO
353 PushBack(esdVZERO, kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO,0);
358 fRawReader->ClearBuffers();
363 // #################################################################################
364 Int_t AliHLTVZERORecoComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) {
365 // see header file for class documentation
372 cdbPath="HLT/ConfigVZERO/";
373 cdbPath+=GetComponentID();
376 AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
377 iResult=ConfigureFromCDBTObjString(cdbPath);
382 // #################################################################################
383 Int_t AliHLTVZERORecoComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
384 // see header file for class documentation
385 ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component");