]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSCorrectSDDPoints.cxx
AliTPCcalibCalib.cxx - use also alignmnet - not implemented yet
[u/mrichter/AliRoot.git] / ITS / AliITSCorrectSDDPoints.cxx
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
16 /* $Id:$ */
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
25 #include "TString.h"
26 #include "TFile.h"
27 #include "AliLog.h"
28 #include "AliCDBEntry.h"
29 #include "AliITSCorrMapSDD.h"
30 #include "AliITSCorrectSDDPoints.h"
31
32 ClassImp(AliITSCorrectSDDPoints)
33 //______________________________________________________________________
34 AliITSCorrectSDDPoints::AliITSCorrectSDDPoints():
35   TObject(),
36   fArrayOfMaps(0),
37   fSegmentationSDD(0)
38 {
39   // default constructor
40   TFile* fil=new TFile("$ALICE_ROOT/OCDB/ITS/Calib/MapsTimeSDD/Run0_9999999_v0_s0.root");
41   AliCDBEntry* e=(AliCDBEntry*)fil->Get("AliCDBEntry");
42   fArrayOfMaps=(TObjArray*)e->GetObject();
43   e->SetOwner(kTRUE);
44   fil->Close();
45   AliInfo(Form("%d AliITSCorrMapSDD objects in file %s",fArrayOfMaps->GetEntries(),fil->GetName()));
46   fSegmentationSDD=new AliITSsegmentationSDD();
47 }
48 //______________________________________________________________________
49 AliITSCorrectSDDPoints::AliITSCorrectSDDPoints(TString filname):
50   TObject(),
51   fArrayOfMaps(0),
52   fSegmentationSDD(0)
53 {
54   // standard constructor
55   TFile* fil=new TFile(filname.Data());
56   AliCDBEntry* e=(AliCDBEntry*)fil->Get("AliCDBEntry");
57   fArrayOfMaps=(TObjArray*)e->GetObject();
58   e->SetOwner(kTRUE);
59   fil->Close();
60   AliInfo(Form("%d AliITSCorrMapSDD objects in file %s",fArrayOfMaps->GetEntries(),fil->GetName()));
61   fSegmentationSDD=new AliITSsegmentationSDD();
62 }
63 //______________________________________________________________________
64 AliITSCorrectSDDPoints::~AliITSCorrectSDDPoints(){
65   //
66   if(fArrayOfMaps) delete fArrayOfMaps;
67 }
68 //______________________________________________________________________
69 Float_t AliITSCorrectSDDPoints::GetCorrection(Int_t modId, Float_t zloc, Float_t xloc) const{
70   // returns correction to SDD drift corrdinate in cm
71   Int_t nSide=fSegmentationSDD->GetSideFromLocalX(xloc);
72   Int_t iSide=2*(modId-240)+nSide;
73   if(iSide<0 || iSide >= 520){ 
74     AliError(Form("Side out of range %d",iSide));
75     return 0.;
76   }
77   AliITSCorrMapSDD* m=(AliITSCorrMapSDD*)fArrayOfMaps->At(iSide);
78   return m->GetCorrection(zloc,xloc,fSegmentationSDD);
79 }