34 : m_barrelAlCa(iConfig.getParameter<
edm::
InputTag>(
"alcaBarrelHitCollection")),
35 m_endcapAlCa(iConfig.getParameter<
edm::
InputTag>(
"alcaEndcapHitCollection")),
36 m_recoWindowSidex(iConfig.getParameter<
int>(
"recoWindowSidex")),
37 m_recoWindowSidey(iConfig.getParameter<
int>(
"recoWindowSidey")),
38 m_etaWidth(iConfig.getParameter<
int>(
"etaWidth")),
39 m_phiWidthEB(iConfig.getParameter<
int>(
"phiWidthEB")),
40 m_etaStart(etaShifter(iConfig.getParameter<
int>(
"etaStart"))),
41 m_etaEnd(etaShifter(iConfig.getParameter<
int>(
"etaEnd"))),
42 m_phiStartEB(iConfig.getParameter<
int>(
"phiStartEB")),
43 m_phiEndEB(iConfig.getParameter<
int>(
"phiEndEB")),
44 m_radStart(iConfig.getParameter<
int>(
"radStart")),
45 m_radEnd(iConfig.getParameter<
int>(
"radEnd")),
46 m_radWidth(iConfig.getParameter<
int>(
"radWidth")),
47 m_phiStartEE(iConfig.getParameter<
int>(
"phiStartEE")),
48 m_phiEndEE(iConfig.getParameter<
int>(
"phiEndEE")),
49 m_phiWidthEE(iConfig.getParameter<
int>(
"phiWidthEE")),
50 m_maxSelectedNumPerXtal(iConfig.getParameter<
int>(
"maxSelectedNumPerCrystal")),
51 m_minEnergyPerCrystal(iConfig.getParameter<double>(
"minEnergyPerCrystal")),
52 m_maxEnergyPerCrystal(iConfig.getParameter<double>(
"maxEnergyPerCrystal")),
53 m_minCoeff(iConfig.getParameter<double>(
"minCoeff")),
54 m_maxCoeff(iConfig.getParameter<double>(
"maxCoeff")),
55 m_usingBlockSolver(iConfig.getParameter<
int>(
"usingBlockSolver")),
56 m_loops(iConfig.getParameter<
int>(
"loops")),
57 m_ElectronLabel(iConfig.getParameter<
edm::
InputTag>(
"electronLabel")) {
58 edm::LogInfo(
"IML") <<
"[EcalEleCalibLooper][ctor] asserts";
66 edm::LogInfo(
"IML") <<
"[EcalEleCalibLooper][ctor] entering ";
67 edm::LogInfo(
"IML") <<
"[EcalEleCalibLooper][ctor] region definition";
71 TH2F* EBRegion =
new TH2F(
"EBRegion",
"EBRegion", 170, 0, 170, 360, 0, 360);
76 TH2F* EERegion =
new TH2F(
"EERegion",
"EERegion", 100, 0, 100, 100, 0, 100);
77 for (
int x = 0;
x < 100; ++
x)
78 for (
int y = 0;
y < 100; ++
y) {
83 TFile
out(
"EBZone.root",
"recreate");
94 edm::LogInfo(
"IML") <<
"[EcalEleCalibLooper][ctor] Calib Block";
110 if (mapFiller ==
"Cluster")
119 if (mapFiller ==
"Matrix")
135 for (std::vector<VEcalCalibBlock*>::iterator calibBlock =
m_EcalCalibBlocks.begin();
138 delete (*calibBlock);
151 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][Start] entering loop " << ciclo;
153 for (std::vector<VEcalCalibBlock*>::iterator calibBlock =
m_EcalCalibBlocks.begin();
156 (*calibBlock)->reset();
194 barrelHitsCollection = barrelRecHitsHandle.
product();
195 if (!barrelRecHitsHandle.
isValid()) {
196 edm::LogError(
"reading") <<
"[EcalEleCalibLooper] barrel rec hits not found";
204 endcapHitsCollection = endcapRecHitsHandle.
product();
205 if (!endcapRecHitsHandle.
isValid()) {
206 edm::LogError(
"reading") <<
"[EcalEleCalibLooper] endcap rec hits not found";
214 edm::LogError(
"reading") <<
"[EcalEleCalibLooper] electrons not found";
219 for (reco::GsfElectronCollection::const_iterator eleIt = pElectrons->begin(); eleIt != pElectrons->end(); ++eleIt) {
220 double pSubtract = 0;
222 std::map<int, double> xtlMap;
225 Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(), barrelHitsCollection).
first;
227 Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(), endcapHitsCollection).
first;
231 eleIt->superCluster()->hitsAndFractions(),
Max, barrelHitsCollection, endcapHitsCollection, xtlMap, pSubtract);
237 pTk = eleIt->trackMomentumAtVtx().R();
250 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfLoop] entering...";
251 for (std::vector<VEcalCalibBlock*>::iterator calibBlock =
m_EcalCalibBlocks.begin();
256 TH1F* EBcoeffEnd =
new TH1F(
"EBRegion",
"EBRegion", 100, 0.5, 2.1);
257 TH2F* EBcoeffMap =
new TH2F(
"EBcoeff",
"EBcoeff", 171, -85, 85, 360, 1, 361);
258 TH1F* EEPcoeffEnd =
new TH1F(
"EEPRegion",
"EEPRegion", 100, 0.5, 2.1);
259 TH1F* EEMcoeffEnd =
new TH1F(
"EEMRegion",
"EEMRegion", 100, 0.5, 2.1);
260 TH2F* EEPcoeffMap =
new TH2F(
"EEPcoeffMap",
"EEPcoeffMap", 101, 1, 101, 101, 0, 101);
261 TH2F* EEMcoeffMap =
new TH2F(
"EEMcoeffMap",
"EEMcoeffMap", 101, 1, 101, 101, 0, 101);
266 int index = barrelIt->rawId();
278 int index = endcapIt->rawId();
279 if (ee.
zside() > 0) {
292 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfLoop] End of endOfLoop";
295 sprintf(
filename,
"coeffs%d.root", iCounter);
299 EEPcoeffEnd->Write();
300 EEPcoeffMap->Write();
301 EEMcoeffEnd->Write();
302 EEMcoeffMap->Write();
321 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfJob] saving calib coeffs";
336 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfJob] Exiting";
380 if (
phi >= 360 &&
phi < 720)
399 int regionNumEB = phiI + Nphi * etaI;
400 return (
int)regionNumEB;
412 double radius = (
ics - 50) * (
ics - 50) + (ips - 50) * (ips - 50);
415 double phi = atan2(static_cast<double>(ips - 50), static_cast<double>(
ics - 50));
421 int regionNumEE = phiI + Nphi * radI;
470 for (
int it = 0; it < 2 *
EEnum; ++it)
475 for (
int ips = 0; ips < 100; ++ips) {
506 double radius2 =
x *
x +
y *
y;
507 if (radius2 < 10 * 10)
509 if (radius2 > 50 * 50)
515 double phi = atan2(static_cast<double>(
y), static_cast<double>(
x));