]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDv1.cxx
Removing extra semicolons (FedoraCore3, gcc 3.4.2)
[u/mrichter/AliRoot.git] / FMD / AliFMDv1.cxx
CommitLineData
37c4363a 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18//____________________________________________________________________
19//
20// Forward Multiplicity Detector based on Silicon wafers. This class
21// contains the base procedures for the Forward Multiplicity detector
22// Detector consists of 5 Si volumes covered pseudorapidity interval
23// from 1.7 to 5.1.
24//
25// This class contains the detailed version of the FMD - that is, hits
26// are produced during simulation.
27//
28// The actual code is done by various separate classes. Below is
29// diagram showing the relationship between the various FMD classes
30// that handles the geometry
31//
32//
33// +----------+ +----------+
34// | AliFMDv1 | | AliFMDv1 |
35// +----------+ +----------+
36// | |
37// +----+--------------+
38// |
39// | +------------+ 1 +---------------+
40// | +- | AliFMDRing |<>--| AliFMDPolygon |
41// V 2 | +------------+ +---------------+
42// +--------+<>--+ |
43// | AliFMD | ^
44// +--------+<>--+ V 1..2
45// 3 | +-------------------+
46// +-| AliFMDSubDetector |
47// +-------------------+
48// ^
49// |
50// +-------------+-------------+
51// | | |
52// +---------+ +---------+ +---------+
53// | AliFMD1 | | AliFMD2 | | AliFMD3 |
54// +---------+ +---------+ +---------+
55//
56//
57// See also the class AliFMD for a more detailed explanation of the
58// various componets.
56b1929b 59#include <TVirtualMC.h> // ROOT_TVirtualMC
60#include <AliRun.h> // ALIRUN_H
61#include <AliMC.h> // ALIMC_H
62#include <AliLog.h> // ALILOG_H
e802be3e 63#include "AliFMDv1.h" // ALIFMDV1_H
37c4363a 64
65//____________________________________________________________________
925e6570 66ClassImp(AliFMDv1)
37c4363a 67
68
69//____________________________________________________________________
70void
71AliFMDv1::StepManager()
72{
73 //
74 // Called for every step in the Forward Multiplicity Detector
75 //
76 // The procedure is as follows:
77 //
78 // - IF NOT track is alive THEN RETURN ENDIF
79 // - IF NOT particle is charged THEN RETURN ENDIF
80 // - IF NOT volume name is "STRI" or "STRO" THEN RETURN ENDIF
81 // - Get strip number (volume copy # minus 1)
82 // - Get phi division number (mother volume copy #)
83 // - Get module number (grand-mother volume copy #)
84 // - section # = 2 * module # + phi division # - 1
85 // - Get ring Id from volume name
86 // - Get detector # from grand-grand-grand-mother volume name
87 // - Get pointer to sub-detector object.
88 // - Get track position
89 // - IF track is entering volume AND track is inside real shape THEN
90 // - Reset energy deposited
91 // - Get track momentum
92 // - Get particle ID #
93 /// - ENDIF
94 // - IF track is inside volume AND inside real shape THEN
95 /// - Update energy deposited
96 // - ENDIF
97 // - IF track is inside real shape AND (track is leaving volume,
98 // or it died, or it is stopped THEN
99 // - Create a hit
100 // - ENDIF
101 //
102 //
0115c4ea 103 AliDebug(10, Form("Is inside %s", gMC->CurrentVolName()));
37c4363a 104
105 // If the track is gone, return
106 if (!gMC->IsTrackAlive()) return;
107
108 // Only process charged particles
109 if(TMath::Abs(gMC->TrackCharge()) <= 0) return;
110
42403906 111 // Only do stuff is the track is in one of the strips.
112 // TString vol(gMC->CurrentVolName());
113 // if (!vol.Contains("STR")) return;
114 Int_t copy;
115 Int_t volumeId = gMC->CurrentVolID(copy);
afddaa11 116 // The ring ID is encoded in the volume name
117 Char_t ring = '\0';
118 if (volumeId == fInner->GetStripId()) ring = 'I';
119 else if (volumeId == fOuter->GetStripId()) ring = 'O';
120 else return;
121
37c4363a 122 // Get the strip number. Note, that GEANT numbers divisions from 1,
123 // so we subtract one
42403906 124 Int_t strip = copy - 1;
37c4363a 125
126 // Get the phi division of the module
127 Int_t phiDiv; // * The phi division number (1 or 2)
128 gMC->CurrentVolOffID(1, phiDiv); // in the module
129
130 // Active volume number - not used.
131 // Int_t active;
132 // gMC->CurrentVolOffID(2, active);
133
134 // Get the module number in the ring.
135 Int_t module;
136 gMC->CurrentVolOffID(3, module);
137
138 // Ring copy number - the same as the detector number - not used
139 // Int_t ringCopy; // * Ring copy number
140 // gMC->CurrentVolOffID(4, ringCopy); // Same as detector number
141
142 // Get the detector number from the path name
143 Int_t detector = Int_t((gMC->CurrentVolOffName(5)[3]) - 48);
144
145 // The sector number, calculated from module and phi division #
146 Int_t sector = 2 * module + phiDiv - 1;
147
afddaa11 148
37c4363a 149 // Get a pointer to the sub detector structure
150 AliFMDSubDetector* det = 0;
151 switch (detector) {
152 case 1: det = fFMD1; break;
153 case 2: det = fFMD2; break;
154 case 3: det = fFMD3; break;
155 }
156 if (!det) return;
157
158 // Get the current track position
159 TLorentzVector v;
160 gMC->TrackPosition(v);
161 // Check that the track is actually within the active area
162 Bool_t isWithin = det->CheckHit(ring, module, v.X(), v.Y());
163 Bool_t entering = gMC->IsTrackEntering() && isWithin;
164 Bool_t inside = gMC->IsTrackInside() && isWithin;
165 Bool_t out = (gMC->IsTrackExiting()
166 || gMC->IsTrackDisappeared()
167 || gMC->IsTrackStop()
168 || !isWithin);
824466d5 169
170 AliDebug(2, Form("Is inside FMD%d%c[%02d,%03d]: particle is %s",
171 detector, ring, sector, strip,
172 (entering ? "entering" :
173 (inside ? "inside" :
174 "exiting"))));
175
176 // Reset the energy deposition for this track, and update some of
37c4363a 177 // our parameters.
178 if (entering) {
179 fCurrentDeltaE = 0;
180
181 // Get production vertex and momentum of the track
182 fCurrentV = v;
183 gMC->TrackMomentum(fCurrentP);
184 fCurrentPdg = gMC->IdFromPDG(gMC->TrackPid());
185
186 // if (fAnalyser)
187 // fAnalyser->Update(detector, ring, isWithin, v.X(), v.Y());
188 }
189
190 // If the track is inside, then update the energy deposition
191 if (inside && fCurrentDeltaE >= 0)
192 fCurrentDeltaE += 1000 * gMC->Edep();
193
194 // The track exits the volume, or it disappeared in the volume, or
195 // the track is stopped because it no longer fulfills the cuts
196 // defined, then we create a hit.
197 if (out && fCurrentDeltaE >= 0) {
198 fCurrentDeltaE += 1000 * gMC->Edep();
199
200 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),
201 detector, ring, sector, strip,
202 fCurrentV.X(), fCurrentV.Y(), fCurrentV.Z(),
203 fCurrentP.X(), fCurrentP.Y(), fCurrentP.Z(),
204 fCurrentDeltaE, fCurrentPdg, fCurrentV.T());
205 fCurrentDeltaE = -1;
206 }
207}
208//___________________________________________________________________
209//
210// EOF
211//