source: trunk/examples/advanced/Rich/src/RichTbDetectorConstruction.cc @ 1309

Last change on this file since 1309 was 807, checked in by garnier, 16 years ago

update

File size: 4.1 KB
Line 
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// RichTbDetectorConstruction.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 "RichTbMaterialParameters.hh"
34#include "RichTbGeometryParameters.hh"
35#include "RichTbDetectorConstruction.hh"
36#include "RichTbHall.hh"
37#include "RichTbMaterial.hh"
38#include "G4Box.hh"
39#include "G4ThreeVector.hh"
40#include "G4LogicalVolume.hh"
41#include "G4VPhysicalVolume.hh"
42#include "G4PVPlacement.hh"
43#include "G4SDManager.hh"
44#include "RichTbSD.hh"
45
46
47
48RichTbDetectorConstruction::RichTbDetectorConstruction(){; }
49RichTbDetectorConstruction::RichTbDetectorConstruction(RichTbRunConfig* RConfig){
50
51  runConfiguration=RConfig;
52 }
53RichTbDetectorConstruction::~RichTbDetectorConstruction(){;}
54
55G4VPhysicalVolume* RichTbDetectorConstruction::Construct(){
56
57  RichTbRunConfig* rConfig= runConfiguration;
58
59  InitializeRichTbMaterial();
60  HistoRichTbMaterialProperties(rConfig);
61
62  rMaterial = new RichTbMaterial(rConfig);
63
64  InitializeRichTbGeometry();
65
66
67  rTbHall = new RichTbHall(rMaterial);
68   
69  rTbComponent = new RichTbComponent(rMaterial,rTbHall,rConfig,true);
70   
71  rTbPhotoDetector = new RichTbPhotoDetector(rMaterial,rTbComponent,rConfig,true);
72
73
74   //Now for the sensitive Detector
75 
76  G4SDManager* SDman = G4SDManager::GetSDMpointer();
77  G4String HpdSDname = "RichTbSD";
78  G4String RichTbHColname="RichTbHitsCollection";
79 
80   
81  RichTbSD* HpdSD = new RichTbSD( HpdSDname,
82                                  NumberOfHpds,NumberOfSiDetSectors,
83                                  NumberOfPadHpdSiPixels,
84                                  RichTbHColname );
85 
86 
87 
88   G4String ROgeometryName = "RichTbROGeom";
89   
90   rTbROGeom = new RichTbROGeometry(ROgeometryName,rMaterial, rConfig);
91   
92   rTbROGeom -> BuildROGeometry();
93   HpdSD ->SetROgeometry( rTbROGeom);
94   SDman->AddNewDetector( HpdSD );
95   G4int NumHpd = NumberOfHpds;
96
97   for (G4int ihpd=0 ; ihpd < NumHpd ; ihpd++ ) { 
98     G4int NumSiSect=rTbPhotoDetector-> getRichHPD(ihpd) ->
99       getNumSectInHpd(); 
100     for (G4int isec=0; isec < NumSiSect; isec++) {
101       G4LogicalVolume* RichTbSiDetSect_LV =rTbPhotoDetector -> 
102         getRichHPD(ihpd)-> getRichHpdSiDetSect(isec)->
103         getHpdSiSectLogicalVolume();
104       RichTbSiDetSect_LV->SetSensitiveDetector( HpdSD ); 
105        }
106      }
107
108
109   rTbGraphics = new RichTbGraphics(rTbHall,rTbComponent,
110                                rTbPhotoDetector,rTbROGeom, rConfig );
111
112
113  return rTbHall->getRichTbHallPhysicalVolume();
114}
115
116
117
118
119
120
Note: See TracBrowser for help on using the repository browser.