]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/qa/QARing.h
Fixes for pA indenfication of events
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / qa / QARing.h
1 /**
2  * @file   QARing.h
3  * @author Christian Holm Christensen <cholm@nbi.dk>
4  * @date   Thu Nov 17 12:16:51 2011
5  * 
6  * @brief  Base class for QA rings
7  * 
8  * @ingroup pwglf_forward_qa_scripts
9  */
10 #ifndef QARING_H
11 #define QARING_H
12 #ifndef __CINT__
13 # include "QAStructs.h"
14 #else 
15 class RingQuantity;
16 class FitStatus;
17 class Merge;
18 class DataLoss;
19 class Correlation;
20 class TTree;
21 #endif
22
23 /**
24  * Base class for QA rings.  This manages the per-ring entries in the
25  * tree 
26  * 
27  * @ingroup pwglf_forward_qa_scripts
28  */
29 struct QARing 
30
31   /** 
32    * Constructor 
33    * 
34    * @param d  Detector
35    * @param r  Ring
36    * 
37    * @return 
38    */
39   QARing(UShort_t d, Char_t r) 
40   : fD(d), fR(r),
41     fChi2(0), 
42     fC(0), 
43     fDelta(0), 
44     fXi(0), 
45     fSigma(0),
46     fFitStatus(0),
47     fMerge(0),
48     fDataLoss(0),
49     fOccupancy(0),
50     fCorrelation(0)
51   {}
52   /** 
53    * Destructor 
54    */
55   virtual ~QARing()
56   {
57     if (fChi2)          { delete fChi2;         fChi2           = 0; } 
58     if (fC)             { delete fC;            fC              = 0; } 
59     if (fDelta)         { delete fDelta;        fDelta          = 0; } 
60     if (fXi)            { delete fXi;           fXi             = 0; } 
61     if (fSigma)         { delete fSigma;        fSigma          = 0; }
62     if (fFitStatus)     { delete fFitStatus;    fFitStatus      = 0; }
63     if (fMerge)         { delete fMerge;        fMerge          = 0; }
64     if (fDataLoss)      { delete fDataLoss;     fDataLoss       = 0; }
65     if (fOccupancy)     { delete fOccupancy;    fOccupancy      = 0; }
66     if (fCorrelation)   { delete fCorrelation;  fCorrelation    = 0; } 
67   }
68   /** 
69    * Initialise 
70    * 
71    * @param tree Tree to read from/write to
72    * @param read If true, read from tree, other wise write 
73    * 
74    * @return true on success
75    */
76   Bool_t Init(TTree* tree, bool read=false)
77   {
78     if (!read) {
79       fChi2        = RingQuantity::MakeBranch(tree, fD, fR, "chi2");
80       fC           = RingQuantity::MakeBranch(tree, fD, fR, "c");
81       fDelta       = RingQuantity::MakeBranch(tree, fD, fR, "delta");
82       fXi          = RingQuantity::MakeBranch(tree, fD, fR, "xi");
83       fSigma       = RingQuantity::MakeBranch(tree, fD, fR, "sigma");
84       fFitStatus   = FitStatus::MakeBranch(tree, fD, fR);
85       fMerge       = Merge::MakeBranch(tree, fD, fR);
86       fDataLoss    = DataLoss::MakeBranch(tree, fD, fR);
87       fOccupancy   = RingQuantity::MakeBranch(tree, fD, fR, "occupancy");
88       fCorrelation = Correlation::MakeBranch(tree, fD, fR);
89       return true;
90     }
91     fChi2        = RingQuantity::SetBranch(tree, fD, fR, "chi2");
92     fC           = RingQuantity::SetBranch(tree, fD, fR, "c");
93     fDelta       = RingQuantity::SetBranch(tree, fD, fR, "delta");
94     fXi          = RingQuantity::SetBranch(tree, fD, fR, "xi");
95     fSigma       = RingQuantity::SetBranch(tree, fD, fR, "sigma");
96     fFitStatus   = FitStatus::SetBranch(tree, fD, fR);
97     fMerge       = Merge::SetBranch(tree, fD, fR);
98     fDataLoss    = DataLoss::SetBranch(tree, fD, fR);
99     fOccupancy   = RingQuantity::SetBranch(tree, fD, fR, "occupancy");
100     fCorrelation = Correlation::SetBranch(tree, fD, fR);
101     return true;
102   }
103   UShort_t      fD;              // Detector number
104   Char_t        fR;              // Ring identifier 
105   RingQuantity* fChi2;           // ELoss reduced chi-square
106   RingQuantity* fC;              // ELoss constant 
107   RingQuantity* fDelta;          // ELoss most probably value 
108   RingQuantity* fXi;             // ELoss Landau width
109   RingQuantity* fSigma;          // ELoss Gaus width
110   FitStatus*    fFitStatus;      // ELoss fit status  
111   Merge*        fMerge;          // Merging parameters
112   DataLoss*     fDataLoss;       // Hit 'loss' summary
113   RingQuantity* fOccupancy;      // Mean occupancy 
114   Correlation*  fCorrelation;    // ELoss vs Poisson correlation 
115 };
116
117 #endif // QARING_H
118 // Local Variables:
119 //  mode: C++
120 // End: