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";
100 if (algorithm ==
"IMA")
102 else if (algorithm ==
"L3")
105 edm::LogError(
"building") << algorithm <<
" is not a valid calibration algorithm";
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);
296 TFile zout(filename,
"recreate");
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);
413 radius =
sqrt(radius);
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));
T getParameter(std::string const &) const
double degrees(double radiants)
def degrees
T getUntrackedParameter(std::string const &, T const &) const
~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
double giveLimit(int)
copes with the infinitives of the tangent
int EEregionsNum() const
DS Number of regions in EE.
std::vector< VEcalCalibBlock * > m_EcalCalibBlocks
single blocks calibrators
edm::InputTag m_endcapAlCa
EcalEndcap Input Collection name.
constexpr uint32_t rawId() const
get the raw id
void EERegionDefinition()
Status endOfLoop(const edm::EventSetup &, unsigned int iCounter) override
unsigned int m_loops
DS sets the number of loops to do.
int EBregionCheck(const int eta, const int phi) const
Tells if you are in the region to be calibrated.
int iphi() const
get the crystal iphi
double Mod(double phi)
autoexplaining
int m_phiWidthEB
eta size of the additive border to the sub-matrix
int m_maxSelectedNumPerXtal
maximum number of events per crystal
double m_minEnergyPerCrystal
minimum energy per crystal cut
double m_maxCoeff
maximum coefficient accepted (RAW)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::vector< DetId > m_endcapCells
interface to the L3Univ class for testing
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
int m_usingBlockSolver
to exclude the blocksolver
int m_radStart
DS For the EE.
int ieta() const
get the crystal ieta
edm::InputTag m_ElectronLabel
To take the electrons.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Status duringLoop(const edm::Event &, const edm::EventSetup &) override
int m_etaStart
phi size of the additive border to the sub-matrix
EcalIntercalibConstantMap m_barrelMap
the maps of recalib coeffs
int EEregionCheck(const int, const int) const
returns zero if the coordinates are in the right place.
int m_recoWindowSidex
reconstruction window size
std::map< int, int > m_xtalRegionId
void EBRegionDefinition()
DS EB Region Definition.
T const * product() const
int EERegionId(const int, const int) const
Gives the id of the region.
double m_minCoeff
minimum coefficient accepted (RAW)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
int m_etaWidth
eta size of the sub-matrix
std::map< int, int > m_xtalNumOfHits
std::vector< int > m_regions
int etaShifter(const int) const
LP Change the coordinate system.
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
int m_phiEndEB
phi end of the region of interest
std::map< int, int > m_xtalPositionInRegion
void writeLine(EBDetId const &, float)
int m_phiStartEB
phi start of the region of interest
void startingNewLoop(unsigned int) override
EcalIntercalibConstantMap m_endcapMap
edm::InputTag m_barrelAlCa
EcalBarrel Input Collection name.
EcalEleCalibLooper(const edm::ParameterSet &)
ctor
double radiants(int degrees)
DS def radiants.
int m_etaEnd
eta end of the region of interest
int EBRegionId(const int, const int) const
Reg Id generator EB --— for the barrel.
void beginOfJob() override
BeginOfJob.
int EBregionsNum() const
DS number of regions in EB.
double m_maxEnergyPerCrystal
maximum energy per crystal cut