ClusterSearcher and RecoCluster#365
Conversation
…ClusterFinder's corresponding functions --Added some extra features, such as hit LAPPD count and strip-by-strip LAPPD hits. -Added ClusterSearcher to replace ClusterFinder using RecoDigit and RecoCluster classes -Updated RecoDigit and RecoCluster classes for corresponding use and new features, such as various cluster parameters -Added NeutronCheck tool as output for RecoCluster information -Added sample toolchain configfolder for using the new tools
| //} | ||
| } | ||
| } | ||
| //FIXME: Need a method to have the 123 be equal to the number of operating detectors |
| LappdNumStrips 60 ## num channels to construct from each LAPPD | ||
| LappdStripLength 100 ## relative x position of each LAPPD strip, for dual-sided readout [mm] | ||
| LappdStripSeparation 10 ## stripline separation, for calculating relative y position of each LAPPD strip [mm] | ||
| PMTMask configfiles/BeamClusterAnalysisMC/DeadPMTIDs_p2v7.txt ## Which PMTs should be masked out? / are dead? |
There was a problem hiding this comment.
You can point to the most up to date path configfiles/LoadWCSim/DeadPMTIDs_p2v7.txt
| if (!fisMC){ | ||
| int pmtid = recoDigit->GetDetectorID(); | ||
| unsigned long chankey = pmt_tubeid_to_channelkey[pmtid]; | ||
| if (pmt_gains[chankey]>0) qep/=pmt_gains[chankey]; |
There was a problem hiding this comment.
In line 77 (m_variables.Get("SinglePEGains",singlePEgains);) you grab the SPE gains from the gains file then use it to convert from nQ --> pe for data. It doesn't look like you ever specify the gains file in the Config file. Could you add it to ClusterSearcherConfig? Alternatively you can grab that directly from the Store since the LoadGeometry tool populates it for downstream tools (like this one) to use. See PhaseIITreeMaker for an example.
There was a problem hiding this comment.
The current configuration in the provided toolchain is for use on MC simulations, which do not require the conversion. So this variable is not necessary within the configuration. I will add it to the readme file.
Though as I start looking at Data in the next couple of weeks, I'll likely move into taking the gains from the store in the next update to this tool. Thank you for the suggestion.
| if(fMCParticles->at(i).GetPdgCode()==2112 && fMCParticles->at(i).GetParentPdg()==0) { | ||
| fTrueNeutronMult++; | ||
|
|
||
| if(fMCParticles->at(i).GetStopTime()>10000) fTrueNeutronDelayed++; |
There was a problem hiding this comment.
It might be wise to make this a configurable variable in case someone needs to look for neutrons in a different region of interest. Especially considering 10us is used extensively throughout the code.
| //true_Emu*=1000; //GeV->MeV to match other energies(unneeded, possibly) | ||
|
|
||
| double theta = truevtx->GetDirection().GetTheta(); | ||
| double p = sqrt(pow(true_Emu,2)-pow(105.7,2)); |
There was a problem hiding this comment.
@jminock is there a way to grab the momentum and Q^2 from the Store? I thought the LoadGenieEvent tool will store those values for use.
There was a problem hiding this comment.
There absolutely is via: m_data->Stores["GenieInfo"]->Get("EventQ2",TrueQ2). Magnitude of muon momentum is not saved to the Store so this is the intended method to get the true muon momentum
jminock
left a comment
There was a problem hiding this comment.
Please make the changes listed. I worry with the large number of pointers if memory is being handled properly. I don't know how necessary all of the pointers are, and I am not enough of an expert on it to make a certain statement. I recommend double checking all are fitting general best practice before this gets sent off to Level 0 review
| } | ||
|
|
||
| if (!fisMC){ | ||
| ifstream file_singlepe(singlePEgains.c_str()); |
There was a problem hiding this comment.
recommend adding a check file_singlepe.is_open() to catch typos in filename.
| // =================== | ||
| for(int idigit=0; idigit<int(fSelectByNeighbours->size()); idigit++ ){ | ||
| RecoDigit* recoDigit = (RecoDigit*)(fSelectByNeighbours->at(idigit)); | ||
| RecoClusterDigit* clusterDigit = new RecoClusterDigit(recoDigit); |
There was a problem hiding this comment.
why do the digits need to be on the heap?
| if (verbosity > 3) std::cout << line << std::endl; //has our stuff; | ||
| if (line.find("#") != std::string::npos) continue; | ||
| std::vector<std::string> DataEntries; | ||
| boost::split(DataEntries, line, boost::is_any_of(","), boost::token_compress_on); |
There was a problem hiding this comment.
i think token_compress_on merges repeated tokens? Is this desirable? If there are repeated tokens, doesn't this suggest an empty column, and by compressing that, your later columns will be shifted?
-Changed RecoCluster and RecoDigit lists in several tools to be vectors of objects, rather than vectors of pointers, to avoid memory complications -removed unused convex hull function from RecoCluster class -simplified CalcAS function in RecoCluster class by consolidating for loops -removed several instances of commented-out code from older versions -removed several debug outputs -altered hard-coded time window values in several instances to rely on configuration input -added use of the true Q2 value from the GenieInfo store to NeutronCheck's output. -removed several uncontrolled cout lines, and replaced useful ones with Log. -Tidied the Instance() function of ClusterSearcher -Added vertex information to NeutronCheck
|
Thank you @flemmons for the updates! Unfortunately, this branch has conflicts with the main branch that must be resolved in order to be merged. I will wait for the conflicts to be resolved and for the workflow check to be performed such that ToolAnalysis is confirmed to compile before I review the actual changes to the files |
|
Conflicts were just Factory and Unity listing different added tools. I've cleared them. |
|
Okay, but could you still resolve those conflicts? Also, it's great that ToolAnalysis can compile in your workspace, but it would be better to get confirmation that ToolAnalysis can compile in a general workspace (on GitHub via workflow). Given that this PR is self contained, there is no reason to not resolve these conflicts. I will look at the other files in the meantime. |
| //} | ||
| } | ||
| //FIXME: Need a method to have the 123 be equal to the number of operating detectors | ||
| double ucharge_balance = sqrt((total_QSquared) / (total_Q * total_Q) - (1. / 123.)); |
There was a problem hiding this comment.
123 is a magic number. While it doesn't impact functionality for now, it can be troublesome for documentation and updating it. What does 123 represent? What is an "operating detector"?
jminock
left a comment
There was a problem hiding this comment.
Please address all the comments. I left some that are more general questions that would be nice to have accessible documentation addressing, and shouldn't be an issue to create. There are some comments that ask about memory. Please address them as they do impact functionality
… nor memory-safe with recent changes to RecoDigit storage.
jminock
left a comment
There was a problem hiding this comment.
Enough comments have been addressed such that any remaining comments are specific to this analysis. I think this is in good enough shape to merge so other neutron analyzers have access to these Tools to further their development.
|
It would be helpful to 'resolve' those comments that have been addressed to make it clearer for reviewers what is still outstanding, without having to go back through the code again. I'm not sure I agree that the remaining issues are all analysis-specific.
|
|
regarding this discussion on the output file from NeutronCheck, I'm inclined to agree with Franklin. Generating debug files is no bad thing - it allows focused validation and debugging, without polluting general-purpose analysis outputs. Unless these variables are likely to be useful for analysis, I would keep them where they are. |
|
I don't mean to add further issues, and this is probably not the right place for it, but I can't help but notice that:
all have a config variable |
…ctorConfig -removed unhelpful forced loop end from single-pe gains extraction in ClusterSearcher::Initialize() -changed Genie version in ClusterSearcher/LoadGenieEventConfig to 1
|
Regarding these [https://github.com//pull/365#issuecomment-4000879256] : |
-replaced all instances of fClusterList with fRecoClusters in ClusterSearcher -changed ClusterSearcher::RecoClusters() to a void function, since it was returning a member pointer to itself -removed ClusterSearcher::SelectByClusters(), which is not used
|
Thanks for the updates Franklin. That's got the vast majority of comments resolved, i think we're very nearly there. The only one I'm still somewhat reticent to ignore is the '123' constant in the charge balance calculations. While applying run-wise bad channel masking would be ideal, I'd still much prefer leaving that as a TODO but still fetching the value from geometry over hard-coding it. It feels like the distinction between "this is a simplification" and "this is sloppy", and it should be trivial to implement. Aside from that it seems like there's a compilation error flagged by the latest CI build: |
|
Reply on slack:
Ok, if it's got motivation and precedent, that's good enough for me. 👍 |
-Updated DigitBuilder to be more consistent with and independent of ClusterFinder's corresponding functions
--Added some extra features, such as hit LAPPD count and strip-by-strip LAPPD hits. (some of these are considered experimental/preliminary)
-Added ClusterSearcher to replace ClusterFinder using RecoDigit and RecoCluster classes
-Updated RecoDigit and RecoCluster classes for corresponding use and new features, such as various cluster parameters
-Added NeutronCheck tool as output for RecoCluster information
-Added sample toolchain configfolder for using the new tools