42 #include "CLHEP/Random/RandGauss.h" 78 std::map<int, CalParameters, std::less<int> >
calmap_;
85 : appendMode_(iConfig.getUntrackedParameter<
bool>(
"appendMode",
true)),
87 SiPixelGainCalibration_(nullptr),
88 SiPixelGainCalibrationService_(iConfig, consumesCollector()),
89 recordName_(iConfig.getParameter<
std::
string>(
"record")),
90 meanPed_(iConfig.getParameter<double>(
"meanPed")),
91 rmsPed_(iConfig.getParameter<double>(
"rmsPed")),
92 meanGain_(iConfig.getParameter<double>(
"meanGain")),
93 rmsGain_(iConfig.getParameter<double>(
"rmsGain")),
94 secondRocRowGainOffset_(iConfig.getParameter<double>(
"secondRocRowGainOffset")),
95 secondRocRowPedOffset_(iConfig.getParameter<double>(
"secondRocRowPedOffset")),
96 numberOfModules_(iConfig.getParameter<
int>(
"numberOfModules")),
97 fromFile_(iConfig.getParameter<
bool>(
"fromFile")),
98 fileName_(iConfig.getParameter<
std::
string>(
"fileName")) {
99 ::putenv((
char*)
"CORAL_AUTH_USER=me");
100 ::putenv((
char*)
"CORAL_AUTH_PASSWORD=test");
107 uint32_t nchannels = 0;
112 <<
"... creating dummy SiPixelGainCalibration Data for Run " <<
run <<
"\n " << std::endl;
123 edm::LogInfo(
"SiPixelCondObjBuilder") <<
" There are " << pDD->dets().size() <<
" detectors" << std::endl;
125 for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) {
126 if (dynamic_cast<PixelGeomDetUnit const*>((*it)) !=
nullptr) {
127 uint32_t detid = ((*it)->geographicalId()).rawId();
137 int nrows = topol.
nrows();
143 std::vector<char> theSiPixelGainCalibration;
147 for (
int j = 0;
j < nrows;
j++) {
150 float ped = 0.0,
gain = 0.0;
154 int chipIndex = 0, colROC = 0, rowROC = 0;
159 std::map<int, CalParameters, std::less<int> >::const_iterator it =
calmap_.find(chanROC);
161 ped = theCalParameters.
p0;
162 gain = theCalParameters.
p1;
167 while (minped > ped || maxped < ped)
174 while (mingain >
gain || maxgain <
gain)
187 else if (
gain < mingain)
192 else if (ped < minped)
211 <<
"[SiPixelCondObjBuilder::analyze] detid already exists" << std::endl;
214 edm::LogPrint(
"SiPixelCondObjBuilder") <<
" ---> PIXEL Modules " << nmodules << std::endl;
215 edm::LogPrint(
"SiPixelCondObjBuilder") <<
" ---> PIXEL Channels " << nchannels << std::endl;
234 edm::LogPrint(
"SiPixelCondObjBuilder") <<
"Didn't get DB" << std::endl;
264 edm::LogPrint(
"SiPixelCondObjBuilder") <<
"Database exception! " << er.
what() << std::endl;
267 edm::LogPrint(
"SiPixelCondObjBuilder") <<
"Standard exception! " << er.what() << std::endl;
268 edm::LogError(
"SiPixelCondObjBuilder") <<
"caught std::exception " << er.what() << std::endl;
270 edm::LogError(
"SiPixelCondObjBuilder") <<
"Funny error" << std::endl;
278 edm::LogInfo(
"SiPixelCondObjBuilder") <<
" Calibration loaded: Map size " <<
calmap_.size() <<
" max " 292 edm::LogError(
"SiPixelCondObjBuilder") <<
"Input file not found" << std::endl;
296 <<
in_file.good() <<
" end of file " << std::endl;
301 for (
int i = 0;
i < 3;
i++) {
306 for (
int i = 0;
i < (52 * 80);
i++) {
310 <<
" Col " << colid <<
" Row " << rowid <<
" P0 " <<
par0 <<
" P1 " <<
par1 << std::endl;
318 calmap_.insert(std::pair<int, CalParameters>(
chan, onePix));
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pddToken_
SiPixelGainCalibrationService SiPixelGainCalibrationService_
Base exception class for the object to relational access.
std::unique_ptr< SiPixelGainCalibration > SiPixelGainCalibration_
virtual int ncolumns() const =0
cond::Time_t beginOfTime() const
virtual int nrows() const =0
Log< level::Error, false > LogError
std::map< int, CalParameters, std::less< int > > calmap_
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
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 secondRocRowGainOffset_
static int pixelToChannelROC(const int rowROC, const int colROC)
const std::string recordName_
const std::string fileName_
#define DEFINE_FWK_MODULE(type)
bool getData(T &iHolder) const
const double secondRocRowPedOffset_
Log< level::Warning, true > LogPrint
Namespace of DDCMS conversion namespace.
Log< level::Info, false > LogInfo
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
std::pair< ContainerIterator, ContainerIterator > Range
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
const int numberOfModules_
void analyze(const edm::Event &, const edm::EventSetup &) override
SiPixelCondObjBuilder(const edm::ParameterSet &iConfig)
char const * what() const noexcept override
PixelIndices * pIndexConverter_
~SiPixelCondObjBuilder() override=default