Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:26

0001 #include "FWCore/Utilities/interface/Exception.h"
0002 #include "SimCalorimetry/CaloSimAlgos/interface/CaloSimParameters.h"
0003 #include <iostream>
0004 
0005 CaloSimParameters::CaloSimParameters(double simHitToPhotoelectrons,
0006                                      double photoelectronsToAnalog,
0007                                      double samplingFactor,
0008                                      double timePhase,
0009                                      int readoutFrameSize,
0010                                      int binOfMaximum,
0011                                      bool doPhotostatistics,
0012                                      bool syncPhase)
0013     : simHitToPhotoelectrons_(simHitToPhotoelectrons),
0014       photoelectronsToAnalog_(photoelectronsToAnalog),
0015       timePhase_(timePhase),
0016       readoutFrameSize_(readoutFrameSize),
0017       binOfMaximum_(binOfMaximum),
0018       doPhotostatistics_(doPhotostatistics),
0019       syncPhase_(syncPhase) {}
0020 
0021 CaloSimParameters::CaloSimParameters(const edm::ParameterSet &p, bool skipPe2Fc)
0022     : simHitToPhotoelectrons_(p.getParameter<double>("simHitToPhotoelectrons")),
0023       photoelectronsToAnalog_(0.),
0024       timePhase_(p.getParameter<double>("timePhase")),
0025       readoutFrameSize_(p.getParameter<int>("readoutFrameSize")),
0026       binOfMaximum_(p.getParameter<int>("binOfMaximum")),
0027       doPhotostatistics_(p.getParameter<bool>("doPhotoStatistics")),
0028       syncPhase_(p.getParameter<bool>("syncPhase")) {
0029   // some subsystems may not want a single number for this
0030   if (p.existsAs<double>("photoelectronsToAnalog")) {
0031     photoelectronsToAnalog_ = p.getParameter<double>("photoelectronsToAnalog");
0032   } else if (p.existsAs<std::vector<double>>("photoelectronsToAnalog")) {
0033     // just take the first one
0034     photoelectronsToAnalog_ = p.getParameter<std::vector<double>>("photoelectronsToAnalog").at(0);
0035   } else if (!skipPe2Fc) {
0036     throw cms::Exception("CaloSimParameters") << "Cannot find parameter photoelectronsToAnalog";
0037   }
0038   // some subsystems may not want this at all
0039 }
0040 
0041 std::ostream &operator<<(std::ostream &os, const CaloSimParameters &p) {
0042   DetId dummy(0);
0043   os << "CALO SIM PARAMETERS" << std::endl;
0044   os << p.simHitToPhotoelectrons(dummy) << " pe per SimHit energy " << std::endl;
0045   os << p.photoelectronsToAnalog() << " Analog signal to be digitized per pe" << std::endl;
0046   os << " Incident energy / SimHit Energy " << std::endl;
0047   return os;
0048 }