| 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 | // RichTbRunConfig.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 "RichTbRunConfig.hh"
|
|---|
| 35 | #include "RichTbMaterialParameters.hh"
|
|---|
| 36 | #include "globals.hh"
|
|---|
| 37 | RichTbRunConfig::RichTbRunConfig()
|
|---|
| 38 | :CurAerogelTNumber(std::vector<G4int>(MaxNumberOfAerogelTiles)),
|
|---|
| 39 | CurAerogelType(std::vector<AerogelType>(MaxNumberOfAerogelTiles)){
|
|---|
| 40 |
|
|---|
| 41 | const char* RunConfigFile = "RunConfig.dat" ;
|
|---|
| 42 | G4cout<<" Run Configuration Input is from "<< RunConfigFile<<G4endl;
|
|---|
| 43 | G4double rPressureN2,rTemperatureN2;
|
|---|
| 44 | G4double rMirrorAddTiltXDeg;
|
|---|
| 45 | G4double rMirrorAddTiltYDeg;
|
|---|
| 46 | G4double unitofPressureN2=1.0*bar;
|
|---|
| 47 | G4double unitofTemperatureN2=1.0*kelvin;
|
|---|
| 48 |
|
|---|
| 49 | // To reduce the number of control variables to input
|
|---|
| 50 | // from the RunConfig.dat
|
|---|
| 51 | // file, define a defualt set for most them here for the G4Example.
|
|---|
| 52 | // Pressure in bar for the nitrogen.
|
|---|
| 53 | rPressureN2=1.0;
|
|---|
| 54 | //temperature of nitrogen in kelvin.
|
|---|
| 55 | rTemperatureN2=292.0;
|
|---|
| 56 | // refractive index parametrization for nitrogen.
|
|---|
| 57 | // to be removed.
|
|---|
| 58 | RefIndexPara=1;
|
|---|
| 59 | // Mirror tilt in X and Y
|
|---|
| 60 | rMirrorAddTiltXDeg=0.0;
|
|---|
| 61 | rMirrorAddTiltYDeg=0.0;
|
|---|
| 62 |
|
|---|
| 63 | // Assign a default for the graphics variables.
|
|---|
| 64 | RichTbHall_visib=0;
|
|---|
| 65 | RichTbEnclosure_visib=2;
|
|---|
| 66 | RichTbRadFrame_visib=2;
|
|---|
| 67 | RichTbRadUpW_visib=1;
|
|---|
| 68 | RichTbRadDnW_visib=1;
|
|---|
| 69 | RichTbAerogel_visib=1;
|
|---|
| 70 | RichTbAerogelWrap_visib=1;
|
|---|
| 71 | RichTbFilter_visib=1;
|
|---|
| 72 | RichTbMirror_visib=1;
|
|---|
| 73 | RichTbHpdMaster_visib=1;
|
|---|
| 74 | RichTbHpdEnvelopeTube_visib=0;
|
|---|
| 75 | RichTbHpdQuartzW_visib=1;
|
|---|
| 76 | RichTbHpdPhCathode_visib=1;
|
|---|
| 77 | RichTbHpdSiDet_visib=1;
|
|---|
| 78 | RichTbHpdSectCoat_visib=0;
|
|---|
| 79 | RichTbHpdSiPx_visib=0;
|
|---|
| 80 | RichTbDrawTrajectory_visib=1;
|
|---|
| 81 | // Photoelectron energy in keV
|
|---|
| 82 | HpdPhElectronEnergy=16.0;
|
|---|
| 83 | FilterTNumber=1;
|
|---|
| 84 | NumberOfAerogelTiles=1;
|
|---|
| 85 | CurAerogelTNumber[0]=0;
|
|---|
| 86 | //
|
|---|
| 87 | RichTbNumPartEvent=1;
|
|---|
| 88 | RichTbParticleTypeCode=0;
|
|---|
| 89 | RichTbParticleStartPosCode=0;
|
|---|
| 90 | RichTbParticleDirectionCode=0;
|
|---|
| 91 | RichTbParticleEnergyCode=0;
|
|---|
| 92 | RichTbParticleEnergy=9.0;
|
|---|
| 93 | RichTbPhotLowE=1.305;
|
|---|
| 94 | RichTbPhotHighE=7.2;
|
|---|
| 95 | WriteMiscOutputFlag=0;
|
|---|
| 96 | OutputFileName ="../outputData/MyOutputDataFile";
|
|---|
| 97 | OutputHistoDirName="../HistoOutputVop/";
|
|---|
| 98 | AerogelRefDataInputFileName="../inputData/aerogelRefIndexInput.dat";
|
|---|
| 99 | FilterTransDataInputFileName="../inputData/FilterTransInput.dat";
|
|---|
| 100 | MiscOutFileName="../outputData/MyMiscOutputFile";
|
|---|
| 101 | //
|
|---|
| 102 | if(RunConfigFile == 0 ) {
|
|---|
| 103 | G4cout<<"Unable to read the run configuration file "
|
|---|
| 104 | <<" using default values for the control variables "
|
|---|
| 105 | <<" and input and output file names "<<G4endl;
|
|---|
| 106 | }else {
|
|---|
| 107 | G4cout<<"Now getting the run configuration file. "
|
|---|
| 108 | << "the Runconfig file name is "<< RunConfigFile <<G4endl;
|
|---|
| 109 |
|
|---|
| 110 | std::ifstream finp(RunConfigFile);
|
|---|
| 111 |
|
|---|
| 112 | finp>>RichTbHall_visib;
|
|---|
| 113 | finp>>RichTbEnclosure_visib;
|
|---|
| 114 | finp>>RichTbRadFrame_visib;
|
|---|
| 115 | finp>>RichTbRadUpW_visib;
|
|---|
| 116 | finp>>RichTbRadDnW_visib;
|
|---|
| 117 | finp>>RichTbAerogel_visib;
|
|---|
| 118 | finp>>RichTbAerogelWrap_visib;
|
|---|
| 119 | finp>>RichTbFilter_visib;
|
|---|
| 120 | finp>>RichTbMirror_visib;
|
|---|
| 121 | finp>>RichTbHpdMaster_visib;
|
|---|
| 122 | finp>>RichTbHpdEnvelopeTube_visib;
|
|---|
| 123 | finp>>RichTbHpdQuartzW_visib;
|
|---|
| 124 | finp>>RichTbHpdPhCathode_visib;
|
|---|
| 125 | finp>>RichTbHpdSiDet_visib;
|
|---|
| 126 | finp>>RichTbHpdSectCoat_visib;
|
|---|
| 127 | finp>>RichTbHpdSiPx_visib;
|
|---|
| 128 | finp>>RichTbDrawTrajectory_visib;
|
|---|
| 129 | finp>>RichTbParticleEnergy;
|
|---|
| 130 | finp>>FilterTNumber;
|
|---|
| 131 | finp>>WriteOutputFile;
|
|---|
| 132 | finp>>OutputFileName;
|
|---|
| 133 | finp>>OutputHistoDirName;
|
|---|
| 134 | finp>>AerogelRefDataInputFileName;
|
|---|
| 135 | finp>>FilterTransDataInputFileName;
|
|---|
| 136 | }
|
|---|
| 137 | CurrentPressureN2=rPressureN2*unitofPressureN2;
|
|---|
| 138 | CurrentTemperatureN2=rTemperatureN2*unitofTemperatureN2;
|
|---|
| 139 | MirrorAddTiltX = (rMirrorAddTiltXDeg*pi/180)*rad;
|
|---|
| 140 | MirrorAddTiltY = (rMirrorAddTiltYDeg*pi/180)*rad;
|
|---|
| 141 | G4cout<<"Current Run Configuration "<<G4endl;
|
|---|
| 142 | G4cout<<"Nitrogen Gas Pressure= "<<
|
|---|
| 143 | CurrentPressureN2/unitofPressureN2<<" bar"<<G4endl;
|
|---|
| 144 | G4cout<<"Nitrogen Gas Temperature = "
|
|---|
| 145 | <<CurrentTemperatureN2/unitofTemperatureN2<<
|
|---|
| 146 | " kelvin"<<G4endl;
|
|---|
| 147 | G4cout<<"Ref Index parametrization used "<<RefIndexPara<<G4endl;
|
|---|
| 148 | G4cout<<"Addtional Mirror tilts wrt X and Y in rad "<<MirrorAddTiltX
|
|---|
| 149 | <<" "<<MirrorAddTiltY<<G4endl;
|
|---|
| 150 | //For Following variables 0 means make the volume invisible;
|
|---|
| 151 | // 1 means make it visible as a solid.
|
|---|
| 152 | // 2 means make it visible as a wireframe.
|
|---|
| 153 | G4cout<<" RichTbHall_visib = "<<RichTbHall_visib<<G4endl;
|
|---|
| 154 | G4cout<<"RichTbEnclosure_visib = "<<RichTbEnclosure_visib<<G4endl;
|
|---|
| 155 | G4cout<<"RichTbRad Frame_visib, FrameUpW_visib, FrameDnW = "
|
|---|
| 156 | <<RichTbRadFrame_visib
|
|---|
| 157 | <<" "<<RichTbRadUpW_visib<<" "<<RichTbRadDnW_visib
|
|---|
| 158 | <<G4endl;
|
|---|
| 159 | G4cout<<"RichTbAerogel_visib, AerogelWrap_visib = "
|
|---|
| 160 | <<RichTbAerogel_visib<<RichTbAerogelWrap_visib<<G4endl;
|
|---|
| 161 | G4cout<<"RichTbFilter_visib = "<<RichTbFilter_visib<<G4endl;
|
|---|
| 162 | G4cout<<"RichTbMirror_visib = "<<RichTbMirror_visib<<G4endl;
|
|---|
| 163 | G4cout<<"RichTbHpdMaster_visib = "<<RichTbHpdMaster_visib<<G4endl;
|
|---|
| 164 | G4cout<<"RichTbHpdEnvelopeTube_visib = "<<RichTbHpdEnvelopeTube_visib<<G4endl;
|
|---|
| 165 | G4cout<<"RichTbHpdQuartzW_visib = "<<RichTbHpdQuartzW_visib<<G4endl;
|
|---|
| 166 | G4cout<<"RichTbHpdPhCathode_visib = "<<RichTbHpdPhCathode_visib<<G4endl;
|
|---|
| 167 | G4cout<<"RichTbHpdSiDet_visib = "<<RichTbHpdSiDet_visib<<G4endl;
|
|---|
| 168 | G4cout<<"RichTbHpdSiSectCoat_visib = "<<RichTbHpdSectCoat_visib<<G4endl;
|
|---|
| 169 | G4cout<<"RichTbHpdSiPx_visib = "<<RichTbHpdSiPx_visib<<G4endl;
|
|---|
| 170 | G4cout<<"RichTbDrawTrajectory_visib = "<<RichTbDrawTrajectory_visib<<G4endl;
|
|---|
| 171 | G4cout<<"RichTbPhElectronEnergy = "<< HpdPhElectronEnergy<<G4endl;
|
|---|
| 172 |
|
|---|
| 173 | // In the G4example only upto 1 type of filter is used.
|
|---|
| 174 | if (FilterTNumber > 0 ) {
|
|---|
| 175 | G4cout<<"RichTbRunConfig: In the G4example "
|
|---|
| 176 | <<" only 1 type of filter used " <<G4endl;
|
|---|
| 177 | FilterTNumber =0;
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 | FilterTransData =
|
|---|
| 182 | new FilterTrData(FilterTNumber,FilterTransDataInputFileName);
|
|---|
| 183 | CurFilterType= FilterTransData->GetFilterTypeIndex();
|
|---|
| 184 |
|
|---|
| 185 | G4cout<<"Filter Number = "<<FilterTNumber<<G4endl;
|
|---|
| 186 | if(FilterTNumber >= 0 ) {
|
|---|
| 187 | G4cout<<" Filter Type = "<<CurFilterType<<G4endl;
|
|---|
| 188 | } else {
|
|---|
| 189 | G4cout<<"No Filter for this Run "<<G4endl;
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 | // for the G4example 1 tile is used. In the LHCb implementation
|
|---|
| 193 | // upto 5 tiles can be used.
|
|---|
| 194 | if(NumberOfAerogelTiles > 1 ) {
|
|---|
| 195 | G4cout<<" RichTbRunConfig: For the G4Example "
|
|---|
| 196 | <<" the number of aerogel tiles is limited to 1 "
|
|---|
| 197 | <<" Hence setting the number of Tiles to 1 "<<G4endl;
|
|---|
| 198 | NumberOfAerogelTiles =1;
|
|---|
| 199 | }
|
|---|
| 200 | for(G4int iia=0; iia<NumberOfAerogelTiles; iia++) {
|
|---|
| 201 | if(CurAerogelTNumber[iia] == 0 ) CurAerogelType[iia]=AerogelTypeA;
|
|---|
| 202 | if(CurAerogelTNumber[iia] == 1 ) CurAerogelType[iia]=AerogelTypeB;
|
|---|
| 203 | if(CurAerogelTNumber[iia] == 2 ) CurAerogelType[iia]=AerogelTypeC;
|
|---|
| 204 | if(CurAerogelTNumber[iia] == 3 ) CurAerogelType[iia]=AerogelTypeD;
|
|---|
| 205 | if(CurAerogelTNumber[iia] == 4 ) CurAerogelType[iia]=AerogelTypeE;
|
|---|
| 206 | }
|
|---|
| 207 | G4cout<<"Number of Aerogel Tiles "<<NumberOfAerogelTiles<<G4endl;
|
|---|
| 208 | for(G4int ia=0; ia<NumberOfAerogelTiles; ia++ ) {
|
|---|
| 209 | G4cout<<" AerogelNumber and Type "<<CurAerogelTNumber[ia]<<" "<<
|
|---|
| 210 | CurAerogelType[ia]<<G4endl;
|
|---|
| 211 | }
|
|---|
| 212 |
|
|---|
| 213 | G4cout<<"Aerogel RefIndex Input file Name is "
|
|---|
| 214 | <<AerogelRefDataInputFileName<<G4endl;
|
|---|
| 215 |
|
|---|
| 216 | AerogelRefractiveInd= new AerogelRefData(AerogelRefDataInputFileName);
|
|---|
| 217 |
|
|---|
| 218 | G4cout<<"Write Outfile File Flag set to "<<WriteOutputFile<<G4endl;
|
|---|
| 219 | G4cout<<"OutputData file = "<<OutputFileName <<G4endl;
|
|---|
| 220 | G4cout<<"OutputHistoDir = "<<OutputHistoDirName <<G4endl;
|
|---|
| 221 |
|
|---|
| 222 | G4String PaType;
|
|---|
| 223 | if(RichTbParticleTypeCode == 0 )PaType="piminus";
|
|---|
| 224 | if(RichTbParticleTypeCode == 1 )PaType="optical photon";
|
|---|
| 225 | if(RichTbParticleTypeCode == 2 )PaType="Mixture of piminus and proton";
|
|---|
| 226 |
|
|---|
| 227 | G4cout<<"Number of beam particles per event = "<<RichTbNumPartEvent<<G4endl;
|
|---|
| 228 |
|
|---|
| 229 | G4cout<<"Particle Type Code "<<RichTbParticleTypeCode
|
|---|
| 230 | <<" "<< PaType <<G4endl;
|
|---|
| 231 |
|
|---|
| 232 | G4cout<<"Particle Start Pos and Direction Energy codes "
|
|---|
| 233 | << RichTbParticleStartPosCode <<" "<< RichTbParticleDirectionCode
|
|---|
| 234 | <<" "<<RichTbParticleEnergyCode<<G4endl;
|
|---|
| 235 | G4cout<<"Energy code 0 is for charged particle and 1 is for photon generation"
|
|---|
| 236 | << " using particle gun "<<G4endl;
|
|---|
| 237 | G4cout<<"Gun Gen Charged Particle energy in GeV is "
|
|---|
| 238 | <<RichTbParticleEnergy<<G4endl;
|
|---|
| 239 | G4cout<<"Gun Gen Photon energy range in eV is "<<RichTbPhotLowE
|
|---|
| 240 | <<" "<< RichTbPhotHighE <<G4endl;
|
|---|
| 241 |
|
|---|
| 242 | }
|
|---|
| 243 | RichTbRunConfig::~RichTbRunConfig() { ; }
|
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 |
|
|---|