]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/trigger/AliHLTTriggerAgent.cxx
code cleanup, removing member variable for L3 field and passing it as a function...
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTriggerAgent.cxx
CommitLineData
89858ccc 1// $Id$
2
3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8//* for The ALICE HLT Project. *
9//* *
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//**************************************************************************
18
19/** @file AliHLTTriggerAgent.cxx
20 @author Matthias Richter
21 @date
22 @brief Agent of the libAliHLTTrigger library
23*/
24
25#include <cassert>
26#include "AliHLTTriggerAgent.h"
18a9a5ad 27#include "AliHLTTriggerDecision.h"
8a8ea98b 28#include "AliHLTGlobalTriggerDecision.h"
18a9a5ad 29#include "AliHLTOUT.h"
30#include "AliHLTMessage.h"
31#include "AliESDEvent.h"
c86017ac 32#include "TObjString.h"
33#include "TObjArray.h"
18a9a5ad 34#include "TArrayC.h"
8a8ea98b 35#include "TFile.h"
36#include "TTree.h"
89858ccc 37
38// header files of library components
39#include "AliHLTEventSummaryProducerComponent.h"
40#include "AliHLTRunSummaryProducerComponent.h"
c86017ac 41#include "AliHLTTriggerBarrelMultiplicity.h"
5f4502cc 42#include "AliHLTD0Trigger.h"
43#include "AliHLTTriggerITSMultiplicity.h"
fde46e9e 44#include "AliHLTTriggerBarrelGeomMultiplicity.h"
5d79eb88 45#include "AliHLTGlobalTriggerComponent.h"
765d85f8 46#include "AliHLTTriggerPhosClusterEnergy.h"
739e2587 47#include "AliHLTTriggerEmcalClusterEnergy.h"
f86ecd3e 48#include "AliHLTTriggerPhosMip.h"
495570cd 49#include "AliHLTTriggerTrdClusterMultiplicity.h"
fc2b0c6d 50#include "AliHLTTriggerGammaConversion.h"
c1550d2c 51#include "AliHLTMuonSpectroTriggerComponent.h"
4d097162 52#include "AliHLTUpcTriggerComponent.h"
742ae1c4 53#include "AliHLTTriggerCounterComponent.h"
4d097162 54
89858ccc 55
56/** global instance for agent registration */
57AliHLTTriggerAgent gAliHLTTriggerAgent;
58
59/** ROOT macro for the implementation of ROOT specific class methods */
60ClassImp(AliHLTTriggerAgent)
61
62AliHLTTriggerAgent::AliHLTTriggerAgent()
18a9a5ad 63 : AliHLTModuleAgent("Trigger")
64 , fTriggerDecisionHandler(NULL)
89858ccc 65{
66 // see header file for class documentation
67 // or
68 // refer to README to build package
69 // or
70 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
71}
72
73AliHLTTriggerAgent::~AliHLTTriggerAgent()
74{
75 // see header file for class documentation
76}
77
78int AliHLTTriggerAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
79{
80 // see header file for class documentation
81 assert(pHandler);
82 if (!pHandler) return -EINVAL;
5d79eb88 83 pHandler->AddComponent(new AliHLTGlobalTriggerComponent);
c86017ac 84 pHandler->AddComponent(new AliHLTTriggerBarrelMultiplicity);
5f4502cc 85 pHandler->AddComponent(new AliHLTTriggerITSMultiplicity);
86 pHandler->AddComponent(new AliHLTD0Trigger);
fde46e9e 87 pHandler->AddComponent(new AliHLTTriggerBarrelGeomMultiplicity);
765d85f8 88 pHandler->AddComponent(new AliHLTTriggerPhosClusterEnergy);
739e2587 89 pHandler->AddComponent(new AliHLTTriggerEmcalClusterEnergy);
f86ecd3e 90 pHandler->AddComponent(new AliHLTTriggerPhosMip);
fc2b0c6d 91 pHandler->AddComponent(new AliHLTTriggerTrdClusterMultiplicity);
92 pHandler->AddComponent(new AliHLTTriggerGammaConversion);
c1550d2c 93 pHandler->AddComponent(new AliHLTMuonSpectroTriggerComponent);
4d097162 94 pHandler->AddComponent(new AliHLTUpcTriggerComponent);
742ae1c4 95 pHandler->AddComponent(new AliHLTTriggerCounterComponent);
89858ccc 96 return 0;
97}
98
c86017ac 99int AliHLTTriggerAgent::CreateConfigurations(AliHLTConfigurationHandler* pHandler,
f7aab453 100 AliRawReader* rawReader,
101 AliRunLoader* runloader) const
c86017ac 102{
103 // see header file for class documentation
104 if (!pHandler) return -EINVAL;
105
106 TString triggerInputs;
107 TString triggerOutputs;
108 TString configurationId;
109 /////////////////////////////////////////////////////////////////////////////////////
110 //
111 // a central barrel charged particle multiplicity trigger
112 configurationId="TRIGGER-Barrel-Multiplicity";
113
feb0a3ff 114 // define the inputs for the BarrelMultiplicityTrigger
c86017ac 115 triggerInputs="GLOBAL-esd-converter";
116
117 // check for the availibility
118 TObjArray* pTokens=triggerInputs.Tokenize(" ");
119 triggerInputs="";
120 if (pTokens) {
121 for (int n=0; n<pTokens->GetEntriesFast(); n++) {
122 TString module=((TObjString*)pTokens->At(n))->GetString();
123 if (pHandler->FindConfiguration(module.Data())) {
124 triggerInputs+=module;
125 triggerInputs+=" ";
126 }
127 }
128 delete pTokens;
129 }
130
feb0a3ff 131 TString arg;
c86017ac 132 if (triggerInputs.Length()>0) {
feb0a3ff 133 // define multiple instances of the BarrelMultiplicityTrigger with different settings
c86017ac 134 HLTInfo("Configuring inputs for %s: %s", configurationId.Data(), triggerInputs.Data());
135 pHandler->CreateConfiguration(configurationId.Data(), "BarrelMultiplicityTrigger", triggerInputs.Data(), "");
136 if (triggerOutputs.Length()>0) triggerOutputs+=" ";
137 triggerOutputs+=configurationId;
feb0a3ff 138
139 configurationId="TRIGGER-Barrel-HighMultiplicity";
140 arg="-triggername BarrelHighMultiplicity";
141 pHandler->CreateConfiguration(configurationId.Data(), "BarrelMultiplicityTrigger", triggerInputs.Data(), arg.Data());
142 if (triggerOutputs.Length()>0) triggerOutputs+=" ";
143 triggerOutputs+=configurationId;
144
145 configurationId="TRIGGER-Barrel-Pt_v01";
146 arg="-triggername BarrelPt_v01";
147 pHandler->CreateConfiguration(configurationId.Data(), "BarrelMultiplicityTrigger", triggerInputs.Data(), arg.Data());
148 if (triggerOutputs.Length()>0) triggerOutputs+=" ";
149 triggerOutputs+=configurationId;
150
151 configurationId="TRIGGER-Barrel-Pt_v02";
152 arg="-triggername BarrelPt_v02";
153 pHandler->CreateConfiguration(configurationId.Data(), "BarrelMultiplicityTrigger", triggerInputs.Data(), arg.Data());
154 if (triggerOutputs.Length()>0) triggerOutputs+=" ";
155 triggerOutputs+=configurationId;
156
157 configurationId="TRIGGER-Barrel-Pt_v03";
158 arg="-triggername BarrelPt_v03";
159 pHandler->CreateConfiguration(configurationId.Data(), "BarrelMultiplicityTrigger", triggerInputs.Data(), arg.Data());
160 if (triggerOutputs.Length()>0) triggerOutputs+=" ";
161 triggerOutputs+=configurationId;
c86017ac 162 } else {
163 HLTWarning("No inputs for %s found, skipping component", configurationId.Data());
164 }
c1550d2c 165
166 /////////////////////////////////////////////////////////////////////////////////////
167 // The muon spectrometer trigger
168 configurationId = "TRIGGER-Muon-Spectrometer";
169
170 // define the inputsfor the muon spectrometer trigger.
171 if (pHandler->FindConfiguration("dHLT-sim-fromRaw")) {
172 triggerInputs = "dHLT-sim-fromRaw";
173 }
174 else if (pHandler->FindConfiguration("dHLT-sim")) {
175 triggerInputs = "dHLT-sim";
176 }
177 else if (pHandler->FindConfiguration("dHLT-sim-fromMC")) {
178 triggerInputs = "dHLT-sim-fromMC";
179 }
180
181 if (triggerInputs.Length() > 0) {
182 HLTInfo("Configuring inputs for %s: %s", configurationId.Data(), triggerInputs.Data());
183 pHandler->CreateConfiguration(configurationId.Data(), "MuonSpectroTrigger", triggerInputs.Data(), "-makestats");
184 if (triggerOutputs.Length() > 0) triggerOutputs += " ";
185 triggerOutputs += configurationId;
186 } else {
187 HLTWarning("No inputs for %s found, skipping component.", configurationId.Data());
188 }
c86017ac 189
f7aab453 190 /////////////////////////////////////////////////////////////////////////////////////
191 // D0 trigger
192 configurationId = "TRIGGER-D0";
193 if(runloader && !rawReader){
194 // simulation without simulated raw data
195 // use ESD as input and add in addition the MC information for trigger evaluation
196 triggerInputs="GLOBAL-esd-converter ";
66a3076c 197
198 // 2010-09-13
199 // disable the publishing of MC information. It seems to be way too big for AA
200 // simulation, anyhow the evaluation of the trigger should be done outside the
201 // component
202 // const char* mcpublisherId="TRIGGER-mc-publisher";
203 // pHandler->CreateConfiguration(mcpublisherId, "ESDMCEventPublisher", NULL, "-entrytype MC -datapath ./");
204 // triggerInputs+=mcpublisherId;
f7aab453 205 }
206 else{
207 // simulation with simulated raw data, or raw data reconstruction
208 // use input from ITS tracker and vertexer directly
209 triggerInputs="ITS-tracker GLOBAL-vertexer";
210 }
211
212 // check for the availibility of inputs
213 pTokens=triggerInputs.Tokenize(" ");
214 triggerInputs="";
215 if (pTokens) {
216 for (int n=0; n<pTokens->GetEntriesFast(); n++) {
217 TString module=((TObjString*)pTokens->At(n))->GetString();
218 if (pHandler->FindConfiguration(module.Data())) {
219 triggerInputs+=module;
220 triggerInputs+=" ";
221 }
222 }
223 delete pTokens;
224 }
225
226 TString argD0 = "";
227 if (triggerInputs.Length()>0) {
228 HLTInfo("Configuring inputs for %s: %s", configurationId.Data(), triggerInputs.Data());
229 pHandler->CreateConfiguration(configurationId.Data(), "D0Trigger", triggerInputs.Data(), argD0.Data());
94001d9d 230 // FIXME: due to a rare segfault for reconstruction of PbPb data the
231 // component is temporarily excluded
232 // https://savannah.cern.ch/bugs/?72590
233 //if (triggerOutputs.Length()>0) triggerOutputs+=" ";
234 //triggerOutputs+=configurationId;
f7aab453 235 } else {
236 HLTWarning("No inputs for %s found, skipping component", configurationId.Data());
237 }
238
c86017ac 239 /////////////////////////////////////////////////////////////////////////////////////
240 //
241 // the global trigger component
242 configurationId="GLOBAL-Trigger";
243 HLTInfo("setting inputs for %s: %s", configurationId.Data(), triggerOutputs.IsNull()?"none":triggerOutputs.Data());
244 pHandler->CreateConfiguration(configurationId.Data(), "HLTGlobalTrigger", triggerOutputs.Data(), "");
245
246 return 0;
247}
248
249const char* AliHLTTriggerAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
250 AliRunLoader* runloader) const
251{
252 // see header file for class documentation
253 if (runloader) {
254 // reconstruction chains for AliRoot simulation
255 // Note: run loader is only available while running embedded into
256 // AliRoot simulation
257
258 // currently disabled due to a problem compiling the runtime trigger library
18a9a5ad 259 return "GLOBAL-Trigger";
c86017ac 260 }
261 return NULL;
262}
263
264const char* AliHLTTriggerAgent::GetRequiredComponentLibraries() const
265{
266 // see header file for class documentation
267
86aebdca 268 return "";
c86017ac 269}
270
89858ccc 271int AliHLTTriggerAgent::GetHandlerDescription(AliHLTComponentDataType dt,
272 AliHLTUInt32_t /*spec*/,
273 AliHLTOUTHandlerDesc& desc) const
274{
275 // see header file for class documentation
276
18a9a5ad 277 // handler of the trigger decisions {'ROOTTOBJ':'HLT '}
278 // currently stored as a TObject with the common data type and origin
279 // HLTOUT. However we might need a separate data type in order to
280 // avoid interference with other handlers
281 // the handler produces an ESD object in order to be merged to the
282 // hltEsd afterwards
8a8ea98b 283 // 2009-11-17 adding the data tyepes for (global) trigger decisions
284 // the TObject data types stays for a while in order to preserve
285 // backward compatibility
286 if (dt==(kAliHLTDataTypeTObject|kAliHLTDataOriginOut) ||
287 dt==kAliHLTDataTypeTriggerDecision ||
288 dt==kAliHLTDataTypeGlobalTrigger) {
18a9a5ad 289 desc=AliHLTOUTHandlerDesc(AliHLTModuleAgent::kEsd, dt, GetModuleId());
290 return 1;
291 }
292
89858ccc 293 // handler for the HLT readou list and trigger data data blocks {'HLTRDLST':'HLT '}
294 if (dt==AliHLTComponentDataTypeInitializer("HLTRDLST", kAliHLTDataOriginOut) ||
295 dt==AliHLTComponentDataTypeInitializer("HLTTRGDT", kAliHLTDataOriginOut)) {
296 desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
297 return 1;
298 }
299
300 return 0;
301}
302
303AliHLTOUTHandler* AliHLTTriggerAgent::GetOutputHandler(AliHLTComponentDataType dt,
18a9a5ad 304 AliHLTUInt32_t /*spec*/)
89858ccc 305{
306 // see header file for class documentation
307
18a9a5ad 308 // raw data blocks to be fed into offline reconstruction
8a8ea98b 309 if ((dt==(kAliHLTDataTypeTObject|kAliHLTDataOriginOut) ||
310 (dt==kAliHLTDataTypeTriggerDecision) ||
311 (dt==kAliHLTDataTypeGlobalTrigger))) {
18a9a5ad 312 if (!fTriggerDecisionHandler) {
313 fTriggerDecisionHandler=new AliHLTTriggerAgent::AliHLTTriggerDecisionHandler;
314 }
315 return fTriggerDecisionHandler;
316 }
317
89858ccc 318 // handler for the HLT readou list and trigger data data blocks {'HLTRDLST':'HLT '}
319 if (dt==AliHLTComponentDataTypeInitializer("HLTRDLST", kAliHLTDataOriginOut) ||
320 dt==AliHLTComponentDataTypeInitializer("HLTTRGDT", kAliHLTDataOriginOut)) {
321 return NULL;
322 }
323
324 return NULL;
325}
326
327int AliHLTTriggerAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
328{
329 // see header file for class documentation
330 if (pInstance==NULL) return -EINVAL;
331
18a9a5ad 332 if (pInstance==fTriggerDecisionHandler) {
333 delete fTriggerDecisionHandler;
334 fTriggerDecisionHandler=NULL;
335 }
336
89858ccc 337 return 0;
338}
18a9a5ad 339
340AliHLTTriggerAgent::AliHLTTriggerDecisionHandler::AliHLTTriggerDecisionHandler()
341 : AliHLTOUTHandler()
342 , fESD(NULL)
343 , fpData(NULL)
344 , fSize(0)
8a8ea98b 345 , fpESDfile(NULL)
346 , fpESDtree(NULL)
18a9a5ad 347{
348 // see header file for class documentation
349}
350
351AliHLTTriggerAgent::AliHLTTriggerDecisionHandler::~AliHLTTriggerDecisionHandler()
352{
353 // see header file for class documentation
8a8ea98b 354 if (fpESDtree) {
355 fpESDtree->GetUserInfo()->Clear();
356 delete fpESDtree;
357 }
358 fpESDtree=NULL;
359
360 if (fpESDfile) {
361 fpESDfile->Close();
362 delete fpESDfile;
363 }
364 fpESDfile=NULL;
365
18a9a5ad 366 if (fESD) delete fESD;
367 fESD=NULL;
368
369 if (fpData) delete fpData;
370 fpData=NULL;
371 fSize=0;
372}
373
374int AliHLTTriggerAgent::AliHLTTriggerDecisionHandler::ProcessData(AliHLTOUT* pData)
375{
376 // see header file for class documentation
377 if (!pData) return -EINVAL;
8a8ea98b 378 int iResult=0;
379 AliHLTGlobalTriggerDecision* pGlobalDecision=NULL;
380 TObjArray triggerDecisions;
381 triggerDecisions.SetOwner(kTRUE);
382 for (iResult=pData->SelectFirstDataBlock(); iResult>=0; iResult=pData->SelectNextDataBlock()) {
383 AliHLTComponentDataType dt=kAliHLTVoidDataType;
384 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
385 if ((iResult=pData->GetDataBlockDescription(dt, spec))<0) break;
18a9a5ad 386 TObject* pObject=pData->GetDataObject();
387 if (pObject) {
8a8ea98b 388 if(dt==kAliHLTDataTypeGlobalTrigger) {
389 if (!pGlobalDecision) {
390 if ((pGlobalDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(pObject))==NULL ||
391 (pGlobalDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(pGlobalDecision->Clone()))==NULL) {
392 HLTFatal("can not convert object of name %s (%s) to HLTGlobalTriggerDecsion according to data type", pObject->GetName(), pObject->Class()->GetName());
393 }
394 } else {
395 HLTWarning("multiple HLT GlobalTrigger decision objects, ignoring all but the first one");
396 }
397 } else if (dt==kAliHLTDataTypeTriggerDecision) {
398 if (pObject->IsA() == AliHLTTriggerDecision::Class() &&
399 !(pObject->IsA() == AliHLTGlobalTriggerDecision::Class())) {
400 AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(pObject);
401 if (pDecision) {
402 if (pGlobalDecision) {
403 // add directly
404 pGlobalDecision->AddTriggerInput(*pDecision);
405 } else {
406 // schedule
407 triggerDecisions.Add(pDecision->Clone());
408 }
409 } else {
410 HLTFatal("can not convert object of name %s (%s) to HLT TriggerDecsion according to data type", pObject->GetName(), pObject->Class()->GetName());
411 }
412 }
413 } else if (dt==(kAliHLTDataTypeTObject|kAliHLTDataOriginOut)){
414 // this is the branch for keeping compatibility
415 // the first version of the trigger framework was using the kAliHLTDataTypeTObject
416 // data type instead of the specific data types for HLT triggers
417 // this effects the cosmic data taken Sep to Oct 2009
418 if (pObject->IsA() == AliHLTGlobalTriggerDecision::Class()) {
419 if (!pGlobalDecision) {
420 if ((pGlobalDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(pObject))==NULL ||
421 (pGlobalDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(pGlobalDecision->Clone()))==NULL) {
422 HLTFatal("can not convert object of name %s (%s) to HLTGlobalTriggerDecsion according to data type", pObject->GetName(), pObject->Class()->GetName());
423 }
424 } else {
425 HLTWarning("multiple HLT GlobalTrigger decision objects, ignoring all but the first one");
426 }
427 } else if (pObject->IsA() == AliHLTTriggerDecision::Class()) {
428 AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(pObject);
429 if (pDecision) {
430 if (pGlobalDecision) {
431 // add directly
432 pGlobalDecision->AddTriggerInput(*pDecision);
433 } else {
434 // schedule
435 triggerDecisions.Add(pDecision->Clone());
436 }
437 } else {
438 HLTFatal("can not convert object of name %s (%s) to HLT TriggerDecsion according to data type", pObject->GetName(), pObject->Class()->GetName());
439 }
440 }
441 }
442 pData->ReleaseDataObject(pObject);
443 pObject=NULL;
444 } else {
445 HLTError("can not get TObject from HLTOUT buffer");
446 iResult=-ENODATA;
447 }
448 }
449 // -ENOENT just signals that there are no more entries
450 if (iResult==-ENOENT) iResult=0;
451
452 if (pGlobalDecision) {
453 for (int i=0; i<triggerDecisions.GetEntriesFast(); i++) {
454 if (triggerDecisions[i]) {
455 pGlobalDecision->AddTriggerInput(*((AliHLTTriggerDecision*)triggerDecisions[i]));
456 }
457 }
458 triggerDecisions.Delete();
459 AliHLTTriggerDecision* pDecision=pGlobalDecision;
460 {
30d84601 461 if (pDecision) {
e13512e4 462 //pDecision->Print();
30d84601 463 HLTDebug("extracted %s", pDecision->GetName());
18a9a5ad 464 if (!fESD) {
465 // create the ESD container, but without std content
466 fESD = new AliESDEvent;
467 }
468 if (!fpData) fpData=new TArrayC;
469 if (fESD && fpData) {
470 fESD->Reset();
30d84601 471 TObject* pESDObject=fESD->FindListObject("HLTGlobalTrigger");
472 if (pESDObject) {
473 // copy the content to the already existing object
8a8ea98b 474 pDecision->Copy(*pESDObject);
30d84601 475 } else {
476 // add a new object
8a8ea98b 477 fESD->AddObject(pDecision->Clone());
30d84601 478 }
8a8ea98b 479 WriteESD();
18a9a5ad 480 AliHLTMessage* pMsg=AliHLTMessage::Stream(fESD);
481 if (pMsg) {
482 if (!pMsg->CompBuffer()) {
483 fSize=pMsg->Length();
484 fpData->Set(fSize, pMsg->Buffer());
485 } else {
486 fSize=pMsg->CompLength();
487 fpData->Set(fSize, pMsg->CompBuffer());
488 }
d2f8c983 489 delete pMsg;
490 pMsg=NULL;
18a9a5ad 491 } else {
492 HLTError("streaming of objects failed");
493 }
494 } else {
495 HLTError("memory allocation failed");
496 iResult=-ENOMEM;
497 }
18a9a5ad 498 }
18a9a5ad 499 }
8a8ea98b 500 delete pGlobalDecision;
501 pGlobalDecision=NULL;
502 } else {
503 HLTError("no global trigger found in data collection");
18a9a5ad 504 }
8a8ea98b 505
e13512e4 506 if (iResult>=0) {
e13512e4 507 return fSize;
508 }
18a9a5ad 509 fSize=0;
510 return iResult;
511}
512
513int AliHLTTriggerAgent::AliHLTTriggerDecisionHandler::GetProcessedData(const AliHLTUInt8_t* &pData)
514{
515 // see header file for class documentation
516 if (!fpData) {
517 pData=NULL;
518 return 0;
519 }
520
521 pData=reinterpret_cast<AliHLTUInt8_t*>(fpData->GetArray());
522 return fSize;
523}
524
525int AliHLTTriggerAgent::AliHLTTriggerDecisionHandler::ReleaseProcessedData(const AliHLTUInt8_t* pData, int size)
526{
527 // see header file for class documentation
528 int iResult=0;
529 if (!fpData || size != fSize ||
530 const_cast<AliHLTUInt8_t*>(pData) != reinterpret_cast<AliHLTUInt8_t*>(fpData->GetArray())) {
531 HLTError("attempt to release to wrong data buffer %p size %d, expected %p size %d", pData, size, fpData?fpData->GetArray():NULL, fSize);
532 }
533 fSize=0;
534 return iResult;
535}
8a8ea98b 536
537int AliHLTTriggerAgent::AliHLTTriggerDecisionHandler::WriteESD()
538{
539 // see header file for class documentation
540 int iResult=0;
541 if (!fESD) return 0;
542 if (!fpESDfile) {
543 fpESDfile=new TFile("HLTdecision.root", "RECREATE");
544 }
545 if (!fpESDtree) {
546 fpESDtree=new TTree("HLTesdTree", "Tree with HLT ESD containing HLT decision");
547 if (fpESDtree) {
548 fESD->WriteToTree(fpESDtree);
549 fpESDtree->GetUserInfo()->Add(fESD);
550 }
551 }
552 if (!fpESDfile || !fpESDtree) return -ENOMEM;
553
554 fpESDtree->Fill();
555 fpESDfile->cd();
556 fpESDtree->Write(fpESDtree->GetName(),TObject::kOverwrite);
557
558 return iResult;
559}