43 : ecalHitsProducer_(iConfig.getParameter<std::
string>(
"ecalRecHitsProducer")),
44 barrelHits_(iConfig.getParameter<std::
string>(
"barrelHitCollection")),
45 endcapHits_(iConfig.getParameter<std::
string>(
"endcapHitCollection")),
50 eCut_barl_(iConfig.getParameter<double>(
"eCut_barrel")),
51 ap_(iConfig.getParameter<double>(
"ap")),
52 b_(iConfig.getParameter<double>(
"b")),
53 eventSet_(iConfig.getParameter<int>(
"eventSet")),
54 statusThreshold_(iConfig.getUntrackedParameter<int>(
"statusThreshold", 3)),
55 reiteration_(iConfig.getUntrackedParameter<bool>(
"reiteration",
false)),
56 oldcalibfile_(iConfig.getUntrackedParameter<std::
string>(
"oldcalibfile",
"EcalintercalibConstants.xml")) {
94 for (
int ieta = 0; ieta <
kBarlRings; ieta++) {
127 t <<
"et_spectrum_b_" <<
i + 1;
131 t <<
"e_spectrum_b_" << i + 1;
136 t <<
"et_spectrum_e_" <<
i + 1;
140 t <<
"e_spectrum_e_" << i + 1;
152 edm::LogInfo(
"Calibration") <<
"[PhiSymmetryCalibration] At end of job";
156 TFile
f(
"Espectra_plus.root",
"recreate");
176 std::ofstream k_barl_out(
"k_barl.dat",
ios::out);
178 k_barl_out << ieta <<
" " <<
k_barl_[ieta] << endl;
181 std::ofstream k_endc_out(
"k_endc.dat",
ios::out);
190 stringstream etsum_file_barl;
191 etsum_file_barl <<
"etsum_barl_" <<
eventSet_ <<
".dat";
193 std::ofstream etsum_barl_out(etsum_file_barl.str().c_str(),
ios::out);
195 for (
int ieta = 0; ieta <
kBarlRings; ieta++) {
198 etsum_barl_out << eventSet_ <<
" " << ieta <<
" " << iphi <<
" " <<
sign <<
" "
203 etsum_barl_out.close();
205 stringstream etsum_file_endc;
206 etsum_file_endc <<
"etsum_endc_" << eventSet_ <<
".dat";
208 std::ofstream etsum_endc_out(etsum_file_endc.str().c_str(),
ios::out);
214 etsum_endc_out << eventSet_ <<
" " << ix <<
" " << iy <<
" " <<
sign <<
" " <<
etsum_endc_[ix][iy][
sign]
220 etsum_endc_out.close();
241 if (!barrelRecHitsHandle.isValid()) {
242 LogError(
"") <<
"[PhiSymmetryCalibration] Error! Can't get product!" << std::endl;
246 if (!endcapRecHitsHandle.isValid()) {
247 LogError(
"") <<
"[PhiSymmetryCalibration] Error! Can't get product!" << std::endl;
258 for (itb = barrelRecHitsHandle->begin(); itb != barrelRecHitsHandle->end(); itb++) {
260 float eta = barrelGeometry->getGeometry(hit)->getPosition().eta();
261 float et = itb->energy() / cosh(eta);
262 float e = itb->energy();
268 e = e * oldCalibs_[hit];
304 for (ite = endcapRecHitsHandle->begin(); ite != endcapRecHitsHandle->end(); ite++) {
306 float eta =
abs(endcapGeometry->getGeometry(hit)->getPosition().eta());
309 float et = ite->energy() / cosh(eta);
310 float e = ite->energy();
315 e = e * oldCalibs_[hit];
323 double eCut_endc = 0;
327 eCut_endc =
ap_ + eta_ring *
b_;
331 float et_thr = eCut_endc / cosh(eta) + 1.;
399 std::vector<TGraph*> k_barl_graph(
kBarlRings);
400 std::vector<TCanvas*> k_barl_plot(
kBarlRings);
403 TF1 mypol1(
"mypol1",
"pol1");
404 for (
int ieta = 0; ieta <
kBarlRings; ieta++) {
406 int middlebin = int(kNMiscalBinsEB / 2);
408 epsilon_M_eb[imiscal] =
miscalEB_[imiscal] - 1.;
410 k_barl_graph[ieta] =
new TGraph(kNMiscalBinsEB, epsilon_M_eb, epsilon_T_eb);
411 k_barl_graph[ieta]->Fit(&mypol1);
414 t <<
"k_barl_" << ieta + 1;
415 k_barl_plot[ieta] =
new TCanvas(t.str().c_str(),
"");
416 k_barl_plot[ieta]->SetFillColor(10);
417 k_barl_plot[ieta]->SetGrid();
418 k_barl_graph[ieta]->SetMarkerSize(1.);
419 k_barl_graph[ieta]->SetMarkerColor(4);
420 k_barl_graph[ieta]->SetMarkerStyle(20);
422 k_barl_graph[ieta]->GetXaxis()->SetTitleSize(.05);
423 k_barl_graph[ieta]->GetYaxis()->SetTitleSize(.05);
424 k_barl_graph[ieta]->GetXaxis()->SetTitle(
"#epsilon_{M}");
425 k_barl_graph[ieta]->GetYaxis()->SetTitle(
"#epsilon_{T}");
426 k_barl_graph[ieta]->Draw(
"AP");
428 k_barl_[ieta] = k_barl_graph[ieta]->GetFunction(
"pol1")->GetParameter(1);
437 int middlebin = int(kNMiscalBinsEE / 2);
439 epsilon_M_ee[imiscal] =
miscalEE_[imiscal] - 1.;
441 k_endc_graph[
ring] =
new TGraph(kNMiscalBinsEE, epsilon_M_ee, epsilon_T_ee);
442 k_endc_graph[
ring]->Fit(&mypol1);
445 t <<
"k_endc_" <<
ring + 1;
446 k_endc_plot[
ring] =
new TCanvas(t.str().c_str(),
"");
447 k_endc_plot[
ring]->SetFillColor(10);
448 k_endc_plot[
ring]->SetGrid();
449 k_endc_graph[
ring]->SetMarkerSize(1.);
450 k_endc_graph[
ring]->SetMarkerColor(4);
451 k_endc_graph[
ring]->SetMarkerStyle(20);
453 k_endc_graph[
ring]->GetXaxis()->SetTitleSize(.05);
454 k_endc_graph[
ring]->GetYaxis()->SetTitleSize(.05);
455 k_endc_graph[
ring]->GetXaxis()->SetTitle(
"#epsilon_{M}");
456 k_endc_graph[
ring]->GetYaxis()->SetTitle(
"#epsilon_{T}");
457 k_endc_graph[
ring]->Draw(
"AP");
459 k_endc_[
ring] = k_endc_graph[
ring]->GetFunction(
"pol1")->GetParameter(1);
463 TFile
f(
"PhiSymmetryCalibration_kFactors.root",
"recreate");
464 for (
int ieta = 0; ieta <
kBarlRings; ieta++) {
465 k_barl_plot[ieta]->Write();
466 delete k_barl_plot[ieta];
467 delete k_barl_graph[ieta];
470 k_endc_plot[
ring]->Write();
471 delete k_endc_plot[
ring];
472 delete k_endc_graph[
ring];
497 edm::LogError(
"PhiSym") <<
"Error reading XML files" << endl;
LuminosityBlockID id() const
~PhiSymmetryCalibration() override
Destructor.
static const float kMiscalRangeEB
static const int kNMiscalBinsEB
tuple ret
prodAgent to be discontinued
void beginJob() override
Called at beginning of job.
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
void setup(const CaloGeometry *geometry, const EcalChannelStatus *chstatus, int statusThreshold)
Timestamp const & endTime() const
void setUp(const edm::EventSetup &setup)
int nRing_[kEndcEtaRings]
static const int kBarlRings
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
std::vector< TH1F * > et_spectrum_b_histos
std::vector< EcalRecHit >::const_iterator const_iterator
GlobalPoint cellPos_[kEndcWedgesX][kEndcWedgesY]
Timestamp const & beginTime() const
std::vector< TH1F * > e_spectrum_b_histos
Log< level::Error, false > LogError
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
int iphi() const
get the crystal iphi
static const int kBarlWedges
bool getData(T &iHolder) const
double etsum_endc_miscal_[kNMiscalBinsEE][kEndcEtaRings]
static const int kEndcWedgesX
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int endcapRing_[kEndcWedgesX][kEndcWedgesY]
static const int kEndcEtaRings
std::vector< TH1F * > et_spectrum_e_histos
Timestamp const & endTime() const
const edm::EDGetTokenT< EBRecHitCollection > ebRecHitToken_
double etsum_barl_miscal_[kNMiscalBinsEB][kBarlRings]
double k_endc_[kEndcEtaRings]
Abs< T >::type abs(const T &t)
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
unsigned int nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
int ieta() const
get the crystal ieta
PhiSymmetryCalibration(const edm::ParameterSet &iConfig)
Constructor.
void beginRun(edm::Run const &, const edm::EventSetup &) override
Log< level::Info, false > LogInfo
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
double miscalEB_[kNMiscalBinsEB]
Timestamp const & beginTime() const
const int statusThreshold_
threshold in channel status beyond which channel is marked bad
std::vector< TH1F * > e_spectrum_e_histos
static const int kNMiscalBinsEE
double k_barl_[kBarlRings]
std::string fullPath() const
void endRun(edm::Run const &, const edm::EventSetup &) override
void analyze(const edm::Event &, const edm::EventSetup &) override
Called at each event.
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
void endJob() override
Called at end of job.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
double miscalEE_[kNMiscalBinsEE]
static const float kMiscalRangeEE
const std::string oldcalibfile_
TimeValue_t value() const
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > channelStatusToken_
bool goodCell_endc[kEndcWedgesX][kEndcWedgesX][kSides]
double etaBoundary_[kEndcEtaRings+1]
static const int kEndcWedgesY