44 #include "CLHEP/Random/RandGauss.h" 45 #include "CLHEP/Random/RandFlat.h" 88 std::map<int, CalParameters, std::less<int> >
calmap_;
96 appendMode_(iConfig.getUntrackedParameter<
bool>(
"appendMode",
true)),
97 SiPixelGainCalibration_(nullptr),
98 SiPixelGainCalibrationService_(iConfig, consumesCollector()),
99 recordName_(iConfig.getParameter<
std::
string>(
"record")),
100 meanPed_(iConfig.getParameter<double>(
"meanPed")),
101 rmsPed_(iConfig.getParameter<double>(
"rmsPed")),
102 meanGain_(iConfig.getParameter<double>(
"meanGain")),
103 rmsGain_(iConfig.getParameter<double>(
"rmsGain")),
104 meanPedFPix_(iConfig.getUntrackedParameter<double>(
"meanPedFPix", meanPed_)),
105 rmsPedFPix_(iConfig.getUntrackedParameter<double>(
"rmsPedFPix", rmsPed_)),
106 meanGainFPix_(iConfig.getUntrackedParameter<double>(
"meanGainFPix", meanGain_)),
107 rmsGainFPix_(iConfig.getUntrackedParameter<double>(
"rmsGainFPix", rmsGain_)),
108 deadFraction_(iConfig.getParameter<double>(
"deadFraction")),
109 noisyFraction_(iConfig.getParameter<double>(
"noisyFraction")),
110 secondRocRowGainOffset_(iConfig.getParameter<double>(
"secondRocRowGainOffset")),
111 secondRocRowPedOffset_(iConfig.getParameter<double>(
"secondRocRowPedOffset")),
112 numberOfModules_(iConfig.getParameter<
int>(
"numberOfModules")),
113 fromFile_(iConfig.getParameter<
bool>(
"fromFile")),
114 fileName_(iConfig.getParameter<
std::
string>(
"fileName")),
115 generateColumns_(iConfig.getUntrackedParameter<
bool>(
"generateColumns",
true))
118 ::putenv((
char*)
"CORAL_AUTH_USER=me");
119 ::putenv((
char*)
"CORAL_AUTH_PASSWORD=test");
126 uint32_t nchannels = 0;
131 <<
"... creating dummy SiPixelGainCalibration Data for Run " <<
run <<
"\n " << std::endl;
144 edm::LogInfo(
"SiPixelCondObjForHLTBuilder") <<
" There are " << pDD->dets().size() <<
" detectors" << std::endl;
146 for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) {
147 if (dynamic_cast<PixelGeomDetUnit const*>((*it)) !=
nullptr) {
148 uint32_t detid = ((*it)->geographicalId()).rawId();
158 int nrows = topol.
nrows();
176 std::vector<char> theSiPixelGainCalibration;
180 float totalPed = 0.0;
181 float totalGain = 0.0;
182 for (
int j = 0;
j < nrows;
j++) {
185 bool isNoisy =
false;
186 float ped = 0.0,
gain = 0.0;
190 int chipIndex = 0, colROC = 0, rowROC = 0;
195 std::map<int, CalParameters, std::less<int> >::const_iterator it =
calmap_.find(chanROC);
197 ped = theCalParameters.
p0;
198 gain = theCalParameters.
p1;
202 double val = CLHEP::RandFlat::shoot();
209 double val = CLHEP::RandFlat::shoot();
216 if (rmsPedWork > 0) {
217 ped = CLHEP::RandGauss::shoot(meanPedWork, rmsPedWork);
218 while (ped < minped || ped > maxped)
219 ped = CLHEP::RandGauss::shoot(meanPedWork, rmsPedWork);
222 if (rmsGainWork > 0) {
223 gain = CLHEP::RandGauss::shoot(meanGainWork, rmsGainWork);
224 while (gain < mingain || gain > maxgain)
225 gain = CLHEP::RandGauss::shoot(meanGainWork, rmsGainWork);
243 else if (
gain < mingain)
248 else if (ped < minped)
255 if ((
j + 1) % 80 == 0) {
257 float averagePed = totalPed /
static_cast<float>(80);
258 float averageGain = totalGain /
static_cast<float>(80);
265 if (!isDead && !isNoisy)
281 <<
"[SiPixelCondObjForHLTBuilder::analyze] detid already exists" << std::endl;
284 edm::LogPrint(
"SiPixelCondObjForHLTBuilder") <<
" ---> PIXEL Modules " << nmodules << std::endl;
285 edm::LogPrint(
"SiPixelCondObjForHLTBuilder") <<
" ---> PIXEL Channels " << nchannels << std::endl;
335 edm::LogError(
"SiPixelCondObjForHLTBuilder") <<
"caught std::exception " << er.what() << std::endl;
337 edm::LogError(
"SiPixelCondObjForHLTBuilder") <<
"Funny error" << std::endl;
345 edm::LogInfo(
"SiPixelCondObjForHLTBuilder") <<
" Calibration loaded: Map size " <<
calmap_.size() <<
" max " 359 edm::LogError(
"SiPixelCondObjForHLTBuilder") <<
"Input file not found" << std::endl;
363 <<
" " <<
in_file.good() <<
" end of file " << std::endl;
368 for (
int i = 0;
i < 3;
i++) {
373 for (
int i = 0;
i < (52 * 80);
i++) {
377 <<
" Col " << colid <<
" Row " << rowid <<
" P0 " <<
par0 <<
" P1 " <<
par1 << std::endl;
385 calmap_.insert(std::pair<int, CalParameters>(
chan, onePix));
SiPixelCondObjForHLTBuilder(const edm::ParameterSet &iConfig)
~SiPixelCondObjForHLTBuilder() override=default
Base exception class for the object to relational access.
const double secondRocRowPedOffset_
std::unique_ptr< SiPixelGainCalibrationForHLT > SiPixelGainCalibration_
virtual int ncolumns() const =0
const std::string fileName_
#define DEFINE_FWK_MODULE(type)
cond::Time_t beginOfTime() const
virtual int nrows() const =0
Log< level::Error, false > LogError
std::pair< ContainerIterator, ContainerIterator > Range
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
PixelIndices * pIndexConverter_
SiPixelGainCalibrationForHLTService SiPixelGainCalibrationService_
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
void analyze(const edm::Event &, const edm::EventSetup &) override
const bool generateColumns_
int transformToROC(const int col, const int row, int &rocId, int &colROC, int &rowROC) const
bool isNewTagRequest(const std::string &recordName)
cond::Time_t currentTime() const
const double meanGainFPix_
const double meanPedFPix_
static int pixelToChannelROC(const int rowROC, const int colROC)
std::map< int, CalParameters, std::less< int > > calmap_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getData(T &iHolder) const
Log< level::Warning, true > LogPrint
Namespace of DDCMS conversion namespace.
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeometryToken_
Log< level::Info, false > LogInfo
const int numberOfModules_
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
const double rmsGainFPix_
const std::string recordName_
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
const double secondRocRowGainOffset_
char const * what() const noexcept override
const double noisyFraction_
const double deadFraction_