]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnListOutput.h
PWG2/SPECTRA -> PWGLF/SPECTRA migration
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnListOutput.h
1 #ifndef ALIRSNLISTOUTPUT_H
2 #define ALIRSNLISTOUTPUT_H
3
4 //
5 // Class AliRsnListOutput
6 //
7 // This class defines a base classe to implement a Output
8 // which uses the internal RSN package event format (AliRsnEvent).
9 // It contains some default flags which turn out to be useful:
10 //  - a flag to select only the "true" pairs (tracks from same resonance)
11 //  - a flag to know if the computation is done over two events (mixing)
12 //
13 // Any kind of analysis object should be implemented as inheriting from this
14 // because the AliRsnAnalyzer which executes the analysis will accept a collection
15 // of such objects, in order to have a unique format of processing method
16 //
17 // The user who implements a kind of computation type should inherit from
18 // this class and override the virtual Outputs defined in it, which
19 // initialize the final output histogram and define how to process data.
20 //
21 //
22 // author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
23 //
24
25 #include <TRef.h>
26 #include <TNamed.h>
27 #include <TArrayI.h>
28 #include <TObjArray.h>
29
30 #include <TH1.h>
31 #include <TH2.h>
32 #include <TH3.h>
33 #include <TNtuple.h>
34 #include <THnSparse.h>
35
36 class AliCFContainer;
37 class AliRsnValue;
38 class AliRsnDaughter;
39 class AliRsnEvent;
40 class AliRsnListOutput : public TNamed {
41
42 public:
43
44    enum EOut {
45       kHistoDefault,
46       kHistoSparse,
47       kCFContainer
48    };
49
50    AliRsnListOutput(const char *name = "", EOut type = kHistoDefault);
51    AliRsnListOutput(const AliRsnListOutput &copy);
52    AliRsnListOutput &operator=(const AliRsnListOutput &copy);
53    virtual ~AliRsnListOutput();
54
55    EOut            GetType() const         {return  fType;}
56    Int_t           GetSteps() const        {return  fSteps;}
57    TObjArray      *GetValues()             {return &fValues;}
58    Int_t           GetNValues()            {return (fNValues = fValues.GetEntries());}
59    AliRsnValue    *GetValue(Int_t i) const {return (AliRsnValue *)fValues[i];}
60    Int_t           GetIndex() const        {return  fIndex;}
61    void            SetType(EOut type)      {fType = type;}
62    void            SetSteps(Int_t n)       {fSteps = n;}
63    void            SetSkipFailed(Bool_t y) {fSkipFailed = y;}
64
65    void            AddValue(AliRsnValue *value);
66
67    virtual void    Reset();
68    virtual Bool_t  Init(const char *prefix, TList *list);
69    virtual Bool_t  Fill(TObject *target, Int_t step = 0);
70    virtual Bool_t  Fill(AliRsnEvent *ev,AliRsnDaughter *d);
71
72 private:
73
74    TH1            *CreateHistogram(const char *name);
75    THnSparseF     *CreateHistogramSparse(const char *name);
76    AliCFContainer *CreateCFContainer(const char *name);
77
78    Bool_t           fSkipFailed;    //  tell to skip fills when one computation fails
79    EOut             fType;          //  output format among allowed ones
80    Int_t            fSteps;         //  number of steps (only for container)
81    TObjArray        fValues;        //  container for all related values
82    Int_t            fNValues;       //! number of values (internal use)
83    TList           *fList;          //! list containing the output
84    Int_t            fIndex;         //  index of object in the list
85
86    TArrayD          fArray;         //! temp array of computed values
87
88    ClassDef(AliRsnListOutput, 1)    //  AliRsnListOutput class
89 };
90
91 #endif