Line data Source code
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 "TObjArray.h"
26 : #include "TString.h"
27 : #include "TFile.h"
28 : #include "AliLog.h"
29 : #include "AliCDBEntry.h"
30 : #include "AliITSCorrMapSDD.h"
31 : #include "AliITSCorrectSDDPoints.h"
32 : #include "AliITSsegmentationSDD.h"
33 :
34 116 : ClassImp(AliITSCorrectSDDPoints)
35 :
36 : //______________________________________________________________________
37 : AliITSCorrectSDDPoints::AliITSCorrectSDDPoints():
38 0 : TObject(),
39 0 : fArrayOfMaps(0),
40 0 : fSegmentationSDD(0)
41 0 : {
42 : // default constructor
43 0 : TFile* fil=new TFile("$ALICE_ROOT/OCDB/ITS/Calib/MapsTimeSDD/Run0_9999999_v0_s0.root");
44 0 : AliCDBEntry* e=(AliCDBEntry*)fil->Get("AliCDBEntry");
45 0 : fArrayOfMaps=(TObjArray*)e->GetObject();
46 0 : e->SetOwner(kTRUE);
47 0 : fil->Close();
48 0 : AliInfo(Form("%d AliITSCorrMapSDD objects in file %s",fArrayOfMaps->GetEntries(),fil->GetName()));
49 0 : fSegmentationSDD=new AliITSsegmentationSDD();
50 0 : }
51 :
52 : //______________________________________________________________________
53 : AliITSCorrectSDDPoints::AliITSCorrectSDDPoints(TObjArray* maps):
54 0 : TObject(),
55 0 : fArrayOfMaps(maps),
56 0 : fSegmentationSDD(new AliITSsegmentationSDD())
57 0 : {
58 : // constructor from external array
59 0 : }
60 :
61 : //______________________________________________________________________
62 : AliITSCorrectSDDPoints::AliITSCorrectSDDPoints(TString filname):
63 0 : TObject(),
64 0 : fArrayOfMaps(0),
65 0 : fSegmentationSDD(0)
66 0 : {
67 : // standard constructor
68 0 : TFile* fil=new TFile(filname.Data());
69 0 : AliCDBEntry* e=(AliCDBEntry*)fil->Get("AliCDBEntry");
70 0 : fArrayOfMaps=(TObjArray*)e->GetObject();
71 0 : e->SetOwner(kTRUE);
72 0 : fil->Close();
73 0 : AliInfo(Form("%d AliITSCorrMapSDD objects in file %s",fArrayOfMaps->GetEntries(),fil->GetName()));
74 0 : fSegmentationSDD=new AliITSsegmentationSDD();
75 0 : }
76 :
77 : //______________________________________________________________________
78 0 : AliITSCorrectSDDPoints::~AliITSCorrectSDDPoints(){
79 : //
80 0 : if(fArrayOfMaps) delete fArrayOfMaps;
81 0 : }
82 :
83 : //______________________________________________________________________
84 : void AliITSCorrectSDDPoints::SetCorrectionMaps(const TObjArray *arr)
85 : {
86 : // replace the maps
87 0 : delete fArrayOfMaps;
88 0 : fArrayOfMaps = (TObjArray*)arr;
89 0 : }
90 :
91 : //______________________________________________________________________
92 : Float_t AliITSCorrectSDDPoints::GetCorrection(Int_t modId, Float_t zloc, Float_t xloc) const{
93 : // returns correction to SDD drift corrdinate in cm
94 0 : Int_t nSide=fSegmentationSDD->GetSideFromLocalX(xloc);
95 0 : Int_t iSide=2*(modId-240)+nSide;
96 0 : if(iSide<0 || iSide >= 520){
97 0 : AliError(Form("Side out of range %d",iSide));
98 0 : return 0.;
99 : }
100 0 : AliITSCorrMapSDD* m=(AliITSCorrMapSDD*)fArrayOfMaps->At(iSide);
101 0 : return m->GetCorrection(zloc,xloc,fSegmentationSDD);
102 0 : }
|