CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PedsOnlyAlgorithm Class Reference

Histogram-based analysis for pedestal run. More...

#include <PedsOnlyAlgorithm.h>

Inheritance diagram for PedsOnlyAlgorithm:
CommissioningAlgorithm

Public Member Functions

const HistohNoise () const
 
const HistohPeds () const
 
 PedsOnlyAlgorithm (const edm::ParameterSet &pset, PedsOnlyAnalysis *const)
 
 ~PedsOnlyAlgorithm () 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
 
 PedsOnlyAlgorithm ()
 

Private Attributes

Histo hNoise_
 
Histo hPeds_
 

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 pedestal run.

Author
M. Wingham, R.Bainbridge

Definition at line 16 of file PedsOnlyAlgorithm.h.

Constructor & Destructor Documentation

◆ PedsOnlyAlgorithm() [1/2]

PedsOnlyAlgorithm::PedsOnlyAlgorithm ( const edm::ParameterSet pset,
PedsOnlyAnalysis * const  anal 
)

Definition at line 16 of file PedsOnlyAlgorithm.cc.

17  : CommissioningAlgorithm(anal), hPeds_(nullptr, ""), hNoise_(nullptr, "") {}

◆ ~PedsOnlyAlgorithm()

PedsOnlyAlgorithm::~PedsOnlyAlgorithm ( )
inlineoverride

Definition at line 20 of file PedsOnlyAlgorithm.h.

20 { ; }

◆ PedsOnlyAlgorithm() [2/2]

PedsOnlyAlgorithm::PedsOnlyAlgorithm ( )
inlineprivate

Definition at line 27 of file PedsOnlyAlgorithm.h.

27 { ; }

Member Function Documentation

◆ analyse()

void PedsOnlyAlgorithm::analyse ( )
overrideprivatevirtual

Performs histogram anaysis.

Implements CommissioningAlgorithm.

Definition at line 77 of file PedsOnlyAlgorithm.cc.

77  {
78  if (!anal()) {
79  edm::LogWarning(mlCommissioning_) << "[PedsOnlyAlgorithm::" << __func__ << "]"
80  << " NULL pointer to base Analysis object!";
81  return;
82  }
83 
84  CommissioningAnalysis* tmp = const_cast<CommissioningAnalysis*>(anal());
85  PedsOnlyAnalysis* anal = dynamic_cast<PedsOnlyAnalysis*>(tmp);
86  if (!anal) {
87  edm::LogWarning(mlCommissioning_) << "[PedsOnlyAlgorithm::" << __func__ << "]"
88  << " NULL pointer to derived Analysis object!";
89  return;
90  }
91 
92  if (!hPeds_.first) {
94  return;
95  }
96 
97  if (!hNoise_.first) {
99  return;
100  }
101 
102  TProfile* peds_histo = dynamic_cast<TProfile*>(hPeds_.first);
103  TProfile* raw_histo = dynamic_cast<TProfile*>(hNoise_.first);
104 
105  if (!peds_histo) {
107  return;
108  }
109 
110  if (!raw_histo) {
112  return;
113  }
114 
115  if (peds_histo->GetNbinsX() != 256) {
117  return;
118  }
119 
120  if (raw_histo->GetNbinsX() != 256) {
122  return;
123  }
124 
125  // Iterate through APVs
126  for (uint16_t iapv = 0; iapv < 2; iapv++) {
127  // Used to calc mean and rms for peds and noise
128  float p_sum = 0., p_sum2 = 0., p_max = -1. * sistrip::invalid_, p_min = sistrip::invalid_;
129  float r_sum = 0., r_sum2 = 0., r_max = -1. * sistrip::invalid_, r_min = sistrip::invalid_;
130 
131  // Iterate through strips of APV
132  for (uint16_t istr = 0; istr < 128; istr++) {
133  uint16_t strip = iapv * 128 + istr;
134 
135  // Pedestals
136  if (peds_histo) {
137  if (peds_histo->GetBinEntries(strip + 1)) {
138  anal->peds_[iapv][istr] = peds_histo->GetBinContent(strip + 1);
139  p_sum += anal->peds_[iapv][istr];
140  p_sum2 += (anal->peds_[iapv][istr] * anal->peds_[iapv][istr]);
141  if (anal->peds_[iapv][istr] > p_max) {
142  p_max = anal->peds_[iapv][istr];
143  }
144  if (anal->peds_[iapv][istr] < p_min) {
145  p_min = anal->peds_[iapv][istr];
146  }
147  }
148  }
149 
150  // Raw noise
151  if (!anal->legacy_) {
152  if (raw_histo) {
153  if (raw_histo->GetBinEntries(strip + 1)) {
154  anal->raw_[iapv][istr] = raw_histo->GetBinContent(strip + 1);
155  r_sum += anal->raw_[iapv][istr];
156  r_sum2 += (anal->raw_[iapv][istr] * anal->raw_[iapv][istr]);
157  if (anal->raw_[iapv][istr] > r_max) {
158  r_max = anal->raw_[iapv][istr];
159  }
160  if (anal->raw_[iapv][istr] < r_min) {
161  r_min = anal->raw_[iapv][istr];
162  }
163  }
164  }
165  } else {
166  if (peds_histo) {
167  if (peds_histo->GetBinEntries(strip + 1)) {
168  anal->raw_[iapv][istr] = raw_histo->GetBinError(strip + 1);
169  r_sum += anal->raw_[iapv][istr];
170  r_sum2 += (anal->raw_[iapv][istr] * anal->raw_[iapv][istr]);
171  if (anal->raw_[iapv][istr] > r_max) {
172  r_max = anal->raw_[iapv][istr];
173  }
174  if (anal->raw_[iapv][istr] < r_min) {
175  r_min = anal->raw_[iapv][istr];
176  }
177  }
178  }
179  }
180 
181  } // strip loop
182 
183  // Calc mean and rms for peds
184  if (!anal->peds_[iapv].empty()) {
185  p_sum /= static_cast<float>(anal->peds_[iapv].size());
186  p_sum2 /= static_cast<float>(anal->peds_[iapv].size());
187  anal->pedsMean_[iapv] = p_sum;
188  anal->pedsSpread_[iapv] = sqrt(fabs(p_sum2 - p_sum * p_sum));
189  }
190 
191  // Calc mean and rms for raw noise
192  if (!anal->raw_[iapv].empty()) {
193  r_sum /= static_cast<float>(anal->raw_[iapv].size());
194  r_sum2 /= static_cast<float>(anal->raw_[iapv].size());
195  anal->rawMean_[iapv] = r_sum;
196  anal->rawSpread_[iapv] = sqrt(fabs(r_sum2 - r_sum * r_sum));
197  }
198 
199  // Set max and min values for peds and raw noise
200  if (p_max > -1. * sistrip::maximum_) {
201  anal->pedsMax_[iapv] = p_max;
202  }
203  if (p_min < 1. * sistrip::maximum_) {
204  anal->pedsMin_[iapv] = p_min;
205  }
206  if (r_max > -1. * sistrip::maximum_) {
207  anal->rawMax_[iapv] = r_max;
208  }
209  if (r_min < 1. * sistrip::maximum_) {
210  anal->rawMin_[iapv] = r_min;
211  }
212 
213  } // apv loop
214 }

References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), hNoise_, hPeds_, sistrip::invalid_, sistrip::maximum_, sistrip::mlCommissioning_, sistrip::nullPtr_, sistrip::numberOfBins_, mathSSE::sqrt(), digitizers_cfi::strip, and createJobs::tmp.

◆ extract()

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

Extracts and organises histograms.

Implements CommissioningAlgorithm.

Definition at line 21 of file PedsOnlyAlgorithm.cc.

21  {
22  if (!anal()) {
23  edm::LogWarning(mlCommissioning_) << "[PedsOnlyAlgorithm::" << __func__ << "]"
24  << " NULL pointer to Analysis object!";
25  return;
26  }
27 
28  // Check number of histograms
29  if (histos.size() != 2) {
31  }
32 
33  // Extract FED key from histo title
34  if (!histos.empty()) {
35  anal()->fedKey(extractFedKey(histos.front()));
36  }
37 
38  // Extract histograms
39  std::vector<TH1*>::const_iterator ihis = histos.begin();
40  for (; ihis != histos.end(); ihis++) {
41  // Check for NULL pointer
42  if (!(*ihis)) {
43  continue;
44  }
45 
46  // Check run type
47  SiStripHistoTitle title((*ihis)->GetName());
48  if (title.runType() != sistrip::PEDS_ONLY) {
50  continue;
51  }
52 
53  // Extract peds and raw noise histos (check for legacy names first!)
54  if (title.extraInfo().find(sistrip::extrainfo::pedsAndRawNoise_) != std::string::npos) {
55  hPeds_.first = *ihis;
56  hPeds_.second = (*ihis)->GetName();
57  hNoise_.first = *ihis;
58  hNoise_.second = (*ihis)->GetName();
59  PedsOnlyAnalysis* a = dynamic_cast<PedsOnlyAnalysis*>(const_cast<CommissioningAnalysis*>(anal()));
60  if (a) {
61  a->legacy_ = true;
62  }
63  } else if (title.extraInfo().find(sistrip::extrainfo::pedestals_) != std::string::npos) {
64  hPeds_.first = *ihis;
65  hPeds_.second = (*ihis)->GetName();
66  } else if (title.extraInfo().find(sistrip::extrainfo::rawNoise_) != std::string::npos) {
67  hNoise_.first = *ihis;
68  hNoise_.second = (*ihis)->GetName();
69  } else {
71  }
72  }
73 }

References a, CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), CommissioningAlgorithm::extractFedKey(), CommissioningAnalysis::fedKey(), combine::histos, hNoise_, hPeds_, sistrip::mlCommissioning_, sistrip::numberOfHistos_, sistrip::extrainfo::pedestals_, sistrip::PEDS_ONLY, sistrip::extrainfo::pedsAndRawNoise_, sistrip::extrainfo::rawNoise_, runGCPTkAlMap::title, sistrip::unexpectedExtraInfo_, and sistrip::unexpectedTask_.

◆ hNoise()

const PedsOnlyAlgorithm::Histo & PedsOnlyAlgorithm::hNoise ( ) const
inline

Definition at line 45 of file PedsOnlyAlgorithm.h.

45 { return hNoise_; }

References hNoise_.

◆ hPeds()

const PedsOnlyAlgorithm::Histo & PedsOnlyAlgorithm::hPeds ( ) const
inline

Definition at line 43 of file PedsOnlyAlgorithm.h.

43 { return hPeds_; }

References hPeds_.

Member Data Documentation

◆ hNoise_

Histo PedsOnlyAlgorithm::hNoise_
private

Residuals and noise

Definition at line 40 of file PedsOnlyAlgorithm.h.

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

◆ hPeds_

Histo PedsOnlyAlgorithm::hPeds_
private

Pedestals and raw noise

Definition at line 37 of file PedsOnlyAlgorithm.h.

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

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
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
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
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
sistrip::unexpectedExtraInfo_
static const char unexpectedExtraInfo_[]
Definition: ConstantsForCommissioningAnalysis.h:22
sistrip::mlCommissioning_
static const char mlCommissioning_[]
Definition: ConstantsForLogger.h:15
CommissioningAlgorithm::anal
CommissioningAnalysis *const anal() const
Definition: CommissioningAlgorithm.h:50
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
sistrip::numberOfBins_
static const char numberOfBins_[]
Definition: ConstantsForCommissioningAnalysis.h:18
sistrip::extrainfo::pedestals_
static const char pedestals_[]
Definition: ConstantsForDqm.h:45
PedsOnlyAnalysis
Histogram-based analysis for pedestal run.
Definition: PedsOnlyAnalysis.h:15
a
double a
Definition: hdecay.h:119
CommissioningAlgorithm::CommissioningAlgorithm
CommissioningAlgorithm()
Definition: CommissioningAlgorithm.cc:15
sistrip::maximum_
static const uint16_t maximum_
Definition: Constants.h:20
PedsOnlyAlgorithm::hPeds_
Histo hPeds_
Definition: PedsOnlyAlgorithm.h:37
sistrip::PEDS_ONLY
Definition: ConstantsForRunType.h:90
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
sistrip::extrainfo::pedsAndRawNoise_
static const char pedsAndRawNoise_[]
Definition: ConstantsForDqm.h:53
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
PedsOnlyAlgorithm::hNoise_
Histo hNoise_
Definition: PedsOnlyAlgorithm.h:40
sistrip::extrainfo::rawNoise_
static const char rawNoise_[]
Definition: ConstantsForDqm.h:46
sistrip::nullPtr_
static const char nullPtr_[]
Definition: ConstantsForCommissioningAnalysis.h:17