11 using namespace pftools;
17 "((x-[0])/[1])*(x>[4])+((x-[2])/[3])*(x<[4])");
19 =
new TF1(
"etaCorrection",
20 "(1-[0]*x-[1]*x*x)*(x<[2])+([3]+[4]*x)*(x>[2]&&x<[5])+(1-[6]*x-[7]*x*x)*(x>[5])");
32 std::string eheb(
"ecalHcalEcalBarrel");
34 std::string ehee(
"ecalHcalEcalEndcap");
36 std::string ehhb(
"ecalHcalHcalBarrel");
38 std::string ehhe(
"ecalHcalHcalEndcap");
46 funcString(
"([0]*[5]*x)*([5]*x<=[1])+([2]+[3]*exp([4]*[5]*x))*([5]*x>[1])");
49 for (std::vector<std::string>::const_iterator cit =
names_.begin(); cit
51 std::string
name = *cit;
52 TF1 func(name.c_str(), funcString);
54 func.FixParameter(0, 1);
55 func.FixParameter(1, 0);
56 func.FixParameter(2, 1);
57 func.FixParameter(3, 0);
58 func.FixParameter(4, 0);
59 func.FixParameter(5, 1);
105 barrelEndcapEtaDiv_(1.0), ecalOnlyDiv_(0.3), hcalOnlyDiv_(0.5),
106 doCorrection_(1), allowNegativeEnergy_(0), doEtaCorrection_(1),
107 maxEToCorrect_(-1.0), correctionLowLimit_(0.), globalP0_(0.0),
108 globalP1_(1.0), lowEP0_(0.0), lowEP1_(1.0) {
123 if (params.size() != 6) {
124 std::cout << __PRETTY_FUNCTION__ <<
": params is of the wrong length."
130 for (std::vector<double>::const_iterator dit = params.begin(); dit
131 != params.end(); ++dit) {
143 std::vector<double> params) {
147 for (std::vector<double>::const_iterator dit = params.begin(); dit
148 != params.end(); ++dit) {
149 func->FixParameter(count, *dit);
158 const double& lowEP1,
const double& globalP0,
const double& globalP1) {
179 const double& hcalE,
const double&
eta,
const double&
phi)
const {
180 const TF1* theFunction(0);
190 assert(theFunction != 0);
191 double totalE(ecalE + hcalE);
192 double bCoeff = theFunction->Eval(totalE);
193 return ecalE * bCoeff;
197 const double& hcalE,
const double&
eta,
const double&
phi)
const {
198 const TF1* theFunction(0);
208 double totalE(ecalE + hcalE);
209 assert(theFunction != 0);
210 double cCoeff = theFunction->Eval(totalE);
211 return hcalE * cCoeff;
215 const double& hcalE,
const double&
eta,
const double&
phi)
const {
216 double totalE(ecalE + hcalE);
240 double& hcalE,
const double&
eta,
const double&
phi)
const {
242 double ecalEOld(ecalE);
243 double hcalEOld(hcalE);
248 double preCorrection(ecalE + hcalE);
255 double a = corrE - preCorrection;
294 <<
": WARNING! This isn't working properly yet!\n";
295 TBranch* calibBr = input->GetBranch(
"Calibratable");
297 calibBr->SetAddress(&calib_ptr);
302 std::cout <<
"Looping over tree's "<< input->GetEntries()
307 input->GetEntry(entries);
315 s <<
"PFClusterCalibration: dump...\n";