4c039060 |
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 | |
d15a28e7 |
16 | //_________________________________________________________________________ |
17 | // Manager class for PHOS version SUBATECH |
18 | //*-- Author : Y. Schutz SUBATECH |
19 | ////////////////////////////////////////////////////////////////////////////// |
d2cf0e38 |
20 | |
fe4da5cc |
21 | // --- ROOT system --- |
d15a28e7 |
22 | |
fe4da5cc |
23 | #include "TBRIK.h" |
24 | #include "TNode.h" |
0869cea5 |
25 | #include "TRandom.h" |
fe4da5cc |
26 | |
d15a28e7 |
27 | // --- Standard library --- |
28 | |
9f616d61 |
29 | #include <cstdio> |
30 | #include <cstring> |
31 | #include <cstdlib> |
32 | #include <strstream> |
33 | #include <cassert> |
d15a28e7 |
34 | |
35 | // --- AliRoot header files --- |
36 | |
fe4da5cc |
37 | #include "AliPHOSv0.h" |
d15a28e7 |
38 | #include "AliPHOSHit.h" |
39 | #include "AliPHOSDigit.h" |
40 | #include "AliPHOSReconstructioner.h" |
fe4da5cc |
41 | #include "AliRun.h" |
d15a28e7 |
42 | #include "AliConst.h" |
fe4da5cc |
43 | |
44 | ClassImp(AliPHOSv0) |
45 | |
d15a28e7 |
46 | //____________________________________________________________________________ |
8c933dd7 |
47 | AliPHOSv0::AliPHOSv0() |
fe4da5cc |
48 | { |
d15a28e7 |
49 | fNTmpHits = 0 ; |
50 | fTmpHits = 0 ; |
fe4da5cc |
51 | } |
d15a28e7 |
52 | |
53 | //____________________________________________________________________________ |
54 | AliPHOSv0::AliPHOSv0(const char *name, const char *title): |
55 | AliPHOS(name,title) |
56 | { |
57 | |
58 | // We use 2 arrays of hits : |
59 | // |
60 | // - fHits (the "normal" one), which retains the hits associated with |
61 | // the current primary particle being tracked |
62 | // (this array is reset after each primary has been tracked). |
63 | // |
64 | // - fTmpHits, which retains all the hits of the current event. It |
65 | // is used for the digitization part. |
66 | |
3a6a7952 |
67 | fPinElectronicNoise = 0.010 ; |
68 | fDigitThreshold = 1. ; // 1 GeV |
0869cea5 |
69 | |
d15a28e7 |
70 | fHits = new TClonesArray("AliPHOSHit",100) ; |
6ad0bfa0 |
71 | gAlice->AddHitList(fHits) ; |
72 | |
d15a28e7 |
73 | fTmpHits= new TClonesArray("AliPHOSHit",100) ; |
74 | |
d15a28e7 |
75 | fNTmpHits = fNhits = 0 ; |
76 | |
6ad0bfa0 |
77 | fDigits = new TClonesArray("AliPHOSDigit",100) ; |
78 | |
79 | |
d15a28e7 |
80 | fIshunt = 1 ; // All hits are associated with primary particles |
fe4da5cc |
81 | |
d15a28e7 |
82 | // gets an instance of the geometry parameters class |
6ad0bfa0 |
83 | |
d15a28e7 |
84 | fGeom = AliPHOSGeometry::GetInstance(title, "") ; |
85 | |
86 | if (fGeom->IsInitialized() ) |
87 | cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ; |
88 | else |
89 | cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ; |
90 | } |
91 | //____________________________________________________________________________ |
6ad0bfa0 |
92 | AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title): |
d15a28e7 |
93 | AliPHOS(name,title) |
94 | { |
95 | |
96 | // We use 2 arrays of hits : |
97 | // |
98 | // - fHits (the "normal" one), which retains the hits associated with |
99 | // the current primary particle being tracked |
100 | // (this array is reset after each primary has been tracked). |
101 | // |
102 | // - fTmpHits, which retains all the hits of the current event. It |
103 | // is used for the digitization part. |
3a6a7952 |
104 | fPinElectronicNoise = 0.010 ; |
d15a28e7 |
105 | fHits = new TClonesArray("AliPHOSHit",100) ; |
106 | fDigits = new TClonesArray("AliPHOSDigit",100) ; |
107 | fTmpHits= new TClonesArray("AliPHOSHit",100) ; |
108 | |
d15a28e7 |
109 | fNTmpHits = fNhits = 0 ; |
110 | |
111 | fIshunt = 1 ; // All hits are associated with primary particles |
112 | |
113 | // gets an instance of the geometry parameters class |
114 | fGeom = AliPHOSGeometry::GetInstance(title, "") ; |
115 | |
116 | if (fGeom->IsInitialized() ) |
117 | cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ; |
118 | else |
119 | cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ; |
120 | |
121 | // Defining the PHOS Reconstructioner |
122 | |
6ad0bfa0 |
123 | fReconstructioner = Reconstructioner ; |
d15a28e7 |
124 | } |
125 | |
126 | //____________________________________________________________________________ |
127 | AliPHOSv0::~AliPHOSv0() |
128 | { |
9f616d61 |
129 | fTmpHits->Delete() ; |
d15a28e7 |
130 | delete fTmpHits ; |
9f616d61 |
131 | fTmpHits = 0 ; |
132 | |
133 | fEmcClusters->Delete() ; |
134 | delete fEmcClusters ; |
135 | fEmcClusters = 0 ; |
136 | |
137 | fPpsdClusters->Delete() ; |
138 | delete fPpsdClusters ; |
139 | fPpsdClusters = 0 ; |
140 | |
141 | fTrackSegments->Delete() ; |
142 | delete fTrackSegments ; |
143 | fTrackSegments = 0 ; |
d15a28e7 |
144 | } |
145 | |
146 | //____________________________________________________________________________ |
ff4c968a |
147 | void AliPHOSv0::AddHit(Int_t primary, Int_t Id, Float_t * hits) |
d15a28e7 |
148 | { |
149 | Int_t hitCounter ; |
92862013 |
150 | TClonesArray <mphits = *fTmpHits ; |
d15a28e7 |
151 | AliPHOSHit *newHit ; |
92862013 |
152 | AliPHOSHit *curHit ; |
ff4c968a |
153 | Bool_t deja = kFALSE ; |
d15a28e7 |
154 | |
155 | // In any case, fills the fTmpHit TClonesArray (with "accumulated hits") |
156 | |
ff4c968a |
157 | newHit = new AliPHOSHit(primary, Id, hits) ; |
d15a28e7 |
158 | |
92862013 |
159 | for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) { |
d15a28e7 |
160 | curHit = (AliPHOSHit*) ltmphits[hitCounter] ; |
161 | if( *curHit == *newHit ) { |
ff4c968a |
162 | *curHit = *curHit + *newHit ; |
163 | deja = kTRUE ; |
d15a28e7 |
164 | } |
165 | } |
166 | |
92862013 |
167 | if ( !deja ) { |
d15a28e7 |
168 | new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ; |
169 | fNTmpHits++ ; |
170 | } |
171 | |
172 | // Please note that the fTmpHits array must survive up to the |
173 | // end of the events, so it does not appear e.g. in ResetHits() ( |
174 | // which is called at the end of each primary). |
fe4da5cc |
175 | |
d15a28e7 |
176 | // if (IsTreeSelected('H')) { |
177 | // And, if we really want raw hits tree, have the fHits array filled also |
178 | // TClonesArray &lhits = *fHits; |
179 | // new(lhits[fNhits]) AliPHOSHit(*newHit) ; |
180 | // fNhits++ ; |
181 | // } |
182 | |
ff4c968a |
183 | delete newHit; |
d15a28e7 |
184 | |
185 | } |
186 | |
187 | |
188 | //____________________________________________________________________________ |
189 | void AliPHOSv0::BuildGeometry() |
fe4da5cc |
190 | { |
d15a28e7 |
191 | |
192 | this->BuildGeometryforPHOS() ; |
193 | if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) ) |
194 | this->BuildGeometryforPPSD() ; |
195 | else |
196 | cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl; |
197 | |
fe4da5cc |
198 | } |
d15a28e7 |
199 | |
200 | //____________________________________________________________________________ |
201 | void AliPHOSv0:: BuildGeometryforPHOS(void) |
202 | { |
203 | // Build the PHOS geometry for the ROOT display |
204 | |
205 | const Int_t kColorPHOS = kRed ; |
206 | const Int_t kColorXTAL = kBlue ; |
207 | |
92862013 |
208 | Double_t const kRADDEG = 180.0 / kPI ; |
d15a28e7 |
209 | |
210 | new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2, |
211 | fGeom->GetOuterBoxSize(1)/2, |
212 | fGeom->GetOuterBoxSize(2)/2 ); |
213 | |
214 | // Textolit Wall box, position inside PHOS |
215 | |
216 | new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2, |
217 | fGeom->GetTextolitBoxSize(1)/2, |
218 | fGeom->GetTextolitBoxSize(2)/2); |
219 | |
220 | // Polystyrene Foam Plate |
221 | |
222 | new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2, |
223 | fGeom->GetSecondUpperPlateThickness()/2, |
224 | fGeom->GetTextolitBoxSize(2)/2 ) ; |
225 | |
226 | // Air Filled Box |
fe4da5cc |
227 | |
d15a28e7 |
228 | new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2, |
229 | fGeom->GetAirFilledBoxSize(1)/2, |
230 | fGeom->GetAirFilledBoxSize(2)/2 ); |
231 | |
232 | // Crystals Box |
233 | |
92862013 |
234 | Float_t xtlX = fGeom->GetCrystalSize(0) ; |
235 | Float_t xtlY = fGeom->GetCrystalSize(1) ; |
236 | Float_t xtlZ = fGeom->GetCrystalSize(2) ; |
d15a28e7 |
237 | |
92862013 |
238 | Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ; |
239 | Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 |
d15a28e7 |
240 | + fGeom->GetModuleBoxThickness() / 2.0 ; |
92862013 |
241 | Float_t zl = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ; |
d15a28e7 |
242 | |
92862013 |
243 | new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ; |
d15a28e7 |
244 | |
245 | // position PHOS into ALICE |
246 | |
92862013 |
247 | Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ; |
d15a28e7 |
248 | Int_t number = 988 ; |
249 | Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ; |
92862013 |
250 | pphi *= kRADDEG ; |
251 | TNode * top = gAlice->GetGeometry()->GetNode("alice") ; |
d15a28e7 |
252 | |
253 | char * nodename = new char[20] ; |
254 | char * rotname = new char[20] ; |
255 | |
256 | for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { |
257 | Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ; |
258 | sprintf(rotname, "%s%d", "rot", number++) ; |
259 | new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0); |
92862013 |
260 | top->cd(); |
d15a28e7 |
261 | sprintf(nodename,"%s%d", "Module", i) ; |
92862013 |
262 | Float_t x = r * TMath::Sin( angle / kRADDEG ) ; |
263 | Float_t y = -r * TMath::Cos( angle / kRADDEG ) ; |
264 | TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ; |
265 | outerboxnode->SetLineColor(kColorPHOS) ; |
266 | fNodes->Add(outerboxnode) ; |
267 | outerboxnode->cd() ; |
d15a28e7 |
268 | // now inside the outer box the textolit box |
92862013 |
269 | y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ; |
d15a28e7 |
270 | sprintf(nodename,"%s%d", "TexBox", i) ; |
92862013 |
271 | TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ; |
272 | textolitboxnode->SetLineColor(kColorPHOS) ; |
273 | fNodes->Add(textolitboxnode) ; |
d15a28e7 |
274 | // upper foam plate inside outre box |
92862013 |
275 | outerboxnode->cd() ; |
d15a28e7 |
276 | sprintf(nodename, "%s%d", "UFPlate", i) ; |
92862013 |
277 | y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ; |
278 | TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ; |
279 | upperfoamplatenode->SetLineColor(kColorPHOS) ; |
280 | fNodes->Add(upperfoamplatenode) ; |
d15a28e7 |
281 | // air filled box inside textolit box (not drawn) |
92862013 |
282 | textolitboxnode->cd(); |
283 | y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ; |
d15a28e7 |
284 | sprintf(nodename, "%s%d", "AFBox", i) ; |
92862013 |
285 | TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ; |
286 | fNodes->Add(airfilledboxnode) ; |
d15a28e7 |
287 | // crystals box inside air filled box |
92862013 |
288 | airfilledboxnode->cd() ; |
289 | y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl |
d15a28e7 |
290 | - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness() |
291 | - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ; |
292 | sprintf(nodename, "%s%d", "XTBox", i) ; |
92862013 |
293 | TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ; |
294 | crystalsboxnode->SetLineColor(kColorXTAL) ; |
295 | fNodes->Add(crystalsboxnode) ; |
d15a28e7 |
296 | } |
297 | } |
298 | |
299 | //____________________________________________________________________________ |
300 | void AliPHOSv0:: BuildGeometryforPPSD(void) |
fe4da5cc |
301 | { |
d15a28e7 |
302 | // Build the PPSD geometry for the ROOT display |
303 | |
92862013 |
304 | Double_t const kRADDEG = 180.0 / kPI ; |
d15a28e7 |
305 | |
306 | const Int_t kColorPHOS = kRed ; |
307 | const Int_t kColorPPSD = kGreen ; |
308 | const Int_t kColorGas = kBlue ; |
309 | const Int_t kColorAir = kYellow ; |
310 | |
311 | // Box for a full PHOS module |
312 | |
313 | new TBRIK( "PPSDBox", "PPSD box", "void", fGeom->GetPPSDBoxSize(0)/2, |
314 | fGeom->GetPPSDBoxSize(1)/2, |
315 | fGeom->GetPPSDBoxSize(2)/2 ); |
316 | |
317 | // Box containing one micromegas module |
318 | |
319 | new TBRIK( "PPSDModule", "PPSD module", "void", fGeom->GetPPSDModuleSize(0)/2, |
320 | fGeom->GetPPSDModuleSize(1)/2, |
321 | fGeom->GetPPSDModuleSize(2)/2 ); |
322 | // top lid |
323 | |
324 | new TBRIK ( "TopLid", "Micromegas top lid", "void", fGeom->GetPPSDModuleSize(0)/2, |
325 | fGeom->GetLidThickness()/2, |
326 | fGeom->GetPPSDModuleSize(2)/2 ) ; |
327 | // composite panel (top and bottom) |
328 | |
329 | new TBRIK ( "TopPanel", "Composite top panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2, |
330 | fGeom->GetCompositeThickness()/2, |
331 | ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; |
332 | |
333 | new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2, |
334 | fGeom->GetCompositeThickness()/2, |
335 | ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; |
336 | // gas gap (conversion and avalanche) |
337 | |
338 | new TBRIK ( "GasGap", "gas gap", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2, |
339 | ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() )/2, |
340 | ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; |
341 | |
342 | // anode and cathode |
343 | |
344 | new TBRIK ( "Anode", "Anode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2, |
345 | fGeom->GetAnodeThickness()/2, |
346 | ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; |
347 | |
348 | new TBRIK ( "Cathode", "Cathode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2, |
349 | fGeom->GetCathodeThickness()/2, |
350 | ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; |
351 | // PC |
352 | |
353 | new TBRIK ( "PCBoard", "Printed Circuit", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2, |
354 | fGeom->GetPCThickness()/2, |
355 | ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ; |
356 | // Gap between Lead and top micromegas |
357 | |
358 | new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2, |
359 | fGeom->GetMicro1ToLeadGap()/2, |
360 | fGeom->GetPPSDBoxSize(2)/2 ) ; |
361 | |
362 | // Gap between Lead and bottom micromegas |
363 | |
364 | new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2, |
365 | fGeom->GetLeadToMicro2Gap()/2, |
366 | fGeom->GetPPSDBoxSize(2)/2 ) ; |
367 | // Lead converter |
368 | |
369 | new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2, |
370 | fGeom->GetLeadConverterThickness()/2, |
371 | fGeom->GetPPSDBoxSize(2)/2 ) ; |
372 | |
373 | // position PPSD into ALICE |
374 | |
375 | char * nodename = new char[20] ; |
376 | char * rotname = new char[20] ; |
377 | |
92862013 |
378 | Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ; |
d15a28e7 |
379 | Int_t number = 988 ; |
92862013 |
380 | TNode * top = gAlice->GetGeometry()->GetNode("alice") ; |
d15a28e7 |
381 | |
382 | for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules |
383 | Float_t angle = fGeom->GetPHOSAngle(i) ; |
384 | sprintf(rotname, "%s%d", "rotg", number++) ; |
385 | new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0); |
92862013 |
386 | top->cd(); |
d15a28e7 |
387 | sprintf(nodename, "%s%d", "Moduleg", i) ; |
92862013 |
388 | Float_t x = r * TMath::Sin( angle / kRADDEG ) ; |
389 | Float_t y = -r * TMath::Cos( angle / kRADDEG ) ; |
390 | TNode * ppsdboxnode = new TNode(nodename , nodename ,"PPSDBox", x, y, 0, rotname ) ; |
391 | ppsdboxnode->SetLineColor(kColorPPSD) ; |
392 | fNodes->Add(ppsdboxnode) ; |
393 | ppsdboxnode->cd() ; |
d15a28e7 |
394 | // inside the PPSD box: |
395 | // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas |
92862013 |
396 | x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ; |
d15a28e7 |
397 | for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module |
92862013 |
398 | Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ; |
399 | TNode * micro1node ; |
d15a28e7 |
400 | for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module |
92862013 |
401 | y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ; |
d15a28e7 |
402 | sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ; |
92862013 |
403 | micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ; |
404 | micro1node->SetLineColor(kColorPPSD) ; |
405 | fNodes->Add(micro1node) ; |
d15a28e7 |
406 | // inside top micromegas |
92862013 |
407 | micro1node->cd() ; |
d15a28e7 |
408 | // a. top lid |
92862013 |
409 | y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ; |
d15a28e7 |
410 | sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ; |
92862013 |
411 | TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ; |
412 | toplidnode->SetLineColor(kColorPPSD) ; |
413 | fNodes->Add(toplidnode) ; |
d15a28e7 |
414 | // b. composite panel |
92862013 |
415 | y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; |
d15a28e7 |
416 | sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ; |
92862013 |
417 | TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ; |
418 | compupnode->SetLineColor(kColorPPSD) ; |
419 | fNodes->Add(compupnode) ; |
d15a28e7 |
420 | // c. anode |
92862013 |
421 | y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ; |
d15a28e7 |
422 | sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ; |
92862013 |
423 | TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ; |
424 | anodenode->SetLineColor(kColorPHOS) ; |
425 | fNodes->Add(anodenode) ; |
d15a28e7 |
426 | // d. gas |
92862013 |
427 | y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ; |
d15a28e7 |
428 | sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ; |
92862013 |
429 | TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ; |
430 | ggapnode->SetLineColor(kColorGas) ; |
431 | fNodes->Add(ggapnode) ; |
d15a28e7 |
432 | // f. cathode |
92862013 |
433 | y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ; |
d15a28e7 |
434 | sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ; |
92862013 |
435 | TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ; |
436 | cathodenode->SetLineColor(kColorPHOS) ; |
437 | fNodes->Add(cathodenode) ; |
d15a28e7 |
438 | // g. printed circuit |
92862013 |
439 | y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ; |
d15a28e7 |
440 | sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ; |
92862013 |
441 | TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ; |
442 | pcnode->SetLineColor(kColorPPSD) ; |
443 | fNodes->Add(pcnode) ; |
d15a28e7 |
444 | // h. composite panel |
92862013 |
445 | y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; |
d15a28e7 |
446 | sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ; |
92862013 |
447 | TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ; |
448 | compdownnode->SetLineColor(kColorPPSD) ; |
449 | fNodes->Add(compdownnode) ; |
450 | z = z - fGeom->GetPPSDModuleSize(2) ; |
451 | ppsdboxnode->cd() ; |
d15a28e7 |
452 | } // end of Z module loop |
92862013 |
453 | x = x - fGeom->GetPPSDModuleSize(0) ; |
454 | ppsdboxnode->cd() ; |
d15a28e7 |
455 | } // end of phi module loop |
456 | // 2. air gap |
92862013 |
457 | ppsdboxnode->cd() ; |
458 | y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ; |
d15a28e7 |
459 | sprintf(nodename, "%s%d", "GapUp", i) ; |
92862013 |
460 | TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ; |
461 | gapupnode->SetLineColor(kColorAir) ; |
462 | fNodes->Add(gapupnode) ; |
d15a28e7 |
463 | // 3. lead converter |
92862013 |
464 | y = y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ; |
d15a28e7 |
465 | sprintf(nodename, "%s%d", "LeadC", i) ; |
92862013 |
466 | TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ; |
467 | leadcnode->SetLineColor(kColorPPSD) ; |
468 | fNodes->Add(leadcnode) ; |
d15a28e7 |
469 | // 4. air gap |
92862013 |
470 | y = y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ; |
d15a28e7 |
471 | sprintf(nodename, "%s%d", "GapDown", i) ; |
92862013 |
472 | TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ; |
473 | gapdownnode->SetLineColor(kColorAir) ; |
474 | fNodes->Add(gapdownnode) ; |
d15a28e7 |
475 | // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas |
92862013 |
476 | x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ; |
d15a28e7 |
477 | for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { |
92862013 |
478 | Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;; |
479 | TNode * micro2node ; |
d15a28e7 |
480 | for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { |
92862013 |
481 | y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ; |
d15a28e7 |
482 | sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ; |
92862013 |
483 | micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ; |
484 | micro2node->SetLineColor(kColorPPSD) ; |
485 | fNodes->Add(micro2node) ; |
d15a28e7 |
486 | // inside bottom micromegas |
92862013 |
487 | micro2node->cd() ; |
d15a28e7 |
488 | // a. top lid |
92862013 |
489 | y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ; |
d15a28e7 |
490 | sprintf(nodename, "%s%d", "Lidb", i) ; |
92862013 |
491 | TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ; |
492 | toplidbnode->SetLineColor(kColorPPSD) ; |
493 | fNodes->Add(toplidbnode) ; |
d15a28e7 |
494 | // b. composite panel |
92862013 |
495 | y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; |
d15a28e7 |
496 | sprintf(nodename, "%s%d", "CompUb", i) ; |
92862013 |
497 | TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ; |
498 | compupbnode->SetLineColor(kColorPPSD) ; |
499 | fNodes->Add(compupbnode) ; |
d15a28e7 |
500 | // c. anode |
92862013 |
501 | y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ; |
d15a28e7 |
502 | sprintf(nodename, "%s%d", "Anob", i) ; |
92862013 |
503 | TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ; |
504 | anodebnode->SetLineColor(kColorPPSD) ; |
505 | fNodes->Add(anodebnode) ; |
d15a28e7 |
506 | // d. conversion gas |
92862013 |
507 | y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ; |
d15a28e7 |
508 | sprintf(nodename, "%s%d", "GGapb", i) ; |
92862013 |
509 | TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ; |
510 | ggapbnode->SetLineColor(kColorGas) ; |
511 | fNodes->Add(ggapbnode) ; |
d15a28e7 |
512 | // f. cathode |
92862013 |
513 | y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ; |
d15a28e7 |
514 | sprintf(nodename, "%s%d", "Cathodeb", i) ; |
92862013 |
515 | TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ; |
516 | cathodebnode->SetLineColor(kColorPPSD) ; |
517 | fNodes->Add(cathodebnode) ; |
d15a28e7 |
518 | // g. printed circuit |
92862013 |
519 | y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ; |
d15a28e7 |
520 | sprintf(nodename, "%s%d", "PCb", i) ; |
92862013 |
521 | TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ; |
522 | pcbnode->SetLineColor(kColorPPSD) ; |
523 | fNodes->Add(pcbnode) ; |
d15a28e7 |
524 | // h. composite pane |
92862013 |
525 | y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; |
d15a28e7 |
526 | sprintf(nodename, "%s%d", "CompDownb", i) ; |
92862013 |
527 | TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ; |
528 | compdownbnode->SetLineColor(kColorPPSD) ; |
529 | fNodes->Add(compdownbnode) ; |
530 | z = z - fGeom->GetPPSDModuleSize(2) ; |
531 | ppsdboxnode->cd() ; |
d15a28e7 |
532 | } // end of Z module loop |
92862013 |
533 | x = x - fGeom->GetPPSDModuleSize(0) ; |
534 | ppsdboxnode->cd() ; |
d15a28e7 |
535 | } // end of phi module loop |
536 | } // PHOS modules |
537 | delete rotname ; |
538 | delete nodename ; |
fe4da5cc |
539 | } |
540 | |
d15a28e7 |
541 | //____________________________________________________________________________ |
fe4da5cc |
542 | void AliPHOSv0::CreateGeometry() |
543 | { |
d15a28e7 |
544 | |
92862013 |
545 | AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ; |
d15a28e7 |
546 | |
92862013 |
547 | if ( phostmp == NULL ) { |
d15a28e7 |
548 | |
549 | fprintf(stderr, "PHOS detector not found!\n") ; |
550 | return; |
fe4da5cc |
551 | |
d15a28e7 |
552 | } |
553 | |
554 | // Get pointer to the array containing media indeces |
92862013 |
555 | Int_t *idtmed = fIdtmed->GetArray() - 699 ; |
d15a28e7 |
556 | |
92862013 |
557 | Float_t bigbox[3] ; |
558 | bigbox[0] = fGeom->GetOuterBoxSize(0) / 2.0 ; |
559 | bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ; |
560 | bigbox[2] = fGeom->GetOuterBoxSize(2) / 2.0 ; |
d15a28e7 |
561 | |
92862013 |
562 | gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ; |
d15a28e7 |
563 | |
564 | this->CreateGeometryforPHOS() ; |
565 | if ( strcmp( fGeom->GetName(), "GPS2") == 0 ) |
566 | this->CreateGeometryforPPSD() ; |
567 | else |
568 | cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl; |
569 | |
570 | // --- Position PHOS mdules in ALICE setup --- |
571 | |
92862013 |
572 | Int_t idrotm[99] ; |
573 | Double_t const kRADDEG = 180.0 / kPI ; |
d15a28e7 |
574 | |
575 | for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { |
576 | |
577 | Float_t angle = fGeom->GetPHOSAngle(i) ; |
92862013 |
578 | AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ; |
d15a28e7 |
579 | |
92862013 |
580 | Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ; |
d15a28e7 |
581 | |
92862013 |
582 | Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ; |
583 | Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ; |
d15a28e7 |
584 | |
92862013 |
585 | gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ; |
d15a28e7 |
586 | |
587 | } // for GetNModules |
588 | |
fe4da5cc |
589 | } |
d15a28e7 |
590 | |
591 | //____________________________________________________________________________ |
592 | void AliPHOSv0::CreateGeometryforPHOS() |
593 | { |
594 | // Get pointer to the array containing media indeces |
92862013 |
595 | Int_t *idtmed = fIdtmed->GetArray() - 699 ; |
d15a28e7 |
596 | |
597 | // --- |
598 | // --- Define PHOS box volume, fPUFPill with thermo insulating foam --- |
599 | // --- Foam Thermo Insulating outer cover dimensions --- |
92862013 |
600 | // --- Put it in bigbox = PHOS |
d15a28e7 |
601 | |
92862013 |
602 | Float_t dphos[3] ; |
603 | dphos[0] = fGeom->GetOuterBoxSize(0) / 2.0 ; |
604 | dphos[1] = fGeom->GetOuterBoxSize(1) / 2.0 ; |
605 | dphos[2] = fGeom->GetOuterBoxSize(2) / 2.0 ; |
d15a28e7 |
606 | |
92862013 |
607 | gMC->Gsvolu("EMCA", "BOX ", idtmed[706], dphos, 3) ; |
d15a28e7 |
608 | |
92862013 |
609 | Float_t yO = - fGeom->GetPPSDBoxSize(1) / 2.0 ; |
d15a28e7 |
610 | |
92862013 |
611 | gMC->Gspos("EMCA", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
612 | |
613 | // --- |
614 | // --- Define Textolit Wall box, position inside EMCA --- |
615 | // --- Textolit Wall box dimentions --- |
616 | |
617 | |
92862013 |
618 | Float_t dptxw[3]; |
619 | dptxw[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ; |
620 | dptxw[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ; |
621 | dptxw[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ; |
d15a28e7 |
622 | |
92862013 |
623 | gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3); |
d15a28e7 |
624 | |
92862013 |
625 | yO = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ; |
d15a28e7 |
626 | |
92862013 |
627 | gMC->Gspos("PTXW", 1, "EMCA", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
628 | |
629 | // --- |
630 | // --- Define Upper Polystyrene Foam Plate, place inside PTXW --- |
631 | // --- immediately below Foam Thermo Insulation Upper plate --- |
632 | |
633 | // --- Upper Polystyrene Foam plate thickness --- |
634 | |
92862013 |
635 | Float_t dpufp[3] ; |
636 | dpufp[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ; |
637 | dpufp[1] = fGeom->GetSecondUpperPlateThickness() / 2. ; |
638 | dpufp[2] = fGeom->GetTextolitBoxSize(2) /2.0 ; |
d15a28e7 |
639 | |
92862013 |
640 | gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ; |
d15a28e7 |
641 | |
92862013 |
642 | yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ; |
d15a28e7 |
643 | |
92862013 |
644 | gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
645 | |
646 | // --- |
647 | // --- Define air-filled box, place inside PTXW --- |
648 | // --- Inner AIR volume dimensions --- |
fe4da5cc |
649 | |
d15a28e7 |
650 | |
92862013 |
651 | Float_t dpair[3] ; |
652 | dpair[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ; |
653 | dpair[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ; |
654 | dpair[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ; |
d15a28e7 |
655 | |
92862013 |
656 | gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ; |
d15a28e7 |
657 | |
92862013 |
658 | yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ; |
d15a28e7 |
659 | |
92862013 |
660 | gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
661 | |
662 | // --- Dimensions of PbWO4 crystal --- |
663 | |
92862013 |
664 | Float_t xtlX = fGeom->GetCrystalSize(0) ; |
665 | Float_t xtlY = fGeom->GetCrystalSize(1) ; |
666 | Float_t xtlZ = fGeom->GetCrystalSize(2) ; |
d15a28e7 |
667 | |
92862013 |
668 | Float_t dptcb[3] ; |
669 | dptcb[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ; |
670 | dptcb[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 |
d15a28e7 |
671 | + fGeom->GetModuleBoxThickness() / 2.0 ; |
92862013 |
672 | dptcb[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ; |
d15a28e7 |
673 | |
92862013 |
674 | gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ; |
d15a28e7 |
675 | |
92862013 |
676 | yO = fGeom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1] |
d15a28e7 |
677 | - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness() |
678 | - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ; |
679 | |
92862013 |
680 | gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
681 | |
682 | // --- |
683 | // --- Define Crystal BLock filled with air, position it inside PTCB --- |
92862013 |
684 | Float_t dpcbl[3] ; |
d15a28e7 |
685 | |
92862013 |
686 | dpcbl[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ; |
687 | dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ; |
688 | dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ; |
d15a28e7 |
689 | |
92862013 |
690 | gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ; |
d15a28e7 |
691 | |
692 | // --- Divide PCBL in X (phi) and Z directions -- |
693 | gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ; |
694 | gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ; |
695 | |
92862013 |
696 | yO = -fGeom->GetModuleBoxThickness() / 2.0 ; |
d15a28e7 |
697 | |
92862013 |
698 | gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
699 | |
700 | // --- |
701 | // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL |
92862013 |
702 | Float_t dpstc[3] ; |
d15a28e7 |
703 | |
92862013 |
704 | dpstc[0] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ; |
705 | dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ; |
706 | dpstc[2] = ( xtlZ + 2 * fGeom->GetCrystalWrapThickness() + 2 * fGeom->GetCrystalHolderThickness() ) / 2.0 ; |
d15a28e7 |
707 | |
92862013 |
708 | gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ; |
d15a28e7 |
709 | |
710 | gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ; |
711 | |
712 | // --- |
713 | // --- Define Tyvek volume, place inside PSTC --- |
92862013 |
714 | Float_t dppap[3] ; |
d15a28e7 |
715 | |
92862013 |
716 | dppap[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ; |
717 | dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ; |
718 | dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ; |
d15a28e7 |
719 | |
92862013 |
720 | gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ; |
d15a28e7 |
721 | |
92862013 |
722 | yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 |
723 | - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ; |
d15a28e7 |
724 | |
92862013 |
725 | gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
726 | |
727 | // --- |
728 | // --- Define PbWO4 crystal volume, place inside PPAP --- |
92862013 |
729 | Float_t dpxtl[3] ; |
d15a28e7 |
730 | |
92862013 |
731 | dpxtl[0] = xtlX / 2.0 ; |
732 | dpxtl[1] = xtlY / 2.0 ; |
733 | dpxtl[2] = xtlZ / 2.0 ; |
d15a28e7 |
734 | |
92862013 |
735 | gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ; |
d15a28e7 |
736 | |
92862013 |
737 | yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - fGeom->GetCrystalWrapThickness() ; |
d15a28e7 |
738 | |
92862013 |
739 | gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
740 | |
741 | // --- |
742 | // --- Define crystal support volume, place inside PPAP --- |
92862013 |
743 | Float_t dpsup[3] ; |
d15a28e7 |
744 | |
92862013 |
745 | dpsup[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ; |
746 | dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ; |
747 | dpsup[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ; |
d15a28e7 |
748 | |
92862013 |
749 | gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ; |
d15a28e7 |
750 | |
92862013 |
751 | yO = fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ; |
d15a28e7 |
752 | |
92862013 |
753 | gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
754 | |
755 | // --- |
756 | // --- Define PIN-diode volume and position it inside crystal support --- |
757 | // --- right behind PbWO4 crystal |
758 | |
759 | // --- PIN-diode dimensions --- |
760 | |
761 | |
92862013 |
762 | Float_t dppin[3] ; |
763 | dppin[0] = fGeom->GetPinDiodeSize(0) / 2.0 ; |
764 | dppin[1] = fGeom->GetPinDiodeSize(1) / 2.0 ; |
765 | dppin[2] = fGeom->GetPinDiodeSize(2) / 2.0 ; |
d15a28e7 |
766 | |
92862013 |
767 | gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ; |
d15a28e7 |
768 | |
92862013 |
769 | yO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ; |
d15a28e7 |
770 | |
92862013 |
771 | gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
772 | |
773 | // --- |
774 | // --- Define Upper Cooling Panel, place it on top of PTCB --- |
92862013 |
775 | Float_t dpucp[3] ; |
d15a28e7 |
776 | // --- Upper Cooling Plate thickness --- |
777 | |
92862013 |
778 | dpucp[0] = dptcb[0] ; |
779 | dpucp[1] = fGeom->GetUpperCoolingPlateThickness() ; |
780 | dpucp[2] = dptcb[2] ; |
d15a28e7 |
781 | |
92862013 |
782 | gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ; |
d15a28e7 |
783 | |
92862013 |
784 | yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetUpperCoolingPlateThickness() ) / 2. |
d15a28e7 |
785 | - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness() |
786 | - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ; |
787 | |
92862013 |
788 | gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
789 | |
790 | // --- |
791 | // --- Define Al Support Plate, position it inside PAIR --- |
792 | // --- right beneath PTCB --- |
793 | // --- Al Support Plate thickness --- |
794 | |
92862013 |
795 | Float_t dpasp[3] ; |
796 | dpasp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ; |
797 | dpasp[1] = fGeom->GetSupportPlateThickness() / 2.0 ; |
798 | dpasp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ; |
d15a28e7 |
799 | |
92862013 |
800 | gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ; |
d15a28e7 |
801 | |
92862013 |
802 | yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2. |
d15a28e7 |
803 | - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() |
92862013 |
804 | - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ; |
d15a28e7 |
805 | |
92862013 |
806 | gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
807 | |
808 | // --- |
809 | // --- Define Thermo Insulating Plate, position it inside PAIR --- |
810 | // --- right beneath PASP --- |
811 | // --- Lower Thermo Insulating Plate thickness --- |
812 | |
92862013 |
813 | Float_t dptip[3] ; |
814 | dptip[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ; |
815 | dptip[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ; |
816 | dptip[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ; |
d15a28e7 |
817 | |
92862013 |
818 | gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ; |
d15a28e7 |
819 | |
92862013 |
820 | yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2. |
d15a28e7 |
821 | - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness() |
92862013 |
822 | - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() ) ; |
d15a28e7 |
823 | |
92862013 |
824 | gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
825 | |
826 | // --- |
827 | // --- Define Textolit Plate, position it inside PAIR --- |
828 | // --- right beneath PTIP --- |
829 | // --- Lower Textolit Plate thickness --- |
830 | |
92862013 |
831 | Float_t dptxp[3] ; |
832 | dptxp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ; |
833 | dptxp[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ; |
834 | dptxp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ; |
d15a28e7 |
835 | |
92862013 |
836 | gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ; |
d15a28e7 |
837 | |
92862013 |
838 | yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2. |
d15a28e7 |
839 | - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness() |
92862013 |
840 | - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() |
d15a28e7 |
841 | + fGeom->GetLowerThermoPlateThickness() ) ; |
842 | |
92862013 |
843 | gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
844 | |
845 | } |
846 | |
847 | //____________________________________________________________________________ |
848 | void AliPHOSv0::CreateGeometryforPPSD() |
fe4da5cc |
849 | { |
d15a28e7 |
850 | // Get pointer to the array containing media indeces |
92862013 |
851 | Int_t *idtmed = fIdtmed->GetArray() - 699 ; |
d15a28e7 |
852 | |
92862013 |
853 | // The box containing all ppsd's for one PHOS module filled with air |
854 | Float_t ppsd[3] ; |
855 | ppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ; |
856 | ppsd[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ; |
857 | ppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ; |
fe4da5cc |
858 | |
92862013 |
859 | gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ; |
d15a28e7 |
860 | |
92862013 |
861 | Float_t yO = fGeom->GetOuterBoxSize(1) / 2.0 ; |
d15a28e7 |
862 | |
92862013 |
863 | gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ; |
d15a28e7 |
864 | |
865 | // Now we build a micromegas module |
866 | // The box containing the whole module filled with epoxy (FR4) |
867 | |
92862013 |
868 | Float_t mppsd[3] ; |
869 | mppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ; |
870 | mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ; |
871 | mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ; |
d15a28e7 |
872 | |
92862013 |
873 | gMC->Gsvolu("MPPS", "BOX ", idtmed[708], mppsd, 3) ; |
d15a28e7 |
874 | |
92862013 |
875 | // Inside mppsd : |
d15a28e7 |
876 | // 1. The Top Lid made of epoxy (FR4) |
877 | |
92862013 |
878 | Float_t tlppsd[3] ; |
879 | tlppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ; |
880 | tlppsd[1] = fGeom->GetLidThickness() / 2.0 ; |
881 | tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ; |
d15a28e7 |
882 | |
92862013 |
883 | gMC->Gsvolu("TLPS", "BOX ", idtmed[708], tlppsd, 3) ; |
d15a28e7 |
884 | |
92862013 |
885 | Float_t y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ; |
d15a28e7 |
886 | |
92862013 |
887 | gMC->Gspos("TLPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; |
d15a28e7 |
888 | |
889 | // 2. the upper panel made of composite material |
890 | |
92862013 |
891 | Float_t upppsd[3] ; |
892 | upppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
893 | upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ; |
894 | upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
d15a28e7 |
895 | |
92862013 |
896 | gMC->Gsvolu("UPPS", "BOX ", idtmed[709], upppsd, 3) ; |
d15a28e7 |
897 | |
92862013 |
898 | y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; |
d15a28e7 |
899 | |
92862013 |
900 | gMC->Gspos("UPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; |
d15a28e7 |
901 | |
902 | // 3. the anode made of Copper |
903 | |
92862013 |
904 | Float_t anppsd[3] ; |
905 | anppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
906 | anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ; |
907 | anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
d15a28e7 |
908 | |
92862013 |
909 | gMC->Gsvolu("ANPS", "BOX ", idtmed[710], anppsd, 3) ; |
d15a28e7 |
910 | |
92862013 |
911 | y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ; |
d15a28e7 |
912 | |
92862013 |
913 | gMC->Gspos("ANPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; |
d15a28e7 |
914 | |
915 | // 4. the conversion gap + avalanche gap filled with gas |
916 | |
92862013 |
917 | Float_t ggppsd[3] ; |
918 | ggppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
919 | ggppsd[1] = ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2.0 ; |
920 | ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
d15a28e7 |
921 | |
92862013 |
922 | gMC->Gsvolu("GGPS", "BOX ", idtmed[715], ggppsd, 3) ; |
d15a28e7 |
923 | |
924 | // --- Divide GGPP in X (phi) and Z directions -- |
925 | gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ; |
926 | gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ; |
927 | |
92862013 |
928 | y0 = y0 - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ; |
d15a28e7 |
929 | |
92862013 |
930 | gMC->Gspos("GGPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; |
d15a28e7 |
931 | |
932 | |
933 | // 6. the cathode made of Copper |
934 | |
92862013 |
935 | Float_t cappsd[3] ; |
936 | cappsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
937 | cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ; |
938 | cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
d15a28e7 |
939 | |
92862013 |
940 | gMC->Gsvolu("CAPS", "BOX ", idtmed[710], cappsd, 3) ; |
d15a28e7 |
941 | |
92862013 |
942 | y0 = y0 - ( fGeom->GetAvalancheGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ; |
d15a28e7 |
943 | |
92862013 |
944 | gMC->Gspos("CAPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; |
d15a28e7 |
945 | |
946 | // 7. the printed circuit made of G10 |
947 | |
92862013 |
948 | Float_t pcppsd[3] ; |
949 | pcppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ; |
950 | pcppsd[1] = fGeom->GetPCThickness() / 2.0 ; |
951 | pcppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
d15a28e7 |
952 | |
92862013 |
953 | gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ; |
d15a28e7 |
954 | |
92862013 |
955 | y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ; |
d15a28e7 |
956 | |
92862013 |
957 | gMC->Gspos("PCPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; |
d15a28e7 |
958 | |
959 | // 8. the lower panel made of composite material |
960 | |
92862013 |
961 | Float_t lpppsd[3] ; |
962 | lpppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
963 | lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ; |
964 | lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ; |
d15a28e7 |
965 | |
92862013 |
966 | gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ; |
d15a28e7 |
967 | |
92862013 |
968 | y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; |
d15a28e7 |
969 | |
92862013 |
970 | gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; |
d15a28e7 |
971 | |
92862013 |
972 | // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module |
d15a28e7 |
973 | // the top and bottom one's (which are assumed identical) : |
974 | |
92862013 |
975 | Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ; |
976 | Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ; |
d15a28e7 |
977 | |
92862013 |
978 | Int_t copyNumbertop = 0 ; |
979 | Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ; |
d15a28e7 |
980 | |
92862013 |
981 | Float_t x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ; |
d15a28e7 |
982 | |
983 | for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module |
92862013 |
984 | Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ; |
d15a28e7 |
985 | |
986 | for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module |
92862013 |
987 | gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ; |
988 | gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ; |
989 | z = z - fGeom->GetPPSDModuleSize(2) ; |
d15a28e7 |
990 | } // end of Z module loop |
92862013 |
991 | x = x - fGeom->GetPPSDModuleSize(0) ; |
d15a28e7 |
992 | } // end of phi module loop |
993 | |
994 | // The Lead converter between two air gaps |
995 | // 1. Upper air gap |
996 | |
92862013 |
997 | Float_t uappsd[3] ; |
998 | uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ; |
999 | uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ; |
1000 | uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ; |
d15a28e7 |
1001 | |
92862013 |
1002 | gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ; |
d15a28e7 |
1003 | |
92862013 |
1004 | y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ; |
d15a28e7 |
1005 | |
92862013 |
1006 | gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; |
d15a28e7 |
1007 | |
1008 | // 2. Lead converter |
1009 | |
92862013 |
1010 | Float_t lcppsd[3] ; |
1011 | lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ; |
1012 | lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ; |
1013 | lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ; |
d15a28e7 |
1014 | |
92862013 |
1015 | gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ; |
d15a28e7 |
1016 | |
92862013 |
1017 | y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ; |
d15a28e7 |
1018 | |
92862013 |
1019 | gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; |
d15a28e7 |
1020 | |
1021 | // 3. Lower air gap |
1022 | |
92862013 |
1023 | Float_t lappsd[3] ; |
1024 | lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ; |
1025 | lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ; |
1026 | lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ; |
d15a28e7 |
1027 | |
92862013 |
1028 | gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ; |
fe4da5cc |
1029 | |
92862013 |
1030 | y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ; |
d15a28e7 |
1031 | |
92862013 |
1032 | gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; |
d15a28e7 |
1033 | |
fe4da5cc |
1034 | } |
1035 | |
d15a28e7 |
1036 | //___________________________________________________________________________ |
1037 | Int_t AliPHOSv0::Digitize(Float_t Energy){ |
9f616d61 |
1038 | Float_t fB = 100000000. ; |
d15a28e7 |
1039 | Float_t fA = 0. ; |
1040 | Int_t chan = Int_t(fA + Energy*fB ) ; |
1041 | return chan ; |
1042 | } |
1043 | //___________________________________________________________________________ |
1044 | void AliPHOSv0::FinishEvent() |
fe4da5cc |
1045 | { |
26d4b141 |
1046 | // cout << "//_____________________________________________________" << endl ; |
1047 | // cout << "<I> AliPHOSv0::FinishEvent() -- Starting digitalization" << endl ; |
d15a28e7 |
1048 | Int_t i ; |
cf239357 |
1049 | Int_t relid[4]; |
ff4c968a |
1050 | Int_t j ; |
d15a28e7 |
1051 | TClonesArray &lDigits = *fDigits ; |
92862013 |
1052 | AliPHOSHit * hit ; |
ff4c968a |
1053 | AliPHOSDigit * newdigit ; |
1054 | AliPHOSDigit * curdigit ; |
1055 | Bool_t deja = kFALSE ; |
fe4da5cc |
1056 | |
d15a28e7 |
1057 | for ( i = 0 ; i < fNTmpHits ; i++ ) { |
92862013 |
1058 | hit = (AliPHOSHit*)fTmpHits->At(i) ; |
ff4c968a |
1059 | newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ; |
6a72c964 |
1060 | deja =kFALSE ; |
ff4c968a |
1061 | for ( j = 0 ; j < fNdigits ; j++) { |
cf239357 |
1062 | curdigit = (AliPHOSDigit*) lDigits[j] ; |
ff4c968a |
1063 | if ( *curdigit == *newdigit) { |
cf239357 |
1064 | *curdigit = *curdigit + *newdigit ; |
ff4c968a |
1065 | deja = kTRUE ; |
1066 | } |
1067 | } |
d1232693 |
1068 | if ( !deja ) { |
ff4c968a |
1069 | new(lDigits[fNdigits]) AliPHOSDigit(* newdigit) ; |
1070 | fNdigits++ ; |
1071 | } |
1072 | |
1073 | delete newdigit ; |
0869cea5 |
1074 | } |
ff4c968a |
1075 | |
cf239357 |
1076 | // Noise induced by the PIN diode of the PbWO crystals |
26d4b141 |
1077 | |
0869cea5 |
1078 | Float_t energyandnoise ; |
1079 | for ( i = 0 ; i < fNdigits ; i++ ) { |
ff4c968a |
1080 | newdigit = (AliPHOSDigit * ) fDigits->At(i) ; |
cf239357 |
1081 | fGeom->AbsToRelNumbering(newdigit->GetId(), relid) ; |
ae37f159 |
1082 | |
cf239357 |
1083 | if (relid[1]==0){ // Digits belong to EMC (PbW0_4 crystals) |
3a6a7952 |
1084 | energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPinElectronicNoise)) ; |
ae37f159 |
1085 | |
cf239357 |
1086 | if (energyandnoise < 0 ) |
1087 | energyandnoise = 0 ; |
ae37f159 |
1088 | |
cf239357 |
1089 | newdigit->SetAmp(energyandnoise) ; |
ae37f159 |
1090 | |
1091 | if ( newdigit->GetAmp() < fDigitThreshold ) // if threshold not surpassed, remove digit from list |
1092 | fDigits->RemoveAt(i) ; |
cf239357 |
1093 | } |
fe4da5cc |
1094 | } |
ae37f159 |
1095 | fDigits->Compress() ; |
d15a28e7 |
1096 | fNTmpHits = 0 ; |
1097 | fTmpHits->Delete(); |
fe4da5cc |
1098 | } |
d15a28e7 |
1099 | |
1100 | //____________________________________________________________________________ |
1101 | void AliPHOSv0::Init(void) |
1102 | { |
1103 | |
1104 | Int_t i; |
1105 | |
1106 | printf("\n"); |
1107 | for(i=0;i<35;i++) printf("*"); |
1108 | printf(" PHOS_INIT "); |
1109 | for(i=0;i<35;i++) printf("*"); |
1110 | printf("\n"); |
1111 | |
1112 | // Here the PHOS initialisation code (if any!) |
1113 | |
1114 | for(i=0;i<80;i++) printf("*"); |
1115 | printf("\n"); |
1116 | |
1117 | } |
1118 | |
1119 | //___________________________________________________________________________ |
1120 | void AliPHOSv0::MakeBranch(Option_t* opt) |
1121 | { |
1122 | // |
1123 | // Create a new branch in the current Root Tree |
1124 | // The branch of fHits is automatically split |
1125 | // |
1126 | AliDetector::MakeBranch(opt) ; |
1127 | |
1128 | char branchname[10]; |
1129 | sprintf(branchname,"%s",GetName()); |
c198e326 |
1130 | char *cdD = strstr(opt,"D"); |
d15a28e7 |
1131 | |
c198e326 |
1132 | if (fDigits && gAlice->TreeD() && cdD) { |
d15a28e7 |
1133 | gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize); |
c198e326 |
1134 | } |
1135 | char *cdR = strstr(opt,"R"); |
1136 | if (fRecParticles && gAlice->TreeR() && cdR) { |
1137 | gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize); |
d15a28e7 |
1138 | } |
1139 | } |
d15a28e7 |
1140 | |
9f616d61 |
1141 | //_____________________________________________________________________________ |
6ad0bfa0 |
1142 | void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner) |
d15a28e7 |
1143 | { |
9f616d61 |
1144 | // reinitializes the existing RecPoint Lists and steers the reconstruction processes |
d15a28e7 |
1145 | |
6ad0bfa0 |
1146 | fReconstructioner = Reconstructioner ; |
1147 | |
9f616d61 |
1148 | if (fEmcClusters) { |
1149 | fEmcClusters->Delete() ; |
1150 | delete fEmcClusters ; |
1151 | fEmcClusters = 0 ; |
9f616d61 |
1152 | } |
1153 | fEmcClusters= new RecPointsList("AliPHOSEmcRecPoint", 100) ; |
1154 | |
9f616d61 |
1155 | if (fPpsdClusters) { |
1156 | fPpsdClusters->Delete() ; |
1157 | delete fPpsdClusters ; |
1158 | fPpsdClusters = 0 ; |
1159 | } |
1160 | fPpsdClusters = new RecPointsList("AliPHOSPpsdRecPoint", 100) ; |
1161 | |
6ad0bfa0 |
1162 | if (fTrackSegments) { |
9f616d61 |
1163 | fTrackSegments->Delete() ; |
1164 | delete fTrackSegments ; |
1165 | fTrackSegments = 0 ; |
1166 | } |
6ad0bfa0 |
1167 | fTrackSegments = new TrackSegmentsList(100) ; |
1168 | |
1169 | if (fRecParticles) { |
1170 | fRecParticles->Delete() ; |
1171 | delete fRecParticles ; |
1172 | fRecParticles = 0 ; |
1173 | } |
1174 | fRecParticles = new RecParticlesList("AliPHOSRecParticle", 100) ; |
1175 | |
1176 | fReconstructioner->Make(fDigits, fEmcClusters, fPpsdClusters, fTrackSegments, fRecParticles); |
9f616d61 |
1177 | |
d15a28e7 |
1178 | } |
1179 | |
1180 | //____________________________________________________________________________ |
1181 | void AliPHOSv0::StepManager(void) |
1182 | { |
92862013 |
1183 | Int_t relid[4] ; // (box, layer, row, column) indices |
d15a28e7 |
1184 | Float_t xyze[4] ; // position wrt MRS and energy deposited |
1185 | TLorentzVector pos ; |
ff4c968a |
1186 | Int_t copy ; |
d15a28e7 |
1187 | |
ff4c968a |
1188 | Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() ); |
d15a28e7 |
1189 | TString name = fGeom->GetName() ; |
1190 | |
1191 | if ( name == "GPS2" ) { // the CPV is a PPSD |
1192 | if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) |
d15a28e7 |
1193 | { |
1194 | gMC->TrackPosition(pos) ; |
1195 | xyze[0] = pos[0] ; |
1196 | xyze[1] = pos[1] ; |
1197 | xyze[2] = pos[2] ; |
1198 | xyze[3] = gMC->Edep() ; |
1199 | |
1200 | if ( xyze[3] != 0 ) { // there is deposited energy |
92862013 |
1201 | gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number |
1202 | gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number |
d15a28e7 |
1203 | // 1-> Geom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper |
1204 | // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower |
92862013 |
1205 | gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell |
1206 | gMC->CurrentVolID(relid[3]) ; // get the column number |
d15a28e7 |
1207 | |
1208 | // get the absolute Id number |
1209 | |
92862013 |
1210 | Int_t absid ; |
ff4c968a |
1211 | fGeom->RelToAbsNumbering(relid, absid) ; |
d15a28e7 |
1212 | |
1213 | // add current hit to the hit list |
ff4c968a |
1214 | AddHit(primary, absid, xyze); |
d15a28e7 |
1215 | |
1216 | } // there is deposited energy |
1217 | } // We are inside the gas of the CPV |
1218 | } // GPS2 configuration |
1219 | |
ff4c968a |
1220 | if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) // We are inside a PBWO crystal |
d15a28e7 |
1221 | { |
1222 | gMC->TrackPosition(pos) ; |
1223 | xyze[0] = pos[0] ; |
1224 | xyze[1] = pos[1] ; |
1225 | xyze[2] = pos[2] ; |
1226 | xyze[3] = gMC->Edep() ; |
1227 | |
1228 | if ( xyze[3] != 0 ) { |
92862013 |
1229 | gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ; |
ff4c968a |
1230 | relid[1] = 0 ; // means PBW04 |
92862013 |
1231 | gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module |
1232 | gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module |
d15a28e7 |
1233 | |
1234 | // get the absolute Id number |
1235 | |
92862013 |
1236 | Int_t absid ; |
1237 | fGeom->RelToAbsNumbering(relid, absid) ; |
d15a28e7 |
1238 | |
1239 | // add current hit to the hit list |
1240 | |
ff4c968a |
1241 | AddHit(primary, absid, xyze); |
d15a28e7 |
1242 | |
1243 | } // there is deposited energy |
1244 | } // we are inside a PHOS Xtal |
1245 | } |
1246 | |