CMS 3D CMS Logo

Public Member Functions | Private Attributes

compareTotalEnergySums< T > Class Template Reference

#include <compareTotalEnergySums.h>

List of all members.

Public Member Functions

 compareTotalEnergySums (const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams)
bool doCompare (TH1I *errorFlag_hist_)
 ~compareTotalEnergySums ()

Private Attributes

T data_
T emu_
GctErrorAnalyzerMBxInfo mbxparams_

Detailed Description

template<class T>
class compareTotalEnergySums< T >

Definition at line 24 of file compareTotalEnergySums.h.


Constructor & Destructor Documentation

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

Definition at line 37 of file compareTotalEnergySums.h.

                                                                                                                       :
  data_(data),
  emu_(emu),
  mbxparams_(mbxparams)    
{
  //std::cout << "initialising..." << std::endl;
}
template<class T >
compareTotalEnergySums< T >::~compareTotalEnergySums ( )

Definition at line 46 of file compareTotalEnergySums.h.

                                                   {
  //anything need to be destructed?
}

Member Function Documentation

template<class T >
bool compareTotalEnergySums< T >::doCompare ( TH1I *  errorFlag_hist_)

Definition at line 51 of file compareTotalEnergySums.h.

References i, and j.

Referenced by GctErrorAnalyzer::analyze().

                                                               {
  
  bool errorFlag=0;

  for(unsigned int i=0; i < data_->size(); i++) {
    //check the GCTTrigBx is the one being considered
    if(data_->at(i).bx() != mbxparams_.GCTTrigBx) continue;

    for(unsigned int j=0; j < emu_->size(); j++) {
      //check the EmuTrigBx is the one being considered
      if(emu_->at(j).bx() != mbxparams_.EmuTrigBx) continue;

      //now check if both overflow bits (from the trigbx) are set
      if(data_->at(i).overFlow() && emu_->at(j).overFlow()) { 
        //if the overflow bits in data and emulator are set, that's enough to call a match
        errorFlag_hist_->Fill(0);
        return errorFlag;
      }

      //check if both over flow bits are not set and if both values are zero, and if so return the errorFlag
      //without making any modifications (a zero et match doesn't mean so much). 
      if(!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == 0 && emu_->at(j).et() == 0) return errorFlag;

      //now check if the values correspond, again with both overflow bits not set
      if(!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == emu_->at(j).et()) {
        //if they are both explicitly not set, and the resulting energies are identical, that's a match
        errorFlag_hist_->Fill(0);
        return errorFlag;
      }

      //otherwise, it's a fail
      errorFlag_hist_->Fill(1);
      errorFlag=1;
      return errorFlag;
    }
  }
  return errorFlag;
}

Member Data Documentation

template<class T >
T compareTotalEnergySums< T >::data_ [private]

Definition at line 32 of file compareTotalEnergySums.h.

template<class T >
T compareTotalEnergySums< T >::emu_ [private]

Definition at line 32 of file compareTotalEnergySums.h.

template<class T >
GctErrorAnalyzerMBxInfo compareTotalEnergySums< T >::mbxparams_ [private]

Definition at line 33 of file compareTotalEnergySums.h.