CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/SimCalorimetry/CaloSimAlgos/src/CaloSimParameters.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/CaloSimAlgos/interface/CaloSimParameters.h"
00002 #include "FWCore/Utilities/interface/Exception.h"
00003 #include<iostream>
00004   
00005 CaloSimParameters::CaloSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog,
00006                  double samplingFactor, double timePhase,
00007                  int readoutFrameSize, int binOfMaximum,
00008                  bool doPhotostatistics, bool syncPhase)
00009 : simHitToPhotoelectrons_(simHitToPhotoelectrons),
00010   photoelectronsToAnalog_(photoelectronsToAnalog),
00011   timePhase_(timePhase),
00012   readoutFrameSize_(readoutFrameSize),
00013   binOfMaximum_(binOfMaximum),
00014   doPhotostatistics_(doPhotostatistics),
00015   syncPhase_(syncPhase)
00016 {
00017 }
00018 
00019 
00020 
00021 CaloSimParameters::CaloSimParameters(const edm::ParameterSet & p)
00022 : simHitToPhotoelectrons_( p.getParameter<double>("simHitToPhotoelectrons") ),
00023   photoelectronsToAnalog_( 0. ),
00024   timePhase_( p.getParameter<double>("timePhase") ),
00025   readoutFrameSize_( p.getParameter<int>("readoutFrameSize") ),
00026   binOfMaximum_( p.getParameter<int>("binOfMaximum") ),
00027   doPhotostatistics_( p.getParameter<bool>("doPhotoStatistics") ),
00028   syncPhase_( p.getParameter<bool>("syncPhase") )
00029 {
00030   // some subsystems may not want a single number for this
00031   if(p.existsAs<double>("photoelectronsToAnalog")) {
00032     photoelectronsToAnalog_ = p.getParameter<double>("photoelectronsToAnalog");
00033   } else if(p.existsAs<std::vector<double> >("photoelectronsToAnalog")) {
00034     // just take the first one
00035     photoelectronsToAnalog_ = p.getParameter<std::vector<double> >("photoelectronsToAnalog").at(0);
00036   } else {
00037     throw cms::Exception("CaloSimParameters") << "Cannot find parameter photoelectronsToAnalog";
00038   }
00039 }
00040 
00041 
00042 std::ostream & operator<<(std::ostream & os, const CaloSimParameters & p) {
00043   DetId dummy(0);
00044   os << "CALO SIM PARAMETERS" << std::endl;
00045   os << p.simHitToPhotoelectrons(dummy) << " pe per SimHit energy " << std::endl;
00046   os << p.photoelectronsToAnalog() << " Analog signal to be digitized per pe" << std::endl;
00047   os << " Incident energy / SimHit Energy " << std::endl;
00048   return os;
00049 }
00050