CMS 3D CMS Logo

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
 
 ~FedCablingAlgorithm () override
 
- Public Member Functions inherited from CommissioningAlgorithm
void analysis (const std::vector< TH1 * > &)
 
 CommissioningAlgorithm ()
 
 CommissioningAlgorithm (CommissioningAnalysis *const)
 
virtual ~CommissioningAlgorithm ()
 

Private Member Functions

void analyse () override
 
void extract (const std::vector< TH1 * > &) override
 
 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() [1/2]

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

Definition at line 17 of file FedCablingAlgorithm.cc.

18  : CommissioningAlgorithm(anal), hFedId_(nullptr, ""), hFedCh_(nullptr, "") {
19  ;
20 }

◆ ~FedCablingAlgorithm()

FedCablingAlgorithm::~FedCablingAlgorithm ( )
inlineoverride

Definition at line 22 of file FedCablingAlgorithm.h.

22 { ; }

◆ FedCablingAlgorithm() [2/2]

FedCablingAlgorithm::FedCablingAlgorithm ( )
inlineprivate

Definition at line 31 of file FedCablingAlgorithm.h.

31 { ; }

Member Function Documentation

◆ analyse()

void FedCablingAlgorithm::analyse ( )
overrideprivatevirtual

Performs histogram anaysis.

Implements CommissioningAlgorithm.

Definition at line 71 of file FedCablingAlgorithm.cc.

71  {
72  if (!anal()) {
73  edm::LogWarning(mlCommissioning_) << "[FedCablingAlgorithm::" << __func__ << "]"
74  << " NULL pointer to base Analysis object!";
75  return;
76  }
77 
78  CommissioningAnalysis* tmp = const_cast<CommissioningAnalysis*>(anal());
79  FedCablingAnalysis* anal = dynamic_cast<FedCablingAnalysis*>(tmp);
80  if (!anal) {
81  edm::LogWarning(mlCommissioning_) << "[FedCablingAlgorithm::" << __func__ << "]"
82  << " NULL pointer to derived Analysis object!";
83  return;
84  }
85 
86  if (!hFedId_.first) {
88  return;
89  }
90 
91  if (!hFedCh_.first) {
93  return;
94  }
95 
96  TProfile* fedid_histo = dynamic_cast<TProfile*>(hFedId_.first);
97  if (!fedid_histo) {
99  return;
100  }
101 
102  TProfile* fedch_histo = dynamic_cast<TProfile*>(hFedCh_.first);
103  if (!fedch_histo) {
105  return;
106  }
107 
108  // Some initialization
109  anal->candidates_.clear();
110  float max = -1.;
111  float weight = -1.;
112  uint16_t id_val = sistrip::invalid_;
113  uint16_t ch_val = sistrip::invalid_;
114 
115  // FED id
116  max = 0.;
117  for (uint16_t ifed = 0; ifed < fedid_histo->GetNbinsX(); ifed++) {
118  if (fedid_histo->GetBinEntries(ifed + 1)) {
119  if (fedid_histo->GetBinContent(ifed + 1) > max &&
120  fedid_histo->GetBinContent(ifed + 1) > FedCablingAnalysis::threshold_) {
121  id_val = ifed;
122  max = fedid_histo->GetBinContent(ifed + 1);
123  }
124  }
125  }
126  weight = max;
127 
128  // FED ch
129  max = 0.;
130  for (uint16_t ichan = 0; ichan < fedch_histo->GetNbinsX(); ichan++) {
131  if (fedch_histo->GetBinEntries(ichan + 1)) {
132  if (fedch_histo->GetBinContent(ichan + 1) > max &&
133  fedch_histo->GetBinContent(ichan + 1) > FedCablingAnalysis::threshold_) {
134  ch_val = ichan;
135  max = fedch_histo->GetBinContent(ichan + 1);
136  }
137  }
138  }
139  if (max > weight) {
140  weight = max;
141  }
142 
143  // Set "best" candidate and ADC level
144  if (id_val != sistrip::invalid_ && ch_val != sistrip::invalid_) {
145  uint32_t key = SiStripFedKey(id_val, SiStripFedKey::feUnit(ch_val), SiStripFedKey::feChan(ch_val)).key();
146  anal->candidates_[key] = static_cast<uint16_t>(weight);
147  anal->fedId_ = id_val;
148  anal->fedCh_ = ch_val;
149  anal->adcLevel_ = weight;
150  } else {
152  }
153 }

References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), SiStripFedKey::feChan(), SiStripFedKey::feUnit(), hFedCh_, hFedId_, sistrip::invalid_, crabWrapper::key, SiStripKey::key(), SiStripPI::max, sistrip::mlCommissioning_, sistrip::noCandidates_, sistrip::nullPtr_, FedCablingAnalysis::threshold_, createJobs::tmp, and mps_merge::weight.

◆ extract()

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

Extracts and organises histograms.

Implements CommissioningAlgorithm.

Definition at line 24 of file FedCablingAlgorithm.cc.

24  {
25  if (!anal()) {
26  edm::LogWarning(mlCommissioning_) << "[FedCablingAlgorithm::" << __func__ << "]"
27  << " NULL pointer to Analysis object!";
28  return;
29  }
30 
31  // Check number of histograms
32  if (histos.size() != 2) {
34  }
35 
36  // Extract FED key from histo title
37  if (!histos.empty()) {
38  anal()->fedKey(extractFedKey(histos.front()));
39  }
40 
41  // Extract histograms
42  std::vector<TH1*>::const_iterator ihis = histos.begin();
43  for (; ihis != histos.end(); ihis++) {
44  // Check for NULL pointer
45  if (!(*ihis)) {
46  continue;
47  }
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 }

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

◆ hFedCh()

const FedCablingAlgorithm::Histo & FedCablingAlgorithm::hFedCh ( ) const
inline

Pointer to FED channel histogram.

Definition at line 48 of file FedCablingAlgorithm.h.

48 { return hFedCh_; }

References hFedCh_.

◆ hFedId()

const FedCablingAlgorithm::Histo & FedCablingAlgorithm::hFedId ( ) const
inline

Pointer to FED id histogram.

Definition at line 47 of file FedCablingAlgorithm.h.

47 { return hFedId_; }

References hFedId_.

Member Data Documentation

◆ hFedCh_

Histo FedCablingAlgorithm::hFedCh_
private

Histo containing FED channel

Definition at line 44 of file FedCablingAlgorithm.h.

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

◆ hFedId_

Histo FedCablingAlgorithm::hFedId_
private

Histo containing FED id

Definition at line 41 of file FedCablingAlgorithm.h.

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

FedCablingAnalysis::threshold_
static const float threshold_
Definition: FedCablingAnalysis.h:59
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
CommissioningAlgorithm::extractFedKey
uint32_t extractFedKey(const TH1 *const)
Definition: CommissioningAlgorithm.cc:29
sistrip::unexpectedTask_
static const char unexpectedTask_[]
Definition: ConstantsForCommissioningAnalysis.h:21
SiStripKey::key
const uint32_t & key() const
Definition: SiStripKey.h:120
mps_merge.weight
weight
Definition: mps_merge.py:88
CommissioningAnalysis::fedKey
const uint32_t & fedKey() const
Definition: CommissioningAnalysis.h:134
CommissioningAnalysis::addErrorCode
virtual void addErrorCode(const std::string &error)
Definition: CommissioningAnalysis.h:148
sistrip::numberOfHistos_
static const char numberOfHistos_[]
Definition: ConstantsForCommissioningAnalysis.h:16
SiStripFedKey
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
sistrip::noCandidates_
static const char noCandidates_[]
Definition: ConstantsForCommissioningAnalysis.h:33
sistrip::unexpectedExtraInfo_
static const char unexpectedExtraInfo_[]
Definition: ConstantsForCommissioningAnalysis.h:22
sistrip::mlCommissioning_
static const char mlCommissioning_[]
Definition: ConstantsForLogger.h:15
sistrip::FED_CABLING
Definition: ConstantsForRunType.h:81
CommissioningAlgorithm::anal
CommissioningAnalysis *const anal() const
Definition: CommissioningAlgorithm.h:50
sistrip::fedChannel_
static const char fedChannel_[]
Definition: ConstantsForGranularity.h:48
CommissioningAlgorithm::CommissioningAlgorithm
CommissioningAlgorithm()
Definition: CommissioningAlgorithm.cc:15
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
SiStripFedKey::feUnit
const uint16_t & feUnit() const
Definition: SiStripFedKey.h:189
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
combine.histos
histos
Definition: combine.py:4
CommissioningAnalysis
Abstract base for derived classes that provide analysis of commissioning histograms.
Definition: CommissioningAnalysis.h:18
SiStripHistoTitle
Utility class that holds histogram title.
Definition: SiStripHistoTitle.h:20
FedCablingAlgorithm::hFedCh_
Histo hFedCh_
Definition: FedCablingAlgorithm.h:44
sistrip::nullPtr_
static const char nullPtr_[]
Definition: ConstantsForCommissioningAnalysis.h:17
FedCablingAlgorithm::hFedId_
Histo hFedId_
Definition: FedCablingAlgorithm.h:41
crabWrapper.key
key
Definition: crabWrapper.py:19
weight
Definition: weight.py:1
FedCablingAnalysis
Histogram-based analysis for connection loop.
Definition: FedCablingAnalysis.h:16
SiStripFedKey::feChan
const uint16_t & feChan() const
Definition: SiStripFedKey.h:190
sistrip::feDriver_
static const char feDriver_[]
Definition: ConstantsForGranularity.h:44