]> git.uio.no Git - u/mrichter/AliRoot.git/blame - CORRFW/AliCFDataGrid.cxx
updated source compilation files collection
[u/mrichter/AliRoot.git] / CORRFW / AliCFDataGrid.cxx
CommitLineData
563113d0 1/* $Id$ */
1e9dad92 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 **************************************************************************/
563113d0 16//--------------------------------------------------------------------//
17// //
9be0fa4e 18// AliCFDataGrid Class //
563113d0 19// Class to handle observed data and correct them //
20// //
21// -- Author : S.Arcelli //
22// //
9be0fa4e 23// substantially modified by r. vernet //
563113d0 24// //
25//--------------------------------------------------------------------//
26//
27//
9f6be3a2 28#include "TMath.h"
29#include "AliLog.h"
563113d0 30#include "AliCFDataGrid.h"
31
32//____________________________________________________________________
33ClassImp(AliCFDataGrid)
34
35//____________________________________________________________________
36AliCFDataGrid::AliCFDataGrid() :
25488e18 37 AliCFGridSparse(),
563113d0 38 fSelData(-1),
39 fContainer(0x0)
40{
41 //
42 // default constructor
43 //
563113d0 44}
45
46//____________________________________________________________________
47AliCFDataGrid::AliCFDataGrid(const Char_t* name,const Char_t* title) :
25488e18 48 AliCFGridSparse(name,title),
563113d0 49 fSelData(-1),
50 fContainer(0x0)
51{
52 //
53 // default constructor
54 //
563113d0 55}
56
57//____________________________________________________________________
1e9dad92 58AliCFDataGrid::AliCFDataGrid(const Char_t* name, const Char_t* title, const Int_t nVarIn, const Int_t * nBinIn, const Double_t *binLimitsIn) :
25488e18 59 AliCFGridSparse(name,title,nVarIn,nBinIn,binLimitsIn),
563113d0 60 fSelData(-1),
61 fContainer(0x0)
62{
63 //
64 // main constructor
65 //
66 SumW2();// errors saved
67}
68//____________________________________________________________________
69AliCFDataGrid::AliCFDataGrid(const Char_t* name, const Char_t* title, const AliCFContainer &c) :
9be0fa4e 70 AliCFGridSparse(name,title),
563113d0 71 fSelData(-1),
72 fContainer(0x0)
73{
74 //
75 // main constructor
76 //
563113d0 77
9be0fa4e 78 //assign the container;
79 fContainer=&c;
80 fNVar = c.GetNVar();
563113d0 81}
82//____________________________________________________________________
25488e18 83AliCFDataGrid::AliCFDataGrid(const AliCFDataGrid& data) : AliCFGridSparse(),
563113d0 84 fSelData(-1),
85 fContainer(0x0)
86{
87 //
88 // copy constructor
89 //
90 ((AliCFDataGrid &)data).Copy(*this);
91}
92
93//____________________________________________________________________
94AliCFDataGrid::~AliCFDataGrid()
95{
96 //
97 // destructor
98 //
99}
100//____________________________________________________________________
101AliCFDataGrid &AliCFDataGrid::operator=(const AliCFDataGrid &c)
102{
103 //
104 // assigment operator
105 //
106 if (this != &c)
107 ((AliCFDataGrid &) c).Copy(*this);
108 return *this;
109}
110//____________________________________________________________________
111
112void AliCFDataGrid::SetMeasured(Int_t istep)
113{
114 //
115 // Deposit observed data over the grid
116 //
9be0fa4e 117
118 fSelData = istep ;
119 //simply clones the container's data at specified step
120 fData = (THnSparse*) ((AliCFGridSparse*)fContainer->GetGrid(istep))->GetGrid()->Clone();
121 SumW2();
122 AliInfo(Form("retrieving measured data from Container %s at selection step %i.",fContainer->GetName(),fSelData));
563113d0 123}
124//____________________________________________________________________
125void AliCFDataGrid::ApplyEffCorrection(const AliCFEffGrid &c)
126{
127
128 //
129 // Apply the efficiency correction
130 //
131 if(c.GetNVar()!=fNVar){
132 AliInfo("Different number of variables, cannot apply correction");
133 return;
134 }
9be0fa4e 135 Divide(&c);
136 AliInfo(Form("correction applied on data grid %s with efficiency %s.",GetName(),c.GetName()));
563113d0 137}
138//____________________________________________________________________
139void AliCFDataGrid::ApplyBGCorrection(const AliCFDataGrid &c)
140{
141
142 //
143 // Apply correction for background
144 //
145 if(c.GetNVar()!=fNVar){
146 AliInfo("Different number of variables, cannot apply correction");
147 return;
148 }
9be0fa4e 149 Add(&c);
150 AliInfo(Form("background %s subtracted from data %s.",c.GetName(),GetName()));
563113d0 151}
563113d0 152//____________________________________________________________________
9be0fa4e 153void AliCFDataGrid::Copy(TObject& c) const
563113d0 154{
155 // copy function
156
9be0fa4e 157 Copy(c);
158 AliCFDataGrid& target = (AliCFDataGrid &) c;
563113d0 159 target.fContainer=fContainer;
160 target.fSelData=fSelData;
161
162}