Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added MuonFitter updates to PhaseIITreeMaker #296

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
55 changes: 54 additions & 1 deletion UserTools/PhaseIITreeMaker/PhaseIITreeMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ bool PhaseIITreeMaker::Initialise(std::string configfile, DataModel &data){

m_variables.Get("Digit_fill",Digit_fill);

m_variables.Get("MuonFitter_fill", MuonFitter_fill);

std::string output_filename;
m_variables.Get("OutputFile", output_filename);
fOutput_tfile = new TFile(output_filename.c_str(), "recreate");
Expand Down Expand Up @@ -108,6 +110,15 @@ bool PhaseIITreeMaker::Initialise(std::string configfile, DataModel &data){
fPhaseIITankClusterTree->Branch("SiPM1NPulses",&fSiPM1NPulses,"SiPM1NPulses/I");
fPhaseIITankClusterTree->Branch("SiPM2NPulses",&fSiPM2NPulses,"SiPM2NPulses/I");
}
//MuonFitter reco track length, vtx, energy; juju
if (MuonFitter_fill)
{
fPhaseIITankClusterTree->Branch("recoMuonVtxX", &fRecoMuonVtxX, "recoMuonVtxX/D");
fPhaseIITankClusterTree->Branch("recoMuonVtxY", &fRecoMuonVtxY, "recoMuonVtxY/D");
fPhaseIITankClusterTree->Branch("recoMuonVtxZ", &fRecoMuonVtxZ, "recoMuonVtxZ/D");
fPhaseIITankClusterTree->Branch("recoTankTrack", &fRecoTankTrack, "recoTankTrack/D");
fPhaseIITankClusterTree->Branch("recoMuonKE", &fRecoMuonKE, "recoMuonKE/D");
}
// MC BNB spill structure timing - AssignBunchTimingMC tool
if(hasBNBtimingMC){
fPhaseIITankClusterTree->Branch("bunchTimes",&fbunchTimes,"bunchTimes/D");
Expand Down Expand Up @@ -433,6 +444,17 @@ bool PhaseIITreeMaker::Initialise(std::string configfile, DataModel &data){
fPhaseIITrigTree->Branch("weight_nucleonqexsec_FluxUnisim",&fnucleonqexsec);
fPhaseIITrigTree->Branch("weight_nucleontotxsec_FluxUnisim",&fnucleontotxsec);
}

//MuonFitter reco track length, vtx, energy; juju
if (MuonFitter_fill)
{
fPhaseIITrigTree->Branch("recoMuonVtxX", &fRecoMuonVtxX, "recoMuonVtxX/D");
fPhaseIITrigTree->Branch("recoMuonVtxY", &fRecoMuonVtxY, "recoMuonVtxY/D");
fPhaseIITrigTree->Branch("recoMuonVtxZ", &fRecoMuonVtxZ, "recoMuonVtxZ/D");
fPhaseIITrigTree->Branch("recoTankTrack", &fRecoTankTrack, "recoTankTrack/D");
fPhaseIITrigTree->Branch("recoMuonKE", &fRecoMuonKE, "recoMuonKE/D");
fPhaseIITrigTree->Branch("numMrdLayers", &fNumMrdLayers, "numMrdLayers/I");
}

// Reconstructed variables from each step in Muon Reco Analysis
// Currently output when RecoDebug_fill = 1 in config
Expand Down Expand Up @@ -656,6 +678,16 @@ bool PhaseIITreeMaker::Execute(){
}

if(SiPMPulseInfo_fill) this->LoadSiPMHits();
if (MuonFitter_fill)
{
Position tmp_vtx(-999,-999,-999);
m_data->CStore.Get("FittedMuonVertex", tmp_vtx);
fRecoMuonVtxX = tmp_vtx.X();
fRecoMuonVtxY = tmp_vtx.Y();
fRecoMuonVtxZ = tmp_vtx.Z();
m_data->CStore.Get("FittedTrackLengthInWater", fRecoTankTrack);
m_data->CStore.Get("RecoMuonKE", fRecoMuonKE);
}
fPhaseIITankClusterTree->Fill();
cluster_num += 1;
if (isData){
Expand Down Expand Up @@ -922,6 +954,18 @@ bool PhaseIITreeMaker::Execute(){
// FIll tree with all reconstruction information
if (RecoDebug_fill) this->FillRecoDebugInfo();

if (MuonFitter_fill)
{
Position tmp_vtx(-999,-999,-999);
m_data->CStore.Get("FittedMuonVertex", tmp_vtx);
fRecoMuonVtxX = tmp_vtx.X();
fRecoMuonVtxY = tmp_vtx.Y();
fRecoMuonVtxZ = tmp_vtx.Z();
m_data->CStore.Get("FittedTrackLengthInWater", fRecoTankTrack);
m_data->CStore.Get("RecoMuonKE", fRecoMuonKE);
m_data->CStore.Get("NLyers", fNumMrdLayers);
}

fPhaseIITrigTree->Fill();
}
return true;
Expand Down Expand Up @@ -1225,7 +1269,16 @@ void PhaseIITreeMaker::ResetVariables() {
fdigitT.clear();
}
//DIGITS


if (MuonFitter_fill)
{
fRecoMuonVtxX = -9999;
fRecoMuonVtxY = -9999;
fRecoMuonVtxZ = -9999;
fRecoTankTrack = -9999;
fRecoMuonKE = -9999;
fNumMrdLayers = -9999;
}
}

bool PhaseIITreeMaker::LoadTankClusterClassifiers(double cluster_time){
Expand Down
8 changes: 8 additions & 0 deletions UserTools/PhaseIITreeMaker/PhaseIITreeMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,13 @@ class PhaseIITreeMaker: public Tool {
double fDeltaZenith;
double fDeltaAngle;

// MuonFitter vertex
double fRecoMuonVtxX;
double fRecoMuonVtxY;
double fRecoMuonVtxZ;
double fRecoTankTrack;
double fRecoMuonKE;
int fNumMrdLayers;

/// \brief Integer that determines the level of logging to perform
int verbosity = 0;
Expand Down Expand Up @@ -464,6 +471,7 @@ class PhaseIITreeMaker: public Tool {
bool muonTruthRecoDiff_fill = 0; //Output difference in tmuonruth and reconstructed values
bool SiPMPulseInfo_fill = 0;
bool Digit_fill = 0;
bool MuonFitter_fill = 0;
};


Expand Down