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