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