19 double etabound = (*theEtabound.find(
type)).
second;
20 std::vector<double> taus = (*theParam.find(
type)).
second;
22 if ( fabs(eta) > etabound) {
31 etnew = 2*(x-taus[0])/(taus[1]+
sqrt(taus[1]*taus[1]-4*taus[0]*taus[2]+4*x*taus[2]));
36 etnew = 2*(x-taus[0])/(taus[1]+
sqrt(taus[1]*taus[1]-4*taus[0]*taus[2]+4*x*taus[2]));
41 etnew = 2*(x-taus[0])/(taus[1]+
sqrt(taus[1]*taus[1]-4*taus[0]*taus[2]+4*x*taus[2]));
46 edm::LogError(
"TauJetCorrector: Error: unknown parametrization type ") <<
type <<
" in TauJetCorrector. No correction applied" << endl;
56 int neta(){
return etavector.size();}
57 double eta(
int ieta){
return etavector[ieta];}
58 int type(
int ieta){
return typevector[ieta];}
59 const vector<double>&
parameters(
int ieta){
return pars[ieta];}
60 bool valid(){
return etavector.size();}
66 vector< vector<double> >
pars;
70 std::string
file=
"JetMETCorrections/TauJet/data/"+tag+
".txt";
79 while( std::getline(
in, line)){
80 if(!line.size() || line[0]==
'#')
continue;
81 istringstream linestream(line);
84 linestream>>par>>
type;
88 etavector.push_back(par);
89 typevector.push_back(type);
90 pars.push_back(vector<double>());
91 while(linestream>>par)pars.back().push_back(par);
108 for(ParametersMap::iterator ip=parametrization.begin();ip!=parametrization.end();ip++)
delete ip->second;
117 if((!pset.
valid()) && (aCalibrationType!=
"no"))
119 edm::LogError(
"TauJetCorrector:Jet Corrections not found ")<<aCalibrationType<<
120 " not found! Cannot apply any correction ... For JetPlusTrack calibration only radii 0.5 and 0.7 are included for JetParton" << endl;
123 if (aCalibrationType==
"no")
return;
125 map<int,vector<double> > pq;
126 map<int,vector<double> > pg;
127 map<int,vector<double> > pqcd;
128 map<int,double > etaboundx;
133 for(
int ieta=0; ieta<pset.
neta();ieta++)
135 if( pset.
type(ieta) == 1 ) {pq[iq] = pset.
parameters(ieta); iq++; mtype=(int)(pset.
type(ieta));}
136 if( pset.
type(ieta) == 2 ) {pg[ig] = pset.
parameters(ieta); ig++; mtype=(int)(pset.
type(ieta));}
137 if( pset.
type(ieta) == 3 ) {pqcd[iqcd] = pset.
parameters(ieta);iqcd++;mtype=(int)(pset.
type(ieta));}
138 if( pset.
type(ieta) == -1 ) {etaboundx[mtype-1] = pset.
eta(ieta);}
143 for(
int ieta=0; ieta<pset.
neta();ieta++)
147 if ( pset.
type(ieta) == -1 )
continue;
151 (*etaboundx.find(0)).second);
156 if( ieta > iq && ieta < iq + ig + 2 )
158 mynum = ieta - iq - 1;
160 (*etaboundx.find(1)).second);
165 if( ieta > iq + ig + 1)
167 mynum = ieta - iq - ig - 2;
170 (*etaboundx.find(2)).second);
181 if(parametrization.empty()) {
return 1.; }
184 double eta=fabs(fJet.Eta());
189 std::map<double,ParametrizationTauJet*>::const_iterator ip=parametrization.upper_bound(eta);
190 etnew=(--ip)->
second->value(et,eta);
194 float mScale = etnew/et;
200 return correction(fJet.
p4());
T getParameter(std::string const &) const
vector< double > etavector
TauJetCorrector(const edm::ParameterSet &fParameters)
vector< vector< double > > pars
Base class for all types of Jets.
virtual double correction(const LorentzVector &fJet) const
get correction using Jet information only
void setParameters(std::string, int)
const vector< double > & parameters(int ieta)
U second(std::pair< T, U > const &p)
JetCalibrationParameterSetTauJet(string tag)
double value(double, double) const
virtual ~TauJetCorrector()
std::string fullPath() const
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
reco::Particle::LorentzVector LorentzVector