| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | // Rich advanced example for Geant4
|
|---|
| 27 | // RichTbSiPixel.cc for Rich of LHCb
|
|---|
| 28 | // History:
|
|---|
| 29 | // Created: Sajan Easo (Sajan.Easo@cern.ch)
|
|---|
| 30 | // Revision and changes: Patricia Mendez (Patricia.Mendez@cern.ch)
|
|---|
| 31 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 32 | #include <iostream>
|
|---|
| 33 | #include "globals.hh"
|
|---|
| 34 | #include "G4Box.hh"
|
|---|
| 35 | #include "G4Trd.hh"
|
|---|
| 36 | #include "G4RotationMatrix.hh"
|
|---|
| 37 | #include "G4ThreeVector.hh"
|
|---|
| 38 | #include "G4Transform3D.hh"
|
|---|
| 39 | #include "G4LogicalVolume.hh"
|
|---|
| 40 | #include "G4VPhysicalVolume.hh"
|
|---|
| 41 | #include "G4PVPlacement.hh"
|
|---|
| 42 | #include "G4UnionSolid.hh"
|
|---|
| 43 | #include "RichTbSiPixel.hh"
|
|---|
| 44 | #include "G4SDManager.hh"
|
|---|
| 45 | #include "RichTbSD.hh"
|
|---|
| 46 | #include "RichTbRODummySD.hh"
|
|---|
| 47 | #include "RichTbMaterialParameters.hh"
|
|---|
| 48 | #include "G4IntersectionSolid.hh"
|
|---|
| 49 | RichTbSiPixel::RichTbSiPixel() {;}
|
|---|
| 50 | RichTbSiPixel::~RichTbSiPixel() {;}
|
|---|
| 51 | RichTbSiPixel::RichTbSiPixel(RichTbMaterial* RMaterial,
|
|---|
| 52 | G4VPhysicalVolume* MotherOfSiPixel,
|
|---|
| 53 | G4int IHpdNum, G4int Isector ,G4int ipixel){
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | //
|
|---|
| 57 | //
|
|---|
| 58 | ICurSectorNumber=Isector;
|
|---|
| 59 | HpdSiPixelnum=ipixel;
|
|---|
| 60 | ICurHpdNumber=IHpdNum;
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 | G4Trd* HpdSiSectTrapInt=
|
|---|
| 64 | new G4Trd("HpdSiSectTrapInt",SiSectTrapHalfX1, SiSectTrapHalfX2,
|
|---|
| 65 | SiSectTrapHalfY1,SiSectTrapHalfY2,SiSectTrapHalfZ);
|
|---|
| 66 |
|
|---|
| 67 | G4Box* HpdSiPxBox;
|
|---|
| 68 | if(ipixel == BigPixelNum ) {
|
|---|
| 69 | HpdSiPxBox=new G4Box("HpdSiPxBigBox",
|
|---|
| 70 | SiPixelHalfX,SiPixelHalfY,SiBigPixelHalfZ);
|
|---|
| 71 | }else {
|
|---|
| 72 | HpdSiPxBox=new G4Box("HpdSiPxBox",SiPixelHalfX,SiPixelHalfY,SiPixelHalfZ);
|
|---|
| 73 | }
|
|---|
| 74 | //
|
|---|
| 75 | //For the rotation and translation of the Si Pixel.
|
|---|
| 76 | G4RotationMatrix HpdSiPxRotation, HpdSiSectTrapIntRotation;
|
|---|
| 77 | G4double RichTbHpdSiPxShiftY=HpdSiPixPosZ;
|
|---|
| 78 | G4double RichTbHpdSiPxShiftX
|
|---|
| 79 | =RichTbPadHpdSiPixPos(ipixel).getPadHpdSiPixPosX();
|
|---|
| 80 | G4double RichTbHpdSiPxShiftZ
|
|---|
| 81 | =RichTbPadHpdSiPixPos(ipixel).getPadHpdSiPixPosY()-SiSectTrapHalfZ;
|
|---|
| 82 |
|
|---|
| 83 | G4ThreeVector HpdSiPxTrsl( RichTbHpdSiPxShiftX,
|
|---|
| 84 | RichTbHpdSiPxShiftY,
|
|---|
| 85 | RichTbHpdSiPxShiftZ);
|
|---|
| 86 |
|
|---|
| 87 | G4Transform3D HpdSiPxTransform(HpdSiPxRotation,HpdSiPxTrsl);
|
|---|
| 88 |
|
|---|
| 89 | G4ThreeVector HpdSiSectTrapIntTrsl(0.0*mm, 0.0*mm, 0.0*mm);
|
|---|
| 90 | G4Transform3D HpdSiSectTrapIntTransform( HpdSiSectTrapIntRotation,
|
|---|
| 91 | HpdSiSectTrapIntTrsl);
|
|---|
| 92 | //Now for the placements
|
|---|
| 93 |
|
|---|
| 94 | G4LogicalVolume* HpdSiPxLog;
|
|---|
| 95 | G4VPhysicalVolume* HpdSiPxPhys;
|
|---|
| 96 | // The pixels at the pixel edge are intersected with the
|
|---|
| 97 | // sector. The BigPixel is also at the edge.
|
|---|
| 98 |
|
|---|
| 99 | if(PixelAtSectEdge[ipixel]){
|
|---|
| 100 | G4IntersectionSolid* HpdSiPxTrapBox
|
|---|
| 101 | = new G4IntersectionSolid("PixelSectTrapInt", HpdSiSectTrapInt,
|
|---|
| 102 | HpdSiPxBox, HpdSiPxTransform);
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 | HpdSiPxLog=
|
|---|
| 106 | new G4LogicalVolume( HpdSiPxTrapBox,RMaterial->getHpdSiDetMaterial(),
|
|---|
| 107 | "PixelSectTrapInt",0,0,0);
|
|---|
| 108 |
|
|---|
| 109 | HpdSiPxPhys=
|
|---|
| 110 | new G4PVPlacement(HpdSiSectTrapIntTransform,"PixelSectTrapInt",
|
|---|
| 111 | HpdSiPxLog,MotherOfSiPixel,false,ipixel);
|
|---|
| 112 |
|
|---|
| 113 | }else{
|
|---|
| 114 |
|
|---|
| 115 | HpdSiPxLog=
|
|---|
| 116 | new G4LogicalVolume( HpdSiPxBox,RMaterial->getHpdSiDetMaterial(),
|
|---|
| 117 | "HpdSiPxBox",0,0,0);
|
|---|
| 118 |
|
|---|
| 119 | HpdSiPxPhys=
|
|---|
| 120 | new G4PVPlacement(HpdSiPxTransform,"HpdSiPxBox",
|
|---|
| 121 | HpdSiPxLog,MotherOfSiPixel,false,ipixel);
|
|---|
| 122 |
|
|---|
| 123 | }
|
|---|
| 124 | //Now for the readout dummy sensitive detector
|
|---|
| 125 | // This just flags the pixel as active.
|
|---|
| 126 | //First Get the deadPixel List
|
|---|
| 127 | G4bool thisPixelisAlive=true;
|
|---|
| 128 | std::vector<G4int>DeadPxL = getDeadPixelList(IHpdNum,Isector);
|
|---|
| 129 | for(size_t ideadP=0; ideadP<DeadPxL.size(); ideadP++){
|
|---|
| 130 | if(ipixel == DeadPxL[ideadP] )thisPixelisAlive=false;
|
|---|
| 131 | }
|
|---|
| 132 | PixelIsAlive= thisPixelisAlive;
|
|---|
| 133 | if(thisPixelisAlive){
|
|---|
| 134 | RichTbRODummySD * DummySensi = new RichTbRODummySD;
|
|---|
| 135 |
|
|---|
| 136 | HpdSiPxLog->SetSensitiveDetector(DummySensi);
|
|---|
| 137 | }
|
|---|
| 138 | RichTbHpdSiPixelLVol=HpdSiPxLog;
|
|---|
| 139 | RichTbHpdSiPixelPVol=HpdSiPxPhys;
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|