From f1cfadab6b805ab77ac2757cd5908ef151452797 Mon Sep 17 00:00:00 2001 From: jminock Date: Mon, 25 Nov 2024 11:38:47 -0500 Subject: [PATCH] Minimal Toolchain for MuonFitter (#316) * minimal Toolchain for MuonFitter * Update FindMrdTracksConfig don't write FindMrdTracks results to debug ROOT file --------- Co-authored-by: James Minock Co-authored-by: marc1uk --- .../MuonFitter/ClusterClassifiersConfig | 3 ++ configfiles/MuonFitter/ClusterFinderConfig | 11 +++++++ configfiles/MuonFitter/DigitBuilderConfig | 8 +++++ configfiles/MuonFitter/EventSelectorConfig | 25 ++++++++++++++ configfiles/MuonFitter/FindMrdTracksConfig | 12 +++++++ configfiles/MuonFitter/LoadWCSimConfig | 22 +++++++++++++ configfiles/MuonFitter/LoadWCSimLAPPDConfig | 14 ++++++++ .../MuonFitter/MCParticlePropertiesConfig | 3 ++ .../MuonFitter/MCRecoEventLoaderConfig | 10 ++++++ configfiles/MuonFitter/MuonFitterConfig | 33 +++++++++++++++++++ configfiles/MuonFitter/README.md | 3 ++ configfiles/MuonFitter/TimeClusteringConfig | 12 +++++++ configfiles/MuonFitter/ToolChainConfig | 26 +++++++++++++++ configfiles/MuonFitter/ToolsConfig | 12 +++++++ 14 files changed, 194 insertions(+) create mode 100644 configfiles/MuonFitter/ClusterClassifiersConfig create mode 100644 configfiles/MuonFitter/ClusterFinderConfig create mode 100644 configfiles/MuonFitter/DigitBuilderConfig create mode 100644 configfiles/MuonFitter/EventSelectorConfig create mode 100644 configfiles/MuonFitter/FindMrdTracksConfig create mode 100644 configfiles/MuonFitter/LoadWCSimConfig create mode 100644 configfiles/MuonFitter/LoadWCSimLAPPDConfig create mode 100644 configfiles/MuonFitter/MCParticlePropertiesConfig create mode 100644 configfiles/MuonFitter/MCRecoEventLoaderConfig create mode 100644 configfiles/MuonFitter/MuonFitterConfig create mode 100644 configfiles/MuonFitter/TimeClusteringConfig create mode 100644 configfiles/MuonFitter/ToolChainConfig create mode 100644 configfiles/MuonFitter/ToolsConfig diff --git a/configfiles/MuonFitter/ClusterClassifiersConfig b/configfiles/MuonFitter/ClusterClassifiersConfig new file mode 100644 index 000000000..948ed3354 --- /dev/null +++ b/configfiles/MuonFitter/ClusterClassifiersConfig @@ -0,0 +1,3 @@ +#ClusterClassifiers Config file +verbosity 0 +IsData 0 diff --git a/configfiles/MuonFitter/ClusterFinderConfig b/configfiles/MuonFitter/ClusterFinderConfig new file mode 100644 index 000000000..4e3606764 --- /dev/null +++ b/configfiles/MuonFitter/ClusterFinderConfig @@ -0,0 +1,11 @@ +# ClusterFinder Config File + +HitStore MCHits #Either MCHits or Hits (accessed in ANNIEEvent store) +OutputFile mc_clusters.root +ClusterFindingWindow 50 # in ns, size of the window used to "clusterize" +AcqTimeWindow 70000 # in ns, size of the acquisition window +ClusterIntegrationWindow 50 # in ns, all hits with +/- 1/2 of this window are considered in the cluster +MinHitsPerCluster 5 # group of hits are considered clusters above this amount of hits +end_of_window_time_cut 0.95 # from o to 1, length of the window you want to loop over with respect to acq. window (1 for full window, 0.95 for 95% from the start) +Plots2D 0 #Draw 2D charge-vs-time plots? +verbosity 0 diff --git a/configfiles/MuonFitter/DigitBuilderConfig b/configfiles/MuonFitter/DigitBuilderConfig new file mode 100644 index 000000000..989becdc6 --- /dev/null +++ b/configfiles/MuonFitter/DigitBuilderConfig @@ -0,0 +1,8 @@ +# DigitBuilder config file + +verbosity 0 +isMC 1 +ParametricModel 1 +PhotoDetectorConfiguration All +LAPPDIDFile ./configfiles/VertexReco/PhaseIIRecoTruth/LAPPDIDs.txt +DigitChargeThr 10 diff --git a/configfiles/MuonFitter/EventSelectorConfig b/configfiles/MuonFitter/EventSelectorConfig new file mode 100644 index 000000000..68c2686af --- /dev/null +++ b/configfiles/MuonFitter/EventSelectorConfig @@ -0,0 +1,25 @@ +# EventSelector config file + +verbosity 0 +MRDRecoCut 0 +MCFVCut 0 +MCPMTVolCut 0 +MCMRDCut 0 +MCPiKCut 0 +MCIsMuonCut 1 +MCIsElectronCut 0 +MCIsSingleRingCut 0 +MCIsMultiRingCut 0 +MCProjectedMRDHit 0 +MCEnergyCut 0 +Emin 0 +Emax 5000 +NHitCut 0 +NHitmin 4 +PromptTrigOnly 0 +RecoFVCut 0 +RecoPMTVolCut 0 +PMTMRDCoincCut 0 +PMTMRDOffset 10 +SaveStatusToStore 1 +IsMC 1 diff --git a/configfiles/MuonFitter/FindMrdTracksConfig b/configfiles/MuonFitter/FindMrdTracksConfig new file mode 100644 index 000000000..d78ed9b58 --- /dev/null +++ b/configfiles/MuonFitter/FindMrdTracksConfig @@ -0,0 +1,12 @@ +# FindMrdTracks Config File +# all variables retrieved with m_variables.Get() must be defined here! + +verbosity 0 +IsData 0 +OutputDirectory . +OutputFile mrdtrackfile # the output file built will be '/...root' +DrawTruthTracks 0 # whether to add MC Truth track info for drawing in MrdPaddlePlot Tool + ## note you need to run that tool to actually view the tracks! +WriteTracksToFile 0 # should the track information be written to a ROOT-file? +SelectTriggerType 0 # should the loaded data be filtered by trigger type? +TriggerType Beam # options: Cosmic, Beam, No Loopback diff --git a/configfiles/MuonFitter/LoadWCSimConfig b/configfiles/MuonFitter/LoadWCSimConfig new file mode 100644 index 000000000..9907c8931 --- /dev/null +++ b/configfiles/MuonFitter/LoadWCSimConfig @@ -0,0 +1,22 @@ +#LoadWCSim Config File +# all variables retrieved with m_variables.Get() must be defined here! +verbose 1 + +#InputFile /pnfs/annie/persistent/users/moflaher/wcsim/lappd/tankonly/wcsim_lappd_tankonly_24-09-17_BNB_Water_10k_22-05-17/wcsim_0.49......19.root +#InputFile /pnfs/annie/persistent/users/moflaher/wcsim/lappd/tankonly/wcsim_lappd_tankonly_03-05-17_rhatcher/wcsim_0.49......00.root ## first of the DOE proposal files +#InputFile /pnfs/annie/persistent/users/moflaher/wcsim/multipmt/tankonly/wcsim_3-12-18_ANNIEp2v6_BNB_Water_10k_22-05-17/wcsim_0.49......19.root +#InputFile /pnfs/annie/persistent/users/moflaher/wcsim/multipmt/tankonly/wcsim_25_04_19_ANNIEp2v6_nodigit_BNB_Water_10k_22-05-17/wcsim_0.49......19.root +#InputFile ./25_04_19_wcsim_0.49......19.root + +#InputFile /annie/app/users/jminock/ToolAnalysis/wcsim_0.root +#InputFile /pnfs/annie/persistent/users/mnieslon/wcsim/output/tankonly/wcsim_ANNIEp2v7_beamlike/wcsim_beamlike_muon_0.100.root +InputFile /pnfs/annie/persistent/simulations/wcsim/G1810a0211a/standard/tank/pmt/wcsim_0.0.0.root +#InputFile ./wcsim_0.*.root +#InputFile /pnfs/annie/persistent/users/mnieslon/wcsim/output/tankonly/wcsim_ANNIEp2v7_beam/pmt-files/wcsim_beam_gst_1060_91_0.7091.root + +WCSimVersion 3 ## should reflect the WCSim version of the files being loaded +HistoricTriggeroffset 0 ## time offset of digits relative to the trigger +UseDigitSmearedTime 1 ## whether to use smeared digit time (T), or true time of first photon (F) +LappdNumStrips 56 ## num channels to construct from each LAPPD +LappdStripLength 100 ## relative x position of each LAPPD strip, for dual-sided readout [mm] +LappdStripSeparation 10 ## stripline separation, for calculating relative y position of each LAPPD strip [mm] diff --git a/configfiles/MuonFitter/LoadWCSimLAPPDConfig b/configfiles/MuonFitter/LoadWCSimLAPPDConfig new file mode 100644 index 000000000..0f1c9af59 --- /dev/null +++ b/configfiles/MuonFitter/LoadWCSimLAPPDConfig @@ -0,0 +1,14 @@ +#LoadWCSimLAPPD Config File +# all variables retrieved with m_variables.Get() must be defined here! +verbose 0 + +#InputFile /pnfs/annie/persistent/users/moflaher/wcsim/lappd/tankonly/wcsim_lappd_tankonly_24-09-17_BNB_Water_10k_22-05-17/wcsim_lappd_0.49......19.root +#InputFile /pnfs/annie/persistent/users/moflaher/wcsim/lappd/tankonly/wcsim_lappd_tankonly_03-05-17_rhatcher/wcsim_lappd_0.49......00.root ## first of the DOE proposal files +#InputFile /pnfs/annie/persistent/users/mnieslon/wcsim/output/tankonly/wcsim_ANNIEp2v7_beamlike/wcsim_beamlike_muon_lappd_0.100.root +InputFile /pnfs/annie/persistent/simulations/wcsim/G1810a0211a/standard/tank/lappd/wcsim_lappd_0.0.0.root +#InputFile ./wcsim_lappd_0.*.root +#InputFile /annie/app/users/jminock/ToolAnalysis/wcsim_lappd_0.root + +WCSimVersion 3 ## should reflect the WCSim version of the files being loaded +InnerStructureRadius 1.3545 ## octagonal inner structure radius in m (from drawings 106.64") +DrawDebugGraphs 0 ## whether to draw TPolyMarker3D's of hits diff --git a/configfiles/MuonFitter/MCParticlePropertiesConfig b/configfiles/MuonFitter/MCParticlePropertiesConfig new file mode 100644 index 000000000..019526011 --- /dev/null +++ b/configfiles/MuonFitter/MCParticlePropertiesConfig @@ -0,0 +1,3 @@ +# MCParticleProperties configuration file + +verbosity 0 diff --git a/configfiles/MuonFitter/MCRecoEventLoaderConfig b/configfiles/MuonFitter/MCRecoEventLoaderConfig new file mode 100644 index 000000000..81f5502a1 --- /dev/null +++ b/configfiles/MuonFitter/MCRecoEventLoaderConfig @@ -0,0 +1,10 @@ +# MCRecoEventLoader config file + +verbosity 1 +GetPionKaonInfo 1 +GetNRings 1 +ParticleID 13 +DoParticleSelection 1 +xshift 0.0 +yshift 14.46469 +zshift -168.1 diff --git a/configfiles/MuonFitter/MuonFitterConfig b/configfiles/MuonFitter/MuonFitterConfig new file mode 100644 index 000000000..69465ed64 --- /dev/null +++ b/configfiles/MuonFitter/MuonFitterConfig @@ -0,0 +1,33 @@ +verbosity 0 + +OutputFile MC_MuonFitter_Reco_2998.root +IsData 0 # 1:is data, not MC; 0:not data, is MC +LuxArea 506.7 # 10-inch R7081 Hamamatsu +EtelArea 613.1 # 11-inch D784UKFLB ETEL +HamamatsuArea 324.3 # 8-inch R5912-100 Hamamatsu +WatchboyArea 506.7 # 10-inch R7081 Hamamatsu +WatchmanArea 506.7 # 10-inch R7081-100 Hamamatsu +PMTMRDOffset 0 # delay btwn tank and MRD PMTs +StepSizeAi 15 # some distance muon travels [cm] +InsideAngle 1. # degrees added to Cherenkov angle for hits to be considered inside cone +OutsideAngle 9. # degrees added to Cherenkov angle for hits to be considered outside cone +PMTChargeThreshold 2 # minimum amount of charge seen by PMT +EtaThreshold 500 # threshold to find best vertex +DisplayTruth 0 # display truth information in graphs (only in MC) +RecoMode 0 # run tool after fitting tank track +AiEtaFile ev_ai_eta_R0.0.txt +#TankTrackFitFile /exp/annie/app/users/jhe/MyToolAnalysis_MFer/fitbyeye_wcsim_2000-2999_RNN_240525v1.txt +#TankTrackFitFile fitbyeye_wcsim_2000-2999_RNN_240525v1.txt +TankTrackFitFile tanktrackfitfile_r0.0_RNN.txt + +UseNumLayers 1 # Updates reco track length in MRD using number of layers +UsePCA 0 # Updates reco track length in MRD using number of layers and PCA-reconstructed track angle (set UseNumLayers 1) +UseConnDots 0 # Updates reco track length in MRD by connecting the MRD hits +UseELoss 0 # Use official ANNIE MRD energyLoss as starting MRD energy +UseSimpleEReco 0 # Just add ANNIE MRD energyLoss (set UseELoss 1); no updating dEdx +RecoEnergyShift 0 # Shift reco muon energy + +Plot3D 0 # 0:no plot; 1:yes plot +Draw3DFMV 0 +Draw3DMRD 0 +SaveHistograms 0 # 0:no; 1:yes diff --git a/configfiles/MuonFitter/README.md b/configfiles/MuonFitter/README.md index 0421158c1..832b47e15 100644 --- a/configfiles/MuonFitter/README.md +++ b/configfiles/MuonFitter/README.md @@ -5,6 +5,7 @@ ********************** Date created: 2024-10-02 +Date last updated: 2024-11-22 The MuonFitter toolchain makes an attempt to fit muons using hit information. The Tool has 2 modes. The first mode is pre-reconstruction. It takes input information from the ANNIEEvent and generates a text file containing hit information for the RNN. It is advisable to include minimal tools in this ToolChain, as the same data must be re-analysed with ToolAnalysis later. @@ -13,6 +14,8 @@ This text file produced in this step is then processed by a standalone python sc The second mode is reconstruction. In this mode the Tool reads information from the ANNIEEvent, along with both text files from the previous two steps (the first mode and the python script) and reconstructs the vertex based on the fitted paths. The resulting muon fit information is passed into the DataModel. +The Toolchain included in this directory is the minimal working Toolchain for MuonFitter to function. All Tools in the ToolChain MUST be included in order for MuonFitter to function. It is recommended to include PhaseIITreeMaker after MuonFitter in RecoMode 1 to generate an ntuple with reconstructed variables from MuonFitter. + More detailed instructions are below. ************************ diff --git a/configfiles/MuonFitter/TimeClusteringConfig b/configfiles/MuonFitter/TimeClusteringConfig new file mode 100644 index 000000000..4a968f850 --- /dev/null +++ b/configfiles/MuonFitter/TimeClusteringConfig @@ -0,0 +1,12 @@ +#TimeClustering Config File + +verbosity 0 +IsData 0 +MinDigitsForTrack 4 +MaxMrdSubEventDuration 30 # [ns] if all hits are within this period, just make one subevent +MinSubeventTimeSep 30 # [ns] gaps of at leas this long delimit subevents +MakeMrdDigitTimePlot 0 # draw a 1D histogram of times to check subevent splitting is suitble +MakeSingleEventPlots 0 +LaunchTApplication 0 +MapChankey_WCSimID ./configfiles/CC_MC_RECO_ntuple/MRD_Chankey_WCSimID.dat +OutputROOTFile test.root diff --git a/configfiles/MuonFitter/ToolChainConfig b/configfiles/MuonFitter/ToolChainConfig new file mode 100644 index 000000000..332810a4f --- /dev/null +++ b/configfiles/MuonFitter/ToolChainConfig @@ -0,0 +1,26 @@ +#ToolChain dynamic setup file + +##### Runtime Parameters ##### +verbose 1 ## Verbosity level of ToolChain +error_level 0 # 0= do not exit, 1= exit on unhandled errors only, 2= exit on unhandled errors and handled errors +attempt_recover 1 ## 1= will attempt to finalise if an execute fails +remote_port 24002 +IO_Threads 1 ## Number of threads for network traffic (~ 1/Gbps) + +###### Logging ##### +log_mode Interactive # Interactive=cout , Remote= remote logging system "serservice_name Remote_Logging" , Local = local file log; +log_local_path ./log +log_service LogStore + + +###### Service discovery ##### Ignore these settings for local analysis +service_publish_sec -1 +service_kick_sec -1 + +##### Tools To Add ##### +Tools_File configfiles/MuonFitter/ToolsConfig ## list of tools to run and their config files + +##### Run Type ##### +Inline -1 ## number of Execute steps in program, -1 infinite loop that is ended by user +Interactive 0 ## set to 1 if you want to run the code interactively + diff --git a/configfiles/MuonFitter/ToolsConfig b/configfiles/MuonFitter/ToolsConfig new file mode 100644 index 000000000..59cd923b6 --- /dev/null +++ b/configfiles/MuonFitter/ToolsConfig @@ -0,0 +1,12 @@ +myLoadGeometry LoadGeometry configfiles/LoadGeometry/LoadGeometryConfig +myLoadWCSim LoadWCSim configfiles/MuonFitter/LoadWCSimConfig +myLoadWCSimLAPPD LoadWCSimLAPPD configfiles/MuonFitter/LoadWCSimLAPPDConfig +myMCParticleProperties MCParticleProperties configfiles/MuonFitter/MCParticlePropertiesConfig +myMCRecoEventLoader MCRecoEventLoader configfiles/MuonFitter/MCRecoEventLoaderConfig +myTimeClustering TimeClustering configfiles/MuonFitter/TimeClusteringConfig +myFindMrdTracks FindMrdTracks configfiles/MuonFitter/FindMrdTracksConfig +myClusterFinder ClusterFinder configfiles/MuonFitter/ClusterFinderConfig +myClusterClassifiers ClusterClassifiers configfiles/MuonFitter/ClusterClassifiersConfig +myDigitBuilder DigitBuilder configfiles/MuonFitter/DigitBuilderConfig +myEventSelector EventSelector configfiles/MuonFitter/EventSelectorConfig +myMuonFitter MuonFitter configfiles/MuonFitter/MuonFitterConfig