ATLAS Offline Software
TrigDecisionToolD3PD.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: TrigDecisionToolD3PD.cxx 318255 2010-08-27 11:46:34Z krasznaa $
6 
7 // STL include(s):
8 #include <algorithm>
9 
10 // Local include(s):
11 #include "TrigDecisionToolD3PD.h"
12 
14 
15 namespace D3PD {
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:
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 ) {
148  } else {
149  Warning( "IsPassed",
150  "The requested information is not available in the input" );
151  return kFALSE;
152  }
153  break;
155  if( GetDetailLevel() >= 1 ) {
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 ) {
168  } else {
169  Warning( "IsPassed",
170  "The requested information is not available in the input" );
171  return kFALSE;
172  }
173  break;
175  if( GetDetailLevel() >= 2 ) {
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 ) {
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 ) {
222  } else {
223  Warning( "IsPassed",
224  "The requested information is not available in the input" );
225  return kFALSE;
226  }
227  break;
229  if( GetDetailLevel() >= 1 ) {
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 ) {
242  } else {
243  Warning( "IsPassed",
244  "The requested information is not available in the input" );
245  return kFALSE;
246  }
247  break;
249  if( GetDetailLevel() >= 2 ) {
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 ) {
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
D3PD::Trig::DataAccess::GetSMK
virtual Int_t GetSMK() const
Get the Super Master Key of the current event.
D3PD::TrigDefs::requireDecision
@ requireDecision
The "raw" decision.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/Conditions.h:57
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
D3PD::TrigDefs::Physics
@ Physics
"The" physics decision
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/Conditions.h:48
D3PD::TrigDefs::L1_TAP
@ L1_TAP
LVL1 Trigger After Prescale decision.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/Conditions.h:93
D3PD::Trig::IDataAccess::Resurrected
@ Resurrected
Definition: IDataAccess.h:60
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
D3PD::Trig::ConfigAccess::GetConfigSvc
virtual TrigConfigSvcD3PD & GetConfigSvc()
Return a reference to the trigger configuration service.
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:146
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
D3PD::Trig::IDataAccess::TAV
@ TAV
Definition: IDataAccess.h:54
D3PD::TrigDecisionToolD3PD::TrigDecisionToolD3PD
TrigDecisionToolD3PD(TTree *eventTree=0, TTree *confTree=0, const TString &prefix="trig_")
Constructor specifying the D3PD trees that the tool should act on.
ClassImp
ClassImp(D3PD::TrigDecisionToolD3PD) namespace D3PD
Definition: TrigDecisionToolD3PD.cxx:13
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
D3PD::Trig::DataAccess::GetL1PSK
virtual Int_t GetL1PSK() const
Get the LVL1 prescale key of the current event.
D3PD
Block filler tool for noisy FEB information.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/ChainGroup.h:21
D3PD::Trig::IDataAccess::TAP
@ TAP
Definition: IDataAccess.h:53
D3PD::TrigDecisionToolD3PD
Tool for interpreting trigger information in the D3PDs.
Definition: TrigDecisionToolD3PD.h:47
D3PD::Trig::DataAccess::GetDetailLevel
virtual Int_t GetDetailLevel() const
Get the detail level that the D3PD was produced with.
D3PD::Trig::IDataAccess::PassedThrough
@ PassedThrough
Definition: IDataAccess.h:61
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
D3PD::Trig::IDataAccess::Physics
@ Physics
Definition: IDataAccess.h:58
D3PD::TrigDefs::allowResurrected
@ allowResurrected
The decision while allowing the chain to be resurrected.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/Conditions.h:67
D3PD::Trig::DataAccess::GetHLTPSK
virtual Int_t GetHLTPSK() const
Get the HLT prescale key of the current event.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
D3PD::Trig::DataAccess::GetL2Result
virtual const std::vector< short > * GetL2Result(HLTResultType type) const
Function for retrieving the encoded LVL2 result.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
D3PD::Trig::DataAccess::GetL1Result
virtual const std::vector< unsigned int > * GetL1Result(L1ResultType type) const
Function for retrieving the encoded LVL1 result.
D3PD::Trig::DataAccess::GetEFResult
virtual const std::vector< short > * GetEFResult(HLTResultType type) const
Function for retrieving the encoded EF result.
D3PD::TrigDefs::passedThrough
@ passedThrough
The passthrough decision for the chain.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/Conditions.h:76
D3PD::TrigDecisionToolD3PD::IsPassed
Bool_t IsPassed(const std::string &name, TrigDefs::DecisionTypes type=TrigDefs::Physics)
Find out whether a given LVL1 item / HLT chain was passed in the event.
D3PD::Trig::IDataAccess::Raw
@ Raw
Definition: IDataAccess.h:59
D3PD::TrigDefs::L1_TBP
@ L1_TBP
LVL1 Trigger Before Prescale decision.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/Conditions.h:84
TrigDecisionToolD3PD.h
D3PD::TrigConfigSvcD3PD::Load
Bool_t Load(Int_t SMK, Int_t L1PSK, Int_t HLTPSK)
Load the configuration belonging to a DB entry.
D3PD::Trig::IDataAccess::TBP
@ TBP
Definition: IDataAccess.h:52