]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MakeMUONResMisAlignment.C
Correct function Compare() for "pixels" from MLEM cluster finder.
[u/mrichter/AliRoot.git] / MUON / MakeMUONResMisAlignment.C
CommitLineData
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
28#include "AliCDBManager.h"
29#include "AliCDBStorage.h"
30#include "AliCDBId.h"
31
32#include <TGeoManager.h>
33#include <TClonesArray.h>
34#include <TString.h>
35#include <TFile.h>
36#include <Riostream.h>
37
38#endif
39
226783d4 40void MakeMUONResMisAlignment()
41{
42 // Check first if geometry is loaded,
43 // if not loaded try to load it from galice.root file
44 if ( ! gGeoManager && ! TGeoManager::Import("geometry.root") ) {
45 cerr << "Loading geometry failed." << endl;
46 return;
1895a097 47 }
48
226783d4 49 AliMUONGeometryTransformer transformer(true);
50 transformer.ReadGeometryData("volpath.dat", gGeoManager);
1895a097 51
52 AliMUONGeometryMisAligner misAligner(0.0, 0.004, 0.0, 0.003, 0.0, 0.0023);
53 AliMUONGeometryTransformer* newTransform
226783d4 54 = misAligner.MisAlign(&transformer, true);
0eae0737 55 const TClonesArray* array = newTransform->GetMisAlignmentData();
1895a097 56
0eae0737 57 if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
226783d4 58 cout << "Generating residual misalignment data in a file" << endl;
59
1895a097 60 // Create a File to store the alignment data
61 TFile f("MUONresidualMisalignment.root","RECREATE");
0eae0737 62 if( !f.IsOpen() ) {
63 cerr << "cannot open file for output" << endl;
64 }
1895a097 65
66 f.cd();
67 f.WriteObject(array,"MUONAlignObjs ","kSingleKey");
68 f.Close();
226783d4 69 }
70 else {
71 cout << "Generating residual misalignment data in CDB" << endl;
1895a097 72 // save in CDB storage
5bd470e1 73 const char* Storage = gSystem->Getenv("STORAGE");
1895a097 74 AliCDBManager* cdbManager = AliCDBManager::Instance();
75 AliCDBStorage* storage = cdbManager->GetStorage(Storage);
76 AliCDBMetaData* cdbData = new AliCDBMetaData();
77 cdbData->SetResponsible("Dimuon Offline project");
78 cdbData->SetComment("MUON alignment objects with residual misalignment");
5bd470e1 79 cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
1895a097 80 AliCDBId id("MUON/Align/Data", 0, 9999999);
0eae0737 81 storage->Put(const_cast<TClonesArray*>(array), id, cdbData);
1895a097 82 }
1895a097 83 delete newTransform;
0eae0737 84 }
1895a097 85