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 {
55 std::vector <std::string>
splitString (
const std::string& fLine) {
56 std::vector <std::string>
result;
59 for (
unsigned i = 0;
i <= fLine.size ();
i++) {
60 if (fLine [
i] ==
' ' ||
i == fLine.size ()) {
62 std::string item (fLine, start,
i-start);
63 result.push_back (item);
69 if (empty) empty =
false;
76 std::vector <unsigned int>
result;
79 for (
unsigned i = 0;
i <= fLine.size ();
i++) {
80 if (fLine [
i] ==
',' ||
i == fLine.size ()) {
82 std::string itemString (fLine, start,
i-start);
83 result.push_back (atoi (itemString.c_str()) );
89 if (empty) empty =
false;
97 return converter.getId ();
103 sprintf (buffer,
" %15s %15s %15s %15s",
104 converter.getField1 ().c_str (), converter.getField2 ().c_str (), converter.getField3 ().c_str (),converter.getFlavor ().c_str ());
112 std::istringstream iss(s);
113 return !(iss >>
f >>
t).
fail();
116 template <
class T,
class S>
118 if (!fObject) fObject =
new T;
120 while (fInput.getline(buffer, 1024)) {
121 if (buffer [0] ==
'#')
continue;
122 std::vector <std::string> items =
splitString (std::string (buffer));
123 if (items.size()==0)
continue;
124 if (items.size () < 8) {
125 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 8 items: eta, phi, depth, subdet, 4x values" << std::endl;
134 fCondObject =
new S(
id, atof (items [4].c_str()), atof (items [5].c_str()),
135 atof (items [6].c_str()), atof (items [7].c_str()));
136 fObject->addValues(*fCondObject);
147 sprintf (buffer,
"# %15s %15s %15s %15s %8s %8s %8s %8s %10s\n",
"eta",
"phi",
"dep",
"det",
"cap0",
"cap1",
"cap2",
"cap3",
"DetId");
149 std::vector<DetId> channels = fObject.getAllChannels ();
150 std::sort (channels.begin(), channels.end(), DetIdLess ());
151 for (std::vector<DetId>::iterator channel = channels.begin ();
152 channel != channels.end ();
154 const float*
values = fObject.getValues (*channel)->getValues ();
157 sprintf (buffer,
" %8.5f %8.5f %8.5f %8.5f %10X\n",
158 values[0], values[1], values[2], values[3], channel->rawId ());
165 template <
class T,
class S>
167 if (!fObject) fObject =
new T;
169 while (fInput.getline(buffer, 1024)) {
170 if (buffer [0] ==
'#')
continue;
171 std::vector <std::string> items =
splitString (std::string (buffer));
172 if (items.size()==0)
continue;
173 if (items.size () < 5) {
174 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 5 items: eta, phi, depth, subdet, value" << std::endl;
183 fCondObject =
new S(
id, atof (items [4].c_str()) );
184 fObject->addValues(*fCondObject);
194 sprintf (buffer,
"# %15s %15s %15s %15s %8s %10s\n",
"eta",
"phi",
"dep",
"det",
"value",
"DetId");
196 std::vector<DetId> channels = fObject.getAllChannels ();
197 std::sort (channels.begin(), channels.end(), DetIdLess ());
198 for (std::vector<DetId>::iterator channel = channels.begin ();
199 channel != channels.end ();
201 const float value = fObject.getValues (*channel)->getValue ();
203 sprintf (buffer,
" %8.5f %10X\n",
204 value, channel->rawId ());
210 template <
class T,
class S>
212 if (!fObject) fObject =
new T;
214 while (fInput.getline(buffer, 1024)) {
215 if (buffer [0] ==
'#')
continue;
216 std::vector <std::string> items =
splitString (std::string (buffer));
217 if (items.size()==0)
continue;
218 if (items.size () < 5) {
219 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 5 items: eta, phi, depth, subdet, value" << std::endl;
228 fCondObject =
new S(
id, atoi (items [4].c_str()) );
229 fObject->addValues(*fCondObject);
239 sprintf (buffer,
"# %15s %15s %15s %15s %8s %10s\n",
"eta",
"phi",
"dep",
"det",
"value",
"DetId");
241 std::vector<DetId> channels = fObject.getAllChannels ();
242 std::sort (channels.begin(), channels.end(), DetIdLess ());
243 for (std::vector<DetId>::iterator channel = channels.begin ();
244 channel != channels.end ();
246 const int value = fObject.getValues (*channel)->getValue ();
248 sprintf (buffer,
" %15d %10X\n",
249 value, channel->rawId ());
255 template <
class T,
class S>
257 if (!fObject) fObject =
new T;
259 while (fInput.getline(buffer, 1024)) {
260 if (buffer [0] ==
'#')
continue;
261 std::vector <std::string> items =
splitString (std::string (buffer));
262 if (items.size()==0)
continue;
264 fCondObject =
new S(firstid.
rawId());
265 for(
int j = 0;
j != 10;
j++) fCondObject->setValue(atoi(items[4].c_str()), 0,
j, atof(items[
j+5].c_str()));
266 for(
int i = 1;
i != 40;
i++){
267 fInput.getline(buffer, 1024);
270 if(
id.rawId() != firstid.
rawId())
break;
271 for(
int j = 0;
j != 10;
j++) fCondObject->setValue(atoi(items[4].c_str()),
i%10,
j, atof(items[
j+5].c_str()));
273 fObject->addValues(*fCondObject);
282 sprintf (buffer,
"# %5s %5s %5s %5s %5s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n",
283 "eta",
"phi",
"dep",
"det",
"capid",
"c0",
"c1",
"c2",
"c3",
"c4",
"c5",
"c6",
"c7",
"c8",
"c9",
"DetId");
285 std::vector<DetId> channels = fObject.getAllChannels ();
286 std::sort (channels.begin(), channels.end(), DetIdLess ());
287 for (std::vector<DetId>::iterator channel = channels.begin ();
288 channel != channels.end ();
291 for(
int m = 0;
m != 4;
m++){
292 for(
int i = 0;
i != 10;
i++){
293 for(
int j = 0;
j != 10;
j++){
295 thisline[
j] = fObject.getValues(*channel)->getValue(
m,
i,
j);
299 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",
300 m, thisline[0], thisline[1], thisline[2], thisline[3], thisline[4], thisline[5], thisline[6], thisline[7],
301 thisline[8], thisline[9], channel->rawId());
345 while (fInput.getline(buffer, 1024)) {
346 if (buffer [0] ==
'#')
continue;
347 std::vector <std::string> items =
splitString (std::string (buffer));
348 if (items.size()==0)
continue;
349 if (items.size () < 6) {
350 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 6 items: eta, phi, depth, subdet, firstSample, samplesToAdd" << std::endl;
364 sprintf (buffer,
"# %15s %15s %15s %15s %18s %15s %10s\n",
"eta",
"phi",
"dep",
"det",
"firstSample",
"samplesToAdd",
"DetId");
367 std::sort (channels.begin(), channels.end(), DetIdLess ());
368 for (std::vector<DetId>::iterator channel = channels.begin ();
369 channel != channels.end ();
372 sprintf (buffer,
" %15d %15d %16X\n",
383 while (fInput.getline(buffer, 1024)) {
384 if (buffer [0] ==
'#')
continue;
385 std::vector <std::string> items =
splitString (std::string (buffer));
386 if (items.size()==0)
continue;
387 if (items.size() < 5) {
388 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 6 items: eta, phi, depth, subdet, signalTSs, noiseTSs" << std::endl;
391 if (items.size() > 7) {
392 edm::LogWarning(
"Format Problem ?") <<
"Check line: " << buffer <<
"\n line must contain 6 items: eta, phi, depth, subdet, signalTSs, noiseTSs. "
393 <<
"\n ! signalTS and noiseTS must be of format <ts1,ts2,ts3,...> withOUT spaces. Ignoring line for safety" << std::endl;
410 sprintf (buffer,
"# %15s %15s %15s %15s %10s %10s %10s\n",
"eta",
"phi",
"dep",
"det",
"signalTSs",
"noiseTSs",
"DetId");
413 std::sort (channels.begin(), channels.end(), DetIdLess ());
414 for (std::vector<DetId>::iterator channel = channels.begin ();
415 channel != channels.end ();
418 if (fId.isHcalZDCDetId())
421 std::vector<unsigned int> vNoiseTS = fObject.
getValues (*channel)->
noiseTS();
423 sprintf (buffer,
" ");
425 for (
unsigned int i=0;
i<vSignalTS.size();
i++)
427 if (
i>0) {sprintf (buffer,
","); fOutput << buffer;}
428 sprintf (buffer,
"%u", vSignalTS.at(
i));
431 sprintf (buffer,
" ");
433 for (
unsigned int i=0;
i<vNoiseTS.size();
i++)
435 if (
i>0) { sprintf (buffer,
","); fOutput << buffer;}
436 sprintf (buffer,
"%u", vNoiseTS.at(
i));
439 sprintf (buffer,
" %10X\n", channel->rawId ());
450 while (fInput.getline(buffer, 1024)) {
451 if (buffer [0] ==
'#')
continue;
452 std::vector <std::string> items =
splitString (std::string (buffer));
453 if (items.size()==0)
continue;
454 if (items.size () < 5) {
455 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 5 items: eta, phi, depth, subdet, signalShape" << std::endl;
469 sprintf (buffer,
"# %15s %15s %15s %15s %14s %10s\n",
"eta",
"phi",
"dep",
"det",
"signalShape",
"DetId");
472 std::sort (channels.begin(), channels.end(), DetIdLess ());
473 for (std::vector<DetId>::iterator channel = channels.begin ();
474 channel != channels.end ();
478 sprintf (buffer,
" %10d %17X\n",
479 value, channel->rawId ());
489 while (fInput.getline(buffer, 1024)) {
490 std::vector <std::string> items =
splitString (std::string (buffer));
491 if (items.size()==0)
continue;
493 if (items[0] ==
"#U")
495 if (items[1] == (std::string)
"ADC") fObject->
setUnitADC(
true);
496 else if (items[1] == (std::string)
"fC") fObject->
setUnitADC(
false);
499 edm::LogWarning(
"Pedestal Unit Error") <<
"Unrecognized unit for pedestals. Assuming fC." << std::endl;
506 edm::LogWarning(
"Pedestal Unit Missing") <<
"The unit for the pedestals is missing in the txt file." << std::endl;
511 while (fInput.getline(buffer, 1024)) {
512 if (buffer [0] ==
'#')
continue;
513 std::vector <std::string> items =
splitString (std::string (buffer));
514 if (items.size()==0)
continue;
515 if (items.size () < 8) {
516 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 8 items: eta, phi, depth, subdet, 4x values"
517 <<
" or 12 items: eta, phi, depth, subdet, 4x values for mean, 4x values for width"
528 if (items.size() < 12)
531 atof (items [6].c_str()), atof (items [7].c_str()),
539 atof (items [6].c_str()), atof (items [7].c_str()),
540 atof (items [8].c_str()), atof (items [9].c_str()),
541 atof (items [10].c_str()), atof (items [11].c_str()) );
554 if (fObject.
isADC() ) sprintf (buffer,
"#U ADC << this is the unit \n");
555 else sprintf (buffer,
"#U fC << this is the unit \n");
558 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");
562 std::sort (channels.begin(), channels.end(), DetIdLess ());
563 for (std::vector<DetId>::iterator channel = channels.begin ();
564 channel != channels.end ();
568 dumpId (fOutput, *channel);
569 sprintf (buffer,
" %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %10X\n",
570 values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], channel->rawId ());
583 while (fInput.getline(buffer, 1024)) {
584 if (buffer [0] ==
'#')
continue;
585 std::vector <std::string> items =
splitString (std::string (buffer));
586 if (items.size()==0)
continue;
587 if (items.size () < 6) {
588 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;
598 if (items[4] ==
"(hex)")
599 sscanf(items[5].c_str(),
"%X", &mystatus);
600 else if (items[4] ==
"(dec)")
601 sscanf(items[5].c_str(),
"%u", &mystatus);
604 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n value field must contain the base: one of (hex), (dec)" << std::endl;
619 sprintf (buffer,
"# %15s %15s %15s %15s %15s %10s\n",
"eta",
"phi",
"dep",
"det",
"(base) value",
"DetId");
622 std::sort (channels.begin(), channels.end(), DetIdLess ());
623 for (std::vector<DetId>::iterator channel = channels.begin ();
624 channel != channels.end ();
627 dumpId (fOutput, *channel);
628 sprintf (buffer,
"%6s %15X %10X\n",
"(hex)",
629 value, channel->rawId ());
642 while (fInput.getline(buffer, 1024)) {
643 if (buffer [0] ==
'#')
645 if (buffer [1] ==
'T')
647 std::vector <std::string> items =
splitString (std::string (buffer) );
651 if (buffer [1] ==
'A')
653 std::vector <std::string> items =
splitString (std::string (buffer) );
659 std::vector <std::string> items =
splitString (std::string (buffer));
660 if (items.size()==0)
continue;
661 if (items.size () < 7) {
662 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 7 items: eta, phi, depth, subdet, pedestal, resp.corr.gain, flag" << std::endl;
679 sprintf (buffer,
"#T %s << this is the tag name \n", fObject.
getTagString().c_str() );
681 sprintf (buffer,
"#A %s << this is the algorithm name \n", fObject.
getAlgoString().c_str() );
685 sprintf (buffer,
"# %15s %15s %15s %15s %8s %13s %8s %10s\n",
686 "eta",
"phi",
"dep",
"det",
"ped",
"respcorrgain",
"flag",
691 for (std::vector<DetId>::iterator channel = channels.begin ();
692 channel != channels.end ();
696 dumpId (fOutput, *channel);
697 sprintf (buffer,
" %10.7f %10.7f %12d %10X\n",
713 while (fInput.getline(buffer, 1024)) {
715 std::vector <std::string> items =
splitString (std::string (buffer));
716 if (items.size()==0)
continue;
718 if (items[0] == (std::string)
"#U")
720 if (items[1] == (std::string)
"ADC") fObject->
setUnitADC(
true);
721 else if (items[1] == (std::string)
"fC") fObject->
setUnitADC(
false);
724 edm::LogWarning(
"Pedestal Width Unit Error") <<
"Unrecognized unit for pedestal widths. Assuming fC." << std::endl;
731 edm::LogWarning(
"Pedestal Width Unit Missing") <<
"The unit for the pedestal widths is missing in the txt file." << std::endl;
737 while (fInput.getline(buffer, 1024)) {
739 if (buffer [0] ==
'#')
continue;
740 std::vector <std::string> items =
splitString (std::string (buffer));
741 if (items.size()==0)
continue;
742 if (items.size () < 14) {
743 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line number: " << linecounter <<
"\n line must contain 14 items: eta, phi, depth, subdet, 10x correlations"
744 <<
" or 20 items: eta, phi, depth, subdet, 16x correlations"
755 if (items.size() < 20)
758 values.setSigma (0, 0, atof (items [4].c_str()));
759 values.setSigma (1, 0, atof (items [5].c_str()));
760 values.setSigma (1, 1, atof (items [6].c_str()));
761 values.setSigma (2, 0, atof (items [7].c_str()));
762 values.setSigma (2, 1, atof (items [8].c_str()));
763 values.setSigma (2, 2, atof (items [9].c_str()));
764 values.setSigma (3, 0, atof (items [10].c_str()));
765 values.setSigma (3, 1, atof (items [11].c_str()));
766 values.setSigma (3, 2, atof (items [12].c_str()));
767 values.setSigma (3, 3, atof (items [13].c_str()));
768 values.setSigma (0, 1, 0.);
769 values.setSigma (0, 2, 0.);
770 values.setSigma (0, 3, 0.);
771 values.setSigma (1, 2, 0.);
772 values.setSigma (1, 3, 0.);
773 values.setSigma (2, 3, 0.);
779 values.setSigma (0, 0, atof (items [4].c_str()) );
780 values.setSigma (0, 1, atof (items [5].c_str()) );
781 values.setSigma (0, 2, atof (items [6].c_str()) );
782 values.setSigma (0, 3, atof (items [7].c_str()) );
783 values.setSigma (1, 0, atof (items [8].c_str()) );
784 values.setSigma (1, 1, atof (items [9].c_str()) );
785 values.setSigma (1, 2, atof (items [10].c_str()) );
786 values.setSigma (1, 3, atof (items [11].c_str()) );
787 values.setSigma (2, 0, atof (items [12].c_str()) );
788 values.setSigma (2, 1, atof (items [13].c_str()) );
789 values.setSigma (2, 2, atof (items [14].c_str()) );
790 values.setSigma (2, 3, atof (items [15].c_str()) );
791 values.setSigma (3, 0, atof (items [16].c_str()) );
792 values.setSigma (3, 1, atof (items [17].c_str()) );
793 values.setSigma (3, 2, atof (items [18].c_str()) );
794 values.setSigma (3, 3, atof (items [19].c_str()) );
805 if (fObject.
isADC() ) sprintf (buffer,
"#U ADC << this is the unit \n");
806 else sprintf (buffer,
"#U fC << this is the unit \n");
809 sprintf (buffer,
"# %15s %15s %15s %15s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n",
810 "eta",
"phi",
"dep",
"det",
811 "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",
815 std::sort (channels.begin(), channels.end(), DetIdLess ());
816 for (std::vector<DetId>::iterator channel = channels.begin ();
817 channel != channels.end ();
821 dumpId (fOutput, *channel);
822 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",
837 while (fInput.getline(buffer, 1024)) {
838 if (buffer [0] ==
'#')
continue;
839 std::vector <std::string> items =
splitString (std::string (buffer));
840 if (items.size()<1)
continue;
841 if (items [0] ==
"SHAPE") {
842 if (items.size () < 33) {
843 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;
848 while (--i >= 0) lowEdges [
i] = atof (items [i+1].c_str ());
852 if (items.size () < 36) {
853 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;
865 for (
unsigned capid = 0; capid < 4; capid++) {
866 for (
unsigned range = 0; range < 4; range++) {
867 coder.setOffset (capid, range, atof (items [index++].c_str ()));
870 for (
unsigned capid = 0; capid < 4; capid++) {
871 for (
unsigned range = 0; range < 4; range++) {
872 coder.setSlope (capid, range, atof (items [index++].c_str ()));
885 fOutput <<
"# QIE basic shape: SHAPE 32 x low edge values for first 32 channels" << std::endl;
886 sprintf (buffer,
"SHAPE ");
888 for (
unsigned bin = 0;
bin < 32;
bin++) {
892 fOutput << std::endl;
894 fOutput <<
"# QIE data" << std::endl;
895 sprintf (buffer,
"# %15s %15s %15s %15s %36s %36s %36s %36s %36s %36s %36s %36s\n",
896 "eta",
"phi",
"dep",
"det",
897 "4 x offsets cap0",
"4 x offsets cap1",
"4 x offsets cap2",
"4 x offsets cap3",
898 "4 x slopes cap0",
"4 x slopes cap1",
"4 x slopes cap2",
"4 x slopes cap3");
901 std::sort (channels.begin(), channels.end(), DetIdLess ());
902 for (std::vector<DetId>::iterator channel = channels.begin ();
903 channel != channels.end ();
906 dumpId (fOutput, *channel);
907 for (
unsigned capid = 0; capid < 4; capid++) {
908 for (
unsigned range = 0; range < 4; range++) {
909 sprintf (buffer,
" %8.5f", coder->
offset (capid, range));
913 for (
unsigned capid = 0; capid < 4; capid++) {
914 for (
unsigned range = 0; range < 4; range++) {
915 sprintf (buffer,
" %8.5f", coder->
slope (capid, range));
919 fOutput << std::endl;
927 while (fInput.getline(buffer, 1024)) {
928 if (buffer [0] ==
'#')
continue;
929 std::vector <std::string> items =
splitString (std::string (buffer));
930 if (items.size () < 36) {
931 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 36 items: eta, phi, depth, subdet, 32 bin values" << std::endl;
944 for (
unsigned bin = 0;
bin < 32;
bin++) {
945 values[
bin] = atof (items [index++].c_str ());
947 coder.setMinCharges (values);
957 fOutput <<
"# QIE data in calibration mode" << std::endl;
958 sprintf (buffer,
"# %15s %15s %15s %15s %288s\n",
959 "eta",
"phi",
"dep",
"det",
"32 x charges");
962 std::sort (channels.begin(), channels.end(), DetIdLess ());
963 for (std::vector<DetId>::iterator channel = channels.begin ();
964 channel != channels.end ();
968 dumpId (fOutput, *channel);
970 for (
unsigned bin = 0;
bin < 32;
bin++) {
971 sprintf (buffer,
" %8.5f", lowEdge [
bin]);
974 fOutput << std::endl;
984 while (fInput.getline(buffer, 1024)) {
985 if (buffer [0] ==
'#')
continue;
986 std::vector <std::string> items =
splitString (std::string (buffer));
987 if (items.size () < 12) {
988 if (items.size()==0)
continue;
989 if (items.size()<9) {
990 edm::LogError(
"MapFormat") <<
"HcalElectronicsMap-> line too short: " << buffer;
993 if (items[8]==
"NA" || items[8]==
"NT") {
994 while (items.size()<12) items.push_back(
"");
995 }
else if (items[8]==
"HT") {
996 if (items.size()==11) items.push_back(
"");
998 edm::LogError(
"MapFormat") <<
"HcalElectronicsMap-> Bad line: " << buffer
999 <<
"\n HT line must contain at least 11 items: i cr sl tb dcc spigot fiber fiberchan subdet=HT ieta iphi";
1003 edm::LogError(
"MapFormat") <<
"HcalElectronicsMap-> Bad line: " << buffer
1004 <<
"\n line must contain 12 items: i cr sl tb dcc spigot fiber fiberchan subdet ieta iphi depth";
1009 int crate = atoi (items [1].c_str());
1010 int slot = atoi (items [2].c_str());
1012 if (items [3] ==
"b") top = 0;
1013 int dcc = atoi (items [4].c_str());
1014 int spigot = atoi (items [5].c_str());
1016 if (items[8] ==
"HT" || items[8] ==
"NT") {
1017 int slb = atoi (items [6].c_str());
1018 int slbCh = atoi (items [7].c_str());
1021 int fiber = atoi (items [6].c_str());
1022 int fiberCh = atoi (items [7].c_str());
1025 elId.
setHTR (crate, slot, top);
1029 if (items [8] ==
"NA") {
1031 }
else if (items [8] ==
"NT") {
1035 if (converter.isHcalDetId ()) {
1038 else if (converter.isHcalTrigTowerDetId ()) {
1039 fObject->
mapEId2tId (elId, converter.getId ());
1041 else if (converter.isHcalCalibDetId ()) {
1044 else if (converter.isHcalZDCDetId ()) {
1048 edm::LogWarning(
"Format Error") <<
"HcalElectronicsMap-> Unknown subdetector: "
1049 << items [8] <<
'/' << items [9] <<
'/' << items [10] <<
'/' << items [11] << std::endl;
1062 sprintf (buf,
"# %7s %3s %3s %3s %4s %7s %10s %14s %7s %5s %5s %6s",
1063 "i",
"cr",
"sl",
"tb",
"dcc",
"spigot",
"fiber/slb",
"fibcha/slbcha",
"subdet",
"ieta",
"iphi",
"depth");
1064 fOutput << buf << std::endl;
1066 for (
unsigned i = 0; i < eids.size (); i++) {
1070 if (trigger.
rawId ()) {
1074 sprintf (buf,
" %7X %3d %3d %3c %4d %7d %10d %14d %7s %5s %5s %6s",
1076 converter.getId().rawId(),
1080 converter.getFlavor ().c_str (), converter.getField1 ().c_str (), converter.getField2 ().c_str (), converter.getField3 ().c_str ()
1082 fOutput << buf << std::endl;
1086 if (channel.
rawId()) {
1090 sprintf (buf,
" %7X %3d %3d %3c %4d %7d %10d %14d %7s %5s %5s %6s",
1092 converter.getId().rawId(),
1094 converter.getFlavor ().c_str (), converter.getField1 ().c_str (), converter.getField2 ().c_str (), converter.getField3 ().c_str ()
1096 fOutput << buf << std::endl;
1107 while (fInput.getline(buffer, 1024)) {
1108 if (buffer [0] ==
'#')
continue;
1109 std::vector <std::string> items =
splitString (std::string (buffer));
1110 if (items.size()==0)
continue;
1112 if (items.size() > 1 &&
1113 items[0].find(
"RctLsb")!=std::string::npos){
1114 fObject->
setRctLsb( atof( items[1].c_str() ) );
1117 if (items.size() > 1 &&
1118 items[0].find(
"Gain")!=std::string::npos){
1123 if (items.size () < 7) {
1124 edm::LogWarning(
"Format Error") <<
"Bad line: " << buffer <<
"\n line must contain 7 items: eta, phi, depth, subdet, Rcalib, LutGranularity, OutputLutThreshold" << std::endl;
1130 atof (items [4].c_str()),
1131 atoi (items [5].c_str()),
1132 atoi (items [6].c_str()));
1142 const float _rctLsb = fObject.
getRctLsb();
1144 sprintf (buffer,
"# %20s\n",
"Non-channel data");
1146 sprintf (buffer,
"%8s %8.5f\n",
"RctLsb", _rctLsb);
1148 sprintf (buffer,
"%8s %8.5f\n",
"Gain", _gain);
1150 sprintf (buffer,
"# %15s %15s %15s %15s %8s %15s %19s %10s\n",
"eta",
"phi",
"dep",
"det",
"Rcalib",
"LutGranularity",
"OutputLutThreshold",
"DetId");
1153 std::sort (channels.begin(), channels.end(), DetIdLess ());
1154 for (std::vector<DetId>::iterator channel = channels.begin ();
1155 channel != channels.end ();
1160 dumpId (fOutput, *channel);
1161 sprintf (buffer,
" %8.5f %15d %19d %10X\n",
1164 _outputLutThreshold,
1175 while (getline(fInput, buffer)) {
1176 if (buffer.at(0) ==
'#')
continue;
1177 std::vector <std::string> items =
splitString (buffer);
1178 if (items.size()==0)
continue;
1180 if (items.size() < 9) {
1181 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;
1187 unsigned int slice, subchan;
1188 switch (items[0].
at(1)) {
1205 from_string<int>(sidering, items[1], std::dec);
1206 from_string<unsigned int>(slice, items[2], std::dec);
1208 from_string<unsigned int>(subchan, items[4], std::dec);
1214 float val,upper,lower;
1215 from_string<int>(LS, items[5], std::dec);
1216 from_string<float>(val, items[6], std::dec);
1217 from_string<float>(upper, items[7], std::dec);
1218 from_string<float>(lower, items[8], std::dec);
1226 if (!(fObject->
addValue(newVal))) {
1228 <<
"\nwas not added to the HcalDcsValues object." << std::endl;
1238 fOutput <<
"# subDet side_ring slice type subChan LS Value UpperLimit LowerLimit DcsId\n";
1244 for (HcalDcsValues::DcsSet::const_iterator val = vals.begin();
1245 val != vals.end(); ++val) {
1248 switch (valId.subdet()) {
1262 fOutput << valId.subdet() <<
' ';
1266 fOutput << valId.ring() <<
' ';
1268 fOutput << valId.zside() <<
' ';
1270 fOutput << valId.slice() <<
' '
1271 << valId.typeString(valId.type()) <<
' '
1272 << valId.subchannel() <<
' ';
1273 fOutput << val->LS() <<
' '
1274 << val->getValue() <<
' '
1275 << val->getUpperLimit() <<
' '
1276 << val->getLowerLimit() <<
' ';
1277 fOutput << std::hex << val->DcsId() << std::dec <<
'\n';
1296 while (fInput.getline(buffer, 1024)) {
1297 if (buffer [0] ==
'#')
continue;
1298 std::vector <std::string> items =
splitString (std::string (buffer));
1299 if (items.size () < 8) {
1300 if (items.size()==0)
continue;
1302 edm::LogError(
"MapFormat") <<
"HcalDcsMap-> Bad line: " << buffer
1303 <<
"\n line must contain 8 items: line side_ring slice subchannel subdet ieta iphi depth";
1309 int ring = atoi(items[1].c_str());
1310 unsigned int slice = atoi (items [2].c_str());
1311 unsigned int subchannel = atoi (items [3].c_str());
1357 if (items[4].
find(
"CALIB")!=std::string::npos){
1360 else if (items[4].
find(
"HB")!=std::string::npos){
1363 else if (items[4].
find(
"HE")!=std::string::npos){
1366 else if (items[4].
find(
"HO")!=std::string::npos){
1369 else if (items[4].
find(
"HF")!=std::string::npos){
1373 edm::LogError(
"MapFormat") <<
"HcalDcsMap-> Unknown subdetector, line is not accepted: " << items[5];
1376 HcalDcsDetId dcsId(subdet, ring, slice, type, subchannel);
1379 if (converter.isHcalDetId()){
1380 id = converter.getId();
1383 edm::LogWarning(
"Invalid HCAL channel") <<
"HcalDcsMap-> invalid channel: "
1387 << items [7] << std::endl;
1401 sprintf (buf,
"# %7s %10s %6s %8s %7s %5s %5s %6s",
1402 "i",
"side_ring",
"slice",
"subchan",
"subdet",
"ieta",
"iphi",
"depth");
1403 fOutput << buf << std::endl;
1405 unsigned int line_counter = 0;
1412 sprintf (buf,
" %8X %10d %6d %8d %7s %5s %5s %6s",
1417 _converter.getFlavor().c_str(),
1418 _converter.getField1().c_str(),
1419 _converter.getField2().c_str(),
1420 _converter.getField3().c_str()
1422 fOutput << buf << std::endl;
float getPedestal() const
unsigned int firstSample() 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)
std::vector< unsigned int > signalTS() const
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
std::vector< unsigned int > splitStringToIntByComma(const std::string &fLine)
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
unsigned int samplesToAdd() 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
unsigned int signalShape() 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)
std::vector< unsigned int > noiseTS() const
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 &))