Skip to content

Commit 69bb0cf

Browse files
author
Sunanda
committed
Code check
1 parent 09a3a3c commit 69bb0cf

File tree

1 file changed

+74
-67
lines changed

1 file changed

+74
-67
lines changed

CondTools/Hcal/test/stubs/HcalCalibrationsAnalyzer.cc

+74-67
Original file line numberDiff line numberDiff line change
@@ -34,93 +34,100 @@ R.Ofierzynski - 2.Oct. 2007
3434

3535
using namespace std;
3636

37-
namespace edmtest
38-
{
39-
class HcalCalibrationsAnalyzer : public edm::one::EDAnalyzer<>
40-
{
37+
namespace edmtest {
38+
class HcalCalibrationsAnalyzer : public edm::one::EDAnalyzer<> {
4139
public:
42-
explicit HcalCalibrationsAnalyzer(edm::ParameterSet const& p);
43-
~ HcalCalibrationsAnalyzer() override = default;
40+
explicit HcalCalibrationsAnalyzer(edm::ParameterSet const& p);
41+
~HcalCalibrationsAnalyzer() override = default;
4442
virtual void analyze(const edm::Event& e, const edm::EventSetup& c);
43+
4544
private:
4645
const edm::ESGetToken<HcalPedestalWidths, HcalPedestalWidthsRcd> tok_pPedWs_;
4746
const edm::ESGetToken<HcalGains, HcalGainsRcd> tok_pGains_;
4847
const edm::ESGetToken<HcalGainWidths, HcalGainWidthsRcd> tok_pGainWs_;
4948
const edm::ESGetToken<HcalPedestals, HcalPedestalsRcd> tok_pPeds_;
5049
};
51-
5250

53-
HcalCalibrationsAnalyzer::HcalCalibrationsAnalyzer(edm::ParameterSet const&) :
54-
// tok_pPedsW_(esConsumes<HcalPedestalWidths, HcalPedestalWisthssRcd>()),
55-
// tok_pGains_(esConsumes<HcalGains, HcalGainsRcd>()),
56-
// tok_pGainWs_(esConsumes<HcalGainWidths, HcalGainWidthsRcd>()),
57-
tok_pPeds_(esConsumes<HcalPedestals, HcalPedestalsRcd>()) {}
51+
HcalCalibrationsAnalyzer::HcalCalibrationsAnalyzer(edm::ParameterSet const&)
52+
: // tok_pPedsW_(esConsumes<HcalPedestalWidths, HcalPedestalWisthssRcd>()),
53+
// tok_pGains_(esConsumes<HcalGains, HcalGainsRcd>()),
54+
// tok_pGainWs_(esConsumes<HcalGainWidths, HcalGainWidthsRcd>()),
55+
tok_pPeds_(esConsumes<HcalPedestals, HcalPedestalsRcd>()) {}
5856

59-
void
60-
HcalCalibrationsAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context)
61-
{
57+
void HcalCalibrationsAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) {
6258
using namespace edm::eventsetup;
6359
// Context is not used.
64-
std::cout <<"HcalCalibrationsAnalyzer::analyze-> I AM IN RUN NUMBER "<<e.id().run() <<std::endl;
65-
std::cout <<"HcalCalibrationsAnalyzer::analyze-> ---EVENT NUMBER "<<e.id().run() <<std::endl;
60+
std::cout << "HcalCalibrationsAnalyzer::analyze-> I AM IN RUN NUMBER " << e.id().run() << std::endl;
61+
std::cout << "HcalCalibrationsAnalyzer::analyze-> ---EVENT NUMBER " << e.id().run() << std::endl;
6662
const auto& pPeds = context.getHandle(tok_pPeds_);
67-
// const auto& pPedWs = context.getHandle(tok_pPedWs_);
68-
// const auto& pGains = context.getHandle(tok_pGains_);
69-
// const auto& pGainWs = context.getHandle(tok_pGainWs_);
63+
// const auto& pPedWs = context.getHandle(tok_pPedWs_);
64+
// const auto& pGains = context.getHandle(tok_pGains_);
65+
// const auto& pGainWs = context.getHandle(tok_pGainWs_);
7066
//call tracker code
7167
//
7268

7369
const HcalPedestals* myped = pPeds.product();
7470
std::vector<DetId> mychannels = myped->getAllChannels();
7571
// int cnt=0;
76-
for (std::vector<DetId>::const_iterator it=mychannels.begin(); it!=mychannels.end(); it++)
77-
{
78-
HcalDetId mydetid(*it);
79-
int eta = mydetid.ieta();
80-
int phi = mydetid.iphi();
81-
int depth = mydetid.depth();
82-
int subdet = mydetid.subdet();
83-
char id;
84-
int rawid = mydetid.rawId();
85-
switch (subdet)
86-
{
87-
case 1 : id = 'B'; break;
88-
case 2 : id = 'E'; break;
89-
case 3 : id = 'O'; break;
90-
case 4 : id = 'F'; break;
91-
}
92-
93-
// std::cout << eta << " " << phi << " " << depth << " " << subdet << " H" << id << " " << rawid;
94-
const float* values = (myped->getValues(mydetid))->getValues();
95-
// if (values) std::cout << ", pedestals: "
96-
// << values [0] << '/' << values [1] << '/' << values [2] << '/' << values [3] << std::endl;
97-
98-
printf(" %d %d %d H%c %f %f %f %f %X\n", eta, phi, depth, id, values [0], values [1], values [2], values [3], rawid);
99-
100-
72+
for (std::vector<DetId>::const_iterator it = mychannels.begin(); it != mychannels.end(); it++) {
73+
HcalDetId mydetid(*it);
74+
int eta = mydetid.ieta();
75+
int phi = mydetid.iphi();
76+
int depth = mydetid.depth();
77+
int subdet = mydetid.subdet();
78+
char id;
79+
int rawid = mydetid.rawId();
80+
switch (subdet) {
81+
case 1:
82+
id = 'B';
83+
break;
84+
case 2:
85+
id = 'E';
86+
break;
87+
case 3:
88+
id = 'O';
89+
break;
90+
case 4:
91+
id = 'F';
92+
break;
10193
}
10294

103-
104-
105-
// std::cout <<" Hcal peds for channel HB eta=15, phi=5, depth=2 "<<std::endl;
106-
// int channelID = HcalDetId (HcalBarrel, 15, 5, 2).rawId();
107-
// const HcalPedestals* myped=pPeds.product();
108-
// const HcalPedestalWidths* mypedW=pPedWs.product();
109-
// const HcalGains* mygain=pGains.product();
110-
// const HcalGainWidths* mygainW=pGainWs.product();
111-
//
112-
// const float* values = myped->getValues (channelID);
113-
// if (values) std::cout << "pedestals for channel " << channelID << ": "
114-
// << values [0] << '/' << values [1] << '/' << values [2] << '/' << values [3] << std::endl;
115-
// values = mypedW->getValues (channelID);
116-
// if (values) std::cout << "pedestal widths for channel " << channelID << ": "
117-
// << values [0] << '/' << values [1] << '/' << values [2] << '/' << values [3] << std::endl;
118-
// values = mygain->getValues (channelID);
119-
// if (values) std::cout << "gains for channel " << channelID << ": "
120-
// << values [0] << '/' << values [1] << '/' << values [2] << '/' << values [3] << std::endl;
121-
// values = mygainW->getValues (channelID);
122-
// if (values) std::cout << "gain widts for channel " << channelID << ": "
123-
// << values [0] << '/' << values [1] << '/' << values [2] << '/' << values [3] << std::endl;
95+
// std::cout << eta << " " << phi << " " << depth << " " << subdet << " H" << id << " " << rawid;
96+
const float* values = (myped->getValues(mydetid))->getValues();
97+
// if (values) std::cout << ", pedestals: "
98+
// << values [0] << '/' << values [1] << '/' << values [2] << '/' << values [3] << std::endl;
99+
100+
printf(" %d %d %d H%c %f %f %f %f %X\n",
101+
eta,
102+
phi,
103+
depth,
104+
id,
105+
values[0],
106+
values[1],
107+
values[2],
108+
values[3],
109+
rawid);
110+
}
111+
112+
// std::cout <<" Hcal peds for channel HB eta=15, phi=5, depth=2 "<<std::endl;
113+
// int channelID = HcalDetId (HcalBarrel, 15, 5, 2).rawId();
114+
// const HcalPedestals* myped=pPeds.product();
115+
// const HcalPedestalWidths* mypedW=pPedWs.product();
116+
// const HcalGains* mygain=pGains.product();
117+
// const HcalGainWidths* mygainW=pGainWs.product();
118+
//
119+
// const float* values = myped->getValues (channelID);
120+
// if (values) std::cout << "pedestals for channel " << channelID << ": "
121+
// << values [0] << '/' << values [1] << '/' << values [2] << '/' << values [3] << std::endl;
122+
// values = mypedW->getValues (channelID);
123+
// if (values) std::cout << "pedestal widths for channel " << channelID << ": "
124+
// << values [0] << '/' << values [1] << '/' << values [2] << '/' << values [3] << std::endl;
125+
// values = mygain->getValues (channelID);
126+
// if (values) std::cout << "gains for channel " << channelID << ": "
127+
// << values [0] << '/' << values [1] << '/' << values [2] << '/' << values [3] << std::endl;
128+
// values = mygainW->getValues (channelID);
129+
// if (values) std::cout << "gain widts for channel " << channelID << ": "
130+
// << values [0] << '/' << values [1] << '/' << values [2] << '/' << values [3] << std::endl;
124131
}
125132
DEFINE_FWK_MODULE(HcalCalibrationsAnalyzer);
126-
}
133+
} // namespace edmtest

0 commit comments

Comments
 (0)