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: Chiara Oppedisano <Chiara.Oppedisano@to.infn.it> *
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 AliHLTZDCESDRecoComponent.cxx
20 @author Chiara Oppedisano <Chiara.Oppedisano@to.infn.it>
21 @brief ZDC reconstruction component
24 #include "AliHLTErrorGuard.h"
25 #include "AliHLTSystem.h"
26 #include "AliHLTZDCESDRecoComponent.h"
27 #include "AliHLTDefinitions.h"
28 #include "AliRawReaderMemory.h"
29 #include "AliGeomManager.h"
30 #include "AliGRPObject.h"
31 #include "AliZDCReconstructor.h"
32 #include "AliZDCRecoParam.h"
33 #include "AliZDCRecoParampp.h"
34 #include "AliZDCRecoParamPbPb.h"
35 #include "AliESDEvent.h"
36 #include "AliESDZDC.h"
37 #include "AliCDBManager.h"
38 #include "AliHLTDataTypes.h"
44 ClassImp(AliHLTZDCESDRecoComponent)
46 //_____________________________________________________________________
47 AliHLTZDCESDRecoComponent::AliHLTZDCESDRecoComponent()
54 //_____________________________________________________________________
55 AliHLTZDCESDRecoComponent::~AliHLTZDCESDRecoComponent()
57 // see header file for class documentation
60 //_____________________________________________________________________
61 const char* AliHLTZDCESDRecoComponent::GetComponentID()
63 // see header file for class documentation
64 return "ZDCESDReco"; // The ID of this component
67 //_____________________________________________________________________
68 void AliHLTZDCESDRecoComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
70 // see header file for class documentation
71 list.push_back(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC);
74 //_____________________________________________________________________
75 AliHLTComponentDataType AliHLTZDCESDRecoComponent::GetOutputDataType()
77 return kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC;
80 //_____________________________________________________________________
81 void AliHLTZDCESDRecoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
83 // see header file for class documentation
88 //_____________________________________________________________________
89 AliHLTComponent* AliHLTZDCESDRecoComponent::Spawn()
91 // see header file for class documentation
92 return new AliHLTZDCESDRecoComponent;
95 //_____________________________________________________________________
96 int AliHLTZDCESDRecoComponent::DoInit( int argc, const char** argv )
98 // see header file for class documentation
101 // -- Load GeomManager
102 if(AliGeomManager::GetGeometry()==NULL){
103 AliGeomManager::LoadGeometry();
106 // read configuration object : HLT/ConfigZDC/
107 TString cdbPath="HLT/ConfigZDC/";
108 cdbPath+=GetComponentID();
109 iResult=ConfigureFromCDBTObjString(cdbPath);
111 // init stage 3: read the component arguments
113 iResult=ConfigureFromArgumentString(argc, argv);
116 // init stage 1: default values for all data members
118 TObject* pOCDBEntry = LoadAndExtractOCDBObject("GRP/GRP/Data");
119 AliGRPObject* pGRP = pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
120 Float_t beamEnergy=0.;
121 if(pGRP) beamEnergy = pGRP->GetBeamEnergy();
124 if(pGRP) beamType = pGRP->GetBeamType();
126 //!!! set the beam type and the energy explicitly
131 // implement the component initialization
133 if (iResult<0) break;
135 fReconstructor = new AliZDCReconstructor;
136 if (!fReconstructor) {
141 fRawReader = new AliRawReaderMemory;
147 // implement further initialization
153 if (fRawReader) delete fRawReader;
156 if (fReconstructor) delete fReconstructor;
157 fReconstructor = NULL;
162 if((beamType.CompareTo("p-p"))==0) fReconstructor->SetRecoParam(AliZDCRecoParampp::GetLowFluxParam());
163 else if((beamType.CompareTo("A-A"))==0) fReconstructor->SetRecoParam(AliZDCRecoParamPbPb::GetHighFluxParam(beamEnergy));
164 else HLTWarning(" Beam type not known by ZDC!");
167 fReconstructor->Init(beamType, beamEnergy);
173 //_____________________________________________________________________
174 int AliHLTZDCESDRecoComponent::ScanConfigurationArgument(int /*argc*/, const char** argv)
176 // Scan configuration arguments
177 // Return the number of processed arguments
178 // -EPROTO if argument format error (e.g. number expected but not found)
180 // The AliHLTComponent base class implements a parsing loop for argument strings and
181 // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
182 // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
185 TString argument=argv[i];
187 if (argument.IsNull()) return 0;
192 //_____________________________________________________________________
193 int AliHLTZDCESDRecoComponent::DoDeinit()
195 if(fRawReader) delete fRawReader;
197 if(fReconstructor) delete fReconstructor;
202 //_____________________________________________________________________
203 int AliHLTZDCESDRecoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
204 AliHLTComponentTriggerData& /*trigData*/)
206 // event processing function
209 // check if this is a data event, there are a couple of special events
210 // which should be ignored for normal processing
211 if (!IsDataEvent()) return 0;
213 // get ZDC raw input data block and set up the rawreader
214 const AliHLTComponentBlockData* pBlock = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC);
216 ALIHLTERRORGUARD(1, "No ZDC input block at event %d", GetEventCount());
220 // add input block to raw reader
221 if (!fRawReader->SetMemory((UChar_t*) pBlock->fPtr, pBlock->fSize )){
222 HLTError("Could not add buffer of data block %s, 0x%08x to rawreader",
223 DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification);
227 TTree *clusterTree = new TTree();
234 // set ZDC EquipmentID
235 fRawReader->SetEquipmentID(3840);
237 fReconstructor->Reconstruct(fRawReader, clusterTree);
239 fReconstructor->FillZDCintoESD(clusterTree, (AliESDEvent *) NULL);
242 PushBack(static_cast<TObject*>(fReconstructor->GetZDCESDData()),
243 kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC,0);
249 // clear the rawreader
250 fRawReader->ClearBuffers();
256 //_____________________________________________________________________
257 int AliHLTZDCESDRecoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
259 // reconfigure the component from the specified CDB entry, or default CDB entry
260 // function is invoked by the framework if a reconfigure command was received.
267 cdbPath="HLT/ConfigZDC/";
268 cdbPath+=GetComponentID();
270 AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
271 iResult=ConfigureFromCDBTObjString(cdbPath);
277 //_____________________________________________________________________
278 int AliHLTZDCESDRecoComponent::ReadPreprocessorValues(const char* /*modules*/)
280 // see header file for class documentation