58 double averageSigma = 0.;
60 double averagekfactor = 0;
63 for (
auto sl = dtSupLylist.begin(); sl != dtSupLylist.end(); sl++) {
67 if (ttrigMean < ttrigMax && ttrigMean >
ttrigMin) {
69 averageSigma += ttrigSigma;
76 averageSigma = averageSigma /
counter;
81 for (
auto sl = dtSupLylist.begin(); sl != dtSupLylist.end(); sl++) {
86 if (ttrigMean < ttrigMax && ttrigMean >
ttrigMin) {
93 cout <<
"average averageSigma counter rms " <<
average <<
" " << averageSigma <<
" " <<
counter <<
" " <<
rms << endl;
95 for (
auto sl = dtSupLylist.begin(); sl != dtSupLylist.end(); sl++) {
97 double newTTrigMean = 0;
98 double newTTrigSigma = 0;
99 double newkfactor = 0;
100 float tempttrigMean = 0;
101 float tempttrigSigma = 0;
102 float tempkfactor = 0;
104 float ttrigSigma = 0;
107 int chamber = (*sl)->id().chamberId().station();
111 newTTrigMean = ttrigMean;
112 newTTrigSigma = ttrigSigma;
118 if (((*sl)->id().superlayer()) == 1) {
123 newTTrigMean = tempttrigMean;
124 newTTrigSigma = tempttrigSigma;
125 newkfactor = tempkfactor;
126 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
127 <<
" -> takes value of sl 3 " << newTTrigMean << endl;
129 cout <<
"No correction possible within same chamber (sl1) " << endl;
131 newTTrigSigma = averageSigma;
132 newkfactor = averagekfactor;
133 cout <<
"####### Bad SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
138 newTTrigMean = tempttrigMean;
139 newTTrigSigma = tempttrigSigma;
140 newkfactor = tempkfactor;
141 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
142 <<
" -> takes value of sl 2 " << newTTrigMean << endl;
144 cout <<
"No correction possible within same chamber (sl1) " << endl;
146 newTTrigSigma = averageSigma;
147 newkfactor = averagekfactor;
148 cout <<
"####### Bad SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
151 }
else if (((*sl)->id().superlayer()) == 2) {
156 newTTrigMean = tempttrigMean;
157 newTTrigSigma = tempttrigSigma;
158 newkfactor = tempkfactor;
159 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
160 <<
" -> takes value of sl 1 " << newTTrigMean << endl;
165 newTTrigMean = tempttrigMean;
166 newTTrigSigma = tempttrigSigma;
167 newkfactor = tempkfactor;
168 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
169 <<
"-> takes value of sl 3 " << newTTrigMean << endl;
171 cout <<
"No correction possible within same chamber (sl2) " << endl;
173 newTTrigSigma = averageSigma;
174 newkfactor = averagekfactor;
175 cout <<
"####### Bad SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
179 }
else if (((*sl)->id().superlayer()) == 3) {
184 newTTrigMean = tempttrigMean;
185 newTTrigSigma = tempttrigSigma;
186 newkfactor = tempkfactor;
187 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
188 <<
" -> takes value of sl 1 " << newTTrigMean << endl;
190 cout <<
"No correction possible within same chamber (sl3)" << endl;
192 newTTrigSigma = averageSigma;
193 newkfactor = averagekfactor;
194 cout <<
"####### Bad SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
199 newTTrigMean = tempttrigMean;
200 newTTrigSigma = tempttrigSigma;
201 newkfactor = tempkfactor;
202 cout <<
"Chamber " <<
chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig " << ttrigMean
203 <<
" -> takes value of sl 2 " << newTTrigMean << endl;
205 cout <<
"No correction possible within same chamber (sl3) " << endl;
207 newTTrigSigma = averageSigma;
208 newkfactor = averagekfactor;
209 cout <<
"####### Bad SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
216 newTTrigSigma = averageSigma;
217 newkfactor = averagekfactor;
218 cout <<
"####### NotPresent SL: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
223 tTrigNewMap.
set((*sl)->id(), newTTrigMean, newTTrigSigma, newkfactor,
DTTimeUnits::ns);
225 cout <<
"New tTrig: " << (*sl)->id() <<
" from " << ttrigMean <<
" to " << newTTrigMean << endl;
226 cout <<
"New tTrigSigma: " << (*sl)->id() <<
" from " << ttrigSigma <<
" to " << newTTrigSigma << endl;
231 cout <<
"[DTTTrigCorrection]: Writing ttrig object to DB!" << endl;
232 string record =
"DTTtrigRcd";
233 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.