14 using namespace sistrip;
23 deadStripMax_(pset.getParameter<double>(
"DeadStripMax")),
24 noisyStripMin_(pset.getParameter<double>(
"NoisyStripMin")),
25 noiseDef_(pset.getParameter<std::
string>(
"NoiseDefinition")),
26 ksProbCut_(pset.getParameter<double>(
"KsProbCut"))
43 <<
"[PedsFullNoiseAlgorithm::" << __func__ <<
"]"
44 <<
" NULL pointer to Analysis object!";
49 if ( histos.size() != 3 ) {
54 if ( !histos.empty() ) {
59 std::vector<TH1*>::const_iterator ihis = histos.begin();
60 for ( ; ihis != histos.end(); ihis++ ) {
63 if ( !(*ihis) ) {
continue; }
78 hPeds_.second = (*ihis)->GetName();
87 hNoise_.second = (*ihis)->GetName();
101 <<
"[PedsFullNoiseAlgorithm::" << __func__ <<
"]"
102 <<
" NULL pointer to base Analysis object!";
110 <<
"[PedsFullNoiseAlgorithm::" << __func__ <<
"]"
111 <<
" NULL pointer to derived Analysis object!";
125 TProfile * peds_histo =
dynamic_cast<TProfile *
>(
hPeds_.first);
126 TH2S * noise_histo =
dynamic_cast<TH2S *
>(
hNoise_.first);
132 if ( !noise_histo ) {
137 if ( peds_histo->GetNbinsX() != 256 ) {
142 if ( noise_histo->GetNbinsY() != 256 ) {
148 for ( uint16_t iapv = 0; iapv < 2; iapv++ ) {
157 TF1 mygaus(
"mygaus",
"gaus");
158 for ( uint16_t istr = 0; istr < 128; istr++ ) {
160 ana->
ksProb_[iapv].push_back(0);
168 if ( peds_histo->GetBinEntries(iapv*128 + istr + 1) ) {
169 ana->
peds_[iapv][istr] = peds_histo->GetBinContent(iapv*128 + istr + 1);
170 p_sum += ana->
peds_[iapv][istr];
171 p_sum2 += (ana->
peds_[iapv][istr] * ana->
peds_[iapv][istr]);
172 if ( ana->
peds_[iapv][istr] > p_max ) { p_max = ana->
peds_[iapv][istr];}
173 if ( ana->
peds_[iapv][istr] < p_min ) { p_min = ana->
peds_[iapv][istr];}
174 ana->
raw_[iapv][istr] = peds_histo->GetBinError(iapv*128 + istr + 1);
175 r_sum += ana->
raw_[iapv][istr];
176 r_sum2 += (ana->
raw_[iapv][istr] * ana->
raw_[iapv][istr]);
177 if ( ana->
raw_[iapv][istr] > r_max ) { r_max = ana->
raw_[iapv][istr]; }
178 if ( ana->
raw_[iapv][istr] < r_min ) { r_min = ana->
raw_[iapv][istr]; }
185 TH1S * noisehist =
new TH1S(
"noisehist",
"",noise_histo->GetNbinsX(),
186 -noise_histo->GetNbinsX()/2,noise_histo->GetNbinsX()/2);
189 for(
int i=0;
i<=noise_histo->GetNbinsX()+1;
i++){
190 noisehist->SetBinContent(
i,noise_histo->GetBinContent(
i,iapv*128 + istr + 1));
193 if(noisehist->Integral() > 0){
194 ana->
noiseRMS_[iapv][istr] = noisehist->GetRMS();
195 noisehist->Fit(&mygaus,
"Q");
196 ana->
noiseGaus_[iapv][istr] = mygaus.GetParameter(2);
199 std::vector<float> integralFrac;
200 integralFrac.push_back(1.*noisehist->GetBinContent(0)/noisehist->Integral(0,noisehist->GetNbinsX()));
202 for(
int i = 1;
i < noisehist->GetNbinsX();
i++){
203 integralFrac.push_back(
float(noisehist->GetBinContent(
i))/
204 noisehist->Integral(0,noisehist->GetNbinsX())+integralFrac[
i-1]);
206 if (integralFrac[
i] >= 0.84135 && integralFrac[
i-1] < 0.84135) {
208 double w = noisehist->GetBinWidth(
i);
209 double a = noisehist->GetBinContent(
i-1);
210 double b = noisehist->GetBinContent(
i);
211 double f = w*(0.84135 -integralFrac[
i-1])/(integralFrac[
i]-integralFrac[
i-1]);
216 double aa = (b-
a)/(2*w);
219 double dd = bb*bb-4*aa*cc;
220 x = (-bb+
sqrt(dd))/(2*aa);
222 ana->
noiseBin84_[iapv][istr] = noisehist->GetBinLowEdge(
i) +
x;
226 TH1D * FitHisto =
new TH1D(
"FitHisto",
"FitHisto",noisehist->GetNbinsX(),
227 -noisehist->GetNbinsX()/2,noisehist->GetNbinsX()/2);
228 FitHisto->Add(&mygaus);
232 if(FitHisto->Integral() > 0){
235 ana->
ksProb_[iapv][istr] = noisehist->KolmogorovTest(FitHisto)*10000;
251 << __func__ <<
"]"<<
" Unknown noise definition!!!";
254 n_sum += ana->
noise_[iapv][istr];
255 n_sum2 += (ana->
noise_[iapv][istr] * ana->
noise_[iapv][istr]);
256 if ( ana->
noise_[iapv][istr] > n_max ) { n_max = ana->
noise_[iapv][istr]; }
257 if ( ana->
noise_[iapv][istr] < n_min ) { n_min = ana->
noise_[iapv][istr]; }
262 if ( !ana->
peds_[iapv].empty() ) {
263 p_sum /=
static_cast<float>( ana->
peds_[iapv].size() );
264 p_sum2 /=
static_cast<float>( ana->
peds_[iapv].size() );
270 if ( !ana->
noise_[iapv].empty() ) {
271 n_sum /=
static_cast<float>( ana->
noise_[iapv].size() );
272 n_sum2 /=
static_cast<float>( ana->
noise_[iapv].size() );
278 if ( !ana->
raw_[iapv].empty() ) {
279 r_sum /=
static_cast<float>( ana->
raw_[iapv].size() );
280 r_sum2 /=
static_cast<float>( ana->
raw_[iapv].size() );
294 for ( uint16_t istr = 0; istr < 128; istr++ ) {
302 ana->
dead_[iapv].push_back(istr);
305 <<
" "<<fec_key.fecCrate()
306 <<
" "<<fec_key.fecSlot()
307 <<
" "<<fec_key.fecRing()
308 <<
" "<<fec_key.ccuAddr()
309 <<
" "<<fec_key.ccuChan()
310 <<
" "<<fec_key.lldChan()
311 <<
" "<<iapv*128+istr<<std::endl;
316 ana->
noisy_[iapv].push_back(istr);
319 <<
" "<<fec_key.fecCrate()
320 <<
" "<<fec_key.fecSlot()
321 <<
" "<<fec_key.fecRing()
322 <<
" "<<fec_key.ccuAddr()
323 <<
" "<<fec_key.ccuChan()
324 <<
" "<<fec_key.lldChan()
325 <<
" "<<iapv*128+istr<<std::endl;
329 ana->
noisy_[iapv].push_back(istr);
332 <<
" "<<fec_key.fecCrate()
333 <<
" "<<fec_key.fecSlot()
334 <<
" "<<fec_key.fecRing()
335 <<
" "<<fec_key.ccuAddr()
336 <<
" "<<fec_key.ccuChan()
337 <<
" "<<fec_key.lldChan()
338 <<
" "<<iapv*128+istr<<std::endl;
341 ana->
noisy_[iapv].push_back(istr);
344 <<
" "<<fec_key.fecCrate()
345 <<
" "<<fec_key.fecSlot()
346 <<
" "<<fec_key.fecRing()
347 <<
" "<<fec_key.ccuAddr()
348 <<
" "<<fec_key.ccuChan()
349 <<
" "<<fec_key.lldChan()
350 <<
" "<<iapv*128+istr<<std::endl;
const uint32_t & fedKey() const
Utility class that holds histogram title.
static const char numberOfHistos_[]
void extract(const std::vector< TH1 * > &)
static const char mlDqmClient_[]
static const char unexpectedExtraInfo_[]
static const char numberOfBins_[]
Histogram-based analysis for pedestal run.
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
static const char mlCommissioning_[]
uint32_t extractFedKey(const TH1 *const )
static const uint16_t maximum_
virtual void addErrorCode(const std::string &error)
const uint32_t & fecKey() const
static const uint16_t invalid_
std::vector< std::vector< double > > tmp
Abstract base for derived classes that provide analysis of commissioning histograms.
CommissioningAnalysis *const anal() const
static const char nullPtr_[]