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>
59 if (!
m_geo->isConsistent()) {
60 B2ERROR(
"TOPGeometryPar::createConfiguration: geometry not consistently defined");
64 GearDir frontEndMapping(content,
"FrontEndMapping");
70 GearDir channelMapping0(content,
"ChannelMapping[@type='IRS3B']");
76 GearDir channelMapping1(content,
"ChannelMapping[@type='IRSX']");
94 B2ERROR(
"TOPGeometry: no payload found in database");
97 if (
m_geoDB->getWavelengthFilter().getName().empty()) {
99 B2WARNING(
"TOPGeometry: obsolete payload revision (pixel independent PDE) - please, check global tags");
101 if (
m_geoDB->getTTSes().empty()) {
102 B2WARNING(
"TOPGeometry: obsolete payload revision (nominal TTS only) - please, check global tags");
104 if (
m_geoDB->arePDETuningFactorsEmpty()) {
105 B2WARNING(
"TOPGeometry: obsolete payload revision (before bugfix and update of optical properties) - please, check global tags");
110 B2FATAL(
"Geometry cannot change during processing, "
111 "aborting (component TOP)");
116 B2ERROR(
"TOPFrontEndMaps: no payload found in database");
122 B2ERROR(
"TOPChannelMaps: no payload found in database");
146 cout <<
"Envelope QE same as nominal quantum efficiency" << endl << endl;
165 if (!
m_valid) B2FATAL(
"No geometry available for TOP");
177 double lambda =
c_hc / energy;
188 int moduleID,
int pmtID,
189 double x,
double y)
const
192 if (!geo->isModuleIDValid(moduleID))
return 0;
194 double lambda =
c_hc / energy;
197 return geo->getNominalQE().getEfficiency(lambda);
203 const auto* pmtQE =
m_pmts[id];
204 if (!pmtQE)
return 0;
206 const auto& pmtArray = geo->getModule(moduleID).getPMTArray();
207 auto pmtPixel = pmtArray.getPMT().getPixelID(x, y);
208 if (pmtPixel == 0)
return 0;
210 auto pixelID = pmtArray.getPixelID(pmtID, pmtPixel);
213 double RQE = geo->getPDETuningFactor(
getPMTType(moduleID, pmtID));
216 return pmtQE->getEfficiency(pmtPixel, lambda,
m_BfieldOn) * RQE;
230 double thrEffi = 1.0;
234 return RQE * thrEffi;
247 B2ERROR(
"TOPGeometryPar::getRelativePDEonMC: called using obsolete TOPGeometry payload revision - please, check global tags");
277 B2ERROR(
"DBArray TOPPmtQEs is empty");
281 double lambdaFirst = 0;
283 if (pmt.getLambdaFirst() > 0) {
284 lambdaFirst = pmt.getLambdaFirst();
288 if (lambdaFirst == 0) {
289 B2ERROR(
"DBArray TOPPmtQEs: lambdaFirst of all PMT found to be less or equal 0");
293 if (pmt.getLambdaFirst() > 0) {
294 lambdaFirst = std::min(lambdaFirst, pmt.getLambdaFirst());
298 double lambdaStep = 0;
300 if (pmt.getLambdaStep() > 0) {
301 lambdaStep = pmt.getLambdaStep();
305 if (lambdaStep == 0) {
306 B2ERROR(
"DBArray TOPPmtQEs: lambdaStep of all PMT found to be less or equal 0");
310 if (pmt.getLambdaStep() > 0) {
311 lambdaStep = std::min(lambdaStep, pmt.getLambdaStep());
315 std::map<std::string, const TOPPmtInstallation*> map;
317 map[pmt.getSerialNumber()] = &pmt;
321 std::vector<float> envelopeQE;
324 auto pmtInstalled = map[pmt.getSerialNumber()];
325 if (pmtInstalled) ce *= geo->getPDETuningFactor(pmtInstalled->getType());
326 if (pmt.getLambdaFirst() == lambdaFirst and pmt.getLambdaStep() == lambdaStep) {
327 const auto& envelope = pmt.getEnvelopeQE();
328 if (envelopeQE.size() < envelope.size()) {
329 envelopeQE.resize(envelope.size() - envelopeQE.size(), 0);
331 for (
size_t i = 0; i < std::min(envelopeQE.size(), envelope.size()); i++) {
332 envelopeQE[i] = std::max(envelopeQE[i], envelope[i] * ce);
335 double lambdaLast = pmt.getLambdaLast();
336 int nExtra = (lambdaLast - lambdaFirst) / lambdaStep + 1 - envelopeQE.size();
337 if (nExtra > 0) envelopeQE.resize(nExtra, 0);
338 for (
size_t i = 0; i < envelopeQE.size(); i++) {
339 float qe = pmt.getEnvelopeQE(lambdaFirst + lambdaStep * i);
340 envelopeQE[i] = std::max(envelopeQE[i], qe * ce);
345 m_envelopeQE.set(lambdaFirst, lambdaStep, 1.0, envelopeQE,
"EnvelopeQE");
347 B2INFO(
"TOPGeometryPar: envelope of PMT dependent QE has been set");
356 std::map<std::string, const TOPPmtQE*> map;
358 map[pmt.getSerialNumber()] = &pmt;
362 m_pmts[id] = map[pmt.getSerialNumber()];
365 B2INFO(
"TOPGeometryPar: QE of PMT's mapped to positions, size = " <<
m_pmts.size());
376 B2INFO(
"TOPGeometryPar: PMT types mapped to positions, size = "
380 std::set<unsigned> types;
382 types.insert(pmt.getType());
385 for (
const auto& type : types) {
386 if (geo->getTTS(type).getPMTType() != type) {
387 B2WARNING(
"No TTS found for an installed PMT type. Nominal one will be used."
388 <<
LogVar(
"PMT type", type));
402 const auto& nominalQE = geo->getNominalQE();
403 double s0 =
integralOfQE(nominalQE.getQE(), nominalQE.getCE(),
404 nominalQE.getLambdaFirst(), nominalQE.getLambdaStep());
406 for (
const auto& module : geo->getModules()) {
407 auto moduleID =
module.getModuleID();
408 const auto& pmtArray =
module.getPMTArray();
409 int numPMTs = pmtArray.getSize();
410 int numPMTPixels = pmtArray.getPMT().getNumPixels();
411 for (
int pmtID = 1; pmtID <= numPMTs; pmtID++) {
413 for (
int pmtPixel = 1; pmtPixel <= numPMTPixels; pmtPixel++) {
417 pmtQE->getLambdaFirst(), pmtQE->getLambdaStep());
419 auto pixelID = pmtArray.getPixelID(pmtID, pmtPixel);
426 B2INFO(
"TOPGeometryPar: pixel relative quantum efficiencies have been set, size = "
437 for (
const auto& module : geo->getModules()) {
438 auto moduleID =
module.getModuleID();
439 const auto& pmtArray =
module.getPMTArray();
440 int numPMTs = pmtArray.getSize();
441 int numPMTPixels = pmtArray.getPMT().getNumPixels();
442 for (
int pmtID = 1; pmtID <= numPMTs; pmtID++) {
444 for (
int pmtPixel = 1; pmtPixel <= numPMTPixels; pmtPixel++) {
445 auto pixelID = pmtArray.getPixelID(pmtID, pmtPixel);
447 double thrEffi = 0.973;
449 thrEffi =
m_pulseHeights->getParameters(moduleID, channel).getThresholdEffi(40, 9.7);
457 B2INFO(
"TOPGeometryPar: pixel relative PDE on MC have been set, size = " <<
m_relPDEonMC.size());
461 double lambdaFirst,
double lambdaStep)
const
463 if (qe.empty())
return 0;
466 const auto&
filter = geo->getWavelengthFilter();
469 double lambda = lambdaFirst;
470 double f1 = qe[0] *
filter.getBulkTransmittance(lambda) / (lambda * lambda);
471 for (
size_t i = 1; i < qe.size(); i++) {
472 lambda += lambdaStep;
473 double f2 = qe[i] *
filter.getBulkTransmittance(lambda) / (lambda * lambda);
477 return s *
c_hc * lambdaStep * ce;
487 GearDir pmtParams(content,
"PMTs/PMT");
501 pmtParams.
getInt(
"PadYNum"));
508 GearDir reflEdgeSurfParams(pmtParams,
"reflectiveEdge/Surface");
510 pmtParams.
getLength(
"reflectiveEdge/thickness"),
511 materials.createOpticalSurfaceConfig(reflEdgeSurfParams));
513 GearDir arrayParams(content,
"PMTs");
515 arrayParams.
getInt(
"nPMTy"),
521 arrayParams.
getString(
"siliconeCookie/material"));
523 arrayParams.
getString(
"wavelengthFilter/material"));
525 double decoupledFraction = arrayParams.
getDouble(
"decoupledFraction", 0);
529 GearDir moduleParams(content,
"Modules");
530 GearDir glueParams(moduleParams,
"Glue");
532 for (
int slotID = 1; slotID <= numModules; slotID++) {
533 std::string gearName =
"Module[@slotID='" + std::to_string(slotID) +
"']";
534 GearDir slotParams(moduleParams, gearName);
539 int cNumber = slotParams.
getInt(
"ConstructionNumber");
540 module.setModuleCNumber(cNumber);
541 module.setName(addNumber(module.getName(), cNumber));
544 prism.setName(
addNumber(prism.getName(), cNumber));
545 module.setPrism(prism);
548 barSegment2.setName(
addNumber(barSegment2.getName() +
"2-", cNumber));
549 barSegment2.setGlue(glueParams.
getLength(
"Thicknes1"),
551 module.setBarSegment2(barSegment2);
554 barSegment1.setName(
addNumber(barSegment1.getName() +
"1-", cNumber));
555 barSegment1.setGlue(glueParams.
getLength(
"Thicknes2"),
557 module.setBarSegment1(barSegment1);
560 mirror.setName(
addNumber(mirror.getName(), cNumber));
561 mirror.setGlue(glueParams.
getLength(
"Thicknes3"),
563 module.setMirrorSegment(mirror);
565 module.setPMTArray(pmtArray);
566 if (decoupledFraction > 0)
module.generateDecoupledPMTs(decoupledFraction);
573 GearDir displacedGeometry(content,
"DisplacedGeometry");
574 if (displacedGeometry) {
575 if (displacedGeometry.
getInt(
"SwitchON") != 0) {
576 B2WARNING(
"TOP: displaced geometry is activated");
578 int moduleID = slot.getInt(
"@ID");
580 B2WARNING(
"TOPGeometryPar: DisplacedGeometry.xml: invalid moduleID."
581 <<
LogVar(
"moduleID", moduleID));
587 slot.getAngle(
"alpha"),
588 slot.getAngle(
"beta"),
589 slot.getAngle(
"gamma"));
590 auto&
module = const_cast<TOPGeoModule&>(geo->getModule(moduleID));
591 module.setModuleDisplacement(moduleDispl);
598 GearDir displacedPMTArrays(content,
"DisplacedPMTArrays");
599 if (displacedPMTArrays) {
600 if (displacedPMTArrays.
getInt(
"SwitchON") != 0) {
601 B2WARNING(
"TOP: displaced PMT arrays are activated");
603 int moduleID = slot.getInt(
"@ID");
605 B2WARNING(
"TOPGeometryPar: DisplacedPMTArrays.xml: invalid moduleID."
606 <<
LogVar(
"moduleID", moduleID));
611 slot.getAngle(
"alpha"));
612 auto&
module = const_cast<TOPGeoModule&>(geo->getModule(moduleID));
613 module.setPMTArrayDisplacement(arrayDispl);
620 GearDir brokenGlues(content,
"BrokenGlues");
622 if (brokenGlues.
getInt(
"SwitchON") != 0) {
623 auto material = brokenGlues.
getString(
"material");
625 int moduleID = slot.getInt(
"@ID");
627 B2WARNING(
"TOPGeometryPar: BrokenGlues.xml: invalid moduleID."
628 <<
LogVar(
"moduleID", moduleID));
631 auto&
module = const_cast<TOPGeoModule&>(geo->getModule(moduleID));
632 for (
const GearDir& glue : slot.getNodes(
"Glue")) {
633 int glueID = glue.getInt(
"@ID");
634 double fraction = glue.getDouble(
"fraction");
635 if (fraction <= 0)
continue;
636 double angle = glue.getAngle(
"angle");
637 module.setBrokenGlue(glueID, fraction, angle, material);
645 GearDir peelOff(content,
"PeelOffCookies");
647 if (peelOff.
getInt(
"SwitchON") != 0) {
648 auto material = peelOff.
getString(
"material");
649 double thickness = peelOff.
getLength(
"thickness");
651 int moduleID = slot.getInt(
"@ID");
653 B2WARNING(
"TOPGeometryPar: PeelOffCookiess.xml: invalid moduleID."
654 <<
LogVar(
"moduleID", moduleID));
657 auto&
module = const_cast<TOPGeoModule&>(geo->getModule(moduleID));
658 module.setPeelOffRegions(thickness, material);
659 for (
const GearDir& region : slot.getNodes(
"Region")) {
660 int regionID = region.getInt(
"@ID");
661 double fraction = region.getDouble(
"fraction");
662 if (fraction <= 0)
continue;
663 double angle = region.getAngle(
"angle");
664 module.appendPeelOffRegion(regionID, fraction, angle);
672 GearDir feParams(content,
"FrontEndGeo");
673 GearDir fbParams(feParams,
"FrontBoard");
681 GearDir hvParams(feParams,
"HVBoard");
688 GearDir bsParams(feParams,
"BoardStack");
701 GearDir qbbParams(content,
"QBB");
707 GearDir outerPanelParams(qbbParams,
"outerPanel");
710 outerPanelParams.
getLength(
"minThickness"),
711 outerPanelParams.
getLength(
"maxThickness"),
715 outerPanelParams.
getInt(
"N"),
717 outerPanelParams.
getString(
"edgeMaterial"),
718 "TOPOuterHoneycombPanel");
721 GearDir innerPanelParams(qbbParams,
"innerPanel");
724 innerPanelParams.
getLength(
"minThickness"),
725 innerPanelParams.
getLength(
"maxThickness"),
729 innerPanelParams.
getInt(
"N"),
731 innerPanelParams.
getString(
"edgeMaterial"),
732 "TOPInnerHoneycombPanel");
735 GearDir sideRailsParams(qbbParams,
"sideRails");
737 sideRailsParams.
getLength(
"reducedThickness"),
742 GearDir prismEnclParams(qbbParams,
"prismEnclosure");
746 prismEnclParams.
getLength(
"bottomThickness"),
747 prismEnclParams.
getLength(
"sideThickness"),
748 prismEnclParams.
getLength(
"backThickness"),
749 prismEnclParams.
getLength(
"frontThickness"),
750 prismEnclParams.
getLength(
"extensionThickness"),
754 GearDir endPlateParams(qbbParams,
"forwardEndPlate");
758 "TOPForwardEndPlate");
761 GearDir coldPlateParams(qbbParams,
"coldPlate");
763 coldPlateParams.
getString(
"baseMaterial"),
764 coldPlateParams.
getLength(
"coolThickness"),
766 coldPlateParams.
getString(
"coolMaterial"));
773 GearDir qeParams(content,
"QE");
774 std::vector<float> qeData;
776 qeData.push_back(Qeffi.getDouble(
""));
786 GearDir ttsParams(content,
"PMTs/TTS");
790 Gauss.getTime(
"mean"),
791 Gauss.getTime(
"sigma"));
798 GearDir pmtTTSParams(content,
"TTSofPMTs");
800 int type = ttsPar.getInt(
"type");
801 double tuneFactor = ttsPar.getDouble(
"PDEtuneFactor");
802 TOPNominalTTS tts(
"TTS of " + ttsPar.getString(
"@name") +
" PMT");
806 Gauss.getTime(
"mean"),
807 Gauss.getTime(
"sigma"));
816 GearDir tdcParams(content,
"TDC");
819 tdcParams.
getInt(
"subBits"),
820 tdcParams.
getTime(
"syncTimeBase"),
821 tdcParams.
getInt(
"numofBunches"),
823 tdcParams.
getTime(
"pileupTime"),
824 tdcParams.
getTime(
"doubleHitResolution"),
825 tdcParams.
getTime(
"timeJitter"),
832 pmtParams.
getTime(
"TDCbitwidth"),
833 pmtParams.
getTime(
"TDCoffset", 0),
834 pmtParams.
getTime(
"TDCpileupTime", 0),
835 pmtParams.
getTime(
"TDCdoubleHitResolution", 0),
836 pmtParams.
getTime(
"TDCtimeJitter", 50e-3),
837 pmtParams.
getDouble(
"TDCefficiency", 1));
843 GearDir shapeParams(content,
"SignalShape");
845 GearDir noiseBandwidth(shapeParams,
"noiseBandwidth");
848 shapeParams.
getTime(
"tailTimeConstant"),
849 noiseBandwidth.
getDouble(
"pole1") / 1000,
850 noiseBandwidth.
getDouble(
"pole2") / 1000);
856 GearDir calpulseParams(content,
"CalPulseShape");
857 if (calpulseParams) {
858 GearDir noiseBandwidth(calpulseParams,
"noiseBandwidth");
861 calpulseParams.
getTime(
"tailTimeConstant"),
862 noiseBandwidth.
getDouble(
"pole1") / 1000,
863 noiseBandwidth.
getDouble(
"pole2") / 1000);
869 std::string materialNode =
"Materials/Material[@name='TOPWavelengthFilterIHU340']";
870 GearDir filterMaterial(content, materialNode);
871 if (!filterMaterial) {
872 B2FATAL(
"TOPGeometry: " << materialNode <<
" not found");
874 GearDir property(filterMaterial,
"Property[@name='ABSLENGTH']");
876 B2FATAL(
"TOPGeometry: " << materialNode <<
", Property ABSLENGTH not found");
878 int numNodes =
property.getNumberNodes(
"value");
881 std::vector<double> energies;
882 std::vector<double> absLengths;
883 for (
int i = 0; i < numNodes; i++) {
884 GearDir value(property,
"value", i + 1);
885 energies.push_back(value.getDouble(
"@energy") * conversion /
Unit::eV);
886 absLengths.push_back(value.getDouble() *
Unit::mm);
888 TSpline3 spline(
"absLen", energies.data(), absLengths.data(), energies.size());
889 double lambdaFirst =
c_hc / energies.back();
890 double lambdaLast =
c_hc / energies[0];
891 double lambdaStep = 5;
892 int numSteps = (lambdaLast - lambdaFirst) / lambdaStep + 1;
893 const double filterThickness = arrayParams.
getLength(
"wavelengthFilter/thickness");
894 std::vector<float> bulkTransmittances;
895 for (
int i = 0; i < numSteps; i++) {
896 double wavelength = lambdaFirst + lambdaStep * i;
897 double energy =
c_hc / wavelength;
898 double absLen = spline.Eval(energy);
899 bulkTransmittances.push_back(exp(-filterThickness / absLen));
904 B2FATAL(
"TOPGeometry: " << materialNode
905 <<
", Property ABSLENGTH has less than 2 nodes");
913 const std::string& SN)
916 GearDir params(content,
"QuartzBars/QuartzBar[@SerialNumber='" + SN +
"']");
918 params.getLength(
"Thickness"),
919 params.getLength(
"Length"),
920 params.getString(
"Material"));
924 std::string surfaceName = params.getString(
"OpticalSurface");
925 double sigmaAlpha = params.getDouble(
"SigmaAlpha");
926 GearDir surfaceParams(content,
"Modules/Surface[@name='" + surfaceName +
"']");
928 auto quartzSurface = materials.createOpticalSurfaceConfig(surfaceParams);
936 const std::string& SN)
939 GearDir params(content,
"Mirrors/Mirror[@SerialNumber='" + SN +
"']");
941 params.getLength(
"Thickness"),
942 params.getLength(
"Length"),
943 params.getString(
"Material"));
945 mirror.
setRadius(params.getLength(
"Radius"));
950 GearDir coatingParams(params,
"Surface");
951 mirror.
setCoating(params.getLength(
"mirrorThickness"),
"Al",
952 materials.createOpticalSurfaceConfig(coatingParams));
955 std::string surfaceName = params.getString(
"OpticalSurface");
956 double sigmaAlpha = params.getDouble(
"SigmaAlpha");
957 GearDir surfaceParams(content,
"Modules/Surface[@name='" + surfaceName +
"']");
958 auto quartzSurface = materials.createOpticalSurfaceConfig(surfaceParams);
966 const std::string& SN)
969 GearDir params(content,
"Prisms/Prism[@SerialNumber='" + SN +
"']");
971 params.getLength(
"Thickness"),
972 params.getLength(
"Length"),
973 params.getLength(
"ExitThickness"),
975 params.getString(
"Material"));
976 prism.
setAngle(params.getAngle(
"Angle"));
980 std::string surfaceName = params.getString(
"OpticalSurface");
981 double sigmaAlpha = params.getDouble(
"SigmaAlpha");
982 GearDir surfaceParams(content,
"Modules/Surface[@name='" + surfaceName +
"']");
984 auto quartzSurface = materials.createOpticalSurfaceConfig(surfaceParams);
994 ss << str <<
"0" << number;
1008 const double b[] = {0.683740494, 0.420323613, 0.585027480};
1009 const double c[] = {0.00460352869, 0.0133968856, 64.4932732};
1011 double x = pow(lambda * 0.001, 2);
1013 for (
int i = 0; i < 3; i++) {
1014 y += b[i] * x / (x - c[i]);
1021 double lambda =
c_hc / energy;
1027 double lambda =
c_hc / energy;
1031 return n / (1 + lambda / n * dndl);
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.
static int getPmtID(int pixel)
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.
static 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
static double getPhaseIndex(double energy)
Returns phase refractive index of quartz at given photon energy.
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using basf2 units.
static 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
static int getUniquePmtID(int moduleID, int pmtID)
Returns unique PMT ID within the detector.
unsigned getPMTType(int moduleID, int pmtID) const
Returns PMT type at a given position.
void finalizeInitialization()
finalize initialization
static double getGroupIndex(double energy)
Returns group refractive index of quartz at given photon energy.
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.
static 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.
static int getUniquePixelID(int moduleID, int pixelID)
Returns unique pixel ID within the detector.
DBObjPtr< TOPCalChannelRQE > m_channelRQE
channel relative quantum effi.
ChannelMapper m_channelMapperIRS3B
channel-pixel mapper
FrontEndMapper m_frontEndMapper
front end electronics mapper
static 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.
static double refractiveIndex(double lambda)
Quartz refractive index (SellMeier equation)
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.
static 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)
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.
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
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.