ATLAS Offline Software
Functions
TrigMissingET.cxx File Reference
#include "TrigMissingEtEvent/TrigMissingET.h"
#include "TrigMissingEtEvent/TrigMissingEtComponent.h"
#include "CxxUtils/StrFormat.h"
#include <string>
#include <stdio.h>
#include <string.h>
#include <cmath>
Include dependency graph for TrigMissingET.cxx:

Go to the source code of this file.

Functions

bool operator== (const TrigMissingET &a, const TrigMissingET &b)
 Operator comparing two objects for equality. More...
 
std::string str (const TrigMissingET &a)
 conversion to formatted string: multi-line! More...
 
MsgStream & operator<< (MsgStream &m, const TrigMissingET &d)
 
void diff (const TrigMissingET &a, const TrigMissingET &b, std::map< std::string, double > &variableChange)
 Comparison with feedback. More...
 

Function Documentation

◆ diff()

void diff ( const TrigMissingET a,
const TrigMissingET b,
std::map< std::string, double > &  variableChange 
)

Comparison with feedback.

Definition at line 342 of file TrigMissingET.cxx.

343  {
344 
345  const double DELTA=1e-3; // distance used to compare floats
346 
347  int Na = a.getNumOfComponents();
348  int Nb = b.getNumOfComponents();
349  if( Na != Nb )
350  variableChange[ "NumOfComponents" ] = Na - Nb;
351 
352  unsigned aFlag = (unsigned) a.getFlag();
353  unsigned bFlag = (unsigned) b.getFlag();
354  if( aFlag != bFlag )
355  variableChange[ "FlagsXOR" ] = aFlag ^ bFlag;
356 
357  unsigned long aRoI = (unsigned long) a.RoIword();
358  unsigned long bRoI = (unsigned long) b.RoIword();
359  if( aRoI != bRoI )
360  variableChange[ "RoIwordsXOR" ] = aRoI ^ bRoI;
361 
362  float aEx = a.ex();
363  float bEx = b.ex();
364  if( fabsf(aEx - bEx) > DELTA )
365  variableChange[ "Ex" ] = aEx - bEx;
366 
367  float aEy = a.ey();
368  float bEy = b.ey();
369  if( fabsf(aEy - bEy) > DELTA )
370  variableChange[ "Ey" ] = aEy - bEy;
371 
372  float aEz = a.ez();
373  float bEz = b.ez();
374  if( fabsf(aEz - bEz) > DELTA )
375  variableChange[ "Ez" ] = aEz - bEz;
376 
377  float aSumEt = a.sumEt();
378  float bSumEt = b.sumEt();
379  if( fabsf(aSumEt - bSumEt) > DELTA )
380  variableChange[ "sumEt" ] = aSumEt - bSumEt;
381 
382  float aSumE = a.sumE();
383  float bSumE = b.sumE();
384  if( fabsf(aSumE - bSumE) > DELTA )
385  variableChange[ "sumE" ] = aSumE - bSumE;
386 
387  for (unsigned u=0; u<a.getNumOfComponents(); ++u) {
388  std::string num = CxxUtils::strformat("%02u", u);
389  std::string key;
390 
391  if( a.getNameOfComponent(u) != b.getNameOfComponent(u) ) {
392  key="CompNameStrCmp"; key+=num;
393  variableChange[ key.c_str() ] =
394  strcmp(a.getNameOfComponent(u).c_str(),
395  b.getNameOfComponent(u).c_str());
396  }
397 
398  unsigned aFlag = (unsigned) a.getStatus(u);
399  unsigned bFlag = (unsigned) b.getStatus(u);
400  if( aFlag != bFlag ) {
401  key="CompStatusXOR"; key+=num;
402  variableChange[ key.c_str() ] = aFlag ^ bFlag;
403  }
404 
405  int aSigns = a.getSumOfSigns(u);
406  int bSigns = b.getSumOfSigns(u);
407  if( aSigns != bSigns ) {
408  key="CompSumSigns"; key+=num;
409  variableChange[ key.c_str() ] = aSigns - bSigns;
410  }
411 
412  int aChans = a.getUsedChannels(u);
413  int bChans = b.getUsedChannels(u);
414  if( aChans != bChans ) {
415  key="CompUsedChans"; key+=num;
416  variableChange[ key.c_str() ] = aChans - bChans;
417  }
418 
419  float aEx = a.getExComponent(u);
420  float bEx = b.getExComponent(u);
421  if( fabsf(aEx - bEx) > DELTA ) {
422  key="CompEx"; key+=num;
423  variableChange[ key.c_str() ] = aEx - bEx;
424  }
425 
426  float aEy = a.getEyComponent(u);
427  float bEy = b.getEyComponent(u);
428  if( fabsf(aEy - bEy) > DELTA ) {
429  key="CompEy"; key+=num;
430  variableChange[ key.c_str() ] = aEy - bEy;
431  }
432 
433  float aEz = a.getEzComponent(u);
434  float bEz = b.getEzComponent(u);
435  if( fabsf(aEz - bEz) > DELTA ) {
436  key="CompEz"; key+=num;
437  variableChange[ key.c_str() ] = aEz - bEz;
438  }
439 
440  float aSumEt = a.getSumEtComponent(u);
441  float bSumEt = b.getSumEtComponent(u);
442  if( fabsf(aSumEt - bSumEt) > DELTA ) {
443  key="CompSumEt"; key+=num;
444  variableChange[ key.c_str() ] = aSumEt - bSumEt;
445  }
446 
447  float aSumE = a.getSumEComponent(u);
448  float bSumE = b.getSumEComponent(u);
449  if( fabsf(aSumE - bSumE) > DELTA ) {
450  key="CompSumE"; key+=num;
451  variableChange[ key.c_str() ] = aSumE - bSumE;
452  }
453 
454  float aCalib0 = a.getComponentCalib0(u);
455  float bCalib0 = b.getComponentCalib0(u);
456  if( fabsf(aCalib0 - bCalib0) > DELTA ) {
457  key="CompCalib0_"; key+=num;
458  variableChange[ key.c_str() ] = aCalib0 - bCalib0;
459  }
460 
461  float aCalib1 = a.getComponentCalib1(u);
462  float bCalib1 = b.getComponentCalib1(u);
463  if( fabsf(aCalib1 - bCalib1) > DELTA ) {
464  key="CompCalib1_"; key+=num;
465  variableChange[ key.c_str() ] = aCalib1 - bCalib1;
466  }
467  }
468 
469  return;
470 }

◆ operator<<()

MsgStream& operator<< ( MsgStream &  m,
const TrigMissingET d 
)

Definition at line 336 of file TrigMissingET.cxx.

336  {
337  return ( m << str( d ) );
338 }

◆ operator==()

bool operator== ( const TrigMissingET a,
const TrigMissingET b 
)

Operator comparing two objects for equality.

Definition at line 241 of file TrigMissingET.cxx.

241  {
242 
243  const double DELTA=1e-3; // distance used to compare floats
244 
245  if( a.getNumOfComponents() != b.getNumOfComponents() )
246  return false;
247  if( a.getFlag() != b.getFlag() )
248  return false;
249  if( a.RoIword() != b.RoIword() )
250  return false;
251 
252  if( fabsf(a.ex() - b.ex()) > DELTA )
253  return false;
254  if( fabsf(a.ey() - b.ey()) > DELTA )
255  return false;
256  if( fabsf(a.ez() - b.ez()) > DELTA )
257  return false;
258  if( fabsf(a.sumEt() - b.sumEt()) > DELTA )
259  return false;
260  if( fabsf(a.sumE() - b.sumE()) > DELTA )
261  return false;
262 
263  for (unsigned u=0; u<a.getNumOfComponents(); ++u) {
264  if( a.getNameOfComponent(u) != b.getNameOfComponent(u) )
265  return false;
266  if( a.getStatus(u) != b.getStatus(u) )
267  return false;
268  if( a.getSumOfSigns(u) != b.getSumOfSigns(u) )
269  return false;
270  if( a.getUsedChannels(u) != b.getUsedChannels(u) )
271  return false;
272  if( fabsf(a.getExComponent(u) - b.getExComponent(u)) > DELTA )
273  return false;
274  if( fabsf(a.getEyComponent(u) - b.getEyComponent(u)) > DELTA )
275  return false;
276  if( fabsf(a.getEzComponent(u) - b.getEzComponent(u)) > DELTA )
277  return false;
278  if( fabsf(a.getSumEtComponent(u) - b.getSumEtComponent(u)) > DELTA )
279  return false;
280  if( fabsf(a.getSumEComponent(u) - b.getSumEComponent(u)) > DELTA )
281  return false;
282  if( fabsf(a.getComponentCalib0(u) - b.getComponentCalib0(u)) > DELTA )
283  return false;
284  if( fabsf(a.getComponentCalib1(u) - b.getComponentCalib1(u)) > DELTA )
285  return false;
286  }
287 
288  return true;
289 }

◆ str()

std::string str ( const TrigMissingET a)

conversion to formatted string: multi-line!

Definition at line 292 of file TrigMissingET.cxx.

292  {
293  std::string s="";
294 
295  using CxxUtils::strformat;
296 
297  s += strformat("MEx = %10.2f MeV\n", a.ex());
298  s += strformat("MEy = %10.2f MeV\n", a.ey());
299  s += strformat("MEz = %10.2f MeV\n", a.ez());
300 
301  float et = std::sqrt(a.ex()*a.ex()+a.ey()*a.ey());
302  s += strformat("MEt = %10.2f MeV\n", et);
303  s += strformat("SumEt = %10.2f MeV\n", a.sumEt());
304  s += strformat("SumE = %10.2f MeV\n", a.sumE());
305 
306  s += strformat("Event status = 0x%08x\n", (unsigned)a.getFlag());
307  unsigned int N = a.getNumOfComponents();
308  s += strformat("Auxiliary components = %4u\n", N);
309 
310  if (N==0) return s; // basic info only
311 
312  // header
313  s += "__name_____status__usedCh.__sumOfSigns__calib1_calib0";
314  s += "/MeV___Ex/MeV_____Ey/MeV_____Ez/MeV___SumE/MeV__SumEt/MeV\n";
315 
316  for (unsigned int i=0; i<N; ++i){
317  s += strformat(
318  "%10s 0x%04x %8d %11d %7.2f %8.2f %10.2f %10.2f %10.2f %10.2f %10.2f\n",
319  a.getNameOfComponent(i).c_str(),
320  (unsigned)a.getStatus(i),
321  a.getUsedChannels(i),
322  a.getSumOfSigns(i),
323  a.getComponentCalib1(i),
324  a.getComponentCalib0(i),
325  a.getExComponent(i),
326  a.getEyComponent(i),
327  a.getEzComponent(i),
328  a.getSumEComponent(i),
329  a.getSumEtComponent(i));
330  }
331 
332  return s;
333 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
et
Extra patterns decribing particle interation process.
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
hist_file_dump.d
d
Definition: hist_file_dump.py:137
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
lumiFormat.i
int i
Definition: lumiFormat.py:85
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
CxxUtils::strformat
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs
Definition: StrFormat.cxx:49
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
a
TList * a
Definition: liststreamerinfos.cxx:10
str
std::string str(const TrigMissingET &a)
conversion to formatted string: multi-line!
Definition: TrigMissingET.cxx:292
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37