-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HFS simple tree + neural network predictions using pybind (#214)
- Loading branch information
Showing
12 changed files
with
392 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# main ignores | ||
.*.sw* | ||
*~ | ||
*.hepmc* | ||
*.root | ||
*.pcm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
// Copyright (C) 2022 Connor Pecar | ||
|
||
R__LOAD_LIBRARY(EpicAnalysis) | ||
#include <pybind11/embed.h> | ||
namespace py = pybind11; | ||
// using ML prediction for vecQ, and writing out tree of HFS four-vectors | ||
// requires pybind includes above | ||
void analysis_testml( | ||
TString configFile="datarec/in.config", /* delphes tree(s) */ | ||
TString outfilePrefix="resolutions" /* output filename prefix*/ | ||
) { | ||
// object needed at start of script using pybind11 | ||
py::scoped_interpreter guard{}; | ||
//outfilePrefix+="_DA"; | ||
// setup analysis ======================================== | ||
AnalysisEcce *A = new AnalysisEcce( | ||
configFile, | ||
outfilePrefix | ||
); | ||
|
||
A->maxEvents = 10000; // use this to limit the number of events | ||
A->writeSimpleTree = true; // write SimpleTree (for one bin) | ||
A->writeHFSTree = true; // write HFSTree (for one bin) | ||
A->SetReconMethod("ML"); // set reconstruction method | ||
A->AddFinalState("pipTrack"); // pion final state | ||
//A->AddFinalState("KpTrack"); // kaon final state | ||
|
||
|
||
// define cuts ==================================== | ||
A->AddBinScheme("w"); A->BinScheme("w")->BuildBin("Min",3.0); // W > 3 GeV | ||
//A->AddBinScheme("xF"); A->BinScheme("xF")->BuildBin("Min",0.0); // xF > 0 | ||
//A->AddBinScheme("ptLab"); A->BinScheme("ptLab")->BuildBin("Min",0.1); // pT_lab > 0.1 GeV (tracking limit) | ||
|
||
|
||
// set binning scheme ==================================== | ||
// z ranges | ||
//A->AddBinScheme("z"); | ||
//A->BinScheme("z")->BuildBin("Min",0.2); // needed? | ||
|
||
// y minima | ||
A->AddBinScheme("y"); | ||
A->BinScheme("y")->BuildBin("Full"); // a bin with no y-cut | ||
|
||
// perform the analysis ================================== | ||
A->Execute(); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
// Copyright (C) 2022 Connor Pecar | ||
|
||
#include "HFSTree.h" | ||
|
||
ClassImp(HFSTree) | ||
|
||
// constructor | ||
HFSTree::HFSTree(TString treeName_, Kinematics *K_, Kinematics *Ktrue_) | ||
: treeName(treeName_) | ||
, K(K_) | ||
, Ktrue(Ktrue_) | ||
{ | ||
T = new TTree(treeName,treeName); | ||
T->Branch("vecElectron", &(K->vecElectron)); | ||
T->Branch("vecElectronTrue", &(Ktrue->vecElectron)); | ||
T->Branch("vecEleBeamTrue", &(Ktrue->vecEleBeam)); | ||
T->Branch("vecIonBeamTrue", &(Ktrue->vecIonBeam)); | ||
T->Branch("nHFS", &(K->nHFS), "nHFS/I"); | ||
T->Branch("hfsp4", &(K->hfsp4)); | ||
//T->Branch("hfspy", &(K->hfspy), "hfspy[nHFS]/F"); | ||
//T->Branch("hfspz", &(K->hfspz), "hfspz[nHFS]/F"); | ||
//T->Branch("hfsE", &(K->hfsE), "hfsE[nHFS]/F"); | ||
T->Branch("hfspid", &(K->hfspid), "hfspid[nHFS]/F"); | ||
T->Branch("weight", &(weight), "weight/D"); | ||
}; | ||
|
||
// destructor | ||
HFSTree::~HFSTree() { | ||
}; | ||
|
Oops, something went wrong.