Back to home page

sPhenix code displayed by LXR

 
 

    


Warning, file /analysis/LightFlavorRatios/corrections/TrivialLambdaFeedDownCorrection.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef LAMBDAFEEDDOWNCORRECTION_H
0002 #define LAMBDAFEEDDOWNCORRECTION_H
0003 
0004 #include "CorrectionHistogram1D.h"
0005 
0006 #include <TFile.h>
0007 
0008 #include <iostream>
0009 #include <string>
0010 #include <memory>
0011 
0012 struct TrivialLambdaFeedDownCorrection : CorrectionHistogram1D
0013 {
0014   std::shared_ptr<TFile> f;
0015   
0016   TrivialLambdaFeedDownCorrection(std::string filename, std::string hname)
0017   {
0018     f = std::make_shared<TFile>(filename.c_str(),"READ");
0019     h_corr = (TH1D*)f->Get(hname.c_str())->Clone();
0020     // preserve histogram on file close
0021     h_corr->SetDirectory(nullptr);
0022     name = "lambdafeeddown";
0023     title = "#Lambda feeddown";
0024   }
0025 
0026   TrivialLambdaFeedDownCorrection(const TrivialLambdaFeedDownCorrection& c)
0027   {
0028     f = c.f;
0029     h_corr = c.h_corr;
0030     name = c.name;
0031     title = c.title;
0032   }
0033 
0034   void apply_correction(float xlow, float xhigh, TH1F* h, int bin) override
0035   {
0036 /*
0037     std::pair<double,double> corr_and_err = get_val_and_error(xlow,xhigh);
0038     std::cout << "lambda feeddown vals " << corr_and_err.first << " " << corr_and_err.second << std::endl;
0039     float new_val = h->GetBinContent(bin)*(1.-corr_and_err.first);
0040     float new_err = new_val * sqrt(pow(h->GetBinError(bin)/h->GetBinContent(bin),2.)+pow(corr_and_err.second/corr_and_err.first,2.));
0041     h->SetBinContent(bin,new_val);
0042     h->SetBinError(bin,new_err);
0043 */
0044   }
0045 
0046 };
0047 
0048 #endif