#include "AliLog.h"
+#include "AliRsnFunction.h"
#include "AliRsnVATProcessInfo.h"
ClassImp(AliRsnVATProcessInfo)
TNamed(name,name),
fHistUsedEvents(0x0),
fEventUsed(kFALSE),
+ fEventFunctions("AliRsnFunction", 0),
fPrintInfoNumber(1000)
{
//
TNamed(copy),
fHistUsedEvents(0x0),
fEventUsed(copy.fEventUsed),
+ fEventFunctions(copy.fEventFunctions),
fPrintInfoNumber(copy.fPrintInfoNumber)
{
//
fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone();
fEventUsed = copy.fEventUsed;
fPrintInfoNumber = copy.fPrintInfoNumber;
+ fEventFunctions = copy.fEventFunctions;
AliDebug(AliLog::kDebug+2, "Exiting");
// ad objects to list
list->Add(fHistUsedEvents);
+
+ // add all other functions
+ Int_t i;
+ TString hName("");
+ AliRsnFunction *fcn = 0;
+ for (i = 0; i < fEventFunctions.GetEntries(); i++)
+ {
+ fcn = (AliRsnFunction*)fEventFunctions.At(i);
+ hName += GetName();
+ hName += '_';
+ hName += fcn->GetName();
+ if (fcn->IsUsingTH1()) list->Add(fcn->CreateHistogram(hName.Data(), ""));
+ else list->Add(fcn->CreateHistogramSparse(hName.Data(), ""));
+ }
AliDebug(AliLog::kDebug+2, "Exiting");
}
//______________________________________________________________________________
-void AliRsnVATProcessInfo::FillInfo()
+void AliRsnVATProcessInfo::FillInfo(AliRsnEvent *event)
{
//
// This method defines how the information histograms must be filled.
//
fHistUsedEvents->Fill(fEventUsed);
+
+ Int_t i;
+ AliRsnFunction *fcn = 0;
+ for (i = 0; i < fEventFunctions.GetEntries(); i++)
+ {
+ fcn = (AliRsnFunction*)fEventFunctions.At(i);
+ fcn->SetEvent(event);
+ fcn->Fill();
+ }
}
//______________________________________________________________________________
if (fHistUsedEvents) return fHistUsedEvents->Integral();
return 0;
}
+
+//_____________________________________________________________________________
+void AliRsnVATProcessInfo::AddEventFunction(AliRsnFunction * fcn)
+{
+//
+// Adds a new computing function
+//
+
+ AliDebug(AliLog::kDebug+2,"<-");
+
+ fEventFunctions.Print();
+ Int_t size = fEventFunctions.GetEntries();
+ new(fEventFunctions[size]) AliRsnFunction(*fcn);
+
+ AliDebug(AliLog::kDebug+2,"->");
+}
#define ALIRSNVATPROCESSINFO_H
#include <TNamed.h>
+#include <TClonesArray.h>
class TH1I;
+class AliRsnFunction;
+class AliRsnEvent;
class AliRsnVATProcessInfo : public TNamed
{
~AliRsnVATProcessInfo();
void GenerateInfoList(TList* list);
- virtual void FillInfo();
+ virtual void FillInfo(AliRsnEvent *event = 0x0);
virtual void PrintInfo(const Long64_t &num);
const char* GetEventHistogramName() { return Form("hEventsUsed_%s",GetName()); };
Long64_t GetNumerOfEventsProcessed();
void SetEventUsed(Int_t flag) { fEventUsed = flag; }
Int_t IsEventUsed() const { return fEventUsed; };
+ void AddEventFunction(AliRsnFunction *fcn);
void SetPrintInfoNumber(const Long64_t &num=1) { fPrintInfoNumber = num; }
TH1I *fHistUsedEvents; // hist of used events
Int_t fEventUsed; // number of used events
+ TClonesArray fEventFunctions; // collection of functions computed on event
Long64_t fPrintInfoNumber; // print info number