CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PedsOnlyAnalysis.cc
Go to the documentation of this file.
5 #include <iostream>
6 #include <iomanip>
7 #include <cmath>
8 
9 using namespace sistrip;
10 
11 // ----------------------------------------------------------------------------
12 //
14  : CommissioningAnalysis(key,"PedsOnlyAnalysis"),
15  peds_(2,VFloat(128,sistrip::invalid_)),
16  raw_(2,VFloat(128,sistrip::invalid_)),
17  pedsMean_(2,sistrip::invalid_),
18  pedsSpread_(2,sistrip::invalid_),
19  rawMean_(2,sistrip::invalid_),
20  rawSpread_(2,sistrip::invalid_),
21  pedsMax_(2,sistrip::invalid_),
22  pedsMin_(2,sistrip::invalid_),
23  rawMax_(2,sistrip::invalid_),
24  rawMin_(2,sistrip::invalid_),
25  legacy_(false)
26 {}
27 
28 // ----------------------------------------------------------------------------
29 //
31  : CommissioningAnalysis("PedsOnlyAnalysis"),
32  peds_(2,VFloat(128,sistrip::invalid_)),
33  raw_(2,VFloat(128,sistrip::invalid_)),
34  pedsMean_(2,sistrip::invalid_),
35  pedsSpread_(2,sistrip::invalid_),
36  rawMean_(2,sistrip::invalid_),
37  rawSpread_(2,sistrip::invalid_),
38  pedsMax_(2,sistrip::invalid_),
39  pedsMin_(2,sistrip::invalid_),
40  rawMax_(2,sistrip::invalid_),
41  rawMin_(2,sistrip::invalid_),
42  legacy_(false)
43 {}
44 
45 // ----------------------------------------------------------------------------
46 //
58  legacy_ = false;
59 }
60 
61 // ----------------------------------------------------------------------------
62 //
64  return ( pedsMean_[0] < sistrip::maximum_ &&
80  getErrorCodes().empty() );
81 }
82 
83 // ----------------------------------------------------------------------------
84 //
85 void PedsOnlyAnalysis::summary( std::stringstream& ss ) const {
86 
87  SiStripFecKey fec_key( fecKey() );
88  SiStripFedKey fed_key( fedKey() );
89 
91 
92  std::stringstream extra1,extra2,extra3;
93  if ( legacy_ ) {
97  } else {
101  }
102 
104  type,
106  fed_key.key(),
108  fec_key.lldChan(),
109  extra1.str() ).title();
111  type,
113  fed_key.key(),
115  fec_key.lldChan(),
116  extra2.str() ).title();
118  type,
120  fed_key.key(),
121  sistrip::APV,
122  SiStripFecKey::i2cAddr( fec_key.lldChan(), true ),
123  extra3.str() ).title();
125  type,
127  fed_key.key(),
128  sistrip::APV,
129  SiStripFecKey::i2cAddr( fec_key.lldChan(), false ),
130  extra3.str() ).title();
131 
132 
133  ss << " Summary"
134  << ":"
135  << ( isValid() ? "Valid" : "Invalid" )
136  << ":"
137  << sistrip::controlView_ << ":"
138  << fec_key.fecCrate() << "/"
139  << fec_key.fecSlot() << "/"
140  << fec_key.fecRing() << "/"
141  << fec_key.ccuAddr() << "/"
142  << fec_key.ccuChan()
143  << ":"
145  << "Collate" << sistrip::dir_
146  << SiStripFecKey( fec_key.fecCrate(),
147  fec_key.fecSlot(),
148  fec_key.fecRing(),
149  fec_key.ccuAddr(),
150  fec_key.ccuChan() ).path()
151  << ":"
152  << title1 << ";" << title2 << ";" << title3 << ";" << title4
153  << std::endl;
154 
155 }
156 
157 // ----------------------------------------------------------------------------
158 //
159 void PedsOnlyAnalysis::print( std::stringstream& ss, uint32_t iapv ) {
160 
161  if ( iapv == 1 || iapv == 2 ) { iapv--; }
162  else { iapv = 0; }
163 
164  if ( peds_[iapv].size() < 128 ||
165  raw_[iapv].size() < 128 ) {
167  << "[" << myName() << "::" << __func__ << "]"
168  << " Unexpected number of pedestal/noise values: "
169  << peds_[iapv].size() << ", "
170  << raw_[iapv].size();
171  return;
172  }
173 
174  header( ss );
175  ss << " Monitorables for APV number : " << iapv;
176  if ( iapv == 0 ) { ss << " (first of pair)"; }
177  else if ( iapv == 1 ) { ss << " (second of pair)"; }
178  ss << std::endl;
179  ss << std::fixed << std::setprecision(2);
180  ss << " Example peds/noise for strips : "
181  << " 0, 31, 63, 127" << std::endl
182  << " Peds [ADC] : "
183  << std::setw(6) << peds_[iapv][0] << ", "
184  << std::setw(6) << peds_[iapv][31] << ", "
185  << std::setw(6) << peds_[iapv][63] << ", "
186  << std::setw(6) << peds_[iapv][127] << std::endl
187  << " Raw noise [ADC] : "
188  << std::setw(6) << raw_[iapv][0] << ", "
189  << std::setw(6) << raw_[iapv][31] << ", "
190  << std::setw(6) << raw_[iapv][63] << ", "
191  << std::setw(6) << raw_[iapv][127] << std::endl;
192  ss << " Mean peds +/- spread [ADC] : " << pedsMean_[iapv] << " +/- " << pedsSpread_[iapv] << std::endl
193  << " Min/Max pedestal [ADC] : " << pedsMin_[iapv] << " <-> " << pedsMax_[iapv] << std::endl
194  << " Mean raw noise +/- spread [ADC] : " << rawMean_[iapv] << " +/- " << rawSpread_[iapv] << std::endl
195  << " Min/Max raw noise [ADC] : " << rawMin_[iapv] << " <-> " << rawMax_[iapv] << std::endl
196  << std::boolalpha
197  << " isValid : " << isValid() << std::endl
198  << std::noboolalpha
199  << " Error codes (found "
200  << std::setw(2) << std::setfill(' ') << getErrorCodes().size()
201  << ") : ";
202  if ( getErrorCodes().empty() ) { ss << "(none)"; }
203  else {
204  VString::const_iterator istr = getErrorCodes().begin();
205  VString::const_iterator jstr = getErrorCodes().end();
206  for ( ; istr != jstr; ++istr ) { ss << *istr << " "; }
207  }
208  ss << std::endl;
209 }
210 
type
Definition: HCALResponse.h:21
static const char rawNoise_[]
const uint32_t & fedKey() const
const uint16_t & fecRing() const
static const char pedsAndRawNoise_[]
static const char dir_[]
Utility class that holds histogram title.
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
bool isValid() const
void print(std::stringstream &, uint32_t apv_number=0)
const uint16_t & lldChan() const
const uint16_t & fecSlot() const
const uint16_t & i2cAddr() const
const uint32_t & key() const
Definition: SiStripKey.h:125
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
static std::string runType(const sistrip::RunType &)
std::vector< float > VFloat
tuple path
else: Piece not in the list, fine.
static const char mlCommissioning_[]
static const char controlView_[]
static const uint16_t maximum_
Definition: Constants.h:20
static const char dqmRoot_[]
const uint32_t & fecKey() const
static const char commonMode_[]
const uint16_t & fecCrate() const
static const char pedestals_[]
static const char pedsAndCmSubNoise_[]
virtual void header(std::stringstream &) const
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:16
void summary(std::stringstream &) const
const uint16_t & ccuChan() const
std::vector< VFloat > VVFloat
Abstract base for derived classes that provide analysis of commissioning histograms.
volatile std::atomic< bool > shutdown_flag false
const VString & getErrorCodes() const
const std::string & myName() const
tuple size
Write out results.