test_FixedChannelGroupService.cxx
Go to the documentation of this file.
1 // test_FixedChannelGroupService.cxx
2 
3 // David Adams
4 // October 2016
5 //
6 // Test FixedChannelGroupService.
7 
8 #include "../FixedChannelGroupService.h"
9 #include <string>
10 #include <iostream>
11 #include <sstream>
12 #include <fstream>
13 #include <iomanip>
16 
17 using std::string;
18 using std::cout;
19 using std::endl;
20 using std::istringstream;
21 using std::ostringstream;
22 using std::ofstream;
23 using std::setw;
24 using std::vector;
25 using art::ServiceHandle;
26 
27 #undef NDEBUG
28 #include <cassert>
29 
31  const string myname = "test_FixedChannelGroupService: ";
32 #ifdef NDEBUG
33  cout << myname << "NDEBUG must be off." << endl;
34  abort();
35 #endif
36  const string line = "-----------------------------";
37 
38  cout << myname << line << endl;
39  cout << myname << "Create fcl file." << endl;
40  std::ostringstream oss;
41  oss << "services.ChannelGroupService: {" << endl;
42  oss << " service_provider: \"FixedChannelGroupService\"" << endl;
43  oss << " group1: [1, 2, 3, 4]" << endl;
44  oss << " group2: [11, 12, 13]" << endl;
45  oss << "}" << endl;
47 
48  cout << myname << line << endl;
49  cout << myname << "Fetch ChannelGroupService." << endl;
51  hcgs->print(cout, myname);
52 
53  unsigned int ngrp = hcgs->size();
54  cout << myname << "Check group count: " << ngrp << endl;
55  assert( ngrp == 2 );
56 
57  cout << myname << line << endl;
58  cout << myname << "Group names and channels:" << endl;
59  for ( unsigned int igrp=0; igrp<ngrp; ++igrp ) {
60  string name = hcgs->name(igrp);
61  const vector<ChannelGroupService::Index> chans = hcgs->channels(igrp);
62  cout << myname << " " << setw(10) << name << ":";
63  for ( ChannelGroupService::Index chan : chans ) cout << setw(6) << chan;
64  cout << endl;
65  assert( name.size() );
66  assert( name != "NoSuchGroup" );
67  assert( chans.size() );
68  }
69 
70  cout << myname << line << endl;
71  cout << myname << "Fetch ChannelGroupService by pointer." << endl;
73  pcgs->print(cout, myname);
74 
75  cout << myname << line << endl;
76  cout << myname << "Done." << endl;
77  return 0;
78 }
79 
80 int main(int argc, char* argv[]) {
81  if ( argc > 1 ) {
82  cout << "Usage: " << argv[0] << endl;
83  }
85 }
86 
87 
88 //******************************************************************************
89 //*** Big configuration chunks
90 //***
91 
92 // this is a copy of the "standard" LArProperties configuration
94  service_provider: "LArPropertiesServiceStandard"
95 
96  # For following parameters, see http://pdg.lbl.gov/AtomicNuclearProperties/
97  RadiationLength: 19.55 # g/cm^2
98  AtomicNumber: 18 # Ar atomic number.
99  AtomicMass: 39.948 # Ar atomic mass (g/mol).
100  ExcitationEnergy: 188.0 # Ar mean excitation energy (eV).
101 
102 # realistic Argon 39 decays
103 # Argon39DecayRate: 0.00141 # decays per cm^3 per second. Assumes 1.01 Bq/kg and a density of 1.396 g/cc
104 # switch them off for faster simulation
105  Argon39DecayRate: 0.0
106 
107  # Optical properties
108  # Fast and slow scintillation emission spectra, from [J Chem Phys vol 91 (1989) 1469]
109  FastScintEnergies: [ 6.0, 6.7, 7.1, 7.4, 7.7, 7.9, 8.1, 8.4, 8.5, 8.6, 8.8, 9.0, 9.1, 9.4, 9.8, 10.4, 10.7]
110  SlowScintEnergies: [ 6.0, 6.7, 7.1, 7.4, 7.7, 7.9, 8.1, 8.4, 8.5, 8.6, 8.8, 9.0, 9.1, 9.4, 9.8, 10.4, 10.7]
111  FastScintSpectrum: [ 0.0, 0.04, 0.12, 0.27, 0.44, 0.62, 0.80, 0.91, 0.92, 0.85, 0.70, 0.50, 0.31, 0.13, 0.04, 0.01, 0.0]
112  SlowScintSpectrum: [ 0.0, 0.04, 0.12, 0.27, 0.44, 0.62, 0.80, 0.91, 0.92, 0.85, 0.70, 0.50, 0.31, 0.13, 0.04, 0.01, 0.0]
113  ScintResolutionScale: 1. # resolution factor used by G4 scintillation
114  ScintFastTimeConst: 6. # fast scintillation time constant (ns)
115  ScintSlowTimeConst: 1590. # slow scintillation time constant (ns)
116  ScintBirksConstant: 0.069 # birks constant for LAr (1/MeV cm)
117  ScintYield: 24000. # total scintillation yield (ph/Mev)
118  ScintPreScale: 0.03 # Scale factor to reduce number of photons simulated
119  # Later QE should be corrected for this scale
120  ScintYieldRatio: 0.3 # fast / slow scint ratio (needs revisitting)
121  ScintByParticleType: false # whether to use different yields and
122  # quenching per particle in fast op sim
123  EnableCerenkovLight: true # whether to switch on cerenkov light (slow)
124 
125 
126 
127 
128  # Scintillation yields and fast/slow ratios per particle type
129  MuonScintYield: 24000
130  MuonScintYieldRatio: 0.23
131  PionScintYield: 24000
132  PionScintYieldRatio: 0.23
133  ElectronScintYield: 20000
134  ElectronScintYieldRatio: 0.27
135  KaonScintYield: 24000
136  KaonScintYieldRatio: 0.23
137  ProtonScintYield: 19200
138  ProtonScintYieldRatio: 0.29
139  AlphaScintYield: 16800
140  AlphaScintYieldRatio: 0.56
141 
142 
143  # Refractive index as a function of energy (eV) from arXiv:1502.04213v1
144  RIndexEnergies: [ 1.900, 2.934, 3.592, 5.566, 6.694, 7.540, 8.574, 9.044, 9.232, 9.420, 9.514, 9.608, 9.702, 9.796, 9.890, 9.984, 10.08, 10.27, 10.45, 10.74, 10.92 ]
145  RIndexSpectrum: [ 1.232, 1.236, 1.240, 1.261, 1.282, 1.306, 1.353, 1.387, 1.404, 1.423, 1.434, 1.446, 1.459, 1.473, 1.488, 1.505, 1.524, 1.569, 1.627, 1.751, 1.879 ]
146 
147  # absorption length as function of energy
148  AbsLengthEnergies: [ 4, 5, 6, 7, 8, 9, 10, 11 ]
149  AbsLengthSpectrum: [ 2000., 2000., 2000., 2000., 2000., 2000., 2000., 2000.]
150 
151  # Rayleigh scattering length (cm) @ 90K as a function of energy (eV) from arXiv:1502.04213
152  RayleighEnergies: [ 2.80, 3.00, 3.50, 4.00, 5.00, 6.00, 7.00, 8.00, 8.50, 9.00, 9.20, 9.40, 9.50, 9.60, 9.70, 9.80, 9.90, 10.0, 10.2, 10.4, 10.6, 10.8 ]
153  RayleighSpectrum: [ 47923., 35981., 18825., 10653., 3972., 1681., 750.9, 334.7, 216.8, 135.0, 109.7, 88.06, 78.32, 69.34, 61.06, 53.46, 46.50, 40.13, 28.91, 19.81, 12.61, 7.20 ]
154 
155  # Surface reflectivity data - vector of energy spectrum per
156  # surface type
157  ReflectiveSurfaceEnergies: [ 7, 9, 10 ]
158  ReflectiveSurfaceNames: [ "STEEL_STAINLESS_Fe7Cr2Ni" ]
159  ReflectiveSurfaceReflectances: [ [ 0.25, 0.25, 0.25 ] ]
160  ReflectiveSurfaceDiffuseFractions: [ [ 0.5, 0.5, 0.5 ] ]
161 )cfg"};
162 
163 
164 // this is a copy of the "standard" DetectorProperties configuration
166 service_provider: "DetectorPropertiesServiceStandard"
167 
168 # Drift properties
169 SternheimerA: 0.1956 # Ar Sternheimer parameter a.
170 SternheimerK: 3.0000 # Ar Sternheimer parameter k.
171 SternheimerX0: 0.2000 # Ar Sternheimer parameter x0.
172 SternheimerX1: 3.0000 # Ar Sternheimer parameter x0.
173 SternheimerCbar: 5.2146 # Ar Sternheimer parameter Cbar.
174 
175 Temperature: 87
176 Electronlifetime: 3.0e3
177 Efield: [0.5,0.666,0.8] #(predicted for microBooNE)
178 ElectronsToADC: 6.8906513e-3 # 1fC = 43.008 ADC counts for DUNE fd
179 NumberTimeSamples: 4492 # drift length/drift velocity*sampling rate = (359.4 cm)/(0.16 cm/us)*(2 MHz)
180 ReadOutWindowSize: 4492 # drift length/drift velocity*sampling rate = (359.4 cm)/(0.16 cm/us)*(2 MHz)
181 TimeOffsetU: 0.
182 TimeOffsetV: 0.
183 TimeOffsetZ: 0.
184 DriftVelFudgeFactor: 1.
185 
186 SimpleBoundaryProcess: true #enable opticalBoundaryProcessSimple instead of G4 default
187 
188 )cfg"};
static QCString name
Definition: declinfo.cpp:673
virtual Index size() const =0
int main(int argc, char *argv[])
std::string string
Definition: nybbler.cc:12
struct vector vector
const std::string DetectorPropertiesServiceConfigurationString
static void load_services(std::string const &config)
virtual std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const =0
int test_FixedChannelGroupService()
virtual const ChannelVector & channels(Index igrp) const =0
ChannelGroupService * ArtServicePointer< ChannelGroupService >()
const std::string LArPropertiesServiceConfigurationString
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
virtual Name name(Index igrp) const =0
void line(double t, double *p, double &x, double &y, double &z)
QTextStream & endl(QTextStream &s)