00001
00002
00003
00004
00005
00006 #include "emcRawDataCalibrator.h"
00007
00008 #include "emcRawDataAccessor.h"
00009 #include "emcMixedDataObject.h"
00010 #include "emcCalibratedDataObject.h"
00011 #include "EmcDynamicData.h"
00012 #include "emcHLRatios.h"
00013 #include "emcPedestals.h"
00014 #include "emcGains.h"
00015 #include "emcGainFEM.h"
00016 #include "emcLCTofs.h"
00017 #include "emcQAs.h"
00018 #include "emcWalkTofs.h"
00019 #include "emcTofT0s.h"
00020 #include "EmcStaticData.h"
00021 #include "emcDataManager.h"
00022 #include "EmcSector.h"
00023 #include "emcCalibrationData.h"
00024 #include "EmcIndexer.h"
00025 #include "emcFEMtupleFactory.h"
00026 #include "emcHLRatioFEM.h"
00027 #include "emcPedestalFEM.h"
00028
00029 #include <cassert>
00030 #include <iostream>
00031 #include <fstream>
00032 #include <cmath>
00033 #include <cstdlib>
00034 #include <vector>
00035
00036 #include "emcException.h"
00037 #include "emcDefines.h"
00038
00039 using std::vector ;
00040 using std::cout ;
00041 using std::cerr ;
00042 using std::endl ;
00043 using std::ifstream ;
00044 using std::string;
00045
00046
00047 emcRawDataCalibrator::emcRawDataCalibrator() : emcCalibrator()
00048 {
00049 fName = "emcRawDataCalibrator" ;
00050 Reset() ;
00051 }
00052
00053
00054 emcRawDataCalibrator::~emcRawDataCalibrator()
00055 {
00056 }
00057
00058
00059 bool emcRawDataCalibrator::Calibrate(const emcRawDataObject& const_rdo,
00060 emcMixedDataObject& mdo,
00061 const PHTimeStamp& when)
00062 {
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 float INVALID_FLOAT = -9999 ;
00078
00079
00080
00081
00082 emcRawDataObject& rdo = const_cast<emcRawDataObject&>(const_rdo);
00083
00084 bool rv = true ;
00085
00086 CollectForMDO(when) ;
00087
00088
00089 mdo.SetPedestalFlag(fCollectPedestalStatus) ;
00090 mdo.SetHLRatioFlag(fCollectHLRatioStatus) ;
00091
00092
00093 int* datamap ;
00094 long* softkeys ;
00095 int* dataerrors ;
00096 rdo.GetDataDescriptionPointers(datamap,softkeys,dataerrors) ;
00097 mdo.SetMaxSize(rdo.GetMaxSize()) ;
00098 Int_t* deadmap = 0;
00099 if(fQA){
00100 deadmap = fQA->GetDeadMap();
00101 assert(deadmap!=0) ;
00102 }
00103 mdo.SetDataDescriptionPointers(datamap,softkeys,dataerrors,deadmap) ;
00104
00106 Int_t index ;
00107 Float_t adc,tdc ;
00108 Float_t hgpost,hgpre,lgpost,lgpre ;
00109 Float_t lg, hg ;
00110 int amupre,amupost,amutac ;
00111 int data_error ;
00112 float newTDCValue, tacped;
00113 float scale ;
00114
00115
00116
00117 for (index = 0; index < rdo.GetSize(); index++ ) {
00118
00119
00120 if ( mdo.GetDead(index) & emcQAs::IamDeadMask() ) {
00121 mdo.AddDataError(index,0x2000);
00122 mdo.SetToZero(index) ;
00123 continue;
00124 }
00125
00126
00127
00128
00129
00130
00131
00132 if (rdo.IsZero(index)) {
00133 mdo.SetToZero(index) ;
00134 continue;
00135 }
00136
00137 rdo.Get(index,tdc,hgpost,lgpost,hgpre,lgpre,
00138 amupre,amupost,amutac,data_error) ;
00139
00140 scale = (fCollectHLRatioStatus? fHLRatios->getValue(index) : 15.22) ;
00141 if(scale<12.||scale>18.) scale = 15.4;
00142
00143
00144
00145
00146
00147
00148 adc = lgpre-lgpost ;
00149
00150
00151
00152
00153
00154
00155
00156 if ( adc>128 || data_error&0x203c ||
00157 hgpost < static_cast<float>(GetHighLowLimit()) ) {
00158
00159 if (data_error&0x23c0) {
00160 adc = 0.;
00161 tdc = 0.;
00162
00163 if(data_error<0x2000) {
00164 mdo.AddDataError(index,0x2000) ;
00165 }
00166 } else {
00167 if (fCollectPedestalStatus) {
00168 adc -= fPedestals->getValue(index, amupost, "LG_Pre-Post") ;
00169 }
00170 adc *= scale;
00171 }
00172 }
00173 else {
00174
00175 adc = hgpre-hgpost ;
00176 if (fCollectPedestalStatus) {
00177 adc -= fPedestals->getValue(index,amupost, "HG_Pre-Post") ;
00178 }
00179 }
00180
00181 newTDCValue = INVALID_FLOAT ;
00182
00183
00184 if (fCollectPedestalStatus && !(data_error&0x2400)) {
00185
00186 newTDCValue = tdc;
00187 tacped = fPedestals->getValue(index,amutac, "TAC") ;
00188
00189 tdc -= ((tacped>0)? tacped : fPedestals->getValue(index, 0, "TAC")) ;
00190 } else if (data_error&0x2400) {
00191 tdc = 0.0 ;
00192 }
00193
00194
00195 if(fabs(tdc)<200. && adc<200. && newTDCValue!=INVALID_FLOAT) {
00196 fPedestals->updateValue(index, amutac, newTDCValue, "TAC");
00197 }
00198 if (mdo.IsUsingHGLG()) {
00199 hg = hgpre-hgpost ;
00200 lg = lgpre-lgpost ;
00201 if (fCollectPedestalStatus) {
00202 hg -= fPedestals->getValue(index,amupost,"HG_Pre-Post") ;
00203 lg -= fPedestals->getValue(index,amupost,"LG_Pre-Post") ;
00204 }
00205 mdo.Set(index, adc, tdc, hg, lg) ;
00206 }
00207 else {
00208 mdo.Set(index, adc, tdc) ;
00209 }
00210 }
00211 return rv ;
00212 }
00213
00214
00215 bool emcRawDataCalibrator::Calibrate(const emcMixedDataObject& mdo,
00216 emcCalibratedDataObject& cdo,
00217 const PHTimeStamp& when)
00218 {
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233 if ( fECalAtT0.empty() ) {
00234 if(!GetECalAtT0(when,true)) return false;
00235 }
00236 bool rv = true ;
00237 Int_t index ;
00238 Int_t eventTime = when.getTics();
00239
00240 CollectForCDO(when) ;
00241
00242 bool energycalibrated = true;
00243 bool timecalibrated = true;
00244
00245 cdo.Reset();
00246
00247 Float_t adc, tdc ;
00248 Int_t outindex =0;
00249 Float_t etotal =0.;
00250
00251
00252 for (index = 0; index < mdo.GetSize(); index++ ) {
00253
00254 int TowerId = mdo.GetItemId(index) ;
00255
00256
00257 if (EmcIndexer::isReference(TowerId)) continue;
00258
00259 adc = mdo.GetADC(index) ;
00260
00261 int errorFlag = mdo.GetErrorFlag(index);
00262
00263 if( adc > GetThresholdADC() && !(errorFlag&0x2000)) {
00264 tdc = mdo.GetTDC(index) ;
00265 if (!(errorFlag&0x2400)) {
00266 timecalibrated &= CalibrateTime(tdc, adc, index, TowerId, eventTime );
00267 }
00268 energycalibrated &= CalibrateEnergy( adc, index, TowerId, eventTime) ;
00269 cdo.Set(outindex, TowerId, mdo.GetSoftwareKey(index), errorFlag,
00270 adc, tdc,mdo.GetDead(index)) ;
00271 etotal += adc ;
00272 outindex++;
00273 }
00274 else {
00275 if(!fZeroSuppression) {
00276 cdo.Set(outindex, TowerId, mdo.GetSoftwareKey(index),
00277 errorFlag, 0., 0.,mdo.GetDead(index)) ;
00278 outindex++;
00279 }
00280 }
00281 }
00282 cdo.SetTotalEnergy(etotal);
00283 cdo.SetZeroSuppressedFlag(fZeroSuppression);
00284 cdo.SetEnergyCalibratedFlag(energycalibrated);
00285 cdo.SetTimeCalibratedFlag(timecalibrated) ;
00286
00287 return rv ;
00288 }
00289
00290
00291 bool emcRawDataCalibrator::Calibrate(const emcRawDataObject& rdo,
00292 emcCalibratedDataObject& cdo,
00293 const PHTimeStamp& when)
00294 {
00299 emcMixedDataObject mdo ;
00300 bool rv = Calibrate(rdo,mdo,when) ;
00301 rv &= Calibrate(mdo,cdo,when) ;
00302 return rv ;
00303 }
00304
00305
00306 bool
00307 emcRawDataCalibrator::CalibrateEnergy(Float_t & adc, const Int_t index,
00308 const Int_t TowerId,int incrementalTime)
00309 {
00310 if (fCollectGainStatus==false) { return false; }
00311
00312 float normt;
00313
00314 if(EmcIndexer::isPbSc(TowerId)) {
00315
00316 normt = fGains->getValue(index,incrementalTime) ;
00317 adc *= ((normt>0.01)? fECalAtT0[index]/normt : 0.) ;
00318 } else {
00319 assert(EmcIndexer::isPbGl(TowerId)) ;
00320
00321 normt = fGains->getValue(index,0) ;
00322 adc *= ((normt>0.01)? fECalAtT0[index]/normt : 0.) ;
00323 }
00324 return true ;
00325 }
00326
00327
00328 bool
00329 emcRawDataCalibrator::CalibrateTime(Float_t & tdc, float adc,
00330 const Int_t index,
00331 const Int_t ,
00332 int )
00333 {
00334 if (fCollectTofStatus==false) { return false; }
00335
00336 float lc = fLCTofs->GetValue1(index) * 1.075 ;
00337 lc = ((lc>25.&&lc<45.)? lc : 35.)/1000.;
00338 float t0 = 0.;
00339 float dt = 0.;
00340 float wk = 0.;
00341
00342 t0 = fWalkTofs->GetValue1(index);
00343 wk = fWalkTofs->GetValue2(index);
00344 dt = ((adc>0.)? wk*adc : 0.);
00345
00346 tdc = (t0 - (tdc-dt))*lc - GetGlobalT0() ;
00347 return true ;
00348 }
00349
00350
00351 void emcRawDataCalibrator::CollectForCDO(const PHTimeStamp& when)
00352 {
00353
00354
00355 static emcGains gainDriver ;
00356 static emcLCTofs lctofDriver ;
00357 static emcWalkTofs walktofDriver ;
00358
00359 emcDataManager* dm = emcDataManager::GetInstance() ;
00360
00361
00362 if (maxFailGain) fCollectGainStatus = false ;
00363
00364
00365 if ( fGainsSource != emcManageable::kNone && maxFailGain ) {
00366 gainDriver.SetSource( fGainsSource ) ;
00367 fGains = dynamic_cast<emcGains*>( dm->Collect(gainDriver, when) ) ;
00368
00369 fCollectGainStatus = (fGains!=0) ;
00370 maxFailGain -= !fCollectGainStatus ;
00371 }
00372
00373
00374
00375 if ( fTofSource != emcManageable::kNone && maxFailTof ) {
00376
00377 lctofDriver.SetSource( fTofSource ) ;
00378 fLCTofs = dynamic_cast<emcLCTofs*>( dm->Collect(lctofDriver, when) ) ;
00379
00380 walktofDriver.SetSource( fTofSource ) ;
00381 fWalkTofs = dynamic_cast<emcWalkTofs*>( dm->Collect(walktofDriver, when)) ;
00382
00383 fCollectTofStatus = (fLCTofs!=0 && fWalkTofs!=0) ;
00384 maxFailTof -= !fCollectTofStatus ;
00385 }
00386
00387 if ( fVerbose>=1 ) {
00388 if (!fCollectTofStatus) {
00389 cerr << "<E> emcRawDataCalibrator::CollectForCDO " << endl
00390 << " ToFs collection failed. " << endl ;
00391 }
00392 if (!fCollectGainStatus) {
00393 cerr << "<E> emcRawDataCalibrator::CollectForCDO() " << endl
00394 << " Gains collection failed. " << endl ;
00395 }
00396 }
00397 }
00398
00399
00400 void emcRawDataCalibrator::CollectForMDO(const PHTimeStamp& when)
00401 {
00402
00403
00404 static emcPedestals pedDriver ;
00405 static emcHLRatios hlrDriver ;
00406 static emcQAs qaDriver ;
00407
00408 emcDataManager* dm = emcDataManager::GetInstance() ;
00409
00410
00411 fCollectPedestalStatus = fCollectHLRatioStatus = false ;
00412
00413
00414 if ( fPedestalsSource != emcManageable::kNone && maxFailPed ) {
00415 pedDriver.SetSource( fPedestalsSource ) ;
00416 fPedestals = dynamic_cast<emcPedestals*>( dm->Collect(pedDriver, when) ) ;
00417
00418 fCollectPedestalStatus = (fPedestals!=0) ;
00419 maxFailPed -= !fCollectPedestalStatus ;
00420 }
00421
00422 if( fVerbose>=1 && !fCollectPedestalStatus) {
00423 cout << "<E> emcRawDataCalibrator::CollectFromMDO() " << endl
00424 << " Pedestal collection failed." << endl ;
00425 }
00426
00427
00428 if ( fHLRatiosSource != emcManageable::kNone && maxFailHLR ) {
00429
00430 hlrDriver.SetSource( fHLRatiosSource) ;
00431 fHLRatios = dynamic_cast<emcHLRatios*>( dm->Collect(hlrDriver, when) ) ;
00432
00433 fCollectHLRatioStatus = (fHLRatios!=0) ;
00434 maxFailHLR -= !fCollectHLRatioStatus ;
00435 }
00436
00437
00438 if ( fQASource != emcManageable::kNone ) {
00439
00440
00441 qaDriver.SetSource(fQASource) ;
00442
00443
00444 qaDriver.SetExtraRejectListFilename(fExtraRejectListFilename.c_str()) ;
00445
00446
00447 fQA = dynamic_cast<emcQAs*>( dm->Collect(qaDriver,when) ) ;
00448 if (!fQA) {
00449 cerr << "<E> Could not collect Q&A ?!" << endl ;
00450 }
00451 assert(fQA!=0) ;
00452 }
00453
00454 if ( fVerbose>=1 && !fCollectHLRatioStatus) {
00455 cout << "<E> emcRawDataCalibrator::CollectForMDO(r) " << endl
00456 << " HLRatio collection failed." << endl ;
00457 }
00458
00459 }
00460
00461
00462 bool
00463 emcRawDataCalibrator::GetECalAtT0(const PHTimeStamp& when,
00464 bool normalizationON)
00465 {
00466
00467
00468 if (!fECalAtT0.empty()) {
00469
00470 return true ;
00471 }
00472
00473 emcRawDataAccessor * rda = emcRawDataAccessor::GetInstance() ;
00474
00475 if (!rda) {
00476 cerr << "<E> emcRawDataCalibrator:: GetECalAtT0 "
00477 << "- Cannot fetch time 0 calibration - No data accessor " << endl ;
00478 return false ;
00479 }
00480
00481 if (GetVerbose()>0) {
00482 cout << "<I> emcRawDataCalibrator::GetECalAtT0 : *** Reading from [" ;
00483 cout << emcManageable::GetStorageName(fIniCalSource) << "]" << endl ;
00484 }
00485
00486 size_t ntowers = 144*rda->GetDynamicData()->getnSM() ;
00487
00488 fECalAtT0.resize(ntowers) ;
00489
00490 PHTimeStamp* timestamp = 0 ;
00491 EmcStaticData* sd = 0 ;
00492
00493
00494
00495
00496
00497
00498
00499 try {
00500 sd = EmcStaticData::buildEmcStaticData() ;
00501 }
00502 catch (emcException& err) {
00503 cerr << "Got exception : " << err.what() << endl ;
00504 exit(1) ;
00505 }
00506
00507 const int * DataMap = rda->GetDynamicData()->getEmcMap();
00508 int item ;
00509 int sn, ist ;
00510 EmcSector * sector ;
00511 float encal, norm0 ;
00512 float nothing ;
00513 float c0,g0,cf ;
00514
00515 float kappa = 1.0/5.9950 ;
00516
00517 if ( fIniCalSource == emcManageable::kDB_Objy ) {
00518 PHTimeStamp& ts = const_cast<PHTimeStamp&>(when) ;
00519 timestamp = &ts ;
00520 }
00521
00522 for (item = 0; item < rda->GetDynamicData()->getEmcSize(); item++) {
00523
00524 EmcIndexer::iPXiSiST(DataMap[item], sn, ist) ;
00525
00526 assert(sn>=0) ;
00527
00528
00529 if (sn>=8) continue ;
00530
00531 sector = sd->getSector(sn) ;
00532
00533 if( !sector ) {
00534
00535
00536
00537 sd ->buildEmcSector( EmcIndexer::EmcSectorId(sn), timestamp ) ;
00538 sector = sd->getSector(sn) ;
00539 }
00540
00541 assert(sector->IsOK()) ;
00542
00543 if ( sn < 6 ) {
00544
00545 sector->GetEnergyCalibration(ist,encal,norm0,nothing) ;
00546 assert(nothing==1.0) ;
00547 }
00548 else {
00549
00550 sector->GetEnergyCalibration(ist,c0,g0,cf) ;
00551 encal = c0*g0*cf ;
00552 norm0 = kappa ;
00553 }
00554
00555 fECalAtT0[item] = encal * ( normalizationON ? norm0 : 1. ) ;
00556
00557 }
00558
00559 return true ;
00560 }
00561
00562
00563 bool emcRawDataCalibrator::GetCollectionStatus(const char* type) const
00564 {
00565 string stype = type ;
00566 if ( stype == "Pedestals" ) {
00567 return fCollectPedestalStatus ;
00568 }
00569 else if ( stype == "HLRatios" ) {
00570 return fCollectHLRatioStatus ;
00571 }
00572 else if ( stype == "Gains" ) {
00573 return fCollectGainStatus ;
00574 }
00575 else if ( stype == "Tofs") {
00576 return fCollectTofStatus ;
00577 }
00578 else if ( stype == "*" ) {
00579 return
00580 fCollectPedestalStatus &
00581 fCollectHLRatioStatus &
00582 fCollectGainStatus &
00583 fCollectTofStatus ;
00584 }
00585 return false ;
00586 }
00587
00588
00589
00590 void emcRawDataCalibrator::Print() const
00591 {
00592 cout << " emcRawDataCalibrator setup : " << endl ;
00593
00594 cout << " **** Pedestals " ;
00595 if ( fPedestalsSource == emcManageable::kFile_ASCII ) {
00596 cout << "are read from files " << endl ;
00597 }
00598 else if ( fPedestalsSource == emcManageable::kDB_Objy ) {
00599 cout << "are read from Database " << endl ;
00600 }
00601 else {
00602 cout << " = 0 (collection disabled)" << endl ;
00603 }
00604
00605 cout << " **** high/low gain ratios " ;
00606 if ( fHLRatiosSource == emcManageable::kFile_ASCII ) {
00607 cout << "are read from files " << endl ;
00608 }
00609 else if ( fHLRatiosSource == emcManageable::kDB_Objy ) {
00610 cout << "are read from Database " << endl ;
00611 }
00612 else {
00613 cout << " = 16 " << endl ;
00614 }
00615
00616 cout << " **** Gains (current normalization) " ;
00617 if ( fGainsSource == emcManageable::kFile_ASCII ) {
00618 cout << "are read from files " << endl ;
00619 }
00620 else if ( fGainsSource == emcManageable::kDB_Objy ) {
00621 cout << "are read from Database " << endl ;
00622 }
00623 else {
00624 cout << " = 1 " << endl ;
00625 }
00626
00627 cout << " **** ToF calibration (least counts and walks) " ;
00628 if ( fTofSource == emcManageable::kFile_ASCII ) {
00629 cout << "are read from files " << endl ;
00630 }
00631 else if ( fTofSource == emcManageable::kDB_Objy ) {
00632 cout << "are read from Database " << endl ;
00633 }
00634 else {
00635 cout << " = 1 " << endl ;
00636 }
00637
00638 cout << " **** Q&A " ;
00639 if ( fQASource == emcManageable::kFile_ASCII ) {
00640 cout << "are read from files " << endl ;
00641 }
00642 else if ( fQASource == emcManageable::kDB_Objy ) {
00643 cout << "are read from Database " << endl ;
00644 }
00645 else {
00646 cout << " Huh ? : check your Q&A source !" << endl ;
00647 }
00648
00649 cout << " **** Initial Calibration " ;
00650 if ( fIniCalSource == emcManageable::kFile_ASCII) {
00651 cout << "are read from files " << endl ;
00652 }
00653 else if ( fIniCalSource == emcManageable::kDB_Objy ) {
00654 cout << "are read from Database " << endl ;
00655 }
00656 else {
00657 cout << " Huh ? : check your IniCal source !" << endl ;
00658 }
00659
00660 cout << " **** High gain threshold = " << GetHighLowLimit() << endl ;
00661 cout << " **** ADC threshold = " << GetThresholdADC() << endl ;
00662 cout << " **** Zero suppression is " <<
00663 ((fZeroSuppression==true)?"ON":"OFF") << endl ;
00664
00665 }
00666
00667
00668 void emcRawDataCalibrator::Reset(void)
00669 {
00670 fPedestalsSource = emcManageable::kNone ;
00671 fHLRatiosSource = emcManageable::kNone ;
00672 fGainsSource = emcManageable::kNone ;
00673 fTofSource = emcManageable::kNone ;
00674 fQASource = emcManageable::kNone ;
00675 fIniCalSource = emcManageable::kNone ;
00676 fCollectPedestalStatus = fCollectHLRatioStatus = false ;
00677 fCollectGainStatus = fCollectTofStatus = false;
00678 maxFailPed = maxFailHLR = maxFailGain = maxFailTof = 10;
00679 fECalAtT0.clear() ;
00680 fZeroSuppression = false;
00681 fQA = 0 ;
00682 SetExtraRejectListFilename();
00683 fPedestals = 0 ;
00684 fHLRatios = 0 ;
00685 }
00686
00687
00688 bool emcRawDataCalibrator::SelectSource(const char* type,
00689 emcManageable::EStorage source)
00690 {
00691
00692
00693
00694
00695
00696 emcRawDataAccessor * rda = emcRawDataAccessor::GetInstance() ;
00697
00698 if (!rda) {
00699 cerr << "<E> emcRawDataCalibrator:: SelectSource - Cannot check source is valid because I cannot get access to RDA. So I am NOT changing the source." << endl ;
00700 return false ;
00701 }
00702 else {
00703
00704
00705
00706 if ( rda->GetDynamicData()->getMapStyle() == false &&
00707 source != emcManageable::kNone ) {
00708 cerr << "<E> emcRawDataCalibrator::SelectSource - Map style is 192 words per FEM. Cannot use any source." << endl ;
00709 return false ;
00710 }
00711 }
00712
00713 bool rv = true ;
00714 string stype = type ;
00715
00716 if ( stype == "Pedestals" )
00717 fPedestalsSource = source ;
00718
00719 else if ( stype == "HLRatios" )
00720 fHLRatiosSource = source ;
00721
00722 else if ( stype == "Gains" )
00723 fGainsSource = source ;
00724
00725 else if ( stype == "ToF" )
00726 fTofSource = source ;
00727
00728 else if ( stype == "QAs" )
00729 fQASource = source ;
00730
00731 else if ( stype == "IniCal" )
00732 fIniCalSource = source ;
00733
00734 else if ( stype == "*" ) {
00735 fPedestalsSource = source ;
00736 fHLRatiosSource = source ;
00737 fGainsSource = source ;
00738 fQASource = source ;
00739 fTofSource = source ;
00740 fIniCalSource = source ;
00741 }
00742 else {
00743 cerr << "emcRawDataCalibrator::SelectSource: " << type << " is an unknown type " << endl
00744 << " Valid types are Pedestals, HLRatios, Gains, ToF " << endl ;
00745 rv = false ;
00746 }
00747
00748 return rv ;
00749
00750 }
00751
00752
00753
00754
00755
00756 void emcRawDataCalibrator::SetTwrGlobalT0(char * filename){
00757 if (fTwrGlobalT0) {
00758 delete [] fTwrGlobalT0;
00759 fTwrGlobalT0 = NULL;
00760 }
00761 if(!filename) return;
00762 ifstream fin(filename, std::ios::in);
00763 emcRawDataAccessor * rda = emcRawDataAccessor::GetInstance();
00764 assert(rda!=0);
00765 emcRawDataObject * rdo = rda->GetRawDataObject() ;
00766 assert(rdo!=0);
00767 fTwrGlobalT0 = new float [rdo->GetMaxSize()];
00768 int lines = 0;
00769 int twr, sector, iX, iY, entries;
00770 float t0, rms;
00771 while(fin>>twr>>sector>>iX>>iY>>t0>>rms>>entries){
00772
00773 assert(lines<rdo->GetMaxSize());
00774 fTwrGlobalT0[lines] = ((entries>2)? t0 : 0.);
00775 lines++;
00776 }
00777 assert(lines==rdo->GetMaxSize());
00778 }