#include <EmcRawDataProvider.h>
Inheritance diagram for EmcRawDataProvider:
Public Types | |
enum | EmcDataMode { DropLow = BIT(0), DropFull = BIT(1), DropHot = BIT(2), DropDead = BIT(3), CutTime = BIT(4), DoCalib = BIT(5), DoOther = BIT(6), Redo = BIT(7) } |
enum | EmcDataMode { DropLow = BIT(0), DropFull = BIT(1), DropHot = BIT(2), DropDead = BIT(3), CutTime = BIT(4), DoCalib = BIT(5), DoOther = BIT(6), Redo = BIT(7) } |
Public Member Functions | |
void | addDeadCrystal (const uint32_t id) |
void | addDeadCrystal (const uint32_t id) |
void | addHotCrystal (const uint32_t id) |
void | addHotCrystal (const uint32_t id) |
void | doCalib (EmcDigi *emcDigi) |
void | doCalib (Identifier &id, uint32_t &measure, uint32_t &adc) |
void | doCalib (EmcDigi *emcDigi) |
void | doCalib (Identifier &id, uint32_t &measure, uint32_t &adc) |
EmcRawDataProvider (const char *name, std::vector< uint32_t > &hot, std::vector< uint32_t > &dead, uint32_t elow=0, uint32_t tlow=0, uint32_t thigh=60) | |
EmcRawDataProvider (const char *name, uint32_t adclow=0, uint32_t tlow=0, uint32_t thigh=60) | |
EmcRawDataProvider () | |
EmcRawDataProvider (const char *name, std::vector< uint32_t > &hot, std::vector< uint32_t > &dead, uint32_t elow=0, uint32_t tlow=0, uint32_t thigh=60) | |
EmcRawDataProvider (const char *name, uint32_t adclow=0, uint32_t tlow=0, uint32_t thigh=60) | |
EmcRawDataProvider () | |
uint32_t | getAdcLowThreshold () |
uint32_t | getAdcLowThreshold () |
std::vector< uint32_t > & | getDeadCrystals () |
std::vector< uint32_t > & | getDeadCrystals () |
EmcDigiCol & | getEmcDigiVec (uint32_t control) |
EmcDigiCol & | getEmcDigiVec (uint32_t control) |
std::vector< uint32_t > & | getHotCrystals () |
std::vector< uint32_t > & | getHotCrystals () |
uint32_t | getTdcHighThreshold () |
uint32_t | getTdcHighThreshold () |
uint32_t | getTdcLowThreshold () |
uint32_t | getTdcLowThreshold () |
void | handle (const Incident &) |
void | handle (const Incident &) |
StatusCode | initialize (ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0) |
virtual StatusCode | initialize (bool mode=0, ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0) |
virtual StatusCode | initialize (bool mode=0, ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0) |
bool | isGoodEmcDigi (uint32_t control, EmcDigi *emcDigi) |
bool | isGoodEmcDigi (uint32_t control, uint32_t id, uint32_t measure, uint32_t adc, uint32_t tdc) |
bool | isGoodEmcDigi (uint32_t control, EmcDigi *emcDigi) |
bool | isGoodEmcDigi (uint32_t control, uint32_t id, uint32_t measure, uint32_t adc, uint32_t tdc) |
bool | removeDeadCrystal (const uint32_t id) |
bool | removeDeadCrystal (const uint32_t id) |
bool | removeHotCrystal (const uint32_t id) |
bool | removeHotCrystal (const uint32_t id) |
void | setDeadCrystals (const std::vector< uint32_t > &idVec) |
void | setDeadCrystals (const std::vector< uint32_t > &idVec) |
void | setELowThreshold (const uint32_t low) |
void | setELowThreshold (const uint32_t low) |
void | setHotCrystals (const std::vector< uint32_t > &idVec) |
void | setHotCrystals (const std::vector< uint32_t > &idVec) |
void | setMsgName (const char *name) |
void | setMsgName (const char *name) |
void | setMsgSvc (IMessageSvc *svc) |
void | setMsgSvc (IMessageSvc *svc) |
void | setSvcLocator (ISvcLocator *svcLoc) |
void | setSvcLocator (ISvcLocator *svcLoc) |
void | setTHighThreshold (const uint32_t high) |
void | setTHighThreshold (const uint32_t high) |
void | setTLowThreshold (const uint32_t low) |
void | setTLowThreshold (const uint32_t low) |
virtual | ~EmcRawDataProvider () |
virtual | ~EmcRawDataProvider () |
Protected Attributes | |
IMessageSvc * | m_msgSvc |
IMessageSvc * | m_msgSvc |
std::string | m_name |
ISvcLocator * | m_svcLocator |
ISvcLocator * | m_svcLocator |
Private Attributes | |
uint32_t | m_adcLowThreshold |
std::vector< uint32_t > | m_deadCrystals |
std::vector< uint32_t > | m_deadCrystals |
IEmcCalibConstSvc * | m_emcCalibConstSvc |
IEmcCalibConstSvc * | m_emcCalibConstSvc |
EmcDigiCol | m_emcDigiVec |
std::vector< uint32_t > | m_hotCrystals |
std::vector< uint32_t > | m_hotCrystals |
uint32_t | m_tHighThreshold |
uint32_t | m_tLowThreshold |
|
00030 { 00031 DropLow = BIT(0), 00032 DropFull = BIT(1), 00033 DropHot = BIT(2), 00034 DropDead = BIT(3), 00035 CutTime = BIT(4), 00036 DoCalib = BIT(5), 00037 DoOther = BIT(6), 00038 Redo = BIT(7) 00039 };
|
|
00030 { 00031 DropLow = BIT(0), 00032 DropFull = BIT(1), 00033 DropHot = BIT(2), 00034 DropDead = BIT(3), 00035 CutTime = BIT(4), 00036 DoCalib = BIT(5), 00037 DoOther = BIT(6), 00038 Redo = BIT(7) 00039 };
|
|
00018 : 00019 RawDataProviderBase(), 00020 m_adcLowThreshold(0), m_tLowThreshold(0), m_tHighThreshold(60), 00021 m_hotCrystals(0), m_deadCrystals(0), 00022 m_emcDigiVec(){ 00023 m_emcCalibConstSvc=0; 00024 }
|
|
00026 : 00027 RawDataProviderBase(name), 00028 m_adcLowThreshold(elow), m_tLowThreshold(tlow), m_tHighThreshold(thigh), 00029 m_hotCrystals(0), m_deadCrystals(0), 00030 m_emcDigiVec(){ 00031 m_emcCalibConstSvc=0; 00032 }
|
|
00035 : 00036 RawDataProviderBase(name), 00037 m_adcLowThreshold(elow), m_tLowThreshold(tlow), m_tHighThreshold(thigh), 00038 m_hotCrystals(hot), m_deadCrystals(dead), 00039 m_emcDigiVec(){ 00040 m_emcCalibConstSvc=0; 00041 }
|
|
00023 {m_emcDigiVec=EmcDigiCol();};
|
|
|
|
|
|
|
|
00023 {m_emcDigiVec=EmcDigiCol();};
|
|
|
|
00220 { 00221 std::vector<uint32_t>::iterator it=m_hotCrystals.begin(); 00222 for(;it!=m_deadCrystals.end();it++){ 00223 if((*it)==teid) break; 00224 } 00225 if(it==m_deadCrystals.end()) m_deadCrystals.push_back(teid); 00226 00227 return; 00228 }
|
|
|
|
00210 { 00211 std::vector<uint32_t>::iterator it=m_hotCrystals.begin(); 00212 for(;it!=m_hotCrystals.end();it++){ 00213 if((*it)==teid) break; 00214 } 00215 if(it==m_hotCrystals.end()) m_hotCrystals.push_back(teid); 00216 00217 return; 00218 }
|
|
|
|
|
|
00131 { 00132 Identifier id=emcDigi->identify(); 00133 uint32_t adc=emcDigi->getChargeChannel(); 00134 uint32_t measure=emcDigi->getMeasure(); 00135 doCalib(id,measure,adc); 00136 emcDigi->setChargeChannel(adc); 00137 emcDigi->setMeasure(measure); 00138 }
|
|
00118 { 00119 00120 uint32_t part = EmcID::barrel_ec(id); 00121 uint32_t itheta = EmcID::theta_module(id); 00122 uint32_t iphi = EmcID::phi_module(id); 00123 int index = m_emcCalibConstSvc->getIndex(part,itheta,iphi); 00124 double adc2e = m_emcCalibConstSvc->getDigiCalibConst(index); 00125 double e = RawDataUtil::EmcCharge(measure, adc)*adc2e; 00126 00127 measure =RawDataUtil::EmcChargeMeasure(e); 00128 adc =RawDataUtil::EmcChargeChannel(e); 00129 }
|
|
00062 { return m_adcLowThreshold; };
|
|
00062 { return m_adcLowThreshold; };
|
|
00066 { return m_deadCrystals; };
|
|
00066 { return m_deadCrystals; };
|
|
|
|
00140 { 00141 MsgStream log(m_msgSvc, m_name); 00142 log << MSG::INFO << "EmcRawDataProvider::getEmcDigiVec..." << endreq; 00143 log << MSG::DEBUG << "vector size=" << m_emcDigiVec.size() << endreq; 00144 00145 if(m_emcDigiVec.size()>0){ 00146 if(control&Redo) m_emcDigiVec=EmcDigiCol(); 00147 else return m_emcDigiVec; 00148 } 00149 // Retrieve Hits Collection 00150 // tianhl for mt 00151 std::string evtDataSvc_name("EventDataSvc"); 00152 if(isGaudiThreaded(m_name)){ 00153 evtDataSvc_name += getGaudiThreadIDfromName(m_name); 00154 } 00155 // tianhl for mt 00156 IDataProviderSvc* evtSvc; 00157 StatusCode sc = m_svcLocator->service(evtDataSvc_name.c_str(),evtSvc,true); 00158 if (!sc.isSuccess()){ 00159 log << MSG::FATAL << "EmcRawDataProvider: ERROR Could not load EventDataSvc" << endreq; 00160 } 00161 00162 SmartDataPtr<EmcDigiCol> emcDigiCol(evtSvc,"/Event/Digi/EmcDigiCol"); 00163 if (!emcDigiCol) { 00164 log << MSG::FATAL << "Could not find Emc digi!!" << endreq; 00165 return m_emcDigiVec; 00166 } 00167 log << MSG::DEBUG << "start dealing with EmcRawCol " << emcDigiCol->size() << endreq; 00168 EmcDigiCol::iterator iterEMC=emcDigiCol->begin(); 00169 for(;iterEMC!= emcDigiCol->end();iterEMC++) { 00170 log << MSG::NIL << "vector size=" << m_emcDigiVec.size() << endreq; 00171 if(isGoodEmcDigi(control,*iterEMC)) m_emcDigiVec.insert(m_emcDigiVec.end(),*iterEMC); 00172 if(control&DoCalib) { 00173 if(m_emcCalibConstSvc!=0) doCalib(*iterEMC); 00174 else { 00175 log << MSG::WARNING << "require EMC calibration, but none service, ignore." << endreq; 00176 } 00177 } 00178 if(control&DoOther) { } 00179 } 00180 log << MSG::VERBOSE << "ready for return" << endreq; 00181 return m_emcDigiVec; 00182 }
|
|
00065 { return m_hotCrystals; };
|
|
00065 { return m_hotCrystals; };
|
|
00064 { return m_tHighThreshold; };
|
|
00064 { return m_tHighThreshold; };
|
|
00063 { return m_tLowThreshold; };
|
|
00063 { return m_tLowThreshold; };
|
|
|
|
00043 { 00044 MsgStream log(m_msgSvc, m_name); 00045 log << MSG::DEBUG << "inc.type=" << inc.type() << endreq; 00046 if ( inc.type() == "BeginEvent" ){ 00047 EmcDigiCol empty; 00048 m_emcDigiVec=empty; 00049 } 00050 return; 00051 }
|
|
Reimplemented in MdcRawDataProvider, and MdcRawDataProvider. 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 }
|
|
|
|
00053 { 00054 00055 RawDataProviderBase::initialize(pSvcLoc,pMsg); 00056 // test cut value 00057 MsgStream log(m_msgSvc, m_name); 00058 if(log.level()<=MSG::INFO){ 00059 std::cout << "EmcRawDataProvider:: " << "elow=" << m_adcLowThreshold << ", tlow=" << m_tLowThreshold 00060 << ", thigh=" << m_tHighThreshold << std::endl; 00061 std::vector<uint32_t>::iterator it=m_hotCrystals.begin(); 00062 std::cout << " hot crystals "; 00063 for(;it!=m_hotCrystals.end();it++){ 00064 std::cout << *it << " "; 00065 } 00066 std::cout << std::endl << " dead crystals "; 00067 for(it=m_deadCrystals.begin();it!=m_deadCrystals.end();it++){ 00068 std::cout << *it << " "; 00069 } 00070 std::cout << std::endl; 00071 } 00072 00073 // get point of EMC calibration service 00074 StatusCode sc = m_svcLocator->service("EmcCalibConstSvc", m_emcCalibConstSvc); 00075 if(sc != StatusCode::SUCCESS) { 00076 log << MSG::ERROR << "Can't get EmcCalibConstSvc." << endreq; 00077 m_emcCalibConstSvc=0; 00078 } 00079 else if(mode) m_emcCalibConstSvc->getDigiCalibConst(0); 00080 00081 return StatusCode::SUCCESS; 00082 }
|
|
|
|
|
|
00110 { 00111 uint32_t adc=emcDigi->getChargeChannel(); 00112 uint32_t measure=emcDigi->getMeasure(); 00113 uint32_t tdc=emcDigi->getTimeChannel(); 00114 Identifier id=emcDigi->identify(); 00115 return isGoodEmcDigi(control,id.get_value(),measure,adc,tdc); 00116 }
|
|
00085 { 00086 if(control&DropLow) { 00087 if(measure==0&&adc<m_adcLowThreshold) return false; 00088 } 00089 if(control&DropFull) { 00090 if(measure==3) return false; 00091 } 00092 if(control&CutTime) { 00093 if(tdc<m_tLowThreshold||tdc>m_tHighThreshold) return false; 00094 } 00095 if(control&DropHot) { 00096 std::vector<uint32_t>::iterator it=m_hotCrystals.begin(); 00097 for(;it!=m_hotCrystals.end();it++){ 00098 if((*it)==id) return false; 00099 } 00100 } 00101 if(control&DropDead) { 00102 std::vector<uint32_t>::iterator it=m_deadCrystals.begin(); 00103 for(;it!=m_deadCrystals.end();it++){ 00104 if((*it)==id) return false; 00105 } 00106 } 00107 return true; 00108 }
|
|
|
|
00197 { 00198 std::vector<uint32_t>::iterator it=m_hotCrystals.begin(); 00199 for(;it!=m_deadCrystals.end();it++){ 00200 if((*it)==teid) { 00201 m_deadCrystals.erase(it); 00202 break; 00203 } 00204 } 00205 if(it==m_deadCrystals.end()) return false; 00206 00207 return true; 00208 }
|
|
|
|
00184 { 00185 std::vector<uint32_t>::iterator it=m_hotCrystals.begin(); 00186 for(;it!=m_hotCrystals.end();it++){ 00187 if((*it)==teid) { 00188 m_hotCrystals.erase(it); 00189 break; 00190 } 00191 } 00192 if(it==m_hotCrystals.end()) return false; 00193 00194 return true; 00195 }
|
|
00056 { m_deadCrystals = idVec; };
|
|
00056 { m_deadCrystals = idVec; };
|
|
00051 { m_adcLowThreshold = low; };
|
|
00051 { m_adcLowThreshold = low; };
|
|
00054 { m_hotCrystals = idVec; };
|
|
00054 { m_hotCrystals = idVec; };
|
|
00029 { m_name = std::string(name); };
|
|
00029 { m_name = std::string(name); };
|
|
00028 { m_msgSvc=svc; };
|
|
00028 { m_msgSvc=svc; };
|
|
00027 { m_svcLocator=svcLoc; };
|
|
00027 { m_svcLocator=svcLoc; };
|
|
00053 { m_tHighThreshold = high; };
|
|
00053 { m_tHighThreshold = high; };
|
|
00052 { m_tLowThreshold = low; };
|
|
00052 { m_tLowThreshold = low; };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|