27 : m_barrelAlCa(iConfig.getParameter<edm::
InputTag>(
"barrelAlca")),
28 m_endcapAlCa(iConfig.getParameter<edm::
InputTag>(
"endcapAlca")),
29 m_ElectronLabel(iConfig.getParameter<edm::
InputTag>(
"ElectronLabel")),
30 m_recoWindowSidex(iConfig.getParameter<int>(
"recoWindowSidex")),
31 m_recoWindowSidey(iConfig.getParameter<int>(
"recoWindowSidey")),
32 m_minEnergyPerCrystal(iConfig.getParameter<double>(
"minEnergyPerCrystal")),
33 m_maxEnergyPerCrystal(iConfig.getParameter<double>(
"maxEnergyPerCrystal")),
34 m_etaStart(iConfig.getParameter<int>(
"etaStart")),
35 m_etaEnd(iConfig.getParameter<int>(
"etaEnd")),
36 m_etaWidth(iConfig.getParameter<int>(
"etaWidth")),
37 m_maxSelectedNumPerRing(iConfig.getParameter<int>(
"maxNumPerRing")),
38 m_minCoeff(iConfig.getParameter<double>(
"minCoeff")),
39 m_maxCoeff(iConfig.getParameter<double>(
"maxCoeff")),
40 m_usingBlockSolver(iConfig.getParameter<int>(
"usingBlockSolver")),
41 m_startRing(iConfig.getParameter<int>(
"startRing")),
42 m_endRing(iConfig.getParameter<int>(
"endRing")),
43 m_EBcoeffFile(iConfig.getParameter<std::
string>(
"EBcoeffs")),
44 m_EEcoeffFile(iConfig.getParameter<std::
string>(
"EEcoeffs")),
45 m_EEZone(iConfig.getParameter<int>(
"EEZone")),
56 assert(m_etaStart >= -85 && m_etaStart <= 86);
66 edm::LogInfo(
"IML") <<
"[InvRingCalib][ctor] Calib Block";
72 if (algorithm ==
"IMA")
74 else if (algorithm ==
"L3")
77 edm::LogError(
"building") << algorithm <<
" is not a valid calibration algorithm";
87 for (
int i = 0;
i < EEBlocks; ++
i) {
88 if (algorithm ==
"IMA")
90 else if (algorithm ==
"L3")
93 edm::LogError(
"building") << algorithm <<
" is not a valid calibration algorithm";
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();
134 edm::LogInfo(
"IML") <<
"[InvRingCalib] Event Setup read";
139 edm::LogInfo(
"IML") <<
"[InvRingCalib] Defining Barrel Regions";
142 edm::LogInfo(
"IML") <<
"[InvRingCalib] Defining endcap Rings";
145 edm::LogInfo(
"IML") <<
"[InvRingCalib] Defining endcap Regions";
165 edm::LogInfo(
"IML") <<
"[InvRingCalib] Initializing the coeffs";
168 TH2F EBRegion(
"EBRegion",
"EBRegion", 171, -85, 86, 360, 1, 361);
169 TH2F EBRing(
"EBRing",
"EBRing", 171, -85, 86, 360, 1, 361);
176 TH2F EEPRegion(
"EEPRegion",
"EEPRegion", 100, 1, 101, 100, 1, 101);
177 TH2F EEPRing(
"EEPRing",
"EEPRing", 100, 1, 101, 100, 1, 101);
178 TH2F EEPRingReg(
"EEPRingReg",
"EEPRingReg", 100, 1, 101, 100, 1, 101);
179 TH2F EEMRegion(
"EEMRegion",
"EEMRegion", 100, 1, 101, 100, 1, 101);
180 TH2F EEMRing(
"EEMRing",
"EEMRing", 100, 1, 101, 100, 1, 101);
181 TH2F EEMRingReg(
"EEMRingReg",
"EEMRingReg", 100, 1, 101, 100, 1, 101);
185 if (ee.
zside() > 0) {
190 if (ee.
zside() < 0) {
200 TFile
out(
"EBZone.root",
"recreate");
211 edm::LogInfo(
"IML") <<
"[InvRingCalib] Start to acquire the coeffs";
231 double pSubtract = 0.;
236 barrelHitsCollection = barrelRecHitsHandle.
product();
238 if (!barrelRecHitsHandle.
isValid()) {
239 edm::LogError(
"IML") <<
"[EcalEleCalibLooper] barrel rec hits not found";
247 endcapHitsCollection = endcapRecHitsHandle.
product();
249 if (!endcapRecHitsHandle.
isValid()) {
250 edm::LogError(
"IML") <<
"[EcalEleCalibLooper] endcap rec hits not found";
259 edm::LogError(
"IML") <<
"[EcalEleCalibLooper] electrons not found";
264 for (reco::GsfElectronCollection::const_iterator eleIt = pElectrons->begin(); eleIt != pElectrons->end(); ++eleIt) {
266 pTk = eleIt->trackMomentumAtVtx().R();
267 std::map<int, double> xtlMap;
270 Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(), barrelHitsCollection).
first;
272 Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(), endcapHitsCollection).
first;
276 eleIt->superCluster()->hitsAndFractions(),
Max, barrelHitsCollection, endcapHitsCollection, xtlMap, pSubtract);
279 pSubtract += eleIt->superCluster()->preshowerEnergy();
291 std::map<int, double> InterRings;
292 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfLoop] Start to invert the matrixes";
294 for (std::vector<VEcalCalibBlock*>::iterator calibBlock =
m_IMACalibBlocks.begin();
299 edm::LogInfo(
"IML") <<
"[InvRingLooper][endOfLoop] Starting to write the coeffs";
300 TH1F* coeffDistr =
new TH1F(
"coeffdistr",
"coeffdistr", 100, 0.7, 1.4);
301 TH1F*
coeffMap =
new TH1F(
"coeffRingMap",
"coeffRingMap", 250, -85, 165);
302 TH1F* ringDistr =
new TH1F(
"ringDistr",
"ringDistr", 250, -85, 165);
303 TH1F* RingFill =
new TH1F(
"RingFill",
"RingFill", 250, -85, 165);
305 ringDistr->Fill(it->second + 0.1);
308 std::map<int, int> flag;
310 flag[it->second] = 0;
321 coeffMap->Fill(m_xtalRing[ID] + 0.1, InterRings[m_xtalRing[ID]]);
322 coeffDistr->Fill(InterRings[m_xtalRing[ID]]);
334 coeffMap->Fill(m_xtalRing[ID], InterRings[m_xtalRing[ID]]);
335 coeffDistr->Fill(InterRings[m_xtalRing[ID]]);
339 sprintf(filename,
"coeff%d.root", iCounter);
340 TFile
out(filename,
"recreate");
361 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfJob] saving calib coeffs";
400 auto cellGeometry = endcapGeometry->
getGeometry(*endcapIt);
401 m_cellPos[endcapIt->rawId()] = cellGeometry->getPosition();
402 m_cellPhi[endcapIt->rawId()] = cellGeometry->getPosition().phi();
412 double etaBonduary[40];
413 etaBonduary[0] = 1.49;
414 etaBonduary[39] = 4.0;
416 etaBonduary[
ring] = (eta_ring[
ring] + eta_ring[
ring - 1]) / 2.;
422 if (fabs(
m_cellPos[endcapIt->rawId()].eta()) > etaBonduary[
ring] &&
423 fabs(
m_cellPos[endcapIt->rawId()].eta()) < etaBonduary[
ring + 1]) {
491 reg =
EERegId(endcapIt->rawId());
534 if (ieta < m_etaStart || ieta >=
m_etaEnd)
537 return (
m_Reg[ieta]);
T getUntrackedParameter(std::string const &, T const &) const
virtual void fillMap(const std::vector< std::pair< DetId, float > > &, const DetId, const EcalRecHitCollection *, const EcalRecHitCollection *, std::map< int, double > &xtlMap, double &)=0
The Map filler.
const double m_maxEnergyPerCrystal
maximum energy per crystal cut
const int m_etaWidth
eta size of the regions
void startingNewLoop(unsigned int) override
startingNewLoop
const edm::EDGetTokenT< EBRecHitCollection > m_ebRecHitToken
ED token.
void EERingDef(const edm::EventSetup &)
Defines the rins in the endcap.
std::map< int, int > m_xtalRegionId
association map between raw detIds and Region
int EBRegionNum() const
Number of regions in EB.
void EBRegionDef()
Defines the regions in the barrel.
uint16_t *__restrict__ id
const int m_usingBlockSolver
to exclude the blocksolver
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const self & getMap() const
const int m_startRing
LP define the EE region to calibrate.
InvRingCalib(const edm::ParameterSet &)
ctor
const int m_EEZone
endcap zone to be calibrated
constexpr uint32_t rawId() const
get the raw id
bool parseXMLMiscalibFile(std::string configFile)
EcalIntercalibConstantMap m_endcapMap
void EERegionDef()
Defines the regions in the endcap.
void beginOfJob() override
BeginOfJob.
std::vector< VEcalCalibBlock * > m_IMACalibBlocks
single blocks calibrators
Status duringLoop(const edm::Event &, const edm::EventSetup &) override
duringLoop
int EERegId(int)
gives back in which region of the endcap you are.
Log< level::Error, false > LogError
Status endOfLoop(const edm::EventSetup &, unsigned int iCounter) override
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
const double m_maxCoeff
maximum coefficient accepted (RAW)
const edm::EDGetTokenT< reco::GsfElectronCollection > m_gsfElectronToken
const double m_minCoeff
minimum coefficient accepted (RAW)
int iphi() const
get the crystal iphi
EcalIntercalibConstantMap m_barrelMap
bool getData(T &iHolder) const
std::map< int, GlobalPoint > m_cellPos
position of the cell, borders, coords etc...
const int m_recoWindowSidey
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
ES token.
VFillMap * m_MapFiller
The class that fills the map!
const EcalIntercalibConstants & get()
const int m_etaEnd
eta end of the zone of interest
std::map< int, int > m_Reg
EB regions vs. eta index.
std::vector< DetId > m_barrelCells
geometry things used all over the file
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
const int m_etaStart
eta start of the zone of interest
std::map< int, int > m_RinginRegion
association map between raw detIds and the number of the ring inside the region
interface to the L3Univ class for testing
~InvRingCalib() override
dtor
Abs< T >::type abs(const T &t)
void RegPrepare()
Prepares the EB regions;.
int ieta() const
get the crystal ieta
unsigned int m_loops
LP sets the number of loops to do.
std::map< int, int > m_xtalRing
association map between Raw detIds and Rings
for(Iditer=Id.begin();Iditer!=Id.end();Iditer++)
Log< level::Info, false > LogInfo
T const * product() const
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 bool validDetId(int crystal_ix, int crystal_iy, int iz)
T getParameter(std::string const &) const
const edm::EDGetTokenT< EERecHitCollection > m_eeRecHitToken
const double m_minEnergyPerCrystal
minimum energy per crystal cut
const int m_recoWindowSidex
reconstruction window size
std::map< int, CalibCoeff > coeffMap
void writeLine(EBDetId const &, float)
std::map< int, int > m_cellPhi
const std::string m_EEcoeffFile
const std::string m_EBcoeffFile
coeffs filenames
std::vector< DetId > m_endcapCells
std::map< int, int > m_RingNumOfHits
number of events already read per Ring
std::string m_mapFillerType
int EBRegId(const int)
Gives back in which region you are:
int EERegionNum() const
The number of regions in EE.