Extracting Branch and Revision from Git.
[u/mrichter/AliRoot.git] / macros / MakeAllDETsZeroMisAlignment.C
CommitLineData
3592c27f 1#include "ARVersion.h"
2
a24be56b 3void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$HOME/ZeroMisAlignment", Bool_t partialGeom=kFALSE){
d3a9c52a 4 // Make zero misalignment objects for all detectors
5 // Pass different "CDBstorage" argument if needed (e.g. to fill
6 // conditions' data base on alien) or set it to null string to have
7 // the objects saved locally on file
8 //
6fce62af 9 const char* macroname="MakeAllDETsZeroMisAlignment.C";
10
d3a9c52a 11 TString strStorage(CDBstorage);
12 if(strStorage.IsNull()){
5bd470e1 13 gSystem->Setenv("TOCDB","kFALSE");
d3a9c52a 14 }else{
5bd470e1 15 gSystem->Setenv("TOCDB","kTRUE");
16 gSystem->Setenv("STORAGE",strStorage.Data());
0492edf5 17 gSystem->Setenv("ARVERSION",ALIROOT_BRANCH);
d3a9c52a 18 }
a24be56b 19 if(partialGeom){
05b5ef6a 20 gSystem->Setenv("REALSETUP","kTRUE");
a24be56b 21 }else{
05b5ef6a 22 gSystem->Setenv("REALSETUP","kFALSE");
a24be56b 23 }
d3a9c52a 24
6fce62af 25 // Load geometry from CDB updating it if we are producing the
26 // alignment objects for the CDB
27 AliCDBManager* cdb = AliCDBManager::Instance();
162637e4 28 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
6fce62af 29 cdb->SetRun(0);
30
31 if(strStorage.IsNull()){ //if we produce the objects into a file
32 AliGeomManager::LoadGeometry(); //load geom from default CDB storage
33 }else{ // if we produce the objects in a CDB storage
34 // update geometry in it
35 Info(macroname,"Updating geometry in CDB storage %s",strStorage.Data());
36 gROOT->ProcessLine(".L $ALICE_ROOT/GRP/UpdateCDBIdealGeom.C");
a24be56b 37 if(partialGeom){
38 UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config_PDC06.C");
39 }else{
6fce62af 40 UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config.C");
a24be56b 41 }
6fce62af 42 // load the same geometry from given CDB storage
43 AliCDBPath path("GRP","Geometry","Data");
44 AliCDBStorage* storage = cdb->GetStorage(strStorage.Data());
45 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
46 if(!entry) Fatal(macroname,"Couldn't load geometry data from CDB!");
47 entry->SetOwner(0);
48 TGeoManager* geom = (TGeoManager*) entry->GetObject();
49 if (!geom) Fatal(macroname,"Couldn't find TGeoManager in the specified CDB entry!");
50 AliGeomManager::SetGeometry(geom);
d3a9c52a 51 }
6fce62af 52
53 // run macro for non-sensitive modules
54 // (presently generates only FRAME alignment objects)
55 gSystem->Exec("aliroot -b -q $ALICE_ROOT/GRP/MakeSTRUCTZeroMisAlignment.C");
d3a9c52a 56
6fce62af 57 // run macros for sensitive modules
8fdf00be 58 TString sModules="ACORDE,EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC";
6fce62af 59 TObjArray *detArray = sModules.Tokenize(',');
d3a9c52a 60 TIter iter(detArray);
61 TObjString *ostr;
62 TString exec_det_macro;
63
64 while((ostr = (TObjString*) iter.Next())){
65 TString str(ostr->String());
66 exec_det_macro="aliroot -b -q $ALICE_ROOT/";
67 exec_det_macro+=str;
68 exec_det_macro+="/Make";
69 exec_det_macro+=str;
70 exec_det_macro+="ZeroMisAlignment.C";
71
72 gSystem->Exec(exec_det_macro.Data());
73 }
74
75 return;
76}
6fce62af 77