Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
377ce9e
Changes to evDisp. Modified the colours of the display so that it mor…
JackFannon Jun 9, 2022
73b8a08
Added tools that have begun to port over the SK4 spallation reduction…
JackFannon Jun 9, 2022
da01e96
Added ParticleCand.h, missed on previous commit
JackFannon Jun 9, 2022
4ed120b
missing files
JackFannon Jun 9, 2022
2cf2dbd
Changes to MakeFile so SKAnalysis plays nicely with Sukap and changed…
JackFannon Jun 14, 2022
b63e793
Changed the writeSpallCand tool to writeMuonCand to better reflect th…
JackFannon Jun 14, 2022
7fc1060
Cleaning up before rebase
JackFannon Jun 21, 2022
1ab2e15
pulled in the SpallTMVA tool
JackFannon Jun 29, 2022
d83fbd9
misc
JackFannon Jul 1, 2022
f986dad
Fixed missing tools
JackFannon Jul 1, 2022
cd56873
Reweight tool now calculates the weights for each events and saves th…
JackFannon Jul 6, 2022
6170e32
Added ApplySRNWeight tool. This tool will take an existing, flat spec…
JackFannon Jul 6, 2022
47ef224
Added muon matching tools and toolchain
JackFannon Aug 2, 2023
17d0900
added all
JackFannon Aug 2, 2023
05eb730
Cleaned up and added hitscutconfig
JackFannon Aug 4, 2023
b2fb12d
added to gitignore
JackFannon Sep 25, 2023
c50a115
cleanup
JackFannon Sep 26, 2023
59586fb
setup sources skg4
JackFannon Sep 26, 2023
de18fde
evPlot created
JackFannon Sep 26, 2023
cf92540
event plotter
JackFannon Sep 26, 2023
d1a9aba
Config files for evplot
JackFannon Sep 26, 2023
0ced6ba
Wait primitive
JackFannon Sep 26, 2023
29d6628
Added library path to setup
JackFannon Sep 26, 2023
c89f5db
temp removed skiptriggers
JackFannon Sep 26, 2023
94490b0
different file
JackFannon Sep 26, 2023
d8abdee
bugfixing, commented out drawing
JackFannon Sep 26, 2023
6a42ab7
DEBUGGING: commented T and Q
JackFannon Sep 26, 2023
286e0db
DEBUGGING: removed gracefulstop and hitscut
JackFannon Sep 26, 2023
452c8b7
DEBUGGING: printout
JackFannon Sep 26, 2023
ce186b5
DEBUGGING: was not getting the tqreal branch before
JackFannon Sep 26, 2023
57b5479
DEBUGGING: uncommented code
JackFannon Sep 26, 2023
db7222f
increased number of events to 1000
JackFannon Sep 26, 2023
4b7e24b
wrong variable
JackFannon Sep 26, 2023
6b63571
DEBUG: trying common blocks -- tqreal empty
JackFannon Sep 26, 2023
bd255ad
DEBUG: trying common blocks
JackFannon Sep 26, 2023
9c94a8d
Press enter to continue
JackFannon Sep 26, 2023
22cb86c
Press enter to continue
JackFannon Sep 26, 2023
aadedeb
Press enter to continue
JackFannon Sep 26, 2023
5852e6c
number of hits cut
JackFannon Sep 26, 2023
cceb466
trying pmt number
JackFannon Sep 26, 2023
af604f9
clear histograms
JackFannon Sep 26, 2023
c4d3b01
clear histograms
JackFannon Sep 26, 2023
7b358e5
increased range on T plot
JackFannon Sep 26, 2023
4a8a9b7
auto-setting range
JackFannon Sep 26, 2023
b6382fc
back to cable number
JackFannon Sep 26, 2023
ab2d96f
batch mode and saving to png
JackFannon Sep 27, 2023
c6dafba
cablenumber - 1
JackFannon Sep 27, 2023
0102f8c
print maxval minval
JackFannon Sep 27, 2023
f9e7a66
remove png lol
JackFannon Sep 27, 2023
3c1f874
Print out time
JackFannon Sep 27, 2023
1568890
Binning modified for negative times
JackFannon Sep 27, 2023
7280bf4
commented axis range change
JackFannon Sep 27, 2023
cf69d5d
removed time printout
JackFannon Sep 27, 2023
1683e0e
skt and skq commons
JackFannon Sep 27, 2023
f4da28b
Print out cable number
JackFannon Sep 27, 2023
81ce735
sktqz for channel num
JackFannon Sep 27, 2023
87b5749
changed indexing
JackFannon Sep 27, 2023
f37447e
sktqz and no hit limit
JackFannon Sep 27, 2023
12e736a
rebinned charge
JackFannon Sep 27, 2023
5e656db
don't plot 0s
JackFannon Sep 27, 2023
56de19b
don't print cablenumber
JackFannon Sep 27, 2023
52c8058
charge is a float
JackFannon Sep 27, 2023
0da5d1e
got to recompile
JackFannon Sep 27, 2023
1f49b0e
shifted time binning
JackFannon Sep 27, 2023
4d2b15a
binning
JackFannon Sep 27, 2023
b58a164
bin
JackFannon Sep 27, 2023
73a7097
binning
JackFannon Sep 27, 2023
eac6d0d
output to pages of a pdf
JackFannon Sep 27, 2023
d0781dc
printing
JackFannon Sep 27, 2023
4f3ec16
entries
JackFannon Sep 27, 2023
dbf3765
charge != 0
JackFannon Sep 27, 2023
95d1f1a
Print trigger ID
JackFannon Sep 27, 2023
5c820a3
tostring
JackFannon Sep 27, 2023
466bd57
print out triggers
JackFannon Sep 27, 2023
b217fe6
skhead
JackFannon Sep 27, 2023
499e442
only allow HE and OD
JackFannon Sep 27, 2023
94f737c
print out supression and increased events
JackFannon Sep 27, 2023
65a4439
Removed printouts
JackFannon Sep 27, 2023
6871446
reduced time rang e
JackFannon Sep 27, 2023
6894e82
hist ranges
JackFannon Sep 27, 2023
dffd329
bin ranges
JackFannon Sep 27, 2023
0e76c74
changed 2d binning
JackFannon Sep 27, 2023
4da64ca
added tgraph
JackFannon Sep 27, 2023
7bdc78b
only plot within range, range now config
JackFannon Sep 27, 2023
4f506b2
Graph formatting
JackFannon Sep 27, 2023
1755c25
axis range
JackFannon Sep 27, 2023
212d1a2
graph range
JackFannon Sep 27, 2023
dc53682
JackFannon Sep 27, 2023
eb8e725
JackFannon Sep 27, 2023
cca1dbe
JackFannon Sep 27, 2023
be79bf1
JackFannon Sep 27, 2023
bd301ec
JackFannon Sep 27, 2023
4c8641a
JackFannon Sep 27, 2023
676b191
JackFannon Sep 27, 2023
c7ed0e2
JackFannon Sep 27, 2023
d170b7c
JackFannon Sep 28, 2023
e796b11
dataSrc switch
JackFannon Sep 28, 2023
b84cb0d
fill hist in switch
JackFannon Sep 28, 2023
60d6d14
JackFannon Sep 28, 2023
8103e31
JackFannon Sep 28, 2023
abf5ab0
JackFannon Sep 28, 2023
cfe2033
JackFannon Sep 28, 2023
78d481e
JackFannon Sep 28, 2023
92fbb49
JackFannon Sep 28, 2023
b92b120
JackFannon Sep 28, 2023
0f978c3
JackFannon Sep 28, 2023
a378d9a
JackFannon Sep 28, 2023
d7b8f0d
JackFannon Sep 28, 2023
8bd0847
outputname config
JackFannon Sep 28, 2023
a2afbe6
JackFannon Sep 28, 2023
4605a6c
JackFannon Sep 28, 2023
18392d5
JackFannon Sep 28, 2023
7b4d09d
JackFannon Sep 28, 2023
b9d42f8
JackFannon Sep 28, 2023
f084428
JackFannon Sep 28, 2023
79fab3c
JackFannon Sep 28, 2023
22afafd
JackFannon Sep 28, 2023
4b32a35
JackFannon Sep 28, 2023
be855ac
JackFannon Sep 28, 2023
7f770ba
JackFannon Sep 28, 2023
126f005
JackFannon Sep 28, 2023
28e37d3
JackFannon Sep 28, 2023
872f3d3
JackFannon Sep 28, 2023
67996b6
JackFannon Sep 28, 2023
ba9b72d
JackFannon Sep 28, 2023
5becf74
JackFannon Sep 28, 2023
95b85e7
JackFannon Sep 28, 2023
3ae8504
JackFannon Sep 29, 2023
4513398
JackFannon Sep 29, 2023
70fe03a
JackFannon Sep 29, 2023
5634b51
JackFannon Sep 29, 2023
f2503f1
JackFannon Sep 29, 2023
2cf8128
JackFannon Sep 29, 2023
9533be7
JackFannon Sep 29, 2023
9c29179
JackFannon Sep 29, 2023
81aa594
JackFannon Sep 29, 2023
a436f66
JackFannon Sep 29, 2023
fef6187
JackFannon Sep 29, 2023
83983aa
JackFannon Sep 29, 2023
bd3bf3b
JackFannon Sep 29, 2023
d38b682
JackFannon Sep 29, 2023
07baf9b
JackFannon Sep 29, 2023
f02d23c
JackFannon Sep 29, 2023
4694f2f
JackFannon Sep 29, 2023
528cdbf
JackFannon Sep 29, 2023
e273b54
JackFannon Sep 29, 2023
3dc40e0
JackFannon Sep 29, 2023
37eed56
JackFannon Sep 29, 2023
044e2f1
JackFannon Sep 29, 2023
e8b0bc2
JackFannon Sep 29, 2023
e976bb8
JackFannon Sep 29, 2023
9da2733
JackFannon Sep 29, 2023
7c91b66
JackFannon Sep 29, 2023
3cd3c50
JackFannon Sep 29, 2023
49a7d67
JackFannon Sep 29, 2023
3882954
JackFannon Sep 29, 2023
9e1318c
JackFannon Sep 29, 2023
c07d914
JackFannon Sep 29, 2023
a49ebb6
JackFannon Sep 29, 2023
accdfb0
JackFannon Sep 29, 2023
8e31d4e
JackFannon Sep 29, 2023
e927bed
JackFannon Sep 29, 2023
54ee1e8
JackFannon Sep 29, 2023
7bf34bd
JackFannon Sep 29, 2023
247393c
JackFannon Sep 29, 2023
ffc5030
JackFannon Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
277 changes: 277 additions & 0 deletions #Makefile#

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions #Setup.sh#
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

#Application path location of applicaiton

Dependencies=`pwd`/Dependencies

export LD_LIBRARY_PATH=`pwd`/lib:${Dependencies}/TMVA/lib:$LD_LIBRARY_PATH

for folder in `ls -d ${PWD}/UserTools/*/ `
do
export PYTHONPATH=$folder:${PYTHONPATH}
done

export SEGFAULT_SIGNALS="all"
export LD_LIBRARY_PATH=$PWD/Dependencies/relic_sk4_ana/data_reduc/third/lib:$LD_LIBRARY_PATH
source /usr/local/sklib_gcc8/bashenv_gcc8_skofl_21a+atmpd_21a
source /usr/local/sklib_gcc8/skofl_21a/env.sh

export NEUTRON=1
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ DataModel/NTagDataModelDict.cxx
BStore_RootDict.cxx
BStore_RootDict.h
BStore_Linkdef_1.hh
.cache
.dir-locals.el
*.json
*.png
*.pdf
8 changes: 8 additions & 0 deletions DataModel/Constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,11 @@ double PdgToMass(int code){
return particle->Mass()*1000.; // converted to MeV
}

std::string TriggerIDToTrigger(int code){
if(constants::Trigger_ID_To_Trigger.count(code)){
return constants::Trigger_ID_To_Trigger.at(code);
} else {
return std::to_string(code);
}
}

38 changes: 38 additions & 0 deletions DataModel/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ int G3ParticleCodeToPdg(int code);
int StringToG3ParticleCode(std::string name);
std::string G3ParticleCodeToString(int code);
double PdgToMass(int code);
std::string TriggerIDToTrigger(int code);

enum class SKROOTMODE : int { NONE = 4, ZEBRA = 3, READ = 2, WRITE = 1, COPY = 0 };

Expand Down Expand Up @@ -498,6 +499,43 @@ namespace constants{
{"also_multiple_mu",muboy_classes::also_multiple_mu}
};

static const std::map<int, std::string> Trigger_ID_To_Trigger{
// from skhead.h
// "BLANK #" entries are empty ID numbers in skhead.h
{0, "LE (sftw. trig.)"},
{1, "HE (sftw. trig.)"},
{2, "SLE (sftw. trig.)"},
{3, "OD (sftw. trig.)"},
{4, "Periodic (SKI-III)"},
{5, "After/CAL (SKI-III)"},
{6, "VETO START"},
{7, "VETO STOP"},
{8, "BLANK 8"},
{9, "BLANK 9"},
{10, "BLANK 10"},
{11, "Random Wide Trigger"},
{12, "Laser (ID, Usho Laser)"},
{13, "LED"},
{14, "Ni"},
{15, "Laser (OD, AutoTQlaser)"},
{16, "LE (hitsum)"},
{17, "HE (histum)"},
{18, "SLE (hitsum)"},
{19, "OD (hitsum)"},
{20, "BLANK 20"},
{21, "BLANK 21"},
{22, "SN Burst"},
{23, "mu->e Decay"},
{24, "LINAC"},
{25, "LINAC Microwave"},
{26, "BLANK 26"},
{27, "Periodic (simple)"},
{28, "SHE"},
{29, "AFT"},
{30, "Pedestal"},
{31, "T2K"}
};

// maps of regular expression error codes to descriptive strings
// -------------------------------------------------------------
/*
Expand Down
18 changes: 16 additions & 2 deletions DataModel/DataModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DataModel::DataModel() : eventVariables_p(new BStore(false,true)), eventVariable
}

DataModel::~DataModel(){
if(rootTApp) delete rootTApp;
//if(rootTApp) delete rootTApp; // segfaults on application termination. J. Fannon
//if(connectionTable) delete connectionTable; // segfaults on application termination, maybe?
}

Expand Down Expand Up @@ -57,15 +57,29 @@ TApplication* DataModel::GetTApp(){
return rootTApp;
}

bool DataModel::RegisterReader(std::string readerName, MTreeReader* reader, std::function<bool()> hasAFT, std::function<bool()> loadSHE, std::function<bool()> loadAFT, std::function<bool(int)> loadCommon){
bool DataModel::RegisterReader(std::string readerName, MTreeReader* reader, std::function<bool()> hasAFT, std::function<bool()> loadSHE, std::function<bool()> loadAFT, std::function<bool(int)> loadCommon, std::function<int(long, bool)> getTreeEntry){
Trees.emplace(readerName, reader);
hasAFTs.emplace(readerName, hasAFT);
loadSHEs.emplace(readerName, loadSHE);
loadAFTs.emplace(readerName, loadAFT);
loadCommons.emplace(readerName, loadCommon);
getEntries.emplace(readerName, getTreeEntry);
return true;
}

int DataModel::getTreeEntry(std::string ReaderName, long entrynum){
if(ReaderName==""){
// if no name given but we have only one TreeReader Tool, use that
if(hasAFTs.size()) ReaderName = hasAFTs.begin()->first;
}
if(getEntries.count(ReaderName)){
return getEntries.at(ReaderName)(entrynum, true);
} else {
std::cerr << "getTreeEntry requested for Unknown reader "<<ReaderName<<std::endl;
}
return 0;
}

bool DataModel::HasAFT(std::string ReaderName){
if(ReaderName==""){
// if no name given but we have only one TreeReader Tool, use that
Expand Down
41 changes: 37 additions & 4 deletions DataModel/DataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include "EventTrueCaptures.h"
#include "PMTHitCluster.h"

#include "ParticleCand.h"

#include "skroot_loweC.h"

class MTreeReader;
class MTreeSelection;
class TreeReader;
Expand Down Expand Up @@ -67,14 +71,16 @@ class DataModel {
std::unordered_map<std::string, std::function<bool()>> loadSHEs;
std::unordered_map<std::string, std::function<bool()>> loadAFTs;
std::unordered_map<std::string, std::function<bool(int)>> loadCommons;
std::unordered_map<std::string, std::function<int(long, bool)>> getEntries;

Store vars; ///< This Store can be used for any variables. It is an inefficent ascii based storage and command line arguments will be placed in here along with ToolChain variables
BStore CStore; ///< This is a more efficent binary Store that can be used to store a dynamic set of inter Tool variables, very useful for constants and and flags hence the name CStore
std::map<std::string,BStore*> Stores; ///< This is a map of named BStore pointers which can be deffined to hold a nammed collection of any type of BStore. It is usefull to store data collections that needs subdividing into differnt stores.

// This function is used to register a TreeReader tool's member functions with the DataModel,
// which provides access from other Tools
bool RegisterReader(std::string readerName, MTreeReader* reader, std::function<bool()> hasAFT, std::function<bool()> loadSHE, std::function<bool()> loadAFT, std::function<bool(int)> loadCommon);
bool RegisterReader(std::string readerName, MTreeReader* reader, std::function<bool()> hasAFT, std::function<bool()> loadSHE, std::function<bool()> loadAFT, std::function<bool(int)> loadCommon, std::function<int(long,bool)> getTreeEntry);
int getTreeEntry(std::string ReaderName="", long entrynum=0);
// These retain function pointers to call the corresponding TreeReader functions.
// The TreeReader instance is obtained from the name specified in their config file.
bool HasAFT(std::string ReaderName="");
Expand All @@ -88,8 +94,8 @@ class DataModel {
// wrapper to check if we've called this yet, since we should probably only call it the once?
void KZInit();
bool kz_initialized=false;


// Event vars
BStore* eventVariables_p; // TODO replace with a pointer and update tools to use -> instead of .
BStore &eventVariables; // use references to preserve current behaviour...
Expand All @@ -107,7 +113,34 @@ class DataModel {

std::map<std::string, Store*> tool_configs;
StoreToTTree StoreConverter;


//flag for a new muon - used for the spallation reduction
bool newMuon = false;

//flag for a new relic candidate - used for the spallation reduction
bool newRelic = false;

//deques of the struct ParticleCand to store event info of ALL muon candidates and relic candidates
std::deque<ParticleCand> muonCandDeque;
std::deque<ParticleCand> relicCandDeque;

//deque for muons that need to be reconstructed (if they have matched to a relic they need to be reconstructed)
std::vector<ParticleCand> muonsToRec;

//vector for relic candidate events that needs to be written out - used for the spallation reduction
std::vector<ParticleCand> writeOutRelics;

//map for lowe information to store when reconstructing events mid-chain and wanting to retrieve the information later
std::map<long, skroot_lowe_common> loweCommonBufferMap;

//vector to store weightings in from various SRN models at energy intervals of 0.5 MeV.
std::vector<std::vector<float>> SRNWeights;

//vector to store modelNames for the SRN Models in
std::vector<std::string> SRNModelNames;

bool applyReweight = false;

private:


Expand Down
2 changes: 1 addition & 1 deletion DataModel/MTreeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ int MTreeReader::ParseBranches(){
TClass* ac = TClass::GetClass(lf->GetTypeName());
if(ac!=nullptr){
branch_istobject.emplace(branchname,ac->InheritsFrom("TObject"));
} else {
}else {
std::cerr<<"Unknown class for branch "<<lf->GetBranch()->GetTitle()
<<"! Please make a dictionary."<<std::endl;
// what are the consequences of this? Do we need to remove it from
Expand Down
17 changes: 17 additions & 0 deletions DataModel/ParticleCand.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef PARTICLECAND_H
#define PARTICLECAND_H

#include "skroot_loweC.h"

struct ParticleCand {
int EventNumber;
float EventTime;
int EntryNumber;
int PID = 0; //0 = muon 1 = LowE
std::vector<int> matchedParticleEvNum;
std::vector<float> matchedParticleTimeDiff;
std::vector<float> matchedParticleBSEnergy;
skroot_lowe_common LowECommon;
};

#endif
21 changes: 21 additions & 0 deletions DataModel/fortran_routines.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,33 @@ extern "C" void skcread_(int*, int*);
extern "C" void skroot_set_tree_(int*);
extern "C" void skroot_get_entry_(int*);

extern "C" int softtrg_inittrgtbl_(int*, int*, int*,int*);
extern "C" int softtrg_inittrgtbl(int , int, int, int);

extern "C" void fix_maxqisk_();
extern "C" void lfmufit_sk4_();

extern "C" void newmufit_(float (*)[3], float (*)[3], float*);

//extern "C" void makededx_(float (*)[4], float (*)[3], int (*)[11146], float (*)[11146], float (*)[11146], float (*)[11146][3], int*, float (*)[200]);

extern "C" void makededx_intg_(float (*)[4], float (*)[3], float*, int (*)[11146], float (*)[11146], float (*)[11146], float (*)[11146][3], int*, int*, float (*)[200], int (*)[334380], int*);

extern "C" void mfmuselect_(float (*)[3], float (*)[3], float*, int*);

extern "C" void mffastfast_(float (*)[3], float (*)[3], int*);

extern "C" void muboy_zbs_(int*, int*, float (*)[4], float (*)[3], float*, float*, int*, float (*)[36], int*);

// from $ATMPD_ROOT/src/programs/TreeBuilder/examples/fort_fopen.F
extern "C" void fort_fopen_(int*, const char*, char*, int* ,int);

// read runinf (y/m/d, start time, end time, etc)
extern "C" void runinfsk_();

//

extern "C" void softtrg_get_cond_(int*, int*, int*, int*, int*);
extern "C" void softtrg_set_cond_(int*, int*, int*, int*, int*);
extern "C" void get_sub_triggers_(int*, int*, int*, int*);
extern "C" void set_timing_gate_(int*);
Expand All @@ -75,6 +95,7 @@ extern "C" void lfallfit_sk4_final_qe43_(float*, int*, int*, int*, int*);
extern "C" void lfallfit_sk4_data_(float*, int*, int*);
extern "C" void lfallfit_sk4_gain_corr_(float*, int*, int*, int*, int*);
extern "C" void lfallfit_sk4_mc_(float*, int*, int*);
extern "C" void lfallfit_sk6_mc_(float*, int*, int*, int*, int*);
// skroot_lowe_ common block

extern "C" void rluxgo_(int*, int*, int*, int*);
Expand Down
33 changes: 33 additions & 0 deletions FluxModels/ando.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
3 1.05239
4 1.26815
5 1.28199
6 1.18259
7 1.0366
8 0.88051
9 0.732413
10 0.601257
11 0.489383
12 0.396725
13 0.320967
14 0.259602
15 0.210367
16 0.17068
17 0.138815
18 0.113143
19 0.0923727
20 0.075644
21 0.0620584
22 0.0510444
23 0.0420982
24 0.0347902
25 0.0288424
26 0.023958
27 0.0199445
28 0.0166415
29 0.0139067
30 0.0116483
31 0.00977277
32 0.008211
33 0.00691467
34 0.00582942
35 0.00492365
Loading