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
|
// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "CondFormats/SiStripObjects/interface/SiStripThreshold.h"
#include "CondFormats/DataRecord/interface/SiStripThresholdRcd.h"
// system include files
#include <memory>
#include <iostream>
#include <cstdio>
#include <sys/time.h>
class SiStripThresholdReader : public edm::one::EDAnalyzer<> {
public:
explicit SiStripThresholdReader(const edm::ParameterSet&);
~SiStripThresholdReader() override = default;
void analyze(const edm::Event&, const edm::EventSetup&) override;
private:
uint32_t printdebug_;
const edm::ESGetToken<SiStripThreshold, SiStripThresholdRcd> thresholdToken_;
};
using namespace std;
using namespace cms;
SiStripThresholdReader::SiStripThresholdReader(const edm::ParameterSet& iConfig)
: printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 3)), thresholdToken_(esConsumes()) {}
void SiStripThresholdReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) {
const auto& thresholds = iSetup.getData(thresholdToken_);
edm::LogInfo("SiStripThresholdReader") << "[SiStripThresholdReader::analyze] End Reading SiStripThreshold"
<< std::endl;
std::vector<uint32_t> detid;
thresholds.getDetIds(detid);
edm::LogInfo("Number of detids ") << detid.size() << std::endl;
if (printdebug_)
for (size_t id = 0; id < detid.size() && id < printdebug_; id++) {
SiStripThreshold::Range range = thresholds.getRange(detid[id]);
//int strip=0;
float old_clusTh = -1, old_lowTh = -1, old_highTh = -1, old_FirstStrip = -1;
for (int it = 0; it < 768; it++) {
SiStripThreshold::Data data = thresholds.getData(it, range);
std::stringstream ss;
data.print(ss);
if (old_clusTh != data.getClusth() || old_lowTh != data.getLth() || old_highTh != data.getHth() ||
old_FirstStrip != data.getFirstStrip()) {
edm::LogInfo("SiStripThresholdReader")
<< "detid: " << detid[id] << " \t"
<< "strip: " << it << " \t" << ss.str() << "FirstStrip_and_Hth: " << data.FirstStrip_and_Hth << " \n"
<< std::endl;
old_lowTh = data.getLth();
old_highTh = data.getHth();
old_clusTh = data.getClusth();
old_FirstStrip = data.getFirstStrip();
}
}
}
}
#include "FWCore/PluginManager/interface/ModuleDef.h"
#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(SiStripThresholdReader);
|