#include <MDTTDCOfflineSpectrum.h>
Definition at line 21 of file MDTTDCOfflineSpectrum.h.
◆ MDTTDCOfflineSpectrum()
dqm_algorithms::MDTTDCOfflineSpectrum::MDTTDCOfflineSpectrum |
( |
const std::string & |
name | ) |
|
◆ clone()
◆ execute()
dqm_core::Result * dqm_algorithms::MDTTDCOfflineSpectrum::execute |
( |
const std::string & |
name, |
|
|
const TObject & |
object, |
|
|
const dqm_core::AlgorithmConfig & |
config |
|
) |
| |
Definition at line 38 of file MDTTDCOfflineSpectrum.cxx.
44 if (!
object.
IsA()->InheritsFrom(
"TH1")) {
45 throw dqm_core::BadConfig(ERS_HERE,
name,
"does not inherit from TH1");
47 std::unique_ptr<TH1>
histogram(
static_cast<TH1 *
>(
object.Clone()));
49 throw dqm_core::BadConfig(ERS_HERE,
name,
"dimension > 2");
60 double t0_low_warning;
62 double t0_high_warning;
64 double tmax_low_warning;
65 double tmax_low_error;
66 double tmax_high_warning;
67 double tmax_high_error;
78 catch ( dqm_core::Exception & ex ) {
79 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
91 TF1* t0Fit =
histogram->GetFunction(
"func1");
92 TF1* tmaxFit =
histogram->GetFunction(
"func2");
94 if(!t0Fit || !tmaxFit){
97 tmaxFit =
histogram->GetFunction(
"func2");
99 if(!t0Fit || !tmaxFit)
throw dqm_core::BadConfig( ERS_HERE,
name,
"TH1 has no TF1" );
101 t0 = t0Fit->GetParameter(1);
102 tmax = tmaxFit->GetParameter(1);
104 t0Err = t0Fit->GetParameter(2);
105 tmaxErr = tmaxFit->GetParameter(2);
108 ERS_DEBUG(1,
m_name <<
" TDrift " <<
" is " << tdrift );
109 ERS_DEBUG(1,
"Green threshold: "<< t0_low_warning <<
" < t0 < "<< t0_high_warning <<
" && " << tmax_low_warning <<
" < tmax < " << tmax_high_warning <<
110 " ; Red threshold : t0 < " << t0_low_error <<
"\n" <<
111 "t0 > " << t0_high_error <<
"\n" <<
112 "tmax > " << tmax_high_error <<
"\n" <<
113 "tmax < " << tmax_low_error
116 std::map<std::string,double>
tags;
118 if (
t0 > t0_low_warning &&
t0 < t0_high_warning && tmax < tmax_high_warning && tmax > tmax_low_warning && std::abs(tdrift) < 1000) {
121 else if (
t0 > t0_low_error &&
t0 < t0_high_error && tmax < tmax_high_error && tmax > tmax_low_error && std::abs(tdrift) < 1200) {
122 if(
t0 < t0_low_warning)
tags[
"t0_low_Warning"] =
t0;
123 else if(
t0 > t0_high_warning)
tags[
"t0_high_Warning"] =
t0;
125 if(tmax > tmax_high_warning)
tags[
"tMax_high_Warning"] = tmax;
126 else if(tmax < tmax_low_warning)
tags[
"tMax_low_Warning"] = tmax;
127 else tags[
"tMax"] = tmax;
128 if( std::abs(tdrift) > 1200 )
tags[
"tDrift_Warning"] = tdrift;
129 else tags[
"tdrift"] = tdrift;
130 result->status_ = dqm_core::Result::Yellow;
134 if(
t0 < t0_low_error)
tags[
"t0_low_Error"] =
t0;
135 else if(
t0 > t0_high_error)
tags[
"t0_high_Error"] =
t0;
137 if(tmax > tmax_high_error)
tags[
"tMax_high_Error"] = tmax;
138 else if(tmax < tmax_low_error)
tags[
"tMax_low_Error"] = tmax;
139 else tags[
"tMax"] = tmax;
140 if( std::abs(tdrift) > 1400 )
tags[
"tDrift_Error"] = tdrift;
141 else tags[
"tdrift"] = tdrift;
147 tags[
"tdrift"] = tdrift;
150 tags[
"t0_FitError"] = t0Err;
153 if(tmaxErr > 2.*tmax) {
154 tags[
"tmax_FitError"] = tmaxErr;
◆ MDTFitTDC()
void dqm_algorithms::MDTTDCOfflineSpectrum::MDTFitTDC |
( |
TH1 * |
h, |
|
|
double & |
t0, |
|
|
double & |
t0err, |
|
|
double & |
tmax, |
|
|
double & |
tmaxerr |
|
) |
| |
Definition at line 178 of file MDTTDCOfflineSpectrum.cxx.
182 double up =
h->GetBinCenter(
h->GetMaximumBin()+1);
183 if(
up > 200 )
up = 200;
184 double down =
up + 650;
185 if(
up < 50 )
up = 50;
186 double parESD0 =
h->GetBinContent(
h->GetMinimumBin());
189 double parESD3 =
h->GetBinContent(
h->GetMaximumBin()) -
h->GetBinContent(
h->GetMinimumBin());
190 std::unique_ptr<TF1> func1 = std::make_unique<TF1>(
"func1",
"[0]+([3]/(1+(TMath::Exp((-x+[1])/[2]))))", 0,
up);
191 func1->SetParameters(parESD0, parESD1, parESD2, parESD3);
192 if(
h->GetEntries()>100){
193 h->Fit(
"func1",
"RQ");
194 t0 = func1->GetParameter(1) ;
195 t0err = func1->GetParError(1);
196 double binAtT0 = (
double)
h->GetBinContent(
h->FindBin(
t0));
197 if(binAtT0<1) binAtT0 = 1;
198 t0err += 10.0 * func1->GetChisquare() / (0.01*binAtT0*binAtT0*(
double)func1->GetNumberFitPoints());
201 parESD0 =
h->GetBinContent(
h->GetMinimumBin());
204 parESD3 = (
h->GetBinContent(
h->GetMaximumBin())-
h->GetBinContent(
h->GetMinimumBin()))/10.;
205 std::unique_ptr<TF1> func2 = std::make_unique<TF1>(
"func2",
"[0]+([3]/(1+(TMath::Exp((x-[1])/[2]))))", down-135, down+135);
206 func2->SetParameters(parESD0,parESD1,parESD2,parESD3);
207 if(
h->GetEntries()>100){
208 func2->SetParLimits(0, parESD0, 2.0*parESD0+1);
209 func2->SetParLimits(2, 5, 90);
210 func2->SetParLimits(3, 0.2*parESD3, 7*parESD3);
211 h->Fit(
"func2",
"WWRQ+");
212 tmax = func2->GetParameter(1);
213 tmaxerr = func2->GetParError(1);
214 double binAtTmax = (
double)
h->GetBinContent(
h->FindBin(tmax));
215 if(binAtTmax<1) binAtTmax = 1;
216 tmaxerr += 10.0 * func2->GetChisquare() / (0.01*binAtTmax*binAtTmax*(
double)func2->GetNumberFitPoints());
◆ printDescription()
void dqm_algorithms::MDTTDCOfflineSpectrum::printDescription |
( |
std::ostream & |
out | ) |
|
Definition at line 165 of file MDTTDCOfflineSpectrum.cxx.
168 out <<
"Analyze pre-fitted MDTTDC spectra histograms" << std::endl;
169 out <<
"Required Parameters: name " <<
m_name <<
", t0Warning threshold" <<
", tMaxWarning threshold" << std::endl;
170 out <<
"Required parameters: t0Error" <<
", tMaxError " << std::endl;
171 out <<
"Returns yellow if t0 < t0Warning or t0 > 800 or if tMax > tMaxWarning or tMax < 800" << std::endl;
172 out <<
"Returns red if t0 < t0Error or t0 > 1000 or if tMax > tMaxError or tMax < 700" << std::endl;
173 out <<
"Returns red if t0Err > 2.*t0 or tMaxErr > 2.*tMax" << std::endl;
174 out <<
"Requires that a histogram has a function named \"func1\" for the t0 fit and \"func2\" for the tMax fit" << std::endl;
◆ m_name
std::string dqm_algorithms::MDTTDCOfflineSpectrum::m_name |
|
private |
The documentation for this struct was generated from the following files: