]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDMisAligner.cxx
initializing variables that were declare without a value
[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;
45f0e531 60 Double_t sigmaTrans, sigmaRotPsi, sigmaRotTheta, sigmaRotPhi;
22c261d9 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
45f0e531 76 sigmaTrans=4.; // 4 cm
77 sigmaRotPsi = 0.2; // degrees
78 sigmaRotTheta = 1.0; // degrees
79 sigmaRotPhi = 0.5; // degrees
80
22c261d9 81 for (Int_t iCh = 0; iCh < 7; iCh++) {
45f0e531 82
83 /*dX = 2 - 2.1*gRandom->Uniform();
84 dY = 2 - 2.1*gRandom->Uniform();
85 dZ = 2.0 - 4*gRandom->Uniform();
86 dPsi = 0.1 - 0.2*gRandom->Uniform();
87 dTheta = 1 - 1.1*gRandom->Uniform();
88 dPhi = 0.25 - 0.5*gRandom->Uniform();*/
89
90 dX = sigmaTrans/2 - (sigmaTrans/2+0.1)*gRandom->Uniform(); // -0.1 <---> 2 cm
91 dY = sigmaTrans/2 - (sigmaTrans/2+0.1)*gRandom->Uniform(); // -0.1 <---> 2 cm
92 dZ = (gRandom->Uniform() - 0.5)*sigmaTrans; // -2.0 <---> 2 cm
93 dPsi = (gRandom->Uniform() - 0.5)*sigmaRotPsi; // -0.1 <---> 0.1 degree
94 dTheta = sigmaRotTheta - (sigmaRotTheta+0.1)*gRandom->Uniform(); // -0.1 <---> 1.0 degree
95 dPhi = (gRandom->Uniform() - 0.5)*sigmaRotPhi; // -0.25 <---> 0.25 degree
96
97
22c261d9 98 // dX = (pRnd->Uniform()-0.5)*sigmaTrans; dY = (pRnd->Uniform()-0.5)*sigmaTrans; dZ = (pRnd->Uniform()-0.5)*sigmaTrans;
99 // dPsi = (pRnd->Uniform()-0.5)*sigmaRot; dTheta = (pRnd->Uniform()-0.5)*sigmaRot; dPhi = (pRnd->Uniform()-0.5)*sigmaRot;
100 new((*array)[iCh]) AliAlignObjMatrix(AliGeomManager::SymName(idHMPID,iCh),
101 AliGeomManager::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
102 }
103 }else{
104 AliError(Form("\"%s\" is not a valid identifier for misalignment types. Exiting ...",GetMisalType()));
105 return 0;
106 }
107
108 return array;
109}
110
111//_______________________________________________________________________________________
112AliCDBMetaData* AliHMPIDMisAligner::GetCDBMetaData() const {
113 // Returns the comment and responsible for the
114 // AliCDBMetaData to be associated with the OCDB entry
115 // containing the HMPID array of misalignment objects
116 //
117 AliCDBMetaData* md = new AliCDBMetaData();
118 md->SetResponsible("HMPID expert means nothing");
119
120 if(TString(GetMisalType())=="ideal")
121 md->SetComment("Alignment objects for HMPID ideal misalignment");
122 if(TString(GetMisalType())=="residual")
123 md->SetComment("Alignment objects for HMPID residual misalignment");
124 if(TString(GetMisalType())=="full")
125 md->SetComment("Full misalignment objects for HMPID produced with sigmaTrans=1mm and sigmaRot=1mrad");
126
127 return md;
128}