Line data Source code
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 PMD. 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 : // Macro to randomly displace the 4 sectors of the PMD
26 : // in each plane. Each sector (to be misaligned)
27 : // of PMD houses the following :
28 : // (a) 6 modules of preshower plane
29 : // (b) 6 modules of veto plane
30 : // (c) The FEE boards on back plane of each module
31 : // (d) 6 modules of convertor plates
32 : // The clustering is done module-wise
33 : // The actual amount displacement will be provided
34 : // by the survey data and has to be converted into
35 : // displacement in x,y,z,theta, phi and psi
36 :
37 :
38 : // Now specify the path of the module to be misaligned
39 : // as followed in the PMD geant
40 :
41 : // _____________
42 : // | | |
43 : // | 1 | 3 |
44 : // | |________|
45 : // |____|___| |
46 : // | | 2 |
47 : // | 4 | |
48 : // |________|____|
49 :
50 : // Misalignment Matrix is expected to be
51 : // same for sectors 1 and 4
52 : // and for the sectors 2 and 3
53 : // As these will be mounted on the same
54 : // Steel plate
55 : //========================================================================
56 :
57 : #include "AliPMDMisAligner.h"
58 : #include "AliGeomManager.h"
59 : #include "TClonesArray.h"
60 : #include "TRandom.h"
61 : #include "AliAlignObjParams.h"
62 : #include "AliLog.h"
63 :
64 12 : ClassImp(AliPMDMisAligner)
65 :
66 : //_______________________________________________________________________________________
67 0 : AliPMDMisAligner::AliPMDMisAligner() : AliMisAligner()
68 0 : {
69 : //
70 : // dummy constructor
71 : //
72 0 : }
73 :
74 : //_______________________________________________________________________________________
75 : TClonesArray* AliPMDMisAligner::MakeAlObjsArray() {
76 : // builds and returns the array of alignment objects
77 : // according to the spcified misalignment scenario
78 : // ("ideal", "residual" or "full").
79 : //
80 0 : TClonesArray *array = new TClonesArray("AliAlignObjParams",4);
81 : TClonesArray &alobj = *array;
82 :
83 : Double_t max_trans=0.1; // maximun shifts in X,Y,Z in centimeters
84 : Double_t max_rot=0.1; // maximum shifts in angles in degrees
85 :
86 : const char *Sector1="PMD/Sector1";
87 : const char *Sector2="PMD/Sector2";
88 : const char *Sector3="PMD/Sector3";
89 : const char *Sector4="PMD/Sector4";
90 :
91 : //Sectors 1 and 4
92 : Double_t dx14=0., dy14=0., dz14=0.; // Misalignment in X,Y and Z
93 : Double_t dpsi14=0., dtheta14=0., dphi14=0.; // Angular displacements
94 : //Sectors 2 and 3
95 : Double_t dx23=0., dy23=0., dz23=0.; // Misalignment in X,Y and Z
96 : Double_t dpsi23=0., dtheta23=0., dphi23=0.; // Angular displacements
97 :
98 : UShort_t iIndex=0; // PMD is not indexed
99 : AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
100 0 : UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
101 :
102 0 : gRandom->SetSeed(4357);
103 :
104 0 : if(TString(GetMisalType())=="ideal")
105 : {
106 :
107 : Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
108 :
109 0 : for(Int_t i=0; i<4; i++){
110 0 : TString snSector(Form("PMD/Sector%d",i+1));
111 0 : new(alobj[i]) AliAlignObjParams(snSector.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
112 0 : }
113 :
114 0 : }else if(TString(GetMisalType())=="residual" || TString(GetMisalType())=="full"){
115 0 : if(!AliGeomManager::GetGeometry())
116 : {
117 0 : AliError("No geometry loaded into AliGeomManager! Returning null pointer!");
118 0 : return 0;
119 : }
120 :
121 : // For sectors 1 and 4
122 : // Translation displacement
123 0 : dx14 = (gRandom->Uniform()-0.5)*max_trans;
124 0 : dy14 = (gRandom->Uniform()-0.5)*max_trans;
125 0 : dz14 = (gRandom->Uniform()-0.5)*max_trans;
126 : //Rotation angles
127 0 : dpsi14 = (gRandom->Uniform()-0.5)*max_rot;
128 0 : dtheta14 = (gRandom->Uniform()-0.5)*max_rot;
129 0 : dphi14 = (gRandom->Uniform()-0.5)*max_rot;
130 :
131 : // For sectors 2 and 3
132 : // Translation displacement
133 0 : dx23 = (gRandom->Uniform()-0.5)*max_trans;
134 0 : dy23 = (gRandom->Uniform()-0.5)*max_trans;
135 0 : dz23 = (gRandom->Uniform()-0.5)*max_trans;
136 : //Rotation angles
137 0 : dpsi23 = (gRandom->Uniform()-0.5)*max_rot;
138 0 : dtheta23 = (gRandom->Uniform()-0.5)*max_rot;
139 0 : dphi23 = (gRandom->Uniform()-0.5)*max_rot;
140 :
141 0 : new(alobj[0]) AliAlignObjParams(Sector1, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
142 0 : new(alobj[1]) AliAlignObjParams(Sector2, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
143 0 : new(alobj[2]) AliAlignObjParams(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
144 0 : new(alobj[3]) AliAlignObjParams(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
145 :
146 : }else{
147 0 : AliError(Form("\"%s\" is not a valid identifier for misalignment types. Exiting ...",GetMisalType()));
148 0 : return 0;
149 : }
150 :
151 0 : return array;
152 0 : }
153 :
154 : //_______________________________________________________________________________________
155 : AliCDBMetaData* AliPMDMisAligner::GetCDBMetaData() const {
156 : // Returns the comment and responsible for the
157 : // AliCDBMetaData to be associated with the OCDB entry
158 : // containing the PMD array of misalignment objects
159 : //
160 0 : AliCDBMetaData* md = new AliCDBMetaData();
161 0 : md->SetResponsible("");
162 :
163 0 : if(TString(GetMisalType())=="ideal")
164 0 : md->SetComment("Alignment objects for PMD ideal misalignment");
165 0 : if(TString(GetMisalType())=="residual")
166 0 : md->SetComment("Alignment objects for PMD residual misalignment");
167 0 : if(TString(GetMisalType())=="full")
168 0 : md->SetComment("Alignment objects for PMD full misalignment");
169 :
170 0 : return md;
171 0 : }
|