@@ -61,7 +61,7 @@ void Detector::configLayers(bool itof, bool otof, bool ftof, bool btof, std::str
6161 const float x2x0, const float sensorThickness)
6262{
6363
64- const std::pair<float , float > dInnerTof = {21 .f , 129 .f }; // Radius and length
64+ std::pair<float , float > dInnerTof = {21 .f , 129 .f }; // Radius and length
6565 std::pair<float , float > dOuterTof = {92 .f , 680 .f }; // Radius and length
6666 std::pair<float , float > radiusRangeDiskTof = {15 .f , 100 .f };
6767 float zForwardTof = 370 .f ;
@@ -91,6 +91,33 @@ void Detector::configLayers(bool itof, bool otof, bool ftof, bool btof, std::str
9191 dOuterTof.second = 580 .f ;
9292 zForwardTof = 200 .f ;
9393 radiusRangeDiskTof = {20 .f , 68 .f };
94+ } else if (pattern.rfind (" custom/" ) == 0 ) { // custom/itof_radius:23/otof_radius:100/
95+ if (itofSegmented) {
96+ LOG (fatal) << " Custom IOTOF pattern does not support segmented configuration, exiting" ;
97+ }
98+ // Handle custom patterns
99+ TString patternStr (pattern.c_str ());
100+ patternStr.ReplaceAll (" custom/" , " " ); // Remove the "custom/" prefix
101+ TObjArray* tokens = patternStr.Tokenize (" /" );
102+ for (int i = 0 ; i < tokens->GetEntries (); ++i) {
103+ TString token (tokens->At (i)->GetName ());
104+ patternStr.ReplaceAll (token, " " );
105+ if (token.BeginsWith (" itof_radius:" )) {
106+ token.ReplaceAll (" itof_radius:" , " " );
107+ dInnerTof.first = token.Atof ();
108+ LOG (info) << " Custom iTOF radius: " << dInnerTof.first << " cm" ;
109+ } else if (token.BeginsWith (" otof_radius:" )) {
110+ token.ReplaceAll (" otof_radius:" , " " );
111+ dOuterTof.first = token.Atof ();
112+ LOG (info) << " Custom oTOF radius: " << dOuterTof.first << " cm" ;
113+ } else {
114+ LOG (fatal) << " Unrecognized token in custom IOTOF pattern: " << token.Data () << " , exiting" ;
115+ }
116+ }
117+ patternStr.ReplaceAll (" /" , " " );
118+ if (!patternStr.IsWhitespace ()) {
119+ LOG (fatal) << " Unrecognized part in custom IOTOF pattern: " << patternStr.Data () << " , exiting" ;
120+ }
94121 } else {
95122 LOG (fatal) << " IOTOF layer pattern " << pattern << " not recognized, exiting" ;
96123 }
@@ -216,6 +243,7 @@ void Detector::defineSensitiveVolumes()
216243 } else if (pattern == " v3b2a" ) {
217244 } else if (pattern == " v3b2b" ) {
218245 } else if (pattern == " v3b3" ) {
246+ } else if (pattern.rfind (" custom/" ) == 0 ) {
219247 } else {
220248 LOG (fatal) << " IOTOF layer pattern " << pattern << " not recognized, exiting" ;
221249 }
0 commit comments