]>
Commit | Line | Data |
---|---|---|
1 | /* $Id$ */ | |
2 | /************************************************************************** | |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Author: The ALICE Off-line Project. * | |
6 | * Contributors are mentioned in the code where appropriate. * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | //--------------------------------------------------------------------// | |
17 | // // | |
18 | // AliCFDataGrid Class // | |
19 | // Class to handle observed data and correct them // | |
20 | // // | |
21 | // -- Author : S.Arcelli // | |
22 | // // | |
23 | // substantially modified by r. vernet // | |
24 | // // | |
25 | //--------------------------------------------------------------------// | |
26 | // | |
27 | // | |
28 | #include "TMath.h" | |
29 | #include "AliLog.h" | |
30 | #include "AliCFDataGrid.h" | |
31 | ||
32 | //____________________________________________________________________ | |
33 | ClassImp(AliCFDataGrid) | |
34 | ||
35 | //____________________________________________________________________ | |
36 | AliCFDataGrid::AliCFDataGrid() : | |
37 | AliCFGridSparse(), | |
38 | fSelData(-1), | |
39 | fContainer(0x0) | |
40 | { | |
41 | // | |
42 | // default constructor | |
43 | // | |
44 | } | |
45 | ||
46 | //____________________________________________________________________ | |
47 | AliCFDataGrid::AliCFDataGrid(const Char_t* name,const Char_t* title) : | |
48 | AliCFGridSparse(name,title), | |
49 | fSelData(-1), | |
50 | fContainer(0x0) | |
51 | { | |
52 | // | |
53 | // default constructor | |
54 | // | |
55 | } | |
56 | ||
57 | //____________________________________________________________________ | |
58 | AliCFDataGrid::AliCFDataGrid(const Char_t* name, const Char_t* title, const Int_t nVarIn, const Int_t * nBinIn) : | |
59 | AliCFGridSparse(name,title,nVarIn,nBinIn), | |
60 | fSelData(-1), | |
61 | fContainer(0x0) | |
62 | { | |
63 | // | |
64 | // main constructor | |
65 | // | |
66 | SumW2();// errors saved | |
67 | } | |
68 | ||
69 | //____________________________________________________________________ | |
70 | AliCFDataGrid::AliCFDataGrid(const Char_t* name, const Char_t* title, const AliCFContainer &c) : | |
71 | AliCFGridSparse(name,title), | |
72 | fSelData(-1), | |
73 | fContainer(&c) | |
74 | { | |
75 | // | |
76 | // main constructor | |
77 | // | |
78 | } | |
79 | ||
80 | //____________________________________________________________________ | |
81 | AliCFDataGrid::AliCFDataGrid(const AliCFDataGrid& data) : | |
82 | AliCFGridSparse(data), | |
83 | fSelData(-1), | |
84 | fContainer(0x0) | |
85 | { | |
86 | // | |
87 | // copy constructor | |
88 | // | |
89 | ((AliCFDataGrid &)data).Copy(*this); | |
90 | } | |
91 | ||
92 | //____________________________________________________________________ | |
93 | AliCFDataGrid::~AliCFDataGrid() | |
94 | { | |
95 | // | |
96 | // destructor | |
97 | // | |
98 | } | |
99 | ||
100 | //____________________________________________________________________ | |
101 | AliCFDataGrid &AliCFDataGrid::operator=(const AliCFDataGrid &c) | |
102 | { | |
103 | // | |
104 | // assigment operator | |
105 | // | |
106 | if (this != &c) c.Copy(*this); | |
107 | return *this; | |
108 | } | |
109 | ||
110 | //____________________________________________________________________ | |
111 | void AliCFDataGrid::SetMeasured(Int_t istep) | |
112 | { | |
113 | // | |
114 | // Deposit observed data over the grid | |
115 | // | |
116 | ||
117 | fSelData = istep ; | |
118 | //simply clones the container's data at specified step | |
119 | fData = (THnSparse*) fContainer->GetGrid(istep)->GetGrid()->Clone(); | |
120 | SumW2(); | |
121 | AliInfo(Form("retrieving measured data from Container %s at selection step %i.",fContainer->GetName(),fSelData)); | |
122 | } | |
123 | //____________________________________________________________________ | |
124 | void AliCFDataGrid::ApplyEffCorrection(const AliCFEffGrid &c) | |
125 | { | |
126 | ||
127 | // | |
128 | // Apply the efficiency correction | |
129 | // | |
130 | if (c.GetNVar()!=GetNVar()) { | |
131 | AliInfo("Different number of variables, cannot apply correction"); | |
132 | return; | |
133 | } | |
134 | Divide(&c); | |
135 | AliInfo(Form("correction applied on data grid %s with efficiency %s.",GetName(),c.GetName())); | |
136 | } | |
137 | //____________________________________________________________________ | |
138 | void AliCFDataGrid::ApplyBGCorrection(const AliCFDataGrid &c) | |
139 | { | |
140 | ||
141 | // | |
142 | // Apply correction for background | |
143 | // | |
144 | if (c.GetNVar()!=GetNVar()) { | |
145 | AliInfo("Different number of variables, cannot apply correction"); | |
146 | return; | |
147 | } | |
148 | Add(&c); | |
149 | AliInfo(Form("background %s subtracted from data %s.",c.GetName(),GetName())); | |
150 | } | |
151 | ||
152 | //____________________________________________________________________ | |
153 | void AliCFDataGrid::Copy(TObject& c) const | |
154 | { | |
155 | // copy function | |
156 | Copy(c); | |
157 | AliCFDataGrid& target = (AliCFDataGrid &) c; | |
158 | target.fContainer=fContainer; | |
159 | target.fSelData=fSelData; | |
160 | } |