ATLAS Offline Software
Functions
TrigDecisionToolD3PD.cxx File Reference
#include <algorithm>
#include "TrigDecisionToolD3PD.h"
Include dependency graph for TrigDecisionToolD3PD.cxx:

Go to the source code of this file.

Functions

 ClassImp (D3PD::TrigDecisionToolD3PD) namespace D3PD
 

Function Documentation

◆ ClassImp()

To read any encoded trigger information from a D3PD, the file has to contain a metadata tree called "TrigConfTree". This is located in the file in a subdirectory called "<d3pd tree name>Meta". For instance in the egammaD3PDs the tree is under "egammaMeta/TrigConfTree". If you don't have such a tree in your file, the tool will not be usable.

The tool of course also needs to access the event-level TTree holding the event-wise trigger information.

Parameters
eventTreePointer to the event-wise D3PD TTree
confTreePointer to "TrigConfTree"
prefixPrefix used by the trigger tools. "trig_" by default.

Perhaps the most important function that people need. It can tell the user whether a given LVL1 item or HLT chain passed in the current event.

By default the function returns the "physics decision", but it can be asked to give more detailed results as well. The function tries to be smart, so if the user asks for information that is not available in the given D3PD, it should just print a warning. (And return kFALSE.)

For a description of the types of trigger results, have a look at the documentation of the TrigDefs::DecisionTypes enumeration.

Parameters
nameThe name of the trigger we're interested in
typeThe type of the trigger decision to look up
Returns
kTRUE if the trigger was passed in the current event, kFALSE otherwise

Definition at line 13 of file TrigDecisionToolD3PD.cxx.

15  {
16 
31  TrigDecisionToolD3PD::TrigDecisionToolD3PD( TTree* eventTree, TTree* confTree,
32  const TString& prefix )
33  : TNamed( "TrigDecisionToolD3PD", "Trigger decision tool" ),
34  Trig::DataAccess( eventTree, prefix ),
35  Trig::ConfigAccess( confTree ),
36  Trig::ChainGroupHandling() {
37 
38  }
39 
57  Bool_t TrigDecisionToolD3PD::IsPassed( const std::string& name,
59 
60  // Load the appropriate configuration:
61  GetConfigSvc().Load( GetSMK(), GetL1PSK(), GetHLTPSK() );
62 
63  Int_t id = 0; // Helper variable
64 
65  //
66  // If we're asking about a LVL1 item:
67  //
68  if( name.find( "L1_" ) != name.npos ) {
69 
70  // Find out if the LVL1 item exists in the current configuration:
71  if( ( id = GetConfigSvc().GetCTPId( name ) ) < 0 ) {
72  Warning( "IsPassed", TString::Format( "LVL1 item not known: %s",
73  name.c_str() ) );
74  return kFALSE;
75  }
76 
77  // Variables helping in looking up the correct bit in the result:
78  const Int_t word = id / 32;
79  const Int_t bit = id % 32;
80 
81  //
82  // Give the result based on a few conditions:
83  //
84  switch( type ) {
85 
86  case TrigDefs::Physics:
87  if( GetDetailLevel() >= 0 ) {
88  return ( ( ( * GetL1Result( Trig::DataAccess::TAV ) )[ word ] >> bit ) & 0x1 );
89  } else {
90  Warning( "IsPassed",
91  "The requested information is not available in the input" );
92  return kFALSE;
93  }
94  break;
95  case TrigDefs::L1_TBP:
96  if( GetDetailLevel() >= 1 ) {
97  return ( ( ( * GetL1Result( Trig::DataAccess::TBP ) )[ word ] >> bit ) & 0x1 );
98  } else {
99  Warning( "IsPassed",
100  "The requested information is not available in the input" );
101  return kFALSE;
102  }
103  break;
104  case TrigDefs::L1_TAP:
105  if( GetDetailLevel() >= 1 ) {
106  return ( ( ( * GetL1Result( Trig::DataAccess::TAP ) )[ word ] >> bit ) & 0x1 );
107  } else {
108  Warning( "IsPassed",
109  "The requested information is not available in the input" );
110  return kFALSE;
111  }
112  break;
113  default:
114  Warning( "IsPassed", "Decision type not recognised. Returning physics decision." );
115  if( GetDetailLevel() >= 0 ) {
116  return ( ( ( * GetL1Result( Trig::DataAccess::TAV ) )[ word ] >> bit ) & 0x1 );
117  } else {
118  Warning( "IsPassed",
119  "The requested information is not available in the input" );
120  return kFALSE;
121  }
122  break;
123  }
124  }
125 
126  // Else we have to be talking about an HLT chain:
127  if( ( id = GetConfigSvc().GetChainId( name ) ) < 0 ) {
128  Warning( "IsPassed", TString::Format( "HLT chain not known: %s",
129  name.c_str() ) );
130  return kFALSE;
131  }
132 
133  //
134  // If this is a LVL2 chain:
135  //
136  if( name.find( "L2_" ) != name.npos ) {
137 
138  //
139  // Decide on which kind of result the user wants:
140  //
141  std::vector< short >::const_iterator begin, end;
142  switch( type ) {
143 
144  case TrigDefs::Physics:
145  if( GetDetailLevel() >= 0 ) {
146  begin = GetL2Result( Trig::DataAccess::Physics )->begin();
147  end = GetL2Result( Trig::DataAccess::Physics )->end();
148  } else {
149  Warning( "IsPassed",
150  "The requested information is not available in the input" );
151  return kFALSE;
152  }
153  break;
154  case TrigDefs::requireDecision:
155  if( GetDetailLevel() >= 1 ) {
156  begin = GetL2Result( Trig::DataAccess::Raw )->begin();
157  end = GetL2Result( Trig::DataAccess::Raw )->end();
158  } else {
159  Warning( "IsPassed",
160  "The requested information is not available in the input" );
161  return kFALSE;
162  }
163  break;
165  if( GetDetailLevel() >= 2 ) {
166  begin = GetL2Result( Trig::DataAccess::Resurrected )->begin();
167  end = GetL2Result( Trig::DataAccess::Resurrected )->end();
168  } else {
169  Warning( "IsPassed",
170  "The requested information is not available in the input" );
171  return kFALSE;
172  }
173  break;
174  case TrigDefs::passedThrough:
175  if( GetDetailLevel() >= 2 ) {
176  begin = GetL2Result( Trig::DataAccess::PassedThrough )->begin();
177  end = GetL2Result( Trig::DataAccess::PassedThrough )->end();
178  } else {
179  Warning( "IsPassed",
180  "The requested information is not available in the input" );
181  return kFALSE;
182  }
183  break;
184  default:
185  Warning( "IsPassed", "Decision type not recognised. Returning physics decision." );
186  if( GetDetailLevel() >= 0 ) {
187  begin = GetL2Result( Trig::DataAccess::Physics )->begin();
188  end = GetL2Result( Trig::DataAccess::Physics )->end();
189  } else {
190  Warning( "IsPassed",
191  "The requested information is not available in the input" );
192  return kFALSE;
193  }
194  break;
195  }
196 
197  //
198  // See if the trigger chain met this condition:
199  //
200  if( std::find( begin, end, id ) != end ) {
201  return kTRUE;
202  } else {
203  return kFALSE;
204  }
205  }
206 
207  //
208  // If this is an EF chain:
209  //
210  if( name.find( "EF_" ) != name.npos ) {
211 
212  //
213  // Decide on which kind of result the user wants:
214  //
215  std::vector< short >::const_iterator begin, end;
216  switch( type ) {
217 
218  case TrigDefs::Physics:
219  if( GetDetailLevel() >= 0 ) {
220  begin = GetEFResult( Trig::DataAccess::Physics )->begin();
221  end = GetEFResult( Trig::DataAccess::Physics )->end();
222  } else {
223  Warning( "IsPassed",
224  "The requested information is not available in the input" );
225  return kFALSE;
226  }
227  break;
228  case TrigDefs::requireDecision:
229  if( GetDetailLevel() >= 1 ) {
230  begin = GetEFResult( Trig::DataAccess::Raw )->begin();
231  end = GetEFResult( Trig::DataAccess::Raw )->end();
232  } else {
233  Warning( "IsPassed",
234  "The requested information is not available in the input" );
235  return kFALSE;
236  }
237  break;
239  if( GetDetailLevel() >= 2 ) {
240  begin = GetEFResult( Trig::DataAccess::Resurrected )->begin();
241  end = GetEFResult( Trig::DataAccess::Resurrected )->end();
242  } else {
243  Warning( "IsPassed",
244  "The requested information is not available in the input" );
245  return kFALSE;
246  }
247  break;
248  case TrigDefs::passedThrough:
249  if( GetDetailLevel() >= 2 ) {
250  begin = GetEFResult( Trig::DataAccess::PassedThrough )->begin();
251  end = GetEFResult( Trig::DataAccess::PassedThrough )->end();
252  } else {
253  Warning( "IsPassed",
254  "The requested information is not available in the input" );
255  return kFALSE;
256  }
257  break;
258  default:
259  Warning( "IsPassed", "Decision type not recognised. Returning physics decision." );
260  if( GetDetailLevel() >= 0 ) {
261  begin = GetEFResult( Trig::DataAccess::Physics )->begin();
262  end = GetEFResult( Trig::DataAccess::Physics )->end();
263  } else {
264  Warning( "IsPassed",
265  "The requested information is not available in the input" );
266  return kFALSE;
267  }
268  break;
269  }
270 
271  //
272  // See if the trigger chain met this condition:
273  //
274  if( std::find( begin, end, id ) != end ) {
275  return kTRUE;
276  } else {
277  return kFALSE;
278  }
279  }
280 
281  //
282  // If everything went well, we should never reach this point. If we do, then
283  // some of the assumptions about the trigger configuration have to be wrong.
284  //
285  Error( "IsPassed", "We've arrived at a serious programming bug!" );
286  return kFALSE;
287  }
288 
289 } // namespace D3PD
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
D3PD::TrigDefs::L1_TAP
@ L1_TAP
LVL1 Trigger After Prescale decision.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/Conditions.h:93
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
D3PD::TrigDefs::DecisionTypes
DecisionTypes
Trigger decision types available from the D3PDs.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/Conditions.h:39
Trig
The common trigger namespace for trigger analysis tools.
Definition: CaloTowerVecMon.h:44
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:146
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
D3PD::TrigDefs::allowResurrected
@ allowResurrected
The decision while allowing the chain to be resurrected.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/Conditions.h:67
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
D3PD::TrigDefs::L1_TBP
@ L1_TBP
LVL1 Trigger Before Prescale decision.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/Conditions.h:84