|
|
Go to the documentation of this file.
32 #include "boost/filesystem/operations.hpp"
54 ecalHitsProducer_(iConfig.getParameter<
std::
string>(
"ecalRecHitsProducer")),
55 barrelHits_(iConfig.getParameter<
std::
string>(
"barrelHitCollection")),
56 endcapHits_(iConfig.getParameter<
std::
string>(
"endcapHitCollection")),
57 eCut_barl_(iConfig.getParameter<double>(
"eCut_barrel")),
58 ap_(iConfig.getParameter<double>(
"ap")),
59 b_(iConfig.getParameter<double>(
"b")),
60 eventSet_(iConfig.getParameter<
int>(
"eventSet")),
61 statusThreshold_(iConfig.getUntrackedParameter<
int>(
"statusThreshold", 3)),
62 reiteration_(iConfig.getUntrackedParameter<
bool>(
"reiteration",
false)),
63 oldcalibfile_(iConfig.getUntrackedParameter<
std::
string>(
"oldcalibfile",
"EcalintercalibConstants.xml")) {
131 t <<
"et_spectrum_b_" <<
i + 1;
135 t <<
"e_spectrum_b_" <<
i + 1;
140 t <<
"et_spectrum_e_" <<
i + 1;
144 t <<
"e_spectrum_e_" <<
i + 1;
156 edm::LogInfo(
"Calibration") <<
"[PhiSymmetryCalibration] At end of job";
160 TFile
f(
"Espectra_plus.root",
"recreate");
180 std::ofstream k_barl_out(
"k_barl.dat",
ios::out);
185 std::ofstream k_endc_out(
"k_endc.dat",
ios::out);
194 stringstream etsum_file_barl;
195 etsum_file_barl <<
"etsum_barl_" <<
eventSet_ <<
".dat";
197 std::ofstream etsum_barl_out(etsum_file_barl.str().c_str(),
ios::out);
207 etsum_barl_out.close();
209 stringstream etsum_file_endc;
210 etsum_file_endc <<
"etsum_endc_" <<
eventSet_ <<
".dat";
212 std::ofstream etsum_endc_out(etsum_file_endc.str().c_str(),
ios::out);
224 etsum_endc_out.close();
245 if (!barrelRecHitsHandle.
isValid()) {
246 LogError(
"") <<
"[PhiSymmetryCalibration] Error! Can't get product!" << std::endl;
250 if (!endcapRecHitsHandle.
isValid()) {
251 LogError(
"") <<
"[PhiSymmetryCalibration] Error! Can't get product!" << std::endl;
263 for (itb = barrelRecHitsHandle->
begin(); itb != barrelRecHitsHandle->
end(); itb++) {
266 float et = itb->energy() / cosh(
eta);
267 float e = itb->energy();
278 int sign =
hit.ieta() > 0 ? 1 : 0;
309 for (ite = endcapRecHitsHandle->
begin(); ite != endcapRecHitsHandle->
end(); ite++) {
314 float et = ite->energy() / cosh(
eta);
315 float e = ite->energy();
323 int sign =
hit.zside() > 0 ? 1 : 0;
328 double eCut_endc = 0;
332 eCut_endc =
ap_ + eta_ring *
b_;
336 float et_thr = eCut_endc / cosh(
eta) + 1.;
383 std::cout <<
"PHIREPRT : run " <<
run.run() <<
" start " << (
run.beginTime().value() >> 32) <<
" end "
384 << (
run.endTime().value() >> 32) <<
" dur "
385 << (
run.endTime().value() >> 32) - (
run.beginTime().value() >> 32)
402 std::vector<TGraph*> k_barl_graph(
kBarlRings);
403 std::vector<TCanvas*> k_barl_plot(
kBarlRings);
406 TF1 mypol1(
"mypol1",
"pol1");
411 epsilon_M_eb[imiscal] =
miscalEB_[imiscal] - 1.;
414 k_barl_graph[
ieta]->Fit(&mypol1);
417 t <<
"k_barl_" <<
ieta + 1;
418 k_barl_plot[
ieta] =
new TCanvas(
t.str().c_str(),
"");
419 k_barl_plot[
ieta]->SetFillColor(10);
420 k_barl_plot[
ieta]->SetGrid();
421 k_barl_graph[
ieta]->SetMarkerSize(1.);
422 k_barl_graph[
ieta]->SetMarkerColor(4);
423 k_barl_graph[
ieta]->SetMarkerStyle(20);
425 k_barl_graph[
ieta]->GetXaxis()->SetTitleSize(.05);
426 k_barl_graph[
ieta]->GetYaxis()->SetTitleSize(.05);
427 k_barl_graph[
ieta]->GetXaxis()->SetTitle(
"#epsilon_{M}");
428 k_barl_graph[
ieta]->GetYaxis()->SetTitle(
"#epsilon_{T}");
429 k_barl_graph[
ieta]->Draw(
"AP");
431 k_barl_[
ieta] = k_barl_graph[
ieta]->GetFunction(
"pol1")->GetParameter(1);
442 epsilon_M_ee[imiscal] =
miscalEE_[imiscal] - 1.;
445 k_endc_graph[
ring]->Fit(&mypol1);
448 t <<
"k_endc_" <<
ring + 1;
449 k_endc_plot[
ring] =
new TCanvas(
t.str().c_str(),
"");
450 k_endc_plot[
ring]->SetFillColor(10);
451 k_endc_plot[
ring]->SetGrid();
452 k_endc_graph[
ring]->SetMarkerSize(1.);
453 k_endc_graph[
ring]->SetMarkerColor(4);
454 k_endc_graph[
ring]->SetMarkerStyle(20);
456 k_endc_graph[
ring]->GetXaxis()->SetTitleSize(.05);
457 k_endc_graph[
ring]->GetYaxis()->SetTitleSize(.05);
458 k_endc_graph[
ring]->GetXaxis()->SetTitle(
"#epsilon_{M}");
459 k_endc_graph[
ring]->GetYaxis()->SetTitle(
"#epsilon_{T}");
460 k_endc_graph[
ring]->Draw(
"AP");
462 k_endc_[
ring] = k_endc_graph[
ring]->GetFunction(
"pol1")->GetParameter(1);
466 TFile
f(
"PhiSymmetryCalibration_kFactors.root",
"recreate");
468 k_barl_plot[
ieta]->Write();
469 delete k_barl_plot[
ieta];
470 delete k_barl_graph[
ieta];
473 k_endc_plot[
ring]->Write();
474 delete k_endc_plot[
ring];
475 delete k_endc_graph[
ring];
502 edm::LogError(
"PhiSym") <<
"Error reading XML files" << endl;
ret
prodAgent to be discontinued
static const int kBarlRings
PhiSymmetryCalibration(const edm::ParameterSet &iConfig)
Constructor.
std::vector< EcalRecHit >::const_iterator const_iterator
unsigned int nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Timestamp const & beginTime() const
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
double miscalEB_[kNMiscalBinsEB]
TimeValue_t value() const
bool goodCell_endc[kEndcWedgesX][kEndcWedgesX][kSides]
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
static const int kNMiscalBinsEE
std::vector< TH1F * > e_spectrum_e_histos
static const int kEndcWedgesY
GlobalPoint cellPos_[kEndcWedgesX][kEndcWedgesY]
std::string oldcalibfile_
double etaBoundary_[kEndcEtaRings+1]
void setup(const CaloGeometry *geometry, const EcalChannelStatus *chstatus, int statusThreshold)
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.
Timestamp const & endTime() const
double miscalEE_[kNMiscalBinsEE]
double k_barl_[kBarlRings]
static const float kMiscalRangeEE
const_iterator begin() const
void endRun(edm::Run const &, const edm::EventSetup &) override
int endcapRing_[kEndcWedgesX][kEndcWedgesY]
static const float kMiscalRangeEB
void beginJob() override
Called at beginning of job.
static const int kNMiscalBinsEB
~PhiSymmetryCalibration() override
Destructor.
const_iterator end() const
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
LuminosityBlockID id() const
void setUp(const edm::EventSetup &setup)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static const int kEndcEtaRings
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::vector< TH1F * > et_spectrum_b_histos
static const int kEndcWedgesX
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
std::vector< TH1F * > e_spectrum_b_histos
double etsum_endc_miscal_[kNMiscalBinsEE][kEndcEtaRings]
static const int kBarlWedges
Abs< T >::type abs(const T &t)
std::vector< TH1F * > et_spectrum_e_histos
std::string ecalHitsProducer_
double etsum_barl_miscal_[kNMiscalBinsEB][kBarlRings]
int nRing_[kEndcEtaRings]
double k_endc_[kEndcEtaRings]
std::string fullPath() const
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
int statusThreshold_
threshold in channel status beyond which channel is marked bad