13 #include <RtypesCore.h>
16 #include "cetlib_except/exception.h"
17 #include "fhiclcpp/ParameterSet.h"
18 #include "fhiclcpp/types/Table.h"
22 : fIsConfigured(
false)
28 fhicl::ParameterSet
const& pset,
29 std::set<std::string> ignore_params
39 this->SetRadiationLength (pset.get<
double >(
"RadiationLength" ));
40 this->SetAtomicNumber (pset.get<
double >(
"AtomicNumber"));
41 this->SetAtomicMass (pset.get<
double >(
"AtomicMass"));
42 this->SetMeanExcitationEnergy (pset.get<
double >(
"ExcitationEnergy"));
44 this->SetArgon39DecayRate (pset.get<
double >(
"Argon39DecayRate"));
46 this->SetFastScintEnergies (pset.get< std::vector<double> >(
"FastScintEnergies"));
47 this->SetFastScintSpectrum (pset.get< std::vector<double> >(
"FastScintSpectrum"));
48 this->SetSlowScintEnergies (pset.get< std::vector<double> >(
"SlowScintEnergies"));
49 this->SetSlowScintSpectrum (pset.get< std::vector<double> >(
"SlowScintSpectrum"));
50 this->SetAbsLengthEnergies (pset.get< std::vector<double> >(
"AbsLengthEnergies"));
51 this->SetAbsLengthSpectrum (pset.get< std::vector<double> >(
"AbsLengthSpectrum"));
52 this->SetRIndexEnergies (pset.get< std::vector<double> >(
"RIndexEnergies" ));
53 this->SetRIndexSpectrum (pset.get< std::vector<double> >(
"RIndexSpectrum" ));
54 this->SetRayleighEnergies (pset.get< std::vector<double> >(
"RayleighEnergies" ));
55 this->SetRayleighSpectrum (pset.get< std::vector<double> >(
"RayleighSpectrum" ));
57 this->SetScintResolutionScale (pset.get<
double>(
"ScintResolutionScale"));
58 this->SetScintFastTimeConst (pset.get<
double>(
"ScintFastTimeConst"));
59 this->SetScintSlowTimeConst (pset.get<
double>(
"ScintSlowTimeConst"));
60 this->SetScintBirksConstant (pset.get<
double>(
"ScintBirksConstant"));
61 this->SetScintByParticleType (pset.get<
bool>(
"ScintByParticleType"));
62 this->SetScintYield (pset.get<
double>(
"ScintYield"));
63 this->SetScintPreScale(pset.get<
double>(
"ScintPreScale"));
64 this->SetScintYieldRatio (pset.get<
double>(
"ScintYieldRatio"));
66 if(ScintByParticleType()){
67 this->SetProtonScintYield(pset.get<
double>(
"ProtonScintYield"));
68 this->SetProtonScintYieldRatio (pset.get<
double>(
"ProtonScintYieldRatio"));
69 this->SetMuonScintYield (pset.get<
double>(
"MuonScintYield"));
70 this->SetMuonScintYieldRatio (pset.get<
double>(
"MuonScintYieldRatio"));
71 this->SetPionScintYield (pset.get<
double>(
"PionScintYield"));
72 this->SetPionScintYieldRatio (pset.get<
double>(
"PionScintYieldRatio"));
73 this->SetKaonScintYield (pset.get<
double>(
"KaonScintYield"));
74 this->SetKaonScintYieldRatio (pset.get<
double>(
"KaonScintYieldRatio"));
75 this->SetElectronScintYield (pset.get<
double>(
"ElectronScintYield"));
76 this->SetElectronScintYieldRatio (pset.get<
double>(
"ElectronScintYieldRatio"));
77 this->SetAlphaScintYield (pset.get<
double>(
"AlphaScintYield"));
78 this->SetAlphaScintYieldRatio (pset.get<
double>(
"AlphaScintYieldRatio"));
81 this->SetEnableCerenkovLight (pset.get<
bool>(
"EnableCerenkovLight"));
83 this->SetReflectiveSurfaceNames(pset.get<std::vector<std::string> >(
"ReflectiveSurfaceNames"));
84 this->SetReflectiveSurfaceEnergies(pset.get<std::vector<double> >(
"ReflectiveSurfaceEnergies"));
85 this->SetReflectiveSurfaceReflectances(pset.get<
std::vector<std::vector<double> > >(
"ReflectiveSurfaceReflectances"));
86 this->SetReflectiveSurfaceDiffuseFractions(pset.get<
std::vector<std::vector<double> > >(
"ReflectiveSurfaceDiffuseFractions"));
97 fhicl::ParameterSet
const& pset,
98 std::set<std::string> ignore_params
101 const bool bScintByParticleType = pset.get<
bool>(
"ScintByParticleType",
false);
104 ignorable_keys.insert(ignore_params.begin(), ignore_params.end());
106 #if DETECTORINFO_LARPROPERTIESSTANDARD_HASOPTIONALATOM
111 if(bScintByParticleType) {
114 if (config.ProtonScintYield(value)) SetProtonScintYield(value);
115 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.ProtonScintYield .key() });
116 if (config.ProtonScintYieldRatio (value)) SetProtonScintYieldRatio (value);
117 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.ProtonScintYieldRatio .key() });
118 if (config.MuonScintYield (value)) SetMuonScintYield (value);
119 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.MuonScintYield .key() });
120 if (config.MuonScintYieldRatio (value)) SetMuonScintYieldRatio (value);
121 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.MuonScintYieldRatio .key() });
122 if (config.PionScintYield (value)) SetPionScintYield (value);
123 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.PionScintYield .key() });
124 if (config.PionScintYieldRatio (value)) SetPionScintYieldRatio (value);
125 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.PionScintYieldRatio .key() });
126 if (config.KaonScintYield (value)) SetKaonScintYield (value);
127 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.KaonScintYield .key() });
128 if (config.KaonScintYieldRatio (value)) SetKaonScintYieldRatio (value);
129 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.KaonScintYieldRatio .key() });
130 if (config.ElectronScintYield (value)) SetElectronScintYield (value);
131 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.ElectronScintYield .key() });
132 if (config.ElectronScintYieldRatio(value)) SetElectronScintYieldRatio(value);
133 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.ElectronScintYieldRatio.key() });
134 if (config.AlphaScintYield (value)) SetAlphaScintYield (value);
135 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.AlphaScintYield .key() });
136 if (config.AlphaScintYieldRatio (value)) SetAlphaScintYieldRatio (value);
137 else errmsg += fhicl::detail::fillMissingKeysMsg(&config_table, { config.AlphaScintYieldRatio .key() });
138 if (!errmsg.empty()) {
139 throw fhicl::detail::validationException((
140 "[these parameters are REQUIRED when ScintByParticleType is true; the list may be incomplete]\n"
147 #else // !DETECTORINFO_LARPROPERTIESSTANDARD_HASOPTIONALATOM
149 if (!bScintByParticleType) {
166 fhicl::Table<ConfigWithScintByType_t> config_table { pset, ignorable_keys };
170 if (bScintByParticleType) {
184 #endif // DETECTORINFO_LARPROPERTIESSTANDARD_HASOPTIONALATOM??
230 fIsConfigured =
true;
238 if (ts == 0)
return false;
246 if(fFastScintSpectrum.size()!=fFastScintEnergies.size()){
247 throw cet::exception(
"Incorrect vector sizes in LArPropertiesStandard")
248 <<
"The vectors specifying the fast scintillation spectrum are "
249 <<
" different sizes - " << fFastScintSpectrum.size()
250 <<
" " << fFastScintEnergies.size();
253 std::map<double, double> ToReturn;
254 for(
size_t i=0; i!=fFastScintSpectrum.size(); ++i)
255 ToReturn[fFastScintEnergies.at(i)]=fFastScintSpectrum.at(i);
263 if(fSlowScintSpectrum.size()!=fSlowScintEnergies.size()){
264 throw cet::exception(
"Incorrect vector sizes in LArPropertiesStandard")
265 <<
"The vectors specifying the slow scintillation spectrum are "
266 <<
" different sizes - " << fSlowScintSpectrum.size()
267 <<
" " << fSlowScintEnergies.size();
270 std::map<double, double> ToReturn;
271 for(
size_t i=0; i!=fSlowScintSpectrum.size(); ++i)
272 ToReturn[fSlowScintEnergies.at(i)]=fSlowScintSpectrum.at(i);
280 if(fRIndexSpectrum.size()!=fRIndexEnergies.size()){
281 throw cet::exception(
"Incorrect vector sizes in LArPropertiesStandard")
282 <<
"The vectors specifying the RIndex spectrum are "
283 <<
" different sizes - " << fRIndexSpectrum.size()
284 <<
" " << fRIndexEnergies.size();
287 std::map<double, double> ToReturn;
288 for(
size_t i=0; i!=fRIndexSpectrum.size(); ++i)
289 ToReturn[fRIndexEnergies.at(i)]=fRIndexSpectrum.at(i);
298 if(fAbsLengthSpectrum.size()!=fAbsLengthEnergies.size()){
299 throw cet::exception(
"Incorrect vector sizes in LArPropertiesStandard")
300 <<
"The vectors specifying the Abs Length spectrum are "
301 <<
" different sizes - " << fAbsLengthSpectrum.size()
302 <<
" " << fAbsLengthEnergies.size();
305 std::map<double, double> ToReturn;
306 for(
size_t i=0; i!=fAbsLengthSpectrum.size(); ++i)
307 ToReturn[fAbsLengthEnergies.at(i)]=fAbsLengthSpectrum.at(i);
315 if(fRayleighSpectrum.size()!=fRayleighEnergies.size()){
316 throw cet::exception(
"Incorrect vector sizes in LArPropertiesStandard")
317 <<
"The vectors specifying the rayleigh spectrum are "
318 <<
" different sizes - " << fRayleighSpectrum.size()
319 <<
" " << fRayleighEnergies.size();
322 std::map<double, double> ToReturn;
323 for(
size_t i=0; i!=fRayleighSpectrum.size(); ++i)
324 ToReturn[fRayleighEnergies.at(i)]=fRayleighSpectrum.at(i);
332 std::map<std::string, std::map<double, double> > ToReturn;
334 if(fReflectiveSurfaceNames.size()!=fReflectiveSurfaceReflectances.size()){
335 throw cet::exception(
"Incorrect vector sizes in LArPropertiesStandard")
336 <<
"The vectors specifying the surface reflectivities "
337 <<
"do not have consistent sizes";
339 for(
size_t i=0; i!=fReflectiveSurfaceNames.size(); ++i){
340 if(fReflectiveSurfaceEnergies.size()!=fReflectiveSurfaceReflectances.at(i).size()){
341 throw cet::exception(
"Incorrect vector sizes in LArPropertiesStandard")
342 <<
"The vectors specifying the surface reflectivities do not have consistent sizes";
345 for(
size_t iName=0; iName!=fReflectiveSurfaceNames.size(); ++iName)
346 for(
size_t iEnergy=0; iEnergy!=fReflectiveSurfaceEnergies.size(); ++iEnergy)
347 ToReturn[fReflectiveSurfaceNames.at(iName)][fReflectiveSurfaceEnergies.at(iEnergy)]=fReflectiveSurfaceReflectances[iName][iEnergy];
356 std::map<std::string, std::map<double, double> > ToReturn;
358 if(fReflectiveSurfaceNames.size()!=fReflectiveSurfaceDiffuseFractions.size()){
359 throw cet::exception(
"Incorrect vector sizes in LArPropertiesStandard")
360 <<
"The vectors specifying the surface reflectivities do not have consistent sizes";
362 for(
size_t i=0; i!=fReflectiveSurfaceNames.size(); ++i){
363 if(fReflectiveSurfaceEnergies.size()!=fReflectiveSurfaceDiffuseFractions.at(i).size()){
364 throw cet::exception(
"Incorrect vector sizes in LArPropertiesStandard")
365 <<
"The vectors specifying the surface reflectivities do not have consistent sizes";
369 for(
size_t iName=0; iName!=fReflectiveSurfaceNames.size(); ++iName)
370 for(
size_t iEnergy=0; iEnergy!=fReflectiveSurfaceEnergies.size(); ++iEnergy)
371 ToReturn[fReflectiveSurfaceNames.at(iName)][fReflectiveSurfaceEnergies.at(iEnergy)]=fReflectiveSurfaceDiffuseFractions[iName][iEnergy];
378 if(fTpbAbsorptionEnergies.size()!=fTpbAbsorptionSpectrum.size()){
379 throw cet::exception(
"Incorrect vector sizes in LArProperties")
380 <<
"The vectors specifying the TpbAbsorption spectrum are "
381 <<
" different sizes - " << fTpbAbsorptionEnergies.size()
382 <<
" " << fTpbAbsorptionSpectrum.size();
385 std::map<double, double> ToReturn;
386 for(
size_t i=0; i!=fTpbAbsorptionSpectrum.size(); ++i)
387 ToReturn[fTpbAbsorptionEnergies.at(i)]=fTpbAbsorptionSpectrum.at(i);
394 if(fTpbEmmisionEnergies.size()!=fTpbEmmisionSpectrum.size()){
395 throw cet::exception(
"Incorrect vector sizes in LArProperties")
396 <<
"The vectors specifying the TpbEmmision spectrum are "
397 <<
" different sizes - " << fTpbEmmisionEnergies.size()
398 <<
" " << fTpbEmmisionSpectrum.size();
402 std::vector<double> new_x;
404 Double_t *en =
new Double_t[int(fTpbEmmisionSpectrum.size())+1];
405 Double_t *spectr =
new Double_t[int(fTpbEmmisionSpectrum.size())+1];
406 for(
int j=0;j<int(fTpbEmmisionSpectrum.size())+1;j++){
412 en[j]=fTpbEmmisionEnergies[j-1];
413 spectr[j]=fTpbEmmisionSpectrum[j-1];
418 TH1D *energyhist=
new TH1D();
419 energyhist->SetBins(
int(fTpbEmmisionSpectrum.size()),en);
420 for(
int ii=0;ii<int(fTpbEmmisionSpectrum.size());ii++) energyhist->SetBinContent(ii,spectr[ii]);
421 xrange=double((en[
int(fTpbEmmisionSpectrum.size())]-en[0])/double(fTpbEmmisionSpectrum.size()));
423 for(
int jj=0; jj<int(tablesize); jj++){
425 new_x.push_back(jj*(xrange/
double(tablesize)));
428 std::map<double, double> ToReturn;
431 for(
int i=0; i<tablesize; i++){
432 ToReturn[new_x.at(i)]=energyhist->Interpolate(new_x[i]);
fhicl::Sequence< double > TpbAbsorptionEnergies
fhicl::Sequence< double > FastScintSpectrum
virtual std::map< double, double > RayleighSpectrum() const override
Service provider with utility LAr functions.
fhicl::Sequence< std::string > ReflectiveSurfaceNames
fhicl::Atom< double > KaonScintYieldRatio
fhicl::Atom< double > MuonScintYieldRatio
virtual std::map< double, double > AbsLengthSpectrum() const override
virtual std::map< double, double > RIndexSpectrum() const override
fhicl::Atom< double > ScintSlowTimeConst
virtual std::map< double, double > FastScintSpectrum() const override
fhicl::Atom< double > ScintBirksConstant
fhicl::Atom< double > RadiationLength
fhicl::Sequence< double > FastScintEnergies
fhicl::Atom< double > ScintPreScale
fhicl::Atom< double > ProtonScintYieldRatio
fhicl::Atom< bool > ExtraMatProperties
fhicl::Atom< double > KaonScintYield
bool Update(uint64_t ts=0)
fhicl::Atom< double > Argon39DecayRate
fhicl::Sequence< double > RIndexSpectrum
fhicl::Sequence< double > RayleighEnergies
fhicl::Atom< double > AtomicNumber
fhicl::Sequence< double > ReflectiveSurfaceEnergies
fhicl::Sequence< double > TpbEmmisionEnergies
fhicl::Sequence< double > AbsLengthEnergies
fhicl::Atom< double > ScintResolutionScale
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
fhicl::Sequence< double > SlowScintEnergies
fhicl::Atom< double > ProtonScintYield
fhicl::Sequence< double > TpbEmmisionSpectrum
bool Configure(fhicl::ParameterSet const &pset, std::set< std::string > ignore_params={})
Configures the provider.
fhicl::Atom< double > PionScintYield
fhicl::Atom< double > TpbTimeConstant
fhicl::Atom< bool > EnableCerenkovLight
structure with all configuration parameters
fhicl::Sequence< double > RayleighSpectrum
fhicl::Atom< double > ScintYield
fhicl::Atom< double > AtomicMass
std::set< std::string > const & IgnorableProviderConfigKeys()
Returns a list of configuration keys that providers should ignore.
virtual std::map< std::string, std::map< double, double > > SurfaceReflectances() const override
structure with all configuration parameters
fhicl::Atom< double > ElectronScintYield
fhicl::Sequence< double > AbsLengthSpectrum
fhicl::Sequence< double > RIndexEnergies
fhicl::Atom< double > ScintFastTimeConst
fhicl::Atom< double > AlphaScintYield
fhicl::Sequence< double > SlowScintSpectrum
virtual std::map< double, double > TpbAbs() const override
fhicl::Atom< bool > ScintByParticleType
virtual std::map< double, double > TpbEm() const override
virtual std::map< std::string, std::map< double, double > > SurfaceReflectanceDiffuseFractions() const override
Properties related to liquid argon environment in the detector.
fhicl::Atom< double > ScintYieldRatio
Simple utilities for service providers.
fhicl::Atom< double > PionScintYieldRatio
fhicl::Sequence< fhicl::Sequence< double > > ReflectiveSurfaceReflectances
fhicl::Sequence< double > TpbAbsorptionSpectrum
fhicl::Atom< double > ElectronScintYieldRatio
fhicl::Atom< double > AlphaScintYieldRatio
fhicl::Atom< double > MeanExcitationEnergy
fhicl::Atom< double > MuonScintYield
virtual std::map< double, double > SlowScintSpectrum() const override
fhicl::Sequence< fhicl::Sequence< double > > ReflectiveSurfaceDiffuseFractions