37 m_barrelAlCa (iConfig.getParameter<edm::InputTag> (
"alcaBarrelHitCollection")) ,
38 m_endcapAlCa (iConfig.getParameter<edm::InputTag> (
"alcaEndcapHitCollection")) ,
39 m_recoWindowSidex (iConfig.getParameter<int> (
"recoWindowSidex")) ,
40 m_recoWindowSidey (iConfig.getParameter<int> (
"recoWindowSidey")) ,
41 m_etaWidth (iConfig.getParameter<int> (
"etaWidth")) ,
42 m_phiWidthEB (iConfig.getParameter<int> (
"phiWidthEB")) ,
43 m_etaStart (etaShifter (iConfig.getParameter<int> (
"etaStart"))) ,
44 m_etaEnd (etaShifter (iConfig.getParameter<int> (
"etaEnd"))) ,
45 m_phiStartEB (iConfig.getParameter<int> (
"phiStartEB")) ,
46 m_phiEndEB (iConfig.getParameter<int> (
"phiEndEB")),
47 m_radStart (iConfig.getParameter<int> (
"radStart")) ,
48 m_radEnd (iConfig.getParameter<int> (
"radEnd")) ,
49 m_radWidth (iConfig.getParameter<int> (
"radWidth")) ,
50 m_phiStartEE (iConfig.getParameter<int> (
"phiStartEE")) ,
51 m_phiEndEE (iConfig.getParameter<int> (
"phiEndEE")) ,
52 m_phiWidthEE (iConfig.getParameter<int> (
"phiWidthEE")) ,
53 m_maxSelectedNumPerXtal (iConfig.getParameter<int> (
"maxSelectedNumPerCrystal")) ,
54 m_minEnergyPerCrystal (iConfig.getParameter<double> (
"minEnergyPerCrystal")),
55 m_maxEnergyPerCrystal (iConfig.getParameter<double> (
"maxEnergyPerCrystal")) ,
56 m_minCoeff (iConfig.getParameter<double> (
"minCoeff")) ,
57 m_maxCoeff (iConfig.getParameter<double> (
"maxCoeff")) ,
58 m_usingBlockSolver (iConfig.getParameter<int> (
"usingBlockSolver")) ,
59 m_loops (iConfig.getParameter<int> (
"loops")),
60 m_ElectronLabel (iConfig.getParameter<edm::InputTag> (
"electronLabel"))
62 edm::LogInfo (
"IML") <<
"[EcalEleCalibLooper][ctor] asserts" ;
70 edm::LogInfo (
"IML") <<
"[EcalEleCalibLooper][ctor] entering " ;
71 edm::LogInfo (
"IML") <<
"[EcalEleCalibLooper][ctor] region definition" ;
75 TH2F * EBRegion =
new TH2F (
"EBRegion",
"EBRegion",170,0,170,360,0,360) ;
80 TH2F * EERegion =
new TH2F (
"EERegion",
"EERegion",100,0,100,100,0,100);
81 for (
int x = 0;
x<100; ++
x)
82 for (
int y = 0;
y<100;++
y){
87 TFile
out (
"EBZone.root",
"recreate");
98 edm::LogInfo (
"IML") <<
"[EcalEleCalibLooper][ctor] Calib Block" ;
103 for (
int region = 0 ;
107 if (algorithm ==
"IMA")
111 else if (algorithm ==
"L3")
118 <<
" is not a valid calibration algorithm" ;
145 for (std::vector<VEcalCalibBlock *>::iterator calibBlock =
m_EcalCalibBlocks.begin () ;
148 delete (*calibBlock) ;
172 edm::LogInfo (
"IML") <<
"[InvMatrixCalibLooper][Start] entering loop " << ciclo;
176 for (std::vector<VEcalCalibBlock *>::iterator calibBlock =
m_EcalCalibBlocks.begin () ;
179 (*calibBlock)->reset ();
207 for (std::vector<DetId>::const_iterator barrelIt=
m_barrelCells.begin();
212 for (std::vector<DetId>::const_iterator endcapIt=
m_endcapCells.begin();
227 barrelHitsCollection = barrelRecHitsHandle.
product () ;
228 if (!barrelRecHitsHandle.
isValid ()) {
229 edm::LogError (
"reading") <<
"[EcalEleCalibLooper] barrel rec hits not found" ;
237 endcapHitsCollection = endcapRecHitsHandle.
product () ;
238 if (!endcapRecHitsHandle.
isValid ()) {
239 edm::LogError (
"reading") <<
"[EcalEleCalibLooper] endcap rec hits not found" ;
247 edm::LogError (
"reading")<<
"[EcalEleCalibLooper] electrons not found" ;
252 for (reco::GsfElectronCollection::const_iterator eleIt = pElectrons->begin ();
253 eleIt != pElectrons->end ();
256 double pSubtract = 0 ;
258 std::map<int , double> xtlMap;
260 if (fabs(eleIt->eta()<1.49))
261 Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(),barrelHitsCollection).
first;
263 Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(),endcapHitsCollection).
first;
264 if (Max.
det()==0)
continue;
266 barrelHitsCollection,endcapHitsCollection, xtlMap,pSubtract);
271 pTk = eleIt->trackMomentumAtVtx ().R ();
273 xtlMap.end (),pTk,pSubtract) ;
288 edm::LogInfo (
"IML") <<
"[InvMatrixCalibLooper][endOfLoop] entering..." ;
289 for (std::vector<VEcalCalibBlock *>::iterator calibBlock =
m_EcalCalibBlocks.begin ();
294 TH1F * EBcoeffEnd =
new TH1F (
"EBRegion",
"EBRegion",100,0.5,2.1) ;
295 TH2F * EBcoeffMap =
new TH2F (
"EBcoeff",
"EBcoeff",171,-85,85,360,1,361);
296 TH1F * EEPcoeffEnd =
new TH1F (
"EEPRegion",
"EEPRegion",100,0.5,2.1);
297 TH1F * EEMcoeffEnd =
new TH1F (
"EEMRegion",
"EEMRegion",100,0.5,2.1);
298 TH2F * EEPcoeffMap =
new TH2F (
"EEPcoeffMap",
"EEPcoeffMap",101,1,101,101,0,101);
299 TH2F * EEMcoeffMap =
new TH2F (
"EEMcoeffMap",
"EEMcoeffMap",101,1,101,101,0,101);
301 for (std::vector<DetId>::const_iterator barrelIt=
m_barrelCells.begin();
305 int index= barrelIt->rawId();
314 for(std::vector<DetId>::const_iterator endcapIt=
m_endcapCells.begin();
318 int index =endcapIt->rawId();
336 edm::LogInfo (
"IML") <<
"[InvMatrixCalibLooper][endOfLoop] End of endOfLoop" ;
339 sprintf(filename,
"coeffs%d.root",iCounter);
340 TFile zout (filename,
"recreate");
341 EBcoeffEnd->Write () ;
342 EBcoeffMap->Write () ;
343 EEPcoeffEnd->Write () ;
344 EEPcoeffMap->Write () ;
345 EEMcoeffEnd->Write () ;
346 EEMcoeffMap->Write () ;
367 edm::LogInfo (
"IML") <<
"[InvMatrixCalibLooper][endOfJob] saving calib coeffs" ;
372 for (std::vector<DetId>::const_iterator barrelIt =
m_barrelCells.begin ();
379 for (std::vector<DetId>::const_iterator endcapIt =
m_endcapCells.begin ();
386 edm::LogInfo (
"IML") <<
"[InvMatrixCalibLooper][endOfJob] Exiting" ;
413 return radiants * 180 * (1/
M_PI) ;
423 return degrees *
M_PI * (1 / 180) ;
434 if (degrees == 90)
return 90 ;
445 if (phi>=360 && phi<720)
return phi-360;
446 if (phi>=720)
return phi-720;
463 int regionNumEB = phiI + Nphi*etaI ;
464 return (
int) regionNumEB;
477 double radius = (ics-50) * (ics-50) + (ips-50) * (ips-50) ;
478 radius =
sqrt (radius) ;
480 double phi = atan2 (static_cast<double> (ips-50),
481 static_cast<double> (ics-50)) ;
483 if (phi < 0) phi += 360;
486 int regionNumEE = phiI + Nphi*radI ;
528 if (reg==-1)
continue;
548 for (
int ips = 0 ; ips < 100 ; ++ips)
551 if (ireg==-1) reg =-1;
552 else reg = EBnum + ireg;
556 if (reg==-1)
continue;
560 if (reg!=-1) reg +=
EEnum;
564 if (reg==-1)
continue;
580 double radius2 = x*x + y*
y ;
581 if (radius2 < 10*10)
return 1;
582 if (radius2 > 50*50)
return 1;
585 double phi = atan2 (static_cast<double> (y),static_cast<double> (x));
587 if (phi < 0) phi += 360;
602 if (etaOld < 0)
return etaOld + 85;
603 else if (etaOld > 0)
return etaOld + 84;
T getParameter(std::string const &) const
double degrees(double radiants)
def degrees
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.
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.
void startingNewLoop(unsigned int)
void EERegionDefinition()
~EcalEleCalibLooper()
dtor
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
uint32_t rawId() const
get the raw id
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)
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
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.
void beginOfJob()
BeginOfJob.
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::vector< int > m_regions
int etaShifter(const int) const
LP Change the coordinate system.
std::map< int, int > m_xtalNumOfHits
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
ESHandle< TrackerGeometry > geometry
void writeLine(EBDetId const &, float)
int m_phiStartEB
phi start of the region of interest
EcalIntercalibConstantMap m_endcapMap
edm::InputTag m_barrelAlCa
EcalBarrel Input Collection name.
Status duringLoop(const edm::Event &, const edm::EventSetup &)
EcalEleCalibLooper(const edm::ParameterSet &)
ctor
double radiants(int degrees)
DS def radiants.
int m_etaEnd
eta end of the region of interest
Detector det() const
get the detector field from this detid
int EBRegionId(const int, const int) const
Reg Id generator EB --— for the barrel.
Status endOfLoop(const edm::EventSetup &, unsigned int iCounter)
int EBregionsNum() const
DS number of regions in EB.
std::map< int, int > m_xtalPositionInRegion
double m_maxEnergyPerCrystal
maximum energy per crystal cut