1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //////////////////////////////////////////////////////////////////////
20 // (V-zero) detector version 3 as designed by the Lyon group //
21 // All comments should be sent to Brigitte CHEYNIS : //
22 // b.cheynis@ipnl.in2p3.fr //
23 // Geometry of the 4th of december 2003 //
24 // (now 3 rings instead of 5 rings as in previous versions -budget //
25 // cuts !! - therefore changes in cell dimensions and offsets) //
26 // previous ring 1 and ring 2 become now ring 1 //
27 // previous ring 3 and ring 4 become now ring 2 //
28 // previous ring 5 becomes now ring 3 - both for Left and Right //
29 // V0R (now V0C) sits between Z values -89.4 and -84.9 cm //
30 // V0L (now V0A) sits between Z values +350.0 and +352.0 cm //
31 // New coordinate system has been implemented in october 2003 //
33 //////////////////////////////////////////////////////////////////////
35 // --- Standard libraries ---
36 #include <Riostream.h>
40 // --- ROOT libraries ---
41 #include <TClonesArray.h>
42 #include <TGeometry.h>
43 #include <TLorentzVector.h>
46 #include <TObjectTable.h>
49 #include <TVirtualMC.h>
50 #include <TParticle.h>
52 // --- AliRoot header files ---
58 #include "AliVZEROLoader.h"
59 #include "AliVZEROdigit.h"
60 #include "AliVZEROhit.h"
61 #include "AliVZEROv3.h"
65 //_____________________________________________________________________________
66 AliVZEROv3:: AliVZEROv3():AliVZERO(),
71 fLightAttenuation(0.05),
75 // Standard default constructor
78 //_____________________________________________________________________________
79 AliVZEROv3::AliVZEROv3(const char *name, const char *title):
85 fLightAttenuation(0.05),
90 // Standard constructor for V-zero Detector version 2
92 AliDebug(2,"Create VZERO object");
94 // fLightYield = 93.75;
95 // fLightAttenuation = 0.05;
101 //_____________________________________________________________________________
102 void AliVZEROv3::CreateGeometry()
105 // Creates the GEANT geometry of the V-zero Detector version 3
107 AliDebug(2,"Create VZERO Geometry");
109 Int_t *idtmed = fIdtmed->GetArray()-2999;
119 Float_t height1Right, height2Right, height3Right;
123 Float_t halfThickQua;
126 Float_t r0Right, r3Right;
127 Float_t pi = TMath::Pi();
129 height1Right = 1.82 + 3.81; // height of cell 1, in cm
130 height2Right = 4.72 + 7.12; // height of cell 2, in cm
131 height3Right = 10.83; // height of cell 3, in cm
133 theta = pi/6.0/2.0; // half angular opening = 15 degrees
135 halfThickQua= fThickness1/2.0; // half thickness of elementary cell (inner ring)
137 // distance 0.6 cm in zdet accounts for the fact V0R box back lid sits 0.6 away from
138 // absorber nose sitting at 90 cm. Will use -zdet later...
139 // size of V0R box (fThickness) is increased by 1 mm as compared to version v2
141 fThickness = fThickness + 0.1;
142 zdet = 90.0 - 0.6 - fThickness/2.0; // distance to vertex (along Z axis)
143 r0Right = 4.05; // closest distance to center of the beam pipe
144 heightRight = height1Right + height2Right + height3Right;
145 r3Right = r0Right + heightRight;
147 // Creation of mother volume v0LE - left part - :
148 // Entrance face at +350.0 cm (new coordinate system) ...
154 partube[2] = fThickness1/2.0;
156 gMC->Gsvolu("V0LE","TUBE",idtmed[3005],partube,3);
158 // Creation of five rings - left part - :
159 // Entrance face at +350.0 cm (new coordinate system) ...
161 // Mother volume v0L0 in which will be set 5 scintillator cells
165 Float_t r0Left = 4.3;
166 Float_t height1Left = 2.6 + 4.1; // previous ring 1 + ring 2
167 Float_t height2Left = 6.4 + 10.2; // previous ring 3 + ring 4
168 Float_t height3Left = 16.9;
169 Float_t heightLeft = height1Left + height2Left + height3Left;
171 Float_t r3Left = r0Left + heightLeft;
175 partubs[2] = fThickness1/2.0;
176 partubs[3] = 90.0-15.0;
177 partubs[4] = 120.0-15.0;
179 gMC->Gsvolu("V0L0","TUBS",idtmed[3010],partubs,5); // air volume
181 Float_t r1Left = r0Left + height1Left;
186 gMC->Gsvolu("V0L1","TUBS",idtmed[3005],partubs,5); // quartz volume
187 gMC->Gspos("V0L1",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
189 Float_t r2Left = r1Left + height2Left;
194 gMC->Gsvolu("V0L2","TUBS",idtmed[3005],partubs,5); // quartz volume
195 gMC->Gspos("V0L2",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
200 gMC->Gsvolu("V0L3","TUBS",idtmed[3005],partubs,5); // quartz volume
201 gMC->Gspos("V0L3",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
204 // Creation of mother volume v0RI - right part - :
206 partube[0] = r0Right - 0.2;
207 partube[1] = r3Right + 1.0;
208 partube[2] = fThickness/2.0;
210 gMC->Gsvolu("V0RI","TUBE",idtmed[3010],partube,3);
212 // Creation of carbon lids (3.5 mm thick) to keep v0RI box shut...
214 Float_t lidThickness = 0.35;
216 partube[0] = r0Right;
217 partube[1] = r3Right;
218 partube[2] = +lidThickness/2.0;
220 gMC->Gsvolu("V0CA","TUBE",idtmed[3001],partube,3);
221 gMC->Gspos("V0CA",1,"V0RI",0.0,0.0, fThickness/2.0-partube[2],0,"ONLY");
222 gMC->Gspos("V0CA",2,"V0RI",0.0,0.0,-fThickness/2.0+partube[2],0,"ONLY");
224 // Creation of aluminum rings to maintain the v0RI pieces ...
226 partube[0] = r0Right - 0.2;
227 partube[1] = r0Right;
228 partube[2] = +fThickness/2.0;
230 gMC->Gsvolu("V0IR","TUBE",idtmed[3003],partube,3);
231 gMC->Gspos("V0IR",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
233 partube[0] = r3Right;
234 partube[1] = r3Right + 1.0;
235 partube[2] = +fThickness/2.0;
237 gMC->Gsvolu("V0ER","TUBE",idtmed[3003],partube,3);
238 gMC->Gspos("V0ER",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
240 // Mother volume v0R0 in which will be set 3 scintillator cells
242 partubs[0] = r0Right;
243 partubs[1] = r3Right;
244 partubs[2] = fThickness/2.0;
245 partubs[3] = 90.0-15.0;
246 partubs[4] = 120.0-15.0;
248 gMC->Gsvolu("V0R0","TUBS",idtmed[3010],partubs,5); // air volume
250 // Elementary cell of ring 1 :
251 // (cells of ring 1 will be shifted by 1.7 cm towards vertex to output fibers)
253 Float_t offsetFibers = 1.7;
254 Float_t offset = fThickness/2.0 - lidThickness - fThickness1/2.0;
255 Float_t r1Right = r0Right + height1Right;
257 partubs[0] = r0Right;
258 partubs[1] = r1Right;
259 partubs[2] = fThickness1/2.0;
261 gMC->Gsvolu("V0R1","TUBS",idtmed[3005],partubs,5); // scintillator volume
262 gMC->Gspos("V0R1",1,"V0R0", 0.0, 0.0 , -offset + offsetFibers, 0,"ONLY");
264 // Elementary cell of ring 2 :
266 Float_t r2Right = r1Right + height2Right;
268 partubs[0] = r1Right;
269 partubs[1] = r2Right;
271 gMC->Gsvolu("V0R2","TUBS",idtmed[3005],partubs,5); // scintillator volume
272 gMC->Gspos("V0R2",1,"V0R0", 0.0, 0.0 , -offset, 0,"ONLY");
275 // Elementary cell of ring 3 :
277 partubs[0] = r2Right;
278 partubs[1] = r3Right;
280 gMC->Gsvolu("V0R3","TUBS",idtmed[3005],partubs,5); // scintillator volume
281 gMC->Gspos("V0R3",1,"V0R0", 0.0, 0.0 , -offset, 0,"ONLY");
284 Float_t phiDeg = 180./6.;
288 for(Float_t phi = 15.0 ; phi < 360.0; phi = phi + phiDeg)
290 AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
291 gMC->Gspos("V0R0",ndetR,"V0RI",0.0,
292 0.0,0.0,idrotm[902],"ONLY");
296 gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,-zdet,0,"ONLY");
298 ncellsR = (ndetR - 1) * 3;
299 AliInfo(Form("Number of cells on Right side = %d",ncellsR));
303 for(Float_t phi = 15.0 ; phi < 360.0; phi = phi + phiDeg)
305 AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
306 gMC->Gspos("V0L0",ndetL,"V0LE",0.0,
307 0.0,0.0,idrotm[902],"ONLY");
311 gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,350.0+fThickness1/2.0,0,"ONLY");
313 ncellsL = (ndetL - 1) * 3;
314 AliInfo(Form("Number of cells on Left side = %d", ncellsL));
318 //_____________________________________________________________________________
319 void AliVZEROv3::CreateMaterials()
322 // Creates materials used for geometry
324 AliDebug(2,"VZERO create materials");
327 Float_t ppckov[14] = { 5.5e-9, 5.7e-9, 5.9e-9, 6.1e-9, 6.3e-9, 6.5e-9, 6.7e-9,
328 6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
331 Float_t ppckov_alu[14] = { 5.5e-9, 5.7e-9, 5.9e-9, 6.1e-9, 6.3e-9, 6.5e-9, 6.7e-9,
332 6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
334 Float_t rindex_quarz[14] = { 1.52398, 1.53090, 1.53835, 1.54641, 1.55513, 1.56458,
335 1.57488, 1.58611, 1.59842, 1.61197, 1.62696, 1.64362,
338 Float_t absco_quarz[14] = { 105.8, 45.656, 35.665, 28.598, 25.007, 21.04, 17.525,
339 14.177, 9.282, 4.0925, 1.149, 0.3627, 0.1497, 0.05 };
341 Float_t effic_all[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
344 Float_t rindex_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
347 Float_t absco_alu[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
348 1e-4,1e-4,1e-4,1e-4 };
349 Float_t effic_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
353 Int_t *idtmed = fIdtmed->GetArray()-2999;
356 // Parameters related to Quarz (SiO2) :
358 Float_t aqua[2], zqua[2], densqua, wmatqua[2];
370 // Parameters related to aluminum sheets :
377 // Parameters related to scintillator CH :
379 Float_t ascin[2] = {1.00794,12.011};
380 Float_t zscin[2] = {1.,6.};
381 Float_t wscin[2] = {1.,1.};
382 Float_t denscin = 1.032;
386 Float_t aAir[4]={12.,14.,16.,36.};
387 Float_t zAir[4]={6.,7.,8.,18.};
388 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
389 Float_t dAir = 1.20479E-3;
391 // Definition of materials :
395 AliMixture( 1, "AIR A$", aAir,zAir,dAir,4,wAir);
396 AliMixture(11, "AIR I$", aAir,zAir,dAir,4,wAir);
397 AliMaterial( 2, "CARBON$" , 12.01, 6.0, 2.265, 18.8, 49.9, 0, 0);
398 AliMixture( 3, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
399 AliMaterial( 4, "ALUMINIUM1$", 26.98, 13., 2.7, 8.9, 37.2, 0, 0);
400 AliMaterial( 5, "ALUMINIUM2$", aal, zal, densal, radlal, 0, 0, 0);
402 AliMixture( 6, "Scintillator$",ascin,zscin,denscin,-2,wscin);
405 Int_t iSXFLD = gAlice->Field()->Integ();
406 Float_t sXMGMX = gAlice->Field()->Max();
408 Float_t tmaxfd, stemax, deemax, epsil, stmin;
417 AliMedium(1, "ACTIVE AIR$", 1, 1, iSXFLD, sXMGMX,
418 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
422 AliMedium(11, "INACTIVE AIR$", 11, 0, iSXFLD, sXMGMX,
423 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
425 AliMedium(2, "CARBON$ ", 2, 1, iSXFLD, sXMGMX,
426 tmaxfd, stemax, deemax, epsil, stmin, 0, 0);
428 AliMedium(3, "QUARZ$", 3, 1, iSXFLD, sXMGMX,
429 tmaxfd, fMaxStepQua, fMaxDestepQua, epsil, stmin, 0, 0);
431 AliMedium(4,"ALUMINUM1$",4, 1, iSXFLD, sXMGMX,
432 tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
435 AliMedium(5,"ALUMINUM2$",5, 1, iSXFLD, sXMGMX,
436 tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
438 AliMedium(6,"SCINTILLATOR$",6, 1, iSXFLD, sXMGMX, 10.0, 0.1, 0.1, 0.003, 0.003, 0, 0);
440 gMC->Gstpar(idtmed[3000], "LOSS", 1.); // [3000] = air ACTIF [3010] = air INACTIF
441 gMC->Gstpar(idtmed[3000], "HADR", 1.);
442 gMC->Gstpar(idtmed[3000], "DCAY", 1.);
443 gMC->Gstpar(idtmed[3000], "DRAY", 1.);
445 gMC->Gstpar(idtmed[3001], "LOSS", 1.); // [3001] = carbon
446 gMC->Gstpar(idtmed[3001], "HADR", 1.);
447 gMC->Gstpar(idtmed[3001], "DCAY", 1.);
448 gMC->Gstpar(idtmed[3001], "DRAY", 1.);
450 gMC->Gstpar(idtmed[3002], "LOSS", 1.); // [3002] = quartz
451 gMC->Gstpar(idtmed[3002], "HADR", 1.);
452 gMC->Gstpar(idtmed[3002], "DCAY", 1.);
453 gMC->Gstpar(idtmed[3002], "DRAY", 1.);
454 gMC->Gstpar(idtmed[3002], "CUTGAM",0.5E-4) ;
455 gMC->Gstpar(idtmed[3002], "CUTELE",1.0E-4) ;
457 gMC->Gstpar(idtmed[3003], "LOSS", 1.); // [3003] = normal aluminum
458 gMC->Gstpar(idtmed[3003], "HADR", 1.);
459 gMC->Gstpar(idtmed[3003], "DCAY", 1.);
460 gMC->Gstpar(idtmed[3003], "DRAY", 1.);
462 gMC->Gstpar(idtmed[3004], "LOSS", 1.); // [3004] = reflecting aluminum
463 gMC->Gstpar(idtmed[3004], "HADR", 1.);
464 gMC->Gstpar(idtmed[3004], "DCAY", 1.);
465 gMC->Gstpar(idtmed[3004], "DRAY", 1.);
466 gMC->Gstpar(idtmed[3004], "CUTGAM",0.5E-4) ;
467 gMC->Gstpar(idtmed[3004], "CUTELE",1.0E-4) ;
469 gMC->Gstpar(idtmed[3005], "LOSS", 1.); // [3005] = scintillator
470 gMC->Gstpar(idtmed[3005], "HADR", 1.);
471 gMC->Gstpar(idtmed[3005], "DCAY", 1.);
472 gMC->Gstpar(idtmed[3005], "DRAY", 1.);
473 gMC->Gstpar(idtmed[3005], "CUTGAM",0.5E-4) ;
474 gMC->Gstpar(idtmed[3005], "CUTELE",1.0E-4) ;
477 // geant3->Gsckov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
478 // geant3->Gsckov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
480 // gMC->SetCerenkov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
481 // gMC->SetCerenkov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
485 //_____________________________________________________________________________
486 void AliVZEROv3::DrawModule() const
489 // Drawing is done in DrawVZERO.C
491 AliDebug(2,"VZERO DrawModule");
495 //_____________________________________________________________________________
496 void AliVZEROv3::Init()
498 // Initialises version 2 of the VZERO Detector
499 // Just prints an information message
501 AliInfo(Form("VZERO version %d initialized",IsVersion()));
503 // gMC->SetMaxStep(fMaxStepAlu);
504 // gMC->SetMaxStep(fMaxStepQua);
511 //_____________________________________________________________________________
512 void AliVZEROv3::StepManager()
515 // Step Manager, called at each step
519 static Float_t hits[21];
520 static Float_t eloss, tlength;
521 static Int_t nPhotonsInStep;
522 static Int_t nPhotons;
523 static Int_t numStep;
525 Float_t destep, step;
529 // We keep only charged tracks :
531 if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
533 static Int_t idV0R1 = gMC->VolId("V0R1");
534 static Int_t idV0L1 = gMC->VolId("V0L1");
535 static Int_t idV0R2 = gMC->VolId("V0R2");
536 static Int_t idV0L2 = gMC->VolId("V0L2");
537 static Int_t idV0R3 = gMC->VolId("V0R3");
538 static Int_t idV0L3 = gMC->VolId("V0L3");
540 vol[0] = gMC->CurrentVolOffID(1, vol[1]);
541 vol[2] = gMC->CurrentVolID(copy);
544 if ( gMC->CurrentVolID(copy) == idV0R1 ||
545 gMC->CurrentVolID(copy) == idV0L1 )
547 else if ( gMC->CurrentVolID(copy) == idV0R2 ||
548 gMC->CurrentVolID(copy) == idV0L2 )
550 else if ( gMC->CurrentVolID(copy) == idV0R3 ||
551 gMC->CurrentVolID(copy) == idV0L3 )
556 if ( ringNumber > 0.5 ) {
558 destep = gMC->Edep();
559 step = gMC->TrackStep();
561 nPhotonsInStep = Int_t(destep / (fLightYield *1e-9) );
562 nPhotonsInStep = gRandom->Poisson(nPhotonsInStep);
567 if ( gMC->IsTrackEntering() ) {
569 nPhotons = nPhotonsInStep;
570 gMC->TrackPosition(fTrackPosition);
571 gMC->TrackMomentum(fTrackMomentum);
573 Float_t pt = TMath::Sqrt( fTrackMomentum.Px() * fTrackMomentum.Px() +
574 fTrackMomentum.Py() * fTrackMomentum.Py() );
576 hits[0] = fTrackPosition.X();
577 hits[1] = fTrackPosition.Y();
578 hits[2] = fTrackPosition.Z();
579 hits[3] = Float_t (gMC->TrackPid());
581 hits[4] = gMC->TrackTime();
582 hits[5] = gMC->TrackCharge();
583 hits[6] = fTrackMomentum.Theta()*TMath::RadToDeg();
584 hits[7] = fTrackMomentum.Phi()*TMath::RadToDeg();
585 hits[8] = ringNumber;
588 hits[10] = fTrackMomentum.P();
589 hits[11] = fTrackMomentum.Px();
590 hits[12] = fTrackMomentum.Py();
591 hits[13] = fTrackMomentum.Pz();
593 TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
594 hits[14] = par->Vx();
595 hits[15] = par->Vy();
596 hits[16] = par->Vz();
603 nPhotons = nPhotons + nPhotonsInStep;
605 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
607 nPhotons = nPhotons - Int_t( (Float_t(nPhotons) * fLightAttenuation * fnMeters) );
608 nPhotons = nPhotons - Int_t( Float_t(nPhotons) * fFibToPhot );
613 hits[20] = GetCellId (vol, hits);
615 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
628 //_____________________________________________________________________________
629 void AliVZEROv3::AddHit(Int_t track, Int_t *vol, Float_t *hits)
634 TClonesArray &lhits = *fHits;
635 new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
638 //_____________________________________________________________________________
639 void AliVZEROv3::AddDigits(Int_t *tracks, Int_t* digits)
642 // Adds a VZERO digit
644 TClonesArray &ldigits = *fDigits;
645 new(ldigits[fNdigits++]) AliVZEROdigit(tracks, digits);
648 //_____________________________________________________________________________
649 void AliVZEROv3::MakeBranch(Option_t *option)
652 // Creates new branches in the current Root Tree
655 sprintf(branchname,"%s",GetName());
656 AliDebug(2,Form("fBufferSize = %d",fBufferSize));
658 const char *cH = strstr(option,"H");
660 if (fHits && fLoader->TreeH() && cH) {
661 fLoader->TreeH()->Branch(branchname,&fHits, fBufferSize);
662 AliDebug(2,Form("Making Branch %s for hits",branchname));
665 const char *cD = strstr(option,"D");
667 if (fDigits && fLoader->TreeD() && cD) {
668 fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
669 AliDebug(2,Form("Making Branch %s for digits",branchname));
674 //_____________________________________________________________________________
675 Int_t AliVZEROv3::GetCellId(Int_t *vol, Float_t *hits)
678 // Returns Id of scintillator cell
679 // Right side from 0 to 35
680 // Left side from 36 to 71
682 Int_t index = vol[1];
685 if (index < 10) index = index + 12;
688 index = (index - 10) + ( ( Int_t(hits[8]) - 1 ) * 12);
691 else if (hits[2] > 0.0)
693 index = (index + 26) + ( ( Int_t(hits[8]) - 1 ) * 12);