]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MakeMUONResMisAlignment.C
Removing obsolete files from build system
[u/mrichter/AliRoot.git] / MUON / MakeMUONResMisAlignment.C
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  **************************************************************************/
15
16 // $Id$
17
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
22
23 #if !defined(__CINT__) || defined(__MAKECINT__)
24
25 #include "AliMUONGeometryTransformer.h"
26 #include "AliMUONGeometryMisAligner.h"
27
28 #include "AliGeomManager.h"
29 #include "AliCDBManager.h"
30 #include "AliCDBStorage.h"
31 #include "AliCDBId.h"
32
33 #include <TSystem.h>
34 #include <TClonesArray.h>
35 #include <TString.h>
36 #include <TFile.h>
37 #include <Riostream.h>
38
39 #endif
40
41 void MakeMUONResMisAlignment()
42 {
43   // Load geometry, if not yet loaded,
44   if ( ! AliGeomManager::GetGeometry() )
45     AliGeomManager::LoadGeometry("geometry.root");
46
47   AliMUONGeometryTransformer transformer;
48   transformer.LoadGeometryData();
49   
50   AliMUONGeometryMisAligner misAligner(0.0, 0.004, 0.0, 0.003, 0.0, 0.0023);
51   AliMUONGeometryTransformer* newTransform 
52     = misAligner.MisAlign(&transformer, true);
53   const TClonesArray* array = newTransform->GetMisAlignmentData();
54
55   if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
56     cout << "Generating residual misalignment data in a file" << endl;
57   
58     // Create a File to store the alignment data
59     TFile f("MUONresidualMisalignment.root","RECREATE");
60     if( !f.IsOpen() ) {
61       cerr << "cannot open file for output" << endl;
62     }
63     
64     f.cd();
65     f.WriteObject(array,"MUONAlignObjs ","kSingleKey");
66     f.Close();
67   }
68   else {
69     cout << "Generating residual misalignment data in CDB" << endl;
70     // save in CDB storage
71     const char* Storage = gSystem->Getenv("STORAGE");
72     AliCDBManager* cdbManager = AliCDBManager::Instance();
73     AliCDBStorage* storage = cdbManager->GetStorage(Storage);
74     AliCDBMetaData* cdbData = new AliCDBMetaData();
75     cdbData->SetResponsible("Dimuon Offline project");
76     cdbData->SetComment("MUON alignment objects with residual misalignment");
77     cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
78     AliCDBId id("MUON/Align/Data", 0, 9999999); 
79     storage->Put(const_cast<TClonesArray*>(array), id, cdbData);
80   }
81   delete newTransform;
82  }   
83