]> git.uio.no Git - u/mrichter/AliRoot.git/blame - CORRFW/AliCFDataGrid.cxx
delete pID object
[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 //
616d0493 53 // named constructor
563113d0 54 //
616d0493 55 AliInfo("Deprecated, will be removed soon !!");
563113d0 56}
57
58//____________________________________________________________________
fb494025 59AliCFDataGrid::AliCFDataGrid(const Char_t* name, const Char_t* title, const Int_t nVarIn, const Int_t * nBinIn) :
60 AliCFGridSparse(name,title,nVarIn,nBinIn),
563113d0 61 fSelData(-1),
62 fContainer(0x0)
63{
64 //
65 // main constructor
66 //
67 SumW2();// errors saved
68}
fb494025 69
563113d0 70//____________________________________________________________________
71AliCFDataGrid::AliCFDataGrid(const Char_t* name, const Char_t* title, const AliCFContainer &c) :
9be0fa4e 72 AliCFGridSparse(name,title),
563113d0 73 fSelData(-1),
fb494025 74 fContainer(&c)
563113d0 75{
76 //
77 // main constructor
78 //
616d0493 79 AliInfo("Deprecated, will be removed soon !!\nUse AliCFDataGrid(name,title,container,step) instead");
80}
81
82//____________________________________________________________________
83AliCFDataGrid::AliCFDataGrid(const Char_t* name, const Char_t* title, const AliCFContainer &c, Int_t step) :
84 AliCFGridSparse(name,title),
85 fSelData(step),
86 fContainer(&c)
87{
88 //
89 // main constructor
90 // assign directly the selection step
91 //
92
93 //simply clones the container's data at specified step
94 fData = (THnSparse*) fContainer->GetGrid(fSelData)->GetGrid()->Clone();
95 SumW2();
96 AliInfo(Form("retrieving measured data from Container %s at selection step %i.",fContainer->GetName(),fSelData));
563113d0 97}
fb494025 98
563113d0 99//____________________________________________________________________
fb494025 100AliCFDataGrid::AliCFDataGrid(const AliCFDataGrid& data) :
101 AliCFGridSparse(data),
563113d0 102 fSelData(-1),
103 fContainer(0x0)
104{
105 //
106 // copy constructor
107 //
108 ((AliCFDataGrid &)data).Copy(*this);
109}
110
111//____________________________________________________________________
112AliCFDataGrid::~AliCFDataGrid()
113{
114 //
115 // destructor
116 //
117}
fb494025 118
563113d0 119//____________________________________________________________________
120AliCFDataGrid &AliCFDataGrid::operator=(const AliCFDataGrid &c)
121{
122 //
123 // assigment operator
124 //
fb494025 125 if (this != &c) c.Copy(*this);
563113d0 126 return *this;
127}
563113d0 128
fb494025 129//____________________________________________________________________
563113d0 130void AliCFDataGrid::SetMeasured(Int_t istep)
131{
132 //
133 // Deposit observed data over the grid
134 //
616d0493 135 AliInfo("Deprecated, will be removed soon !!\nPlease specify selection step in constructor.");
9be0fa4e 136
137 fSelData = istep ;
138 //simply clones the container's data at specified step
fb494025 139 fData = (THnSparse*) fContainer->GetGrid(istep)->GetGrid()->Clone();
9be0fa4e 140 SumW2();
141 AliInfo(Form("retrieving measured data from Container %s at selection step %i.",fContainer->GetName(),fSelData));
563113d0 142}
143//____________________________________________________________________
144void AliCFDataGrid::ApplyEffCorrection(const AliCFEffGrid &c)
145{
146
147 //
148 // Apply the efficiency correction
149 //
fb494025 150 if (c.GetNVar()!=GetNVar()) {
563113d0 151 AliInfo("Different number of variables, cannot apply correction");
152 return;
153 }
9be0fa4e 154 Divide(&c);
155 AliInfo(Form("correction applied on data grid %s with efficiency %s.",GetName(),c.GetName()));
563113d0 156}
157//____________________________________________________________________
158void AliCFDataGrid::ApplyBGCorrection(const AliCFDataGrid &c)
159{
160
161 //
162 // Apply correction for background
163 //
fb494025 164 if (c.GetNVar()!=GetNVar()) {
563113d0 165 AliInfo("Different number of variables, cannot apply correction");
166 return;
167 }
e8ef142b 168 Add(&c,-1);
9be0fa4e 169 AliInfo(Form("background %s subtracted from data %s.",c.GetName(),GetName()));
563113d0 170}
fb494025 171
563113d0 172//____________________________________________________________________
9be0fa4e 173void AliCFDataGrid::Copy(TObject& c) const
563113d0 174{
175 // copy function
9be0fa4e 176 Copy(c);
177 AliCFDataGrid& target = (AliCFDataGrid &) c;
563113d0 178 target.fContainer=fContainer;
179 target.fSelData=fSelData;
563113d0 180}