]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MakeMUONZeroMisAlignment.C
AliAlignObjAngles becomes AliAlignObjParams (Raffaele)
[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,
dfe9c69d 42 if(!AliGeomManager::GetGeometry()){
43 if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
44 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
45 AliCDBManager::Instance()->SetRun(0);
46 AliGeomManager::LoadGeometry();
47 }
ef4cb4f1 48
49 AliMUONGeometryTransformer transformer;
50 transformer.LoadGeometryData();
c2d1365a 51 TClonesArray* array = transformer.CreateZeroAlignmentData();;
d3a9c52a 52
dfe9c69d 53 const char* macroname = "MakeMUONZeroMisAlignment.C";
0eae0737 54 if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
c2d1365a 55 // Create a file to store the alignment data
dfe9c69d 56 const char* filename = "MUONZeroMisalignment.root";
57 TFile f(filename,"RECREATE");
58 if(!f){
59 Error(macroname,"cannot open file for output\n");
60 return;
c2d1365a 61 }
dfe9c69d 62 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 63 f.cd();
dfe9c69d 64 f.WriteObject(array,"MUONAlignObjs","kSingleKey");
d3a9c52a 65 f.Close();
dfe9c69d 66 } else {
d3a9c52a 67 // save in CDB storage
dfe9c69d 68 TString Storage = gSystem->Getenv("STORAGE");
69 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
70 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
71 return;
72 }
73 Info(macroname,"Saving alignment objects in CDB storage %s",
74 Storage.Data());
75 AliCDBManager* cdb = AliCDBManager::Instance();
76 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
77 if(!storage){
78 Error(macroname,"Unable to open storage %s\n",Storage.Data());
79 return;
80 }
d3a9c52a 81 AliCDBMetaData* cdbData = new AliCDBMetaData();
82 cdbData->SetResponsible("Dimuon Offline project");
5bd470e1 83 cdbData->SetComment("MUON alignment objects with zero misalignment");
84 cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 85 AliCDBId id("MUON/Align/Data", 0, AliCDBRunRange::Infinity());
d3a9c52a 86 storage->Put(array, id, cdbData);
87 }
d3a9c52a 88}
89