Project

General

Profile

Feature #1921

Cuts in MAUS Processing

Added by Rogers, Chris over 6 years ago. Updated over 5 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
21 March 2017
Due date:
% Done:

50%

Estimated time:
Workflow:
New Issue

Description

It is desirable to enable cuts as an output of the MAUS processing:

  • Add a "Cuts" object to the recon event
  • Add a mapper that generates a standard set of cuts
  • Add a reducer that plots the data showing effect of cuts

Files

example_load_root_file.root (598 KB) example_load_root_file.root Rogers, Chris, 16 June 2017 15:12
application_test.log (133 KB) application_test.log Error raised when plotting TOF histograms, reason why cut data structure fails a MAUS build state Fedorov, Misha, 03 November 2017 09:24
install.log (343 KB) install.log failed build output (after fixing MapCppCuts issue) Fedorov, Misha, 06 November 2017 17:24

Related issues

Related to MAUS - Feature #1948: MapCppCuts UpgradeIn ProgressKurup, Ajit11 January 2018

Actions
#1

Updated by Rogers, Chris over 6 years ago

The Cuts object is the main interface for analysts to access information about whether an event should be included in an analysis. It should be a C++ class. Should have the option to do a cuts lookup based on either an integer index that indexes the cut variable or a string that names the cut variable.

Use Case

I want to understand if my event falls within a particular cut, say a TOF01 cut which isolates events in the muon peak. I don't want to do the actual cut myself - so instead I want to check against some pre-existing set of cuts. The Cuts object will store all of the Cuts in the MAUS data structure so after the reconstruction an analyst can do a lookup against the Cuts object to decide whether or not the event was in the muon peak.

This entry only describes the object that stores the data. The actual algorithm to apply the cuts is done elsewhere.

Containing the following:

public

  • Default Constructor constructs an empty cuts object. All Cuts should initially be False (will not cut)
  • Copy Constructor copies all member data
  • Method bool GetWillCut(int cut_variable). cut_variable indexes the particular cut to be returned. Returns true if the recon event falls outside the acceptance of the cut
  • Method bool GetWillCut(std::string cut_variable) cut_variable names the particular cut to be returned. Returns true if the recon event falls outside the acceptance of the cut.
  • Method void SetWillCut(std::string cut_variable, bool will_cut)
    • cut_variable names the particular cut to be returned.
    • will_cut sets the value of the object that will be cut
    • An exception should be raised if cut_variable is not a valid name.
  • Method void SetWillCut(size_t cut_variable, bool will_cut)
    • cut_variable indexes the particular cut to be returned.
    • will_cut sets the value of the object that will be cut
    • An exception should be raised if cut_variable is not a valid index (out of range).
  • Static method std::string VariableName(size_t cut_variable) Returns the human readable string name for a given integer cut variable. An exception should be raised if cut_variable is not a valid index (out of range).
  • Static method size_t VariableIndex(std::string cut_variable) Returns the index for a given cut variable name. An exception should be raised if cut_variable is not a valid name.

VariableIndex(VariableName(some_uint)) should return some_uint.

private

I recommend that you store the cuts as a std::vector<bool>

I recommend that you store a static member variable std::map<size_t, std::string> which does the index to name lookup; and std::map<std::string, size_t> which does the name to index lookup. There might be an stl object that provides fast two-way lookups, in which case this would be preferable.

Other Stuff

  • Add a Cuts object as a member variable of the ReconEvent. Add appropriate Get and Set functions
  • Each public member function should be commented in the header file with description of the purpose of the function, any variables passed to the function, return value if there is one and any possible pitfalls/exceptions.
  • You should put a description of the class in the header file.
  • You should write unit tests that check that the class meets the specifications as outlined in this comment
#2

Updated by Rogers, Chris over 6 years ago

Sample root file for testing

#4

Updated by Rajaram, Durga about 6 years ago

Does this come from the ~mfedorov/maus/clean_maus branch?

#5

Updated by Rajaram, Durga about 6 years ago

The failure is coming from a double free.
I ran with valgrind

==29416== Invalid free() / delete / delete[]
==29416==    at 0x4A0545F: operator delete(void*) (vg_replace_malloc.c:387)
==29416==    by 0x37CEA35ECC: __cxa_finalize (in /lib64/libc-2.12.so)
==29416==    by 0x17DECCC5: ??? (in /home/durga/mfedorov/build/libMapCppSimulation.so)
==29416==    by 0x17DF6F70: ??? (in /home/durga/mfedorov/build/libMapCppSimulation.so)
==29416==    by 0x37CEA35B31: exit (in /lib64/libc-2.12.so)
==29416==    by 0x37CEA1ED63: (below main) (in /lib64/libc-2.12.so)
==29416==  Address 0x1b8c0d40 is 0 bytes inside a block of size 39 free'd
==29416==    at 0x4A0545F: operator delete(void*) (vg_replace_malloc.c:387)
==29416==    by 0x37CEA35ECC: __cxa_finalize (in /lib64/libc-2.12.so)
==29416==    by 0x159FA3C5: ??? (in /home/durga/mfedorov/build/libMapCppCuts.so)
==29416==    by 0x15A0A4B0: ??? (in /home/durga/mfedorov/build/libMapCppCuts.so)
==29416==    by 0x37CEA35B31: exit (in /lib64/libc-2.12.so)
==29416==    by 0x37CEA1ED63: (below main) (in /lib64/libc-2.12.so)

I don't understand what is getting free'd by MapCppSimulation & MapCppCuts

#6

Updated by Rajaram, Durga about 6 years ago

As to why it was showing up in tof_mc_plotter, it is because tof_mc_plotter is linked against libMapCppSimulation and libMapCppCuts

To fix this, I have changed core builder to build tof_mc_plotter by linking to just libMausCpp -- it doesn't really need the other libraries.

Checked with Misha's branch that the test now passes.

Pushed to trunk rev.1235

Misha -- can you pull the trunk fix into your branch, and check again? Should be ok now.

#8

Updated by Franchini, Paolo about 6 years ago

Hi Misha,

I think you had some conflicts in your branch. You have several errors about stuff like

 <<<<<<< TREE
 >>>>>>> MERGE-SOURCE
 =======

in /src/common_cpp/Recon/SciFi/RootFitter.hh.

#9

Updated by Rogers, Chris almost 6 years ago

#10

Updated by Franchini, Paolo almost 6 years ago

First version included in MAUS 3.1.0.

Durga asked for a benchmark of the additional time that the cut mapper would require during the reconstruction.

#11

Updated by Franchini, Paolo over 5 years ago

  • Status changed from Open to In Progress
  • Assignee changed from Fedorov, Misha to Kurup, Ajit
  • % Done changed from 0 to 50

Also available in: Atom PDF