File indexing completed on 2025-01-31 09:20:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include "Detector/DeVPSensor.h"
0018 #include "DD4hep/Primitives.h"
0019 #include "DD4hep/Printout.h"
0020
0021 namespace gaudi {
0022 const DeVPSensorElement::itemkey_type DeVPSensorElement::key_info = dd4hep::ConditionKey::itemCode("StripInfo");
0023 const DeVPSensorElement::itemkey_type DeVPSensorElement::key_noise = dd4hep::ConditionKey::itemCode("StripNoise");
0024 const DeVPSensorElement::itemkey_type DeVPSensorElement::key_readout = dd4hep::ConditionKey::itemCode("StripReadout");
0025 }
0026
0027
0028 void gaudi::detail::DeVPSensorStaticObject::print(int indent, int flg) const {
0029
0030 this->DeStaticObject::print(indent, flg);
0031 if ( flg & DePrint::SPECIFIC ) {
0032 printout(INFO,"DeVPSensorStatic",
0033 "%s+ >> Module:%d Sensor:%d %s %d Chips Rows:%d Cols:%d",
0034 DE::indent(indent).c_str(),
0035 module, sensorNumber, (de_user&VP::LEFT) ? "Left" : "Right", nChips, nCols, nRows);
0036 }
0037 if ( flg & DePrint::DETAIL ) {
0038 printout(INFO,"DeVPSensorStatic",
0039 "%s+ >> Thickness:%g ChipSize:%g Dist:%g Pix-Size:%g Dist:%g",
0040 DE::indent(indent).c_str(),
0041 thickness, chipSize, interChipDist, pixelSize, interChipPixelSize);
0042 printout(INFO,"DeVPSensorStatic",
0043 "%s+ >> SizeX: %g SizeY: %g local:%ld pitch:%ld",
0044 DE::indent(indent).c_str(), sizeX, sizeY, local_x.size(), x_pitch.size());
0045 }
0046 }
0047
0048
0049 void gaudi::detail::DeVPSensorStaticObject::initialize() {
0050 std::string side = param<std::string>("Side");
0051
0052 sensorNumber = param<int>("SensorNumber");
0053 module = param<int>("Module");
0054 side.find("Left") == 0 ? de_user |= VP::LEFT : de_user &= ~VP::LEFT;
0055
0056 thickness = param<double>("Thickness");
0057 nChips = param<int>("NChips");
0058 chipSize = param<double>("ChipSize");
0059 interChipDist = param<double>("InterChipDist");
0060 nCols = param<int>("NColumns");
0061 nRows = param<int>("NRows");
0062 pixelSize = param<double>("PixelSize");
0063 interChipPixelSize = param<double>("InterChipPixelSize");
0064
0065 sizeX = nChips * chipSize + (nChips - 1) * interChipDist;
0066 sizeY = chipSize;
0067 for (unsigned int col = 0; col < VP::NSensorColumns; ++col) {
0068
0069 const double x0 =
0070 (col / VP::NColumns) * (chipSize + interChipDist);
0071 double x = x0 + (col % VP::NColumns + 0.5) * pixelSize;
0072 double pitch = pixelSize;
0073 switch (col) {
0074 case 256:
0075 case 512:
0076
0077 x -= 0.5 * (interChipPixelSize - pixelSize);
0078 pitch =
0079 0.5 * (interChipPixelSize + pixelSize);
0080 break;
0081 case 255:
0082 case 511:
0083
0084 x += 0.5 * (interChipPixelSize - pixelSize);
0085 pitch = interChipPixelSize;
0086 break;
0087 case 254:
0088 case 510:
0089
0090 pitch =
0091 0.5 * (interChipPixelSize + pixelSize);
0092 break;
0093 }
0094 local_x[col] = x;
0095 x_pitch[col] = pitch;
0096 }
0097 }
0098
0099
0100 void gaudi::detail::DeVPSensorObject::print(int indent, int flg) const {
0101 DeIOVObject::print(indent, flg);
0102 printout(INFO,"DeVPSensor", "%s+ >> Info: %s Noise:%s Readout:%s",
0103 DE::indent(indent).c_str(),
0104 yes_no(info.isValid()),
0105 yes_no(noise.isValid()),
0106 yes_no(readout.isValid()));
0107 }
0108
0109
0110 void gaudi::detail::DeVPSensorObject::initialize() {
0111 DeIOVObject::initialize();
0112
0113 sensor_static = de_static;
0114 de_user = de_static->de_user;
0115
0116 checkAlignment();
0117 for(const auto& c : conditions) {
0118 if ( c.first == DeVPSensor::key_info ) info = c.second;
0119 else if ( c.first == DeVPSensor::key_noise ) noise = c.second;
0120 else if ( c.first == DeVPSensor::key_readout ) readout = c.second;
0121 }
0122
0123 if ( !info.isValid() ) {
0124
0125 }
0126 if ( !noise.isValid() ) {
0127
0128 }
0129 if ( !readout.isValid() ) {
0130
0131 }
0132 }