CMS 3D CMS Logo

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

Algorithm for scope mode data. More...

#include <DaqScopeModeAlgorithm.h>

Inheritance diagram for DaqScopeModeAlgorithm:
CommissioningAlgorithm

Public Member Functions

 DaqScopeModeAlgorithm (const edm::ParameterSet &pset, DaqScopeModeAnalysis *const)
 
const HistoheaderHigh () const
 
const HistoheaderLow () const
 
const Histohisto () const
 
const HistohNoise () const
 
const HistohPeds () const
 
 ~DaqScopeModeAlgorithm () 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
 
 DaqScopeModeAlgorithm ()
 
void extract (const std::vector< TH1 * > &) override
 

Private Attributes

float deadStripMax_
 
Histo headerHigh_
 
Histo headerLow_
 
Histo histo_
 
Histo hNoise_
 
Histo hPeds_
 
float noisyStripMin_
 

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

Algorithm for scope mode data.

Author
R.Bainbridge

Definition at line 16 of file DaqScopeModeAlgorithm.h.

Constructor & Destructor Documentation

◆ DaqScopeModeAlgorithm() [1/2]

DaqScopeModeAlgorithm::DaqScopeModeAlgorithm ( const edm::ParameterSet pset,
DaqScopeModeAnalysis * const  anal 
)

Definition at line 16 of file DaqScopeModeAlgorithm.cc.

18  histo_(nullptr, ""),
19  headerLow_(nullptr, ""),
20  headerHigh_(nullptr, ""),
21  hPeds_(nullptr, ""),
22  hNoise_(nullptr, ""),
23  deadStripMax_(pset.getParameter<double>("DeadStripMax")),
24  noisyStripMin_(pset.getParameter<double>("NoisyStripMin")) {
25  ;
26 }

◆ ~DaqScopeModeAlgorithm()

DaqScopeModeAlgorithm::~DaqScopeModeAlgorithm ( )
inlineoverride

Definition at line 20 of file DaqScopeModeAlgorithm.h.

20 { ; }

◆ DaqScopeModeAlgorithm() [2/2]

DaqScopeModeAlgorithm::DaqScopeModeAlgorithm ( )
inlineprivate

Definition at line 29 of file DaqScopeModeAlgorithm.h.

29 { ; }

Member Function Documentation

◆ analyse()

void DaqScopeModeAlgorithm::analyse ( )
overrideprivatevirtual

Performs histogram anaylsis.

pedestal

scope-mode profile

Implements CommissioningAlgorithm.

Definition at line 88 of file DaqScopeModeAlgorithm.cc.

88  {
89  if (!anal()) {
90  edm::LogWarning(mlCommissioning_) << "[DaqScopeModeAlgorithm::" << __func__ << "]"
91  << " NULL pointer to base Analysis object!";
92  return;
93  }
94 
95  CommissioningAnalysis* tmp = const_cast<CommissioningAnalysis*>(anal());
96  DaqScopeModeAnalysis* anal = dynamic_cast<DaqScopeModeAnalysis*>(tmp);
97  if (!anal) {
98  edm::LogWarning(mlCommissioning_) << "[DaqScopeModeAlgorithm::" << __func__ << "]"
99  << " NULL pointer to derived Analysis object!";
100  return;
101  }
102 
103  // Analysis level wants all the informations --> it will work only on Spy-events
104  if (!hPeds_.first) {
106  return;
107  }
108 
109  if (!hNoise_.first) {
111  return;
112  }
113 
114  if (!histo_.first) {
116  return;
117  }
118  if (!headerLow_.first) {
120  return;
121  }
122  if (!headerHigh_.first) {
124  return;
125  }
126 
128  TProfile* peds_histo = dynamic_cast<TProfile*>(hPeds_.first);
129  TProfile* noise_histo = dynamic_cast<TProfile*>(hNoise_.first);
131  TProfile* scope_histo = dynamic_cast<TProfile*>(histo_.first);
132  TH1F* headerLow_histo = dynamic_cast<TH1F*>(headerLow_.first);
133  TH1F* headerHigh_histo = dynamic_cast<TH1F*>(headerHigh_.first);
134 
135  if (!peds_histo) {
137  return;
138  }
139 
140  if (!noise_histo) {
142  return;
143  }
144 
145  if (!scope_histo) {
147  return;
148  }
149 
150  if (!headerLow_histo) {
152  return;
153  }
154 
155  if (!headerHigh_histo) {
157  return;
158  }
159 
160  if (peds_histo->GetNbinsX() != 256) {
162  return;
163  }
164 
165  if (noise_histo->GetNbinsX() != 256) {
167  return;
168  }
169 
170  if (scope_histo->GetNbinsX() != 298) {
172  return;
173  }
174 
175  // Calculate pedestals and noise
176  // Iterate through APVs
177  for (uint16_t iapv = 0; iapv < 2; iapv++) {
178  // Used to calc mean and rms for peds and noise
179  float p_sum = 0., p_sum2 = 0., p_max = -1. * sistrip::invalid_, p_min = sistrip::invalid_;
180  float n_sum = 0., n_sum2 = 0., n_max = -1. * sistrip::invalid_, n_min = sistrip::invalid_;
181  float r_sum = 0., r_sum2 = 0., r_max = -1. * sistrip::invalid_, r_min = sistrip::invalid_;
182 
183  // Iterate through strips of APV
184  for (uint16_t istr = 0; istr < 128; istr++) {
185  uint16_t strip = iapv * 128 + istr;
186 
187  // Pedestals and raw noise
188  if (peds_histo) {
189  if (peds_histo->GetBinEntries(strip + 1)) {
190  anal->peds_[iapv][istr] = peds_histo->GetBinContent(strip + 1);
191  p_sum += anal->peds_[iapv][istr];
192  p_sum2 += (anal->peds_[iapv][istr] * anal->peds_[iapv][istr]);
193  if (anal->peds_[iapv][istr] > p_max) {
194  p_max = anal->peds_[iapv][istr];
195  }
196  if (anal->peds_[iapv][istr] < p_min) {
197  p_min = anal->peds_[iapv][istr];
198  }
199 
200  anal->raw_[iapv][istr] = peds_histo->GetBinError(strip + 1);
201  r_sum += anal->raw_[iapv][istr];
202  r_sum2 += (anal->raw_[iapv][istr] * anal->raw_[iapv][istr]);
203  if (anal->raw_[iapv][istr] > r_max) {
204  r_max = anal->raw_[iapv][istr];
205  }
206  if (anal->raw_[iapv][istr] < r_min) {
207  r_min = anal->raw_[iapv][istr];
208  }
209  }
210  }
211 
212  // Noise
213  if (noise_histo) {
214  if (noise_histo->GetBinEntries(strip + 1)) {
215  anal->noise_[iapv][istr] = noise_histo->GetBinContent(strip + 1);
216  n_sum += anal->noise_[iapv][istr];
217  n_sum2 += (anal->noise_[iapv][istr] * anal->noise_[iapv][istr]);
218  if (anal->noise_[iapv][istr] > n_max) {
219  n_max = anal->noise_[iapv][istr];
220  }
221  if (anal->noise_[iapv][istr] < n_min) {
222  n_min = anal->noise_[iapv][istr];
223  }
224  }
225  }
226  } // strip loop
227 
228  // Calc mean and rms for peds
229  if (!anal->peds_[iapv].empty()) {
230  p_sum /= static_cast<float>(anal->peds_[iapv].size());
231  p_sum2 /= static_cast<float>(anal->peds_[iapv].size());
232  anal->pedsMean_[iapv] = p_sum;
233  anal->pedsSpread_[iapv] = sqrt(fabs(p_sum2 - p_sum * p_sum));
234  }
235 
236  // Calc mean and rms for noise
237  if (!anal->noise_[iapv].empty()) {
238  n_sum /= static_cast<float>(anal->noise_[iapv].size());
239  n_sum2 /= static_cast<float>(anal->noise_[iapv].size());
240  anal->noiseMean_[iapv] = n_sum;
241  anal->noiseSpread_[iapv] = sqrt(fabs(n_sum2 - n_sum * n_sum));
242  }
243 
244  // Calc mean and rms for raw noise
245  if (!anal->raw_[iapv].empty()) {
246  r_sum /= static_cast<float>(anal->raw_[iapv].size());
247  r_sum2 /= static_cast<float>(anal->raw_[iapv].size());
248  anal->rawMean_[iapv] = r_sum;
249  anal->rawSpread_[iapv] = sqrt(fabs(r_sum2 - r_sum * r_sum));
250  }
251 
252  // Set max and min values for peds, noise and raw noise
253  if (p_max > -1. * sistrip::maximum_) {
254  anal->pedsMax_[iapv] = p_max;
255  }
256  if (p_min < 1. * sistrip::maximum_) {
257  anal->pedsMin_[iapv] = p_min;
258  }
259  if (n_max > -1. * sistrip::maximum_) {
260  anal->noiseMax_[iapv] = n_max;
261  }
262  if (n_min < 1. * sistrip::maximum_) {
263  anal->noiseMin_[iapv] = n_min;
264  }
265  if (r_max > -1. * sistrip::maximum_) {
266  anal->rawMax_[iapv] = r_max;
267  }
268  if (r_min < 1. * sistrip::maximum_) {
269  anal->rawMin_[iapv] = r_min;
270  }
271 
272  // Set dead and noisy strips
273  for (uint16_t istr = 0; istr < 128; istr++) {
274  if (anal->noiseMin_[iapv] > sistrip::maximum_ || anal->noiseMax_[iapv] > sistrip::maximum_) {
275  continue;
276  }
277  if (anal->noise_[iapv][istr] < (anal->noiseMean_[iapv] - deadStripMax_ * anal->noiseSpread_[iapv])) {
278  anal->dead_[iapv].push_back(istr);
279  } else if (anal->noise_[iapv][istr] > (anal->noiseMean_[iapv] + noisyStripMin_ * anal->noiseSpread_[iapv])) {
280  anal->noisy_[iapv].push_back(istr);
281  }
282  }
283  } // apv loop
284 
286  //anal->peak_ = (scope_histo->GetBinContent(287)+scope_histo->GetBinContent(288))/2.;
287  //anal->base_ = (scope_histo->GetBinContent(1)+scope_histo->GetBinContent(2)+scope_histo->GetBinContent(3)+scope_histo->GetBinContent(4)+scope_histo->GetBinContent(5))/5.;
288  anal->peak_ = headerHigh_histo->GetMean();
289  anal->base_ = headerLow_histo->GetMean();
290  anal->height_ = anal->peak_ - anal->base_;
293  return;
294  }
295 }

References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), deadStripMax_, headerHigh_, headerLow_, histo_, hNoise_, hPeds_, sistrip::invalid_, sistrip::maximum_, sistrip::mlCommissioning_, noisyStripMin_, sistrip::nullPtr_, sistrip::numberOfBins_, sistrip::smallTickMarkHeight_, mathSSE::sqrt(), digitizers_cfi::strip, DaqScopeModeAnalysis::tickMarkHeightThreshold_, and createJobs::tmp.

◆ extract()

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

Extracts and organises histograms.

Implements CommissioningAlgorithm.

Definition at line 30 of file DaqScopeModeAlgorithm.cc.

30  {
31  if (!anal()) {
32  edm::LogWarning(mlCommissioning_) << "[DaqScopeModeAlgorithm::" << __func__ << "]"
33  << " NULL pointer to base Analysis object!";
34  return;
35  }
36 
37  // Extract FED key from histo title
38  if (!histos.empty()) {
39  anal()->fedKey(extractFedKey(histos.front()));
40  }
41 
42  // Extract histograms
43  std::vector<TH1*>::const_iterator ihis = histos.begin();
44  for (; ihis != histos.end(); ihis++) {
45  // Check for NULL pointer
46  if (!(*ihis)) {
47  continue;
48  }
49 
50  // Check name
51  SiStripHistoTitle title((*ihis)->GetName());
52  if (title.runType() != sistrip::DAQ_SCOPE_MODE) {
54  continue;
55  }
56 
57  // Extract timing histo
58  // Extract peds and noise histos (check for legacy names first!)
59  if (title.extraInfo().find(sistrip::extrainfo::pedsAndRawNoise_) != std::string::npos) {
60  hPeds_.first = *ihis;
61  hPeds_.second = (*ihis)->GetName();
62  } else if (title.extraInfo().find(sistrip::extrainfo::pedsAndCmSubNoise_) != std::string::npos) {
63  hNoise_.first = *ihis;
64  hNoise_.second = (*ihis)->GetName();
65  } else if (title.extraInfo().find(sistrip::extrainfo::pedestals_) != std::string::npos) {
66  hPeds_.first = *ihis;
67  hPeds_.second = (*ihis)->GetName();
68  } else if (title.extraInfo().find(sistrip::extrainfo::noise_) != std::string::npos) {
69  hNoise_.first = *ihis;
70  hNoise_.second = (*ihis)->GetName();
71  } else if (title.extraInfo().find(sistrip::extrainfo::commonMode_) != std::string::npos) {
72  //@@ something here for CM plots?
73  } else if (title.extraInfo().find(sistrip::extrainfo::scopeModeFrame_) != std::string::npos) {
74  histo_.first = *ihis;
75  histo_.second = (*ihis)->GetName();
76  } else if (title.extraInfo().find(sistrip::extrainfo::scopeModeHeaderLow_) != std::string::npos) {
77  headerLow_.first = *ihis;
78  headerLow_.second = (*ihis)->GetName();
79  } else if (title.extraInfo().find(sistrip::extrainfo::scopeModeHeaderHigh_) != std::string::npos) {
80  headerHigh_.first = *ihis;
81  headerHigh_.second = (*ihis)->GetName();
82  }
83  }
84 }

References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), sistrip::extrainfo::commonMode_, sistrip::DAQ_SCOPE_MODE, CommissioningAlgorithm::extractFedKey(), CommissioningAnalysis::fedKey(), headerHigh_, headerLow_, histo_, combine::histos, hNoise_, hPeds_, sistrip::mlCommissioning_, sistrip::extrainfo::noise_, sistrip::extrainfo::pedestals_, sistrip::extrainfo::pedsAndCmSubNoise_, sistrip::extrainfo::pedsAndRawNoise_, sistrip::extrainfo::scopeModeFrame_, sistrip::extrainfo::scopeModeHeaderHigh_, sistrip::extrainfo::scopeModeHeaderLow_, overlapproblemtsosanalyzer_cfi::title, and sistrip::unexpectedTask_.

◆ headerHigh()

const DaqScopeModeAlgorithm::Histo & DaqScopeModeAlgorithm::headerHigh ( ) const
inline

Definition at line 54 of file DaqScopeModeAlgorithm.h.

54 { return headerHigh_; }

References headerHigh_.

◆ headerLow()

const DaqScopeModeAlgorithm::Histo & DaqScopeModeAlgorithm::headerLow ( ) const
inline

Definition at line 53 of file DaqScopeModeAlgorithm.h.

53 { return headerLow_; }

References headerLow_.

◆ histo()

const DaqScopeModeAlgorithm::Histo & DaqScopeModeAlgorithm::histo ( ) const
inline

Definition at line 52 of file DaqScopeModeAlgorithm.h.

52 { return histo_; }

References histo_.

◆ hNoise()

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

Definition at line 56 of file DaqScopeModeAlgorithm.h.

56 { return hNoise_; }

References hNoise_.

◆ hPeds()

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

Definition at line 55 of file DaqScopeModeAlgorithm.h.

55 { return hPeds_; }

References hPeds_.

Member Data Documentation

◆ deadStripMax_

float DaqScopeModeAlgorithm::deadStripMax_
private

Analysis parameters

Definition at line 48 of file DaqScopeModeAlgorithm.h.

Referenced by analyse().

◆ headerHigh_

Histo DaqScopeModeAlgorithm::headerHigh_
private

Histogram of header high.

Definition at line 41 of file DaqScopeModeAlgorithm.h.

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

◆ headerLow_

Histo DaqScopeModeAlgorithm::headerLow_
private

Histogram of header low.

Definition at line 39 of file DaqScopeModeAlgorithm.h.

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

◆ histo_

Histo DaqScopeModeAlgorithm::histo_
private

Histogram of scope mode data.

Definition at line 37 of file DaqScopeModeAlgorithm.h.

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

◆ hNoise_

Histo DaqScopeModeAlgorithm::hNoise_
private

Residuals and noise

Definition at line 45 of file DaqScopeModeAlgorithm.h.

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

◆ hPeds_

Histo DaqScopeModeAlgorithm::hPeds_
private

Pedestals and raw noise

Definition at line 43 of file DaqScopeModeAlgorithm.h.

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

◆ noisyStripMin_

float DaqScopeModeAlgorithm::noisyStripMin_
private

Definition at line 49 of file DaqScopeModeAlgorithm.h.

Referenced by analyse().

sistrip::extrainfo::commonMode_
static const char commonMode_[]
Definition: ConstantsForDqm.h:48
sistrip::DAQ_SCOPE_MODE
Definition: ConstantsForRunType.h:83
sistrip::extrainfo::noise_
static const char noise_[]
Definition: ConstantsForDqm.h:47
sistrip::extrainfo::scopeModeHeaderHigh_
static const char scopeModeHeaderHigh_[]
Definition: ConstantsForDqm.h:65
CommissioningAlgorithm::extractFedKey
uint32_t extractFedKey(const TH1 *const)
Definition: CommissioningAlgorithm.cc:29
sistrip::unexpectedTask_
static const char unexpectedTask_[]
Definition: ConstantsForCommissioningAnalysis.h:21
DaqScopeModeAlgorithm::noisyStripMin_
float noisyStripMin_
Definition: DaqScopeModeAlgorithm.h:49
DaqScopeModeAlgorithm::histo_
Histo histo_
Definition: DaqScopeModeAlgorithm.h:37
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
CommissioningAnalysis::fedKey
const uint32_t & fedKey() const
Definition: CommissioningAnalysis.h:134
DaqScopeModeAlgorithm::headerLow_
Histo headerLow_
Definition: DaqScopeModeAlgorithm.h:39
DaqScopeModeAlgorithm::deadStripMax_
float deadStripMax_
Definition: DaqScopeModeAlgorithm.h:48
DaqScopeModeAlgorithm::headerHigh_
Histo headerHigh_
Definition: DaqScopeModeAlgorithm.h:41
CommissioningAnalysis::addErrorCode
virtual void addErrorCode(const std::string &error)
Definition: CommissioningAnalysis.h:148
sistrip::extrainfo::pedsAndCmSubNoise_
static const char pedsAndCmSubNoise_[]
Definition: ConstantsForDqm.h:55
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
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
DaqScopeModeAnalysis
Analysis for scope mode data.
Definition: DaqScopeModeAnalysis.h:16
sistrip::extrainfo::pedestals_
static const char pedestals_[]
Definition: ConstantsForDqm.h:45
edm::LogWarning
Definition: MessageLogger.h:141
CommissioningAlgorithm::CommissioningAlgorithm
CommissioningAlgorithm()
Definition: CommissioningAlgorithm.cc:15
sistrip::extrainfo::scopeModeFrame_
static const char scopeModeFrame_[]
Definition: ConstantsForDqm.h:63
sistrip::maximum_
static const uint16_t maximum_
Definition: Constants.h:20
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
DaqScopeModeAnalysis::tickMarkHeightThreshold_
static const float tickMarkHeightThreshold_
Definition: DaqScopeModeAnalysis.h:78
sistrip::extrainfo::pedsAndRawNoise_
static const char pedsAndRawNoise_[]
Definition: ConstantsForDqm.h:53
sistrip::smallTickMarkHeight_
static const char smallTickMarkHeight_[]
Definition: ConstantsForCommissioningAnalysis.h:39
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
combine.histos
histos
Definition: combine.py:4
CommissioningAnalysis
Abstract base for derived classes that provide analysis of commissioning histograms.
Definition: CommissioningAnalysis.h:18
DaqScopeModeAlgorithm::hNoise_
Histo hNoise_
Definition: DaqScopeModeAlgorithm.h:45
SiStripHistoTitle
Utility class that holds histogram title.
Definition: SiStripHistoTitle.h:20
DaqScopeModeAlgorithm::hPeds_
Histo hPeds_
Definition: DaqScopeModeAlgorithm.h:43
sistrip::extrainfo::scopeModeHeaderLow_
static const char scopeModeHeaderLow_[]
Definition: ConstantsForDqm.h:64
sistrip::nullPtr_
static const char nullPtr_[]
Definition: ConstantsForCommissioningAnalysis.h:17
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27