]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/scripts/ApplyAlignment.C
Updating info for ACORDE and TRD
[u/mrichter/AliRoot.git] / FMD / scripts / ApplyAlignment.C
1 //____________________________________________________________________
2 //
3 // $Id$
4 //
5 // Read in the geometry, and get alignment data from CDB, and  apply
6 // that to the geometry. 
7 //
8 /** Apply alignment to a geometry 
9     @ingroup simple_script
10  */
11 void
12 ApplyAlignment()
13 {
14   gSystem->Load("libFMDutil.so");
15   TGeoManager::Import("geometry.root");
16
17   AliCDBManager* cdb   = AliCDBManager::Instance();
18   cdb->SetDefaultStorage("local://cdb");
19   AliCDBEntry*   align = cdb->Get("FMD/Align/Data");
20   if (align) {
21     Info("ApplyAlignment","Got alignment data from CDB");
22     TClonesArray* array = dynamic_cast<TClonesArray*>(align->GetObject());
23     if (!array) {
24       Warning("ApplyAlignement", "Invalid align data from CDB");
25     }
26     else {
27       Int_t nAlign = array->GetEntries();
28       for (Int_t i = 0; i < nAlign; i++) {
29         AliAlignObjParams* a = static_cast<AliAlignObjParams*>(array->At(i));
30         if (!a->ApplyToGeometry()) {
31           Warning("ApplyAlignement", "Failed to apply alignment to %s", 
32                   a->GetVolPath());
33         }
34       }
35     }
36   }
37   TCanvas* c = new TCanvas("Geometry", "Geometry");
38   c->SetFillColor(1);
39   gGeoManager->GetTopVolume()->Draw();
40 }
41 //____________________________________________________________________
42 //
43 // EOF
44 //