16 fp_(iConfig.getUntrackedParameter<edm::
FileInPath>(
"file",edm::
FileInPath(
"CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))),
17 printdebug_(iConfig.getUntrackedParameter<uint32_t>(
"printDebug",1)),
21 stripLengthMode_(
true),
30 std::vector<uint32_t> inputDetIds;
31 inputApvGain->getDetIds(inputDetIds);
43 std::map<int, std::vector<double> > meanNoise;
45 std::map<int, std::vector<double> > sigmaNoise;
50 std::map<int, std::vector<double> > noiseStripLengthLinearSlope;
51 fillParameters(noiseStripLengthLinearSlope,
"NoiseStripLengthSlope");
52 std::map<int, std::vector<double> > noiseStripLengthLinearQuote;
53 fillParameters(noiseStripLengthLinearQuote,
"NoiseStripLengthQuote");
58 unsigned int count = 0;
59 const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos =
reader.getAllData();
60 for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++) {
68 uint32_t detId = it->first;
70 unsigned short nApvs = it->second.nApvs;
72 if(stripLengthMode_) {
74 double linearSlope = noiseStripLengthLinearSlope[sl.first][sl.second];
75 double linearQuote = noiseStripLengthLinearQuote[sl.first][sl.second];
76 double stripLength = it->second.stripLength;
77 for(
unsigned short j=0;
j<nApvs; ++
j ) {
79 double gain = inputApvGain->getApvGain(
j,
inputRange);
81 for(
unsigned short stripId = 0; stripId < 128; ++stripId ) {
82 noise = ( ( linearSlope*stripLength + linearQuote) /
electronsPerADC_ ) * gain;
83 if( count<printDebug_ )
printLog(detId, stripId+128*
j, noise);
84 obj->
setData(noise, theSiStripVector);
90 double meanN = meanNoise[sl.first][sl.second];
91 double sigmaN = sigmaNoise[sl.first][sl.second];
92 for(
unsigned short j=0;
j<nApvs; ++
j ) {
94 double gain = inputApvGain->getApvGain(
j,
inputRange);
96 for(
unsigned short stripId = 0; stripId < 128; ++stripId ) {
97 noise = ( CLHEP::RandGauss::shoot(meanN, sigmaN) ) * gain;
99 if( count<printDebug_ )
printLog(detId, stripId+128*
j, noise);
100 obj->
setData(noise, theSiStripVector);
106 if ( ! obj->
put(it->first,theSiStripVector) ) {
107 edm::LogError(
"SiStripNoisesFakeESSource::produce ")<<
" detid already exists"<<std::endl;
123 edm::LogError(
"SiStripNoiseNormalizedWithApvGainBuilder")<<
"Service is unavailable"<<std::endl;
136 layerId = theTIBDetId.
layer() - 1;
140 layerId = theTOBDetId.
layer() - 1;
144 layerId = theTIDDetId.
ring() - 1;
148 layerId = theTECDetId.
ring() - 1;
150 return std::make_pair(subId, layerId);
168 if( v.size() == layers ) {
169 mapToFill.insert(std::make_pair( subDet, v ));
171 else if( v.size() == 1 ) {
172 std::vector<double> parV(layers, v[0]);
173 mapToFill.insert(std::make_pair( subDet, parV ));
176 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
inputRange
Get input source.
unsigned int layer() const
layer id
std::vector< uint16_t > InputVector
SiStripNoiseNormalizedWithApvGainBuilder(const edm::ParameterSet &iConfig)
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
cond::Time_t beginOfTime() const
unsigned int ring() const
ring id
std::pair< ContainerIterator, ContainerIterator > Range
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.
void printLog(const uint32_t detId, const unsigned short strip, const double &noise) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
bool put(const uint32_t &detID, const InputVector &input)
void fillSubDetParameter(std::map< int, std::vector< double > > &mapToFill, const std::vector< double > &v, const int subDet, const unsigned short layers) const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
cond::Time_t endOfTime() const
unsigned int layer() const
layer id
cond::Time_t currentTime() const
unsigned int ring() const
ring id
std::string fullPath() const
std::pair< int, int > subDetAndLayer(const uint32_t detit) const
Given the map and the detid it returns the corresponding layer/ring.
void setData(float noise_, InputVector &vped)