]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDDetector.cxx
Corrected treatment of signals with multiple banches
[u/mrichter/AliRoot.git] / FMD / AliFMDDetector.cxx
index e7438280d4bea33786050025c06cb032c848ecbd..020b077c4bc79c55e5322b39edcec830bc12267e 100644 (file)
@@ -158,7 +158,7 @@ AliFMDDetector::HasAllTransforms(Char_t ring) const
    (name[3] == 'T' || name[3] == 'B'))
 #define IS_NODE_SENSOR(name)                           \
   (name[0] == 'F' && (name[2] == 'B' || name[2] == 'F') && name[3] == 'H')
-//#define IS_NODE_SENSOR(name)                         \
+//#define IS_NODE_SENSOR(name)                         
 //  (name[0] == 'F' && name[2] == 'S' && name[3] == 'E')
 #define IS_NODE_HALF(name) \
   (name[0] == 'F' && name[2] == 'M' && (name[3] == 'B' || name[3] == 'T'))
@@ -188,6 +188,27 @@ AliFMDDetector::InitTransformations()
   if (fOuter && !fOuterTransforms) 
     fOuterTransforms = new TObjArray(fOuter->GetNModules());
   
+  // Loop over bottom/top 
+  for (size_t ihalf = 0; ihalf < 2; ihalf++) {
+    char  half = (ihalf == 0 ? 'T' : 'B');
+    TString path(Form(HALF_FORMAT, fId, half));
+    TGeoPNEntry* entry = gGeoManager->GetAlignableEntry(path.Data());
+    if (!entry) {
+      AliError(Form("Alignable entry for half-detector \"%s\" not found!", 
+                   path.Data()));
+      continue;
+    }
+    TGeoPhysicalNode* pn = entry->GetPhysicalNode();
+    if (!pn) {
+      AliWarning(Form("Making physical volume for \"%s\"", path.Data()));
+      pn = gGeoManager->MakeAlignablePN(entry);
+      if (!pn) {
+       AliError(Form("No physical node for \"%s\"", path.Data()));
+       continue;
+      }
+    }
+  }
+  
   // Loop over rings 
   for (size_t iring = 0; iring < 2; iring++) {
     char ring = (iring == 0 ? 'I' : 'O');
@@ -235,7 +256,7 @@ AliFMDDetector::InitTransformations()
        // Get transformation matrix for this node, and store it. 
        TGeoMatrix*  t = new TGeoHMatrix(*pm);
        trans->AddAt(t, base+imod);
-       AliFMDDebug(1, ("Found matrix for path \"%s\": %p",path.Data(),pm));
+       AliFMDDebug(5, ("Found matrix for path \"%s\": %p",path.Data(),pm));
       }
     }
   }
@@ -521,21 +542,29 @@ AliFMDDetector::Detector2XYZ(Char_t   ring,
   // Translate detector coordinates (this,ring,sector,strip) into
   // (x,y,z) coordinates (in global reference frame)
   AliFMDRing* r = GetRing(ring);
-  if (!r) return;
+  if (!r) { 
+    AliWarning(Form("No such ring FMD%d%c ", fId, ring));
+    return;
+  }
   TGeoMatrix* m = FindTransform(ring, sector);
-  if (!m) return;
+  if (!m) { 
+    AliWarning(Form("No transfrmation found for FMD%d%c[%02d]", 
+                   fId, ring, sector));
+    return;
+  }
   Double_t rho      = r->GetStripRadius(strip);
   Double_t phi      = ((sector % 2) - .5) * r->GetTheta();
   Double_t siThick  = r->GetSiThickness();
+#if 0 
   Double_t modThick = (siThick
                       + r->GetPrintboardThickness()
                       + r->GetCopperThickness()
                       + r->GetChipThickness()
                       + r->GetSpacing());
+#endif
   AliFMDDebug(30, ("Rho %7.3f, angle %7.3f", rho, phi));
-# define DEGRAD TMath::Pi() / 180. 
-  Double_t local[]  = { rho * TMath::Cos(phi * DEGRAD), 
-                       rho * TMath::Sin(phi * DEGRAD), 
+  Double_t local[]  = { rho * TMath::Cos(phi * TMath::DegToRad()), 
+                       rho * TMath::Sin(phi * TMath::DegToRad()), 
                        /* -modThick + */ siThick / 2 };
   Double_t master[3];
   AliFMDDebug(30, ("Local (%7.3f,%7.3f,%7.3f)",local[0], local[1], local[2]));