58 double averageSigma = 0.;
59 double average2Sigma = 0.;
61 double averagekfactor = 0;
64 for (
auto sl = dtSupLylist.begin(); sl != dtSupLylist.end(); sl++) {
68 if (ttrigMean < ttrigMax && ttrigMean >
ttrigMin) {
70 averageSigma += ttrigSigma;
77 averageSigma = averageSigma /
counter;
82 for (
auto sl = dtSupLylist.begin(); sl != dtSupLylist.end(); sl++) {
87 if (ttrigMean < ttrigMax && ttrigMean >
ttrigMin) {
89 average2Sigma += (ttrigSigma - averageSigma) * (ttrigSigma - averageSigma);
95 cout <<
"average averageSigma counter rms " <<
average <<
" " << averageSigma <<
" " <<
counter <<
" " <<
rms << endl;
97 for (
auto sl = dtSupLylist.begin(); sl != dtSupLylist.end(); sl++) {
99 double newTTrigMean = 0;
100 double newTTrigSigma = 0;
101 double newkfactor = 0;
102 float tempttrigMean = 0;
103 float tempttrigSigma = 0;
104 float tempkfactor = 0;
106 float ttrigSigma = 0;
109 int chamber = (*sl)->id().chamberId().station();
113 newTTrigMean = ttrigMean;
114 newTTrigSigma = ttrigSigma;
120 if (((*sl)->id().superlayer()) == 1) {
125 newTTrigMean = tempttrigMean;
126 newTTrigSigma = tempttrigSigma;
127 newkfactor = tempkfactor;
128 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
129 <<
" -> takes value of sl 3 " << newTTrigMean << endl;
131 cout <<
"No correction possible within same chamber (sl1) " << endl;
133 newTTrigSigma = averageSigma;
134 newkfactor = averagekfactor;
135 cout <<
"####### Bad SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
140 newTTrigMean = tempttrigMean;
141 newTTrigSigma = tempttrigSigma;
142 newkfactor = tempkfactor;
143 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
144 <<
" -> takes value of sl 2 " << newTTrigMean << endl;
146 cout <<
"No correction possible within same chamber (sl1) " << endl;
148 newTTrigSigma = averageSigma;
149 newkfactor = averagekfactor;
150 cout <<
"####### Bad SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
153 }
else if (((*sl)->id().superlayer()) == 2) {
158 newTTrigMean = tempttrigMean;
159 newTTrigSigma = tempttrigSigma;
160 newkfactor = tempkfactor;
161 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
162 <<
" -> takes value of sl 1 " << newTTrigMean << endl;
167 newTTrigMean = tempttrigMean;
168 newTTrigSigma = tempttrigSigma;
169 newkfactor = tempkfactor;
170 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
171 <<
"-> takes value of sl 3 " << newTTrigMean << endl;
173 cout <<
"No correction possible within same chamber (sl2) " << endl;
175 newTTrigSigma = averageSigma;
176 newkfactor = averagekfactor;
177 cout <<
"####### Bad SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
181 }
else if (((*sl)->id().superlayer()) == 3) {
186 newTTrigMean = tempttrigMean;
187 newTTrigSigma = tempttrigSigma;
188 newkfactor = tempkfactor;
189 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
190 <<
" -> takes value of sl 1 " << newTTrigMean << endl;
192 cout <<
"No correction possible within same chamber (sl3)" << endl;
194 newTTrigSigma = averageSigma;
195 newkfactor = averagekfactor;
196 cout <<
"####### Bad SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
201 newTTrigMean = tempttrigMean;
202 newTTrigSigma = tempttrigSigma;
203 newkfactor = tempkfactor;
204 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
205 <<
" -> takes value of sl 2 " << newTTrigMean << endl;
207 cout <<
"No correction possible within same chamber (sl3) " << endl;
209 newTTrigSigma = averageSigma;
210 newkfactor = averagekfactor;
211 cout <<
"####### Bad SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
218 newTTrigSigma = averageSigma;
219 newkfactor = averagekfactor;
220 cout <<
"####### NotPresent SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
225 tTrigNewMap.
set((*sl)->id(), newTTrigMean, newTTrigSigma, newkfactor,
DTTimeUnits::ns);
227 cout <<
"New tTrig: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
228 cout <<
"New tTrigSigma: " << (*sl)->id() <<
" from " << ttrigSigma <<
" to " << newTTrigSigma << endl;
233 cout <<
"[DTTTrigCorrection]: Writing ttrig object to DB!" << endl;
234 string record =
"DTTtrigRcd";
235 DTCalibDBUtils::writeToDB<DTTtrig>(
record, tTrigNewMap);
int set(int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
Abs< T >::type abs(const T &t)
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
static std::atomic< unsigned int > counter
edm::ESHandle< DTGeometry > muonGeom
const unsigned int kfactor
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.