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
VpspScanAlgorithm Class Reference

Histogram-based analysis for VPSP scan. More...

#include <VpspScanAlgorithm.h>

Inheritance diagram for VpspScanAlgorithm:
CommissioningAlgorithm

Public Member Functions

const Histohisto (const uint16_t &apv) const
 
 VpspScanAlgorithm (const edm::ParameterSet &pset, VpspScanAnalysis *const )
 
virtual ~VpspScanAlgorithm ()
 
- 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 * > &)
 
 VpspScanAlgorithm ()
 

Private Attributes

std::vector< Histohistos_
 

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 VPSP scan.

Author
M. Wingham, R.Bainbridge

Definition at line 16 of file VpspScanAlgorithm.h.

Constructor & Destructor Documentation

VpspScanAlgorithm::VpspScanAlgorithm ( const edm::ParameterSet pset,
VpspScanAnalysis * const  anal 
)

Definition at line 17 of file VpspScanAlgorithm.cc.

18  : CommissioningAlgorithm(anal),
19  histos_( 2, Histo(0,"") )
20 {;}
std::vector< Histo > histos_
std::pair< TH1 *, std::string > Histo
virtual VpspScanAlgorithm::~VpspScanAlgorithm ( )
inlinevirtual

Definition at line 22 of file VpspScanAlgorithm.h.

22 {;}
VpspScanAlgorithm::VpspScanAlgorithm ( )
inlineprivate

Definition at line 29 of file VpspScanAlgorithm.h.

29 {;}

Member Function Documentation

void VpspScanAlgorithm::analyse ( )
privatevirtual

Performs histogram anaysis.

Implements CommissioningAlgorithm.

Definition at line 76 of file VpspScanAlgorithm.cc.

References VpspScanAnalysis::adcLevel_, CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), VpspScanAnalysis::bottomEdge_, VpspScanAnalysis::bottomLevel_, plotBeamSpotDB::first, VpspScanAnalysis::fraction_, mergeVDriftHistosByStation::histos, histos_, sistrip::invalid_, relval_2017::k, plotBeamSpotDB::last, sistrip::mlCommissioning_, sistrip::noBaselineLevel_, sistrip::noBottomPlateau_, sistrip::noTopPlateau_, sistrip::noVpspSetting_, sistrip::nullPtr_, tmp, VpspScanAnalysis::topEdge_, VpspScanAnalysis::topLevel_, sistrip::valid_, and VpspScanAnalysis::vpsp_.

76  {
77 
78  if ( !anal() ) {
80  << "[VpspScanAlgorithm::" << __func__ << "]"
81  << " NULL pointer to base Analysis object!";
82  return;
83  }
84 
86  VpspScanAnalysis* anal = dynamic_cast<VpspScanAnalysis*>( tmp );
87  if ( !anal ) {
89  << "[VpspScanAlgorithm::" << __func__ << "]"
90  << " NULL pointer to derived Analysis object!";
91  return;
92  }
93 
94  // from deprecated()
95 
96  std::vector<const TProfile*> histos;
97  std::vector<uint16_t> monitorables;
98  for ( uint16_t iapv = 0; iapv < 2; iapv++ ) {
99 
100  monitorables.clear();
101  monitorables.resize( 7, sistrip::invalid_ );
102 
103  histos.clear();
104  histos.push_back( const_cast<const TProfile*>( dynamic_cast<TProfile*>(histos_[iapv].first) ) );
105 
106  if ( !histos[0] ) {
108  continue;
109  }
110 
111  // Find "top" plateau
112  int first = sistrip::invalid_;
113  float top = -1. * sistrip::invalid_;;
114  for ( int k = 5; k < 55; k++ ) {
115  if ( !histos[0]->GetBinEntries(k) ) { continue; }
116  if ( histos[0]->GetBinContent(k) >= top ) {
117  first = k;
118  top = histos[0]->GetBinContent(k);
119  }
120  }
121  if ( top < -1. * sistrip::valid_ ) { top = sistrip::invalid_; } //@@ just want +ve invalid number here
122  if ( top > 1. * sistrip::valid_ ) {
124  continue;
125  }
126  monitorables[5] = static_cast<uint16_t>(top);
127  monitorables[3] = first;
128 
129  // Find "bottom" plateau
130  int last = sistrip::invalid_;
131  float bottom = 1. * sistrip::invalid_;
132  for ( int k = 55; k > 5; k-- ) {
133  if ( !histos[0]->GetBinEntries(k) ) { continue; }
134  if ( histos[0]->GetBinContent(k) <= bottom ) {
135  last = k;
136  bottom = histos[0]->GetBinContent(k);
137  }
138  }
139  if ( bottom > 1. * sistrip::valid_ ) {
141  continue;
142  }
143  monitorables[6] = static_cast<uint16_t>(bottom);
144  monitorables[4] = last;
145 
146  // Set optimum baseline level
147  float opt = bottom + ( top - bottom ) * 1./3.;
148  monitorables[1] = static_cast<uint16_t>(opt);
149 
150  // Find optimum VPSP setting
151  uint16_t vpsp = sistrip::invalid_;
152  if ( opt < 1. * sistrip::valid_ ) {
153  uint16_t ivpsp = 5;
154  for ( ; ivpsp < 55; ivpsp++ ) {
155  if ( histos[0]->GetBinContent(ivpsp) < opt ) { break; }
156  }
157  if ( ivpsp != 54 ) {
158  vpsp = ivpsp;
159  monitorables[0] = vpsp;
160  }
161  else {
163  continue;
164  }
165 
166  } else {
168  continue;
169  }
170 
171  // Set analysis results for both APVs
172  anal->vpsp_[iapv] = monitorables[0];
173  anal->adcLevel_[iapv] = monitorables[1];
174  anal->fraction_[iapv] = monitorables[2];
175  anal->topEdge_[iapv] = monitorables[3];
176  anal->bottomEdge_[iapv] = monitorables[4];
177  anal->topLevel_[iapv] = monitorables[5];
178  anal->bottomLevel_[iapv] = monitorables[6];
179 
180  }
181 
182 }
std::vector< Histo > histos_
static const char noBaselineLevel_[]
static const uint16_t valid_
Definition: Constants.h:17
static const char noBottomPlateau_[]
static const char mlCommissioning_[]
virtual void addErrorCode(const std::string &error)
static const char noTopPlateau_[]
Histogram-based analysis for VPSP scan.
static const uint16_t invalid_
Definition: Constants.h:16
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
Abstract base for derived classes that provide analysis of commissioning histograms.
static const char noVpspSetting_[]
CommissioningAnalysis *const anal() const
static const char nullPtr_[]
void VpspScanAlgorithm::extract ( const std::vector< TH1 * > &  histos)
privatevirtual

Extracts and organises histograms.

Implements CommissioningAlgorithm.

Definition at line 24 of file VpspScanAlgorithm.cc.

References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), sistrip::apv_, TauDecayModes::dec, CommissioningAlgorithm::extractFedKey(), CommissioningAnalysis::fedKey(), histos_, sistrip::invalid_, sistrip::mlCommissioning_, sistrip::numberOfHistos_, contentValuesCheck::ss, indexGen::title, sistrip::unexpectedExtraInfo_, sistrip::unexpectedTask_, and sistrip::VPSP_SCAN.

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

24  {
25 
26  if ( !anal() ) {
28  << "[VpspScanAlgorithm::" << __func__ << "]"
29  << " NULL pointer to Analysis object!";
30  return;
31  }
32 
33  // Check number of histograms
34  if ( histos.size() != 2 ) {
36  }
37 
38  // Extract FED key from histo title
39  if ( !histos.empty() ) { anal()->fedKey( extractFedKey( histos.front() ) ); }
40 
41  // Extract histograms
42  std::vector<TH1*>::const_iterator ihis = histos.begin();
43  for ( ; ihis != histos.end(); ihis++ ) {
44 
45  // Check pointer
46  if ( !(*ihis) ) { continue; }
47 
48  // Check name
49  SiStripHistoTitle title( (*ihis)->GetName() );
50  if ( title.runType() != sistrip::VPSP_SCAN ) {
52  continue;
53  }
54 
55  // Extract APV number
56  uint16_t apv = sistrip::invalid_;
57  if ( title.extraInfo().find(sistrip::apv_) != std::string::npos ) {
58  std::stringstream ss;
59  ss << title.extraInfo().substr( title.extraInfo().find(sistrip::apv_) + (sizeof(sistrip::apv_) - 1), 1 );
60  ss >> std::dec >> apv;
61  }
62 
63  if ( apv <= 1 ) {
64  histos_[apv].first = *ihis;
65  histos_[apv].second = (*ihis)->GetName();
66  } else {
68  }
69 
70  }
71 
72 }
static const char unexpectedTask_[]
const uint32_t & fedKey() const
Utility class that holds histogram title.
std::vector< Histo > histos_
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 apv_[]
static const uint16_t invalid_
Definition: Constants.h:16
CommissioningAnalysis *const anal() const
const Histo& VpspScanAlgorithm::histo ( const uint16_t &  apv) const

Histogram pointer and title.

Member Data Documentation

std::vector<Histo> VpspScanAlgorithm::histos_
private

Pointers and titles for histograms.

Definition at line 40 of file VpspScanAlgorithm.h.

Referenced by analyse(), and extract().