Use VMC id's rather than TGeo id's
[u/mrichter/AliRoot.git] / FMD / scripts / ApplyAlignment.C
CommitLineData
1e8f773e 1//____________________________________________________________________
2//
3// $Id$
4//
5// Read in the geometry, and get alignment data from CDB, and apply
6// that to the geometry.
7//
9b48326f 8/** Apply alignment to a geometry
9 @ingroup simple_script
10 */
1e8f773e 11void
12ApplyAlignment()
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 AliAlignObjAngles* a = static_cast<AliAlignObjAngles*>(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//