ATLAS Offline Software
Functions
BinsDiffFromStripMedian.cxx File Reference
#include <dqm_core/AlgorithmConfig.h>
#include <dqm_algorithms/BinsDiffFromStripMedian.h>
#include <dqm_algorithms/tools/AlgorithmHelper.h>
#include <dqm_core/AlgorithmManager.h>
#include <TH1.h>
#include <TF1.h>
#include <TClass.h>
#include <cmath>
#include <iostream>
#include <string>

Go to the source code of this file.

Functions

bool mySortfunc (const bin &i, const bin &j)
 
bool mySortfunc_ratio (const bin &i, const bin &j)
 
void AddToList (const int r0, const int r2, int i, int j, std::vector< std::vector< colorbin > > &ColorBinMap, std::vector< colorbin > &LookAtList)
 
double CalEta (std::vector< colorbin > &LookAtList)
 
double CalPhi (std::vector< colorbin > &LookAtList)
 
double CalVal (std::vector< colorbin > &LookAtList)
 
double CalR (std::vector< colorbin > &LookAtList, double eta, double phi)
 

Function Documentation

◆ AddToList()

void AddToList ( const int  r0,
const int  r2,
int  i,
int  j,
std::vector< std::vector< colorbin > > &  ColorBinMap,
std::vector< colorbin > &  LookAtList 
)

Definition at line 291 of file BinsDiffFromStripMedian.cxx.

291  {
292 
293  if( i-r0<0 || i-r0>=(int)ColorBinMap.size()
294  || j-r2<0 ||j-r2>=(int)ColorBinMap[0].size() ) return;
295 
296  std::vector<colorbin> tmp;
297 
298  if(i-1-r0>=0 && j-1-r2>=0 && ColorBinMap[i-1-r0][j-1-r2].m_status==1){
299  tmp.push_back(ColorBinMap[i-1-r0][j-1-r2]);
300  ColorBinMap[i-1-r0][j-1-r2].m_status=0;
301  }
302  if(j-1-r2 >=0 && ColorBinMap[i-r0][j-1-r2].m_status==1){
303  tmp.push_back(ColorBinMap[i-r0][j-1-r2]);
304  ColorBinMap[i-r0][j-1-r2].m_status=0;
305  }
306  if(i+1-r0<(int)ColorBinMap.size() && j-1-r2 >=0 && ColorBinMap[i+1-r0][j-1-r2].m_status==1){
307  tmp.push_back(ColorBinMap[i+1-r0][j-1-r2]);
308  ColorBinMap[i+1-r0][j-1-r2].m_status=0;
309  }
310  if(i-1-r0>=0 && ColorBinMap[i-1-r0][j-r2].m_status==1){
311  tmp.push_back(ColorBinMap[i-1-r0][j-r2]);
312  ColorBinMap[i-1-r0][j-r2].m_status=0;
313  }
314 
315  if(i+1-r0<(int)ColorBinMap.size() && ColorBinMap[i+1-r0][j-r2].m_status==1){
316  tmp.push_back(ColorBinMap[i+1-r0][j-r2]);
317  ColorBinMap[i+1-r0][j-r2].m_status=0;
318  }
319  if(i-1-r0>=0 && j+1-r2 < (int)ColorBinMap[0].size()
320  && ColorBinMap[i-1-r0][j+1-r2].m_status==1){
321  tmp.push_back(ColorBinMap[i-1-r0][j+1-r2]);
322  ColorBinMap[i-1-r0][j+1-r2].m_status=0;
323  }
324 if(j+1-r2<(int)ColorBinMap[0].size()&& ColorBinMap[i-r0][j+1-r2].m_status==1){
325  tmp.push_back(ColorBinMap[i-r0][j+1-r2]);
326  ColorBinMap[i-r0][j+1-r2].m_status=0;
327  }
328  if(i+1-r0<(int)ColorBinMap.size() && j+1-r2<(int)ColorBinMap[0].size()&&ColorBinMap[i+1-r0][j+1-r2].m_status==1){
329  tmp.push_back(ColorBinMap[i+1-r0][j+1-r2]);
330  ColorBinMap[i+1-r0][j+1-r2].m_status=0;
331  }
332 
333  for(unsigned int k=0;k<tmp.size();k++){
334  if(tmp[k].m_color!=green){
335  LookAtList.push_back(tmp[k]);
336  AddToList(r0,r2,tmp[k].m_ix,tmp[k].m_iy,ColorBinMap,LookAtList);
337  }
338  }
339  return;
340 
341 }

◆ CalEta()

double CalEta ( std::vector< colorbin > &  LookAtList)

Definition at line 343 of file BinsDiffFromStripMedian.cxx.

343  {
344  double sumEta=0;
345  double sumN=0;
346  for(unsigned int i=0;i<LookAtList.size();i++){
347  double eta = LookAtList[i].m_eta;
348  double n = LookAtList[i].m_value;
349  sumEta += n*eta;
350  sumN +=n;
351  }
352  if(sumN!=0) return sumEta/sumN;
353  else return -99;
354 }

◆ CalPhi()

double CalPhi ( std::vector< colorbin > &  LookAtList)

Definition at line 355 of file BinsDiffFromStripMedian.cxx.

355  {
356  double sumPhi=0;
357  double sumN=0;
358  for(unsigned int i=0;i<LookAtList.size();i++){
359  double phi = LookAtList[i].m_phi;
360  double n = LookAtList[i].m_value;
361  sumPhi += n*phi;
362  sumN +=n;
363  }
364  if(sumN!=0) return sumPhi/sumN;
365  else return -99;
366 }

◆ CalR()

double CalR ( std::vector< colorbin > &  LookAtList,
double  eta,
double  phi 
)

Definition at line 375 of file BinsDiffFromStripMedian.cxx.

375  {
376  if(LookAtList.size()<2) return 0;
377  double maxR=0;
378  for(unsigned int i=0;i<LookAtList.size();i++){
379  double distance = std::sqrt(std::pow((LookAtList[i].m_eta-eta),2)+std::pow((LookAtList[i].m_phi-phi),2));
380  maxR=distance>maxR?distance:maxR;
381  }
382  return maxR;
383 }

◆ CalVal()

double CalVal ( std::vector< colorbin > &  LookAtList)

Definition at line 367 of file BinsDiffFromStripMedian.cxx.

367  {
368  double sumN=0;
369  for(unsigned int i=0;i<LookAtList.size();i++){
370  double n = LookAtList[i].m_value;
371  sumN += n;
372  }
373  return sumN;
374 }

◆ mySortfunc()

bool mySortfunc ( const bin i,
const bin j 
)

Definition at line 23 of file BinsDiffFromStripMedian.cxx.

23 {return (i.m_value > j.m_value);}

◆ mySortfunc_ratio()

bool mySortfunc_ratio ( const bin i,
const bin j 
)

Definition at line 24 of file BinsDiffFromStripMedian.cxx.

24 {return (i.m_outstandingRatio> j.m_outstandingRatio);}
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
MCP::ScaleSmearParam::r2
@ r2
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
TRT_PAI_physicsConstants::r0
const double r0
electron radius{cm}
Definition: TRT_PAI_physicsConstants.h:20
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
bin::m_outstandingRatio
double m_outstandingRatio
Definition: BinsDiffFromStripMedian.h:50
green
@ green
Definition: BinsDiffFromStripMedian.h:18
bin::m_value
double m_value
Definition: BinsDiffFromStripMedian.h:49
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
AddToList
void AddToList(const int r0, const int r2, int i, int j, std::vector< std::vector< colorbin > > &ColorBinMap, std::vector< colorbin > &LookAtList)
Definition: BinsDiffFromStripMedian.cxx:291
fitman.k
k
Definition: fitman.py:528