Protected constructor, to be only used by the code itself.
This function implements an "OR" of the triggers that match the selection. The function returns kTRUE
if any of the matching triggers pass the selection.
This function is implemented in the same way as the offline version of ChainGroup::getPrescale(...). If the chain group only holds one chain/item, then the function returns the cumulative prescale of this chain/item. (e.g. EF prescale * LVL2 prescale * LVL1 prescale)
In case there are multiple triggers defined, there are two cases. If one of the defined triggers is unprescaled (prescale = 1.0) then the chain group by definition has a prescale of 1.0. But if all of the chains/items are prescaled, we can't provide a single prescale for them. In this case the function returns 0.0.
This function returns the list of triggers that match a given selection. For instance to get the list of all LVL2 chains, one has to request a chain group with the pattern "L2.*".
This function makes sure that the object is aware of the configuration that was used in the current event, and is confugured appropriately.
This function is used to create properly formatted names from a comma separated list of names. The list can even contain spaces.
31 ChainGroup::ChainGroup(
const std::vector< std::string >& triggerNames,
33 TrigConfigSvcD3PD&
svc )
34 : TNamed(
"ChainGroup",
"A particular chain group" ),
35 m_parent(
parent ), m_configSvc(
svc ), m_triggerNames( triggerNames ) {
58 Error(
"IsPassed",
"Trigger(s) can't be evaluated" );
65 for(
size_t i = 0;
i < m_existingTriggers.size(); ++
i ) {
68 if( m_existingTriggers[
i ].
find(
"L1_" ) != std::string::npos ) {
71 const Int_t word = m_existingIDs[
i ] / 32;
72 const Int_t bit = m_existingIDs[
i ] % 32;
76 case TrigDefs::Physics:
77 if( m_parent.GetDetailLevel() >= 0 ) {
79 if( ( ( * m_parent.GetL1Result( Trig::IDataAccess::TAV ) )[ word ] >> bit ) & 0
x1 ) {
84 "The requested information is not available in the input" );
89 if( m_parent.GetDetailLevel() >= 1 ) {
91 if( ( ( * m_parent.GetL1Result( Trig::IDataAccess::TBP ) )[ word ] >> bit ) & 0
x1 ) {
96 "The requested information is not available in the input" );
101 if( m_parent.GetDetailLevel() >= 1 ) {
103 if( ( ( * m_parent.GetL1Result( Trig::IDataAccess::TAP ) )[ word ] >> bit ) & 0
x1 ) {
108 "The requested information is not available in the input" );
113 Warning(
"IsPassed",
"Decision type not recognised for LVL1 items!" );
119 else if( m_existingTriggers[
i ].
find(
"L2_" ) != std::string::npos ) {
121 std::vector< short >::const_iterator
begin,
end;
124 case TrigDefs::Physics:
125 if( m_parent.GetDetailLevel() >= 0 ) {
126 begin = m_parent.GetL2Result( Trig::IDataAccess::Physics )->begin();
127 end = m_parent.GetL2Result( Trig::IDataAccess::Physics )->end();
130 "The requested information is not available in the input" );
134 case TrigDefs::requireDecision:
135 if( m_parent.GetDetailLevel() >= 1 ) {
136 begin = m_parent.GetL2Result( Trig::IDataAccess::Raw )->begin();
137 end = m_parent.GetL2Result( Trig::IDataAccess::Raw )->end();
140 "The requested information is not available in the input" );
145 if( m_parent.GetDetailLevel() >= 2 ) {
146 begin = m_parent.GetL2Result( Trig::IDataAccess::Resurrected )->begin();
147 end = m_parent.GetL2Result( Trig::IDataAccess::Resurrected )->end();
150 "The requested information is not available in the input" );
154 case TrigDefs::passedThrough:
155 if( m_parent.GetDetailLevel() >= 2 ) {
156 begin = m_parent.GetL2Result( Trig::IDataAccess::PassedThrough )->begin();
157 end = m_parent.GetL2Result( Trig::IDataAccess::PassedThrough )->end();
160 "The requested information is not available in the input" );
165 Warning(
"IsPassed",
"Decision type not recognised for HLT chains!" );
175 else if( m_existingTriggers[
i ].
find(
"EF_" ) != std::string::npos ) {
177 std::vector< short >::const_iterator
begin,
end;
180 case TrigDefs::Physics:
181 if( m_parent.GetDetailLevel() >= 0 ) {
182 begin = m_parent.GetEFResult( Trig::IDataAccess::Physics )->begin();
183 end = m_parent.GetEFResult( Trig::IDataAccess::Physics )->end();
186 "The requested information is not available in the input" );
190 case TrigDefs::requireDecision:
191 if( m_parent.GetDetailLevel() >= 1 ) {
192 begin = m_parent.GetEFResult( Trig::IDataAccess::Raw )->begin();
193 end = m_parent.GetEFResult( Trig::IDataAccess::Raw )->end();
196 "The requested information is not available in the input" );
201 if( m_parent.GetDetailLevel() >= 2 ) {
202 begin = m_parent.GetEFResult( Trig::IDataAccess::Resurrected )->begin();
203 end = m_parent.GetEFResult( Trig::IDataAccess::Resurrected )->end();
206 "The requested information is not available in the input" );
210 case TrigDefs::passedThrough:
211 if( m_parent.GetDetailLevel() >= 2 ) {
212 begin = m_parent.GetEFResult( Trig::IDataAccess::PassedThrough )->begin();
213 end = m_parent.GetEFResult( Trig::IDataAccess::PassedThrough )->end();
216 "The requested information is not available in the input" );
221 Warning(
"IsPassed",
"Decision type not recognised for HLT chains!" );
230 Fatal(
"IsPassed",
"Something seems to be wrong with this function!" );
253 Float_t ChainGroup::GetPrescale() {
259 Error(
"IsPassed",
"Trigger(s) can't be evaluated" );
265 const Bool_t singleTrigger = ( m_existingTriggers.size() == 1 );
270 std::vector< std::string >::const_iterator name_itr = m_existingTriggers.begin();
271 std::vector< std::string >::const_iterator name_end = m_existingTriggers.end();
272 for( ; name_itr != name_end; ++name_itr ) {
278 Float_t chainPrescale = 1.0;
279 if( name_itr->find(
"EF_" ) != name_itr->npos ) {
281 chainPrescale = m_configSvc.GetPrescale( *name_itr );
282 const std::string& l2name = m_configSvc.GetLowerChainName( *name_itr );
283 chainPrescale *= m_configSvc.GetPrescale( l2name );
284 const std::string& l1name = m_configSvc.GetLowerChainName( l2name );
285 chainPrescale *= m_configSvc.GetPrescale( l1name );
287 }
else if( name_itr->find(
"L2_" ) != name_itr->npos ) {
289 chainPrescale = m_configSvc.GetPrescale( *name_itr );
290 const std::string& l1name = m_configSvc.GetLowerChainName( *name_itr );
291 chainPrescale *= m_configSvc.GetPrescale( l1name );
293 }
else if( name_itr->find(
"L1_" ) != name_itr->npos ) {
295 chainPrescale = m_configSvc.GetPrescale( *name_itr );
298 Fatal(
"GetPrescale",
"Something seems to be wrong with this function!" );
303 if( singleTrigger )
return chainPrescale;
307 const Bool_t
unprescaled = ( std::abs( chainPrescale - 1.0 ) < 1
e-5 );
323 const std::vector< std::string >& ChainGroup::GetListOfTriggers() {
329 Error(
"IsPassed",
"Trigger(s) can't be evaluated" );
330 m_existingTriggers.clear();
333 return m_existingTriggers;
343 Bool_t ChainGroup::Update() {
346 if( m_smk == m_parent.GetSMK() )
return kTRUE;
350 m_configSvc.Load( m_parent.GetSMK(), m_parent.GetL1PSK(), m_parent.GetHLTPSK() );
351 m_smk = m_parent.GetSMK();
354 m_existingTriggers.clear();
355 m_existingIDs.clear();
359 std::vector< std::string >::const_iterator name_itr = m_triggerNames.begin();
360 std::vector< std::string >::const_iterator name_end = m_triggerNames.end();
361 for( ; name_itr != name_end; ++name_itr ) {
365 std::vector< std::string > split_names =
ToVector( *name_itr );
366 std::vector< std::string >::const_iterator splitname_itr = split_names.begin();
367 std::vector< std::string >::const_iterator splitname_end = split_names.end();
368 for( ; splitname_itr != splitname_end; ++splitname_itr ) {
371 TRegexp
re( *splitname_itr );
373 const Bool_t isWildcarded = ( ( splitname_itr->find(
'^' ) != splitname_itr->npos ) ||
374 ( splitname_itr->find(
'$' ) != splitname_itr->npos ) ||
375 ( splitname_itr->find(
'.' ) != splitname_itr->npos ) ||
376 ( splitname_itr->find(
'[' ) != splitname_itr->npos ) ||
377 ( splitname_itr->find(
']' ) != splitname_itr->npos ) ||
378 ( splitname_itr->find(
'*' ) != splitname_itr->npos ) ||
379 ( splitname_itr->find(
'+' ) != splitname_itr->npos ) ||
380 ( splitname_itr->find(
'?' ) != splitname_itr->npos ) );
383 std::vector< std::string >::const_iterator trigger_itr =
384 m_configSvc.GetLVL1Items().begin();
385 std::vector< std::string >::const_iterator trigger_end =
386 m_configSvc.GetLVL1Items().end();
387 for( ; trigger_itr != trigger_end; ++trigger_itr ) {
389 if(
re.Index( *trigger_itr, &len ) != kNPOS ) {
390 m_existingTriggers.push_back( *trigger_itr );
391 m_existingIDs.push_back( m_configSvc.GetCTPId( *trigger_itr ) );
394 if( *splitname_itr == *trigger_itr ) {
395 m_existingTriggers.push_back( *trigger_itr );
396 m_existingIDs.push_back( m_configSvc.GetCTPId( *trigger_itr ) );
402 trigger_itr = m_configSvc.GetHLTChains().begin();
403 trigger_end = m_configSvc.GetHLTChains().end();
404 for( ; trigger_itr != trigger_end; ++trigger_itr ) {
406 if(
re.Index( *trigger_itr, &len ) != kNPOS ) {
407 m_existingTriggers.push_back( *trigger_itr );
408 m_existingIDs.push_back( m_configSvc.GetChainId( *trigger_itr ) );
411 if( *splitname_itr == *trigger_itr ) {
412 m_existingTriggers.push_back( *trigger_itr );
413 m_existingIDs.push_back( m_configSvc.GetChainId( *trigger_itr ) );
421 if( m_existingTriggers.size() != m_existingIDs.size() ) {
422 Fatal(
"Update",
"There is a serious problem in the code!" );
439 std::string local_names(
names );
440 std::string::size_type
pos;
441 while( (
pos = local_names.find_first_of(
' ' ) ) != local_names.npos ) {
442 local_names.erase(
pos, 1 );
446 std::vector< std::string >
result;
447 std::string::size_type old_pos = 0;
448 while( (
pos = local_names.find(
',', old_pos ) ) != local_names.npos ) {
449 result.push_back( local_names.substr( old_pos,
pos - old_pos ) );
452 if( old_pos < local_names.size() ) {
453 result.push_back( local_names.substr( old_pos, local_names.size() - old_pos ) );