6 : onlineDbConnectionString(
pset.getParameter<
std::
string>(
"onlineDB")),
9 lastValueFileName(
pset.getParameter<
std::
string>(
"lastValueFile")),
10 fromFile(
pset.getParameter<
bool>(
"lastValueFromFile")),
11 psuDetIdMapFile_(
pset.getParameter<
std::
string>(
"PsuDetIdMapFile")),
12 debug_(
pset.getParameter<
bool>(
"debugModeOn")),
14 tmax_par(
pset.getParameter<
std::vector<
int> >(
"Tmax")),
15 tmin_par(
pset.getParameter<
std::vector<
int> >(
"Tmin")),
16 tset_par(
pset.getParameter<
std::vector<
int> >(
"TSetMin")),
17 deltaTmin_(
pset.getParameter<uint32_t>(
"DeltaTmin")),
18 maxIOVlength_(
pset.getParameter<uint32_t>(
"MaxIOVlength")),
19 detIdListFile_(
pset.getParameter<
std::
string>(
"DetIdListFile")),
20 excludedDetIdListFile_(
pset.getParameter<
std::
string>(
"ExcludedDetIdListFile")),
21 highVoltageOnThreshold_(
pset.getParameter<double>(
"HighVoltageOnThreshold")) {
25 edm::LogError(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::SiStripDetVOffBuilder] constructor" << endl;
49 <<
"[SiStripDetVOffBuilder::SiStripDetVOffBuilder] DB name has not been set properly ... Returning ...";
54 edm::LogError(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::SiStripDetVOffBuilder] File expected for "
55 "lastValue table, but filename not specified ... Returning ...";
61 ss <<
"[SiStripDetVOffBuilder::SiStripDetVOffBuilder]\n"
65 <<
" Table to be queried: " <<
whichTable <<
"\n"
87 edm::LogError(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::" << __func__ <<
"]: destructing ...";
102 edm::LogError(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::BuildDetVOff]: Query type is " <<
whichTable
107 <<
"[SiStripDetVOffBuilder::BuildDetVOff]: Use file? " << ((
fromFile) ?
"TRUE" :
"FALSE");
112 <<
"[SiStripDetVOffBuilder::BuildDetVOff]: retrieved last time stamp from DB: " <<
lastStoredCondObj.second
165 for (
unsigned int i = 0;
i < dStruct.
detidV.size();
i++) {
168 std::vector<uint32_t>* detids = &(dStruct.
detidV[
i].first);
187 if (iovtime != saveIovTime) {
197 const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>& detInfos =
reader.getAllData();
206 std::vector<std::pair<uint32_t, std::string> > excludedDetIdMap;
210 for (std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>::const_iterator it = detInfos.begin();
211 it != detInfos.end();
213 std::vector<std::pair<uint32_t, std::string> >::const_iterator exclIt = excludedDetIdMap.begin();
214 bool excluded =
false;
215 for (; exclIt != excludedDetIdMap.end(); ++exclIt) {
216 if (it->first == exclIt->first) {
222 modV->
put(it->first, 1, 1);
236 std::vector<uint32_t> beforeV;
248 for (
unsigned int j = 0;
j < detids->size();
j++) {
250 cout <<
"at time = " << iovtime <<
" detid[" <<
j <<
"] = " << (*detids)[
j] <<
" has hv = " << hvlv.first
251 <<
" and lv = " << hvlv.second << endl;
252 modV->
put((*detids)[
j], hvlv.first, hvlv.second);
256 unsigned int numAdded = 0, numRemoved = 0;
257 if (iovtime == saveIovTime) {
259 numAdded = oldStats[1];
260 numRemoved = oldStats[2];
262 std::vector<uint32_t> afterV;
265 if ((afterV.size() - beforeV.size()) > 0) {
266 numAdded += afterV.size() - beforeV.size();
267 }
else if ((beforeV.size() - afterV.size()) > 0) {
268 numRemoved += beforeV.size() - afterV.size();
272 if (iovtime != saveIovTime) {
277 if (
modulesOff.empty() || !(*modV == *testV)) {
278 modulesOff.push_back(std::make_pair(modV, iovtime));
280 saveIovTime = iovtime;
312 std::vector<uint32_t> finalids;
314 std::cout <<
"Index = " <<
i <<
" Size of DetIds vector = " << finalids.size() << std::endl;
316 for (
unsigned int j = 0;
j < finalids.size();
j++) {
317 std::cout <<
"detid = " << finalids[
j] <<
" LV off = " << (
modulesOff[
i].first)->IsModuleLVOff(finalids[
j])
318 <<
" HV off = " << (
modulesOff[
i].first)->IsModuleHVOff(finalids[
j]) << std::endl;
325 const coral::TimeStamp& changeDate,
326 const std::vector<uint32_t>& settingID,
327 const std::vector<coral::TimeStamp>& settingDate) {
330 std::vector<int> locations;
331 for (
unsigned int i = 0;
i < settingID.size();
i++) {
332 if (settingID[
i] ==
id) {
333 locations.push_back((
int)
i);
338 if (locations.empty()) {
340 }
else if (locations.size() == 1) {
341 setting = locations[0];
346 for (
unsigned int j = 0;
j < locations.size();
j++) {
347 #ifdef USING_NEW_CORAL
348 const boost::posix_time::ptime& testSec = changeDate.time();
349 const boost::posix_time::ptime& limitSec = settingDate[(
unsigned int)locations[
j]].
time();
351 long testSec = changeDate.time().ns();
352 long limitSec = settingDate[(
unsigned int)locations[
j]].
time().ns();
354 if (testSec >= limitSec) {
355 setting = locations[
j];
363 const coral::TimeStamp& changeDate,
364 const std::vector<std::string>& settingDpname,
365 const std::vector<coral::TimeStamp>& settingDate) {
368 std::vector<int> locations;
369 for (
unsigned int i = 0;
i < settingDpname.size();
i++) {
370 if (settingDpname[
i] == dpname) {
371 locations.push_back((
int)
i);
376 if (locations.empty()) {
378 }
else if (locations.size() == 1) {
379 setting = locations[0];
384 for (
unsigned int j = 0;
j < locations.size();
j++) {
385 #ifdef USING_NEW_CORAL
386 const boost::posix_time::ptime& testSec = changeDate.time();
387 const boost::posix_time::ptime& limitSec = settingDate[(
unsigned int)locations[
j]].
time();
389 long testSec = changeDate.time().ns();
390 long limitSec = settingDate[(
unsigned int)locations[
j]].
time().ns();
392 if (testSec >= limitSec) {
393 setting = locations[
j];
401 std::vector<float>& vmonValues,
402 std::vector<coral::TimeStamp>& dateChange) {
404 if (lastValueFile.bad()) {
406 <<
"[SiStripDetVOffBuilder::" << __func__ <<
"]: last Value file does not exist!";
413 std::vector<std::string> changeDates;
420 while (std::getline(lastValueFile,
line)) {
421 std::istringstream
ss(
line);
425 ss >> std::skipws >> dpid >> vmon >> changeDate;
426 dpIDs.push_back(dpid);
427 vmonValues.push_back(vmon);
428 changeDates.push_back(changeDate);
430 lastValueFile.close();
433 for (
unsigned int i = 0;
i < changeDates.size();
i++) {
435 int year = atoi(
part.c_str());
438 part = changeDates[
i].substr(5, 2);
439 int month = atoi(
part.c_str());
442 part = changeDates[
i].substr(8, 2);
446 part = changeDates[
i].substr(11, 2);
447 int hour = atoi(
part.c_str());
450 part = changeDates[
i].substr(14, 2);
451 int minute = atoi(
part.c_str());
454 part = changeDates[
i].substr(17, 2);
458 coral::TimeStamp
date(year, month,
day, hour, minute,
second, 0);
459 dateChange.push_back(
date);
462 if (changeDates.size() != dateChange.size()) {
463 edm::LogError(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::" << __func__ <<
"]: date conversion failed!!";
485 unsigned long long iovSec = iovTime >> 32;
486 uint32_t iovNanoSec = uint32_t(iovTime);
488 cout <<
"[SiStripDetVOffBuilder::getCoralTime] Converting CondTime into CoralTime: "
489 <<
" condTime = " << iovSec <<
" - " << iovNanoSec <<
" getCondTime(coralTime) = " << (testTime >> 32) <<
" - "
490 << (testTime & 0xFFFFFFFF) << endl;
497 std::sort(vec.begin(), vec.end());
498 std::vector<uint32_t>::iterator it =
std::unique(vec.begin(), vec.end());
499 vec.resize(it - vec.begin());
511 std::cout <<
"latestDate: condTime = " << (latestDate >> 32) <<
" - "
512 << (latestDate & 0xFFFFFFFF)
517 for (
unsigned int i = 1;
i < coralDate.size();
i++) {
519 if (testDate > latestDate) {
520 latestDate = testDate;
527 std::vector<std::pair<SiStripDetVOff*, cond::Time_t> >::iterator& initialIt,
528 std::vector<std::pair<SiStripDetVOff*, cond::Time_t> >& resultVec,
533 if (
distance(resultVec.begin(), initialIt) == 0) {
537 if (
debug_ && (it->first->getLVoffCounts() - initialIt->first->getLVoffCounts() == 0) &&
538 (it->first->getHVoffCounts() - initialIt->first->getHVoffCounts() == 0)) {
539 cout <<
"Same number of LV and HV at start and end of sequence: LV off = " << it->first->getLVoffCounts()
540 <<
" HV off = " << it->first->getHVoffCounts() << endl;
544 if ((it->first->getLVoffCounts() - initialIt->first->getLVoffCounts() > 0) ||
545 (it->first->getHVoffCounts() - initialIt->first->getHVoffCounts() > 0)) {
552 cout <<
"Reducing IOV sequence (going off)" << endl;
555 else if ((it->first->getLVoffCounts() - initialIt->first->getLVoffCounts() <= 0) ||
556 (it->first->getHVoffCounts() - initialIt->first->getHVoffCounts() <= 0)) {
560 cout <<
"Reducing IOV sequence (going on)" << endl;
565 std::vector<std::pair<SiStripDetVOff*, cond::Time_t> >::iterator& initialIt,
566 std::vector<std::pair<SiStripDetVOff*, cond::Time_t> >& resultVec,
568 const unsigned int first) {
570 cout <<
"first (1->means the sequence started at the first timestamp in the query results, 0-> that it did not)= "
572 cout <<
"initial->first (initial SiStripDetVOff object of the IOV sequence)= " << initialIt->first
573 <<
", second (initial timestamp of the IOV sequence) = " << initialIt->second << endl;
574 cout <<
"last (0->means that the sequence is not ending with the last item in the query results, 1-> that it "
579 resultVec.erase(initialIt +
first, it + 1);
581 it = resultVec.end() - 2;
583 it = resultVec.erase(initialIt +
first, it);
590 std::vector<std::pair<SiStripDetVOff*, cond::Time_t> >::iterator initialIt;
593 int resultsIndex = 0;
595 if (resultVecSize > 1) {
596 std::vector<std::pair<SiStripDetVOff*, cond::Time_t> >::iterator it =
modulesOff.begin();
597 for (; it !=
modulesOff.end() - 1; ++it, ++resultsIndex) {
598 unsigned long long deltaT = ((it + 1)->
second - it->second) >> 32;
599 unsigned long long deltaTsequence = 0;
601 deltaTsequence = ((it + 1)->
second - initialIt->second) >> 32;
604 if ((deltaT < deltaTmin) && ((
count == 0) || (deltaTsequence < maxIOVlength))) {
613 else if (
count > 1) {
622 if (resultsIndex == resultVecSize - 2 &&
count != 0) {
660 std::vector<coral::TimeStamp> settingDate;
661 std::vector<float> settingValue;
662 std::vector<std::string> settingDpname;
663 std::vector<uint32_t> settingDpid;
665 LogDebug(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::BuildDetVOff]: Channel settings retrieved";
666 LogDebug(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::BuildDetVOff]: Number of PSU channels: "
667 << settingDpname.size();
670 std::stringstream
ss;
671 for (
unsigned int j = 0;
j < tStruct.
dpname.size();
j++) {
682 ss <<
"Channel = " << tStruct.
dpname[
j] << std::endl;
686 <<
"[SiStripDetVOffBuilder::BuildDetVOff]: Number of channels with no setting information " <<
missing;
687 LogDebug(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::BuildDetVOff]: Number of entries in dpname vector "
695 <<
"[SiStripDetVOffBuilder::BuildDetVOff]: File access complete \n\t Number of values read from file: "
696 << tStruct.
dpid.size();
699 std::vector<coral::TimeStamp> settingDate;
700 std::vector<float> settingValue;
701 std::vector<std::string> settingDpname;
702 std::vector<uint32_t> settingDpid;
705 LogDebug(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::BuildDetVOff]: Channel settings retrieved";
706 LogDebug(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::BuildDetVOff]: Number of PSU channels: "
707 << settingDpname.size();
710 std::stringstream
ss;
714 for (
unsigned int j = 0;
j < tStruct.
dpid.size();
j++) {
722 tStruct.
dpname[
j] = settingDpname[setting];
727 ss <<
"DP ID = " << tStruct.
dpid[
j] << std::endl;
730 LogDebug(
"SiStripDetVOffBuilder") <<
"Number of missing psu channels = " <<
missing << std::endl;
731 LogDebug(
"SiStripDetVOffBuilder") <<
"IDs are: = " <<
ss.str();
736 ss <<
comment << (condTime >> 32) <<
" - " << (condTime & 0xFFFFFFFF) << std::endl;
742 ss <<
"Starting from IOV time in the database : year = " << coralTime.year() <<
", month = " << coralTime.month()
743 <<
", day = " << coralTime.day() <<
", hour = " << coralTime.hour() <<
", minute = " << coralTime.minute()
744 <<
", second = " << coralTime.second() <<
", nanosecond = " << coralTime.nanosecond() << std::endl;
770 std::cout <<
"PLEASE provide the name of a valid PSUDetIDMapFile in the cfg: currently still necessary to have a "
771 "file, soon will access the info straight from the DB!"
777 LogTrace(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::BuildDetVOff] PSU(Channel)-detID map(s) built";
785 unsigned int ch0bad = 0, ch1bad = 0, ch2bad = 0, ch3bad = 0;
786 std::vector<unsigned int> numLvBad, numHvBad;
791 std::map<std::string, bool> UnmappedState, CrosstalkingState;
793 std::map<std::string, std::vector<uint32_t> > UnmappedPSUs = map_.
getHVUnmappedMap();
795 if (
FileExists(
"HVUnmappedChannelState.dat")) {
796 std::cout <<
"File HVUnmappedChannelState.dat exists!" << std::endl;
797 std::ifstream ifs(
"HVUnmappedChannelState.dat");
799 while (getline(ifs,
line)) {
808 std::string PSU = PSUChannel.substr(0, PSUChannel.size() - 10);
810 std::map<std::string, std::vector<uint32_t> >::iterator iter = UnmappedPSUs.find(PSU);
811 if (iter != UnmappedPSUs.end()) {
812 UnmappedState[PSUChannel] = HVStatus;
814 std::cout <<
"WARNING!!! There are channels in the local file with the channel status for HVUnmapped "
815 "channels, that ARE NOT CONSIDERED AS UNMAPPED in the current map!"
822 bool MissingChannels =
false;
823 for (
std::map<
std::string, vector<uint32_t> >::iterator it = UnmappedPSUs.begin(); it != UnmappedPSUs.end(); it++) {
826 std::map<std::string, bool>::iterator iter = UnmappedState.find(chan002);
827 if (iter == UnmappedState.end()) {
828 std::cout <<
"ERROR! The local file with the channel status for HVUnmapped channels IS MISSING one of the "
829 "following unmapped channel voltage status information:"
832 MissingChannels =
true;
834 iter = UnmappedState.find(chan003);
835 if (iter == UnmappedState.end()) {
836 std::cout <<
"ERROR! The local file with the channel status for HVUnmapped channels IS MISSING one of the "
837 "following unmapped channel voltage status information:"
840 MissingChannels =
true;
844 if (MissingChannels) {
846 <<
"Exiting now... please check the local HVUnmappedChannelState.dat and the mapfile you provided ("
852 for (
std::map<
std::string, vector<uint32_t> >::iterator it = UnmappedPSUs.begin(); it != UnmappedPSUs.end(); it++) {
855 UnmappedState[chan002] =
false;
856 UnmappedState[chan003] =
false;
862 if (
FileExists(
"HVCrosstalkingChannelState.dat")) {
863 std::cout <<
"File HVCrosstalkingChannelState.dat exists!" << std::endl;
864 std::ifstream ifs(
"HVCrosstalkingChannelState.dat");
866 while (getline(ifs,
line)) {
875 std::string PSU = PSUChannel.substr(0, PSUChannel.size() - 10);
877 std::map<std::string, std::vector<uint32_t> >::iterator iter = CrosstalkingPSUs.find(PSU);
878 if (iter != CrosstalkingPSUs.end()) {
879 CrosstalkingState[PSUChannel] = HVStatus;
881 std::cout <<
"WARNING!!! There are channels in the local file with the channel status for HVUnmapped "
882 "channels, that ARE NOT CONSIDERED AS UNMAPPED in the current map!"
889 bool MissingChannels =
false;
890 for (
std::map<
std::string, vector<uint32_t> >::iterator it = CrosstalkingPSUs.begin(); it != CrosstalkingPSUs.end();
894 std::map<std::string, bool>::iterator iter = CrosstalkingState.find(chan002);
895 if (iter == CrosstalkingState.end()) {
896 std::cout <<
"ERROR! The local file with the channel status for HVCrosstalking channels IS MISSING one of the "
897 "following unmapped channel voltage status information:"
900 MissingChannels =
true;
902 iter = CrosstalkingState.find(chan003);
903 if (iter == CrosstalkingState.end()) {
904 std::cout <<
"ERROR! The local file with the channel status for HVCrosstalking channels IS MISSING one of the "
905 "following unmapped channel voltage status information:"
908 MissingChannels =
true;
912 if (MissingChannels) {
914 <<
"Exiting now... please check the local HVCrosstalkingChannelState.dat and the mapfile you provided ("
920 for (
std::map<
std::string, vector<uint32_t> >::iterator it = CrosstalkingPSUs.begin(); it != CrosstalkingPSUs.end();
924 CrosstalkingState[chan002] =
false;
925 CrosstalkingState[chan003] =
false;
931 std::cout <<
"Printing the UnmappedChannelState initial map:" << std::endl;
932 std::cout <<
"PSUChannel\t\tHVON?(true or false)" << std::endl;
933 for (std::map<std::string, bool>::iterator it = UnmappedState.begin(); it != UnmappedState.end(); it++) {
934 std::cout << it->first <<
"\t\t" << it->second << std::endl;
937 std::cout <<
"Printing the CrosstalkingChannelState initial map:" << std::endl;
938 std::cout <<
"PSUChannel\t\tHVON?(true or false)" << std::endl;
939 for (std::map<std::string, bool>::iterator it = CrosstalkingState.begin(); it != CrosstalkingState.end(); it++) {
940 std::cout << it->first <<
"\t\t" << it->second << std::endl;
949 for (
unsigned int dp = 0;
dp < psuStruct.
dpname.size();
dp++) {
953 if (PSUChannel !=
"UNKNOWN") {
956 PSUChannel.substr(PSUChannel.size() - 10);
957 std::string PSU = PSUChannel.substr(0, PSUChannel.size() - 10);
981 std::vector<uint32_t> ids;
988 std::vector<uint32_t> unmapped_ids, crosstalking_ids;
1010 cout <<
"Corresponding to LV (PSU-)matching detids: " << endl;
1011 for (
unsigned int i_detid = 0; i_detid < ids.size(); i_detid++) {
1012 cout << ids[i_detid] << std::endl;
1015 cout <<
"Corresponding to straight HV matching detids: " << endl;
1016 for (
unsigned int i_detid = 0; i_detid < ids.size(); i_detid++) {
1017 cout << ids[i_detid] << std::endl;
1022 if (!unmapped_ids.empty()) {
1023 cout <<
"Corresponding to HV unmapped (PSU-)matching detids: " << endl;
1024 for (
unsigned int i_detid = 0; i_detid < unmapped_ids.size(); i_detid++) {
1025 cout << unmapped_ids[i_detid] << std::endl;
1028 if (!crosstalking_ids.empty()) {
1029 cout <<
"Corresponding to HV crosstalking (PSU-)matching detids: " << endl;
1030 for (
unsigned int i_detid = 0; i_detid < crosstalking_ids.size(); i_detid++) {
1031 cout << crosstalking_ids[i_detid] << std::endl;
1065 numLvBad.insert(numLvBad.end(), ids.begin(), ids.end());
1068 detIdStruct.
isHV.push_back(0);
1071 detIdStruct.
psuName.push_back(PSUChannel);
1077 if (!ids.empty() || !unmapped_ids.empty() || !crosstalking_ids.empty()) {
1078 if (
Channel ==
"channel002") {
1080 }
else if (
Channel ==
"channel003") {
1085 std::vector<uint32_t> OFFids;
1086 OFFids.insert(OFFids.end(), ids.begin(), ids.end());
1087 OFFids.insert(OFFids.end(), unmapped_ids.begin(), unmapped_ids.end());
1089 if (!crosstalking_ids
1092 CrosstalkingState[PSUChannel] =
false;
1095 if (!CrosstalkingState[PSUChannel.substr(0, PSUChannel.size() - 1) +
"2"] &&
1096 !CrosstalkingState[PSUChannel.substr(0, PSUChannel.size() - 1) +
"3"]) {
1099 crosstalking_ids.begin(),
1100 crosstalking_ids.end());
1102 std::cout <<
"Adding the unmapped detids corresponding to (HV1/2 cross-talking) PSU "
1103 << PSUChannel.substr(0, PSUChannel.size() - 10) <<
" to the list of detids turning OFF"
1111 UnmappedState[PSUChannel] =
false;
1113 if (!OFFids.empty()) {
1128 numHvBad.insert(numHvBad.end(), ids.begin(), ids.end());
1131 detIdStruct.
isHV.push_back(1);
1134 detIdStruct.
psuName.push_back(PSUChannel);
1157 detIdStruct.
isHV.push_back(0);
1160 detIdStruct.
psuName.push_back(PSUChannel);
1166 std::vector<uint32_t> ONids;
1167 ONids.insert(ONids.end(), ids.begin(), ids.end());
1169 ONids.end(), crosstalking_ids.begin(), crosstalking_ids.end());
1174 UnmappedState[PSUChannel] =
true;
1177 if (UnmappedState[PSUChannel.substr(0, PSUChannel.size() - 1) +
"2"] &&
1178 UnmappedState[PSUChannel.substr(0, PSUChannel.size() - 1) +
"3"]) {
1179 ONids.insert(ONids.end(),
1180 unmapped_ids.begin(),
1181 unmapped_ids.end());
1183 std::cout <<
"Adding the detids corresponding to HV-unmapped PSU "
1184 << PSUChannel.substr(0, PSUChannel.size() - 10) <<
" to the list of detids turning ON"
1190 if (!crosstalking_ids
1192 CrosstalkingState[PSUChannel] =
true;
1194 if (!ONids.empty()) {
1209 detIdStruct.
isHV.push_back(1);
1212 detIdStruct.
psuName.push_back(PSUChannel);
1225 std::ofstream ofsUnmapped(
"HVUnmappedChannelState.dat");
1226 for (std::map<std::string, bool>::iterator it = UnmappedState.begin(); it != UnmappedState.end(); it++) {
1227 ofsUnmapped << it->first <<
"\t" << it->second << std::endl;
1229 std::ofstream ofsCrosstalking(
"HVCrosstalkingChannelState.dat");
1230 for (std::map<std::string, bool>::iterator it = CrosstalkingState.begin(); it != CrosstalkingState.end(); it++) {
1231 ofsCrosstalking << it->first <<
"\t" << it->second << std::endl;
1239 std::cout <<
"Number of channels that turned OFF in this O2O interval" << std::endl;
1240 std::cout <<
"Channel000 = " << ch0bad <<
" Channel001 = " << ch1bad << std::endl;
1241 std::cout <<
"Channel002 = " << ch2bad <<
" Channel003 = " << ch3bad << std::endl;
1242 std::cout <<
"Number of LV detIDs that turned OFF in this O2O interval = " << numLvBad.size() << std::endl;
1243 std::cout <<
"Number of HV detIDs that turned OFF in this O2O interval = " << numHvBad.size() << std::endl;
1246 LogTrace(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::" << __func__
1247 <<
"]: Number of PSUs retrieved from DB with map information "
1248 << detIdStruct.
detidV.size();
1249 LogTrace(
"SiStripDetVOffBuilder") <<
"[SiStripDetVOffBuilder::" << __func__
1250 <<
"]: Number of PSUs retrieved from DB with no map information "
1253 unsigned int dupCount = 0;
1254 for (
unsigned int t = 0;
t < numLvBad.size();
t++) {
1255 std::vector<unsigned int>::iterator iter =
std::find(numHvBad.begin(), numHvBad.end(), numLvBad[
t]);
1256 if (iter != numHvBad.end()) {
1261 std::cout <<
"Number of channels for which LV & HV turned OFF in this O2O interval = " << dupCount << std::endl;
1265 std::vector<uint32_t> pStats(3, 0);
1266 pStats.push_back(afterV);
1267 pStats.push_back(numAdded);
1268 pStats.push_back(numRemoved);
1276 int lv_off = -1, hv_off = -1;
1277 if (detIdStruct.
isHV[
i] == 0) {
1280 if (detIdStruct.
isHV[
i] == 1) {
1291 if (iChannel ==
"002" || iChannel ==
"003") {
1292 bool lastStatusOfOtherChannel =
true;
1293 for (
unsigned int j = 0;
j <
i;
j++) {
1296 if (iPsu == jPsu && iChannel != jChannel && (jChannel ==
"002" || jChannel ==
"003")) {
1299 <<
" with status = " << detIdStruct.
StatusGood[
i] <<
" and psu[" <<
j
1300 <<
"] = " << detIdStruct.
psuName[
j] <<
" with status " << detIdStruct.
StatusGood[
j] << endl;
1301 lastStatusOfOtherChannel = detIdStruct.
StatusGood[
j];
1304 if (detIdStruct.
StatusGood[
i] != lastStatusOfOtherChannel) {
1306 cout <<
"turning off hv" << endl;
1316 return make_pair(hv_off, lv_off);