1 |
grimes |
1.1 |
#ifndef l1menu_tools_h
|
2 |
|
|
#define l1menu_tools_h
|
3 |
|
|
|
4 |
|
|
/** @file Miscellaneous functions that are useful.
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
#include <vector>
|
8 |
|
|
#include <string>
|
9 |
|
|
|
10 |
|
|
//
|
11 |
|
|
// Forward declarations
|
12 |
|
|
//
|
13 |
|
|
namespace l1menu
|
14 |
|
|
{
|
15 |
|
|
class ITrigger;
|
16 |
|
|
class IEvent;
|
17 |
|
|
}
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
namespace l1menu
|
21 |
|
|
{
|
22 |
|
|
/** @brief Finds all of the parameter names that refer to thresholds.
|
23 |
|
|
*
|
24 |
|
|
* Searches through all the parameter names for things that have the form "threshold1",
|
25 |
|
|
* "threshold2" etcetera. Also looks for things of the form "leg1threshold1", "leg2threshold1"
|
26 |
|
|
* etcetera for when I get around to implementing the cross triggers.
|
27 |
|
|
*
|
28 |
|
|
* @param[in] trigger The trigger to check.
|
29 |
grimes |
1.2 |
* @return A std::vector of strings for all of the value parameter names that
|
30 |
grimes |
1.1 |
* refer to thresholds.
|
31 |
|
|
*
|
32 |
|
|
* @author Mark Grimes (mark.grimes@bristol.ac.uk)
|
33 |
|
|
* @date 28/May/2013
|
34 |
|
|
*/
|
35 |
|
|
std::vector<std::string> getThresholdNames( const l1menu::ITrigger& trigger );
|
36 |
|
|
|
37 |
grimes |
1.2 |
/** @brief Finds all of the parameter names that don't refer to thresholds.
|
38 |
|
|
*
|
39 |
|
|
* Does the opposite of getThresholdNames, so returns all parameter names that getThresholdNames
|
40 |
|
|
* doesn't.
|
41 |
|
|
*
|
42 |
|
|
* @param[in] trigger The trigger to check.
|
43 |
|
|
* @return A std::vector of strings for all of the valued parameter names that
|
44 |
|
|
* don't refer to thresholds.
|
45 |
|
|
*
|
46 |
|
|
* @author Mark Grimes (mark.grimes@bristol.ac.uk)
|
47 |
|
|
* @date 30/May/2013
|
48 |
|
|
*/
|
49 |
|
|
std::vector<std::string> getNonThresholdParameterNames( const l1menu::ITrigger& trigger );
|
50 |
|
|
|
51 |
grimes |
1.1 |
/** @brief Sets all of the thresholds in the supplied trigger as tight as possible but still passing the supplied event.
|
52 |
|
|
*
|
53 |
|
|
* Note that this assumes all of the thresholds are independent. If they're not, behaviour is undefined. The supplied
|
54 |
|
|
* trigger is modified, so make a copy before hand if that's not what you want. Note only the thresholds are changed, any
|
55 |
|
|
* other parameters e.g. eta cuts are kept as is.
|
56 |
|
|
*
|
57 |
|
|
* If no thresholds can be found that would let the trigger pass the supplied event, a std::runtime_error is thrown.
|
58 |
|
|
*
|
59 |
|
|
* @param[in] event The event to test the trigger on.
|
60 |
|
|
* @param[out] trigger The trigger to check and modify.
|
61 |
|
|
* @param[in] tolerance The trigger thresholds will be modified to be within this tolerance of thresholds that would
|
62 |
|
|
* fail the event.
|
63 |
|
|
*
|
64 |
|
|
* @author Mark Grimes (mark.grimes@bristol.ac.uk)
|
65 |
|
|
* @date 28/May/2013
|
66 |
|
|
*/
|
67 |
|
|
void setTriggerThresholdsAsTightAsPossible( const l1menu::IEvent& event, l1menu::ITrigger& trigger, float tolerance=0.01 );
|
68 |
|
|
}
|
69 |
|
|
#endif
|