55 vector<DTSuperLayer*> dtSupLylist =
muonGeom->superLayers();
61 double averageSigma = 0.;
62 double average2Sigma = 0.;
65 double averagekfactor = 0;
68 for (vector<DTSuperLayer*>::const_iterator sl = dtSupLylist.begin();
69 sl != dtSupLylist.end(); sl++) {
77 if( ttrigMean < ttrigMax && ttrigMean >
ttrigMin ) {
79 averageSigma += ttrigSigma;
85 average = average/ counter;
86 averageSigma = averageSigma/counter;
87 averagekfactor = kfactor;
91 for (vector<DTSuperLayer*>::const_iterator sl = dtSupLylist.begin();
92 sl != dtSupLylist.end(); sl++) {
101 if( ttrigMean < ttrigMax && ttrigMean > ttrigMin ) {
102 average2 += (ttrigMean-
average)*(ttrigMean-average);
103 average2Sigma += (ttrigSigma-averageSigma)*(ttrigSigma-averageSigma);
107 rms = average2 /(counter-1);
108 rmsSigma = average2Sigma /(counter-1);
110 rmsSigma =
sqrt(rmsSigma);
111 cout <<
"average averageSigma counter rms "<< average <<
" " << averageSigma <<
" " << counter <<
" " << rms <<endl;
114 for (vector<DTSuperLayer*>::const_iterator sl = dtSupLylist.begin();
115 sl != dtSupLylist.end(); sl++) {
117 double newTTrigMean = 0;
118 double newTTrigSigma = 0;
119 double newkfactor =0;
120 float tempttrigMean = 0;
121 float tempttrigSigma = 0;
122 float tempkfactor = 0;
124 float ttrigSigma = 0;
131 int chamber = (*sl)->id().chamberId().station();
135 newTTrigMean = ttrigMean;
136 newTTrigSigma = ttrigSigma;
137 newkfactor = kfactor;
142 if(((*sl)->id().superlayer()) == 1){
151 newTTrigMean = tempttrigMean;
152 newTTrigSigma = tempttrigSigma;
153 newkfactor = tempkfactor;
154 cout <<
"Chamber "<< chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig "<< ttrigMean
155 <<
" -> takes value of sl 3 " << newTTrigMean <<endl;
156 }
else if(chamber == 4){
157 cout <<
"No correction possible within same chamber (sl1) " <<endl;
159 newTTrigSigma = averageSigma;
160 newkfactor = averagekfactor;
161 cout<<
"####### Bad SL: " << (*sl)->id() <<
" from "<< ttrigMean <<
" to "<< newTTrigMean <<endl;
162 }
else if(chamber != 4){
170 newTTrigMean = tempttrigMean;
171 newTTrigSigma = tempttrigSigma;
172 newkfactor = tempkfactor;
173 cout <<
"Chamber "<< chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig "<< ttrigMean
174 <<
" -> takes value of sl 2 " << newTTrigMean <<endl;
176 cout <<
"No correction possible within same chamber (sl1) " <<endl;
178 newTTrigSigma = averageSigma;
179 newkfactor = averagekfactor;
180 cout<<
"####### Bad SL: " << (*sl)->id() <<
" from "<< ttrigMean <<
" to "<< newTTrigMean <<endl;
183 }
else if (((*sl)->id().superlayer()) == 2) {
192 newTTrigMean = tempttrigMean;
193 newTTrigSigma = tempttrigSigma;
194 newkfactor = tempkfactor;
195 cout <<
"Chamber "<< chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig "<< ttrigMean
196 <<
" -> takes value of sl 1 " << newTTrigMean <<endl;
205 newTTrigMean = tempttrigMean;
206 newTTrigSigma = tempttrigSigma;
207 newkfactor = tempkfactor;
208 cout <<
"Chamber "<< chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig "<< ttrigMean
209 <<
"-> takes value of sl 3 " << newTTrigMean <<endl;
211 cout <<
"No correction possible within same chamber (sl2) " <<endl;
213 newTTrigSigma = averageSigma;
214 newkfactor = averagekfactor;
215 cout<<
"####### Bad SL: " << (*sl)->id() <<
" from "<< ttrigMean <<
" to "<< newTTrigMean <<endl;
220 }
else if (((*sl)->id().superlayer()) == 3) {
229 newTTrigMean = tempttrigMean;
230 newTTrigSigma = tempttrigSigma;
231 newkfactor = tempkfactor;
232 cout <<
"Chamber "<< chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig "<< ttrigMean
233 <<
" -> takes value of sl 1 " << newTTrigMean <<endl;
234 }
else if(chamber == 4) {
235 cout <<
"No correction possible within same chamber (sl3)" <<endl;
237 newTTrigSigma = averageSigma;
238 newkfactor = averagekfactor;
239 cout<<
"####### Bad SL: " << (*sl)->id() <<
" from "<< ttrigMean <<
" to "<< newTTrigMean <<endl;
240 }
else if(chamber != 4){
248 newTTrigMean = tempttrigMean;
249 newTTrigSigma = tempttrigSigma;
250 newkfactor = tempkfactor;
251 cout <<
"Chamber "<< chamber <<
" sl " << ((*sl)->id().superlayer()) <<
"has ttrig "<< ttrigMean
252 <<
" -> takes value of sl 2 " << newTTrigMean <<endl;
254 cout <<
"No correction possible within same chamber (sl3) " <<endl;
256 newTTrigSigma = averageSigma;
257 newkfactor = averagekfactor;
258 cout<<
"####### Bad SL: " << (*sl)->id() <<
" from "<< ttrigMean <<
" to "<< newTTrigMean <<endl;
266 newTTrigSigma = averageSigma;
267 newkfactor = averagekfactor;
268 cout<<
"####### NotPresent SL: " << (*sl)->id() <<
" from "<< ttrigMean <<
" to "<< newTTrigMean <<endl;
273 tTrigNewMap->
set((*sl)->id(), newTTrigMean, newTTrigSigma, newkfactor,
DTTimeUnits::ns);
275 cout<<
"New tTrig: " << (*sl)->id()
276 <<
" from "<< ttrigMean <<
" to "<< newTTrigMean <<endl;
277 cout<<
"New tTrigSigma: " << (*sl)->id()
278 <<
" from "<<ttrigSigma <<
" to "<< newTTrigSigma <<endl;
285 cout <<
"[DTTTrigCorrection]: Writing ttrig object to DB!" << endl;
286 string record =
"DTTtrigRcd";
287 DTCalibDBUtils::writeToDB<DTTtrig>(
record, tTrigNewMap);
int set(int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
edm::ESHandle< DTGeometry > muonGeom