]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONCheckMisAligner.C
SelectCollisionCandidates added for the task
[u/mrichter/AliRoot.git] / MUON / MUONCheckMisAligner.C
CommitLineData
57e827c3 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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/* $Id$ */
17
e54bf126 18/// \ingroup macros
19/// \file MUONCheckMisAligner.C
20/// \brief This macro performs the misalignment on an existing muon arm geometry
21///
22/// This macro performs the misalignment on an existing muon arm geometry
23/// based on the standard definition of the detector elements in
24/// the AliMUONGeometryTransformer class.
25///
26/// It uses AliMUONGeometryMisAligner :
27/// - Creates a new AliMUONGeometryTransformer and AliMUONGeometryMisAligner
1ba08db3 28/// - Loads the geometry from the specified geometry file (default is geometry.root)
e54bf126 29/// - Creates a second AliMUONGeometryTransformer by misaligning the existing
30/// one using AliMUONGeometryMisAligner::MisAlign
31/// - User has to specify the magnitude of the alignments, in the Cartesian
32/// co-ordiantes (which are used to apply translation misalignments) and in the
33/// spherical co-ordinates (which are used to apply angular displacements)
34/// - User can also set misalignment ranges by hand using the methods :
35/// SetMaxCartMisAlig, SetMaxAngMisAlig, SetXYAngMisAligFactor
36/// (last method takes account of the fact that the misalingment is greatest in
37/// the XY plane, since the detection elements are fixed to a support structure
38/// in this plane. Misalignments in the XZ and YZ plane will be very small
39/// compared to those in the XY plane, which are small already - of the order
40/// of microns)
41/// - Default behavior generates a "residual" misalignment using gaussian
42/// distributions. Uniform distributions can still be used, see
43/// AliMUONGeometryMisAligner.
44/// - User can also generate module misalignments using SetModuleCartMisAlig
45/// and SetModuleAngMisAlig
46///
47/// Note: If the detection elements are allowed to be misaligned in all
48/// directions, this has consequences for the alignment algorithm, which
49/// needs to know the number of free parameters. Eric only allowed 3 :
50/// x,y,theta_xy, but in principle z and the other two angles are alignable
51/// as well.
52///
53/// \author:Bruce Becker
57e827c3 54
edd305e8 55#if !defined(__CINT__) || defined(__MAKECINT__)
56
57#include "AliMUONGeometryTransformer.h"
58#include "AliMUONGeometryMisAligner.h"
59
ef4cb4f1 60#include "AliGeomManager.h"
edd305e8 61#include "AliCDBManager.h"
62#include "AliCDBMetaData.h"
63#include "AliCDBId.h"
64
65#include <TGeoManager.h>
66#include <TClonesArray.h>
67
68#endif
69
2cbab029 70void MUONCheckMisAligner(Double_t xcartmisaligm = 0.0, Double_t xcartmisaligw = 0.004,
71 Double_t ycartmisaligm = 0.0, Double_t ycartmisaligw = 0.003,
b9bff1ec 72 Double_t angmisaligm = 0.0, Double_t angmisaligw = 0.0023,
edd305e8 73 TString nameCDB = "ResMisAlignCDB",
74 const TString& geomFileName = "geometry.root")
57e827c3 75{
76
ef4cb4f1 77 AliMUONGeometryTransformer *transform = new AliMUONGeometryTransformer();
78 transform->LoadGeometryData(geomFileName.Data());
edd305e8 79
2cbab029 80 AliMUONGeometryMisAligner misAligner(xcartmisaligm,xcartmisaligw,
81 ycartmisaligm,ycartmisaligw,
82 angmisaligm,angmisaligw);
57e827c3 83
f1d59163 84 // Generate mis alignment data
ef4cb4f1 85
4600314b 86 // Uncomment lines below if you would like to generate module misalignments
ef4cb4f1 87 // misAligner.SetModuleCartMisAlig(0.0,0.1,0.0,0.1,0.0,0.1); // Full
88 // misAligner.SetModuleAngMisAlig(0.0,0.02,0.0,0.04,0.0,0.02); // Full
89 // misAligner.SetModuleCartMisAlig(0.0,0.003,0.0,0.003,0.0,0.003); // Res
90 // misAligner.SetModuleAngMisAlig(0.0,0.0006,0.0,0.001,0.0,0.0005); // Res
91
57e827c3 92 AliMUONGeometryTransformer *newTransform = misAligner.MisAlign(transform,true);
93 newTransform->WriteTransformations("transform2.dat");
f1d59163 94 newTransform->WriteMisAlignmentData("misalign.root");
95
96 // Apply misAlignment via AliRoot framework
ef4cb4f1 97 AliGeomManager::ApplyAlignObjsToGeom(
98 *const_cast<TClonesArray*>(newTransform->GetMisAlignmentData()));
f1d59163 99 // Save new geometry file
100 gGeoManager->Export("geometry2.root");
1ba08db3 101
f1d59163 102 // Extract new transformations
ef4cb4f1 103 AliMUONGeometryTransformer* transform3 = new AliMUONGeometryTransformer();
1ba08db3 104 gGeoManager->UnlockGeometry();
ef4cb4f1 105 transform3->LoadGeometryData("geometry2.root");
f1d59163 106 transform3->WriteTransformations("transform3.dat");
107 // Check that transform3.dat is equal to transform2.dat
57e827c3 108
2cbab029 109 // Generate misaligned data in local cdb
edd305e8 110 const TClonesArray* array = newTransform->GetMisAlignmentData();
4818a9b7 111
112 // 100 mum residual resolution for chamber misalignments?
113 misAligner.SetAlignmentResolution(array,-1,0.01,0.01,xcartmisaligw,ycartmisaligw);
114
b9bff1ec 115 TString sLocCDB("local://");
116 sLocCDB += nameCDB;
2cbab029 117 // CDB manager
118 AliCDBManager* cdbManager = AliCDBManager::Instance();
1ba08db3 119 cdbManager->SetSpecificStorage("MUON/Align/Data",sLocCDB.Data());
120
2cbab029 121 AliCDBMetaData* cdbData = new AliCDBMetaData();
122 cdbData->SetResponsible("Dimuon Offline project");
123 cdbData->SetComment("MUON alignment objects with residual misalignment");
1ba08db3 124 AliCDBId id("MUON/Align/Data", 0, AliCDBRunRange::Infinity());
edd305e8 125 cdbManager->Put(const_cast<TClonesArray*>(array), id, cdbData);
2cbab029 126
57e827c3 127 // To run simulation with misaligned geometry, you have to set
128 // the Align option in Config.C:
129 // MUON->SetAlign("transform2.dat");
130}
131
132
133
134