Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:20:19

0001 //==============================================================================
0002 //  AIDA Detector description implementation for LHCb
0003 //------------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 //  \author   Markus Frank
0011 //  \date     2018-03-08
0012 //  \version  1.0
0013 //
0014 //==============================================================================
0015 
0016 // Framework include files
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 /// Printout method to stdout
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 /// Initialization of sub-classes
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     // Calculate the x-coordinate of the pixel centre and the pitch.
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       // right of chip border
0077       x -= 0.5 * (interChipPixelSize - pixelSize);
0078       pitch =
0079         0.5 * (interChipPixelSize + pixelSize);
0080       break;
0081     case 255:
0082     case 511:
0083       // left of chip border
0084       x += 0.5 * (interChipPixelSize - pixelSize);
0085       pitch = interChipPixelSize;
0086       break;
0087     case 254:
0088     case 510:
0089       // two left of chip border
0090       pitch =
0091         0.5 * (interChipPixelSize + pixelSize);
0092       break;
0093     }
0094     local_x[col] = x;
0095     x_pitch[col] = pitch;
0096   }
0097 }
0098 
0099 /// Printout method to stdout
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 /// Initialization of sub-classes
0110 void gaudi::detail::DeVPSensorObject::initialize()   {
0111   DeIOVObject::initialize();
0112 
0113   sensor_static = de_static;
0114   de_user = de_static->de_user;
0115   // We require a valid alignment object for sensors!
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   // Check here if values must be valid ?
0123   if ( !info.isValid() )  {
0124     // except(DeVPSensor", "Invalid IOV dependent sensor info!");
0125   }
0126   if ( !noise.isValid() )  {
0127     // except(DeVPSensor", "Invalid IOV dependent sensor noise!");
0128   }
0129   if ( !readout.isValid() )  {
0130     // except(DeVPSensor", "Invalid IOV dependent sensor readout!");
0131   }
0132 }