Skip to content

Commit

Permalink
Added MuonFitter updates to PhaseIITreeMaker
Browse files Browse the repository at this point in the history
  • Loading branch information
James Minock committed Oct 2, 2024
1 parent ff86893 commit aaf14ce
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
55 changes: 54 additions & 1 deletion UserTools/PhaseIITreeMaker/PhaseIITreeMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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 @@ -106,6 +108,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");
}

}

Expand Down Expand Up @@ -422,6 +433,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 @@ -641,6 +663,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 @@ -907,6 +939,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 @@ -1200,7 +1244,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 @@ -425,6 +425,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 @@ -452,6 +459,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
1 change: 1 addition & 0 deletions configfiles/CC_MC_RECO_ntuple/PhaseIITreeMakerConfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ TankReco_fill 1
SimpleReco_fill 1
RingCounting_fill 1
Reweight_fill 1
MuonFitter_fill 1

OutputFile PhaseIITree_0.0.0.root
#NumEventsWritten 2000

0 comments on commit aaf14ce

Please sign in to comment.