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
28 #include "AliHLTErrorGuard.h"
29 #include "AliHLTSystem.h"
30 #include "AliHLTZDCESDRecoComponent.h"
31 #include "AliHLTDefinitions.h"
32 #include "AliRawReaderMemory.h"
33 #include "AliGeomManager.h"
34 #include "AliGRPObject.h"
35 #include "AliZDCReconstructor.h"
36 #include "AliZDCRecoParam.h"
37 #include "AliZDCRecoParampp.h"
38 #include "AliZDCRecoParamPbPb.h"
39 #include "AliESDEvent.h"
40 #include "AliESDZDC.h"
41 #include "AliCDBManager.h"
42 #include "AliHLTDataTypes.h"
46 ClassImp(AliHLTZDCESDRecoComponent)
48 //_____________________________________________________________________
49 AliHLTZDCESDRecoComponent::AliHLTZDCESDRecoComponent()
56 //_____________________________________________________________________
57 AliHLTZDCESDRecoComponent::~AliHLTZDCESDRecoComponent()
59 // see header file for class documentation
62 //_____________________________________________________________________
63 const char* AliHLTZDCESDRecoComponent::GetComponentID()
65 // see header file for class documentation
66 return "ZDCESDReco"; // The ID of this component
69 //_____________________________________________________________________
70 void AliHLTZDCESDRecoComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
72 // see header file for class documentation
73 list.push_back(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC);
76 //_____________________________________________________________________
77 AliHLTComponentDataType AliHLTZDCESDRecoComponent::GetOutputDataType()
79 return kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC;
82 //_____________________________________________________________________
83 void AliHLTZDCESDRecoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
85 // see header file for class documentation
90 //_____________________________________________________________________
91 AliHLTComponent* AliHLTZDCESDRecoComponent::Spawn()
93 // see header file for class documentation
94 return new AliHLTZDCESDRecoComponent;
97 //_____________________________________________________________________
98 int AliHLTZDCESDRecoComponent::DoInit( int argc, const char** argv )
100 // see header file for class documentation
103 // -- Load GeomManager
104 if(AliGeomManager::GetGeometry()==NULL){
105 AliGeomManager::LoadGeometry();
108 // read configuration object : HLT/ConfigZDC/
109 TString cdbPath="HLT/ConfigZDC/";
110 cdbPath+=GetComponentID();
111 iResult=ConfigureFromCDBTObjString(cdbPath);
113 // init stage 3: read the component arguments
115 iResult=ConfigureFromArgumentString(argc, argv);
118 // init stage 1: default values for all data members
120 TObject* pOCDBEntry = LoadAndExtractOCDBObject("GRP/GRP/Data");
121 AliGRPObject* pGRP = pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
122 Float_t beamEnergy=0.;
123 if(pGRP) beamEnergy = pGRP->GetBeamEnergy();
126 if(pGRP) beamType = pGRP->GetBeamType();
128 //!!! set the beam type and the energy explicitly
133 // implement the component initialization
135 if (iResult<0) break;
137 fReconstructor = new AliZDCReconstructor;
138 if (!fReconstructor) {
143 fRawReader = new AliRawReaderMemory;
149 // implement further initialization
155 if (fRawReader) delete fRawReader;
158 if (fReconstructor) delete fReconstructor;
159 fReconstructor = NULL;
164 if((beamType.CompareTo("p-p"))==0) fReconstructor->SetRecoParam(AliZDCRecoParampp::GetLowFluxParam());
165 else if((beamType.CompareTo("A-A"))==0) fReconstructor->SetRecoParam(AliZDCRecoParamPbPb::GetHighFluxParam(beamEnergy));
166 else HLTWarning(" Beam type not known by ZDC!");
169 fReconstructor->Init(beamType, beamEnergy);
175 //_____________________________________________________________________
176 int AliHLTZDCESDRecoComponent::ScanConfigurationArgument(int /*argc*/, const char** argv)
178 // Scan configuration arguments
179 // Return the number of processed arguments
180 // -EPROTO if argument format error (e.g. number expected but not found)
182 // The AliHLTComponent base class implements a parsing loop for argument strings and
183 // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
184 // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
187 TString argument=argv[i];
189 if (argument.IsNull()) return 0;
194 //_____________________________________________________________________
195 int AliHLTZDCESDRecoComponent::DoDeinit()
197 if(fRawReader) delete fRawReader;
199 if(fReconstructor) delete fReconstructor;
204 //_____________________________________________________________________
205 int AliHLTZDCESDRecoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
206 AliHLTComponentTriggerData& /*trigData*/)
208 // event processing function
211 // check if this is a data event, there are a couple of special events
212 // which should be ignored for normal processing
213 if (!IsDataEvent()) return 0;
215 // get ZDC raw input data block and set up the rawreader
216 const AliHLTComponentBlockData* pBlock = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC);
218 ALIHLTERRORGUARD(1, "No ZDC input block at event %d", GetEventCount());
222 // add input block to raw reader
223 if (!fRawReader->SetMemory((UChar_t*) pBlock->fPtr, pBlock->fSize )){
224 HLTError("Could not add buffer of data block %s, 0x%08x to rawreader",
225 DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification);
229 TTree *clusterTree = new TTree();
236 // set ZDC EquipmentID
237 fRawReader->SetEquipmentID(3840);
239 fReconstructor->Reconstruct(fRawReader, clusterTree);
241 fReconstructor->FillZDCintoESD(clusterTree, (AliESDEvent *) NULL);
244 PushBack(static_cast<TObject*>(fReconstructor->GetZDCESDData()),
245 kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC,0);
251 // clear the rawreader
252 fRawReader->ClearBuffers();
258 //_____________________________________________________________________
259 int AliHLTZDCESDRecoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
261 // reconfigure the component from the specified CDB entry, or default CDB entry
262 // function is invoked by the framework if a reconfigure command was received.
269 cdbPath="HLT/ConfigZDC/";
270 cdbPath+=GetComponentID();
272 AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
273 iResult=ConfigureFromCDBTObjString(cdbPath);
279 //_____________________________________________________________________
280 int AliHLTZDCESDRecoComponent::ReadPreprocessorValues(const char* /*modules*/)
282 // see header file for class documentation