Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-22 22:36:52

0001 #include <iostream>
0002 #include <sstream>
0003 #include "CondCore/Utilities/interface/PayloadInspector.h"
0004 #include "CondCore/SiPixelPlugins/plugins/SiPixelLorentzAngle_PayloadInspector.cc"
0005 #include "CondCore/SiPixelPlugins/plugins/SiPixelQuality_PayloadInspector.cc"
0006 #include "CondCore/SiPixelPlugins/plugins/SiPixelGainCalibrationOffline_PayloadInspector.cc"
0007 #include "CondCore/SiPixelPlugins/plugins/SiPixelTemplateDBObject_PayloadInspector.cc"
0008 #include "CondCore/SiPixelPlugins/plugins/SiPixelGenErrorDBObject_PayloadInspector.cc"
0009 #include "CondCore/SiPixelPlugins/plugins/SiPixelVCal_PayloadInspector.cc"
0010 #include "CondCore/SiPixelPlugins/plugins/SiPixelQualityProbabilities_PayloadInspector.cc"
0011 #include "CondCore/SiPixelPlugins/plugins/SiPixelDynamicInefficiency_PayloadInspector.cc"
0012 #include "CondCore/SiPixelPlugins/plugins/SiPixelFEDChannelContainer_PayloadInspector.cc"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 #include "FWCore/PluginManager/interface/PluginManager.h"
0015 #include "FWCore/PluginManager/interface/standard.h"
0016 #include "FWCore/PluginManager/interface/SharedLibrary.h"
0017 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
0018 
0019 int main(int argc, char** argv) {
0020   Py_Initialize();
0021 
0022   edmplugin::PluginManager::Config config;
0023   edmplugin::PluginManager::configure(edmplugin::standard::config());
0024 
0025   std::vector<edm::ParameterSet> psets;
0026   edm::ParameterSet pSet;
0027   pSet.addParameter("@service_type", std::string("SiteLocalConfigService"));
0028   psets.push_back(pSet);
0029   edm::ServiceToken servToken(edm::ServiceRegistry::createSet(psets));
0030   edm::ServiceRegistry::Operate operate(servToken);
0031 
0032   std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS");
0033 
0034   // Lorentz Angle
0035 
0036   std::string tag = "SiPixelLorentzAngle_v11_offline";
0037   cond::Time_t start = static_cast<unsigned long long>(303790);
0038   cond::Time_t end = static_cast<unsigned long long>(324245);
0039 
0040   edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising Lorentz Angle plots " << std::endl;
0041 
0042   SiPixelLorentzAngleValues histo1;
0043   histo1.process(connectionString, PI::mk_input(tag, start, start));
0044   edm::LogPrint("testSiPixelPayloadInspector") << histo1.data() << std::endl;
0045 
0046   SiPixelLorentzAngleValueComparisonSingleTag histo2;
0047   histo2.process(connectionString, PI::mk_input(tag, start, end));
0048   edm::LogPrint("testSiPixelPayloadInspector") << histo2.data() << std::endl;
0049 
0050   SiPixelLorentzAngleByRegionComparisonSingleTag histo3;
0051   histo3.process(connectionString, PI::mk_input(tag, start, end));
0052   edm::LogPrint("testSiPixelPayloadInspector") << histo3.data() << std::endl;
0053 
0054   SiPixelBPixLorentzAngleMap histo4;
0055   histo4.process(connectionString, PI::mk_input(tag, start, start));
0056   edm::LogPrint("testSiPixelPayloadInspector") << histo4.data() << std::endl;
0057 
0058   SiPixelFPixLorentzAngleMap histo5;
0059   histo5.process(connectionString, PI::mk_input(tag, end, end));
0060   edm::LogPrint("testSiPixelPayloadInspector") << histo5.data() << std::endl;
0061 
0062   std::string f_tagPhase2 = "SiPixelLorentzAngle_phase2_T15_v5_mc";
0063   std::string l_tagPhase2 = "SiPixelLorentzAngle_phase2_T19_v1_mc";
0064 
0065   SiPixelLorentzAngleValuesBarrelCompareTwoTags histoPhase2;
0066   histoPhase2.process(connectionString, PI::mk_input(f_tagPhase2, 1, 1, l_tagPhase2, 1, 1));
0067   edm::LogPrint("testSiPixelPayloadInspector") << histoPhase2.data() << std::endl;
0068 
0069   // 2 tags comparisons
0070 
0071   std::string tag2 = "SiPixelLorentzAngle_2016_ultralegacymc_v2";
0072   cond::Time_t start2 = static_cast<unsigned long long>(1);
0073 
0074   SiPixelLorentzAngleValueComparisonTwoTags histo6;
0075   histo6.process(connectionString, PI::mk_input(tag, start, start, tag2, start2, start2));
0076   edm::LogPrint("testSiPixelPayloadInspector") << histo6.data() << std::endl;
0077 
0078   SiPixelLorentzAngleByRegionComparisonTwoTags histo7;
0079   histo7.process(connectionString, PI::mk_input(tag, start, start, tag2, start2, start2));
0080   edm::LogPrint("testSiPixelPayloadInspector") << histo7.data() << std::endl;
0081 
0082   // SiPixelQuality
0083 
0084   tag = "SiPixelQuality_forDigitizer_phase1_2018_permanentlyBad";
0085   tag2 = "SiPixelQuality_phase1_2023_v6_mc";
0086   start = static_cast<unsigned long long>(1);
0087   end = static_cast<unsigned long long>(1);
0088 
0089   edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelQuality plots " << std::endl;
0090 
0091   SiPixelBPixQualityMap histo8;
0092   histo8.process(connectionString, PI::mk_input(tag, start, end));
0093   edm::LogPrint("testSiPixelPayloadInspector") << histo8.data() << std::endl;
0094 
0095   SiPixelFPixQualityMap histo9;
0096   histo9.process(connectionString, PI::mk_input(tag, start, end));
0097   edm::LogPrint("testSiPixelPayloadInspector") << histo9.data() << std::endl;
0098 
0099   SiPixelQualityBadFractionMap histo9bis;
0100   histo9bis.process(connectionString, PI::mk_input(tag, start, end));
0101   edm::LogPrint("testSiPixelPayloadInspector") << histo9bis.data() << std::endl;
0102 
0103   SiPixelQualityBadFracCompareTwoTags histo9ter;
0104   histo9ter.process(connectionString, PI::mk_input(tag, start, start, tag2, start2, start2));
0105   edm::LogPrint("testSiPixelPayloadInspector") << histo9ter.data() << std::endl;
0106 
0107   // SiPixelGainCalibrationOffline
0108 
0109   tag = "SiPixelGainCalibration_2009runs_express";
0110   start = static_cast<unsigned long long>(312203);
0111   end = static_cast<unsigned long long>(312203);
0112 
0113   edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelGainCalibrationOffline plots " << std::endl;
0114 
0115   SiPixelGainCalibrationOfflineGainsValues histo10;
0116   histo10.process(connectionString, PI::mk_input(tag, start, end));
0117   edm::LogPrint("testSiPixelPayloadInspector") << histo10.data() << std::endl;
0118 
0119   SiPixelGainCalibrationOfflinePedestalsValues histo11;
0120   histo11.process(connectionString, PI::mk_input(tag, start, end));
0121   edm::LogPrint("testSiPixelPayloadInspector") << histo11.data() << std::endl;
0122 
0123   SiPixelGainCalibrationOfflineGainsByPart histo12;
0124   histo12.process(connectionString, PI::mk_input(tag, start, end));
0125   edm::LogPrint("testSiPixelPayloadInspector") << histo12.data() << std::endl;
0126 
0127   SiPixelGainCalibrationOfflinePedestalsByPart histo13;
0128   histo13.process(connectionString, PI::mk_input(tag, start, end));
0129   edm::LogPrint("testSiPixelPayloadInspector") << histo13.data() << std::endl;
0130 
0131   end = static_cast<unsigned long long>(326851);
0132 
0133   SiPixelGainCalibOfflinePedestalComparisonSingleTag histo14;
0134   histo14.process(connectionString, PI::mk_input(tag, start, end));
0135   edm::LogPrint("testSiPixelPayloadInspector") << histo14.data() << std::endl;
0136 
0137   SiPixelGainCalibOfflineGainByRegionComparisonSingleTag histo15;
0138   histo15.process(connectionString, PI::mk_input(tag, start, end));
0139   edm::LogPrint("testSiPixelPayloadInspector") << histo15.data() << std::endl;
0140 
0141   SiPixelGainCalibrationOfflineCorrelations histo16;
0142   histo16.process(connectionString, PI::mk_input(tag, end, end));
0143   edm::LogPrint("testSiPixelPayloadInspector") << histo16.data() << std::endl;
0144 
0145   py::dict inputs;
0146   inputs["SetLog"] = "True";  // sets to true, 1,True,Yes will work
0147 
0148   SiPixelGainCalibrationOfflineGainsValuesBarrel histo17;
0149   histo17.setInputParamValues(inputs);
0150   histo17.process(connectionString, PI::mk_input(tag, end, end));
0151   edm::LogPrint("testSiPixelPayloadInspector") << histo17.data() << std::endl;
0152 
0153   // SiPixelTemplates
0154 
0155   tag = "SiPixelTemplateDBObject38Tv3_express";
0156   start = static_cast<unsigned long long>(326083);
0157   end = static_cast<unsigned long long>(326083);
0158 
0159   edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelTemplates plots " << std::endl;
0160 
0161   SiPixelTemplateIDsBPixMap histo18;
0162   histo18.process(connectionString, PI::mk_input(tag, start, end));
0163   edm::LogPrint("testSiPixelPayloadInspector") << histo18.data() << std::endl;
0164 
0165   SiPixelTemplateLAFPixMap histo19;
0166   histo19.process(connectionString, PI::mk_input(tag, start, end));
0167   edm::LogPrint("testSiPixelPayloadInspector") << histo19.data() << std::endl;
0168 
0169   SiPixelTemplateQScaleMap histoQscale;
0170   histoQscale.process(connectionString, PI::mk_input(tag, start, end));
0171   edm::LogPrint("testSiPixelPayloadInspector") << histoQscale.data() << std::endl;
0172 
0173   // SiPixelVCal
0174 
0175   tag = "SiPixelVCal_v1";
0176 
0177   edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelVCal plots " << std::endl;
0178 
0179   SiPixelVCalValues histo20;
0180   histo20.process("frontier://FrontierPrep/CMS_CONDITIONS", PI::mk_input(tag, 1, 1));
0181   edm::LogPrint("testSiPixelPayloadInspector") << histo20.data() << std::endl;
0182 
0183   SiPixelVCalSlopeValuesBarrel histo21;
0184   histo21.process("frontier://FrontierPrep/CMS_CONDITIONS", PI::mk_input(tag, 1, 1));
0185   edm::LogPrint("testSiPixelPayloadInspector") << histo21.data() << std::endl;
0186 
0187   SiPixelVCalOffsetValuesEndcap histo22;
0188   histo22.process("frontier://FrontierPrep/CMS_CONDITIONS", PI::mk_input(tag, 1, 1));
0189   edm::LogPrint("testSiPixelPayloadInspector") << histo22.data() << std::endl;
0190 
0191   // SiPixelGenErrors
0192 
0193   tag = "SiPixelGenErrorDBObject_phase1_BoR3_HV350_Tr2000";
0194   start = static_cast<unsigned long long>(1);
0195   end = static_cast<unsigned long long>(1);
0196 
0197   edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelGenErrors plots " << std::endl;
0198 
0199   SiPixelGenErrorHeaderTable histo23;
0200   histo23.process(connectionString, PI::mk_input(tag, start, end));
0201   edm::LogPrint("testSiPixelPayloadInspector") << histo23.data() << std::endl;
0202 
0203   SiPixelGenErrorIDsBPixMap histo24;
0204   histo24.process(connectionString, PI::mk_input(tag, start, end));
0205   edm::LogPrint("testSiPixelPayloadInspector") << histo24.data() << std::endl;
0206 
0207   // SiPixelQualityProbabilities
0208 
0209   tag = "SiPixelQualityProbabilities_UltraLegacy2018_v0_mc";
0210   start = static_cast<unsigned long long>(1);
0211   end = static_cast<unsigned long long>(1);
0212 
0213   edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelQualityProbabilities plots " << std::endl;
0214 
0215   SiPixelQualityProbabilitiesScenariosCount histo25;
0216   histo25.process(connectionString, PI::mk_input(tag, start, end));
0217   edm::LogPrint("testSiPixelPayloadInspector") << histo25.data() << std::endl;
0218 
0219   // SiPixelDynamicInefficiency
0220 
0221   tag = "SiPixelDynamicInefficiency_PhaseI_v9";
0222   start = static_cast<unsigned long long>(1);
0223   end = static_cast<unsigned long long>(1);
0224 
0225   edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixeDynamicInefficiency plots " << std::endl;
0226 
0227   SiPixelFullIneffROCfromDynIneffMap histo26;
0228   histo26.process(connectionString, PI::mk_input(tag, start, end));
0229   edm::LogPrint("testSiPixelPayloadInspector") << histo26.data() << std::endl;
0230 
0231   tag2 = "SiPixelDynamicInefficiency_PhaseI_v6";
0232   start2 = static_cast<unsigned long long>(1);
0233 
0234   SiPixelFullIneffROCsMapCompareTwoTags histo27;
0235   histo27.process(connectionString, PI::mk_input(tag, start, start, tag2, start2, start2));
0236   edm::LogPrint("testSiPixelPayloadInspector") << histo27.data() << std::endl;
0237 
0238   SiPixelDynamicInefficiencyPUPixelMaps histo28;
0239   histo28.process(connectionString, PI::mk_input(tag2, start, end));
0240   edm::LogPrint("testSiPixelPayloadInspector") << histo28.data() << std::endl;
0241 
0242   SiPixelDynamicInefficiencyPUParametrization histo29;
0243   histo29.process(connectionString, PI::mk_input(tag2, start, end));
0244   edm::LogPrint("testSiPixelPayloadInspector") << histo29.data() << std::endl;
0245 
0246   SiPixelDynamicInefficiencyPUParamComparisonTwoTags histo30;
0247   histo30.process(connectionString, PI::mk_input(tag, start, end, tag2, start2, start2));
0248   edm::LogPrint("testSiPixelPayloadInspector") << histo30.data() << std::endl;
0249 
0250   // SiPixelFEDChannelContainer
0251   tag = "SiPixelStatusScenarios_StuckTBMandOther_2023_v2_mc";
0252   tag2 = "SiPixelQualityProbabilities_2023_v2_mc";
0253   start = static_cast<unsigned long long>(1);
0254   end = static_cast<unsigned long long>(1);
0255 
0256   edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelFEDChannelContainer plots " << std::endl;
0257 
0258   inputs["SiPixelQualityProbabilitiesTag"] = tag2;  // Quality Probabilities tag to use
0259   SiPixelBPixFEDChannelContainerWeightedMap histo31;
0260   histo31.setInputParamValues(inputs);
0261   histo31.process(connectionString, PI::mk_input(tag, start, end));
0262   edm::LogPrint("testSiPixelPayloadInspector") << histo31.data() << std::endl;
0263 
0264   inputs["Scenarios"] = "370097_302";
0265   SiPixelBPixFEDChannelContainerMap histo32;
0266   histo32.setInputParamValues(inputs);
0267   histo32.process(connectionString, PI::mk_input(tag, start, end));
0268   edm::LogPrint("testSiPixelPayloadInspector") << histo32.data() << std::endl;
0269 
0270   inputs.clear();
0271 #if PY_MAJOR_VERSION >= 3
0272   // TODO I don't know why this Py_INCREF is necessary...
0273   Py_INCREF(inputs.ptr());
0274 #endif
0275 
0276   Py_Finalize();
0277 }