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 TPC. 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 //========================================================================
27 #include "AliTPCMisAligner.h"
28 #include "AliGeomManager.h"
29 #include "TClonesArray.h"
30 #include "TGeoManager.h"
32 #include "AliAlignObjParams.h"
35 ClassImp(AliTPCMisAligner)
37 //_______________________________________________________________________________________
38 AliTPCMisAligner::AliTPCMisAligner() : AliMisAligner()
45 //_______________________________________________________________________________________
46 TClonesArray* AliTPCMisAligner::MakeAlObjsArray() {
47 // builds and returns the array of alignment objects
48 // according to the spcified misalignment scenario
49 // ("ideal", "residual" or "full").
51 if(!AliGeomManager::GetGeometry())
53 AliError("No geometry loaded into AliGeomManager! Returning null pointer!");
57 TClonesArray *array = new TClonesArray("AliAlignObjParams",73);
58 TClonesArray &alobj = *array;
60 gRandom->SetSeed(4357);
62 // misalignment of the whole TPC according to survey
63 Double_t dx=-0.159, dy=-0.05, dz=0.034, dpsi=-0.00183, dtheta=0.01835, dphi=0.02865;
64 new(alobj[j++]) AliAlignObjParams("ALIC_1/TPC_M_1", 0, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
65 AliAlignObjParams* alObjTPC = (AliAlignObjParams*) array->UncheckedAt(0);
66 alObjTPC->ApplyToGeometry();
68 if(TString(GetMisalType())=="ideal")
71 dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
72 for (Int_t iLayer = AliGeomManager::kTPC1; iLayer <= AliGeomManager::kTPC2; iLayer++) {
73 for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) {
75 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
76 const char *symname = AliGeomManager::SymName(volid);
77 new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
81 }else if(TString(GetMisalType())=="residual" || TString(GetMisalType())=="full"){
82 // sigma translation = 0.1 mm
83 // sigma rotation = 0.1 mrad
86 Double_t sigmatr=0.01;
87 Double_t sigmarot = 0.006;
89 for (Int_t iLayer = AliGeomManager::kTPC1; iLayer <= AliGeomManager::kTPC2; iLayer++) {
90 for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) {
92 dx = gRandom->Gaus(0,sigmatr);
93 dy = gRandom->Gaus(0,sigmatr);
94 dz = gRandom->Gaus(0,sigmatr);
95 dpsi = gRandom->Gaus(0,sigmarot);
96 dtheta = gRandom->Gaus(0,sigmarot);
97 dphi = gRandom->Gaus(0,sigmarot);
99 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
100 const char *symname = AliGeomManager::SymName(volid);
101 new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
105 AliError(Form("\"%s\" is not a valid identifier for misalignment types. Exiting ...",GetMisalType()));
112 //_______________________________________________________________________________________
113 AliCDBMetaData* AliTPCMisAligner::GetCDBMetaData() const {
114 // Returns the comment and responsible for the
115 // AliCDBMetaData to be associated with the OCDB entry
116 // containing the TPC array of misalignment objects
118 AliCDBMetaData* md = new AliCDBMetaData();
119 md->SetResponsible("");
121 if(TString(GetMisalType())=="ideal")
122 md->SetComment("Alignment objects for TPC ideal misalignment");
123 if(TString(GetMisalType())=="residual")
124 md->SetComment("Alignment objects for TPC residual misalignment");
125 if(TString(GetMisalType())=="full")
126 md->SetComment("Alignment objects for TPC full misalignment");