Another histos for lumi
[u/mrichter/AliRoot.git] / ITS / AliITSCorrectSDDPoints.cxx
CommitLineData
f1fd6fdb 1/**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
8102b2c9 16/* $Id$ */
f1fd6fdb 17
18///////////////////////////////////////////////////////////////////
19// //
20// Implementation of the class to apply SDD map corrections //
21// Origin: F.Prino, Torino, prino@to.infn.it //
22// //
23///////////////////////////////////////////////////////////////////
24
cfe39822 25#include "TObjArray.h"
f1fd6fdb 26#include "TString.h"
27#include "TFile.h"
28#include "AliLog.h"
29#include "AliCDBEntry.h"
30#include "AliITSCorrMapSDD.h"
31#include "AliITSCorrectSDDPoints.h"
cfe39822 32#include "AliITSsegmentationSDD.h"
f1fd6fdb 33
34ClassImp(AliITSCorrectSDDPoints)
8102b2c9 35
f1fd6fdb 36//______________________________________________________________________
37AliITSCorrectSDDPoints::AliITSCorrectSDDPoints():
38 TObject(),
39 fArrayOfMaps(0),
40 fSegmentationSDD(0)
41{
42 // default constructor
43 TFile* fil=new TFile("$ALICE_ROOT/OCDB/ITS/Calib/MapsTimeSDD/Run0_9999999_v0_s0.root");
44 AliCDBEntry* e=(AliCDBEntry*)fil->Get("AliCDBEntry");
45 fArrayOfMaps=(TObjArray*)e->GetObject();
46 e->SetOwner(kTRUE);
47 fil->Close();
48 AliInfo(Form("%d AliITSCorrMapSDD objects in file %s",fArrayOfMaps->GetEntries(),fil->GetName()));
49 fSegmentationSDD=new AliITSsegmentationSDD();
50}
8102b2c9 51
52//______________________________________________________________________
53AliITSCorrectSDDPoints::AliITSCorrectSDDPoints(TObjArray* maps):
54 TObject(),
55 fArrayOfMaps(maps),
56 fSegmentationSDD(new AliITSsegmentationSDD())
57{
58 // constructor from external array
59}
60
f1fd6fdb 61//______________________________________________________________________
62AliITSCorrectSDDPoints::AliITSCorrectSDDPoints(TString filname):
63 TObject(),
64 fArrayOfMaps(0),
65 fSegmentationSDD(0)
66{
67 // standard constructor
68 TFile* fil=new TFile(filname.Data());
69 AliCDBEntry* e=(AliCDBEntry*)fil->Get("AliCDBEntry");
70 fArrayOfMaps=(TObjArray*)e->GetObject();
71 e->SetOwner(kTRUE);
72 fil->Close();
73 AliInfo(Form("%d AliITSCorrMapSDD objects in file %s",fArrayOfMaps->GetEntries(),fil->GetName()));
74 fSegmentationSDD=new AliITSsegmentationSDD();
75}
8102b2c9 76
f1fd6fdb 77//______________________________________________________________________
78AliITSCorrectSDDPoints::~AliITSCorrectSDDPoints(){
79 //
80 if(fArrayOfMaps) delete fArrayOfMaps;
81}
8102b2c9 82
83//______________________________________________________________________
cfe39822 84void AliITSCorrectSDDPoints::SetCorrectionMaps(const TObjArray *arr)
8102b2c9 85{
86 // replace the maps
87 delete fArrayOfMaps;
88 fArrayOfMaps = (TObjArray*)arr;
89}
90
f1fd6fdb 91//______________________________________________________________________
92Float_t AliITSCorrectSDDPoints::GetCorrection(Int_t modId, Float_t zloc, Float_t xloc) const{
93 // returns correction to SDD drift corrdinate in cm
94 Int_t nSide=fSegmentationSDD->GetSideFromLocalX(xloc);
95 Int_t iSide=2*(modId-240)+nSide;
96 if(iSide<0 || iSide >= 520){
97 AliError(Form("Side out of range %d",iSide));
98 return 0.;
99 }
100 AliITSCorrMapSDD* m=(AliITSCorrMapSDD*)fArrayOfMaps->At(iSide);
101 return m->GetCorrection(zloc,xloc,fSegmentationSDD);
102}