1 const char* GetARversion();
3 void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/Residual"){
4 // Make residual 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 // This macro defines the default name and place for the detector-macros
9 // in charge of producing the residual misalignment objects as
10 // $ALICE_ROOT/DET/MakeDETResidualMisAlignment.C
12 const char* macroname="MakeAllDETsResMisAlignment.C";
14 TString strStorage(CDBstorage);
15 if(strStorage.IsNull()){
16 gSystem->Setenv("TOCDB","kFALSE");
18 gSystem->Setenv("TOCDB","kTRUE");
19 gSystem->Setenv("STORAGE",strStorage.Data());
20 gSystem->Setenv("ARVERSION",GetARversion());
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");
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!");
42 TGeoManager* geom = (TGeoManager*) entry->GetObject();
43 if (!geom) Fatal(macroname,"Couldn't find TGeoManager in the specified CDB entry!");
44 AliGeomManager::SetGeometry(geom);
47 // run macro for non-sensitive modules
48 // (presently generates only FRAME alignment objects)
49 gSystem->Exec("aliroot -b -q $ALICE_ROOT/GRP/MakeSTRUCTResMisAlignment.C");
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(',');
56 TString exec_det_macro;
58 while((ostr = (TObjString*) iter.Next())){
59 TString str(ostr->String());
60 exec_det_macro="aliroot -b -q $ALICE_ROOT/";
62 exec_det_macro+="/Make";
64 exec_det_macro+="ResMisAlignment.C";
66 gSystem->Exec(exec_det_macro.Data());
72 const 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);
81 if ( fv->ReadBuffer(buf, size) ) {
82 Printf("Error reading AliRoot version from file to buffer!");