Skip to content

Commit

Permalink
Add bunchTimes to PhaseIITreeMaker (#305)
Browse files Browse the repository at this point in the history
* Update README.md

Beef up README for PhaseIITreeMaker

* Add files via upload

Changes to PhaseIITreeMaker to read bunchTimes from the AssignBunchTimingMC tool
  • Loading branch information
S81D authored Nov 18, 2024
1 parent 5cb8e45 commit 62910f6
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 10 deletions.
27 changes: 26 additions & 1 deletion UserTools/PhaseIITreeMaker/PhaseIITreeMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ bool PhaseIITreeMaker::Initialise(std::string configfile, DataModel &data){
/////////////////////////////////////////////////////////////////

hasGenie = false;
hasBNBtimingMC = false;

m_variables.Get("verbose", verbosity);
m_variables.Get("IsData",isData);
m_variables.Get("HasGenie",hasGenie);
m_variables.Get("HasBNBtimingMC",hasBNBtimingMC);
m_variables.Get("TankHitInfo_fill", TankHitInfo_fill);
m_variables.Get("MRDHitInfo_fill", MRDHitInfo_fill);
m_variables.Get("fillCleanEventsOnly", fillCleanEventsOnly);
Expand Down Expand Up @@ -106,7 +108,10 @@ bool PhaseIITreeMaker::Initialise(std::string configfile, DataModel &data){
fPhaseIITankClusterTree->Branch("SiPM1NPulses",&fSiPM1NPulses,"SiPM1NPulses/I");
fPhaseIITankClusterTree->Branch("SiPM2NPulses",&fSiPM2NPulses,"SiPM2NPulses/I");
}

// MC BNB spill structure timing - AssignBunchTimingMC tool
if(hasBNBtimingMC){
fPhaseIITankClusterTree->Branch("bunchTimes",&fbunchTimes,"bunchTimes/D");
}
}

if(MRDClusterProcessing){
Expand Down Expand Up @@ -644,6 +649,10 @@ bool PhaseIITreeMaker::Execute(){
if(!good_class){
if(verbosity>3) Log("PhaseIITreeMaker Tool: No cluster classifiers. Continuing tree",v_debug,verbosity);
}
bool good_bunch = this->LoadBNBtimingMC(it_cluster_pair_mc->first);
if(!good_bunch){
if(verbosity>v_debug) Log("PhaseIITreeMaker Tool: BNB timing (MC). Continuing tree",v_debug,verbosity);
}
}

if(SiPMPulseInfo_fill) this->LoadSiPMHits();
Expand Down Expand Up @@ -958,6 +967,10 @@ void PhaseIITreeMaker::ResetVariables() {
fSiPMNum.clear();
}

if(hasBNBtimingMC){
fbunchTimes = -9999;
}

if(TankClusterProcessing){
fClusterMaxPE = -9999;
fClusterChargePointX = -9999;
Expand Down Expand Up @@ -1237,6 +1250,18 @@ bool PhaseIITreeMaker::LoadTankClusterClassifiers(double cluster_time){
return good_classifiers;
}

bool PhaseIITreeMaker::LoadBNBtimingMC(double cluster_time){
Log("PhaseITreeMaker tool: Getting BNB timing (MC)", v_debug, verbosity);
bool got_bnb_times = m_data->Stores.at("ANNIEEvent")->Get("bunchTimes", bunchTimes);
if(!got_bnb_times){
Log("PhaseITreeMaker tool: BNB timing (MC) not found!", v_debug, verbosity);
} else {
Log("PhaseITreeMaker tool: Setting fbunchTimes variables", v_debug, verbosity);
fbunchTimes = bunchTimes.at(cluster_time);
}
return got_bnb_times;
}

void PhaseIITreeMaker::LoadTankClusterHits(std::vector<Hit> cluster_hits){
Position detector_center=geom->GetTankCentre();
double tank_center_x = detector_center.X();
Expand Down
6 changes: 6 additions & 0 deletions UserTools/PhaseIITreeMaker/PhaseIITreeMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class PhaseIITreeMaker: public Tool {
void LoadTankClusterHits(std::vector<Hit> cluster_hits);
void LoadTankClusterHitsMC(std::vector<MCHit> cluster_hits,std::vector<unsigned long> cluster_detkeys);
bool LoadTankClusterClassifiers(double cluster_time);
bool LoadBNBtimingMC(double cluster_time);
void LoadAllTankHits(bool IsData);
void LoadSiPMHits();

Expand All @@ -85,6 +86,7 @@ class PhaseIITreeMaker: public Tool {
//General variables
bool isData;
bool hasGenie;
bool hasBNBtimingMC;

std::map<int,std::string>* AuxChannelNumToTypeMap;
std::map<int,double> ChannelKeyToSPEMap;
Expand Down Expand Up @@ -206,6 +208,10 @@ class PhaseIITreeMaker: public Tool {
std::vector<int> fADCWaveformChankeys;
std::vector<int> fADCWaveformSamples;

// ************** MC BNB Spill Structure ************* //
std::map<double,double> bunchTimes;
double fbunchTimes;

// ************ Muon reconstruction level information ******** //
std::string MRDTriggertype;
std::vector<BoostStore>* theMrdTracks; // the reconstructed tracks
Expand Down
38 changes: 29 additions & 9 deletions UserTools/PhaseIITreeMaker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,44 @@ verbose (1 or 0)
Defines the level of verbosity for outputs of PhaseIITreeMaker algorithm.
OutputFile TestFile.ntuple.root
ClusterProcessing 1
Process cluster-level trees. Each ntuple entry contains all the PMT hits observed
Output filename
TankClusterProcessing 1
Process PMT cluster-level trees. Each ntuple entry contains all the PMT hits observed
in a cluster (as defined in the ClusterFinder tool) as well as cluster classifiers
(as defined in the ClusterClassifiers tool), along with other general information
(run/subrun number, nhits, SiPM hits, trigger time).
(run/subrun number, nhits, SiPM hits, trigger time).
MRDClusterProcessing 1
Process MRD cluster-level trees. Each ntuple entry contains all the MRD hits observed
in a cluster (as defined in the TimeClustering tool), along with other general information
(run/subrun number, nhits, trigger time).
TriggerProcessing 1
Process trigger-level trees. Each ntuple entry contains all PMT hits observed
for a given trigger, along with other general information (run/subrun number,
nhits,trigger time).
nhits,trigger time,beam parameters).
HitInfo_fill 1
Fill in hit information for all hits (Time,Charge,PE,Position).
TankHitInfo_fill 1
Fill in PMT hit information for all hits (Time,Charge,PE,Position).
MRDHitInfo_fill 1
Fill in MRD hit information for all hits (Time,Channel ID).
SiPMPulseInfo_fill 1
Fill in SiPM pulse information (charge/time/SiPM number).
MRDReco_fill 0
Fill in track reconstruction parameters defined by the FindMRDTracks tool.
fillCleanEventsOnly (1 or 0)
Only fill tree with events that pass the event selection defined in the
EventSelector tool.
Reco_fill 0
Fill in final reconstruction parameters estimated using the Tank
Reconstruction algorithms.
MCTruth_fill (1 or 0)
Input will determine if Truth information from files given is saved to the
reco tree. Will output to tree if 1.
Expand All @@ -69,4 +78,15 @@ reconstruction chain are saved to the tree. Values include seeds from SeedVtxFi
fits from PointPosFinder, and FOMs for likelihood fits at each reconstruction step.
Will output to tree if 1.
IsData (1 or 0)
Whether the data we are processing is real (Hits) or MC (MCHits).
HasGenie (1 or 0)
Input determines whether GENIE-level information is loaded by the LoadGENIEEvent tool.
HasBNBtimingMC (1 or 0)
Input determines whether cluster times (MC) are spill-corrected to produce a BNB-realistic timing structure.
Must have HasGenie 1 and TankClusterProcessing 1 enabled.
(as defined in the AssignBunchTimingMC tool).
```

0 comments on commit 62910f6

Please sign in to comment.