Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
#include <iostream>
#include <sstream>
#include "CondCore/Utilities/interface/PayloadInspector.h"
#include "CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc"
#include "CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc"
#include "CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc"
#include "CondCore/SiStripPlugins/plugins/SiStripThreshold_PayloadInspector.cc"
#include "CondCore/SiStripPlugins/plugins/SiStripLatency_PayloadInspector.cc"
#include "CondCore/SiStripPlugins/plugins/SiStripFedCabling_PayloadInspector.cc"
#include "CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc"

#include "FWCore/PluginManager/interface/PluginManager.h"
#include "FWCore/PluginManager/interface/standard.h"
#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"

int main(int argc, char** argv) {
  Py_Initialize();

  edmplugin::PluginManager::Config config;
  edmplugin::PluginManager::configure(edmplugin::standard::config());

  std::vector<edm::ParameterSet> psets;
  edm::ParameterSet pSet;
  pSet.addParameter("@service_type", std::string("SiteLocalConfigService"));
  psets.push_back(pSet);
  edm::ServiceToken servToken(edm::ServiceRegistry::createSet(psets));
  edm::ServiceRegistry::Operate operate(servToken);

  std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS");

  // Gains

  std::string tag = "SiStripApvGain_FromParticles_GR10_v11_offline";

  cond::Time_t start = static_cast<unsigned long long>(132440);
  cond::Time_t end = static_cast<unsigned long long>(285368);
  py::dict inputs;

  edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Gains plots " << std::endl;

  SiStripApvGainsAverageTrackerMap histo1;
  histo1.process(connectionString, PI::mk_input(tag, start, start));
  edm::LogPrint("testSiStripPayloadInspector") << histo1.data() << std::endl;

  SiStripApvGainsAvgDeviationRatioWithPreviousIOVTrackerMap histo2;
  inputs["nsigma"] = "1";
  histo2.setInputParamValues(inputs);
  histo2.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histo2.data() << std::endl;

  SiStripApvGainsMaxDeviationRatioWithPreviousIOVTrackerMap histo3;
  inputs["nsigma"] = "1";
  histo3.setInputParamValues(inputs);
  histo3.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histo3.data() << std::endl;

  SiStripApvGainsValuesComparatorSingleTag histo4;
  histo4.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histo4.data() << std::endl;

  SiStripApvGainsComparatorSingleTag histo5;
  histo5.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histo5.data() << std::endl;

  SiStripApvGainsComparatorByRegionSingleTag histo6;
  histo6.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histo6.data() << std::endl;

  SiStripApvGainsRatioComparatorByRegionSingleTag histo7;
  histo7.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histo7.data() << std::endl;

  SiStripApvGainCompareByPartitionSingleTag histoGainByPart;
  histoGainByPart.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histoGainByPart.data() << std::endl;

  SiStripApvGainRatioByPartitionSingleTag histoGainRatioByPart;
  histoGainRatioByPart.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histoGainRatioByPart.data() << std::endl;

  // Noise

  tag = "SiStripNoise_GR10_v1_hlt";
  start = static_cast<unsigned long long>(312968);
  end = static_cast<unsigned long long>(313120);

  edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Noise plots " << std::endl;

  SiStripNoiseValuePerAPV histo8;
  histo8.process(connectionString, PI::mk_input(tag, start, start));
  edm::LogPrint("testSiStripPayloadInspector") << histo8.data() << std::endl;

  SiStripNoiseValueComparisonPerAPVSingleTag histo9;
  histo9.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histo9.data() << std::endl;

  SiStripNoiseComparatorMeanByRegionSingleTag histoCompareMeanByRegion;
  histoCompareMeanByRegion.process(connectionString, PI::mk_input(tag, start, start));
  edm::LogPrint("testSiStripPayloadInspector") << histoCompareMeanByRegion.data() << std::endl;

  SiStripNoisePerDetId histoNoiseForDetId;
  inputs["DetIds"] = "470148232";
  histoNoiseForDetId.setInputParamValues(inputs);
  histoNoiseForDetId.process(connectionString, PI::mk_input(tag, start, start));
  edm::LogPrint("testSiStripPayloadInspector") << histoNoiseForDetId.data() << std::endl;

  SiStripNoiseCorrelationByPartition histoNoiseCorrelationByPartition;
  histoNoiseCorrelationByPartition.process(connectionString, PI::mk_input(tag, start, start));
  edm::LogPrint("testSiStripPayloadInspector") << histoNoiseCorrelationByPartition.data() << std::endl;

  SiStripNoiseDiffByPartitionSingleTag histoNoiseDiffByPart;
  histoNoiseDiffByPart.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histoNoiseDiffByPart.data() << std::endl;

  // Pedestals

  tag = "SiStripPedestals_v2_prompt";
  start = static_cast<unsigned long long>(303420);
  end = static_cast<unsigned long long>(313120);

  edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Pedestal plots " << std::endl;

  SiStripPedestalValuePerStrip histo10;
  histo10.process(connectionString, PI::mk_input(tag, start, start));
  edm::LogPrint("testSiStripPayloadInspector") << histo10.data() << std::endl;

  SiStripPedestalValueComparisonPerModuleSingleTag histo11;
  histo11.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histo11.data() << std::endl;

  SiStripPedestalPerDetId histoPedestalForDetId;
  inputs["DetIds"] = py::cast<std::string>(inputs["DetIds"]) +
                     ",470065830,369121594,369124670,470177668";  // add a bunch of other DetIds
  histoPedestalForDetId.setInputParamValues(inputs);
  histoPedestalForDetId.process(connectionString, PI::mk_input(tag, start, start));
  edm::LogPrint("testSiStripPayloadInspector") << histoPedestalForDetId.data() << std::endl;

  SiStripPedestalCorrelationByPartition histoPedestalCorrelationByPartition;
  histoPedestalCorrelationByPartition.process(connectionString, PI::mk_input(tag, start, start));
  edm::LogPrint("testSiStripPayloadInspector") << histoPedestalCorrelationByPartition.data() << std::endl;

  SiStripPedestalDiffByPartitionSingleTag histoPedDiffByPart;
  histoPedDiffByPart.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histoPedDiffByPart.data() << std::endl;

  // Latency

  tag = "SiStripLatency_v2_prompt";
  start = static_cast<unsigned long long>(315347);
  end = static_cast<unsigned long long>(316675);

  edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Latency plots " << std::endl;

  SiStripLatencyMode histo12;
  histo12.process(connectionString, PI::mk_input(tag, start, start));
  edm::LogPrint("testSiStripPayloadInspector") << histo12.data() << std::endl;

  SiStripLatencyModeHistory histo13;
  histo13.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histo13.data() << std::endl;

  // Threshold
  tag = "SiStripThreshold_v1_prompt";
  start = static_cast<unsigned long long>(315352);
  end = static_cast<unsigned long long>(315460);

  edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Threshold plots " << std::endl;

  SiStripThresholdValueHigh histo14;
  histo14.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histo14.data() << std::endl;

  // test SiStripTkMaps
  tag = "SiStripBadComponents_startupMC_for2017_v1_mc";
  start = static_cast<unsigned long long>(1);
  end = static_cast<unsigned long long>(1);

  edm::LogPrint("testSiStripPayloadInspector") << "## Exercising SiStripTkMaps plots " << std::endl;

  SiStripBadStripFractionTH2PolyTkMap histoTkMap;
  histoTkMap.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histoTkMap.data() << std::endl;

  // test FED cabling
  tag = "SiStripFedCabling_GR10_v1_hlt";
  start = static_cast<unsigned long long>(1);
  end = static_cast<unsigned long long>(400000);

  edm::LogPrint("testSiStripPayloadInspector") << "## Exercising FEDCabling plots " << std::endl;

  SiStripFedCablingComparisonTrackerMapSingleTag histoFEDCablingCompare;
  histoFEDCablingCompare.process(connectionString, PI::mk_input(tag, start, end));
  edm::LogPrint("testSiStripPayloadInspector") << histoFEDCablingCompare.data() << std::endl;

  inputs.clear();
#if PY_MAJOR_VERSION >= 3
  // TODO I don't know why this Py_INCREF is necessary...
  Py_INCREF(inputs.ptr());
#endif

  Py_Finalize();
}