abca08bd |
1 | /************************************************************************** |
2 | * Copyright(c) 2007-2010, 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 | //======================================================================== |
17 | // |
18 | // This class generates misalignment for T0. In particular it defines |
19 | // the misalignment in the three canonical scenarios: "ideal", "residual" |
20 | // and "full". |
21 | // It is meant to be run standalone or from the steering macro |
22 | // $ALICE_ROOT/macros/MakeAlignmentObjs.C |
23 | // looping on the detectors. |
24 | // |
25 | //======================================================================== |
26 | |
27 | #include "AliT0MisAligner.h" |
28 | #include "AliGeomManager.h" |
29 | #include "TClonesArray.h" |
30 | #include "TRandom.h" |
31 | #include "AliAlignObjParams.h" |
32 | #include "AliLog.h" |
33 | |
34 | ClassImp(AliT0MisAligner) |
35 | |
36 | //_______________________________________________________________________________________ |
37 | AliT0MisAligner::AliT0MisAligner() : AliMisAligner() |
38 | { |
39 | // |
40 | // dummy constructor |
41 | // |
42 | } |
43 | |
44 | //_______________________________________________________________________________________ |
45 | TClonesArray* AliT0MisAligner::MakeAlObjsArray() { |
46 | // builds and returns the array of alignment objects |
47 | // according to the spcified misalignment scenario |
48 | // ("ideal", "residual" or "full"). |
49 | // |
50 | TClonesArray *array = new TClonesArray("AliAlignObjParams",4); |
51 | TClonesArray &alobj = *array; |
52 | |
53 | Double_t dx,dy,dz,dpsi,dtheta,dphi; |
54 | gRandom->SetSeed(4321); |
55 | Double_t sigmatr = 0.006; // sigma for shifts in cm |
56 | Double_t sigmarot = 0.001; // sigma for tilts in degrees |
57 | |
58 | TString symName[2] = {"/ALIC_1/0STR_1","/ALIC_1/0STL_1"}; |
59 | |
60 | Int_t iIndex=0; |
61 | AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; |
62 | UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); |
63 | |
64 | if(TString(GetMisalType())=="ideal") |
65 | { |
66 | dx=0., dy=0., dz=0.; |
67 | dpsi=0., dtheta=0., dphi=0.; |
68 | for (Int_t imod=0; imod<2; imod++) |
69 | { |
70 | new(alobj[imod]) AliAlignObjParams(symName[imod].Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); |
71 | } |
72 | }else if(TString(GetMisalType())=="residual" || TString(GetMisalType())=="full") |
73 | { |
74 | |
75 | for (Int_t imod=0; imod<2; imod++) |
76 | { |
77 | dx = gRandom->Gaus(0.,sigmatr); |
78 | dy = gRandom->Gaus(0.,sigmatr); |
79 | dz = gRandom->Gaus(0.,sigmatr); |
80 | dpsi = gRandom->Gaus(0.,sigmarot); |
81 | dtheta = gRandom->Gaus(0.,sigmarot); |
82 | dphi = gRandom->Gaus(0.,sigmarot); |
83 | new(alobj[imod]) AliAlignObjParams(symName[imod].Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); |
84 | } |
85 | |
86 | }else{ |
87 | AliError(Form("\"%s\" is not a valid identifier for misalignment types. Exiting ...",GetMisalType())); |
88 | return 0; |
89 | } |
90 | |
91 | return array; |
92 | } |
93 | |
94 | //_______________________________________________________________________________________ |
95 | AliCDBMetaData* AliT0MisAligner::GetCDBMetaData() const { |
96 | // Returns the comment and responsible for the |
97 | // AliCDBMetaData to be associated with the OCDB entry |
98 | // containing the T0 array of misalignment objects |
99 | // |
100 | AliCDBMetaData* md = new AliCDBMetaData(); |
101 | md->SetResponsible("Tomasz Malkiewicz"); |
102 | |
103 | if(TString(GetMisalType())=="ideal") |
104 | md->SetComment("Alignment objects for T0 ideal misalignment"); |
105 | if(TString(GetMisalType())=="residual") |
106 | md->SetComment("Alignment objects for T0 residual misalignment"); |
107 | if(TString(GetMisalType())=="full") |
108 | md->SetComment("Alignment objects for T0 full misalignment"); |
109 | |
110 | return md; |
111 | } |