]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/MakeAllDETsZeroMisAlignment.C
Using symbolic particle types everywhere
[u/mrichter/AliRoot.git] / macros / MakeAllDETsZeroMisAlignment.C
1 void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$HOME/ZeroMisAlignment", Bool_t partialGeom=kFALSE){
2   // Make zero 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   //
7   const char* macroname="MakeAllDETsZeroMisAlignment.C";
8
9   TString strStorage(CDBstorage);
10   if(strStorage.IsNull()){
11     gSystem->Setenv("TOCDB","kFALSE");
12   }else{  
13     gSystem->Setenv("TOCDB","kTRUE");
14     gSystem->Setenv("STORAGE",strStorage.Data());
15     gROOT->ProcessLine(".L $ALICE_ROOT/macros/GetARversion.C");
16     gSystem->Setenv("ARVERSION",GetARversion());
17   }
18   if(partialGeom){
19     gSystem->Setenv("PARTGEOM","kTRUE");
20   }else{
21     gSystem->Setenv("PARTGEOM","kFALSE");
22   }
23
24   // Load geometry from CDB updating it if we are producing the
25   // alignment objects for the CDB
26   AliCDBManager* cdb = AliCDBManager::Instance();
27   if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
28   cdb->SetRun(0);
29   
30   if(strStorage.IsNull()){ //if we produce the objects into a file
31     AliGeomManager::LoadGeometry(); //load geom from default CDB storage
32   }else{ // if we produce the objects in a CDB storage
33     // update geometry in it
34     Info(macroname,"Updating geometry in CDB storage %s",strStorage.Data());
35     gROOT->ProcessLine(".L $ALICE_ROOT/GRP/UpdateCDBIdealGeom.C");
36     if(partialGeom){
37       UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config_PDC06.C");
38     }else{
39     UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config.C");    
40     }
41     // load the same geometry from given CDB storage
42     AliCDBPath path("GRP","Geometry","Data");
43     AliCDBStorage* storage = cdb->GetStorage(strStorage.Data());
44     AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
45     if(!entry) Fatal(macroname,"Couldn't load geometry data from CDB!");
46     entry->SetOwner(0);
47     TGeoManager* geom = (TGeoManager*) entry->GetObject();
48     if (!geom) Fatal(macroname,"Couldn't find TGeoManager in the specified CDB entry!");
49     AliGeomManager::SetGeometry(geom);
50   }
51   
52   // run macro for non-sensitive modules
53   // (presently generates only FRAME alignment objects)
54   gSystem->Exec("aliroot -b -q $ALICE_ROOT/GRP/MakeSTRUCTZeroMisAlignment.C");
55
56   // run macros for sensitive modules
57   TString sModules="EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC";
58   TObjArray *detArray = sModules.Tokenize(',');
59   TIter iter(detArray);
60   TObjString *ostr;
61   TString exec_det_macro;
62
63   while((ostr = (TObjString*) iter.Next())){
64     TString str(ostr->String());
65     exec_det_macro="aliroot -b -q $ALICE_ROOT/";
66     exec_det_macro+=str;
67     exec_det_macro+="/Make";
68     exec_det_macro+=str;
69     exec_det_macro+="ZeroMisAlignment.C";
70     
71     gSystem->Exec(exec_det_macro.Data());
72   }
73
74   return;
75 }
76