]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/ApplyAlignment.C
Moving required CMake version from 2.8.4 to 2.8.8
[u/mrichter/AliRoot.git] / ITS / UPGRADE / ApplyAlignment.C
1 void ApplyAlignment(const char* fileMA)
2 {
3   // apply ITSU alignment from the file
4   //
5   if (!gGeoManager) {
6     if (!gSystem->AccessPathName("geometry.root")) {
7       printf("Loading geometry.root from current directory\n");
8       AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage      
9     }
10     else {
11       printf("No geometry in memory and not geometry.root in current directory\n");
12       return;
13     }
14   }
15   else {
16     if (gGeoManager->IsLocked()) {
17       printf("There is geometry in memory but it is locked");
18       return;
19     }
20   }
21   //
22   TFile* fl = TFile::Open(fileMA);
23   if (!fl) {
24     printf("Failed to open misalignments file %s\n",fileMA);
25   }
26   TClonesArray* arr = (TClonesArray*)fl->Get("ITSUAlignObjs");
27   if (!arr) {
28     AliCDBEntry* cdbe = (AliCDBEntry*) fl->Get("AliCDBEntry");
29     if (!cdbe) {
30       printf("File %s does not contain recognizable misalignment\n",fileMA);
31       return;
32     }
33     arr = (TClonesArray*)cdbe->GetObject();
34   }
35   //
36   if (!arr->IsA()==TClonesArray::Class()) {
37     printf("The object in %s is not TClonesArray\n",fileMA);
38     return;
39   }
40   printf("Applying misalignment from %s geometry in memory\n",fileMA);
41   AliGeomManager::ApplyAlignObjsToGeom(*arr);
42   gGeoManager->LockGeometry();
43   //
44 }