139 |
|
return *triggers_.back(); |
140 |
|
} |
141 |
|
|
142 |
+ |
l1menu::ITrigger& l1menu::TriggerMenu::addTrigger( const l1menu::ITrigger& triggerToCopy ) |
143 |
+ |
{ |
144 |
+ |
std::unique_ptr<l1menu::ITrigger> pNewTrigger=triggerTable_.copyTrigger( triggerToCopy ); |
145 |
+ |
if( pNewTrigger.get()==NULL ) throw std::range_error( "Trigger requested that does not exist" ); |
146 |
+ |
|
147 |
+ |
triggers_.push_back( std::move(pNewTrigger) ); |
148 |
+ |
|
149 |
+ |
// Make sure triggerResults_ is always the same size as triggers_ |
150 |
+ |
triggerResults_.resize( triggers_.size() ); |
151 |
+ |
return *triggers_.back(); |
152 |
+ |
} |
153 |
+ |
|
154 |
|
size_t l1menu::TriggerMenu::numberOfTriggers() const |
155 |
|
{ |
156 |
|
return triggers_.size(); |
177 |
|
return triggerTable_.copyTrigger(*triggers_[position]); |
178 |
|
} |
179 |
|
|
180 |
< |
bool l1menu::TriggerMenu::apply( const l1menu::IEvent& event ) const |
180 |
> |
bool l1menu::TriggerMenu::apply( const l1menu::L1TriggerDPGEvent& event ) const |
181 |
|
{ |
182 |
|
bool atLeastOneTriggerHasFired=false; |
183 |
|
|
231 |
|
// will have "threshold1" whereas a cross trigger will have "leg1threshold1", "leg2threshold1" etcetera. This |
232 |
|
// utility function will get the threshold names in the correct order. |
233 |
|
const auto& thresholdNames=l1menu::tools::getThresholdNames(newTrigger); |
234 |
< |
if( thresholdNames.size()>1 ) newTrigger.parameter(thresholdNames[0])=::convertStringToFloat( tableColumns[3] ); |
235 |
< |
if( thresholdNames.size()>2 ) newTrigger.parameter(thresholdNames[1])=::convertStringToFloat( tableColumns[4] ); |
236 |
< |
if( thresholdNames.size()>3 ) newTrigger.parameter(thresholdNames[2])=::convertStringToFloat( tableColumns[5] ); |
237 |
< |
if( thresholdNames.size()>4 ) newTrigger.parameter(thresholdNames[3])=::convertStringToFloat( tableColumns[6] ); |
234 |
> |
if( thresholdNames.size()>=1 ) newTrigger.parameter(thresholdNames[0])=::convertStringToFloat( tableColumns[3] ); |
235 |
> |
if( thresholdNames.size()>=2 ) newTrigger.parameter(thresholdNames[1])=::convertStringToFloat( tableColumns[4] ); |
236 |
> |
if( thresholdNames.size()>=3 ) newTrigger.parameter(thresholdNames[2])=::convertStringToFloat( tableColumns[5] ); |
237 |
> |
if( thresholdNames.size()>=4 ) newTrigger.parameter(thresholdNames[3])=::convertStringToFloat( tableColumns[6] ); |
238 |
|
|
239 |
|
float etaOrRegionCut=::convertStringToFloat( tableColumns[7] ); |
240 |
|
// For most triggers, I can just try and set both the etaCut and regionCut parameters |