Skip to content

Commit

Permalink
apply revision comments
Browse files Browse the repository at this point in the history
  • Loading branch information
francescobrivio committed Dec 9, 2021
1 parent 3299173 commit ce3e23b
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 74 deletions.
29 changes: 14 additions & 15 deletions CondCore/ESSources/test/SiStripTest/noiseanalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,45 @@
#include "CondFormats/Calibration/interface/mySiStripNoises.h"
#include "CondFormats/DataRecord/interface/mySiStripNoisesRcd.h"

#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/MakerMacros.h"

using namespace std;

namespace edmtest {
class NoisesAnalyzer : public edm::EDAnalyzer {
class NoisesAnalyzer : public edm::global::EDAnalyzer<> {
public:
explicit NoisesAnalyzer(edm::ParameterSet const& p) : theNoisesToken_(esConsumes()) {
std::cout << "NoisesAnalyzer" << std::endl;
edm::LogPrint("NoisesAnalyzer") << "NoisesAnalyzer";
}
explicit NoisesAnalyzer(int i) { std::cout << "NoisesAnalyzer " << i << std::endl; }
virtual ~NoisesAnalyzer() { std::cout << "~NoisesAnalyzer " << std::endl; }
virtual void analyze(const edm::Event& e, const edm::EventSetup& c);
explicit NoisesAnalyzer(int i) { edm::LogPrint("NoisesAnalyzer") << "NoisesAnalyzer " << i; }
virtual ~NoisesAnalyzer() { edm::LogPrint("NoisesAnalyzer") << "~NoisesAnalyzer "; }
void analyze(edm::StreamID, const edm::Event& e, const edm::EventSetup& c) const override;

private:
const edm::ESGetToken<mySiStripNoises, mySiStripNoisesRcd> theNoisesToken_;
};

void NoisesAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) {
void NoisesAnalyzer::analyze(edm::StreamID, const edm::Event& e, const edm::EventSetup& context) const {
using namespace edm::eventsetup;
// Context is not used.
std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl;
edm::LogPrint("NoisesAnalyzer") << " I AM IN RUN NUMBER " << e.id().run();
edm::LogPrint("NoisesAnalyzer") << " ---EVENT NUMBER " << e.id().event();
edm::eventsetup::EventSetupRecordKey recordKey(
edm::eventsetup::EventSetupRecordKey::TypeTag::findType("mySiStripNoisesRcd"));
if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
//record not found
std::cout << "Record \"mySiStripNoisesRcd"
<< "\" does not exist " << std::endl;
edm::LogPrint("NoisesAnalyzer") << "Record \"mySiStripNoisesRcd\" does not exist";
}
std::cout << "got context" << std::endl;
edm::LogPrint("NoisesAnalyzer") << "got context";
auto const& mynoise = &context.getData(theNoisesToken_);
std::cout << "Noises* " << mynoise << std::endl;
edm::LogPrint("NoisesAnalyzer") << "Noises* " << mynoise;
unsigned int a = mynoise->v_noises.size();
std::cout << "size a " << a << std::endl;
edm::LogPrint("NoisesAnalyzer") << "size a " << a;
unsigned int b = mynoise->indexes.size();
std::cout << "size b " << b << std::endl;
edm::LogPrint("NoisesAnalyzer") << "size b " << b;
/*for(std::vector<mySiStripNoises::DetRegistry>::const_iterator it=mynoise->indexes.begin(); it!=mynoise->indexes.end(); ++it){
std::cout << " detid " <<it->detid<< std::endl;
}*/
Expand Down
30 changes: 17 additions & 13 deletions CondCore/ESSources/test/stubs/EfficiencyByLabelAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ namespace edmtest {
public:
explicit EfficiencyByLabelAnalyzer(edm::ParameterSet const& p)
: theEffToken1_(esConsumes()), theEffToken2_(esConsumes()) {
std::cout << "EfficiencyByLabelAnalyzer" << std::endl;
edm::LogPrint("EfficiencyByLabelAnalyzer") << "EfficiencyByLabelAnalyzer";
}
explicit EfficiencyByLabelAnalyzer(int i) {
edm::LogPrint("EfficiencyByLabelAnalyzer") << "EfficiencyByLabelAnalyzer " << i;
}
virtual ~EfficiencyByLabelAnalyzer() {
edm::LogPrint("EfficiencyByLabelAnalyzer") << "~EfficiencyByLabelAnalyzer ";
}
explicit EfficiencyByLabelAnalyzer(int i) { std::cout << "EfficiencyByLabelAnalyzer " << i << std::endl; }
virtual ~EfficiencyByLabelAnalyzer() { std::cout << "~EfficiencyByLabelAnalyzer " << std::endl; }
virtual void analyze(const edm::Event& e, const edm::EventSetup& c);

private:
Expand All @@ -38,28 +42,28 @@ namespace edmtest {
void EfficiencyByLabelAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) {
using namespace edm::eventsetup;
// Context is not used.
std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl;
edm::LogPrint("EfficiencyByLabelAnalyzer") << " I AM IN RUN NUMBER " << e.id().run();
edm::LogPrint("EfficiencyByLabelAnalyzer") << " ---EVENT NUMBER " << e.id().event();
edm::eventsetup::EventSetupRecordKey recordKey(
edm::eventsetup::EventSetupRecordKey::TypeTag::findType("ExEfficiencyRcd"));
if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
//record not found
std::cout << "Record \"ExEfficiencyRcd"
<< "\" does not exist " << std::endl;
edm::LogPrint("EfficiencyByLabelAnalyzer") << "Record \"ExEfficiencyRcd\" does not exist";
}
std::cout << "got context" << std::endl;
edm::LogPrint("EfficiencyByLabelAnalyzer") << "got context";
{
condex::Efficiency const& eff = context.getData(theEffToken2_);
std::cout << "Efficiency*, type (2) " << (void*)(&eff) << " " << typeid(eff).name() << std::endl;
edm::LogPrint("EfficiencyByLabelAnalyzer")
<< "Efficiency*, type (2) " << (void*)(&eff) << " " << typeid(eff).name();
}
condex::Efficiency const& eff = context.getData(theEffToken1_);
std::cout << "Efficiency*, type " << (void*)(&eff) << " " << typeid(eff).name() << std::endl;
edm::LogPrint("EfficiencyByLabelAnalyzer") << "Efficiency*, type " << (void*)(&eff) << " " << typeid(eff).name();
for (float pt = 0; pt < 10; pt += 2) {
std::cout << "\npt=" << pt << " :";
edm::LogPrint("EfficiencyByLabelAnalyzer") << "\npt=" << pt << " :";
for (float eta = -3; eta < 3; eta += 1)
std::cout << eff(pt, eta) << " ";
edm::LogPrint("EfficiencyByLabelAnalyzer") << eff(pt, eta) << " ";
}
std::cout << std::endl;
edm::LogPrint("EfficiencyByLabelAnalyzer");
}

DEFINE_FWK_MODULE(EfficiencyByLabelAnalyzer);
Expand Down
21 changes: 9 additions & 12 deletions CondCore/ESSources/test/stubs/KeyListAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace {

template <typename Conf>
void print(Conf const& c) {
std::cout << c.v << " " << c.key << " ; ";
edm::LogPrint("KeyListAnalyzer") << c.v << " " << c.key << " ; ";
}

} // namespace
Expand All @@ -29,10 +29,10 @@ namespace edmtest {
class KeyListAnalyzer : public edm::one::EDAnalyzer<> {
public:
explicit KeyListAnalyzer(edm::ParameterSet const& p) : theKeyListToken_(esConsumes()) {
std::cout << "KeyListAnalyzer" << std::endl;
edm::LogPrint("KeyListAnalyzer") << "KeyListAnalyzer";
}
explicit KeyListAnalyzer(int i) { std::cout << "KeyListAnalyzer " << i << std::endl; }
virtual ~KeyListAnalyzer() { std::cout << "~KeyListAnalyzer " << std::endl; }
explicit KeyListAnalyzer(int i) { edm::LogPrint("KeyListAnalyzer") << "KeyListAnalyzer " << i; }
virtual ~KeyListAnalyzer() { edm::LogPrint("KeyListAnalyzer") << "~KeyListAnalyzer "; }
virtual void analyze(const edm::Event& e, const edm::EventSetup& c);

private:
Expand All @@ -42,16 +42,15 @@ namespace edmtest {
void KeyListAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) {
using namespace edm::eventsetup;
// Context is not used.
std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl;
edm::LogPrint("KeyListAnalyzer") << " I AM IN RUN NUMBER " << e.id().run();
edm::LogPrint("KeyListAnalyzer") << " ---EVENT NUMBER " << e.id().event();
edm::eventsetup::EventSetupRecordKey recordKey(
edm::eventsetup::EventSetupRecordKey::TypeTag::findType("ExDwarfListRcd"));
if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
//record not found
std::cout << "Record \"ExDwarfListRcd "
<< "\" does not exist " << std::endl;
edm::LogPrint("KeyListAnalyzer") << "Record \"ExDwarfListRcd\" does not exist";
}
std::cout << "got context" << std::endl;
edm::LogPrint("KeyListAnalyzer") << "got context";
cond::KeyList const& kl = context.getData(theKeyListToken_);
int n = 0;
for (int i = 0; i < kl.size(); i++)
Expand All @@ -62,9 +61,7 @@ namespace edmtest {
else
print(*kl.get<condex::ConfF>(i));
}
std::cout << "found " << n << " valid keyed confs" << std::endl;

std::cout << std::endl;
edm::LogPrint("KeyListAnalyzer") << "found " << n << " valid keyed confs" << std::endl;
}

DEFINE_FWK_MODULE(KeyListAnalyzer);
Expand Down
6 changes: 3 additions & 3 deletions CondCore/ESSources/test/stubs/LumiTestReadAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ namespace edmtest {
msg << "On time " << boost::posix_time::to_iso_extended_string(now) << " Target " << target << "; found "
<< found;
edm::LogWarning(MSGSOURCE) << msg.str();
std::cout << "ERROR ( process " << m_processId << " ) : " << msg.str() << std::endl;
std::cout << "### dumping in file " << m_pathForErrorFile << std::endl;
edm::LogPrint("LumiTestReadAnalyzer") << "ERROR ( process " << m_processId << " ) : " << msg.str();
edm::LogPrint("LumiTestReadAnalyzer") << "### dumping in file " << m_pathForErrorFile;
{
std::ofstream errorFile(m_pathForErrorFile, std::ios_base::app);
errorFile << msg.str() << std::endl;
}
//throw std::runtime_error( msg.str() );
} else {
std::cout << "Info: read was ok." << std::endl;
edm::LogPrint("LumiTestReadAnalyzer") << "Info: read was ok.";
}
}
DEFINE_FWK_MODULE(LumiTestReadAnalyzer);
Expand Down
29 changes: 14 additions & 15 deletions CondCore/ESSources/test/stubs/PedestalsAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ namespace edmtest {
public:
explicit PedestalsAnalyzer(edm::ParameterSet const& p)
: thePedestalToken_(esConsumes()), theBeginRunPedestalToken_(esConsumes<edm::Transition::BeginRun>()) {
std::cout << "PedestalsAnalyzer" << std::endl;
edm::LogPrint("PedestalsAnalyzer") << "PedestalsAnalyzer";
}
explicit PedestalsAnalyzer(int i) { std::cout << "PedestalsAnalyzer " << i << std::endl; }
virtual ~PedestalsAnalyzer() { std::cout << "~PedestalsAnalyzer " << std::endl; }
explicit PedestalsAnalyzer(int i) { edm::LogPrint("PedestalsAnalyzer") << "PedestalsAnalyzer " << i; }
virtual ~PedestalsAnalyzer() { edm::LogPrint("PedestalsAnalyzer") << "~PedestalsAnalyzer "; }
virtual void beginJob();
virtual void beginRun(const edm::Run&, const edm::EventSetup& context);
virtual void analyze(const edm::Event& e, const edm::EventSetup& c);
Expand All @@ -39,31 +39,30 @@ namespace edmtest {
const edm::ESGetToken<Pedestals, PedestalsRcd> thePedestalToken_, theBeginRunPedestalToken_;
};
void PedestalsAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context) {
std::cout << "###PedestalsAnalyzer::beginRun" << std::endl;
std::cout << "got context" << std::endl;
edm::LogPrint("PedestalsAnalyzer") << "###PedestalsAnalyzer::beginRun";
edm::LogPrint("PedestalsAnalyzer") << "got context";
auto const& myBeginRunPed = &context.getData(theBeginRunPedestalToken_);
std::cout << "Pedestals* " << myBeginRunPed << std::endl;
edm::LogPrint("PedestalsAnalyzer") << "Pedestals* " << myBeginRunPed;
}
void PedestalsAnalyzer::beginJob() { std::cout << "###PedestalsAnalyzer::beginJob" << std::endl; }
void PedestalsAnalyzer::beginJob() { edm::LogPrint("PedestalsAnalyzer") << "###PedestalsAnalyzer::beginJob"; }
void PedestalsAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) {
using namespace edm::eventsetup;
// Context is not used.
std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl;
edm::LogPrint("PedestalsAnalyzer") << " I AM IN RUN NUMBER " << e.id().run();
edm::LogPrint("PedestalsAnalyzer") << " ---EVENT NUMBER " << e.id().event();
edm::eventsetup::EventSetupRecordKey recordKey(
edm::eventsetup::EventSetupRecordKey::TypeTag::findType("PedestalsRcd"));
if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
//record not found
std::cout << "Record \"PedestalsRcd"
<< "\" does not exist " << std::endl;
edm::LogPrint("PedestalsAnalyzer") << "Record \"PedestalsRcd\" does not exist";
}
std::cout << "got context" << std::endl;
edm::LogPrint("PedestalsAnalyzer") << "got context";
auto const& myped = &context.getData(thePedestalToken_);
std::cout << "Pedestals* " << myped << std::endl;
edm::LogPrint("PedestalsAnalyzer") << "Pedestals* " << myped;
for (std::vector<Pedestals::Item>::const_iterator it = myped->m_pedestals.begin(); it != myped->m_pedestals.end();
++it)
std::cout << " mean: " << it->m_mean << " variance: " << it->m_variance;
std::cout << std::endl;
edm::LogPrint("PedestalsAnalyzer") << " mean: " << it->m_mean << " variance: " << it->m_variance;
edm::LogPrint("PedestalsAnalyzer") << std::endl;

TFile* f = TFile::Open("MyPedestal.xml", "recreate");
f->WriteObjectAny(myped, "Pedestals", "Pedestals");
Expand Down
23 changes: 12 additions & 11 deletions CondCore/ESSources/test/stubs/PedestalsByLabelAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ namespace edmtest {
public:
explicit PedestalsByLabelAnalyzer(edm::ParameterSet const& p)
: thePedestalToken_(esConsumes(edm::ESInputTag("", "lab3d"))) {
std::cout << "PedestalsByLabelAnalyzer" << std::endl;
edm::LogPrint("PedestalsByLabelAnalyzer") << "PedestalsByLabelAnalyzer";
}
explicit PedestalsByLabelAnalyzer(int i) { std::cout << "PedestalsByLabelAnalyzer " << i << std::endl; }
virtual ~PedestalsByLabelAnalyzer() { std::cout << "~PedestalsByLabelAnalyzer " << std::endl; }
explicit PedestalsByLabelAnalyzer(int i) {
edm::LogPrint("PedestalsByLabelAnalyzer") << "PedestalsByLabelAnalyzer " << i;
}
virtual ~PedestalsByLabelAnalyzer() { edm::LogPrint("PedestalsByLabelAnalyzer") << "~PedestalsByLabelAnalyzer "; }
virtual void analyze(const edm::Event& e, const edm::EventSetup& c);

private:
Expand All @@ -37,22 +39,21 @@ namespace edmtest {
void PedestalsByLabelAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) {
using namespace edm::eventsetup;
// Context is not used.
std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl;
edm::LogPrint("PedestalsByLabelAnalyzer") << " I AM IN RUN NUMBER " << e.id().run();
edm::LogPrint("PedestalsByLabelAnalyzer") << " ---EVENT NUMBER " << e.id().event();
edm::eventsetup::EventSetupRecordKey recordKey(
edm::eventsetup::EventSetupRecordKey::TypeTag::findType("PedestalsRcd"));
if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
//record not found
std::cout << "Record \"PedestalsRcd"
<< "\" does not exist " << std::endl;
edm::LogPrint("PedestalsByLabelAnalyzer") << "Record \"PedestalsRcd\" does not exist";
}
std::cout << "got context" << std::endl;
edm::LogPrint("PedestalsByLabelAnalyzer") << "got context";
auto const& myped = &context.getData(thePedestalToken_);
std::cout << "Pedestals* " << myped << std::endl;
edm::LogPrint("PedestalsByLabelAnalyzer") << "Pedestals* " << myped;
for (std::vector<Pedestals::Item>::const_iterator it = myped->m_pedestals.begin(); it != myped->m_pedestals.end();
++it)
std::cout << " mean: " << it->m_mean << " variance: " << it->m_variance;
std::cout << std::endl;
edm::LogPrint("PedestalsByLabelAnalyzer") << " mean: " << it->m_mean << " variance: " << it->m_variance;
edm::LogPrint("PedestalsByLabelAnalyzer") << std::endl;
}
DEFINE_FWK_MODULE(PedestalsByLabelAnalyzer);
} // namespace edmtest
5 changes: 3 additions & 2 deletions CondCore/ESSources/test/stubs/TestConcurrentIOVsCondCore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ namespace edmtest {
// The original reference file was created using a version
// of the code before concurrent IOVs were implemented.
for (auto const& object : testObjects_) {
std::cout << "TestConcurrentIOVsCondCore: lumi = " << object.lumi_ << " position: (" << object.x_ << ", "
<< object.y_ << ", " << object.z_ << ") iov = " << object.start_ << ":" << object.end_ << std::endl;
edm::LogPrint("TestConcurrentIOVsCondCore")
<< "TestConcurrentIOVsCondCore: lumi = " << object.lumi_ << " position: (" << object.x_ << ", " << object.y_
<< ", " << object.z_ << ") iov = " << object.start_ << ":" << object.end_;
}
}

Expand Down
5 changes: 2 additions & 3 deletions CondCore/ESSources/test/stubs/TestUpdater.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace condtest {
explicit TestUpdater(edm::ParameterSet const&);
virtual void analyze(const edm::Event& e, const edm::EventSetup& c);
virtual void beginRun(const edm::Run&, const edm::EventSetup&);
//virtual void endRun(const edm::Run& r, const edm::EventSetup&) {}

static void update(int run);

Expand All @@ -48,13 +47,13 @@ namespace condtest {

size_t number = (c.getData(theIntToken_)).front();
if (1 == e.id().run() % 2 && number != e.id().run())
std::cout << "it was not updated!" << std::endl;
edm::LogPrint("TestUpdater") << "it was not updated!";
}

void TestUpdater::update(int run) {
std::ostringstream ss;
ss << "touch cfg.py; rm cfg.py; sed 's?_CurrentRun_?" << run << "?g' writeInt_cfg.py > cfg.py; cmsRun cfg.py";
std::cout << ss.str() << std::endl;
edm::LogPrint("TestUpdater") << ss.str();
// write run in db
::system(ss.str().c_str());
}
Expand Down

0 comments on commit ce3e23b

Please sign in to comment.