|
|
Go to the documentation of this file.
22 if (
first.genericSubdet() !=
second.genericSubdet())
23 return first.genericSubdet() <
second.genericSubdet();
24 if (
first.isHcalDetId()) {
40 return first.readoutVMECrateId() !=
second.readoutVMECrateId()
41 ?
first.readoutVMECrateId() <
second.readoutVMECrateId()
52 std::vector<std::string>
result;
55 for (
unsigned i = 0;
i <= fLine.size();
i++) {
56 if (fLine[
i] ==
' ' ||
i == fLine.size()) {
80 " %15s %15s %15s %15s",
88 template <
class S,
class T>
91 while (fInput.getline(
buffer, 1024)) {
97 if (
items.size() < 8) {
99 <<
"\n line must contain 8 items: eta, phi, depth, subdet, 4x values"
109 S fCondObject(
id, atof(
items[4].c_str()), atof(
items[5].c_str()), atof(
items[6].c_str()), atof(
items[7].c_str()));
110 fObject.addValues(fCondObject);
121 "# %15s %15s %15s %15s %8s %8s %8s %8s %10s\n",
132 std::vector<DetId>
channels = fObject.getAllChannels();
134 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); ++channel) {
135 const float*
values = fObject.getValues(*channel)->getValues();
137 dumpId(fOutput, *channel);
146 template <
class S,
class T>
149 while (fInput.getline(
buffer, 1024)) {
155 if (
items.size() < 5) {
157 <<
"\n line must contain 5 items: eta, phi, depth, subdet, value" << std::endl;
166 S fCondObject(
id, atof(
items[4].c_str()));
167 fObject.addValues(fCondObject);
176 sprintf(
buffer,
"# %15s %15s %15s %15s %8s %10s\n",
"eta",
"phi",
"dep",
"det",
"value",
"DetId");
178 std::vector<DetId>
channels = fObject.getAllChannels();
180 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); ++channel) {
181 const float value = fObject.getValues(*channel)->getValue();
182 dumpId(fOutput, *channel);
183 sprintf(
buffer,
" %8.5f %10X\n",
value, channel->rawId());
189 template <
class S,
class T>
192 while (fInput.getline(
buffer, 1024)) {
198 if (
items.size() < 5) {
200 <<
"\n line must contain 5 items: eta, phi, depth, subdet, value" << std::endl;
209 fCondObject =
new S(
id, atoi(
items[4].c_str()));
210 fObject.addValues(*fCondObject);
220 sprintf(
buffer,
"# %15s %15s %15s %15s %8s %10s\n",
"eta",
"phi",
"dep",
"det",
"value",
"DetId");
222 std::vector<DetId>
channels = fObject.getAllChannels();
224 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); ++channel) {
225 const int value = fObject.getValues(*channel)->getValue();
226 dumpId(fOutput, *channel);
227 sprintf(
buffer,
" %15d %10X\n",
value, channel->rawId());
233 bool getObject(std::istream& fInput,
CastorGains& fObject) {
return getCastorObject<CastorGain>(fInput, fObject); }
236 return getCastorObject<CastorGainWidth>(fInput, fObject);
241 return getCastorSingleFloatObject<CastorSaturationCorr>(fInput, fObject);
251 while (fInput.getline(
buffer, 1024)) {
256 if (
items[0] ==
"#U") {
262 edm::LogWarning(
"Pedestal Unit Error") <<
"Unrecognized unit for pedestals. Assuming fC." << std::endl;
268 <<
"The unit for the pedestals is missing in the txt file." << std::endl;
273 while (fInput.getline(
buffer, 1024)) {
279 if (
items.size() < 8) {
281 <<
"Bad line: " <<
buffer <<
"\n line must contain 8 items: eta, phi, depth, subdet, 4x values"
282 <<
" or 12 items: eta, phi, depth, subdet, 4x values for mean, 4x values for width" << std::endl;
292 if (
items.size() < 12)
295 atof(
items[4].c_str()),
296 atof(
items[5].c_str()),
297 atof(
items[6].c_str()),
298 atof(
items[7].c_str()),
307 atof(
items[4].c_str()),
308 atof(
items[5].c_str()),
309 atof(
items[6].c_str()),
310 atof(
items[7].c_str()),
311 atof(
items[8].c_str()),
312 atof(
items[9].c_str()),
313 atof(
items[10].c_str()),
314 atof(
items[11].c_str()));
326 sprintf(
buffer,
"#U ADC << this is the unit \n");
328 sprintf(
buffer,
"#U fC << this is the unit \n");
332 "# %15s %15s %15s %15s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n",
350 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); ++channel) {
353 dumpId(fOutput, *channel);
355 " %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %10X\n",
374 while (fInput.getline(
buffer, 1024)) {
380 if (
items.size() < 5) {
382 <<
"\n line must contain 5 items: eta, phi, depth, subdet, GOOD/BAD/HOT/DEAD"
390 <<
"line: " <<
buffer <<
"\n attempts to redefine data. Ignored" << std::endl;
396 std::unique_ptr<CastorChannelStatus> fCondObject;
397 if (
items[4].substr(0, 2) ==
"0x") {
398 sscanf(
items[4].c_str(),
"%X", &mystatus);
399 fCondObject = std::make_unique<CastorChannelStatus>(
id, mystatus);
400 }
else if (isalpha(
items[4].c_str()[0])) {
401 fCondObject = std::make_unique<CastorChannelStatus>(
id,
items[4]);
403 sscanf(
items[4].c_str(),
"%u", &mystatus);
404 fCondObject = std::make_unique<CastorChannelStatus>(
id, mystatus);
414 sprintf(
buffer,
"# %15s %15s %15s %15s %15s %10s\n",
"eta",
"phi",
"dep",
"det",
"value",
"DetId");
418 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); ++channel) {
420 dumpId(fOutput, *channel);
421 sprintf(
buffer,
" %15X %10X\n",
value, channel->rawId());
432 while (fInput.getline(
buffer, 1024)) {
445 <<
"Unrecognized unit for pedestal widths. Assuming fC." << std::endl;
451 <<
"The unit for the pedestal widths is missing in the txt file." << std::endl;
457 while (fInput.getline(
buffer, 1024)) {
464 if (
items.size() < 14) {
466 <<
"\n line must contain 14 items: eta, phi, depth, subdet, 10x correlations"
467 <<
" or 20 items: eta, phi, depth, subdet, 16x correlations" << std::endl;
477 if (
items.size() < 20)
490 values.setSigma(0, 1, 0.);
491 values.setSigma(0, 2, 0.);
492 values.setSigma(0, 3, 0.);
493 values.setSigma(1, 2, 0.);
494 values.setSigma(1, 3, 0.);
495 values.setSigma(2, 3, 0.);
527 sprintf(
buffer,
"#U ADC << this is the unit \n");
529 sprintf(
buffer,
"#U fC << this is the unit \n");
533 "# %15s %15s %15s %15s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n",
558 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); ++channel) {
561 dumpId(fOutput, *channel);
564 " %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %10X\n",
565 item->getSigma(0, 0),
566 item->getSigma(0, 1),
567 item->getSigma(0, 2),
568 item->getSigma(0, 3),
569 item->getSigma(1, 0),
570 item->getSigma(1, 1),
571 item->getSigma(1, 2),
572 item->getSigma(1, 3),
573 item->getSigma(2, 0),
574 item->getSigma(2, 1),
575 item->getSigma(2, 2),
576 item->getSigma(2, 3),
577 item->getSigma(3, 0),
578 item->getSigma(3, 1),
579 item->getSigma(3, 2),
580 item->getSigma(3, 3),
591 while (fInput.getline(
buffer, 1024)) {
597 if (
items[0] ==
"SHAPE") {
598 if (
items.size() < 33) {
600 <<
"Bad line: " <<
buffer <<
"\n line must contain 33 items: SHAPE 32 x low QIE edges for first 32 bins"
609 if (
items.size() < 36) {
611 <<
"\n line must contain 36 items: eta, phi, depth, subdet, 4 capId x 4 "
612 "Ranges x offsets, 4 capId x 4 Ranges x slopes"
625 for (
unsigned capid = 0; capid < 4; capid++) {
630 for (
unsigned capid = 0; capid < 4; capid++) {
645 fOutput <<
"# QIE basic shape: SHAPE 32 x low edge values for first 32 channels" << std::endl;
646 sprintf(
buffer,
"SHAPE ");
648 for (
unsigned bin = 0;
bin < 32;
bin++) {
652 fOutput << std::endl;
654 fOutput <<
"# QIE data" << std::endl;
656 "# %15s %15s %15s %15s %36s %36s %36s %36s %36s %36s %36s %36s\n",
672 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); ++channel) {
674 dumpId(fOutput, *channel);
675 for (
unsigned capid = 0; capid < 4; capid++) {
681 for (
unsigned capid = 0; capid < 4; capid++) {
687 fOutput << std::endl;
695 while (fInput.getline(
buffer, 1024)) {
699 if (
items.size() < 36) {
701 <<
"\n line must contain 36 items: eta, phi, depth, subdet, 32 bin values"
715 for (
unsigned bin = 0;
bin < 32;
bin++) {
728 fOutput <<
"# QIE data in calibration mode" << std::endl;
729 sprintf(
buffer,
"# %15s %15s %15s %15s %288s\n",
"eta",
"phi",
"dep",
"det",
"32 x charges");
733 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); ++channel) {
736 dumpId(fOutput, *channel);
738 for (
unsigned bin = 0;
bin < 32;
bin++) {
742 fOutput << std::endl;
751 while (fInput.getline(
buffer, 1024)) {
755 if (
items.size() < 12) {
758 if (
items.size() < 9) {
763 while (
items.size() < 12)
765 }
else if (
items[8] ==
"HT") {
766 if (
items.size() == 11)
770 <<
"\n HT line must contain at least 11 items: i cr sl tb dcc spigot fiber "
771 "fiberchan subdet=HT ieta iphi";
776 <<
"CastorElectronicsMap-> Bad line: " <<
buffer
777 <<
"\n line must contain 12 items: i cr sl tb dcc spigot fiber fiberchan subdet ieta iphi depth";
782 int crate = atoi(
items[1].c_str());
783 int slot = atoi(
items[2].c_str());
787 int dcc = atoi(
items[4].c_str());
788 int spigot = atoi(
items[5].c_str());
792 int slbCh = atoi(
items[7].c_str());
795 int fiber = atoi(
items[6].c_str());
796 int fiberCh = atoi(
items[7].c_str());
799 elId.
setHTR(crate, slot, top);
803 if (
items[8] ==
"NA") {
805 }
else if (
items[8] ==
"NT") {
812 edm::LogWarning(
"Format Error") <<
"CastorElectronicsMap-> Unknown subdetector: " <<
items[8] <<
'/'
827 "# %7s %3s %3s %3s %4s %7s %10s %14s %7s %5s %5s %6s",
840 fOutput <<
buf << std::endl;
842 for (
unsigned i = 0;
i < eids.size();
i++) {
844 if (
eid.isTriggerChainId()) {
852 " %7X %3d %3d %3c %4d %7d %10d %14d %7s %5s %5s %6s",
857 eid.readoutVMECrateId(),
859 eid.htrTopBottom() > 0 ?
't' :
'b',
863 eid.slbChannelIndex(),
868 fOutput <<
buf << std::endl;
872 if (channel.
rawId()) {
877 " %7X %3d %3d %3c %4d %7d %10d %14d %7s %5s %5s %6s",
880 eid.readoutVMECrateId(),
882 eid.htrTopBottom() > 0 ?
't' :
'b',
891 fOutput <<
buf << std::endl;
900 while (fInput.getline(
buffer, 1024)) {
906 if (
items.size() < 6) {
909 <<
"\n line must contain 6 items: eta, phi, depth, subdet, firstSample, samplesToAdd" << std::endl;
923 "# %15s %15s %15s %15s %18s %15s %10s\n",
934 for (std::vector<DetId>::iterator channel =
channels.begin(); channel !=
channels.end(); ++channel) {
935 dumpId(fOutput, *channel);
bool dumpCastorSingleFloatObject(std::ostream &fOutput, const T &fObject)
void dumpId(std::ostream &fOutput, DetId id)
static const HcalDetId Undefined
const Item * getValues(DetId fId, bool throwOnFail=true) const
const bool exists(DetId fId) const
void setUnitADC(bool isADC)
constexpr int iphi() const
get the cell iphi
const CastorCalibrationQIECoder * getCoder(DetId fId) const
get QIE parameters
float slope(unsigned fCapId, unsigned fRange) const
void setUnitADC(bool isADC)
void setOffset(unsigned fCapId, unsigned fRange, float fValue)
U second(std::pair< T, U > const &p)
constexpr int depth() const
get the tower depth
Readout chain identification for Castor Bits for the readout chain : some names need change!...
const float * getValues() const
get value for all capId = 0..3
float lowEdge(unsigned fAdc) const
Log< level::Warning, false > LogWarning
std::vector< DetId > getAllChannels() const
void setMinCharges(const float fValue[32])
static int slb(const HcalTriggerPrimitiveSample &theSample)
bool mapEId2tId(CastorElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
bool getCastorObject(std::istream &fInput, T &fObject)
double S(const TLorentzVector &, const TLorentzVector &)
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
bool getObject(std::istream &fInput, CastorPedestals &fObject)
void setHTR(int crate, int slot, int tb)
bool operator()(CastorElectronicsId first, CastorElectronicsId second) const
static const HcalTrigTowerDetId Undefined
bool operator()(DetId fFirst, DetId fSecond) const
bool addValues(const Item &myItem)
bool addCoder(const CastorCalibrationQIECoder &fCoder)
const CastorQIECoder * getCoder(DetId fId) const
get QIE parameters
uint32_t getValue() const
bool getCastorSingleIntObject(std::istream &fInput, T &fObject, S *fCondObject)
bool addCoder(const CastorQIECoder &fCoder)
Log< level::Error, false > LogError
void setSlope(unsigned fCapId, unsigned fRange, float fValue)
constexpr uint32_t rawId() const
get the raw id
const DetId lookup(CastorElectronicsId fId) const
lookup the logical detid associated with the given electronics id
bool getCastorSingleFloatObject(std::istream &fInput, T &fObject)
DetId getId(const std::vector< std::string > &items)
const DetId lookupTrigger(CastorElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
float offset(unsigned fCapId, unsigned fRange) const
bool mapEId2chId(CastorElectronicsId fElectronicsId, DetId fId)
unsigned int firstSample() const
bool dumpCastorSingleIntObject(std::ostream &fOutput, const T &fObject)
constexpr int ietaAbs() const
get the absolute value of the cell ieta
constexpr int zside() const
get the z-side of the cell (1/-1)
std::vector< std::string > splitString(const std::string &fLine)
std::vector< CastorElectronicsId > allElectronicsId() const
const float * minCharges() const
unsigned int samplesToAdd() const
bool dumpCastorObject(std::ostream &fOutput, const T &fObject)
const CastorQIEShape & getShape() const
get basic shape