@@ -368,7 +368,7 @@ void FT3Module::addStaveVolume(
368368
369369void FT3Module::addDetectorVolume (
370370 TGeoVolume* motherVolume, std::string volumeName, int color,
371- unsigned * volume_count, double x_mid, double y_mid, double z_mid,
371+ unsigned volume_count, double x_mid, double y_mid, double z_mid,
372372 double x_half_length, double y_half_length, double z_half_length)
373373{
374374 TGeoManager* geoManager = gGeoManager ;
@@ -378,13 +378,12 @@ void FT3Module::addDetectorVolume(
378378 volume->SetFillColorAlpha (color, 0.4 );
379379 motherVolume->AddNode (
380380 volume,
381- * volume_count,
381+ volume_count,
382382 new TGeoTranslation ( // midpoint of box to add
383383 x_mid,
384384 y_mid,
385385 z_mid) // TGeoTranslation
386386 ); // addNode
387- (*volume_count)++;
388387}
389388
390389/*
@@ -393,10 +392,12 @@ void FT3Module::addDetectorVolume(
393392 */
394393void FT3Module::add2x1GlueVolume (
395394 TGeoVolume* motherVolume, int layerNumber, int direction, unsigned stave_idx,
396- unsigned * volume_count, double x_mid, double y_mid, double z_mid,
395+ unsigned volume_count, double x_mid, double y_mid, double z_mid,
397396 std::string element_glued_to)
398397{
399- std::string glue_name = " FT3glue_" + element_glued_to + " _" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (stave_idx) + " _" + std::to_string (*volume_count);
398+ std::string glue_name = " FT3glue_" + element_glued_to + " _"
399+ + std::to_string (direction) + " _" + std::to_string (layerNumber) + " _"
400+ + std::to_string (stave_idx) + " _" + std::to_string (volume_count);
400401 addDetectorVolume (
401402 motherVolume, glue_name, Constants::glueColor, volume_count,
402403 x_mid, y_mid, z_mid,
@@ -409,9 +410,11 @@ void FT3Module::add2x1GlueVolume(
409410 */
410411void FT3Module::add2x1CopperVolume (
411412 TGeoVolume* motherVolume, int layerNumber, int direction, unsigned stave_idx,
412- unsigned * volume_count, double x_mid, double y_mid, double z_mid)
413+ unsigned volume_count, double x_mid, double y_mid, double z_mid)
413414{
414- std::string copper_name = " FT3Copper_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (stave_idx) + " _" + std::to_string (*volume_count);
415+ std::string copper_name = " FT3Copper_" + std::to_string (direction) + " _"
416+ + std::to_string (layerNumber) + " _" + std::to_string (stave_idx)
417+ + " _" + std::to_string (volume_count);
415418 addDetectorVolume (
416419 motherVolume, copper_name, Constants::CuColor, volume_count,
417420 x_mid, y_mid, z_mid,
@@ -424,9 +427,11 @@ void FT3Module::add2x1CopperVolume(
424427 */
425428void FT3Module::add2x1KaptonVolume (
426429 TGeoVolume* motherVolume, int layerNumber, int direction, unsigned stave_idx,
427- unsigned * volume_count, double x_mid, double y_mid, double z_mid)
430+ unsigned volume_count, double x_mid, double y_mid, double z_mid)
428431{
429- std::string kapton_name = " FT3Kapton_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (stave_idx) + " _" + std::to_string (*volume_count);
432+ std::string kapton_name = " FT3Kapton_" + std::to_string (direction) + " _"
433+ + std::to_string (layerNumber) + " _" + std::to_string (stave_idx)
434+ + " _" + std::to_string (volume_count);
430435 addDetectorVolume (
431436 motherVolume, kapton_name, Constants::kaptonColor, volume_count,
432437 x_mid, y_mid, z_mid,
@@ -453,53 +458,56 @@ void FT3Module::add2x1KaptonVolume(
453458 */
454459void FT3Module::addSingleSensorVolume (
455460 TGeoVolume* motherVolume, int layerNumber, int direction, unsigned stave_idx,
456- unsigned * volume_count, double active_x_mid, double y_mid, double z_mid,
461+ unsigned volume_count, double active_x_mid, double y_mid, double z_mid,
457462 bool isLeft)
458463{
459464 TGeoVolume* sensor;
460465 TGeoManager* geoManager = gGeoManager ;
461466 // ACTIVE AREA
462- std::string sensor_name = " FT3Sensor_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (stave_idx) + " _" + std::to_string (*volume_count);
467+ std::string sensor_name = " FT3Sensor_" + std::to_string (direction) + " _"
468+ + std::to_string (layerNumber) + " _" + std::to_string (stave_idx)
469+ + " _" + std::to_string (volume_count);
463470 sensor = geoManager->MakeBox (sensor_name.c_str (), siliconMed, Constants::active_width / 2 ,
464471 Constants::single_sensor_height / 2 , Constants::siliconThickness / 2 );
465472 sensor->SetLineColor (Constants::SiColor);
466473 sensor->SetFillColorAlpha (Constants::SiColor, 0.4 );
467474 motherVolume->AddNode (
468475 sensor,
469- * volume_count,
476+ volume_count,
470477 new TGeoTranslation ( // midpoint of box to add
471478 active_x_mid,
472479 y_mid,
473480 z_mid) // TGeoTranslation
474481 ); // addNode
475- (* volume_count)++;
482+ (volume_count)++;
476483 // INACTIVE STRIP ON LEFT OR RIGHT
477484 double inactive_x_mid = isLeft ? (active_x_mid - Constants::active_width / 2 - Constants::inactive_width / 2 )
478485 : (active_x_mid + Constants::active_width / 2 + Constants::inactive_width / 2 );
479- std::string sensor_inactive_name =
480- " FT3Sensor_Inactive_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (stave_idx) + " _" + std::to_string (*volume_count);
486+ std::string sensor_inactive_name = " FT3Sensor_Inactive_" + std::to_string (direction) + " _"
487+ + std::to_string (layerNumber) + " _" + std::to_string (stave_idx)
488+ + " _" + std::to_string (volume_count);
481489 sensor = geoManager->MakeBox (sensor_inactive_name.c_str (), siliconMed, Constants::inactive_width / 2 ,
482490 Constants::single_sensor_height / 2 , Constants::siliconThickness / 2 );
483491 sensor->SetLineColor (Constants::SiInactiveColor);
484492 sensor->SetFillColorAlpha (Constants::SiInactiveColor, 0.4 );
485493 motherVolume->AddNode (
486494 sensor,
487- * volume_count,
495+ volume_count,
488496 new TGeoTranslation ( // midpoint of box to add
489497 inactive_x_mid,
490498 y_mid,
491499 z_mid) // TGeoTranslation
492500 ); // addNode
493- (* volume_count)++;
501+ (volume_count)++;
494502}
495503
496504void FT3Module::create_layout_staveGeo (double mZ , int layerNumber, int direction,
497505 double Rin, double Rout, double z_offset_local,
498506 const Constants::StaveConfig& staveConfig,
499507 TGeoVolume* motherVolume)
500508{
501- LOG (debug) << " FT3Module: create_layout_staveGeo - Layer "
502- << layerNumber << " , Direction " << direction ;
509+ LOG (debug) << " FT3Module: create_layout_staveGeo - Direction "
510+ << direction << " , Layer " << layerNumber ;
503511
504512 FT3Module::initialize_materials ();
505513 auto & ft3Params = o2::ft3::FT3BaseParam::Instance ();
@@ -546,7 +554,6 @@ void FT3Module::create_layout_staveGeo(double mZ, int layerNumber, int direction
546554
547555 // initialise all y_positions, vector over all staves/columns
548556 std::vector<PosNegPositionTypes> y_positionsPosNeg;
549- unsigned volume_count = 0 ; // give each subvolume a unique ID
550557 // stave triangle cross sections are the same for every stave (direction based)
551558 std::array<std::array<double , 3 >, 4 > staveTriangles = buildStaveTriangle (direction);
552559 // declare vector with number of 2xn sensor stacks (modules) -- only used for logging
@@ -556,6 +563,7 @@ void FT3Module::create_layout_staveGeo(double mZ, int layerNumber, int direction
556563 std::vector<unsigned >(Constants::kSensorsPerStack .size (), 0 )
557564 );
558565 std::vector<unsigned > nSensorStackTotal (Constants::kSensorsPerStack .size (), 0 );
566+ unsigned staveVolumeCount = 0 ;
559567 for (unsigned i_stave = 0 ; i_stave < staveConfig.x_midpoints .size (); i_stave++) {
560568 y_positionsPosNeg.emplace_back (PosNegPositionTypes{PositionTypes{}, PositionTypes{}});
561569 const int staveID = Constants::staveIdxToID (i_stave, staveConfig.x_midpoints .size ());
@@ -651,18 +659,18 @@ void FT3Module::create_layout_staveGeo(double mZ, int layerNumber, int direction
651659 double z_stave_shift_forward = // move staves more inward to fit in layer volume
652660 -z_offset_to_carbon_face + z_stave_shift_abs;
653661 std::string stave_volume_name =
654- " Stave_ " + std::to_string (i_stave ) + " _" + std::to_string (layerNumber) +
655- " _" + std::to_string (direction );
662+ " FT3_Stave_ " + std::to_string (direction ) + " _" + std::to_string (layerNumber) +
663+ " _" + std::to_string (i_stave );
656664
657665 // Create the stave volumes and fill the y positions where to put sensors on the stave
658666 addStaveVolume (
659- motherVolume, stave_volume_name, direction, &volume_count ,
667+ motherVolume, stave_volume_name, direction, &staveVolumeCount ,
660668 staveConfig.y_lengths [i_stave], staveTriangles, absAllowedYRange,
661669 staveConfig.x_midpoints [i_stave], y_midpoint, z_stave_shift_forward);
662670 // Now create the mirrored stave
663671 if (mirrorStaveAroundX) {
664672 addStaveVolume (
665- motherVolume, stave_volume_name + " _mirrored" , direction, &volume_count ,
673+ motherVolume, stave_volume_name + " _mirrored" , direction, &staveVolumeCount ,
666674 staveConfig.y_lengths [i_stave], staveTriangles, absAllowedYRange,
667675 staveConfig.x_midpoints [i_stave], -y_midpoint, z_stave_shift_forward);
668676 }
@@ -728,6 +736,7 @@ void FT3Module::create_layout_staveGeo(double mZ, int layerNumber, int direction
728736 : -Constants::z_offsetStave (staveConfig.x_midpoint_spacing );
729737 }
730738
739+ unsigned sensor_count = 0 ; // reset for each stave
731740 for (int y_sign = -1 ; y_sign < 2 ; y_sign += 2 ) {
732741 // place sensors at positive and negative y
733742 const auto & positions = (y_sign == 1 ) ? y_positionsPosNeg[i_stave].first
@@ -741,34 +750,35 @@ void FT3Module::create_layout_staveGeo(double mZ, int layerNumber, int direction
741750 // left single sensor of the 2x1
742751 double z_mid = z_offset_to_silicon * z_offset_multiplier + z_stave_shift;
743752 addSingleSensorVolume (
744- motherVolume, layerNumber, direction, i_stave, &volume_count ,
753+ motherVolume, layerNumber, direction, i_stave, sensor_count ,
745754 x_mid - Constants::active_width / 2 , y_mid, z_mid, true );
746755 // right single sensor of the 2x1
747756 addSingleSensorVolume (
748- motherVolume, layerNumber, direction, i_stave, &volume_count ,
757+ motherVolume, layerNumber, direction, i_stave, sensor_count ,
749758 x_mid + Constants::active_width / 2 , y_mid, z_mid, false );
750759 // ------------ (2) Epoxy glue layer between silicon and copper (FPC) ------------
751760 z_mid = z_offset_to_glue_Si * z_offset_multiplier + z_stave_shift;
752761 add2x1GlueVolume (
753- motherVolume, layerNumber, direction, i_stave, &volume_count ,
762+ motherVolume, layerNumber, direction, i_stave, sensor_count ,
754763 x_mid, y_mid, z_mid, " SiCu" );
755764 // ------------ (3) Copper layer (FPC) ------------
756765 z_mid = z_offset_to_copper * z_offset_multiplier + z_stave_shift;
757766 add2x1CopperVolume (
758- motherVolume, layerNumber, direction, i_stave, &volume_count ,
767+ motherVolume, layerNumber, direction, i_stave, sensor_count ,
759768 x_mid, y_mid, z_mid);
760769 // ------------ (4) Kapton layer (FPC) ------------
761770 z_mid = z_offset_to_kapton * z_offset_multiplier + z_stave_shift;
762771 add2x1KaptonVolume (
763- motherVolume, layerNumber, direction, i_stave, &volume_count ,
772+ motherVolume, layerNumber, direction, i_stave, sensor_count ,
764773 x_mid, y_mid, z_mid);
765774 // ------------ (5) Epoxy glue layer between stave and Kapton ------------
766775 z_mid = z_offset_to_glue_Ka * z_offset_multiplier + z_stave_shift;
767776 add2x1GlueVolume (
768- motherVolume, layerNumber, direction, i_stave, &volume_count ,
777+ motherVolume, layerNumber, direction, i_stave, sensor_count ,
769778 x_mid, y_mid, z_mid, " CarbonKapton" );
770779 // increment to next sensor: (height + gap of one sensor)
771780 y_mid += y_sign * (Constants::sensor2x1_height + Constants::sensor2x1_gap);
781+ sensor_count++; // same count for each material in the glued stack of materials
772782 } // sensors in stack
773783 } // for y_sign (writing of positive or negative y positions)
774784 } // i_y_pos
0 commit comments