37 #include "boost/filesystem/operations.hpp"
61 ecalHitsProducer_(iConfig.getParameter<std::
string>(
"ecalRecHitsProducer")),
62 barrelHits_( iConfig.getParameter< std::
string > (
"barrelHitCollection")),
63 endcapHits_( iConfig.getParameter< std::
string > (
"endcapHitCollection")),
64 eCut_barl_( iConfig.getParameter< double > (
"eCut_barrel") ),
65 ap_( iConfig.getParameter<double> (
"ap") ),
66 b_( iConfig.getParameter<double> (
"b") ),
67 eventSet_( iConfig.getParameter< int > (
"eventSet") ),
68 statusThreshold_(iConfig.getUntrackedParameter<int>(
"statusThreshold",3)),
69 reiteration_(iConfig.getUntrackedParameter< bool > (
"reiteration",
false)),
70 oldcalibfile_(iConfig.getUntrackedParameter<std::
string>(
"oldcalibfile",
71 "EcalintercalibConstants.xml"))
119 for (
int sign=0; sign<
kSides; sign++) {
157 t <<
"et_spectrum_b_" <<
i+1;
161 t <<
"e_spectrum_b_" << i+1;
168 t <<
"et_spectrum_e_" <<
i+1;
172 t <<
"e_spectrum_e_" << i+1;
188 edm::LogInfo(
"Calibration") <<
"[PhiSymmetryCalibration] At end of job";
193 TFile
f(
"Espectra_plus.root",
"recreate");
216 std::ofstream k_barl_out(
"k_barl.dat",
ios::out);
218 k_barl_out << ieta <<
" " <<
k_barl_[ieta] << endl;
221 std::ofstream k_endc_out(
"k_endc.dat",
ios::out);
231 stringstream etsum_file_barl;
232 etsum_file_barl <<
"etsum_barl_"<<
eventSet_<<
".dat";
234 std::ofstream etsum_barl_out(etsum_file_barl.str().c_str(),
ios::out);
238 for (
int sign=0; sign<
kSides; sign++) {
239 etsum_barl_out << eventSet_ <<
" " << ieta <<
" " << iphi <<
" " << sign
245 etsum_barl_out.close();
247 stringstream etsum_file_endc;
248 etsum_file_endc <<
"etsum_endc_"<<eventSet_<<
".dat";
250 std::ofstream etsum_endc_out(etsum_file_endc.str().c_str(),
ios::out);
255 for (
int sign=0; sign<
kSides; sign++) {
256 etsum_endc_out << eventSet_ <<
" " << ix <<
" " << iy <<
" " << sign
264 etsum_endc_out.close();
288 if (!barrelRecHitsHandle.isValid()) {
289 LogError(
"") <<
"[PhiSymmetryCalibration] Error! Can't get product!" << std::endl;
293 if (!endcapRecHitsHandle.isValid()) {
294 LogError(
"") <<
"[PhiSymmetryCalibration] Error! Can't get product!" << std::endl;
309 for (itb=barrelRecHitsHandle->begin(); itb!=barrelRecHitsHandle->end(); itb++) {
311 float eta = barrelGeometry->getGeometry(hit)->getPosition().eta();
312 float et = itb->energy()/cosh(eta);
313 float e = itb->energy();
321 e = e * oldCalibs_[hit];
326 int sign = hit.
ieta()>0 ? 1 : 0;
357 for (ite=endcapRecHitsHandle->begin(); ite!=endcapRecHitsHandle->end(); ite++) {
359 float eta =
abs(endcapGeometry->getGeometry(hit)->getPosition().eta());
362 float et = ite->energy()/cosh(eta);
363 float e = ite->energy();
368 e = e * oldCalibs_[hit];
371 int sign = hit.
zside()>0 ? 1 : 0;
383 eCut_endc =
ap_ + eta_ring*
b_;
389 float et_thr = eCut_endc/cosh(eta) + 1.;
464 std::vector<TGraph*> k_barl_graph(
kBarlRings);
465 std::vector<TCanvas*> k_barl_plot(
kBarlRings);
469 int middlebin = int (kNMiscalBinsEB/2);
471 epsilon_M_eb[imiscal] =
miscalEB_[imiscal] - 1.;
473 k_barl_graph[ieta] =
new TGraph (kNMiscalBinsEB,epsilon_M_eb,epsilon_T_eb);
474 k_barl_graph[ieta]->Fit(
"pol1");
478 t<<
"k_barl_" << ieta+1;
479 k_barl_plot[ieta] =
new TCanvas(t.str().c_str(),
"");
480 k_barl_plot[ieta]->SetFillColor(10);
481 k_barl_plot[ieta]->SetGrid();
482 k_barl_graph[ieta]->SetMarkerSize(1.);
483 k_barl_graph[ieta]->SetMarkerColor(4);
484 k_barl_graph[ieta]->SetMarkerStyle(20);
486 k_barl_graph[ieta]->GetXaxis()->SetTitleSize(.05);
487 k_barl_graph[ieta]->GetYaxis()->SetTitleSize(.05);
488 k_barl_graph[ieta]->GetXaxis()->SetTitle(
"#epsilon_{M}");
489 k_barl_graph[ieta]->GetYaxis()->SetTitle(
"#epsilon_{T}");
490 k_barl_graph[ieta]->Draw(
"AP");
492 k_barl_[ieta] = k_barl_graph[ieta]->GetFunction(
"pol1")->GetParameter(1);
502 int middlebin = int (kNMiscalBinsEE/2);
504 epsilon_M_ee[imiscal] =
miscalEE_[imiscal] - 1.;
506 k_endc_graph[
ring] =
new TGraph (kNMiscalBinsEE,epsilon_M_ee,epsilon_T_ee);
507 k_endc_graph[
ring]->Fit(
"pol1");
510 t<<
"k_endc_"<<
ring+1;
511 k_endc_plot[
ring] =
new TCanvas(t.str().c_str(),
"");
512 k_endc_plot[
ring]->SetFillColor(10);
513 k_endc_plot[
ring]->SetGrid();
514 k_endc_graph[
ring]->SetMarkerSize(1.);
515 k_endc_graph[
ring]->SetMarkerColor(4);
516 k_endc_graph[
ring]->SetMarkerStyle(20);
518 k_endc_graph[
ring]->GetXaxis()->SetTitleSize(.05);
519 k_endc_graph[
ring]->GetYaxis()->SetTitleSize(.05);
520 k_endc_graph[
ring]->GetXaxis()->SetTitle(
"#epsilon_{M}");
521 k_endc_graph[
ring]->GetYaxis()->SetTitle(
"#epsilon_{T}");
522 k_endc_graph[
ring]->Draw(
"AP");
524 k_endc_[
ring] = k_endc_graph[
ring]->GetFunction(
"pol1")->GetParameter(1);
528 TFile
f(
"PhiSymmetryCalibration_kFactors.root",
"recreate");
530 k_barl_plot[ieta]->Write();
531 delete k_barl_plot[ieta];
532 delete k_barl_graph[ieta];
535 k_endc_plot[
ring]->Write();
536 delete k_endc_plot[
ring];
537 delete k_endc_graph[
ring];
576 if (ret)
edm::LogError(
"PhiSym")<<
"Error reading XML files"<<endl;;
LuminosityBlockID id() const
static const float kMiscalRangeEB
static const int kNMiscalBinsEB
virtual void endRun(edm::Run &, const edm::EventSetup &)
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
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Called at each event.
int iphi() const
get the crystal iphi
static const int kBarlWedges
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
std::string ecalHitsProducer_
Timestamp const & endTime() const
double etsum_barl_miscal_[kNMiscalBinsEB][kBarlRings]
double k_endc_[kEndcEtaRings]
Abs< T >::type abs(const T &t)
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
int statusThreshold_
threshold in channel status beyond which channel is marked bad
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
unsigned int nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
int ieta() const
get the crystal ieta
PhiSymmetryCalibration(const edm::ParameterSet &iConfig)
Constructor.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
~PhiSymmetryCalibration()
Destructor.
virtual void beginJob()
Called at beginning of job.
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
double miscalEB_[kNMiscalBinsEB]
Timestamp const & beginTime() const
return(e1-e2)*(e1-e2)+dp *dp
std::vector< TH1F * > e_spectrum_e_histos
static const int kNMiscalBinsEE
double k_barl_[kBarlRings]
std::string oldcalibfile_
volatile std::atomic< bool > shutdown_flag false
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
std::string fullPath() const
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
double miscalEE_[kNMiscalBinsEE]
static const float kMiscalRangeEE
virtual void endJob()
Called at end of job.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
TimeValue_t value() const
bool goodCell_endc[kEndcWedgesX][kEndcWedgesX][kSides]
double etaBoundary_[kEndcEtaRings+1]
static const int kEndcWedgesY