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