]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Bug fix (V11Hybrid geometry)
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 May 2007 20:40:41 +0000 (20:40 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 May 2007 20:40:41 +0000 (20:40 +0000)
ITS/AliITSInitGeometry.cxx
ITS/AliITSv11Hybrid.cxx

index f536fa847b183f0f1ba72100b58d3b764758d866..1ccedf7d13cd5bf57a0da45113237ee93205013f 100644 (file)
@@ -2136,34 +2136,36 @@ void AliITSInitGeometry::DecodeDetectorv11Hybrid(Int_t &mod,Int_t layer,Int_t cp
     //                   of copy numbers.
     // Return:
     //    none.
-    const Int_t kDetPerLadderSPD[2]={2,4};
-    const Int_t kDetPerLadder[6]={4,4,6,8,22,25};
-    const Int_t kLadPerLayer[6]={20,40,14,22,34,38};
-    Int_t lay=-1,lad=-1,det=-1,i;
-
-    switch(layer){
-    case 1: case 2:{
-        lay = layer;
-        lad = cpn1+kDetPerLadderSPD[layer-1]*(cpn0-1);
-        det = cpn2;
-        }break;
-    case 3: case 4:{
-        lay = layer;
-        lad = cpn0;
-        det = cpn1;
-        }break;
-    case 5: case 6:{
-        lay = layer;
-        lad = cpn0;
-        det = cpn1;
-        }break;
-    default:{
-        }break;
-    } // end switch
-    mod = 0;
-    for(i=0;i<layer-1;i++) mod += kLadPerLayer[i]*kDetPerLadder[i];
-    mod += kDetPerLadder[layer-1]*(lad-1)+det-1;// module start at zero.
-    return;
+  const Int_t kDetPerLadderSPD[2]={2,4};
+  const Int_t kDetPerLadder[6]={4,4,6,8,22,25};
+  const Int_t kLadPerLayer[6]={20,40,14,22,34,38};
+  Int_t lad=-1,det=-1,i;
+  
+  switch(layer) {
+  case 1: case 2:{
+    lad = cpn1+kDetPerLadderSPD[layer-1]*(cpn0-1);
+    det = cpn2;
+  } break;
+  case 3: case 4:{
+    if (SDDIsTGeoNative()) {
+      lad = cpn0+1;
+      det = cpn1+1;
+    } else {
+      lad = cpn0;
+      det = cpn1;
+    }
+  } break;
+  case 5: case 6:{
+    lad = cpn0;
+    det = cpn1;
+  } break;
+  default:{
+  } break;
+  } // end switch
+  mod = 0;
+  for(i=0;i<layer-1;i++) mod += kLadPerLayer[i]*kDetPerLadder[i];
+  mod += kDetPerLadder[layer-1]*(lad-1)+det-1;// module start at zero.
+  return;
 }
 //______________________________________________________________________
 void AliITSInitGeometry::RecodeDetectorv11Hybrid(Int_t mod,Int_t &cpn0,
index 4fcb2d3568a24d9f649e323be91fe2dcc79594c3..4f7b3a575dd8973cc6084061da199ee6135a738c 100644 (file)
@@ -16,6 +16,9 @@
 // $Id$
 
 // $Log$
+// Revision 1.3  2007/05/08 16:57:42  masera
+// Updates concerning the geometry: versioning system, new V11hybrid version, bug fixes (B.Nilsend and L. Gaudichet
+//
 
 //========================================================================
 //
@@ -222,7 +225,6 @@ void AliITSv11Hybrid::SetT2Lmatrix(const char *name, Double_t dAlpha,
   delete matLtoT;
   alignableEntry->SetMatrix(matTtoL);
 }
-
 //______________________________________________________________________
 void AliITSv11Hybrid::AddAlignableVolumes() const
 {
@@ -5351,129 +5353,6 @@ void AliITSv11Hybrid::DrawModule() const{
     gMC->Gdhead(1111, "Inner Tracking System Version 1");
     gMC->Gdman(17, 6, "MAN");
 }
-
-// //______________________________________________________________________
-// void AliITSv11Hybrid::StepManager(){
-//     //    Called for every step in the ITS, then calles the AliITShit class
-//     // creator with the information to be recoreded about that hit.
-//     //     The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
-//     // printing of information to a file which can be used to create a .det
-//     // file read in by the routine CreateGeometry(). If set to 0 or any other
-//     // value except 1, the default behavior, then no such file is created nor
-//     // it the extra variables and the like used in the printing allocated.
-//     // Inputs:
-//     //   none.
-//     // Outputs:
-//     //   none.
-//     // Return:
-//     //   none.
-
-//     static TLorentzVector position0;
-//     static Int_t stat0=0;
-
-//     if(!(this->IsActive())) {
-//     return;
-//     } // end if !Active volume.
-
-//     if(!(gMC->TrackCharge())) return;
-
-//     Int_t kk = 0, copy;
-//     Int_t id = gMC->CurrentVolID(copy);
-//     while ((id != fIdSens[kk]) && (kk<6)) ++kk;
-
-//     if((kk<6) && (gMC->IsTrackExiting())) {
-//     copy = fTrackReferences->GetEntriesFast();
-//     TClonesArray &lTR = *fTrackReferences;
-//     // Fill TrackReference structure with this new TrackReference.
-//     new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
-//     } // if Outer ITS mother Volume
-
-//     Int_t   copy1, copy2;  
-//     Int_t   vol[5];
-//     TClonesArray &lhits = *fHits;
-
-//     // Track status
-//     vol[3] = 0;
-//     vol[4] = 0;
-//     if(gMC->IsTrackInside())      vol[3] +=  1;
-//     if(gMC->IsTrackEntering())    vol[3] +=  2;
-//     if(gMC->IsTrackExiting())     vol[3] +=  4;
-//     if(gMC->IsTrackOut())         vol[3] +=  8;
-//     if(gMC->IsTrackDisappeared()) vol[3] += 16;
-//     if(gMC->IsTrackStop())        vol[3] += 32;
-//     if(gMC->IsTrackAlive())       vol[3] += 64;
-
-//     // Fill hit structure.
-//     vol[0] = kk+1;
-//     Int_t sddModPos = 1, sddLaddPos = 2, sddIndShift = 0;
-//     if (AliITSInitGeometry::SDDIsTGeoNative()) {
-//       sddModPos     = 2;
-//       sddLaddPos    = 3;
-//       sddIndShift   = 1;
-//     };
-
-//     switch (kk) {
-
-//     case 0: { // SPD
-
-//       gMC->CurrentVolOffID(2,copy);  // det 1<->4
-//       vol[1] = copy;
-//       gMC->CurrentVolOffID(3,copy1); // lad 1<->2
-//       gMC->CurrentVolOffID(4,copy2); // mod 1<->10
-//       vol[2] = copy1+(copy2-1)*2; //# of ladders in one module  = 2
-//     } break;
-
-//     case 1: {
-
-//       gMC->CurrentVolOffID(2,copy);  // 1<->4
-//       vol[1] = copy;
-//       gMC->CurrentVolOffID(3,copy1); // 1<->4
-//       gMC->CurrentVolOffID(4,copy2); // 1<->10
-//       vol[2] = copy1+(copy2-1)*4; //# of ladders in one module  = 4
-//     } break;
-
-//     case 2: // SDD
-//     case 3: {
-
-//       gMC->CurrentVolOffID(sddModPos, copy); // 1<->6  and 1<->8
-//       vol[1] = copy + sddIndShift;
-//       gMC->CurrentVolOffID(sddLaddPos, copy);// 1<->14 and 1<->22
-//       vol[2] = copy + sddIndShift;
-//     } break;
-
-//     case 5: // SSD
-//     case 4: {
-
-//       gMC->CurrentVolOffID(1,copy); // 1<->22 and 1<->25
-//       vol[1] = copy;
-//       gMC->CurrentVolOffID(2,copy); // 1<->34 and 1<->38
-//       vol[2] = copy;
-//     } break;
-
-//     default: return; // not an ITS volume?
-//     }
-
-//     TLorentzVector position, momentum;
-//     gMC->TrackPosition(position);
-//     gMC->TrackMomentum(momentum);
-//     vol[4] = stat0;
-//     if(gMC->IsTrackEntering()) {
-//     position0 = position;
-//     stat0 = vol[3];
-//     return;
-//     } // end if IsEntering
-//     // Fill hit structure with this new hit.
-    
-//     new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
-//                                gMC->Edep(),gMC->TrackTime(),position,
-//                                position0,momentum);
-
-//     position0 = position;
-//     stat0 = vol[3];
-
-//     return;
-// }
-
 //______________________________________________________________________
 void AliITSv11Hybrid::StepManager(){
     //    Called for every step in the ITS, then calles the AliITShit class
@@ -5490,27 +5369,33 @@ void AliITSv11Hybrid::StepManager(){
     // Return:
     //   none.
 
-    static TLorentzVector position, momentum; // Saves on calls to constructors
-    static AliITShit hit;// Saves on calls to constructors
-
     if(!(this->IsActive())) return;
     if(!(gMC->TrackCharge())) return;
 
-    Int_t lay = 0, copy;
-    Int_t id = gMC->CurrentVolID(copy);
-    while ((id != fIdSens[lay]) && (lay<6)) ++lay;
-
-    if((lay<6) && (gMC->IsTrackExiting())) {
-       copy = fTrackReferences->GetEntriesFast();
-       TClonesArray &lTR = *fTrackReferences;
-       // Fill TrackReference structure with this new TrackReference.
-       new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
+    Int_t  copy, id, lay;
+    Bool_t sensvol = kFALSE;
+    id = gMC->CurrentVolID(copy);
+    for(lay=0; lay<fIdN; lay++) if (id == fIdSens[lay]) {
+        sensvol=kTRUE;
+        break;
+    } // end for if
+
+    if(sensvol && (gMC->IsTrackExiting())) {
+      copy = fTrackReferences->GetEntriesFast();
+      TClonesArray &lTR = *fTrackReferences;
+      // Fill TrackReference structure with this new TrackReference.
+      new(lTR[copy]) AliTrackReference(
+                    gAlice->GetMCApp()->GetCurrentTrackNumber());
     } // if Outer ITS mother Volume
 
+    static TLorentzVector position, momentum; // Saves on calls to construtors
+    static AliITShit hit;// Saves on calls to constructors
+    Int_t   cpn0, cpn1, cpn2, status, mod;
+    //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
     TClonesArray &lhits = *(Hits());
-
+    //
     // Track status
-    Int_t status;
+    status = 0;
     if(gMC->IsTrackInside())      status +=  1;
     if(gMC->IsTrackEntering())    status +=  2;
     if(gMC->IsTrackExiting())     status +=  4;
@@ -5518,77 +5403,37 @@ void AliITSv11Hybrid::StepManager(){
     if(gMC->IsTrackDisappeared()) status += 16;
     if(gMC->IsTrackStop())        status += 32;
     if(gMC->IsTrackAlive())       status += 64;
-
-    // Fill hit structure.
-    Int_t sddModPos = 1, sddLaddPos = 2, sddIndShift = 0;
-    if (AliITSInitGeometry::SDDIsTGeoNative()) {
-      sddModPos     = 2;
-      sddLaddPos    = 3;
-      sddIndShift   = 1;
-    };
-
-    Int_t copy1, copy2, lad, det, mod;  
+    //
     switch (lay) {
+    case 0:case 1: // SPD
+      gMC->CurrentVolOffID(2,cpn2);
+      gMC->CurrentVolOffID(3,cpn1);
+      gMC->CurrentVolOffID(4,cpn0);
+      break;
+    case 2:case 3: // SDD
+      cpn2 = 1;
+      if (AliITSInitGeometry::SDDIsTGeoNative()) {
+       gMC->CurrentVolOffID(2,cpn1);
+       gMC->CurrentVolOffID(3,cpn0);
+      } else {
+       gMC->CurrentVolOffID(1,cpn1);
+       gMC->CurrentVolOffID(2,cpn0);
+      };
+      break;
+    case 4:case 5: // SSD
+      cpn2 = 1;
+      gMC->CurrentVolOffID(1,cpn1);
+      gMC->CurrentVolOffID(2,cpn0);
+      break;
+    default:
+      Error("StepManager","Unknown volume lay=%d",lay+1);
+      return; // not an ITS sensitive volume.
+    } //
+    fInitGeom.DecodeDetector(mod,lay+1,cpn0,cpn1,cpn2);
 
-    case 0: { // SPD
-
-      gMC->CurrentVolOffID(2,copy);  // det 1<->4
-      det = copy;
-      gMC->CurrentVolOffID(3,copy1); // lad 1<->2
-      gMC->CurrentVolOffID(4,copy2); // mod 1<->10
-      lad = copy1+(copy2-1)*2; //# of ladders in one module  = 2
-      mod = (lad-1)*4 + det - 1;
-    } break;
-
-    case 1: {
-
-      gMC->CurrentVolOffID(2,copy);  // 1<->4
-      det = copy;
-      gMC->CurrentVolOffID(3,copy1); // 1<->4
-      gMC->CurrentVolOffID(4,copy2); // 1<->10
-      lad = copy1+(copy2-1)*4; //# of ladders in one module  = 4
-      mod = 80 + (lad-1)*4 + det - 1;
-    } break;
-
-    case 2: { // SDD
-      
-      gMC->CurrentVolOffID(sddModPos, copy); // 1<->6  and 1<->8
-      det = copy + sddIndShift;
-      gMC->CurrentVolOffID(sddLaddPos, copy);// 1<->14 and 1<->22
-      lad = copy + sddIndShift;
-      mod = 240 + (lad-1)*6 + det - 1;
-    } break;
-
-    case 3: {
-
-      gMC->CurrentVolOffID(sddModPos, copy); // 1<->6  and 1<->8
-      det = copy + sddIndShift;
-      gMC->CurrentVolOffID(sddLaddPos, copy);// 1<->14 and 1<->22
-      lad = copy + sddIndShift;
-      mod = 324 + (lad-1)*8 + det - 1;
-    } break;
-
-    case 4: { // SSD
-
-      gMC->CurrentVolOffID(1,copy); // 1<->22 and 1<->25
-      det = copy;
-      gMC->CurrentVolOffID(2,copy); // 1<->34 and 1<->38
-      lad = copy;
-      mod = 500 + (lad-1)*22 + det - 1;
-    } break;
-
-    case 5: {
-
-      gMC->CurrentVolOffID(1,copy); // 1<->22 and 1<->25
-      det = copy;
-      gMC->CurrentVolOffID(2,copy); // 1<->34 and 1<->38
-      lad = copy;
-      mod = 1248 + (lad-1)*25 + det - 1;
-    } break;
-
-    default: return; // not an ITS volume?
-    }
-
+    //
+    // Fill hit structure.
+    //
     hit.SetModule(mod);
     hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
     gMC->TrackPosition(position);