]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/MakeAllDETsFullMisAlignment.C
Keep only the forward mapping array persistent, the inverse one is created on demand...
[u/mrichter/AliRoot.git] / macros / MakeAllDETsFullMisAlignment.C
1 void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/FullMisAlignment", Bool_t partialGeom=kFALSE){
2    // Make full misalignment objects for all detectors
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   //
10   const char* macroname="MakeAllDETsFullMisAlignment.C";
11
12   TString strStorage(CDBstorage);
13   if(strStorage.IsNull()){
14     gSystem->Setenv("TOCDB","kFALSE");
15   }else{  
16     gSystem->Setenv("TOCDB","kTRUE");
17     gSystem->Setenv("STORAGE",strStorage.Data());
18     gROOT->ProcessLine(".L $ALICE_ROOT/macros/GetARversion.C");
19     gSystem->Setenv("ARVERSION",GetARversion());
20   }
21   if(partialGeom){
22     gSystem->Setenv("PARTGEOM","kTRUE");
23   }else{
24     gSystem->Setenv("PARTGEOM","kFALSE");
25   }
26
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");
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     }
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);
53   }
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");
58
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(',');
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 }
79