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 HMPID. 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 "AliHMPIDMisAligner.h"
28 #include "AliGeomManager.h"
29 #include "TClonesArray.h"
32 #include "AliAlignObjMatrix.h"
35 ClassImp(AliHMPIDMisAligner)
37 //_______________________________________________________________________________________
38 AliHMPIDMisAligner::AliHMPIDMisAligner() : AliMisAligner()
45 //_______________________________________________________________________________________
46 TClonesArray* AliHMPIDMisAligner::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("AliAlignObjMatrix",7);
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
63 // TRandom *pRnd = new TRandom(4357);
64 gRandom->SetSeed(4357);
66 if(TString(GetMisalType())=="ideal")
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);
74 }else if( TString(GetMisalType())=="residual" || TString(GetMisalType())=="full"){
76 sigmaTrans=0.1; // 1mm
77 sigmaRot=0.001*180/TMath::Pi(); // 1 mrad
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);
92 AliError(Form("\"%s\" is not a valid identifier for misalignment types. Exiting ...",GetMisalType()));
99 //_______________________________________________________________________________________
100 AliCDBMetaData* 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
105 AliCDBMetaData* md = new AliCDBMetaData();
106 md->SetResponsible("HMPID expert means nothing");
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");