-// $Id:$
+// $Id$
/**************************************************************************
* This file is property of and copyright by the ALICE HLT Project *
* ALICE Experiment at CERN, All rights reserved. *
#include "AliHLTGlobalTrigger.h"
#include "AliHLTGlobalTriggerDecision.h"
+#include "TArrayL64.h"
+#include "TClonesArray.h"
#include <cstring>
+#include <cassert>
ClassImp(AliHLTGlobalTrigger)
AliHLTGlobalTrigger::AliHLTGlobalTrigger() :
- AliHLTLogging(),
- fCounters()
+ AliHLTLogging()
+ , fCounters(NULL)
{
// Default constructor.
}
AliHLTGlobalTrigger::~AliHLTGlobalTrigger()
{
// Default destructor.
+ if (fCounters) {
+ delete fCounters;
+ }
}
{
// Resets the trigger counters.
- fCounters.Set(number);
+ if (!fCounters) fCounters = new TArrayL64(number);
+ if (!fCounters) return;
+
+ fCounters->Set(number);
for (UInt_t i = 0; i < number; i++)
{
- fCounters[i] = 0;
+ (*fCounters)[i] = 0;
}
}
+void AliHLTGlobalTrigger::IncrementCounter(UInt_t i)
+{
+ // increment a specific counter
+ if (fCounters && i<fCounters->GetSize()) ++(*fCounters)[i];
+}
+
+Long64_t AliHLTGlobalTrigger::GetCounter(UInt_t i) const
+{
+ if (fCounters && i<fCounters->GetSize()) return (*fCounters)[i];
+ return 0;
+}
//-*- Mode: C++ -*-
-// $Id:$
+// $Id$
#ifndef ALIHLTGLOBALTRIGGER_H
#define ALIHLTGLOBALTRIGGER_H
/* This file is property of and copyright by the ALICE HLT Project *
/// @brief Declaration of the AliHLTGlobalTrigger base class.
#include "TObject.h"
-#include "TArrayL64.h"
#include "AliHLTDataTypes.h"
#include "AliHLTLogging.h"
class AliHLTGlobalTriggerDecision;
class AliHLTTriggerMenu;
class TClonesArray;
+class TArrayL64;
/**
* \class AliHLTGlobalTrigger
/**
* Returns the array of trigger counters.
*/
- const TArrayL64& Counters() const { return fCounters; }
-
+ const TArrayL64* Counters() const { return fCounters; }
+
protected:
/**
static Factory* fFactory[kMaxFactories];
};
- /// Not implemented. Do not allow copying of this object.
- AliHLTGlobalTrigger(const AliHLTGlobalTrigger& obj);
- /// Not implemented. Do not allow copying of this object.
- AliHLTGlobalTrigger& operator = (const AliHLTGlobalTrigger& obj);
-
/**
* Increments a trigger counter by one.
* \param i The counter to increment.
*/
- void IncrementCounter(UInt_t i) { ++fCounters[i]; };
+ void IncrementCounter(UInt_t i);
/**
* Returns a trigger counter's value.
* \param i The counter number to return.
*/
- Long64_t GetCounter(UInt_t i) const { return fCounters[i]; };
+ Long64_t GetCounter(UInt_t i) const;
private:
-
- TArrayL64 fCounters; //! Event trigger counters. One counter for each trigger class.
+ /// Not implemented. Do not allow copying of this object.
+ AliHLTGlobalTrigger(const AliHLTGlobalTrigger& obj);
+ /// Not implemented. Do not allow copying of this object.
+ AliHLTGlobalTrigger& operator = (const AliHLTGlobalTrigger& obj);
+
+ TArrayL64* fCounters; //! Event trigger counters. One counter for each trigger class.
ClassDef(AliHLTGlobalTrigger, 0) // Global HLT trigger base class which implements logic for a particular trigger menu.
};
decision.ReadoutList(maskedList);
}
- decision.SetCounters(fTrigger->Counters(), GetEventCount()+1);
+ const TArrayL64* counters=fTrigger->Counters();
+ if (counters) {
+ decision.SetCounters(*counters, GetEventCount()+1);
+ }
static UInt_t lastTime=0;
TDatime time;
if (time.Get()-lastTime>5) {
{
// print some statistics
ULong64_t count=0;
- for (int i=0; i<pTrigger->Counters().GetSize(); i++) {
- count+=pTrigger->Counters()[i];
+ const TArrayL64* counters=pTrigger->Counters();
+ for (int i=0; counters!=NULL && i<counters->GetSize(); i++) {
+ count+=(*counters)[i];
}
int totalEvents=GetEventCount()+offset;
float ratio=0;