-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve LAPPD data monitoring #319
base: online_monitoring
Are you sure you want to change the base?
Improve LAPPD data monitoring #319
Conversation
- We were previously summing all of the points recorded in PPS accumulated number vector, resulting in an exponential graph, which is incorrect. We now sum only the previous number - which creates a meaningful graph.
- ROOT handles it anyway if the numbers get too big, so we don't need to do it
- turns out i didn't need to store some of the properties in vectors, as entries kind of do the same
- `MonitorLAPPDData` also reads `LAPPD_ID` from `LAPPDTemp` now
Hi Furkan.
are not deleted.
Considering that the monitoring code should, in theory, run 24/7 for potentially months on end, memory leaks are a real problem. Using the stack is much easier than using valgrind. :)
and subsequently seem to have two vectors acting as one of keys and one of values? I'm not sure where this idea came from - ROOT has supported nearly all standard containers, including maps, since ROOT 6 (and even ROOT 5 could do so with a little help from a dictionary). So this seems like an unnecessary complication.
I'm not sure why you get a variable into a string, only to cast the string to a number. The CStore (an instance of BoostStore) uses the streamer operator (
|
bc96727
to
3f33a9d
Compare
Hi Marcus. Thanks a lot for your comments on the PR. So far, I've fixed/refactored most of the things you've pointed up, except:
I'll be posting an update again when I implement the rest and the PF# vs Data Event Count plot. Thanks again, and have a nice one. |
ok, that's a shame about ROOT not supporting
you need
the extra variable is a pain, i know, but c'est la ROOT. :(
for example, this would segfault if |
Wouldn't just using |
I'll be honest that I didn't go through the code well enough to know that the files are only used as temporary storage. That's generally not good practice, but simply swapping TFile to BoostStores would be more complicated than you think. So I think sticking with the file for now is fine. If performance were an issue, you could make a RAMdisk and put the TFile there, so that in effect it remains in RAM, but i'm not sure that's a concern for us. |
If you wanted to move to BoostStores it would be better to just drop the ROOT classes and store the underlying data. A histogram is really just a pair of arrays - one of bin edges and one of contents. A TGraph is likewise a pair of x and y arrays. stl containers such as std::vector are natively supported by BoostStores, so you could store those arrays and reconstruct the ROOT object if/when needed. |
TH1F, TGraph and other plots are constructed after we take the data in ( // ...
std::vector<ULong64_t> *t_time = new std::vector<ULong64_t>;
if (f->GetListOfKeys()->Contains("lappddatamonitor_tree")) {
// ...
t->SetBranchAddress("t_start", &t_time);
} else {
// ...
t->Branch("t_start", &t_time);
}
t->Write("", TObject::kOverwrite); to /*
typechecking=false, type=2=multievent
(almost every allocation in the codebase uses
these params)
*/
BoostStore data(false, 2);
if (/* file exists */) {
data.Initialise(/* file */);
}
std::vector<ULong64_t> t_time;
data.Set("t_start", t_time);
data.Save(/* file */);
/* Similar to ROOT, each save in BoostStore creates an entry that
we can iterate later when reading the file */ could work. One question I have is that most of the codebase allocates |
There would be no problem putting a BoostStore on the stack. I'm pretty sure nothing in c++ will ever function differently on the heap vs the stack, that's just part of the language.
is technically undefined behaviour (potentially even crashing the program depending on the types involved), and will result in garbage in
The code you have may work (i'm honestly not sure off the top of my head if you can re-open and append to multi-entry BoostStores, perhaps you can...), but in any case I don't think there would be much if any benefit compared to just moving the ROOT objects to the heap. |
:) Though if you are going to go the ROOT way, make sure you sort your branch addresses out. Your last example again passes the same variable to |
I've refactored the code as we've discussed for both reading from and writing to ROOT and it now works without a problem |
This PR improves LAPPD data monitoring capabilities of ToolAnalysis. It primarily:
ParseDataMonitoring
to handle additional data that is needed by new plotsLast histogram is still work in progress, so I am currently planning to move this PR out of draft when I'm done with it.