]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDv1.cxx
Migrated to a geometry implemented via AliFMDGeometry (derives from
[u/mrichter/AliRoot.git] / FMD / AliFMDv1.cxx
index 9a91fd4c1bda2bc389f6196b7d493746369ebba6..34a320aca7bd7cc4d8de47e42c715172b71a7efd 100644 (file)
 //                                                                          
 // Forward Multiplicity Detector based on Silicon wafers. This class
 // contains the base procedures for the Forward Multiplicity detector
-// Detector consists of 5 Si volumes covered pseudorapidity interval
-// from 1.7 to 5.1.
-//
+// Detector consists of 3 sub-detectors FMD1, FMD2, and FMD3, each of
+// which has 1 or 2 rings of silicon sensors. 
+//                                                       
 // This class contains the detailed version of the FMD - that is, hits
 // are produced during simulation. 
 //                                                                           
-// The actual code is done by various separate classes.   Below is
-// diagram showing the relationship between the various FMD classes
-// that handles the geometry 
-//
-//
-//       +----------+   +----------+   
-//       | AliFMDv1 |  | AliFMDv1 |   
-//       +----------+   +----------+   
-//            |              |
-//       +----+--------------+
-//       |
-//       |           +------------+ 1  +---------------+
-//       |        +- | AliFMDRing |<>--| AliFMDPolygon | 
-//       V     2  |  +------------+    +---------------+   
-//  +--------+<>--+        |
-//  | AliFMD |             ^                       
-//  +--------+<>--+        V 1..2                     
-//            3  | +-------------------+ 
-//               +-| AliFMDSubDetector | 
-//                 +-------------------+
-//                           ^              
-//                           |
-//             +-------------+-------------+
-//             |             |             |         
-//        +---------+   +---------+   +---------+
-//        | AliFMD1 |   | AliFMD2 |   | AliFMD3 |
-//        +---------+   +---------+   +---------+
-//      
-//
 // See also the class AliFMD for a more detailed explanation of the
 // various componets. 
-#ifndef ROOT_TVirtualMC
-# include <TVirtualMC.h>
-#endif
-#ifndef ALIFMDV1_H
-# include "AliFMDv1.h"
-#endif
-#ifndef ALIRUN_H
-# include "AliRun.h"
-#endif
-#ifndef ALIMC_H
-# include "AliMC.h"
-#endif
-#ifndef ALILOG_H
-# include "AliLog.h"
-#endif
+//
+#include <TVirtualMC.h>                // ROOT_TVirtualMC
+#include <AliRun.h>            // ALIRUN_H
+#include <AliMC.h>             // ALIMC_H
+#include <AliLog.h>            // ALILOG_H
+#include "AliFMDv1.h"          // ALIFMDV1_H
+#include "AliFMDSimulator.h"   // ALIFMDSIMULATOR_H
+#include "AliFMDG3Simulator.h" // ALIFMDG3SIMULATOR_H
+#include "AliFMDGeoSimulator.h"        // ALIFMDGEOSIMULATOR_H
 
 //____________________________________________________________________
-ClassImp(AliFMDv1);
+ClassImp(AliFMDv1)
+#if 0
+  ; // This is here to keep Emacs for indenting the next line
+#endif
 
 
 //____________________________________________________________________
 void 
 AliFMDv1::StepManager()
 {
-  //
   // Called for every step in the Forward Multiplicity Detector
   //
-  // The procedure is as follows: 
+  // The message is deligated to AliFMDSimulator::Exec 
   // 
-  //   - IF NOT track is alive THEN RETURN ENDIF
-  //   - IF NOT particle is charged THEN RETURN ENDIF
-  //   - IF NOT volume name is "STRI" or "STRO" THEN RETURN ENDIF 
-  //   - Get strip number (volume copy # minus 1)
-  //   - Get phi division number (mother volume copy #)
-  //   - Get module number (grand-mother volume copy #)
-  //   - section # = 2 * module # + phi division # - 1
-  //   - Get ring Id from volume name 
-  //   - Get detector # from grand-grand-grand-mother volume name 
-  //   - Get pointer to sub-detector object. 
-  //   - Get track position 
-  //   - IF track is entering volume AND track is inside real shape THEN
-  //   -   Reset energy deposited 
-  //   -   Get track momentum 
-  //   -   Get particle ID # 
-  ///  - ENDIF
-  //   - IF track is inside volume AND inside real shape THEN 
-  ///  -   Update energy deposited 
-  //   - ENDIF 
-  //   - IF track is inside real shape AND (track is leaving volume,
-  //         or it died, or it is stopped  THEN
-  //   -   Create a hit 
-  //   - ENDIF
-  //     
-  //
-  // DebugGuard guard("AliFMDv1::StepManager");
-  AliDebug(10, "AliFMDv1::StepManager");
-  // return;
-
-  // If the track is gone, return
-  if (!gMC->IsTrackAlive()) return;
-  
-  // Only process charged particles 
-  if(TMath::Abs(gMC->TrackCharge()) <= 0) return; 
-
-  // Only do stuff is the track is in one of the strips. 
-  TString vol(gMC->CurrentVolName());
-  if (!vol.Contains("STR")) return;
-
-
-  // Get the strip number.  Note, that GEANT numbers divisions from 1,
-  // so we subtract one 
-  Int_t strip;             
-  gMC->CurrentVolID(strip);
-  strip--;                 
-
-  // Get the phi division of the module 
-  Int_t phiDiv;                         // * The phi division number (1 or 2)
-  gMC->CurrentVolOffID(1, phiDiv);      //   in the module  
-
-  // Active volume number - not used. 
-  // Int_t active;                         
-  // gMC->CurrentVolOffID(2, active);      
-
-  // Get the module number in the ring. 
-  Int_t module;                    
-  gMC->CurrentVolOffID(3, module); 
-  
-  // Ring copy number - the same as the detector number - not used
-  // Int_t ringCopy;                       // * Ring copy number
-  // gMC->CurrentVolOffID(4, ringCopy);    //   Same as detector number 
-  
-  // Get the detector number from the path name 
-  Int_t detector = Int_t((gMC->CurrentVolOffName(5)[3]) - 48);
-
-  // The sector number, calculated from module and phi division # 
-  Int_t  sector =  2 * module + phiDiv - 1;
-
-  // The ring ID is encoded in the volume name 
-  Char_t ring = vol[3];
-
-  // Get a pointer to the sub detector structure 
-  AliFMDSubDetector* det = 0;
-  switch (detector) {
-  case 1: det = fFMD1; break;
-  case 2: det = fFMD2; break;
-  case 3: det = fFMD3; break;
-  }
-  if (!det) return;
-
-  // Get the current track position 
-  TLorentzVector v;
-  gMC->TrackPosition(v);
-  // Check that the track is actually within the active area 
-  Bool_t isWithin = det->CheckHit(ring, module, v.X(), v.Y());
-  Bool_t entering = gMC->IsTrackEntering() && isWithin;
-  Bool_t inside   = gMC->IsTrackInside()   && isWithin;
-  Bool_t out      = (gMC->IsTrackExiting() 
-                    || gMC->IsTrackDisappeared() 
-                    || gMC->IsTrackStop() 
-                    || !isWithin);
-// Reset the energy deposition for this track, and update some of
-  // our parameters.
-  if (entering) {
-    fCurrentDeltaE = 0;
-
-    // Get production vertex and momentum of the track 
-    fCurrentV = v;
-    gMC->TrackMomentum(fCurrentP);
-    fCurrentPdg = gMC->IdFromPDG(gMC->TrackPid());
-
-    // if (fAnalyser) 
-    //   fAnalyser->Update(detector, ring, isWithin, v.X(), v.Y());
-  }
-  
-  // If the track is inside, then update the energy deposition
-  if (inside && fCurrentDeltaE >= 0) 
-    fCurrentDeltaE += 1000 * gMC->Edep();
-
-  // The track exits the volume, or it disappeared in the volume, or
-  // the track is stopped because it no longer fulfills the cuts
-  // defined, then we create a hit. 
-  if (out && fCurrentDeltaE >= 0) {
-    fCurrentDeltaE += 1000 * gMC->Edep();
-
-    AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),
-          detector, ring,  sector, strip,
-          fCurrentV.X(), fCurrentV.Y(), fCurrentV.Z(),
-          fCurrentP.X(), fCurrentP.Y(), fCurrentP.Z(), 
-          fCurrentDeltaE, fCurrentPdg, fCurrentV.T());
-    fCurrentDeltaE = -1;
+  if (!fSimulator) {
+    AliFatal("No simulator object made");
+    return;
   }
+  fSimulator->Exec("");
 }
 //___________________________________________________________________
 //