9#include <top/geometry/TOPGeometryPar.h>
11#include <framework/gearbox/GearDir.h>
12#include <framework/logging/Logger.h>
13#include <framework/logging/LogSystem.h>
14#include <framework/geometry/BFieldManager.h>
15#include <geometry/Materials.h>
60 if (!
m_geo->isConsistent()) {
61 B2ERROR(
"TOPGeometryPar::createConfiguration: geometry not consistently defined");
65 GearDir frontEndMapping(content,
"FrontEndMapping");
71 GearDir channelMapping0(content,
"ChannelMapping[@type='IRS3B']");
77 GearDir channelMapping1(content,
"ChannelMapping[@type='IRSX']");
98 B2ERROR(
"TOPGeometry: no payload found in database");
101 if ((*m_geoDB)->getWavelengthFilter().getName().empty()) {
103 B2WARNING(
"TOPGeometry: obsolete payload revision (pixel independent PDE) - please, check global tags");
105 if ((*m_geoDB)->getTTSes().empty()) {
106 B2WARNING(
"TOPGeometry: obsolete payload revision (nominal TTS only) - please, check global tags");
108 if ((*m_geoDB)->arePDETuningFactorsEmpty()) {
109 B2WARNING(
"TOPGeometry: obsolete payload revision (before bugfix and update of optical properties) - please, check global tags");
114 B2FATAL(
"Geometry cannot change during processing, "
115 "aborting (component TOP)");
120 B2ERROR(
"TOPFrontEndMaps: no payload found in database");
126 B2ERROR(
"TOPChannelMaps: no payload found in database");
150 cout <<
"Envelope QE same as nominal quantum efficiency" << endl << endl;
169 if (!
m_valid) B2FATAL(
"No geometry available for TOP");
181 double lambda =
c_hc / energy;
192 int moduleID,
int pmtID,
193 double x,
double y)
const
196 if (!geo->isModuleIDValid(moduleID))
return 0;
198 double lambda =
c_hc / energy;
201 return geo->getNominalQE().getEfficiency(lambda);
207 const auto* pmtQE =
m_pmts[id];
208 if (!pmtQE)
return 0;
210 const auto& pmtArray = geo->getModule(moduleID).getPMTArray();
211 auto pmtPixel = pmtArray.getPMT().getPixelID(x, y);
212 if (pmtPixel == 0)
return 0;
214 auto pixelID = pmtArray.getPixelID(pmtID, pmtPixel);
217 double RQE = geo->getPDETuningFactor(
getPMTType(moduleID, pmtID));
220 return pmtQE->getEfficiency(pmtPixel, lambda,
m_BfieldOn) * RQE;
234 double thrEffi = 1.0;
238 return RQE * thrEffi;
251 B2ERROR(
"TOPGeometryPar::getRelativePDEonMC: called using obsolete TOPGeometry payload revision - please, check global tags");
281 B2ERROR(
"DBArray TOPPmtQEs is empty");
285 double lambdaFirst = 0;
287 if (pmt.getLambdaFirst() > 0) {
288 lambdaFirst = pmt.getLambdaFirst();
292 if (lambdaFirst == 0) {
293 B2ERROR(
"DBArray TOPPmtQEs: lambdaFirst of all PMT found to be less or equal 0");
297 if (pmt.getLambdaFirst() > 0) {
298 lambdaFirst = std::min(lambdaFirst, pmt.getLambdaFirst());
302 double lambdaStep = 0;
304 if (pmt.getLambdaStep() > 0) {
305 lambdaStep = pmt.getLambdaStep();
309 if (lambdaStep == 0) {
310 B2ERROR(
"DBArray TOPPmtQEs: lambdaStep of all PMT found to be less or equal 0");
314 if (pmt.getLambdaStep() > 0) {
315 lambdaStep = std::min(lambdaStep, pmt.getLambdaStep());
319 std::map<std::string, const TOPPmtInstallation*> map;
321 map[pmt.getSerialNumber()] = &pmt;
325 std::vector<float> envelopeQE;
328 auto pmtInstalled = map[pmt.getSerialNumber()];
329 if (pmtInstalled) ce *= geo->getPDETuningFactor(pmtInstalled->getType());
330 if (pmt.getLambdaFirst() == lambdaFirst and pmt.getLambdaStep() == lambdaStep) {
331 const auto& envelope = pmt.getEnvelopeQE();
332 if (envelopeQE.size() < envelope.size()) {
333 envelopeQE.resize(envelope.size() - envelopeQE.size(), 0);
335 for (
size_t i = 0; i < std::min(envelopeQE.size(), envelope.size()); i++) {
336 envelopeQE[i] = std::max(envelopeQE[i], envelope[i] * ce);
339 double lambdaLast = pmt.getLambdaLast();
340 int nExtra = (lambdaLast - lambdaFirst) / lambdaStep + 1 - envelopeQE.size();
341 if (nExtra > 0) envelopeQE.resize(nExtra, 0);
342 for (
size_t i = 0; i < envelopeQE.size(); i++) {
343 float qe = pmt.getEnvelopeQE(lambdaFirst + lambdaStep * i);
344 envelopeQE[i] = std::max(envelopeQE[i], qe * ce);
349 m_envelopeQE.set(lambdaFirst, lambdaStep, 1.0, envelopeQE,
"EnvelopeQE");
351 B2INFO(
"TOPGeometryPar: envelope of PMT dependent QE has been set");
360 std::map<std::string, const TOPPmtQE*> map;
362 map[pmt.getSerialNumber()] = &pmt;
366 m_pmts[id] = map[pmt.getSerialNumber()];
369 B2INFO(
"TOPGeometryPar: QE of PMT's mapped to positions, size = " <<
m_pmts.size());
380 B2INFO(
"TOPGeometryPar: PMT types mapped to positions, size = "
384 std::set<unsigned> types;
386 types.insert(pmt.getType());
389 for (
const auto& type : types) {
390 if (geo->getTTS(type).getPMTType() != type) {
391 B2WARNING(
"No TTS found for an installed PMT type. Nominal one will be used."
392 <<
LogVar(
"PMT type", type));
406 const auto& nominalQE = geo->getNominalQE();
407 double s0 =
integralOfQE(nominalQE.getQE(), nominalQE.getCE(),
408 nominalQE.getLambdaFirst(), nominalQE.getLambdaStep());
410 for (
const auto& module : geo->getModules()) {
411 auto moduleID =
module.getModuleID();
412 const auto& pmtArray =
module.getPMTArray();
413 int numPMTs = pmtArray.getSize();
414 int numPMTPixels = pmtArray.getPMT().getNumPixels();
415 for (
int pmtID = 1; pmtID <= numPMTs; pmtID++) {
417 for (
int pmtPixel = 1; pmtPixel <= numPMTPixels; pmtPixel++) {
421 pmtQE->getLambdaFirst(), pmtQE->getLambdaStep());
423 auto pixelID = pmtArray.getPixelID(pmtID, pmtPixel);
430 B2INFO(
"TOPGeometryPar: pixel relative quantum efficiencies have been set, size = "
441 for (
const auto& module : geo->getModules()) {
442 auto moduleID =
module.getModuleID();
443 const auto& pmtArray =
module.getPMTArray();
444 int numPMTs = pmtArray.getSize();
445 int numPMTPixels = pmtArray.getPMT().getNumPixels();
446 for (
int pmtID = 1; pmtID <= numPMTs; pmtID++) {
448 for (
int pmtPixel = 1; pmtPixel <= numPMTPixels; pmtPixel++) {
449 auto pixelID = pmtArray.getPixelID(pmtID, pmtPixel);
451 double thrEffi = 0.973;
453 thrEffi =
m_pulseHeights->getParameters(moduleID, channel).getThresholdEffi(40, 9.7);
461 B2INFO(
"TOPGeometryPar: pixel relative PDE on MC have been set, size = " <<
m_relPDEonMC.size());
465 double lambdaFirst,
double lambdaStep)
const
467 if (qe.empty())
return 0;
470 const auto&
filter = geo->getWavelengthFilter();
473 double lambda = lambdaFirst;
474 double f1 = qe[0] *
filter.getBulkTransmittance(lambda) / (lambda * lambda);
475 for (
size_t i = 1; i < qe.size(); i++) {
476 lambda += lambdaStep;
477 double f2 = qe[i] *
filter.getBulkTransmittance(lambda) / (lambda * lambda);
481 return s *
c_hc * lambdaStep * ce;
491 GearDir pmtParams(content,
"PMTs/PMT");
505 pmtParams.
getInt(
"PadYNum"));
512 GearDir reflEdgeSurfParams(pmtParams,
"reflectiveEdge/Surface");
514 pmtParams.
getLength(
"reflectiveEdge/thickness"),
515 materials.createOpticalSurfaceConfig(reflEdgeSurfParams));
517 GearDir arrayParams(content,
"PMTs");
519 arrayParams.
getInt(
"nPMTy"),
525 arrayParams.
getString(
"siliconeCookie/material"));
527 arrayParams.
getString(
"wavelengthFilter/material"));
529 double decoupledFraction = arrayParams.
getDouble(
"decoupledFraction", 0);
533 GearDir moduleParams(content,
"Modules");
534 GearDir glueParams(moduleParams,
"Glue");
536 for (
int slotID = 1; slotID <= numModules; slotID++) {
537 std::string gearName =
"Module[@slotID='" + std::to_string(slotID) +
"']";
538 GearDir slotParams(moduleParams, gearName);
543 int cNumber = slotParams.
getInt(
"ConstructionNumber");
544 module.setModuleCNumber(cNumber);
545 module.setName(addNumber(module.getName(), cNumber));
548 prism.setName(
addNumber(prism.getName(), cNumber));
549 module.setPrism(prism);
552 barSegment2.setName(
addNumber(barSegment2.getName() +
"2-", cNumber));
553 barSegment2.setGlue(glueParams.
getLength(
"Thicknes1"),
555 module.setBarSegment2(barSegment2);
558 barSegment1.setName(
addNumber(barSegment1.getName() +
"1-", cNumber));
559 barSegment1.setGlue(glueParams.
getLength(
"Thicknes2"),
561 module.setBarSegment1(barSegment1);
564 mirror.setName(
addNumber(mirror.getName(), cNumber));
565 mirror.setGlue(glueParams.
getLength(
"Thicknes3"),
567 module.setMirrorSegment(mirror);
569 module.setPMTArray(pmtArray);
570 if (decoupledFraction > 0)
module.generateDecoupledPMTs(decoupledFraction);
577 GearDir displacedGeometry(content,
"DisplacedGeometry");
578 if (displacedGeometry) {
579 if (displacedGeometry.
getInt(
"SwitchON") != 0) {
580 B2WARNING(
"TOP: displaced geometry is activated");
582 int moduleID = slot.getInt(
"@ID");
584 B2WARNING(
"TOPGeometryPar: DisplacedGeometry.xml: invalid moduleID."
585 <<
LogVar(
"moduleID", moduleID));
591 slot.getAngle(
"alpha"),
592 slot.getAngle(
"beta"),
593 slot.getAngle(
"gamma"));
594 auto&
module = const_cast<TOPGeoModule&>(geo->getModule(moduleID));
595 module.setModuleDisplacement(moduleDispl);
602 GearDir displacedPMTArrays(content,
"DisplacedPMTArrays");
603 if (displacedPMTArrays) {
604 if (displacedPMTArrays.
getInt(
"SwitchON") != 0) {
605 B2WARNING(
"TOP: displaced PMT arrays are activated");
607 int moduleID = slot.getInt(
"@ID");
609 B2WARNING(
"TOPGeometryPar: DisplacedPMTArrays.xml: invalid moduleID."
610 <<
LogVar(
"moduleID", moduleID));
615 slot.getAngle(
"alpha"));
616 auto&
module = const_cast<TOPGeoModule&>(geo->getModule(moduleID));
617 module.setPMTArrayDisplacement(arrayDispl);
624 GearDir brokenGlues(content,
"BrokenGlues");
626 if (brokenGlues.
getInt(
"SwitchON") != 0) {
627 auto material = brokenGlues.
getString(
"material");
629 int moduleID = slot.getInt(
"@ID");
631 B2WARNING(
"TOPGeometryPar: BrokenGlues.xml: invalid moduleID."
632 <<
LogVar(
"moduleID", moduleID));
635 auto&
module = const_cast<TOPGeoModule&>(geo->getModule(moduleID));
636 for (
const GearDir& glue : slot.getNodes(
"Glue")) {
637 int glueID = glue.getInt(
"@ID");
638 double fraction = glue.getDouble(
"fraction");
639 if (fraction <= 0)
continue;
640 double angle = glue.getAngle(
"angle");
641 module.setBrokenGlue(glueID, fraction, angle, material);
649 GearDir peelOff(content,
"PeelOffCookies");
651 if (peelOff.
getInt(
"SwitchON") != 0) {
652 auto material = peelOff.
getString(
"material");
653 double thickness = peelOff.
getLength(
"thickness");
655 int moduleID = slot.getInt(
"@ID");
657 B2WARNING(
"TOPGeometryPar: PeelOffCookiess.xml: invalid moduleID."
658 <<
LogVar(
"moduleID", moduleID));
661 auto&
module = const_cast<TOPGeoModule&>(geo->getModule(moduleID));
662 module.setPeelOffRegions(thickness, material);
663 for (
const GearDir& region : slot.getNodes(
"Region")) {
664 int regionID = region.getInt(
"@ID");
665 double fraction = region.getDouble(
"fraction");
666 if (fraction <= 0)
continue;
667 double angle = region.getAngle(
"angle");
668 module.appendPeelOffRegion(regionID, fraction, angle);
676 GearDir feParams(content,
"FrontEndGeo");
677 GearDir fbParams(feParams,
"FrontBoard");
685 GearDir hvParams(feParams,
"HVBoard");
692 GearDir bsParams(feParams,
"BoardStack");
705 GearDir qbbParams(content,
"QBB");
711 GearDir outerPanelParams(qbbParams,
"outerPanel");
714 outerPanelParams.
getLength(
"minThickness"),
715 outerPanelParams.
getLength(
"maxThickness"),
719 outerPanelParams.
getInt(
"N"),
721 outerPanelParams.
getString(
"edgeMaterial"),
722 "TOPOuterHoneycombPanel");
725 GearDir innerPanelParams(qbbParams,
"innerPanel");
728 innerPanelParams.
getLength(
"minThickness"),
729 innerPanelParams.
getLength(
"maxThickness"),
733 innerPanelParams.
getInt(
"N"),
735 innerPanelParams.
getString(
"edgeMaterial"),
736 "TOPInnerHoneycombPanel");
739 GearDir sideRailsParams(qbbParams,
"sideRails");
741 sideRailsParams.
getLength(
"reducedThickness"),
746 GearDir prismEnclParams(qbbParams,
"prismEnclosure");
750 prismEnclParams.
getLength(
"bottomThickness"),
751 prismEnclParams.
getLength(
"sideThickness"),
752 prismEnclParams.
getLength(
"backThickness"),
753 prismEnclParams.
getLength(
"frontThickness"),
754 prismEnclParams.
getLength(
"extensionThickness"),
758 GearDir endPlateParams(qbbParams,
"forwardEndPlate");
762 "TOPForwardEndPlate");
765 GearDir coldPlateParams(qbbParams,
"coldPlate");
767 coldPlateParams.
getString(
"baseMaterial"),
768 coldPlateParams.
getLength(
"coolThickness"),
770 coldPlateParams.
getString(
"coolMaterial"));
777 GearDir qeParams(content,
"QE");
778 std::vector<float> qeData;
780 qeData.push_back(Qeffi.getDouble(
""));
790 GearDir ttsParams(content,
"PMTs/TTS");
794 Gauss.getTime(
"mean"),
795 Gauss.getTime(
"sigma"));
802 GearDir pmtTTSParams(content,
"TTSofPMTs");
804 int type = ttsPar.getInt(
"type");
805 double tuneFactor = ttsPar.getDouble(
"PDEtuneFactor");
806 TOPNominalTTS tts(
"TTS of " + ttsPar.getString(
"@name") +
" PMT");
810 Gauss.getTime(
"mean"),
811 Gauss.getTime(
"sigma"));
820 GearDir tdcParams(content,
"TDC");
823 tdcParams.
getInt(
"subBits"),
824 tdcParams.
getTime(
"syncTimeBase"),
825 tdcParams.
getInt(
"numofBunches"),
827 tdcParams.
getTime(
"pileupTime"),
828 tdcParams.
getTime(
"doubleHitResolution"),
829 tdcParams.
getTime(
"timeJitter"),
836 pmtParams.
getTime(
"TDCbitwidth"),
837 pmtParams.
getTime(
"TDCoffset", 0),
838 pmtParams.
getTime(
"TDCpileupTime", 0),
839 pmtParams.
getTime(
"TDCdoubleHitResolution", 0),
840 pmtParams.
getTime(
"TDCtimeJitter", 50e-3),
841 pmtParams.
getDouble(
"TDCefficiency", 1));
847 GearDir shapeParams(content,
"SignalShape");
849 GearDir noiseBandwidth(shapeParams,
"noiseBandwidth");
852 shapeParams.
getTime(
"tailTimeConstant"),
853 noiseBandwidth.
getDouble(
"pole1") / 1000,
854 noiseBandwidth.
getDouble(
"pole2") / 1000);
860 GearDir calpulseParams(content,
"CalPulseShape");
861 if (calpulseParams) {
862 GearDir noiseBandwidth(calpulseParams,
"noiseBandwidth");
865 calpulseParams.
getTime(
"tailTimeConstant"),
866 noiseBandwidth.
getDouble(
"pole1") / 1000,
867 noiseBandwidth.
getDouble(
"pole2") / 1000);
873 std::string materialNode =
"Materials/Material[@name='TOPWavelengthFilterIHU340']";
874 GearDir filterMaterial(content, materialNode);
875 if (!filterMaterial) {
876 B2FATAL(
"TOPGeometry: " << materialNode <<
" not found");
878 GearDir property(filterMaterial,
"Property[@name='ABSLENGTH']");
880 B2FATAL(
"TOPGeometry: " << materialNode <<
", Property ABSLENGTH not found");
882 int numNodes =
property.getNumberNodes(
"value");
885 std::vector<double> energies;
886 std::vector<double> absLengths;
887 for (
int i = 0; i < numNodes; i++) {
888 GearDir value(property,
"value", i + 1);
889 energies.push_back(value.getDouble(
"@energy") * conversion /
Unit::eV);
890 absLengths.push_back(value.getDouble() *
Unit::mm);
892 TSpline3 spline(
"absLen", energies.data(), absLengths.data(), energies.size());
893 double lambdaFirst =
c_hc / energies.back();
894 double lambdaLast =
c_hc / energies[0];
895 double lambdaStep = 5;
896 int numSteps = (lambdaLast - lambdaFirst) / lambdaStep + 1;
897 const double filterThickness = arrayParams.
getLength(
"wavelengthFilter/thickness");
898 std::vector<float> bulkTransmittances;
899 for (
int i = 0; i < numSteps; i++) {
900 double wavelength = lambdaFirst + lambdaStep * i;
901 double energy =
c_hc / wavelength;
902 double absLen = spline.Eval(energy);
903 bulkTransmittances.push_back(exp(-filterThickness / absLen));
908 B2FATAL(
"TOPGeometry: " << materialNode
909 <<
", Property ABSLENGTH has less than 2 nodes");
917 const std::string& SN)
920 GearDir params(content,
"QuartzBars/QuartzBar[@SerialNumber='" + SN +
"']");
922 params.getLength(
"Thickness"),
923 params.getLength(
"Length"),
924 params.getString(
"Material"));
928 std::string surfaceName = params.getString(
"OpticalSurface");
929 double sigmaAlpha = params.getDouble(
"SigmaAlpha");
930 GearDir surfaceParams(content,
"Modules/Surface[@name='" + surfaceName +
"']");
932 auto quartzSurface = materials.createOpticalSurfaceConfig(surfaceParams);
940 const std::string& SN)
943 GearDir params(content,
"Mirrors/Mirror[@SerialNumber='" + SN +
"']");
945 params.getLength(
"Thickness"),
946 params.getLength(
"Length"),
947 params.getString(
"Material"));
949 mirror.
setRadius(params.getLength(
"Radius"));
954 GearDir coatingParams(params,
"Surface");
955 mirror.
setCoating(params.getLength(
"mirrorThickness"),
"Al",
956 materials.createOpticalSurfaceConfig(coatingParams));
959 std::string surfaceName = params.getString(
"OpticalSurface");
960 double sigmaAlpha = params.getDouble(
"SigmaAlpha");
961 GearDir surfaceParams(content,
"Modules/Surface[@name='" + surfaceName +
"']");
962 auto quartzSurface = materials.createOpticalSurfaceConfig(surfaceParams);
970 const std::string& SN)
973 GearDir params(content,
"Prisms/Prism[@SerialNumber='" + SN +
"']");
975 params.getLength(
"Thickness"),
976 params.getLength(
"Length"),
977 params.getLength(
"ExitThickness"),
979 params.getString(
"Material"));
980 prism.
setAngle(params.getAngle(
"Angle"));
984 std::string surfaceName = params.getString(
"OpticalSurface");
985 double sigmaAlpha = params.getDouble(
"SigmaAlpha");
986 GearDir surfaceParams(content,
"Modules/Surface[@name='" + surfaceName +
"']");
988 auto quartzSurface = materials.createOpticalSurfaceConfig(surfaceParams);
998 ss << str <<
"0" << number;
1000 ss << str << number;
1012 const double b[] = {0.683740494, 0.420323613, 0.585027480};
1013 const double c[] = {0.00460352869, 0.0133968856, 64.4932732};
1015 double x = pow(lambda * 0.001, 2);
1017 for (
int i = 0; i < 3; i++) {
1018 y += b[i] * x / (x - c[i]);
1025 double lambda =
c_hc / energy;
1031 double lambda =
c_hc / energy;
1035 return n / (1 + lambda / n * dndl);
Class for accessing objects in the database.
GearDir is the basic class used for accessing the parameter store.
virtual int getNumberNodes(const std::string &path="") const override
Return the number of nodes a given path will expand to.
virtual std::string getString(const std::string &path="") const noexcept(false) override
Get the parameter path as a string.
@ c_Debug
Debug: for code development.
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Geometry parameters of a quartz bar segment.
void setVendorData(const std::string &vendor, const std::string &serialNumber)
Sets vendor's name and serial number.
void setSurface(const GeoOpticalSurface &surface, double sigmaAlpha)
Sets optical surface.
Geometry parameters of cold plate (simplified)
Geometry parameters of forward end plate (simplified)
Geometry parameters of board stack (front-end electronic module)
void setBoardStack(double width, double height, double length, double gap, double y, const std::string &material, double spacerWidth, const std::string &spacerMaterial)
Sets board stack data.
void setHVBoard(double width, double length, double thickness, double gap, double y, const std::string &material)
Sets HV board data.
void setFrontBoard(double width, double height, double thickness, double gap, double y, const std::string &material)
Sets front board data.
Geometry parameters of honeycomb panel.
Geometry parameters of a mirror segment.
void setRadius(double radius)
Sets spherical mirror radius of curvature.
void setCenterOfCurvature(double xc, double yc)
Sets spherical mirror center of curvature.
void setCoating(double thickness, const std::string &material, const GeoOpticalSurface &surface)
Sets parameters of reflective coating.
Displacement parameters of a TOP module.
Geometry parameters of a module (optical components + positioning)
Displacement parameters of MCP-PMT array.
Geometry parameters of MCP-PMT array.
void setSiliconeCookie(double thickness, const std::string &material)
Sets silicone cookie.
void setWavelengthFilter(double thickness, const std::string &material)
Sets wavelength filter.
void setAirGap(double gap)
Sets air gap for optically decoupled PMT's.
Geometry parameters of MCP-PMT.
void setBottom(double thickness, const std::string &material)
Sets bottom.
void setWindow(double thickness, const std::string &material)
Sets entrance window.
void setSensVolume(double sizeX, double sizeY, double thickness, const std::string &material)
Sets sensitive volume (photo-cathode)
void setWallThickness(double thickness)
Sets wall thickness.
void setWallMaterial(const std::string &material)
Sets casing material.
void setNumPixels(unsigned numColumns, unsigned numRows)
Sets number of pixel rows and columns.
void setFillMaterial(const std::string &material)
Sets inside material.
void setReflEdge(double width, double thickness, const GeoOpticalSurface &surf)
Sets reflective edge.
Geometry parameters of prism enclosure (simplified)
Geometry parameters of prism.
void setAngle(double angle)
Recalculates flatLength according to given prism angle.
Geometry parameters of Quartz Bar Box (mother class)
void setOuterPanel(const TOPGeoHoneycombPanel &outerPanel)
Sets outer honeycomb panel.
void setColdPlate(const TOPGeoColdPlate &coldPlate)
Sets forward cold plate.
void setPrismEnclosure(const TOPGeoPrismEnclosure &prismEnclosure)
Sets prism enclosure.
void setSideRails(const TOPGeoSideRails &sideRails)
Sets side rails.
void setInnerPanel(const TOPGeoHoneycombPanel &innerPanel)
Sets inner honeycomb panel.
void setEndPlate(const TOPGeoEndPlate &endPlate)
Sets forward end plate.
Geometry parameters of side rails (simplified)
Geometry parameters of TOP.
const TOPNominalTDC & getNominalTDC() const
Returns nominal time-to-digit conversion parameters.
void setCalPulseShape(const TOPSignalShape &shape)
Sets calibration pulse shape.
void appendTTS(const TOPNominalTTS &tts)
Appends time transition spread of a particular PMT type.
void setWavelengthFilter(const TOPWavelengthFilter &filter)
Sets wavelength filter transmittance.
void setNominalTDC(const TOPNominalTDC &nominalTDC)
Sets nominal time-to-digit conversion parameters.
void setQBB(const TOPGeoQBB &QBB)
Sets quartz bar box.
void setFrontEnd(const TOPGeoFrontEnd &frontEnd, unsigned num=4)
Sets front-end.
static void useBasf2Units()
Use basf2 units when returning geometry parameters.
void setNominalQE(const TOPNominalQE &nominalQE)
Sets nominal quantum efficiency of PMT.
void appendPDETuningFactor(unsigned type, double factor)
Appends photon detection efficiency tuning factor of a particular PMT type.
const TOPNominalQE & getNominalQE() const
Returns nominal quantum efficiency of PMT.
void setSignalShape(const TOPSignalShape &signalShape)
Sets single photon signal shape.
void setNominalTTS(const TOPNominalTTS &nominalTTS)
Sets nominal time transition spread of PMT.
Nominal quantum efficiency of PMT.
double getEfficiency(double lambda) const
Returns quantum times collection efficiency at given photon wavelength using linear interpolation.
Nominal time-to-digit conversion parameters (simplified model)
double getSampleWidth() const
Returns time difference between two samples.
void setADCBits(unsigned adcBits)
Sets the number of ADC bits.
void setAveragePedestal(int averagePedestal)
Sets average of pedestals.
Nominal time transition spread of PMT.
void setPMTType(unsigned type)
Set type of PMT (see TOPPmtObsoleteData::EType for the defined types)
Normalized shape of single photon pulse (waveform) Pulse must be positive.
Bulk transmittance of wavelength filter.
int getPmtID(int pixel) const
Returns PMT ID (1-based)
unsigned getChannel(int pixel) const
Converts pixel to hardware channel number (0-based)
Singleton class for TOP Geometry Parameters.
double integralOfQE(const std::vector< float > &qe, double ce, double lambdaFirst, double lambdaStep) const
Returns integral of quantum efficiency over photon energies.
TOPGeoPrism createPrism(const GearDir &content, const std::string &serialNumber)
Create a parameter object from gearbox for prism.
virtual ~TOPGeometryPar()
Destructor.
OptionalDBArray< TOPPmtQE > m_pmtQEData
quantum efficiencies
double getRelativePixelEfficiency(int moduleID, int pixelID) const
Returns relative pixel efficiency (including CE, RQE and threshold efficiency)
bool m_BfieldOn
true if B field is on
double getPMTEfficiencyEnvelope(double energy) const
Returns PMT efficiency envelope, e.g.
bool m_fromDB
parameters from database or Gearbox
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using basf2 units.
TOPGeoMirrorSegment createMirrorSegment(const GearDir &content, const std::string &serialNumber)
Create a parameter object from gearbox for mirror segment.
DBObjPtr< TOPGeometry > * m_geoDB
geometry parameters from database
unsigned getPMTType(int moduleID, int pmtID) const
Returns PMT type at a given position.
void finalizeInitialization()
finalize initialization
int getUniquePixelID(int moduleID, int pixelID) const
Returns unique pixel ID within the detector.
const ChannelMapper & getChannelMapper() const
Returns default channel mapper (mapping of channels to pixels)
void prepareRelEfficiencies() const
Prepares a map of relative pixel quantum times collection efficiencies (relative to nominal one)
double getPMTEfficiency(double energy, int moduleID, int pmtID, double x, double y) const
Returns PMT pixel efficiency, a product of quantum and collection efficiency.
TOPGeometry * createConfiguration(const GearDir &content)
Create a parameter object from gearbox.
DBObjPtr< TOPCalChannelThresholdEff > m_thresholdEff
channel threshold effi.
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
TOPNominalQE m_envelopeQE
envelope quantum efficiency
std::map< int, unsigned > m_pmtTypes
PMT types mapped to positions.
DBObjPtr< TOPCalChannelRQE > m_channelRQE
channel relative quantum effi.
ChannelMapper m_channelMapperIRS3B
channel-pixel mapper
FrontEndMapper m_frontEndMapper
front end electronics mapper
std::string addNumber(const std::string &str, unsigned number)
Adds number to string.
static const double c_hc
Planck constant times speed of light in [eV*nm].
const TOPNominalTTS & getTTS(int moduleID, int pmtID) const
Returns TTS of a PMT at given position.
void prepareRelPDEonMC() const
Prepares a map of relative pixel photon detection efficiencies on MC.
std::map< int, const TOPPmtQE * > m_pmts
QE data mapped to positions.
bool m_valid
true if geometry is available
void clearCache()
Clears cache for PMT dependent QE data - function is used in call backs.
ChannelMapper m_channelMapperIRSX
channel-pixel mapper
void Initialize()
Initialize from database.
TOPGeoBarSegment createBarSegment(const GearDir &content, const std::string &serialNumber)
Create a parameter object from gearbox for bar segment.
double getRelativePDEonMC(int moduleID, int pixelID) const
Returns relative PDE on MC (including CE, tuning factor and threshold efficiency)
double getPhaseIndex(double energy) const
Returns phase refractive index of quartz at given photon energy.
double refractiveIndex(double lambda) const
Quartz refractive index (SellMeier equation)
bool m_oldPayload
true if old payload found in DB
std::map< int, double > m_relPDEonMC
pixel relative photon detection efficiencies on MC
void mapPmtQEToPositions() const
Maps PMT QE data to positions within the detector.
double getGroupIndex(double energy) const
Returns group refractive index of quartz at given photon energy.
TOPGeometry * m_geo
geometry parameters from Gearbox
TOPGeometryPar()
Hidden constructor since it is a singleton class.
void setEnvelopeQE() const
Constructs envelope of quantum efficiency from PMT data.
void mapPmtTypeToPositions() const
Maps PMT type to positions within the detector.
DBObjPtr< TOPCalChannelPulseHeight > m_pulseHeights
channel pulse height parametrizations
int getUniquePmtID(int moduleID, int pmtID) const
Returns unique PMT ID within the detector.
static TOPGeometryPar * s_instance
Pointer to the class instance.
OptionalDBArray< TOPPmtInstallation > m_pmtInstalled
PMT installation data.
std::map< int, double > m_relEfficiencies
pixel relative QE
static const double mm
[millimeters]
static const double nm
[nanometers]
static const double eV
[electronvolt]
static const double T
[tesla]
double getAngle(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard angle unit.
std::vector< double > getArray(const std::string &path) const noexcept(false)
Get the parameter path as a list of double values converted to the standard unit.
double getTime(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard time unit.
double getDouble(const std::string &path="") const noexcept(false)
Get the parameter path as a double.
double getLength(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
std::vector< GearDir > getNodes(const std::string &path="") const
Get vector of GearDirs which point to all the nodes the given path evaluates to.
int getInt(const std::string &path="") const noexcept(false)
Get the parameter path as a int.
static Materials & getInstance()
Get a reference to the singleton instance.
Class to store variables with their name which were sent to the logging service.
static double convertValue(double value, const std::string &unitString)
Converts a floating point value to the standard framework unit.
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
double sqrt(double a)
sqrt for double
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double > > &runs, double cut, std::map< ExpRun, std::pair< double, double > > &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved
double normalize()
Normalize the distribution (fractions)
void appendModule(const TOPGeoModule &module)
Appends module (if its ID differs from already appended modules)
void print(const std::string &title="TOP geometry parameters") const override
Print the content of the class.
bool isModuleIDValid(int moduleID) const
Checks if module exists in m_modules.
const TOPNominalTTS & getTTS(unsigned type) const
Returns time transition spread of a given PMT type.
void appendGaussian(double norm, double mean, double sigma)
Append Gaussian.
double getPDETuningFactor(unsigned type) const
Returns photon detection efficiency tuning factor of a given PMT type.
Abstract base class for different kinds of events.