]>
Commit | Line | Data |
---|---|---|
3decf5cb | 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 | //_________________________________________________________________________ | |
17 | // Manager class for PHOS version for fast simulations | |
18 | //*-- Author : Y. Schutz SUBATECH | |
19 | ////////////////////////////////////////////////////////////////////////////// | |
20 | ||
21 | // --- ROOT system --- | |
22 | ||
23 | #include "TBRIK.h" | |
24 | #include "TNode.h" | |
25 | #include "TParticle.h" | |
26 | ||
27 | // --- Standard library --- | |
28 | ||
29 | #include <cstdio> | |
30 | #include <cassert> | |
31 | ||
32 | // --- AliRoot header files --- | |
33 | ||
34 | #include "AliPHOSvFast.h" | |
35 | #include "AliPHOSReconstructioner.h" | |
36 | #include "AliRun.h" | |
37 | #include "AliConst.h" | |
38 | ||
39 | ClassImp(AliPHOSvFast) | |
40 | ||
41 | //____________________________________________________________________________ | |
42 | AliPHOSvFast::AliPHOSvFast() | |
43 | { | |
44 | fRecParticles = 0 ; | |
45 | fNRecParticles = 0 ; | |
46 | } | |
47 | ||
48 | //____________________________________________________________________________ | |
49 | AliPHOSvFast::AliPHOSvFast(const char *name, const char *title): | |
50 | AliPHOS(name,title) | |
51 | { | |
52 | // gets an instance of the geometry parameters class | |
53 | ||
54 | fGeom = AliPHOSGeometry::GetInstance(title, "") ; | |
55 | ||
56 | if (fGeom->IsInitialized() ) | |
57 | cout << "AliPHOSvFast : PHOS geometry intialized for " << fGeom->GetName() << endl ; | |
58 | else | |
59 | cout << "AliPHOSvFast : PHOS geometry initialization failed !" << endl ; | |
60 | ||
61 | SetBigBox(0, fGeom->GetOuterBoxSize(0) ) ; | |
62 | SetBigBox(1, fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) ; | |
63 | SetBigBox(2, fGeom->GetOuterBoxSize(0) ); | |
64 | ||
65 | fNRecParticles = 0 ; | |
66 | } | |
67 | ||
68 | //____________________________________________________________________________ | |
69 | AliPHOSvFast::~AliPHOSvFast() | |
70 | { | |
71 | ||
72 | fRecParticles->Delete() ; | |
73 | delete fRecParticles ; | |
74 | fRecParticles = 0 ; | |
75 | ||
76 | } | |
77 | ||
78 | //____________________________________________________________________________ | |
79 | void AliPHOSvFast::AddRecParticle(Int_t primary) | |
80 | { | |
81 | TClonesArray * particlelist = gAlice->Particles() ; | |
82 | TParticle * part = (TParticle *)particlelist->At(primary) ; | |
83 | cout << " AliPHOSvFast::AddRecParticle " << part->GetName() << endl ; | |
84 | } | |
85 | ||
86 | //____________________________________________________________________________ | |
87 | void AliPHOSvFast::BuildGeometry() | |
88 | { | |
89 | ||
90 | // Build the PHOS geometry for the ROOT display | |
91 | ||
92 | const Int_t kColorPHOS = kRed ; | |
93 | ||
94 | Double_t const kRADDEG = 180.0 / kPI ; | |
95 | ||
96 | new TBRIK( "BigBox", "PHOS box", "void", GetBigBox(0)/2, | |
97 | GetBigBox(1)/2, | |
98 | GetBigBox(2)/2 ); | |
99 | ||
100 | // position PHOS into ALICE | |
101 | ||
102 | Float_t r = fGeom->GetIPtoOuterCoverDistance() + GetBigBox(1) / 2.0 ; | |
103 | Int_t number = 988 ; | |
104 | Float_t pphi = TMath::ATan( GetBigBox(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ; | |
105 | pphi *= kRADDEG ; | |
106 | TNode * top = gAlice->GetGeometry()->GetNode("alice") ; | |
107 | ||
108 | char * nodename = new char[20] ; | |
109 | char * rotname = new char[20] ; | |
110 | ||
111 | for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { | |
112 | Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ; | |
113 | sprintf(rotname, "%s%d", "rot", number++) ; | |
114 | new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0); | |
115 | top->cd(); | |
116 | sprintf(nodename,"%s%d", "Module", i) ; | |
117 | Float_t x = r * TMath::Sin( angle / kRADDEG ) ; | |
118 | Float_t y = -r * TMath::Cos( angle / kRADDEG ) ; | |
119 | TNode * bigboxnode = new TNode(nodename, nodename, "BigBox", x, y, 0, rotname ) ; | |
120 | bigboxnode->SetLineColor(kColorPHOS) ; | |
121 | fNodes->Add(bigboxnode) ; | |
122 | } | |
123 | delete[] nodename ; | |
124 | delete[] rotname ; | |
125 | } | |
126 | ||
127 | //____________________________________________________________________________ | |
128 | void AliPHOSvFast::CreateGeometry() | |
129 | { | |
130 | ||
131 | AliPHOSvFast *phostmp = (AliPHOSvFast*)gAlice->GetModule("PHOS") ; | |
132 | ||
133 | if ( phostmp == NULL ) { | |
134 | ||
135 | fprintf(stderr, "PHOS detector not found!\n") ; | |
136 | return ; | |
137 | ||
138 | } | |
139 | ||
140 | // Get pointer to the array containing media indeces | |
141 | Int_t *idtmed = fIdtmed->GetArray() - 699 ; | |
142 | ||
143 | Float_t bigbox[3] ; | |
144 | bigbox[0] = GetBigBox(0) / 2.0 ; | |
145 | bigbox[1] = GetBigBox(1) / 2.0 ; | |
146 | bigbox[2] = GetBigBox(2) / 2.0 ; | |
147 | ||
148 | gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ; | |
149 | ||
150 | // --- Position PHOS mdules in ALICE setup --- | |
151 | ||
152 | Int_t idrotm[99] ; | |
153 | Double_t const kRADDEG = 180.0 / kPI ; | |
154 | ||
155 | for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { | |
156 | ||
157 | Float_t angle = fGeom->GetPHOSAngle(i) ; | |
158 | AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ; | |
159 | ||
160 | Float_t r = fGeom->GetIPtoOuterCoverDistance() + GetBigBox(1) / 2.0 ; | |
161 | ||
162 | Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ; | |
163 | Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ; | |
164 | ||
165 | gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ; | |
166 | ||
167 | } // for GetNModules | |
168 | ||
169 | } | |
170 | ||
171 | ||
172 | //____________________________________________________________________________ | |
173 | void AliPHOSvFast::Init(void) | |
174 | { | |
175 | ||
176 | Int_t i; | |
177 | ||
178 | printf("\n"); | |
179 | for(i=0;i<35;i++) printf("*"); | |
180 | printf(" FAST PHOS_INIT "); | |
181 | for(i=0;i<35;i++) printf("*"); | |
182 | printf("\n"); | |
183 | ||
184 | // Here the PHOS initialisation code (if any!) | |
185 | ||
186 | for(i=0;i<80;i++) printf("*"); | |
187 | printf("\n"); | |
188 | ||
189 | } | |
190 | ||
191 | //___________________________________________________________________________ | |
192 | Float_t AliPHOSvFast::GetBigBox(Int_t index) | |
193 | { | |
194 | Float_t rv = 0 ; | |
195 | ||
196 | switch (index) { | |
197 | case 0: | |
198 | rv = fBigBoxX ; | |
199 | break ; | |
200 | case 1: | |
201 | rv = fBigBoxY ; | |
202 | break ; | |
203 | case 2: | |
204 | rv = fBigBoxZ ; | |
205 | break ; | |
206 | } | |
207 | return rv ; | |
208 | } | |
209 | ||
210 | //___________________________________________________________________________ | |
211 | void AliPHOSvFast::MakeBranch(Option_t* opt) | |
212 | { | |
213 | // | |
214 | // Create a new branch in the current Root Tree | |
215 | // The branch of fHits is automatically split | |
216 | // | |
217 | AliDetector::MakeBranch(opt) ; | |
218 | ||
219 | char branchname[10]; | |
220 | sprintf(branchname,"%s",GetName()); | |
221 | char *cd = strstr(opt,"D"); | |
222 | ||
223 | if (fDigits && gAlice->TreeD() && cd) { | |
224 | gAlice->TreeD()->Branch(branchname, &fRecParticles, fBufferSize); | |
225 | // printf("* AliPHOS::MakeBranch * Making Branch %s for RecParticles \n",branchname); | |
226 | } | |
227 | } | |
228 | ||
229 | //___________________________________________________________________________ | |
230 | void AliPHOSvFast::SetBigBox(Int_t index, Float_t value) | |
231 | { | |
232 | ||
233 | switch (index) { | |
234 | case 0: | |
235 | fBigBoxX = value ; | |
236 | break ; | |
237 | case 1: | |
238 | fBigBoxY = value ; | |
239 | break ; | |
240 | case 2: | |
241 | fBigBoxZ = value ; | |
242 | break ; | |
243 | } | |
244 | ||
245 | } | |
246 | ||
247 | //____________________________________________________________________________ | |
248 | void AliPHOSvFast::StepManager(void) | |
249 | { | |
250 | ||
251 | Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() ); | |
252 | TString name = fGeom->GetName() ; | |
253 | ||
254 | // add the primary particle to the RecParticles list | |
255 | ||
256 | AddRecParticle(primary); | |
257 | fNRecParticles++ ; | |
258 | gMC->StopTrack() ; | |
259 | ||
260 | } | |
261 |