2 #include <boost/cstdint.hpp>
11 #include "CLHEP/Random/RandFlat.h"
12 #include "CLHEP/Random/RandGauss.h"
18 stripLengthMode_(
true),
21 edm::LogInfo(
"SiStripNoisesGenerator") <<
"[SiStripNoisesGenerator::SiStripNoisesGenerator]";
26 edm::LogInfo(
"SiStripNoisesGenerator") <<
"[SiStripNoisesGenerator::~SiStripNoisesGenerator]";
36 std::map<int, std::vector<double> > meanNoise;
38 std::map<int, std::vector<double> > sigmaNoise;
43 std::map<int, std::vector<double> > noiseStripLengthLinearSlope;
44 fillParameters(noiseStripLengthLinearSlope,
"NoiseStripLengthSlope");
45 std::map<int, std::vector<double> > noiseStripLengthLinearQuote;
46 fillParameters(noiseStripLengthLinearQuote,
"NoiseStripLengthQuote");
54 const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos =
reader.getAllData();
56 for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); ++it) {
61 uint32_t detId = it->first;
63 unsigned short nApvs = it->second.nApvs;
68 double linearSlope = noiseStripLengthLinearSlope[sl.first][sl.second];
69 double linearQuote = noiseStripLengthLinearQuote[sl.first][sl.second];
70 double stripLength = it->second.stripLength;
71 for(
unsigned short j=0;
j<128*nApvs; ++
j ) {
73 if( count<printDebug_ )
printLog(detId,
j, noise);
79 double meanN = meanNoise[sl.first][sl.second];
80 double sigmaN = sigmaNoise[sl.first][sl.second];
81 for(
unsigned short j=0;
j<128*nApvs; ++
j ) {
82 noise = CLHEP::RandGauss::shoot(meanN, sigmaN);
84 if( count<printDebug_ )
printLog(detId,
j, noise);
90 if ( !
obj_->
put(it->first,theSiStripVector) ) {
91 edm::LogError(
"SiStripNoisesFakeESSource::produce ")<<
" detid already exists"<<std::endl;
105 layerId = theTIBDetId.
layer() - 1;
109 layerId = theTOBDetId.
layer() - 1;
113 layerId = theTIDDetId.
ring() - 1;
117 layerId = theTECDetId.
ring() - 1;
119 return std::make_pair(subId, layerId);
137 if( v.size() == layers ) {
138 mapToFill.insert(std::make_pair( subDet, v ));
140 else if( v.size() == 1 ) {
141 std::vector<double> parV(layers, v[0]);
142 mapToFill.insert(std::make_pair( subDet, parV ));
145 throw cms::Exception(
"Configuration") <<
"ERROR: number of parameters for subDet " << subDet <<
" are " << v.size() <<
". They must be either 1 or " << layers << std::endl;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void fillParameters(std::map< int, std::vector< double > > &mapToFill, const std::string ¶meterName) const
Fills the parameters read from cfg and matching the name in the given map.
unsigned int layer() const
layer id
std::pair< int, int > subDetAndLayer(const uint32_t detit) const
Given the map and the detid it returns the corresponding layer/ring.
std::vector< uint16_t > InputVector
SiStripNoisesGenerator(const edm::ParameterSet &, const edm::ActivityRegistry &)
void fillSubDetParameter(std::map< int, std::vector< double > > &mapToFill, const std::vector< double > &v, const int subDet, const unsigned short layers) const
unsigned int ring() const
ring id
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool put(const uint32_t &detID, const InputVector &input)
void printLog(const uint32_t detId, const unsigned short strip, const double &noise) const
unsigned int layer() const
layer id
unsigned int ring() const
ring id
std::string fullPath() const
~SiStripNoisesGenerator()
void setData(float noise_, InputVector &vped)