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