1 /**************************************************************************
2 * Copyright(c) 2007-2010, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //========================================================================
18 // This class generates misalignment for PMD. In particular it defines
19 // the misalignment in the three canonical scenarios: "ideal", "residual"
21 // It is meant to be run standalone or from the steering macro
22 // $ALICE_ROOT/macros/MakeAlignmentObjs.C
23 // looping on the detectors.
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
38 // Now specify the path of the module to be misaligned
39 // as followed in the PMD geant
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
55 //========================================================================
57 #include "AliPMDMisAligner.h"
58 #include "AliGeomManager.h"
59 #include "TClonesArray.h"
61 #include "AliAlignObjParams.h"
64 ClassImp(AliPMDMisAligner)
66 //_______________________________________________________________________________________
67 AliPMDMisAligner::AliPMDMisAligner() : AliMisAligner()
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").
80 TClonesArray *array = new TClonesArray("AliAlignObjParams",4);
81 TClonesArray &alobj = *array;
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
86 const char *Sector1="PMD/Sector1";
87 const char *Sector2="PMD/Sector2";
88 const char *Sector3="PMD/Sector3";
89 const char *Sector4="PMD/Sector4";
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
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
98 UShort_t iIndex=0; // PMD is not indexed
99 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
100 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
102 gRandom->SetSeed(4357);
104 if(TString(GetMisalType())=="ideal")
107 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
109 for(Int_t i=0; i<4; i++){
110 TString snSector(Form("PMD/Sector%d",i+1));
111 new(alobj[i]) AliAlignObjParams(snSector.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
114 }else if(TString(GetMisalType())=="residual" || TString(GetMisalType())=="full"){
115 if(!AliGeomManager::GetGeometry())
117 AliError("No geometry loaded into AliGeomManager! Returning null pointer!");
121 // For sectors 1 and 4
122 // Translation displacement
123 dx14 = (gRandom->Uniform()-0.5)*max_trans;
124 dy14 = (gRandom->Uniform()-0.5)*max_trans;
125 dz14 = (gRandom->Uniform()-0.5)*max_trans;
127 dpsi14 = (gRandom->Uniform()-0.5)*max_rot;
128 dtheta14 = (gRandom->Uniform()-0.5)*max_rot;
129 dphi14 = (gRandom->Uniform()-0.5)*max_rot;
131 // For sectors 2 and 3
132 // Translation displacement
133 dx23 = (gRandom->Uniform()-0.5)*max_trans;
134 dy23 = (gRandom->Uniform()-0.5)*max_trans;
135 dz23 = (gRandom->Uniform()-0.5)*max_trans;
137 dpsi23 = (gRandom->Uniform()-0.5)*max_rot;
138 dtheta23 = (gRandom->Uniform()-0.5)*max_rot;
139 dphi23 = (gRandom->Uniform()-0.5)*max_rot;
141 new(alobj[0]) AliAlignObjParams(Sector1, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
142 new(alobj[1]) AliAlignObjParams(Sector2, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
143 new(alobj[2]) AliAlignObjParams(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
144 new(alobj[3]) AliAlignObjParams(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
147 AliError(Form("\"%s\" is not a valid identifier for misalignment types. Exiting ...",GetMisalType()));
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
160 AliCDBMetaData* md = new AliCDBMetaData();
161 md->SetResponsible("");
163 if(TString(GetMisalType())=="ideal")
164 md->SetComment("Alignment objects for PMD ideal misalignment");
165 if(TString(GetMisalType())=="residual")
166 md->SetComment("Alignment objects for PMD residual misalignment");
167 if(TString(GetMisalType())=="full")
168 md->SetComment("Alignment objects for PMD full misalignment");