]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFv5T0.cxx
New Run Range
[u/mrichter/AliRoot.git] / TOF / AliTOFv5T0.cxx
index 087042c8d07e153930d2a3819d5f4768817ddabe..45d5a7b4d73e7236185b715261978aa46d046ca1 100644 (file)
 
 /*
 $Log$
+Revision 1.22  2007/10/07 19:40:46  decaro
+right handling of l2t matrices and alignable entries in case of TOF staging geometry
+
+Revision 1.21  2007/10/04 13:15:30  arcelli
+updates to comply with AliTOFGeometryV5 becoming AliTOFGeometry
+
+Revision 1.20  2007/10/03 18:07:22  arcelli
+right handling of l2t matrices and alignable entries in case of TOF holes (Annalisa)
+
+Revision 1.19  2007/10/03 10:41:12  arcelli
+adding tracking-to-local matrices for new AliTOFcluster
+
+Revision 1.18  2007/07/27 08:14:48  morsch
+Write all track references into the same branch.
+
+Revision 1.17  2007/05/14 14:41:13  decaro
+Fix a bug in FTOA volume positionig inside BTOF13,14,15,16,17 in case of holes in 11th and 12th sectors
+
+Revision 1.16  2007/05/04 12:59:26  arcelli
+Change the TOF SM paths for misalignment (one layer up)
+
+Revision 1.15  2007/02/19 15:41:55  decaro
+Coding convention: few corrections
+
+Revision 1.14  2006/10/17 15:33:14  arcelli
+Moving some printout from Info to Debug level
+
+Revision 1.13  2006/10/12 16:35:43  arcelli
+definition of the alignable volumes symbolic names added
+
+Revision 1.12  2006/08/22 13:34:46  arcelli
+removal of effective c++ warnings (C.Zampolli)
+
+Revision 1.11  2006/07/12 16:03:44  arcelli
+updates to match the new numbering of the TOF/TRD mother volumes in FRAME (ALICE convention)
+
+Revision 1.10  2006/05/10 18:40:17  hristov
+Larger strings for the names
+
 Revision 1.9  2006/05/04 19:41:42  hristov
 Possibility for partial TOF geometry (S.Arcelli)
 
@@ -78,26 +117,38 @@ Revision 0.1 2004 November G. Cara Romeo and A. De Caro
 #include "TLorentzVector.h"
 #include "TNode.h"
 #include "TVirtualMC.h"
+#include "TGeoManager.h"
+#include <TGeoMatrix.h>
+#include <TGeoPhysicalNode.h>
+#include <TGeoVolume.h>
 
 #include "AliConst.h"
 #include "AliLog.h"
 #include "AliMagF.h"
 #include "AliMC.h"
 #include "AliRun.h"
+#include "AliTrackReference.h"
 
 #include "AliTOFGeometry.h"
-#include "AliTOFGeometryV5.h"
 #include "AliTOFv5T0.h"
 
 extern TDirectory *gDirectory;
 extern TVirtualMC *gMC;
+extern TGeoManager *gGeoManager;
 
 extern AliRun *gAlice;
 
 ClassImp(AliTOFv5T0)
 
 //_____________________________________________________________________________
-AliTOFv5T0::AliTOFv5T0()
+  AliTOFv5T0::AliTOFv5T0():
+  fIdFTOA(-1),
+  fIdFTOB(-1),
+  fIdFTOC(-1),
+  fIdFLTA(-1),
+  fIdFLTB(-1),
+  fIdFLTC(-1),
+  fTOFHoles(kFALSE)
 {
   //
   // Default constructor
@@ -105,8 +156,15 @@ AliTOFv5T0::AliTOFv5T0()
 }
  
 //_____________________________________________________________________________
-AliTOFv5T0::AliTOFv5T0(const char *name, const char *title)
-        : AliTOF(name,title,"tzero")
+AliTOFv5T0::AliTOFv5T0(const char *name, const char *title):
+  AliTOF(name,title,"tzero"),
+  fIdFTOA(-1),
+  fIdFTOB(-1),
+  fIdFTOC(-1),
+  fIdFLTA(-1),
+  fIdFLTB(-1),
+  fIdFLTC(-1),
+  fTOFHoles(kFALSE)
 {
   //
   // Standard constructor
@@ -122,15 +180,15 @@ AliTOFv5T0::AliTOFv5T0(const char *name, const char *title)
   } else{
     
     if (fTOFGeometry) delete fTOFGeometry;
-    fTOFGeometry = new AliTOFGeometryV5();
+    fTOFGeometry = new AliTOFGeometry();
 
     if(frame->IsVersion()==1) {
-      AliInfo(Form("Frame version %d", frame->IsVersion())); 
-      AliInfo("Full Coverage for TOF");
+      AliDebug(1,Form("Frame version %d", frame->IsVersion())); 
+      AliDebug(1,"Full Coverage for TOF");
       fTOFHoles=false;}    
     else {
-      AliInfo(Form("Frame version %d", frame->IsVersion())); 
-      AliInfo("TOF with Holes for PHOS");
+      AliDebug(1,Form("Frame version %d", frame->IsVersion())); 
+      AliDebug(1,"TOF with Holes for PHOS");
       fTOFHoles=true;}      
   }
   fTOFGeometry->SetHoles(fTOFHoles);
@@ -145,6 +203,134 @@ AliTOFv5T0::AliTOFv5T0(const char *name, const char *title)
 
 } 
 
+//_____________________________________________________________________________
+void AliTOFv5T0::AddAlignableVolumes() const
+{
+  //
+  // Create entries for alignable volumes associating the symbolic volume
+  // name with the corresponding volume path. Needs to be syncronized with
+  // eventual changes in the geometry.
+  //
+
+  TString volPath;
+  TString symName;
+
+  TString vpL0  = "ALIC_1/B077_1/BSEGMO";
+  TString vpL1 = "_1/BTOF";
+  TString vpL2 = "_1";
+  TString vpL3 = "/FTOA_0";
+  TString vpL4 = "/FLTA_0/FSTR_";
+
+  TString snSM  = "TOF/sm";
+  TString snSTRIP = "/strip";
+
+  Int_t nSectors=fTOFGeometry->NSectors();
+  Int_t nStrips =fTOFGeometry->NStripA()+
+                 2*fTOFGeometry->NStripB()+
+                 2*fTOFGeometry->NStripC();
+
+  //
+  // The TOF MRPC Strips
+  // The symbolic names are: TOF/sm00/strip01
+  //                           ...
+  //                         TOF/sm17/strip91
+  Int_t imod=0;
+
+  for (Int_t isect = 0; isect < nSectors; isect++) {
+    for (Int_t istr = 1; istr <= nStrips; istr++) {
+
+      //if (fTOFSectors[isect]==-1) continue;
+
+      if (fTOFHoles && (isect==13 || isect==14 || isect==15)) {
+       if (istr<39) {
+         vpL3 = "/FTOB_0";
+         vpL4 = "/FLTB_0/FSTR_";
+       }
+       else if (istr>53) {
+         vpL3 = "/FTOC_0";
+         vpL4 = "/FLTC_0/FSTR_";
+       }
+       else continue;
+      }
+      else {
+       vpL3 = "/FTOA_0";
+       vpL4 = "/FLTA_0/FSTR_";
+      }
+
+      volPath  = vpL0;
+      volPath += isect;
+      volPath += vpL1;
+      volPath += isect;
+      volPath += vpL2;
+      volPath += vpL3;
+      volPath += vpL4;
+      volPath += istr;
+
+      
+      symName  = snSM;
+      symName += Form("%02d",isect);
+      symName += snSTRIP;
+      symName += Form("%02d",istr);
+            
+      AliDebug(2,"--------------------------------------------"); 
+      AliDebug(2,Form("Alignable object %d", imod)); 
+      AliDebug(2,Form("volPath=%s\n",volPath.Data()));
+      AliDebug(2,Form("symName=%s\n",symName.Data()));
+      AliDebug(2,"--------------------------------------------"); 
+             
+      gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data());
+
+      //T2L matrices for alignment
+      TGeoPNEntry *e = gGeoManager->GetAlignableEntry(symName.Data());
+      if (e) {
+       const char *path = e->GetTitle();
+       if (!gGeoManager->cd(path)) {
+         AliFatal(Form("Volume path %s not valid!",path));
+       }
+       TGeoHMatrix *globMatrix = gGeoManager->GetCurrentMatrix();
+       Double_t phi = 20.0 * (isect % 18) + 10.0;
+       TGeoHMatrix *t2l  = new TGeoHMatrix();
+       t2l->RotateZ(phi);
+       t2l->MultiplyLeft(&(globMatrix->Inverse()));
+       e->SetMatrix(t2l);
+      }
+      else {
+       AliError(Form("Alignable entry %s is not valid!",symName.Data()));
+      }
+      imod++;
+    }
+  }
+
+
+  //
+  // The TOF supermodules
+  // The symbolic names are: TOF/sm00
+  //                           ...
+  //                         TOF/sm17
+  //
+  for (Int_t isect = 0; isect < nSectors; isect++) {
+
+    volPath  = vpL0;
+    volPath += isect;
+    volPath += vpL1;
+    volPath += isect;
+    volPath += vpL2;
+
+    symName  = snSM;
+    symName += Form("%02d",isect);
+
+      AliDebug(2,"--------------------------------------------"); 
+      AliDebug(2,Form("Alignable object %d", isect+imod)); 
+      AliDebug(2,Form("volPath=%s\n",volPath.Data()));
+      AliDebug(2,Form("symName=%s\n",symName.Data()));
+      AliDebug(2,"--------------------------------------------"); 
+             
+    gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data());
+
+  }
+  
+}
 //____________________________________________________________________________
 void AliTOFv5T0::BuildGeometry()
 {
@@ -310,14 +496,21 @@ void AliTOFv5T0::TOFpc(Float_t xtof,  Float_t ytof, Float_t zlenA,
     if(fTOFSectors[isec]==-1)continue;
     char name[16];
     sprintf(name, "BTOF%d",isec);
-    if (fTOFHoles && (isec==16||isec==17)) {
+    if (fTOFHoles && (isec==13 || isec==14 || isec==15)) {
+    //    if (fTOFHoles && (isec==16||isec==17)) { \\Old 6h convention
       xcoor = 0.;
       ycoor = (zlenA*0.5 + kInterCentrModBorder1)*0.5;
       zcoor = 0.;
       gMC->Gspos("FTOB", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
       gMC->Gspos("FTOC", 0, name, xcoor,-ycoor, zcoor, idrotm[0], "ONLY");
     }
-    else gMC->Gspos("FTOA", 0,name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
+    else {
+      xcoor = 0.;
+      ycoor = 0.;
+      zcoor = 0.;
+      gMC->Gspos("FTOA", 0,name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
+    }
+
   }
   // Large not sensitive volumes with Insensitive Freon (FLTA, FLTB and FLTC)
   
@@ -1396,7 +1589,7 @@ void AliTOFv5T0::StepManager()
 
     AliMC *mcApplication = (AliMC*)gAlice->GetMCApp();
 
-    AddTrackReference(mcApplication->GetCurrentTrackNumber());
+    AddTrackReference(mcApplication->GetCurrentTrackNumber(), AliTrackReference::kTOF);
     //AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
 
     // getting information about hit volumes
@@ -1466,13 +1659,15 @@ void AliTOFv5T0::StepManager()
     volpath=gMC->CurrentVolOffName(7);
     index=atoi(&volpath[4]);
     sector=-1;
-  
-    if(index<5){
-      sector=index+13;
-       }
-    else{
-      sector=index-5;
-    } 
+    sector=index;
+
+    //Old 6h convention
+    // if(index<5){
+    //   sector=index+13;
+    // }
+    // else{
+    //   sector=index-5;
+    // } 
  
     for(i=0;i<3;++i) {
       hits[i]   = pos[i];