]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | /// \ingroup macros | |
19 | /// \file MakeMUONResMisAlignment.C | |
20 | /// \brief Macro for generating the residual misalignment data. | |
21 | /// | |
22 | /// The macro is triggered from AliRoot/macros/MakeAllDETsResMisAlignment.C | |
23 | /// | |
24 | /// \author: I. Hrivnacova, IPN Orsay | |
25 | ||
26 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
27 | ||
28 | #include "AliMUONGeometryTransformer.h" | |
29 | #include "AliMUONGeometryMisAligner.h" | |
30 | ||
31 | #include "AliGeomManager.h" | |
32 | #include "AliCDBManager.h" | |
33 | #include "AliCDBStorage.h" | |
34 | #include "AliCDBEntry.h" | |
35 | #include "AliCDBId.h" | |
36 | ||
37 | #include <TSystem.h> | |
38 | #include <TError.h> | |
39 | #include <TClonesArray.h> | |
40 | #include <TString.h> | |
41 | #include <TFile.h> | |
42 | #include <Riostream.h> | |
43 | ||
44 | #endif | |
45 | ||
46 | void MakeMUONResMisAlignment() | |
47 | { | |
48 | const char* macroname = "MakeMUONResMisAlignment.C"; | |
49 | // Activate CDB storage and load geometry from CDB | |
50 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
51 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
52 | cdb->SetRun(0); | |
53 | ||
54 | AliCDBStorage* storage = 0; | |
55 | ||
56 | if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ | |
57 | TString Storage = gSystem->Getenv("STORAGE"); | |
58 | if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { | |
59 | Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); | |
60 | return; | |
61 | } | |
62 | storage = cdb->GetStorage(Storage.Data()); | |
63 | if(!storage){ | |
64 | Error(macroname,"Unable to open storage %s\n",Storage.Data()); | |
65 | return; | |
66 | } | |
67 | AliCDBPath path("GRP","Geometry","Data"); | |
68 | AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun()); | |
69 | if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); | |
70 | entry->SetOwner(0); | |
71 | TGeoManager* geom = (TGeoManager*) entry->GetObject(); | |
72 | AliGeomManager::SetGeometry(geom); | |
73 | }else{ | |
74 | AliGeomManager::LoadGeometry(); //load geom from default CDB storage | |
75 | } | |
76 | ||
77 | AliMUONGeometryTransformer transformer; | |
78 | transformer.LoadGeometryData(); | |
79 | ||
80 | AliMUONGeometryMisAligner misAligner(0.0, 0.004, 0.0, 0.003, 0.0, 0.0023); | |
81 | AliMUONGeometryTransformer* newTransform | |
82 | = misAligner.MisAlign(&transformer, true); | |
83 | const TClonesArray* array = newTransform->GetMisAlignmentData(); | |
84 | ||
85 | // 100 mum residual resolution for chamber misalignments? | |
86 | misAligner.SetAlignmentResolution(array,-1,0.01,0.01); | |
87 | ||
88 | if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) { | |
89 | // Save in file | |
90 | const char* filename = "MUONresidualMisalignment.root"; | |
91 | TFile f(filename,"RECREATE"); | |
92 | if(!f.IsOpen()){ | |
93 | Error(macroname,"cannot open file for output\n"); | |
94 | return; | |
95 | } | |
96 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
97 | f.cd(); | |
98 | f.WriteObject(array,"MUONAlignObjs","kSingleKey"); | |
99 | f.Close(); | |
100 | } else { | |
101 | // Save in CDB storage | |
102 | AliCDBMetaData* cdbData = new AliCDBMetaData(); | |
103 | cdbData->SetResponsible("Dimuon Offline project"); | |
104 | cdbData->SetComment("MUON alignment objects with residual misalignment"); | |
105 | cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION")); | |
106 | AliCDBId id("MUON/Align/Data", 0, AliCDBRunRange::Infinity()); | |
107 | storage->Put(const_cast<TClonesArray*>(array), id, cdbData); | |
108 | } | |
109 | delete newTransform; | |
110 | } | |
111 |