]>
Commit | Line | Data |
---|---|---|
c2d1365a | 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 | **************************************************************************/ | |
d3a9c52a | 15 | |
c2d1365a | 16 | // $Id$ |
d3a9c52a | 17 | |
c2d1365a | 18 | // Macro for generating the zero misalignment data. |
19 | // | |
20 | // Author: I. Hrivnacova, IPN Orsay | |
d3a9c52a | 21 | |
0eae0737 | 22 | #if !defined(__CINT__) || defined(__MAKECINT__) |
23 | ||
24 | #include "AliMUONGeometryTransformer.h" | |
25 | ||
26 | #include "AliCDBManager.h" | |
27 | #include "AliCDBStorage.h" | |
28 | #include "AliCDBId.h" | |
29 | ||
30 | #include <TGeoManager.h> | |
31 | #include <TClonesArray.h> | |
32 | #include <TString.h> | |
33 | #include <TFile.h> | |
34 | #include <Riostream.h> | |
35 | ||
36 | #endif | |
37 | ||
c2d1365a | 38 | void MakeMUONZeroMisAlignment() |
39 | { | |
40 | // Check first if geometry is loaded, | |
41 | // if not loaded try to load it from galice.root file | |
42 | if ( ! gGeoManager && ! TGeoManager::Import("geometry.root") ) { | |
43 | cerr << "Loading geometry failed." << endl; | |
44 | return; | |
d3a9c52a | 45 | } |
46 | ||
c2d1365a | 47 | AliMUONGeometryTransformer transformer(true); |
48 | transformer.ReadGeometryData("volpath.dat", gGeoManager); | |
49 | TClonesArray* array = transformer.CreateZeroAlignmentData();; | |
d3a9c52a | 50 | |
0eae0737 | 51 | if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) { |
c2d1365a | 52 | // save in file |
53 | cout << "Generating zero misalignment data in a file ..." << endl; | |
d3a9c52a | 54 | |
c2d1365a | 55 | // Create a file to store the alignment data |
56 | TFile f("MUONzeroMisalignment.root", "RECREATE"); | |
0eae0737 | 57 | if( !f.IsOpen() ) { |
c2d1365a | 58 | cerr<<"cannot open file for output\n"; |
59 | } | |
0eae0737 | 60 | |
d3a9c52a | 61 | f.cd(); |
62 | f.WriteObject(array,"MUONAlignObjs ","kSingleKey"); | |
63 | f.Close(); | |
c2d1365a | 64 | } |
65 | else { | |
66 | cout << "Generating zero misalignment data in CDB ..." << endl; | |
67 | ||
d3a9c52a | 68 | // save in CDB storage |
5bd470e1 | 69 | const char* Storage = gSystem->Getenv("STORAGE"); |
d3a9c52a | 70 | AliCDBManager* cdbManager = AliCDBManager::Instance(); |
71 | AliCDBStorage* storage = cdbManager->GetStorage(Storage); | |
72 | AliCDBMetaData* cdbData = new AliCDBMetaData(); | |
73 | cdbData->SetResponsible("Dimuon Offline project"); | |
5bd470e1 | 74 | cdbData->SetComment("MUON alignment objects with zero misalignment"); |
75 | cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION")); | |
d3a9c52a | 76 | AliCDBId id("MUON/Align/Data", 0, 9999999); |
77 | storage->Put(array, id, cdbData); | |
78 | } | |
d3a9c52a | 79 | } |
80 |