]>
Commit | Line | Data |
---|---|---|
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 | //____________________________________________________________________ | |
33 | ClassImp(AliCFDataGrid) | |
34 | ||
35 | //____________________________________________________________________ | |
36 | AliCFDataGrid::AliCFDataGrid() : | |
25488e18 | 37 | AliCFGridSparse(), |
563113d0 | 38 | fSelData(-1), |
39 | fContainer(0x0) | |
40 | { | |
41 | // | |
42 | // default constructor | |
43 | // | |
563113d0 | 44 | } |
45 | ||
563113d0 | 46 | //____________________________________________________________________ |
fb494025 | 47 | AliCFDataGrid::AliCFDataGrid(const Char_t* name, const Char_t* title, const Int_t nVarIn, const Int_t * nBinIn) : |
48 | AliCFGridSparse(name,title,nVarIn,nBinIn), | |
563113d0 | 49 | fSelData(-1), |
50 | fContainer(0x0) | |
51 | { | |
52 | // | |
53 | // main constructor | |
54 | // | |
55 | SumW2();// errors saved | |
56 | } | |
fb494025 | 57 | |
616d0493 | 58 | //____________________________________________________________________ |
59 | AliCFDataGrid::AliCFDataGrid(const Char_t* name, const Char_t* title, const AliCFContainer &c, Int_t step) : | |
60 | AliCFGridSparse(name,title), | |
61 | fSelData(step), | |
62 | fContainer(&c) | |
63 | { | |
64 | // | |
65 | // main constructor | |
66 | // assign directly the selection step | |
67 | // | |
68 | ||
69 | //simply clones the container's data at specified step | |
70 | fData = (THnSparse*) fContainer->GetGrid(fSelData)->GetGrid()->Clone(); | |
71 | SumW2(); | |
72 | AliInfo(Form("retrieving measured data from Container %s at selection step %i.",fContainer->GetName(),fSelData)); | |
563113d0 | 73 | } |
fb494025 | 74 | |
563113d0 | 75 | //____________________________________________________________________ |
fb494025 | 76 | AliCFDataGrid::AliCFDataGrid(const AliCFDataGrid& data) : |
77 | AliCFGridSparse(data), | |
563113d0 | 78 | fSelData(-1), |
79 | fContainer(0x0) | |
80 | { | |
81 | // | |
82 | // copy constructor | |
83 | // | |
84 | ((AliCFDataGrid &)data).Copy(*this); | |
85 | } | |
86 | ||
87 | //____________________________________________________________________ | |
88 | AliCFDataGrid::~AliCFDataGrid() | |
89 | { | |
90 | // | |
91 | // destructor | |
92 | // | |
93 | } | |
fb494025 | 94 | |
563113d0 | 95 | //____________________________________________________________________ |
96 | AliCFDataGrid &AliCFDataGrid::operator=(const AliCFDataGrid &c) | |
97 | { | |
98 | // | |
99 | // assigment operator | |
100 | // | |
fb494025 | 101 | if (this != &c) c.Copy(*this); |
563113d0 | 102 | return *this; |
103 | } | |
563113d0 | 104 | |
fb494025 | 105 | //____________________________________________________________________ |
563113d0 | 106 | void AliCFDataGrid::ApplyEffCorrection(const AliCFEffGrid &c) |
107 | { | |
108 | ||
109 | // | |
110 | // Apply the efficiency correction | |
111 | // | |
fb494025 | 112 | if (c.GetNVar()!=GetNVar()) { |
563113d0 | 113 | AliInfo("Different number of variables, cannot apply correction"); |
114 | return; | |
115 | } | |
9be0fa4e | 116 | Divide(&c); |
117 | AliInfo(Form("correction applied on data grid %s with efficiency %s.",GetName(),c.GetName())); | |
563113d0 | 118 | } |
119 | //____________________________________________________________________ | |
120 | void AliCFDataGrid::ApplyBGCorrection(const AliCFDataGrid &c) | |
121 | { | |
122 | ||
123 | // | |
124 | // Apply correction for background | |
125 | // | |
fb494025 | 126 | if (c.GetNVar()!=GetNVar()) { |
563113d0 | 127 | AliInfo("Different number of variables, cannot apply correction"); |
128 | return; | |
129 | } | |
e8ef142b | 130 | Add(&c,-1); |
9be0fa4e | 131 | AliInfo(Form("background %s subtracted from data %s.",c.GetName(),GetName())); |
563113d0 | 132 | } |
fb494025 | 133 | |
563113d0 | 134 | //____________________________________________________________________ |
9be0fa4e | 135 | void AliCFDataGrid::Copy(TObject& c) const |
563113d0 | 136 | { |
137 | // copy function | |
9be0fa4e | 138 | Copy(c); |
139 | AliCFDataGrid& target = (AliCFDataGrid &) c; | |
563113d0 | 140 | target.fContainer=fContainer; |
141 | target.fSelData=fSelData; | |
563113d0 | 142 | } |