Skip to content

Commit

Permalink
fix: updates w.r.t. main
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Jan 9, 2023
1 parent 89a01a1 commit 17deebe
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 25 deletions.
5 changes: 4 additions & 1 deletion macro/dihadrons/analysis.C
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
R__LOAD_LIBRARY(Sidis-eic)
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2022 Christopher Dilks

R__LOAD_LIBRARY(EpicAnalysis)

void analysis(
TString source="delphes",
Expand Down
35 changes: 17 additions & 18 deletions src/Analysis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ void Analysis::Prepare() {
// instantiate shared objects
kin = new Kinematics(eleBeamEn, ionBeamEn, crossingAngle);
kinTrue = new Kinematics(eleBeamEn, ionBeamEn, crossingAngle);
ST = new SimpleTree("tree",kin,kinTrue);
HFST = new HFSTree("hfstree",kin,kinTrue);
PT = new ParticleTree("ptree");
ST = new SimpleTree("tree",kin,kinTrue);
HFST = new HFSTree("hfstree",kin,kinTrue);
PT = new ParticleTree("ptree");

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

// fill 2h (dihadron) histograms
void Analysis::FillHistosDihadrons() {
HD->CheckBins();
HD->Payload([this](Histos *H){
H->FillHist1D("DihMh", dih->Mh, wTrack);
H->FillHist1D("DihMX", dih->MX, wTrack);
H->FillHist1D("DihZ", dih->Z, wTrack);
H->FillHist1D("DihPhPerp", dih->PhPerp, wTrack);
H->FillHist1D("DihTheta", dih->Theta, wTrack);
H->FillHist1D("DihPhiH", dih->PhiH, wTrack);
H->FillHist1D("DihPhiR", dih->PhiR, wTrack);
H->FillHist1D("DihPhiS", dih->PhiS, wTrack);
H->FillHist2D("DihPhiHvsPhiR", dih->PhiR, dih->PhiH, wTrack);
H->FillHist2D("DihThetaVsPh", dih->Ph, dih->Theta, wTrack);
});
HD->ExecuteOps(true);
void Analysis::FillHistos2h(Double_t wgt) {
auto fill_payload = [this,wgt] (Histos *H) {
H->FillHist1D("DihMh", dih->Mh, wgt);
H->FillHist1D("DihMX", dih->MX, wgt);
H->FillHist1D("DihZ", dih->Z, wgt);
H->FillHist1D("DihPhPerp", dih->PhPerp, wgt);
H->FillHist1D("DihTheta", dih->Theta, wgt);
H->FillHist1D("DihPhiH", dih->PhiH, wgt);
H->FillHist1D("DihPhiR", dih->PhiR, wgt);
H->FillHist1D("DihPhiS", dih->PhiS, wgt);
H->FillHist2D("DihPhiHvsPhiR", dih->PhiR, dih->PhiH, wgt);
H->FillHist2D("DihThetaVsPh", dih->Ph, dih->Theta, wgt);
};
FillHistos(fill_payload);
}

// fill jet histograms
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Analysis : public TNamed
// `FillHistos(weight)` methods: fill histograms
void FillHistosInclusive(Double_t wgt); // inclusive kinematics
void FillHistos1h(Double_t wgt); // single-hadron kinematics
void FillHistosDihadrons();
void FillHistos2h(Double_t wgt); // dihadron kinematics
void FillHistosJets(Double_t wgt); // jet kinematics

// shared objects
Expand Down
3 changes: 2 additions & 1 deletion src/AnalysisDelphes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ void AnalysisDelphes::Execute() {
}; // end track loop

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

// jet loop - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if(includeOutputSet["jets"]) {
Expand Down
2 changes: 1 addition & 1 deletion src/AnalysisEpicPodio.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void AnalysisEpicPodio::Execute()
// - check PID, to see if it's a final state we're interested in
auto kv = PIDtoFinalState.find(recPDG);
if(kv!=PIDtoFinalState.end()) finalStateID = kv->second; else return;
if(activeFinalStates.find(finalStateID)==activeFinalStates.end()) return;
if(!IsFinalState(finalStateID)) return;

// set SIDIS particle 4-momenta, and calculate their kinematics
kinTrue->vecHadron = GetP4(simPart);
Expand Down
7 changes: 5 additions & 2 deletions src/Dihadrons.cxx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2022 Christopher Dilks

#include "Dihadrons.h"

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

void DihadronSet::CalculateKinematics(Analysis *A) {
void DihadronSet::CalculateKinematics(Analysis *A, Double_t wgt) {

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

Expand Down
5 changes: 4 additions & 1 deletion src/Dihadrons.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2022 Christopher Dilks

#pragma once

#include <vector>
Expand All @@ -24,7 +27,7 @@ class DihadronSet {
void IncludeHadron(TString hadName);
void AddHadron(Analysis *A);
void SetFinalStateID(TString state) { dihadronFinalStateID = state; }
void CalculateKinematics(Analysis *A);
void CalculateKinematics(Analysis *A, Double_t wgt=1.0);
private:
std::vector<TString> includedHadrons;
std::map<TString,std::vector<TLorentzVector>> hadSetRec, hadSetGen;
Expand Down

0 comments on commit 17deebe

Please sign in to comment.