]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MakeMUONResMisAlignment.C
Added functionality to generate module misalignments
[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
226783d4 23void MakeMUONResMisAlignment()
24{
25 // Check first if geometry is loaded,
26 // if not loaded try to load it from galice.root file
27 if ( ! gGeoManager && ! TGeoManager::Import("geometry.root") ) {
28 cerr << "Loading geometry failed." << endl;
29 return;
1895a097 30 }
31
226783d4 32 AliMUONGeometryTransformer transformer(true);
33 transformer.ReadGeometryData("volpath.dat", gGeoManager);
1895a097 34
35 AliMUONGeometryMisAligner misAligner(0.0, 0.004, 0.0, 0.003, 0.0, 0.0023);
36 AliMUONGeometryTransformer* newTransform
226783d4 37 = misAligner.MisAlign(&transformer, true);
1895a097 38 TClonesArray* array = newTransform->GetMisAlignmentData();
39
226783d4 40 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
41 cout << "Generating residual misalignment data in a file" << endl;
42
1895a097 43 // Create a File to store the alignment data
44 TFile f("MUONresidualMisalignment.root","RECREATE");
45 if(!f) {cerr<<"cannot open file for output\n";}
46
47 f.cd();
48 f.WriteObject(array,"MUONAlignObjs ","kSingleKey");
49 f.Close();
226783d4 50 }
51 else {
52 cout << "Generating residual misalignment data in CDB" << endl;
1895a097 53 // save in CDB storage
5bd470e1 54 const char* Storage = gSystem->Getenv("STORAGE");
1895a097 55 AliCDBManager* cdbManager = AliCDBManager::Instance();
56 AliCDBStorage* storage = cdbManager->GetStorage(Storage);
57 AliCDBMetaData* cdbData = new AliCDBMetaData();
58 cdbData->SetResponsible("Dimuon Offline project");
59 cdbData->SetComment("MUON alignment objects with residual misalignment");
5bd470e1 60 cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
1895a097 61 AliCDBId id("MUON/Align/Data", 0, 9999999);
62 storage->Put(array, id, cdbData);
63 }
1895a097 64 delete newTransform;
65}
66