@@ -366,6 +366,11 @@ void Geometry::setParameters(std::string geometryfile)
366366 LOG (debug) << " The size of the HCAL readout tower will be : " << mGlobal_HCAL_Tower_Size ;
367367 }
368368
369+ if (command.find (" HCAL_PITCH_SIZE" ) != std::string::npos) {
370+ mGlobal_HCAL_Pitch_Size = std::stof (tokens[1 ]);
371+ LOG (debug) << " The distance between fibers is : " << mGlobal_HCAL_Pitch_Size ;
372+ }
373+
369374 if (command.find (" HCAL_TOWER_NX" ) != std::string::npos) {
370375 mGlobal_HCAL_Tower_NX = std::stoi (tokens[1 ]);
371376 LOG (debug) << " The number of the HCAL readout towers in X will be : " << mGlobal_HCAL_Tower_NX ;
@@ -376,6 +381,11 @@ void Geometry::setParameters(std::string geometryfile)
376381 LOG (debug) << " The number of the HCAL readout towers in Y will be : " << mGlobal_HCAL_Tower_NY ;
377382 }
378383
384+ if (command.find (" HCAL_BEAMPIPE" ) != std::string::npos) {
385+ mGlobal_HCAL_BeamPipeHole_Size = std::stof (tokens[1 ]);
386+ LOG (debug) << " The HCAL beam pipe openning : " << mGlobal_HCAL_BeamPipeHole_Size ;
387+ }
388+
379389 if (command.find (" PIX_OffsetX" ) != std::string::npos) {
380390 mGlobal_PIX_OffsetX = std::stof (tokens[1 ]);
381391 LOG (debug) << " Pixel offset from the beam pipe will be: " << mGlobal_PIX_OffsetX ;
@@ -429,11 +439,6 @@ void Geometry::setParameters(std::string geometryfile)
429439 if (command.find (" NUMBER_OF_HCAL_LAYERS" ) != std::string::npos) {
430440 mNHCalLayers = std::stoi (tokens[1 ]);
431441 LOG (debug) << " Number of HCAL layers " << mNHCalLayers ;
432- if (mNHCalLayers == 1 ) {
433- mUseSandwichHCAL = false ;
434- } else {
435- mUseSandwichHCAL = true ;
436- }
437442 }
438443
439444 if (command.find (" NUMBER_OF_SEGMENTS" ) != std::string::npos) {
@@ -640,6 +645,14 @@ void Geometry::setParameters(std::string geometryfile)
640645 mHCalLayerThickness = center_z;
641646 center_z = 0 ;
642647
648+ if (mNHCalLayers == 1 && hHCal > 2 ) {
649+ mHCALDesign = Geometry::HCALDesgin::Sheets;
650+ } else if (mNHCalLayers == 1 && hHCal == 2 ) {
651+ mHCALDesign = Geometry::HCALDesgin::Spaghetti;
652+ } else {
653+ mHCALDesign = Geometry::HCALDesgin::Sandwich;
654+ }
655+
643656 mFrontMatterLayerThickness = center_z;
644657 LOG (debug) << " end of SetParameters " ;
645658}
@@ -702,27 +715,34 @@ std::tuple<double, double, double> Geometry::getGeoTowerCenter(int tower, int se
702715 int ix = id % nCols;
703716 int iy = id / nRows;
704717
705- if (mUseSandwichHCAL ) {
706- float padSize = mVirtualSegmentComposition [segment].mPadSize ;
707- double hCALsizeX = nCols * padSize;
708- double hCALsizeY = nRows * padSize;
709- x = ix * padSize + 0.5 * padSize - 0.5 * hCALsizeX;
710- y = iy * padSize + 0.5 * padSize - 0.5 * hCALsizeY;
711- } else {
712- nCols = std::floor (getFOCALSizeX () / getHCALTowerSize () + 0.001 ) + 1 ;
713- nRows = std::floor (getFOCALSizeY () / getHCALTowerSize () + 0.001 );
714- ix = id % nCols;
715- iy = id / nRows;
716- double beamPipeRadius = 3.6 ; // in cm TODO: check if this is OK
717- double towerHalfDiag = std::sqrt (2 ) * 0.5 * getTowerSizeX (); // tower half diagonal
718- double minRadius = beamPipeRadius + towerHalfDiag;
719-
720- float towerSize = getHCALTowerSize () / 7 ; // To be set from outside (number of channels on x & y)
721- y = iy * towerSize + 0.5 * towerSize - 0.5 * towerSize * nRows;
722- x = ix * towerSize + 0.5 * towerSize - 0.5 * towerSize * nCols;
723- if (y < minRadius && y > -minRadius) {
724- x = int (x) <= 0 ? x - (minRadius - towerSize) : x + (minRadius - towerSize);
718+ switch (mHCALDesign ) {
719+ case HCALDesgin::Sandwich: {
720+ float padSize = mVirtualSegmentComposition [segment].mPadSize ;
721+ double hCALsizeX = nCols * padSize;
722+ double hCALsizeY = nRows * padSize;
723+
724+ x = ix * padSize + 0.5 * padSize - 0.5 * hCALsizeX;
725+ y = iy * padSize + 0.5 * padSize - 0.5 * hCALsizeY;
726+ break ;
725727 }
728+ case HCALDesgin::Spaghetti: {
729+ float towerSize = getHCALTowerSize () / 7 ; // To be set from outside (number of channels on x & y)
730+ y = iy * towerSize + 0.5 * towerSize - 0.5 * towerSize * nRows;
731+ x = ix * towerSize + 0.5 * towerSize - 0.5 * towerSize * nCols;
732+ break ;
733+ }
734+ case HCALDesgin::Sheets: {
735+ Composition comp1 = mHCalCompositionBase [0 ];
736+ Composition comp2 = mHCalCompositionBase [2 ];
737+ double hCALsizeX = comp1.sizeX () * 2 ; // Size of two sheet in X
738+ double hCALsizeY = getHCALTowersInY () * (comp1.sizeY () + comp2.sizeY ()) * 2 ; // To be set in a better way
739+
740+ x = ix * hCALsizeX / getHCALTowersInX () + 0.5 * hCALsizeX / getHCALTowersInX () - 0.5 * hCALsizeX;
741+ y = iy * hCALsizeY / getHCALTowersInY () + 0.5 * hCALsizeY / getHCALTowersInY () - 0.5 * hCALsizeY;
742+ break ;
743+ }
744+ default :
745+ break ;
726746 }
727747 }
728748
@@ -1118,12 +1138,41 @@ std::tuple<bool, int, int, int, int> Geometry::getVirtualInfo(double x, double y
11181138 x = x < 0 ? x - 0.001 : x + 0.001 ;
11191139 y = y < 0 ? y - 0.001 : y + 0.001 ;
11201140 }
1121- if (!mUseSandwichHCAL ) {
1122- row = (int )((y + hCALsizeY / 2 ) / (towerSize / 7 ));
1123- col = (int )((x + hCALsizeX / 2 ) / (towerSize / 7 ));
1124- } else {
1125- row = (int )((y + hCALsizeY / 2 ) / (towerSize));
1126- col = (int )((x + hCALsizeX / 2 ) / (towerSize));
1141+
1142+ switch (mHCALDesign ) {
1143+ case HCALDesgin::Sandwich: {
1144+ row = (int )((y + hCALsizeY / 2 ) / (towerSize));
1145+ col = (int )((x + hCALsizeX / 2 ) / (towerSize));
1146+ break ;
1147+ }
1148+ case HCALDesgin::Spaghetti: {
1149+ row = (int )((y + hCALsizeY / 2 ) / (towerSize / 7 ));
1150+ col = (int )((x + hCALsizeX / 2 ) / (towerSize / 7 ));
1151+ break ;
1152+ }
1153+ case HCALDesgin::Sheets: {
1154+ Composition comp1 = mHCalCompositionBase [0 ];
1155+ Composition comp2 = mHCalCompositionBase [2 ];
1156+ double hCALsizeX = comp1.sizeX () * 2 ; // Size of two sheet in X
1157+ double hCALsizeY = getHCALTowersInY () * (comp1.sizeY () + comp2.sizeY ()) * 2 ; // To be set in a better way
1158+
1159+ if (y < getHCALBeamPipeHoleSize () / 2 && y > -getHCALBeamPipeHoleSize () / 2 ) {
1160+ if (x < 0 ) {
1161+ x += 1.0 ; // remove the offset around the beam pipe
1162+ } else {
1163+ x -= 1.0 ; // remove the offset around the beam pipe
1164+ }
1165+ }
1166+
1167+ row = (int )((y + hCALsizeY / 2 ) / (hCALsizeY / getHCALTowersInY ()));
1168+ if (x > 0 ) {
1169+ x = x - 0.15 - 0.06 ;
1170+ }
1171+ col = (int )((x - 0.15 + hCALsizeX / 2 ) / ((hCALsizeX - 0.15 * 2 - 0.06 * 2 ) / getHCALTowersInX ()));
1172+ break ;
1173+ }
1174+ default :
1175+ break ;
11271176 }
11281177 } else {
11291178 row = (int )((y + getFOCALSizeY () / 2 ) / mVirtualSegmentComposition [segment].mPadSize );
@@ -1150,12 +1199,29 @@ std::tuple<bool, double, double, double> Geometry::getXYZFromColRowSeg(int col,
11501199 double hCALsizeX = getHCALTowersInX () * towerSize;
11511200 double hCALsizeY = getHCALTowersInY () * towerSize;
11521201
1153- if (!mUseSandwichHCAL ) {
1154- y = -1 * hCALsizeY / 2 + ((float )row + 0.5 ) * (towerSize / 7 );
1155- x = -1 * hCALsizeX / 2 + ((float )col + 0.5 ) * (towerSize / 7 );
1156- } else {
1157- y = -1 * hCALsizeY / 2 + ((float )row + 0.5 ) * (towerSize);
1158- x = -1 * hCALsizeX / 2 + ((float )col + 0.5 ) * (towerSize);
1202+ switch (mHCALDesign ) {
1203+ case HCALDesgin::Sandwich: {
1204+ y = -1 * hCALsizeY / 2 + ((float )row + 0.5 ) * (towerSize);
1205+ x = -1 * hCALsizeX / 2 + ((float )col + 0.5 ) * (towerSize);
1206+ break ;
1207+ }
1208+ case HCALDesgin::Spaghetti: {
1209+ y = -1 * hCALsizeY / 2 + ((float )row + 0.5 ) * (towerSize / 7 );
1210+ x = -1 * hCALsizeX / 2 + ((float )col + 0.5 ) * (towerSize / 7 );
1211+ break ;
1212+ }
1213+ case HCALDesgin::Sheets: {
1214+ Composition comp1 = mHCalCompositionBase [0 ];
1215+ Composition comp2 = mHCalCompositionBase [2 ];
1216+ double hCALsizeX = comp1.sizeX () * 2 ; // Size of two sheet in X
1217+ double hCALsizeY = getHCALTowersInY () * (comp1.sizeY () + comp2.sizeY ()) * 2 ; // To be set in a better way
1218+
1219+ y = -1 * hCALsizeY / 2 + ((float )row + 0.5 ) * (hCALsizeY / getHCALTowersInY ());
1220+ x = -1 * hCALsizeX / 2 + ((float )col + 0.5 ) * (hCALsizeX / getHCALTowersInX ());
1221+ break ;
1222+ }
1223+ default :
1224+ break ;
11591225 }
11601226 } else {
11611227 y = -1 * getFOCALSizeY () / 2 + ((float )row + 0.5 ) * mVirtualSegmentComposition [segment].mPadSize ;
@@ -1191,12 +1257,24 @@ std::tuple<bool, int, int> Geometry::getVirtualNColRow(int segment) const
11911257 nCol = (int )(getFOCALSizeX () / mVirtualSegmentComposition [segment].mPadSize + 0.001 );
11921258 nRow = (int )(getFOCALSizeY () / mVirtualSegmentComposition [segment].mPadSize + 0.001 );
11931259 if (getVirtualIsHCal (segment)) {
1194- if (!mUseSandwichHCAL ) {
1195- nCol = getHCALTowersInX () * 7 ; // To be set from outside (number of channels in each tower on x)
1196- nRow = getHCALTowersInY () * 7 ; // To be set from outside (number of channels in each tower on y)
1197- } else {
1198- nCol = getHCALTowersInX ();
1199- nRow = getHCALTowersInY ();
1260+ switch (mHCALDesign ) {
1261+ case HCALDesgin::Sandwich: {
1262+ nCol = getHCALTowersInX ();
1263+ nRow = getHCALTowersInY ();
1264+ break ;
1265+ }
1266+ case HCALDesgin::Spaghetti: {
1267+ nCol = getHCALTowersInX () * 7 ; // To be set from outside (number of channels in each tower on x)
1268+ nRow = getHCALTowersInY () * 7 ; // To be set from outside (number of channels in each tower on y)
1269+ break ;
1270+ }
1271+ case HCALDesgin::Sheets: {
1272+ nCol = getHCALTowersInX ();
1273+ nRow = getHCALTowersInY ();
1274+ break ;
1275+ }
1276+ default :
1277+ break ;
12001278 }
12011279 }
12021280 return {true , nCol, nRow};
0 commit comments