]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/MakeAllDETsFullMisAlignment.C
Fixes for coverity.
[u/mrichter/AliRoot.git] / macros / MakeAllDETsFullMisAlignment.C
1 #include "ARVersion.h"
2
3 void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/FullMisAlignment", Bool_t partialGeom=kFALSE){
4    // Make full 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 full misalignment objects as 
10   // $ALICE_ROOT/DET/MakeDETFullMisAlignment.C
11   //
12   const char* macroname="MakeAllDETsFullMisAlignment.C";
13
14   TString strStorage(CDBstorage);
15   if(strStorage.IsNull()){
16     gSystem->Setenv("TOCDB","kFALSE");
17   }else{  
18     gSystem->Setenv("TOCDB","kTRUE");
19     gSystem->Setenv("STORAGE",strStorage.Data());
20     gSystem->Setenv("ARVERSION",ALIROOT_BRANCH);
21   }
22   if(partialGeom){
23     gSystem->Setenv("REALSETUP","kTRUE");
24   }else{
25     gSystem->Setenv("REALSETUP","kFALSE");
26   }
27
28   // Load geometry from CDB updating it if we are producing the
29   // alignment objects for the CDB
30   AliCDBManager* cdb = AliCDBManager::Instance();
31   if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
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");
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     }
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);
54   }
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");
59
60   // run macros for sensitive modules
61   TString sModules="ACORDE,EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC";
62   TObjArray *detArray = sModules.Tokenize(',');
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 }
80