From a64ab0efa483045148c46db4eb98fed3a681ad5a Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 13:18:40 -0500 Subject: [PATCH 001/100] Document changes going from v5 to v6 --- README.md | 1 + doc/v5-to-v6.md | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 doc/v5-to-v6.md diff --git a/README.md b/README.md index fb63886..39ea59f 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ TrkAna is an event-based ntuple for Mu2e analyses. Each entry in the ntuple corr ## Useful Links +* [v5 --> v6 major changes](v5-to-v6.md) * [Mu2eWiki page](https://mu2ewiki.fnal.gov/wiki/TrkAna) * [utility to get explanations of branch and leaf names](tutorial/pages/helper.md) * [version history of TrkAna](https://mu2ewiki.fnal.gov/wiki/TrkAna#Version_History_.2F_TrkAna_Musings) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md new file mode 100644 index 0000000..ddd5f51 --- /dev/null +++ b/doc/v5-to-v6.md @@ -0,0 +1,7 @@ +# Major Changes from v5 to v6 + +There was a major update when we moved from v5 to v6. Here is a table of changes for you to consult: + +| | v5 | v6 | Notes | +|---|--|--|---| +|test | ```dem``` | ```trk``` | | From 1603cb5edbc986b76c7357ed772a4baa960af368 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 13:21:29 -0500 Subject: [PATCH 002/100] Fix link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 39ea59f..2489103 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ TrkAna is an event-based ntuple for Mu2e analyses. Each entry in the ntuple corr ## Useful Links -* [v5 --> v6 major changes](v5-to-v6.md) +* [v5 --> v6 major changes](doc/v5-to-v6.md) * [Mu2eWiki page](https://mu2ewiki.fnal.gov/wiki/TrkAna) * [utility to get explanations of branch and leaf names](tutorial/pages/helper.md) * [version history of TrkAna](https://mu2ewiki.fnal.gov/wiki/TrkAna#Version_History_.2F_TrkAna_Musings) From b7da8f8686fcb3835983fe048e859413ed58616b Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 14:26:25 -0500 Subject: [PATCH 003/100] Rename art module to EventNtupleMaker --- doc/v5-to-v6.md | 12 +++++- fcl/prolog.fcl | 2 +- ...r_module.cc => EventNtupleMaker_module.cc} | 39 +++++++------------ 3 files changed, 27 insertions(+), 26 deletions(-) rename src/{TrkAnaTreeMaker_module.cc => EventNtupleMaker_module.cc} (96%) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index ddd5f51..169a06f 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -2,6 +2,16 @@ There was a major update when we moved from v5 to v6. Here is a table of changes for you to consult: +## Branch / Leaf Changes + +## Fcl Files +Many fcl files were renamed, updated, or deleted + + +## Name Changes + | | v5 | v6 | Notes | |---|--|--|---| -|test | ```dem``` | ```trk``` | | +| src file name | ```TrkAnaTreeMaker_module.cc``` | ```EventNtupleMaker_module.cc``` | | +| art module name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | + diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index f9640a3..192ae57 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -170,7 +170,7 @@ Ext : { input : "MergeKKLine" TrkAnaTreeMaker : { - module_type : TrkAnaTreeMaker + module_type : EventNtupleMaker branches : [ @local::DeM, @local::DeP, @local::UeM, @local::UeP, @local::DmuM, @local::DmuP, @local::UmuM, @local::UmuP ] RecoCountTag : "SelectRecoMC" diff --git a/src/TrkAnaTreeMaker_module.cc b/src/EventNtupleMaker_module.cc similarity index 96% rename from src/TrkAnaTreeMaker_module.cc rename to src/EventNtupleMaker_module.cc index 8da0da0..d0f74a5 100644 --- a/src/TrkAnaTreeMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -1,14 +1,5 @@ // -// Prototype analysis module using tracks. This module associates information from the -// Mu2e detector systems into a single coherent analysis TTree (trkana). This module -// depends on the data products produced by reconstruction and (if requested) their MC -// counterparts. The primary analysis object is the set of Downstream electron track fits. -// Upstream electron fit and downstream muon are also required for PID and quality selection. -// Calorimeter clusters and Track-cluster matching are used for PID. CRV coincidences are also -// included for rejecting cosmic backgrounds. -// Most of the calcluations are done by upstream modules and helper classes. -// Original author: Dave Brown (LBNL) 7/7/2016 -// Updated November 2018 to run on KalSeeds only (A. Edmonds) +// art module to create the EventNtuple // // Mu2e includes @@ -107,7 +98,7 @@ namespace mu2e { typedef size_t BranchIndex; typedef size_t StepCollIndex; - class TrkAnaTreeMaker : public art::EDAnalyzer { + class EventNtupleMaker : public art::EDAnalyzer { public: @@ -191,8 +182,8 @@ namespace mu2e { }; typedef art::EDAnalyzer::Table Parameters; - explicit TrkAnaTreeMaker(const Parameters& conf); - virtual ~TrkAnaTreeMaker() { } + explicit EventNtupleMaker(const Parameters& conf); + virtual ~EventNtupleMaker() { } void beginJob() override; void beginSubRun(const art::SubRun & subrun ) override; @@ -317,7 +308,7 @@ namespace mu2e { }; - TrkAnaTreeMaker::TrkAnaTreeMaker(const Parameters& conf): + EventNtupleMaker::EventNtupleMaker(const Parameters& conf): art::EDAnalyzer(conf), _conf(conf()), _PBITag(conf().PBITag()), @@ -399,7 +390,7 @@ namespace mu2e { } } - void TrkAnaTreeMaker::beginJob( ){ + void EventNtupleMaker::beginJob( ){ art::ServiceHandle tfs; // create TTree _trkana=tfs->make("trkana","track analysis"); @@ -509,12 +500,12 @@ namespace mu2e { if(_conf.helices()) _trkana->Branch("helixinfo.",&_hinfo,_buffsize,_splitlevel); } - void TrkAnaTreeMaker::beginSubRun(const art::SubRun & subrun ) { + void EventNtupleMaker::beginSubRun(const art::SubRun & subrun ) { // get bfield _infoStructHelper.updateSubRun(); } - void TrkAnaTreeMaker::analyze(const art::Event& event) { + void EventNtupleMaker::analyze(const art::Event& event) { // reset event level structs _einfo.reset(); _einfomc.reset(); @@ -693,7 +684,7 @@ namespace mu2e { } - void TrkAnaTreeMaker::fillEventInfo( const art::Event& event) { + void EventNtupleMaker::fillEventInfo( const art::Event& event) { // fill basic event information _einfo.event = event.event(); _einfo.run = event.run(); @@ -724,7 +715,7 @@ namespace mu2e { _wtinfo.setWeights(weights); } - void TrkAnaTreeMaker::fillTriggerBits(const art::Event& event,std::string const& process) { + void EventNtupleMaker::fillTriggerBits(const art::Event& event,std::string const& process) { //get the TriggerResult from the process that created the KalFinalFit downstream collection art::InputTag const tag{Form("TriggerResults::%s", process.c_str())}; auto trigResultsH = event.getValidHandle(tag); @@ -760,7 +751,7 @@ namespace mu2e { } } - void TrkAnaTreeMaker::fillAllInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr) { + void EventNtupleMaker::fillAllInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr) { const auto& kseedptr = (kspch->at(i_kseedptr)); const auto& kseed = *kseedptr; @@ -864,7 +855,7 @@ namespace mu2e { // some branches can't be made until the analyze() function because we want to write out all data products of a certain type // these all have an underlying array where we want to name the individual elements in the array with different leaf names template - std::vector > TrkAnaTreeMaker::createSpecialBranch(const art::Event& event, const std::string& branchname, + std::vector > EventNtupleMaker::createSpecialBranch(const art::Event& event, const std::string& branchname, std::vector >& handles, // this parameter is only needed so that the template parameter T can be deduced. There is probably a better way to do this FIXME TI& infostruct, TIA& array, bool make_individual_branches, const std::string& selection) { std::vector > outputHandles; @@ -917,7 +908,7 @@ namespace mu2e { return outputHandles; } - void TrkAnaTreeMaker::resetTrackBranches() { + void EventNtupleMaker::resetTrackBranches() { for (BranchIndex i_branch = 0; i_branch < _allBranches.size(); ++i_branch) { _allRQIs.at(i_branch).reset(); @@ -928,5 +919,5 @@ namespace mu2e { // Part of the magic that makes this class a module. // create an instance of the module. It also registers -using mu2e::TrkAnaTreeMaker; -DEFINE_ART_MODULE(TrkAnaTreeMaker) +using mu2e::EventNtupleMaker; +DEFINE_ART_MODULE(EventNtupleMaker) From b1f382ffcf62b9dab4464d3219e1ed594e011299 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 14:29:21 -0500 Subject: [PATCH 004/100] Follow on changes in fcl for name change --- doc/v5-to-v6.md | 1 + fcl/TrkAnaDeM.fcl | 2 +- fcl/TrkAnaDeMFromDigis.fcl | 2 +- fcl/TrkAnaLineFromDigis.fcl | 2 +- fcl/TrkAnaReflections.fcl | 2 +- fcl/prolog.fcl | 6 +++--- fcl/prolog_trigger.fcl | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 169a06f..4c5bdd2 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -14,4 +14,5 @@ Many fcl files were renamed, updated, or deleted |---|--|--|---| | src file name | ```TrkAnaTreeMaker_module.cc``` | ```EventNtupleMaker_module.cc``` | | | art module name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | +| prolog.fcl table name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | diff --git a/fcl/TrkAnaDeM.fcl b/fcl/TrkAnaDeM.fcl index 362ece0..011ae42 100644 --- a/fcl/TrkAnaDeM.fcl +++ b/fcl/TrkAnaDeM.fcl @@ -30,7 +30,7 @@ physics : TriggerPath : [ MergeKKDeM, MakeSS ] analyzers : { TrkAnaDeM : { - @table::TrkAnaTreeMaker + @table::EventNtupleMaker FitType : LoopHelix diagLevel : 2 FillMCInfo : true diff --git a/fcl/TrkAnaDeMFromDigis.fcl b/fcl/TrkAnaDeMFromDigis.fcl index 2f1b06f..b2413bf 100644 --- a/fcl/TrkAnaDeMFromDigis.fcl +++ b/fcl/TrkAnaDeMFromDigis.fcl @@ -63,7 +63,7 @@ physics : ] analyzers : { TrkAnaDeM : { - @table::TrkAnaTreeMaker + @table::EventNtupleMaker FitType : LoopHelix diagLevel : 2 FillMCInfo : true diff --git a/fcl/TrkAnaLineFromDigis.fcl b/fcl/TrkAnaLineFromDigis.fcl index d3e14d3..9f3067e 100644 --- a/fcl/TrkAnaLineFromDigis.fcl +++ b/fcl/TrkAnaLineFromDigis.fcl @@ -35,7 +35,7 @@ physics : RecoPath : [ @sequence::Reconstruction.LineRecoMCPath ] analyzers : { TrkAnaLine : { - @table::TrkAnaTreeMaker + @table::EventNtupleMaker FitType : KinematicLine diagLevel : 2 FillMCInfo : true diff --git a/fcl/TrkAnaReflections.fcl b/fcl/TrkAnaReflections.fcl index 4249f97..0a7ffd3 100644 --- a/fcl/TrkAnaReflections.fcl +++ b/fcl/TrkAnaReflections.fcl @@ -5,7 +5,7 @@ #include "TrkAna/fcl/prolog.fcl" BEGIN_PROLOG TAR : { - @table::TrkAnaTreeMaker + @table::EventNtupleMaker FitType : LoopHelix diagLevel : 2 FillMCInfo : true diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 192ae57..9a49031 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -169,7 +169,7 @@ Ext : { input : "MergeKKLine" } -TrkAnaTreeMaker : { +EventNtupleMaker : { module_type : EventNtupleMaker branches : [ @local::DeM, @local::DeP, @local::UeM, @local::UeP, @local::DmuM, @local::DmuP, @local::UmuM, @local::UmuP ] @@ -223,9 +223,9 @@ TrkAnaReco : { } analyzers : { - TrkAna : { @table::TrkAnaTreeMaker } + TrkAna : { @table::EventNtupleMaker } - TrkAnaExt : { @table::TrkAnaTreeMaker + TrkAnaExt : { @table::EventNtupleMaker branches : [ @local::Ext ] } diff --git a/fcl/prolog_trigger.fcl b/fcl/prolog_trigger.fcl index 907248d..d2a1ae2 100644 --- a/fcl/prolog_trigger.fcl +++ b/fcl/prolog_trigger.fcl @@ -5,7 +5,7 @@ BEGIN_PROLOG TrkAnaTrigger : { TrkAnaTT : { - @table::TrkAnaTreeMaker + @table::EventNtupleMaker diagLevel : 2 FillCRVCoincs : false FillCaloMC : false From e7ecfa642bc70d435c1bfc9a3a94bf1d295fc6ef Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 14:49:54 -0500 Subject: [PATCH 005/100] Rename tree name from trkana to ntuple --- doc/v5-to-v6.md | 3 +- src/EventNtupleMaker_module.cc | 90 ++++++++++++++--------------- validation/create_val_file.C | 102 ++++++++++++++++----------------- 3 files changed, 98 insertions(+), 97 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 4c5bdd2..cf3232e 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -13,6 +13,7 @@ Many fcl files were renamed, updated, or deleted | | v5 | v6 | Notes | |---|--|--|---| | src file name | ```TrkAnaTreeMaker_module.cc``` | ```EventNtupleMaker_module.cc``` | | -| art module name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | +| art module name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | | prolog.fcl table name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | +| tree name | ```trkana``` | ```ntuple``` | | diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index d0f74a5..991bf22 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -195,7 +195,7 @@ namespace mu2e { std::vector _allBranches; // configurations for all track branches // main TTree - TTree* _trkana; + TTree* _ntuple; // general event info branch EventInfo _einfo; EventInfoMC _einfomc; @@ -393,66 +393,66 @@ namespace mu2e { void EventNtupleMaker::beginJob( ){ art::ServiceHandle tfs; // create TTree - _trkana=tfs->make("trkana","track analysis"); + _ntuple=tfs->make("ntuple","Mu2e Event Ntuple"); // add event info branch - _trkana->Branch("evtinfo.",&_einfo,_buffsize,_splitlevel); + _ntuple->Branch("evtinfo.",&_einfo,_buffsize,_splitlevel); if (_fillmc) { - _trkana->Branch("evtinfomc.",&_einfomc,_buffsize,_splitlevel); + _ntuple->Branch("evtinfomc.",&_einfomc,_buffsize,_splitlevel); } // hit counting branch - _trkana->Branch("hcnt.",&_hcnt); + _ntuple->Branch("hcnt.",&_hcnt); // track counting branches for (BranchIndex i_branch = 0; i_branch < _allBranches.size(); ++i_branch) { BranchConfig i_branchConfig = _allBranches.at(i_branch); std::string leafname = i_branchConfig.branch(); - _trkana->Branch(("tcnt.n"+leafname).c_str(),&_tcnt._counts[i_branch]); + _ntuple->Branch(("tcnt.n"+leafname).c_str(),&_tcnt._counts[i_branch]); } // create all track branches for (BranchIndex i_branch = 0; i_branch < _allBranches.size(); ++i_branch) { BranchConfig i_branchConfig = _allBranches.at(i_branch); std::string branch = i_branchConfig.branch(); - _trkana->Branch((branch+".").c_str(),&_allTIs.at(i_branch),_buffsize,_splitlevel); - _trkana->Branch((branch+"fit.").c_str(),&_allTFIs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+".").c_str(),&_allTIs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"fit.").c_str(),&_allTFIs.at(i_branch),_buffsize,_splitlevel); // add traj-specific branches - if(_ftype == LoopHelix )_trkana->Branch((branch+"lh.").c_str(),&_allLHIs.at(i_branch),_buffsize,_splitlevel); - if(_ftype == CentralHelix )_trkana->Branch((branch+"ch.").c_str(),&_allCHIs.at(i_branch),_buffsize,_splitlevel); - if(_ftype == KinematicLine )_trkana->Branch((branch+"kl.").c_str(),&_allKLIs.at(i_branch),_buffsize,_splitlevel); + if(_ftype == LoopHelix )_ntuple->Branch((branch+"lh.").c_str(),&_allLHIs.at(i_branch),_buffsize,_splitlevel); + if(_ftype == CentralHelix )_ntuple->Branch((branch+"ch.").c_str(),&_allCHIs.at(i_branch),_buffsize,_splitlevel); + if(_ftype == KinematicLine )_ntuple->Branch((branch+"kl.").c_str(),&_allKLIs.at(i_branch),_buffsize,_splitlevel); // TrkCaloHit: currently only 1 - _trkana->Branch((branch+"tch.").c_str(),&_allTCHIs.at(i_branch)); - _trkana->Branch((branch+"trkqual.").c_str(),&_allTrkQualResults.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"tch.").c_str(),&_allTCHIs.at(i_branch)); + _ntuple->Branch((branch+"trkqual.").c_str(),&_allTrkQualResults.at(i_branch),_buffsize,_splitlevel); if (_conf.filltrkpid() && i_branchConfig.options().filltrkpid()) { int n_trkpid_vars = TrkCaloHitPID::n_vars; for (int i_trkpid_var = 0; i_trkpid_var < n_trkpid_vars; ++i_trkpid_var) { TrkCaloHitPID::MVA_varindex i_index =TrkCaloHitPID::MVA_varindex(i_trkpid_var); std::string varname = TrkCaloHitPID::varName(i_index); - _trkana->Branch((branch+"trkpid."+varname).c_str(), &_allTPIs.at(i_branch)._tchpvars[i_index]); + _ntuple->Branch((branch+"trkpid."+varname).c_str(), &_allTPIs.at(i_branch)._tchpvars[i_index]); } - _trkana->Branch((branch+"trkpid.mvaout").c_str(), &_allTPIs.at(i_branch)._mvaout); - _trkana->Branch((branch+"trkpid.mvastat").c_str(), &_allTPIs.at(i_branch)._mvastat); - _trkana->Branch((branch+"trkpid.disk0frad").c_str(), &_allTPIs.at(i_branch)._diskfrad[0]); - _trkana->Branch((branch+"trkpid.disk1frad").c_str(), &_allTPIs.at(i_branch)._diskfrad[1]); - _trkana->Branch((branch+"trkpid.disk0brad").c_str(), &_allTPIs.at(i_branch)._diskbrad[0]); - _trkana->Branch((branch+"trkpid.disk1brad").c_str(), &_allTPIs.at(i_branch)._diskbrad[1]); + _ntuple->Branch((branch+"trkpid.mvaout").c_str(), &_allTPIs.at(i_branch)._mvaout); + _ntuple->Branch((branch+"trkpid.mvastat").c_str(), &_allTPIs.at(i_branch)._mvastat); + _ntuple->Branch((branch+"trkpid.disk0frad").c_str(), &_allTPIs.at(i_branch)._diskfrad[0]); + _ntuple->Branch((branch+"trkpid.disk1frad").c_str(), &_allTPIs.at(i_branch)._diskfrad[1]); + _ntuple->Branch((branch+"trkpid.disk0brad").c_str(), &_allTPIs.at(i_branch)._diskbrad[0]); + _ntuple->Branch((branch+"trkpid.disk1brad").c_str(), &_allTPIs.at(i_branch)._diskbrad[1]); } // optionally add hit-level branches // (for the time being diagLevel : 2 will still work, but I propose removing this at some point) if(_conf.diag() > 1 || (_conf.fillhits() && i_branchConfig.options().fillhits())){ - _trkana->Branch((branch+"tsh.").c_str(),&_allTSHIs.at(i_branch),_buffsize,_splitlevel); - _trkana->Branch((branch+"tsm.").c_str(),&_allTSMIs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"tsh.").c_str(),&_allTSHIs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"tsm.").c_str(),&_allTSMIs.at(i_branch),_buffsize,_splitlevel); } // optionally add MC branches if(_fillmc && i_branchConfig.options().fillmc()){ - _trkana->Branch((branch+"mc.").c_str(),&_allMCTIs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"mc.").c_str(),&_allMCTIs.at(i_branch),_buffsize,_splitlevel); - _trkana->Branch((branch+"mcsim.").c_str(),&_allMCSimTIs.at(i_branch),_buffsize,_splitlevel); - _trkana->Branch((branch+"mcvd.").c_str(),&_allMCVDInfos.at(i_branch),_buffsize,_splitlevel); - if(_fillcalomc)_trkana->Branch((branch+"tchmc.").c_str(),&_allMCTCHIs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"mcsim.").c_str(),&_allMCSimTIs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"mcvd.").c_str(),&_allMCVDInfos.at(i_branch),_buffsize,_splitlevel); + if(_fillcalomc)_ntuple->Branch((branch+"tchmc.").c_str(),&_allMCTCHIs.at(i_branch),_buffsize,_splitlevel); // at hit-level MC information // (for the time being diagLevel will still work, but I propose removing this at some point) if(_conf.diag() > 1 || (_conf.fillhits() && i_branchConfig.options().fillhits())){ - _trkana->Branch((branch+"tshmc.").c_str(),&_allTSHIMCs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"tshmc.").c_str(),&_allTSHIMCs.at(i_branch),_buffsize,_splitlevel); } // configure extra MCStep branches for this track type if(_conf.extraMCStepTags(_extraMCStepTags)){ @@ -461,43 +461,43 @@ namespace mu2e { auto inst = tag.instance(); std::string mcsiname = branch +"mcsic_" + inst + "."; std::string mcssiname = branch + "mcssi_" + inst + "."; - _trkana->Branch(mcsiname.c_str(),&_extraMCStepInfos[i_branch][ixtra],_buffsize,_splitlevel); - _trkana->Branch(mcssiname.c_str(),&_extraMCStepSummaryInfos[i_branch][ixtra],_buffsize,_splitlevel); + _ntuple->Branch(mcsiname.c_str(),&_extraMCStepInfos[i_branch][ixtra],_buffsize,_splitlevel); + _ntuple->Branch(mcssiname.c_str(),&_extraMCStepSummaryInfos[i_branch][ixtra],_buffsize,_splitlevel); } } if(_conf.SurfaceStepsTag(_surfaceStepsTag)){ - _trkana->Branch((branch+"mcssi.").c_str(),&_surfaceStepInfos[i_branch],_buffsize,_splitlevel); + _ntuple->Branch((branch+"mcssi.").c_str(),&_surfaceStepInfos[i_branch],_buffsize,_splitlevel); } } } // trigger info. Actual names should come from the BeginRun object FIXME if(_conf.filltrig()) { - _trkana->Branch("trigbits",&_trigbits,_buffsize,_splitlevel); + _ntuple->Branch("trigbits",&_trigbits,_buffsize,_splitlevel); } // calorimeter information for the downstream electron track // general CRV info if(_fillcrvcoincs) { // coincidence branches should be here FIXME - _trkana->Branch("crvsummary.",&_crvsummary,_buffsize,_splitlevel); - _trkana->Branch("crvcoincs.",&_crvcoincs,_buffsize,_splitlevel); + _ntuple->Branch("crvsummary.",&_crvsummary,_buffsize,_splitlevel); + _ntuple->Branch("crvcoincs.",&_crvcoincs,_buffsize,_splitlevel); if(_fillcrvpulses) { - _trkana->Branch("crvpulses.",&_crvpulses,_buffsize,_splitlevel); + _ntuple->Branch("crvpulses.",&_crvpulses,_buffsize,_splitlevel); } if(_fillcrvdigis) { - _trkana->Branch("crvdigis.",&_crvdigis,_buffsize,_splitlevel); + _ntuple->Branch("crvdigis.",&_crvdigis,_buffsize,_splitlevel); } if(_fillmc){ - _trkana->Branch("crvsummarymc.",&_crvsummarymc,_buffsize,_splitlevel); - _trkana->Branch("crvcoincsmc.",&_crvcoincsmc,_buffsize,_splitlevel); - _trkana->Branch("crvcoincsmcplane.",&_crvcoincsmcplane,_buffsize,_splitlevel); + _ntuple->Branch("crvsummarymc.",&_crvsummarymc,_buffsize,_splitlevel); + _ntuple->Branch("crvcoincsmc.",&_crvcoincsmc,_buffsize,_splitlevel); + _ntuple->Branch("crvcoincsmcplane.",&_crvcoincsmcplane,_buffsize,_splitlevel); if(_fillcrvpulses) { - _trkana->Branch("crvpulsesmc.",&_crvpulsesmc,_buffsize,_splitlevel); + _ntuple->Branch("crvpulsesmc.",&_crvpulsesmc,_buffsize,_splitlevel); } } } // helix info - if(_conf.helices()) _trkana->Branch("helixinfo.",&_hinfo,_buffsize,_splitlevel); + if(_conf.helices()) _ntuple->Branch("helixinfo.",&_hinfo,_buffsize,_splitlevel); } void EventNtupleMaker::beginSubRun(const art::SubRun & subrun ) { @@ -680,7 +680,7 @@ namespace mu2e { // fill this row in the TTree - _trkana->Fill(); + _ntuple->Fill(); } @@ -894,14 +894,14 @@ namespace mu2e { int n_leaves = leafnames.size(); for (int i_leaf = 0; i_leaf < n_leaves; ++i_leaf) { std::string thisbranchname = (branchname+"."+leafnames.at(i_leaf)); - if (!_trkana->GetBranch(thisbranchname.c_str())) { // only want to create the branch once - _trkana->Branch(thisbranchname.c_str(), &array[i_leaf]); + if (!_ntuple->GetBranch(thisbranchname.c_str())) { // only want to create the branch once + _ntuple->Branch(thisbranchname.c_str(), &array[i_leaf]); } } } else { - if (!_trkana->GetBranch((branchname+".").c_str())) { // only want to create the branch once - _trkana->Branch((branchname+".").c_str(), &infostruct, infostruct.leafname(labels).c_str()); + if (!_ntuple->GetBranch((branchname+".").c_str())) { // only want to create the branch once + _ntuple->Branch((branchname+".").c_str(), &infostruct, infostruct.leafname(labels).c_str()); } } } diff --git a/validation/create_val_file.C b/validation/create_val_file.C index 9a6aa7e..1113548 100644 --- a/validation/create_val_file.C +++ b/validation/create_val_file.C @@ -1,72 +1,72 @@ void create_val_file(std::string filename, std::string outfilename) { - TFile* trkana_file = new TFile(filename.c_str(), "READ"); - TTree* trkana = (TTree*) trkana_file->Get("TrkAna/trkana"); + TFile* ntuple_file = new TFile(filename.c_str(), "READ"); + TTree* ntuple = (TTree*) ntuple_file->Get("TrkAna/ntuple"); TFile* file = new TFile(outfilename.c_str(), "RECREATE"); // evtinfo histograms - trkana->Draw("evtinfo.event>>h_evtinfo_event", "", ""); - trkana->Draw("evtinfo.subrun>>h_evtinfo_subrun", "", ""); - trkana->Draw("evtinfo.run>>h_evtinfo_run", "", ""); - trkana->Draw("evtinfo.nprotons>>h_evtinfo_nprotons", "", ""); - trkana->Draw("evtinfo.pbtime>>h_evtinfo_pbtime", "", ""); - trkana->Draw("evtinfo.pbterr>>h_evtinfo_pbterr", "", ""); + ntuple->Draw("evtinfo.event>>h_evtinfo_event", "", ""); + ntuple->Draw("evtinfo.subrun>>h_evtinfo_subrun", "", ""); + ntuple->Draw("evtinfo.run>>h_evtinfo_run", "", ""); + ntuple->Draw("evtinfo.nprotons>>h_evtinfo_nprotons", "", ""); + ntuple->Draw("evtinfo.pbtime>>h_evtinfo_pbtime", "", ""); + ntuple->Draw("evtinfo.pbterr>>h_evtinfo_pbterr", "", ""); // evtinfomc histograms - trkana->Draw("evtinfomc.nprotons>>h_evtinfomc_nprotons", "", ""); - trkana->Draw("evtinfomc.pbtime>>h_evtinfomc_pbtime", "", ""); + ntuple->Draw("evtinfomc.nprotons>>h_evtinfomc_nprotons", "", ""); + ntuple->Draw("evtinfomc.pbtime>>h_evtinfomc_pbtime", "", ""); // demfit histograms - trkana->Draw("demfit.mom.R()>>h_demfit_mom_all", "", "goff"); - trkana->Draw("demfit.mom.R()>>h_demfit_mom_ent", "demfit.sid==0", "goff"); - trkana->Draw("demfit.mom.R()>>h_demfit_mom_mid", "demfit.sid==1", "goff"); - trkana->Draw("demfit.mom.R()>>h_demfit_mom_xit", "demfit.sid==2", "goff"); - trkana->Draw("demfit.mom.R()>>h_demfit_mom_ent_t0cut", "demfit.sid==0 && demlh.t0>=700", "goff"); - trkana->Draw("demfit.mom.R()>>h_demfit_mom_mid_t0cut", "demfit.sid==1 && demlh.t0>=700", "goff"); - trkana->Draw("demfit.mom.R()>>h_demfit_mom_xit_t0cut", "demfit.sid==2 && demlh.t0>=700", "goff"); + ntuple->Draw("demfit.mom.R()>>h_demfit_mom_all", "", "goff"); + ntuple->Draw("demfit.mom.R()>>h_demfit_mom_ent", "demfit.sid==0", "goff"); + ntuple->Draw("demfit.mom.R()>>h_demfit_mom_mid", "demfit.sid==1", "goff"); + ntuple->Draw("demfit.mom.R()>>h_demfit_mom_xit", "demfit.sid==2", "goff"); + ntuple->Draw("demfit.mom.R()>>h_demfit_mom_ent_t0cut", "demfit.sid==0 && demlh.t0>=700", "goff"); + ntuple->Draw("demfit.mom.R()>>h_demfit_mom_mid_t0cut", "demfit.sid==1 && demlh.t0>=700", "goff"); + ntuple->Draw("demfit.mom.R()>>h_demfit_mom_xit_t0cut", "demfit.sid==2 && demlh.t0>=700", "goff"); // resolution histograms - trkana->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_all", "", "goff"); - trkana->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_ent", "demmcvd[].sid==0", "goff"); - trkana->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_mid", "demmcvd[].sid==1", "goff"); - trkana->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_xit", "demmcvd[].sid==2", "goff"); + ntuple->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_all", "", "goff"); + ntuple->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_ent", "demmcvd[].sid==0", "goff"); + ntuple->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_mid", "demmcvd[].sid==1", "goff"); + ntuple->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_xit", "demmcvd[].sid==2", "goff"); // trkcalohit histograms - trkana->Draw("demtch.ctime>>h_demtch_ctime_all", "", "goff"); - trkana->Draw("demtch.ctime>>h_demtch_ctime_active", "demtch.active==1", "goff"); - trkana->Draw("demtch.ctime>>h_demtch_ctime_inactive", "demtch.active==0", "goff"); - trkana->Draw("demtch.ctime-demlh.t0>>h_demtch_demfit_dt_ent", "demfit.sid==0 && demtch.active==1", "goff"); + ntuple->Draw("demtch.ctime>>h_demtch_ctime_all", "", "goff"); + ntuple->Draw("demtch.ctime>>h_demtch_ctime_active", "demtch.active==1", "goff"); + ntuple->Draw("demtch.ctime>>h_demtch_ctime_inactive", "demtch.active==0", "goff"); + ntuple->Draw("demtch.ctime-demlh.t0>>h_demtch_demfit_dt_ent", "demfit.sid==0 && demtch.active==1", "goff"); // crv histograms - trkana->Draw("crvsummary.totalPEs>>h_crvsummary_totalPEs_all", "", "goff"); - trkana->Draw("crvcoincs.pos.fCoordinates.fX>>h_crvhit_pos_x", "", "goff"); - trkana->Draw("crvcoincs.pos.fCoordinates.fY>>h_crvhit_pos_y", "", "goff"); - trkana->Draw("crvcoincs.pos.fCoordinates.fZ>>h_crvhit_pos_z", "", "goff"); - trkana->Draw("crvcoincsmc.primary.fCoordinates.fX>>h_crvhitmc_primary_x", "", "goff"); - trkana->Draw("crvcoincsmc.primary.fCoordinates.fY>>h_crvhitmc_primary_y", "", "goff"); - trkana->Draw("crvcoincsmc.primary.fCoordinates.fZ>>h_crvhitmc_primary_z", "", "goff"); - trkana->Draw("crvcoincsmc.depositedEnergy>>h_crvhitmc_depostedEnergy", "", "goff"); + ntuple->Draw("crvsummary.totalPEs>>h_crvsummary_totalPEs_all", "", "goff"); + ntuple->Draw("crvcoincs.pos.fCoordinates.fX>>h_crvhit_pos_x", "", "goff"); + ntuple->Draw("crvcoincs.pos.fCoordinates.fY>>h_crvhit_pos_y", "", "goff"); + ntuple->Draw("crvcoincs.pos.fCoordinates.fZ>>h_crvhit_pos_z", "", "goff"); + ntuple->Draw("crvcoincsmc.primary.fCoordinates.fX>>h_crvhitmc_primary_x", "", "goff"); + ntuple->Draw("crvcoincsmc.primary.fCoordinates.fY>>h_crvhitmc_primary_y", "", "goff"); + ntuple->Draw("crvcoincsmc.primary.fCoordinates.fZ>>h_crvhitmc_primary_z", "", "goff"); + ntuple->Draw("crvcoincsmc.depositedEnergy>>h_crvhitmc_depostedEnergy", "", "goff"); // demmcsim histograms - trkana->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_all", "", "goff"); - trkana->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_all", "", "goff"); - trkana->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_all", "", "goff"); - trkana->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_evtprimary", "demmcsim.prirel._rel==0 && demmcsim.prirel._rem==0", "goff"); - trkana->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_evtprimary", "demmcsim.prirel._rel==0 && demmcsim.prirel._rem==0", "goff"); - trkana->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_evtprimary", "demmcsim.prirel._rel==0 && demmcsim.prirel._rem==0", "goff"); - trkana->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkprimary", "demmcsim.trkrel._rel==0 && demmcsim.trkrel._rem==0", "goff"); - trkana->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkprimary", "demmcsim.trkrel._rel==0 && demmcsim.trkrel._rem==0", "goff"); - trkana->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkprimary", "demmcsim.trkrel._rel==0 && demmcsim.trkrel._rem==0", "goff"); - trkana->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkparent", "demmcsim.trkrel._rel==2 && demmcsim.trkrel._rem==1", "goff"); - trkana->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkparent", "demmcsim.trkrel._rel==2 && demmcsim.trkrel._rem==1", "goff"); - trkana->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkparent", "demmcsim.trkrel._rel==2 && demmcsim.trkrel._rem==1", "goff"); - trkana->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkgparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==2", "goff"); - trkana->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkgparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==2", "goff"); - trkana->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkgparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==2", "goff"); - trkana->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkggparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==3", "goff"); - trkana->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkggparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==3", "goff"); - trkana->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkggparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==3", "goff"); + ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_all", "", "goff"); + ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_all", "", "goff"); + ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_all", "", "goff"); + ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_evtprimary", "demmcsim.prirel._rel==0 && demmcsim.prirel._rem==0", "goff"); + ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_evtprimary", "demmcsim.prirel._rel==0 && demmcsim.prirel._rem==0", "goff"); + ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_evtprimary", "demmcsim.prirel._rel==0 && demmcsim.prirel._rem==0", "goff"); + ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkprimary", "demmcsim.trkrel._rel==0 && demmcsim.trkrel._rem==0", "goff"); + ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkprimary", "demmcsim.trkrel._rel==0 && demmcsim.trkrel._rem==0", "goff"); + ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkprimary", "demmcsim.trkrel._rel==0 && demmcsim.trkrel._rem==0", "goff"); + ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkparent", "demmcsim.trkrel._rel==2 && demmcsim.trkrel._rem==1", "goff"); + ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkparent", "demmcsim.trkrel._rel==2 && demmcsim.trkrel._rem==1", "goff"); + ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkparent", "demmcsim.trkrel._rel==2 && demmcsim.trkrel._rem==1", "goff"); + ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkgparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==2", "goff"); + ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkgparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==2", "goff"); + ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkgparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==2", "goff"); + ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkggparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==3", "goff"); + ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkggparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==3", "goff"); + ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkggparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==3", "goff"); file->Write(); From d399cca0b21e683faf097bb5f47e4250de184c8d Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 15:07:45 -0500 Subject: [PATCH 006/100] Rename folder from TrkAna to EventNtuple --- doc/v5-to-v6.md | 2 +- fcl/TrkAnaReco.fcl | 12 ++++++------ fcl/prolog.fcl | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index cf3232e..6359c93 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -16,4 +16,4 @@ Many fcl files were renamed, updated, or deleted | art module name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | | prolog.fcl table name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | | tree name | ```trkana``` | ```ntuple``` | | - +| folder name | ```TrkAna``` | ```EventNtuple``` | | diff --git a/fcl/TrkAnaReco.fcl b/fcl/TrkAnaReco.fcl index 4a596c6..fc584dc 100644 --- a/fcl/TrkAnaReco.fcl +++ b/fcl/TrkAnaReco.fcl @@ -29,12 +29,12 @@ physics.end_paths : [ TrkAnaEndPath ] #physics.analyzers.TrkAnaPos.candidate.options : @local::AllOpt # for hit level diagnostics, set diagLevel to 2 -physics.analyzers.TrkAna.diagLevel : 1 -physics.analyzers.TrkAna.FillMCInfo : true -physics.analyzers.TrkAna.FillCRVCoincs : true -physics.analyzers.TrkAna.FillTriggerInfo : false -physics.analyzers.TrkAna.FitType : LoopHelix +physics.analyzers.EventNtuple.diagLevel : 1 +physics.analyzers.EventNtuple.FillMCInfo : true +physics.analyzers.EventNtuple.FillCRVCoincs : true +physics.analyzers.EventNtuple.FillTriggerInfo : false +physics.analyzers.EventNtuple.FitType : LoopHelix -physics.analyzers.TrkAna.FillTrkPIDInfo : false +physics.analyzers.EventNtuple.FillTrkPIDInfo : false services.TFileService.fileName: "nts.owner.trkana-reco.version.sequencer.root" diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 9a49031..05c4142 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -223,7 +223,7 @@ TrkAnaReco : { } analyzers : { - TrkAna : { @table::EventNtupleMaker } + EventNtuple : { @table::EventNtupleMaker } TrkAnaExt : { @table::EventNtupleMaker branches : [ @local::Ext ] @@ -235,8 +235,8 @@ TrkAnaReco : { # TrigSequence : [ PBIWeight, @sequence::TrkQualProducersPath, @sequence::TrkPIDProducersPath] TrigSequence : [ @sequence::MergeKKProducersPath, PBIWeight, MakeSS, TrkQualDeM ] TrigSequenceNoMC : [ @sequence::MergeKKProducersPath, TrkQualDeM ] - EndSequenceNoMC : [ TrkAna ] - EndSequence : [ TrkAna, genCountLogger ] + EndSequenceNoMC : [ EventNtuple ] + EndSequence : [ EventNtuple, genCountLogger ] } From e54e121e4c6abb12545e50d1e1cbded0ca405538 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 15:11:06 -0500 Subject: [PATCH 007/100] Deleting CrvExpert.fcl --- doc/v5-to-v6.md | 3 +++ fcl/CrvExpert.fcl | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 fcl/CrvExpert.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 6359c93..0ad399f 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -7,6 +7,9 @@ There was a major update when we moved from v5 to v6. Here is a table of changes ## Fcl Files Many fcl files were renamed, updated, or deleted +| fcl file | v5 --> v6 | notes | +|----|---|----| +| CrvExpert.fcl | deleted | refers to v4 ```TrkAnaNeg``` and ```TrkAnaPos``` | ## Name Changes diff --git a/fcl/CrvExpert.fcl b/fcl/CrvExpert.fcl deleted file mode 100644 index 76f3cd9..0000000 --- a/fcl/CrvExpert.fcl +++ /dev/null @@ -1,3 +0,0 @@ -#include "TrkAna/fcl/TrkAnaReco.fcl" -physics.analyzers.TrkAnaNeg.FillCRVPulses : false -physics.analyzers.TrkAnaPos.FillCRVPulses : false From c919223c5a8b38d56f2ea14e4365f093bd01ade3 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 15:13:45 -0500 Subject: [PATCH 008/100] Delete TrkAnaReco_wTrkQualFilter.fcl --- doc/v5-to-v6.md | 7 ++-- fcl/TrkAnaReco_wTrkQualFilter.fcl | 63 ------------------------------- 2 files changed, 4 insertions(+), 66 deletions(-) delete mode 100644 fcl/TrkAnaReco_wTrkQualFilter.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 0ad399f..030e72c 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -7,9 +7,10 @@ There was a major update when we moved from v5 to v6. Here is a table of changes ## Fcl Files Many fcl files were renamed, updated, or deleted -| fcl file | v5 --> v6 | notes | -|----|---|----| -| CrvExpert.fcl | deleted | refers to v4 ```TrkAnaNeg``` and ```TrkAnaPos``` | +| fcl file | v5 --> v6 | +|----|---| +| CrvExpert.fcl | deleted | +| TrkAnaReco_wTrkQualFilter.fcl | deleted | ## Name Changes diff --git a/fcl/TrkAnaReco_wTrkQualFilter.fcl b/fcl/TrkAnaReco_wTrkQualFilter.fcl deleted file mode 100644 index f344e98..0000000 --- a/fcl/TrkAnaReco_wTrkQualFilter.fcl +++ /dev/null @@ -1,63 +0,0 @@ -#include "Offline/fcl/minimalMessageService.fcl" -#include "Offline/fcl/standardProducers.fcl" -#include "Offline/fcl/standardServices.fcl" -#include "TrkAna/fcl/prolog.fcl" - -process_name : TrkAnaReco - -source : { module_type : RootInput } - -services : @local::Services.Reco - -physics : -{ - producers : { @table::TrkAnaReco.producers } - analyzers : { @table::TrkAnaReco.analyzers } - filters : { - trkQualFilter : { module_type : TrkQualFilter - trainName : "TrkQual" - trkHypo : "DeM" - effRequest : 0.505 - } - trkQualNegFilter : { module_type : TrkQualFilter - trainName : "TrkQualNeg" - trkHypo : "DeM" - effRequest : 0.5 - } - } -} - -physics.producers.TrkQualNegDeM : @local::TrkQualDeM -physics.producers.TrkQualNegDeM.TrainingName : "TrkQualNeg" - -physics.TrkAnaTrigPath : [ @sequence::TrkAnaReco.TrigSequence, trkQualFilter ] -physics.TrkAnaNegTrigPath : [ @sequence::TrkAnaReco.TrigSequence, TrkQualNegDeM, trkQualNegFilter ] -#physics.TrkAnaBothTrigPath : [ @sequence::physics.TrkAnaTrigPath, @sequence::physics.TrkAnaNegTrigPath ] - -physics.TrkAnaEndPath : [ @sequence::TrkAnaReco.EndSequence ] - -# Take events that pass one filter -physics.analyzers.TrkAnaNeg.SelectEvents : [ TrkAnaTrigPath ] - -# Take events that pass either filter -#physics.analyzers.TrkAnaNeg.SelectEvents : [ TrkAnaTrigPath, TrkAnaNegTrigPath ] - -# Take events that pass both filters -#physics.analyzers.TrkAnaNeg.SelectEvents : [ TrkAnaBothTrigPath ] - - -# Include more information (MC, full TrkQual and TrkPID branches) -physics.analyzers.TrkAnaNeg.candidate.options : @local::AllOpt -physics.analyzers.TrkAnaPos.candidate.options : @local::AllOpt - -# for hit level diagnostics, set diagLevel to 2 -physics.analyzers.TrkAnaNeg.diagLevel : 1 -physics.analyzers.TrkAnaNeg.FillMCInfo : true -physics.analyzers.TrkAnaNeg.FillCRVCoincs : true -physics.analyzers.TrkAnaNeg.FillTriggerInfo : true -physics.analyzers.TrkAnaPos.diagLevel : 1 -physics.analyzers.TrkAnaPos.FillMCInfo : true -physics.analyzers.TrkAnaPos.FillCRVCoincs : true -physics.analyzers.TrkAnaPos.FillTriggerInfo : true - -services.TFileService.fileName: "nts.owner.trkana-reco.version.sequencer.root" From 0685b3a91223bc48ea9cc0857da52e285156a2df Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 15:26:11 -0500 Subject: [PATCH 009/100] Follow on change to validation script for folder name change --- validation/create_val_file.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/create_val_file.C b/validation/create_val_file.C index 1113548..c76b0f8 100644 --- a/validation/create_val_file.C +++ b/validation/create_val_file.C @@ -1,7 +1,7 @@ void create_val_file(std::string filename, std::string outfilename) { TFile* ntuple_file = new TFile(filename.c_str(), "READ"); - TTree* ntuple = (TTree*) ntuple_file->Get("TrkAna/ntuple"); + TTree* ntuple = (TTree*) ntuple_file->Get("EventNtuple/ntuple"); TFile* file = new TFile(outfilename.c_str(), "RECREATE"); From bfdf9721184476e64db84408d96ddb109f9f7e00 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 15:27:15 -0500 Subject: [PATCH 010/100] Rename default output file name --- doc/v5-to-v6.md | 1 + fcl/TrkAnaReco.fcl | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 030e72c..4d150e9 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -21,3 +21,4 @@ Many fcl files were renamed, updated, or deleted | prolog.fcl table name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | | tree name | ```trkana``` | ```ntuple``` | | | folder name | ```TrkAna``` | ```EventNtuple``` | | +| default output file name | ```nts.owner.trkana-reco.version.sequencer.root``` | ```nts.owner.description.version.sequencer.root``` | | diff --git a/fcl/TrkAnaReco.fcl b/fcl/TrkAnaReco.fcl index fc584dc..1cb8eb5 100644 --- a/fcl/TrkAnaReco.fcl +++ b/fcl/TrkAnaReco.fcl @@ -3,7 +3,7 @@ #include "Offline/fcl/standardServices.fcl" #include "TrkAna/fcl/prolog.fcl" -process_name : TrkAnaReco +process_name : EventNtuple source : { module_type : RootInput } @@ -23,18 +23,12 @@ physics.TrkAnaEndPath : [ @sequence::TrkAnaReco.EndSequence ] physics.trigger_paths : [ TrkAnaTrigPath ] physics.end_paths : [ TrkAnaEndPath ] -# Include more information (MC, full TrkQual and TrkPID branches) -# TODO: add these options back -#physics.analyzers.TrkAnaNeg.candidate.options : @local::AllOpt -#physics.analyzers.TrkAnaPos.candidate.options : @local::AllOpt - # for hit level diagnostics, set diagLevel to 2 physics.analyzers.EventNtuple.diagLevel : 1 physics.analyzers.EventNtuple.FillMCInfo : true physics.analyzers.EventNtuple.FillCRVCoincs : true physics.analyzers.EventNtuple.FillTriggerInfo : false physics.analyzers.EventNtuple.FitType : LoopHelix - physics.analyzers.EventNtuple.FillTrkPIDInfo : false -services.TFileService.fileName: "nts.owner.trkana-reco.version.sequencer.root" +services.TFileService.fileName: "nts.owner.description.version.sequencer.root" From 70565322c78c66edffc2b59faeea5d2f2f12b7ee Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 15:31:53 -0500 Subject: [PATCH 011/100] Reorganize documentation --- doc/v5-to-v6.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 4d150e9..155668a 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -1,10 +1,14 @@ # Major Changes from v5 to v6 -There was a major update when we moved from v5 to v6. Here is a table of changes for you to consult: +There was a major update when we moved from v5 to v6. Here are tables of changes for you to consult. Note that the same change may appear in multiple tables since it may be important in one area but defined in another. For example, the folder name is defined in fcl but is also important to know in the Tree / Branch / Leaf Changes -## Branch / Leaf Changes +## Tree / Branch / Leaf Changes +| | v5 | v6 | Notes | +|---|--|--|---| +| folder name | ```TrkAna``` | ```EventNtuple``` | defined in fcl| +| tree name | ```trkana``` | ```ntuple``` | defined in code | -## Fcl Files +## Fcl File Changes Many fcl files were renamed, updated, or deleted | fcl file | v5 --> v6 | @@ -12,13 +16,18 @@ Many fcl files were renamed, updated, or deleted | CrvExpert.fcl | deleted | | TrkAnaReco_wTrkQualFilter.fcl | deleted | -## Name Changes +## Fcl Parameter Changes +| | v5 | v6 | Notes | +|---|--|--|---| +| prolog.fcl table name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | the table that contains the default module configuration | +| folder name | ```TrkAna``` | ```EventNtuple``` | | +| default output file name | ```nts.owner.trkana-reco.version.sequencer.root``` | ```nts.owner.description.version.sequencer.root``` | | + + +## Important Code Changes | | v5 | v6 | Notes | |---|--|--|---| | src file name | ```TrkAnaTreeMaker_module.cc``` | ```EventNtupleMaker_module.cc``` | | | art module name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | -| prolog.fcl table name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | -| tree name | ```trkana``` | ```ntuple``` | | -| folder name | ```TrkAna``` | ```EventNtuple``` | | -| default output file name | ```nts.owner.trkana-reco.version.sequencer.root``` | ```nts.owner.description.version.sequencer.root``` | | +| tree name | ```trkana``` | ```ntuple``` | defined in code | From 4d5c5b3997d9881705feda28b5faa20caf33a0ae Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 16:02:09 -0500 Subject: [PATCH 012/100] Rename prolog block --- doc/v5-to-v6.md | 3 ++- fcl/TrkAnaReco.fcl | 10 ++++------ fcl/prolog.fcl | 5 ++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 155668a..b2e6d6c 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -19,9 +19,10 @@ Many fcl files were renamed, updated, or deleted ## Fcl Parameter Changes | | v5 | v6 | Notes | |---|--|--|---| -| prolog.fcl table name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | the table that contains the default module configuration | | folder name | ```TrkAna``` | ```EventNtuple``` | | | default output file name | ```nts.owner.trkana-reco.version.sequencer.root``` | ```nts.owner.description.version.sequencer.root``` | | +| prolog.fcl table name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | the table that contains the default module configuration | +| prolog.fcl physics block | ```TrkAnaReco``` | ```EventNtuple``` | the block that contains ```producers```, ```analyzers```, etc. | ## Important Code Changes diff --git a/fcl/TrkAnaReco.fcl b/fcl/TrkAnaReco.fcl index 1cb8eb5..572def4 100644 --- a/fcl/TrkAnaReco.fcl +++ b/fcl/TrkAnaReco.fcl @@ -11,14 +11,12 @@ services : @local::Services.Reco physics : { - producers : { - @table::TrkAnaReco.producers - } - analyzers : { @table::TrkAnaReco.analyzers } + producers : { @table::EventNtuple.producers } + analyzers : { @table::EventNtuple.analyzers } } -physics.TrkAnaTrigPath : [ @sequence::TrkAnaReco.TrigSequence ] -physics.TrkAnaEndPath : [ @sequence::TrkAnaReco.EndSequence ] +physics.TrkAnaTrigPath : [ @sequence::EventNtuple.TrigSequence ] +physics.TrkAnaEndPath : [ @sequence::EventNtuple.EndSequence ] physics.trigger_paths : [ TrkAnaTrigPath ] physics.end_paths : [ TrkAnaEndPath ] diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 05c4142..a7bb069 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -211,14 +211,13 @@ EventNtupleMaker : { SurfaceStepCollectionTag : "MakeSS" } -TrkAnaReco : { - +EventNtuple : { producers: { PBIWeight : @local::PBIWeight @table::TrkQualProducers @table::TrkPIDProducers @table::MergeKKProducers -# patch for SurfaceSteps in MDC2020 + # patch for SurfaceSteps in MDC2020 MakeSS : @local::CommonMC.MakeSSReco } From faf13a1d0ec92e16e8add4ac5f089f82adb8b866 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 16:06:50 -0500 Subject: [PATCH 013/100] Rename paths --- doc/v5-to-v6.md | 1 + fcl/TrkAnaReco.fcl | 8 ++++---- fcl/prolog.fcl | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index b2e6d6c..bfc27be 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -23,6 +23,7 @@ Many fcl files were renamed, updated, or deleted | default output file name | ```nts.owner.trkana-reco.version.sequencer.root``` | ```nts.owner.description.version.sequencer.root``` | | | prolog.fcl table name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | the table that contains the default module configuration | | prolog.fcl physics block | ```TrkAnaReco``` | ```EventNtuple``` | the block that contains ```producers```, ```analyzers```, etc. | +| prolog.fcl path names | ```Sequence``` | ```Path``` | for consistency with previous stages of processing| ## Important Code Changes diff --git a/fcl/TrkAnaReco.fcl b/fcl/TrkAnaReco.fcl index 572def4..47eb8e6 100644 --- a/fcl/TrkAnaReco.fcl +++ b/fcl/TrkAnaReco.fcl @@ -15,11 +15,11 @@ physics : analyzers : { @table::EventNtuple.analyzers } } -physics.TrkAnaTrigPath : [ @sequence::EventNtuple.TrigSequence ] -physics.TrkAnaEndPath : [ @sequence::EventNtuple.EndSequence ] +physics.EventNtuplePath : [ @sequence::EventNtuple.Path ] +physics.EventNtupleEndPath : [ @sequence::EventNtuple.EndPath ] -physics.trigger_paths : [ TrkAnaTrigPath ] -physics.end_paths : [ TrkAnaEndPath ] +physics.trigger_paths : [ EventNtuplePath ] +physics.end_paths : [ EventNtupleEndPath ] # for hit level diagnostics, set diagLevel to 2 physics.analyzers.EventNtuple.diagLevel : 1 diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index a7bb069..807dda3 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -232,10 +232,10 @@ EventNtuple : { } # TrigSequence : [ PBIWeight, @sequence::TrkQualProducersPath, @sequence::TrkPIDProducersPath] - TrigSequence : [ @sequence::MergeKKProducersPath, PBIWeight, MakeSS, TrkQualDeM ] - TrigSequenceNoMC : [ @sequence::MergeKKProducersPath, TrkQualDeM ] - EndSequenceNoMC : [ EventNtuple ] - EndSequence : [ EventNtuple, genCountLogger ] + Path : [ @sequence::MergeKKProducersPath, PBIWeight, MakeSS, TrkQualDeM ] + PathNoMC : [ @sequence::MergeKKProducersPath, TrkQualDeM ] + EndPath : [ EventNtuple, genCountLogger ] + EndPathNoMC : [ EventNtuple ] } From 34f9b1089a4b8a7339773423352670033b6beca9 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 16:11:36 -0500 Subject: [PATCH 014/100] Move effective defaults from TrkAnaReco.fcl into prolog.fcl --- fcl/TrkAnaReco.fcl | 8 -------- fcl/prolog.fcl | 10 +++++++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/fcl/TrkAnaReco.fcl b/fcl/TrkAnaReco.fcl index 47eb8e6..5c618f6 100644 --- a/fcl/TrkAnaReco.fcl +++ b/fcl/TrkAnaReco.fcl @@ -21,12 +21,4 @@ physics.EventNtupleEndPath : [ @sequence::EventNtuple.EndPath ] physics.trigger_paths : [ EventNtuplePath ] physics.end_paths : [ EventNtupleEndPath ] -# for hit level diagnostics, set diagLevel to 2 -physics.analyzers.EventNtuple.diagLevel : 1 -physics.analyzers.EventNtuple.FillMCInfo : true -physics.analyzers.EventNtuple.FillCRVCoincs : true -physics.analyzers.EventNtuple.FillTriggerInfo : false -physics.analyzers.EventNtuple.FitType : LoopHelix -physics.analyzers.EventNtuple.FillTrkPIDInfo : false - services.TFileService.fileName: "nts.owner.description.version.sequencer.root" diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 807dda3..15e9ccb 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -187,10 +187,10 @@ EventNtupleMaker : { CrvDigisTag : "SelectRecoMC" CrvCoincidenceClusterMCAssnsTag : "CrvCoincidenceClusterMCAssns" CrvPlaneY : 2653 - FillMCInfo : true - FillTrkPIDInfo : true + FillMCInfo : false + FillTrkPIDInfo : false FillHitInfo : false - FillTriggerInfo : true + FillTriggerInfo : false TriggerProcessName : "Mix" ProcessEmptyEvents : false FillCRVCoincs : true @@ -209,8 +209,12 @@ EventNtupleMaker : { # ExtraMCStepCollectionTags : [ "compressRecoMCs:protonabsorber", "compressRecoMCs:stoppingtarget" ] ExtraMCStepCollectionTags : [] SurfaceStepCollectionTag : "MakeSS" + FitType : LoopHelix } +EventNtupleMakerMC : @local::EventNtupleMaker +EventNtupleMakerMC.FillMCInfo : true + EventNtuple : { producers: { PBIWeight : @local::PBIWeight From 7ba6f79429c061435595f51158cdda753df4df83 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 16:16:45 -0500 Subject: [PATCH 015/100] Renaming TrkAnaReco.fcl --- doc/v5-to-v6.md | 9 +++++---- fcl/{TrkAnaReco.fcl => from_mock_dataset.fcl} | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) rename fcl/{TrkAnaReco.fcl => from_mock_dataset.fcl} (89%) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index bfc27be..8f73655 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -11,10 +11,11 @@ There was a major update when we moved from v5 to v6. Here are tables of changes ## Fcl File Changes Many fcl files were renamed, updated, or deleted -| fcl file | v5 --> v6 | -|----|---| -| CrvExpert.fcl | deleted | -| TrkAnaReco_wTrkQualFilter.fcl | deleted | +| fcl file | v5 --> v6 | notes | +|----|---|----| +| TrkAnaReco.fcl | from_mock_dataset.fcl | for running on mock datasets, ```genCountLogger``` also removed | +| CrvExpert.fcl | deleted | | +| TrkAnaReco_wTrkQualFilter.fcl | deleted | | ## Fcl Parameter Changes | | v5 | v6 | Notes | diff --git a/fcl/TrkAnaReco.fcl b/fcl/from_mock_dataset.fcl similarity index 89% rename from fcl/TrkAnaReco.fcl rename to fcl/from_mock_dataset.fcl index 5c618f6..95c44b3 100644 --- a/fcl/TrkAnaReco.fcl +++ b/fcl/from_mock_dataset.fcl @@ -16,7 +16,7 @@ physics : } physics.EventNtuplePath : [ @sequence::EventNtuple.Path ] -physics.EventNtupleEndPath : [ @sequence::EventNtuple.EndPath ] +physics.EventNtupleEndPath : [ @sequence::EventNtuple.EndPathNoMC ] physics.trigger_paths : [ EventNtuplePath ] physics.end_paths : [ EventNtupleEndPath ] From 6b1b620eb228d6baf801a5a8b2b6be6ca29b52d6 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 16:21:25 -0500 Subject: [PATCH 016/100] Move some prolog around for tidying --- doc/v5-to-v6.md | 1 + fcl/prolog.fcl | 31 +++---------------------------- fcl/prolog_mc_reweighters.fcl | 30 ++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 28 deletions(-) create mode 100644 fcl/prolog_mc_reweighters.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 8f73655..e7f99c3 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -14,6 +14,7 @@ Many fcl files were renamed, updated, or deleted | fcl file | v5 --> v6 | notes | |----|---|----| | TrkAnaReco.fcl | from_mock_dataset.fcl | for running on mock datasets, ```genCountLogger``` also removed | +| prolog_mc_reweighters.fcl | new file | contains prolog blocks for reweighter modules which were previously in prolog.fcl itself | | CrvExpert.fcl | deleted | | | TrkAnaReco_wTrkQualFilter.fcl | deleted | | diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 15e9ccb..02fc2d4 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -2,6 +2,9 @@ #include "Offline/Compression/fcl/prolog.fcl" #include "Offline/CommonMC/fcl/prolog.fcl" #include "Offline/fcl/TrkCaloDt.fcl" + +#include "TrkAna/fcl/prolog_mc_reweighters.fcl" + BEGIN_PROLOG # Track quality module TrkQual : { @@ -56,34 +59,6 @@ TrkPIDProducers : { } TrkPIDProducersPath : [ TrkPIDDeM, TrkPIDDeP ] -# DIO weighting for flat spectrum electrons -DIOWeight: { - module_type: DecayInOrbitWeight - weightingScheme : pol58 - inputModule : compressDigiMCs - verbosityLevel: 1 -} -# converts ProtonBunchIntensity object to EventWeight object -PBIWeight : { - module_type : PBIWeight - PBITag : "PBISim" - meanPBITag : "PBISim:MeanIntensity" -} -#Example configuration of RMCWeightModule -RMCWeight : { - module_type : RMCWeight - kinematic_endpoint : 100 - internalConversion : 1 - verbosityLevel : 0 -} -dioLLWeight : { - module_type : BinnedSpectrumWeight - genParticleTag : "compressDigiMCs" - genParticlePdgId : 11 - genParticleGenId : dioTail - spectrumFileName : "Offline/ConditionsService/data/czarnecki_szafron_Al_2016.tbl" - BinCenter : false -} genCountLogger: { module_type: GenEventCountReader } AllOpt : { diff --git a/fcl/prolog_mc_reweighters.fcl b/fcl/prolog_mc_reweighters.fcl new file mode 100644 index 0000000..90ef0c8 --- /dev/null +++ b/fcl/prolog_mc_reweighters.fcl @@ -0,0 +1,30 @@ +BEGIN_PROLOG +# DIO weighting for flat spectrum electrons +DIOWeight: { + module_type: DecayInOrbitWeight + weightingScheme : pol58 + inputModule : compressDigiMCs + verbosityLevel: 1 +} +# converts ProtonBunchIntensity object to EventWeight object +PBIWeight : { + module_type : PBIWeight + PBITag : "PBISim" + meanPBITag : "PBISim:MeanIntensity" +} +#Example configuration of RMCWeightModule +RMCWeight : { + module_type : RMCWeight + kinematic_endpoint : 100 + internalConversion : 1 + verbosityLevel : 0 +} +dioLLWeight : { + module_type : BinnedSpectrumWeight + genParticleTag : "compressDigiMCs" + genParticlePdgId : 11 + genParticleGenId : dioTail + spectrumFileName : "Offline/ConditionsService/data/czarnecki_szafron_Al_2016.tbl" + BinCenter : false +} +END_PROLOG From 7ca7e80cacbe4fb447e42ee63be09d69a9d48444 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 16:29:23 -0500 Subject: [PATCH 017/100] Adding new fcl files --- doc/v5-to-v6.md | 4 +++- fcl/from_mcs_mixed.fcl | 1 + fcl/{from_mock_dataset.fcl => from_mcs_mockdata.fcl} | 0 fcl/from_mcs_primary.fcl | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 fcl/from_mcs_mixed.fcl rename fcl/{from_mock_dataset.fcl => from_mcs_mockdata.fcl} (100%) create mode 100644 fcl/from_mcs_primary.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index e7f99c3..bf71330 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -13,7 +13,9 @@ Many fcl files were renamed, updated, or deleted | fcl file | v5 --> v6 | notes | |----|---|----| -| TrkAnaReco.fcl | from_mock_dataset.fcl | for running on mock datasets, ```genCountLogger``` also removed | +| TrkAnaReco.fcl | from_mcs_mockdata.fcl | for running on mock datasets, ```genCountLogger``` also removed | +| from_mcs_primary.fcl | new file | for running on mcs "primary" datasets | +| from_mcs_mixed.fcl | new file | for running on mcs "mixed" datasets | | prolog_mc_reweighters.fcl | new file | contains prolog blocks for reweighter modules which were previously in prolog.fcl itself | | CrvExpert.fcl | deleted | | | TrkAnaReco_wTrkQualFilter.fcl | deleted | | diff --git a/fcl/from_mcs_mixed.fcl b/fcl/from_mcs_mixed.fcl new file mode 100644 index 0000000..e772683 --- /dev/null +++ b/fcl/from_mcs_mixed.fcl @@ -0,0 +1 @@ +#include "TrkAna/inc/from_mcs_primary.fcl" diff --git a/fcl/from_mock_dataset.fcl b/fcl/from_mcs_mockdata.fcl similarity index 100% rename from fcl/from_mock_dataset.fcl rename to fcl/from_mcs_mockdata.fcl diff --git a/fcl/from_mcs_primary.fcl b/fcl/from_mcs_primary.fcl new file mode 100644 index 0000000..601177a --- /dev/null +++ b/fcl/from_mcs_primary.fcl @@ -0,0 +1,3 @@ +#include "TrkAna/inc/from_mcs_mockdata.fcl" + +physics.EventNtupleEndPath : [ @sequence::EventNtuple.EndPath ] # adds back genCountLogger From a4743a5f13a6eb884b276f9a2063de971119f381 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 17:35:16 -0500 Subject: [PATCH 018/100] Rename extracted fcl and updated other fcl --- doc/v5-to-v6.md | 4 +++- fcl/TrkAnaExtracted.fcl | 37 ------------------------------------- fcl/from_mcs_extracted.fcl | 8 ++++++++ fcl/from_mcs_mixed.fcl | 2 +- fcl/from_mcs_primary.fcl | 2 +- fcl/prolog.fcl | 11 ++--------- 6 files changed, 15 insertions(+), 49 deletions(-) delete mode 100644 fcl/TrkAnaExtracted.fcl create mode 100644 fcl/from_mcs_extracted.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index bf71330..0df12d6 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -5,8 +5,9 @@ There was a major update when we moved from v5 to v6. Here are tables of changes ## Tree / Branch / Leaf Changes | | v5 | v6 | Notes | |---|--|--|---| -| folder name | ```TrkAna``` | ```EventNtuple``` | defined in fcl| | tree name | ```trkana``` | ```ntuple``` | defined in code | +| folder name | ```TrkAna``` | ```EventNtuple``` | defined in fcl | +| folder name | ```TrkAnaExt``` | ```EventNtuple``` | defined in fcl | ## Fcl File Changes Many fcl files were renamed, updated, or deleted @@ -16,6 +17,7 @@ Many fcl files were renamed, updated, or deleted | TrkAnaReco.fcl | from_mcs_mockdata.fcl | for running on mock datasets, ```genCountLogger``` also removed | | from_mcs_primary.fcl | new file | for running on mcs "primary" datasets | | from_mcs_mixed.fcl | new file | for running on mcs "mixed" datasets | +| TrkAnaExtracted.fcl | from_mcs_extracted.fcl | for running on mcs "extracted position" datasets, now #includes from_mcs_mockdata.fcl as a base | | prolog_mc_reweighters.fcl | new file | contains prolog blocks for reweighter modules which were previously in prolog.fcl itself | | CrvExpert.fcl | deleted | | | TrkAnaReco_wTrkQualFilter.fcl | deleted | | diff --git a/fcl/TrkAnaExtracted.fcl b/fcl/TrkAnaExtracted.fcl deleted file mode 100644 index 6ebde28..0000000 --- a/fcl/TrkAnaExtracted.fcl +++ /dev/null @@ -1,37 +0,0 @@ -#include "Offline/fcl/minimalMessageService.fcl" -#include "Offline/fcl/standardProducers.fcl" -#include "Offline/fcl/standardServices.fcl" -#include "TrkAna/fcl/prolog.fcl" - -process_name : TrkAnaExt - -source : { module_type : RootInput } - -services : @local::Services.Reco - -physics : -{ - producers : { - @table::TrkAnaReco.producers - } - analyzers : { @table::TrkAnaReco.analyzers } -} -physics.TrkAnaTrigPath : [ @sequence::MergeKKNoFieldPath ] -physics.TrkAnaEndPath : [ TrkAnaExt ] - -physics.trigger_paths : [ TrkAnaTrigPath ] -physics.end_paths : [ TrkAnaEndPath ] - -# Include more information (MC, full TrkQual and TrkPID branches) -physics.analyzers.TrkAnaExt.branches[0].options.fillMC : true -physics.analyzers.TrkAnaExt.branches[0].options.genealogyDepth : 5 -physics.analyzers.TrkAnaExt.FillTriggerInfo : false -physics.analyzers.TrkAnaExt.FitType : KinematicLine - -# for hit level diagnostics, set diagLevel to 2 -physics.analyzers.TrkAnaExt.diagLevel : 1 -physics.analyzers.TrkAnaExt.FillMCInfo : true -physics.analyzers.TrkAnaExt.FillCRVCoincs : true - -services.GeometryService.inputFile: "Production/JobConfig/cosmic/geom_cosmic_extracted.txt" -services.TFileService.fileName: "nts.owner.trkanaextracted-reco.version.sequencer.root" diff --git a/fcl/from_mcs_extracted.fcl b/fcl/from_mcs_extracted.fcl new file mode 100644 index 0000000..27a9dfa --- /dev/null +++ b/fcl/from_mcs_extracted.fcl @@ -0,0 +1,8 @@ +#include "TrkAna/fcl/from_mcs_mockdata.fcl" + +physics.EventNtuplePath : [ @sequence::EventNtuple.PathExt ] # path for extracted position cosmics +physics.analyzers.EventNtuple.branches : [ @local::Ext ] +physics.analyzers.EventNtuple.FitType : KinematicLine + +services.GeometryService.inputFile: "Production/JobConfig/cosmic/geom_cosmic_extracted.txt" +services.TFileService.fileName: "nts.owner.trkanaextracted-reco.version.sequencer.root" diff --git a/fcl/from_mcs_mixed.fcl b/fcl/from_mcs_mixed.fcl index e772683..76b6d7c 100644 --- a/fcl/from_mcs_mixed.fcl +++ b/fcl/from_mcs_mixed.fcl @@ -1 +1 @@ -#include "TrkAna/inc/from_mcs_primary.fcl" +#include "TrkAna/fcl/from_mcs_primary.fcl" diff --git a/fcl/from_mcs_primary.fcl b/fcl/from_mcs_primary.fcl index 601177a..a011596 100644 --- a/fcl/from_mcs_primary.fcl +++ b/fcl/from_mcs_primary.fcl @@ -1,3 +1,3 @@ -#include "TrkAna/inc/from_mcs_mockdata.fcl" +#include "TrkAna/fcl/from_mcs_mockdata.fcl" physics.EventNtupleEndPath : [ @sequence::EventNtuple.EndPath ] # adds back genCountLogger diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 02fc2d4..184b109 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -162,7 +162,7 @@ EventNtupleMaker : { CrvDigisTag : "SelectRecoMC" CrvCoincidenceClusterMCAssnsTag : "CrvCoincidenceClusterMCAssns" CrvPlaneY : 2653 - FillMCInfo : false + FillMCInfo : true FillTrkPIDInfo : false FillHitInfo : false FillTriggerInfo : false @@ -187,9 +187,6 @@ EventNtupleMaker : { FitType : LoopHelix } -EventNtupleMakerMC : @local::EventNtupleMaker -EventNtupleMakerMC.FillMCInfo : true - EventNtuple : { producers: { PBIWeight : @local::PBIWeight @@ -202,16 +199,12 @@ EventNtuple : { analyzers : { EventNtuple : { @table::EventNtupleMaker } - - TrkAnaExt : { @table::EventNtupleMaker - branches : [ @local::Ext ] - } - genCountLogger : @local::genCountLogger } # TrigSequence : [ PBIWeight, @sequence::TrkQualProducersPath, @sequence::TrkPIDProducersPath] Path : [ @sequence::MergeKKProducersPath, PBIWeight, MakeSS, TrkQualDeM ] + PathExt : [ @sequence::MergeKKNoFieldPath ] PathNoMC : [ @sequence::MergeKKProducersPath, TrkQualDeM ] EndPath : [ EventNtuple, genCountLogger ] EndPathNoMC : [ EventNtuple ] From d6d925b96b79e79448c6ca8c3e70c915cbd63995 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 18:20:04 -0500 Subject: [PATCH 019/100] Update fcl file for running in output of ceSimReco.fcl --- doc/v5-to-v6.md | 3 ++- fcl/TrkAnaReco_ceSimReco.fcl | 10 ---------- fcl/from_mcs_ceSimReco.fcl | 6 ++++++ 3 files changed, 8 insertions(+), 11 deletions(-) delete mode 100644 fcl/TrkAnaReco_ceSimReco.fcl create mode 100644 fcl/from_mcs_ceSimReco.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 0df12d6..02f42ba 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -15,9 +15,10 @@ Many fcl files were renamed, updated, or deleted | fcl file | v5 --> v6 | notes | |----|---|----| | TrkAnaReco.fcl | from_mcs_mockdata.fcl | for running on mock datasets, ```genCountLogger``` also removed | +| TrkAnaExtracted.fcl | from_mcs_extracted.fcl | for running on mcs "extracted position" datasets, now #includes from_mcs_mockdata.fcl as a base | +| TrkAnaReco_ceSimReco.fcl | from_mcs_ceSimReco.fcl | for running on the output of ceSimReco.fcl | | from_mcs_primary.fcl | new file | for running on mcs "primary" datasets | | from_mcs_mixed.fcl | new file | for running on mcs "mixed" datasets | -| TrkAnaExtracted.fcl | from_mcs_extracted.fcl | for running on mcs "extracted position" datasets, now #includes from_mcs_mockdata.fcl as a base | | prolog_mc_reweighters.fcl | new file | contains prolog blocks for reweighter modules which were previously in prolog.fcl itself | | CrvExpert.fcl | deleted | | | TrkAnaReco_wTrkQualFilter.fcl | deleted | | diff --git a/fcl/TrkAnaReco_ceSimReco.fcl b/fcl/TrkAnaReco_ceSimReco.fcl deleted file mode 100644 index a488000..0000000 --- a/fcl/TrkAnaReco_ceSimReco.fcl +++ /dev/null @@ -1,10 +0,0 @@ -#include "TrkAna/fcl/TrkAnaReco.fcl" - -process_name : TrkAnaCeSimReco - -physics.analyzers.TrkAna.branches : [ @local::DeM ] -physics.analyzers.TrkAna.FillTriggerInfo : false -physics.TrkAnaTrigPath : [ MergeKKDeM, PBIWeight, TrkQualDeM, TrkPIDDeM ] -physics.TrkAnaEndPath : [ TrkAna, genCountLogger ] - -services.TFileService.fileName: "nts.owner.trkana-ce-sim-reco.version.sequencer.root" diff --git a/fcl/from_mcs_ceSimReco.fcl b/fcl/from_mcs_ceSimReco.fcl new file mode 100644 index 0000000..9bdef6a --- /dev/null +++ b/fcl/from_mcs_ceSimReco.fcl @@ -0,0 +1,6 @@ +#include "TrkAna/fcl/from_mcs_mockdata.fcl" + +physics.analyzers.EventNtuple.branches : [ @local::DeM ] +physics.analyzers.EventNtuple.FillTriggerInfo : false +physics.EventNtuplePath : [ MergeKKDeM, PBIWeight, TrkQualDeM, TrkPIDDeM ] +physics.EventNtupleEndPath : [ EventNtuple, genCountLogger ] From ed700d2150a882aca807a156fe78d0296feb515d Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 18:22:50 -0500 Subject: [PATCH 020/100] Removing unneeded fcl files --- doc/v5-to-v6.md | 2 ++ fcl/TrkAnaReco_addMCUpstream.fcl | 4 ---- fcl/TrkAnaReco_addStopTgtVDs.fcl | 19 ------------------- 3 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 fcl/TrkAnaReco_addMCUpstream.fcl delete mode 100644 fcl/TrkAnaReco_addStopTgtVDs.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 02f42ba..cda9cd5 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -22,6 +22,8 @@ Many fcl files were renamed, updated, or deleted | prolog_mc_reweighters.fcl | new file | contains prolog blocks for reweighter modules which were previously in prolog.fcl itself | | CrvExpert.fcl | deleted | | | TrkAnaReco_wTrkQualFilter.fcl | deleted | | +| TrkAnaReco_addMCUpstream.fcl | deleted | | +| TrkAnaReco_addStopTgtVDs.fcl | deleted | | ## Fcl Parameter Changes | | v5 | v6 | Notes | diff --git a/fcl/TrkAnaReco_addMCUpstream.fcl b/fcl/TrkAnaReco_addMCUpstream.fcl deleted file mode 100644 index b7cffe1..0000000 --- a/fcl/TrkAnaReco_addMCUpstream.fcl +++ /dev/null @@ -1,4 +0,0 @@ -#include "TrkAna/fcl/TrkAnaReco.fcl" - -physics.analyzers.TrkAnaNeg.supplements[0].options : @local::AllOpt -physics.analyzers.TrkAnaNeg.supplements[0].options.fillTrkPID : false \ No newline at end of file diff --git a/fcl/TrkAnaReco_addStopTgtVDs.fcl b/fcl/TrkAnaReco_addStopTgtVDs.fcl deleted file mode 100644 index 3cea34d..0000000 --- a/fcl/TrkAnaReco_addStopTgtVDs.fcl +++ /dev/null @@ -1,19 +0,0 @@ -// This fcl file gives an example of how an analyzer -// can write a TrkAna tree with different VirtualDetectors -// -// This is useful if .... -// -// In this example, we will write branches for ST_Out virtual detector -// - -// This example builds on TrkAnaReco.fcl -#include "TrkAna/fcl/TrkAnaReco.fcl" - -// First define the suffix of the branches we want -// In this example, "tgt" will mean we create branched "detgt", "demctgt", "uetgt", etc. -physics.analyzers.TrkAnaNeg.candidate.segmentSuffixes : [ @sequence::physics.analyzers.TrkAnaNeg.candidate.segmentSuffixes, "tgt" ] - -// Then define the virtual detectors we want to be included in this branch -// NB we add a sequence because we sometimes combine virtual detectors for one "interesting" plane -// (e.g. TT_FrontHollow and TT_FrontPA define the entrance to the tracker) -physics.analyzers.TrkAnaNeg.candidate.segmentVIDs : [ @sequence::physics.analyzers.TrkAnaNeg.candidate.segmentVIDs, ["ST_Out"] ] From 973db039a994d1ac92badc7f94c8b064678dcf36 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 18:29:51 -0500 Subject: [PATCH 021/100] Updating mock data-related fcl files --- doc/v5-to-v6.md | 2 ++ fcl/TrkAnaRecoEnsemble-Data.fcl | 8 -------- fcl/TrkAnaRecoEnsemble-MC.fcl | 5 ----- fcl/from_mcs_mockdata_noMC.fcl | 6 ++++++ 4 files changed, 8 insertions(+), 13 deletions(-) delete mode 100644 fcl/TrkAnaRecoEnsemble-Data.fcl delete mode 100644 fcl/TrkAnaRecoEnsemble-MC.fcl create mode 100644 fcl/from_mcs_mockdata_noMC.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index cda9cd5..2e5e3f5 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -17,9 +17,11 @@ Many fcl files were renamed, updated, or deleted | TrkAnaReco.fcl | from_mcs_mockdata.fcl | for running on mock datasets, ```genCountLogger``` also removed | | TrkAnaExtracted.fcl | from_mcs_extracted.fcl | for running on mcs "extracted position" datasets, now #includes from_mcs_mockdata.fcl as a base | | TrkAnaReco_ceSimReco.fcl | from_mcs_ceSimReco.fcl | for running on the output of ceSimReco.fcl | +| TrkAnaRecoEnsemble-Data.fcl | from_mcs_mockdata_noMC.fcl | for running on mock data with no MC information | | from_mcs_primary.fcl | new file | for running on mcs "primary" datasets | | from_mcs_mixed.fcl | new file | for running on mcs "mixed" datasets | | prolog_mc_reweighters.fcl | new file | contains prolog blocks for reweighter modules which were previously in prolog.fcl itself | +| TrkAnaRecoEnsemble-MC.fcl | deleted | use from_mcs_mockdata.fcl | | CrvExpert.fcl | deleted | | | TrkAnaReco_wTrkQualFilter.fcl | deleted | | | TrkAnaReco_addMCUpstream.fcl | deleted | | diff --git a/fcl/TrkAnaRecoEnsemble-Data.fcl b/fcl/TrkAnaRecoEnsemble-Data.fcl deleted file mode 100644 index f959ac8..0000000 --- a/fcl/TrkAnaRecoEnsemble-Data.fcl +++ /dev/null @@ -1,8 +0,0 @@ -#include "TrkAna/fcl/TrkAnaReco.fcl" - -physics.analyzers.TrkAna.FillMCInfo : false - -physics.TrkAnaTrigPath : [ @sequence::TrkAnaReco.TrigSequenceNoMC ] -physics.TrkAnaEndPath : [ @sequence::TrkAnaReco.EndSequenceNoMC ] - -services.TFileService.fileName: "nts.owner.trkana-reco-ensemble-data.version.sequencer.root" diff --git a/fcl/TrkAnaRecoEnsemble-MC.fcl b/fcl/TrkAnaRecoEnsemble-MC.fcl deleted file mode 100644 index 4c876ef..0000000 --- a/fcl/TrkAnaRecoEnsemble-MC.fcl +++ /dev/null @@ -1,5 +0,0 @@ -#include "TrkAna/fcl/TrkAnaReco.fcl" - -physics.TrkAnaEndPath : [ @sequence::TrkAnaReco.EndSequenceNoMC ] - -services.TFileService.fileName: "nts.owner.trkana-reco-ensemble-mc.version.sequencer.root" diff --git a/fcl/from_mcs_mockdata_noMC.fcl b/fcl/from_mcs_mockdata_noMC.fcl new file mode 100644 index 0000000..3af4f21 --- /dev/null +++ b/fcl/from_mcs_mockdata_noMC.fcl @@ -0,0 +1,6 @@ +#include "TrkAna/fcl/from_mcs_mockdata_noMC.fcl" + +physics.analyzers.EventNtuple.FillMCInfo : false + +physics.EventNtuplePath : [ @sequence::EventNtuple.PathNoMC ] +physics.EventNtupleEndPath : [ @sequence::EventNtuple.EndPathNoMC ] From 9c8df23d9d07e5e48f6c9ddde9214be331c1d026 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 18:36:20 -0500 Subject: [PATCH 022/100] Adding a README.md for the fcl files --- fcl/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 fcl/README.md diff --git a/fcl/README.md b/fcl/README.md new file mode 100644 index 0000000..f9dd9e2 --- /dev/null +++ b/fcl/README.md @@ -0,0 +1,7 @@ +# Fcl Files +The naming convention for fcl files is: + +| fcl file | runs on | additional info | +|----------|-----|-----| +| from_mcs-mockdata.fcl | mock data files | | +| from_mcs-mockdata_noMC.fcl | mock data files | doesn't include MC in output| From a6f4c0ee5640e3ce139699b49825ad1b8782e13a Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 18:57:56 -0500 Subject: [PATCH 023/100] Updating new fcl file naming convention --- doc/v5-to-v6.md | 14 +++++++------- fcl/README.md | 10 +++++++--- ...om_mcs_ceSimReco.fcl => from_mcs-ceSimReco.fcl} | 2 +- ...om_mcs_extracted.fcl => from_mcs-extracted.fcl} | 2 +- fcl/from_mcs-mixed.fcl | 1 + ...from_mcs_mockdata.fcl => from_mcs-mockdata.fcl} | 0 ...ockdata_noMC.fcl => from_mcs-mockdata_noMC.fcl} | 2 +- fcl/{from_mcs_primary.fcl => from_mcs-primary.fcl} | 2 +- fcl/from_mcs_mixed.fcl | 1 - 9 files changed, 19 insertions(+), 15 deletions(-) rename fcl/{from_mcs_ceSimReco.fcl => from_mcs-ceSimReco.fcl} (84%) rename fcl/{from_mcs_extracted.fcl => from_mcs-extracted.fcl} (89%) create mode 100644 fcl/from_mcs-mixed.fcl rename fcl/{from_mcs_mockdata.fcl => from_mcs-mockdata.fcl} (100%) rename fcl/{from_mcs_mockdata_noMC.fcl => from_mcs-mockdata_noMC.fcl} (78%) rename fcl/{from_mcs_primary.fcl => from_mcs-primary.fcl} (67%) delete mode 100644 fcl/from_mcs_mixed.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 2e5e3f5..58bfefd 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -14,14 +14,14 @@ Many fcl files were renamed, updated, or deleted | fcl file | v5 --> v6 | notes | |----|---|----| -| TrkAnaReco.fcl | from_mcs_mockdata.fcl | for running on mock datasets, ```genCountLogger``` also removed | -| TrkAnaExtracted.fcl | from_mcs_extracted.fcl | for running on mcs "extracted position" datasets, now #includes from_mcs_mockdata.fcl as a base | -| TrkAnaReco_ceSimReco.fcl | from_mcs_ceSimReco.fcl | for running on the output of ceSimReco.fcl | -| TrkAnaRecoEnsemble-Data.fcl | from_mcs_mockdata_noMC.fcl | for running on mock data with no MC information | -| from_mcs_primary.fcl | new file | for running on mcs "primary" datasets | -| from_mcs_mixed.fcl | new file | for running on mcs "mixed" datasets | +| TrkAnaReco.fcl | from_mcs-mockdata.fcl | for running on mock datasets, ```genCountLogger``` also removed | +| TrkAnaExtracted.fcl | from_mcs-extracted.fcl | for running on mcs "extracted position" datasets, now #includes from_mcs-mockdata.fcl as a base | +| TrkAnaReco_ceSimReco.fcl | from_mcs-ceSimReco.fcl | for running on the output of ceSimReco.fcl | +| TrkAnaRecoEnsemble-Data.fcl | from_mcs-mockdata_noMC.fcl | for running on mock data with no MC information | +| from_mcs-primary.fcl | new file | for running on mcs "primary" datasets | +| from_mcs-mixed.fcl | new file | for running on mcs "mixed" datasets | | prolog_mc_reweighters.fcl | new file | contains prolog blocks for reweighter modules which were previously in prolog.fcl itself | -| TrkAnaRecoEnsemble-MC.fcl | deleted | use from_mcs_mockdata.fcl | +| TrkAnaRecoEnsemble-MC.fcl | deleted | use from_mcs-mockdata.fcl | | CrvExpert.fcl | deleted | | | TrkAnaReco_wTrkQualFilter.fcl | deleted | | | TrkAnaReco_addMCUpstream.fcl | deleted | | diff --git a/fcl/README.md b/fcl/README.md index f9dd9e2..b318bab 100644 --- a/fcl/README.md +++ b/fcl/README.md @@ -1,7 +1,11 @@ # Fcl Files -The naming convention for fcl files is: +The naming convention for fcl files is ```from_tier-type_extra.fcl``` where ```tier``` is the data tier of the input dataset, ```type``` is the type of dataset (e.g. primary-only, extracted position), and ```extra``` gives some extra information (optional) | fcl file | runs on | additional info | |----------|-----|-----| -| from_mcs-mockdata.fcl | mock data files | | -| from_mcs-mockdata_noMC.fcl | mock data files | doesn't include MC in output| +| from_mcs-mockdata.fcl | mock datasets | | +| from_mcs-mockdata_noMC.fcl | mock datasets | doesn't include MC in output| +| from_mcs-extracted.fcl | reconstructed extracted position datasets | | +| from_mcs-primary.fcl | reconstructed primary (i.e. no background hits) datasets | | +| from_mcs-mixed.fcl | reconstructed mixed (i.e. primary+background hits) datasets | | +| from_mcs-ceSimReco.fcl | output of ceSimReco.fcl | | diff --git a/fcl/from_mcs_ceSimReco.fcl b/fcl/from_mcs-ceSimReco.fcl similarity index 84% rename from fcl/from_mcs_ceSimReco.fcl rename to fcl/from_mcs-ceSimReco.fcl index 9bdef6a..7ff0c9c 100644 --- a/fcl/from_mcs_ceSimReco.fcl +++ b/fcl/from_mcs-ceSimReco.fcl @@ -1,4 +1,4 @@ -#include "TrkAna/fcl/from_mcs_mockdata.fcl" +#include "TrkAna/fcl/from_mcs-mockdata.fcl" physics.analyzers.EventNtuple.branches : [ @local::DeM ] physics.analyzers.EventNtuple.FillTriggerInfo : false diff --git a/fcl/from_mcs_extracted.fcl b/fcl/from_mcs-extracted.fcl similarity index 89% rename from fcl/from_mcs_extracted.fcl rename to fcl/from_mcs-extracted.fcl index 27a9dfa..bae180d 100644 --- a/fcl/from_mcs_extracted.fcl +++ b/fcl/from_mcs-extracted.fcl @@ -1,4 +1,4 @@ -#include "TrkAna/fcl/from_mcs_mockdata.fcl" +#include "TrkAna/fcl/from_mcs-mockdata.fcl" physics.EventNtuplePath : [ @sequence::EventNtuple.PathExt ] # path for extracted position cosmics physics.analyzers.EventNtuple.branches : [ @local::Ext ] diff --git a/fcl/from_mcs-mixed.fcl b/fcl/from_mcs-mixed.fcl new file mode 100644 index 0000000..3e3cfc7 --- /dev/null +++ b/fcl/from_mcs-mixed.fcl @@ -0,0 +1 @@ +#include "TrkAna/fcl/from_mcs-primary.fcl" diff --git a/fcl/from_mcs_mockdata.fcl b/fcl/from_mcs-mockdata.fcl similarity index 100% rename from fcl/from_mcs_mockdata.fcl rename to fcl/from_mcs-mockdata.fcl diff --git a/fcl/from_mcs_mockdata_noMC.fcl b/fcl/from_mcs-mockdata_noMC.fcl similarity index 78% rename from fcl/from_mcs_mockdata_noMC.fcl rename to fcl/from_mcs-mockdata_noMC.fcl index 3af4f21..1a8466e 100644 --- a/fcl/from_mcs_mockdata_noMC.fcl +++ b/fcl/from_mcs-mockdata_noMC.fcl @@ -1,4 +1,4 @@ -#include "TrkAna/fcl/from_mcs_mockdata_noMC.fcl" +#include "TrkAna/fcl/from_mcs-mockdata.fcl" physics.analyzers.EventNtuple.FillMCInfo : false diff --git a/fcl/from_mcs_primary.fcl b/fcl/from_mcs-primary.fcl similarity index 67% rename from fcl/from_mcs_primary.fcl rename to fcl/from_mcs-primary.fcl index a011596..340bd64 100644 --- a/fcl/from_mcs_primary.fcl +++ b/fcl/from_mcs-primary.fcl @@ -1,3 +1,3 @@ -#include "TrkAna/fcl/from_mcs_mockdata.fcl" +#include "TrkAna/fcl/from_mcs-mockdata.fcl" physics.EventNtupleEndPath : [ @sequence::EventNtuple.EndPath ] # adds back genCountLogger diff --git a/fcl/from_mcs_mixed.fcl b/fcl/from_mcs_mixed.fcl deleted file mode 100644 index 76b6d7c..0000000 --- a/fcl/from_mcs_mixed.fcl +++ /dev/null @@ -1 +0,0 @@ -#include "TrkAna/fcl/from_mcs_primary.fcl" From 894b913581c5d58af6c4427d55c4672464fb4e77 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 18:59:24 -0500 Subject: [PATCH 024/100] Update fcl file README.md --- fcl/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fcl/README.md b/fcl/README.md index b318bab..cec17cd 100644 --- a/fcl/README.md +++ b/fcl/README.md @@ -1,5 +1,12 @@ # Fcl Files -The naming convention for fcl files is ```from_tier-type_extra.fcl``` where ```tier``` is the data tier of the input dataset, ```type``` is the type of dataset (e.g. primary-only, extracted position), and ```extra``` gives some extra information (optional) +## Naming Convention +The naming convention for fcl files is: + +```from_tier-type_extra.fcl``` + +where ```tier``` is the data tier of the input dataset, ```type``` is the type of dataset (e.g. primary-only, extracted position), and ```extra``` gives some extra information (optional) + +## Table of Fcl Files | fcl file | runs on | additional info | |----------|-----|-----| From 0c52149b51220b8aeffacbaadd0bd9f31be77413 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 19:08:36 -0500 Subject: [PATCH 025/100] Update fcl file README.md --- fcl/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fcl/README.md b/fcl/README.md index cec17cd..cbb7e4e 100644 --- a/fcl/README.md +++ b/fcl/README.md @@ -2,7 +2,9 @@ ## Naming Convention The naming convention for fcl files is: -```from_tier-type_extra.fcl``` +``` +from_tier-type_extra.fcl +``` where ```tier``` is the data tier of the input dataset, ```type``` is the type of dataset (e.g. primary-only, extracted position), and ```extra``` gives some extra information (optional) From c0643ed0c80473723d752ad6a10dac02f33a511e Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 19:37:16 -0500 Subject: [PATCH 026/100] Make "all track types in one branch" the new default, and add an example fcl file of how to separate again --- doc/v5-to-v6.md | 9 ++++----- fcl/README.md | 1 + fcl/TrkAnaReco_mergedKalSeeds.fcl | 10 ---------- fcl/from_mcs-mockdata_separateTrkBranches.fcl | 5 +++++ fcl/prolog.fcl | 14 +++++++++++--- 5 files changed, 21 insertions(+), 18 deletions(-) delete mode 100644 fcl/TrkAnaReco_mergedKalSeeds.fcl create mode 100644 fcl/from_mcs-mockdata_separateTrkBranches.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 58bfefd..4ad20d4 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -8,9 +8,10 @@ There was a major update when we moved from v5 to v6. Here are tables of changes | tree name | ```trkana``` | ```ntuple``` | defined in code | | folder name | ```TrkAna``` | ```EventNtuple``` | defined in fcl | | folder name | ```TrkAnaExt``` | ```EventNtuple``` | defined in fcl | +| branch | ```dem```, ```uem```, etc. | ```trk``` | all track types are now in a single branch | ## Fcl File Changes -Many fcl files were renamed, updated, or deleted +Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 are all fcl files are documented on the new [fcl README page](../fcl/README.md) | fcl file | v5 --> v6 | notes | |----|---|----| @@ -18,14 +19,12 @@ Many fcl files were renamed, updated, or deleted | TrkAnaExtracted.fcl | from_mcs-extracted.fcl | for running on mcs "extracted position" datasets, now #includes from_mcs-mockdata.fcl as a base | | TrkAnaReco_ceSimReco.fcl | from_mcs-ceSimReco.fcl | for running on the output of ceSimReco.fcl | | TrkAnaRecoEnsemble-Data.fcl | from_mcs-mockdata_noMC.fcl | for running on mock data with no MC information | -| from_mcs-primary.fcl | new file | for running on mcs "primary" datasets | -| from_mcs-mixed.fcl | new file | for running on mcs "mixed" datasets | -| prolog_mc_reweighters.fcl | new file | contains prolog blocks for reweighter modules which were previously in prolog.fcl itself | -| TrkAnaRecoEnsemble-MC.fcl | deleted | use from_mcs-mockdata.fcl | +| TrkAnaRecoEnsemble-MC.fcl | deleted | use from_mcs-mockdata.fcl instead| | CrvExpert.fcl | deleted | | | TrkAnaReco_wTrkQualFilter.fcl | deleted | | | TrkAnaReco_addMCUpstream.fcl | deleted | | | TrkAnaReco_addStopTgtVDs.fcl | deleted | | +| TrkAnaReco_mergedKalSeeds.fcl | deleted | all track types in one branch is now the default | ## Fcl Parameter Changes | | v5 | v6 | Notes | diff --git a/fcl/README.md b/fcl/README.md index cbb7e4e..53c710d 100644 --- a/fcl/README.md +++ b/fcl/README.md @@ -18,3 +18,4 @@ where ```tier``` is the data tier of the input dataset, ```type``` is the type o | from_mcs-primary.fcl | reconstructed primary (i.e. no background hits) datasets | | | from_mcs-mixed.fcl | reconstructed mixed (i.e. primary+background hits) datasets | | | from_mcs-ceSimReco.fcl | output of ceSimReco.fcl | | +| from_mcs-mockdata_separateTrkBranches.fcl | mock datasets | example on how to separate the tracks into separate branches again| diff --git a/fcl/TrkAnaReco_mergedKalSeeds.fcl b/fcl/TrkAnaReco_mergedKalSeeds.fcl deleted file mode 100644 index ff3db36..0000000 --- a/fcl/TrkAnaReco_mergedKalSeeds.fcl +++ /dev/null @@ -1,10 +0,0 @@ -#include "TrkAna/fcl/TrkAnaReco.fcl" - -physics.producers.MergeKalSeeds : { - module_type : MergeKalSeeds - KalSeedCollections : ["KKDeM", "KKDeP", "KKUeM", "KKUeP", "KKDmuM", "KKDmuP", "KKUmuM", "KKUmuP" ] -} - -physics.analyzers.TrkAna.branches : [ {input : "MergeKalSeeds" branch : "trk" } ] - -physics.TrkAnaTrigPath : [ MergeKalSeeds, PBIWeight, TrkQualDeM ] diff --git a/fcl/from_mcs-mockdata_separateTrkBranches.fcl b/fcl/from_mcs-mockdata_separateTrkBranches.fcl new file mode 100644 index 0000000..887ebdb --- /dev/null +++ b/fcl/from_mcs-mockdata_separateTrkBranches.fcl @@ -0,0 +1,5 @@ +#include "TrkAna/fcl/from_mcs-mockdata.fcl" + +physics.analyzers.EventNtuple.branches : [ @local::DeM, @local::DeP, @local::UeM, @local::UeP, + @local::DmuM, @local::DmuP, @local::UmuM, @local::UmuP ] +physics.EventNtuplePath : [ @sequence::EventNtuple.PathSeparate ] diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 184b109..8528e8d 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -90,6 +90,8 @@ MergeKKUmuP : @local::MergeKK MergeKKUmuP.KalSeedCollections : [ "KKUmuP" ] MergeKKLine : @local::MergeKK MergeKKLine.KalSeedCollections : [ "KKLine" ] +MergeKKAll : @local::MergeKK +MergeKKAll.KalSeedCollections : ["KKDeM", "KKDeP", "KKUeM", "KKUeP", "KKDmuM", "KKDmuP", "KKUmuM", "KKUmuP" ] MergeKKProducers : { MergeKKDeM : @local::MergeKKDeM @@ -101,9 +103,11 @@ MergeKKProducers : { MergeKKUmuM : @local::MergeKKUmuM MergeKKUmuP : @local::MergeKKUmuP MergeKKLine : @local::MergeKKLine + MergeKKAll : @local::MergeKKAll } -MergeKKProducersPath : [ MergeKKDeM, MergeKKUeM, MergeKKDmuM, MergeKKDeP, MergeKKUeP, MergeKKDmuP, MergeKKUmuM, MergeKKUmuP ] +MergeKKProducersPath : [ MergeKKAll ] MergeKKNoFieldPath : [ MergeKKLine ] +MergeKKSeparatePath : [ MergeKKDeM, MergeKKUeM, MergeKKDmuM, MergeKKDeP, MergeKKUeP, MergeKKDmuP, MergeKKUmuM, MergeKKUmuP ] DeM : { input : "MergeKKDeM" @@ -142,12 +146,15 @@ Ext : { input : "MergeKKLine" branch : "kl" options : { fillMC : true genealogyDepth : -1 matchDepth : -1 } } +All : { input : "MergeKKAll" + branch : "trk" + options : { fillMC : true genealogyDepth : -1 matchDepth : -1 } +} EventNtupleMaker : { module_type : EventNtupleMaker - branches : [ @local::DeM, @local::DeP, @local::UeM, @local::UeP, - @local::DmuM, @local::DmuP, @local::UmuM, @local::UmuP ] + branches : [ @local::All ] RecoCountTag : "SelectRecoMC" PBITag : "PBISim" PBTTag : "EWMProducer" @@ -205,6 +212,7 @@ EventNtuple : { # TrigSequence : [ PBIWeight, @sequence::TrkQualProducersPath, @sequence::TrkPIDProducersPath] Path : [ @sequence::MergeKKProducersPath, PBIWeight, MakeSS, TrkQualDeM ] PathExt : [ @sequence::MergeKKNoFieldPath ] + PathSeparate : [ @sequence::MergeKKSeparatePath, PBIWeight, MakeSS, TrkQualDeM ] PathNoMC : [ @sequence::MergeKKProducersPath, TrkQualDeM ] EndPath : [ EventNtuple, genCountLogger ] EndPathNoMC : [ EventNtuple ] From 34f341ee4bccb94a484fa86a426de42aee8ff69a Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 19:41:25 -0500 Subject: [PATCH 027/100] Update validation script for new "trk" branch. Don't rename histograms themselves yet... --- validation/create_val_file.C | 70 ++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/validation/create_val_file.C b/validation/create_val_file.C index c76b0f8..fed7875 100644 --- a/validation/create_val_file.C +++ b/validation/create_val_file.C @@ -17,26 +17,26 @@ void create_val_file(std::string filename, std::string outfilename) { ntuple->Draw("evtinfomc.nprotons>>h_evtinfomc_nprotons", "", ""); ntuple->Draw("evtinfomc.pbtime>>h_evtinfomc_pbtime", "", ""); - // demfit histograms - ntuple->Draw("demfit.mom.R()>>h_demfit_mom_all", "", "goff"); - ntuple->Draw("demfit.mom.R()>>h_demfit_mom_ent", "demfit.sid==0", "goff"); - ntuple->Draw("demfit.mom.R()>>h_demfit_mom_mid", "demfit.sid==1", "goff"); - ntuple->Draw("demfit.mom.R()>>h_demfit_mom_xit", "demfit.sid==2", "goff"); - ntuple->Draw("demfit.mom.R()>>h_demfit_mom_ent_t0cut", "demfit.sid==0 && demlh.t0>=700", "goff"); - ntuple->Draw("demfit.mom.R()>>h_demfit_mom_mid_t0cut", "demfit.sid==1 && demlh.t0>=700", "goff"); - ntuple->Draw("demfit.mom.R()>>h_demfit_mom_xit_t0cut", "demfit.sid==2 && demlh.t0>=700", "goff"); + // trkfit histograms + ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_all", "", "goff"); + ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_ent", "trkfit.sid==0", "goff"); + ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_mid", "trkfit.sid==1", "goff"); + ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_xit", "trkfit.sid==2", "goff"); + ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_ent_t0cut", "trkfit.sid==0 && trklh.t0>=700", "goff"); + ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_mid_t0cut", "trkfit.sid==1 && trklh.t0>=700", "goff"); + ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_xit_t0cut", "trkfit.sid==2 && trklh.t0>=700", "goff"); // resolution histograms - ntuple->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_all", "", "goff"); - ntuple->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_ent", "demmcvd[].sid==0", "goff"); - ntuple->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_mid", "demmcvd[].sid==1", "goff"); - ntuple->Draw("(demfit[][demmcvd.iinter].mom.R() - demmcvd[].mom.R())>>h_demfit_momres_xit", "demmcvd[].sid==2", "goff"); + ntuple->Draw("(trkfit[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_all", "", "goff"); + ntuple->Draw("(trkfit[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_ent", "trkmcvd[].sid==0", "goff"); + ntuple->Draw("(trkfit[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_mid", "trkmcvd[].sid==1", "goff"); + ntuple->Draw("(trkfit[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_xit", "trkmcvd[].sid==2", "goff"); // trkcalohit histograms - ntuple->Draw("demtch.ctime>>h_demtch_ctime_all", "", "goff"); - ntuple->Draw("demtch.ctime>>h_demtch_ctime_active", "demtch.active==1", "goff"); - ntuple->Draw("demtch.ctime>>h_demtch_ctime_inactive", "demtch.active==0", "goff"); - ntuple->Draw("demtch.ctime-demlh.t0>>h_demtch_demfit_dt_ent", "demfit.sid==0 && demtch.active==1", "goff"); + ntuple->Draw("trktch.ctime>>h_demtch_ctime_all", "", "goff"); + ntuple->Draw("trktch.ctime>>h_demtch_ctime_active", "trktch.active==1", "goff"); + ntuple->Draw("trktch.ctime>>h_demtch_ctime_inactive", "trktch.active==0", "goff"); + ntuple->Draw("trktch.ctime-trklh.t0>>h_demtch_demfit_dt_ent", "trkfit.sid==0 && trktch.active==1", "goff"); // crv histograms ntuple->Draw("crvsummary.totalPEs>>h_crvsummary_totalPEs_all", "", "goff"); @@ -48,25 +48,25 @@ void create_val_file(std::string filename, std::string outfilename) { ntuple->Draw("crvcoincsmc.primary.fCoordinates.fZ>>h_crvhitmc_primary_z", "", "goff"); ntuple->Draw("crvcoincsmc.depositedEnergy>>h_crvhitmc_depostedEnergy", "", "goff"); - // demmcsim histograms - ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_all", "", "goff"); - ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_all", "", "goff"); - ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_all", "", "goff"); - ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_evtprimary", "demmcsim.prirel._rel==0 && demmcsim.prirel._rem==0", "goff"); - ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_evtprimary", "demmcsim.prirel._rel==0 && demmcsim.prirel._rem==0", "goff"); - ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_evtprimary", "demmcsim.prirel._rel==0 && demmcsim.prirel._rem==0", "goff"); - ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkprimary", "demmcsim.trkrel._rel==0 && demmcsim.trkrel._rem==0", "goff"); - ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkprimary", "demmcsim.trkrel._rel==0 && demmcsim.trkrel._rem==0", "goff"); - ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkprimary", "demmcsim.trkrel._rel==0 && demmcsim.trkrel._rem==0", "goff"); - ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkparent", "demmcsim.trkrel._rel==2 && demmcsim.trkrel._rem==1", "goff"); - ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkparent", "demmcsim.trkrel._rel==2 && demmcsim.trkrel._rem==1", "goff"); - ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkparent", "demmcsim.trkrel._rel==2 && demmcsim.trkrel._rem==1", "goff"); - ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkgparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==2", "goff"); - ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkgparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==2", "goff"); - ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkgparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==2", "goff"); - ntuple->Draw("demmcsim.pos.x()>>h_demmcsim_pos_x_trkggparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==3", "goff"); - ntuple->Draw("demmcsim.pos.y()>>h_demmcsim_pos_y_trkggparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==3", "goff"); - ntuple->Draw("demmcsim.pos.z()>>h_demmcsim_pos_z_trkggparent", "demmcsim.trkrel._rel==5 && demmcsim.trkrel._rem==3", "goff"); + // trkmcsim histograms + ntuple->Draw("trkmcsim.pos.x()>>h_demmcsim_pos_x_all", "", "goff"); + ntuple->Draw("trkmcsim.pos.y()>>h_demmcsim_pos_y_all", "", "goff"); + ntuple->Draw("trkmcsim.pos.z()>>h_demmcsim_pos_z_all", "", "goff"); + ntuple->Draw("trkmcsim.pos.x()>>h_demmcsim_pos_x_evtprimary", "trkmcsim.prirel._rel==0 && trkmcsim.prirel._rem==0", "goff"); + ntuple->Draw("trkmcsim.pos.y()>>h_demmcsim_pos_y_evtprimary", "trkmcsim.prirel._rel==0 && trkmcsim.prirel._rem==0", "goff"); + ntuple->Draw("trkmcsim.pos.z()>>h_demmcsim_pos_z_evtprimary", "trkmcsim.prirel._rel==0 && trkmcsim.prirel._rem==0", "goff"); + ntuple->Draw("trkmcsim.pos.x()>>h_demmcsim_pos_x_trkprimary", "trkmcsim.trkrel._rel==0 && trkmcsim.trkrel._rem==0", "goff"); + ntuple->Draw("trkmcsim.pos.y()>>h_demmcsim_pos_y_trkprimary", "trkmcsim.trkrel._rel==0 && trkmcsim.trkrel._rem==0", "goff"); + ntuple->Draw("trkmcsim.pos.z()>>h_demmcsim_pos_z_trkprimary", "trkmcsim.trkrel._rel==0 && trkmcsim.trkrel._rem==0", "goff"); + ntuple->Draw("trkmcsim.pos.x()>>h_demmcsim_pos_x_trkparent", "trkmcsim.trkrel._rel==2 && trkmcsim.trkrel._rem==1", "goff"); + ntuple->Draw("trkmcsim.pos.y()>>h_demmcsim_pos_y_trkparent", "trkmcsim.trkrel._rel==2 && trkmcsim.trkrel._rem==1", "goff"); + ntuple->Draw("trkmcsim.pos.z()>>h_demmcsim_pos_z_trkparent", "trkmcsim.trkrel._rel==2 && trkmcsim.trkrel._rem==1", "goff"); + ntuple->Draw("trkmcsim.pos.x()>>h_demmcsim_pos_x_trkgparent", "trkmcsim.trkrel._rel==5 && trkmcsim.trkrel._rem==2", "goff"); + ntuple->Draw("trkmcsim.pos.y()>>h_demmcsim_pos_y_trkgparent", "trkmcsim.trkrel._rel==5 && trkmcsim.trkrel._rem==2", "goff"); + ntuple->Draw("trkmcsim.pos.z()>>h_demmcsim_pos_z_trkgparent", "trkmcsim.trkrel._rel==5 && trkmcsim.trkrel._rem==2", "goff"); + ntuple->Draw("trkmcsim.pos.x()>>h_demmcsim_pos_x_trkggparent", "trkmcsim.trkrel._rel==5 && trkmcsim.trkrel._rem==3", "goff"); + ntuple->Draw("trkmcsim.pos.y()>>h_demmcsim_pos_y_trkggparent", "trkmcsim.trkrel._rel==5 && trkmcsim.trkrel._rem==3", "goff"); + ntuple->Draw("trkmcsim.pos.z()>>h_demmcsim_pos_z_trkggparent", "trkmcsim.trkrel._rel==5 && trkmcsim.trkrel._rem==3", "goff"); file->Write(); From 21f219fee5f15dd6238c224a4b7374fdd44ddc11 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 19:41:40 -0500 Subject: [PATCH 028/100] Update v5-to-v6 doc --- doc/v5-to-v6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 4ad20d4..eb5e828 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -20,11 +20,11 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | TrkAnaReco_ceSimReco.fcl | from_mcs-ceSimReco.fcl | for running on the output of ceSimReco.fcl | | TrkAnaRecoEnsemble-Data.fcl | from_mcs-mockdata_noMC.fcl | for running on mock data with no MC information | | TrkAnaRecoEnsemble-MC.fcl | deleted | use from_mcs-mockdata.fcl instead| +| TrkAnaReco_mergedKalSeeds.fcl | deleted | all track types in one branch is now the default | | CrvExpert.fcl | deleted | | | TrkAnaReco_wTrkQualFilter.fcl | deleted | | | TrkAnaReco_addMCUpstream.fcl | deleted | | | TrkAnaReco_addStopTgtVDs.fcl | deleted | | -| TrkAnaReco_mergedKalSeeds.fcl | deleted | all track types in one branch is now the default | ## Fcl Parameter Changes | | v5 | v6 | Notes | From eb5b547888d9d49fb2736d0581f62450fd5a4f91 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 20:07:57 -0500 Subject: [PATCH 029/100] A little renaming and reorganizing of ntuplehelper --- .muse | 1 + README.md | 2 +- bin/ntuplehelper | 8 ++++---- tutorial/pages/helper.md => doc/ntuplehelper.md | 8 ++++---- utils/helper/ntuplehelper.py | 2 +- validation/ntuplehelper-test.py | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) rename tutorial/pages/helper.md => doc/ntuplehelper.md (93%) diff --git a/.muse b/.muse index 3faeacd..ef45a00 100644 --- a/.muse +++ b/.muse @@ -2,4 +2,5 @@ ROOT_LIBRARY_PATH PYTHONPATH utils +PYTHONPATH utils/helper PATH bin diff --git a/README.md b/README.md index 2489103..8f82f16 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ TrkAna is an event-based ntuple for Mu2e analyses. Each entry in the ntuple corr * [v5 --> v6 major changes](doc/v5-to-v6.md) * [Mu2eWiki page](https://mu2ewiki.fnal.gov/wiki/TrkAna) -* [utility to get explanations of branch and leaf names](tutorial/pages/helper.md) +* [utility to get explanations of branch and leaf names](doc/ntuplehelper.md) * [version history of TrkAna](https://mu2ewiki.fnal.gov/wiki/TrkAna#Version_History_.2F_TrkAna_Musings) * [tutorial](tutorial/README.md) (some but not all updated for v5) * [instructions for developers](https://mu2ewiki.fnal.gov/wiki/TrkAna#For_Developers) diff --git a/bin/ntuplehelper b/bin/ntuplehelper index 822bfbe..2afe11a 100755 --- a/bin/ntuplehelper +++ b/bin/ntuplehelper @@ -1,20 +1,20 @@ #!/bin/python3 import argparse -from ntuplehelper import nthelp +from ntuplehelper import nthelper # A main function so that this can be run on the command line def main(): parser = argparse.ArgumentParser( prog='ntuplehelper', - description='A python utility class to get information about branches and leaves', + description='A python utility class to get information about branches and leaves in the Mu2e EventNtuple', epilog='For help, post to the #trkana Slack channel') - parser.add_argument('--branches', required=True, nargs='*', help="Use format \"branch.leaf\". Multiple items are allowed. Using a \"*\" for the leaf will print description of all leaves for the branch") + parser.add_argument('branches', nargs='*', help="Use format \"branch.leaf\". Multiple items are allowed. Using a \"*\" for the leaf will print description of all leaves for the branch") args = parser.parse_args() - nth = nthelp() + nth = nthelper() nth.whatis(args.branches) diff --git a/tutorial/pages/helper.md b/doc/ntuplehelper.md similarity index 93% rename from tutorial/pages/helper.md rename to doc/ntuplehelper.md index 94b24c6..08300c7 100644 --- a/tutorial/pages/helper.md +++ b/doc/ntuplehelper.md @@ -12,20 +12,20 @@ You can use this utility: * on the command line: ``` -ntuplehelper --branches dem.nhits demmcsim.* +ntuplehelper dem.nhits demmcsim.* ``` * on the ROOT command lineL ``` -root[0] .! ntuplehelper --branches dem.nhits demmcsim.* +root[0] .! ntuplehelper dem.nhits demmcsim.* ``` * from within python: ``` >>> import ntuplehelper ->>> nthelp = ntuplehelper.nthelp() ->>> nthelp.whatis(['dem.hits', 'demmcsim.*']) +>>> nthelper = ntuplehelper.nthelper() +>>> nthelper.whatis(['dem.hits', 'demmcsim.*']) ``` The above produces this output: diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index c44b48e..0d591d6 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -1,6 +1,6 @@ import os -class nthelp: +class nthelper: track_types_dict = { 'kl' : "kinematic line fit (i.e. straight-line fit)", 'dem' : "downstream e-minus fit", diff --git a/validation/ntuplehelper-test.py b/validation/ntuplehelper-test.py index bfaf193..cff0328 100644 --- a/validation/ntuplehelper-test.py +++ b/validation/ntuplehelper-test.py @@ -1,6 +1,6 @@ import ntuplehelper -nthelp = ntuplehelper.nthelp() +nthelp = ntuplehelper.nthelper() print("Testing a leaf from each branch") print("=========") From 4cd397e2891bb7a668d97c6866f7055a38332d48 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 23 Sep 2024 20:50:16 -0500 Subject: [PATCH 030/100] Removing fhicl parameters that weren't being used anywhere in the code --- doc/v5-to-v6.md | 9 ++++++--- fcl/prolog.fcl | 2 -- fcl/prolog_trigger.fcl | 1 - src/EventNtupleMaker_module.cc | 3 --- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index eb5e828..b29202e 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -3,15 +3,15 @@ There was a major update when we moved from v5 to v6. Here are tables of changes for you to consult. Note that the same change may appear in multiple tables since it may be important in one area but defined in another. For example, the folder name is defined in fcl but is also important to know in the Tree / Branch / Leaf Changes ## Tree / Branch / Leaf Changes -| | v5 | v6 | Notes | -|---|--|--|---| +| | v5 | v6 | Notes | +|---|---|---|---| | tree name | ```trkana``` | ```ntuple``` | defined in code | | folder name | ```TrkAna``` | ```EventNtuple``` | defined in fcl | | folder name | ```TrkAnaExt``` | ```EventNtuple``` | defined in fcl | | branch | ```dem```, ```uem```, etc. | ```trk``` | all track types are now in a single branch | ## Fcl File Changes -Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 are all fcl files are documented on the new [fcl README page](../fcl/README.md) +Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 and all fcl files are documented on the new [fcl README page](../fcl/README.md) | fcl file | v5 --> v6 | notes | |----|---|----| @@ -34,6 +34,9 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | prolog.fcl table name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | the table that contains the default module configuration | | prolog.fcl physics block | ```TrkAnaReco``` | ```EventNtuple``` | the block that contains ```producers```, ```analyzers```, etc. | | prolog.fcl path names | ```Sequence``` | ```Path``` | for consistency with previous stages of processing| +| EventNtupleMaker module parameter | ```ProcessEmptyEvents``` | removed | not used anywhere | +| EventNtupleMaker module parameter | ```required``` | removed | not used anywhere | +| EventNtupleMaker module parameter | ```RecoCountTag``` | removed | not used anywhere | ## Important Code Changes diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 8528e8d..1d59c96 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -155,7 +155,6 @@ All : { input : "MergeKKAll" EventNtupleMaker : { module_type : EventNtupleMaker branches : [ @local::All ] - RecoCountTag : "SelectRecoMC" PBITag : "PBISim" PBTTag : "EWMProducer" PBTMCTag : "EWMProducer" @@ -174,7 +173,6 @@ EventNtupleMaker : { FillHitInfo : false FillTriggerInfo : false TriggerProcessName : "Mix" - ProcessEmptyEvents : false FillCRVCoincs : true FillCRVPulses : false FillCRVDigis : false diff --git a/fcl/prolog_trigger.fcl b/fcl/prolog_trigger.fcl index d2a1ae2..c4a7463 100644 --- a/fcl/prolog_trigger.fcl +++ b/fcl/prolog_trigger.fcl @@ -9,7 +9,6 @@ TrkAnaTrigger : { diagLevel : 2 FillCRVCoincs : false FillCaloMC : false - RecoCountTag : "" FillTriggerInfo : true FillTrkPIDInfo : false FillHitInfo : true diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 991bf22..352a798 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -109,7 +109,6 @@ namespace mu2e { fhicl::Atom fillhits{Name("fillHits"), Comment("Switch to turn on filling of hit-level information for this set of tracks"), false}; fhicl::OptionalAtom trkpid{Name("trkpid"), Comment("TrkCaloHitPIDCollection input tag to be written out")}; fhicl::Atom filltrkpid{Name("fillTrkPID"), Comment("Switch to turn on filling of the full TrkPIDInfo for this set of tracks"), false}; - fhicl::Atom required{Name("required"), Comment("True/false if you require this type of track in the event"), false}; fhicl::Atom genealogyDepth{Name("genealogyDepth"), Comment("The depth of the genealogy information you want to keep"), 1}; fhicl::Atom matchDepth{Name("matchDepth"), Comment("The depth into the MC true particle matching you want to keep"), 1}; }; @@ -129,13 +128,11 @@ namespace mu2e { using Comment=fhicl::Comment; // General control and config - fhicl::Atom pempty{Name("ProcessEmptyEvents"),false}; fhicl::Atom diag{Name("diagLevel"),1}; fhicl::Atom debug{Name("debugLevel"),0}; fhicl::Atom splitlevel{Name("splitlevel"),99}; fhicl::Atom buffsize{Name("buffsize"),32000}; // General event info - fhicl::Atom rctag{Name("RecoCountTag"), Comment("RecoCount"), art::InputTag()}; fhicl::Atom PBITag{Name("PBITag"), Comment("Tag for ProtonBunchIntensity object") ,art::InputTag()}; fhicl::Atom PBTTag{Name("PBTTag"), Comment("Tag for ProtonBunchTime object") ,art::InputTag()}; fhicl::Atom filltrig{Name("FillTriggerInfo"),false}; From d9acfb5be4a8eea02b9b73ff1161e74505712e61 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Wed, 25 Sep 2024 19:28:32 -0500 Subject: [PATCH 031/100] Deleting unused fcl files --- doc/v5-to-v6.md | 2 + fcl/TrkAnaReco_multipleBestCrv.fcl | 38 ------------------- ...co_multipleBestCrv_differentThresholds.fcl | 21 ---------- 3 files changed, 2 insertions(+), 59 deletions(-) delete mode 100644 fcl/TrkAnaReco_multipleBestCrv.fcl delete mode 100644 fcl/TrkAnaReco_multipleBestCrv_differentThresholds.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index b29202e..83c09f4 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -25,6 +25,8 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | TrkAnaReco_wTrkQualFilter.fcl | deleted | | | TrkAnaReco_addMCUpstream.fcl | deleted | | | TrkAnaReco_addStopTgtVDs.fcl | deleted | | +| TrkAnaReco_multipleBestCrv.fcl | deleted | | +| TrkAnaReco_multipleBestCrv_differentThresholds.fcl | deleted | | ## Fcl Parameter Changes | | v5 | v6 | Notes | diff --git a/fcl/TrkAnaReco_multipleBestCrv.fcl b/fcl/TrkAnaReco_multipleBestCrv.fcl deleted file mode 100644 index 505c487..0000000 --- a/fcl/TrkAnaReco_multipleBestCrv.fcl +++ /dev/null @@ -1,38 +0,0 @@ -// This fcl file gives an example of how an analyzer -// can write out a TrkAna tree with multiple "bestcrv" branches. -// -// This is useful if an analyzer wants to compare two different algorithms, -// or compare best and second-best crv hits -// -// In this example, we will write branches for the first and second-best crv hits, -// as defined by the BestCrvHitDeltaT module. This module creates a separate BestCrvAssns -// for the best and second-best crv hits. These will be written to the branches -// "debestcrv" and "desecondbestcrv", respectively -// -// In TrkAnaReco.fcl, we run this module multiple times with different track collections -// (e.g. downstream e-minus (DeM), upstream e-minus (UeM)). The labels for these modules -// are e.g. BestCrvDeM, BestCrvUeM, and each one produces two BestCrvAssns with instance names "first" -// and "second". So the art::InputTag ("moduleLabel:instanceName") for these would be -// e.g. "BestCrvDeM:first", "BestCrvUeM:second". -// - -// This example builds on TrkAnaReco.fcl -#include "TrkAna/fcl/TrkAnaReco.fcl" - -// The commented-out lines below are already defined in TrkAnaReco.fcl, -// but are included here for a later explanation -# physics.analyzers.TrkAnaNeg.candidate.options.suffix : "DeM" -# physics.analyzers.TrkAnaNeg.candidate.options.branch : "de" - -// We will add bestcrv branches for the candidate track. First, make a list of the module labels -// for the BestCrvAssns we will read in. Note that we do not need the "DeM" suffix of the module label -// because we have already defined it (see the commented-out lines above) -physics.analyzers.TrkAnaNeg.candidate.options.bestCrvModules : [ "BestCrv", "BestCrv" ] - -// Next we need to list the instance names of the Assns we will be reading in. -// Note that these can be empty strings (i.e. "") -physics.analyzers.TrkAnaNeg.candidate.options.bestCrvInstances : [ "first", "second" ] - -// Finally, we define what we want to name these branches. Note that TrkAna will add the "de" to the -// start of each branch name to differentiate between candidates and supplements -physics.analyzers.TrkAnaNeg.candidate.options.bestCrvBranches : [ "bestcrv", "secondbestcrv" ] diff --git a/fcl/TrkAnaReco_multipleBestCrv_differentThresholds.fcl b/fcl/TrkAnaReco_multipleBestCrv_differentThresholds.fcl deleted file mode 100644 index d236424..0000000 --- a/fcl/TrkAnaReco_multipleBestCrv_differentThresholds.fcl +++ /dev/null @@ -1,21 +0,0 @@ -#include "TrkAna/fcl/TrkAnaReco.fcl" - -// We want a singles Assns between reco and MC CrvCoincidenceClusters from all different collections -physics.producers.MakeCrvCoincidenceClusterMCAssns.crvCoincidenceTags : [ "SelectRecoMC:CrvCoincidenceClusterFinder", "SelectRecoMC:CrvCoincidenceClusterFinder6PEs" ] -physics.producers.MakeCrvCoincidenceClusterMCAssns.crvCoincidenceMCTags : [ "compressRecoMCs:CrvCoincidenceClusterMatchMC", "compressRecoMCs:CrvCoincidenceClusterMatchMC6PEs" ] - -// Define the new BestCrv modules and add them to the path -physics.producers.BestCrv6PEsDeM : @local::BestCrvDeM -physics.producers.BestCrv6PEsDeM.crvCoincidenceTag : "SelectRecoMC:CrvCoincidenceClusterFinder6PEs" - -physics.TrkAnaTrigPath : [ @sequence::physics.TrkAnaTrigPath, BestCrv6PEsDeM ] - -// Then add them to TrkAna (NB DeM suffix not needed) -physics.analyzers.TrkAnaNeg.candidate.options.bestCrvModules : [ "BestCrv", "BestCrv6PEs" ] - -// The BestCrvHitDeltaT_module.cc produces the first- and second-best crv hits. -// Here we have two different modules and want the best candidate for each so we use "first" twice... -physics.analyzers.TrkAnaNeg.candidate.options.bestCrvInstances : [ "first", "first" ] - -// This names the branches, which will translate to "debestcrv" and "debestcrv6PEs" -physics.analyzers.TrkAnaNeg.candidate.options.bestCrvBranches : [ "bestcrv", "bestcrv6PEs" ] From d13b98e2dec861fc7831d2a3318aef8b4fd3200f Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Wed, 25 Sep 2024 19:44:53 -0500 Subject: [PATCH 032/100] Adding an example fcl that uses a Selector --- fcl/README.md | 3 ++- fcl/from_mcs-mockdata_selectorExample.fcl | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 fcl/from_mcs-mockdata_selectorExample.fcl diff --git a/fcl/README.md b/fcl/README.md index 53c710d..4e0b23a 100644 --- a/fcl/README.md +++ b/fcl/README.md @@ -13,9 +13,10 @@ where ```tier``` is the data tier of the input dataset, ```type``` is the type o | fcl file | runs on | additional info | |----------|-----|-----| | from_mcs-mockdata.fcl | mock datasets | | -| from_mcs-mockdata_noMC.fcl | mock datasets | doesn't include MC in output| +| from_mcs-mockdata_noMC.fcl | mock datasets | doesn't include MC in output | | from_mcs-extracted.fcl | reconstructed extracted position datasets | | | from_mcs-primary.fcl | reconstructed primary (i.e. no background hits) datasets | | | from_mcs-mixed.fcl | reconstructed mixed (i.e. primary+background hits) datasets | | | from_mcs-ceSimReco.fcl | output of ceSimReco.fcl | | | from_mcs-mockdata_separateTrkBranches.fcl | mock datasets | example on how to separate the tracks into separate branches again| +| from_mcs-mockdata_selectorExample.fcl | mock datasets | example on how to use a selector to select certain types of tracks | diff --git a/fcl/from_mcs-mockdata_selectorExample.fcl b/fcl/from_mcs-mockdata_selectorExample.fcl new file mode 100644 index 0000000..bda991a --- /dev/null +++ b/fcl/from_mcs-mockdata_selectorExample.fcl @@ -0,0 +1,13 @@ +#include "TrkAna/fcl/from_mcs-mockdata.fcl" + +# a simple selector is used here, but any selector implemented as a tool can be used +physics.producers.MergeKKAll.Selector : { + tool_type : SimpleKalSeedSelector + MinMomentum : 75.0 # MeV/c + MaxMomentum : 300.0 #MeV/c + MinFitConsistency : 1e-10 + MinDeltaNHitFraction : 0.05 # Consider a 5% difference in active hit count to be 'significant', and call the track more hits 'better'. Otherwise, use fit quality to determine 'better' + MinActiveHits : 15 # Require a reasonable # of active hits +} +# optionally select only the 'best' single candidate per event, where 'best' is defined by the selector, this result in only one track per event +SelectBest : true From 969c4d7a77efa69e0c2ede4fb1ab16b47a1771c5 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Wed, 25 Sep 2024 19:47:29 -0500 Subject: [PATCH 033/100] Changing default of FillHits parameter --- doc/v5-to-v6.md | 3 ++- fcl/prolog.fcl | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 83c09f4..1c830dc 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -38,7 +38,8 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | prolog.fcl path names | ```Sequence``` | ```Path``` | for consistency with previous stages of processing| | EventNtupleMaker module parameter | ```ProcessEmptyEvents``` | removed | not used anywhere | | EventNtupleMaker module parameter | ```required``` | removed | not used anywhere | -| EventNtupleMaker module parameter | ```RecoCountTag``` | removed | not used anywhere | +| EventNtupleMaker module parameter | ```RecoCountTag``` | removed | not used anywhere | +| ```FillHits``` default value | ```false``` | ```true``` | changed in prolog.fcl | ## Important Code Changes diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 1d59c96..45e1e8d 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -170,7 +170,7 @@ EventNtupleMaker : { CrvPlaneY : 2653 FillMCInfo : true FillTrkPIDInfo : false - FillHitInfo : false + FillHitInfo : true FillTriggerInfo : false TriggerProcessName : "Mix" FillCRVCoincs : true From 81e8b31c1b66cd8ab3ac79c36f7b449302ef7610 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Wed, 25 Sep 2024 19:52:18 -0500 Subject: [PATCH 034/100] Turning hit output on properly --- fcl/prolog.fcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 45e1e8d..5527c9a 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -148,7 +148,7 @@ Ext : { input : "MergeKKLine" } All : { input : "MergeKKAll" branch : "trk" - options : { fillMC : true genealogyDepth : -1 matchDepth : -1 } + options : { fillHits : true fillMC : true genealogyDepth : -1 matchDepth : -1 } } From 9d1e22eb2b05e73da8fa9aa579ee33801bd02c50 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Wed, 25 Sep 2024 19:58:05 -0500 Subject: [PATCH 035/100] Fix whitespace --- src/EventNtupleMaker_module.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 352a798..8ac9225 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -215,13 +215,13 @@ namespace mu2e { std::vector > > _allRQCHs; // outer vector is for each track type, inner vector is all RecoQuals std::vector > _allTCHPCHs; // we will only allow one TrkCaloHitPID object per track type to be fully written out - std::vector > _allTrkQualCHs; + std::vector > _allTrkQualCHs; // quality branches (outputs) std::vector _allRQIs; std::vector _allTPIs; std::map> _allTrkQualResults; - + // trigger information unsigned _trigbits; std::map _tmap; // map between path and trigger ID. ID should come from trigger itself FIXME! @@ -615,7 +615,7 @@ namespace mu2e { _allMCTIs.at(i_branch).clear(); _allMCVDInfos.at(i_branch).clear(); _allMCSimTIs.at(i_branch).clear(); - + _allTrkQualResults.at(i_branch).clear(); for (StepCollIndex i_extraMCStepTag = 0; i_extraMCStepTag < _extraMCStepTags.size(); ++i_extraMCStepTag) { @@ -783,9 +783,8 @@ namespace mu2e { const auto& trkQualHandle = _allTrkQualCHs.at(i_branch); if (trkQualHandle.isValid()) { // might not have a valid handle _infoStructHelper.fillTrkQualInfo(kseed, trkQualHandle->at(i_kseedptr) , _allTrkQualResults.at(i_branch)); - } - + // all RecoQuals std::vector recoQuals; // for the output value for (const auto& i_recoQualHandle : _allRQCHs.at(i_branch)) { From 2e58d56af8eacd8288e49c37f6aaaeabfea0ff2c Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Fri, 27 Sep 2024 14:45:50 -0500 Subject: [PATCH 036/100] Change branch name to trkqual --- doc/v5-to-v6.md | 1 + src/EventNtupleMaker_module.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 1c830dc..28fb1f1 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -9,6 +9,7 @@ There was a major update when we moved from v5 to v6. Here are tables of changes | folder name | ```TrkAna``` | ```EventNtuple``` | defined in fcl | | folder name | ```TrkAnaExt``` | ```EventNtuple``` | defined in fcl | | branch | ```dem```, ```uem```, etc. | ```trk``` | all track types are now in a single branch | +| branch | ```demtrkqual``` | ```trkqual``` | otherwise it would have been ```trktrkqual```| ## Fcl File Changes Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 and all fcl files are documented on the new [fcl README page](../fcl/README.md) diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 8ac9225..7323e66 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -417,7 +417,7 @@ namespace mu2e { if(_ftype == KinematicLine )_ntuple->Branch((branch+"kl.").c_str(),&_allKLIs.at(i_branch),_buffsize,_splitlevel); // TrkCaloHit: currently only 1 _ntuple->Branch((branch+"tch.").c_str(),&_allTCHIs.at(i_branch)); - _ntuple->Branch((branch+"trkqual.").c_str(),&_allTrkQualResults.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"qual.").c_str(),&_allTrkQualResults.at(i_branch),_buffsize,_splitlevel); if (_conf.filltrkpid() && i_branchConfig.options().filltrkpid()) { int n_trkpid_vars = TrkCaloHitPID::n_vars; for (int i_trkpid_var = 0; i_trkpid_var < n_trkpid_vars; ++i_trkpid_var) { From 5e9a6b034c075412115593470bd1330920efb8a7 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Fri, 27 Sep 2024 14:51:01 -0500 Subject: [PATCH 037/100] Adding trkqual branch to ntuplehelper --- inc/MVAResultInfo.hh | 3 ++- utils/helper/ntuplehelper.py | 3 ++- validation/ntuplehelper-test.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/inc/MVAResultInfo.hh b/inc/MVAResultInfo.hh index 2364c4e..0d9b9f0 100644 --- a/inc/MVAResultInfo.hh +++ b/inc/MVAResultInfo.hh @@ -1,4 +1,5 @@ // +// MVAResultInfo: array branch containing the output of a multi-variate analysis (MVA) // structs used to record MVAResult information into TrkAna tree // Andy Edmonds (January 2024) // @@ -9,7 +10,7 @@ namespace mu2e // general info about the SimParticle which was simulated struct MVAResultInfo { bool valid = false; // whether this information is valid or not - float result = -1.0; // the result of the MVA + float result = -1.0; // the numerical result of the MVA void reset() { *this = MVAResultInfo(); } }; } diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index 0d591d6..37d44b9 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -36,7 +36,8 @@ class nthelper: "crvsummarymc" : "CrvSummaryMC", "crvcoincs" : "CrvHitInfoReco", "crvcoincsmc" : "CrvHitInfoMC", - "crvcoincsmcplane" : "CrvPlaneInfoMC" + "crvcoincsmcplane" : "CrvPlaneInfoMC", + "trkqual" : "MVAResultInfo" } def check_track_type(self, branch): diff --git a/validation/ntuplehelper-test.py b/validation/ntuplehelper-test.py index cff0328..f6a7424 100644 --- a/validation/ntuplehelper-test.py +++ b/validation/ntuplehelper-test.py @@ -4,7 +4,7 @@ print("Testing a leaf from each branch") print("=========") -nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hcnt.nbkg', 'tcnt.ndem', 'demmcsim.pdg', 'demtch.trkdepth', 'demtsh.ptoca', 'demtshmc.edep', 'demtsm.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'demmcsci.dp', 'demmcssi.dp', 'dem.nactive', 'demmc.ndigigood', 'demfit.mom', 'demlh.cx', 'demch.omega', 'klkl.phi0']) +nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hcnt.nbkg', 'tcnt.ndem', 'demmcsim.pdg', 'demtch.trkdepth', 'demtsh.ptoca', 'demtshmc.edep', 'demtsm.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'demmcsci.dp', 'demmcssi.dp', 'dem.nactive', 'demmc.ndigigood', 'demfit.mom', 'demlh.cx', 'demch.omega', 'klkl.phi0', 'trkqual.result']) print("Testing a few leaves from a single branch (should only print the branch description once)") print("=========") From 788e22d3bff4e83e6af9288d6af844e3856d4e4f Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Fri, 27 Sep 2024 16:00:40 -0500 Subject: [PATCH 038/100] Rename hitcount branch and also fix it --- doc/v5-to-v6.md | 2 +- fcl/prolog.fcl | 1 + src/EventNtupleMaker_module.cc | 12 +++++++++--- src/InfoStructHelper.cc | 3 +++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 28fb1f1..90a3fa7 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -10,6 +10,7 @@ There was a major update when we moved from v5 to v6. Here are tables of changes | folder name | ```TrkAnaExt``` | ```EventNtuple``` | defined in fcl | | branch | ```dem```, ```uem```, etc. | ```trk``` | all track types are now in a single branch | | branch | ```demtrkqual``` | ```trkqual``` | otherwise it would have been ```trktrkqual```| +| branch | ```hcnt``` | ```hitcount``` | also now filled | ## Fcl File Changes Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 and all fcl files are documented on the new [fcl README page](../fcl/README.md) @@ -39,7 +40,6 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | prolog.fcl path names | ```Sequence``` | ```Path``` | for consistency with previous stages of processing| | EventNtupleMaker module parameter | ```ProcessEmptyEvents``` | removed | not used anywhere | | EventNtupleMaker module parameter | ```required``` | removed | not used anywhere | -| EventNtupleMaker module parameter | ```RecoCountTag``` | removed | not used anywhere | | ```FillHits``` default value | ```false``` | ```true``` | changed in prolog.fcl | diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 5527c9a..20b0169 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -155,6 +155,7 @@ All : { input : "MergeKKAll" EventNtupleMaker : { module_type : EventNtupleMaker branches : [ @local::All ] + RecoCountTag : "SelectRecoMC" PBITag : "PBISim" PBTTag : "EWMProducer" PBTMCTag : "EWMProducer" diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 7323e66..f662783 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -133,6 +133,7 @@ namespace mu2e { fhicl::Atom splitlevel{Name("splitlevel"),99}; fhicl::Atom buffsize{Name("buffsize"),32000}; // General event info + fhicl::Atom rctag{Name("RecoCountTag"), Comment("RecoCount"), art::InputTag()}; fhicl::Atom PBITag{Name("PBITag"), Comment("Tag for ProtonBunchIntensity object") ,art::InputTag()}; fhicl::Atom PBTTag{Name("PBTTag"), Comment("Tag for ProtonBunchTime object") ,art::InputTag()}; fhicl::Atom filltrig{Name("FillTriggerInfo"),false}; @@ -196,7 +197,7 @@ namespace mu2e { // general event info branch EventInfo _einfo; EventInfoMC _einfomc; - art::InputTag _PBITag, _PBTTag, _PBTMCTag; + art::InputTag _recoCountTag, _PBITag, _PBTTag, _PBTMCTag; // hit counting HitCount _hcnt; // track counting @@ -308,6 +309,7 @@ namespace mu2e { EventNtupleMaker::EventNtupleMaker(const Parameters& conf): art::EDAnalyzer(conf), _conf(conf()), + _recoCountTag(conf().rctag()), _PBITag(conf().PBITag()), _PBTTag(conf().PBTTag()), _PBTMCTag(conf().PBTMCTag()), @@ -397,7 +399,7 @@ namespace mu2e { _ntuple->Branch("evtinfomc.",&_einfomc,_buffsize,_splitlevel); } // hit counting branch - _ntuple->Branch("hcnt.",&_hcnt); + _ntuple->Branch("hitcount.",&_hcnt); // track counting branches for (BranchIndex i_branch = 0; i_branch < _allBranches.size(); ++i_branch) { BranchConfig i_branchConfig = _allBranches.at(i_branch); @@ -686,8 +688,12 @@ namespace mu2e { _einfo.event = event.event(); _einfo.run = event.run(); _einfo.subrun = event.subRun(); - // currently no reco nproton estimate TODO + auto recoCountHandle = event.getValidHandle(_recoCountTag); + auto recoCount = *recoCountHandle; + _infoStructHelper.fillHitCount(recoCount, _hcnt); + + // currently no reco nproton estimate TODO auto PBThandle = event.getValidHandle(_PBTTag); auto PBT = *PBThandle; _einfo.pbtime = PBT.pbtime_; diff --git a/src/InfoStructHelper.cc b/src/InfoStructHelper.cc index 4aeb079..8d03673 100644 --- a/src/InfoStructHelper.cc +++ b/src/InfoStructHelper.cc @@ -10,6 +10,7 @@ #include namespace mu2e { + // TODO: Propose to delete this function since it is unused void InfoStructHelper::fillHitCount(StrawHitFlagCollection const& shfC, HitCount& hitcount) { hitcount.nsd = shfC.size(); for(const auto& shf : shfC) { @@ -21,6 +22,8 @@ namespace mu2e { } void InfoStructHelper::fillHitCount(RecoCount const& nrec, HitCount& hitcount) { + hitcount.nsd = nrec._nstrawdigi; + // TODO: add other counts from RecoCount? hitcount.nesel = nrec._nshfesel; hitcount.nrsel = nrec._nshfrsel; hitcount.ntsel = nrec._nshftsel; From 5ab797b754736c43dba926bd3b8ac250f30a6869 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Fri, 27 Sep 2024 16:58:55 -0500 Subject: [PATCH 039/100] Rename fillAllInfos function to fillAllTrackInfos --- doc/v5-to-v6.md | 1 + src/EventNtupleMaker_module.cc | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 90a3fa7..2356347 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -50,3 +50,4 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | src file name | ```TrkAnaTreeMaker_module.cc``` | ```EventNtupleMaker_module.cc``` | | | art module name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | | tree name | ```trkana``` | ```ntuple``` | defined in code | +| art module function | ```fillAllInfos``` | ```fillAllTrackInfos``` | more descriptive | diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index f662783..e1f22a8 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -298,7 +298,7 @@ namespace mu2e { void fillEventInfo(const art::Event& event); void fillTriggerBits(const art::Event& event,std::string const& process); void resetTrackBranches(); - void fillAllInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr); + void fillAllTrackInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr); template std::vector > createSpecialBranch(const art::Event& event, const std::string& branchname, @@ -633,7 +633,7 @@ namespace mu2e { for (size_t i_kseedptr = 0; i_kseedptr < kseedptr_coll.size(); ++i_kseedptr) { resetTrackBranches(); // reset track branches here so that we don't get information from previous tracks in the next entry - fillAllInfos(kseedptr_coll_h, i_branch, i_kseedptr); // fill the info structs for this track + fillAllTrackInfos(kseedptr_coll_h, i_branch, i_kseedptr); // fill the info structs for this track if(_conf.helices()){ auto const& khassns = khaH.product(); // find the associated HelixSeed to this KalSeed using the assns. @@ -754,7 +754,7 @@ namespace mu2e { } } - void EventNtupleMaker::fillAllInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr) { + void EventNtupleMaker::fillAllTrackInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr) { const auto& kseedptr = (kspch->at(i_kseedptr)); const auto& kseed = *kseedptr; From 1c99f08f5596c6f8d86465b43bd21fc2a6697d5b Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Fri, 27 Sep 2024 17:14:13 -0500 Subject: [PATCH 040/100] Update hitcount branch in ntuplehelper --- utils/helper/ntuplehelper.py | 2 +- validation/ntuplehelper-test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index 37d44b9..045be26 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -17,7 +17,7 @@ class nthelper: # A dictionary of branch name to header file containing the struct branch_struct_dict = { 'evtinfo' : "EventInfo", 'evtinfomc' : "EventInfoMC", - 'hcnt' : "HitCount", + 'hitcount' : "HitCount", 'tcnt' : "TrkCount", # TODO: leaves can't be retrieved because they are runtime made 'trk' : "TrkInfo", 'trkfit' : "TrkFitInfo", diff --git a/validation/ntuplehelper-test.py b/validation/ntuplehelper-test.py index f6a7424..67a287b 100644 --- a/validation/ntuplehelper-test.py +++ b/validation/ntuplehelper-test.py @@ -4,7 +4,7 @@ print("Testing a leaf from each branch") print("=========") -nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hcnt.nbkg', 'tcnt.ndem', 'demmcsim.pdg', 'demtch.trkdepth', 'demtsh.ptoca', 'demtshmc.edep', 'demtsm.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'demmcsci.dp', 'demmcssi.dp', 'dem.nactive', 'demmc.ndigigood', 'demfit.mom', 'demlh.cx', 'demch.omega', 'klkl.phi0', 'trkqual.result']) +nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'demmcsim.pdg', 'demtch.trkdepth', 'demtsh.ptoca', 'demtshmc.edep', 'demtsm.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'demmcsci.dp', 'demmcssi.dp', 'dem.nactive', 'demmc.ndigigood', 'demfit.mom', 'demlh.cx', 'demch.omega', 'klkl.phi0', 'trkqual.result']) print("Testing a few leaves from a single branch (should only print the branch description once)") print("=========") From bd78b5aae983506717c0847c53f211073546df26 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Fri, 27 Sep 2024 17:16:02 -0500 Subject: [PATCH 041/100] Changing tch branch name to trkcalohit --- doc/v5-to-v6.md | 1 + src/EventNtupleMaker_module.cc | 2 +- utils/helper/ntuplehelper.py | 2 +- validation/create_val_file.C | 8 ++++---- validation/ntuplehelper-test.py | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 2356347..aba1d94 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -10,6 +10,7 @@ There was a major update when we moved from v5 to v6. Here are tables of changes | folder name | ```TrkAnaExt``` | ```EventNtuple``` | defined in fcl | | branch | ```dem```, ```uem```, etc. | ```trk``` | all track types are now in a single branch | | branch | ```demtrkqual``` | ```trkqual``` | otherwise it would have been ```trktrkqual```| +| branch | ```demtch``` | ```trkcalohit``` | | | branch | ```hcnt``` | ```hitcount``` | also now filled | ## Fcl File Changes diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index e1f22a8..9d8172b 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -418,7 +418,7 @@ namespace mu2e { if(_ftype == CentralHelix )_ntuple->Branch((branch+"ch.").c_str(),&_allCHIs.at(i_branch),_buffsize,_splitlevel); if(_ftype == KinematicLine )_ntuple->Branch((branch+"kl.").c_str(),&_allKLIs.at(i_branch),_buffsize,_splitlevel); // TrkCaloHit: currently only 1 - _ntuple->Branch((branch+"tch.").c_str(),&_allTCHIs.at(i_branch)); + _ntuple->Branch((branch+"calohit.").c_str(),&_allTCHIs.at(i_branch)); _ntuple->Branch((branch+"qual.").c_str(),&_allTrkQualResults.at(i_branch),_buffsize,_splitlevel); if (_conf.filltrkpid() && i_branchConfig.options().filltrkpid()) { int n_trkpid_vars = TrkCaloHitPID::n_vars; diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index 045be26..46869e3 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -26,7 +26,7 @@ class nthelper: 'trkch' : "CentralHelixInfo", 'trkkl' : "KinematicLineInfo", 'trkmcsim' : "SimInfo", - 'trktch' : "TrkCaloHitInfo", + 'trkcalohit' : "TrkCaloHitInfo", 'trktsh' : "TrkStrawHitInfo", 'trktshmc' : "TrkStrawHitInfoMC", 'trktsm' : "TrkStrawMatInfo", diff --git a/validation/create_val_file.C b/validation/create_val_file.C index fed7875..994787f 100644 --- a/validation/create_val_file.C +++ b/validation/create_val_file.C @@ -33,10 +33,10 @@ void create_val_file(std::string filename, std::string outfilename) { ntuple->Draw("(trkfit[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_xit", "trkmcvd[].sid==2", "goff"); // trkcalohit histograms - ntuple->Draw("trktch.ctime>>h_demtch_ctime_all", "", "goff"); - ntuple->Draw("trktch.ctime>>h_demtch_ctime_active", "trktch.active==1", "goff"); - ntuple->Draw("trktch.ctime>>h_demtch_ctime_inactive", "trktch.active==0", "goff"); - ntuple->Draw("trktch.ctime-trklh.t0>>h_demtch_demfit_dt_ent", "trkfit.sid==0 && trktch.active==1", "goff"); + ntuple->Draw("trkcalohit.ctime>>h_demtch_ctime_all", "", "goff"); + ntuple->Draw("trkcalohit.ctime>>h_demtch_ctime_active", "trkcalohit.active==1", "goff"); + ntuple->Draw("trkcalohit.ctime>>h_demtch_ctime_inactive", "trkcalohit.active==0", "goff"); + ntuple->Draw("trkcalohit.ctime-trklh.t0>>h_demtch_demfit_dt_ent", "trkfit.sid==0 && trktch.active==1", "goff"); // crv histograms ntuple->Draw("crvsummary.totalPEs>>h_crvsummary_totalPEs_all", "", "goff"); diff --git a/validation/ntuplehelper-test.py b/validation/ntuplehelper-test.py index 67a287b..cfc1e0a 100644 --- a/validation/ntuplehelper-test.py +++ b/validation/ntuplehelper-test.py @@ -4,7 +4,7 @@ print("Testing a leaf from each branch") print("=========") -nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'demmcsim.pdg', 'demtch.trkdepth', 'demtsh.ptoca', 'demtshmc.edep', 'demtsm.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'demmcsci.dp', 'demmcssi.dp', 'dem.nactive', 'demmc.ndigigood', 'demfit.mom', 'demlh.cx', 'demch.omega', 'klkl.phi0', 'trkqual.result']) +nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'demmcsim.pdg', 'demcalohit.trkdepth', 'demtsh.ptoca', 'demtshmc.edep', 'demtsm.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'demmcsci.dp', 'demmcssi.dp', 'dem.nactive', 'demmc.ndigigood', 'demfit.mom', 'demlh.cx', 'demch.omega', 'klkl.phi0', 'trkqual.result']) print("Testing a few leaves from a single branch (should only print the branch description once)") print("=========") From 36d50a8216a0f27a9596b0a68fecdf05da5075e5 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Fri, 27 Sep 2024 17:24:41 -0500 Subject: [PATCH 042/100] Updating trkcalohitmc branch and adding to validation --- doc/v5-to-v6.md | 1 + inc/CaloClusterInfoMC.hh | 2 +- src/EventNtupleMaker_module.cc | 2 +- utils/helper/ntuplehelper.py | 1 + validation/create_val_file.C | 7 +++++++ validation/ntuplehelper-test.py | 2 +- 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index aba1d94..8ce99c7 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -11,6 +11,7 @@ There was a major update when we moved from v5 to v6. Here are tables of changes | branch | ```dem```, ```uem```, etc. | ```trk``` | all track types are now in a single branch | | branch | ```demtrkqual``` | ```trkqual``` | otherwise it would have been ```trktrkqual```| | branch | ```demtch``` | ```trkcalohit``` | | +| branch | ```demtchmc``` | ```trkcalohitmc``` | | | branch | ```hcnt``` | ```hitcount``` | also now filled | ## Fcl File Changes diff --git a/inc/CaloClusterInfoMC.hh b/inc/CaloClusterInfoMC.hh index 2024eb6..3570abf 100644 --- a/inc/CaloClusterInfoMC.hh +++ b/inc/CaloClusterInfoMC.hh @@ -1,5 +1,5 @@ // -// Struct describing MC truth for calorimeter cluster +// CaloClusterInfoMC: struct describing MC truth for calorimeter cluster // original author: Dave Brown (LBNL), Jan 2019 // #ifndef CaloClusterInfoMC_HH diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 9d8172b..81f7c72 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -447,7 +447,7 @@ namespace mu2e { _ntuple->Branch((branch+"mcsim.").c_str(),&_allMCSimTIs.at(i_branch),_buffsize,_splitlevel); _ntuple->Branch((branch+"mcvd.").c_str(),&_allMCVDInfos.at(i_branch),_buffsize,_splitlevel); - if(_fillcalomc)_ntuple->Branch((branch+"tchmc.").c_str(),&_allMCTCHIs.at(i_branch),_buffsize,_splitlevel); + if(_fillcalomc)_ntuple->Branch((branch+"calohitmc.").c_str(),&_allMCTCHIs.at(i_branch),_buffsize,_splitlevel); // at hit-level MC information // (for the time being diagLevel will still work, but I propose removing this at some point) if(_conf.diag() > 1 || (_conf.fillhits() && i_branchConfig.options().fillhits())){ diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index 46869e3..9d63730 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -27,6 +27,7 @@ class nthelper: 'trkkl' : "KinematicLineInfo", 'trkmcsim' : "SimInfo", 'trkcalohit' : "TrkCaloHitInfo", + 'trkcalohitmc' : "CaloClusterInfoMC", 'trktsh' : "TrkStrawHitInfo", 'trktshmc' : "TrkStrawHitInfoMC", 'trktsm' : "TrkStrawMatInfo", diff --git a/validation/create_val_file.C b/validation/create_val_file.C index 994787f..2a3b9af 100644 --- a/validation/create_val_file.C +++ b/validation/create_val_file.C @@ -38,6 +38,13 @@ void create_val_file(std::string filename, std::string outfilename) { ntuple->Draw("trkcalohit.ctime>>h_demtch_ctime_inactive", "trkcalohit.active==0", "goff"); ntuple->Draw("trkcalohit.ctime-trklh.t0>>h_demtch_demfit_dt_ent", "trkfit.sid==0 && trktch.active==1", "goff"); + // trkcalohitmc histograms + ntuple->Draw("trkcalohitmc.nsim>>h_trkcalohitmc_nsim_all", "", "goff"); + ntuple->Draw("trkcalohitmc.etot>>h_trkcalohitmc_etot_all", "", "goff"); + ntuple->Draw("trkcalohitmc.tavg>>h_trkcalohitmc_tavg_all", "", "goff"); + ntuple->Draw("trkcalohitmc.eprimary>>h_trkcalohitmc_eprimary_all", "", "goff"); + ntuple->Draw("trkcalohitmc.tprimary>>h_trkcalohitmc_tprimary_all", "", "goff"); + // crv histograms ntuple->Draw("crvsummary.totalPEs>>h_crvsummary_totalPEs_all", "", "goff"); ntuple->Draw("crvcoincs.pos.fCoordinates.fX>>h_crvhit_pos_x", "", "goff"); diff --git a/validation/ntuplehelper-test.py b/validation/ntuplehelper-test.py index cfc1e0a..ee7c617 100644 --- a/validation/ntuplehelper-test.py +++ b/validation/ntuplehelper-test.py @@ -4,7 +4,7 @@ print("Testing a leaf from each branch") print("=========") -nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'demmcsim.pdg', 'demcalohit.trkdepth', 'demtsh.ptoca', 'demtshmc.edep', 'demtsm.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'demmcsci.dp', 'demmcssi.dp', 'dem.nactive', 'demmc.ndigigood', 'demfit.mom', 'demlh.cx', 'demch.omega', 'klkl.phi0', 'trkqual.result']) +nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'demmcsim.pdg', 'demcalohit.trkdepth', 'trkcalohitmc.nsim', 'demtsh.ptoca', 'demtshmc.edep', 'demtsm.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'demmcsci.dp', 'demmcssi.dp', 'dem.nactive', 'demmc.ndigigood', 'demfit.mom', 'demlh.cx', 'demch.omega', 'klkl.phi0', 'trkqual.result']) print("Testing a few leaves from a single branch (should only print the branch description once)") print("=========") From fa50307f5fa38081ff8def606b496597d0771a28 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Sun, 29 Sep 2024 17:39:59 -0500 Subject: [PATCH 043/100] Update name of straw hit branches --- doc/v5-to-v6.md | 3 +++ src/EventNtupleMaker_module.cc | 6 +++--- utils/helper/ntuplehelper.py | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 8ce99c7..28ac5f9 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -13,6 +13,9 @@ There was a major update when we moved from v5 to v6. Here are tables of changes | branch | ```demtch``` | ```trkcalohit``` | | | branch | ```demtchmc``` | ```trkcalohitmc``` | | | branch | ```hcnt``` | ```hitcount``` | also now filled | +| branch | ```demtsh``` | ```trkhits``` | | +| branch | ```demtshmc``` | ```trkhitsmc``` | | +| branch | ```demtsm``` | ```trkmats``` | mats = materials | ## Fcl File Changes Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 and all fcl files are documented on the new [fcl README page](../fcl/README.md) diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 81f7c72..6a2c380 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -437,8 +437,8 @@ namespace mu2e { // optionally add hit-level branches // (for the time being diagLevel : 2 will still work, but I propose removing this at some point) if(_conf.diag() > 1 || (_conf.fillhits() && i_branchConfig.options().fillhits())){ - _ntuple->Branch((branch+"tsh.").c_str(),&_allTSHIs.at(i_branch),_buffsize,_splitlevel); - _ntuple->Branch((branch+"tsm.").c_str(),&_allTSMIs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"hits.").c_str(),&_allTSHIs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"mats.").c_str(),&_allTSMIs.at(i_branch),_buffsize,_splitlevel); } // optionally add MC branches @@ -451,7 +451,7 @@ namespace mu2e { // at hit-level MC information // (for the time being diagLevel will still work, but I propose removing this at some point) if(_conf.diag() > 1 || (_conf.fillhits() && i_branchConfig.options().fillhits())){ - _ntuple->Branch((branch+"tshmc.").c_str(),&_allTSHIMCs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"hitsmc.").c_str(),&_allTSHIMCs.at(i_branch),_buffsize,_splitlevel); } // configure extra MCStep branches for this track type if(_conf.extraMCStepTags(_extraMCStepTags)){ diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index 9d63730..e50718f 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -28,9 +28,9 @@ class nthelper: 'trkmcsim' : "SimInfo", 'trkcalohit' : "TrkCaloHitInfo", 'trkcalohitmc' : "CaloClusterInfoMC", - 'trktsh' : "TrkStrawHitInfo", - 'trktshmc' : "TrkStrawHitInfoMC", - 'trktsm' : "TrkStrawMatInfo", + 'trkhits' : "TrkStrawHitInfo", + 'trkhitsmc' : "TrkStrawHitInfoMC", + 'trkmats' : "TrkStrawMatInfo", 'trkmcsci' : "MCStepInfo", 'trkmcssi' : "MCStepSummaryInfo", "crvsummary" : "CrvSummaryReco", From 42eb7a906c70111599c36f0a633ec63af1530147 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Sun, 29 Sep 2024 18:17:53 -0500 Subject: [PATCH 044/100] Renaming fillTrackInfos function --- doc/v5-to-v6.md | 2 +- src/EventNtupleMaker_module.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 28ac5f9..55759fd 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -55,4 +55,4 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | src file name | ```TrkAnaTreeMaker_module.cc``` | ```EventNtupleMaker_module.cc``` | | | art module name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | | tree name | ```trkana``` | ```ntuple``` | defined in code | -| art module function | ```fillAllInfos``` | ```fillAllTrackInfos``` | more descriptive | +| art module function | ```fillAllInfos``` | ```fillTrackInfos``` | more descriptive | diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 6a2c380..97dd0d0 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -298,7 +298,7 @@ namespace mu2e { void fillEventInfo(const art::Event& event); void fillTriggerBits(const art::Event& event,std::string const& process); void resetTrackBranches(); - void fillAllTrackInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr); + void fillTrackInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr); template std::vector > createSpecialBranch(const art::Event& event, const std::string& branchname, @@ -633,7 +633,7 @@ namespace mu2e { for (size_t i_kseedptr = 0; i_kseedptr < kseedptr_coll.size(); ++i_kseedptr) { resetTrackBranches(); // reset track branches here so that we don't get information from previous tracks in the next entry - fillAllTrackInfos(kseedptr_coll_h, i_branch, i_kseedptr); // fill the info structs for this track + fillTrackInfos(kseedptr_coll_h, i_branch, i_kseedptr); // fill the info structs for this track if(_conf.helices()){ auto const& khassns = khaH.product(); // find the associated HelixSeed to this KalSeed using the assns. @@ -754,7 +754,7 @@ namespace mu2e { } } - void EventNtupleMaker::fillAllTrackInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr) { + void EventNtupleMaker::fillTrackInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr) { const auto& kseedptr = (kspch->at(i_kseedptr)); const auto& kseed = *kseedptr; From f3160dfd832c8e47bb8cee875b7c3c56664eb9ff Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Sun, 29 Sep 2024 18:18:57 -0500 Subject: [PATCH 045/100] Another rename of this function --- doc/v5-to-v6.md | 2 +- src/EventNtupleMaker_module.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 55759fd..266c7e4 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -55,4 +55,4 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | src file name | ```TrkAnaTreeMaker_module.cc``` | ```EventNtupleMaker_module.cc``` | | | art module name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | | tree name | ```trkana``` | ```ntuple``` | defined in code | -| art module function | ```fillAllInfos``` | ```fillTrackInfos``` | more descriptive | +| art module function | ```fillAllInfos``` | ```fillTrackBranches``` | more descriptive | diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 97dd0d0..6c6168e 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -298,7 +298,7 @@ namespace mu2e { void fillEventInfo(const art::Event& event); void fillTriggerBits(const art::Event& event,std::string const& process); void resetTrackBranches(); - void fillTrackInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr); + void fillTrackBranches(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr); template std::vector > createSpecialBranch(const art::Event& event, const std::string& branchname, From e838ebc2149ffc88aad3b04664667346ba159853 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Sun, 29 Sep 2024 18:21:28 -0500 Subject: [PATCH 046/100] Forgot to rename the function in the code --- src/EventNtupleMaker_module.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 6c6168e..5470289 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -633,7 +633,7 @@ namespace mu2e { for (size_t i_kseedptr = 0; i_kseedptr < kseedptr_coll.size(); ++i_kseedptr) { resetTrackBranches(); // reset track branches here so that we don't get information from previous tracks in the next entry - fillTrackInfos(kseedptr_coll_h, i_branch, i_kseedptr); // fill the info structs for this track + fillTrackBranches(kseedptr_coll_h, i_branch, i_kseedptr); // fill the info structs for this track if(_conf.helices()){ auto const& khassns = khaH.product(); // find the associated HelixSeed to this KalSeed using the assns. From c34e2710f30714b8d92591bc5a27d03a91181dc2 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Sun, 29 Sep 2024 18:21:41 -0500 Subject: [PATCH 047/100] Forgot to rename the function in the code --- src/EventNtupleMaker_module.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 5470289..ec7af6c 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -754,7 +754,7 @@ namespace mu2e { } } - void EventNtupleMaker::fillTrackInfos(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr) { + void EventNtupleMaker::fillTrackBranches(const art::Handle& kspch, BranchIndex i_branch, size_t i_kseedptr) { const auto& kseedptr = (kspch->at(i_kseedptr)); const auto& kseed = *kseedptr; From c4a34e2154692da3e91cd4689aca748935ca0158 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 12:41:00 -0500 Subject: [PATCH 048/100] Very first, most simple start on RooUtil --- utils/rooutil/examples/PrintEvents.C | 7 +++++++ utils/rooutil/inc/RooUtil.hh | 21 +++++++++++++++++++++ validation/test_rooutil.sh | 1 + 3 files changed, 29 insertions(+) create mode 100644 utils/rooutil/examples/PrintEvents.C create mode 100644 utils/rooutil/inc/RooUtil.hh create mode 100644 validation/test_rooutil.sh diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C new file mode 100644 index 0000000..6c5e9b9 --- /dev/null +++ b/utils/rooutil/examples/PrintEvents.C @@ -0,0 +1,7 @@ +#include "TrkAna/utils/rooutil/inc/RooUtil.hh" + +void PrintEvents(std::string filename) { + + RooUtil util(filename); + std::cout << filename << " has " << util.GetNEvents() << " events" << std::endl; +} diff --git a/utils/rooutil/inc/RooUtil.hh b/utils/rooutil/inc/RooUtil.hh new file mode 100644 index 0000000..be70713 --- /dev/null +++ b/utils/rooutil/inc/RooUtil.hh @@ -0,0 +1,21 @@ +#ifndef RooUtil_hh_ +#define RooUtil_hh_ + +#include "TFile.h" +#include "TTree.h" + +class RooUtil { +public: + RooUtil(std::string filename, std::string treename = "EventNtuple/ntuple") { + TFile* file = new TFile(filename.c_str(), "READ"); + ntuple = (TTree*) file->Get(treename.c_str()); + } + + int GetNEvents() { return ntuple->GetEntries(); } + +private: + TTree* ntuple; + +}; + +#endif diff --git a/validation/test_rooutil.sh b/validation/test_rooutil.sh new file mode 100644 index 0000000..1d2512b --- /dev/null +++ b/validation/test_rooutil.sh @@ -0,0 +1 @@ +root -l -b -q TrkAna/utils/rooutil/examples/PrintEvents.C\(\"nts.trkana.v6.root\"\) From 2d2fec6a07572cc32f08e295eb69ac798b7da6e9 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 12:55:20 -0500 Subject: [PATCH 049/100] Add Event and evtinfo to RooUtil. Needed change in art module --- doc/v5-to-v6.md | 3 ++- src/EventNtupleMaker_module.cc | 2 +- utils/rooutil/README.md | 3 +++ utils/rooutil/examples/PrintEvents.C | 6 ++++++ utils/rooutil/inc/Event.hh | 16 ++++++++++++++++ utils/rooutil/inc/RooUtil.hh | 10 +++++++++- 6 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 utils/rooutil/README.md create mode 100644 utils/rooutil/inc/Event.hh diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 266c7e4..c4d7c71 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -48,7 +48,7 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | ```FillHits``` default value | ```false``` | ```true``` | changed in prolog.fcl | -## Important Code Changes +## Other Code Changes | | v5 | v6 | Notes | |---|--|--|---| @@ -56,3 +56,4 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | art module name | ```TrkAnaTreeMaker``` | ```EventNtupleMaker``` | | | tree name | ```trkana``` | ```ntuple``` | defined in code | | art module function | ```fillAllInfos``` | ```fillTrackBranches``` | more descriptive | +| art module code | ```ntuple->Branch("evtinfo.")``` | ```ntuple->Branch("evtinfo")``` | period removed for better access in RooUtil | diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index ec7af6c..38cf592 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -394,7 +394,7 @@ namespace mu2e { // create TTree _ntuple=tfs->make("ntuple","Mu2e Event Ntuple"); // add event info branch - _ntuple->Branch("evtinfo.",&_einfo,_buffsize,_splitlevel); + _ntuple->Branch("evtinfo",&_einfo,_buffsize,_splitlevel); if (_fillmc) { _ntuple->Branch("evtinfomc.",&_einfomc,_buffsize,_splitlevel); } diff --git a/utils/rooutil/README.md b/utils/rooutil/README.md new file mode 100644 index 0000000..1226210 --- /dev/null +++ b/utils/rooutil/README.md @@ -0,0 +1,3 @@ +# RooUtil + +This is currently under development diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 6c5e9b9..4ff6e37 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -4,4 +4,10 @@ void PrintEvents(std::string filename) { RooUtil util(filename); std::cout << filename << " has " << util.GetNEvents() << " events" << std::endl; + + // Now loop through the events and print the number of tracks in each event + for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { + const auto& event = util.GetEvent(i_event); + std::cout << "Run:Subrun:Event " << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << std::endl; + } } diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh new file mode 100644 index 0000000..9d07b82 --- /dev/null +++ b/utils/rooutil/inc/Event.hh @@ -0,0 +1,16 @@ +#ifndef Event_hh_ +#define Event_hh_ + +#include "TrkAna/inc/EventInfo.hh" + +#include "TTree.h" + +struct Event { + Event(TTree* ntuple) { + ntuple->SetBranchAddress("evtinfo", &this->evtinfo); + }; + + mu2e::EventInfo* evtinfo = nullptr; +}; + +#endif diff --git a/utils/rooutil/inc/RooUtil.hh b/utils/rooutil/inc/RooUtil.hh index be70713..c0c9f0c 100644 --- a/utils/rooutil/inc/RooUtil.hh +++ b/utils/rooutil/inc/RooUtil.hh @@ -4,18 +4,26 @@ #include "TFile.h" #include "TTree.h" +#include "TrkAna/utils/rooutil/inc/Event.hh" + class RooUtil { public: RooUtil(std::string filename, std::string treename = "EventNtuple/ntuple") { TFile* file = new TFile(filename.c_str(), "READ"); ntuple = (TTree*) file->Get(treename.c_str()); + event = new Event(ntuple); } int GetNEvents() { return ntuple->GetEntries(); } + const Event& GetEvent(int i_event) { + ntuple->GetEntry(i_event); + return *event; + } + private: TTree* ntuple; - + Event* event; // holds all the variables for SetBranchAddress }; #endif From 5e7a7d96c1d2909af5fa8ff4640acf5963705107 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 12:57:35 -0500 Subject: [PATCH 050/100] Adding trk branch to RooUtil --- utils/rooutil/examples/PrintEvents.C | 2 +- utils/rooutil/inc/Event.hh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 4ff6e37..6e919aa 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -8,6 +8,6 @@ void PrintEvents(std::string filename) { // Now loop through the events and print the number of tracks in each event for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { const auto& event = util.GetEvent(i_event); - std::cout << "Run:Subrun:Event " << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << std::endl; + std::cout << "" << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << " has " << event.trk->size() << " tracks" << std::endl; } } diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index 9d07b82..a7b8985 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -8,9 +8,11 @@ struct Event { Event(TTree* ntuple) { ntuple->SetBranchAddress("evtinfo", &this->evtinfo); + ntuple->SetBranchAddress("trk", &this->trk); }; mu2e::EventInfo* evtinfo = nullptr; + std::vector* trk = nullptr; }; #endif From b9bdc39d20a448cc276b8bca590f0cc417ac33ce Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 12:59:19 -0500 Subject: [PATCH 051/100] Add nTracks function to RooUtil Event class --- utils/rooutil/examples/PrintEvents.C | 2 +- utils/rooutil/inc/Event.hh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 6e919aa..89c0ba0 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -8,6 +8,6 @@ void PrintEvents(std::string filename) { // Now loop through the events and print the number of tracks in each event for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { const auto& event = util.GetEvent(i_event); - std::cout << "" << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << " has " << event.trk->size() << " tracks" << std::endl; + std::cout << "" << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << " has " << event.nTracks() << " tracks" << std::endl; } } diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index a7b8985..7b527ed 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -11,6 +11,8 @@ struct Event { ntuple->SetBranchAddress("trk", &this->trk); }; + int nTracks() const { return trk->size(); } + mu2e::EventInfo* evtinfo = nullptr; std::vector* trk = nullptr; }; From a3c0ebadb98c06b4eb98979f0066a4330839dee4 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 13:01:43 -0500 Subject: [PATCH 052/100] Test RooUtil with compiled macro --- utils/rooutil/examples/PrintEvents.C | 2 ++ utils/rooutil/inc/Event.hh | 1 + validation/test_rooutil.sh | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 89c0ba0..9f49842 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -1,5 +1,7 @@ #include "TrkAna/utils/rooutil/inc/RooUtil.hh" +#include + void PrintEvents(std::string filename) { RooUtil util(filename); diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index 7b527ed..16c848d 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -2,6 +2,7 @@ #define Event_hh_ #include "TrkAna/inc/EventInfo.hh" +#include "TrkAna/inc/TrkInfo.hh" #include "TTree.h" diff --git a/validation/test_rooutil.sh b/validation/test_rooutil.sh index 1d2512b..0bb8b21 100644 --- a/validation/test_rooutil.sh +++ b/validation/test_rooutil.sh @@ -1 +1 @@ -root -l -b -q TrkAna/utils/rooutil/examples/PrintEvents.C\(\"nts.trkana.v6.root\"\) +root -l -b -q TrkAna/utils/rooutil/examples/PrintEvents.C+\(\"nts.trkana.v6.root\"\) From ad9975b7c4bccc3c968b084a8d519fd48c0024b3 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 13:07:03 -0500 Subject: [PATCH 053/100] Add function to get specific track in RooUtil --- utils/rooutil/examples/PrintEvents.C | 4 ++++ utils/rooutil/inc/Event.hh | 1 + 2 files changed, 5 insertions(+) diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 9f49842..68d3d36 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -11,5 +11,9 @@ void PrintEvents(std::string filename) { for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { const auto& event = util.GetEvent(i_event); std::cout << "" << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << " has " << event.nTracks() << " tracks" << std::endl; + for (int i_track = 0; i_track < event.nTracks(); ++i_track) { + const auto& track = event.getTrack(i_track); + std::cout << " Track #" << i_track+1 << " has " << track.nhits << " hits and " << track.nactive << " active hits (fit consistency = " << track.fitcon << ")" << std::endl; + } } } diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index 16c848d..1524b95 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -13,6 +13,7 @@ struct Event { }; int nTracks() const { return trk->size(); } + mu2e::TrkInfo getTrack(size_t i_track) const { return trk->at(i_track); } mu2e::EventInfo* evtinfo = nullptr; std::vector* trk = nullptr; From e75fa0c7f34234c8b923e24f6366cd2dd52983b7 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 13:18:52 -0500 Subject: [PATCH 054/100] Adding loop through track segments to RooUtil --- utils/rooutil/examples/PrintEvents.C | 6 +++++- utils/rooutil/inc/Event.hh | 7 +++++-- utils/rooutil/inc/Track.hh | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 utils/rooutil/inc/Track.hh diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 68d3d36..01c419a 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -13,7 +13,11 @@ void PrintEvents(std::string filename) { std::cout << "" << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << " has " << event.nTracks() << " tracks" << std::endl; for (int i_track = 0; i_track < event.nTracks(); ++i_track) { const auto& track = event.getTrack(i_track); - std::cout << " Track #" << i_track+1 << " has " << track.nhits << " hits and " << track.nactive << " active hits (fit consistency = " << track.fitcon << ")" << std::endl; + std::cout << " Track #" << i_track+1 << " has " << track.trk->nhits << " hits and " << track.trk->nactive << " active hits (fit consistency = " << track.trk->fitcon << ")" << std::endl; + std::cout << " and " << track.trkfit->size() << " segments:" << std::endl; + for (const auto& trkfit : *track.trkfit) { + std::cout << " surfaceID " << trkfit.sid << ": p = " << trkfit.mom.R() << " MeV/c" << std::endl; + } } } } diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index 1524b95..b110d8d 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -2,7 +2,8 @@ #define Event_hh_ #include "TrkAna/inc/EventInfo.hh" -#include "TrkAna/inc/TrkInfo.hh" + +#include "TrkAna/utils/rooutil/inc/Track.hh" #include "TTree.h" @@ -10,13 +11,15 @@ struct Event { Event(TTree* ntuple) { ntuple->SetBranchAddress("evtinfo", &this->evtinfo); ntuple->SetBranchAddress("trk", &this->trk); + ntuple->SetBranchAddress("trkfit", &this->trkfit); }; int nTracks() const { return trk->size(); } - mu2e::TrkInfo getTrack(size_t i_track) const { return trk->at(i_track); } + Track getTrack(size_t i_track) const { return Track(&trk->at(i_track), &trkfit->at(i_track)); } mu2e::EventInfo* evtinfo = nullptr; std::vector* trk = nullptr; + std::vector>* trkfit = nullptr; }; #endif diff --git a/utils/rooutil/inc/Track.hh b/utils/rooutil/inc/Track.hh new file mode 100644 index 0000000..a52c988 --- /dev/null +++ b/utils/rooutil/inc/Track.hh @@ -0,0 +1,14 @@ +#ifndef Track_hh_ +#define Track_hh_ + +#include "TrkAna/inc/TrkInfo.hh" +#include "TrkAna/inc/TrkFitInfo.hh" + +struct Track { + Track(mu2e::TrkInfo* trk, std::vector* trkfit) : trk(trk), trkfit(trkfit) { } + + mu2e::TrkInfo* trk = nullptr; + std::vector* trkfit = nullptr; +}; + +#endif From 59e722128a0eb20619230aa77cd1cf7275ed0d85 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 13:24:33 -0500 Subject: [PATCH 055/100] A simple track cut function --- utils/rooutil/examples/PrintEvents.C | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 01c419a..a3e940c 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -2,6 +2,15 @@ #include +bool good_track(const Track& track) { + if (track.trk->fitcon > 1e-3) { + return true; + } + else { + return false; + } +} + void PrintEvents(std::string filename) { RooUtil util(filename); @@ -11,10 +20,18 @@ void PrintEvents(std::string filename) { for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { const auto& event = util.GetEvent(i_event); std::cout << "" << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << " has " << event.nTracks() << " tracks" << std::endl; + for (int i_track = 0; i_track < event.nTracks(); ++i_track) { const auto& track = event.getTrack(i_track); - std::cout << " Track #" << i_track+1 << " has " << track.trk->nhits << " hits and " << track.trk->nactive << " active hits (fit consistency = " << track.trk->fitcon << ")" << std::endl; - std::cout << " and " << track.trkfit->size() << " segments:" << std::endl; + std::cout << " Track #" << i_track+1 << " has " << track.trk->nhits << " hits and " << track.trk->nactive << " active hits (fit consistency = " << track.trk->fitcon << ")"; + if (good_track(track)) { + std::cout << " GOOD TRACK"; + } + else { + std::cout << " BAD TRACK"; + } + std::cout << std::endl << " and " << track.trkfit->size() << " segments:" << std::endl; + for (const auto& trkfit : *track.trkfit) { std::cout << " surfaceID " << trkfit.sid << ": p = " << trkfit.mom.R() << " MeV/c" << std::endl; } From 7db7eca5e93ad877b4a0dd7ad86fb25f27c881ca Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 13:36:49 -0500 Subject: [PATCH 056/100] Update RooUtil to return a set of tracks given a cut function --- utils/rooutil/examples/PrintEvents.C | 5 ++++- utils/rooutil/inc/Event.hh | 21 +++++++++++++++++++++ utils/rooutil/inc/RooUtil.hh | 3 +++ utils/rooutil/inc/Track.hh | 3 +++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index a3e940c..40f006d 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -19,7 +19,10 @@ void PrintEvents(std::string filename) { // Now loop through the events and print the number of tracks in each event for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { const auto& event = util.GetEvent(i_event); - std::cout << "" << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << " has " << event.nTracks() << " tracks" << std::endl; + std::cout << "" << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << " has: " << std::endl; + + const auto& good_tracks = event.GetTracks(good_track); + std::cout << event.nTracks() << " total tracks and " << good_tracks.size() << " good tracks" << std::endl; for (int i_track = 0; i_track < event.nTracks(); ++i_track) { const auto& track = event.getTrack(i_track); diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index b110d8d..14e99e2 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -14,9 +14,30 @@ struct Event { ntuple->SetBranchAddress("trkfit", &this->trkfit); }; + void Update() { + tracks.clear(); + for (int i_track = 0; i_track < nTracks(); ++i_track) { + Track track(&(trk->at(i_track)), &(trkfit->at(i_track))); + tracks.emplace_back(track); + } + } + + int nTracks() const { return trk->size(); } Track getTrack(size_t i_track) const { return Track(&trk->at(i_track), &trkfit->at(i_track)); } + Tracks GetTracks(TrackCut cut) const { + Tracks select_tracks; + for (const auto& track : tracks) { + if (cut(track)) { + select_tracks.emplace_back(track); + } + } + return select_tracks; + } + + Tracks tracks; + mu2e::EventInfo* evtinfo = nullptr; std::vector* trk = nullptr; std::vector>* trkfit = nullptr; diff --git a/utils/rooutil/inc/RooUtil.hh b/utils/rooutil/inc/RooUtil.hh index c0c9f0c..bfaff81 100644 --- a/utils/rooutil/inc/RooUtil.hh +++ b/utils/rooutil/inc/RooUtil.hh @@ -18,6 +18,9 @@ public: const Event& GetEvent(int i_event) { ntuple->GetEntry(i_event); + + event->Update(); + return *event; } diff --git a/utils/rooutil/inc/Track.hh b/utils/rooutil/inc/Track.hh index a52c988..be66dbd 100644 --- a/utils/rooutil/inc/Track.hh +++ b/utils/rooutil/inc/Track.hh @@ -11,4 +11,7 @@ struct Track { std::vector* trkfit = nullptr; }; +typedef bool (*TrackCut)(const Track& track); +typedef std::vector Tracks; + #endif From e3e59ee4ac73ae17f2b088be3fff6be0cdfe69bb Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 13:54:29 -0500 Subject: [PATCH 057/100] Add debug outputs and also a GetTracks function that gets all tracks --- utils/rooutil/examples/PrintEvents.C | 12 ++++++----- utils/rooutil/inc/Event.hh | 25 +++++++++++++++++++++-- utils/rooutil/inc/RooUtil.hh | 30 ++++++++++++++++++++++++++-- 3 files changed, 58 insertions(+), 9 deletions(-) diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 40f006d..a6bd973 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -13,7 +13,7 @@ bool good_track(const Track& track) { void PrintEvents(std::string filename) { - RooUtil util(filename); + RooUtil util(filename, "EventNtuple/ntuple", true); // turn on debug std::cout << filename << " has " << util.GetNEvents() << " events" << std::endl; // Now loop through the events and print the number of tracks in each event @@ -21,12 +21,14 @@ void PrintEvents(std::string filename) { const auto& event = util.GetEvent(i_event); std::cout << "" << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << " has: " << std::endl; + const auto& all_tracks = event.GetTracks(); const auto& good_tracks = event.GetTracks(good_track); - std::cout << event.nTracks() << " total tracks and " << good_tracks.size() << " good tracks" << std::endl; + std::cout << all_tracks.size() << " total tracks and " << good_tracks.size() << " good tracks" << std::endl; - for (int i_track = 0; i_track < event.nTracks(); ++i_track) { - const auto& track = event.getTrack(i_track); - std::cout << " Track #" << i_track+1 << " has " << track.trk->nhits << " hits and " << track.trk->nactive << " active hits (fit consistency = " << track.trk->fitcon << ")"; + int i_track = 0; + for (const auto& track : all_tracks) { + ++i_track; + std::cout << " Track #" << i_track << " has " << track.trk->nhits << " hits and " << track.trk->nactive << " active hits (fit consistency = " << track.trk->fitcon << ")"; if (good_track(track)) { std::cout << " GOOD TRACK"; } diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index 14e99e2..f731734 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -8,24 +8,43 @@ #include "TTree.h" struct Event { - Event(TTree* ntuple) { + Event(TTree* ntuple, bool debug = false) : debug(debug) { + if (debug) { + std::cout << "Event::Event(): Setting branch addresses..." << std::endl; + } + ntuple->SetBranchAddress("evtinfo", &this->evtinfo); ntuple->SetBranchAddress("trk", &this->trk); ntuple->SetBranchAddress("trkfit", &this->trkfit); + + if (debug) { + std::cout << "Event::Event(): All done." << std::endl; + } }; void Update() { + if (debug) { + std::cout << "Event::Update(): Clearing tracks from previous event..." << std::endl; + } tracks.clear(); + for (int i_track = 0; i_track < nTracks(); ++i_track) { Track track(&(trk->at(i_track)), &(trkfit->at(i_track))); + if (debug) { + std::cout << "Event::Update(): Adding track #" << i_track << " to tracks..." << std::endl; + } tracks.emplace_back(track); } + + if (debug) { + std::cout << "Event::Update(): All done." << std::endl; + } } int nTracks() const { return trk->size(); } - Track getTrack(size_t i_track) const { return Track(&trk->at(i_track), &trkfit->at(i_track)); } + Tracks GetTracks() const { return tracks; } Tracks GetTracks(TrackCut cut) const { Tracks select_tracks; for (const auto& track : tracks) { @@ -41,6 +60,8 @@ struct Event { mu2e::EventInfo* evtinfo = nullptr; std::vector* trk = nullptr; std::vector>* trkfit = nullptr; + + bool debug = false; }; #endif diff --git a/utils/rooutil/inc/RooUtil.hh b/utils/rooutil/inc/RooUtil.hh index bfaff81..b3ca9b1 100644 --- a/utils/rooutil/inc/RooUtil.hh +++ b/utils/rooutil/inc/RooUtil.hh @@ -8,25 +8,51 @@ class RooUtil { public: - RooUtil(std::string filename, std::string treename = "EventNtuple/ntuple") { + RooUtil(std::string filename, std::string treename = "EventNtuple/ntuple", bool debug = false) : debug(debug) { + if (debug) { + std::cout << "RooUtil::RooUtil(): Opening file " << filename << "..." << std::endl; + } TFile* file = new TFile(filename.c_str(), "READ"); + + if (debug) { + std::cout << "RooUtil::RooUtil(): Extracting ntuple " << treename << "..." << std::endl; + } ntuple = (TTree*) file->Get(treename.c_str()); - event = new Event(ntuple); + + if (debug) { + std::cout << "RooUtil::RooUtil(): Creating event..." << std::endl; + } + event = new Event(ntuple, debug); + + if (debug) { + std::cout << "RooUtil::RooUtil(): All done." << std::endl; + } } + void SetDebug(bool dbg) { debug = dbg; } int GetNEvents() { return ntuple->GetEntries(); } const Event& GetEvent(int i_event) { + if (debug) { + std::cout << "RooUtil::GetEvent(): Getting event #" << i_event << "..." << std::endl; + } ntuple->GetEntry(i_event); + if (debug) { + std::cout << "RooUtil::GetEvent(): Updating Event..." << std::endl; + } event->Update(); + if (debug) { + std::cout << "RooUtil::GetEvent(): All done." << std::endl; + } return *event; } private: TTree* ntuple; Event* event; // holds all the variables for SetBranchAddress + bool debug; }; #endif From 1f6d5a633e67d6f4211fc7ad304f1fea2e23b9f7 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 13:56:42 -0500 Subject: [PATCH 058/100] Turning off debug in PrintEvents example --- utils/rooutil/examples/PrintEvents.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index a6bd973..ad0eb3c 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -13,7 +13,7 @@ bool good_track(const Track& track) { void PrintEvents(std::string filename) { - RooUtil util(filename, "EventNtuple/ntuple", true); // turn on debug + RooUtil util(filename); std::cout << filename << " has " << util.GetNEvents() << " events" << std::endl; // Now loop through the events and print the number of tracks in each event From 00cf0a0ab58bd2740bca46e6129474d09cb932d4 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 14:17:33 -0500 Subject: [PATCH 059/100] Adding plot for track momentum at tracker entrance --- utils/rooutil/examples/PrintEvents.C | 12 ++++++++++++ utils/rooutil/inc/Event.hh | 2 +- validation/test_rooutil.sh | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index ad0eb3c..f1e8343 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -1,5 +1,7 @@ #include "TrkAna/utils/rooutil/inc/RooUtil.hh" +#include "TH1F.h" + #include bool good_track(const Track& track) { @@ -16,6 +18,8 @@ void PrintEvents(std::string filename) { RooUtil util(filename); std::cout << filename << " has " << util.GetNEvents() << " events" << std::endl; + TH1F* hRecoMom = new TH1F("hRecoMom", "Reconstructed Momentum at Tracker Entrance", 50,95,110); + // Now loop through the events and print the number of tracks in each event for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { const auto& event = util.GetEvent(i_event); @@ -36,10 +40,18 @@ void PrintEvents(std::string filename) { std::cout << " BAD TRACK"; } std::cout << std::endl << " and " << track.trkfit->size() << " segments:" << std::endl; + } + std::cout << "Now looping through the good tracks only..." << std::endl; + for (const auto& track : good_tracks) { + std::cout << " This track has " << track.trk->nhits << " hits and " << track.trk->nactive << " active hits (fit consistency = " << track.trk->fitcon << ")" << std::endl; for (const auto& trkfit : *track.trkfit) { std::cout << " surfaceID " << trkfit.sid << ": p = " << trkfit.mom.R() << " MeV/c" << std::endl; + if (trkfit.sid == mu2e::SurfaceIdDetail::TT_Front) { + hRecoMom->Fill(trkfit.mom.R()); + } } } } + hRecoMom->Draw("HIST E"); } diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index f731734..26c0c2b 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -29,7 +29,7 @@ struct Event { tracks.clear(); for (int i_track = 0; i_track < nTracks(); ++i_track) { - Track track(&(trk->at(i_track)), &(trkfit->at(i_track))); + Track track(&(trk->at(i_track)), &(trkfit->at(i_track))); // passing the addresses of the underlying structs if (debug) { std::cout << "Event::Update(): Adding track #" << i_track << " to tracks..." << std::endl; } diff --git a/validation/test_rooutil.sh b/validation/test_rooutil.sh index 0bb8b21..aa36ece 100644 --- a/validation/test_rooutil.sh +++ b/validation/test_rooutil.sh @@ -1 +1 @@ -root -l -b -q TrkAna/utils/rooutil/examples/PrintEvents.C+\(\"nts.trkana.v6.root\"\) +root -l TrkAna/utils/rooutil/examples/PrintEvents.C+\(\"nts.trkana.v6.root\"\) From cac546439eac042e124ac13d3d2a3c769c03073a Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 14:26:29 -0500 Subject: [PATCH 060/100] Adding a file of common cut function --- utils/rooutil/examples/PrintEvents.C | 3 ++- utils/rooutil/inc/common_cuts.hh | 32 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 utils/rooutil/inc/common_cuts.hh diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index f1e8343..ae5f087 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -1,11 +1,12 @@ #include "TrkAna/utils/rooutil/inc/RooUtil.hh" +#include "TrkAna/utils/rooutil/inc/common_cuts.hh" #include "TH1F.h" #include bool good_track(const Track& track) { - if (track.trk->fitcon > 1e-3) { + if (track.trk->fitcon > 1e-3 && is_e_minus(track)) { return true; } else { diff --git a/utils/rooutil/inc/common_cuts.hh b/utils/rooutil/inc/common_cuts.hh new file mode 100644 index 0000000..dd5f7df --- /dev/null +++ b/utils/rooutil/inc/common_cuts.hh @@ -0,0 +1,32 @@ +// +// This file contains common cut functions that you might want to use. +// You can use these in your own functions too +// + +#ifndef common_cuts_hh_ +#define common_cuts_hh_ + +#include "TrkAna/utils/rooutil/inc/Track.hh" + +// Track Types +bool is_e_minus(const Track& track) { + if (track.trk->pdg==11) { return true; } + else { return false; } +} + +bool is_e_plus(const Track& track) { + if (track.trk->pdg==-11) { return true; } + else { return false; } +} + +bool is_mu_minus(const Track& track) { + if (track.trk->pdg==13) { return true; } + else { return false; } +} + +bool is_mu_plus(const Track& track) { + if (track.trk->pdg==-13) { return true; } + else { return false; } +} + +#endif From e05f072c0b4c786dc57207c3e642198764bce907 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 14:49:36 -0500 Subject: [PATCH 061/100] Add TrackSegments and common cuts to RooUtil --- utils/rooutil/examples/PrintEvents.C | 18 +++++++++----- utils/rooutil/inc/Event.hh | 7 +++--- utils/rooutil/inc/Track.hh | 36 +++++++++++++++++++++++++++- utils/rooutil/inc/TrackSegment.hh | 16 +++++++++++++ utils/rooutil/inc/common_cuts.hh | 19 +++++++++++++++ 5 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 utils/rooutil/inc/TrackSegment.hh diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index ae5f087..190784a 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -40,17 +40,23 @@ void PrintEvents(std::string filename) { else { std::cout << " BAD TRACK"; } - std::cout << std::endl << " and " << track.trkfit->size() << " segments:" << std::endl; + std::cout << std::endl; } std::cout << "Now looping through the good tracks only..." << std::endl; for (const auto& track : good_tracks) { std::cout << " This track has " << track.trk->nhits << " hits and " << track.trk->nactive << " active hits (fit consistency = " << track.trk->fitcon << ")" << std::endl; - for (const auto& trkfit : *track.trkfit) { - std::cout << " surfaceID " << trkfit.sid << ": p = " << trkfit.mom.R() << " MeV/c" << std::endl; - if (trkfit.sid == mu2e::SurfaceIdDetail::TT_Front) { - hRecoMom->Fill(trkfit.mom.R()); - } + + const auto& all_segments = track.GetSegments(); + std::cout << " and " << all_segments.size() << " segments:" << std::endl; + for (const auto& segment : all_segments) { + std::cout << " surfaceID " << segment.trkfit->sid << ": p = " << segment.trkfit->mom.R() << " MeV/c" << std::endl; + } + + const auto& trk_ent_segments = track.GetSegments(tracker_entrance); + for (const auto& segment : trk_ent_segments) { + std::cout << " filling histogram with surfaceID " << segment.trkfit->sid << ": p = " << segment.trkfit->mom.R() << " MeV/c" << std::endl; + hRecoMom->Fill(segment.trkfit->mom.R()); } } } diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index 26c0c2b..b0c1bd7 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -29,7 +29,7 @@ struct Event { tracks.clear(); for (int i_track = 0; i_track < nTracks(); ++i_track) { - Track track(&(trk->at(i_track)), &(trkfit->at(i_track))); // passing the addresses of the underlying structs + Track track(&(trk->at(i_track)), &(trkfit->at(i_track)), debug); // passing the addresses of the underlying structs if (debug) { std::cout << "Event::Update(): Adding track #" << i_track << " to tracks..." << std::endl; } @@ -57,11 +57,12 @@ struct Event { Tracks tracks; + bool debug = false; + + // Pointers to the data mu2e::EventInfo* evtinfo = nullptr; std::vector* trk = nullptr; std::vector>* trkfit = nullptr; - - bool debug = false; }; #endif diff --git a/utils/rooutil/inc/Track.hh b/utils/rooutil/inc/Track.hh index be66dbd..b1f6193 100644 --- a/utils/rooutil/inc/Track.hh +++ b/utils/rooutil/inc/Track.hh @@ -4,9 +4,43 @@ #include "TrkAna/inc/TrkInfo.hh" #include "TrkAna/inc/TrkFitInfo.hh" +#include "TrkAna/utils/rooutil/inc/TrackSegment.hh" + struct Track { - Track(mu2e::TrkInfo* trk, std::vector* trkfit) : trk(trk), trkfit(trkfit) { } + Track(mu2e::TrkInfo* trk, std::vector* trkfit, bool debug = false) : trk(trk), trkfit(trkfit), debug(debug) { + + // Create the underlying track segments + for (int i_segment = 0; i_segment < nSegments(); ++i_segment) { + TrackSegment segment(&(trkfit->at(i_segment))); // passing the addresses of the underlying structs + if (debug) { + std::cout << "Track::Track(): Adding segment #" << i_segment << " to segments..." << std::endl; + } + segments.emplace_back(segment); + } + + if (debug) { + std::cout << "Track::Track(): All done." << std::endl; + } + } + + int nSegments() const { return trkfit->size(); } + + TrackSegments GetSegments() const { return segments; } + TrackSegments GetSegments(TrackSegmentCut cut) const { + TrackSegments select_segments; + for (const auto& segment : segments) { + if (cut(segment)) { + select_segments.emplace_back(segment); + } + } + return select_segments; + } + + TrackSegments segments; + + bool debug = false; + // Pointers to the data mu2e::TrkInfo* trk = nullptr; std::vector* trkfit = nullptr; }; diff --git a/utils/rooutil/inc/TrackSegment.hh b/utils/rooutil/inc/TrackSegment.hh new file mode 100644 index 0000000..dc961f9 --- /dev/null +++ b/utils/rooutil/inc/TrackSegment.hh @@ -0,0 +1,16 @@ +#ifndef TrackSegment_hh_ +#define TrackSegment_hh_ + +#include "TrkAna/inc/TrkFitInfo.hh" + +struct TrackSegment { + TrackSegment(mu2e::TrkFitInfo* trkfit) : trkfit(trkfit) { } + + // Pointers to the data + mu2e::TrkFitInfo* trkfit = nullptr; +}; + +typedef bool (*TrackSegmentCut)(const TrackSegment& track_seg); +typedef std::vector TrackSegments; + +#endif diff --git a/utils/rooutil/inc/common_cuts.hh b/utils/rooutil/inc/common_cuts.hh index dd5f7df..12847ad 100644 --- a/utils/rooutil/inc/common_cuts.hh +++ b/utils/rooutil/inc/common_cuts.hh @@ -7,6 +7,7 @@ #define common_cuts_hh_ #include "TrkAna/utils/rooutil/inc/Track.hh" +#include "TrkAna/utils/rooutil/inc/TrackSegment.hh" // Track Types bool is_e_minus(const Track& track) { @@ -29,4 +30,22 @@ bool is_mu_plus(const Track& track) { else { return false; } } + +// Track Segment Locations +bool tracker_entrance(const TrackSegment& segment) { + if (segment.trkfit->sid==mu2e::SurfaceIdDetail::TT_Front) { return true; } + else { return false; } +} + +bool tracker_middle(const TrackSegment& segment) { + if (segment.trkfit->sid==mu2e::SurfaceIdDetail::TT_Mid) { return true; } + else { return false; } +} + +bool tracker_exit(const TrackSegment& segment) { + if (segment.trkfit->sid==mu2e::SurfaceIdDetail::TT_Back) { return true; } + else { return false; } +} + + #endif From 828d0689a0cd4ff7ea0cfb57fd8268e16a825090 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 14:54:51 -0500 Subject: [PATCH 062/100] Adding an example script to plot the entrance momentum --- utils/rooutil/examples/PlotEntranceMomentum.C | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 utils/rooutil/examples/PlotEntranceMomentum.C diff --git a/utils/rooutil/examples/PlotEntranceMomentum.C b/utils/rooutil/examples/PlotEntranceMomentum.C new file mode 100644 index 0000000..801c072 --- /dev/null +++ b/utils/rooutil/examples/PlotEntranceMomentum.C @@ -0,0 +1,44 @@ +// +// An example of how to plot the momentum of electrons at the tracker entrance +// This uses cut functions defined in common_cuts.hh +// + +#include "TrkAna/utils/rooutil/inc/RooUtil.hh" +#include "TrkAna/utils/rooutil/inc/common_cuts.hh" + +#include "TH1F.h" + +void PlotEntranceMomentum(std::string filename) { + + // Create the histogram you want to fill + TH1F* hRecoMom = new TH1F("hRecoMom", "Reconstructed Momentum at Tracker Entrance", 50,95,110); + + // Set up RooUtil + RooUtil util(filename); + + // Loop through the events + for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { + // Get the next event + const auto& event = util.GetEvent(i_event); + + // Get the e_minus tracks from the event + const auto& e_minus_tracks = event.GetTracks(is_e_minus); + + // Loop through the e_minus tracks + for (const auto& track : e_minus_tracks) { + + // Get the track segments at the tracker entrance + const auto& trk_ent_segments = track.GetSegments(tracker_entrance); + + // Loop through the tracker entrance track segments + for (const auto& segment : trk_ent_segments) { + + // Fill the histogram + hRecoMom->Fill(segment.trkfit->mom.R()); + } + } + } + + // Draw the histogram + hRecoMom->Draw("HIST E"); +} From c01a595f6126e8572976eefac1a64ed458dd6f9e Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 15:06:00 -0500 Subject: [PATCH 063/100] Added an example script to create a flat tree for e.g. unbinned fits --- utils/rooutil/examples/CreateTree.C | 53 +++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 utils/rooutil/examples/CreateTree.C diff --git a/utils/rooutil/examples/CreateTree.C b/utils/rooutil/examples/CreateTree.C new file mode 100644 index 0000000..e8106ac --- /dev/null +++ b/utils/rooutil/examples/CreateTree.C @@ -0,0 +1,53 @@ +// +// An example of how to create a flatter tree if you want to do an unbinned lieklihood fit +// This uses cut functions defined in common_cuts.hh +// + +#include "TrkAna/utils/rooutil/inc/RooUtil.hh" +#include "TrkAna/utils/rooutil/inc/common_cuts.hh" + +#include "TH1F.h" + +void CreateTree(std::string filename) { + + // Create the TTree + TTree* tree = new TTree("example_tree", "An example tree"); + // Here we will write out one track per row along with its track segment at the tracker entrance + mu2e::TrkInfo trk; + mu2e::TrkFitInfo trk_ent; + tree->Branch("trk", &trk); + tree->Branch("trk_ent", &trk_ent); + + // Set up RooUtil + RooUtil util(filename); + + // Loop through the events + for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { + // Get the next event + const auto& event = util.GetEvent(i_event); + + // Get the e_minus tracks from the event + const auto& e_minus_tracks = event.GetTracks(is_e_minus); + + // Loop through the e_minus tracks + for (const auto& track : e_minus_tracks) { + trk = *(track.trk); // we will fill this data into the tree + + // Get the track segments at the tracker entrance + const auto& trk_ent_segments = track.GetSegments(tracker_entrance); + + // Loop through the tracker entrance track segments + for (const auto& segment : trk_ent_segments) { + trk_ent = *(segment.trkfit); // we will fill this data into the tree + } + + // Fill the tree once per track + tree->Fill(); + } + } + + // Create an output file + TFile* outfile = new TFile("example_tree.root", "RECREATE"); + tree->Write(); + outfile->Close(); +} From 3bc4546cd7a79ee9dd9a53ae99f57b59c00ceaf4 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 15:50:30 -0500 Subject: [PATCH 064/100] Adding a first attempt at a is_downstream function --- utils/rooutil/examples/PrintEvents.C | 29 +++------------------------- utils/rooutil/inc/Track.hh | 4 +++- utils/rooutil/inc/TrackSegment.hh | 4 ++++ utils/rooutil/inc/common_cuts.hh | 15 +++++++++++++- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 190784a..843f669 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -1,12 +1,10 @@ #include "TrkAna/utils/rooutil/inc/RooUtil.hh" #include "TrkAna/utils/rooutil/inc/common_cuts.hh" -#include "TH1F.h" - #include bool good_track(const Track& track) { - if (track.trk->fitcon > 1e-3 && is_e_minus(track)) { + if (track.trk->fitcon > 1e-3 && is_e_minus(track) && is_downstream(track)) { return true; } else { @@ -19,8 +17,6 @@ void PrintEvents(std::string filename) { RooUtil util(filename); std::cout << filename << " has " << util.GetNEvents() << " events" << std::endl; - TH1F* hRecoMom = new TH1F("hRecoMom", "Reconstructed Momentum at Tracker Entrance", 50,95,110); - // Now loop through the events and print the number of tracks in each event for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { const auto& event = util.GetEvent(i_event); @@ -31,34 +27,15 @@ void PrintEvents(std::string filename) { std::cout << all_tracks.size() << " total tracks and " << good_tracks.size() << " good tracks" << std::endl; int i_track = 0; - for (const auto& track : all_tracks) { + for (const auto& track : good_tracks) { ++i_track; std::cout << " Track #" << i_track << " has " << track.trk->nhits << " hits and " << track.trk->nactive << " active hits (fit consistency = " << track.trk->fitcon << ")"; - if (good_track(track)) { - std::cout << " GOOD TRACK"; - } - else { - std::cout << " BAD TRACK"; - } - std::cout << std::endl; - } - - std::cout << "Now looping through the good tracks only..." << std::endl; - for (const auto& track : good_tracks) { - std::cout << " This track has " << track.trk->nhits << " hits and " << track.trk->nactive << " active hits (fit consistency = " << track.trk->fitcon << ")" << std::endl; const auto& all_segments = track.GetSegments(); std::cout << " and " << all_segments.size() << " segments:" << std::endl; for (const auto& segment : all_segments) { - std::cout << " surfaceID " << segment.trkfit->sid << ": p = " << segment.trkfit->mom.R() << " MeV/c" << std::endl; - } - - const auto& trk_ent_segments = track.GetSegments(tracker_entrance); - for (const auto& segment : trk_ent_segments) { - std::cout << " filling histogram with surfaceID " << segment.trkfit->sid << ": p = " << segment.trkfit->mom.R() << " MeV/c" << std::endl; - hRecoMom->Fill(segment.trkfit->mom.R()); + std::cout << " surfaceID " << segment.trkfit->sid << ": z = " << segment.trkfit->pos.z() << " mm, t = " << segment.trkfit->time << " ns, p = " << segment.trkfit->mom.R() << " MeV/c" << std::endl; } } } - hRecoMom->Draw("HIST E"); } diff --git a/utils/rooutil/inc/Track.hh b/utils/rooutil/inc/Track.hh index b1f6193..ae90eb4 100644 --- a/utils/rooutil/inc/Track.hh +++ b/utils/rooutil/inc/Track.hh @@ -18,6 +18,9 @@ struct Track { segments.emplace_back(segment); } + // Time order the segments + std::sort(segments.begin(), segments.end(), TrackSegment::earliest); + if (debug) { std::cout << "Track::Track(): All done." << std::endl; } @@ -37,7 +40,6 @@ struct Track { } TrackSegments segments; - bool debug = false; // Pointers to the data diff --git a/utils/rooutil/inc/TrackSegment.hh b/utils/rooutil/inc/TrackSegment.hh index dc961f9..5140ddf 100644 --- a/utils/rooutil/inc/TrackSegment.hh +++ b/utils/rooutil/inc/TrackSegment.hh @@ -8,6 +8,10 @@ struct TrackSegment { // Pointers to the data mu2e::TrkFitInfo* trkfit = nullptr; + + static bool earliest(const TrackSegment& seg1, const TrackSegment& seg2) { + return seg1.trkfit->time < seg2.trkfit->time; + } }; typedef bool (*TrackSegmentCut)(const TrackSegment& track_seg); diff --git a/utils/rooutil/inc/common_cuts.hh b/utils/rooutil/inc/common_cuts.hh index 12847ad..45c22c5 100644 --- a/utils/rooutil/inc/common_cuts.hh +++ b/utils/rooutil/inc/common_cuts.hh @@ -9,7 +9,7 @@ #include "TrkAna/utils/rooutil/inc/Track.hh" #include "TrkAna/utils/rooutil/inc/TrackSegment.hh" -// Track Types +// Track Particle Types bool is_e_minus(const Track& track) { if (track.trk->pdg==11) { return true; } else { return false; } @@ -30,6 +30,19 @@ bool is_mu_plus(const Track& track) { else { return false; } } +// Track Directions +bool is_downstream(const Track& track) { + // Segments are time-ordered so check to see if the track always increases in z-position + double first_z = track.GetSegments().at(0).trkfit->pos.z(); + double prev_z = first_z; + for (const auto& segment : track.GetSegments()) { + if (segment.trkfit->pos.z() < prev_z) { // we are now upstream of the previous segment so this is now a downstream track + return false; + } + } + return true; // we got to the end without turning upstream +} + // Track Segment Locations bool tracker_entrance(const TrackSegment& segment) { From 9b0f8e8119a0769eba70223066be679b54a958f6 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 15:54:30 -0500 Subject: [PATCH 065/100] Putting in a placeholder tutorial page and moving the old version out of the way --- tutorial/README.md | 54 +------------------ tutorial/v5/README.md | 53 ++++++++++++++++++ tutorial/{ => v5}/pages/crv-extracted.md | 0 .../pages/fitting-physics-analysis.md | 0 tutorial/{ => v5}/pages/genealogy.md | 0 tutorial/{ => v5}/pages/large-datasets.md | 0 tutorial/{ => v5}/pages/makeclass.md | 0 tutorial/{ => v5}/pages/mom-res.md | 0 tutorial/{ => v5}/pages/n-hits.md | 0 tutorial/{ => v5}/pages/opening.md | 0 tutorial/{ => v5}/pages/physics-analysis.md | 0 tutorial/{ => v5}/pages/prelims.md | 0 tutorial/{ => v5}/pages/reco-mom.md | 0 tutorial/{ => v5}/pages/setup.md | 0 .../pages/simplepython-cutsandplot.md | 0 tutorial/{ => v5}/pages/start-pos.md | 0 tutorial/{ => v5}/pages/tgt-ipa-e-loss.md | 0 tutorial/{ => v5}/pages/using_pyutil.md | 0 tutorial/{ => v5}/scripts/CrvExtracted.C | 0 tutorial/{ => v5}/scripts/Genealogy.C | 0 tutorial/{ => v5}/scripts/Genealogy.py | 0 tutorial/{ => v5}/scripts/MomRes.C | 0 tutorial/{ => v5}/scripts/MomRes.py | 0 tutorial/{ => v5}/scripts/NHits.C | 0 tutorial/{ => v5}/scripts/NHits.py | 0 tutorial/{ => v5}/scripts/Opening.C | 0 tutorial/{ => v5}/scripts/Opening.py | 0 tutorial/{ => v5}/scripts/RecoMom.C | 0 tutorial/{ => v5}/scripts/RecoMom.py | 0 tutorial/{ => v5}/scripts/StartPos.C | 0 tutorial/{ => v5}/scripts/StartPos.py | 0 tutorial/{ => v5}/scripts/SurfaceStep.C | 0 tutorial/{ => v5}/scripts/update_pages.sh | 0 33 files changed, 55 insertions(+), 52 deletions(-) create mode 100644 tutorial/v5/README.md rename tutorial/{ => v5}/pages/crv-extracted.md (100%) rename tutorial/{ => v5}/pages/fitting-physics-analysis.md (100%) rename tutorial/{ => v5}/pages/genealogy.md (100%) rename tutorial/{ => v5}/pages/large-datasets.md (100%) rename tutorial/{ => v5}/pages/makeclass.md (100%) rename tutorial/{ => v5}/pages/mom-res.md (100%) rename tutorial/{ => v5}/pages/n-hits.md (100%) rename tutorial/{ => v5}/pages/opening.md (100%) rename tutorial/{ => v5}/pages/physics-analysis.md (100%) rename tutorial/{ => v5}/pages/prelims.md (100%) rename tutorial/{ => v5}/pages/reco-mom.md (100%) rename tutorial/{ => v5}/pages/setup.md (100%) rename tutorial/{ => v5}/pages/simplepython-cutsandplot.md (100%) rename tutorial/{ => v5}/pages/start-pos.md (100%) rename tutorial/{ => v5}/pages/tgt-ipa-e-loss.md (100%) rename tutorial/{ => v5}/pages/using_pyutil.md (100%) rename tutorial/{ => v5}/scripts/CrvExtracted.C (100%) rename tutorial/{ => v5}/scripts/Genealogy.C (100%) rename tutorial/{ => v5}/scripts/Genealogy.py (100%) rename tutorial/{ => v5}/scripts/MomRes.C (100%) rename tutorial/{ => v5}/scripts/MomRes.py (100%) rename tutorial/{ => v5}/scripts/NHits.C (100%) rename tutorial/{ => v5}/scripts/NHits.py (100%) rename tutorial/{ => v5}/scripts/Opening.C (100%) rename tutorial/{ => v5}/scripts/Opening.py (100%) rename tutorial/{ => v5}/scripts/RecoMom.C (100%) rename tutorial/{ => v5}/scripts/RecoMom.py (100%) rename tutorial/{ => v5}/scripts/StartPos.C (100%) rename tutorial/{ => v5}/scripts/StartPos.py (100%) rename tutorial/{ => v5}/scripts/SurfaceStep.C (100%) rename tutorial/{ => v5}/scripts/update_pages.sh (100%) diff --git a/tutorial/README.md b/tutorial/README.md index acf58cf..abda8af 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -1,53 +1,3 @@ -# TrkAna Tutorial +# Analysis Tools Tutorial -## Introduction - -Welcome to the TrkAna Tutorial! - -The exercises in this tutorial are designed to be self-paced and for both ROOT and python analyzers. - -If you have any questions, comments, or feedback, then you can either post on the ```#trkana``` channel of the [Mu2e Slack](https://mu2ewiki.fnal.gov/wiki/Slack), or [open a GitHub issue](https://github.com/Mu2e/TrkAna/issues) - -## Contents - -1. [Preliminary Information](pages/prelims.md): In this exercise, we will get some preliminary information about TrkAna. - -1. [Logging In and Setting Up](pages/setup.md): In this exercise, we will log in to the mu2egpvms and set up the environment for the rest of the exercises. - -1. [Opening and Inspecting a TrkAna ROOT file](pages/opening.md): In this exercise, we will open and inspect the TrkAna ROOT files. - -1. [How to get more information](pages/helper.md): On this page are instructions to use the ```ntuplehelper``` - -1. [Plotting Global Track Information](pages/n-hits.md): In this exercise, we will use the ```dem``` branch to plot the number of hits on a track. We will also apply an event-level cut on the number of dem tracks. - -1. [Plotting Local Track Information](pages/reco-mom.md): In this exercise, we will use the ```demfit``` branches to plot the reconstructed track momentum at the entrance of the tracker with and without a time cut. - -1. [Plotting MC Truth Information of the Track](pages/mom-res.md): In this exercise, we will use the ```demmcvd``` branch to compare reconstructed and MC truth information to plot the momentum resolution at the entrance of the tracker. - -1. [How to Create a ROOT MakeClass](pages/makeclass.md): Brief instructions on how to generate a ROOT MakeClass - -Note that the tutorials below still need to be updated for version 5 TrkAna trees: - -1. [Plotting MC Truth Information of the Particle](pages/start-pos.md): In this exercise, we will use the ```demmcsim``` branch to plot the starting position of the conversion electrons. - -1. [Plotting MC Truth Information of Ancestor Particles](pages/genealogy.md): In this exercise, we will use the ```demmcsim``` branch to plot the starting position of the muons that generate conversion electrons, and the starting positions of decay-in-orbit electrons. - -Physics Analysis Examples: - -1. [Mock Data Histograms](pages/physics-analysis.md): In this exercise, we extract a combined mock data set and plot momentun and apply a set of simple cuts. This uses a ROOT/C++ example. - -1. [Fitting to Mock Data](pages/fitting-physics-analysis.md): In this exercise, we follow from the first analysis example to use RooFit to fit to the Mock Data. - -1. [Python Counting Example](pages/simplepython-cutsandplot.md): In this exercise, we do some simple cut and count analysis using uproot and python. - -Incomplete tutorials that have something useful: - -1. [Plotting the Time Difference between a Track and CRV hit in the Extracted Position](pages/crv-extracted.md): In this exercise, we will use the ```crvinfo``` branch to plot the time difference between a track and CRV hit in the extracted position. - -Future tutorials: - -1. [Plotting the Simulated Energy Loss of Conversion Electrons in the Stopping Target and IPA](pages/tgt-ipa-e-loss.md): In this exercise, we will use the ```demmcsic_stoppingtarget``` and ```demmcsic_protonabsorber``` branches to plot the MC true energy loss of conversion electrons in the stopping target and inner proton absorber. - -1. [Making Your Own TrkAna Tree](pages/make-your-own.md): In this exercise, we will make our own TrkAna tree that has a different structure to the default. - -Next Page: [Preliminary Information](pages/prelims.md) +Currently under development. In the meantime, the previous version of the tutorials is available [here](v5/README.md) diff --git a/tutorial/v5/README.md b/tutorial/v5/README.md new file mode 100644 index 0000000..acf58cf --- /dev/null +++ b/tutorial/v5/README.md @@ -0,0 +1,53 @@ +# TrkAna Tutorial + +## Introduction + +Welcome to the TrkAna Tutorial! + +The exercises in this tutorial are designed to be self-paced and for both ROOT and python analyzers. + +If you have any questions, comments, or feedback, then you can either post on the ```#trkana``` channel of the [Mu2e Slack](https://mu2ewiki.fnal.gov/wiki/Slack), or [open a GitHub issue](https://github.com/Mu2e/TrkAna/issues) + +## Contents + +1. [Preliminary Information](pages/prelims.md): In this exercise, we will get some preliminary information about TrkAna. + +1. [Logging In and Setting Up](pages/setup.md): In this exercise, we will log in to the mu2egpvms and set up the environment for the rest of the exercises. + +1. [Opening and Inspecting a TrkAna ROOT file](pages/opening.md): In this exercise, we will open and inspect the TrkAna ROOT files. + +1. [How to get more information](pages/helper.md): On this page are instructions to use the ```ntuplehelper``` + +1. [Plotting Global Track Information](pages/n-hits.md): In this exercise, we will use the ```dem``` branch to plot the number of hits on a track. We will also apply an event-level cut on the number of dem tracks. + +1. [Plotting Local Track Information](pages/reco-mom.md): In this exercise, we will use the ```demfit``` branches to plot the reconstructed track momentum at the entrance of the tracker with and without a time cut. + +1. [Plotting MC Truth Information of the Track](pages/mom-res.md): In this exercise, we will use the ```demmcvd``` branch to compare reconstructed and MC truth information to plot the momentum resolution at the entrance of the tracker. + +1. [How to Create a ROOT MakeClass](pages/makeclass.md): Brief instructions on how to generate a ROOT MakeClass + +Note that the tutorials below still need to be updated for version 5 TrkAna trees: + +1. [Plotting MC Truth Information of the Particle](pages/start-pos.md): In this exercise, we will use the ```demmcsim``` branch to plot the starting position of the conversion electrons. + +1. [Plotting MC Truth Information of Ancestor Particles](pages/genealogy.md): In this exercise, we will use the ```demmcsim``` branch to plot the starting position of the muons that generate conversion electrons, and the starting positions of decay-in-orbit electrons. + +Physics Analysis Examples: + +1. [Mock Data Histograms](pages/physics-analysis.md): In this exercise, we extract a combined mock data set and plot momentun and apply a set of simple cuts. This uses a ROOT/C++ example. + +1. [Fitting to Mock Data](pages/fitting-physics-analysis.md): In this exercise, we follow from the first analysis example to use RooFit to fit to the Mock Data. + +1. [Python Counting Example](pages/simplepython-cutsandplot.md): In this exercise, we do some simple cut and count analysis using uproot and python. + +Incomplete tutorials that have something useful: + +1. [Plotting the Time Difference between a Track and CRV hit in the Extracted Position](pages/crv-extracted.md): In this exercise, we will use the ```crvinfo``` branch to plot the time difference between a track and CRV hit in the extracted position. + +Future tutorials: + +1. [Plotting the Simulated Energy Loss of Conversion Electrons in the Stopping Target and IPA](pages/tgt-ipa-e-loss.md): In this exercise, we will use the ```demmcsic_stoppingtarget``` and ```demmcsic_protonabsorber``` branches to plot the MC true energy loss of conversion electrons in the stopping target and inner proton absorber. + +1. [Making Your Own TrkAna Tree](pages/make-your-own.md): In this exercise, we will make our own TrkAna tree that has a different structure to the default. + +Next Page: [Preliminary Information](pages/prelims.md) diff --git a/tutorial/pages/crv-extracted.md b/tutorial/v5/pages/crv-extracted.md similarity index 100% rename from tutorial/pages/crv-extracted.md rename to tutorial/v5/pages/crv-extracted.md diff --git a/tutorial/pages/fitting-physics-analysis.md b/tutorial/v5/pages/fitting-physics-analysis.md similarity index 100% rename from tutorial/pages/fitting-physics-analysis.md rename to tutorial/v5/pages/fitting-physics-analysis.md diff --git a/tutorial/pages/genealogy.md b/tutorial/v5/pages/genealogy.md similarity index 100% rename from tutorial/pages/genealogy.md rename to tutorial/v5/pages/genealogy.md diff --git a/tutorial/pages/large-datasets.md b/tutorial/v5/pages/large-datasets.md similarity index 100% rename from tutorial/pages/large-datasets.md rename to tutorial/v5/pages/large-datasets.md diff --git a/tutorial/pages/makeclass.md b/tutorial/v5/pages/makeclass.md similarity index 100% rename from tutorial/pages/makeclass.md rename to tutorial/v5/pages/makeclass.md diff --git a/tutorial/pages/mom-res.md b/tutorial/v5/pages/mom-res.md similarity index 100% rename from tutorial/pages/mom-res.md rename to tutorial/v5/pages/mom-res.md diff --git a/tutorial/pages/n-hits.md b/tutorial/v5/pages/n-hits.md similarity index 100% rename from tutorial/pages/n-hits.md rename to tutorial/v5/pages/n-hits.md diff --git a/tutorial/pages/opening.md b/tutorial/v5/pages/opening.md similarity index 100% rename from tutorial/pages/opening.md rename to tutorial/v5/pages/opening.md diff --git a/tutorial/pages/physics-analysis.md b/tutorial/v5/pages/physics-analysis.md similarity index 100% rename from tutorial/pages/physics-analysis.md rename to tutorial/v5/pages/physics-analysis.md diff --git a/tutorial/pages/prelims.md b/tutorial/v5/pages/prelims.md similarity index 100% rename from tutorial/pages/prelims.md rename to tutorial/v5/pages/prelims.md diff --git a/tutorial/pages/reco-mom.md b/tutorial/v5/pages/reco-mom.md similarity index 100% rename from tutorial/pages/reco-mom.md rename to tutorial/v5/pages/reco-mom.md diff --git a/tutorial/pages/setup.md b/tutorial/v5/pages/setup.md similarity index 100% rename from tutorial/pages/setup.md rename to tutorial/v5/pages/setup.md diff --git a/tutorial/pages/simplepython-cutsandplot.md b/tutorial/v5/pages/simplepython-cutsandplot.md similarity index 100% rename from tutorial/pages/simplepython-cutsandplot.md rename to tutorial/v5/pages/simplepython-cutsandplot.md diff --git a/tutorial/pages/start-pos.md b/tutorial/v5/pages/start-pos.md similarity index 100% rename from tutorial/pages/start-pos.md rename to tutorial/v5/pages/start-pos.md diff --git a/tutorial/pages/tgt-ipa-e-loss.md b/tutorial/v5/pages/tgt-ipa-e-loss.md similarity index 100% rename from tutorial/pages/tgt-ipa-e-loss.md rename to tutorial/v5/pages/tgt-ipa-e-loss.md diff --git a/tutorial/pages/using_pyutil.md b/tutorial/v5/pages/using_pyutil.md similarity index 100% rename from tutorial/pages/using_pyutil.md rename to tutorial/v5/pages/using_pyutil.md diff --git a/tutorial/scripts/CrvExtracted.C b/tutorial/v5/scripts/CrvExtracted.C similarity index 100% rename from tutorial/scripts/CrvExtracted.C rename to tutorial/v5/scripts/CrvExtracted.C diff --git a/tutorial/scripts/Genealogy.C b/tutorial/v5/scripts/Genealogy.C similarity index 100% rename from tutorial/scripts/Genealogy.C rename to tutorial/v5/scripts/Genealogy.C diff --git a/tutorial/scripts/Genealogy.py b/tutorial/v5/scripts/Genealogy.py similarity index 100% rename from tutorial/scripts/Genealogy.py rename to tutorial/v5/scripts/Genealogy.py diff --git a/tutorial/scripts/MomRes.C b/tutorial/v5/scripts/MomRes.C similarity index 100% rename from tutorial/scripts/MomRes.C rename to tutorial/v5/scripts/MomRes.C diff --git a/tutorial/scripts/MomRes.py b/tutorial/v5/scripts/MomRes.py similarity index 100% rename from tutorial/scripts/MomRes.py rename to tutorial/v5/scripts/MomRes.py diff --git a/tutorial/scripts/NHits.C b/tutorial/v5/scripts/NHits.C similarity index 100% rename from tutorial/scripts/NHits.C rename to tutorial/v5/scripts/NHits.C diff --git a/tutorial/scripts/NHits.py b/tutorial/v5/scripts/NHits.py similarity index 100% rename from tutorial/scripts/NHits.py rename to tutorial/v5/scripts/NHits.py diff --git a/tutorial/scripts/Opening.C b/tutorial/v5/scripts/Opening.C similarity index 100% rename from tutorial/scripts/Opening.C rename to tutorial/v5/scripts/Opening.C diff --git a/tutorial/scripts/Opening.py b/tutorial/v5/scripts/Opening.py similarity index 100% rename from tutorial/scripts/Opening.py rename to tutorial/v5/scripts/Opening.py diff --git a/tutorial/scripts/RecoMom.C b/tutorial/v5/scripts/RecoMom.C similarity index 100% rename from tutorial/scripts/RecoMom.C rename to tutorial/v5/scripts/RecoMom.C diff --git a/tutorial/scripts/RecoMom.py b/tutorial/v5/scripts/RecoMom.py similarity index 100% rename from tutorial/scripts/RecoMom.py rename to tutorial/v5/scripts/RecoMom.py diff --git a/tutorial/scripts/StartPos.C b/tutorial/v5/scripts/StartPos.C similarity index 100% rename from tutorial/scripts/StartPos.C rename to tutorial/v5/scripts/StartPos.C diff --git a/tutorial/scripts/StartPos.py b/tutorial/v5/scripts/StartPos.py similarity index 100% rename from tutorial/scripts/StartPos.py rename to tutorial/v5/scripts/StartPos.py diff --git a/tutorial/scripts/SurfaceStep.C b/tutorial/v5/scripts/SurfaceStep.C similarity index 100% rename from tutorial/scripts/SurfaceStep.C rename to tutorial/v5/scripts/SurfaceStep.C diff --git a/tutorial/scripts/update_pages.sh b/tutorial/v5/scripts/update_pages.sh similarity index 100% rename from tutorial/scripts/update_pages.sh rename to tutorial/v5/scripts/update_pages.sh From e4c71daf1faf3b6e3853e44b090c8df43a7c906d Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 16:09:47 -0500 Subject: [PATCH 066/100] Starting a draft of the tutorial --- tutorial/draft.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tutorial/draft.md diff --git a/tutorial/draft.md b/tutorial/draft.md new file mode 100644 index 0000000..2540f59 --- /dev/null +++ b/tutorial/draft.md @@ -0,0 +1,4 @@ +# Analysis Tools Tutorial (Draft) + +This set of tutorials will guide you through the analysis tools that are available to you for your analysis. We will analyze an [EventNtuple](https://mu2ewiki.fnal.gov/wiki/TrkAna) of a [mock dataset](https://mu2ewiki.fnal.gov/wiki/MDC2024:_Mock_Data) on the [Elastic Analysis Facility (EAF)](https://mu2ewiki.fnal.gov/wiki/Elastic_Analysis_Facility_(EAF)). We will also investigate interesting events with the [Mu2eDisplay](link) + From f353b6fcdd8fbc9c7d52e2527463c546df26d8ea Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 16:12:28 -0500 Subject: [PATCH 067/100] Updating main README --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8f82f16..7c07712 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# TrkAna +# EventNtuple ## Introduction -TrkAna is an event-based ntuple for Mu2e analyses. Each entry in the ntuple corresponds to a single Mu2e event. +The EventNtuple is a simplified data format that can be easily for Mu2e analyses. Each entry in the ntuple corresponds to a single Mu2e event. ## Useful Links @@ -11,9 +11,6 @@ TrkAna is an event-based ntuple for Mu2e analyses. Each entry in the ntuple corr * [Mu2eWiki page](https://mu2ewiki.fnal.gov/wiki/TrkAna) * [utility to get explanations of branch and leaf names](doc/ntuplehelper.md) * [version history of TrkAna](https://mu2ewiki.fnal.gov/wiki/TrkAna#Version_History_.2F_TrkAna_Musings) -* [tutorial](tutorial/README.md) (some but not all updated for v5) +* [tutorial](tutorial/README.md) * [instructions for developers](https://mu2ewiki.fnal.gov/wiki/TrkAna#For_Developers) * [instructions for validation](validation/README.md) - -## Becoming obsolete -* [spreadsheet explaining branch and leaf names](https://docs.google.com/spreadsheets/d/1IMZVgj74vxGTWqAFRtFEEcYChujJyc38VcopZh52jhc/edit) From c9d591854263456f0f9bf39ac5075ff1752b59c9 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 16:21:36 -0500 Subject: [PATCH 068/100] Updating draft tutorial --- tutorial/draft.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tutorial/draft.md b/tutorial/draft.md index 2540f59..7eec473 100644 --- a/tutorial/draft.md +++ b/tutorial/draft.md @@ -1,4 +1,12 @@ # Analysis Tools Tutorial (Draft) -This set of tutorials will guide you through the analysis tools that are available to you for your analysis. We will analyze an [EventNtuple](https://mu2ewiki.fnal.gov/wiki/TrkAna) of a [mock dataset](https://mu2ewiki.fnal.gov/wiki/MDC2024:_Mock_Data) on the [Elastic Analysis Facility (EAF)](https://mu2ewiki.fnal.gov/wiki/Elastic_Analysis_Facility_(EAF)). We will also investigate interesting events with the [Mu2eDisplay](link) +This set of tutorials will guide you through the analysis tools that are available to you for your analysis. + +By the end of this tutorial, you will be able to: +* log in and run on the [Elastic Analysis Facility (EAF)](https://mu2ewiki.fnal.gov/wiki/Elastic_Analysis_Facility_(EAF)); +* open and read an [EventNtuple](https://mu2ewiki.fnal.gov/wiki/TrkAna) file; +* investigate interesting events with the [Mu2eDisplay](link); and +* perform the Reference Analysis on the [mock dataset](https://mu2ewiki.fnal.gov/wiki/MDC2024:_Mock_Data). + +This tutorial has both ROOT and python instructions. From fc1f7b9c1367474b5e952849082cd411126a3f9f Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 16:32:36 -0500 Subject: [PATCH 069/100] Updating main README.md --- README.md | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7c07712..5116020 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,29 @@ ## Introduction -The EventNtuple is a simplified data format that can be easily for Mu2e analyses. Each entry in the ntuple corresponds to a single Mu2e event. +The EventNtuple is a simplified data format that can be used for Mu2e analyses. +## Structure +The EventNtuple structure is complex. -## Useful Links +The help understand what all the branches and leaves mean, we have an [```ntuplehelper```](doc/ntuplehelper.md) tool + +## Utilities +To help with analyzing the EventNtuple given its complex structure, we have two sets of utilities: +* [RooUtil](utils/rooutil/README.md) for ROOT-based analyses, and +* [PyUtil](utils/pyutil/README.md) for python-based analyses. + +Both of these are currently undergoing rapid development. Feel free to use these and let us know your thoughts. + +## Validation +Validation scripts and instructions are [here](validation/README.md) + +## Previous Versions +The version history of EventNtuple is [here](https://mu2ewiki.fnal.gov/wiki/TrkAna#Version_History_.2F_TrkAna_Musings). +* Special Note: there were major changes going from v5 to v6 and so we have provided a [list of v5 --> v6 changes](doc/v5-to-v6.md) for those with analysis scripts that ran on v5 ntuples + +## Other Useful Links -* [v5 --> v6 major changes](doc/v5-to-v6.md) * [Mu2eWiki page](https://mu2ewiki.fnal.gov/wiki/TrkAna) -* [utility to get explanations of branch and leaf names](doc/ntuplehelper.md) -* [version history of TrkAna](https://mu2ewiki.fnal.gov/wiki/TrkAna#Version_History_.2F_TrkAna_Musings) * [tutorial](tutorial/README.md) * [instructions for developers](https://mu2ewiki.fnal.gov/wiki/TrkAna#For_Developers) -* [instructions for validation](validation/README.md) From e36d507cd3066efe4ea132147cbf2513382ae305 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 17:18:50 -0500 Subject: [PATCH 070/100] Adding a draft README.md for RooUtil --- utils/rooutil/draft.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 utils/rooutil/draft.md diff --git a/utils/rooutil/draft.md b/utils/rooutil/draft.md new file mode 100644 index 0000000..06f3668 --- /dev/null +++ b/utils/rooutil/draft.md @@ -0,0 +1,20 @@ +# RooUtil (draft) + +RooUtil is a utility class to help analyze EventNtuple in ROOT-based analysis frameworks. + +It is currently under development and the available branches are listed [below](#Supported-Branches) + +## Classes +There are various classes that combine together branches at different dimenions + +| Class | Branches | +|-----|-----| +| Event | ```evtinfo```, ```trk``` (vector), ```trkfit``` (vector-of-vector) | +| Track | ```trk```, ```trkfit``` (vector) | +| TrackSegment | ```trkfit``` | + +## Supported Branches +The currently supported branches are: +* evtinfo +* trk +* trkfit From c1bac66828137073792c9574a0e6e5bc28242031 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 17:21:14 -0500 Subject: [PATCH 071/100] Updating RooUtil draft.md --- utils/rooutil/draft.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/rooutil/draft.md b/utils/rooutil/draft.md index 06f3668..c9a2c58 100644 --- a/utils/rooutil/draft.md +++ b/utils/rooutil/draft.md @@ -7,11 +7,11 @@ It is currently under development and the available branches are listed [below]( ## Classes There are various classes that combine together branches at different dimenions -| Class | Branches | -|-----|-----| -| Event | ```evtinfo```, ```trk``` (vector), ```trkfit``` (vector-of-vector) | -| Track | ```trk```, ```trkfit``` (vector) | -| TrackSegment | ```trkfit``` | +| Class | Single Objects | Vectors | Vector-of-Vectors | +|-----|-----|----|-----| +| Event | ```evtinfo``` | ```trk``` | ```trkfit``` | +| Track | ```trk``` | ```trkfit``` | none | +| TrackSegment | ```trkfit``` | none | none | ## Supported Branches The currently supported branches are: From 4410fff3db430d5b17208fe3ecf3fec947f9b740 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 30 Sep 2024 17:51:48 -0500 Subject: [PATCH 072/100] Adding evtinfomc to RooUtil --- doc/v5-to-v6.md | 1 + src/EventNtupleMaker_module.cc | 2 +- utils/rooutil/README.md | 2 +- utils/rooutil/draft.md | 4 ++-- utils/rooutil/examples/PrintEvents.C | 2 +- utils/rooutil/inc/Event.hh | 9 ++++++++- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index c4d7c71..ad5173f 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -57,3 +57,4 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | tree name | ```trkana``` | ```ntuple``` | defined in code | | art module function | ```fillAllInfos``` | ```fillTrackBranches``` | more descriptive | | art module code | ```ntuple->Branch("evtinfo.")``` | ```ntuple->Branch("evtinfo")``` | period removed for better access in RooUtil | +| art module code | ```ntuple->Branch("evtinfomc.")``` | ```ntuple->Branch("evtinfomc")``` | period removed for better access in RooUtil | diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 38cf592..aa6cd37 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -396,7 +396,7 @@ namespace mu2e { // add event info branch _ntuple->Branch("evtinfo",&_einfo,_buffsize,_splitlevel); if (_fillmc) { - _ntuple->Branch("evtinfomc.",&_einfomc,_buffsize,_splitlevel); + _ntuple->Branch("evtinfomc",&_einfomc,_buffsize,_splitlevel); } // hit counting branch _ntuple->Branch("hitcount.",&_hcnt); diff --git a/utils/rooutil/README.md b/utils/rooutil/README.md index 1226210..62116bb 100644 --- a/utils/rooutil/README.md +++ b/utils/rooutil/README.md @@ -1,3 +1,3 @@ # RooUtil -This is currently under development +This is currently under development. diff --git a/utils/rooutil/draft.md b/utils/rooutil/draft.md index c9a2c58..d4c3060 100644 --- a/utils/rooutil/draft.md +++ b/utils/rooutil/draft.md @@ -9,12 +9,12 @@ There are various classes that combine together branches at different dimenions | Class | Single Objects | Vectors | Vector-of-Vectors | |-----|-----|----|-----| -| Event | ```evtinfo``` | ```trk``` | ```trkfit``` | +| Event | ```evtinfo```, ```evtinfomc``` | ```trk``` | ```trkfit``` | | Track | ```trk``` | ```trkfit``` | none | | TrackSegment | ```trkfit``` | none | none | ## Supported Branches The currently supported branches are: -* evtinfo +* evtinfo, evtinfomc * trk * trkfit diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 843f669..6fc6eda 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -21,7 +21,7 @@ void PrintEvents(std::string filename) { for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { const auto& event = util.GetEvent(i_event); std::cout << "" << event.evtinfo->run << ":" << event.evtinfo->subrun << ":" << event.evtinfo->event << " has: " << std::endl; - + std::cout << "pbtime (reco) = " << event.evtinfo->pbtime << " ns, pbtime (MC) = " << event.evtinfomc->pbtime << " ns" << std::endl; const auto& all_tracks = event.GetTracks(); const auto& good_tracks = event.GetTracks(good_track); std::cout << all_tracks.size() << " total tracks and " << good_tracks.size() << " good tracks" << std::endl; diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index b0c1bd7..6daa830 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -2,6 +2,7 @@ #define Event_hh_ #include "TrkAna/inc/EventInfo.hh" +#include "TrkAna/inc/EventInfoMC.hh" #include "TrkAna/utils/rooutil/inc/Track.hh" @@ -17,6 +18,11 @@ struct Event { ntuple->SetBranchAddress("trk", &this->trk); ntuple->SetBranchAddress("trkfit", &this->trkfit); + // Check if the MC branches exist + if (ntuple->GetBranch("evtinfomc")) { + ntuple->SetBranchAddress("evtinfomc", &this->evtinfomc); + } + if (debug) { std::cout << "Event::Event(): All done." << std::endl; } @@ -41,7 +47,6 @@ struct Event { } } - int nTracks() const { return trk->size(); } Tracks GetTracks() const { return tracks; } @@ -61,6 +66,8 @@ struct Event { // Pointers to the data mu2e::EventInfo* evtinfo = nullptr; + mu2e::EventInfoMC* evtinfomc = nullptr; + std::vector* trk = nullptr; std::vector>* trkfit = nullptr; }; From ea0240e7b0a8aed0674623dbc934ceb803043498 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 09:59:43 -0500 Subject: [PATCH 073/100] Renaming trkfit to trksegs (and TrkFitInfo to TrkSegInfo) --- doc/v5-to-v6.md | 2 ++ inc/InfoStructHelper.hh | 4 ++-- inc/{TrkFitInfo.hh => TrkSegInfo.hh} | 10 ++++---- src/EventNtupleMaker_module.cc | 12 +++++----- src/InfoStructHelper.cc | 34 ++++++++++++++-------------- src/classes.h | 2 +- src/classes_def.xml | 6 ++--- utils/helper/ntuplehelper.py | 2 +- validation/create_val_file.C | 26 ++++++++++----------- validation/ntuplehelper-test.py | 4 ++-- 10 files changed, 52 insertions(+), 50 deletions(-) rename inc/{TrkFitInfo.hh => TrkSegInfo.hh} (88%) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index ad5173f..47eb8bc 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -9,6 +9,7 @@ There was a major update when we moved from v5 to v6. Here are tables of changes | folder name | ```TrkAna``` | ```EventNtuple``` | defined in fcl | | folder name | ```TrkAnaExt``` | ```EventNtuple``` | defined in fcl | | branch | ```dem```, ```uem```, etc. | ```trk``` | all track types are now in a single branch | +| branch | ```demfit```, ```uemfit```, etc. | ```trksegs``` | track segments | | branch | ```demtrkqual``` | ```trkqual``` | otherwise it would have been ```trktrkqual```| | branch | ```demtch``` | ```trkcalohit``` | | | branch | ```demtchmc``` | ```trkcalohitmc``` | | @@ -58,3 +59,4 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | art module function | ```fillAllInfos``` | ```fillTrackBranches``` | more descriptive | | art module code | ```ntuple->Branch("evtinfo.")``` | ```ntuple->Branch("evtinfo")``` | period removed for better access in RooUtil | | art module code | ```ntuple->Branch("evtinfomc.")``` | ```ntuple->Branch("evtinfomc")``` | period removed for better access in RooUtil | +| info struct | ```TrkFitInfo``` | ```TrkSegInfo``` | to match new branch name, also other changes in module (e.g. ```_allTFIs``` to ```_allTSIs```)| diff --git a/inc/InfoStructHelper.hh b/inc/InfoStructHelper.hh index 7cf6279..9fc7e33 100644 --- a/inc/InfoStructHelper.hh +++ b/inc/InfoStructHelper.hh @@ -18,7 +18,7 @@ #include "TrkAna/inc/HitCount.hh" #include "TrkAna/inc/TrkInfo.hh" -#include "TrkAna/inc/TrkFitInfo.hh" +#include "TrkAna/inc/TrkSegInfo.hh" #include "TrkAna/inc/LoopHelixInfo.hh" #include "TrkAna/inc/CentralHelixInfo.hh" #include "TrkAna/inc/KinematicLineInfo.hh" @@ -52,7 +52,7 @@ namespace mu2e { void fillHitCount(RecoCount const& nrec, HitCount& hitcount); void fillTrkInfo(const KalSeed& kseed,std::vector& trkinfo); - void fillTrkFitInfo(const KalSeed& kseed,std::vector>& trkfitinfos); + void fillTrkSegInfo(const KalSeed& kseed,std::vector>& trkseginfos); void fillTrkInfoHits(const KalSeed& kseed,TrkInfo& trkinfo); void fillTrkInfoStraws(const KalSeed& kseed,TrkInfo& trkinfo); void fillLoopHelixInfo(const KalSeed& kseed, std::vector>& lhis); diff --git a/inc/TrkFitInfo.hh b/inc/TrkSegInfo.hh similarity index 88% rename from inc/TrkFitInfo.hh rename to inc/TrkSegInfo.hh index 9d95b7b..598c14b 100644 --- a/inc/TrkFitInfo.hh +++ b/inc/TrkSegInfo.hh @@ -1,16 +1,16 @@ // -// TrkFitInfo: an array of array branch that contains track fit results at particular Surfaces. Example structure: [ [trk1_surfA, trk1_surfB, ...], [trk2_surf_A, trk2_surfC], ... [ trkN_surfB, trkN_surfC] ] +// TrkSegInfo: an array of array branch that contains track fit results at particular Surfaces. Example structure: [ [trk1_surfA, trk1_surfB, ...], [trk2_surf_A, trk2_surfC], ... [ trkN_surfB, trkN_surfC] ] // All momenta are in units of MeV/c, time in nsec WRT when the proton bunch pulse peak hits the production target, // positions are in mm WRT the center of the tracker. // Dave Brown (LBNL) // -#ifndef TrkFitInfo_HH -#define TrkFitInfo_HH +#ifndef TrkSegInfo_HH +#define TrkSegInfo_HH #include "TrkAna/inc/RootVectors.hh" #include "Offline/DataProducts/inc/SurfaceId.hh" namespace mu2e { - struct TrkFitInfo { + struct TrkSegInfo { XYZVectorF mom = XYZVectorF(); // momentum of the fit at this Surface XYZVectorF pos = XYZVectorF(); // position of the fit at this Surface @@ -23,7 +23,7 @@ namespace mu2e bool late = false; // is this the latest intersection for this track? int sid = SurfaceIdEnum::unknown; // SurfaceId of the intersected surface, see Offline/KinKalGeom/inc/SurfaceId.hh for definitions int sindex = 0; // index to the intersected surface (for multi-surface elements like StoppingTarget) - void reset() { *this = TrkFitInfo(); } + void reset() { *this = TrkSegInfo(); } }; } #endif diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index aa6cd37..3d650ce 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -60,7 +60,7 @@ #include "TrkAna/inc/EventInfoMC.hh" #include "TrkAna/inc/TrkInfo.hh" #include "TrkAna/inc/TrkInfoMC.hh" -#include "TrkAna/inc/TrkFitInfo.hh" +#include "TrkAna/inc/TrkSegInfo.hh" #include "TrkAna/inc/LoopHelixInfo.hh" #include "TrkAna/inc/CentralHelixInfo.hh" #include "TrkAna/inc/KinematicLineInfo.hh" @@ -206,7 +206,7 @@ namespace mu2e { std::vector > _allKSPCHs; // track branches (outputs) std::map> _allTIs; - std::map>> _allTFIs; + std::map>> _allTSIs; std::map>> _allLHIs; std::map>> _allCHIs; std::map>> _allKLIs; @@ -342,7 +342,7 @@ namespace mu2e { auto i_branchConfig = _allBranches.at(i_branch); _allTIs[i_branch] = std::vector(); // fit sampling (KalIntersection) at a surface - _allTFIs[i_branch] = std::vector>(); + _allTSIs[i_branch] = std::vector>(); // fit-specific branches _allLHIs[i_branch] = std::vector>(); _allCHIs[i_branch] = std::vector>(); @@ -412,7 +412,7 @@ namespace mu2e { BranchConfig i_branchConfig = _allBranches.at(i_branch); std::string branch = i_branchConfig.branch(); _ntuple->Branch((branch+".").c_str(),&_allTIs.at(i_branch),_buffsize,_splitlevel); - _ntuple->Branch((branch+"fit.").c_str(),&_allTFIs.at(i_branch),_buffsize,_splitlevel); + _ntuple->Branch((branch+"segs.").c_str(),&_allTSIs.at(i_branch),_buffsize,_splitlevel); // add traj-specific branches if(_ftype == LoopHelix )_ntuple->Branch((branch+"lh.").c_str(),&_allLHIs.at(i_branch),_buffsize,_splitlevel); if(_ftype == CentralHelix )_ntuple->Branch((branch+"ch.").c_str(),&_allCHIs.at(i_branch),_buffsize,_splitlevel); @@ -604,7 +604,7 @@ namespace mu2e { // loop through all track types for (BranchIndex i_branch = 0; i_branch < _allBranches.size(); ++i_branch) { _allTIs.at(i_branch).clear(); - _allTFIs.at(i_branch).clear(); + _allTSIs.at(i_branch).clear(); _allLHIs.at(i_branch).clear(); _allCHIs.at(i_branch).clear(); _allKLIs.at(i_branch).clear(); @@ -762,7 +762,7 @@ namespace mu2e { _infoStructHelper.fillTrkInfo(kseed,_allTIs.at(i_branch)); // fit information at specific points:e - _infoStructHelper.fillTrkFitInfo(kseed,_allTFIs.at(i_branch)); + _infoStructHelper.fillTrkSegInfo(kseed,_allTSIs.at(i_branch)); if(_ftype == LoopHelix && kseed.loopHelixFit())_infoStructHelper.fillLoopHelixInfo(kseed,_allLHIs.at(i_branch)); if(_ftype == CentralHelix && kseed.centralHelixFit())_infoStructHelper.fillCentralHelixInfo(kseed,_allCHIs.at(i_branch)); if(_ftype == KinematicLine && kseed.kinematicLineFit())_infoStructHelper.fillKinematicLineInfo(kseed,_allKLIs.at(i_branch)); diff --git a/src/InfoStructHelper.cc b/src/InfoStructHelper.cc index 8d03673..95fd591 100644 --- a/src/InfoStructHelper.cc +++ b/src/InfoStructHelper.cc @@ -114,8 +114,8 @@ namespace mu2e { trkinfos.push_back(trkinfo); } - void InfoStructHelper::fillTrkFitInfo(const KalSeed& kseed, std::vector>& all_tfis) { - std::vector tfis; + void InfoStructHelper::fillTrkSegInfo(const KalSeed& kseed, std::vector>& all_tsis) { + std::vector tsis; double tmin(std::numeric_limits::max()); double tmax(std::numeric_limits::lowest()); size_t imin(0), imax(0); @@ -130,24 +130,24 @@ namespace mu2e { tmax = kinter.time(); imax = ikinter; } - TrkFitInfo tfi; - tfi.mom = kinter.momentum3(); - tfi.pos = kinter.position3(); - tfi.time = kinter.time(); - tfi.momerr = kinter.momerr(); - tfi.inbounds = kinter.inBounds(); - tfi.gap = kinter.gap(); - tfi.sid = kinter.surfid_.id().id(); - tfi.sindex = kinter.surfid_.index(); - tfi.dmom = kinter.dMom(); - tfis.push_back(tfi); + TrkSegInfo tsi; + tsi.mom = kinter.momentum3(); + tsi.pos = kinter.position3(); + tsi.time = kinter.time(); + tsi.momerr = kinter.momerr(); + tsi.inbounds = kinter.inBounds(); + tsi.gap = kinter.gap(); + tsi.sid = kinter.surfid_.id().id(); + tsi.sindex = kinter.surfid_.index(); + tsi.dmom = kinter.dMom(); + tsis.push_back(tsi); } // now flag early and latest intersections - if(tfis.size() > 0){ - tfis[imin].early = true; - tfis[imax].late = true; + if(tsis.size() > 0){ + tsis[imin].early = true; + tsis[imax].late = true; } - all_tfis.push_back(tfis); + all_tsis.push_back(tsis); } void InfoStructHelper::fillLoopHelixInfo(const KalSeed& kseed, std::vector>& all_lhis) { diff --git a/src/classes.h b/src/classes.h index dc37256..8703357 100644 --- a/src/classes.h +++ b/src/classes.h @@ -8,7 +8,7 @@ #include "TrkAna/inc/TrkCount.hh" #include "TrkAna/inc/TrkInfo.hh" #include "TrkAna/inc/TrkInfoMC.hh" -#include "TrkAna/inc/TrkFitInfo.hh" +#include "TrkAna/inc/TrkSegInfo.hh" #include "TrkAna/inc/LoopHelixInfo.hh" #include "TrkAna/inc/CentralHelixInfo.hh" #include "TrkAna/inc/KinematicLineInfo.hh" diff --git a/src/classes_def.xml b/src/classes_def.xml index 1959588..a079864 100644 --- a/src/classes_def.xml +++ b/src/classes_def.xml @@ -35,9 +35,9 @@ - - - + + + diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index e50718f..6751f8c 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -20,7 +20,7 @@ class nthelper: 'hitcount' : "HitCount", 'tcnt' : "TrkCount", # TODO: leaves can't be retrieved because they are runtime made 'trk' : "TrkInfo", - 'trkfit' : "TrkFitInfo", + 'trksegs' : "TrkSegInfo", 'trkmc' : "TrkInfoMC", 'trklh' : "LoopHelixInfo", 'trkch' : "CentralHelixInfo", diff --git a/validation/create_val_file.C b/validation/create_val_file.C index 2a3b9af..1feed6e 100644 --- a/validation/create_val_file.C +++ b/validation/create_val_file.C @@ -17,26 +17,26 @@ void create_val_file(std::string filename, std::string outfilename) { ntuple->Draw("evtinfomc.nprotons>>h_evtinfomc_nprotons", "", ""); ntuple->Draw("evtinfomc.pbtime>>h_evtinfomc_pbtime", "", ""); - // trkfit histograms - ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_all", "", "goff"); - ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_ent", "trkfit.sid==0", "goff"); - ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_mid", "trkfit.sid==1", "goff"); - ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_xit", "trkfit.sid==2", "goff"); - ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_ent_t0cut", "trkfit.sid==0 && trklh.t0>=700", "goff"); - ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_mid_t0cut", "trkfit.sid==1 && trklh.t0>=700", "goff"); - ntuple->Draw("trkfit.mom.R()>>h_demfit_mom_xit_t0cut", "trkfit.sid==2 && trklh.t0>=700", "goff"); + // trksegs histograms + ntuple->Draw("trksegs.mom.R()>>h_demfit_mom_all", "", "goff"); + ntuple->Draw("trksegs.mom.R()>>h_demfit_mom_ent", "trksegs.sid==0", "goff"); + ntuple->Draw("trksegs.mom.R()>>h_demfit_mom_mid", "trksegs.sid==1", "goff"); + ntuple->Draw("trksegs.mom.R()>>h_demfit_mom_xit", "trksegs.sid==2", "goff"); + ntuple->Draw("trksegs.mom.R()>>h_demfit_mom_ent_t0cut", "trksegs.sid==0 && trklh.t0>=700", "goff"); + ntuple->Draw("trksegs.mom.R()>>h_demfit_mom_mid_t0cut", "trksegs.sid==1 && trklh.t0>=700", "goff"); + ntuple->Draw("trksegs.mom.R()>>h_demfit_mom_xit_t0cut", "trksegs.sid==2 && trklh.t0>=700", "goff"); // resolution histograms - ntuple->Draw("(trkfit[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_all", "", "goff"); - ntuple->Draw("(trkfit[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_ent", "trkmcvd[].sid==0", "goff"); - ntuple->Draw("(trkfit[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_mid", "trkmcvd[].sid==1", "goff"); - ntuple->Draw("(trkfit[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_xit", "trkmcvd[].sid==2", "goff"); + ntuple->Draw("(trksegs[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_all", "", "goff"); + ntuple->Draw("(trksegs[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_ent", "trkmcvd[].sid==0", "goff"); + ntuple->Draw("(trksegs[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_mid", "trkmcvd[].sid==1", "goff"); + ntuple->Draw("(trksegs[][trkmcvd.iinter].mom.R() - trkmcvd[].mom.R())>>h_demfit_momres_xit", "trkmcvd[].sid==2", "goff"); // trkcalohit histograms ntuple->Draw("trkcalohit.ctime>>h_demtch_ctime_all", "", "goff"); ntuple->Draw("trkcalohit.ctime>>h_demtch_ctime_active", "trkcalohit.active==1", "goff"); ntuple->Draw("trkcalohit.ctime>>h_demtch_ctime_inactive", "trkcalohit.active==0", "goff"); - ntuple->Draw("trkcalohit.ctime-trklh.t0>>h_demtch_demfit_dt_ent", "trkfit.sid==0 && trktch.active==1", "goff"); + ntuple->Draw("trkcalohit.ctime-trklh.t0>>h_demtch_demfit_dt_ent", "trksegs.sid==0 && trktch.active==1", "goff"); // trkcalohitmc histograms ntuple->Draw("trkcalohitmc.nsim>>h_trkcalohitmc_nsim_all", "", "goff"); diff --git a/validation/ntuplehelper-test.py b/validation/ntuplehelper-test.py index ee7c617..3e80c85 100644 --- a/validation/ntuplehelper-test.py +++ b/validation/ntuplehelper-test.py @@ -4,7 +4,7 @@ print("Testing a leaf from each branch") print("=========") -nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'demmcsim.pdg', 'demcalohit.trkdepth', 'trkcalohitmc.nsim', 'demtsh.ptoca', 'demtshmc.edep', 'demtsm.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'demmcsci.dp', 'demmcssi.dp', 'dem.nactive', 'demmc.ndigigood', 'demfit.mom', 'demlh.cx', 'demch.omega', 'klkl.phi0', 'trkqual.result']) +nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'trkmcsim.pdg', 'trkcalohit.trkdepth', 'trkcalohitmc.nsim', 'trkhits.ptoca', 'trkhitsmc.edep', 'trkmats.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'trkmcsci.dp', 'trkmcssi.dp', 'trk.nactive', 'trkmc.ndigigood', 'trksegs.mom', 'trklh.cx', 'trkch.omega', 'klkl.phi0', 'trkqual.result']) print("Testing a few leaves from a single branch (should only print the branch description once)") print("=========") @@ -12,7 +12,7 @@ print("Testing wildcard") print("=========") -nthelp.whatis(["dem.*", "demfit.*"]) +nthelp.whatis(["trk.*", "trksegs.*"]) print("Testing a few errors") print("=========") From 0da5b960b973dda78606fc981f6f0b8e08d38dae Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 10:22:29 -0500 Subject: [PATCH 074/100] Update helix branch to be a vector --- doc/v5-to-v6.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 47eb8bc..7a5a160 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -17,6 +17,7 @@ There was a major update when we moved from v5 to v6. Here are tables of changes | branch | ```demtsh``` | ```trkhits``` | | | branch | ```demtshmc``` | ```trkhitsmc``` | | | branch | ```demtsm``` | ```trkmats``` | mats = materials | +| branch | ```helixinfo``` | ```helices``` | also now a vector branch | ## Fcl File Changes Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 and all fcl files are documented on the new [fcl README page](../fcl/README.md) From 2b0b3a46aabca433ed5b321007148c84b2cbc02d Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 10:23:38 -0500 Subject: [PATCH 075/100] Actually commit the code that updates the helix branch --- inc/HelixInfo.hh | 22 +++++++++++----------- inc/InfoStructHelper.hh | 2 +- src/EventNtupleMaker_module.cc | 11 +++++++---- src/InfoStructHelper.cc | 4 +++- utils/helper/ntuplehelper.py | 3 ++- validation/ntuplehelper-test.py | 2 +- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/inc/HelixInfo.hh b/inc/HelixInfo.hh index c73fd07..285d64b 100644 --- a/inc/HelixInfo.hh +++ b/inc/HelixInfo.hh @@ -1,20 +1,20 @@ // -// Struct for HelixSeed info +// HelixInfo: struct for HelixSeed info // #ifndef TrkAna_HelixInfo_hh #define TrkAna_HelixInfo_hh namespace mu2e { struct HelixInfo { - int nch = -1; - int ncha = -1; - int nsh = -1; - int nsha = -1; - int flag = -1; - float t0err = -1; - float mom = -1; - float chi2xy = -1; - float chi2fz = -1; - float ecalo = -1; + int nch = -1; // number of combo hits potentially used for this helix + int ncha = -1; // number of combo hits that are not "outliers" + int nsh = -1; // number of straw hits in the combo hits potentially used for this helix + int nsha = -1; // number of straw hits in the combo hits that are not "outliers" + int flag = -1; // flag for algorithm used (TPR = 0, CPR = 1, APR = 2, MPR = 3) + float t0err = -1; // uncertainty on time + float mom = -1; // momentum + float chi2xy = -1; // squared sum of the hit residuals wrt the XY plane normalized by the degree of freedom + float chi2fz = -1; // squared sum of the hit residuals wrt the ZPhi plane normalized by the degree of freedom + float ecalo = -1; // energy deposited in calo cluster void reset() { *this = HelixInfo(); } }; } diff --git a/inc/InfoStructHelper.hh b/inc/InfoStructHelper.hh index 9fc7e33..5e186c2 100644 --- a/inc/InfoStructHelper.hh +++ b/inc/InfoStructHelper.hh @@ -63,7 +63,7 @@ namespace mu2e { void fillMatInfo(const KalSeed& kseed, std::vector>& tminfos ); void fillCaloHitInfo(const KalSeed& kseed, std::vector& tchinfo ); void fillTrkPIDInfo(const TrkCaloHitPID& tchp, const KalSeed& kseed, TrkPIDInfo& trkpidInfo); - void fillHelixInfo(art::Ptr const& hptr, HelixInfo& hinfo); + void fillHelixInfo(art::Ptr const& hptr, std::vector& all_hinfos); }; } diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 3d650ce..77be160 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -283,7 +283,7 @@ namespace mu2e { std::vector _crvpulsesmc; std::vector _crvrecoinfo; // helices - HelixInfo _hinfo; + std::vector _hinfos; // struct helpers InfoStructHelper _infoStructHelper; InfoMCStructHelper _infoMCStructHelper; @@ -496,7 +496,7 @@ namespace mu2e { } } // helix info - if(_conf.helices()) _ntuple->Branch("helixinfo.",&_hinfo,_buffsize,_splitlevel); + if(_conf.helices()) _ntuple->Branch("helices.",&_hinfos,_buffsize,_splitlevel); } void EventNtupleMaker::beginSubRun(const art::SubRun & subrun ) { @@ -510,8 +510,11 @@ namespace mu2e { _einfomc.reset(); _hcnt.reset(); _tcnt.reset(); - _hinfo.reset(); _wtinfo.reset(); + + // clear the vector branches + _hinfos.clear(); + // update timing maps for MC if(_fillmc){ _infoMCStructHelper.updateEvent(event); @@ -638,7 +641,7 @@ namespace mu2e { auto const& khassns = khaH.product(); // find the associated HelixSeed to this KalSeed using the assns. auto hptr = (*khassns)[i_kseedptr].second; - _infoStructHelper.fillHelixInfo(hptr, _hinfo); + _infoStructHelper.fillHelixInfo(hptr, _hinfos); } } } diff --git a/src/InfoStructHelper.cc b/src/InfoStructHelper.cc index 95fd591..f295ee0 100644 --- a/src/InfoStructHelper.cc +++ b/src/InfoStructHelper.cc @@ -415,7 +415,8 @@ namespace mu2e { } - void InfoStructHelper::fillHelixInfo(art::Ptr const& hptr, HelixInfo& hinfo) { + void InfoStructHelper::fillHelixInfo(art::Ptr const& hptr, std::vector& all_hinfos) { + HelixInfo hinfo; if(hptr.isNonnull()){ // count hits, active and not for(size_t ihit=0;ihit < hptr->hits().size(); ihit++){ @@ -443,6 +444,7 @@ namespace mu2e { if(hptr->caloCluster().isNonnull()) hinfo.ecalo = hptr->caloCluster()->energyDep(); } + all_hinfos.emplace_back(hinfo); } } diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index 6751f8c..9180ce9 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -38,7 +38,8 @@ class nthelper: "crvcoincs" : "CrvHitInfoReco", "crvcoincsmc" : "CrvHitInfoMC", "crvcoincsmcplane" : "CrvPlaneInfoMC", - "trkqual" : "MVAResultInfo" + "trkqual" : "MVAResultInfo", + "helices" : "HelixInfo" } def check_track_type(self, branch): diff --git a/validation/ntuplehelper-test.py b/validation/ntuplehelper-test.py index 3e80c85..079e4a3 100644 --- a/validation/ntuplehelper-test.py +++ b/validation/ntuplehelper-test.py @@ -4,7 +4,7 @@ print("Testing a leaf from each branch") print("=========") -nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'trkmcsim.pdg', 'trkcalohit.trkdepth', 'trkcalohitmc.nsim', 'trkhits.ptoca', 'trkhitsmc.edep', 'trkmats.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'trkmcsci.dp', 'trkmcssi.dp', 'trk.nactive', 'trkmc.ndigigood', 'trksegs.mom', 'trklh.cx', 'trkch.omega', 'klkl.phi0', 'trkqual.result']) +nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'trkmcsim.pdg', 'trkcalohit.trkdepth', 'trkcalohitmc.nsim', 'trkhits.ptoca', 'trkhitsmc.edep', 'trkmats.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'trkmcsci.dp', 'trkmcssi.dp', 'trk.nactive', 'trkmc.ndigigood', 'trksegs.mom', 'trklh.cx', 'trkch.omega', 'klkl.phi0', 'trkqual.result', 'helices.chi2xy']) print("Testing a few leaves from a single branch (should only print the branch description once)") print("=========") From 928b4f2847ab4248bc5dd4b8cf85c0fa5ecf0224 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 10:50:19 -0500 Subject: [PATCH 076/100] Update name of trksegpars branches --- doc/v5-to-v6.md | 3 +++ src/EventNtupleMaker_module.cc | 6 +++--- utils/helper/ntuplehelper.py | 6 +++--- validation/ntuplehelper-test.py | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 7a5a160..0d47ecf 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -18,6 +18,9 @@ There was a major update when we moved from v5 to v6. Here are tables of changes | branch | ```demtshmc``` | ```trkhitsmc``` | | | branch | ```demtsm``` | ```trkmats``` | mats = materials | | branch | ```helixinfo``` | ```helices``` | also now a vector branch | +| branch | ```demlh``` | ```trksegpars_lh``` | pars = parameters, lh = LoopHelix | +| branch | ```demch``` | ```trksegpars_ch``` | pars = parameters, ch = CentralHelix | +| branch | ```demkl``` | ```trksegpars_kl``` | pars = parameters, kl = KinematicLine | ## Fcl File Changes Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 and all fcl files are documented on the new [fcl README page](../fcl/README.md) diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 77be160..03be809 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -414,9 +414,9 @@ namespace mu2e { _ntuple->Branch((branch+".").c_str(),&_allTIs.at(i_branch),_buffsize,_splitlevel); _ntuple->Branch((branch+"segs.").c_str(),&_allTSIs.at(i_branch),_buffsize,_splitlevel); // add traj-specific branches - if(_ftype == LoopHelix )_ntuple->Branch((branch+"lh.").c_str(),&_allLHIs.at(i_branch),_buffsize,_splitlevel); - if(_ftype == CentralHelix )_ntuple->Branch((branch+"ch.").c_str(),&_allCHIs.at(i_branch),_buffsize,_splitlevel); - if(_ftype == KinematicLine )_ntuple->Branch((branch+"kl.").c_str(),&_allKLIs.at(i_branch),_buffsize,_splitlevel); + if(_ftype == LoopHelix )_ntuple->Branch((branch+"segpars_lh.").c_str(),&_allLHIs.at(i_branch),_buffsize,_splitlevel); + if(_ftype == CentralHelix )_ntuple->Branch((branch+"segpars_ch.").c_str(),&_allCHIs.at(i_branch),_buffsize,_splitlevel); + if(_ftype == KinematicLine )_ntuple->Branch((branch+"segpars_kl.").c_str(),&_allKLIs.at(i_branch),_buffsize,_splitlevel); // TrkCaloHit: currently only 1 _ntuple->Branch((branch+"calohit.").c_str(),&_allTCHIs.at(i_branch)); _ntuple->Branch((branch+"qual.").c_str(),&_allTrkQualResults.at(i_branch),_buffsize,_splitlevel); diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index 9180ce9..73bf72b 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -22,9 +22,9 @@ class nthelper: 'trk' : "TrkInfo", 'trksegs' : "TrkSegInfo", 'trkmc' : "TrkInfoMC", - 'trklh' : "LoopHelixInfo", - 'trkch' : "CentralHelixInfo", - 'trkkl' : "KinematicLineInfo", + 'trksegpars_lh' : "LoopHelixInfo", + 'trksegpars_ch' : "CentralHelixInfo", + 'trksegpars_kl' : "KinematicLineInfo", 'trkmcsim' : "SimInfo", 'trkcalohit' : "TrkCaloHitInfo", 'trkcalohitmc' : "CaloClusterInfoMC", diff --git a/validation/ntuplehelper-test.py b/validation/ntuplehelper-test.py index 079e4a3..cf980a0 100644 --- a/validation/ntuplehelper-test.py +++ b/validation/ntuplehelper-test.py @@ -4,7 +4,7 @@ print("Testing a leaf from each branch") print("=========") -nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'trkmcsim.pdg', 'trkcalohit.trkdepth', 'trkcalohitmc.nsim', 'trkhits.ptoca', 'trkhitsmc.edep', 'trkmats.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'trkmcsci.dp', 'trkmcssi.dp', 'trk.nactive', 'trkmc.ndigigood', 'trksegs.mom', 'trklh.cx', 'trkch.omega', 'klkl.phi0', 'trkqual.result', 'helices.chi2xy']) +nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'trkmcsim.pdg', 'trkcalohit.trkdepth', 'trkcalohitmc.nsim', 'trkhits.ptoca', 'trkhitsmc.edep', 'trkmats.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'trkmcsci.dp', 'trkmcssi.dp', 'trk.nactive', 'trkmc.ndigigood', 'trksegs.mom', 'trksegpars_lh.cx', 'trksegpars_ch.omega', 'trksegpars_kl.phi0', 'trkqual.result', 'helices.chi2xy']) print("Testing a few leaves from a single branch (should only print the branch description once)") print("=========") From 967a96aa987bb0831d6482da87efda862c64e70b Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 10:57:37 -0500 Subject: [PATCH 077/100] Update name of surface step branch --- doc/v5-to-v6.md | 1 + inc/SurfaceStepInfo.hh | 2 +- src/EventNtupleMaker_module.cc | 2 +- utils/helper/ntuplehelper.py | 3 ++- validation/ntuplehelper-test.py | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 0d47ecf..0480a5f 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -21,6 +21,7 @@ There was a major update when we moved from v5 to v6. Here are tables of changes | branch | ```demlh``` | ```trksegpars_lh``` | pars = parameters, lh = LoopHelix | | branch | ```demch``` | ```trksegpars_ch``` | pars = parameters, ch = CentralHelix | | branch | ```demkl``` | ```trksegpars_kl``` | pars = parameters, kl = KinematicLine | +| branch | ```demmcssi``` | ```trksegsmc``` | information of the surface steps at same places as trksegs| ## Fcl File Changes Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 and all fcl files are documented on the new [fcl README page](../fcl/README.md) diff --git a/inc/SurfaceStepInfo.hh b/inc/SurfaceStepInfo.hh index a7c58c9..c4408fb 100644 --- a/inc/SurfaceStepInfo.hh +++ b/inc/SurfaceStepInfo.hh @@ -1,5 +1,5 @@ // -// SurfaceStep info to summarize energy deposition in a passive element, or passage through a virtual detector +// SurfaceStepInfo: info to summarize MC energy deposition in a passive element, or passage through a virtual detector // #ifndef SurfaceStepInfo_HH #define SurfaceStepInfo_HH diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 03be809..63b25b2 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -465,7 +465,7 @@ namespace mu2e { } } if(_conf.SurfaceStepsTag(_surfaceStepsTag)){ - _ntuple->Branch((branch+"mcssi.").c_str(),&_surfaceStepInfos[i_branch],_buffsize,_splitlevel); + _ntuple->Branch((branch+"segsmc.").c_str(),&_surfaceStepInfos[i_branch],_buffsize,_splitlevel); } } } diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index 73bf72b..ea0fbd5 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -39,7 +39,8 @@ class nthelper: "crvcoincsmc" : "CrvHitInfoMC", "crvcoincsmcplane" : "CrvPlaneInfoMC", "trkqual" : "MVAResultInfo", - "helices" : "HelixInfo" + "helices" : "HelixInfo", + "trksegsmc" : "SurfaceStepInfo" } def check_track_type(self, branch): diff --git a/validation/ntuplehelper-test.py b/validation/ntuplehelper-test.py index cf980a0..3d47cce 100644 --- a/validation/ntuplehelper-test.py +++ b/validation/ntuplehelper-test.py @@ -4,7 +4,7 @@ print("Testing a leaf from each branch") print("=========") -nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'trkmcsim.pdg', 'trkcalohit.trkdepth', 'trkcalohitmc.nsim', 'trkhits.ptoca', 'trkhitsmc.edep', 'trkmats.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'trkmcsci.dp', 'trkmcssi.dp', 'trk.nactive', 'trkmc.ndigigood', 'trksegs.mom', 'trksegpars_lh.cx', 'trksegpars_ch.omega', 'trksegpars_kl.phi0', 'trkqual.result', 'helices.chi2xy']) +nthelp.whatis(['evtinfomc.pbtime', 'evtinfo.event', 'hitcount.nbkg', 'tcnt.ndem', 'trkmcsim.pdg', 'trkcalohit.trkdepth', 'trkcalohitmc.nsim', 'trkhits.ptoca', 'trkhitsmc.edep', 'trkmats.tlen', 'crvsummary.totalPEs', 'crvsummarymc.sectorNumber', 'crvcoincs.time', 'crvcoincsmc.primaryE', 'crvcoincsmcplane.dir', 'trkmcsci.dp', 'trkmcssi.dp', 'trk.nactive', 'trkmc.ndigigood', 'trksegs.mom', 'trksegpars_lh.cx', 'trksegpars_ch.omega', 'trksegpars_kl.phi0', 'trkqual.result', 'helices.chi2xy', 'trksegsmc.path']) print("Testing a few leaves from a single branch (should only print the branch description once)") print("=========") From 47a01ab286f725bc9a238ccc35a15c0e08c91c4f Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 11:23:21 -0500 Subject: [PATCH 078/100] Update RooUtil with the trksegs branch name change --- utils/rooutil/examples/CreateTree.C | 4 ++-- utils/rooutil/examples/PlotEntranceMomentum.C | 2 +- utils/rooutil/examples/PrintEvents.C | 2 +- utils/rooutil/inc/Event.hh | 6 +++--- utils/rooutil/inc/Track.hh | 10 +++++----- utils/rooutil/inc/TrackSegment.hh | 8 ++++---- utils/rooutil/inc/common_cuts.hh | 10 +++++----- validation/test_rooutil.sh | 4 +++- 8 files changed, 24 insertions(+), 22 deletions(-) diff --git a/utils/rooutil/examples/CreateTree.C b/utils/rooutil/examples/CreateTree.C index e8106ac..efd3537 100644 --- a/utils/rooutil/examples/CreateTree.C +++ b/utils/rooutil/examples/CreateTree.C @@ -14,7 +14,7 @@ void CreateTree(std::string filename) { TTree* tree = new TTree("example_tree", "An example tree"); // Here we will write out one track per row along with its track segment at the tracker entrance mu2e::TrkInfo trk; - mu2e::TrkFitInfo trk_ent; + mu2e::TrkSegInfo trk_ent; tree->Branch("trk", &trk); tree->Branch("trk_ent", &trk_ent); @@ -38,7 +38,7 @@ void CreateTree(std::string filename) { // Loop through the tracker entrance track segments for (const auto& segment : trk_ent_segments) { - trk_ent = *(segment.trkfit); // we will fill this data into the tree + trk_ent = *(segment.trkseg); // we will fill this data into the tree } // Fill the tree once per track diff --git a/utils/rooutil/examples/PlotEntranceMomentum.C b/utils/rooutil/examples/PlotEntranceMomentum.C index 801c072..739ee9b 100644 --- a/utils/rooutil/examples/PlotEntranceMomentum.C +++ b/utils/rooutil/examples/PlotEntranceMomentum.C @@ -34,7 +34,7 @@ void PlotEntranceMomentum(std::string filename) { for (const auto& segment : trk_ent_segments) { // Fill the histogram - hRecoMom->Fill(segment.trkfit->mom.R()); + hRecoMom->Fill(segment.trkseg->mom.R()); } } } diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 6fc6eda..9b31063 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -34,7 +34,7 @@ void PrintEvents(std::string filename) { const auto& all_segments = track.GetSegments(); std::cout << " and " << all_segments.size() << " segments:" << std::endl; for (const auto& segment : all_segments) { - std::cout << " surfaceID " << segment.trkfit->sid << ": z = " << segment.trkfit->pos.z() << " mm, t = " << segment.trkfit->time << " ns, p = " << segment.trkfit->mom.R() << " MeV/c" << std::endl; + std::cout << " surfaceID " << segment.trkseg->sid << ": z = " << segment.trkseg->pos.z() << " mm, t = " << segment.trkseg->time << " ns, p = " << segment.trkseg->mom.R() << " MeV/c" << std::endl; } } } diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index 6daa830..049579b 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -16,7 +16,7 @@ struct Event { ntuple->SetBranchAddress("evtinfo", &this->evtinfo); ntuple->SetBranchAddress("trk", &this->trk); - ntuple->SetBranchAddress("trkfit", &this->trkfit); + ntuple->SetBranchAddress("trksegs", &this->trksegs); // Check if the MC branches exist if (ntuple->GetBranch("evtinfomc")) { @@ -35,7 +35,7 @@ struct Event { tracks.clear(); for (int i_track = 0; i_track < nTracks(); ++i_track) { - Track track(&(trk->at(i_track)), &(trkfit->at(i_track)), debug); // passing the addresses of the underlying structs + Track track(&(trk->at(i_track)), &(trksegs->at(i_track)), debug); // passing the addresses of the underlying structs if (debug) { std::cout << "Event::Update(): Adding track #" << i_track << " to tracks..." << std::endl; } @@ -69,7 +69,7 @@ struct Event { mu2e::EventInfoMC* evtinfomc = nullptr; std::vector* trk = nullptr; - std::vector>* trkfit = nullptr; + std::vector>* trksegs = nullptr; }; #endif diff --git a/utils/rooutil/inc/Track.hh b/utils/rooutil/inc/Track.hh index ae90eb4..14d70d5 100644 --- a/utils/rooutil/inc/Track.hh +++ b/utils/rooutil/inc/Track.hh @@ -2,16 +2,16 @@ #define Track_hh_ #include "TrkAna/inc/TrkInfo.hh" -#include "TrkAna/inc/TrkFitInfo.hh" +#include "TrkAna/inc/TrkSegInfo.hh" #include "TrkAna/utils/rooutil/inc/TrackSegment.hh" struct Track { - Track(mu2e::TrkInfo* trk, std::vector* trkfit, bool debug = false) : trk(trk), trkfit(trkfit), debug(debug) { + Track(mu2e::TrkInfo* trk, std::vector* trksegs, bool debug = false) : trk(trk), trksegs(trksegs), debug(debug) { // Create the underlying track segments for (int i_segment = 0; i_segment < nSegments(); ++i_segment) { - TrackSegment segment(&(trkfit->at(i_segment))); // passing the addresses of the underlying structs + TrackSegment segment(&(trksegs->at(i_segment))); // passing the addresses of the underlying structs if (debug) { std::cout << "Track::Track(): Adding segment #" << i_segment << " to segments..." << std::endl; } @@ -26,7 +26,7 @@ struct Track { } } - int nSegments() const { return trkfit->size(); } + int nSegments() const { return trksegs->size(); } TrackSegments GetSegments() const { return segments; } TrackSegments GetSegments(TrackSegmentCut cut) const { @@ -44,7 +44,7 @@ struct Track { // Pointers to the data mu2e::TrkInfo* trk = nullptr; - std::vector* trkfit = nullptr; + std::vector* trksegs = nullptr; }; typedef bool (*TrackCut)(const Track& track); diff --git a/utils/rooutil/inc/TrackSegment.hh b/utils/rooutil/inc/TrackSegment.hh index 5140ddf..6c5a4ec 100644 --- a/utils/rooutil/inc/TrackSegment.hh +++ b/utils/rooutil/inc/TrackSegment.hh @@ -1,16 +1,16 @@ #ifndef TrackSegment_hh_ #define TrackSegment_hh_ -#include "TrkAna/inc/TrkFitInfo.hh" +#include "TrkAna/inc/TrkSegInfo.hh" struct TrackSegment { - TrackSegment(mu2e::TrkFitInfo* trkfit) : trkfit(trkfit) { } + TrackSegment(mu2e::TrkSegInfo* trkseg) : trkseg(trkseg) { } // Pointers to the data - mu2e::TrkFitInfo* trkfit = nullptr; + mu2e::TrkSegInfo* trkseg = nullptr; static bool earliest(const TrackSegment& seg1, const TrackSegment& seg2) { - return seg1.trkfit->time < seg2.trkfit->time; + return seg1.trkseg->time < seg2.trkseg->time; } }; diff --git a/utils/rooutil/inc/common_cuts.hh b/utils/rooutil/inc/common_cuts.hh index 45c22c5..ab14d57 100644 --- a/utils/rooutil/inc/common_cuts.hh +++ b/utils/rooutil/inc/common_cuts.hh @@ -33,10 +33,10 @@ bool is_mu_plus(const Track& track) { // Track Directions bool is_downstream(const Track& track) { // Segments are time-ordered so check to see if the track always increases in z-position - double first_z = track.GetSegments().at(0).trkfit->pos.z(); + double first_z = track.GetSegments().at(0).trkseg->pos.z(); double prev_z = first_z; for (const auto& segment : track.GetSegments()) { - if (segment.trkfit->pos.z() < prev_z) { // we are now upstream of the previous segment so this is now a downstream track + if (segment.trkseg->pos.z() < prev_z) { // we are now upstream of the previous segment so this is now a downstream track return false; } } @@ -46,17 +46,17 @@ bool is_downstream(const Track& track) { // Track Segment Locations bool tracker_entrance(const TrackSegment& segment) { - if (segment.trkfit->sid==mu2e::SurfaceIdDetail::TT_Front) { return true; } + if (segment.trkseg->sid==mu2e::SurfaceIdDetail::TT_Front) { return true; } else { return false; } } bool tracker_middle(const TrackSegment& segment) { - if (segment.trkfit->sid==mu2e::SurfaceIdDetail::TT_Mid) { return true; } + if (segment.trkseg->sid==mu2e::SurfaceIdDetail::TT_Mid) { return true; } else { return false; } } bool tracker_exit(const TrackSegment& segment) { - if (segment.trkfit->sid==mu2e::SurfaceIdDetail::TT_Back) { return true; } + if (segment.trkseg->sid==mu2e::SurfaceIdDetail::TT_Back) { return true; } else { return false; } } diff --git a/validation/test_rooutil.sh b/validation/test_rooutil.sh index aa36ece..1349fbb 100644 --- a/validation/test_rooutil.sh +++ b/validation/test_rooutil.sh @@ -1 +1,3 @@ -root -l TrkAna/utils/rooutil/examples/PrintEvents.C+\(\"nts.trkana.v6.root\"\) +root -l -b -q TrkAna/utils/rooutil/examples/PrintEvents.C++\(\"nts.trkana.v6.root\"\) +root -l -b -q TrkAna/utils/rooutil/examples/PlotEntranceMomentum.C++\(\"nts.trkana.v6.root\"\) +root -l -b -q TrkAna/utils/rooutil/examples/CreateTree.C++\(\"nts.trkana.v6.root\"\) From bbfe19b900217e5aa846e0d15c645e2d56c8bb3d Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 11:36:08 -0500 Subject: [PATCH 079/100] Adding a fcl file that re-runs reco --- fcl/from_dig-mockdata.fcl | 61 +++++++++++++++++++++++++++++++++++++++ fcl/prolog.fcl | 1 + 2 files changed, 62 insertions(+) create mode 100644 fcl/from_dig-mockdata.fcl diff --git a/fcl/from_dig-mockdata.fcl b/fcl/from_dig-mockdata.fcl new file mode 100644 index 0000000..a649119 --- /dev/null +++ b/fcl/from_dig-mockdata.fcl @@ -0,0 +1,61 @@ +#include "Offline/fcl/minimalMessageService.fcl" +#include "Offline/fcl/standardProducers.fcl" +#include "Offline/fcl/standardServices.fcl" +#include "Production/JobConfig/reco/prolog.fcl" +#include "TrkAna/fcl/prolog.fcl" + +process_name : EventNtuple + +source : { module_type : RootInput } + +services : @local::Services.Reco + +physics : +{ + producers : { + @table::Reconstruction.producers + @table::EventNtuple.producers + MakeSS : @local::CommonMC.MakeSSDigi + } + filters : { + @table::Reconstruction.filters + } + + analyzers : { + @table::Reconstruction.analyzers + @table::EventNtuple.analyzers + } +} +outputs : { + Output : { + @table::Reconstruction.Output + SelectEvents : [ "EventNtuplePath" ] + } +} + + +physics.EventNtuplePath : [ + MakeSS, + @sequence::Reconstruction.RecoMCPath, + @sequence::EventNtuple.PathNoMakeSS +] +physics.EventNtupleEndPath : [ @sequence::Reconstruction.EndPath, @sequence::EventNtuple.EndPathNoMC ] +physics.analyzers.EventNtuple.SelectEvents : [ "EventNtuplePath" ] + +physics.trigger_paths : [ EventNtuplePath ] +physics.end_paths : [ EventNtupleEndPath ] + +physics.producers.compressRecoMCs.surfaceStepTags: [ "MakeSS" ] # because these are not made in compressDigiMCs + +#include "Production/JobConfig/common/epilog.fcl" +#include "Production/JobConfig/reco/epilog.fcl" + +outputs.Output.fileName: "mcs.owner.description.version.sequencer.art" +services.TFileService.fileName: "nts.owner.description.version.sequencer.root" + +# +# Temporarily drop the trigger products: the embedded ComboHitCollections have incompatible schema +# +#include "Production/JobConfig/reco/drop_trigger.fcl" + +#include "Production/Validation/database.fcl" diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 20b0169..8ba94f8 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -210,6 +210,7 @@ EventNtuple : { # TrigSequence : [ PBIWeight, @sequence::TrkQualProducersPath, @sequence::TrkPIDProducersPath] Path : [ @sequence::MergeKKProducersPath, PBIWeight, MakeSS, TrkQualDeM ] + PathNoMakeSS : [ @sequence::MergeKKProducersPath, PBIWeight, TrkQualDeM ] PathExt : [ @sequence::MergeKKNoFieldPath ] PathSeparate : [ @sequence::MergeKKSeparatePath, PBIWeight, MakeSS, TrkQualDeM ] PathNoMC : [ @sequence::MergeKKProducersPath, TrkQualDeM ] From 5686fd37a7202b6cd95083539e1742b12824d85c Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 13:56:03 -0500 Subject: [PATCH 080/100] Add a rooUtil track counting example --- utils/rooutil/examples/TrackCounting.C | 24 ++++++++++++++++++++++++ utils/rooutil/inc/Event.hh | 6 ++++++ 2 files changed, 30 insertions(+) create mode 100644 utils/rooutil/examples/TrackCounting.C diff --git a/utils/rooutil/examples/TrackCounting.C b/utils/rooutil/examples/TrackCounting.C new file mode 100644 index 0000000..836458e --- /dev/null +++ b/utils/rooutil/examples/TrackCounting.C @@ -0,0 +1,24 @@ +#include "TrkAna/utils/rooutil/inc/RooUtil.hh" +#include "TrkAna/utils/rooutil/inc/common_cuts.hh" + +#include + +void TrackCounting(std::string filename) { + + RooUtil util(filename); + std::cout << filename << " has " << util.GetNEvents() << " events" << std::endl; + + // Now loop through the events and print the number of tracks in each event + std::cout << "Run\tSubrun\tEvent\tN_trk\tN_e-\tN_e+\tN_mu-\tN_mu+" << std::endl; + for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { + const auto& event = util.GetEvent(i_event); + + int n_total_tracks = event.CountTracks(); + int n_e_minus_tracks = event.CountTracks(is_e_minus); + int n_e_plus_tracks = event.CountTracks(is_e_plus); + int n_mu_minus_tracks = event.CountTracks(is_mu_minus); + int n_mu_plus_tracks = event.CountTracks(is_mu_plus); + + std::cout << event.evtinfo->run << "\t" << event.evtinfo->subrun << "\t" << event.evtinfo->event << "\t" << n_total_tracks << "\t" << n_e_minus_tracks << "\t" << n_e_plus_tracks << "\t" << n_mu_minus_tracks << "\t" << n_mu_plus_tracks << std::endl; + } +} diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index 049579b..2d154e1 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -60,6 +60,12 @@ struct Event { return select_tracks; } + int CountTracks() const { return tracks.size(); } + int CountTracks(TrackCut cut) const { + Tracks select_tracks = GetTracks(cut); + return select_tracks.size(); + } + Tracks tracks; bool debug = false; From 26a4bdff0fdcb774dade91091b9f1c232ece8c84 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 14:02:32 -0500 Subject: [PATCH 081/100] Instead of function pointers use std::function so that we can combine functions in lambdas --- utils/rooutil/examples/TrackCounting.C | 20 ++++++++++++++++++-- utils/rooutil/inc/Track.hh | 3 ++- utils/rooutil/inc/TrackSegment.hh | 3 ++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/utils/rooutil/examples/TrackCounting.C b/utils/rooutil/examples/TrackCounting.C index 836458e..ddec7e9 100644 --- a/utils/rooutil/examples/TrackCounting.C +++ b/utils/rooutil/examples/TrackCounting.C @@ -3,13 +3,22 @@ #include +bool good_track(const Track& track) { + if (track.trk->fitcon > 1e-3) { + return true; + } + else { + return false; + } +} + void TrackCounting(std::string filename) { RooUtil util(filename); std::cout << filename << " has " << util.GetNEvents() << " events" << std::endl; // Now loop through the events and print the number of tracks in each event - std::cout << "Run\tSubrun\tEvent\tN_trk\tN_e-\tN_e+\tN_mu-\tN_mu+" << std::endl; + std::cout << "Run\tSubrun\tEvent\tN_trk(good)\tN_e-(good)\tN_e+(good)\tN_mu-(good)\tN_mu+(good)" << std::endl; for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) { const auto& event = util.GetEvent(i_event); @@ -19,6 +28,13 @@ void TrackCounting(std::string filename) { int n_mu_minus_tracks = event.CountTracks(is_mu_minus); int n_mu_plus_tracks = event.CountTracks(is_mu_plus); - std::cout << event.evtinfo->run << "\t" << event.evtinfo->subrun << "\t" << event.evtinfo->event << "\t" << n_total_tracks << "\t" << n_e_minus_tracks << "\t" << n_e_plus_tracks << "\t" << n_mu_minus_tracks << "\t" << n_mu_plus_tracks << std::endl; + int n_good_tracks = event.CountTracks(good_track); + int n_e_minus_good_tracks = event.CountTracks([](const Track& track){ return is_e_minus(track) && good_track(track); }); + int n_e_plus_good_tracks = event.CountTracks([](const Track& track){ return is_e_plus(track) && good_track(track); }); + int n_mu_minus_good_tracks = event.CountTracks([](const Track& track){ return is_mu_minus(track) && good_track(track); }); + int n_mu_plus_good_tracks = event.CountTracks([](const Track& track){ return is_mu_plus(track) && good_track(track); }); + + std::cout << event.evtinfo->run << "\t" << event.evtinfo->subrun << "\t" << event.evtinfo->event << "\t" << n_total_tracks << " (" << n_good_tracks << ")\t" << n_e_minus_tracks << " (" << n_e_minus_good_tracks << ")\t" << n_e_plus_tracks << " (" << n_e_plus_good_tracks << ")\t" << n_mu_minus_tracks << " (" << n_mu_minus_good_tracks << ")\t" << n_mu_plus_tracks << " (" << n_mu_plus_good_tracks << ")" << std::endl; + } } diff --git a/utils/rooutil/inc/Track.hh b/utils/rooutil/inc/Track.hh index 14d70d5..4475ae5 100644 --- a/utils/rooutil/inc/Track.hh +++ b/utils/rooutil/inc/Track.hh @@ -1,6 +1,7 @@ #ifndef Track_hh_ #define Track_hh_ +#include #include "TrkAna/inc/TrkInfo.hh" #include "TrkAna/inc/TrkSegInfo.hh" @@ -47,7 +48,7 @@ struct Track { std::vector* trksegs = nullptr; }; -typedef bool (*TrackCut)(const Track& track); +typedef std::function TrackCut; typedef std::vector Tracks; #endif diff --git a/utils/rooutil/inc/TrackSegment.hh b/utils/rooutil/inc/TrackSegment.hh index 6c5a4ec..2b0ef4d 100644 --- a/utils/rooutil/inc/TrackSegment.hh +++ b/utils/rooutil/inc/TrackSegment.hh @@ -1,6 +1,7 @@ #ifndef TrackSegment_hh_ #define TrackSegment_hh_ +#include #include "TrkAna/inc/TrkSegInfo.hh" struct TrackSegment { @@ -14,7 +15,7 @@ struct TrackSegment { } }; -typedef bool (*TrackSegmentCut)(const TrackSegment& track_seg); +typedef std::function TrackSegmentCut; typedef std::vector TrackSegments; #endif From a8fca92251bc202cca85c6fb8657c544a00321ea Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 14:19:58 -0500 Subject: [PATCH 082/100] Adding some more RooUtil draft documenation --- utils/rooutil/README.md | 2 +- utils/rooutil/draft.md | 42 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/utils/rooutil/README.md b/utils/rooutil/README.md index 62116bb..cae2f8f 100644 --- a/utils/rooutil/README.md +++ b/utils/rooutil/README.md @@ -1,3 +1,3 @@ # RooUtil -This is currently under development. +This is currently under development. You can see some draft documentation [here](./draft.md) diff --git a/utils/rooutil/draft.md b/utils/rooutil/draft.md index d4c3060..d0aa889 100644 --- a/utils/rooutil/draft.md +++ b/utils/rooutil/draft.md @@ -10,11 +10,47 @@ There are various classes that combine together branches at different dimenions | Class | Single Objects | Vectors | Vector-of-Vectors | |-----|-----|----|-----| | Event | ```evtinfo```, ```evtinfomc``` | ```trk``` | ```trkfit``` | -| Track | ```trk``` | ```trkfit``` | none | -| TrackSegment | ```trkfit``` | none | none | +| Track | ```trk``` | ```trksegs``` | none | +| TrackSegment | ```trkseg``` | none | none | ## Supported Branches The currently supported branches are: * evtinfo, evtinfomc * trk -* trkfit +* trksegs + +## Cut Functions + +### Common Cut Functions + +Here are the common cut functions defined in ```TrkAna/utils/rooutil/inc/common_cuts.hh``` with explanations: + +| function | cuts on | result | +|----|----|----| +|```is_e_minus``` | tracks | true if e-minus hypothesis | +|```is_e_plus``` | tracks | true if e-plus hypothesis | +|```is_mu_minus``` | tracks | true if mu-minus hypothesis | +|```is_mu_plus``` | tracks | true if mu-plus hypothesis | +|```tracker_entrance``` | track segments | true if track segment is at tracker entrance | +|```tracker_middle``` | track segments | true if track segment is at tracker middle | +|```tracker_exit``` | track segments | true if track segment is at tracker exit | + +### Combining Cut Functions + +There are two ways to combine cut functions: + +1. Write a new one yourself e.g: + +``` +bool my_cut(onst Track& track) { + return good_track(track) && is_e_minus(track); +} +... +int n_e_minus_good_tracks = event.CountTracks(my_cut); +``` + +2. or, be combine them in a [lambda function](https://learn.microsoft.com/en-us/cpp/cpp/lambda-expressions-in-cpp?view=msvc-170) (similar to python): + +``` +int n_e_minus_good_tracks = event.CountTracks([](const Track& track){ return is_e_minus(track) && good_track(track); }); +``` From 6d4e459d2ed54338edae1c36c39d0443326438e7 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 16:19:24 -0500 Subject: [PATCH 083/100] Fix for TrkQualAll --- fcl/prolog.fcl | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 8ba94f8..71d45ae 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -12,21 +12,23 @@ TrkQual : { datFilename : "Offline/TrkDiag/data/TrkQual_ANN1_v1.dat" } TrkQualDeM : @local::TrkQual -TrkQualDeM.KalSeedCollection : "KKDeM" +TrkQualDeM.KalSeedPtrCollection : "MergeKKDeM" TrkQualUeM : @local::TrkQual -TrkQualUeM.KalSeedCollection : "KKUeM" +TrkQualUeM.KalSeedPtrCollection : "MergeKKUeM" TrkQualDmuM : @local::TrkQual -TrkQualDmuM.KalSeedCollection : "KKDmuM" +TrkQualDmuM.KalSeedPtrCollection : "MergeKKDmuM" TrkQualUmuM : @local::TrkQual -TrkQualUmuM.KalSeedCollection : "KKUmuM" +TrkQualUmuM.KalSeedPtrCollection : "MergeKKUmuM" TrkQualDeP : @local::TrkQual -TrkQualDeP.KalSeedCollection : "KKDeP" +TrkQualDeP.KalSeedPtrCollection : "MergeKKDeP" TrkQualUeP : @local::TrkQual -TrkQualUeP.KalSeedCollection : "KKUeP" +TrkQualUeP.KalSeedPtrCollection : "MergeKKUeP" TrkQualDmuP : @local::TrkQual -TrkQualDmuP.KalSeedCollection : "KKDmuP" +TrkQualDmuP.KalSeedPtrCollection : "MergeKKDmuP" TrkQualUmuP : @local::TrkQual -TrkQualUmuP.KalSeedCollection : "KKUmuP" +TrkQualUmuP.KalSeedPtrCollection : "MergeKKUmuP" +TrkQualAll : @local::TrkQual +TrkQualAll.KalSeedPtrCollection : "MergeKKAll" TrkQualProducers : { TrkQualDeM : @local::TrkQualDeM @@ -37,6 +39,7 @@ TrkQualProducers : { TrkQualDmuP : @local::TrkQualDmuP TrkQualUmuM : @local::TrkQualUmuM TrkQualUmuP : @local::TrkQualUmuP + TrkQualAll : @local::TrkQualAll } TrkQualProducersPath : [ TrkQualDeM, TrkQualUeM, TrkQualDmuM, TrkQualDeP, TrkQualUeP, TrkQualDmuP, TrkQualUmuM, TrkQualUmuP ] @@ -209,11 +212,11 @@ EventNtuple : { } # TrigSequence : [ PBIWeight, @sequence::TrkQualProducersPath, @sequence::TrkPIDProducersPath] - Path : [ @sequence::MergeKKProducersPath, PBIWeight, MakeSS, TrkQualDeM ] - PathNoMakeSS : [ @sequence::MergeKKProducersPath, PBIWeight, TrkQualDeM ] + Path : [ @sequence::MergeKKProducersPath, PBIWeight, MakeSS, TrkQualAll ] + PathNoMakeSS : [ @sequence::MergeKKProducersPath, PBIWeight, TrkQualAll ] PathExt : [ @sequence::MergeKKNoFieldPath ] - PathSeparate : [ @sequence::MergeKKSeparatePath, PBIWeight, MakeSS, TrkQualDeM ] - PathNoMC : [ @sequence::MergeKKProducersPath, TrkQualDeM ] + PathSeparate : [ @sequence::MergeKKSeparatePath, PBIWeight, MakeSS, TrkQualAll ] + PathNoMC : [ @sequence::MergeKKProducersPath, TrkQualAll ] EndPath : [ EventNtuple, genCountLogger ] EndPathNoMC : [ EventNtuple ] From 688e8b42fb45ce749904a08851f1dc82ea66658c Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Thu, 3 Oct 2024 16:22:32 -0500 Subject: [PATCH 084/100] Fix for separate branches --- fcl/prolog.fcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 71d45ae..038c16d 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -215,7 +215,7 @@ EventNtuple : { Path : [ @sequence::MergeKKProducersPath, PBIWeight, MakeSS, TrkQualAll ] PathNoMakeSS : [ @sequence::MergeKKProducersPath, PBIWeight, TrkQualAll ] PathExt : [ @sequence::MergeKKNoFieldPath ] - PathSeparate : [ @sequence::MergeKKSeparatePath, PBIWeight, MakeSS, TrkQualAll ] + PathSeparate : [ @sequence::MergeKKSeparatePath, PBIWeight, MakeSS, @sequence::TrkQualProducersPath] PathNoMC : [ @sequence::MergeKKProducersPath, TrkQualAll ] EndPath : [ EventNtuple, genCountLogger ] EndPathNoMC : [ EventNtuple ] From c77abcf68d86527f75df21378ee716a23417d418 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Wed, 9 Oct 2024 14:12:24 -0500 Subject: [PATCH 085/100] Fix missing trkqual branch --- fcl/prolog.fcl | 1 + 1 file changed, 1 insertion(+) diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index 1b36917..c5546a8 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -153,6 +153,7 @@ Ext : { input : "MergeKKLine" All : { input : "MergeKKAll" branch : "trk" options : { fillHits : true fillMC : true genealogyDepth : -1 matchDepth : -1 } + trkQualTag : "TrkQualAll" } From 4c74c226b9a6251a8d69d099ec4ea7d45c7dd55a Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 08:37:01 -0500 Subject: [PATCH 086/100] Update draft RooUtil documentation with new trkseg name --- utils/rooutil/draft.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/rooutil/draft.md b/utils/rooutil/draft.md index d0aa889..728b9dd 100644 --- a/utils/rooutil/draft.md +++ b/utils/rooutil/draft.md @@ -9,7 +9,7 @@ There are various classes that combine together branches at different dimenions | Class | Single Objects | Vectors | Vector-of-Vectors | |-----|-----|----|-----| -| Event | ```evtinfo```, ```evtinfomc``` | ```trk``` | ```trkfit``` | +| Event | ```evtinfo```, ```evtinfomc``` | ```trk``` | ```trksegs``` | | Track | ```trk``` | ```trksegs``` | none | | TrackSegment | ```trkseg``` | none | none | From 359ab83d12670d218abdea9af97a0329e49bfe60 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 08:37:16 -0500 Subject: [PATCH 087/100] Update upstream/downstream common_cut --- utils/rooutil/inc/common_cuts.hh | 49 +++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/utils/rooutil/inc/common_cuts.hh b/utils/rooutil/inc/common_cuts.hh index ab14d57..d95c840 100644 --- a/utils/rooutil/inc/common_cuts.hh +++ b/utils/rooutil/inc/common_cuts.hh @@ -30,17 +30,21 @@ bool is_mu_plus(const Track& track) { else { return false; } } -// Track Directions -bool is_downstream(const Track& track) { - // Segments are time-ordered so check to see if the track always increases in z-position - double first_z = track.GetSegments().at(0).trkseg->pos.z(); - double prev_z = first_z; - for (const auto& segment : track.GetSegments()) { - if (segment.trkseg->pos.z() < prev_z) { // we are now upstream of the previous segment so this is now a downstream track - return false; - } +// Track Segment Directions +bool is_downstream(const TrackSeg& track_seg) { + // the sign of p_z tells us whether this segment is going upstream or downstream + if (segment.trkseg->mom.z() > 0) { + return true; } - return true; // we got to the end without turning upstream + else { return false; } +} + +bool is_upstream(const TrackSeg& track_seg) { + // the sign of p_z tells us whether this segment is going upstream or downstream + if (segment.trkseg->mom.z() < 0) { + return true; + } + else { return false; } } @@ -61,4 +65,29 @@ bool tracker_exit(const TrackSegment& segment) { } +// More complex cuts + +// A track is a reflected track if we have both an upstream and a downstream segment at the tracker entrance +bool is_reflected(const Track& track) { + bool have_upstream = false; + bool have_downstream = false; + for (const auto& track_seg : track.segments) { + if (track_entrance(track_seg)) { + if (is_upstream(track_seg)) { + have_upstream = true; + } + if (is_downstream(track_seg)) { + have_downstream = true; + } + } + } + if (have_upstream && have_downstream) { + return true; + } + else { + return false; + } +} + + #endif From dbc9c15907b239c15871176a6f60969e29cb7889 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 09:54:05 -0500 Subject: [PATCH 088/100] Removing unused fcl file --- doc/v5-to-v6.md | 1 + fcl/TrkAnaReco_MultipleTrkQual.fcl | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 fcl/TrkAnaReco_MultipleTrkQual.fcl diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 0480a5f..639e5d9 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -40,6 +40,7 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | TrkAnaReco_addStopTgtVDs.fcl | deleted | | | TrkAnaReco_multipleBestCrv.fcl | deleted | | | TrkAnaReco_multipleBestCrv_differentThresholds.fcl | deleted | | +| TrkAnaReco_MultipleTrkQual.fcl | deleted | | ## Fcl Parameter Changes | | v5 | v6 | Notes | diff --git a/fcl/TrkAnaReco_MultipleTrkQual.fcl b/fcl/TrkAnaReco_MultipleTrkQual.fcl deleted file mode 100644 index a378630..0000000 --- a/fcl/TrkAnaReco_MultipleTrkQual.fcl +++ /dev/null @@ -1,6 +0,0 @@ -#include "TrkAna/fcl/TrkAnaReco.fcl" -# Add another TrkQual module with a different training -# (NB to be read out by TrkAna it must have the same suffix) -physics.producers.TrkQualNewDeP : @local::TrkQualDeP -physics.producers.TrkQualNewDeP.TrainingName : "TrkQualPosNew" -physics.TrkAnaTrigPath : [ @sequence::TrkAnaReco.TrigSequence, TrkQualNewDeP ] From 449ecf6bd5bea05d4273130184e1b636b302a2cf Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:07:20 -0500 Subject: [PATCH 089/100] Update includes with new name. Compiled successfully --- inc/CentralHelixInfo.hh | 2 +- inc/CrvHitInfoMC.hh | 2 +- inc/CrvHitInfoReco.hh | 2 +- inc/CrvInfoHelper.hh | 14 ++++---- inc/CrvPlaneInfoMC.hh | 2 +- inc/CrvPulseInfoReco.hh | 2 +- inc/CrvSummaryMC.hh | 2 +- inc/HelixInfo.hh | 4 +-- inc/InfoMCStructHelper.hh | 20 ++++++------ inc/InfoStructHelper.hh | 30 ++++++++--------- inc/MCStepInfo.hh | 2 +- inc/MCStepSummaryInfo.hh | 2 +- inc/MVAResultInfo.hh | 2 +- inc/SimInfo.hh | 2 +- inc/SurfaceStepInfo.hh | 2 +- inc/TrkCaloHitInfo.hh | 2 +- inc/TrkSegInfo.hh | 2 +- inc/TrkStrawHitInfo.hh | 2 +- inc/TrkStrawHitInfoMC.hh | 2 +- src/BestCrvHitDeltaT_module.cc | 2 +- src/CrvHitInfoMC.cc | 2 +- src/CrvHitInfoReco.cc | 2 +- src/CrvInfoHelper.cc | 2 +- src/CrvPlaneInfoMC.cc | 2 +- src/CrvPulseInfoReco.cc | 2 +- src/CrvSummaryMC.cc | 2 +- src/EventNtupleMaker_module.cc | 54 +++++++++++++++--------------- src/InfoMCStructHelper.cc | 2 +- src/InfoStructHelper.cc | 2 +- src/SurfaceStepInfo.cc | 2 +- src/classes.h | 60 +++++++++++++++++----------------- 31 files changed, 116 insertions(+), 116 deletions(-) diff --git a/inc/CentralHelixInfo.hh b/inc/CentralHelixInfo.hh index fc277c0..d6728c4 100644 --- a/inc/CentralHelixInfo.hh +++ b/inc/CentralHelixInfo.hh @@ -6,7 +6,7 @@ // #ifndef CentralHelixInfo_HH #define CentralHelixInfo_HH -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" #include "Offline/DataProducts/inc/SurfaceId.hh" namespace mu2e { diff --git a/inc/CrvHitInfoMC.hh b/inc/CrvHitInfoMC.hh index fb1d64c..00701b8 100644 --- a/inc/CrvHitInfoMC.hh +++ b/inc/CrvHitInfoMC.hh @@ -5,7 +5,7 @@ namespace CLHEP {class Hep3Vector; } #include -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" namespace mu2e { diff --git a/inc/CrvHitInfoReco.hh b/inc/CrvHitInfoReco.hh index f2505ab..518ffcc 100644 --- a/inc/CrvHitInfoReco.hh +++ b/inc/CrvHitInfoReco.hh @@ -3,7 +3,7 @@ // CrvHitInfoReco: information about a cluster of CRV coincidence triplets -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" #include "Offline/DataProducts/inc/CRVId.hh" namespace CLHEP {class Hep3Vector; } #include diff --git a/inc/CrvInfoHelper.hh b/inc/CrvInfoHelper.hh index 2363162..c44f5fa 100644 --- a/inc/CrvInfoHelper.hh +++ b/inc/CrvInfoHelper.hh @@ -1,13 +1,13 @@ // // Replacement for CRVAnalysis // -#include "TrkAna/inc/CrvHitInfoReco.hh" -#include "TrkAna/inc/CrvHitInfoMC.hh" -#include "TrkAna/inc/CrvWaveformInfo.hh" -#include "TrkAna/inc/CrvSummaryReco.hh" -#include "TrkAna/inc/CrvSummaryMC.hh" -#include "TrkAna/inc/CrvPlaneInfoMC.hh" -#include "TrkAna/inc/CrvPulseInfoReco.hh" +#include "EventNtuple/inc/CrvHitInfoReco.hh" +#include "EventNtuple/inc/CrvHitInfoMC.hh" +#include "EventNtuple/inc/CrvWaveformInfo.hh" +#include "EventNtuple/inc/CrvSummaryReco.hh" +#include "EventNtuple/inc/CrvSummaryMC.hh" +#include "EventNtuple/inc/CrvPlaneInfoMC.hh" +#include "EventNtuple/inc/CrvPulseInfoReco.hh" #include "Offline/DataProducts/inc/CRVId.hh" #include "Offline/RecoDataProducts/inc/CrvCoincidenceCluster.hh" #include "Offline/RecoDataProducts/inc/CrvRecoPulse.hh" diff --git a/inc/CrvPlaneInfoMC.hh b/inc/CrvPlaneInfoMC.hh index c7f13ea..5cea16f 100644 --- a/inc/CrvPlaneInfoMC.hh +++ b/inc/CrvPlaneInfoMC.hh @@ -3,7 +3,7 @@ // CrvPlaneInfoMC: information about the point where the MC trajectory crosses the xz plane of CRV-T -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" namespace CLHEP {class Hep3Vector; } #include diff --git a/inc/CrvPulseInfoReco.hh b/inc/CrvPulseInfoReco.hh index 81fcc2c..6da5ab0 100644 --- a/inc/CrvPulseInfoReco.hh +++ b/inc/CrvPulseInfoReco.hh @@ -1,7 +1,7 @@ #ifndef CrvPulseInfoReco_hh #define CrvPulseInfoReco_hh -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" namespace CLHEP {class Hep3Vector; } #include diff --git a/inc/CrvSummaryMC.hh b/inc/CrvSummaryMC.hh index ac99d0b..c8fbfd6 100644 --- a/inc/CrvSummaryMC.hh +++ b/inc/CrvSummaryMC.hh @@ -3,7 +3,7 @@ // CrvSummaryMC: branch that provides a summary of the CRV MC true information -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" namespace CLHEP {class Hep3Vector; } namespace mu2e { diff --git a/inc/HelixInfo.hh b/inc/HelixInfo.hh index 285d64b..938aeda 100644 --- a/inc/HelixInfo.hh +++ b/inc/HelixInfo.hh @@ -1,8 +1,8 @@ // // HelixInfo: struct for HelixSeed info // -#ifndef TrkAna_HelixInfo_hh -#define TrkAna_HelixInfo_hh +#ifndef EventNtuple_HelixInfo_hh +#define EventNtuple_HelixInfo_hh namespace mu2e { struct HelixInfo { int nch = -1; // number of combo hits potentially used for this helix diff --git a/inc/InfoMCStructHelper.hh b/inc/InfoMCStructHelper.hh index ef3bab2..958b9b9 100644 --- a/inc/InfoMCStructHelper.hh +++ b/inc/InfoMCStructHelper.hh @@ -2,8 +2,8 @@ // Namespace for collecting tools used in MC truth evaluation // Original author: Dave Brown (LBNL) 8/10/2016 // -#ifndef TrkAna_InfoMCStructHelper_hh -#define TrkAna_InfoMCStructHelper_hh +#ifndef EventNtuple_InfoMCStructHelper_hh +#define EventNtuple_InfoMCStructHelper_hh #include "fhiclcpp/types/Atom.h" #include "Offline/RecoDataProducts/inc/StrawHitIndex.hh" #include "Offline/MCDataProducts/inc/StrawDigiMC.hh" @@ -11,14 +11,14 @@ #include "Offline/MCDataProducts/inc/CrvCoincidenceClusterMC.hh" #include "Offline/RecoDataProducts/inc/KalSeed.hh" -#include "TrkAna/inc/TrkInfoMC.hh" -#include "TrkAna/inc/SimInfo.hh" -#include "TrkAna/inc/TrkStrawHitInfoMC.hh" -#include "TrkAna/inc/CaloClusterInfoMC.hh" -#include "TrkAna/inc/MCStepInfo.hh" -#include "TrkAna/inc/MCStepSummaryInfo.hh" -#include "TrkAna/inc/SurfaceStepInfo.hh" -#include "TrkAna/inc/CrvHitInfoMC.hh" +#include "EventNtuple/inc/TrkInfoMC.hh" +#include "EventNtuple/inc/SimInfo.hh" +#include "EventNtuple/inc/TrkStrawHitInfoMC.hh" +#include "EventNtuple/inc/CaloClusterInfoMC.hh" +#include "EventNtuple/inc/MCStepInfo.hh" +#include "EventNtuple/inc/MCStepSummaryInfo.hh" +#include "EventNtuple/inc/SurfaceStepInfo.hh" +#include "EventNtuple/inc/CrvHitInfoMC.hh" #include "Offline/RecoDataProducts/inc/KalSeed.hh" #include "Offline/MCDataProducts/inc/KalSeedMC.hh" #include "BTrk/BbrGeom/HepPoint.h" diff --git a/inc/InfoStructHelper.hh b/inc/InfoStructHelper.hh index 5e186c2..c2295da 100644 --- a/inc/InfoStructHelper.hh +++ b/inc/InfoStructHelper.hh @@ -2,8 +2,8 @@ // Class for help filling Info structs // Original author: A. Edmonds (November 2018) // -#ifndef TrkAna_InfoStructHelper_hh -#define TrkAna_InfoStructHelper_hh +#ifndef EventNtuple_InfoStructHelper_hh +#define EventNtuple_InfoStructHelper_hh #include "Offline/RecoDataProducts/inc/StrawHitIndex.hh" #include "Offline/RecoDataProducts/inc/KalSeed.hh" #include "Offline/RecoDataProducts/inc/StrawHitFlag.hh" @@ -16,19 +16,19 @@ #include "Offline/GeometryService/inc/GeomHandle.hh" #include "Offline/CalorimeterGeom/inc/DiskCalorimeter.hh" -#include "TrkAna/inc/HitCount.hh" -#include "TrkAna/inc/TrkInfo.hh" -#include "TrkAna/inc/TrkSegInfo.hh" -#include "TrkAna/inc/LoopHelixInfo.hh" -#include "TrkAna/inc/CentralHelixInfo.hh" -#include "TrkAna/inc/KinematicLineInfo.hh" -#include "TrkAna/inc/TrkStrawHitInfo.hh" -#include "TrkAna/inc/TrkStrawMatInfo.hh" -#include "TrkAna/inc/TrkCaloHitInfo.hh" -#include "TrkAna/inc/TrkPIDInfo.hh" -#include "TrkAna/inc/HelixInfo.hh" -#include "TrkAna/inc/MVAResultInfo.hh" -#include "TrkAna/inc/CrvHitInfoReco.hh" +#include "EventNtuple/inc/HitCount.hh" +#include "EventNtuple/inc/TrkInfo.hh" +#include "EventNtuple/inc/TrkSegInfo.hh" +#include "EventNtuple/inc/LoopHelixInfo.hh" +#include "EventNtuple/inc/CentralHelixInfo.hh" +#include "EventNtuple/inc/KinematicLineInfo.hh" +#include "EventNtuple/inc/TrkStrawHitInfo.hh" +#include "EventNtuple/inc/TrkStrawMatInfo.hh" +#include "EventNtuple/inc/TrkCaloHitInfo.hh" +#include "EventNtuple/inc/TrkPIDInfo.hh" +#include "EventNtuple/inc/HelixInfo.hh" +#include "EventNtuple/inc/MVAResultInfo.hh" +#include "EventNtuple/inc/CrvHitInfoReco.hh" #include "art/Framework/Principal/Handle.h" #include #include diff --git a/inc/MCStepInfo.hh b/inc/MCStepInfo.hh index 36e5dcb..8e3d1c8 100644 --- a/inc/MCStepInfo.hh +++ b/inc/MCStepInfo.hh @@ -4,7 +4,7 @@ #ifndef MCStepInfo_HH #define MCStepInfo_HH #include -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" namespace mu2e { struct MCStepInfo { diff --git a/inc/MCStepSummaryInfo.hh b/inc/MCStepSummaryInfo.hh index 3adfb3a..a772aac 100644 --- a/inc/MCStepSummaryInfo.hh +++ b/inc/MCStepSummaryInfo.hh @@ -4,7 +4,7 @@ #ifndef MCStepSummaryInfo_HH #define MCStepSummaryInfo_HH #include -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" namespace mu2e { struct MCStepSummaryInfo { diff --git a/inc/MVAResultInfo.hh b/inc/MVAResultInfo.hh index 0d9b9f0..781b45b 100644 --- a/inc/MVAResultInfo.hh +++ b/inc/MVAResultInfo.hh @@ -1,6 +1,6 @@ // // MVAResultInfo: array branch containing the output of a multi-variate analysis (MVA) -// structs used to record MVAResult information into TrkAna tree +// structs used to record MVAResult information into EventNtuple // Andy Edmonds (January 2024) // #ifndef MVAResultInfo_HH diff --git a/inc/SimInfo.hh b/inc/SimInfo.hh index 498874f..955c839 100644 --- a/inc/SimInfo.hh +++ b/inc/SimInfo.hh @@ -6,7 +6,7 @@ // #ifndef SimInfo_HH #define SimInfo_HH -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" #include "Offline/MCDataProducts/inc/MCRelationship.hh" namespace mu2e { diff --git a/inc/SurfaceStepInfo.hh b/inc/SurfaceStepInfo.hh index c4408fb..1e1f3bf 100644 --- a/inc/SurfaceStepInfo.hh +++ b/inc/SurfaceStepInfo.hh @@ -4,7 +4,7 @@ #ifndef SurfaceStepInfo_HH #define SurfaceStepInfo_HH #include "Offline/DataProducts/inc/SurfaceId.hh" -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" namespace mu2e { class SurfaceStep; diff --git a/inc/TrkCaloHitInfo.hh b/inc/TrkCaloHitInfo.hh index 46979ee..9afe45d 100644 --- a/inc/TrkCaloHitInfo.hh +++ b/inc/TrkCaloHitInfo.hh @@ -4,7 +4,7 @@ // #ifndef TrkCaloHitInfo_HH #define TrkCaloHitInfo_HH -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" namespace mu2e { struct TrkCaloHitInfo { diff --git a/inc/TrkSegInfo.hh b/inc/TrkSegInfo.hh index 598c14b..14d2f22 100644 --- a/inc/TrkSegInfo.hh +++ b/inc/TrkSegInfo.hh @@ -6,7 +6,7 @@ // #ifndef TrkSegInfo_HH #define TrkSegInfo_HH -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" #include "Offline/DataProducts/inc/SurfaceId.hh" namespace mu2e { diff --git a/inc/TrkStrawHitInfo.hh b/inc/TrkStrawHitInfo.hh index 1dea831..b244f47 100644 --- a/inc/TrkStrawHitInfo.hh +++ b/inc/TrkStrawHitInfo.hh @@ -5,7 +5,7 @@ #define TrkStrawHitInfoHH -//#include "TrkAna/inc/RootVectors.hh" +//#include "EventNtuple/inc/RootVectors.hh" #include "Offline/DataProducts/inc/TrkTypes.hh" namespace mu2e { diff --git a/inc/TrkStrawHitInfoMC.hh b/inc/TrkStrawHitInfoMC.hh index 14502a5..872e0ac 100644 --- a/inc/TrkStrawHitInfoMC.hh +++ b/inc/TrkStrawHitInfoMC.hh @@ -3,7 +3,7 @@ // #ifndef TrkStrawHitInfoMC_HH #define TrkStrawHitInfoMC_HH -#include "TrkAna/inc/RootVectors.hh" +#include "EventNtuple/inc/RootVectors.hh" #include "Offline/MCDataProducts/inc/MCRelationship.hh" namespace mu2e { diff --git a/src/BestCrvHitDeltaT_module.cc b/src/BestCrvHitDeltaT_module.cc index 7815ae6..f8a0f9c 100644 --- a/src/BestCrvHitDeltaT_module.cc +++ b/src/BestCrvHitDeltaT_module.cc @@ -16,7 +16,7 @@ #include "fhiclcpp/types/Table.h" #include "fhiclcpp/types/OptionalSequence.h" -#include "TrkAna/inc/BestCrvAssns.hh" +#include "EventNtuple/inc/BestCrvAssns.hh" // C++ includes. #include diff --git a/src/CrvHitInfoMC.cc b/src/CrvHitInfoMC.cc index 72c404b..81a0ddd 100644 --- a/src/CrvHitInfoMC.cc +++ b/src/CrvHitInfoMC.cc @@ -1,4 +1,4 @@ -#include "TrkAna/inc/CrvHitInfoMC.hh" +#include "EventNtuple/inc/CrvHitInfoMC.hh" #include "CLHEP/Vector/ThreeVector.h" namespace mu2e { CrvHitInfoMC::CrvHitInfoMC(bool valid, int pdgId, diff --git a/src/CrvHitInfoReco.cc b/src/CrvHitInfoReco.cc index ff98dd1..e0cf5d9 100644 --- a/src/CrvHitInfoReco.cc +++ b/src/CrvHitInfoReco.cc @@ -1,4 +1,4 @@ -#include "TrkAna/inc/CrvHitInfoReco.hh" +#include "EventNtuple/inc/CrvHitInfoReco.hh" #include "CLHEP/Vector/ThreeVector.h" namespace mu2e { CrvHitInfoReco::CrvHitInfoReco(int sectorType, CLHEP::Hep3Vector hpos, float timeWindowStart, float timeWindowEnd, float timeAvg, float PEs, std::array PEsPerLayer, int nCoincidenceHits, int nCoincidenceLayers, float coincidenceAngle) : diff --git a/src/CrvInfoHelper.cc b/src/CrvInfoHelper.cc index d02d5a6..ae1d3f9 100644 --- a/src/CrvInfoHelper.cc +++ b/src/CrvInfoHelper.cc @@ -1,4 +1,4 @@ -#include "TrkAna/inc/CrvInfoHelper.hh" +#include "EventNtuple/inc/CrvInfoHelper.hh" #include "Offline/CosmicRayShieldGeom/inc/CosmicRayShield.hh" #include "Offline/CRVConditions/inc/CRVDigitizationPeriod.hh" diff --git a/src/CrvPlaneInfoMC.cc b/src/CrvPlaneInfoMC.cc index acb47bb..67f96b5 100644 --- a/src/CrvPlaneInfoMC.cc +++ b/src/CrvPlaneInfoMC.cc @@ -1,4 +1,4 @@ -#include "TrkAna/inc/CrvPlaneInfoMC.hh" +#include "EventNtuple/inc/CrvPlaneInfoMC.hh" #include "CLHEP/Vector/ThreeVector.h" namespace mu2e { CrvPlaneInfoMC::CrvPlaneInfoMC(int pdgId, int primaryPdgId, float primaryE, CLHEP::Hep3Vector primaryPos, diff --git a/src/CrvPulseInfoReco.cc b/src/CrvPulseInfoReco.cc index 584ccb3..ee28c0c 100644 --- a/src/CrvPulseInfoReco.cc +++ b/src/CrvPulseInfoReco.cc @@ -1,4 +1,4 @@ -#include "TrkAna/inc/CrvPulseInfoReco.hh" +#include "EventNtuple/inc/CrvPulseInfoReco.hh" #include "CLHEP/Vector/ThreeVector.h" namespace mu2e { CrvPulseInfoReco::CrvPulseInfoReco(CLHEP::Hep3Vector ppos, int barId, int sectorId, int SiPMId, int PEs, int PEsPulseHeight, float pulseHeight, float pulseBeta, float pulseFitChi2, float time) : diff --git a/src/CrvSummaryMC.cc b/src/CrvSummaryMC.cc index 225667c..e55bfcc 100644 --- a/src/CrvSummaryMC.cc +++ b/src/CrvSummaryMC.cc @@ -1,4 +1,4 @@ -#include "TrkAna/inc/CrvSummaryMC.hh" +#include "EventNtuple/inc/CrvSummaryMC.hh" #include "CLHEP/Vector/ThreeVector.h" namespace mu2e { CrvSummaryMC::CrvSummaryMC(double totalEnergyDeposited, double minPathLayer, double maxPathLayer, int nHitCounters, CLHEP::Hep3Vector ppos, int sectorNumber, int sectorType, int pdgId) : diff --git a/src/EventNtupleMaker_module.cc b/src/EventNtupleMaker_module.cc index 63b25b2..48cbed9 100644 --- a/src/EventNtupleMaker_module.cc +++ b/src/EventNtupleMaker_module.cc @@ -54,35 +54,35 @@ // mu2e tracking #include "Offline/BTrkData/inc/TrkStrawHit.hh" // diagnostics -#include "TrkAna/inc/HitCount.hh" -#include "TrkAna/inc/TrkCount.hh" -#include "TrkAna/inc/EventInfo.hh" -#include "TrkAna/inc/EventInfoMC.hh" -#include "TrkAna/inc/TrkInfo.hh" -#include "TrkAna/inc/TrkInfoMC.hh" -#include "TrkAna/inc/TrkSegInfo.hh" -#include "TrkAna/inc/LoopHelixInfo.hh" -#include "TrkAna/inc/CentralHelixInfo.hh" -#include "TrkAna/inc/KinematicLineInfo.hh" -#include "TrkAna/inc/SimInfo.hh" -#include "TrkAna/inc/EventWeightInfo.hh" -#include "TrkAna/inc/TrkStrawHitInfo.hh" -#include "TrkAna/inc/TrkStrawHitInfoMC.hh" -#include "TrkAna/inc/TrkCaloHitInfo.hh" -#include "TrkAna/inc/CaloClusterInfoMC.hh" -#include "TrkAna/inc/TrkPIDInfo.hh" -#include "TrkAna/inc/HelixInfo.hh" -#include "TrkAna/inc/InfoStructHelper.hh" -#include "TrkAna/inc/CrvInfoHelper.hh" -#include "TrkAna/inc/InfoMCStructHelper.hh" +#include "EventNtuple/inc/HitCount.hh" +#include "EventNtuple/inc/TrkCount.hh" +#include "EventNtuple/inc/EventInfo.hh" +#include "EventNtuple/inc/EventInfoMC.hh" +#include "EventNtuple/inc/TrkInfo.hh" +#include "EventNtuple/inc/TrkInfoMC.hh" +#include "EventNtuple/inc/TrkSegInfo.hh" +#include "EventNtuple/inc/LoopHelixInfo.hh" +#include "EventNtuple/inc/CentralHelixInfo.hh" +#include "EventNtuple/inc/KinematicLineInfo.hh" +#include "EventNtuple/inc/SimInfo.hh" +#include "EventNtuple/inc/EventWeightInfo.hh" +#include "EventNtuple/inc/TrkStrawHitInfo.hh" +#include "EventNtuple/inc/TrkStrawHitInfoMC.hh" +#include "EventNtuple/inc/TrkCaloHitInfo.hh" +#include "EventNtuple/inc/CaloClusterInfoMC.hh" +#include "EventNtuple/inc/TrkPIDInfo.hh" +#include "EventNtuple/inc/HelixInfo.hh" +#include "EventNtuple/inc/InfoStructHelper.hh" +#include "EventNtuple/inc/CrvInfoHelper.hh" +#include "EventNtuple/inc/InfoMCStructHelper.hh" #include "Offline/RecoDataProducts/inc/RecoQual.hh" #include "Offline/RecoDataProducts/inc/MVAResult.hh" -#include "TrkAna/inc/RecoQualInfo.hh" -#include "TrkAna/inc/MVAResultInfo.hh" -#include "TrkAna/inc/BestCrvAssns.hh" -#include "TrkAna/inc/MCStepInfo.hh" -#include "TrkAna/inc/SurfaceStepInfo.hh" -#include "TrkAna/inc/MCStepSummaryInfo.hh" +#include "EventNtuple/inc/RecoQualInfo.hh" +#include "EventNtuple/inc/MVAResultInfo.hh" +#include "EventNtuple/inc/BestCrvAssns.hh" +#include "EventNtuple/inc/MCStepInfo.hh" +#include "EventNtuple/inc/SurfaceStepInfo.hh" +#include "EventNtuple/inc/MCStepSummaryInfo.hh" // C++ includes. #include diff --git a/src/InfoMCStructHelper.cc b/src/InfoMCStructHelper.cc index afbb940..d37c1cd 100644 --- a/src/InfoMCStructHelper.cc +++ b/src/InfoMCStructHelper.cc @@ -2,7 +2,7 @@ // Namespace for collecting tools used in MC truth evaluation // Original author: Dave Brown (LBNL) 8/10/2016 // -#include "TrkAna/inc/InfoMCStructHelper.hh" +#include "EventNtuple/inc/InfoMCStructHelper.hh" #include "Offline/MCDataProducts/inc/StepPointMC.hh" #include "Offline/MCDataProducts/inc/SimParticle.hh" #include "Offline/MCDataProducts/inc/MCRelationship.hh" diff --git a/src/InfoStructHelper.cc b/src/InfoStructHelper.cc index f295ee0..0323b62 100644 --- a/src/InfoStructHelper.cc +++ b/src/InfoStructHelper.cc @@ -2,7 +2,7 @@ // Namespace for collecting tools used in TrkDiag tree filling // Original author: A. Edmonds (November 2018) // -#include "TrkAna/inc/InfoStructHelper.hh" +#include "EventNtuple/inc/InfoStructHelper.hh" #include "Offline/RecoDataProducts/inc/TrkStrawHitSeed.hh" #include "KinKal/Trajectory/CentralHelix.hh" #include "Offline/Mu2eKinKal/inc/WireHitState.hh" diff --git a/src/SurfaceStepInfo.cc b/src/SurfaceStepInfo.cc index 3e0ceed..ef73882 100644 --- a/src/SurfaceStepInfo.cc +++ b/src/SurfaceStepInfo.cc @@ -1,4 +1,4 @@ -#include "TrkAna/inc/SurfaceStepInfo.hh" +#include "EventNtuple/inc/SurfaceStepInfo.hh" #include "Offline/MCDataProducts/inc/SurfaceStep.hh" namespace mu2e { SurfaceStepInfo::SurfaceStepInfo (const SurfaceStep ss) : sid(ss.surfaceId().id().id()),sindex(ss.surfaceId().index()), time(ss.time()), edep(ss.energyDeposit()), diff --git a/src/classes.h b/src/classes.h index 8703357..bb9a7cd 100644 --- a/src/classes.h +++ b/src/classes.h @@ -1,30 +1,30 @@ -#include "TrkAna/inc/TrkStrawHitInfoMC.hh" -#include "TrkAna/inc/TrkStrawHitInfo.hh" -#include "TrkAna/inc/TrkStrawMatInfo.hh" -#include "TrkAna/inc/EventInfo.hh" -#include "TrkAna/inc/EventInfoMC.hh" -#include "TrkAna/inc/HelixInfo.hh" -#include "TrkAna/inc/HitCount.hh" -#include "TrkAna/inc/TrkCount.hh" -#include "TrkAna/inc/TrkInfo.hh" -#include "TrkAna/inc/TrkInfoMC.hh" -#include "TrkAna/inc/TrkSegInfo.hh" -#include "TrkAna/inc/LoopHelixInfo.hh" -#include "TrkAna/inc/CentralHelixInfo.hh" -#include "TrkAna/inc/KinematicLineInfo.hh" -#include "TrkAna/inc/SimInfo.hh" -#include "TrkAna/inc/MCStepInfo.hh" -#include "TrkAna/inc/MCStepSummaryInfo.hh" -#include "TrkAna/inc/TrkCaloHitInfo.hh" -#include "TrkAna/inc/EventWeightInfo.hh" -#include "TrkAna/inc/RecoQualInfo.hh" -#include "TrkAna/inc/CaloClusterInfoMC.hh" -#include "TrkAna/inc/CrvHitInfoReco.hh" -#include "TrkAna/inc/CrvHitInfoMC.hh" -#include "TrkAna/inc/CrvWaveformInfo.hh" -#include "TrkAna/inc/CrvPlaneInfoMC.hh" -#include "TrkAna/inc/CrvPulseInfoReco.hh" -#include "TrkAna/inc/CrvSummaryReco.hh" -#include "TrkAna/inc/CrvSummaryMC.hh" -#include "TrkAna/inc/MVAResultInfo.hh" -#include "TrkAna/inc/SurfaceStepInfo.hh" +#include "EventNtuple/inc/TrkStrawHitInfoMC.hh" +#include "EventNtuple/inc/TrkStrawHitInfo.hh" +#include "EventNtuple/inc/TrkStrawMatInfo.hh" +#include "EventNtuple/inc/EventInfo.hh" +#include "EventNtuple/inc/EventInfoMC.hh" +#include "EventNtuple/inc/HelixInfo.hh" +#include "EventNtuple/inc/HitCount.hh" +#include "EventNtuple/inc/TrkCount.hh" +#include "EventNtuple/inc/TrkInfo.hh" +#include "EventNtuple/inc/TrkInfoMC.hh" +#include "EventNtuple/inc/TrkSegInfo.hh" +#include "EventNtuple/inc/LoopHelixInfo.hh" +#include "EventNtuple/inc/CentralHelixInfo.hh" +#include "EventNtuple/inc/KinematicLineInfo.hh" +#include "EventNtuple/inc/SimInfo.hh" +#include "EventNtuple/inc/MCStepInfo.hh" +#include "EventNtuple/inc/MCStepSummaryInfo.hh" +#include "EventNtuple/inc/TrkCaloHitInfo.hh" +#include "EventNtuple/inc/EventWeightInfo.hh" +#include "EventNtuple/inc/RecoQualInfo.hh" +#include "EventNtuple/inc/CaloClusterInfoMC.hh" +#include "EventNtuple/inc/CrvHitInfoReco.hh" +#include "EventNtuple/inc/CrvHitInfoMC.hh" +#include "EventNtuple/inc/CrvWaveformInfo.hh" +#include "EventNtuple/inc/CrvPlaneInfoMC.hh" +#include "EventNtuple/inc/CrvPulseInfoReco.hh" +#include "EventNtuple/inc/CrvSummaryReco.hh" +#include "EventNtuple/inc/CrvSummaryMC.hh" +#include "EventNtuple/inc/MVAResultInfo.hh" +#include "EventNtuple/inc/SurfaceStepInfo.hh" From 0b522147bc1115d300ab2da00b4d02d51692c758 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:19:19 -0500 Subject: [PATCH 090/100] Update includes in fcl files and add script I've been using to validate that they successfully run --- doc/v5-to-v6.md | 6 ++ fcl/TrkAnaDeM.fcl | 2 +- fcl/TrkAnaDeMFromDigis.fcl | 4 +- fcl/TrkAnaLineFromDigis.fcl | 2 +- fcl/TrkAnaReflections.fcl | 2 +- fcl/TrkAnaTriggerMC.fcl | 2 +- fcl/TrkAnaTriggerMCFromDigis.fcl | 2 +- fcl/from_dig-mockdata.fcl | 2 +- fcl/from_mcs-ceSimReco.fcl | 2 +- fcl/from_mcs-extracted.fcl | 3 +- fcl/from_mcs-mixed.fcl | 2 +- fcl/from_mcs-mockdata.fcl | 2 +- fcl/from_mcs-mockdata_noMC.fcl | 2 +- fcl/from_mcs-mockdata_selectorExample.fcl | 2 +- fcl/from_mcs-mockdata_separateTrkBranches.fcl | 2 +- fcl/from_mcs-primary.fcl | 2 +- fcl/prolog.fcl | 2 +- fcl/prolog_trigger.fcl | 2 +- validation/test_fcls.sh | 95 +++++++++++++++++++ 19 files changed, 119 insertions(+), 19 deletions(-) create mode 100644 validation/test_fcls.sh diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 639e5d9..42e9ff8 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -32,6 +32,12 @@ Many fcl files were renamed, updated, or deleted. New fcl files introduced in v6 | TrkAnaExtracted.fcl | from_mcs-extracted.fcl | for running on mcs "extracted position" datasets, now #includes from_mcs-mockdata.fcl as a base | | TrkAnaReco_ceSimReco.fcl | from_mcs-ceSimReco.fcl | for running on the output of ceSimReco.fcl | | TrkAnaRecoEnsemble-Data.fcl | from_mcs-mockdata_noMC.fcl | for running on mock data with no MC information | +| TrkAnaDeM.fcl | only #includes updated | | +| TrkAnaDeMFromDigis.fcl | only #includes updated | | +| TrkAnaLineFromDigis.fcl | only #includes updated | | +| TrkAnaReflections.fcl | only #includes updated | | +| TrkAnaTrigger.fcl | only #includes updated | | +| TrkAnaTriggerFromDigis.fcl | only #includes updated | | | TrkAnaRecoEnsemble-MC.fcl | deleted | use from_mcs-mockdata.fcl instead| | TrkAnaReco_mergedKalSeeds.fcl | deleted | all track types in one branch is now the default | | CrvExpert.fcl | deleted | | diff --git a/fcl/TrkAnaDeM.fcl b/fcl/TrkAnaDeM.fcl index 011ae42..e0126ba 100644 --- a/fcl/TrkAnaDeM.fcl +++ b/fcl/TrkAnaDeM.fcl @@ -1,7 +1,7 @@ # Minimal job to run TrkAna on the 'best' downstream electrons. Runs on mcs files #include "Offline/fcl/minimalMessageService.fcl" #include "Offline/fcl/standardServices.fcl" -#include "TrkAna/fcl/prolog.fcl" +#include "EventNtuple/fcl/prolog.fcl" process_name: TADeM source : { module_type : RootInput } diff --git a/fcl/TrkAnaDeMFromDigis.fcl b/fcl/TrkAnaDeMFromDigis.fcl index b2413bf..cd56297 100644 --- a/fcl/TrkAnaDeMFromDigis.fcl +++ b/fcl/TrkAnaDeMFromDigis.fcl @@ -1,6 +1,6 @@ # Minimal job to reconstructed downstream electrons from digis and analyze the output with TrkAna # #include this script in a subscript which specifies the database (ie -##include "TrkAna/fcl/TrkAnaDeMFromDigis.fcl" +##include "EventNtuple/fcl/TrkAnaDeMFromDigis.fcl" #services.DbService.purpose: MDC2020_best #services.DbService.version: v1_3 #services.DbService.verbose : 2 @@ -9,7 +9,7 @@ #include "Offline/fcl/standardServices.fcl" #include "Production/JobConfig/reco/prolog.fcl" #include "Offline/Mu2eKinKal/fcl/prolog.fcl" -#include "TrkAna/fcl/prolog.fcl" +#include "EventNtuple/fcl/prolog.fcl" process_name: TADeMDigis source : { module_type : RootInput } diff --git a/fcl/TrkAnaLineFromDigis.fcl b/fcl/TrkAnaLineFromDigis.fcl index 9f3067e..b9970ac 100644 --- a/fcl/TrkAnaLineFromDigis.fcl +++ b/fcl/TrkAnaLineFromDigis.fcl @@ -4,7 +4,7 @@ #include "Offline/fcl/standardServices.fcl" #include "Production/JobConfig/reco/prolog.fcl" #include "Offline/Mu2eKinKal/fcl/prolog.fcl" -#include "TrkAna/fcl/prolog.fcl" +#include "EventNtuple/fcl/prolog.fcl" process_name: TALineDigis source : { module_type : RootInput } diff --git a/fcl/TrkAnaReflections.fcl b/fcl/TrkAnaReflections.fcl index 0a7ffd3..8abc7c4 100644 --- a/fcl/TrkAnaReflections.fcl +++ b/fcl/TrkAnaReflections.fcl @@ -2,7 +2,7 @@ #include "Offline/fcl/minimalMessageService.fcl" #include "Offline/fcl/standardServices.fcl" #include "Offline/TrkReco/fcl/prolog.fcl" -#include "TrkAna/fcl/prolog.fcl" +#include "EventNtuple/fcl/prolog.fcl" BEGIN_PROLOG TAR : { @table::EventNtupleMaker diff --git a/fcl/TrkAnaTriggerMC.fcl b/fcl/TrkAnaTriggerMC.fcl index c3a2fd2..7787131 100644 --- a/fcl/TrkAnaTriggerMC.fcl +++ b/fcl/TrkAnaTriggerMC.fcl @@ -2,7 +2,7 @@ # Run TrkAna on the output of the trigger, including MC truth matching # #include "Offline/fcl/standardServices.fcl" -#include "TrkAna/fcl/prolog_trigger.fcl" +#include "EventNtuple/fcl/prolog_trigger.fcl" process_name : TrkAnaTriggerMC services : @local::Services.Reco source : { diff --git a/fcl/TrkAnaTriggerMCFromDigis.fcl b/fcl/TrkAnaTriggerMCFromDigis.fcl index eecb61c..00eaa4c 100644 --- a/fcl/TrkAnaTriggerMCFromDigis.fcl +++ b/fcl/TrkAnaTriggerMCFromDigis.fcl @@ -5,7 +5,7 @@ #include "Offline/CommonMC/fcl/prolog_trigger.fcl" #include "Production/JobConfig/digitize/prolog.fcl" -#include "TrkAna/fcl/prolog_trigger.fcl" +#include "EventNtuple/fcl/prolog_trigger.fcl" #include "mu2e_trig_config/test/triggerTest.fcl" # # Add MC truth matching for the highP_stopTarg triggers diff --git a/fcl/from_dig-mockdata.fcl b/fcl/from_dig-mockdata.fcl index a649119..e7bd09c 100644 --- a/fcl/from_dig-mockdata.fcl +++ b/fcl/from_dig-mockdata.fcl @@ -2,7 +2,7 @@ #include "Offline/fcl/standardProducers.fcl" #include "Offline/fcl/standardServices.fcl" #include "Production/JobConfig/reco/prolog.fcl" -#include "TrkAna/fcl/prolog.fcl" +#include "EventNtuple/fcl/prolog.fcl" process_name : EventNtuple diff --git a/fcl/from_mcs-ceSimReco.fcl b/fcl/from_mcs-ceSimReco.fcl index 7ff0c9c..f668d1e 100644 --- a/fcl/from_mcs-ceSimReco.fcl +++ b/fcl/from_mcs-ceSimReco.fcl @@ -1,4 +1,4 @@ -#include "TrkAna/fcl/from_mcs-mockdata.fcl" +#include "EventNtuple/fcl/from_mcs-mockdata.fcl" physics.analyzers.EventNtuple.branches : [ @local::DeM ] physics.analyzers.EventNtuple.FillTriggerInfo : false diff --git a/fcl/from_mcs-extracted.fcl b/fcl/from_mcs-extracted.fcl index bae180d..39e9791 100644 --- a/fcl/from_mcs-extracted.fcl +++ b/fcl/from_mcs-extracted.fcl @@ -1,8 +1,7 @@ -#include "TrkAna/fcl/from_mcs-mockdata.fcl" +#include "EventNtuple/fcl/from_mcs-mockdata.fcl" physics.EventNtuplePath : [ @sequence::EventNtuple.PathExt ] # path for extracted position cosmics physics.analyzers.EventNtuple.branches : [ @local::Ext ] physics.analyzers.EventNtuple.FitType : KinematicLine services.GeometryService.inputFile: "Production/JobConfig/cosmic/geom_cosmic_extracted.txt" -services.TFileService.fileName: "nts.owner.trkanaextracted-reco.version.sequencer.root" diff --git a/fcl/from_mcs-mixed.fcl b/fcl/from_mcs-mixed.fcl index 3e3cfc7..bb9e297 100644 --- a/fcl/from_mcs-mixed.fcl +++ b/fcl/from_mcs-mixed.fcl @@ -1 +1 @@ -#include "TrkAna/fcl/from_mcs-primary.fcl" +#include "EventNtuple/fcl/from_mcs-primary.fcl" diff --git a/fcl/from_mcs-mockdata.fcl b/fcl/from_mcs-mockdata.fcl index 95c44b3..2c962e4 100644 --- a/fcl/from_mcs-mockdata.fcl +++ b/fcl/from_mcs-mockdata.fcl @@ -1,7 +1,7 @@ #include "Offline/fcl/minimalMessageService.fcl" #include "Offline/fcl/standardProducers.fcl" #include "Offline/fcl/standardServices.fcl" -#include "TrkAna/fcl/prolog.fcl" +#include "EventNtuple/fcl/prolog.fcl" process_name : EventNtuple diff --git a/fcl/from_mcs-mockdata_noMC.fcl b/fcl/from_mcs-mockdata_noMC.fcl index 1a8466e..f2c166a 100644 --- a/fcl/from_mcs-mockdata_noMC.fcl +++ b/fcl/from_mcs-mockdata_noMC.fcl @@ -1,4 +1,4 @@ -#include "TrkAna/fcl/from_mcs-mockdata.fcl" +#include "EventNtuple/fcl/from_mcs-mockdata.fcl" physics.analyzers.EventNtuple.FillMCInfo : false diff --git a/fcl/from_mcs-mockdata_selectorExample.fcl b/fcl/from_mcs-mockdata_selectorExample.fcl index bda991a..875738a 100644 --- a/fcl/from_mcs-mockdata_selectorExample.fcl +++ b/fcl/from_mcs-mockdata_selectorExample.fcl @@ -1,4 +1,4 @@ -#include "TrkAna/fcl/from_mcs-mockdata.fcl" +#include "EventNtuple/fcl/from_mcs-mockdata.fcl" # a simple selector is used here, but any selector implemented as a tool can be used physics.producers.MergeKKAll.Selector : { diff --git a/fcl/from_mcs-mockdata_separateTrkBranches.fcl b/fcl/from_mcs-mockdata_separateTrkBranches.fcl index 887ebdb..75330dc 100644 --- a/fcl/from_mcs-mockdata_separateTrkBranches.fcl +++ b/fcl/from_mcs-mockdata_separateTrkBranches.fcl @@ -1,4 +1,4 @@ -#include "TrkAna/fcl/from_mcs-mockdata.fcl" +#include "EventNtuple/fcl/from_mcs-mockdata.fcl" physics.analyzers.EventNtuple.branches : [ @local::DeM, @local::DeP, @local::UeM, @local::UeP, @local::DmuM, @local::DmuP, @local::UmuM, @local::UmuP ] diff --git a/fcl/from_mcs-primary.fcl b/fcl/from_mcs-primary.fcl index 340bd64..e9650a8 100644 --- a/fcl/from_mcs-primary.fcl +++ b/fcl/from_mcs-primary.fcl @@ -1,3 +1,3 @@ -#include "TrkAna/fcl/from_mcs-mockdata.fcl" +#include "EventNtuple/fcl/from_mcs-mockdata.fcl" physics.EventNtupleEndPath : [ @sequence::EventNtuple.EndPath ] # adds back genCountLogger diff --git a/fcl/prolog.fcl b/fcl/prolog.fcl index c5546a8..772c054 100644 --- a/fcl/prolog.fcl +++ b/fcl/prolog.fcl @@ -3,7 +3,7 @@ #include "Offline/CommonMC/fcl/prolog.fcl" #include "Offline/fcl/TrkCaloDt.fcl" -#include "TrkAna/fcl/prolog_mc_reweighters.fcl" +#include "EventNtuple/fcl/prolog_mc_reweighters.fcl" BEGIN_PROLOG # Track quality module diff --git a/fcl/prolog_trigger.fcl b/fcl/prolog_trigger.fcl index c4a7463..6609185 100644 --- a/fcl/prolog_trigger.fcl +++ b/fcl/prolog_trigger.fcl @@ -1,7 +1,7 @@ # # Special configuration base for running TrkAna on trigger fits # -#include "TrkAna/fcl/prolog.fcl" +#include "EventNtuple/fcl/prolog.fcl" BEGIN_PROLOG TrkAnaTrigger : { TrkAnaTT : { diff --git a/validation/test_fcls.sh b/validation/test_fcls.sh new file mode 100644 index 0000000..5f85b56 --- /dev/null +++ b/validation/test_fcls.sh @@ -0,0 +1,95 @@ +# +# test_fcls.sh - runs fcl files to make sure that they complete successfully +# Note: requires relevant filelists in a directory above this one +# + +log_file="test_fcls.log" +rm ${log_file} + +echo -n "from_mcs-mockdata.fcl... " +mu2e -c fcl/from_mcs-mockdata.fcl -S ../filelists/mcs.mu2e.ensemble-1BB-CEDIOCRYCosmic-2400000s-p95MeVc-Triggered.MDC2020ae_perfect_v1_3.art.list --TFileName nts.ntuple.mock.root -n 100 > ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi + +echo -n "from_mcs-mockdata_noMC.fcl... " +mu2e -c fcl/from_mcs-mockdata_noMC.fcl -S ../filelists/mcs.mu2e.ensemble-1BB-CEDIOCRYCosmic-2400000s-p95MeVc-Triggered.MDC2020ae_perfect_v1_3.art.list --TFileName nts.ntuple.mockNoMC.root -n 100 >> ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi + +echo -n "from_mcs-primary.fcl... " +mu2e -c fcl/from_mcs-primary.fcl -S ../filelists/mcs.mu2e.CeEndpointOnSpillTriggered.MDC2020ae_best_v1_3.art.list --TFileName nts.ntuple.primary.root -n 100 >> ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi + +echo -n "from_mcs-mixed.fcl... " +mu2e -c fcl/from_mcs-mixed.fcl -S ../filelists/mcs.mu2e.CeEndpointMix2BBTriggered.MDC2020ae_best_v1_3.art.list --TFileName nts.ntuple.mixed.root -n 100 >> ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi + +echo -n "from_mcs-extracted.fcl... " +mu2e -c fcl/from_mcs-extracted.fcl -S ../filelists/mcs.mu2e.CosmicCRYExtractedCatTriggered.MDC2020ae_best_v1_3.art.list --TFileName nts.ntuple.extracted.root -n 100 >> ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi + +echo -n "from_mcs-ceSimReco.fcl... " +mu2e -c fcl/from_mcs-ceSimReco.fcl -s mcs.owner.val-ceSimReco.dsconf.seq.art --TFileName nts.ntuple.ceSimReco.root >> ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi + +echo -n "from_mcs-mockdata_separateTrkBranches.fcl... " +mu2e -c fcl/from_mcs-mockdata_separateTrkBranches.fcl -S ../filelists/mcs.mu2e.ensemble-1BB-CEDIOCRYCosmic-2400000s-p95MeVc-Triggered.MDC2020ae_perfect_v1_3.art.list --TFileName nts.ntuple.mockSepTrkBranches.root -n 100 >> ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi + +echo -n "from_mcs-mockdata_selectorExample.fcl... " +mu2e -c fcl/from_mcs-mockdata_selectorExample.fcl -S ../filelists/mcs.mu2e.ensemble-1BB-CEDIOCRYCosmic-2400000s-p95MeVc-Triggered.MDC2020ae_perfect_v1_3.art.list --TFileName nts.ntuple.mockSelector.root -n 100 >> ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi + +echo -n "from_dig-mockdata.fcl... " +mu2e -c fcl/from_dig-mockdata.fcl -S ../filelists/dig.mu2e.ensemble-1BB-CEDIOCRYCosmic-2400000s-p95MeVc-Triggered.MDC2020ae_perfect_v1_3.art.list --TFileName nts.ntuple.dig.root -n 100 >> ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi + +echo -n "creating v6 file for validation script... " +mu2e -c fcl/from_mcs-mockdata.fcl -S ../filelists/mcs.mu2e.ensemble-1BB-CEDIOCRYCosmic-2400000s-p95MeVc-Triggered.MDC2020ae_perfect_v1_3.art.list --TFileName nts.ntuple.v6.root -n 100 >> ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi + +echo -n "creating validation file... " +root -l -b -q validation/create_val_file.C\(\"nts.ntuple.v6.root\",\"val.ntuple.v6.root\"\) >> ${log_file} 2>&1 +if [ $? == 0 ]; then + echo "OK" +else + echo "FAIL" +fi From 80a9265efb184790446aad825eefdf9bd6f210f3 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:22:26 -0500 Subject: [PATCH 091/100] Add to .gitignore --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index b25c15b..1465b61 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,9 @@ *~ +*.art +*.root +*.log +*.so +*.d +*.pcm +*__pycache__ +backing From 3c6737ec3bc48fc2563b449971f1cd29eb79d744 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:24:55 -0500 Subject: [PATCH 092/100] Updating ntuplehelper with new EventNtuple name --- doc/ntuplehelper.md | 4 ++-- utils/helper/ntuplehelper.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/ntuplehelper.md b/doc/ntuplehelper.md index 08300c7..d837b00 100644 --- a/doc/ntuplehelper.md +++ b/doc/ntuplehelper.md @@ -1,10 +1,10 @@ # How to get help -- ```ntuplehelper``` -On this page, you will learn how to use the [```ntuplehelper```](../../utils/ntuplehelper.py) utility to get more information about what the different branches and leaves are. You will need to be in a TrkAna environment e.g. +On this page, you will learn how to use the [```ntuplehelper```](../../utils/ntuplehelper.py) utility to get more information about what the different branches and leaves are. You will need to be in a EventNtuple environment e.g. ``` mu2einit -muse setup TrkAna +muse setup EventNtuple ``` You can use this utility: diff --git a/utils/helper/ntuplehelper.py b/utils/helper/ntuplehelper.py index ea0fbd5..c10b965 100644 --- a/utils/helper/ntuplehelper.py +++ b/utils/helper/ntuplehelper.py @@ -90,7 +90,7 @@ def whatis(self, array): if (".hh" not in struct_file): struct_file += ".hh" # print(struct_file) - with open(os.environ.get("TRKANA_INC")+"/TrkAna/inc/"+struct_file, 'r') as f: + with open(os.environ.get("EVENTNTUPLE_INC")+"/EventNtuple/inc/"+struct_file, 'r') as f: lines = f.readlines() for row in lines: if (row.find("// "+struct) != -1): From d79b545cf38f6f460d73859ab9701579b5df120b Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:36:34 -0500 Subject: [PATCH 093/100] Update rooutil with the new name + fix a couple of things --- utils/rooutil/draft.md | 2 +- utils/rooutil/examples/CreateTree.C | 4 ++-- utils/rooutil/examples/PlotEntranceMomentum.C | 4 ++-- utils/rooutil/examples/PrintEvents.C | 6 +++--- utils/rooutil/examples/TrackCounting.C | 4 ++-- utils/rooutil/inc/Event.hh | 6 +++--- utils/rooutil/inc/RooUtil.hh | 2 +- utils/rooutil/inc/Track.hh | 6 +++--- utils/rooutil/inc/TrackSegment.hh | 2 +- utils/rooutil/inc/common_cuts.hh | 16 ++++++++-------- validation/test_rooutil.sh | 6 +++--- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/utils/rooutil/draft.md b/utils/rooutil/draft.md index 728b9dd..080c23a 100644 --- a/utils/rooutil/draft.md +++ b/utils/rooutil/draft.md @@ -23,7 +23,7 @@ The currently supported branches are: ### Common Cut Functions -Here are the common cut functions defined in ```TrkAna/utils/rooutil/inc/common_cuts.hh``` with explanations: +Here are the common cut functions defined in ```EventNtuple/utils/rooutil/inc/common_cuts.hh``` with explanations: | function | cuts on | result | |----|----|----| diff --git a/utils/rooutil/examples/CreateTree.C b/utils/rooutil/examples/CreateTree.C index efd3537..2c63c55 100644 --- a/utils/rooutil/examples/CreateTree.C +++ b/utils/rooutil/examples/CreateTree.C @@ -3,8 +3,8 @@ // This uses cut functions defined in common_cuts.hh // -#include "TrkAna/utils/rooutil/inc/RooUtil.hh" -#include "TrkAna/utils/rooutil/inc/common_cuts.hh" +#include "EventNtuple/utils/rooutil/inc/RooUtil.hh" +#include "EventNtuple/utils/rooutil/inc/common_cuts.hh" #include "TH1F.h" diff --git a/utils/rooutil/examples/PlotEntranceMomentum.C b/utils/rooutil/examples/PlotEntranceMomentum.C index 739ee9b..7bdc78e 100644 --- a/utils/rooutil/examples/PlotEntranceMomentum.C +++ b/utils/rooutil/examples/PlotEntranceMomentum.C @@ -3,8 +3,8 @@ // This uses cut functions defined in common_cuts.hh // -#include "TrkAna/utils/rooutil/inc/RooUtil.hh" -#include "TrkAna/utils/rooutil/inc/common_cuts.hh" +#include "EventNtuple/utils/rooutil/inc/RooUtil.hh" +#include "EventNtuple/utils/rooutil/inc/common_cuts.hh" #include "TH1F.h" diff --git a/utils/rooutil/examples/PrintEvents.C b/utils/rooutil/examples/PrintEvents.C index 9b31063..7cf7152 100644 --- a/utils/rooutil/examples/PrintEvents.C +++ b/utils/rooutil/examples/PrintEvents.C @@ -1,10 +1,10 @@ -#include "TrkAna/utils/rooutil/inc/RooUtil.hh" -#include "TrkAna/utils/rooutil/inc/common_cuts.hh" +#include "EventNtuple/utils/rooutil/inc/RooUtil.hh" +#include "EventNtuple/utils/rooutil/inc/common_cuts.hh" #include bool good_track(const Track& track) { - if (track.trk->fitcon > 1e-3 && is_e_minus(track) && is_downstream(track)) { + if (track.trk->fitcon > 1e-3 && is_e_minus(track)) { return true; } else { diff --git a/utils/rooutil/examples/TrackCounting.C b/utils/rooutil/examples/TrackCounting.C index ddec7e9..9557498 100644 --- a/utils/rooutil/examples/TrackCounting.C +++ b/utils/rooutil/examples/TrackCounting.C @@ -1,5 +1,5 @@ -#include "TrkAna/utils/rooutil/inc/RooUtil.hh" -#include "TrkAna/utils/rooutil/inc/common_cuts.hh" +#include "EventNtuple/utils/rooutil/inc/RooUtil.hh" +#include "EventNtuple/utils/rooutil/inc/common_cuts.hh" #include diff --git a/utils/rooutil/inc/Event.hh b/utils/rooutil/inc/Event.hh index 2d154e1..5246a45 100644 --- a/utils/rooutil/inc/Event.hh +++ b/utils/rooutil/inc/Event.hh @@ -1,10 +1,10 @@ #ifndef Event_hh_ #define Event_hh_ -#include "TrkAna/inc/EventInfo.hh" -#include "TrkAna/inc/EventInfoMC.hh" +#include "EventNtuple/inc/EventInfo.hh" +#include "EventNtuple/inc/EventInfoMC.hh" -#include "TrkAna/utils/rooutil/inc/Track.hh" +#include "EventNtuple/utils/rooutil/inc/Track.hh" #include "TTree.h" diff --git a/utils/rooutil/inc/RooUtil.hh b/utils/rooutil/inc/RooUtil.hh index b3ca9b1..9837802 100644 --- a/utils/rooutil/inc/RooUtil.hh +++ b/utils/rooutil/inc/RooUtil.hh @@ -4,7 +4,7 @@ #include "TFile.h" #include "TTree.h" -#include "TrkAna/utils/rooutil/inc/Event.hh" +#include "EventNtuple/utils/rooutil/inc/Event.hh" class RooUtil { public: diff --git a/utils/rooutil/inc/Track.hh b/utils/rooutil/inc/Track.hh index 4475ae5..6edb301 100644 --- a/utils/rooutil/inc/Track.hh +++ b/utils/rooutil/inc/Track.hh @@ -2,10 +2,10 @@ #define Track_hh_ #include -#include "TrkAna/inc/TrkInfo.hh" -#include "TrkAna/inc/TrkSegInfo.hh" +#include "EventNtuple/inc/TrkInfo.hh" +#include "EventNtuple/inc/TrkSegInfo.hh" -#include "TrkAna/utils/rooutil/inc/TrackSegment.hh" +#include "EventNtuple/utils/rooutil/inc/TrackSegment.hh" struct Track { Track(mu2e::TrkInfo* trk, std::vector* trksegs, bool debug = false) : trk(trk), trksegs(trksegs), debug(debug) { diff --git a/utils/rooutil/inc/TrackSegment.hh b/utils/rooutil/inc/TrackSegment.hh index 2b0ef4d..a24b945 100644 --- a/utils/rooutil/inc/TrackSegment.hh +++ b/utils/rooutil/inc/TrackSegment.hh @@ -2,7 +2,7 @@ #define TrackSegment_hh_ #include -#include "TrkAna/inc/TrkSegInfo.hh" +#include "EventNtuple/inc/TrkSegInfo.hh" struct TrackSegment { TrackSegment(mu2e::TrkSegInfo* trkseg) : trkseg(trkseg) { } diff --git a/utils/rooutil/inc/common_cuts.hh b/utils/rooutil/inc/common_cuts.hh index d95c840..23952dc 100644 --- a/utils/rooutil/inc/common_cuts.hh +++ b/utils/rooutil/inc/common_cuts.hh @@ -6,8 +6,8 @@ #ifndef common_cuts_hh_ #define common_cuts_hh_ -#include "TrkAna/utils/rooutil/inc/Track.hh" -#include "TrkAna/utils/rooutil/inc/TrackSegment.hh" +#include "EventNtuple/utils/rooutil/inc/Track.hh" +#include "EventNtuple/utils/rooutil/inc/TrackSegment.hh" // Track Particle Types bool is_e_minus(const Track& track) { @@ -31,7 +31,7 @@ bool is_mu_plus(const Track& track) { } // Track Segment Directions -bool is_downstream(const TrackSeg& track_seg) { +bool is_downstream(const TrackSegment& segment) { // the sign of p_z tells us whether this segment is going upstream or downstream if (segment.trkseg->mom.z() > 0) { return true; @@ -39,7 +39,7 @@ bool is_downstream(const TrackSeg& track_seg) { else { return false; } } -bool is_upstream(const TrackSeg& track_seg) { +bool is_upstream(const TrackSegment& segment) { // the sign of p_z tells us whether this segment is going upstream or downstream if (segment.trkseg->mom.z() < 0) { return true; @@ -71,12 +71,12 @@ bool tracker_exit(const TrackSegment& segment) { bool is_reflected(const Track& track) { bool have_upstream = false; bool have_downstream = false; - for (const auto& track_seg : track.segments) { - if (track_entrance(track_seg)) { - if (is_upstream(track_seg)) { + for (const auto& segment : track.segments) { + if (tracker_entrance(segment)) { + if (is_upstream(segment)) { have_upstream = true; } - if (is_downstream(track_seg)) { + if (is_downstream(segment)) { have_downstream = true; } } diff --git a/validation/test_rooutil.sh b/validation/test_rooutil.sh index 1349fbb..3aee895 100644 --- a/validation/test_rooutil.sh +++ b/validation/test_rooutil.sh @@ -1,3 +1,3 @@ -root -l -b -q TrkAna/utils/rooutil/examples/PrintEvents.C++\(\"nts.trkana.v6.root\"\) -root -l -b -q TrkAna/utils/rooutil/examples/PlotEntranceMomentum.C++\(\"nts.trkana.v6.root\"\) -root -l -b -q TrkAna/utils/rooutil/examples/CreateTree.C++\(\"nts.trkana.v6.root\"\) +root -l -b -q utils/rooutil/examples/PrintEvents.C++\(\"nts.ntuple.v6.root\"\) +root -l -b -q utils/rooutil/examples/PlotEntranceMomentum.C++\(\"nts.ntuple.v6.root\"\) +root -l -b -q utils/rooutil/examples/CreateTree.C++\(\"nts.ntuple.v6.root\"\) From 6175bba5cb3ec92dfc487771bc71fc1161e33b0e Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:52:40 -0500 Subject: [PATCH 094/100] Add instructions for upgrading --- README.md | 10 ++++++---- doc/v5-to-v6.md | 4 +++- doc/v5-to-v6_developers.md | 9 +++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 doc/v5-to-v6_developers.md diff --git a/README.md b/README.md index 5116020..c06833c 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,13 @@ Both of these are currently undergoing rapid development. Feel free to use these Validation scripts and instructions are [here](validation/README.md) ## Previous Versions -The version history of EventNtuple is [here](https://mu2ewiki.fnal.gov/wiki/TrkAna#Version_History_.2F_TrkAna_Musings). -* Special Note: there were major changes going from v5 to v6 and so we have provided a [list of v5 --> v6 changes](doc/v5-to-v6.md) for those with analysis scripts that ran on v5 ntuples +The version history of EventNtuple is [here](https://mu2ewiki.fnal.gov/wiki/EventNtuple). + +### Upgrading from v5 to v6 +* For analyzers: a list of branch/leaf/name changes is [here](doc/v5-to-v6.md) +* For developers: instructions to update your development area are [here](doc/v5-to-v6_developers.md) ## Other Useful Links -* [Mu2eWiki page](https://mu2ewiki.fnal.gov/wiki/TrkAna) +* [Mu2eWiki page](https://mu2ewiki.fnal.gov/wiki/EventNtuple) * [tutorial](tutorial/README.md) -* [instructions for developers](https://mu2ewiki.fnal.gov/wiki/TrkAna#For_Developers) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index 42e9ff8..aa06b23 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -1,6 +1,8 @@ # Major Changes from v5 to v6 -There was a major update when we moved from v5 to v6. Here are tables of changes for you to consult. Note that the same change may appear in multiple tables since it may be important in one area but defined in another. For example, the folder name is defined in fcl but is also important to know in the Tree / Branch / Leaf Changes +There was a major update when we moved from v5 to v6. Here are tables of changes for you to consult. Note that the same change may appear in multiple tables since it may be important in one area but defined in another. For example, the folder name is defined in fcl but is also important to know in the Tree / Branch / Leaf Changes. + +Instructions for developers to upgrade their development areas are [here](doc/v5-to-v6_developers.md) ## Tree / Branch / Leaf Changes | | v5 | v6 | Notes | diff --git a/doc/v5-to-v6_developers.md b/doc/v5-to-v6_developers.md new file mode 100644 index 0000000..209bdcc --- /dev/null +++ b/doc/v5-to-v6_developers.md @@ -0,0 +1,9 @@ +# Updating your TrkAna v5 area to an EventNtuple v6 area + +From your working directory: + +``` +mv TrkAna/ EventNtuple/ +cd EventNtuple/ +git remote set-url mu2e https://github.com/Mu2e/EventNtuple +``` From 247e117f1e7e65d91da7380060ac7cc2cf556df4 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:53:28 -0500 Subject: [PATCH 095/100] Fix link --- doc/v5-to-v6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/v5-to-v6.md b/doc/v5-to-v6.md index aa06b23..1ffb1e7 100644 --- a/doc/v5-to-v6.md +++ b/doc/v5-to-v6.md @@ -2,7 +2,7 @@ There was a major update when we moved from v5 to v6. Here are tables of changes for you to consult. Note that the same change may appear in multiple tables since it may be important in one area but defined in another. For example, the folder name is defined in fcl but is also important to know in the Tree / Branch / Leaf Changes. -Instructions for developers to upgrade their development areas are [here](doc/v5-to-v6_developers.md) +Instructions for developers to upgrade their development areas are [here](v5-to-v6_developers.md) ## Tree / Branch / Leaf Changes | | v5 | v6 | Notes | From 6ebae4b868220e6f63bd690a5cc75f6136d2b315 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:54:48 -0500 Subject: [PATCH 096/100] Adding more instructions --- doc/v5-to-v6_developers.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/v5-to-v6_developers.md b/doc/v5-to-v6_developers.md index 209bdcc..8dcc44d 100644 --- a/doc/v5-to-v6_developers.md +++ b/doc/v5-to-v6_developers.md @@ -1,9 +1,14 @@ # Updating your TrkAna v5 area to an EventNtuple v6 area -From your working directory: +From your working directory before doing ```muse setup```: ``` mv TrkAna/ EventNtuple/ cd EventNtuple/ git remote set-url mu2e https://github.com/Mu2e/EventNtuple +cd ../ +rm -rf build/XXX/ # if you like +mu2einit +muse setup +muse build -j4 --mu2eCompactPrint ``` From ac8116baba1c4440158b94aa302825f563840226 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:57:50 -0500 Subject: [PATCH 097/100] Update developers instructions --- doc/v5-to-v6_developers.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/v5-to-v6_developers.md b/doc/v5-to-v6_developers.md index 8dcc44d..3fc5279 100644 --- a/doc/v5-to-v6_developers.md +++ b/doc/v5-to-v6_developers.md @@ -1,10 +1,13 @@ # Updating your TrkAna v5 area to an EventNtuple v6 area +Rename your own fork on GitHub. Go to settings and change the repository name under "General" + From your working directory before doing ```muse setup```: ``` mv TrkAna/ EventNtuple/ cd EventNtuple/ +git remote set-url origin git@github.com/YourUsername/EventNtuple git remote set-url mu2e https://github.com/Mu2e/EventNtuple cd ../ rm -rf build/XXX/ # if you like @@ -12,3 +15,4 @@ mu2einit muse setup muse build -j4 --mu2eCompactPrint ``` + From ff96d6255c693e690be0190bf8a0681bf4f8abf8 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:58:30 -0500 Subject: [PATCH 098/100] Add a change to test pushing to renamed repo --- doc/v5-to-v6_developers.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/v5-to-v6_developers.md b/doc/v5-to-v6_developers.md index 3fc5279..635568b 100644 --- a/doc/v5-to-v6_developers.md +++ b/doc/v5-to-v6_developers.md @@ -13,6 +13,7 @@ cd ../ rm -rf build/XXX/ # if you like mu2einit muse setup + muse build -j4 --mu2eCompactPrint ``` From edc3f31c392c0ca26adb1479a0be14c015267756 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:58:38 -0500 Subject: [PATCH 099/100] Undo that change --- doc/v5-to-v6_developers.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/v5-to-v6_developers.md b/doc/v5-to-v6_developers.md index 635568b..3fc5279 100644 --- a/doc/v5-to-v6_developers.md +++ b/doc/v5-to-v6_developers.md @@ -13,7 +13,6 @@ cd ../ rm -rf build/XXX/ # if you like mu2einit muse setup - muse build -j4 --mu2eCompactPrint ``` From 000adeaaf41c9b4c44d178a58843a5a1badf19b6 Mon Sep 17 00:00:00 2001 From: Andrew Edmonds Date: Mon, 14 Oct 2024 10:59:18 -0500 Subject: [PATCH 100/100] Make fix to instructions --- doc/v5-to-v6_developers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/v5-to-v6_developers.md b/doc/v5-to-v6_developers.md index 3fc5279..8733c73 100644 --- a/doc/v5-to-v6_developers.md +++ b/doc/v5-to-v6_developers.md @@ -7,7 +7,7 @@ From your working directory before doing ```muse setup```: ``` mv TrkAna/ EventNtuple/ cd EventNtuple/ -git remote set-url origin git@github.com/YourUsername/EventNtuple +git remote set-url origin git@github.com:YourUsername/EventNtuple git remote set-url mu2e https://github.com/Mu2e/EventNtuple cd ../ rm -rf build/XXX/ # if you like