Skip to content

Commit 17deebe

Browse files
committed
fix: updates w.r.t. main
1 parent 89a01a1 commit 17deebe

File tree

7 files changed

+34
-25
lines changed

7 files changed

+34
-25
lines changed

macro/dihadrons/analysis.C

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
R__LOAD_LIBRARY(Sidis-eic)
1+
// SPDX-License-Identifier: LGPL-3.0-or-later
2+
// Copyright (C) 2022 Christopher Dilks
3+
4+
R__LOAD_LIBRARY(EpicAnalysis)
25

36
void analysis(
47
TString source="delphes",

src/Analysis.cxx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,9 @@ void Analysis::Prepare() {
322322
// instantiate shared objects
323323
kin = new Kinematics(eleBeamEn, ionBeamEn, crossingAngle);
324324
kinTrue = new Kinematics(eleBeamEn, ionBeamEn, crossingAngle);
325-
ST = new SimpleTree("tree",kin,kinTrue);
326-
HFST = new HFSTree("hfstree",kin,kinTrue);
327-
PT = new ParticleTree("ptree");
325+
ST = new SimpleTree("tree",kin,kinTrue);
326+
HFST = new HFSTree("hfstree",kin,kinTrue);
327+
PT = new ParticleTree("ptree");
328328

329329
// if including jets, define a `jet` final state
330330
#ifndef EXCLUDE_DELPHES
@@ -915,21 +915,20 @@ void Analysis::FillHistos1h(Double_t wgt) {
915915
};
916916

917917
// fill 2h (dihadron) histograms
918-
void Analysis::FillHistosDihadrons() {
919-
HD->CheckBins();
920-
HD->Payload([this](Histos *H){
921-
H->FillHist1D("DihMh", dih->Mh, wTrack);
922-
H->FillHist1D("DihMX", dih->MX, wTrack);
923-
H->FillHist1D("DihZ", dih->Z, wTrack);
924-
H->FillHist1D("DihPhPerp", dih->PhPerp, wTrack);
925-
H->FillHist1D("DihTheta", dih->Theta, wTrack);
926-
H->FillHist1D("DihPhiH", dih->PhiH, wTrack);
927-
H->FillHist1D("DihPhiR", dih->PhiR, wTrack);
928-
H->FillHist1D("DihPhiS", dih->PhiS, wTrack);
929-
H->FillHist2D("DihPhiHvsPhiR", dih->PhiR, dih->PhiH, wTrack);
930-
H->FillHist2D("DihThetaVsPh", dih->Ph, dih->Theta, wTrack);
931-
});
932-
HD->ExecuteOps(true);
918+
void Analysis::FillHistos2h(Double_t wgt) {
919+
auto fill_payload = [this,wgt] (Histos *H) {
920+
H->FillHist1D("DihMh", dih->Mh, wgt);
921+
H->FillHist1D("DihMX", dih->MX, wgt);
922+
H->FillHist1D("DihZ", dih->Z, wgt);
923+
H->FillHist1D("DihPhPerp", dih->PhPerp, wgt);
924+
H->FillHist1D("DihTheta", dih->Theta, wgt);
925+
H->FillHist1D("DihPhiH", dih->PhiH, wgt);
926+
H->FillHist1D("DihPhiR", dih->PhiR, wgt);
927+
H->FillHist1D("DihPhiS", dih->PhiS, wgt);
928+
H->FillHist2D("DihPhiHvsPhiR", dih->PhiR, dih->PhiH, wgt);
929+
H->FillHist2D("DihThetaVsPh", dih->Ph, dih->Theta, wgt);
930+
};
931+
FillHistos(fill_payload);
933932
}
934933

935934
// fill jet histograms

src/Analysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Analysis : public TNamed
127127
// `FillHistos(weight)` methods: fill histograms
128128
void FillHistosInclusive(Double_t wgt); // inclusive kinematics
129129
void FillHistos1h(Double_t wgt); // single-hadron kinematics
130-
void FillHistosDihadrons();
130+
void FillHistos2h(Double_t wgt); // dihadron kinematics
131131
void FillHistosJets(Double_t wgt); // jet kinematics
132132

133133
// shared objects

src/AnalysisDelphes.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ void AnalysisDelphes::Execute() {
236236
}; // end track loop
237237

238238
// dihadrons - - - - - - - - - - - - - - - - - - - - - - - - - - - -
239-
if(includeOutputSet["2h"]) dihSet->CalculateKinematics(this);
239+
if(includeOutputSet["2h"])
240+
dihSet->CalculateKinematics(this, Q2weightFactor * weightTrack->GetWeight(*kinTrue)); // FIXME: need separate `Weights` object?
240241

241242
// jet loop - - - - - - - - - - - - - - - - - - - - - - - - - - - -
242243
if(includeOutputSet["jets"]) {

src/AnalysisEpicPodio.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void AnalysisEpicPodio::Execute()
241241
// - check PID, to see if it's a final state we're interested in
242242
auto kv = PIDtoFinalState.find(recPDG);
243243
if(kv!=PIDtoFinalState.end()) finalStateID = kv->second; else return;
244-
if(activeFinalStates.find(finalStateID)==activeFinalStates.end()) return;
244+
if(!IsFinalState(finalStateID)) return;
245245

246246
// set SIDIS particle 4-momenta, and calculate their kinematics
247247
kinTrue->vecHadron = GetP4(simPart);

src/Dihadrons.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// SPDX-License-Identifier: LGPL-3.0-or-later
2+
// Copyright (C) 2022 Christopher Dilks
3+
14
#include "Dihadrons.h"
25

36
ClassImp(DihadronSet)
@@ -81,7 +84,7 @@ void DihadronSet::AddHadron(Analysis *A) {
8184
hadSetGen[A->finalStateID].push_back( A->kinTrue->vecHadron );
8285
}
8386

84-
void DihadronSet::CalculateKinematics(Analysis *A) {
87+
void DihadronSet::CalculateKinematics(Analysis *A, Double_t wgt) {
8588

8689
// TODO: this does not yet handle generalized dihadrons
8790
if(includedHadrons.size()!=2) fmt::print("ERROR: more or less than 2 final states defined for DihadronSet\n");
@@ -107,7 +110,7 @@ void DihadronSet::CalculateKinematics(Analysis *A) {
107110
A->dihTrue = &(dihListGen[i]);
108111
auto finalStateID_tmp = A->finalStateID; // temporarily change Analysis::finalStateID
109112
A->finalStateID = dihadronFinalStateID; // to that of this DihadronSet
110-
A->FillHistosDihadrons();
113+
A->FillHistos2h(wgt);
111114
A->finalStateID = finalStateID_tmp; // revert Analysis::finalStateID
112115
}
113116

src/Dihadrons.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// SPDX-License-Identifier: LGPL-3.0-or-later
2+
// Copyright (C) 2022 Christopher Dilks
3+
14
#pragma once
25

36
#include <vector>
@@ -24,7 +27,7 @@ class DihadronSet {
2427
void IncludeHadron(TString hadName);
2528
void AddHadron(Analysis *A);
2629
void SetFinalStateID(TString state) { dihadronFinalStateID = state; }
27-
void CalculateKinematics(Analysis *A);
30+
void CalculateKinematics(Analysis *A, Double_t wgt=1.0);
2831
private:
2932
std::vector<TString> includedHadrons;
3033
std::map<TString,std::vector<TLorentzVector>> hadSetRec, hadSetGen;

0 commit comments

Comments
 (0)