0f236b4e |
1 | #include <TString.h> |
2 | #include <TVectorD.h> |
3 | #include <TObjArray.h> |
4 | #include <TFile.h> |
5 | |
6 | #include <AliTPCComposedCorrection.h> |
7 | #include <AliTPCCorrectionLookupTable.h> |
8 | |
9 | #include <AliToyMCEventGenerator.h> |
10 | |
11 | |
12 | AliTPCComposedCorrection* GetComposedResidualDistortion(TString fluctuationMap, TString averageMap, Bool_t rescale=kTRUE) |
13 | { |
14 | // |
15 | // |
16 | // |
17 | |
18 | |
19 | TFile fFluct(fluctuationMap); |
20 | AliTPCCorrectionLookupTable *corrFluct = (AliTPCCorrectionLookupTable*)fFluct.Get("map"); |
21 | fFluct.Close(); |
22 | |
23 | TFile fAverage(averageMap); |
24 | AliTPCCorrectionLookupTable *corrAverage = (AliTPCCorrectionLookupTable*)fAverage.Get("map"); |
25 | fAverage.Close(); |
26 | |
27 | TObjArray *arrMaps = new TObjArray(2); |
28 | arrMaps->Add(corrFluct); // distortion with the fluctuation Map |
29 | arrMaps->Add(corrAverage); // correction with the average Map |
30 | |
31 | // create the composed correction |
32 | // if the weight are set to +1 and -1, the first map will be responsible for the distortions |
33 | // The second map for the corrections |
34 | AliTPCComposedCorrection *residualDistortion = new AliTPCComposedCorrection(arrMaps, AliTPCComposedCorrection::kQueueResidual); |
35 | TVectorD weights(2); |
36 | weights(0)=+1.; |
37 | weights(1)=-1.; |
38 | if (rescale) { |
39 | Float_t dummy=0; |
40 | weights(1)=-AliToyMCEventGenerator::GetSCScalingFactor(corrFluct, corrAverage,dummy); |
41 | } |
42 | residualDistortion->SetWeights(&weights); |
43 | |
44 | return residualDistortion; |
45 | } |