30 : m_barrelAlCa(iConfig.getParameter<
edm::
InputTag>(
"alcaBarrelHitCollection")),
31 m_endcapAlCa(iConfig.getParameter<
edm::
InputTag>(
"alcaEndcapHitCollection")),
32 m_ElectronLabel(iConfig.getParameter<
edm::
InputTag>(
"electronLabel")),
33 m_recoWindowSidex(iConfig.getParameter<
int>(
"recoWindowSidex")),
34 m_recoWindowSidey(iConfig.getParameter<
int>(
"recoWindowSidey")),
35 m_etaWidth(iConfig.getParameter<
int>(
"etaWidth")),
36 m_phiWidthEB(iConfig.getParameter<
int>(
"phiWidthEB")),
37 m_etaStart(etaShifter(iConfig.getParameter<
int>(
"etaStart"))),
38 m_etaEnd(etaShifter(iConfig.getParameter<
int>(
"etaEnd"))),
39 m_phiStartEB(iConfig.getParameter<
int>(
"phiStartEB")),
40 m_phiEndEB(iConfig.getParameter<
int>(
"phiEndEB")),
41 m_radStart(iConfig.getParameter<
int>(
"radStart")),
42 m_radEnd(iConfig.getParameter<
int>(
"radEnd")),
43 m_radWidth(iConfig.getParameter<
int>(
"radWidth")),
44 m_phiStartEE(iConfig.getParameter<
int>(
"phiStartEE")),
45 m_phiEndEE(iConfig.getParameter<
int>(
"phiEndEE")),
46 m_phiWidthEE(iConfig.getParameter<
int>(
"phiWidthEE")),
47 m_maxSelectedNumPerXtal(iConfig.getParameter<
int>(
"maxSelectedNumPerCrystal")),
48 m_minEnergyPerCrystal(iConfig.getParameter<double>(
"minEnergyPerCrystal")),
49 m_maxEnergyPerCrystal(iConfig.getParameter<double>(
"maxEnergyPerCrystal")),
50 m_minCoeff(iConfig.getParameter<double>(
"minCoeff")),
51 m_maxCoeff(iConfig.getParameter<double>(
"maxCoeff")),
52 m_usingBlockSolver(iConfig.getParameter<
int>(
"usingBlockSolver")),
53 m_loops(iConfig.getParameter<
int>(
"loops")),
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();
192 barrelHitsCollection = barrelRecHitsHandle.
product();
193 if (!barrelRecHitsHandle.
isValid()) {
194 edm::LogError(
"reading") <<
"[EcalEleCalibLooper] barrel rec hits not found";
202 endcapHitsCollection = endcapRecHitsHandle.
product();
203 if (!endcapRecHitsHandle.
isValid()) {
204 edm::LogError(
"reading") <<
"[EcalEleCalibLooper] endcap rec hits not found";
212 edm::LogError(
"reading") <<
"[EcalEleCalibLooper] electrons not found";
217 for (reco::GsfElectronCollection::const_iterator eleIt = pElectrons->begin(); eleIt != pElectrons->end(); ++eleIt) {
218 double pSubtract = 0;
220 std::map<int, double> xtlMap;
229 eleIt->superCluster()->hitsAndFractions(),
Max, barrelHitsCollection, endcapHitsCollection, xtlMap, pSubtract);
235 pTk = eleIt->trackMomentumAtVtx().R();
248 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfLoop] entering...";
249 for (std::vector<VEcalCalibBlock*>::iterator calibBlock =
m_EcalCalibBlocks.begin();
254 TH1F* EBcoeffEnd =
new TH1F(
"EBRegion",
"EBRegion", 100, 0.5, 2.1);
255 TH2F* EBcoeffMap =
new TH2F(
"EBcoeff",
"EBcoeff", 171, -85, 85, 360, 1, 361);
256 TH1F* EEPcoeffEnd =
new TH1F(
"EEPRegion",
"EEPRegion", 100, 0.5, 2.1);
257 TH1F* EEMcoeffEnd =
new TH1F(
"EEMRegion",
"EEMRegion", 100, 0.5, 2.1);
258 TH2F* EEPcoeffMap =
new TH2F(
"EEPcoeffMap",
"EEPcoeffMap", 101, 1, 101, 101, 0, 101);
259 TH2F* EEMcoeffMap =
new TH2F(
"EEMcoeffMap",
"EEMcoeffMap", 101, 1, 101, 101, 0, 101);
264 int index = barrelIt->rawId();
276 int index = endcapIt->rawId();
277 if (ee.
zside() > 0) {
290 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfLoop] End of endOfLoop";
293 sprintf(
filename,
"coeffs%d.root", iCounter);
297 EEPcoeffEnd->Write();
298 EEPcoeffMap->Write();
299 EEMcoeffEnd->Write();
300 EEMcoeffMap->Write();
319 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfJob] saving calib coeffs";
334 edm::LogInfo(
"IML") <<
"[InvMatrixCalibLooper][endOfJob] Exiting";
378 if (
phi >= 360 &&
phi < 720)
397 int regionNumEB = phiI + Nphi * etaI;
398 return (
int)regionNumEB;
410 double radius = (
ics - 50) * (
ics - 50) + (ips - 50) * (ips - 50);
413 double phi = atan2(static_cast<double>(ips - 50), static_cast<double>(
ics - 50));
419 int regionNumEE = phiI + Nphi * radI;
468 for (
int it = 0; it < 2 *
EEnum; ++it)
473 for (
int ips = 0; ips < 100; ++ips) {
504 double radius2 =
x *
x +
y *
y;
505 if (radius2 < 10 * 10)
507 if (radius2 > 50 * 50)
513 double phi = atan2(static_cast<double>(
y), static_cast<double>(
x));
double degrees(double radiants)
def degrees
~EcalEleCalibLooper() override
dtor
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.
std::vector< DetId > m_barrelCells
T getParameter(std::string const &) const
const int m_phiStartEB
phi start of the region of interest
const int m_usingBlockSolver
to exclude the blocksolver
const double m_maxCoeff
maximum coefficient accepted (RAW)
const int m_phiEndEB
phi end of the region of interest
const int m_phiWidthEB
eta size of the additive border to the sub-matrix
const edm::EDGetTokenT< EERecHitCollection > m_eeRecHitToken
const int m_recoWindowSidey
double giveLimit(int)
copes with the infinitives of the tangent
const int m_radStart
DS For the EE.
int EERegionId(const int, const int) const
Gives the id of the region.
int iphi() const
get the crystal iphi
std::vector< VEcalCalibBlock * > m_EcalCalibBlocks
single blocks calibrators
T const * product() const
void EERegionDefinition()
Status endOfLoop(const edm::EventSetup &, unsigned int iCounter) override
const int m_etaStart
phi size of the additive border to the sub-matrix
Log< level::Error, false > LogError
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
double getMaximum(TObjArray *array)
int ieta() const
get the crystal ieta
const int m_etaEnd
eta end of the region of interest
T getUntrackedParameter(std::string const &, T const &) const
int EBregionCheck(const int eta, const int phi) const
Tells if you are in the region to be calibrated.
double Mod(double phi)
autoexplaining
int etaShifter(const int) const
LP Change the coordinate system.
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int EEregionCheck(const int, const int) const
returns zero if the coordinates are in the right place.
std::vector< DetId > m_endcapCells
const double m_minEnergyPerCrystal
minimum energy per crystal cut
interface to the L3Univ class for testing
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
bool getData(T &iHolder) const
Status duringLoop(const edm::Event &, const edm::EventSetup &) override
EcalIntercalibConstantMap m_barrelMap
the maps of recalib coeffs
Log< level::Info, false > LogInfo
const int m_recoWindowSidex
reconstruction window size
std::map< int, int > m_xtalRegionId
void EBRegionDefinition()
DS EB Region Definition.
const edm::EDGetTokenT< EBRecHitCollection > m_ebRecHitToken
ED token.
const int m_etaWidth
eta size of the sub-matrix
constexpr uint32_t rawId() const
get the raw id
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
const edm::EDGetTokenT< reco::GsfElectronCollection > m_gsfElectronToken
std::map< int, int > m_xtalNumOfHits
std::vector< int > m_regions
int EBregionsNum() const
DS number of regions in EB.
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
ES token.
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
std::map< int, int > m_xtalPositionInRegion
void writeLine(EBDetId const &, float)
const int m_maxSelectedNumPerXtal
maximum number of events per crystal
const unsigned int m_loops
DS sets the number of loops to do.
void startingNewLoop(unsigned int) override
EcalIntercalibConstantMap m_endcapMap
int EEregionsNum() const
DS Number of regions in EE.
int EBRegionId(const int, const int) const
Reg Id generator EB --— for the barrel.
EcalEleCalibLooper(const edm::ParameterSet &)
ctor
double radiants(int degrees)
DS def radiants.
void beginOfJob() override
BeginOfJob.
const double m_maxEnergyPerCrystal
maximum energy per crystal cut
const double m_minCoeff
minimum coefficient accepted (RAW)