6 #define _STAVE_NAME_ "VtxStave"
7 #define _CHIP_NAME_ "VtxChip"
16 vtx->SetFileName(
"vtx.root");
28 unsigned staveNumMax = staveNum[
_LAYER_NUM_-1], staveNumSum = 0;
31 double chipWidth = 1.000;
32 double chipLength = 2.000;
33 double chipThickness = 0.002;
35 int chipsPerStave = 10;
38 double staveWidth = chipWidth + 0.100;
39 double staveLength = chipsPerStave*(chipLength + 0.010);
41 double staveThickness = 0.030;
44 double staveSlope = 10.0;
47 auto stave =
new TGeoBBox(
_STAVE_NAME_, staveWidth/2, staveLength/2, staveThickness/2);
48 auto vstave =
new TGeoVolume(
_STAVE_NAME_, stave,
vtx->GetMedium(
"X0=10cm"));
51 auto chip =
new TGeoBBox(
_CHIP_NAME_, chipWidth/2, chipLength/2, chipThickness/2);
52 auto vchip =
new TGeoVolume(
_CHIP_NAME_, chip,
vtx->GetMedium(
"silicon"));
56 double step = chipLength + (staveLength - chipsPerStave*chipLength)/chipsPerStave;
57 for(
int ichip=0; ichip<chipsPerStave; ichip++) {
58 double yOffset = (ichip - (chipsPerStave-1)/2.0)*
step;
60 vstave->AddNode(vchip, ichip,
new TGeoCombiTrans(0.0, yOffset, 0.0, 0));
65 unsigned staveCounter = 0;
69 unsigned group =
vtx->AddLogicalVolumeGroup(
_LAYER_NUM_, staveNumMax, chipsPerStave);
72 for(
unsigned ilayer=0; ilayer<
_LAYER_NUM_; ilayer++)
73 staveNumSum += staveNum[ilayer];
76 auto xmap =
vtx->CreateNewMap();
80 xmap->AddGeantVolumeLevel(
_CHIP_NAME_, chipsPerStave);
85 for(
unsigned ilayer=0; ilayer<
_LAYER_NUM_; ilayer++) {
87 for(
unsigned istave=0; istave<staveNum[ilayer]; istave++) {
90 for(
unsigned ichip=0; ichip<chipsPerStave; ichip++) {
93 UInt_t geant[2] = {ichip, staveCounter}, logical[3] = {ilayer, istave, ichip};
95 if (
vtx->SetMappingTableEntry(xmap, geant, group, logical)) {
96 cout <<
"Failed to set mapping table entry!" << endl;
103 double degAngle = istave*360.0/staveNum[ilayer];
104 double radAngle = degAngle*TMath::Pi()/180.0;
106 auto rw =
new TGeoRotation();
108 double fullAngle = degAngle + staveSlope;
109 rw->SetAngles(90.0, 0.0 - fullAngle, 180.0, 0.0, 90.0, 90.0 - fullAngle);
112 vtx->GetTopVolume()->AddNode(vstave, staveCounter++,
113 new TGeoCombiTrans(radius[ilayer]*sin(radAngle),
114 radius[ilayer]*
cos(radAngle), 0.0,
rw));
120 vtx->GetColorTable()->AddPatternMatch(
"VtxStave", kGray);
121 vtx->GetTransparencyTable()->AddPatternMatch(
"VtxStave", 40);
122 vtx->GetColorTable()->AddPatternMatch(
"VtxChip", kYellow);
127 vtx->FinalizeOutput();