31 : m_barrelAlCa(iConfig.getParameter<
edm::
InputTag>(
"barrelAlca")),
32 m_endcapAlCa(iConfig.getParameter<
edm::
InputTag>(
"endcapAlca")),
33 m_ElectronLabel(iConfig.getParameter<
edm::
InputTag>(
"ElectronLabel")),
34 m_recoWindowSidex(iConfig.getParameter<
int>(
"recoWindowSidex")),
35 m_recoWindowSidey(iConfig.getParameter<
int>(
"recoWindowSidey")),
36 m_minEnergyPerCrystal(iConfig.getParameter<double>(
"minEnergyPerCrystal")),
37 m_maxEnergyPerCrystal(iConfig.getParameter<double>(
"maxEnergyPerCrystal")),
38 m_etaStart(iConfig.getParameter<
int>(
"etaStart")),
39 m_etaEnd(iConfig.getParameter<
int>(
"etaEnd")),
40 m_etaWidth(iConfig.getParameter<
int>(
"etaWidth")),
41 m_maxSelectedNumPerRing(iConfig.getParameter<
int>(
"maxNumPerRing")),
42 m_minCoeff(iConfig.getParameter<double>(
"minCoeff")),
43 m_maxCoeff(iConfig.getParameter<double>(
"maxCoeff")),
44 m_usingBlockSolver(iConfig.getParameter<
int>(
"usingBlockSolver")),
45 m_startRing(iConfig.getParameter<
int>(
"startRing")),
46 m_endRing(iConfig.getParameter<
int>(
"endRing")),
47 m_EBcoeffFile(iConfig.getParameter<
std::
string>(
"EBcoeffs")),
48 m_EEcoeffFile(iConfig.getParameter<
std::
string>(
"EEcoeffs")),
49 m_EEZone(iConfig.getParameter<
int>(
"EEZone")) {
66 edm::LogInfo(
"IML") <<
"[InvRingCalib][ctor] Calib Block";
87 for (
int i = 0;
i < EEBlocks; ++
i) {
97 edm::LogInfo(
"IML") <<
" [InvRingCalib][ctor] end of creator";
114 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][Start] entering loop " << ciclo;
115 for (std::vector<VEcalCalibBlock*>::iterator calibBlock =
m_IMACalibBlocks.begin();
119 (*calibBlock)->reset();
136 edm::LogInfo(
"IML") <<
"[InvRingCalib] Event Setup read";
141 edm::LogInfo(
"IML") <<
"[InvRingCalib] Defining Barrel Regions";
144 edm::LogInfo(
"IML") <<
"[InvRingCalib] Defining endcap Rings";
147 edm::LogInfo(
"IML") <<
"[InvRingCalib] Defining endcap Regions";
167 edm::LogInfo(
"IML") <<
"[InvRingCalib] Initializing the coeffs";
170 TH2F EBRegion(
"EBRegion",
"EBRegion", 171, -85, 86, 360, 1, 361);
171 TH2F EBRing(
"EBRing",
"EBRing", 171, -85, 86, 360, 1, 361);
178 TH2F EEPRegion(
"EEPRegion",
"EEPRegion", 100, 1, 101, 100, 1, 101);
179 TH2F EEPRing(
"EEPRing",
"EEPRing", 100, 1, 101, 100, 1, 101);
180 TH2F EEPRingReg(
"EEPRingReg",
"EEPRingReg", 100, 1, 101, 100, 1, 101);
181 TH2F EEMRegion(
"EEMRegion",
"EEMRegion", 100, 1, 101, 100, 1, 101);
182 TH2F EEMRing(
"EEMRing",
"EEMRing", 100, 1, 101, 100, 1, 101);
183 TH2F EEMRingReg(
"EEMRingReg",
"EEMRingReg", 100, 1, 101, 100, 1, 101);
187 if (ee.
zside() > 0) {
192 if (ee.
zside() < 0) {
202 TFile
out(
"EBZone.root",
"recreate");
213 edm::LogInfo(
"IML") <<
"[InvRingCalib] Start to acquire the coeffs";
233 double pSubtract = 0.;
238 barrelHitsCollection = barrelRecHitsHandle.
product();
240 if (!barrelRecHitsHandle.
isValid()) {
241 edm::LogError(
"IML") <<
"[EcalEleCalibLooper] barrel rec hits not found";
248 endcapHitsCollection = endcapRecHitsHandle.
product();
250 if (!endcapRecHitsHandle.
isValid()) {
251 edm::LogError(
"IML") <<
"[EcalEleCalibLooper] endcap rec hits not found";
260 edm::LogError(
"IML") <<
"[EcalEleCalibLooper] electrons not found";
265 for (reco::GsfElectronCollection::const_iterator eleIt = pElectrons->begin(); eleIt != pElectrons->end(); ++eleIt) {
267 pTk = eleIt->trackMomentumAtVtx().R();
268 std::map<int, double> xtlMap;
271 Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(), barrelHitsCollection).
first;
273 Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(), endcapHitsCollection).
first;
277 eleIt->superCluster()->hitsAndFractions(),
Max, barrelHitsCollection, endcapHitsCollection, xtlMap, pSubtract);
280 pSubtract += eleIt->superCluster()->preshowerEnergy();
292 std::map<int, double> InterRings;
293 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfLoop] Start to invert the matrixes";
295 for (std::vector<VEcalCalibBlock*>::iterator calibBlock =
m_IMACalibBlocks.begin();
300 edm::LogInfo(
"IML") <<
"[InvRingLooper][endOfLoop] Starting to write the coeffs";
301 TH1F* coeffDistr =
new TH1F(
"coeffdistr",
"coeffdistr", 100, 0.7, 1.4);
302 TH1F*
coeffMap =
new TH1F(
"coeffRingMap",
"coeffRingMap", 250, -85, 165);
303 TH1F* ringDistr =
new TH1F(
"ringDistr",
"ringDistr", 250, -85, 165);
304 TH1F* RingFill =
new TH1F(
"RingFill",
"RingFill", 250, -85, 165);
306 ringDistr->Fill(it->second + 0.1);
309 std::map<int, int>
flag;
311 flag[it->second] = 0;
340 sprintf(
filename,
"coeff%d.root", iCounter);
362 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfJob] saving calib coeffs";
405 auto cellGeometry = endcapGeometry->
getGeometry(*endcapIt);
406 m_cellPos[endcapIt->rawId()] = cellGeometry->getPosition();
407 m_cellPhi[endcapIt->rawId()] = cellGeometry->getPosition().phi();
417 double etaBonduary[40];
418 etaBonduary[0] = 1.49;
419 etaBonduary[39] = 4.0;
421 etaBonduary[
ring] = (eta_ring[
ring] + eta_ring[
ring - 1]) / 2.;
427 if (fabs(
m_cellPos[endcapIt->rawId()].eta()) > etaBonduary[
ring] &&
428 fabs(
m_cellPos[endcapIt->rawId()].eta()) < etaBonduary[
ring + 1]) {
496 reg =
EERegId(endcapIt->rawId());
539 if (ieta < m_etaStart || ieta >=
m_etaEnd)