41{
42
43
44 if (!
object.
IsA()->InheritsFrom(
"TH1")) {
45 throw dqm_core::BadConfig(ERS_HERE, name, "does not inherit from TH1");
46 }
47 std::unique_ptr<TH1>
histogram(
static_cast<TH1 *
>(
object.Clone()));
49 throw dqm_core::BadConfig(ERS_HERE, name, "dimension > 2");
50 }
51
53
55 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
58 }
59
60 double t0_low_warning;
61 double t0_low_error;
62 double t0_high_warning;
63 double t0_high_error;
64 double tmax_low_warning;
65 double tmax_low_error;
66 double tmax_high_warning;
67 double tmax_high_error;
68 try {
77 }
78 catch ( dqm_core::Exception & ex ) {
79 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
80 }
81
82
83 dqm_core::Result*
result =
new dqm_core::Result();
84
86 double tmax;
87 double tdrift;
88 double t0Err;
89 double tmaxErr;
90
91 TF1* t0Fit =
histogram->GetFunction(
"func1");
92 TF1* tmaxFit =
histogram->GetFunction(
"func2");
93
94 if(!t0Fit || !tmaxFit){
97 }else{
98 t0 = t0Fit->GetParameter(1);
99 tmax = tmaxFit->GetParameter(1);
101 t0Err = t0Fit->GetParameter(2);
102 tmaxErr = tmaxFit->GetParameter(2);
103 }
104
105
106 ERS_DEBUG(1,
m_name <<
" TDrift " <<
" is " << tdrift );
107 ERS_DEBUG(1,"Green threshold: "<< t0_low_warning << " < t0 < "<< t0_high_warning << " && " << tmax_low_warning <<" < tmax < " << tmax_high_warning <<
108 " ; Red threshold : t0 < " << t0_low_error << "\n" <<
109 "t0 > " << t0_high_error << "\n" <<
110 "tmax > " << tmax_high_error << "\n" <<
111 "tmax < " << tmax_low_error
112 );
113
114 std::map<std::string,double>
tags;
115
116 if (
t0 > t0_low_warning &&
t0 < t0_high_warning && tmax < tmax_high_warning && tmax > tmax_low_warning && std::abs(tdrift) < 1000) {
117 result->status_ = dqm_core::Result::Green;
118 }
119 else if (
t0 > t0_low_error &&
t0 < t0_high_error && tmax < tmax_high_error && tmax > tmax_low_error && std::abs(tdrift) < 1200) {
120 if(
t0 < t0_low_warning)
tags[
"t0_low_Warning"] =
t0;
121 else if(
t0 > t0_high_warning)
tags[
"t0_high_Warning"] =
t0;
123 if(tmax > tmax_high_warning)
tags[
"tMax_high_Warning"] = tmax;
124 else if(tmax < tmax_low_warning)
tags[
"tMax_low_Warning"] = tmax;
125 else tags[
"tMax"] = tmax;
126 if( std::abs(tdrift) > 1200 )
tags[
"tDrift_Warning"] = tdrift;
127 else tags[
"tdrift"] = tdrift;
128 result->status_ = dqm_core::Result::Yellow;
129 }
130 else {
131 result->status_ = dqm_core::Result::Red;
132 if(
t0 < t0_low_error)
tags[
"t0_low_Error"] =
t0;
133 else if(
t0 > t0_high_error)
tags[
"t0_high_Error"] =
t0;
135 if(tmax > tmax_high_error)
tags[
"tMax_high_Error"] = tmax;
136 else if(tmax < tmax_low_error)
tags[
"tMax_low_Error"] = tmax;
137 else tags[
"tMax"] = tmax;
138 if( std::abs(tdrift) > 1400 )
tags[
"tDrift_Error"] = tdrift;
139 else tags[
"tdrift"] = tdrift;
140 }
141
145 tags[
"tdrift"] = tdrift;
146 }
148 tags[
"t0_FitError"] = t0Err;
149 result->status_ = dqm_core::Result::Red;
150 }
151 if(tmaxErr > 2.*tmax) {
152 tags[
"tmax_FitError"] = tmaxErr;
153 result->status_ = dqm_core::Result::Red;
154 }
155
157
159
160}
std::vector< std::string > tags
void MDTFitTDC(TH1 *h, double &t0, double &t0err, double &tmax, double &tmaxerr)
#define IsA
Declare the TObject style functions.