X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=FMD%2FAliFMDv1.cxx;h=386115768af1796f25089eb21ebb0a78d6fabf5b;hb=4cbef9fba538a1bf23541e9f3760754c7b1cd802;hp=cec594e69b9ba7d9ca07da4c1cd75723c8cbdaff;hpb=b316044fe32fcbb68532d2b3903af3d86bdb61c9;p=u%2Fmrichter%2FAliRoot.git
diff --git a/FMD/AliFMDv1.cxx b/FMD/AliFMDv1.cxx
index cec594e69b9..386115768af 100644
--- a/FMD/AliFMDv1.cxx
+++ b/FMD/AliFMDv1.cxx
@@ -1,886 +1,336 @@
-///////////////////////////////////////////////////////////////////////////////
-// //
-// Forward Multiplicity Detector Version 1 //
-// //
-//Begin_Html
-/*
-
-
- The responsible person for this module is
-Valeri Kondratiev.
-
-
-
+/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ +/* $Id$ */ +/** @file AliFMDv1.cxx + @author Christian Holm Christensen+ @date Mon Mar 27 12:48:51 2006 + @brief Concrete implementation of FMD detector driver - detailed + version + @ingroup FMD_sim */ -//End_Html -// // -/////////////////////////////////////////////////////////////////////////////// +//____________________________________________________________________ +// +// Forward Multiplicity Detector based on Silicon wafers. This class +// contains the base procedures for the Forward Multiplicity detector +// 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. +// +// See also the class AliFMD for a more detailed explanation of the +// various componets. +// +#include // ROOT_TVirtualMC +#include // ALIRUN_H +#include // ALIMC_H +// #include // ALILOG_H +#include "AliFMDDebug.h" // Better debug macros +#include "AliFMDv1.h" // ALIFMDV1_H +// #include "AliFMDGeometryBuilder.h" +#include "AliFMDGeometry.h" +#include "AliFMDDetector.h" +#include "AliFMDRing.h" +#include +#include +#include "AliFMDHit.h" -#include "AliRun.h" -#include "AliFMDv1.h" -#include "AliMC.h" -#include "AliConst.h" - - +//____________________________________________________________________ ClassImp(AliFMDv1) - -//_____________________________________________________________________________ -AliFMDv1::AliFMDv1() : AliFMD() -{ - // - // Defautl constructor for FMD version 1 - // -} - -//_____________________________________________________________________________ -AliFMDv1::AliFMDv1(const char *name, const char *title) - : AliFMD(name,title) -{ - // - // Standard constructor for FMD version 1 - // -} - -//_____________________________________________________________________________ -void AliFMDv1::CreateGeometry() +#if 0 + ; // This is here to keep Emacs for indenting the next line +#endif + + +//____________________________________________________________________ +Bool_t +AliFMDv1::VMC2FMD(TLorentzVector& v, UShort_t& detector, + Char_t& ring, UShort_t& sector, UShort_t& strip) const { - // - // Creation of the geometry of the FMD version 1 - // - //Begin_Html - /* - - */ - //End_Html - //Begin_Html - /* - - */ - //End_Html + // Convert VMC coordinates to detector coordinates + TVirtualMC* mc = TVirtualMC::GetMC(); + AliFMDGeometry* fmd = AliFMDGeometry::Instance(); - AliMC* pMC = AliMC::GetMC(); - - Float_t rout; - Float_t z; - Float_t h1, h2, t0, t1, t2; - Float_t tt; - Float_t par[3], rin; - const Float_t v1 = 42.0; - const Float_t v2 = 4.5; - const Float_t v3 = 5.62; - const Float_t v4 = 16.0; - - Int_t *idtmed = gAlice->Idtmed(); - - // ******************************************************** - // DEFINE RIGHT DISK#3 OF FMD - // ******************************************************** - - // Define parameters - - rin = 4.5; - rout = 10.5; - z = 85.; - tt = 2.5; - h1 = TMath::Sqrt(rout * rout + v1/ (tt * kPI)) - rout; - h2 = .4; - t0 = v2/ (h1 * kPI * (h1 + rout * 2.)); - t1 = v3/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - t2 = v4/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); + // Get track position + mc->TrackPosition(v); + Int_t moduleno; mc->CurrentVolOffID(fmd->GetModuleOff(), moduleno); + Int_t iring; mc->CurrentVolOffID(fmd->GetRingOff(), iring); + ring = Char_t(iring); + Int_t det; mc->CurrentVolOffID(fmd->GetDetectorOff(), det); + detector = det; - // *******Inner slice*********** - // Inner steel wall - par[0] = rin - .02; - par[1] = rin; - par[2] = 1.5; - pMC->Gsvolu("IWR3", "TUBE", idtmed[899], par, 3); - pMC->Gspos("IWR3", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY"); - // Front steel wall - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("FWR3", "TUBE", idtmed[899], par, 3); - pMC->Gspos("FWR3", 1, "ALIC", 0., 0., z + .01, 0, "ONLY"); - // Rear steel wall - pMC->Gsvolu("RWR3", "TUBE", idtmed[899], par, 3); - pMC->Gspos("RWR3", 1, "ALIC", 0., 0., z + 2.99, 0, "ONLY"); - // MCP - par[0] = rin; - par[1] = rout; - par[2] = .07; - pMC->Gsvolu("MPR3", "TUBE", idtmed[900], par, 3); - pMC->Gspos("MPR3", 1, "ALIC", 0., 0., z + 1.57, 0, "ONLY"); - // Silicon plate - par[0] = rin; - par[1] = rout; - par[2] = .019; - pMC->Gsvolu("SPR3", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SPR3", 1, "ALIC", 0., 0., z + 1.719, 0, "ONLY"); - // Summator plate - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("SMR3", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SMR3", 1, "ALIC", 0., 0., z + 2.01, 0, "ONLY"); - // *******Outer slice ******* - // Ceramic plate - par[0] = rout; - par[1] = rout + h1; - par[2] = 1.25; - pMC->Gsvolu("CPR3", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CPR3", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY"); - // Covar spring - par[0] = rout; - par[1] = rout + h1; - par[2] = t0 / 2.; - pMC->Gsvolu("C1R3", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C1R3", 1, "ALIC", 0., 0., z + .25 - t0 / 2., 0, "ONLY"); - pMC->Gsvolu("C2R3", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C2R3", 1, "ALIC", 0., 0., z + 2.75 + t0 / 2., 0, "ONLY"); - // Getter camera - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t1 / 2.; - pMC->Gsvolu("GKR3", "TUBE", idtmed[903], par, 3); - pMC->Gspos("GKR3", 1, "ALIC", 0., 0., z + .25 + t1 / 2., 0, "ONLY"); - // Ceramic slice - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t2 / 2.; - pMC->Gsvolu("SCR3", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SCR3", 1, "ALIC", 0., 0., z + .25 + t1 + t2 / 2., 0, "ONLY"); - // ******Electronic slice ******* - // Silicon ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("SER3", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SER3", 1, "ALIC", 0., 0., z + 1.57 - .025, 0, "ONLY"); - // Ceramic ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("CER3", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CER3", 1, "ALIC", 0., 0., z + 1.58 + .025, 0, "ONLY"); - // *********************************************************** - // DEFINE LEFT DISK#3 OF FMD - // *********************************************************** - - // Define parameters - - rin = 4.5; - rout = 10.5; - z = -85.; - tt = 2.5; - h1 = TMath::Sqrt(rout * rout + v1/ (tt * kPI)) - rout; - h2 = .4; - t0 = v2/ (h1 * kPI * (h1 + rout * 2.)); - t1 = v3/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - t2 = v4/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - - // *******Inner slice*********** - // Inner steel wall - par[0] = rin - .02; - par[1] = rin; - par[2] = 1.5; - pMC->Gsvolu("IWL3", "TUBE", idtmed[899], par, 3); - pMC->Gspos("IWL3", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY"); - // Front steel wall - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("FWL3", "TUBE", idtmed[899], par, 3); - pMC->Gspos("FWL3", 1, "ALIC", 0., 0., z - .01, 0, "ONLY"); - // Rear steel wall - pMC->Gsvolu("RWL3", "TUBE", idtmed[899], par, 3); - pMC->Gspos("RWL3", 1, "ALIC", 0., 0., z - 2.99, 0, "ONLY"); - // MCP - par[0] = rin; - par[1] = rout; - par[2] = .07; - pMC->Gsvolu("MPL3", "TUBE", idtmed[900], par, 3); - pMC->Gspos("MPL3", 1, "ALIC", 0., 0., z - 1.57, 0, "ONLY"); - // Silicon plate - par[0] = rin; - par[1] = rout; - par[2] = .019; - pMC->Gsvolu("SPL3", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SPL3", 1, "ALIC", 0., 0., z - 1.719, 0, "ONLY"); - // Summator plate - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("SML3", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SML3", 1, "ALIC", 0., 0., z - 2.01, 0, "ONLY"); - // *******Outer slice ******* - // Ceramic plate - par[0] = rout; - par[1] = rout + h1; - par[2] = 1.25; - pMC->Gsvolu("CPL3", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CPL3", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY"); - // Covar spring - par[0] = rout; - par[1] = rout + h1; - par[2] = t0 / 2.; - pMC->Gsvolu("C1L3", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C1L3", 1, "ALIC", 0., 0., z - .25 + t0 / 2., 0, "ONLY"); - pMC->Gsvolu("C2L3", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C2L3", 1, "ALIC", 0., 0., z - 2.75 - t0 / 2., 0, "ONLY"); - // Getter camera - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t1 / 2.; - pMC->Gsvolu("GKL3", "TUBE", idtmed[903], par, 3); - pMC->Gspos("GKL3", 1, "ALIC", 0., 0., z - .25 - t1 / 2., 0, "ONLY"); - // Ceramic slice - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t2 / 2.; - pMC->Gsvolu("SCL3", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SCL3", 1, "ALIC", 0., 0., z - .25 - t1 - t2 / 2., 0, "ONLY"); - // ******Electronic slice ******* - // Silicon ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("SEL3", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SEL3", 1, "ALIC", 0., 0., z - 1.57 + .025, 0, "ONLY"); - // Ceramic ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("CEL3", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CEL3", 1, "ALIC", 0., 0., z - 1.58 - .025, 0, "ONLY"); - // ******************************************************** - // DEFINE RIGHT DISK#2 OF FMD - // ******************************************************** - - // Define parameters - - rin = 8.; - rout = 14.; - z = 69.7; - tt = 2.5; - h1 = TMath::Sqrt(rout * rout + v1/ (tt * kPI)) - rout; - h2 = .4; - t0 = v2/ (h1 * kPI * (h1 + rout * 2.)); - t1 = v3/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - t2 = v4/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - - // *******Inner slice*********** - // Inner steel wall - par[0] = rin - .02; - par[1] = rin; - par[2] = 1.5; - pMC->Gsvolu("IWR2", "TUBE", idtmed[899], par, 3); - pMC->Gspos("IWR2", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY"); - // Front steel wall - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("FWR2", "TUBE", idtmed[899], par, 3); - pMC->Gspos("FWR2", 1, "ALIC", 0., 0., z + .01, 0, "ONLY"); - // Rear steel wall - pMC->Gsvolu("RWR2", "TUBE", idtmed[899], par, 3); - pMC->Gspos("RWR2", 1, "ALIC", 0., 0., z + 2.99, 0, "ONLY"); - // MCP - par[0] = rin; - par[1] = rout; - par[2] = .07; - pMC->Gsvolu("MPR2", "TUBE", idtmed[900], par, 3); - pMC->Gspos("MPR2", 1, "ALIC", 0., 0., z + 1.57, 0, "ONLY"); - // Silicon plate - par[0] = rin; - par[1] = rout; - par[2] = .019; - pMC->Gsvolu("SPR2", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SPR2", 1, "ALIC", 0., 0., z + 1.719, 0, "ONLY"); - // Summator plate - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("SMR2", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SMR2", 1, "ALIC", 0., 0., z + 2.01, 0, "ONLY"); - // *******Outer slice ******* - // Ceramic plate - par[0] = rout; - par[1] = rout + h1; - par[2] = 1.25; - pMC->Gsvolu("CPR2", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CPR2", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY"); - // Covar spring - par[0] = rout; - par[1] = rout + h1; - par[2] = t0 / 2.; - pMC->Gsvolu("C1R2", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C1R2", 1, "ALIC", 0., 0., z + .25 - t0 / 2., 0, "ONLY"); - pMC->Gsvolu("C2R2", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C2R2", 1, "ALIC", 0., 0., z + 2.75 + t0 / 2., 0, "ONLY"); - // Getter camera - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t1 / 2.; - pMC->Gsvolu("GKR2", "TUBE", idtmed[903], par, 3); - pMC->Gspos("GKR2", 1, "ALIC", 0., 0., z + .25 + t1 / 2., 0, "ONLY"); - // Ceramic slice - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t2 / 2.; - pMC->Gsvolu("SCR2", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SCR2", 1, "ALIC", 0., 0., z + .25 + t1 + t2 / 2., 0, "ONLY"); - // ******Electronic slice ******* - // Silicon ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("SER2", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SER2", 1, "ALIC", 0., 0., z + 1.57 - .025, 0, "ONLY"); - // Ceramic ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("CER2", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CER2", 1, "ALIC", 0., 0., z + 1.58 + .025, 0, "ONLY"); - // *********************************************************** - // DEFINE LEFT DISK#2 OF FMD - // *********************************************************** - - // Define parameters - - rin = 8.; - rout = 14.; - z = -69.7; - tt = 2.5; - h1 = TMath::Sqrt(rout * rout + v1/ (tt * kPI)) - rout; - h2 = .4; - t0 = v2/ (h1 * kPI * (h1 + rout * 2.)); - t1 = v3/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - t2 = v4/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - - // *******Inner slice*********** - // Inner steel wall - par[0] = rin - .02; - par[1] = rin; - par[2] = 1.5; - pMC->Gsvolu("IWL2", "TUBE", idtmed[899], par, 3); - pMC->Gspos("IWL2", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY"); - // Front steel wall - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("FWL2", "TUBE", idtmed[899], par, 3); - pMC->Gspos("FWL2", 1, "ALIC", 0., 0., z - .01, 0, "ONLY"); - // Rear steel wall - pMC->Gsvolu("RWL2", "TUBE", idtmed[899], par, 3); - pMC->Gspos("RWL2", 1, "ALIC", 0., 0., z - 2.99, 0, "ONLY"); - // MCP - par[0] = rin; - par[1] = rout; - par[2] = .07; - pMC->Gsvolu("MPL2", "TUBE", idtmed[900], par, 3); - pMC->Gspos("MPL2", 1, "ALIC", 0., 0., z - 1.57, 0, "ONLY"); - // Silicon plate - par[0] = rin; - par[1] = rout; - par[2] = .019; - pMC->Gsvolu("SPL2", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SPL2", 1, "ALIC", 0., 0., z - 1.719, 0, "ONLY"); - // Summator plate - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("SML2", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SML2", 1, "ALIC", 0., 0., z - 2.01, 0, "ONLY"); - // *******Outer slice ******* - // Ceramic plate - par[0] = rout; - par[1] = rout + h1; - par[2] = 1.25; - pMC->Gsvolu("CPL2", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CPL2", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY"); - // Covar spring - par[0] = rout; - par[1] = rout + h1; - par[2] = t0 / 2.; - pMC->Gsvolu("C1L2", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C1L2", 1, "ALIC", 0., 0., z - .25 + t0 / 2., 0, "ONLY"); - pMC->Gsvolu("C2L2", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C2L2", 1, "ALIC", 0., 0., z - 2.75 - t0 / 2., 0, "ONLY"); - // Getter camera - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t1 / 2.; - pMC->Gsvolu("GKL2", "TUBE", idtmed[903], par, 3); - pMC->Gspos("GKL2", 1, "ALIC", 0., 0., z - .25 - t1 / 2., 0, "ONLY"); - // Ceramic slice - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t2 / 2.; - pMC->Gsvolu("SCL2", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SCL2", 1, "ALIC", 0., 0., z - .25 - t1 - t2 / 2., 0, "ONLY"); - // ******Electronic slice ******* - // Silicon ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("SEL2", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SEL2", 1, "ALIC", 0., 0., z - 1.57 + .025, 0, "ONLY"); - // Ceramic ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("CEL2", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CEL2", 1, "ALIC", 0., 0., z - 1.58 - .025, 0, "ONLY"); - // ******************************************************** - // DEFINE RIGHT DISK#1 OF FMD - // ******************************************************** - - // Define parameters - rin = 8.; - rout = 17.5; - z = 42.5; - tt = 2.5; - h1 = TMath::Sqrt(rout * rout + v1/ (tt * kPI)) - rout; - h2 = .4; - t0 = v2/ (h1 * kPI * (h1 + rout * 2.)); - t1 = v3/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - t2 = v4/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - - // *******Inner slice*********** - // Inner steel wall - par[0] = rin - .02; - par[1] = rin; - par[2] = 1.5; - pMC->Gsvolu("IWR1", "TUBE", idtmed[899], par, 3); - pMC->Gspos("IWR1", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY"); - // Front steel wall - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("FWR1", "TUBE", idtmed[899], par, 3); - pMC->Gspos("FWR1", 1, "ALIC", 0., 0., z + .01, 0, "ONLY"); - // Rear steel wall - pMC->Gsvolu("RWR1", "TUBE", idtmed[899], par, 3); - pMC->Gspos("RWR1", 1, "ALIC", 0., 0., z + 2.99, 0, "ONLY"); - // MCP - par[0] = rin; - par[1] = rout; - par[2] = .07; - pMC->Gsvolu("MPR1", "TUBE", idtmed[900], par, 3); - pMC->Gspos("MPR1", 1, "ALIC", 0., 0., z + 1.57, 0, "ONLY"); - // Silicon plate - par[0] = rin; - par[1] = rout; - par[2] = .019; - pMC->Gsvolu("SPR1", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SPR1", 1, "ALIC", 0., 0., z + 1.719, 0, "ONLY"); - // Summator plate - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("SMR1", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SMR1", 1, "ALIC", 0., 0., z + 2.01, 0, "ONLY"); - // *******Outer slice ******* - // Ceramic plate - par[0] = rout; - par[1] = rout + h1; - par[2] = 1.25; - pMC->Gsvolu("CPR1", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CPR1", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY"); - // Covar spring - par[0] = rout; - par[1] = rout + h1; - par[2] = t0 / 2.; - pMC->Gsvolu("C1R1", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C1R1", 1, "ALIC", 0., 0., z + .25 - t0 / 2., 0, "ONLY"); - pMC->Gsvolu("C2R1", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C2R1", 1, "ALIC", 0., 0., z + 2.75 + t0 / 2., 0, "ONLY"); - // Getter camera - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t1 / 2.; - pMC->Gsvolu("GKR1", "TUBE", idtmed[903], par, 3); - pMC->Gspos("GKR1", 1, "ALIC", 0., 0., z + .25 + t1 / 2., 0, "ONLY"); - // Ceramic slice - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t2 / 2.; - pMC->Gsvolu("SCR1", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SCR1", 1, "ALIC", 0., 0., z + .25 + t1 + t2 / 2., 0, "ONLY"); - // ******Electronic slice ******* - // Silicon ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("SER1", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SER1", 1, "ALIC", 0., 0., z + 1.57 - .025, 0, "ONLY"); - // Ceramic ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("CER1", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CER1", 1, "ALIC", 0., 0., z + 1.58 + .025, 0, "ONLY"); - // *********************************************************** - // DEFINE LEFT DISK#1 OF FMD - // *********************************************************** - - // Define parameters - - rin = 8.; - rout = 17.5; - z = -42.5; - tt = 2.5; - h1 = TMath::Sqrt(rout * rout + v1/ (tt * kPI)) - rout; - h2 = .4; - t0 = v2/ (h1 * kPI * (h1 + rout * 2.)); - t1 = v3/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - t2 = v4/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - - // *******Inner slice*********** - // Inner steel wall - par[0] = rin - .02; - par[1] = rin; - par[2] = 1.5; - pMC->Gsvolu("IWL1", "TUBE", idtmed[899], par, 3); - pMC->Gspos("IWL1", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY"); - // Front steel wall - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("FWL1", "TUBE", idtmed[899], par, 3); - pMC->Gspos("FWL1", 1, "ALIC", 0., 0., z - .01, 0, "ONLY"); - // Rear steel wall - pMC->Gsvolu("RWL1", "TUBE", idtmed[899], par, 3); - pMC->Gspos("RWL1", 1, "ALIC", 0., 0., z - 2.99, 0, "ONLY"); - // MCP - par[0] = rin; - par[1] = rout; - par[2] = .07; - pMC->Gsvolu("MPL1", "TUBE", idtmed[900], par, 3); - pMC->Gspos("MPL1", 1, "ALIC", 0., 0., z - 1.57, 0, "ONLY"); - // Silicon plate - par[0] = rin; - par[1] = rout; - par[2] = .019; - pMC->Gsvolu("SPL1", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SPL1", 1, "ALIC", 0., 0., z - 1.719, 0, "ONLY"); - // Summator plate - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("SML1", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SML1", 1, "ALIC", 0., 0., z - 2.01, 0, "ONLY"); - // *******Outer slice ******* - // Ceramic plate - par[0] = rout; - par[1] = rout + h1; - par[2] = 1.25; - pMC->Gsvolu("CPL1", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CPL1", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY"); - // Covar spring - par[0] = rout; - par[1] = rout + h1; - par[2] = t0 / 2.; - pMC->Gsvolu("C1L1", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C1L1", 1, "ALIC", 0., 0., z - .25 + t0 / 2., 0, "ONLY"); - pMC->Gsvolu("C2L1", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C2L1", 1, "ALIC", 0., 0., z - 2.75 - t0 / 2., 0, "ONLY"); - // Getter camera - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t1 / 2.; - pMC->Gsvolu("GKL1", "TUBE", idtmed[903], par, 3); - pMC->Gspos("GKL1", 1, "ALIC", 0., 0., z - .25 - t1 / 2., 0, "ONLY"); - // Ceramic slice - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t2 / 2.; - pMC->Gsvolu("SCL1", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SCL1", 1, "ALIC", 0., 0., z - .25 - t1 - t2 / 2., 0, "ONLY"); - // ******Electronic slice ******* - // Silicon ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("SEL1", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SEL1", 1, "ALIC", 0., 0., z - 1.57 + .025, 0, "ONLY"); - // Ceramic ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("CEL1", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CEL1", 1, "ALIC", 0., 0., z - 1.58 - .025, 0, "ONLY"); - // *********************************************************** - // DEFINE LEFT DISK#4 OF FMD - // *********************************************************** - - // Define parameters - - rin = 4.2; - rout = 13.; - z = -229.5; - tt = 2.5; - h1 = TMath::Sqrt(rout * rout + v1/ (tt * kPI)) - rout; - h2 = .4; - t0 = v2/ (h1 * kPI * (h1 + rout * 2.)); - t1 = v3/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - t2 = v4/ (h2 * kPI * (h2 + (h1 + rout) * 2.)); - - // *******Inner slice*********** - // Inner steel wall - par[0] = rin - .02; - par[1] = rin; - par[2] = 1.5; - pMC->Gsvolu("IWL4", "TUBE", idtmed[899], par, 3); - pMC->Gspos("IWL4", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY"); - // Front steel wall - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("FWL4", "TUBE", idtmed[899], par, 3); - pMC->Gspos("FWL4", 1, "ALIC", 0., 0., z - .01, 0, "ONLY"); - // Rear steel wall - pMC->Gsvolu("RWL4", "TUBE", idtmed[899], par, 3); - pMC->Gspos("RWL4", 1, "ALIC", 0., 0., z - 2.99, 0, "ONLY"); - // MCP - par[0] = rin; - par[1] = rout; - par[2] = .07; - pMC->Gsvolu("MPL4", "TUBE", idtmed[900], par, 3); - pMC->Gspos("MPL4", 1, "ALIC", 0., 0., z - 1.57, 0, "ONLY"); - // Silicon plate - par[0] = rin; - par[1] = rout; - par[2] = .019; - pMC->Gsvolu("SPL4", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SPL4", 1, "ALIC", 0., 0., z - 1.719, 0, "ONLY"); - // Summator plate - par[0] = rin; - par[1] = rout; - par[2] = .01; - pMC->Gsvolu("SML4", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SML4", 1, "ALIC", 0., 0., z - 2.01, 0, "ONLY"); - // *******Outer slice ******* - // Ceramic plate - par[0] = rout; - par[1] = rout + h1; - par[2] = 1.25; - pMC->Gsvolu("CPL4", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CPL4", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY"); - // Covar spring - par[0] = rout; - par[1] = rout + h1; - par[2] = t0 / 2.; - pMC->Gsvolu("C1L4", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C1L4", 1, "ALIC", 0., 0., z - .25 + t0 / 2., 0, "ONLY"); - pMC->Gsvolu("C2L4", "TUBE", idtmed[903], par, 3); - pMC->Gspos("C2L4", 1, "ALIC", 0., 0., z - 2.75 - t0 / 2., 0, "ONLY"); - // Getter camera - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t1 / 2.; - pMC->Gsvolu("GKL4", "TUBE", idtmed[903], par, 3); - pMC->Gspos("GKL4", 1, "ALIC", 0., 0., z - .25 - t1 / 2., 0, "ONLY"); - // Ceramic slice - par[0] = rout + h1; - par[1] = rout + h1 + h2; - par[2] = t2 / 2.; - pMC->Gsvolu("SCL4", "TUBE", idtmed[902], par, 3); - pMC->Gspos("SCL4", 1, "ALIC", 0., 0., z - .25 - t1 - t2 / 2., 0, "ONLY"); - // ******Electronic slice ******* - // Silicon ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("SEL4", "TUBE", idtmed[901], par, 3); - pMC->Gspos("SEL4", 1, "ALIC", 0., 0., z - 1.57 + .025, 0, "ONLY"); - // Ceramic ring - par[0] = rout + h1 + h2; - par[1] = rout + h1 + h2 + 5.; - par[2] = .025; - pMC->Gsvolu("CEL4", "TUBE", idtmed[902], par, 3); - pMC->Gspos("CEL4", 1, "ALIC", 0., 0., z - 1.58 - .025, 0, "ONLY"); + // Get the ring geometry + //Int_t nsec = fmd->GetDetector(detector)->GetRing(ring)->GetNSectors(); + Int_t nstr = fmd->GetDetector(detector)->GetRing(ring)->GetNStrips(); + Double_t lowr = fmd->GetDetector(detector)->GetRing(ring)->GetMinR(); + Double_t theta = fmd->GetDetector(detector)->GetRing(ring)->GetTheta(); + Double_t pitch = fmd->GetDetector(detector)->GetRing(ring)->GetPitch(); + + // Figure out the strip number + Double_t r = TMath::Sqrt(v.X() * v.X() + v.Y() * v.Y()); + Int_t str = Int_t((r - lowr) / pitch); + if (str < 0 || str >= nstr) return kFALSE; + strip = str; + + // Figure out the sector number + Double_t phi = TMath::ATan2(v.Y(), v.X()) * 180. / TMath::Pi(); + if (phi < 0) phi = 360. + phi; + Double_t t = phi - 2 * moduleno * theta; + sector = 2 * moduleno; + if (t < 0 || t > 2 * theta) return kFALSE; + else if (t > theta) sector += 1; + + AliFMDDebug(40, ("<1> Inside an active FMD volume FMD%d%c[%2d,%3d] %s", + detector, ring, sector, strip, mc->CurrentVolPath())); + return kTRUE; } - -//_____________________________________________________________________________ -void AliFMDv1::DrawModule() + +//____________________________________________________________________ +Bool_t +AliFMDv1::VMC2FMD(Int_t copy, TLorentzVector& v, + UShort_t& detector, Char_t& ring, + UShort_t& sector, UShort_t& strip) const { - // - // Draw a shaded view of the FMD version 1 - // + // Convert VMC coordinates to detector coordinates + TVirtualMC* mc = TVirtualMC::GetMC(); + AliFMDGeometry* fmd = AliFMDGeometry::Instance(); - AliMC* pMC = AliMC::GetMC(); - - // Set everything unseen - pMC->Gsatt("*", "seen", -1); - // - // Set ALIC mother transparent - pMC->Gsatt("ALIC","SEEN",0); - // - // Set the volumes visible - pMC->Gsatt("IWR3","seen",1); - pMC->Gsatt("FWR3","seen",1); - pMC->Gsatt("RWR3","seen",1); - pMC->Gsatt("MPR3","seen",1); - pMC->Gsatt("SPR3","seen",1); - pMC->Gsatt("SMR3","seen",1); - pMC->Gsatt("CPR3","seen",1); - pMC->Gsatt("C1R3","seen",1); - pMC->Gsatt("C2R3","seen",1); - pMC->Gsatt("GKR3","seen",1); - pMC->Gsatt("SCR3","seen",1); - pMC->Gsatt("SER3","seen",1); - pMC->Gsatt("CER3","seen",1); - pMC->Gsatt("IWL3","seen",1); - pMC->Gsatt("FWL3","seen",1); - pMC->Gsatt("RWL3","seen",1); - pMC->Gsatt("MPL3","seen",1); - pMC->Gsatt("SPL3","seen",1); - pMC->Gsatt("SML3","seen",1); - pMC->Gsatt("CPL3","seen",1); - pMC->Gsatt("C1L3","seen",1); - pMC->Gsatt("C2L3","seen",1); - pMC->Gsatt("GKL3","seen",1); - pMC->Gsatt("SCL3","seen",1); - pMC->Gsatt("SEL3","seen",1); - pMC->Gsatt("CEL3","seen",1); - pMC->Gsatt("IWR2","seen",1); - pMC->Gsatt("FWR2","seen",1); - pMC->Gsatt("RWR2","seen",1); - pMC->Gsatt("MPR2","seen",1); - pMC->Gsatt("SPR2","seen",1); - pMC->Gsatt("SMR2","seen",1); - pMC->Gsatt("CPR2","seen",1); - pMC->Gsatt("C1R2","seen",1); - pMC->Gsatt("C2R2","seen",1); - pMC->Gsatt("GKR2","seen",1); - pMC->Gsatt("SCR2","seen",1); - pMC->Gsatt("SER2","seen",1); - pMC->Gsatt("CER2","seen",1); - pMC->Gsatt("IWL2","seen",1); - pMC->Gsatt("FWL2","seen",1); - pMC->Gsatt("RWL2","seen",1); - pMC->Gsatt("MPL2","seen",1); - pMC->Gsatt("SPL2","seen",1); - pMC->Gsatt("SML2","seen",1); - pMC->Gsatt("CPL2","seen",1); - pMC->Gsatt("C1L2","seen",1); - pMC->Gsatt("C2L2","seen",1); - pMC->Gsatt("GKL2","seen",1); - pMC->Gsatt("SCL2","seen",1); - pMC->Gsatt("SEL2","seen",1); - pMC->Gsatt("CEL2","seen",1); - pMC->Gsatt("IWR1","seen",1); - pMC->Gsatt("FWR1","seen",1); - pMC->Gsatt("RWR1","seen",1); - pMC->Gsatt("MPR1","seen",1); - pMC->Gsatt("SPR1","seen",1); - pMC->Gsatt("SMR1","seen",1); - pMC->Gsatt("CPR1","seen",1); - pMC->Gsatt("C1R1","seen",1); - pMC->Gsatt("C2R1","seen",1); - pMC->Gsatt("GKR1","seen",1); - pMC->Gsatt("SCR1","seen",1); - pMC->Gsatt("SER1","seen",1); - pMC->Gsatt("CER1","seen",1); - pMC->Gsatt("IWL1","seen",1); - pMC->Gsatt("FWL1","seen",1); - pMC->Gsatt("RWL1","seen",1); - pMC->Gsatt("MPL1","seen",1); - pMC->Gsatt("SPL1","seen",1); - pMC->Gsatt("SML1","seen",1); - pMC->Gsatt("CPL1","seen",1); - pMC->Gsatt("C1L1","seen",1); - pMC->Gsatt("C2L1","seen",1); - pMC->Gsatt("GKL1","seen",1); - pMC->Gsatt("SCL1","seen",1); - pMC->Gsatt("SEL1","seen",1); - pMC->Gsatt("CEL1","seen",1); - pMC->Gsatt("IWL4","seen",1); - pMC->Gsatt("FWL4","seen",1); - pMC->Gsatt("RWL4","seen",1); - pMC->Gsatt("MPL4","seen",1); - pMC->Gsatt("SPL4","seen",1); - pMC->Gsatt("SML4","seen",1); - pMC->Gsatt("CPL4","seen",1); - pMC->Gsatt("C1L4","seen",1); - pMC->Gsatt("C2L4","seen",1); - pMC->Gsatt("GKL4","seen",1); - pMC->Gsatt("SCL4","seen",1); - pMC->Gsatt("SEL4","seen",1); - pMC->Gsatt("CEL4","seen",1); - // - pMC->Gdopt("hide", "on"); - pMC->Gdopt("shad", "on"); - pMC->Gsatt("*", "fill", 7); - pMC->SetClipBox("."); - pMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000); - pMC->DefaultRange(); - pMC->Gdraw("alic", 40, 30, 0, 6, 9, .08, .08); - pMC->Gdhead(1111, "Forward Multiplicity Detector version 1"); - pMC->Gdman(13, 9, "MAN"); + strip = copy - 1; + Int_t sectordiv; mc->CurrentVolOffID(fmd->GetSectorOff(), sectordiv); + if (fmd->GetModuleOff() >= 0) { + Int_t module; mc->CurrentVolOffID(fmd->GetModuleOff(), module); + sector = 2 * module + sectordiv; + } + else + sector = sectordiv; + AliFMDDebug(30, ("Getting ring volume with offset %d -> %s", + fmd->GetRingOff(), + mc->CurrentVolOffName(fmd->GetRingOff()))); + Int_t iring; mc->CurrentVolOffID(fmd->GetRingOff(), iring); + ring = Char_t(iring); + Int_t det; mc->CurrentVolOffID(fmd->GetDetectorOff(), det); + detector = det; + + //Double_t rz = fmd->GetDetector(detector)->GetRingZ(ring); + AliFMDDetector* gdet = fmd->GetDetector(detector); + AliFMDRing* gring = gdet->GetRing(ring); + if (!gring) { + AliFatal(Form("Ring %c not found (volume was %s at offset %d in path %s)", + ring, + mc->CurrentVolOffName(fmd->GetRingOff()), + fmd->GetRingOff(), + mc->CurrentVolPath())); + } + Int_t n = gring->GetNSectors(); +#if 0 + if (rz < 0) { + Int_t s = ((n - sector + n / 2) % n) + 1; + AliFMDDebug(1, ("Recalculating sector to %d (=%d-%d+%d/2%%%d+1 z=%f)", + s, n, sector, n, n, rz)); + sector = s; + } +#endif + if (sector < 1 || sector > n) { + AliWarning(Form("sector # %d out of range (0-%d)", sector-1, n-1)); + return kFALSE; + } + sector--; + // Get track position + mc->TrackPosition(v); + AliFMDDebug(40, ("<2> Inside an active FMD volume FMD%d%c[%2d,%3d] %s", + detector, ring, sector, strip, mc->CurrentVolPath())); + + return kTRUE; } -//_____________________________________________________________________________ -void AliFMDv1::CreateMaterials() -{ - // - // Create materials for version 1 of FMD - // - // Steel for chamber - Float_t ast[4] = { 55.847,58.71,51.996,47.9 }; - Float_t zst[4] = { 26.,28.,24.,22. }; - Float_t wst[4] = { .6,.18,.12,.1 }; - // Lead glass for MCP - Float_t amcp[3] = { 15.9994,28.086,207.19 }; - Float_t zmcp[3] = { 8.,14.,82. }; - Float_t wmcp[3] = { .43,.375,.195 }; - // Ceramic for plates - Float_t acer[2] = { 26.98,15.9994 }; - Float_t zcer[2] = { 13.,8. }; - Float_t wcer[2] = { .4,.6 }; - - Float_t epsil, stmin, deemax, tmaxfd, stemax; - - Int_t ISXFLD = gAlice->Field()->Integ(); - Float_t SXMGMX = gAlice->Field()->Max(); - - // Silicon - - AliMaterial(2, "SI$", 28.086, 14., 2.33, 9.36, 45.5); - - // Covar - - AliMaterial(4, "FE$", 55.85, 26., 8.3, 1.67, 15.9); - - // Steel - - AliMixture(0, "FMD_STEEL$", ast, zst, 7.9, 4, wst); - - // Lead glass - - AliMixture(1, "FMD_MCP$", amcp, zmcp, 1.55, 3, wmcp); - - // Ceramic - - AliMixture(3, "FMD_CERAMIC$", acer, zcer, 3.96, -2, wcer); - // ******************************************************* - // Defines tracking media parameters. - // ******************************************************* - epsil = .001; // Tracking precision, DLS - stemax = -1.; // Maximum displacement for multiple scattering - tmaxfd = -20.; // Maximum angle due to field deflection - deemax = -.3; // Maximum fractional energy loss, DLS - stmin = -.8; - // ******************************************************** - AliMedium(900, "STEEL_L3 ", 0, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(901, "LEAD_GLASS_L3 ", 1, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(902, "SILICON_L3 ", 2, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(903, "CERAMIC_L3 ", 3, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(904, "COVAR_L3 ", 4, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin); +//____________________________________________________________________ +Bool_t +AliFMDv1::CheckHit(Int_t trackno, Int_t pdg, Float_t absQ, + const TLorentzVector& p, Float_t edep) const +{ + // Check that a hit is good + if (AliLog::GetDebugLevel("FMD", "AliFMD") < 5) return kFALSE; + TVirtualMC* mc = TVirtualMC::GetMC(); + Double_t mass = mc->TrackMass(); + Double_t poverm = (mass == 0 ? 0 : p.P() / mass); + + // This `if' is to debug abnormal energy depositions. We trigger on + // p/m approx larger than or equal to a MIP, and a large edep - more + // than 1 keV - a MIP is 100 eV. + if (!(edep > absQ * absQ && poverm > 1)) return kFALSE; + + TArrayI procs; + mc->StepProcesses(procs); + TString processes; + for (Int_t ip = 0; ip < procs.fN; ip++) { + if (ip != 0) processes.Append(","); + processes.Append(TMCProcessName[procs.fArray[ip]]); + } + TDatabasePDG* pdgDB = TDatabasePDG::Instance(); + TParticlePDG* particleType = pdgDB->GetParticle(pdg); + TString pname(particleType ? particleType->GetName() : "???"); + TString what; + if (mc->IsTrackEntering()) what.Append("entering "); + if (mc->IsTrackExiting()) what.Append("exiting "); + if (mc->IsTrackInside()) what.Append("inside "); + if (mc->IsTrackDisappeared()) what.Append("disappeared "); + if (mc->IsTrackStop()) what.Append("stopped "); + if (mc->IsNewTrack()) what.Append("new "); + if (mc->IsTrackAlive()) what.Append("alive "); + if (mc->IsTrackOut()) what.Append("out "); + + Int_t mother = gAlice->GetMCApp()->GetPrimary(trackno); + AliFMDDebug(15, ("Track # %5d deposits a lot of energy\n" + " Volume: %s\n" + " Momentum: (%7.4f,%7.4f,%7.4f)\n" + " PDG: %d (%s)\n" + " Edep: %-14.7f keV (mother %d)\n" + " p/m: %-7.4f/%-7.4f = %-14.7f\n" + " Processes: %s\n" + " What: %s\n", + trackno, mc->CurrentVolPath(), p.X(), p.Y(), p.Z(), + pdg, pname.Data(), edep, mother, p.P(), mass, + poverm, processes.Data(), what.Data())); + return kTRUE; } + +//____________________________________________________________________ +void +AliFMDv1::StepManager() +{ + // Member function that is executed each time a hit is made in the + // FMD. None-charged particles are ignored. Dead tracks are + // ignored. + // + // The procedure is as follows: + // + // - 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 + // + TVirtualMC* mc = TVirtualMC::GetMC(); + if (!mc->IsTrackAlive()) return; + Double_t absQ = TMath::Abs(mc->TrackCharge()); + if (absQ <= 0) return; + + Int_t copy; + Int_t vol = mc->CurrentVolID(copy); + AliFMDGeometry* fmd = AliFMDGeometry::Instance(); + if (!fmd->IsActive(vol)) { + AliFMDDebug(50, ("Not an FMD volume %d '%s'",vol,mc->CurrentVolName())); + return; + } + TLorentzVector v; + UShort_t detector; + Char_t ring; + UShort_t sector; + UShort_t strip; + + if (fmd->IsDetailed()) { + if (!VMC2FMD(copy, v, detector, ring, sector, strip)) return; + } else { + if (!VMC2FMD(v, detector, ring, sector, strip)) return; + } + TLorentzVector p; + mc->TrackMomentum(p); + Int_t trackno = gAlice->GetMCApp()->GetCurrentTrackNumber(); + Int_t pdg = mc->TrackPid(); + Double_t edep = mc->Edep() * 1000; // keV + Bool_t isBad = CheckHit(trackno, pdg, absQ, p, edep); + + // Check that the track is actually within the active area + Bool_t entering = mc->IsTrackEntering(); + Bool_t inside = mc->IsTrackInside(); + Bool_t out = (mc->IsTrackExiting()|| mc->IsTrackDisappeared()|| + mc->IsTrackStop()); + // Reset the energy deposition for this track, and update some of + // our parameters. + if (entering) { + AliFMDDebug(15, ("Track # %8d entering active FMD volume %s: " + "Edep=%f (%f,%f,%f)", trackno, mc->CurrentVolPath(), + edep, v.X(), v.Y(), v.Z())); + fCurrentP = p; + fCurrentV = v; + fCurrentDeltaE = edep; + fCurrentPdg = pdg; // mc->IdFromPDG(pdg); + } + // If the track is inside, then update the energy deposition + if (inside && fCurrentDeltaE >= 0) { + fCurrentDeltaE += edep; + AliFMDDebug(15, ("Track # %8d inside active FMD volume %s: Edep=%f, " + "Accumulated Edep=%f (%f,%f,%f)", trackno, + mc->CurrentVolPath(), edep, fCurrentDeltaE, + v.X(), v.Y(), v.Z())); + } + // 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) { + if (fCurrentDeltaE >= 0) { + fCurrentDeltaE += edep; + AliFMDDebug(15, ("Track # %8d exiting active FMD volume %s: Edep=%g, " + "Accumulated Edep=%g (%f,%f,%f)", trackno, + mc->CurrentVolPath(), edep, fCurrentDeltaE, + v.X(), v.Y(), v.Z())); + TVector3 cur(v.Vect()); + cur -= fCurrentV.Vect(); + Double_t len = cur.Mag(); + AliFMDHit* h = + AddHitByFields(trackno, detector, ring, sector, strip, + fCurrentV.X(), fCurrentV.Y(), fCurrentV.Z(), + fCurrentP.X(), fCurrentP.Y(), fCurrentP.Z(), + fCurrentDeltaE, fCurrentPdg, fCurrentV.T(), + len, mc->IsTrackDisappeared()||mc->IsTrackStop()); + // Add a copy + if (isBad && fBad) { + new ((*fBad)[fBad->GetEntries()]) AliFMDHit(*h); + } + // Check the geometry that we can get back the coordinates. +#ifdef CHECK_TRANS + Double_t x, y, z; + fmd->Detector2XYZ(detector, ring, sector, strip, x, y ,z); + AliFMDDebug(1, ("Hit at (%f,%f,%f), geometry says (%f,%f,%f)", + fCurrentV.X(), fCurrentV.Y(), fCurrentV.Z(), x, y, z)); +#endif + } + fCurrentDeltaE = -1; + } +} +//___________________________________________________________________ +// +// EOF +//