]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MakeMUONZeroMisAlignment.C
Updated for changes in geometry classes
[u/mrichter/AliRoot.git] / MUON / MakeMUONZeroMisAlignment.C
CommitLineData
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
ef4cb4f1 26#include "AliGeomManager.h"
0eae0737 27#include "AliCDBManager.h"
28#include "AliCDBStorage.h"
29#include "AliCDBId.h"
30
ef4cb4f1 31#include <TSystem.h>
0eae0737 32#include <TClonesArray.h>
33#include <TString.h>
34#include <TFile.h>
35#include <Riostream.h>
36
37#endif
38
c2d1365a 39void MakeMUONZeroMisAlignment()
40{
ef4cb4f1 41 // Load geometry, if not yet loaded,
42 if ( ! AliGeomManager::GetGeometry() )
43 AliGeomManager::LoadGeometry("geometry.root");
44
45 AliMUONGeometryTransformer transformer;
46 transformer.LoadGeometryData();
c2d1365a 47 TClonesArray* array = transformer.CreateZeroAlignmentData();;
d3a9c52a 48
0eae0737 49 if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
c2d1365a 50 // save in file
51 cout << "Generating zero misalignment data in a file ..." << endl;
d3a9c52a 52
c2d1365a 53 // Create a file to store the alignment data
54 TFile f("MUONzeroMisalignment.root", "RECREATE");
0eae0737 55 if( !f.IsOpen() ) {
c2d1365a 56 cerr<<"cannot open file for output\n";
57 }
0eae0737 58
d3a9c52a 59 f.cd();
60 f.WriteObject(array,"MUONAlignObjs ","kSingleKey");
61 f.Close();
c2d1365a 62 }
63 else {
64 cout << "Generating zero misalignment data in CDB ..." << endl;
65
d3a9c52a 66 // save in CDB storage
5bd470e1 67 const char* Storage = gSystem->Getenv("STORAGE");
d3a9c52a 68 AliCDBManager* cdbManager = AliCDBManager::Instance();
69 AliCDBStorage* storage = cdbManager->GetStorage(Storage);
70 AliCDBMetaData* cdbData = new AliCDBMetaData();
71 cdbData->SetResponsible("Dimuon Offline project");
5bd470e1 72 cdbData->SetComment("MUON alignment objects with zero misalignment");
73 cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
d3a9c52a 74 AliCDBId id("MUON/Align/Data", 0, 9999999);
75 storage->Put(array, id, cdbData);
76 }
d3a9c52a 77}
78