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