]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MakeMUONFullMisAlignment.C
Add buspatch length & change patch module interface needed for station 2
[u/mrichter/AliRoot.git] / MUON / MakeMUONFullMisAlignment.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 full misalignment data.
19 // The macro is trigger from AliRoot/macros/MakeAllDETsFullMisAlignment.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
42 void MakeMUONFullMisAlignment()
43 {
44   // Load geometry, if not yet loaded,
45   if ( ! AliGeomManager::GetGeometry() )
46     AliGeomManager::LoadGeometry("geometry.root");
47
48   AliMUONGeometryTransformer transformer;
49   transformer.LoadGeometryData();
50   
51   AliMUONGeometryMisAligner misAligner(0.0, 0.03, 0.0, 0.03, 0.0, 0.03);
52   AliMUONGeometryTransformer* newTransform 
53     = misAligner.MisAlign(&transformer, true);
54   const TClonesArray* array = newTransform->GetMisAlignmentData();
55   
56   if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
57     cout << "Generating full misalignment data in a file" << endl;
58
59     // Create a File to store the alignment data
60     TFile f("MUONfullMisalignment.root","RECREATE");
61     if ( !f.IsOpen() ) {
62       cerr << "cannot open file for output" << endl;
63     }
64     
65     f.cd();
66     f.WriteObject(array,"MUONAlignObjs ","kSingleKey");
67     f.Close();
68   }
69   else {
70     cout << "Generating full misalignment data in CDB" << endl;
71
72     // save in CDB storage
73     const char* Storage = gSystem->Getenv("STORAGE");
74     
75     AliCDBManager* cdbManager = AliCDBManager::Instance();
76     AliCDBStorage* storage = cdbManager->GetStorage(Storage);
77     AliCDBMetaData* cdbData = new AliCDBMetaData();
78     cdbData->SetResponsible("Dimuon Offline project");
79     cdbData->SetComment("MUON alignment objects with full misalignment");
80     cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
81     AliCDBId id("MUON/Align/Data", 0, 9999999); 
82     storage->Put(const_cast<TClonesArray*>(array), id, cdbData);
83   }   
84   delete newTransform;
85 }