@@ -181,6 +181,45 @@ TGeoVolume* TRKLayer::createModule(std::string type)
181181 return moduleVol;
182182}
183183
184+ TGeoVolume* TRKLayer::createHalfStave (std::string type)
185+ {
186+ TGeoMedium* medAir = gGeoManager ->GetMedium (" TRK_AIR$" );
187+ std::string halfStaveName = GeometryTGeo::getTRKHalfStavePattern () + std::to_string (mLayerNumber );
188+
189+ TGeoShape* halfStave;
190+ TGeoVolume* halfStaveVol;
191+
192+ if (type == " cylinder" ) {
193+ halfStave = new TGeoTube (mInnerRadius , mInnerRadius + mChipThickness , mChipLength / 2 );
194+ halfStaveVol = new TGeoVolume (halfStaveName.c_str (), halfStave, medAir);
195+
196+ TGeoVolume* moduleVol = createModule (" cylinder" );
197+ LOGP (info, " Inserting {} in {} " , moduleVol->GetName (), halfStaveVol->GetName ());
198+ halfStaveVol->AddNode (moduleVol, 1 , nullptr );
199+ } else if (type == " flat" ) {
200+ double moduleLength = constants::moduleMLOT::length;
201+ double staveWidth = constants::ML::width;
202+ double staveLength = constants::ML::length;
203+
204+ halfStave = new TGeoBBox (staveWidth / 2 , mChipThickness / 2 , staveLength / 2 );
205+ halfStaveVol = new TGeoVolume (halfStaveName.c_str (), halfStave, medAir);
206+
207+ for (int iModule = 0 ; iModule < mNumberOfModules ; iModule++) {
208+ TGeoVolume* moduleVol = createModule (" flat" );
209+
210+ // Put the modules in the correct position
211+ double zPos = -0.5 * mNumberOfModules * moduleLength + (iModule + 0.5 ) * moduleLength;
212+
213+ TGeoCombiTrans* trans = new TGeoCombiTrans ();
214+ trans->SetTranslation (0 , 0 , zPos); // TO BE CHECKED !!!
215+
216+ LOGP (info, " Inserting {} in {} " , moduleVol->GetName (), halfStaveVol->GetName ());
217+ halfStaveVol->AddNode (moduleVol, iModule, trans);
218+ }
219+ }
220+ return halfStaveVol;
221+ }
222+
184223TGeoVolume* TRKLayer::createStave (std::string type)
185224{
186225 TGeoMedium* medAir = gGeoManager ->GetMedium (" TRK_AIR$" );
@@ -199,7 +238,7 @@ TGeoVolume* TRKLayer::createStave(std::string type)
199238 } else if (type == " flat" ) {
200239 double moduleLength = constants::moduleMLOT::length;
201240 double staveWidth = constants::ML::width;
202- double staveLength = constants::ML ::length;
241+ double staveLength = constants::moduleMLOT ::length * mNumberOfModules ;
203242
204243 stave = new TGeoBBox (staveWidth / 2 , mChipThickness / 2 , staveLength / 2 );
205244 staveVol = new TGeoVolume (staveName.c_str (), stave, medAir);
@@ -217,15 +256,17 @@ TGeoVolume* TRKLayer::createStave(std::string type)
217256 staveVol->AddNode (moduleVol, iModule, trans);
218257 }
219258 } else if (type == " staggered" ) {
220- double moduleWidth = constants::moduleMLOT::width;
221- double moduleLength = constants::moduleMLOT::length;
259+ /* double moduleWidth = constants::moduleMLOT::width;
260+ double moduleLength = constants::moduleMLOT::length;*/
261+
262+ double halfstaveWidth = constants::ML::width;
222263 double staveWidth = constants::OT::width; // Each stave has two modules (based on the LOI design)
223- double staveLength = constants::OT ::length;
264+ double staveLength = constants::moduleMLOT ::length * mNumberOfModules ;
224265
225266 stave = new TGeoBBox (staveWidth / 2 , mLogicalVolumeThickness / 2 , staveLength / 2 );
226267 staveVol = new TGeoVolume (staveName.c_str (), stave, medAir);
227268
228- for (int iModule = 0 ; iModule < mNumberOfModules ; iModule++) {
269+ /* for (int iModule = 0; iModule < mNumberOfModules; iModule++) {
229270 TGeoVolume* moduleVolLeft = createModule("flat");
230271 TGeoVolume* moduleVolRight = createModule("flat");
231272
@@ -243,7 +284,21 @@ TGeoVolume* TRKLayer::createStave(std::string type)
243284 transRight->SetTranslation(xRight, 0.2, zPos); // TO BE CHECKED !!! 1mm overlap between the modules
244285 LOGP(info, "Inserting {} in {} ", moduleVolRight->GetName(), staveVol->GetName());
245286 staveVol->AddNode(moduleVolRight, iModule * 2 + 1, transRight);
246- }
287+ }*/
288+
289+ // Put the half staves in the correct position
290+ TGeoVolume* halfStaveVolLeft = createHalfStave (" flat" );
291+ TGeoVolume* halfStaveVolRight = createHalfStave (" flat" );
292+
293+ TGeoCombiTrans* transLeft = new TGeoCombiTrans ();
294+ transLeft->SetTranslation (-halfstaveWidth / 2 + 0.05 , 0 , 0 ); // TO BE CHECKED !!! 1mm overlap between the modules
295+ LOGP (info, " Inserting {} in {} " , halfStaveVolLeft->GetName (), staveVol->GetName ());
296+ staveVol->AddNode (halfStaveVolLeft, 0 , transLeft);
297+
298+ TGeoCombiTrans* transRight = new TGeoCombiTrans ();
299+ transRight->SetTranslation (halfstaveWidth / 2 - 0.05 , 0 , 0 ); // TO BE CHECKED !!! 1mm overlap between the modules
300+ LOGP (info, " Inserting {} in {} " , halfStaveVolRight->GetName (), staveVol->GetName ());
301+ staveVol->AddNode (halfStaveVolRight, 1 , transRight);
247302 } else {
248303 LOGP (fatal, " Chip of type '{}' is not implemented" , type);
249304 }
0 commit comments