]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDMisAligner.cxx
Class to produce misalignments by R. Grosso
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDMisAligner.cxx
CommitLineData
22c261d9 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 HMPID. 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 "AliHMPIDMisAligner.h"
28#include "AliGeomManager.h"
29#include "TClonesArray.h"
30#include "TRandom.h"
31#include "TMath.h"
32#include "AliAlignObjMatrix.h"
33#include "AliLog.h"
34
35ClassImp(AliHMPIDMisAligner)
36
37//_______________________________________________________________________________________
38AliHMPIDMisAligner::AliHMPIDMisAligner() : AliMisAligner()
39{
40 //
41 // dummy constructor
42 //
43}
44
45//_______________________________________________________________________________________
46TClonesArray* AliHMPIDMisAligner::MakeAlObjsArray() {
47 // builds and returns the array of alignment objects
48 // according to the spcified misalignment scenario
49 // ("ideal", "residual" or "full").
50 //
51 if(!AliGeomManager::GetGeometry())
52 {
53 AliError("No geometry loaded into AliGeomManager! Returning null pointer!");
54 return 0;
55 }
56
57 TClonesArray *array = new TClonesArray("AliAlignObjMatrix",7);
58
59 AliGeomManager::ELayerID idHMPID = AliGeomManager::kHMPID;
60 Double_t sigmaTrans, sigmaRot;
61 Double_t dX=0., dY=0., dZ=0., dPsi=0., dTheta=0., dPhi=0.; //displacements
62
63 // TRandom *pRnd = new TRandom(4357);
64 gRandom->SetSeed(4357);
65
66 if(TString(GetMisalType())=="ideal")
67 {
68
69 for (Int_t iCh = 0; iCh < 7; iCh++) {
70 new((*array)[iCh]) AliAlignObjMatrix(AliGeomManager::SymName(idHMPID,iCh),
71 AliGeomManager::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
72 }
73
74 }else if( TString(GetMisalType())=="residual" || TString(GetMisalType())=="full"){
75
76 sigmaTrans=0.1; // 1mm
77 sigmaRot=0.001*180/TMath::Pi(); // 1 mrad
78
79 for (Int_t iCh = 0; iCh < 7; iCh++) {
80 dX = (gRandom->Uniform()-0.5)*sigmaTrans;
81 dY = (gRandom->Uniform()-0.5)*sigmaTrans;
82 dZ = (gRandom->Uniform()-0.5)*sigmaTrans;
83 dPsi = (gRandom->Uniform()-0.5)*sigmaRot;
84 dTheta = (gRandom->Uniform()-0.5)*sigmaRot;
85 dPhi = (gRandom->Uniform()-0.5)*sigmaRot;
86 // dX = (pRnd->Uniform()-0.5)*sigmaTrans; dY = (pRnd->Uniform()-0.5)*sigmaTrans; dZ = (pRnd->Uniform()-0.5)*sigmaTrans;
87 // dPsi = (pRnd->Uniform()-0.5)*sigmaRot; dTheta = (pRnd->Uniform()-0.5)*sigmaRot; dPhi = (pRnd->Uniform()-0.5)*sigmaRot;
88 new((*array)[iCh]) AliAlignObjMatrix(AliGeomManager::SymName(idHMPID,iCh),
89 AliGeomManager::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
90 }
91 }else{
92 AliError(Form("\"%s\" is not a valid identifier for misalignment types. Exiting ...",GetMisalType()));
93 return 0;
94 }
95
96 return array;
97}
98
99//_______________________________________________________________________________________
100AliCDBMetaData* AliHMPIDMisAligner::GetCDBMetaData() const {
101 // Returns the comment and responsible for the
102 // AliCDBMetaData to be associated with the OCDB entry
103 // containing the HMPID array of misalignment objects
104 //
105 AliCDBMetaData* md = new AliCDBMetaData();
106 md->SetResponsible("HMPID expert means nothing");
107
108 if(TString(GetMisalType())=="ideal")
109 md->SetComment("Alignment objects for HMPID ideal misalignment");
110 if(TString(GetMisalType())=="residual")
111 md->SetComment("Alignment objects for HMPID residual misalignment");
112 if(TString(GetMisalType())=="full")
113 md->SetComment("Full misalignment objects for HMPID produced with sigmaTrans=1mm and sigmaRot=1mrad");
114
115 return md;
116}