SDigits has become a copy of hits and threshold to associate primary particles has...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.cxx
CommitLineData
2012850d 1/**************************************************************************
a1469a24 2
2012850d 3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
a1469a24 4
2012850d 5 * *
a1469a24 6
2012850d 7 * Author: The ALICE Off-line Project. *
a1469a24 8
2012850d 9 * Contributors are mentioned in the code where appropriate. *
a1469a24 10
2012850d 11 * *
a1469a24 12
2012850d 13 * Permission to use, copy, modify and distribute this software and its *
a1469a24 14
2012850d 15 * documentation strictly for non-commercial purposes is hereby granted *
a1469a24 16
2012850d 17 * without fee, provided that the above copyright notice appears in all *
a1469a24 18
2012850d 19 * copies and that both the copyright notice and this permission notice *
a1469a24 20
2012850d 21 * appear in the supporting documentation. The authors make no claims *
a1469a24 22
2012850d 23 * about the suitability of this software for any purpose. It is *
a1469a24 24
2012850d 25 * provided "as is" without express or implied warranty. *
a1469a24 26
2012850d 27 **************************************************************************/
28
a1469a24 29
30
2012850d 31/* $Id$ */
32
a1469a24 33
34
2012850d 35//_________________________________________________________________________
a1469a24 36
2012850d 37// Implementation version v0 of EMCAL Manager class
a1469a24 38
2012850d 39// An object of this class does not produce hits nor digits
a1469a24 40
2012850d 41// It is the one to use if you do not want to produce outputs in TREEH or TREED
a1469a24 42
ffa6d63b 43// This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx
a1469a24 44
2012850d 45//*-- Author: Yves Schutz (SUBATECH)
a1469a24 46
b13bbe81 47//*-- and : Sahal Yacoob (LBL / UCT)
2012850d 48
a1469a24 49
50
09641ef5 51// This Version of AliEMCALv0 reduces the number of volumes placed in XEN1 (the envelope) to less than five hundred
a1469a24 52
09641ef5 53// The Envelope is Placed in Alice, And the Aluminium layer. Mini envelopes (XU) are then placed in XEN1.
a1469a24 54
09641ef5 55// Each mini envelope contains 2 scintillator, and 2 lead layers, except the last one which contains just one scintillator layer.
a1469a24 56
09641ef5 57// At the moment I cannot place the 36 and above layers in the mini envelopes so all layers are still placed in XEN1
58
59
a1469a24 60
61
62
2012850d 63// --- ROOT system ---
a1469a24 64
b13bbe81 65#include "TPGON.h"
a1469a24 66
2012850d 67#include "TTUBS.h"
a1469a24 68
2012850d 69#include "TNode.h"
a1469a24 70
2012850d 71#include "TRandom.h"
a1469a24 72
2012850d 73#include "TGeometry.h"
a1469a24 74
09641ef5 75//#include "Tstring.h"
2012850d 76
a1469a24 77
78
2012850d 79// --- Standard library ---
80
a1469a24 81
82
b13bbe81 83#include <stdio.h>
a1469a24 84
b13bbe81 85#include <string.h>
a1469a24 86
b13bbe81 87#include <stdlib.h>
a1469a24 88
b13bbe81 89#include <strstream.h>
a1469a24 90
b13bbe81 91#include <iostream.h>
2012850d 92
a1469a24 93
94
2012850d 95// --- AliRoot header files ---
96
a1469a24 97
98
2012850d 99#include "AliEMCALv0.h"
a1469a24 100
2012850d 101#include "AliEMCALGeometry.h"
a1469a24 102
b13bbe81 103#include "AliConst.h"
a1469a24 104
2012850d 105#include "AliRun.h"
a1469a24 106
2012850d 107#include "AliMC.h"
108
a1469a24 109
110
2012850d 111ClassImp(AliEMCALv0)
112
a1469a24 113
114
b13bbe81 115//______________________________________________________________________
a1469a24 116
2012850d 117AliEMCALv0::AliEMCALv0(const char *name, const char *title):
a1469a24 118
b13bbe81 119 AliEMCAL(name,title){
a1469a24 120
b13bbe81 121 // Standard Constructor
2012850d 122
a1469a24 123
124
b13bbe81 125 if (strcmp(GetTitle(),"") != 0 )
a1469a24 126
b13bbe81 127 fGeom = AliEMCALGeometry::GetInstance(GetTitle(), "") ;
61e0abb5 128
a1469a24 129
130
2012850d 131}
a1469a24 132
b13bbe81 133//______________________________________________________________________
a1469a24 134
b13bbe81 135void AliEMCALv0::BuildGeometry(){
a1469a24 136
b13bbe81 137 // Display Geometry for display.C
2012850d 138
a1469a24 139
140
b13bbe81 141 const Int_t kColorArm1 = kBlue ;
91e9918b 142
a1469a24 143
144
ffa6d63b 145 // Difine the shape of the Calorimeter
a1469a24 146
2012850d 147
a1469a24 148
b13bbe81 149 new TTUBS("Envelop1", "Tubs that contains arm 1", "void",
a1469a24 150
b13bbe81 151 fGeom->GetEnvelop(0), // rmin
a1469a24 152
b13bbe81 153 fGeom->GetEnvelop(1) +30 , // rmax
a1469a24 154
b13bbe81 155 fGeom->GetEnvelop(2)/2.0, // half length in Z
a1469a24 156
b13bbe81 157 fGeom->GetArm1PhiMin(), // minimun phi angle
a1469a24 158
b13bbe81 159 fGeom->GetArm1PhiMax() // maximun phi angle
a1469a24 160
b13bbe81 161 );
a1469a24 162
ffa6d63b 163 // Place the Node
a1469a24 164
b13bbe81 165 TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ;
a1469a24 166
b13bbe81 167 envelop1node->SetLineColor(kColorArm1) ;
a1469a24 168
b13bbe81 169 fNodes->Add(envelop1node) ;
a1469a24 170
2012850d 171}
a1469a24 172
b13bbe81 173//______________________________________________________________________
a1469a24 174
b13bbe81 175void AliEMCALv0::CreateGeometry(){
a1469a24 176
b13bbe81 177 // Create the EMCAL geometry for Geant
2012850d 178
a1469a24 179 Float_t etamin,etamax;
180
181
182
156eff25 183 if(!(fGeom->IsInitialized())){
a1469a24 184
185 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
2012850d 186
b13bbe81 187 } // end if
a1469a24 188
b13bbe81 189 // Get pointer to the array containing media indices
a1469a24 190
b13bbe81 191 Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
e13bd4f0 192
a1469a24 193
194
ffa6d63b 195 // Create an Envelope within which to place the Detector
a1469a24 196
2012850d 197
a1469a24 198
199 Float_t envelopA[5];
200
201 envelopA[0] = fGeom->GetEnvelop(0); // rmin
202
203 envelopA[1] = fGeom->GetEnvelop(1); // rmax
204
205 envelopA[2] = fGeom->GetEnvelop(2)/2.0; // dz
206
207 envelopA[3] = fGeom->GetArm1PhiMin(); // minimun phi angle
208
209 envelopA[4] = fGeom->GetArm1PhiMax(); // maximun phi angle
210
211
212
213 // create XEN1
214
b13bbe81 215 gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; //filled with air
a1469a24 216
217
218
09641ef5 219 Int_t idrotm = 1;
a1469a24 220
09641ef5 221 AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
222
a1469a24 223
224
225 // Position the EMCAL Mother Volume in Alice
226
71d7e6ad 227 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
a1469a24 228
229
230
231 //
232
09641ef5 233 TString label = "XU0";
234
09641ef5 235
09641ef5 236
a1469a24 237 //rmin Start mini envelopes after the aluminium layer
09641ef5 238
a1469a24 239 envelopA[0] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active() +
09641ef5 240
a1469a24 241 fGeom->GetAlFrontThickness();
09641ef5 242
a1469a24 243 //rmax larger for first two layers (preshower);
b13bbe81 244
a1469a24 245 Float_t tseg = fGeom->GetPreSintThick()+fGeom->GetPbRadThick();
246
247 envelopA[1] = envelopA[0] + 2.0*tseg;
248
249 envelopA[2] = fGeom->GetEnvelop(2)/2.0; // dz
250
251 envelopA[3] = fGeom->GetArm1PhiMin(); // minimun phi angle
252
253 envelopA[4] = fGeom->GetArm1PhiMax(); // maximun phi angle
254
255 //filled with air
256
257 gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
258
259 // Place XU0 in to XEN1
260
261 gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY");
262
263
264
265 tseg = fGeom->GetFullSintThick()+fGeom->GetPbRadThick();
266
267 for (int i = 1; i < ((fGeom->GetNLayers()-1)/2) + 1 ; i++ ){
268
269 label = "XU" ;
270
271 label += i ;
272
273 envelopA[0] = envelopA[1]; //rmin
274
275 envelopA[1] = envelopA[0] + 2.0*tseg; //rmax
276
277 //filled with air
278
279 gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
280
281 gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
282
283 } // end i
284
285
286
287 // Create the shapes of active material (LEAD/Aluminium/Scintillator)
288
289 // to be placed
b13bbe81 290
ffa6d63b 291 Float_t envelopB[10]; // First Layer of Aluminium
a1469a24 292
ffa6d63b 293 Float_t envelopC[10]; // Scintillator Layers
a1469a24 294
295 Float_t envelopD[10]; // Lead Layers
296
297 //starting position in Phi
298
299 envelopC[0] = envelopD[0] = envelopB[0] = fGeom->GetArm1PhiMin();
300
301 // Angular size of the Detector in Phi
302
303 envelopB[1] = fGeom->GetArm1PhiMax() - fGeom->GetArm1PhiMin();
304
305 envelopC[1] = envelopD[1] = envelopB[1];
306
307 // Number of Section in Phi
308
309 envelopC[2] = envelopD[2] = envelopB[2] = fGeom->GetNPhi();
310
311 // each section will be passed 2 z coordinates
312
313 envelopD[3] = envelopC[3] = envelopB[3] = 2;
314
315 envelopB[4] = fGeom->ZFromEtaR(fGeom->GetEnvelop(0)+fGeom->GetGap2Active(),
316
317 fGeom->GetArm1EtaMin());// z co-ordinate 1
318
ffa6d63b 319 envelopB[5] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active(); //rmin at z1
a1469a24 320
321 envelopB[6] = envelopB[5] + fGeom->GetAlFrontThickness();//rmax at z1
322
323 envelopD[6] = envelopB[6];
324
325 envelopB[7] =fGeom->ZFromEtaR(fGeom->GetEnvelop(0)+fGeom->GetGap2Active(),
326
327 fGeom->GetArm1EtaMax()); // z co-ordinate 2
328
ffa6d63b 329 envelopB[8] = envelopB[5] ; //
a1469a24 330
ffa6d63b 331 envelopB[9] = envelopB[6] ; // radii are the same.
332
a1469a24 333
334
ffa6d63b 335 // filled shapes wit hactive material
a1469a24 336
337 // Define Aluminium volume completely
338
339 gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10);
340
341 // The polystyrene layers will be defined when placed
342
343 gMC->Gsvolu("XPST", "PGON", idtmed[1601], 0, 0);
344
345 gMC->Gsvolu("XPBX", "PGON", idtmed[1600], 0, 0);// as will the lead layers
346
347 // Dividind eta polystyrene divisions into phi segments.
348
349 gMC->Gsdvn("XPHI", "XPST", fGeom->GetNPhi(), 2);
350
ffa6d63b 351 // Position Aluminium Layer in the Envelope
a1469a24 352
61e0abb5 353 gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ;
b13bbe81 354
a1469a24 355
356
357 // The loop below places the scintillator in Lead Layers alternately.
358
09641ef5 359 for (int i = 0; i < fGeom->GetNLayers() ; i++ ){
360
a1469a24 361 label = "XU" ;
362
09641ef5 363 label += (int) i/2 ; // we will place two layers (i = one layer) in each mini envelope)
a1469a24 364
09641ef5 365 envelopC[5] = envelopD[6] ; //rmin
a1469a24 366
367 envelopC[6] = envelopD[6] + ((i > 1) ? fGeom->GetFullSintThick() :
368
369 fGeom->GetPreSintThick());//rmax larger for first two layers (preshower)
370
b13bbe81 371 envelopC[8] = envelopD[6] ; //rmin
a1469a24 372
373 envelopC[9] = envelopD[6] + ((i > 1 ) ? fGeom->GetFullSintThick() :
374
375 fGeom->GetPreSintThick());//rmax larger for first two layers (preshower)
376
377 for (int j =0; j < (fGeom->GetNEta()) ; j++){
378
379 etamin = fGeom->GetArm1EtaMin()+
380
156eff25 381 (j*fGeom->GetDeltaEta());
a1469a24 382
383 etamax = fGeom->GetArm1EtaMin()+
384
156eff25 385 ((j+1)*fGeom->GetDeltaEta());
a1469a24 386
387 envelopC[4] = fGeom->ZFromEtaR(envelopD[6],etamin); //z begin
388
389 envelopC[7] = fGeom->ZFromEtaR(envelopD[6],etamax);// z end
390
391 gMC->Gsposp("XPST",1+j+i*(fGeom->GetNEta()), label.Data(), // should be used but there's a weird crash above i = 18,
392
ffa6d63b 393 0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer
a1469a24 394
b13bbe81 395 } // end for j
a1469a24 396
b13bbe81 397 if (i < (fGeom->GetNLayers()-1)){
a1469a24 398
399 envelopD[5] = envelopC[6] ; //rmin
400
401 envelopD[6] = envelopC[6] + fGeom->GetPbRadThick(); //rmax
402
b13bbe81 403 envelopD[8] = envelopC[6] ; //rmin
a1469a24 404
405 envelopD[9] = envelopC[6] + fGeom->GetPbRadThick(); //rmax
406
407 for (int j =0; j < (fGeom->GetNEta()) ; j++){
408
409 etamin = fGeom->GetArm1EtaMin()+
410
156eff25 411 (j*fGeom->GetDeltaEta());
a1469a24 412
413 etamax = fGeom->GetArm1EtaMin()+
414
156eff25 415 ((j+1)*fGeom->GetDeltaEta());
a1469a24 416
417 envelopD[4] = fGeom->ZFromEtaR(envelopC[6],etamin);//z begin
418
419 envelopD[7] = fGeom->ZFromEtaR(envelopC[6],etamax);// z end
420
421 // Position and Define Layer
422
423 gMC->Gsposp("XPBX",1+ j+i*(fGeom->GetNEta()), label.Data(),
424
425 0.0, 0.0, 0.0 , idrotm, "ONLY", envelopD, 10);
426
b13bbe81 427 } // end for j
a1469a24 428
b13bbe81 429 } // end if i
a1469a24 430
61e0abb5 431 } // for i
a1469a24 432
2012850d 433}
a1469a24 434
b13bbe81 435//______________________________________________________________________
a1469a24 436
b13bbe81 437void AliEMCALv0::Init(void){
a1469a24 438
b13bbe81 439 // Just prints an information message
a1469a24 440
b13bbe81 441 Int_t i;
442
a1469a24 443
444
b13bbe81 445 cout << endl;
a1469a24 446
b13bbe81 447 for(i=0;i<35;i++) cout <<"*";
a1469a24 448
b13bbe81 449 cout << " EMCAL_INIT ";
a1469a24 450
b13bbe81 451 for(i=0;i<35;i++) cout << "*";
a1469a24 452
b13bbe81 453 cout << endl;
454
a1469a24 455
456
b13bbe81 457 // Here the EMCAL initialisation code (if any!)
458
a1469a24 459
460
b13bbe81 461 if (fGeom!=0)
a1469a24 462
b13bbe81 463 cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for "
a1469a24 464
b13bbe81 465 << fGeom->GetName() << endl ;
a1469a24 466
b13bbe81 467 else
a1469a24 468
b13bbe81 469 cout << "AliEMCAL" << Version() <<
a1469a24 470
b13bbe81 471 " : EMCAL geometry initialization failed !" << endl ;
a1469a24 472
b13bbe81 473 for(i=0;i<80;i++) printf("*");
a1469a24 474
b13bbe81 475 cout << endl;
a1469a24 476
2012850d 477}
a1469a24 478