数字をダンプばかりしてもはっきりしないことが多々あります。ここでは補正前と後のElectronのpTをヒストグラムにつめてみましょう。 MyxNewAnalysis.hに以下のヘッダーファイルを追加します。
#include <TH1.h>
メンバ変数に以下を追加です。
TH1 *h_electronPtOriginal; //!
TH1 *h_electronPtCorrected; //!
MyxNewAnalysis.cxxのhistInitialize ()でヒストグラムを定義します:
h_electronPtOriginal = new TH1F("h_electronPtOriginal", "h_electronPtOriginal", 100, 0, 100);
wk()->addOutput(h_electronPtOriginal);
h_electronPtCorrected = new TH1F("h_electronPtCorrected", "h_electronPtCorrected", 100, 0, 100);
wk()->addOutput(h_electronPtCorrected);
execute()のelectron loopの中でfillします。Medium selectionを通ったものだけfillしてみます。ついでに電磁カロリメーターのcoverageを考慮して、|η|<2.47のカットもかけてみましょう。
// Electrons
const xAOD::ElectronContainer* electrons = nullptr;
ANA_CHECK(event->retrieve( electrons, "Electrons"));
xAOD::ElectronContainer::const_iterator electron_itr = electrons->begin();
xAOD::ElectronContainer::const_iterator electron_end = electrons->end();
for ( ; electron_itr != electron_end; ++electron_itr ){
bool LHMediumSel = m_MediumLH->accept((*electron_itr));
if ( !LHMediumSel ) continue;
if( fabs((*electron_itr)->eta()) > 2.47 ) continue;
h_electronPtOriginal->Fill( (*electron_itr)->pt()*0.001 );
Info("execute()", " electron pt = %.2f GeV", ((*electron_itr)->pt()*0.001));
}
std::pair< xAOD::ElectronContainer*, xAOD::ShallowAuxContainer* > electrons_shallowCopy = xAOD::shallowCopyContainer( *electrons );
xAOD::ElectronContainer::iterator electronSC_itr = (electrons_shallowCopy.first)->begin();
xAOD::ElectronContainer::iterator electronSC_end = (electrons_shallowCopy.first)->end();
for( ; electronSC_itr != electronSC_end; ++electronSC_itr ) {
if(m_electronCalibrationAndSmearingTool->applyCorrection(**electronSC_itr) == CP::CorrectionCode::Error){
Error("execute()", "ElectronCalibrationAndSmearingTool returns Error CorrectionCode");
}
bool LHMediumSel = m_MediumLH->accept((*electronSC_itr));
if ( !LHMediumSel ) continue;
if ( fabs((*electronSC_itr)->eta()) > 2.47 ) continue;
h_electronPtCorrected->Fill( (*electronSC_itr)->pt()*0.001 );
Info("execute()", " corrected electron pt = %.2f GeV", ((*electronSC_itr)->pt() * 0.001));
}
delete electrons_shallowCopy.first;
delete electrons_shallowCopy.second;
補正前の電子にもmediumLHカットをかけるようにしてみました。
コンパイルして、実行してください。アウトプットdirectoryの中に出来ている submitDir/hist-data16_13TeV.00311481.physics_Main.merge.DAOD_HIGG2D4.f758_m1710_p2880.rootというファイルをROOTで開いてみます。
$ root -l submitDir/hist-data16_13TeV.00310247.physics_Main.merge.DAOD_HIGG2D4.f755_m1699_p2880.root
root [0]
Attaching file hist-data16_13TeV.00310247.physics_Main.merge.DAOD_HIGG2D4.f755_m1699_p2880.rootas _file0...
(class TFile *) 0x23ce080
root [1] .ls
TFile** submitDir/hist-data16_13TeV.00310247.physics_Main.merge.DAOD_HIGG2D4.f755_m1699_p2880.root
TFile* submitDir/hist-data16_13TeV.00310247.physics_Main.merge.DAOD_HIGG2D4.f755_m1699_p2880.root
KEY: TTree EventLoop_FileExecuted;1 executed files
KEY: TH1D EventLoop_EventCount;1 number of events per algorithm
KEY: TH1D EventLoop_RunTime;1 worker run-time summary
KEY: TH1F h_electronPtOriginal;1 h_electronPtOriginal
KEY: TH1F h_electronPtCorrected;1 h_electronPtCorrected
root [2] h_electronPtOriginal->Draw()
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root [3] h_electronPtCorrected->SetLineColor(kRed)
root [5] h_electronPtCorrected->Draw("same")
補正がかけられているのが図で見てわかります。