4 |
|
#include <exception> |
5 |
|
#include <map> |
6 |
|
#include <stdexcept> |
7 |
+ |
#include <algorithm> |
8 |
|
#include "l1menu/ITrigger.h" |
9 |
|
#include "l1menu/IEvent.h" |
10 |
|
#include "l1menu/TriggerTable.h" |
33 |
|
if( legNumber!=0 ) stringConverter << "leg" << legNumber; // For triggers with only one leg I don't want to prefix anything. |
34 |
|
|
35 |
|
stringConverter << "threshold" << thresholdNumber; |
36 |
+ |
|
37 |
|
trigger.parameter(stringConverter.str()); |
38 |
|
// If the threshold doesn't exist the statement above will throw an exception, so |
39 |
|
// I've reached this far then the threshold name must exist. |
47 |
|
// exist, so I know I've finished. If it isn't from the first threshold then there could be |
48 |
|
// other prefixes (e.g. "leg2") that have thresholds that can be modified, in which case I |
49 |
|
// need to continue. |
50 |
< |
if( thresholdNumber==1 ) break; |
50 |
> |
if( thresholdNumber==1 && legNumber!=0 ) break; |
51 |
|
} |
52 |
|
} |
53 |
|
|
54 |
|
return returnValue; |
55 |
|
} |
56 |
|
|
57 |
+ |
std::vector<std::string> l1menu::getNonThresholdParameterNames( const l1menu::ITrigger& trigger ) |
58 |
+ |
{ |
59 |
+ |
std::vector<std::string> returnValue; |
60 |
+ |
|
61 |
+ |
// It'll be easier to get the threshold names and then copy |
62 |
+ |
// everything that's not in there to the return value. |
63 |
+ |
std::vector<std::string> allParameterNames=trigger.parameterNames(); |
64 |
+ |
std::vector<std::string> thresholdNames=getThresholdNames(trigger); |
65 |
+ |
|
66 |
+ |
for( const auto& parameterName : allParameterNames ) |
67 |
+ |
{ |
68 |
+ |
const auto& iFindResult=std::find( thresholdNames.begin(), thresholdNames.end(), parameterName ); |
69 |
+ |
// If the current parameter name isn't one of the thresholds add |
70 |
+ |
// it the vector which I'm going to return. |
71 |
+ |
if( iFindResult==thresholdNames.end() ) returnValue.push_back(parameterName); |
72 |
+ |
} |
73 |
+ |
|
74 |
+ |
return returnValue; |
75 |
+ |
} |
76 |
+ |
|
77 |
|
void l1menu::setTriggerThresholdsAsTightAsPossible( const l1menu::IEvent& event, l1menu::ITrigger& trigger, float tolerance ) |
78 |
|
{ |
79 |
|
std::vector<std::string> thresholdNames=l1menu::getThresholdNames( trigger ); |
96 |
|
{ |
97 |
|
lowThreshold=l1menu::TriggerTable::instance().getSuggestedLowerEdge( trigger.name(), thresholdName ); |
98 |
|
highThreshold=l1menu::TriggerTable::instance().getSuggestedUpperEdge( trigger.name(), thresholdName ); |
99 |
+ |
highThreshold*=5; // Make sure the high threshold is very high, to catch all tails |
100 |
|
} |
101 |
|
catch( std::exception& error ) { /* No indication set. Do nothing and just use the defaults I set previously. */ } |
102 |
|
|