73 e9 =
new TH1F(
"e9",
"E9 energy", 300, 0., 150.);
74 e25 =
new TH1F(
"e25",
"E25 energy", 300, 0., 150.);
75 scE =
new TH1F(
"scE",
"SC energy", 300, 0., 150.);
76 trP =
new TH1F(
"trP",
"Trk momentum", 300, 0., 150.);
77 EoP =
new TH1F(
"EoP",
"EoP", 600, 0., 3.);
78 EoP_all =
new TH1F(
"EoP_all",
"EoP_all", 600, 0., 3.);
81 calibs =
new TH1F(
"calib",
"Calibration constants", 4000, 0.5, 2.);
83 calibs =
new TH1F(
"calib",
"Calibration constants", 800, 0.5, 2.);
86 e25OverScE =
new TH1F(
"e25OverscE",
"E25 / SC energy", 400, 0., 2.);
87 E25oP =
new TH1F(
"E25oP",
"E25 / P", 1200, 0., 1.5);
89 Map =
new TH2F(
"Map",
"Nb Events in Crystal", 85, 1, 85, 70, 5, 75);
90 e9Overe25 =
new TH1F(
"e9Overe25",
"E9 / E25", 400, 0., 2.);
91 Map3Dcalib =
new TH2F(
"3Dcalib",
"3Dcalib", 85, 1, 85, 70, 5, 75);
93 MapCor1 =
new TH2F(
"MapCor1",
"Correlation E25/Pcalo versus E25/Pin", 100, 0., 5., 100, 0., 5.);
94 MapCor2 =
new TH2F(
"MapCor2",
"Correlation E25/Pcalo versus E/P", 100, 0., 5., 100, 0., 5.);
95 MapCor3 =
new TH2F(
"MapCor3",
"Correlation E25/Pcalo versus Pout/Pin", 100, 0., 5., 100, 0., 5.);
96 MapCor4 =
new TH2F(
"MapCor4",
"Correlation E25/Pcalo versus E25/highestP", 100, 0., 5., 100, 0., 5.);
97 MapCor5 =
new TH2F(
"MapCor5",
"Correlation E25/Pcalo versus Pcalo/Pout", 100, 0., 5., 100, 0., 5.);
98 MapCor6 =
new TH2F(
"MapCor6",
"Correlation Pout/Pin versus E25/Pin", 100, 0., 5., 100, 0., 5.);
99 MapCor7 =
new TH2F(
"MapCor7",
"Correlation Pout/Pin versus Pcalo/Pout", 100, 0., 5., 100, 0., 5.);
100 MapCor8 =
new TH2F(
"MapCor8",
"Correlation E25/Pin versus Pcalo/Pout", 100, 0., 5., 100, 0., 5.);
101 MapCor9 =
new TH2F(
"MapCor9",
"Correlation E25/Pcalo versus Eseed/Pout", 100, 0., 5., 100, 0., 5.);
102 MapCor10 =
new TH2F(
"MapCor10",
"Correlation Eseed/Pout versus Pout/Pin", 100, 0., 5., 100, 0., 5.);
103 MapCor11 =
new TH2F(
"MapCor11",
"Correlation Eseed/Pout versus E25/Pin", 100, 0., 5., 100, 0., 5.);
105 new TH2F(
"MapCorCalib",
"Correlation Miscalibration versus Calibration constants", 100, 0.5, 1.5, 100, 0.5, 1.5);
107 PinMinPout =
new TH1F(
"PinMinPout",
"(Pin - Pout)/Pin", 600, -2.0, 2.0);
110 calibinter =
new TH1F(
"calibinter",
"internal calibration constants", 2000, 0.5, 2.);
111 PinOverPout =
new TH1F(
"PinOverPout",
"pinOverpout", 600, 0., 3.);
112 eSeedOverPout =
new TH1F(
"eSeedOverPout",
"eSeedOverpout ", 600, 0., 3.);
113 MisCalibs =
new TH1F(
"MisCalibs",
"Miscalibration constants", 4000, 0.5, 2.);
114 RatioCalibs =
new TH1F(
"RatioCalibs",
"Ratio in Calibration Constants", 4000, 0.5, 2.0);
115 DiffCalibs =
new TH1F(
"DiffCalibs",
"Difference in Calibration constants", 4000, -1.0, 1.0);
117 calibinter =
new TH1F(
"calibinter",
"internal calibration constants", 400, 0.5, 2.);
118 PinOverPout =
new TH1F(
"PinOverPout",
"pinOverpout", 600, 0., 3.);
119 eSeedOverPout =
new TH1F(
"eSeedOverPout",
"eSeedOverpout ", 600, 0., 3.);
120 MisCalibs =
new TH1F(
"MisCalibs",
"Miscalibration constants", 800, 0.5, 2.);
121 RatioCalibs =
new TH1F(
"RatioCalibs",
"Ratio in Calibration Constants", 800, 0.5, 2.0);
122 DiffCalibs =
new TH1F(
"DiffCalibs",
"Difference in Calibration constants", 800, -1.0, 1.0);
124 Error1 =
new TH1F(
"Error1",
"DeltaP/Pin", 800, -1.0, 1.0);
125 Error2 =
new TH1F(
"Error2",
"DeltaP/Pout", 800, -1.0, 1.0);
126 Error3 =
new TH1F(
"Error3",
"DeltaP/Pcalo", 800, -1.0, 1.0);
127 eSeedOverPout2 =
new TH1F(
"eSeedOverPout2",
"eSeedOverpout (No Supercluster)", 600, 0., 4.);
128 hadOverEm =
new TH1F(
"hadOverEm",
"Had/EM distribution", 600, -2., 2.);
131 Map3DcalibNoCuts =
new TH2F(
"3DcalibNoCuts",
"3Dcalib (Before Cuts)", 85, 1, 85, 70, 5, 75);
132 e9NoCuts =
new TH1F(
"e9NoCuts",
"E9 energy (Before Cuts)", 300, 0., 150.);
133 e25NoCuts =
new TH1F(
"e25NoCuts",
"E25 energy (Before Cuts)", 300, 0., 150.);
134 scENoCuts =
new TH1F(
"scENoCuts",
"SC energy (Before Cuts)", 300, 0., 150.);
135 trPNoCuts =
new TH1F(
"trPNoCuts",
"Trk momentum (Before Cuts)", 300, 0., 150.);
136 EoPNoCuts =
new TH1F(
"EoPNoCuts",
"EoP (Before Cuts)", 600, 0., 3.);
138 calibsNoCuts =
new TH1F(
"calibNoCuts",
"Calibration constants (Before Cuts)", 4000, 0., 2.);
140 calibsNoCuts =
new TH1F(
"calibNoCuts",
"Calibration constants (Before Cuts)", 800, 0., 2.);
142 e25OverScENoCuts =
new TH1F(
"e25OverscENoCuts",
"E25 / SC energy (Before Cuts)", 400, 0., 2.);
143 E25oPNoCuts =
new TH1F(
"E25oPNoCuts",
"E25 / P (Before Cuts)", 1200, 0., 1.5);
144 MapNoCuts =
new TH2F(
"MapNoCuts",
"Nb Events in Crystal (Before Cuts)", 85, 1, 85, 70, 5, 75);
145 e9Overe25NoCuts =
new TH1F(
"e9Overe25NoCuts",
"E9 / E25 (Before Cuts)", 400, 0., 2.);
146 PinOverPoutNoCuts =
new TH1F(
"PinOverPoutNoCuts",
"pinOverpout (Before Cuts)", 600, 0., 3.);
147 eSeedOverPoutNoCuts =
new TH1F(
" eSeedOverPoutNoCuts",
"eSeedOverpout (Before Cuts) ", 600, 0., 4.);
148 PinMinPoutNoCuts =
new TH1F(
"PinMinPoutNoCuts",
"(Pin - Pout)/Pin (Before Cuts)", 600, -2.0, 2.0);
150 RatioCalibsNoCuts =
new TH1F(
"RatioCalibsNoCuts",
"Ratio in Calibration Constants (Before Cuts)", 4000, 0.5, 2.0);
151 DiffCalibsNoCuts =
new TH1F(
"DiffCalibsNoCuts",
"Difference in Calibration constants (Before Cuts)", 4000, -1.0, 1.0);
152 calibinterNoCuts =
new TH1F(
"calibinterNoCuts",
"internal calibration constants", 2000, 0.5, 2.);
155 new TH2F(
"MapCor1NoCuts",
"Correlation E25/PatCalo versus E25/Pin (Before Cuts)", 100, 0., 5., 100, 0., 5.);
157 new TH2F(
"MapCor2NoCuts",
"Correlation E25/PatCalo versus E/P (Before Cuts)", 100, 0., 5., 100, 0., 5.);
159 new TH2F(
"MapCor3NoCuts",
"Correlation E25/PatCalo versus Pout/Pin (Before Cuts)", 100, 0., 5., 100, 0., 5.);
161 new TH2F(
"MapCor4NoCuts",
"Correlation E25/PatCalo versus E25/highestP (Before Cuts)", 100, 0., 5., 100, 0., 5.);
163 new TH2F(
"MapCor5NoCuts",
"Correlation E25/Pcalo versus Pcalo/Pout (Before Cuts)", 100, 0., 5., 100, 0., 5.);
165 new TH2F(
"MapCor6NoCuts",
"Correlation Pout/Pin versus E25/Pin (Before Cuts)", 100, 0., 5., 100, 0., 5.);
167 new TH2F(
"MapCor7NoCuts",
"Correlation Pout/Pin versus Pcalo/Pout (Before Cuts)", 100, 0., 5., 100, 0., 5.);
169 new TH2F(
"MapCor8NoCuts",
"Correlation E25/Pin versus Pcalo/Pout (Before Cuts)", 100, 0., 5., 100, 0., 5.);
171 new TH2F(
"MapCor9NoCuts",
"Correlation E25/Pcalo versus Eseed/Pout (Before Cuts)", 100, 0., 5., 100, 0., 5.);
173 new TH2F(
"MapCor10NoCuts",
"Correlation Eseed/Pout versus Pout/Pin (Before Cuts)", 100, 0., 5., 100, 0., 5.);
175 new TH2F(
"MapCor11NoCuts",
"Correlation Eseed/Pout versus E25/Pin (Before Cuts)", 100, 0., 5., 100, 0., 5.);
177 "Correlation Miscalibration versus Calibration constants (Before Cuts)",
185 Error1NoCuts =
new TH1F(
"Eror1NoCuts",
"DeltaP/Pin (Before Cuts)", 800, -1.0, 1.0);
186 Error2NoCuts =
new TH1F(
"Error2NoCuts",
"DeltaP/Pout (Before Cuts)", 800, -1.0, 1.0);
187 Error3NoCuts =
new TH1F(
"Error3NoCuts",
"DeltaP/Pcalo (Before Cuts)", 800, -1.0, 1.0);
188 eSeedOverPout2NoCuts =
new TH1F(
"eSeedOverPout2NoCuts",
"eSeedOverpout (No Supercluster, Before Cuts)", 600, 0., 4.);
189 hadOverEmNoCuts =
new TH1F(
"hadOverEmNoCuts",
"Had/EM distribution (Before Cuts)", 600, -2., 2.);
193 new TH2F(
"MapCor1ESeed",
"Correlation E25/Pcalo versus E25/Pin (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
195 new TH2F(
"MapCor2ESeed",
"Correlation E25/Pcalo versus E/P (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
197 "MapCor3ESeed",
"Correlation E25/Pcalo versus Pout/Pin (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
199 "MapCor4ESeed",
"Correlation E25/Pcalo versus E25/highestP (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
201 "MapCor5ESeed",
"Correlation E25/Pcalo versus Pcalo/Pout (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
203 new TH2F(
"MapCor6ESeed",
"Correlation Pout/Pin versus E25/Pin (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
205 "MapCor7ESeed",
"Correlation Pout/Pin versus Pcalo/Pout (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
207 "MapCor8ESeed",
"Correlation E25/Pin versus Pcalo/Pout (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
209 "MapCor9ESeed",
"Correlation E25/Pcalo versus Eseed/Pout (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
211 "MapCor10ESeed",
"Correlation Eseed/Pout versus Pout/Pin (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
213 "MapCor11ESeed",
"Correlation Eseed/Pout versus E25/Pin (after Eseed/Pout cut)", 100, 0., 5., 100, 0., 5.);
216 new TH1F(
"eSeedOverPout2ESeed",
"eSeedOverpout (No Supercluster, after Eseed/Pout cut)", 600, 0., 4.);
218 hadOverEmESeed =
new TH1F(
"hadOverEmESeed",
"Had/EM distribution (after Eseed/Pout cut)", 600, -2., 2.);
221 GeneralMap =
new TH2F(
"GeneralMap",
"Map without any cuts", 85, 1, 85, 70, 5, 75);
235 <<
" Should be either L3, HH or HHReg. Abort! ";
260 int nIterations = 10;
270 edm::LogError(
"EcalCalib") <<
" Calibration not run due to problem in Algo Choice...";
291 std::map<EBDetId, float> OldCoeff;
293 while (fileStatus != EOF) {
294 fileStatus = fscanf(MisCalib,
"%d %d %f\n", &
eta, &
phi, &coeff);
295 if (
eta != -1 &&
phi != -1 && coeff != -1) {
303 CalibrationCluster::CalibMap::iterator itmap;
309 std::map<EBDetId, float>::iterator iter = OldCoeff.find(itmap->first);
310 if (iter != OldCoeff.end())
311 Compare = iter->second;
318 if ((itmap->first).ieta() <
mineta_ + 2) {
322 if ((itmap->first).ieta() >
maxeta_ - 2) {
326 if ((itmap->first).iphi() <
minphi_ + 2) {
330 if ((itmap->first).iphi() >
maxphi_ - 2) {
352 edm::LogError(
"EcalCalib") <<
" Calibration not run due to problem in AlgoChoice...";
361 CalibrationCluster::CalibMap::iterator itmapp;
365 std::map<EBDetId, float>::iterator iter2 = OldCoeff.find(itmapp->first);
366 if (iter2 != OldCoeff.end())
367 Compare2 = iter2->second;
372 if ((itmapp->first).ieta() <
mineta_ + 2) {
376 if ((itmapp->first).ieta() >
maxeta_ - 2) {
380 if ((itmapp->first).iphi() <
minphi_ + 2) {
384 if ((itmapp->first).iphi() >
maxphi_ - 2) {
397 edm::LogVerbatim(
"EcalCalib") <<
"\n************* STATISTICS **************";
415 for (it = ecrh.
begin(); it != ecrh.
end(); it++) {
417 if (it->energy() > en_save) {
418 en_save = it->energy();
429 double currEnergy = 0.;
432 for (std::vector<DetId>::const_iterator idsIt = v1.begin(); idsIt != v1.end(); ++idsIt) {
433 if (idsIt->subdetId() != 1)
436 itrechit =
hits->find(*idsIt);
438 if (itrechit ==
hits->end()) {
439 edm::LogVerbatim(
"EcalCalib") <<
"ElectronCalibration::findMaxHit2: rechit not found! ";
442 if (itrechit->energy() > currEnergy) {
443 currEnergy = itrechit->energy();
458 if (!
phits.isValid()) {
459 edm::LogError(
"EcalCalib") <<
"Error! can't get the product EBRecHitCollection: ";
467 edm::LogError(
"EcalCalib") <<
"Error! can't get the product ElectronCollection: ";
491 float highestElePt = 0.;
495 if (fabs(eleIt->eta()) > (
maxeta_ + 3) * 0.0175)
497 if (eleIt->eta() < (
mineta_ - 3) * 0.0175)
500 if (eleIt->pt() > highestElePt) {
501 highestElePt = eleIt->pt();
502 highPtElectron = *eleIt;
506 if (highestElePt <
ElePt_)
511 if (fabs(sc.
eta()) > (
maxeta_ + 3) * 0.0175) {
512 edm::LogVerbatim(
"EcalCalib") <<
"++++ Problem with electron, electron eta is " << highPtElectron.
eta()
513 <<
" while SC is " << sc.
eta() << std::endl;
517 std::vector<DetId> v1;
522 v1.push_back(idsIt->first);
530 if (maxHitId.
null()) {
535 int maxCC_Eta = maxHitId.
ieta();
536 int maxCC_Phi = maxHitId.
iphi();
560 std::vector<float>
energy;
561 float energy3x3 = 0.;
562 float energy5x5 = 0.;
566 if (Xtals5x5[icry].subdetId() != 1)
568 itrechit =
hits->find(Xtals5x5[icry]);
569 if (itrechit ==
hits->end()) {
576 energy.push_back(itrechit->energy());
577 energy5x5 +=
energy[icry];
579 if (icry == 6 || icry == 7 || icry == 8 || icry == 11 || icry == 12 || icry == 13 || icry == 16 || icry == 17 ||
581 energy3x3 +=
energy[icry];
597 float UncorrectedPatCalo =
634 MapCor1NoCuts->Fill(energy5x5 / UncorrectedPatCalo, energy5x5 / Ptrack_in);
636 MapCor3NoCuts->Fill(energy5x5 / UncorrectedPatCalo, Ptrack_out / Ptrack_in);
637 MapCor4NoCuts->Fill(energy5x5 / UncorrectedPatCalo, energy5x5 / highPtElectron.
p());
638 MapCor5NoCuts->Fill(energy5x5 / UncorrectedPatCalo, UncorrectedPatCalo / Ptrack_out);
639 MapCor6NoCuts->Fill(Ptrack_out / Ptrack_in, energy5x5 / Ptrack_in);
640 MapCor7NoCuts->Fill(Ptrack_out / Ptrack_in, UncorrectedPatCalo / Ptrack_out);
641 MapCor8NoCuts->Fill(energy5x5 / Ptrack_in, UncorrectedPatCalo / Ptrack_out);
657 if ((energy3x3 / energy5x5) <
cut1_)
660 if ((Ptrack_out / Ptrack_in) <
cut2_ || (Ptrack_out / Ptrack_in) >
cut3_)
666 e25->Fill(energy5x5);
669 trP->Fill(UncorrectedPatCalo);
674 E25oP->Fill(energy5x5 / UncorrectedPatCalo);
676 Map->Fill(maxCC_Eta, maxCC_Phi);
684 MapCor1->Fill(energy5x5 / UncorrectedPatCalo, energy5x5 / Ptrack_in);
686 MapCor3->Fill(energy5x5 / UncorrectedPatCalo, Ptrack_out / Ptrack_in);
687 MapCor4->Fill(energy5x5 / UncorrectedPatCalo, energy5x5 / highPtElectron.
p());
688 MapCor5->Fill(energy5x5 / UncorrectedPatCalo, UncorrectedPatCalo / Ptrack_out);
689 MapCor6->Fill(Ptrack_out / Ptrack_in, energy5x5 / Ptrack_in);
690 MapCor7->Fill(Ptrack_out / Ptrack_in, UncorrectedPatCalo / Ptrack_out);
691 MapCor8->Fill(energy5x5 / Ptrack_in, UncorrectedPatCalo / Ptrack_out);
696 PinMinPout->Fill((Ptrack_in - Ptrack_out) / Ptrack_in);
716 MapCor1ESeed->Fill(energy5x5 / UncorrectedPatCalo, energy5x5 / Ptrack_in);
718 MapCor3ESeed->Fill(energy5x5 / UncorrectedPatCalo, Ptrack_out / Ptrack_in);
719 MapCor4ESeed->Fill(energy5x5 / UncorrectedPatCalo, energy5x5 / highPtElectron.
p());
720 MapCor5ESeed->Fill(energy5x5 / UncorrectedPatCalo, UncorrectedPatCalo / Ptrack_out);
721 MapCor6ESeed->Fill(Ptrack_out / Ptrack_in, energy5x5 / Ptrack_in);
722 MapCor7ESeed->Fill(Ptrack_out / Ptrack_in, UncorrectedPatCalo / Ptrack_out);
723 MapCor8ESeed->Fill(energy5x5 / Ptrack_in, UncorrectedPatCalo / Ptrack_out);
Log< level::Info, true > LogVerbatim
int eventcrystal[171][360]
T getParameter(std::string const &) const
CalibrationCluster::CalibMap ReducedMap
edm::EDGetTokenT< EBRecHitCollection > recHitToken_
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
edm::InputTag trackLabel_
constexpr bool isNotFinite(T x)
std::vector< float > WeightVector
int iphi() const
get the crystal iphi
float trackMomentumError() const
void analyze(const edm::Event &, const edm::EventSetup &) override
HouseholderDecomposition * MyHH
T const * product() const
TH1F * eSeedOverPout2ESeed
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
CalibMap getMap(int, int, int, int)
TH1F * eSeedOverPoutNoCuts
std::vector< float > solutionNoCuts
MinL3Algorithm * MyL3Algo1
std::vector< int > MaxCCphiNoCuts
std::vector< int > MaxCCetaNoCuts
Log< level::Error, false > LogError
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
float eSuperClusterOverP() const
Classification classification() const
std::vector< float > solution
int ieta() const
get the crystal ieta
math::XYZVectorF trackMomentumAtCalo() const
float eSeedClusterOverPout() const
constexpr bool null() const
is this a null id ?
std::vector< float > newCalibs
math::XYZVectorF trackMomentumOut() const
std::vector< float > EnergyVector
double p() const final
magnitude of momentum vector
ElectronCalibration(const edm::ParameterSet &)
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > TrackerTraits::tindex_type *__restrict__ double *__restrict__ phits
EBDetId findMaxHit(edm::Handle< EBRecHitCollection > &)
std::vector< float > iterate(const std::vector< std::vector< float > > &eventMatrix, const std::vector< int > &VmaxCeta, const std::vector< int > &VmaxCphi, const std::vector< float > &energyVector, const int &nIter, const bool &normalizeFlag=false)
std::vector< int > MaxCCphi
std::string miscalibfile_
std::vector< float > WeightVectorNoCuts
std::vector< std::vector< float > > EventMatrixNoCuts
CalibrationCluster calibCluster
math::XYZVectorF trackMomentumAtVtx() const
const_iterator begin() const
static const int ETAPHIMODE
std::vector< EcalRecHit >::iterator iterator
const_iterator end() const
double energy() const
cluster energy
std::vector< std::vector< float > > EventMatrix
~ElectronCalibration() override
std::vector< float > runRegional(const std::vector< std::vector< float > > &eventMatrix, const std::vector< int > &VmaxCeta, const std::vector< int > &VmaxCphi, const std::vector< float > &energyVector, const int &nIter, const int ®Length=5)
EBDetId findMaxHit2(const std::vector< DetId > &, const EBRecHitCollection *)
void writeLine(EBDetId const &, float)
std::vector< float > EnergyVectorNoCuts
double eta() const
pseudorapidity of cluster centroid
TH1F * eSeedOverPout2NoCuts
std::vector< EBDetId > get5x5Id(EBDetId const &)
Power< A, B >::type pow(const A &a, const B &b)
float hadronicOverEm() const
std::vector< float > oldCalibs
SuperClusterRef superCluster() const override
reference to a SuperCluster
std::vector< float > iterate(const std::vector< std::vector< float > > &eventMatrix, const std::vector< int > &VmaxCeta, const std::vector< int > &VmaxCphi, const std::vector< float > &energyVector, const int &nIter, const bool &normalizeFlag=false)
double eta() const final
momentum pseudorapidity
std::vector< int > MaxCCeta