22 sinPhi.push_back(
sin(2. * 3.1415927 *
i * 1.0 / L1CaloRegionDetId::N_PHI));
23 cosPhi.push_back(
cos(2. * 3.1415927 *
i * 1.0 / L1CaloRegionDetId::N_PHI));
39 const std::vector<l1t::CaloEmCand> & EMCands,
40 const std::vector<l1t::Jet> *
jets,
41 std::vector<l1t::EtSum> * etsums) {
43 unsigned int sumET = 0;
46 unsigned int sumHT = 0;
50 std::vector<l1t::CaloRegion> *subRegions =
new std::vector<l1t::CaloRegion>();
55 double jetLsb=params_->jetLsb();
57 int etSumEtaMinEt = params_->etSumEtaMin(0);
58 int etSumEtaMaxEt = params_->etSumEtaMax(0);
60 int etSumEtThresholdEt = (int) (params_->etSumEtThreshold(0) / jetLsb);
62 int etSumEtaMinHt = params_->etSumEtaMin(1);
63 int etSumEtaMaxHt = params_->etSumEtaMax(1);
65 int etSumEtThresholdHt = (int) (params_->etSumEtThreshold(1) / jetLsb);
69 double towerLsb = params_->towerLsbSum();
70 int jetSeedThreshold = floor( params_->jetSeedThreshold()/towerLsb + 0.5);
72 std::vector<l1t::Jet> *unCorrJets =
new std::vector<l1t::Jet>();
73 std::vector<l1t::Jet> * unSortedJets =
new std::vector<l1t::Jet>();
74 std::vector<l1t::Jet> * SortedJets =
new std::vector<l1t::Jet>();
78 std::string jetCalibrationType = params_->jetCalibrationType();
79 std::vector<double> jetCalibrationParams = params_->jetCalibrationParams();
80 JetCalibration(unCorrJets, jetCalibrationParams, unSortedJets, jetCalibrationType, towerLsb);
83 int dijet_phi=DiJetPhi(SortedJets);
85 for(std::vector<CaloRegion>::const_iterator
region = subRegions->begin();
region != subRegions->end();
region++) {
86 if (
region->hwEta() < etSumEtaMinEt ||
region->hwEta() > etSumEtaMaxEt) {
91 int regionET =
region->hwPt();
93 if(regionET >= etSumEtThresholdEt){
95 sumEx += (((double) regionET) * cosPhi[
region->hwPhi()]);
96 sumEy += (((double) regionET) * sinPhi[
region->hwPhi()]);
100 for(std::vector<CaloRegion>::const_iterator
region = subRegions->begin();
region != subRegions->end();
region++) {
101 if (
region->hwEta() < etSumEtaMinHt ||
region->hwEta() > etSumEtaMaxHt) {
106 int regionET =
region->hwPt();
108 if(regionET >= etSumEtThresholdHt) {
110 sumHx += (((double) regionET) * cosPhi[
region->hwPhi()]);
111 sumHy += (((double) regionET) * sinPhi[
region->hwPhi()]);
115 unsigned int MET = ((
unsigned int)
sqrt(sumEx * sumEx + sumEy * sumEy));
116 unsigned int MHT = ((
unsigned int)
sqrt(sumHx * sumHx + sumHy * sumHy));
118 double physicalPhi = atan2(sumEy, sumEx) + 3.1415927;
123 double physicalPhiHT = atan2(sumHy, sumHx) + 3.1415927;
129 const ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > etLorentz(0,0,0,0);
153 uint16_t MHToHT=MHToverHT(MHT,sumHT);
156 l1t::EtSum etMiss(*&etLorentz,EtSum::EtSumType::kMissingEt,MET,0,iPhiET,METqual);
157 l1t::EtSum htMiss(*&etLorentz,EtSum::EtSumType::kMissingHt,MHToHT&0x7f,0,iPhiHT,MHTqual);
158 l1t::EtSum etTot (*&etLorentz,EtSum::EtSumType::kTotalEt,sumET&0xfff,0,0,ETTqual);
159 l1t::EtSum htTot (*&etLorentz,EtSum::EtSumType::kTotalHt,sumHT&0xfff,0,0,HTTqual);
161 std::vector<l1t::EtSum> *preGtEtSums =
new std::vector<l1t::EtSum>();
163 preGtEtSums->push_back(etMiss);
164 preGtEtSums->push_back(htMiss);
165 preGtEtSums->push_back(etTot);
166 preGtEtSums->push_back(htTot);
179 for(std::vector<l1t::EtSum>::const_iterator itetsum = etsums->begin();
180 itetsum != etsums->end(); ++itetsum){
191 if(EtSum::EtSumType::kTotalEt == itetsum->getType())
193 cout <<
"Total Et" << endl;
194 cout << bitset<12>(itetsum->hwPt()).
to_string() << endl;
196 if(EtSum::EtSumType::kTotalHt == itetsum->getType())
198 cout <<
"Total Ht" << endl;
199 cout << bitset<12>(itetsum->hwPt()).
to_string() << endl;
210 if (jets->size()<2)
return dphi;
211 if ((*jets).at(0).hwPt() == 0)
return dphi;
212 if ((*jets).at(1).hwPt() == 0)
return dphi;
215 int iphi1 = (*jets).at(0).hwPhi();
216 int iphi2 = (*jets).at(1).hwPhi();
218 int difference=
abs(iphi1-iphi2);
235 result = result & 0x7f;
void JetCalibration(std::vector< l1t::Jet > *uncalibjets, std::vector< double > jetCalibrationParams, std::vector< l1t::Jet > *jets, std::string jetCalibrationType, double jetLSB)
void RegionCorrection(const std::vector< l1t::CaloRegion > ®ions, std::vector< l1t::CaloRegion > *subRegions, CaloParamsHelper *params)
------— New region correction (PUsub, no response correction at the moment) --------— ...
Sin< T >::type sin(const T &t)
std::vector< double > cosPhi
void EtSumToGtScales(CaloParamsHelper *params, const std::vector< l1t::EtSum > *input, std::vector< l1t::EtSum > *output)
void SortJets(std::vector< l1t::Jet > *input, std::vector< l1t::Jet > *output)
std::string to_string(const T &t)
virtual void processEvent(const std::vector< l1t::CaloRegion > ®ions, const std::vector< l1t::CaloEmCand > &EMCands, const std::vector< l1t::Jet > *jets, std::vector< l1t::EtSum > *sums)
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
uint16_t MHToverHT(uint16_t, uint16_t) const
std::vector< double > sinPhi
void slidingWindowJetFinder(const int, const std::vector< l1t::CaloRegion > *regions, std::vector< l1t::Jet > *uncalibjets)
int DiJetPhi(const std::vector< l1t::Jet > *jets) const
static const unsigned N_PHI
virtual ~Stage1Layer2EtSumAlgorithmImpPP()
Stage1Layer2EtSumAlgorithmImpPP(CaloParamsHelper *params)