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