Closed cameronc137 closed 5 years ago
See https://github.com/JeffersonLab/remoll/tree/feature-pe-analyzer for an example of this code in action
To utilize this code simply do the same cmake .. ; make ; ./remoll -m <some macro>
Then to use this program execute ./pe <rootfile> <detector number (probably 28 is a good one to try)>
you were missing the dictionary for the std
Thanks Ciprian, that fixed it and my script works now.
This is one output I get, which I think is supposed to be histogramming the number of PEs on the cathode per event
Because I don't have the quartz tile wrapped in a photon blocking material all of the photons generated in the air propagate into the quartz and up the light guide... or at least that is my theory. This plot was made with the external generator re-shooting the moller ring 5 flux at the detector.
Just for completeness: I fixed more issues in my analysis code (trees were growing without bound because I never cleared the vectors I was storing the intermediate values in...)
The result of 1000 11 GeV electrons directly on the quartz:
But I need to do a bit more work to get the detector attribution to work correctly (only 1% of hits are counting as "quartz" hits, event though 1000 of them are).
In terms of the actual issue at hand, I can confidently say I know how to include an analysis executable into the remoll compilation scheme now, and I can write up a bit of a guide to help other people do the same, but this is only the case for adding it directly into the CMake file (the sources and headers can be tucked away in the analysis directory out of sight).
Suggestion:
This may not be a big issue if we don't mind having the CMakeLists.txt file grow as a function of time, and we may even be able to add a feature where the standard cmake .. ; make ;
procedure ignores anything other than the primary remoll executable, etc. and then if we give a special flag at the cmake or make command to have it compile the others (one at a time or all together).
I do think it is important to have an official and documented way of making executable data analysis programs, because after the change of the IO structure to use remoll specific classes instead of just long arrays it now requires some significant amount of effort and C++ knowledge to make this work, and the benefits to having git-tracked and naturally updated and recompiled analysis scripts are quite substantial.
I got compilation to work in standalone mode, but it needs a copy of a previously compiled libremoll.so to be handy to work.
Not a bad trade off I guess. I'll go ahead and commit it and push. And I'll document what I did so other people can copy it tomorrow.
I have made an attempt to include what I've learned over the last few days and months in a new readme section: see https://github.com/JeffersonLab/remoll/commit/867c43f1d53c6a79830bcce89e9a922bcebf81f1
Am I wrong in any of what I have said there? I only vaguely understand the CMakeLists.txt description I gave, and if anyone has more or better examples of root analysis techniques please add them in too.
I've put this all into a branch feature-cmake-analysis-in-subproject for testing but I haven't updated the docs yet. Essentially all subdirectories in analysis
that are added to the CMakeLists.txt there will be included in default compilation from the top level. They will also get install as binaries wherever binaries are held. No copying of headers needed.
Ok, I think I fixed it (it definitely works now, and I only made a few minor edits). And now it should be obvious how to add your own analysis sub-projects by just copying the contents of the /pe/ folder and changing the name.
I think with the lowercase Findremoll it won't set the variables to the correct values for installs to e.g. /usr/local/remoll/v2.1/ etc. That's likely going to be needed in the future.
I see. Probably this is fixed by https://github.com/JeffersonLab/remoll/commit/5bdbca83c5eb6cd4e69b2f32ee0e1bc1da145340 in #164
I don't think so (even without the capitalization mismatch). The point of FindPackage is to give paths of installed binaries and resource files to use in other projects. In that sense the top-level CMakeLists.txt should not include find_package anything except for ROOT and Geant4 etc. We can/should however include find_package(remoll) in the analysis scripts. Probably that means we will have to use a different CMakeLists.txt, maybe just in the pe and hallRad directories, not in top level.
Oh dear. That sub-level CMakeLists would still need to point to a pre-existing libremoll.so, and I would probably use the same kind of point-to-remoll binary directory for that there too. Is there a way for CMake to ask the user for input - like to ask what version of remoll you want, with the default just-press-enter result being whatever the newest one is?
There are -D flags, but those shouldn't be necessary. Default should work without requiring that input.
The question is really whether you can realistically expect a set of analysis scripts to find a remoll binary without it being in the search path... The only thing we can do is just hard-code a ../../build but it may be even better if we just encourage everyone to run make install
after compilation so that stuff ends up in ~/bin or /usr/local/bin. From there we can just rely on having remoll-config
in the search path.
(With the minor detail that FindRemoll.cmake isn't installed anywhere yet.)
This is resolved in #164 (though the readme now needs to be updated to describe all of the new CMakeLists.txt requirements and the fact that make install
is needed and where things get installed to)
Environment: (where does this bug occur, have you tried other environments)
Steps to reproduce: (give a step by step account of how to trigger the bug)
Expected Result: (what do you expect when you execute the steps above)
In an effort to write an analysis executable capable of counting PEs on a cathode for an electron that may hit several detectors I have written a (modified one of Ciprian's) script. In this I have defined some struct's in analogy with the remolltypes.hh struct's that I would like to be branches in a remoll-agnostic resulting analysis tree. I expect for this analyzer to read a remoll-output .root file and make a new root file with branches corresponding to these new structs with the analyzed data in them.
Actual Result: (what do you get when you execute the steps above)
However, when I compile (successfully) and execute the script it fails to work, giving an error. `[cameronc@mocha out_refTest_2deg]$ ./pruneTreePE remollout_r5o_external_refTest_2deg.root 50001 Running with file=remollout_r5o_external_refTest_2deg.root, detid=50001 Error in: The pointer specified for catpes is not of a class known to ROOT
Error in : The pointer specified for q is not of a class known to ROOT
Error in : The pointer specified for ref is not of a class known to ROOT
Error in : The pointer specified for refx is not of a class known to ROOT
Error in : The pointer specified for refair is not of a class known to ROOT
Error in : The pointer specified for lg is not of a class known to ROOT
Error in : The pointer specified for lgair is not of a class known to ROOT
Error in : The pointer specified for pmtcat is not of a class known to ROOT
Error in : The pointer specified for pmtbulk is not of a class known to ROOT
Error in : The pointer specified for else is not of a class known to ROOT
0/500 - 0%**
Tree :T : Tree of detector hits
Entries : 0 : Total = 334 bytes File Size = 202
` And the final number of entries should be well above 0.
General Concern
It is not very clear how to use libremoll.so in subsequent analysis scripts, but it is very powerful when used correctly. Additionally, it is no clear how to include new analysis executables or non-remoll structs/classes into the cmake ..; make compilation scheme, but I know it is possible and powerful as well. Is there some resource I can use to learn more about these, and can we link/summarize that in the readme or wiki somewhere?