#include <DQM/SiStripCommissioningAnalysis/interface/SamplingAlgorithm.h>
Public Member Functions | |
const Histo & | histo () const |
SamplingAlgorithm (SamplingAnalysis *const ) | |
virtual | ~SamplingAlgorithm () |
Private Member Functions | |
void | analyse () |
Performs histogram anaylsis. | |
void | correctBinning (TProfile *prof) const |
void | correctProfile (TProfile *profile, float SoNcut=3.) const |
virtual void | extract (const std::vector< TH1 * > &) |
Extracts and organises histograms. | |
void | pruneProfile (TProfile *profile) const |
SamplingAlgorithm () | |
Private Attributes | |
TF1 * | deconv_fitter_ |
Fitter in peak and deconvolution mode. | |
Histo | histo_ |
pulse shape | |
TF1 * | peak_fitter_ |
SamplingAnalysis * | samp_ |
Delaere Algorithm for latency run
Definition at line 17 of file SamplingAlgorithm.h.
SamplingAlgorithm::SamplingAlgorithm | ( | SamplingAnalysis * const | anal | ) |
Definition at line 18 of file SamplingAlgorithm.cc.
References deconv_fitter_, fdeconv_convoluted(), fpeak_convoluted(), and peak_fitter_.
00019 : CommissioningAlgorithm(anal), 00020 histo_(0,""), 00021 deconv_fitter_(0), 00022 peak_fitter_(0), 00023 samp_(0) 00024 { 00025 peak_fitter_ = new TF1("peak_fitter",fpeak_convoluted,-4800,0,5); 00026 peak_fitter_->SetNpx(2000); 00027 peak_fitter_->FixParameter(0,0); 00028 peak_fitter_->SetParLimits(1,0,4800); 00029 peak_fitter_->SetParLimits(2,0,20); 00030 peak_fitter_->FixParameter(3,50); 00031 peak_fitter_->SetParLimits(4,0,100); 00032 peak_fitter_->SetParameters(0.,1250,10,50,10); 00033 deconv_fitter_ = new TF1("deconv_fitter",fdeconv_convoluted,-50,50,5); 00034 deconv_fitter_->SetNpx(1000); 00035 deconv_fitter_->FixParameter(0,0); 00036 deconv_fitter_->SetParLimits(1,-10,10); 00037 deconv_fitter_->SetParLimits(2,0,200); 00038 deconv_fitter_->SetParLimits(3,5,100); 00039 deconv_fitter_->FixParameter(3,50); 00040 deconv_fitter_->SetParLimits(4,0,100); 00041 deconv_fitter_->SetParameters(0.,-2.82,0.96,50,20); 00042 }
virtual SamplingAlgorithm::~SamplingAlgorithm | ( | ) | [inline, virtual] |
SamplingAlgorithm::SamplingAlgorithm | ( | ) | [inline, private] |
void SamplingAlgorithm::analyse | ( | ) | [private, virtual] |
Performs histogram anaylsis.
Implements CommissioningAlgorithm.
Definition at line 106 of file SamplingAlgorithm.cc.
References sistrip::APV_LATENCY, correctBinning(), correctProfile(), deconv_fitter_, SamplingAnalysis::error_, histo_, max, SamplingAnalysis::max_, sistrip::mlCommissioning_, peak_fitter_, pruneProfile(), SamplingAnalysis::runType_, samp_, and SamplingAnalysis::sOnCut_.
00106 { 00107 00108 if ( !samp_ ) { 00109 edm::LogWarning(mlCommissioning_) 00110 << "[SamplingAlgorithm::" << __func__ << "]" 00111 << " NULL pointer to derived Analysis object!"; 00112 return; 00113 } 00114 00115 TProfile* prof = (TProfile*)(histo_.first); 00116 if ( !prof ) { 00117 edm::LogWarning(mlCommissioning_) 00118 << " NULL pointer to histogram!" ; 00119 return; 00120 } 00121 00122 // set the right error mode: rms 00123 prof->SetErrorOption(" "); 00124 00125 // prune the profile 00126 pruneProfile(prof); 00127 00128 // correct for the binning 00129 correctBinning(prof); 00130 00131 // correct for clustering effects 00132 correctProfile(prof,samp_->sOnCut_); 00133 00134 // fit depending on the mode 00135 if(samp_->runType_==sistrip::APV_LATENCY) { 00136 00137 // initialize the fit (overal latency) 00138 float max = prof->GetBinCenter(prof->GetMaximumBin()); 00139 float ampl = prof->GetMaximum(); 00140 peak_fitter_->SetParameters(0.,50-max,ampl/20.,50,10); 00141 00142 // fit 00143 if(prof->Fit(peak_fitter_,"Q")==0) 00144 prof->Fit(peak_fitter_,"QEM"); 00145 00146 // Set monitorables 00147 samp_->max_ = peak_fitter_->GetMaximumX(); 00148 samp_->error_ = peak_fitter_->GetParError(1); 00149 00150 } else { // sistrip::FINE_DELAY 00151 00152 // fit 00153 if(prof->Fit(deconv_fitter_,"Q")==0) 00154 prof->Fit(deconv_fitter_,"QEM"); 00155 00156 // Set monitorables 00157 samp_->max_ = deconv_fitter_->GetMaximumX(); 00158 samp_->error_ = deconv_fitter_->GetParError(1); 00159 00160 } 00161 00162 }
void SamplingAlgorithm::correctBinning | ( | TProfile * | prof | ) | const [private] |
Definition at line 183 of file SamplingAlgorithm.cc.
Referenced by analyse().
00184 { 00185 prof->GetXaxis()->SetLimits(prof->GetXaxis()->GetXmin()-prof->GetBinWidth(1)/2., 00186 prof->GetXaxis()->GetXmax()-prof->GetBinWidth(1)/2.); 00187 }
void SamplingAlgorithm::correctProfile | ( | TProfile * | profile, | |
float | SoNcut = 3. | |||
) | const [private] |
Definition at line 191 of file SamplingAlgorithm.cc.
References SamplingAnalysis::correctMeasurement(), SamplingAnalysis::limit(), min, and samp_.
Referenced by analyse().
00192 { 00193 if ( !samp_ ) { return; } 00194 uint32_t nbins=profile->GetNbinsX(); 00195 float min = samp_->limit(SoNcut); 00196 for(uint32_t bin=1;bin<=nbins;++bin) 00197 if(profile->GetBinContent(bin)<min) { 00198 profile->SetBinContent(bin,0.); 00199 profile->SetBinError(bin,0.); 00200 profile->SetBinEntries(bin,0); 00201 } 00202 else { 00203 profile->SetBinContent(bin, 00204 profile->GetBinEntries(bin)* 00205 samp_->correctMeasurement(profile->GetBinContent(bin),SoNcut)); 00206 } 00207 }
void SamplingAlgorithm::extract | ( | const std::vector< TH1 * > & | ) | [private, virtual] |
Extracts and organises histograms.
Implements CommissioningAlgorithm.
Definition at line 46 of file SamplingAlgorithm.cc.
References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), sistrip::APV_LATENCY, sistrip::extrainfo::clusterCharge_, CommissioningAlgorithm::extractFedKey(), CommissioningAnalysis::fedKey(), sistrip::FINE_DELAY, SamplingAnalysis::granularity_, histo_, sistrip::mlCommissioning_, sistrip::numberOfHistos_, SamplingAnalysis::runType_, samp_, indexGen::title, tmp, and sistrip::unexpectedTask_.
00046 { 00047 00048 if ( !anal() ) { 00049 edm::LogWarning(mlCommissioning_) 00050 << "[SamplingAlgorithm::" << __func__ << "]" 00051 << " NULL pointer to Analysis object!"; 00052 return; 00053 } 00054 00055 CommissioningAnalysis* tmp = const_cast<CommissioningAnalysis*>( anal() ); 00056 samp_ = dynamic_cast<SamplingAnalysis*>( tmp ); 00057 if ( !samp_ ) { 00058 edm::LogWarning(mlCommissioning_) 00059 << "[SamplingAlgorithm::" << __func__ << "]" 00060 << " NULL pointer to derived Analysis object!"; 00061 return; 00062 } 00063 00064 // Check 00065 if ( histos.size() != 1 && histos.size() != 2 ) { 00066 samp_->addErrorCode(sistrip::numberOfHistos_); 00067 } 00068 00069 // Extract FED key from histo title 00070 if ( !histos.empty() ) { samp_->fedKey( extractFedKey( histos.front() ) ); } 00071 00072 // Extract 00073 std::vector<TH1*>::const_iterator ihis = histos.begin(); 00074 for ( ; ihis != histos.end(); ihis++ ) { 00075 00076 // Check pointer 00077 if ( !(*ihis) ) { 00078 edm::LogWarning(mlCommissioning_) << " NULL pointer to histogram!"; 00079 continue; 00080 } 00081 00082 // Check name 00083 SiStripHistoTitle title( (*ihis)->GetName() ); 00084 if ( title.runType() != sistrip::APV_LATENCY && title.runType() != sistrip::FINE_DELAY) { 00085 samp_->addErrorCode(sistrip::unexpectedTask_); 00086 continue; 00087 } 00088 // Set the mode for later fits 00089 samp_->runType_ = title.runType(); 00090 00091 // Set the granularity 00092 samp_->granularity_ = title.granularity(); 00093 00094 // Extract timing histo 00095 if ( title.extraInfo().find(sistrip::extrainfo::clusterCharge_) != std::string::npos ) { 00096 histo_.first = *ihis; 00097 histo_.second = (*ihis)->GetName(); 00098 } 00099 00100 } 00101 00102 }
const Histo& SamplingAlgorithm::histo | ( | ) | const [inline] |
void SamplingAlgorithm::pruneProfile | ( | TProfile * | profile | ) | const [private] |
Definition at line 166 of file SamplingAlgorithm.cc.
Referenced by analyse().
00167 { 00168 // loop over bins to find the max stat 00169 uint32_t nbins=profile->GetNbinsX(); 00170 uint32_t max = 0; 00171 for(uint32_t bin=1;bin<=nbins;++bin) max = max < profile->GetBinEntries(bin) ? uint32_t(profile->GetBinEntries(bin)) : max; 00172 // loop over bins to clean 00173 uint32_t min = max/10; 00174 for(uint32_t bin=1;bin<=nbins;++bin) 00175 if(profile->GetBinEntries(bin)<min) { 00176 profile->SetBinContent(bin,0.); 00177 profile->SetBinError(bin,0.); 00178 } 00179 }
TF1* SamplingAlgorithm::deconv_fitter_ [private] |
Fitter in peak and deconvolution mode.
Definition at line 47 of file SamplingAlgorithm.h.
Referenced by analyse(), and SamplingAlgorithm().
Histo SamplingAlgorithm::histo_ [private] |
TF1* SamplingAlgorithm::peak_fitter_ [private] |
Definition at line 49 of file SamplingAlgorithm.h.
Referenced by analyse(), and SamplingAlgorithm().
SamplingAnalysis* SamplingAlgorithm::samp_ [private] |
Definition at line 51 of file SamplingAlgorithm.h.
Referenced by analyse(), correctProfile(), and extract().