23 bool operator () (
DetId fFirst,
DetId fSecond)
const {
26 if (
first.genericSubdet () !=
second.genericSubdet ())
return first.genericSubdet () <
second.genericSubdet ();
27 if (
first.isHcalDetId ()) {
30 return f1.zside () != s1.zside () ?
f1.zside () < s1.zside () :
31 f1.iphi () != s1.iphi () ?
f1.iphi () < s1.iphi () :
32 f1.ietaAbs () != s1.ietaAbs () ?
f1.ietaAbs () < s1.ietaAbs () :
33 f1.depth () < s1.depth ();
40 class HcalElectronicsIdLess {
53 std::vector <std::string>
splitString (
const std::string& fLine) {
54 std::vector <std::string>
result;
57 for (
unsigned i = 0;
i <= fLine.size ();
i++) {
58 if (fLine [
i] ==
' ' ||
i == fLine.size ()) {
60 std::string item (fLine, start,
i-start);
61 result.push_back (item);
67 if (empty) empty =
false;
75 return converter.getId ();
81 sprintf (buffer,
" %15s %15s %15s %15s",
82 converter.getField1 ().c_str (), converter.getField2 ().c_str (), converter.getField3 ().c_str (),converter.getFlavor ().c_str ());
87 bool from_string(T&
t,
const std::string&
s, std::ios_base& (*
f)(std::ios_base&)) {
88 std::istringstream iss(s);
89 return !(iss >>
f >>
t).
fail();
92 template <
class T,
class S>
94 if (!fObject) fObject =
new T;
96 while (fInput.getline(buffer, 1024)) {
97 if (buffer [0] ==
'#')
continue;
98 std::vector <std::string> items =
splitString (std::string (buffer));
99 if (items.size()==0)
continue;
100 if (items.size () < 8) {
101 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 8 items: eta, phi, depth, subdet, 4x values" << std::endl;
110 fCondObject =
new S(
id, atof (items [4].c_str()), atof (items [5].c_str()),
111 atof (items [6].c_str()), atof (items [7].c_str()));
112 fObject->addValues(*fCondObject);
123 sprintf (buffer,
"# %15s %15s %15s %15s %8s %8s %8s %8s %10s\n",
"eta",
"phi",
"dep",
"det",
"cap0",
"cap1",
"cap2",
"cap3",
"DetId");
125 std::vector<DetId> channels = fObject.getAllChannels ();
126 std::sort (channels.begin(), channels.end(), DetIdLess ());
127 for (std::vector<DetId>::iterator channel = channels.begin ();
128 channel != channels.end ();
130 const float*
values = fObject.getValues (*channel)->getValues ();
133 sprintf (buffer,
" %8.5f %8.5f %8.5f %8.5f %10X\n",
134 values[0], values[1], values[2], values[3], channel->rawId ());
141 template <
class T,
class S>
143 if (!fObject) fObject =
new T;
145 while (fInput.getline(buffer, 1024)) {
146 if (buffer [0] ==
'#')
continue;
147 std::vector <std::string> items =
splitString (std::string (buffer));
148 if (items.size()==0)
continue;
149 if (items.size () < 5) {
150 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 8 items: eta, phi, depth, subdet, value" << std::endl;
159 fCondObject =
new S(
id, atof (items [4].c_str()) );
160 fObject->addValues(*fCondObject);
170 sprintf (buffer,
"# %15s %15s %15s %15s %8s %10s\n",
"eta",
"phi",
"dep",
"det",
"value",
"DetId");
172 std::vector<DetId> channels = fObject.getAllChannels ();
173 std::sort (channels.begin(), channels.end(), DetIdLess ());
174 for (std::vector<DetId>::iterator channel = channels.begin ();
175 channel != channels.end ();
177 const float value = fObject.getValues (*channel)->getValue ();
179 sprintf (buffer,
" %8.5f %10X\n",
180 value, channel->rawId ());
186 template <
class T,
class S>
188 if (!fObject) fObject =
new T;
190 while (fInput.getline(buffer, 1024)) {
191 if (buffer [0] ==
'#')
continue;
192 std::vector <std::string> items =
splitString (std::string (buffer));
193 if (items.size()==0)
continue;
194 if (items.size () < 5) {
195 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 8 items: eta, phi, depth, subdet, value" << std::endl;
204 fCondObject =
new S(
id, atoi (items [4].c_str()) );
205 fObject->addValues(*fCondObject);
215 sprintf (buffer,
"# %15s %15s %15s %15s %8s %10s\n",
"eta",
"phi",
"dep",
"det",
"value",
"DetId");
217 std::vector<DetId> channels = fObject.getAllChannels ();
218 std::sort (channels.begin(), channels.end(), DetIdLess ());
219 for (std::vector<DetId>::iterator channel = channels.begin ();
220 channel != channels.end ();
222 const int value = fObject.getValues (*channel)->getValue ();
224 sprintf (buffer,
" %15d %10X\n",
225 value, channel->rawId ());
231 template <
class T,
class S>
233 if (!fObject) fObject =
new T;
235 while (fInput.getline(buffer, 1024)) {
236 if (buffer [0] ==
'#')
continue;
237 std::vector <std::string> items =
splitString (std::string (buffer));
238 if (items.size()==0)
continue;
240 fCondObject =
new S(firstid.
rawId());
241 for(
int j = 0;
j != 10;
j++) fCondObject->setValue(atoi(items[4].c_str()), 0,
j, atof(items[
j+5].c_str()));
242 for(
int i = 1;
i != 40;
i++){
243 fInput.getline(buffer, 1024);
246 if(
id.rawId() != firstid.
rawId())
break;
247 for(
int j = 0;
j != 10;
j++) fCondObject->setValue(atoi(items[4].c_str()),
i%10,
j, atof(items[
j+5].c_str()));
249 fObject->addValues(*fCondObject);
258 sprintf (buffer,
"# %5s %5s %5s %5s %5s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n",
259 "eta",
"phi",
"dep",
"det",
"capid",
"c0",
"c1",
"c2",
"c3",
"c4",
"c5",
"c6",
"c7",
"c8",
"c9",
"DetId");
261 std::vector<DetId> channels = fObject.getAllChannels ();
262 std::sort (channels.begin(), channels.end(), DetIdLess ());
263 for (std::vector<DetId>::iterator channel = channels.begin ();
264 channel != channels.end ();
267 for(
int m = 0;
m != 4;
m++){
268 for(
int i = 0;
i != 10;
i++){
269 for(
int j = 0;
j != 10;
j++){
271 thisline[
j] = fObject.getValues(*channel)->getValue(
m,
i,
j);
275 sprintf(buffer,
" %5i %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %10X\n",
276 m, thisline[0], thisline[1], thisline[2], thisline[3], thisline[4], thisline[5], thisline[6], thisline[7],
277 thisline[8], thisline[9], channel->rawId());
321 while (fInput.getline(buffer, 1024)) {
322 std::vector <std::string> items =
splitString (std::string (buffer));
323 if (items.size()==0)
continue;
325 if (items[0] ==
"#U")
327 if (items[1] == (std::string)
"ADC") fObject->
setUnitADC(
true);
328 else if (items[1] == (std::string)
"fC") fObject->
setUnitADC(
false);
331 edm::LogWarning(
"Pedestal Unit Error") <<
"Unrecognized unit for pedestals. Assuming fC." << std::endl;
338 edm::LogWarning(
"Pedestal Unit Missing") <<
"The unit for the pedestals is missing in the txt file." << std::endl;
343 while (fInput.getline(buffer, 1024)) {
344 if (buffer [0] ==
'#')
continue;
345 std::vector <std::string> items =
splitString (std::string (buffer));
346 if (items.size()==0)
continue;
347 if (items.size () < 8) {
348 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 8 items: eta, phi, depth, subdet, 4x values"
349 <<
" or 12 items: eta, phi, depth, subdet, 4x values for mean, 4x values for width"
360 if (items.size() < 12)
363 atof (items [6].c_str()), atof (items [7].c_str()),
371 atof (items [6].c_str()), atof (items [7].c_str()),
372 atof (items [8].c_str()), atof (items [9].c_str()),
373 atof (items [10].c_str()), atof (items [11].c_str()) );
386 if (fObject.
isADC() ) sprintf (buffer,
"#U ADC << this is the unit \n");
387 else sprintf (buffer,
"#U fC << this is the unit \n");
390 sprintf (buffer,
"# %15s %15s %15s %15s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n",
"eta",
"phi",
"dep",
"det",
"cap0",
"cap1",
"cap2",
"cap3",
"widthcap0",
"widthcap1",
"widthcap2",
"widthcap3",
"DetId");
394 std::sort (channels.begin(), channels.end(), DetIdLess ());
395 for (std::vector<DetId>::iterator channel = channels.begin ();
396 channel != channels.end ();
400 dumpId (fOutput, *channel);
401 sprintf (buffer,
" %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %10X\n",
402 values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], channel->rawId ());
415 while (fInput.getline(buffer, 1024)) {
416 if (buffer [0] ==
'#')
continue;
417 std::vector <std::string> items =
splitString (std::string (buffer));
418 if (items.size()==0)
continue;
419 if (items.size () < 6) {
420 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 6 items: eta, phi, depth, subdet, base - either (hex) or (dec), value" << std::endl;
430 if (items[4] ==
"(hex)")
431 sscanf(items[5].c_str(),
"%X", &mystatus);
432 else if (items[4] ==
"(dec)")
433 sscanf(items[5].c_str(),
"%u", &mystatus);
436 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n value field must contain the base: one of (hex), (dec)" << std::endl;
451 sprintf (buffer,
"# %15s %15s %15s %15s %15s %10s\n",
"eta",
"phi",
"dep",
"det",
"(base) value",
"DetId");
454 std::sort (channels.begin(), channels.end(), DetIdLess ());
455 for (std::vector<DetId>::iterator channel = channels.begin ();
456 channel != channels.end ();
459 dumpId (fOutput, *channel);
460 sprintf (buffer,
"%6s %15X %10X\n",
"(hex)",
461 value, channel->rawId ());
474 while (fInput.getline(buffer, 1024)) {
475 if (buffer [0] ==
'#')
477 if (buffer [1] ==
'T')
479 std::vector <std::string> items =
splitString (std::string (buffer) );
483 if (buffer [1] ==
'A')
485 std::vector <std::string> items =
splitString (std::string (buffer) );
491 std::vector <std::string> items =
splitString (std::string (buffer));
492 if (items.size()==0)
continue;
493 if (items.size () < 7) {
494 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 7 items: eta, phi, depth, subdet, pedestal, resp.corr.gain, flag" << std::endl;
511 sprintf (buffer,
"#T %s << this is the tag name \n", fObject.
getTagString().c_str() );
513 sprintf (buffer,
"#A %s << this is the algorithm name \n", fObject.
getAlgoString().c_str() );
517 sprintf (buffer,
"# %15s %15s %15s %15s %8s %13s %8s %10s\n",
518 "eta",
"phi",
"dep",
"det",
"ped",
"respcorrgain",
"flag",
523 for (std::vector<DetId>::iterator channel = channels.begin ();
524 channel != channels.end ();
528 dumpId (fOutput, *channel);
529 sprintf (buffer,
" %10.7f %10.7f %12d %10X\n",
545 while (fInput.getline(buffer, 1024)) {
547 std::vector <std::string> items =
splitString (std::string (buffer));
548 if (items.size()==0)
continue;
550 if (items[0] == (std::string)
"#U")
552 if (items[1] == (std::string)
"ADC") fObject->
setUnitADC(
true);
553 else if (items[1] == (std::string)
"fC") fObject->
setUnitADC(
false);
556 edm::LogWarning(
"Pedestal Width Unit Error") <<
"Unrecognized unit for pedestal widths. Assuming fC." << std::endl;
563 edm::LogWarning(
"Pedestal Width Unit Missing") <<
"The unit for the pedestal widths is missing in the txt file." << std::endl;
569 while (fInput.getline(buffer, 1024)) {
571 if (buffer [0] ==
'#')
continue;
572 std::vector <std::string> items =
splitString (std::string (buffer));
573 if (items.size()==0)
continue;
574 if (items.size () < 14) {
575 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line number: " << linecounter <<
"\n line must contain 14 items: eta, phi, depth, subdet, 10x correlations"
576 <<
" or 20 items: eta, phi, depth, subdet, 16x correlations"
587 if (items.size() < 20)
590 values.setSigma (0, 0, atof (items [4].c_str()));
591 values.setSigma (1, 0, atof (items [5].c_str()));
592 values.setSigma (1, 1, atof (items [6].c_str()));
593 values.setSigma (2, 0, atof (items [7].c_str()));
594 values.setSigma (2, 1, atof (items [8].c_str()));
595 values.setSigma (2, 2, atof (items [9].c_str()));
596 values.setSigma (3, 0, atof (items [10].c_str()));
597 values.setSigma (3, 1, atof (items [11].c_str()));
598 values.setSigma (3, 2, atof (items [12].c_str()));
599 values.setSigma (3, 3, atof (items [13].c_str()));
600 values.setSigma (0, 1, 0.);
601 values.setSigma (0, 2, 0.);
602 values.setSigma (0, 3, 0.);
603 values.setSigma (1, 2, 0.);
604 values.setSigma (1, 3, 0.);
605 values.setSigma (2, 3, 0.);
611 values.setSigma (0, 0, atof (items [4].c_str()) );
612 values.setSigma (0, 1, atof (items [5].c_str()) );
613 values.setSigma (0, 2, atof (items [6].c_str()) );
614 values.setSigma (0, 3, atof (items [7].c_str()) );
615 values.setSigma (1, 0, atof (items [8].c_str()) );
616 values.setSigma (1, 1, atof (items [9].c_str()) );
617 values.setSigma (1, 2, atof (items [10].c_str()) );
618 values.setSigma (1, 3, atof (items [11].c_str()) );
619 values.setSigma (2, 0, atof (items [12].c_str()) );
620 values.setSigma (2, 1, atof (items [13].c_str()) );
621 values.setSigma (2, 2, atof (items [14].c_str()) );
622 values.setSigma (2, 3, atof (items [15].c_str()) );
623 values.setSigma (3, 0, atof (items [16].c_str()) );
624 values.setSigma (3, 1, atof (items [17].c_str()) );
625 values.setSigma (3, 2, atof (items [18].c_str()) );
626 values.setSigma (3, 3, atof (items [19].c_str()) );
637 if (fObject.
isADC() ) sprintf (buffer,
"#U ADC << this is the unit \n");
638 else sprintf (buffer,
"#U fC << this is the unit \n");
641 sprintf (buffer,
"# %15s %15s %15s %15s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n",
642 "eta",
"phi",
"dep",
"det",
643 "cov_0_0",
"cov_0_1",
"cov_0_2",
"cov_0_3",
"cov_1_0",
"cov_1_1",
"cov_1_2",
"cov_1_3",
"cov_2_0",
"cov_2_1",
"cov_2_2",
"cov_2_3",
"cov_3_0",
"cov_3_1",
"cov_3_2",
"cov_3_3",
647 std::sort (channels.begin(), channels.end(), DetIdLess ());
648 for (std::vector<DetId>::iterator channel = channels.begin ();
649 channel != channels.end ();
653 dumpId (fOutput, *channel);
654 sprintf (buffer,
" %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",
669 while (fInput.getline(buffer, 1024)) {
670 if (buffer [0] ==
'#')
continue;
671 std::vector <std::string> items =
splitString (std::string (buffer));
672 if (items.size()<1)
continue;
673 if (items [0] ==
"SHAPE") {
674 if (items.size () < 33) {
675 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 33 items: SHAPE 32 x low QIE edges for first 32 bins" << std::endl;
680 while (--i >= 0) lowEdges [
i] = atof (items [i+1].c_str ());
684 if (items.size () < 36) {
685 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 36 items: eta, phi, depth, subdet, 4 capId x 4 Ranges x offsets, 4 capId x 4 Ranges x slopes" << std::endl;
697 for (
unsigned capid = 0; capid < 4; capid++) {
698 for (
unsigned range = 0; range < 4; range++) {
699 coder.setOffset (capid, range, atof (items [index++].c_str ()));
702 for (
unsigned capid = 0; capid < 4; capid++) {
703 for (
unsigned range = 0; range < 4; range++) {
704 coder.setSlope (capid, range, atof (items [index++].c_str ()));
717 fOutput <<
"# QIE basic shape: SHAPE 32 x low edge values for first 32 channels" << std::endl;
718 sprintf (buffer,
"SHAPE ");
720 for (
unsigned bin = 0;
bin < 32;
bin++) {
724 fOutput << std::endl;
726 fOutput <<
"# QIE data" << std::endl;
727 sprintf (buffer,
"# %15s %15s %15s %15s %36s %36s %36s %36s %36s %36s %36s %36s\n",
728 "eta",
"phi",
"dep",
"det",
729 "4 x offsets cap0",
"4 x offsets cap1",
"4 x offsets cap2",
"4 x offsets cap3",
730 "4 x slopes cap0",
"4 x slopes cap1",
"4 x slopes cap2",
"4 x slopes cap3");
733 std::sort (channels.begin(), channels.end(), DetIdLess ());
734 for (std::vector<DetId>::iterator channel = channels.begin ();
735 channel != channels.end ();
738 dumpId (fOutput, *channel);
739 for (
unsigned capid = 0; capid < 4; capid++) {
740 for (
unsigned range = 0; range < 4; range++) {
741 sprintf (buffer,
" %8.5f", coder->
offset (capid, range));
745 for (
unsigned capid = 0; capid < 4; capid++) {
746 for (
unsigned range = 0; range < 4; range++) {
747 sprintf (buffer,
" %8.5f", coder->
slope (capid, range));
751 fOutput << std::endl;
759 while (fInput.getline(buffer, 1024)) {
760 if (buffer [0] ==
'#')
continue;
761 std::vector <std::string> items =
splitString (std::string (buffer));
762 if (items.size () < 36) {
763 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 36 items: eta, phi, depth, subdet, 32 bin values" << std::endl;
776 for (
unsigned bin = 0;
bin < 32;
bin++) {
777 values[
bin] = atof (items [index++].c_str ());
779 coder.setMinCharges (values);
789 fOutput <<
"# QIE data in calibration mode" << std::endl;
790 sprintf (buffer,
"# %15s %15s %15s %15s %288s\n",
791 "eta",
"phi",
"dep",
"det",
"32 x charges");
794 std::sort (channels.begin(), channels.end(), DetIdLess ());
795 for (std::vector<DetId>::iterator channel = channels.begin ();
796 channel != channels.end ();
800 dumpId (fOutput, *channel);
802 for (
unsigned bin = 0;
bin < 32;
bin++) {
803 sprintf (buffer,
" %8.5f", lowEdge [
bin]);
806 fOutput << std::endl;
816 while (fInput.getline(buffer, 1024)) {
817 if (buffer [0] ==
'#')
continue;
818 std::vector <std::string> items =
splitString (std::string (buffer));
819 if (items.size () < 12) {
820 if (items.size()==0)
continue;
821 if (items.size()<9) {
822 edm::LogError(
"MapFormat") <<
"HcalElectronicsMap-> line too short: " << buffer;
825 if (items[8]==
"NA" || items[8]==
"NT") {
826 while (items.size()<12) items.push_back(
"");
827 }
else if (items[8]==
"HT") {
828 if (items.size()==11) items.push_back(
"");
830 edm::LogError(
"MapFormat") <<
"HcalElectronicsMap-> Bad line: " << buffer
831 <<
"\n HT line must contain at least 11 items: i cr sl tb dcc spigot fiber fiberchan subdet=HT ieta iphi";
835 edm::LogError(
"MapFormat") <<
"HcalElectronicsMap-> Bad line: " << buffer
836 <<
"\n line must contain 12 items: i cr sl tb dcc spigot fiber fiberchan subdet ieta iphi depth";
841 int crate = atoi (items [1].c_str());
842 int slot = atoi (items [2].c_str());
844 if (items [3] ==
"b") top = 0;
845 int dcc = atoi (items [4].c_str());
846 int spigot = atoi (items [5].c_str());
848 if (items[8] ==
"HT" || items[8] ==
"NT") {
849 int slb = atoi (items [6].c_str());
850 int slbCh = atoi (items [7].c_str());
853 int fiber = atoi (items [6].c_str());
854 int fiberCh = atoi (items [7].c_str());
857 elId.
setHTR (crate, slot, top);
861 if (items [8] ==
"NA") {
863 }
else if (items [8] ==
"NT") {
867 if (converter.isHcalDetId ()) {
870 else if (converter.isHcalTrigTowerDetId ()) {
871 fObject->
mapEId2tId (elId, converter.getId ());
873 else if (converter.isHcalCalibDetId ()) {
876 else if (converter.isHcalZDCDetId ()) {
880 edm::LogWarning(
"Format Error") <<
"HcalElectronicsMap-> Unknown subdetector: "
881 << items [8] <<
'/' << items [9] <<
'/' << items [10] <<
'/' << items [11] << std::endl;
894 sprintf (buf,
"# %7s %3s %3s %3s %4s %7s %10s %14s %7s %5s %5s %6s",
895 "i",
"cr",
"sl",
"tb",
"dcc",
"spigot",
"fiber/slb",
"fibcha/slbcha",
"subdet",
"ieta",
"iphi",
"depth");
896 fOutput << buf << std::endl;
898 for (
unsigned i = 0; i < eids.size (); i++) {
902 if (trigger.
rawId ()) {
906 sprintf (buf,
" %7X %3d %3d %3c %4d %7d %10d %14d %7s %5s %5s %6s",
908 converter.getId().rawId(),
912 converter.getFlavor ().c_str (), converter.getField1 ().c_str (), converter.getField2 ().c_str (), converter.getField3 ().c_str ()
914 fOutput << buf << std::endl;
918 if (channel.
rawId()) {
922 sprintf (buf,
" %7X %3d %3d %3c %4d %7d %10d %14d %7s %5s %5s %6s",
924 converter.getId().rawId(),
926 converter.getFlavor ().c_str (), converter.getField1 ().c_str (), converter.getField2 ().c_str (), converter.getField3 ().c_str ()
928 fOutput << buf << std::endl;
939 while (fInput.getline(buffer, 1024)) {
940 if (buffer [0] ==
'#')
continue;
941 std::vector <std::string> items =
splitString (std::string (buffer));
942 if (items.size()==0)
continue;
944 if (items.size() > 1 &&
945 items[0].find(
"RctLsb")!=std::string::npos){
946 fObject->
setRctLsb( atof( items[1].c_str() ) );
949 if (items.size() > 1 &&
950 items[0].find(
"Gain")!=std::string::npos){
955 if (items.size () < 7) {
956 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 7 items: eta, phi, depth, subdet, Rcalib, LutGranularity, OutputLutThreshold" << std::endl;
962 atof (items [4].c_str()),
963 atoi (items [5].c_str()),
964 atoi (items [6].c_str()));
974 const float _rctLsb = fObject.
getRctLsb();
976 sprintf (buffer,
"# %20s\n",
"Non-channel data");
978 sprintf (buffer,
"%8s %8.5f\n",
"RctLsb", _rctLsb);
980 sprintf (buffer,
"%8s %8.5f\n",
"Gain", _gain);
982 sprintf (buffer,
"# %15s %15s %15s %15s %8s %15s %19s %10s\n",
"eta",
"phi",
"dep",
"det",
"Rcalib",
"LutGranularity",
"OutputLutThreshold",
"DetId");
985 std::sort (channels.begin(), channels.end(), DetIdLess ());
986 for (std::vector<DetId>::iterator channel = channels.begin ();
987 channel != channels.end ();
992 dumpId (fOutput, *channel);
993 sprintf (buffer,
" %8.5f %15d %19d %10X\n",
1007 while (getline(fInput, buffer)) {
1008 if (buffer.at(0) ==
'#')
continue;
1009 std::vector <std::string> items =
splitString (buffer);
1010 if (items.size()==0)
continue;
1012 if (items.size() < 9) {
1013 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 9 items: subDet, side_ring, slice, type, subChannel, LS, Value, UpperLimit, LowerLimit" << std::endl;
1019 unsigned int slice, subchan;
1020 switch (items[0].
at(1)) {
1037 from_string<int>(sidering, items[1], std::dec);
1038 from_string<unsigned int>(slice, items[2], std::dec);
1040 from_string<unsigned int>(subchan, items[4], std::dec);
1046 float val,upper,lower;
1047 from_string<int>(LS, items[5], std::dec);
1048 from_string<float>(val, items[6], std::dec);
1049 from_string<float>(upper, items[7], std::dec);
1050 from_string<float>(lower, items[8], std::dec);
1058 if (!(fObject->
addValue(newVal))) {
1060 <<
"\nwas not added to the HcalDcsValues object." << std::endl;
1070 fOutput <<
"# subDet side_ring slice type subChan LS Value UpperLimit LowerLimit DcsId\n";
1076 for (HcalDcsValues::DcsSet::const_iterator val = vals.begin();
1077 val != vals.end(); ++val) {
1080 switch (valId.subdet()) {
1094 fOutput << valId.subdet() <<
' ';
1098 fOutput << valId.ring() <<
' ';
1100 fOutput << valId.zside() <<
' ';
1102 fOutput << valId.slice() <<
' '
1103 << valId.typeString(valId.type()) <<
' '
1104 << valId.subchannel() <<
' ';
1105 fOutput << val->LS() <<
' '
1106 << val->getValue() <<
' '
1107 << val->getUpperLimit() <<
' '
1108 << val->getLowerLimit() <<
' ';
1109 fOutput << std::hex << val->DcsId() << std::dec <<
'\n';
1128 while (fInput.getline(buffer, 1024)) {
1129 if (buffer [0] ==
'#')
continue;
1130 std::vector <std::string> items =
splitString (std::string (buffer));
1131 if (items.size () < 8) {
1132 if (items.size()==0)
continue;
1134 edm::LogError(
"MapFormat") <<
"HcalDcsMap-> Bad line: " << buffer
1135 <<
"\n line must contain 8 items: line side_ring slice subchannel subdet ieta iphi depth";
1141 int ring = atoi(items[1].c_str());
1142 unsigned int slice = atoi (items [2].c_str());
1143 unsigned int subchannel = atoi (items [3].c_str());
1189 if (items[4].
find(
"CALIB")!=std::string::npos){
1192 else if (items[4].
find(
"HB")!=std::string::npos){
1195 else if (items[4].
find(
"HE")!=std::string::npos){
1198 else if (items[4].
find(
"HO")!=std::string::npos){
1201 else if (items[4].
find(
"HF")!=std::string::npos){
1205 edm::LogError(
"MapFormat") <<
"HcalDcsMap-> Unknown subdetector, line is not accepted: " << items[5];
1208 HcalDcsDetId dcsId(subdet, ring, slice, type, subchannel);
1211 if (converter.isHcalDetId()){
1212 id = converter.getId();
1215 edm::LogWarning(
"Invalid HCAL channel") <<
"HcalDcsMap-> invalid channel: "
1219 << items [7] << std::endl;
1233 sprintf (buf,
"# %7s %10s %6s %8s %7s %5s %5s %6s",
1234 "i",
"side_ring",
"slice",
"subchan",
"subdet",
"ieta",
"iphi",
"depth");
1235 fOutput << buf << std::endl;
1237 unsigned int line_counter = 0;
1244 sprintf (buf,
" %8X %10d %6d %8d %7s %5s %5s %6s",
1249 _converter.getFlavor().c_str(),
1250 _converter.getField1().c_str(),
1251 _converter.getField2().c_str(),
1252 _converter.getField3().c_str()
1254 fOutput << buf << std::endl;
float getPedestal() const
static const HcalDetId Undefined
void setAlgoString(std::string fAlgo)
bool addValues(const Item &myItem, bool h2mode_=false)
int fiberIndex() const
get the fiber index [1-8] (which of eight fibers carried by a spigot) (valid only for non-trigger-cha...
void setUnitADC(bool isADC)
float slope(unsigned fCapId, unsigned fRange) const
bool getHcalSingleIntObject(std::istream &fInput, T *fObject, S *fCondObject)
bool getHcalSingleFloatObject(std::istream &fInput, T *fObject, S *fCondObject)
const HcalQIECoder * getCoder(DetId fId) const
get QIE parameters
float getSigma(int fCapId1, int fCapId2) const
get correlation element for capId1/2 = 0..3
bool mapGeomId2DcsId(HcalDetId fId, HcalDcsDetId fDcsId)
bool getHcalMatrixObject(std::istream &fInput, T *fObject, S *fCondObject)
DcsSet const & getAllSubdetValues(DcsSubDet subd) const
int htrSlot() const
get the htr slot
bool dumpHcalSingleFloatObject(std::ostream &fOutput, const T &fObject)
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
const HcalQIEShape & getShape() const
get basic shape
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const HcalCalibrationQIECoder * getCoder(DetId fId) const
get QIE parameters
std::vector< std::string > splitString(const std::string &fLine)
float lowEdge(unsigned fAdc) const
int readoutVMECrateId() const
get the readout VME crate number
void dumpId(std::ostream &fOutput, DetId id)
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
const_iterator endById(void) const
bool addCoder(const HcalQIECoder &fCoder, bool h2mode_=false)
std::vector< HcalDcsValue > DcsSet
void setUnitADC(bool isADC)
float getRespGain() const
int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom)
float offset(unsigned fCapId, unsigned fRange) const
const_iterator beginById(void) const
std::vector< DetId > getAllChannels() const
HcalDetId getHcalDetId(void)
int dccid() const
get the (Hcal local) DCC id
HcalDcsDetId getHcalDcsDetId(void)
bool dumpHcalMatrixObject(std::ostream &fOutput, const T &fObject)
int fiberChanId() const
get the fiber channel id (which of three channels on a readout fiber) (valid only for non-trigger-cha...
std::string getTagString() const
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
int spigot() const
get the spigot (input number on DCC)
static DcsType DcsTypeFromString(const std::string &str)
int slbChannelIndex() const
get the SLB channel index (valid only for trigger-chain ids)
void setHTR(int crate, int slot, int tb)
std::string getAlgoString() const
std::vector< HcalElectronicsId > allElectronicsId() const
bool isTriggerChainId() const
static const HcalTrigTowerDetId Undefined
bool addValue(HcalDcsValue const &newVal)
bool getHcalObject(std::istream &fInput, T *fObject, S *fCondObject)
bool getObject(std::istream &fInput, HcalPedestals *fObject)
DetId getId(const std::vector< std::string > &items)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
int slbSiteNumber() const
get the SLB site number (valid only for trigger-chain ids)
const float * getValues() const
get value for all capId = 0..3
bool dumpHcalObject(std::ostream &fOutput, const T &fObject)
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
const float * minCharges() const
void setTagString(std::string fTag)
uint32_t getValue() const
bool addCoder(const HcalCalibrationQIECoder &fCoder)
const Item * getValues(DetId fId) const
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
bool dumpHcalSingleIntObject(std::ostream &fOutput, const T &fObject)
bool from_string(T &t, const std::string &s, std::ios_base &(*f)(std::ios_base &))