]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Use Alignable volume names
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Dec 2006 13:24:18 +0000 (13:24 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Dec 2006 13:24:18 +0000 (13:24 +0000)
FMD/AliFMDAlignFaker.cxx
FMD/scripts/MakeAlignment.C

index d566c060db5398b281990d4ca906da4502b2bdf2..3f63b9b7036d97cc9994a5d5e9255abb4765246d 100644 (file)
@@ -82,6 +82,12 @@ AliFMDAlignFaker::AliFMDAlignFaker(Int_t mask, const char* geo,
     fComment("")
 {
   // Default constructor 
+  if (!loc) { 
+    AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage();
+    if (!storage) AliFatal("Default Storage not set");
+    const TString& uri = storage->GetURI();
+    fTitle = uri;
+  }
   SetSensorDisplacement();
   SetSensorRotation();
   SetHalfDisplacement();
@@ -160,15 +166,47 @@ AliFMDAlignFaker::Exec(Option_t*)
   
   // Make an iterator
   TGeoIterator next(topVolume);
+  next.SetTopName(Form("/%s_1", topVolume->GetName()));
   TGeoNode* node = 0;
-
+  
+  Char_t currentDet  = '\0';
+  Char_t currentHalf = '\0';
   // Loop over all entries in geometry to find our nodes. 
   while ((node = static_cast<TGeoNode*>(next()))) {
     const char* name =  node->GetName();
     if (!(IS_NODE_HALF(name) && TESTBIT(fMask, kHalves)) &&
        !(IS_NODE_SENSOR(name) && TESTBIT(fMask, kSensors))) 
       continue;
-    
+
+    TString path, alignName;
+    next.GetPath(path);
+    Int_t id = node->GetVolume()->GetNumber();
+    if (IS_NODE_HALF(name))   { 
+      currentDet    = name[1];
+      currentHalf   = name[3];
+      alignName     = Form("FMD/FMD%c_%c", currentDet, currentHalf);
+    }
+    if (IS_NODE_SENSOR(name)) {
+      Char_t ring  = name[1];
+      Int_t  copy  = node->GetNumber();
+      alignName    = Form("FMD/FMD%c_%c/FMD%c_%02d", 
+                         currentDet, currentHalf, ring, copy);
+    }
+    if (alignName.IsNull()) continue;
+    if (!gGeoManager->GetAlignableEntry(alignName.Data())) {
+      AliWarning(Form("No alignable entry for %s, using path %s",
+                     alignName.Data(), path.Data()));
+      alignName = path;
+    }
+    AliDebug(1, Form("Making alignment for %s -> %s (%d)", 
+                    alignName.Data(), path.Data(), id));
+    if (IS_NODE_HALF(name))   MakeAlignHalf(alignName, id);
+    if (IS_NODE_SENSOR(name)) MakeAlignSensor(alignName, id);
+#if 0    
+    if (!(IS_NODE_HALF(name) && TESTBIT(fMask, kHalves)) &&
+       !(IS_NODE_SENSOR(name) && TESTBIT(fMask, kSensors))) 
+      continue;
+
     // Get the path 
     TString path(Form("/%s", gGeoManager->GetNode(0)->GetName()));
     Int_t nLevel = next.GetLevel();
@@ -185,6 +223,7 @@ AliFMDAlignFaker::Exec(Option_t*)
     Int_t id = node->GetVolume()->GetNumber();
     if (IS_NODE_HALF(name))   MakeAlignHalf(path, id);
     if (IS_NODE_SENSOR(name)) MakeAlignSensor(path, id);
+#endif 
   }
 
   TString t(GetTitle());
@@ -210,12 +249,13 @@ AliFMDAlignFaker::MakeAlign(const TString& path, Int_t id,
   //   rotX      Rotation about X-axis 
   //   rotY      Rotation about Y-axis
   //   rotZ      Rotation about Z-axis 
-  AliDebug(1, Form("Make alignment for %s (volume %d): (%f,%f,%f) (%f,%f,%f)", 
+  AliDebug(3, Form("Make alignment for %s (volume %d): (%f,%f,%f) (%f,%f,%f)", 
                   path.Data(), id, transX, transY, transZ, rotX, rotY, rotZ));
   Int_t nAlign = fArray->GetEntries();
   id = 0;
   AliAlignObjAngles* obj = 
-    new ((*fArray)[nAlign]) AliAlignObjAngles(path.Data(), id,0,0,0,0,0,0,kTRUE);
+    new ((*fArray)[nAlign]) AliAlignObjAngles(path.Data(),
+                                             id,0,0,0,0,0,0,kTRUE);
   if (!obj) {
     AliError(Form("Failed to create alignment object for %s", path.Data()));
     return kFALSE;
@@ -263,8 +303,9 @@ void
 AliFMDAlignFaker::WriteToCDB()
 {
   // Make the objects. 
+  const char* loc = GetTitle();
   AliCDBManager*     cdb  = AliCDBManager::Instance();
-  AliCDBStorage*  storage = cdb->GetStorage(GetTitle());
+  AliCDBStorage*  storage = cdb->GetStorage(!loc ? "" : loc);
   AliCDBMetaData*    meta = new AliCDBMetaData; 
   meta->SetResponsible(gSystem->GetUserInfo()->fRealName.Data()); 
   meta->SetAliRootVersion(gROOT->GetVersion()); 
index ce90aaabf803983935827c2ff2c44bd9655a88df..3e6d92230f39ba2ed1f7886541495d62dbff49e0 100644 (file)
@@ -13,8 +13,8 @@ MakeAlignment()
   if (!TGeoManager::Import("geometry.root")) 
     gAlice->Init("$ALICE_ROOT/FMD/Config.C");
   AliCDBManager* cdb   = AliCDBManager::Instance();
-  cdb->SetDefaultStorage("local://$ALICE_ROOT");
-  
+  cdb->SetDefaultStorage("$ALICE_ROOT");
+  AliLog::SetModuleDebugLevel("FMD", 1);
   gSystem->Load("libFMDutil.so");
   AliFMDAlignFaker f(AliFMDAlignFaker::kAll, "geometry.root", 0);
   // f.RemoveAlign(AliFMDAlignFaker::kHalves);