103 #include "StFtpcParamReader.hh"
104 #include "StFtpcDbReader.hh"
106 #include "StFtpcGasUtilities.hh"
107 #include "StMessMgr.h"
115 mParam = paramReader;
122 StFtpcGasUtilities::~StFtpcGasUtilities() {
125 Int_t StFtpcGasUtilities::barometricPressure() {
126 if (mGas->getBarometricPressure() == mParam->normalizedNowPressure())
return kStOK;
127 if (mGas->getBarometricPressure() >= mDb->minPressure() && mGas->getBarometricPressure() <= mDb->maxPressure()) {
128 LOG_DEBUG <<
"Change normalizedNowPressure from "<<mParam->normalizedNowPressure()<<
" to "<<mGas->getBarometricPressure()<<endm;
129 mParam->setNormalizedNowPressure(mGas->getBarometricPressure());
133 LOG_WARN <<
"Invalid value ("<<mGas->getBarometricPressure()<<
") from offline database for barometric pressure - using previous value ("<<mParam->normalizedNowPressure()<<
")"<<endm;
139 Int_t StFtpcGasUtilities::averageTemperatureWest(Int_t dbDate, Int_t runNumber) {
141 Int_t numberBodyTemperaturesWest = 0;
142 Float_t averageBodyTemperatureWest = 0.0;
143 Float_t averageGasTempWest = 0.0;
152 if ( ((dbDate >= 20100413 && runNumber > 11102099) && (dbDate <= 20100419 && runNumber < 11109080)) ||
153 ((dbDate >= 20100421 && runNumber > 1111068) && (dbDate <= 20100426 && runNumber < 11116056)) ) {
154 mParam->setGasTemperatureWest(mDb->defaultTemperatureWest() + mDb->adjustAverageWest());
155 LOG_WARN<<
"FTPC West Extra temperatures bad for run number "<<runNumber<<
" dbDate "<<dbDate<<
" using defaultTemperatureWest = "<<mDb->defaultTemperatureWest()<<
" + adjustAverageWest "<<mDb->adjustAverageWest()<<
" = "<<mParam->gasTemperatureWest()<<endm;
162 if ( dbDate >= 20051030 ) {
164 ftpcTemps_st* tempT = mTemps->GetTable();
166 Int_t numberExtraTempsWest = 0;
167 Float_t averageExtraTempsWest = 0.0;
169 if (tempT->extra1West >= mDb->minGasTemperature() && tempT->extra1West <= mDb->maxGasTemperature() ) {
170 averageExtraTempsWest += tempT->extra1West;
171 numberExtraTempsWest++;
172 LOG_DEBUG<<
" "<<tempT->extra1West<<
"(extra1West)"<<endm;
179 if (tempT->extra3West >= mDb->minGasTemperature() && tempT->extra3West <= mDb->maxGasTemperature() ) {
180 averageExtraTempsWest += tempT->extra3West;
181 numberExtraTempsWest++;
182 LOG_DEBUG<<
" + "<<tempT->extra3West<<
"(extra3West)"<<endm;
184 if (tempT->extra4West >= mDb->minGasTemperature() && tempT->extra4West <= mDb->maxGasTemperature() ) {
185 averageExtraTempsWest += tempT->extra4West;
186 numberExtraTempsWest++;
187 LOG_DEBUG<<
" + "<<tempT->extra4West<<
"(extra4West)"<<endm;
189 if (tempT->extra5West >= mDb->minGasTemperature() && tempT->extra5West <= mDb->maxGasTemperature() ) {
190 averageExtraTempsWest += tempT->extra5West;
191 numberExtraTempsWest++;
192 LOG_DEBUG<<
" + "<<tempT->extra5West<<
"(extra5West)"<<endm;
194 if (tempT->extra6West >= mDb->minGasTemperature() && tempT->extra6West <= mDb->maxGasTemperature() ) {
195 averageExtraTempsWest += tempT->extra6West;
196 numberExtraTempsWest++;
197 LOG_DEBUG<<
" + "<<tempT->extra6West<<
"(extra6West)"<<endm;
199 LOG_DEBUG<<
" = "<<averageExtraTempsWest<<endm;
202 if (numberExtraTempsWest > 0) {
203 LOG_DEBUG<<
"setGasTemperatureWest = averageGasTempWest = "<<averageExtraTempsWest<<
"/"<<numberExtraTempsWest<<
" + "<<mDb->adjustAverageWest()<<
" = "<<averageExtraTempsWest/numberExtraTempsWest + mDb->adjustAverageWest()<<endm;
204 averageGasTempWest = averageExtraTempsWest/numberExtraTempsWest;
205 mParam->setGasTemperatureWest(averageGasTempWest + mDb->adjustAverageWest());
209 LOG_WARN<<
"No FTPC West Extra temperatures found for run number "<<runNumber<<
"dbDate "<<dbDate<<
" using defaultTemperatureWest = "<<mParam->gasTemperatureWest()<<endm;
218 if ( dbDate >= 20050101 && dbDate < 20051030 ) {
220 LOG_DEBUG<<
" dbDate = "<<dbDate<<
"(>2005-01-01) Use FTPC West body temperatures + FTPC West extra temperature readings 1,3-6 (2 is unstable in the year 2005 run)"<<endm;
222 if (mGas->getBody1West() >= mDb->minGasTemperature() && mGas->getBody1West() <= mDb->maxGasTemperature()) {
223 averageBodyTemperatureWest += mGas->getBody1West();
224 numberBodyTemperaturesWest++;
225 LOG_DEBUG<<
" "<<mGas->getBody1West()<<
"(body1West)"<<endm;
227 if (mGas->getBody2West() >= mDb->minGasTemperature() && mGas->getBody2West()<= mDb->maxGasTemperature() ) {
228 averageBodyTemperatureWest += mGas->getBody2West();
229 numberBodyTemperaturesWest++;
230 LOG_DEBUG<<
" + "<<mGas->getBody2West()<<
"(body2West)"<<endm;
232 if (mGas->getBody3West() >= mDb->minGasTemperature() && mGas->getBody3West()<= mDb->maxGasTemperature() ) {
233 averageBodyTemperatureWest += mGas->getBody3West();
234 numberBodyTemperaturesWest++;
235 LOG_DEBUG<<
" + "<<mGas->getBody3West()<<
"(body3West)"<<endm;
237 if (mGas->getBody4West() >= mDb->minGasTemperature() && mGas->getBody4West() <= mDb->maxGasTemperature() ) {
238 averageBodyTemperatureWest += mGas->getBody4West();
239 numberBodyTemperaturesWest++;
240 LOG_DEBUG<<
" + "<<mGas->getBody4West()<<
"(body4West)"<<endm;
242 if (mGas->getBody5West() >= mDb->minGasTemperature() && mGas->getBody5West() <= mDb->maxGasTemperature() ) {
243 averageBodyTemperatureWest += mGas->getBody5West();
244 numberBodyTemperaturesWest++;
245 LOG_DEBUG<<
" + "<<mGas->getBody5West()<<
"(body5West)"<<endm;
247 if (mGas->getBody6West() >= mDb->minGasTemperature() && mGas->getBody6West() <= mDb->maxGasTemperature() ) {
248 averageBodyTemperatureWest += mGas->getBody6West();
249 numberBodyTemperaturesWest++;
250 LOG_DEBUG<<
" + "<<mGas->getBody6West()<<
"(body6West)"<<endm;
252 LOG_DEBUG<<
" = "<<averageBodyTemperatureWest<<endm;
256 if (numberBodyTemperaturesWest > 0) {
257 LOG_DEBUG<<
"averageBodyTemperatureWest = "<<averageBodyTemperatureWest<<
"/"<<numberBodyTemperaturesWest<<
" = "<<averageBodyTemperatureWest/numberBodyTemperaturesWest<<endm;
260 ftpcTemps_st* tempT = mTemps->GetTable();
262 Int_t numberExtraTempsWest = 0;
263 Float_t averageExtraTempsWest = 0.0;
265 if (tempT->extra1West >= mDb->minGasTemperature() && tempT->extra1West <= mDb->maxGasTemperature() ) {
266 averageExtraTempsWest += tempT->extra1West;
267 numberExtraTempsWest++;
268 LOG_DEBUG<<
" "<<tempT->extra1West<<
"(extra1West)"<<endm;
275 if (tempT->extra3West >= mDb->minGasTemperature() && tempT->extra3West <= mDb->maxGasTemperature() ) {
276 averageExtraTempsWest += tempT->extra3West;
277 numberExtraTempsWest++;
278 LOG_DEBUG<<
" + "<<tempT->extra3West<<
"(extra3West)"<<endm;
280 if (tempT->extra4West >= mDb->minGasTemperature() && tempT->extra4West <= mDb->maxGasTemperature() ) {
281 averageExtraTempsWest += tempT->extra4West;
282 numberExtraTempsWest++;
283 LOG_DEBUG<<
" + "<<tempT->extra4West<<
"(extra4West)"<<endm;
285 if (tempT->extra5West >= mDb->minGasTemperature() && tempT->extra5West <= mDb->maxGasTemperature() ) {
286 averageExtraTempsWest += tempT->extra5West;
287 numberExtraTempsWest++;
288 LOG_DEBUG<<
" + "<<tempT->extra5West<<
"(extra5West)"<<endm;
290 if (tempT->extra6West >= mDb->minGasTemperature() && tempT->extra6West <= mDb->maxGasTemperature() ) {
291 averageExtraTempsWest += tempT->extra6West;
292 numberExtraTempsWest++;
293 LOG_DEBUG<<
" + "<<tempT->extra6West<<
"(extra6West)"<<endm;
295 LOG_DEBUG<<
" = "<<averageExtraTempsWest<<endm;
298 if (numberExtraTempsWest > 0) {
299 LOG_DEBUG<<
"averageExtraTempsWest = "<<averageExtraTempsWest<<
"/"<<numberExtraTempsWest<<
" = "<<averageExtraTempsWest/numberExtraTempsWest<<endm;
302 if ( (numberBodyTemperaturesWest + numberExtraTempsWest) > 0 ) {
303 LOG_DEBUG<<
"setGasTemperatureWest = averageGasTempWest = ("<<averageBodyTemperatureWest<<
" + "<<averageExtraTempsWest<<
")/("<<numberBodyTemperaturesWest<<
" + "<<numberExtraTempsWest<<
") + "<<mDb->adjustAverageWest()<<
" = "<<(averageBodyTemperatureWest+averageExtraTempsWest)/(numberBodyTemperaturesWest+numberExtraTempsWest) + mDb->adjustAverageWest()<<endm;
304 averageGasTempWest = (averageBodyTemperatureWest + averageExtraTempsWest)/(numberBodyTemperaturesWest + numberExtraTempsWest);
305 mParam->setGasTemperatureWest(averageGasTempWest + mDb->adjustAverageWest());
309 LOG_WARN<<
"No FTPC West body temperatures or FTPC Extra temperatures found for run number "<<runNumber<<
"dbDate "<<dbDate<<
" using defaultTemperatureWest = "<<mParam->gasTemperatureWest()<<endm;
316 if ( runNumber > 5027147 && runNumber < 5136001 ) {
317 LOG_DEBUG<<
"runNumber = "<<runNumber<<
" > 5027147 && <= 5136001: only Body1, Body3 and Body4 are useable for FTPC West. The averageBodyTemperatureWest is adjusted by "<<mDb->adjustAverageWest()<<endm;
318 if (mGas->getBody1West() >= mDb->minGasTemperature() && mGas->getBody1West() <= mDb->maxGasTemperature() ) {
319 averageBodyTemperatureWest += mGas->getBody1West();
320 numberBodyTemperaturesWest++;
321 LOG_DEBUG<<
" "<<mGas->getBody1West()<<
"(body1West)"<<endm;
323 if (mGas->getBody3West() >= mDb->minGasTemperature() && mGas->getBody3West() <= mDb->maxGasTemperature() ) {
324 averageBodyTemperatureWest += mGas->getBody3West();
325 numberBodyTemperaturesWest++;
326 LOG_DEBUG<<
" + "<<mGas->getBody3West()<<
"(body3West)"<<endm;
328 if (mGas->getBody4West() >= mDb->minGasTemperature() && mGas->getBody4West() <= mDb->maxGasTemperature() ) {
329 averageBodyTemperatureWest += mGas->getBody4West();
330 numberBodyTemperaturesWest++;
331 LOG_DEBUG<<
" + "<<mGas->getBody4West()<<
"(body4West)"<<endm;
336 if (mGas->getBody1West() >= mDb->minGasTemperature() && mGas->getBody1West() <= mDb->maxGasTemperature()) {
337 averageBodyTemperatureWest += mGas->getBody1West();
338 numberBodyTemperaturesWest++;
339 LOG_DEBUG<<mGas->getBody1West()<<
"(body1West)"<<endm;
341 if (mGas->getBody2West() >= mDb->minGasTemperature() && mGas->getBody2West()<= mDb->maxGasTemperature() ) {
342 averageBodyTemperatureWest += mGas->getBody2West();
343 numberBodyTemperaturesWest++;
344 LOG_DEBUG<<
" + "<<mGas->getBody2West()<<
"(body2West)"<<endm;
346 if (mGas->getBody3West() >= mDb->minGasTemperature() && mGas->getBody3West()<= mDb->maxGasTemperature() ) {
347 averageBodyTemperatureWest += mGas->getBody3West();
348 numberBodyTemperaturesWest++;
349 LOG_DEBUG<<
" + "<<mGas->getBody3West()<<
"(body3West)"<<endm;
351 if (mGas->getBody4West() >= mDb->minGasTemperature() && mGas->getBody4West() <= mDb->maxGasTemperature() ) {
352 averageBodyTemperatureWest += mGas->getBody4West();
353 numberBodyTemperaturesWest++;
354 LOG_DEBUG<<
" + "<<mGas->getBody4West()<<
"(body4West)"<<endm;
357 if ( (dbDate >= 20031031 && dbDate <= 20040124) || dbDate >= 20040404) {
358 LOG_DEBUG<<
"(dbDate = "<<dbDate<<
" >= 20031031 && <= 20040124 || >= 20040404 activate additional body temperature sensors) "<<endm;
359 if (mGas->getBody5West() >= mDb->minGasTemperature() && mGas->getBody5West() <= mDb->maxGasTemperature() ) {
360 averageBodyTemperatureWest += mGas->getBody5West();
361 numberBodyTemperaturesWest++;
362 LOG_DEBUG<<
" + "<<mGas->getBody5West()<<
"(body5West)"<<endm;
364 if (mGas->getBody6West() >= mDb->minGasTemperature() && mGas->getBody6West() <= mDb->maxGasTemperature() ) {
365 averageBodyTemperatureWest += mGas->getBody6West();
366 numberBodyTemperaturesWest++;
367 LOG_DEBUG<<
" + "<<mGas->getBody6West()<<
"(body6West)"<<endm;
371 LOG_DEBUG<<
" = "<<averageBodyTemperatureWest<<endm;
374 if (numberBodyTemperaturesWest > 0) {
375 LOG_DEBUG<<
"setGasTemperatureWest = "<<averageBodyTemperatureWest<<
" (averageBodyTemperatureWest) + "<<mDb->adjustAverageWest()<<
" (adjustAverageWest) = "<<averageBodyTemperatureWest + mDb->adjustAverageWest()<<endm;
376 averageBodyTemperatureWest = averageBodyTemperatureWest/numberBodyTemperaturesWest;
377 mParam->setGasTemperatureWest(averageBodyTemperatureWest + mDb->adjustAverageWest());
382 LOG_WARN<<
"No FTPC West body temperatures found for "<<dbDate<<
" using defaultTemperatureWest = "<<mParam->gasTemperatureWest()<<endm;
388 Int_t StFtpcGasUtilities::averageTemperatureEast(Int_t dbDate, Int_t runNumber) {
390 Int_t numberBodyTemperaturesEast = 0;
391 Float_t averageBodyTemperatureEast = 0.0;
392 Float_t averageGasTempEast = 0.0;
401 if ( ((dbDate >= 20100413 && runNumber > 11102099) && (dbDate <= 20100419 && runNumber < 11109080)) ||
402 ((dbDate >= 20100421 && runNumber > 1111068) && (dbDate <= 20100426 && runNumber < 11116056)) ) {
403 mParam->setGasTemperatureEast(mDb->defaultTemperatureEast() + mDb->adjustAverageEast());
404 LOG_WARN<<
"FTPC East Extra temperatures bad for run number "<<runNumber<<
" dbDate "<<dbDate<<
" using defaultTemperatureEast = "<<mDb->defaultTemperatureEast()<<
" + adjustAverageEast = "<<mDb->adjustAverageEast()<<
" = "<<mParam->gasTemperatureEast()<<endm;
411 if ( dbDate >= 20051030 ) {
413 ftpcTemps_st* tempT = mTemps->GetTable();
415 Int_t numberExtraTempsEast = 0;
416 Float_t averageExtraTempsEast = 0.0;
418 if (tempT->extra1East >= mDb->minGasTemperature() && tempT->extra1East <= mDb->maxGasTemperature() ) {
419 averageExtraTempsEast += tempT->extra1East;
420 numberExtraTempsEast++;
421 LOG_DEBUG<<
" "<<tempT->extra1East<<
"(extra1East)"<<endm;
423 if (tempT->extra2East >= mDb->minGasTemperature() && tempT->extra2East <= mDb->maxGasTemperature() ) {
424 averageExtraTempsEast += tempT->extra2East;
425 numberExtraTempsEast++;
426 LOG_DEBUG<<
" + "<<tempT->extra2East<<
"(extra2East)"<<endm;
428 if (tempT->extra3East >= mDb->minGasTemperature() && tempT->extra3East <= mDb->maxGasTemperature() ) {
429 averageExtraTempsEast += tempT->extra3East;
430 numberExtraTempsEast++;
431 LOG_DEBUG<<
" + "<<tempT->extra3East<<
"(extra3East)"<<endm;
433 if (tempT->extra4East >= mDb->minGasTemperature() && tempT->extra4East <= mDb->maxGasTemperature() ) {
434 averageExtraTempsEast += tempT->extra4East;
435 numberExtraTempsEast++;
436 LOG_DEBUG<<
" + "<<tempT->extra4East<<
"(extra4East)"<<endm;
438 if (tempT->extra5East >= mDb->minGasTemperature() && tempT->extra5East <= mDb->maxGasTemperature() ) {
439 averageExtraTempsEast += tempT->extra5East;
440 numberExtraTempsEast++;
441 LOG_DEBUG<<
" + "<<tempT->extra5East<<
"(extra5East)"<<endm;
443 if (tempT->extra6East >= mDb->minGasTemperature() && tempT->extra6East <= mDb->maxGasTemperature() ) {
444 averageExtraTempsEast += tempT->extra6East;
445 numberExtraTempsEast++;
446 LOG_DEBUG<<
" + "<<tempT->extra6East<<
"(extra6East)"<<endm;
448 if (tempT->extra7East >= mDb->minGasTemperature() && tempT->extra7East <= mDb->maxGasTemperature() ) {
449 averageExtraTempsEast += tempT->extra7East;
450 numberExtraTempsEast++;
451 LOG_DEBUG<<
" + "<<tempT->extra7East<<
"(extra7East)"<<endm;
453 LOG_DEBUG<<
" = "<<averageExtraTempsEast<<endm;
456 if (numberExtraTempsEast > 0) {
457 LOG_DEBUG<<
"setGasTemperatureEast = averageGasTempEast = "<<averageExtraTempsEast<<
"/"<<numberExtraTempsEast<<
" + "<<mDb->adjustAverageEast()<<
" = "<<averageExtraTempsEast/numberExtraTempsEast + mDb->adjustAverageEast()<<endm;
458 averageGasTempEast = averageExtraTempsEast/numberExtraTempsEast;
459 mParam->setGasTemperatureEast(averageGasTempEast + mDb->adjustAverageEast());
463 LOG_WARN<<
"No FTPC East Extra temperatures found for run number "<<runNumber<<
"dbDate "<<dbDate<<
" using defaultTemperatureEast = "<<mParam->gasTemperatureEast()<<endm;
472 if ( dbDate >= 20050101 && dbDate < 20051030 ) {
474 LOG_DEBUG<<
" dbDate = "<<dbDate<<
"(>2005-01-01) Use FTPC East body temperatures + FTPC East extra temperature readings 1-7"<<endm;
476 if (mGas->getBody1East() >= mDb->minGasTemperature() && mGas->getBody1East() <= mDb->maxGasTemperature()) {
477 averageBodyTemperatureEast += mGas->getBody1East();
478 numberBodyTemperaturesEast++;
479 LOG_DEBUG<<
" "<<mGas->getBody1East()<<
"(body1East)"<<endm;
481 if (mGas->getBody2East() >= mDb->minGasTemperature() && mGas->getBody2East()<= mDb->maxGasTemperature() ) {
482 averageBodyTemperatureEast += mGas->getBody2East();
483 numberBodyTemperaturesEast++;
484 LOG_DEBUG<<
" + "<<mGas->getBody2East()<<
"(body2East)"<<endm;
486 if (mGas->getBody3East() >= mDb->minGasTemperature() && mGas->getBody3East()<= mDb->maxGasTemperature() ) {
487 averageBodyTemperatureEast += mGas->getBody3East();
488 numberBodyTemperaturesEast++;
489 LOG_DEBUG<<
" + "<<mGas->getBody3East()<<
"(body3East)"<<endm;
491 if (mGas->getBody4East() >= mDb->minGasTemperature() && mGas->getBody4East() <= mDb->maxGasTemperature() ) {
492 averageBodyTemperatureEast += mGas->getBody4East();
493 numberBodyTemperaturesEast++;
494 LOG_DEBUG<<
" + "<<mGas->getBody4East()<<
"(body4East)"<<endm;
496 if (mGas->getBody5East() >= mDb->minGasTemperature() && mGas->getBody5East() <= mDb->maxGasTemperature() ) {
497 averageBodyTemperatureEast += mGas->getBody5East();
498 numberBodyTemperaturesEast++;
499 LOG_DEBUG<<
" + "<<mGas->getBody5East()<<
"(body5East)"<<endm;
501 if (mGas->getBody6East() >= mDb->minGasTemperature() && mGas->getBody6East() <= mDb->maxGasTemperature() ) {
502 averageBodyTemperatureEast += mGas->getBody6East();
503 numberBodyTemperaturesEast++;
504 LOG_DEBUG<<
" + "<<mGas->getBody6East()<<
"(body6East)"<<endm;
506 LOG_DEBUG<<
" = "<<averageBodyTemperatureEast<<endm;
509 if (numberBodyTemperaturesEast > 0) {
510 LOG_DEBUG<<
"averageBodyTemperatureEast = "<<averageBodyTemperatureEast<<
"/"<<numberBodyTemperaturesEast<<
" = "<<averageBodyTemperatureEast/numberBodyTemperaturesEast<<endm;
513 ftpcTemps_st* tempT = mTemps->GetTable();
515 Int_t numberExtraTempsEast = 0;
516 Float_t averageExtraTempsEast = 0.0;
518 if (tempT->extra1East >= mDb->minGasTemperature() && tempT->extra1East <= mDb->maxGasTemperature() ) {
519 averageExtraTempsEast += tempT->extra1East;
520 numberExtraTempsEast++;
521 LOG_DEBUG<<
" "<<tempT->extra1East<<
"(extra1East)"<<endm;
523 if (tempT->extra2East >= mDb->minGasTemperature() && tempT->extra2East <= mDb->maxGasTemperature() ) {
524 averageExtraTempsEast += tempT->extra2East;
525 numberExtraTempsEast++;
526 LOG_DEBUG<<
" + "<<tempT->extra2East<<
"(extra2East)"<<endm;
528 if (tempT->extra3East >= mDb->minGasTemperature() && tempT->extra3East <= mDb->maxGasTemperature() ) {
529 averageExtraTempsEast += tempT->extra3East;
530 numberExtraTempsEast++;
531 LOG_DEBUG<<
" + "<<tempT->extra3East<<
"(extra3East)"<<endm;
533 if (tempT->extra4East >= mDb->minGasTemperature() && tempT->extra4East <= mDb->maxGasTemperature() ) {
534 averageExtraTempsEast += tempT->extra4East;
535 numberExtraTempsEast++;
536 LOG_DEBUG<<
" + "<<tempT->extra4East<<
"(extra4East)"<<endm;
538 if (tempT->extra5East >= mDb->minGasTemperature() && tempT->extra5East <= mDb->maxGasTemperature() ) {
539 averageExtraTempsEast += tempT->extra5East;
540 numberExtraTempsEast++;
541 LOG_DEBUG<<
" + "<<tempT->extra5East<<
"(extra5East)"<<endm;
543 if (tempT->extra6East >= mDb->minGasTemperature() && tempT->extra6East <= mDb->maxGasTemperature() ) {
544 averageExtraTempsEast += tempT->extra6East;
545 numberExtraTempsEast++;
546 LOG_DEBUG<<
" + "<<tempT->extra6East<<
"(extra6East)"<<endm;
548 if (tempT->extra7East >= mDb->minGasTemperature() && tempT->extra7East <= mDb->maxGasTemperature() ) {
549 averageExtraTempsEast += tempT->extra7East;
550 numberExtraTempsEast++;
551 LOG_DEBUG<<
" + "<<tempT->extra7East<<
"(extra7East)"<<endm;
553 LOG_DEBUG<<
" = "<<averageExtraTempsEast<<endm;
556 if (numberExtraTempsEast > 0) {
557 LOG_DEBUG<<
"averageExtraTempsEast = "<<averageExtraTempsEast<<
"/"<<numberExtraTempsEast<<
" = "<<averageExtraTempsEast/numberExtraTempsEast<<endm;
561 if (numberExtraTempsEast > 0) {
562 LOG_DEBUG<<
"setGasTemperatureEast = averageGasTempEast = ("<<averageBodyTemperatureEast<<
" + "<<averageExtraTempsEast<<
")/("<<numberBodyTemperaturesEast<<
" + "<<numberExtraTempsEast<<
") + "<<mDb->adjustAverageEast()<<
" = "<<(averageBodyTemperatureEast+averageExtraTempsEast)/(numberBodyTemperaturesEast+numberExtraTempsEast) + mDb->adjustAverageEast()<<endm;
563 averageGasTempEast = (averageBodyTemperatureEast + averageExtraTempsEast)/(numberBodyTemperaturesEast + numberExtraTempsEast);
564 mParam->setGasTemperatureEast(averageGasTempEast + mDb->adjustAverageEast());
568 LOG_WARN<<
"No FTPC East body temperatures or FTPC Extra temperatures found for run number "<<runNumber<<
"dbDate "<<dbDate<<
" using defaultTemperatureEast = "<<mParam->gasTemperatureEast()<<endm;
575 if ( runNumber > 5027147 && runNumber <= 5093053 ) {
576 LOG_DEBUG<<
"runNumber = "<<runNumber<<
" > 5027147 && <= 5093053: only Body3, Body4 and Body5 are useable for FTPC East. The averageBodyTemperatureEast is adjusted by "<<mDb->adjustAverageEast()<<endm;
577 if (mGas->getBody3East() >= mDb->minGasTemperature() && mGas->getBody3East() <= mDb->maxGasTemperature() ) {
578 averageBodyTemperatureEast += mGas->getBody3East();
579 numberBodyTemperaturesEast++;
580 LOG_DEBUG<<
" "<<mGas->getBody3East()<<
"(body3East)"<<endm;
582 if (mGas->getBody4East() >= mDb->minGasTemperature() && mGas->getBody4East() <= mDb->maxGasTemperature() ) {
583 averageBodyTemperatureEast += mGas->getBody4East();
584 numberBodyTemperaturesEast++;
585 LOG_DEBUG<<
" + "<<mGas->getBody4East()<<
"(body4East)"<<endm;
587 if (mGas->getBody5East() >= mDb->minGasTemperature() && mGas->getBody5East() <= mDb->maxGasTemperature() ) {
588 averageBodyTemperatureEast += mGas->getBody5East();
589 numberBodyTemperaturesEast++;
590 LOG_DEBUG<<
" + "<<mGas->getBody5East()<<
"(body5East)"<<endm;
596 if (mGas->getBody1East() >= mDb->minGasTemperature() && mGas->getBody1East() <= mDb->maxGasTemperature()) {
597 averageBodyTemperatureEast += mGas->getBody1East();
598 numberBodyTemperaturesEast++;
599 LOG_DEBUG<<mGas->getBody1East()<<
"(body1East)"<<endm;
601 if (mGas->getBody2East() >= mDb->minGasTemperature() && mGas->getBody2East()<= mDb->maxGasTemperature() ) {
602 averageBodyTemperatureEast += mGas->getBody2East();
603 numberBodyTemperaturesEast++;
604 LOG_DEBUG<<
" + "<<mGas->getBody2East()<<
"(body2East)"<<endm;
606 if (mGas->getBody3East() >= mDb->minGasTemperature() && mGas->getBody3East()<= mDb->maxGasTemperature() ) {
607 averageBodyTemperatureEast += mGas->getBody3East();
608 numberBodyTemperaturesEast++;
609 LOG_DEBUG<<
" + "<<mGas->getBody3East()<<
"(body3East)"<<endm;
611 if (mGas->getBody4East() >= mDb->minGasTemperature() && mGas->getBody4East() <= mDb->maxGasTemperature() ) {
612 averageBodyTemperatureEast += mGas->getBody4East();
613 numberBodyTemperaturesEast++;
614 LOG_DEBUG<<
" + "<<mGas->getBody4East()<<
"(body4East)"<<endm;
617 if ( (dbDate >= 20031031 && dbDate <= 20040124) || dbDate >= 20040404 ) {
618 LOG_DEBUG<<
"(dbDate = "<<dbDate<<
" >= 20031031 && <= 20040124 || >= 20040404 activate additional body temperature sensors) ";
619 if (mGas->getBody5East() >= mDb->minGasTemperature() && mGas->getBody5East() <= mDb->maxGasTemperature() ) {
620 averageBodyTemperatureEast += mGas->getBody5East();
621 numberBodyTemperaturesEast++;
622 LOG_DEBUG<<
" + "<<mGas->getBody5East()<<
"(body5East)"<<endm;
624 if (mGas->getBody6East() >= mDb->minGasTemperature() && mGas->getBody6East() <= mDb->maxGasTemperature() ) {
625 averageBodyTemperatureEast += mGas->getBody6East();
626 numberBodyTemperaturesEast++;
627 LOG_DEBUG<<mGas->getBody6East()<<
"(body6East)"<<endm;
631 LOG_DEBUG<<
" = "<<averageBodyTemperatureEast<<endm;
634 if (numberBodyTemperaturesEast > 0) {
635 LOG_DEBUG<<
"setGasTemperatureEast = "<<averageBodyTemperatureEast<<
" (averageBodyTemperatureEast) + "<<mDb->adjustAverageEast()<<
" (adjustAverageEast) = "<<averageBodyTemperatureEast + mDb->adjustAverageEast()<<endm;
636 averageBodyTemperatureEast = averageBodyTemperatureEast/numberBodyTemperaturesEast;
637 mParam->setGasTemperatureEast(averageBodyTemperatureEast + mDb->adjustAverageEast());
642 LOG_WARN<<
"No FTPC East body temperatures found for "<<dbDate<<
" using defaultTemperatureEast = "<<mParam->gasTemperatureEast()<<endm;
647 Int_t StFtpcGasUtilities::defaultTemperatureWest(Int_t dbDate,Bool_t SVT_On) {
649 mParam->setGasTemperatureWest(mDb->defaultTemperatureWest());
650 LOG_WARN<<
"No valid body temperatures available for FTPC West; Initialize to defaultTemperatureWest (for dbDate = "<<dbDate<<
" SVT off) = "<<mParam->gasTemperatureWest()<<endm;
653 if (dbDate < 20021105) {
655 mParam->setGasTemperatureWest(mDb->defaultTemperatureWest() + mDb->temperatureDifference());
656 LOG_WARN<<
"No valid body temperatures available for FTPC West; Initialize to mDb->defaultTemperatureWest() + mDb->temperatureDifference() (for year2001 data,SVT on) = "<<mParam->gasTemperatureWest()<<endm;
658 if (dbDate >= 20021105) {
660 mParam->setGasTemperatureWest(mDb->defaultTemperatureWest());
661 LOG_WARN<<
"No valid body temperatures available for FTPC West; Initialize to mDb->defaultTemperatureWest() (as of year2003, SVT on) = "<<mParam->gasTemperatureWest()<<endm;
667 Int_t StFtpcGasUtilities::defaultTemperatureEast(Int_t dbDate,Bool_t SVT_On) {
669 mParam->setGasTemperatureEast(mDb->defaultTemperatureEast());
670 LOG_WARN<<
"No valid body temperatures available for FTPC East; Initialize to defaultTemperatureEast (for dbDate = "<<dbDate<<
" SVT off) = "<<mParam->gasTemperatureEast()<<endm;
673 if (dbDate < 20021105) {
675 mParam->setGasTemperatureEast(mDb->defaultTemperatureEast());
676 LOG_WARN<<
"No valid body temperatures available for FTPC East; Initialize to mDb->defaultTemperatureEast() (for year2001 data, SVT on) = "<<mParam->gasTemperatureEast()<<endm;
678 if (dbDate >= 20021105) {
680 mParam->setGasTemperatureEast(mDb->defaultTemperatureEast() + mDb->temperatureDifference());
681 LOG_WARN<<
"No valid body temperatures available for FTPC East; Initialize to mDb->defaultTemperatureEast() + mDb->temperatureDifference() (as of year2003,SVT on) = "<<mParam->gasTemperatureEast()<<endm;