test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
FedCablingAlgorithm Class Reference

Histogram-based analysis for connection loop. More...

#include <FedCablingAlgorithm.h>

Inheritance diagram for FedCablingAlgorithm:
CommissioningAlgorithm

Public Member Functions

 FedCablingAlgorithm (const edm::ParameterSet &pset, FedCablingAnalysis *const )
 
const HistohFedCh () const
 
const HistohFedId () const
 
virtual ~FedCablingAlgorithm ()
 
- Public Member Functions inherited from CommissioningAlgorithm
void analysis (const std::vector< TH1 * > &)
 
 CommissioningAlgorithm (CommissioningAnalysis *const )
 
 CommissioningAlgorithm ()
 
virtual ~CommissioningAlgorithm ()
 

Private Member Functions

void analyse ()
 
void extract (const std::vector< TH1 * > &)
 
 FedCablingAlgorithm ()
 

Private Attributes

Histo hFedCh_
 
Histo hFedId_
 

Additional Inherited Members

- Public Types inherited from CommissioningAlgorithm
typedef std::pair< TH1
*, std::string > 
Histo
 
- Protected Member Functions inherited from CommissioningAlgorithm
CommissioningAnalysis *const anal () const
 
uint32_t extractFedKey (const TH1 *const )
 

Detailed Description

Histogram-based analysis for connection loop.

Author
R.Bainbridge

Definition at line 16 of file FedCablingAlgorithm.h.

Constructor & Destructor Documentation

FedCablingAlgorithm::FedCablingAlgorithm ( const edm::ParameterSet pset,
FedCablingAnalysis * const  anal 
)

Definition at line 17 of file FedCablingAlgorithm.cc.

virtual FedCablingAlgorithm::~FedCablingAlgorithm ( )
inlinevirtual

Definition at line 24 of file FedCablingAlgorithm.h.

24 {;}
FedCablingAlgorithm::FedCablingAlgorithm ( )
inlineprivate

Definition at line 34 of file FedCablingAlgorithm.h.

34 {;}

Member Function Documentation

void FedCablingAlgorithm::analyse ( )
privatevirtual

Performs histogram anaysis.

Implements CommissioningAlgorithm.

Definition at line 73 of file FedCablingAlgorithm.cc.

References FedCablingAnalysis::adcLevel_, CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), FedCablingAnalysis::candidates_, SiStripFedKey::feChan(), FedCablingAnalysis::fedCh_, FedCablingAnalysis::fedId_, SiStripFedKey::feUnit(), hFedCh_, hFedId_, sistrip::invalid_, SiStripKey::key(), relval_steps::key, bookConverter::max, sistrip::mlCommissioning_, sistrip::noCandidates_, sistrip::nullPtr_, FedCablingAnalysis::threshold_, tmp, and histoStyle::weight.

73  {
74 
75  if ( !anal() ) {
77  << "[FedCablingAlgorithm::" << __func__ << "]"
78  << " NULL pointer to base Analysis object!";
79  return;
80  }
81 
83  FedCablingAnalysis* anal = dynamic_cast<FedCablingAnalysis*>( tmp );
84  if ( !anal ) {
86  << "[FedCablingAlgorithm::" << __func__ << "]"
87  << " NULL pointer to derived Analysis object!";
88  return;
89  }
90 
91  if ( !hFedId_.first ) {
93  return;
94  }
95 
96  if ( !hFedCh_.first ) {
98  return;
99  }
100 
101  TProfile* fedid_histo = dynamic_cast<TProfile*>(hFedId_.first);
102  if ( !fedid_histo ) {
104  return;
105  }
106 
107  TProfile* fedch_histo = dynamic_cast<TProfile*>(hFedCh_.first);
108  if ( !fedch_histo ) {
110  return;
111  }
112 
113  // Some initialization
114  anal->candidates_.clear();
115  float max = -1.;
116  float weight = -1.;
117  uint16_t id_val = sistrip::invalid_;
118  uint16_t ch_val = sistrip::invalid_;
119 
120  // FED id
121  max = 0.;
122  for ( uint16_t ifed = 0; ifed < fedid_histo->GetNbinsX(); ifed++ ) {
123  if ( fedid_histo->GetBinEntries(ifed+1) ) {
124  if ( fedid_histo->GetBinContent(ifed+1) > max &&
125  fedid_histo->GetBinContent(ifed+1) > FedCablingAnalysis::threshold_ ) {
126  id_val = ifed;
127  max = fedid_histo->GetBinContent(ifed+1);
128  }
129  }
130  }
131  weight = max;
132 
133  // FED ch
134  max = 0.;
135  for ( uint16_t ichan = 0; ichan < fedch_histo->GetNbinsX(); ichan++ ) {
136  if ( fedch_histo->GetBinEntries(ichan+1) ) {
137  if ( fedch_histo->GetBinContent(ichan+1) > max &&
138  fedch_histo->GetBinContent(ichan+1) > FedCablingAnalysis::threshold_ ) {
139  ch_val = ichan;
140  max = fedch_histo->GetBinContent(ichan+1);
141  }
142  }
143  }
144  if ( max > weight ) { weight = max; }
145 
146  // Set "best" candidate and ADC level
147  if ( id_val != sistrip::invalid_ &&
148  ch_val != sistrip::invalid_ ) {
149  uint32_t key = SiStripFedKey( id_val,
150  SiStripFedKey::feUnit(ch_val),
151  SiStripFedKey::feChan(ch_val) ).key();
152  anal->candidates_[key] = static_cast<uint16_t>(weight);
153  anal->fedId_ = id_val;
154  anal->fedCh_ = ch_val;
155  anal->adcLevel_ = weight;
156  } else {
158  }
159 
160 }
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
Histogram-based analysis for connection loop.
static const float threshold_
static const char noCandidates_[]
const uint32_t & key() const
Definition: SiStripKey.h:125
static const char mlCommissioning_[]
virtual void addErrorCode(const std::string &error)
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
const uint16_t & feUnit() const
static const uint16_t invalid_
Definition: Constants.h:16
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const uint16_t & feChan() const
Abstract base for derived classes that provide analysis of commissioning histograms.
int weight
Definition: histoStyle.py:50
CommissioningAnalysis *const anal() const
static const char nullPtr_[]
void FedCablingAlgorithm::extract ( const std::vector< TH1 * > &  histos)
privatevirtual

Extracts and organises histograms.

Implements CommissioningAlgorithm.

Definition at line 25 of file FedCablingAlgorithm.cc.

References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), CommissioningAlgorithm::extractFedKey(), sistrip::FED_CABLING, sistrip::fedChannel_, CommissioningAnalysis::fedKey(), sistrip::feDriver_, hFedCh_, hFedId_, sistrip::mlCommissioning_, sistrip::numberOfHistos_, indexGen::title, sistrip::unexpectedExtraInfo_, and sistrip::unexpectedTask_.

Referenced by BeautifulSoup.PageElement::_invert(), and BeautifulSoup.Tag::decompose().

25  {
26 
27  if ( !anal() ) {
29  << "[FedCablingAlgorithm::" << __func__ << "]"
30  << " NULL pointer to Analysis object!";
31  return;
32  }
33 
34  // Check number of histograms
35  if ( histos.size() != 2 ) {
37  }
38 
39  // Extract FED key from histo title
40  if ( !histos.empty() ) { anal()->fedKey( extractFedKey( histos.front() ) ); }
41 
42  // Extract histograms
43  std::vector<TH1*>::const_iterator ihis = histos.begin();
44  for ( ; ihis != histos.end(); ihis++ ) {
45 
46  // Check for NULL pointer
47  if ( !(*ihis) ) { continue; }
48 
49  // Check name
50  SiStripHistoTitle title( (*ihis)->GetName() );
51  if ( title.runType() != sistrip::FED_CABLING ) {
53  continue;
54  }
55 
56  // Extract FED id and channel histos
57  if ( title.extraInfo().find(sistrip::feDriver_) != std::string::npos ) {
58  hFedId_.first = *ihis;
59  hFedId_.second = (*ihis)->GetName();
60  } else if ( title.extraInfo().find(sistrip::fedChannel_) != std::string::npos ) {
61  hFedCh_.first = *ihis;
62  hFedCh_.second = (*ihis)->GetName();
63  } else {
65  }
66 
67  }
68 
69 }
static const char feDriver_[]
static const char unexpectedTask_[]
const uint32_t & fedKey() const
Utility class that holds histogram title.
static const char numberOfHistos_[]
static const char unexpectedExtraInfo_[]
static const char mlCommissioning_[]
uint32_t extractFedKey(const TH1 *const )
virtual void addErrorCode(const std::string &error)
static const char fedChannel_[]
CommissioningAnalysis *const anal() const
const FedCablingAlgorithm::Histo & FedCablingAlgorithm::hFedCh ( ) const
inline

Pointer to FED channel histogram.

Definition at line 53 of file FedCablingAlgorithm.h.

References hFedCh_.

53 { return hFedCh_; }
const FedCablingAlgorithm::Histo & FedCablingAlgorithm::hFedId ( ) const
inline

Pointer to FED id histogram.

Definition at line 52 of file FedCablingAlgorithm.h.

References hFedId_.

52 { return hFedId_; }

Member Data Documentation

Histo FedCablingAlgorithm::hFedCh_
private

Histo containing FED channel

Definition at line 48 of file FedCablingAlgorithm.h.

Referenced by analyse(), extract(), and hFedCh().

Histo FedCablingAlgorithm::hFedId_
private

Histo containing FED id

Definition at line 45 of file FedCablingAlgorithm.h.

Referenced by analyse(), extract(), and hFedId().