Manso tracker is now ported into AliRoot-HLT framework properly.
[u/mrichter/AliRoot.git] / macros / MakeAllDETsFullMisAlignment.C
CommitLineData
6fce62af 1const char* GetARversion();
2
1895a097 3void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/Full"){
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());
6fce62af 20 gSystem->Setenv("ARVERSION",GetARversion());
1895a097 21 }
22
6fce62af 23 // Load geometry from CDB updating it if we are producing the
24 // alignment objects for the CDB
25 AliCDBManager* cdb = AliCDBManager::Instance();
26 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
27 cdb->SetRun(0);
28
29 if(strStorage.IsNull()){ //if we produce the objects into a file
30 AliGeomManager::LoadGeometry(); //load geom from default CDB storage
31 }else{ // if we produce the objects in a CDB storage
32 // update geometry in it
33 Info(macroname,"Updating geometry in CDB storage %s",strStorage.Data());
34 gROOT->ProcessLine(".L $ALICE_ROOT/GRP/UpdateCDBIdealGeom.C");
35 UpdateCDBIdealGeom(strStorage.Data());
36 // load the same geometry from given CDB storage
37 AliCDBPath path("GRP","Geometry","Data");
38 AliCDBStorage* storage = cdb->GetStorage(strStorage.Data());
39 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
40 if(!entry) Fatal(macroname,"Couldn't load geometry data from CDB!");
41 entry->SetOwner(0);
42 TGeoManager* geom = (TGeoManager*) entry->GetObject();
43 if (!geom) Fatal(macroname,"Couldn't find TGeoManager in the specified CDB entry!");
44 AliGeomManager::SetGeometry(geom);
1895a097 45 }
6fce62af 46
47 // run macro for non-sensitive modules
48 // (presently generates only FRAME alignment objects)
49 gSystem->Exec("aliroot -b -q $ALICE_ROOT/GRP/MakeSTRUCTFullMisAlignment.C");
1895a097 50
6fce62af 51 // run macros for sensitive modules
52 TString sModules="EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC";
53 TObjArray *detArray = sModules.Tokenize(',');
1895a097 54 TIter iter(detArray);
55 TObjString *ostr;
56 TString exec_det_macro;
57
58 while((ostr = (TObjString*) iter.Next())){
59 TString str(ostr->String());
60 exec_det_macro="aliroot -b -q $ALICE_ROOT/";
61 exec_det_macro+=str;
62 exec_det_macro+="/Make";
63 exec_det_macro+=str;
64 exec_det_macro+="FullMisAlignment.C";
65
66 gSystem->Exec(exec_det_macro.Data());
67 }
68
69 return;
70}
6fce62af 71
72const char* GetARversion(){
73 // Get AliRoot version from $ALICE_ROOT/CVS/Repository file
74 // It's the best we can do without a GetVersion() method
75 TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ");
76 Int_t size = fv->GetSize();
77 char *buf = new Char_t[size];
78 memset(buf, '\0', size);
79 fv->Seek(0);
80 const char* alirootv;
81 if ( fv->ReadBuffer(buf, size) ) {
82 Printf("Error reading AliRoot version from file to buffer!");
83 alirootv = "";
84 }
85 if(buf=="AliRoot"){
86 alirootv="HEAD";
87 }else{
88 alirootv = buf;
89 }
90 return alirootv;
91}