CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
compareCands< T > Class Template Reference

#include <compareCands.h>

Public Member Functions

 compareCands (const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams)
 
bool doCompare (TH1I *errorFlag_hist_, TH1I *mismatchD_Rank, TH2I *mismatchD_EtEtaPhi, TH1I *mismatchE_Rank, TH2I *mismatchE_EtEtaPhi)
 
 ~compareCands ()
 

Private Attributes

T data_
 
T emu_
 
GctErrorAnalyzerMBxInfo mbxparams_
 

Detailed Description

template<class T>
class compareCands< T >

Definition at line 21 of file compareCands.h.

Constructor & Destructor Documentation

◆ compareCands()

template<class T >
compareCands< T >::compareCands ( const T data,
const T emu,
const GctErrorAnalyzerMBxInfo mbxparams 
)

Definition at line 39 of file compareCands.h.

40  : data_(data), emu_(emu), mbxparams_(mbxparams) {
41  //std::cout << "initialising..." << std::endl;
42 }

◆ ~compareCands()

template<class T >
compareCands< T >::~compareCands ( )

Definition at line 45 of file compareCands.h.

45  {
46  //anything need destructing?
47 }

Member Function Documentation

◆ doCompare()

template<class T >
bool compareCands< T >::doCompare ( TH1I *  errorFlag_hist_,
TH1I *  mismatchD_Rank,
TH2I *  mismatchD_EtEtaPhi,
TH1I *  mismatchE_Rank,
TH2I *  mismatchE_EtEtaPhi 
)

Definition at line 50 of file compareCands.h.

54  {
55  //this code has now been patched to be multiple_bx compliant. However, this still means that only 1 comparison will happen per event, and this has to be
56  //matched such that the RCTTrigBx(=0) data is run over the emulator and the EmuTrigBx analysis (Bx=0) corresponds to the GCTTrigBx (Bx=0) analysis
57  //These TrigBx parameters are set in the configuration to make things more flexible if things change later
58 
59  //define some temporary local variables
60  bool errorFlag = false;
61  unsigned int i = 0, j = 0;
62  std::vector<bool> matched(GCT_OBJECT_QUANTA);
63  //this makes a vector of GCT_OBJECT_QUANTA=4 bools, all set to false
64  //remember that pushing back will make the vector larger!
65 
66  for (i = 0; i < data_->size(); i++) {
67  //The first thing to check is that the BX of the data corresponds to the trig Bx (we expect these to be contiguous i.e. data sorted in Bx)
68  if (data_->at(i).bx() != mbxparams_.GCTTrigBx)
69  continue;
70 
71  //If the data candidate has zero rank, move to the next data candidate
72  //since all the candidates are ranked in order of rank, this implies all the remaining data candidates also have rank = 0
73  if (data_->at(i).rank() == 0)
74  continue;
75 
76  for (j = 0; j < emu_->size(); j++) {
77  //Again, the first thing to check in this loop is that the BX of the emulator data corresponds to the trig Bx
78  if (emu_->at(j).bx() != mbxparams_.EmuTrigBx)
79  continue;
80 
81  if (data_->at(i).rank() == emu_->at(j).rank() &&
82  data_->at(i).regionId().ieta() == emu_->at(j).regionId().ieta() &&
83  data_->at(i).regionId().iphi() == emu_->at(j).regionId().iphi() && matched.at((j % GCT_OBJECT_QUANTA)) == 0) {
84  //this means that the ith data candidate matches the jth emulator candidate
85  errorFlag_hist_->Fill(0); //fill the errorflag histo in the matched bin
86  matched.at((j % GCT_OBJECT_QUANTA)) = true; //set emulator candidate to matched so it doesn't get re-used
87  break; //matched the current data candidate, now move to the next
88  }
89 
90  if ((j % GCT_OBJECT_QUANTA) + 1 == GCT_OBJECT_QUANTA) {
91  errorFlag_hist_->Fill(1); //fill the errorflag histo in the unmatched data candidate bin
92  mismatchD_Rank->Fill(data_->at(i).rank()); //fill the rank histogram of mismatched data candidates
93  mismatchD_EtEtaPhi->Fill(data_->at(i).regionId().ieta(),
94  data_->at(i).regionId().iphi(),
95  data_->at(i).rank()); //fill the EtEtaPhi dist for mismatched candidates
96  errorFlag = true; //set the errorFlag to true
97  }
98  }
99  }
100 
101  //loop over the matched boolean vector and see if there are any rank>0 unmatched emu candidates - if there are populate the histogram in the emulator mismatched bin
102  for (i = 0; i < matched.size(); i++) {
103  //the first thing to check is that the matched flag for object i out of 0,1,2,3 (0 -> GCT_OBJECT_QUANTA-1) is not set - then we can check that the corresponding
104  //emulator candidates either have rank = 0 (which is good) or rank > 0 (which is bad)
105  if (matched.at(i))
106  continue;
107 
108  //now loop over the emulator candidates
109  for (j = 0; j < emu_->size(); j++) {
110  //check that the bx of the emulator candidates is the trigbx
111  if (emu_->at(j).bx() != mbxparams_.EmuTrigBx)
112  continue;
113 
114  //now check that the j%GCT_OBJECT_QUANTA is the same as the index of the false entry in the bool_matched vector so that we are looking at the right candidate
115  if ((j % GCT_OBJECT_QUANTA == i) && (emu_->at(j).rank() > 0)) {
116  errorFlag_hist_->Fill(2); //increment emulator mismatched bin
117  mismatchE_Rank->Fill(emu_->at(j).rank()); //fill the rank histogram for unmatched emulator
118  mismatchE_EtEtaPhi->Fill(emu_->at(j).regionId().ieta(),
119  emu_->at(j).regionId().iphi(),
120  emu_->at(j).rank()); //fill EtEtaPhi for unmatched emu cands
121  errorFlag = true; //set the errorFlag (if it's not already)
122  }
123  }
124  }
125 
126  return errorFlag;
127 }

References GCT_OBJECT_QUANTA, mps_fire::i, dqmiolumiharvest::j, and muonTagProbeFilters_cff::matched.

Referenced by GctErrorAnalyzer::analyze().

Member Data Documentation

◆ data_

template<class T >
T compareCands< T >::data_
private

Definition at line 33 of file compareCands.h.

◆ emu_

template<class T >
T compareCands< T >::emu_
private

Definition at line 33 of file compareCands.h.

◆ mbxparams_

template<class T >
GctErrorAnalyzerMBxInfo compareCands< T >::mbxparams_
private

Definition at line 34 of file compareCands.h.

muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
mps_fire.i
i
Definition: mps_fire.py:355
compareCands::emu_
T emu_
Definition: compareCands.h:33
compareCands::data_
T data_
Definition: compareCands.h:33
GCT_OBJECT_QUANTA
const unsigned int GCT_OBJECT_QUANTA
Definition: GctErrorAnalyzerDefinitions.h:4
GctErrorAnalyzerMBxInfo::GCTTrigBx
int GCTTrigBx
Definition: GctErrorAnalyzerDefinitions.h:16
compareCands::mbxparams_
GctErrorAnalyzerMBxInfo mbxparams_
Definition: compareCands.h:34
GctErrorAnalyzerMBxInfo::EmuTrigBx
int EmuTrigBx
Definition: GctErrorAnalyzerDefinitions.h:15
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66