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++ ) {
155 for ( uint16_t istr = 0; istr < 128; istr++ ) {
157 ana->
ksProb_[iapv].push_back(0);
165 if ( peds_histo->GetBinEntries(iapv*128 + istr + 1) ) {
166 ana->
peds_[iapv][istr] = peds_histo->GetBinContent(iapv*128 + istr + 1);
167 p_sum += ana->
peds_[iapv][istr];
168 p_sum2 += (ana->
peds_[iapv][istr] * ana->
peds_[iapv][istr]);
169 if ( ana->
peds_[iapv][istr] > p_max ) { p_max = ana->
peds_[iapv][istr];}
170 if ( ana->
peds_[iapv][istr] < p_min ) { p_min = ana->
peds_[iapv][istr];}
171 ana->
raw_[iapv][istr] = peds_histo->GetBinError(iapv*128 + istr + 1);
172 r_sum += ana->
raw_[iapv][istr];
173 r_sum2 += (ana->
raw_[iapv][istr] * ana->
raw_[iapv][istr]);
174 if ( ana->
raw_[iapv][istr] > r_max ) { r_max = ana->
raw_[iapv][istr]; }
175 if ( ana->
raw_[iapv][istr] < r_min ) { r_min = ana->
raw_[iapv][istr]; }
182 TH1S * noisehist =
new TH1S(
"noisehist",
"",noise_histo->GetNbinsX(),
183 -noise_histo->GetNbinsX()/2,noise_histo->GetNbinsX()/2);
186 for(
int i=0;
i<=noise_histo->GetNbinsX()+1;
i++){
187 noisehist->SetBinContent(
i,noise_histo->GetBinContent(
i,iapv*128 + istr + 1));
190 if(noisehist->Integral() > 0){
191 ana->
noiseRMS_[iapv][istr] = noisehist->GetRMS();
192 noisehist->Fit(
"gaus",
"Q");
193 ana->
noiseGaus_[iapv][istr] = noisehist->GetFunction(
"gaus")->GetParameter(2);
196 std::vector<float> integralFrac;
197 integralFrac.push_back(1.*noisehist->GetBinContent(0)/noisehist->Integral(0,noisehist->GetNbinsX()));
199 for(
int i = 1;
i < noisehist->GetNbinsX();
i++){
200 integralFrac.push_back(
float(noisehist->GetBinContent(
i))/
201 noisehist->Integral(0,noisehist->GetNbinsX())+integralFrac[
i-1]);
203 if (integralFrac[
i] >= 0.84135 && integralFrac[
i-1] < 0.84135) {
205 double w = noisehist->GetBinWidth(
i);
206 double a = noisehist->GetBinContent(
i-1);
207 double b = noisehist->GetBinContent(
i);
208 double f = w*(0.84135 -integralFrac[
i-1])/(integralFrac[
i]-integralFrac[
i-1]);
213 double aa = (b-
a)/(2*w);
216 double dd = bb*bb-4*aa*cc;
217 x = (-bb+
sqrt(dd))/(2*aa);
219 ana->
noiseBin84_[iapv][istr] = noisehist->GetBinLowEdge(
i) +
x;
223 TH1D * FitHisto =
new TH1D(
"FitHisto",
"FitHisto",noisehist->GetNbinsX(),
224 -noisehist->GetNbinsX()/2,noisehist->GetNbinsX()/2);
225 FitHisto->Add(noisehist->GetFunction(
"gaus"));
229 if(FitHisto->Integral() > 0){
232 ana->
ksProb_[iapv][istr] = noisehist->KolmogorovTest(FitHisto)*10000;
248 << __func__ <<
"]"<<
" Unknown noise definition!!!";
251 n_sum += ana->
noise_[iapv][istr];
252 n_sum2 += (ana->
noise_[iapv][istr] * ana->
noise_[iapv][istr]);
253 if ( ana->
noise_[iapv][istr] > n_max ) { n_max = ana->
noise_[iapv][istr]; }
254 if ( ana->
noise_[iapv][istr] < n_min ) { n_min = ana->
noise_[iapv][istr]; }
259 if ( !ana->
peds_[iapv].empty() ) {
260 p_sum /=
static_cast<float>( ana->
peds_[iapv].size() );
261 p_sum2 /=
static_cast<float>( ana->
peds_[iapv].size() );
267 if ( !ana->
noise_[iapv].empty() ) {
268 n_sum /=
static_cast<float>( ana->
noise_[iapv].size() );
269 n_sum2 /=
static_cast<float>( ana->
noise_[iapv].size() );
275 if ( !ana->
raw_[iapv].empty() ) {
276 r_sum /=
static_cast<float>( ana->
raw_[iapv].size() );
277 r_sum2 /=
static_cast<float>( ana->
raw_[iapv].size() );
291 for ( uint16_t istr = 0; istr < 128; istr++ ) {
299 ana->
dead_[iapv].push_back(istr);
302 <<
" "<<fec_key.fecCrate()
303 <<
" "<<fec_key.fecSlot()
304 <<
" "<<fec_key.fecRing()
305 <<
" "<<fec_key.ccuAddr()
306 <<
" "<<fec_key.ccuChan()
307 <<
" "<<fec_key.lldChan()
308 <<
" "<<iapv*128+istr<<std::endl;
313 ana->
noisy_[iapv].push_back(istr);
316 <<
" "<<fec_key.fecCrate()
317 <<
" "<<fec_key.fecSlot()
318 <<
" "<<fec_key.fecRing()
319 <<
" "<<fec_key.ccuAddr()
320 <<
" "<<fec_key.ccuChan()
321 <<
" "<<fec_key.lldChan()
322 <<
" "<<iapv*128+istr<<std::endl;
326 ana->
noisy_[iapv].push_back(istr);
329 <<
" "<<fec_key.fecCrate()
330 <<
" "<<fec_key.fecSlot()
331 <<
" "<<fec_key.fecRing()
332 <<
" "<<fec_key.ccuAddr()
333 <<
" "<<fec_key.ccuChan()
334 <<
" "<<fec_key.lldChan()
335 <<
" "<<iapv*128+istr<<std::endl;
338 ana->
noisy_[iapv].push_back(istr);
341 <<
" "<<fec_key.fecCrate()
342 <<
" "<<fec_key.fecSlot()
343 <<
" "<<fec_key.fecRing()
344 <<
" "<<fec_key.ccuAddr()
345 <<
" "<<fec_key.ccuChan()
346 <<
" "<<fec_key.lldChan()
347 <<
" "<<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_[]