TofRawDataProvider Class Reference

#include <TofRawDataProvider.h>

Inheritance diagram for TofRawDataProvider:

RawDataProviderBase List of all members.

Public Member Functions

 TofRawDataProvider ()
 TofRawDataProvider (const char *name)
 ~TofRawDataProvider ()
StatusCode initialize (bool mode=false, ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
void handle (const Incident &)
void tofDataMapFull ()
TofDataMaptofDataMapOnlineMode (uint32_t control=1)
TofDataVectortofDataVectorOnlineMode (uint32_t control=1)
TofDataMaptofDataMapEstime ()
TofDataVectortofDataVectorEstime ()
TofDataMaptofDataMapTof (double estime=0.0)
TofDataVectortofDataVectorTof (double estime=0.0)
TofDataMaptofDataMapEmc (double estime=0.0)
TofDataVectortofDataVectorEmc (double estime=0.0)
StatusCode initialize (ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
void setSvcLocator (ISvcLocator *svcLoc)
void setMsgSvc (IMessageSvc *svc)
void setMsgName (const char *name)

Protected Attributes

ISvcLocator * m_svcLocator
IMessageSvc * m_msgSvc
std::string m_name

Private Attributes

int m_run
int m_event
bool m_hasFilled
TofDataMap m_tofDataMap
TofDataMap m_tofDataMapOnline
TofDataVector m_tofDataVectorOnline
TofDataMap m_tofDataMapEstime
TofDataVector m_tofDataVectorEstime
TofDataMap m_tofDataMapTof
TofDataVector m_tofDataVectorTof
TofDataMap m_tofDataMapEmc
TofDataVector m_tofDataVectorEmc

Detailed Description

Definition at line 24 of file TofRawDataProvider.h.


Constructor & Destructor Documentation

TofRawDataProvider::TofRawDataProvider (  ) 

Definition at line 36 of file TofRawDataProvider.cxx.

00036                                        :
00037   RawDataProviderBase(),
00038   m_hasFilled(0)
00039 {}

TofRawDataProvider::TofRawDataProvider ( const char *  name  ) 

Definition at line 42 of file TofRawDataProvider.cxx.

00042                                                          :
00043   RawDataProviderBase( name ),
00044   m_hasFilled(0)
00045 {}

TofRawDataProvider::~TofRawDataProvider (  ) 

Definition at line 48 of file TofRawDataProvider.cxx.

References iter(), m_tofDataMap, m_tofDataMapEmc, m_tofDataMapEstime, m_tofDataMapOnline, m_tofDataMapTof, m_tofDataVectorEmc, m_tofDataVectorEstime, m_tofDataVectorOnline, and m_tofDataVectorTof.

00048                                         {
00049   IterTofDataMap iter = m_tofDataMap.begin();
00050   for( ; iter != m_tofDataMap.end(); iter++ ) {
00051     delete (*iter).second;
00052   }
00053   m_tofDataMap.clear();
00054 
00055   m_tofDataMapOnline.clear();
00056   m_tofDataVectorOnline.clear();
00057   m_tofDataMapEstime.clear();
00058   m_tofDataVectorEstime.clear();
00059   m_tofDataMapTof.clear();
00060   m_tofDataVectorTof.clear();
00061   m_tofDataMapEmc.clear();
00062   m_tofDataVectorEmc.clear();
00063 
00064   return;
00065 }


Member Function Documentation

void TofRawDataProvider::handle ( const Incident &   ) 

Definition at line 114 of file TofRawDataProvider.cxx.

References Bes_Common::DEBUG, iter(), m_hasFilled, RawDataProviderBase::m_msgSvc, RawDataProviderBase::m_name, m_tofDataMap, m_tofDataMapEmc, m_tofDataMapEstime, m_tofDataMapOnline, m_tofDataMapTof, m_tofDataVectorEmc, m_tofDataVectorEstime, m_tofDataVectorOnline, and m_tofDataVectorTof.

Referenced by RawDataProviderSvc::handle().

00114                                                   {
00115   MsgStream log( m_msgSvc, m_name );
00116   log << MSG::DEBUG << "handle: " << inc.type() << endreq;
00117   if ( inc.type() == "BeginEvent" ){
00118     log << MSG::DEBUG << "Begin Event" << endreq;
00119     IterTofDataMap iter = m_tofDataMap.begin();
00120     for( ; iter != m_tofDataMap.end(); iter++ ) {
00121       delete (*iter).second;
00122     }
00123     IterTofDataMap iterOnline = m_tofDataMapOnline.begin();
00124     for( ; iterOnline != m_tofDataMapOnline.end(); iterOnline++ ) {
00125       delete (*iterOnline).second;
00126     }
00127     m_tofDataMap.clear();
00128     m_tofDataMapOnline.clear();
00129     m_tofDataVectorOnline.clear();
00130     m_tofDataMapEstime.clear();
00131     m_tofDataVectorEstime.clear();
00132     m_tofDataMapTof.clear();
00133     m_tofDataVectorTof.clear();
00134     m_tofDataMapEmc.clear();
00135     m_tofDataVectorEmc.clear();
00136 
00137     m_hasFilled = false;
00138   }
00139   return;
00140 }

StatusCode RawDataProviderBase::initialize ( ISvcLocator *  svcLoc = 0,
IMessageSvc *  pMsg = 0 
) [inherited]

Reimplemented in MdcRawDataProvider.

Definition at line 26 of file RawDataProviderBase.cxx.

References Bes_Common::INFO, RawDataProviderBase::m_msgSvc, RawDataProviderBase::m_name, RawDataProviderBase::m_svcLocator, and deljobs::string.

Referenced by initialize(), MdcRawDataProvider::initialize(), and EmcRawDataProvider::initialize().

00026                                                                                     {
00027   if(pSvcLoc!=0){
00028     // test service point
00029     // tianhl for mt
00030     std::string evtDataSvc_name("EventDataSvc");
00031     if(isGaudiThreaded(m_name)){
00032       evtDataSvc_name += getGaudiThreadIDfromName(m_name);
00033       std::cout << "---------------------------------- " <<  evtDataSvc_name << std::endl;
00034     }
00035     // tianhl for mt
00036     IDataProviderSvc* evtSvc;
00037     StatusCode sc = pSvcLoc->service(evtDataSvc_name.c_str(),evtSvc,true);
00038     if (!sc.isSuccess()){
00039       std::cout << "RawDataProviderBase::initialize()  ERROR Could not load EventDataSvc" << std::endl;
00040       return StatusCode::FAILURE;
00041     }
00042     m_svcLocator= pSvcLoc;
00043   }
00044   else {
00045     m_svcLocator= Gaudi::svcLocator();
00046   }
00047   try{
00048     if(pMsg!=0){
00049       MsgStream log(pMsg, m_name);
00050       log << MSG::INFO << "RawDataProviderBase::initialize()  Test..." << endreq;
00051       m_msgSvc=pMsg;
00052     }
00053     else{ 
00054       StatusCode sc = m_svcLocator->service("MessageSvc", m_msgSvc ,true);
00055       if (!sc.isSuccess()) throw SvcDisable("MessageSvc");
00056     }
00057   }
00058   catch(...){
00059     std::cout << "RawDataProviderBase::initialize()  ERROR Could not get MessageSvc" << std::endl;
00060   }
00061 
00062   return StatusCode::SUCCESS;
00063 }

StatusCode TofRawDataProvider::initialize ( bool  mode = false,
ISvcLocator *  svcLoc = 0,
IMessageSvc *  pMsg = 0 
)

Definition at line 68 of file TofRawDataProvider.cxx.

References detVerSvc, calibUtil::ERROR, Bes_Common::INFO, RawDataProviderBase::initialize(), RawDataProviderBase::m_msgSvc, RawDataProviderBase::m_name, RawDataProviderBase::m_svcLocator, tofCaliSvc, tofQCorrSvc, and tofQElecSvc.

Referenced by RawDataProviderSvc::initialize().

00068                                                                                               {
00069   MsgStream log( m_msgSvc, m_name );
00070   RawDataProviderBase::initialize( pSvcLoc,pMsg );
00071 
00072   // Get Detector Version Service
00073   StatusCode sc_det = m_svcLocator->service("DetVerSvc", detVerSvc);
00074   if( sc_det == StatusCode::SUCCESS ) {
00075     log << MSG::INFO << "TofRawDataProvider Get Detector Version Service Sucessfully!" << endreq;
00076   }
00077   else {
00078     log << MSG::ERROR << "TofRawDataProvider Can NOT Retrieve DetVerSvc instance" << endreq;
00079     return StatusCode::FAILURE;
00080   }
00081 
00082   //Get TOF Calibtration Service
00083   StatusCode scc = m_svcLocator->service("TofCaliSvc", tofCaliSvc);
00084   if( scc ==  StatusCode::SUCCESS ) { 
00085     log << MSG::INFO << "TofRec Get Calibration Service Sucessfully!" << endreq;
00086   }
00087   else if(!mode) {
00088     log << MSG::ERROR << "TofRec Get Calibration Service Failed !" << endreq;
00089     return StatusCode::FAILURE;
00090   }
00091 
00092   //Get TOF Q Correction Service
00093   StatusCode scq = m_svcLocator->service("TofQCorrSvc", tofQCorrSvc);
00094   if (scq ==  StatusCode::SUCCESS) { 
00095     log << MSG::INFO << "TofRec Get Q Correction Service Sucessfully!" << endreq;
00096   } else if(!mode){
00097     log << MSG::ERROR << "TofRec Get Q Correction Service Failed !" << endreq;
00098     return StatusCode::FAILURE;
00099   }
00100 
00101   //Get TOF Q Electronics Saturation Service
00102   StatusCode sce = m_svcLocator->service("TofQElecSvc", tofQElecSvc);
00103   if (sce ==  StatusCode::SUCCESS) { 
00104     log << MSG::INFO << "TofRec Get Q Electronics Calibration Service Sucessfully!" << endreq;
00105   } else if(!mode){
00106     log << MSG::ERROR << "TofRec Get Q Electronics Calibration Service Failed !" << endreq;
00107     return StatusCode::FAILURE;
00108   }
00109 
00110   return StatusCode::SUCCESS; 
00111 }

void RawDataProviderBase::setMsgName ( const char *  name  )  [inline, inherited]

Definition at line 29 of file RawDataProviderBase.h.

References RawDataProviderBase::m_name, and deljobs::string.

00029 { m_name = std::string(name); };

void RawDataProviderBase::setMsgSvc ( IMessageSvc *  svc  )  [inline, inherited]

Definition at line 28 of file RawDataProviderBase.h.

References RawDataProviderBase::m_msgSvc.

00028 { m_msgSvc=svc; };

void RawDataProviderBase::setSvcLocator ( ISvcLocator *  svcLoc  )  [inline, inherited]

Definition at line 27 of file RawDataProviderBase.h.

References RawDataProviderBase::m_svcLocator.

00027 { m_svcLocator=svcLoc; };

TofDataMap & TofRawDataProvider::tofDataMapEmc ( double  estime = 0.0  ) 

Definition at line 1013 of file TofRawDataProvider.cxx.

References TofID::cell_id(), count, genRecEmupikp::i, TofID::is_mrpc(), iter(), m_hasFilled, m_run, m_tofDataMap, m_tofDataMapEmc, tClockBackward, tClockForward, and tofDataMapFull().

Referenced by RawDataProviderSvc::tofDataMapEmc(), and tofDataVectorEmc().

01013                                                              {
01014 
01015   if( !m_hasFilled ) {
01016     TofRawDataProvider::tofDataMapFull();
01017     m_hasFilled = true;
01018   }
01019 
01020   if( !m_tofDataMapEmc.empty() ) {
01021     m_tofDataMapEmc.clear();
01022   }
01023 
01024   IterTofDataMap iter = m_tofDataMap.begin();
01025   for( ; iter != m_tofDataMap.end(); iter++ ) {
01026     if( ( ((*iter).second)->quality() & 0xa ) != 0 ) {
01027 
01028       if( estime > 1.0e-6 ) {
01029         int t0clock = static_cast<int>(estime/24.0);
01030         int clock1 = ((*iter).second)->qclock1();
01031         int clock2 = ((*iter).second)->qclock2();
01032         bool  forward = ( ( ( t0clock - clock1 ) < tClockBackward ) && ( ( clock1 - t0clock ) < tClockForward ) );
01033         bool backward = ( ( ( t0clock - clock2 ) < tClockBackward ) && ( ( clock2 - t0clock ) < tClockForward ) );
01034         if(  TofID::is_mrpc( TofID::cell_id((*iter).first) ) && m_run>=43680 && m_run<43809 ) {
01035           double offset = -11.0;
01036           forward = ( ( ( t0clock - clock1 ) < ( tClockBackward -offset ) ) && ( ( clock1 - t0clock ) < ( tClockForward + offset ) ) );
01037           backward = ( ( ( t0clock - clock2 ) < ( tClockBackward - offset ) ) && ( ( clock2 - t0clock ) < ( tClockForward + offset ) ) );
01038         }
01039         if( !forward && !backward ) continue;
01040       }
01041 
01042       m_tofDataMapEmc.insert( make_pair( (*iter).first, (*iter).second ) );
01043     }
01044   }
01045 
01046   iter = m_tofDataMapEmc.begin();
01047   while( iter != m_tofDataMapEmc.end() ) {
01048     unsigned int iden_value = (*iter).first;
01049     unsigned int count = m_tofDataMapEmc.count( iden_value );
01050     for( unsigned int i=0; i != count; i++, iter++ ) {
01051       ((*iter).second)->setTimes( count );
01052     }
01053   }
01054 
01055   return m_tofDataMapEmc;
01056 }

TofDataMap & TofRawDataProvider::tofDataMapEstime (  ) 

Definition at line 911 of file TofRawDataProvider.cxx.

References count, genRecEmupikp::i, iter(), m_hasFilled, m_tofDataMap, m_tofDataMapEstime, and tofDataMapFull().

Referenced by RawDataProviderSvc::tofDataMapEstime(), and tofDataVectorEstime().

00911                                                  {
00912 
00913   if( !m_hasFilled ) {
00914     TofRawDataProvider::tofDataMapFull();
00915     m_hasFilled = true;
00916   }
00917 
00918   if( !m_tofDataMapEstime.empty() ) {
00919     m_tofDataMapEstime.clear();
00920   }
00921 
00922   IterTofDataMap iter = m_tofDataMap.begin();
00923   for( ; iter != m_tofDataMap.end(); iter++ ) {
00924     if( ( ( ((*iter).second)->quality() & 0x5 ) != 0 ) && ((*iter).second)->tmatched() ) {
00925       m_tofDataMapEstime.insert( make_pair( (*iter).first, (*iter).second ) );
00926     }
00927   }
00928 
00929   iter = m_tofDataMapEstime.begin();
00930   while( iter != m_tofDataMapEstime.end() ) {
00931     unsigned int iden_value = (*iter).first;
00932     unsigned int count = m_tofDataMapEstime.count( iden_value );
00933     for( unsigned int i=0; i != count; i++, iter++ ) {
00934       ((*iter).second)->setTimes( count );
00935     }
00936   }
00937 
00938   return m_tofDataMapEstime;
00939 }

void TofRawDataProvider::tofDataMapFull (  ) 

Definition at line 144 of file TofRawDataProvider.cxx.

References abs, PmtData::adc(), TofID::barrel_ec(), ITofCaliSvc::BrEast(), ITofCaliSvc::BrWest(), TofID::cell_id(), count, deljobs::end, TofID::end(), ITofCaliSvc::Endcap(), calibUtil::ERROR, Bes_Common::FATAL, TofID::getIntID(), genRecEmupikp::i, Bes_Common::INFO, TofID::is_barrel(), TofID::is_mrpc(), TofID::is_scin(), iter(), m_event, RawDataProviderBase::m_msgSvc, RawDataProviderBase::m_name, m_run, RawDataProviderBase::m_svcLocator, m_tofDataMap, ITofCaliSvc::MisLable(), TofID::phi_module(), ITofCaliSvc::QCorr(), ITofCaliSvc::QElec(), PmtData::qtimesmm(), PmtData::quality(), genRecEmupikp::range, PmtData::setAdc(), TofData::setBackward(), Adc::setCorr(), Adc::setElec(), TofData::setForward(), TofData::setIdentify(), PmtData::setIdentify(), TofValue::setNumber(), PmtData::setTdc(), TofData::setTMatched(), Tdc::setValue(), Adc::setValue(), deljobs::string, tClockDiff, timeDiff, timeDiffMRPC, tofCaliSvc, totBackward, totForward, true, and Bes_Common::WARNING.

Referenced by tofDataMapEmc(), tofDataMapEstime(), and tofDataMapTof().

00144                                         {
00145 
00146   MsgStream log(m_msgSvc, m_name);
00147   log << MSG::INFO << "TofRawDataProvider::tofDataMapFull()" << endreq;
00148 
00149   if( !m_tofDataMap.empty() ) {
00150 
00151     log << MSG::WARNING << "TofRawDataProvider::tofDataMapFull: m_tofDataMap is NOT empty!" << endreq;
00152 
00153     IterTofDataMap iter = m_tofDataMap.begin();
00154     for( ; iter != m_tofDataMap.end(); iter++ ) {
00155       delete (*iter).second;
00156     }
00157     m_tofDataMap.clear();
00158   }
00159    // tianhl for mt
00160     std::string evtDataSvc_name("EventDataSvc");
00161     if(isGaudiThreaded(m_name)){
00162       evtDataSvc_name += getGaudiThreadIDfromName(m_name);
00163     }
00164     // tianhl for mt
00165 
00166   IDataProviderSvc* eventSvc;
00167   StatusCode sc = m_svcLocator->service( evtDataSvc_name.c_str(),eventSvc, true );
00168   if( !sc.isSuccess() ) {
00169     log << MSG::FATAL << "TofRawDataProvider::tofDataMapFull: ERROR Could not load EventDataSvc" << endreq;
00170     return;
00171   }
00172 
00173   // Event Header
00174   SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,"/Event/EventHeader");
00175   if( !eventHeader ) {
00176     log << MSG::FATAL << "TofRawDataProvider could not find Event Header!" << endreq;
00177     return;
00178   }
00179   m_run = eventHeader->runNumber();
00180   m_event = eventHeader->eventNumber();
00181 
00182   bool mc = ( m_run < 0 ) ? true:false;
00183   bool qCorr = bool( tofCaliSvc->QCorr() );
00184   qCorr = qCorr && (!mc);
00185   bool qElec = bool( tofCaliSvc->QElec() );
00186   bool misLable = bool( tofCaliSvc->MisLable() );
00187   misLable = ( !mc && misLable );
00188 
00189   int identmp = -1;
00190   vector<int> deadId;
00191   for( unsigned int i=0; i<5; i++ ) {
00192     identmp = tofCaliSvc->BrEast(i);
00193     if( identmp != 0x2fffffff ) {
00194       deadId.push_back( identmp );
00195     }
00196     identmp = tofCaliSvc->BrWest(i);
00197     if( identmp != 0x2fffffff ) {
00198       deadId.push_back( identmp );
00199     }
00200     identmp = tofCaliSvc->Endcap(i);
00201     if( identmp != 0x2fffffff ) {
00202       deadId.push_back( identmp );
00203     }
00204   }
00205 
00206   // get TDS data in a common class
00207   SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc,"/Event/Digi/TofDigiCol");
00208   if( !tofDigiCol ) {
00209     log << MSG::WARNING << "TofRawDataProvider::tofDataMapFull: Could not find Tof Digi Data!" << endreq;
00210     return;
00211   }
00212 
00213   int qnumber = 0;
00214   int tnumber = 0;
00215 
00216   std::vector<Adc*> chargeVec;
00217   std::vector<Tdc*> timeVec;
00218 
00219   TofDigiCol::iterator iter = tofDigiCol->begin();
00220   for( ; iter != tofDigiCol->end(); iter++ ) {
00221     Identifier iden = (*iter)->identify();
00222     unsigned int iden_value = iden.get_value();
00223 
00224     bool sameId = false;
00225     vector<int>::iterator iter_dead = deadId.begin();
00226     for( ; iter_dead != deadId.end(); iter_dead++ ) {
00227       if( iden_value == (*iter_dead) ) {
00228         sameId = true;
00229         break;
00230       }
00231     }
00232     if( sameId ) {
00233       if( mc ) { continue; }
00234       else {
00235         std::string bore;
00236         if( (TofID::barrel_ec(iden))==1 ) { bore=string("Barrel");}
00237         else if( (TofID::barrel_ec(iden))==0 ) { bore=string("East Endcap"); }
00238         else if( (TofID::barrel_ec(iden))==2 ) { bore=string("West Endcap"); }
00239         else if( (TofID::barrel_ec(iden))==3 ) { bore=string("ETF(MRPC)");   }
00240 
00241         log << MSG::ERROR << "TofRawDataProvider::tofDataMapFull: Dead Channel Number is not Correct, please check TOF Calibration Constants!  " << bore << endreq;
00242       }
00243     }
00244 
00245     if( TofID::is_scin(iden) && !(TofID::is_barrel(iden) ) && (TofID::end(iden))==1 ) continue;
00246 
00247     unsigned int overflow = (*iter)->getOverflow();
00248     if( TofID::is_scin(iden) && ( ( overflow & 0xfe000000 ) == 0xfe000000 ) ) continue;
00249 
00250 
00251     //    if( ( m_detVerSvc->phase() == 1 ) && TofID::is_mrpc( iden ) ) continue;
00252     //    if( ( m_detVerSvc->phase() >= 3 ) && TofID::is_scin( iden ) && !( TofID::is_barrel( iden ) ) ) continue;;
00253 
00254     // for 150203 data, 92Scin + 2MRPC
00255     //    if( !mc && ( m_detVerSvc->phase() == 2 ) && TofID::is_mrpc( iden ) ) {
00256     if( m_run>=40203 && m_run<=43253 && TofID::is_mrpc( iden ) ) {
00257       // ETF Module 36 ==> 44
00258       if( ( iden_value & 0x2fffffe0 ) == 0x2000c800 ) {
00259         iden_value = 0x2000c900 + ( iden_value & 0x1f );
00260         iden = Identifier( iden_value );
00261       }
00262       // ETF Module 37 ==> 43
00263       if( ( iden_value & 0x2fffffe0 ) == 0x2000c820 ) {
00264         iden_value = 0x2000c8e0 + ( iden_value & 0x1f );
00265         iden = Identifier( iden_value );
00266       }
00267     }
00268     // end 150203 data
00269 
00270     // overflow 0x   1 1         1 1            1 1
00271     //            no Q T / multi Q T / overflow Q T
00272 
00273     bool multiQ = ( ( overflow & 0x8 ) != 0 );
00274     bool multiT = ( ( overflow & 0x4 ) != 0 );
00275 
00276     unsigned int tdcChannel = (*iter)->getTimeChannel();
00277     unsigned int adcChannel = (*iter)->getChargeChannel();
00278     if( TofID::is_scin(iden) && ( ( overflow & 0x2 ) != 0 ) ) { 
00279       adcChannel = ( adcChannel | 0x80000 ); 
00280     }
00281 
00282     if( (adcChannel&0x7fffffff) != 0x7fffffff ) {
00283       Adc* adc = new Adc;
00284       if( qCorr ) adc->setCorr();
00285       if( qElec ) adc->setElec();
00286 
00287       // for 150203 data, 92Scin + 2MRPC
00288       //      if( !mc && ( m_detVerSvc->phase() == 2 ) && TofID::is_mrpc( iden ) ) {
00289       if( m_run>=40203 && m_run<=43253 && TofID::is_mrpc( iden ) ) {
00290         adcChannel += 0x18000;
00291       }
00292       // end 150203 data
00293 
00294       adc->setValue( iden, adcChannel );
00295       qnumber++;
00296       adc->setNumber( qnumber );
00297       chargeVec.push_back( adc );
00298     }
00299 
00300     if( tdcChannel != 0x7fffffff ) {
00301       Tdc* tdc = new Tdc;
00302 
00303       // for 150203 data, 92Scin + 2MRPC
00304       //      if( !mc && ( m_detVerSvc->phase(0 == 2 ) && TofID::is_mrpc( iden ) ) {
00305       if( m_run>=40203 && m_run<=43253 && TofID::is_mrpc( iden ) ) {
00306         tdcChannel += 0x18000;
00307       }
00308       // end 150203 data
00309 
00310       tdc->setValue( tdcChannel );
00311       tnumber++;
00312       tdc->setNumber( tnumber );
00313       timeVec.push_back( tdc );
00314     }
00315 
00316     if( multiT || multiQ ) {
00317       TofDigiCol::iterator iter_next = iter + 1;
00318       if( iter_next != tofDigiCol->end() ) {
00319         unsigned int idenNext_value = ((*iter_next)->identify()).get_value();
00320         if( iden_value == idenNext_value ) continue;
00321       }
00322     }
00323 
00324     qnumber = 0;
00325     tnumber = 0;
00326 
00327     std::vector<PmtData*> pmtDataVec;
00328     if( TofID::is_scin( iden ) ) {
00329       std::vector<Tdc*>::iterator iter_t = timeVec.begin();
00330       for( ; iter_t != timeVec.end(); iter_t++ ) {
00331         int tclock = (*iter_t)->clock();
00332         PmtData* pmt = new PmtData;
00333         pmt->setIdentify( iden.get_value() );
00334         pmt->setTdc( (*iter_t) );
00335         std::vector<Adc*>::iterator iter_q = chargeVec.begin();
00336         for( ; iter_q != chargeVec.end(); iter_q++ ) {
00337           if( (*iter_q)->times() != -1 ) { continue; }
00338           int qclock = (*iter_q)->clock();
00339           if( abs(tclock-qclock)<2 ) {
00340             if( ( pmt->quality() & 0x2 ) != 0 ) {         // pmt has Q
00341               if( (*iter_q)->value() > pmt->adc() ) {
00342                 pmt->qtimesmm();
00343                 pmt->setAdc( (*iter_q) );             
00344               }
00345             }
00346             else {                                        // pmt has no Q
00347               pmt->setAdc( (*iter_q) );
00348             }
00349           }
00350         }
00351         pmtDataVec.push_back( pmt );
00352       }
00353 
00354       std::vector<Adc*>::iterator iter_q = chargeVec.begin();
00355       for( ; iter_q != chargeVec.end(); iter_q++ ) {
00356         if( (*iter_q)->times() != -1 ) { continue; }
00357         PmtData* pmt = new PmtData;
00358         pmt->setIdentify( iden.get_value() );
00359         pmt->setAdc( (*iter_q) );
00360         pmtDataVec.push_back( pmt );
00361       }
00362 
00363     }
00364 
00365     if( TofID::is_mrpc( iden ) ) {
00366       std::vector<Tdc*>::iterator iter_t = timeVec.begin();
00367       for( ; iter_t != timeVec.end(); iter_t++ ) {
00368         std::vector<Adc*>::iterator iter_q = chargeVec.begin();
00369         for( ; iter_q != chargeVec.end(); iter_q++ ) {
00370           if( ( (*iter_q)->qtc() - (*iter_t)->value() ) > totForward && ( (*iter_q)->qtc() - (*iter_t)->value() ) < totBackward ) {
00371             PmtData* pmt = new PmtData;
00372             pmt->setIdentify( iden.get_value() );
00373             pmt->setTdc( (*iter_t) );
00374             pmt->setAdc( (*iter_q) );
00375             pmtDataVec.push_back( pmt );
00376           }
00377         }
00378         if( (*iter_t)->times() == -1 ) {
00379           PmtData* pmt = new PmtData;
00380           pmt->setTdc( (*iter_t) );
00381           pmtDataVec.push_back( pmt );
00382         }
00383       }
00384 
00385       std::vector<Adc*>::iterator iter_q = chargeVec.begin();
00386       for( ; iter_q != chargeVec.end(); iter_q++ ) {
00387         if( (*iter_q)->times() != -1 ) { continue; }
00388         PmtData* pmt = new PmtData;
00389         pmt->setIdentify( iden.get_value() );
00390         pmt->setAdc( (*iter_q) );
00391         pmtDataVec.push_back( pmt );
00392       }
00393 
00394     }
00395 
00396     chargeVec.clear();
00397     timeVec.clear();
00398 
00399     unsigned int iden_value_key = (iden_value & 0xfffffffe );
00400     if( TofID::is_scin( iden ) ) {
00401       int barrel_ec = TofID::barrel_ec( iden );
00402       //      int layer     = TofID::layer( iden );
00403       int tofid     = TofID::phi_module( iden );
00404       int end       = TofID::end( iden );
00405       if( ( barrel_ec == 0 ) || ( barrel_ec == 2 ) ) {
00406         std::vector<PmtData*>::iterator iter_pmt = pmtDataVec.begin();
00407         for( ; iter_pmt != pmtDataVec.end(); iter_pmt++ ) {
00408           TofData* tof = new TofData;
00409           if( misLable ) {
00410             tof->setMisLable();
00411             if( barrel_ec==2 && tofid==42 ) {
00412               unsigned int iden91 = TofID::getIntID( 2, 0, 91-48, 0 ); 
00413               iden_value_key = iden91;
00414               iden = TofID::cell_id( iden91 );
00415             }
00416             if( barrel_ec==2 && tofid==43 ) {
00417               unsigned int iden90 = TofID::getIntID( 2, 0, 90-48, 0 );
00418               iden_value_key = iden90;
00419               iden = TofID::cell_id( iden90 );
00420             }
00421           }
00422           tof->setIdentify( iden );
00423           tof->setForward( (*iter_pmt) );
00424           tof->setTMatched( true );
00425           m_tofDataMap.insert( make_pair( iden_value_key, tof ) );
00426         }
00427       }
00428       else if( barrel_ec == 1 ) {
00429         unsigned int count = m_tofDataMap.count( iden_value_key );
00430         if( count == 0 ) {
00431           std::vector<PmtData*>::iterator iter_pmt = pmtDataVec.begin();
00432           for( ; iter_pmt != pmtDataVec.end(); iter_pmt++ ) {
00433             TofData* tof = new TofData;
00434             tof->setIdentify( iden );
00435             if( end == 0 ) {
00436               tof->setForward( (*iter_pmt) );
00437             }
00438             else {
00439               tof->setBackward( (*iter_pmt) );
00440             }
00441             tof->setTMatched( true );
00442             m_tofDataMap.insert( make_pair( iden_value_key, tof ) );
00443           }
00444         }
00445         else {
00446           pair< IterTofDataMap, IterTofDataMap > range = m_tofDataMap.equal_range( iden_value_key );
00447           std::vector<PmtData*>::iterator iter_pmt = pmtDataVec.begin();
00448           for( ; iter_pmt != pmtDataVec.end(); iter_pmt++ ) {
00449             bool used = false;
00450             IterTofDataMap iter = range.first;
00451             for( unsigned int tofDataNumber = 0; tofDataNumber < count; tofDataNumber++, iter++ ) {
00452 
00453               bool matched = false;
00454               if( end == 0 ) { // east, forward
00455                 if( ( (*iter_pmt)->quality() & 0x1 ) != 0 ) { // pmt has east time
00456                   if( ( ((*iter).second)->quality() & 0x1 ) != 0 ) { // tofmap has west time
00457                     double time1 = (*iter_pmt)->tdc();
00458                     double time2 = ((*iter).second)->tdc2();
00459                     matched = ( abs(time1-time2)<timeDiff );
00460                   }
00461                   else { // tofmap has no west time
00462                     if( ( ((*iter).second)->quality() & 0x2 ) != 0 ) { // tofmap has no west time, but west charge
00463                       double time1 = (*iter_pmt)->tclock();
00464                       double time2 = (*iter_pmt)->qclock();
00465                       double time3 = ((*iter).second)->qclock2();
00466                       matched = ( ( abs(time1-time3)<=tClockDiff ) || ( abs(time2-time3)<=tClockDiff ) );
00467                     }
00468                   }
00469                 }
00470                 else { // pmt has no east time
00471                   if( ( (*iter_pmt)->quality() & 0x2 ) != 0 ) { // pmt has no east time, but east charge
00472                     if( ( ((*iter).second)->quality() & 0x1 ) != 0 ) { // tofmap has west time
00473                       if( ( ( ((*iter).second)->quality() & 0x2 ) != 0 ) ) { // tofmap has west time and west charge
00474                         double time1 = (*iter_pmt)->qclock();
00475                         double time2 = ((*iter).second)->tclock2();
00476                         double time3 = ((*iter).second)->qclock2();
00477                         matched = ( ( abs(time1-time2)<=tClockDiff ) || ( abs(time1-time3)<=tClockDiff ) );
00478                       }
00479                     }
00480                     else { // tofmap has no west time, but west charge
00481                       if( ( ( ((*iter).second)->quality() & 0x2 ) != 0 ) ) {
00482                         double time1 = (*iter_pmt)->qclock();
00483                         double time2 = ((*iter).second)->qclock2();
00484                         matched = ( abs(time1-time2)<=tClockDiff );                     
00485                       }
00486                     } 
00487                   }
00488                 }
00489               
00490                 if( matched ) {
00491                   used = true;
00492                   if( ( ( (*iter).second)->quality() & 0xc ) == 0 ) {
00493                     ((*iter).second)->setForward( (*iter_pmt) );
00494                   }
00495                   else {
00496                     TofData* tof = new TofData;
00497                     tof->setIdentify( iden );
00498                     tof->setForward( (*iter_pmt) );
00499                     tof->setBackward( ((*iter).second)->backward() );
00500                     tof->setTMatched( true );
00501                     m_tofDataMap.insert( make_pair( iden_value_key, tof ) );
00502                   }
00503                 }
00504               
00505               } // end east, forward
00506               else { // west, backward
00507                 if( ( (*iter_pmt)->quality() & 0x1 ) != 0 ) { // pmt has west time
00508                   if( ( ((*iter).second)->quality() & 0x4 ) != 0 ) { // tofmap has east time
00509                     double time1 = (*iter_pmt)->tdc();
00510                     double time2 = ((*iter).second)->tdc1();
00511                     matched = ( abs(time1-time2)<timeDiff );
00512                   }
00513                   else { // tofmap has no east time
00514                     if( ( ((*iter).second)->quality() & 0x8 ) != 0 ) { // tofmap has no east time, but east charge
00515                       double time1 = (*iter_pmt)->tclock();
00516                       double time2 = (*iter_pmt)->qclock();
00517                       double time3 = ((*iter).second)->qclock1();
00518                       matched = ( ( abs(time1-time3)<=tClockDiff ) || ( abs(time2-time3)<=tClockDiff ) );
00519                     }
00520                   }
00521                 }
00522                 else { // pmt has no west time
00523                   if( ( (*iter_pmt)->quality() & 0x2 ) != 0 ) { // pmt has no west time, but west charge
00524                     if( ( ((*iter).second)->quality() & 0x4 ) != 0 ) { // tofmap has east time
00525                       if( ( ( ((*iter).second)->quality() & 0x8 ) != 0 ) ) { // tofmap has east time and east charge
00526                         double time1 = (*iter_pmt)->qclock();
00527                         double time2 = ((*iter).second)->tclock1();
00528                         double time3 = ((*iter).second)->qclock1();
00529                         matched = ( ( abs(time1-time2)<=tClockDiff ) || ( abs(time1-time3)<=tClockDiff ) );
00530                       }
00531                       else {
00532                       }
00533                     }
00534                     else { // tofmap has no west time, but west charge
00535                       if( ( ( ((*iter).second)->quality() & 0x8 ) != 0 ) ) {
00536                         double time1 = (*iter_pmt)->qclock();
00537                         double time2 = ((*iter).second)->qclock1();
00538                         matched = ( abs(time1-time2)<=tClockDiff );                     
00539                       }
00540                     } 
00541                   }
00542                 }
00543 
00544                 if( matched ) {
00545                   used = true;
00546                   if( ( ( (*iter).second)->quality() & 0x3 ) == 0 ) {
00547                     ((*iter).second)->setBackward( (*iter_pmt) );
00548                   }
00549                   else {
00550                     TofData* tof = new TofData;
00551                     tof->setIdentify( iden );
00552                     tof->setForward( ((*iter).second)->forward() );
00553                     tof->setBackward( (*iter_pmt) );
00554                     tof->setTMatched( true );
00555                     m_tofDataMap.insert( make_pair( iden_value_key, tof ) );
00556                   }
00557                 }
00558               }
00559             }
00560 
00561             if( ! used ) {
00562               TofData* tof = new TofData;
00563               tof->setIdentify( iden );
00564               if( end == 0 ) {
00565                 tof->setForward( (*iter_pmt) );
00566               }
00567               else {
00568                 tof->setBackward( (*iter_pmt) );
00569               } 
00570               tof->setTMatched( true );
00571               m_tofDataMap.insert( make_pair( iden_value_key, tof ) );
00572             }
00573           }
00574         }
00575       }
00576     }
00577     //  mrpc endcap tof
00578     if( TofID::is_mrpc( iden ) ) {
00579       //      int barrel_ec = TofID::barrel_ec( iden );
00580       //      int endcap    = TofID::endcap( iden );
00581       //      int tofid     = TofID::module( iden );
00582       //      int strip     = TofID::strip( iden );
00583       int end       = TofID::end( iden );
00584 
00585       unsigned int count = m_tofDataMap.count( iden_value_key );
00586       if( count == 0 ) {
00587         std::vector<PmtData*>::iterator iter_pmt = pmtDataVec.begin();
00588         for( ; iter_pmt != pmtDataVec.end(); iter_pmt++ ) {
00589           TofData* tof = new TofData;
00590           tof->setIdentify( iden );
00591           if( end == 0 ) {
00592             tof->setForward( (*iter_pmt) );
00593           }
00594           else {
00595             tof->setBackward( (*iter_pmt) );
00596           }
00597           tof->setTMatched( true );
00598           m_tofDataMap.insert( make_pair( iden_value_key, tof ) );
00599         }
00600       }
00601       else {
00602         pair< IterTofDataMap, IterTofDataMap > range = m_tofDataMap.equal_range( iden_value_key );
00603         std::vector<PmtData*>::iterator iter_pmt = pmtDataVec.begin();
00604         for( ; iter_pmt != pmtDataVec.end(); iter_pmt++ ) {
00605           bool used = false;
00606           IterTofDataMap iter = range.first;
00607           for( unsigned int tofDataNumber = 0; tofDataNumber < count; tofDataNumber++, iter++ ) {
00608             bool matched = false;
00609             if( end == 0 ) { // east, forward
00610               if( ( (*iter_pmt)->quality() & 0x1 ) != 0 ) {  // pmt has east time
00611                 if( ( ((*iter).second)->quality() & 0x1 ) != 0 ) { // tofmap has west time
00612                   double time1 = (*iter_pmt)->tdc();
00613                   double time2 = ((*iter).second)->tdc2();
00614                   matched = ( abs(time1-time2)<timeDiffMRPC );
00615                 }
00616               }
00617                 /*
00618                 else {
00619                   if( ( ((*iter).second)->quality() & 0x2 ) != 0 ) {
00620                     double time1 = (*iter_pmt)->tdc();
00621                     double time2 = ((*iter).second)->qtc2();
00622                     matched = ( abs(time1-time2)<timeDiffMRPC );
00623                   }
00624                 }
00625               }
00626               else {
00627                 if( ( ((*iter).second)->quality() & 0x1 ) != 0 ) {
00628                   double time1 = (*iter_pmt)->qtc();
00629                   double time2 = ((*iter).second)->tdc2();
00630                   matched = ( abs(time1-time2)<timeDiffMRPC );
00631                 }
00632                 else {
00633                   if( ( ((*iter).second)->quality() & 0x2 ) != 0 ) {
00634                     double time1 = (*iter_pmt)->qtc();
00635                     double time2 = ((*iter).second)->qtc2();
00636                     matched = ( abs(time1-time2)<timeDiffMRPC );
00637                   }
00638                 }
00639               }
00640 
00641               if( ( (*iter_pmt)->quality() & 0x3 ) == 0x3 ) { // pmt has east time
00642                 if( ( ((*iter).second)->quality() & 0x3 ) == 0x3 ) { // tofmap has west time
00643                   double time1 = (*iter_pmt)->tdc();
00644                   double time2 = ((*iter).second)->tdc2();
00645                   matched = ( abs(time1-time2)<timeDiffMRPC );
00646                 }
00647               }
00648               */
00649               if( matched ) {
00650                 used = true;
00651                 if( ( ( (*iter).second)->quality() & 0xc ) == 0 ) {
00652                   ((*iter).second)->setForward( (*iter_pmt) );
00653                 }
00654                 else {
00655                   TofData* tof = new TofData;
00656                   tof->setIdentify( iden );
00657                   tof->setForward( (*iter_pmt) );
00658                   tof->setBackward( ((*iter).second)->backward() );       
00659                   tof->setTMatched( true );
00660                   m_tofDataMap.insert( make_pair( iden_value_key, tof ) );
00661                 }
00662               }
00663             } // end east, forward
00664             else { // west, backward
00665               if( ( (*iter_pmt)->quality() & 0x1 ) != 0 ) { // pmt has west time
00666                 if( ( ((*iter).second)->quality() & 0x4 ) != 0 ) { // tofmap has east time
00667                   double time1 = (*iter_pmt)->tdc();
00668                   double time2 = ((*iter).second)->tdc1();
00669                   matched = ( abs(time1-time2)<timeDiffMRPC );
00670                 }
00671               }
00672                 /*
00673                 else {
00674                   if( ( ((*iter).second)->quality() & 0x8 ) != 0 ) {
00675                     double time1 = (*iter_pmt)->tdc();
00676                     double time2 = ((*iter).second)->qtc1();
00677                     matched = ( abs(time1-time2)<timeDiffMRPC );
00678                   }
00679                 }
00680               }
00681               else {
00682                 if( ( ((*iter).second)->quality() & 0x4 ) != 0 ) {
00683                   double time1 = (*iter_pmt)->qtc();
00684                   double time2 = ((*iter).second)->tdc1();
00685                   matched = ( abs(time1-time2)<timeDiffMRPC );
00686                 }
00687                 else {
00688                   if( ( ((*iter).second)->quality() & 0x8 ) != 0 ) {
00689                     double time1 = (*iter_pmt)->qtc();
00690                     double time2 = ((*iter).second)->qtc1();
00691                     matched = ( abs(time1-time2)<timeDiffMRPC );
00692                   }
00693                 }
00694               }
00695 
00696               if( ( (*iter_pmt)->quality() & 0x3 ) == 0x3 ) { // pmt has west time
00697                 if( ( ((*iter).second)->quality() & 0xc ) == 0xc ) { // tofmap has east time
00698                   double time1 = (*iter_pmt)->tdc();
00699                   double time2 = ((*iter).second)->tdc1();
00700                   matched = ( abs(time1-time2)<timeDiffMRPC );
00701                 }
00702               }
00703               */
00704               if( matched ) {
00705                 used = true;
00706                 if( ( ( (*iter).second)->quality() & 0x3 ) == 0 ) {
00707                   ((*iter).second)->setBackward( (*iter_pmt) );
00708                 }
00709                 else {
00710                   TofData* tof = new TofData;
00711                   tof->setIdentify( iden );
00712                   tof->setForward( ((*iter).second)->forward() );
00713                   tof->setBackward( (*iter_pmt) );
00714                   tof->setTMatched( true );
00715                   m_tofDataMap.insert( make_pair( iden_value_key, tof ) );
00716                 }
00717               }
00718             }
00719           }
00720 
00721           if( ! used ) {
00722             TofData* tof = new TofData;
00723             tof->setIdentify( iden );
00724             if( end == 0 ) {
00725               tof->setForward( (*iter_pmt) );
00726             }
00727             else {
00728               tof->setBackward( (*iter_pmt) );
00729             } 
00730             tof->setTMatched( true );
00731             m_tofDataMap.insert( make_pair( iden_value_key, tof ) );
00732           }
00733         }
00734       }
00735     }
00736 
00737     pmtDataVec.clear();
00738 
00739   }
00740 
00741   return;
00742 
00743 }//close tofDataMapFull

TofDataMap & TofRawDataProvider::tofDataMapOnlineMode ( uint32_t  control = 1  ) 

Definition at line 747 of file TofRawDataProvider.cxx.

References abs, TofID::barrel_ec(), count, TofID::end(), deljobs::end, Bes_Common::FATAL, Identifier::get_value(), genRecEmupikp::i, Bes_Common::INFO, TofID::is_scin(), iter(), RawDataProviderBase::m_msgSvc, RawDataProviderBase::m_name, RawDataProviderBase::m_svcLocator, m_tofDataMapOnline, TofID::phi_module(), genRecEmupikp::range, TofData::setBackward(), TofData::setForward(), TofData::setIdentify(), PmtData::setTdc(), Tdc::setValue(), deljobs::string, PmtData::tdc(), timeDiff, timeDiffMRPC, true, and Bes_Common::WARNING.

Referenced by RawDataProviderSvc::tofDataMapOnlineMode(), and tofDataVectorOnlineMode().

00747                                                                      {
00748 
00749   MsgStream log(m_msgSvc, m_name);
00750   log << MSG::INFO << "TofRawDataProvider::tofDataMapOnlineMode()" << endreq;
00751 
00752   if( ! m_tofDataMapOnline.empty() ) {
00753     if(control){
00754       IterTofDataMap iter = m_tofDataMapOnline.begin();
00755       for( ; iter != m_tofDataMapOnline.end(); iter++ ) {
00756         delete (*iter).second;
00757       }
00758       m_tofDataMapOnline.clear();
00759     }
00760     else return m_tofDataMapOnline;
00761   }
00762     // tianhl for mt
00763     std::string evtDataSvc_name("EventDataSvc");
00764     if(isGaudiThreaded(m_name)){
00765       evtDataSvc_name += getGaudiThreadIDfromName(m_name);
00766     }
00767     // tianhl for mt
00768 
00769   IDataProviderSvc* eventSvc;
00770   StatusCode sc = m_svcLocator->service( evtDataSvc_name.c_str(), eventSvc, true );
00771   if( !sc.isSuccess() ) {
00772     log << MSG::FATAL << "TofRawDataProvider::tofDataMapOnlineMode(): ERROR Could not load EventDataSvc" << endreq;
00773     return m_tofDataMapOnline;
00774   }
00775 
00776   // get TDS data in a common class
00777   SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc,"/Event/Digi/TofDigiCol");
00778   if( !tofDigiCol ) {
00779     log << MSG::WARNING << "TofRawDataProvider::tofDataMapOnlineMode(): Could not find Tof Digi Data!" << endreq;
00780     return m_tofDataMapOnline;
00781   } 
00782 
00783   TofDigiCol::iterator iter = tofDigiCol->begin();
00784   for( ; iter != tofDigiCol->end(); iter++ ) {
00785     unsigned int overflow   = (*iter)->getOverflow();
00786     if( ( overflow & 0xfe000000 ) == 0xfe000000 ) continue;
00787     // overflow 0x   1 1         1 1            1 1
00788     //            no Q T / multi Q T / overflow Q T
00789     
00790     bool noT = ( ( overflow & 0x10 ) != 0 );
00791     //    bool multiQ = ( ( overflow & 0x8 ) != 0 );
00792     //    bool multiT = ( ( overflow & 0x4 ) != 0 );
00793     if( noT ) continue;
00794     
00795     Identifier iden = (*iter)->identify();
00796     unsigned int iden_value = iden.get_value();
00797     int  barrel_ec  = TofID::barrel_ec(iden);
00798     int  id         = TofID::phi_module(iden);
00799     int  end        = TofID::end(iden);
00800 
00801     unsigned int tdcChannel = (*iter)->getTimeChannel();
00802     if( tdcChannel == 0x7fffffff ) continue;
00803 
00804     Tdc* tdc = new Tdc;
00805     tdc->setValue( tdcChannel );
00806     PmtData* pmt = new PmtData;
00807     pmt->setTdc( tdc );
00808 
00809     unsigned int iden_value_key = ( iden_value & 0xfffffffe );
00810     if( barrel_ec == 0 || barrel_ec == 2 ) {
00811       TofData* tof = new TofData;
00812       tof->setIdentify( iden );
00813       tof->setForward( pmt );
00814       m_tofDataMapOnline.insert( make_pair( iden_value_key, tof ) );
00815     }
00816     else if( barrel_ec == 1 || barrel_ec == 3 ) {
00817       unsigned int count = m_tofDataMapOnline.count( iden_value_key );
00818         
00819       if( count == 0 ) {
00820         TofData* tof = new TofData;
00821         tof->setIdentify( iden );
00822         if( end == 0 ) {
00823           tof->setForward( pmt );
00824         }
00825         else {
00826           tof->setBackward( pmt );
00827         } 
00828         m_tofDataMapOnline.insert( make_pair( iden_value_key, tof ) );
00829       }
00830       else {
00831         bool used = false;
00832         pair< IterTofDataMap, IterTofDataMap > range = m_tofDataMapOnline.equal_range( iden_value_key );
00833         IterTofDataMap iter = range.first;
00834         for( unsigned int i=0; i<count; i++, iter++ ) {
00835           if( ( end == 0 ) && ( ( ( (*iter).second)->quality() & 0x1 ) != 0 ) ) {
00836             double time1 = pmt->tdc();
00837             double time2 = ((*iter).second)->tdc2();
00838             if( ( TofID::is_scin( iden ) && abs(time1-time2)<timeDiff ) || ( TofID::is_scin( iden ) && abs(time1-time2)<timeDiffMRPC ) ) {
00839               used = true;
00840               if( ( ( (*iter).second)->quality() & 0x4 ) == 0 ) {
00841                 ((*iter).second)->setForward( pmt );
00842               }
00843               else {
00844                 TofData* tof = new TofData;
00845                 tof->setIdentify( iden );
00846                 tof->setForward( pmt );
00847                 tof->setBackward( ((*iter).second)->backward() );
00848                 m_tofDataMapOnline.insert( make_pair( iden_value_key, tof ) );
00849               }
00850             }
00851           }
00852           else if( ( end == 1 ) && ( ( ((*iter).second)->quality() & 0x4 ) != 0 ) ) {
00853             double time1 = ((*iter).second)->tdc1();
00854             double time2 = pmt->tdc();
00855               
00856             if( ( TofID::is_scin( iden ) && abs(time1-time2)<timeDiff ) || ( TofID::is_scin( iden ) && abs(time1-time2)<timeDiffMRPC ) ) {
00857               used = true;
00858               if( ( ( (*iter).second)->quality() & 0x1 ) == 0 ) {
00859                 ((*iter).second)->setBackward( pmt );
00860               }
00861               else {
00862                 TofData* tof = new TofData;
00863                 tof->setIdentify( iden );
00864                 tof->setForward( ((*iter).second)->forward() );
00865                 tof->setBackward( pmt );
00866                 m_tofDataMapOnline.insert( make_pair( iden_value_key, tof ) );
00867               }
00868             }
00869           }
00870         }
00871         if( ! used ) {
00872           TofData* tof = new TofData;
00873           tof->setIdentify( iden );
00874           if( end == 0 ) {
00875             tof->setForward( pmt );
00876           }
00877           else {
00878             tof->setBackward( pmt );
00879           } 
00880           m_tofDataMapOnline.insert( make_pair( iden_value_key, tof ) );
00881         }
00882       }
00883     }
00884   }
00885 
00886   return m_tofDataMapOnline;
00887 
00888 }

TofDataMap & TofRawDataProvider::tofDataMapTof ( double  estime = 0.0  ) 

Definition at line 955 of file TofRawDataProvider.cxx.

References TofID::cell_id(), count, genRecEmupikp::i, TofID::is_mrpc(), iter(), m_hasFilled, m_run, m_tofDataMap, m_tofDataMapTof, timeBackward, timeForward, and tofDataMapFull().

Referenced by RawDataProviderSvc::tofDataMapTof(), and tofDataVectorTof().

00955                                                              {
00956 
00957   if( !m_hasFilled ) {
00958     TofRawDataProvider::tofDataMapFull();
00959     m_hasFilled = true;
00960   }
00961 
00962   if( !m_tofDataMapTof.empty() ) {
00963     m_tofDataMapTof.clear();
00964   }
00965 
00966   IterTofDataMap iter = m_tofDataMap.begin();
00967   for( ; iter != m_tofDataMap.end(); iter++ ) {
00968     if( ( ( ((*iter).second)->quality() & 0xc ) == 0xc ) || ( ( ((*iter).second)->quality() & 0x3 ) == 0x3 ) ) {
00969       if( estime > 1.0e-6 ) {
00970         double tdc1 = ((*iter).second)->tdc1();
00971         double tdc2 = ((*iter).second)->tdc2();
00972         bool  forward = ( ( ( estime - tdc1 ) < timeBackward ) && ( ( tdc1 - estime ) < timeForward ) );
00973         bool backward = ( ( ( estime - tdc2 ) < timeBackward ) && ( ( tdc2 - estime ) < timeForward ) );
00974         if( TofID::is_mrpc( TofID::cell_id((*iter).first) ) && m_run>=43680 && m_run<43809 ) {
00975           double offset = -264.0;
00976           forward = ( ( ( estime - tdc1 ) < ( timeBackward - offset ) ) && ( ( tdc1 - estime ) < ( timeForward + offset ) ) );
00977           backward = ( ( ( estime - tdc2 ) < ( timeBackward + offset ) ) && ( ( tdc2 - estime ) < ( timeForward + offset ) ) );
00978         }
00979         if( !forward && !backward ) continue;   
00980       }
00981       m_tofDataMapTof.insert( make_pair( (*iter).first, (*iter).second ) );
00982     }
00983   }
00984 
00985   iter = m_tofDataMapTof.begin();
00986   while( iter != m_tofDataMapTof.end() ) {
00987     unsigned int iden_value = (*iter).first;
00988     unsigned int count = m_tofDataMapTof.count( iden_value );
00989     for( unsigned int i=0; i != count; i++, iter++ ) {
00990       ((*iter).second)->setTimes( count );
00991     }
00992   }
00993 
00994   return m_tofDataMapTof;
00995 }

TofDataVector & TofRawDataProvider::tofDataVectorEmc ( double  estime = 0.0  ) 

Definition at line 1059 of file TofRawDataProvider.cxx.

References iter(), m_tofDataVectorEmc, and tofDataMapEmc().

Referenced by RawDataProviderSvc::tofDataVectorEmc().

01059                                                                    {
01060   if( m_tofDataVectorEmc.size() != 0 ) {
01061     m_tofDataVectorEmc.clear();
01062   }
01063 
01064   TofDataMap tofDataMapEmc = TofRawDataProvider::tofDataMapEmc( estime );
01065   IterTofDataMap iter = tofDataMapEmc.begin();
01066   for( ; iter != tofDataMapEmc.end(); iter++ ) {
01067     m_tofDataVectorEmc.push_back( iter->second );
01068   }
01069   return m_tofDataVectorEmc;
01070 }

TofDataVector & TofRawDataProvider::tofDataVectorEstime (  ) 

Definition at line 942 of file TofRawDataProvider.cxx.

References iter(), m_tofDataVectorEstime, and tofDataMapEstime().

Referenced by RawDataProviderSvc::tofDataVectorEstime().

00942                                                        {
00943   if( m_tofDataVectorEstime.size() != 0 ) return m_tofDataVectorEstime;
00944 
00945   TofDataMap tofDataMapEstime = TofRawDataProvider::tofDataMapEstime();
00946   IterTofDataMap iter = tofDataMapEstime.begin();
00947   for( ; iter != tofDataMapEstime.end(); iter++ ) {
00948     m_tofDataVectorEstime.push_back( iter->second );
00949   }
00950   return m_tofDataVectorEstime;
00951 }

TofDataVector & TofRawDataProvider::tofDataVectorOnlineMode ( uint32_t  control = 1  ) 

Definition at line 891 of file TofRawDataProvider.cxx.

References Bes_Common::INFO, iter(), RawDataProviderBase::m_msgSvc, RawDataProviderBase::m_name, m_tofDataVectorOnline, and tofDataMapOnlineMode().

Referenced by RawDataProviderSvc::tofDataVectorOnlineMode().

00891                                                                            {
00892 
00893   MsgStream log(m_msgSvc, m_name);
00894   log << MSG::INFO << "TofRawDataProvider::tofDataVectorOnlineMode()" << endreq;
00895   
00896   if( m_tofDataVectorOnline.size() != 0 ) {
00897     if(!control) return m_tofDataVectorOnline;
00898     else         m_tofDataVectorOnline.clear();
00899   }
00900   TofDataMap tofRawDataMap = TofRawDataProvider::tofDataMapOnlineMode(control);
00901   IterTofDataMap iter = tofRawDataMap.begin();
00902   for( ; iter != tofRawDataMap.end(); iter++ ) {
00903     m_tofDataVectorOnline.push_back( iter->second );
00904   }
00905 
00906   return m_tofDataVectorOnline;
00907 }

TofDataVector & TofRawDataProvider::tofDataVectorTof ( double  estime = 0.0  ) 

Definition at line 998 of file TofRawDataProvider.cxx.

References iter(), m_tofDataVectorTof, and tofDataMapTof().

Referenced by RawDataProviderSvc::tofDataVectorTof().

00998                                                                    {
00999   if( m_tofDataVectorTof.size() != 0 ) {
01000     m_tofDataVectorTof.clear();
01001   }
01002 
01003   TofDataMap tofDataMapTof = TofRawDataProvider::tofDataMapTof( estime );
01004   IterTofDataMap iter = tofDataMapTof.begin();
01005   for( ; iter != tofDataMapTof.end(); iter++ ) {
01006     m_tofDataVectorTof.push_back( iter->second );
01007   }
01008   return m_tofDataVectorTof;
01009 }


Member Data Documentation

int TofRawDataProvider::m_event [private]

Definition at line 56 of file TofRawDataProvider.h.

Referenced by tofDataMapFull().

bool TofRawDataProvider::m_hasFilled [private]

Definition at line 57 of file TofRawDataProvider.h.

Referenced by handle(), tofDataMapEmc(), tofDataMapEstime(), and tofDataMapTof().

IMessageSvc* RawDataProviderBase::m_msgSvc [protected, inherited]

Definition at line 36 of file RawDataProviderBase.h.

Referenced by EmcRawDataProvider::getEmcDigiVec(), MdcRawDataProvider::getMdcDigiVec(), handle(), MdcRawDataProvider::handle(), EmcRawDataProvider::handle(), initialize(), RawDataProviderBase::initialize(), EmcRawDataProvider::initialize(), RawDataProviderBase::setMsgSvc(), tofDataMapFull(), tofDataMapOnlineMode(), and tofDataVectorOnlineMode().

std::string RawDataProviderBase::m_name [protected, inherited]

Definition at line 37 of file RawDataProviderBase.h.

Referenced by EmcRawDataProvider::getEmcDigiVec(), MdcRawDataProvider::getMdcDigiVec(), handle(), MdcRawDataProvider::handle(), EmcRawDataProvider::handle(), initialize(), RawDataProviderBase::initialize(), EmcRawDataProvider::initialize(), RawDataProviderBase::setMsgName(), tofDataMapFull(), tofDataMapOnlineMode(), and tofDataVectorOnlineMode().

int TofRawDataProvider::m_run [private]

Definition at line 56 of file TofRawDataProvider.h.

Referenced by tofDataMapEmc(), tofDataMapFull(), and tofDataMapTof().

ISvcLocator* RawDataProviderBase::m_svcLocator [protected, inherited]

Definition at line 35 of file RawDataProviderBase.h.

Referenced by EmcRawDataProvider::getEmcDigiVec(), MdcRawDataProvider::getMdcDigiVec(), initialize(), RawDataProviderBase::initialize(), EmcRawDataProvider::initialize(), RawDataProviderBase::setSvcLocator(), tofDataMapFull(), and tofDataMapOnlineMode().

TofDataMap TofRawDataProvider::m_tofDataMap [private]

Definition at line 58 of file TofRawDataProvider.h.

Referenced by handle(), tofDataMapEmc(), tofDataMapEstime(), tofDataMapFull(), tofDataMapTof(), and ~TofRawDataProvider().

TofDataMap TofRawDataProvider::m_tofDataMapEmc [private]

Definition at line 69 of file TofRawDataProvider.h.

Referenced by handle(), tofDataMapEmc(), and ~TofRawDataProvider().

TofDataMap TofRawDataProvider::m_tofDataMapEstime [private]

Definition at line 63 of file TofRawDataProvider.h.

Referenced by handle(), tofDataMapEstime(), and ~TofRawDataProvider().

TofDataMap TofRawDataProvider::m_tofDataMapOnline [private]

Definition at line 60 of file TofRawDataProvider.h.

Referenced by handle(), tofDataMapOnlineMode(), and ~TofRawDataProvider().

TofDataMap TofRawDataProvider::m_tofDataMapTof [private]

Definition at line 66 of file TofRawDataProvider.h.

Referenced by handle(), tofDataMapTof(), and ~TofRawDataProvider().

TofDataVector TofRawDataProvider::m_tofDataVectorEmc [private]

Definition at line 70 of file TofRawDataProvider.h.

Referenced by handle(), tofDataVectorEmc(), and ~TofRawDataProvider().

TofDataVector TofRawDataProvider::m_tofDataVectorEstime [private]

Definition at line 64 of file TofRawDataProvider.h.

Referenced by handle(), tofDataVectorEstime(), and ~TofRawDataProvider().

TofDataVector TofRawDataProvider::m_tofDataVectorOnline [private]

Definition at line 61 of file TofRawDataProvider.h.

Referenced by handle(), tofDataVectorOnlineMode(), and ~TofRawDataProvider().

TofDataVector TofRawDataProvider::m_tofDataVectorTof [private]

Definition at line 67 of file TofRawDataProvider.h.

Referenced by handle(), tofDataVectorTof(), and ~TofRawDataProvider().


Generated on Tue Nov 29 23:36:06 2016 for BOSS_7.0.2 by  doxygen 1.4.7