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 | // filterTrData.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 <fstream> |
---|
34 | #include "FilterTrData.hh" |
---|
35 | #include "RichTbGeometryParameters.hh" |
---|
36 | #include "RichTbMaterialParameters.hh" |
---|
37 | |
---|
38 | FilterTrData::FilterTrData(G4int FilterTypeNum, G4String FilterDataFileName ) |
---|
39 | :NumberOfTrBins(NumFilterTransBins), |
---|
40 | TransWaveL(std::vector<G4double>(NumFilterTransBins)), |
---|
41 | TransValue(std::vector<G4double>(NumFilterTransBins)), |
---|
42 | TransTotValue(std::vector<G4double>(NumFilterTransBins)) |
---|
43 | { |
---|
44 | // In the G4example the same type of filter is used |
---|
45 | // for all types of filters. |
---|
46 | FilterTypeNumber= FilterTypeNum; |
---|
47 | FilterTransDataFileName=FilterDataFileName; |
---|
48 | if( FilterTypeNum >= 0 && FilterTypeNum <= 5 ) { |
---|
49 | FilterTypeIndex = GlassD263; |
---|
50 | FilterRefIndexNominal = RefIndexGlassD263 ; |
---|
51 | } else if (FilterTypeNum == -1 ) { |
---|
52 | G4cout<<" No filter for this run "<<G4endl; |
---|
53 | } else {G4cout<<"FilterTrData : Unknown Filter Type "<<G4endl; } |
---|
54 | |
---|
55 | |
---|
56 | //for now default ref index is provided as that of glassd263. |
---|
57 | |
---|
58 | CurNeighbourRefIndexNominal= NitrogenNominalRefIndex; |
---|
59 | ReadFilterTrans(); |
---|
60 | if(FilterTypeNum >=0 ) { |
---|
61 | FilterThickness = 2.0*FilterHalfZArray[FilterTypeNum]; |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | void FilterTrData::ReadFilterTrans() { |
---|
66 | //first get the filter type index |
---|
67 | FilterType Ftype = GetFilterTypeIndex(); |
---|
68 | if(Ftype == GlassD263 ) { |
---|
69 | const char* D263FilterTransFile= FilterTransDataFileName.c_str(); |
---|
70 | if(D263FilterTransFile != 0 ) { |
---|
71 | G4cout<<"Glass D263 Filter trans is from "<<D263FilterTransFile<<G4endl; |
---|
72 | if(NumberOfTrBins != NumPhotBinGlassD263Trans ) { |
---|
73 | NumberOfTrBins = NumPhotBinGlassD263Trans; |
---|
74 | TransWaveL.resize(NumberOfTrBins); |
---|
75 | TransValue.resize(NumberOfTrBins); |
---|
76 | TransTotValue.resize(NumberOfTrBins); |
---|
77 | } |
---|
78 | std::ifstream finpga(D263FilterTransFile); |
---|
79 | G4double wa,trn; |
---|
80 | //set the order to have increasing in wavelength after reading in. |
---|
81 | //the data file is with decreasing order of wavelength. |
---|
82 | for (G4int fbin=0; fbin< NumberOfTrBins ; fbin++){ |
---|
83 | finpga>>wa; |
---|
84 | finpga>>trn; |
---|
85 | TransWaveL[NumberOfTrBins-fbin-1]=wa; |
---|
86 | // TransValue[NumberOfTrBins-fbin-1]=trn/100.0; |
---|
87 | TransValue[NumberOfTrBins-fbin-1]=GetCurrentFilTrans(trn); |
---|
88 | TransTotValue[NumberOfTrBins-fbin-1]=GetTotFilTrans(trn); |
---|
89 | } |
---|
90 | }else { |
---|
91 | G4cout<<" Unknown file name for filter transmission Data input "<<G4endl; |
---|
92 | G4cout<<" Please specify the correct file name for filter transmission " <<G4endl; |
---|
93 | } |
---|
94 | |
---|
95 | } else { |
---|
96 | G4cout<<"Unknown Filter or No filter"<<G4endl; |
---|
97 | G4cout<<" Please provide the Filter transmission Data " <<G4endl; |
---|
98 | |
---|
99 | } |
---|
100 | } |
---|
101 | |
---|
102 | G4double FilterTrData::GetCurrentFilTrans(G4double trnData) { |
---|
103 | // No wavelength dependance yet for the Fresnel loss at the |
---|
104 | // surfaces. |
---|
105 | G4double trn = trnData/100.0; |
---|
106 | // G4double na= FilterRefIndexNominal; |
---|
107 | // G4double nb= CurNeighbourRefIndexNominal; |
---|
108 | // G4double LossAtFEntrance=std::pow(((na-nb)/(na+nb)),2.0); |
---|
109 | // G4double LossAtFExit = std::pow(((nb-na)/(nb+na)),2.0); |
---|
110 | |
---|
111 | if(trn > 1.0 ) trn=1.0; |
---|
112 | return trn; |
---|
113 | } |
---|
114 | |
---|
115 | G4double FilterTrData::GetTotFilTrans(G4double trnData) { |
---|
116 | // No wavelength dependance yet. |
---|
117 | |
---|
118 | return trnData/100.0; |
---|
119 | |
---|
120 | } |
---|
121 | FilterTrData::~FilterTrData(){ ; } |
---|
122 | |
---|
123 | |
---|
124 | |
---|
125 | |
---|
126 | |
---|
127 | |
---|
128 | |
---|