]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added the possibility to include a function in the ProcessInfo object, to produce...
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 30 Nov 2010 08:17:48 +0000 (08:17 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 30 Nov 2010 08:17:48 +0000 (08:17 +0000)
PWG2/RESONANCES/AliRsnVATProcessInfo.cxx
PWG2/RESONANCES/AliRsnVATProcessInfo.h
PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx
PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h

index 981494d1d50c5e48ffb5cab33db257dfb5917eb0..dafe636adce61defc1df7e571d76f9dc18f6d618 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "AliLog.h"
 
+#include "AliRsnFunction.h"
 #include "AliRsnVATProcessInfo.h"
 
 ClassImp(AliRsnVATProcessInfo)
@@ -24,6 +25,7 @@ AliRsnVATProcessInfo::AliRsnVATProcessInfo(const char *name) :
   TNamed(name,name),
   fHistUsedEvents(0x0),
   fEventUsed(kFALSE),
+  fEventFunctions("AliRsnFunction", 0),
   fPrintInfoNumber(1000)
 {
 //
@@ -40,6 +42,7 @@ AliRsnVATProcessInfo::AliRsnVATProcessInfo(const AliRsnVATProcessInfo& copy) :
   TNamed(copy),
   fHistUsedEvents(0x0),
   fEventUsed(copy.fEventUsed),
+  fEventFunctions(copy.fEventFunctions),
   fPrintInfoNumber(copy.fPrintInfoNumber)
 {
 //
@@ -68,6 +71,7 @@ AliRsnVATProcessInfo& AliRsnVATProcessInfo::operator=
   fHistUsedEvents  = (TH1I*)copy.fHistUsedEvents->Clone();
   fEventUsed       = copy.fEventUsed;
   fPrintInfoNumber = copy.fPrintInfoNumber;
+  fEventFunctions  = copy.fEventFunctions;
   
   AliDebug(AliLog::kDebug+2, "Exiting");
   
@@ -113,12 +117,26 @@ void AliRsnVATProcessInfo::GenerateInfoList(TList *list)
 
   // 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.
@@ -130,6 +148,15 @@ void AliRsnVATProcessInfo::FillInfo()
 //
 
   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();
+  }
 }
 
 //______________________________________________________________________________
@@ -153,3 +180,19 @@ Long64_t AliRsnVATProcessInfo::GetNumerOfEventsProcessed()
   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,"->");
+}
index 98661336d6e0f70b626dd88d68c52b365254ee5c..06aa03b4576501e71dc0694c46bd476e4d434640 100644 (file)
 #define ALIRSNVATPROCESSINFO_H
 
 #include <TNamed.h>
+#include <TClonesArray.h>
 
 class TH1I;
+class AliRsnFunction;
+class AliRsnEvent;
 
 class AliRsnVATProcessInfo : public TNamed
 {
@@ -26,13 +29,14 @@ 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; }
 
@@ -40,6 +44,7 @@ class AliRsnVATProcessInfo : public TNamed
 
     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 
 
index 6aa237ebd46834ddff36a12d29fbc159cbf10e29..3c0c62b6c24fcf34a893cfbfabfa91dcc8669151 100644 (file)
@@ -13,6 +13,7 @@
 #include "AliESDEvent.h"
 #include "AliMCEvent.h"
 #include "AliAODEvent.h"
+#include "AliRsnEvent.h"
 
 ClassImp(AliRsnVAnalysisTaskSE)
 
@@ -299,7 +300,7 @@ void AliRsnVAnalysisTaskSE::FillInfo()
 
   AliDebug(AliLog::kDebug+2, "<-");
 
-  fTaskInfo.FillInfo();
+  fTaskInfo.FillInfo(&fRsnEvent);
 
   AliDebug(AliLog::kDebug+2,"->");
 }
index 91fab55f8f3e1e1dcc900130e4a7dd5965d0c5c8..c99464ddc5defd1e296ba5a797a47f92d9a78939 100644 (file)
@@ -51,7 +51,8 @@ class AliRsnVAnalysisTaskSE : public AliAnalysisTaskSE
     virtual void    FillInfo();
 
     // Prior probs
-    AliRsnEvent*    GetRsnEvent() {return &fRsnEvent;}
+    AliRsnEvent*           GetRsnEvent() {return &fRsnEvent;}
+    AliRsnVATProcessInfo*  GetInfo()     {return &fTaskInfo;}
 
     void SetMCOnly(Bool_t mcOnly = kTRUE) {fMCOnly = mcOnly;}
     void SetLogType(AliLog::EType_t type, TString allClasses = "");