@@ -218,10 +218,12 @@ void Detector::createMaterials()
218218
219219 int fieldType;
220220 float maxField;
221+
221222 // TODO: Comment out two lines below once tested that the above function assigns field type and max correctly
222- fieldType = 3 ; // Field type
223- maxField = 5.0 ; // Field max.
224- // o2::base::Detector::initFieldTrackingParams(fieldType, maxField);
223+ fieldType = 2 ; // Field type
224+ maxField = 10 .; // Field max.
225+
226+ o2::base::Detector::initFieldTrackingParams (fieldType, maxField);
225227 LOG (info) << " FD3: createMaterials(): fieldType " << fieldType << " , maxField " << maxField;
226228
227229 float tmaxfd3 = -10.0 ; // max deflection angle due to magnetic field in one step
@@ -265,150 +267,77 @@ void Detector::buildModules()
265267{
266268 LOGP (info, " Creating FD3 geometry" );
267269
268- mNumberOfRingsScint = Constants::nringsScint;
269- mNumberOfRingsCher = Constants::nringsCher;
270- mNumberOfSectors = Constants::nsect;
271- mDzScint = Constants::dzscint;
272- mDzCher = Constants::dzcher;
273-
274270 auto & baseParam = FD3BaseParam::Instance ();
275271
276- mEtaMinScintA = Constants::etaMin_scintA;
277- mEtaMinCherA = Constants::etaMin_cherA;
278- mEtaMaxScintA = baseParam.isSymmetric ? Constants::etaMax_scintA_v1 : Constants::etaMax_scintA_v2;
279- mEtaMaxCherA = baseParam.isSymmetric ? Constants::etaMax_cherA_v1 : Constants::etaMax_cherA_v2;
280-
281- mEtaMinScintC = Constants::etaMin_scintC;
282- mEtaMinCherC = Constants::etaMin_cherC;
283- mEtaMaxScintC = Constants::etaMax_scintC;
284- mEtaMaxCherC = Constants::etaMax_cherC;
285-
286- mZScint = Constants::zscint;
287- mZCher = Constants::zcher;
288-
289272 auto topVolume = (TGeoVolume*)gGeoManager ->GetVolume (" barrel" );
290273
291274 mChannelCounter = 0 ;
292275
293- TGeoVolumeAssembly* vFD3_ScintA = buildModuleScintA ();
294- TGeoVolumeAssembly* vFD3_ScintC = buildModuleScintC ();
295- TGeoVolumeAssembly *vFD3_CherA, *vFD3_CherC;
276+ TGeoVolumeAssembly *vFD3_ScintA, *vFD3_ScintC, *vFD3_CherA, *vFD3_CherC;
296277
297- if (baseParam.isCherenkovSegmented ) {
298- if (baseParam.isSymmetric ) {
299- vFD3_CherA = buildModuleCherenkov_v1 ();
300- } else {
301- vFD3_CherA = buildModuleCherenkov_v2 ();
302- }
303- vFD3_CherC = buildModuleCherenkov_v1 ();
278+ if (baseParam.isSymmetric ) {
279+ vFD3_ScintA = buildModuleScint (Constants::etaMin, Constants::etaMax);
280+ vFD3_CherA = buildModuleCherenkov_v1 ();
304281 } else {
305- vFD3_CherA = buildModuleCherenkov_v0 ( mEtaMaxCherA , mEtaMaxCherA , mZCher );
306- vFD3_CherC = buildModuleCherenkov_v0 ( mEtaMinCherC , mEtaMaxCherC , - mZCher );
282+ vFD3_ScintA = buildModuleScint (Constants::etaMin, Constants::etaMax2 );
283+ vFD3_CherA = buildModuleCherenkov_v2 ( );
307284 }
308285
286+ vFD3_ScintC = buildModuleScint (Constants::etaMin, Constants::etaMax);
287+ vFD3_CherC = buildModuleCherenkov_v1 ();
288+
289+ vFD3_ScintA->SetName (" FD3_ScintA" );
290+ vFD3_ScintC->SetName (" FD3_ScintC" );
309291 vFD3_CherA->SetName (" FD3_CherA" );
310292 vFD3_CherC->SetName (" FD3_CherC" );
311293
312- topVolume->AddNode (vFD3_ScintA, 1 , new TGeoTranslation (0 ., 30 .f , mZScint ));
313- topVolume->AddNode (vFD3_ScintC, 1 , new TGeoTranslation (0 ., 30 .f , -mZScint ));
294+ topVolume->AddNode (vFD3_ScintA, 1 , new TGeoTranslation (0 ., 30 .f , Constants::zScint ));
295+ topVolume->AddNode (vFD3_ScintC, 1 , new TGeoTranslation (0 ., 30 .f , -Constants::zScint ));
314296
315- topVolume->AddNode (vFD3_CherA, 1 , new TGeoTranslation (0 ., 30 .f , mZCher ));
316- topVolume->AddNode (vFD3_CherC, 1 , new TGeoTranslation (0 ., 30 .f , -mZCher ));
297+ topVolume->AddNode (vFD3_CherA, 1 , new TGeoTranslation (0 ., 30 .f , Constants::zCher ));
298+ topVolume->AddNode (vFD3_CherC, 1 , new TGeoTranslation (0 ., 30 .f , -Constants::zCher ));
317299}
318300
319- TGeoVolumeAssembly* Detector::buildModuleScintA ( )
301+ TGeoVolumeAssembly* Detector::buildModuleScint ( float etaMin, float etaMax )
320302{
321- auto mod = new TGeoVolumeAssembly (" FD3_ScintA " );
303+ auto mod = new TGeoVolumeAssembly (" FD3_Scint " );
322304
323305 const TGeoMedium* medium = gGeoManager ->GetMedium (" FD3_Scintillator" );
324306
325- float dphiDeg = 360 . / mNumberOfSectors ;
326-
327- for (int ir = 0 ; ir < mNumberOfRingsScint ; ir++) {
328- std::string rName = " fd3_ring" + std::to_string (ir + 1 );
329- float etaMin = mEtaMaxScintA - (ir + 1 ) * (mEtaMaxScintA - mEtaMinScintA ) / mNumberOfRingsScint ;
330- float etaMax = mEtaMaxScintA - ir * (mEtaMaxScintA - mEtaMinScintA ) / mNumberOfRingsScint ;
331- float zmod = mZScint ;
332- float rmin = getRingSize (zmod, etaMax), rmax = getRingSize (zmod, etaMin);
333- LOG (info) << " Scintillator ring" << ir << " : from " << rmin << " to " << rmax;
334- for (int ic = 0 ; ic < mNumberOfSectors ; ic++) {
335- int cellId = mChannelCounter ++; // ic + mNumberOfSectors * ir;
336- std::string nodeName = " fd3_node" + std::to_string (cellId);
337- float phimin = dphiDeg * ic;
338- float phimax = dphiDeg * (ic + 1 );
339- auto tbs = new TGeoTubeSeg (" tbs" , rmin, rmax, mDzScint / 2 , phimin, phimax);
340- auto node = new TGeoVolume (nodeName.c_str (), tbs, medium);
341- node->SetLineColor ((ir + ic) % 2 == 0 ? kRed : kRed - 7 );
342- mod->AddNode (node, 1 );
343- }
344- }
345-
346- return mod;
347- }
307+ int nrings = Constants::nRingsScint, nsect = Constants::nSectScint;
308+ float zmod = Constants::zScint, dz = Constants::dzScint;
348309
349- TGeoVolumeAssembly* Detector::buildModuleScintC ()
350- {
351- auto mod = new TGeoVolumeAssembly (" FD3_ScintC" );
352-
353- const TGeoMedium* medium = gGeoManager ->GetMedium (" FD3_Scintillator" );
354-
355- float dphiDeg = 360 . / mNumberOfSectors ;
356-
357- for (int ir = 0 ; ir < mNumberOfRingsScint ; ir++) {
358- std::string rName = " fd3_ring" + std::to_string (ir + 1 + mNumberOfRingsScint );
359- float etaMin = mEtaMinScintC + ir * (mEtaMaxScintC - mEtaMinScintC ) / mNumberOfRingsScint ;
360- float etaMax = mEtaMinScintC + (ir + 1 ) * (mEtaMaxScintC - mEtaMinScintC ) / mNumberOfRingsScint ;
361- float zmod = -mZScint ;
362- float rmin = getRingSize (zmod, etaMin), rmax = getRingSize (zmod, etaMax);
363- LOG (info) << " Scintillator ring" << ir + mNumberOfRingsScint << " : from " << rmin << " to " << rmax;
364- for (int ic = 0 ; ic < mNumberOfSectors ; ic++) {
365- int cellId = mChannelCounter ++; // ic + mNumberOfSectors * (ir + mNumberOfRingsScint);
310+ for (int ir = 0 ; ir < nrings; ir++) {
311+ float eta1 = etaMax - ir * (etaMax - etaMin) / nrings;
312+ float eta2 = etaMax - (ir + 1 ) * (etaMax - etaMin) / nrings;
313+ float r1 = getRingSize (zmod, eta1), r2 = getRingSize (zmod, eta2);
314+ LOG (info) << " Scintillator ring " << ir + 1 << " : from " << r1 << " to " << r2;
315+ for (int ic = 0 ; ic < nsect; ic++) {
316+ int cellId = mChannelCounter ++;
366317 std::string nodeName = " fd3_node" + std::to_string (cellId);
367- float phimin = dphiDeg * ic ;
368- float phimax = dphiDeg * (ic + 1 );
369- auto tbs = new TGeoTubeSeg (" tbs" , rmin, rmax, mDzScint / 2 , phimin, phimax );
318+ float phi1 = ic * 360 . / nsect ;
319+ float phi2 = (ic + 1 ) * 360 . / nsect ;
320+ auto tbs = new TGeoTubeSeg (" tbs" , r1, r2, dz / 2 , phi1, phi2 );
370321 auto node = new TGeoVolume (nodeName.c_str (), tbs, medium);
371- node->SetLineColor ((ir + ic) % 2 == 0 ? kBlue : kBlue - 7 );
322+ if (cellId < nrings * nsect) {
323+ node->SetLineColor ((ir + ic) % 2 == 0 ? kRed : kRed - 7 );
324+ } else {
325+ node->SetLineColor ((ir + ic) % 2 == 0 ? kBlue : kBlue - 7 );
326+ }
372327 mod->AddNode (node, 1 );
373328 }
374329 }
375330
376331 return mod;
377332}
378333
379- TGeoVolumeAssembly* Detector::buildModuleCherenkov_v0 (float etaMin, float etaMax, float zmod)
380- {
381- auto mod = new TGeoVolumeAssembly (" " );
382-
383- const TGeoMedium* medium = gGeoManager ->GetMedium (" FD3_Glass" );
384-
385- float rmin, rmax;
386- if (zmod >= 0 ) {
387- rmin = getRingSize (zmod, etaMin);
388- rmax = getRingSize (zmod, etaMax);
389- } else {
390- rmin = getRingSize (zmod, etaMin);
391- rmax = getRingSize (zmod, etaMax);
392- }
393-
394- int cellId = mChannelCounter ++;
395- std::string nodeName = " fd3_node" + std::to_string (cellId);
396-
397- auto tbs = new TGeoTubeSeg (" tbs" , rmin, rmax, mDzScint / 2 , 0 , 360 );
398- auto node = new TGeoVolume (nodeName.c_str (), tbs, medium);
399- node->SetLineColor (zmod > 0 ? kOrange : kMagenta );
400- mod->AddNode (node, 1 );
401-
402- return mod;
403- }
404-
405334TGeoVolumeAssembly* Detector::buildModuleCherenkov_v1 ()
406335{
407336 auto mod = new TGeoVolumeAssembly (" FD3_Ch" );
408337
409338 TGeoMedium* medium = gGeoManager ->GetMedium (" FD3_Glass" );
410339
411- double rsizeq = Constants::rsizeq;
340+ float rsizeq = Constants::rsizeq, dz = Constants::dzCher ;
412341
413342 const int N = 68 ;
414343
@@ -429,7 +358,7 @@ TGeoVolumeAssembly* Detector::buildModuleCherenkov_v1()
429358 for (int i = 0 ; i < N; i++) {
430359 int cellId = mChannelCounter ++;
431360 std::string nodeName = " fd3_node" + std::to_string (cellId);
432- auto box = new TGeoBBox (rsizeq - 0.05 , rsizeq - 0.05 , mDzCher / 2 );
361+ auto box = new TGeoBBox (rsizeq - 0.05 , rsizeq - 0.05 , dz / 2 );
433362 auto node = new TGeoVolume (nodeName.c_str (), box, medium);
434363 node->SetLineColor (kOrange + 7 );
435364 mod->AddNode (node, 1 , new TGeoTranslation (x[i], y[i], 0 ));
@@ -444,7 +373,7 @@ TGeoVolumeAssembly* Detector::buildModuleCherenkov_v2()
444373
445374 TGeoMedium* medium = gGeoManager ->GetMedium (" FD3_Glass" );
446375
447- double rsizeq = Constants::rsizeq;
376+ float rsizeq = Constants::rsizeq, dz = Constants::dzCher ;
448377
449378 const int N = 68 ;
450379
@@ -465,7 +394,7 @@ TGeoVolumeAssembly* Detector::buildModuleCherenkov_v2()
465394 for (int i = 0 ; i < N; i++) {
466395 int cellId = mChannelCounter ++;
467396 std::string nodeName = " fd3_node" + std::to_string (cellId);
468- auto box = new TGeoBBox (rsizeq - 0.05 , rsizeq - 0.05 , mDzCher / 2 );
397+ auto box = new TGeoBBox (rsizeq - 0.05 , rsizeq - 0.05 , dz / 2 );
469398 auto node = new TGeoVolume (nodeName.c_str (), box, medium);
470399 node->SetLineColor (kOrange + 7 );
471400 mod->AddNode (node, 1 , new TGeoTranslation (x[i], y[i], 0 ));
0 commit comments