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 20 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 38 of file compareCands.h.

39  : data_(data), emu_(emu), mbxparams_(mbxparams) {
40  //std::cout << "initialising..." << std::endl;
41 }
GctErrorAnalyzerMBxInfo mbxparams_
Definition: compareCands.h:33
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80

◆ ~compareCands()

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

Definition at line 44 of file compareCands.h.

44  {
45  //anything need destructing?
46 }

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 49 of file compareCands.h.

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

Referenced by GctErrorAnalyzer::analyze().

53  {
54  //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
55  //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
56  //These TrigBx parameters are set in the configuration to make things more flexible if things change later
57 
58  //define some temporary local variables
59  bool errorFlag = false;
60  unsigned int i = 0, j = 0;
61  std::vector<bool> matched(GCT_OBJECT_QUANTA);
62  //this makes a vector of GCT_OBJECT_QUANTA=4 bools, all set to false
63  //remember that pushing back will make the vector larger!
64 
65  for (i = 0; i < data_->size(); i++) {
66  //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)
67  if (data_->at(i).bx() != mbxparams_.GCTTrigBx)
68  continue;
69 
70  //If the data candidate has zero rank, move to the next data candidate
71  //since all the candidates are ranked in order of rank, this implies all the remaining data candidates also have rank = 0
72  if (data_->at(i).rank() == 0)
73  continue;
74 
75  for (j = 0; j < emu_->size(); j++) {
76  //Again, the first thing to check in this loop is that the BX of the emulator data corresponds to the trig Bx
77  if (emu_->at(j).bx() != mbxparams_.EmuTrigBx)
78  continue;
79 
80  if (data_->at(i).rank() == emu_->at(j).rank() &&
81  data_->at(i).regionId().ieta() == emu_->at(j).regionId().ieta() &&
82  data_->at(i).regionId().iphi() == emu_->at(j).regionId().iphi() && matched.at((j % GCT_OBJECT_QUANTA)) == 0) {
83  //this means that the ith data candidate matches the jth emulator candidate
84  errorFlag_hist_->Fill(0); //fill the errorflag histo in the matched bin
85  matched.at((j % GCT_OBJECT_QUANTA)) = true; //set emulator candidate to matched so it doesn't get re-used
86  break; //matched the current data candidate, now move to the next
87  }
88 
89  if ((j % GCT_OBJECT_QUANTA) + 1 == GCT_OBJECT_QUANTA) {
90  errorFlag_hist_->Fill(1); //fill the errorflag histo in the unmatched data candidate bin
91  mismatchD_Rank->Fill(data_->at(i).rank()); //fill the rank histogram of mismatched data candidates
92  mismatchD_EtEtaPhi->Fill(data_->at(i).regionId().ieta(),
93  data_->at(i).regionId().iphi(),
94  data_->at(i).rank()); //fill the EtEtaPhi dist for mismatched candidates
95  errorFlag = true; //set the errorFlag to true
96  }
97  }
98  }
99 
100  //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
101  for (i = 0; i < matched.size(); i++) {
102  //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
103  //emulator candidates either have rank = 0 (which is good) or rank > 0 (which is bad)
104  if (matched.at(i))
105  continue;
106 
107  //now loop over the emulator candidates
108  for (j = 0; j < emu_->size(); j++) {
109  //check that the bx of the emulator candidates is the trigbx
110  if (emu_->at(j).bx() != mbxparams_.EmuTrigBx)
111  continue;
112 
113  //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
114  if ((j % GCT_OBJECT_QUANTA == i) && (emu_->at(j).rank() > 0)) {
115  errorFlag_hist_->Fill(2); //increment emulator mismatched bin
116  mismatchE_Rank->Fill(emu_->at(j).rank()); //fill the rank histogram for unmatched emulator
117  mismatchE_EtEtaPhi->Fill(emu_->at(j).regionId().ieta(),
118  emu_->at(j).regionId().iphi(),
119  emu_->at(j).rank()); //fill EtEtaPhi for unmatched emu cands
120  errorFlag = true; //set the errorFlag (if it's not already)
121  }
122  }
123  }
124 
125  return errorFlag;
126 }
const unsigned int GCT_OBJECT_QUANTA
GctErrorAnalyzerMBxInfo mbxparams_
Definition: compareCands.h:33

Member Data Documentation

◆ data_

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

Definition at line 32 of file compareCands.h.

◆ emu_

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

Definition at line 32 of file compareCands.h.

◆ mbxparams_

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

Definition at line 33 of file compareCands.h.