CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRawDataProvider Class Reference

#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)
}
 

Public Member Functions

 EmcRawDataProvider ()
 
 EmcRawDataProvider (const char *name, uint32_t adclow=0, uint32_t tlow=0, uint32_t thigh=60)
 
 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)
 
virtual ~EmcRawDataProvider ()
 
void handle (const Incident &)
 
virtual StatusCode initialize (bool mode=0, ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
 
EmcDigiColgetEmcDigiVec (uint32_t control)
 
bool isGoodEmcDigi (uint32_t control, uint32_t id, uint32_t measure, uint32_t adc, uint32_t tdc)
 
bool isGoodEmcDigi (uint32_t control, EmcDigi *emcDigi)
 
void doCalib (Identifier &id, uint32_t &measure, uint32_t &adc)
 
void doCalib (EmcDigi *emcDigi)
 
void setELowThreshold (const uint32_t low)
 
void setTLowThreshold (const uint32_t low)
 
void setTHighThreshold (const uint32_t high)
 
void setHotCrystals (const std::vector< uint32_t > &idVec)
 
void addHotCrystal (const uint32_t id)
 
void setDeadCrystals (const std::vector< uint32_t > &idVec)
 
void addDeadCrystal (const uint32_t id)
 
bool removeHotCrystal (const uint32_t id)
 
bool removeDeadCrystal (const uint32_t id)
 
uint32_t getAdcLowThreshold ()
 
uint32_t getTdcLowThreshold ()
 
uint32_t getTdcHighThreshold ()
 
std::vector< uint32_t > & getHotCrystals ()
 
std::vector< uint32_t > & getDeadCrystals ()
 
- Public Member Functions inherited from RawDataProviderBase
 RawDataProviderBase (const char *name)
 
virtual ~RawDataProviderBase ()
 
StatusCode initialize (ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
 
void setSvcLocator (ISvcLocator *svcLoc)
 
void setMsgSvc (IMessageSvc *svc)
 
void setMsgName (const char *name)
 

Additional Inherited Members

- Protected Member Functions inherited from RawDataProviderBase
 RawDataProviderBase ()
 
- Protected Attributes inherited from RawDataProviderBase
ISvcLocator * m_svcLocator
 
IMessageSvc * m_msgSvc
 
std::string m_name
 

Detailed Description

Definition at line 17 of file EmcRawDataProvider.h.

Member Enumeration Documentation

◆ EmcDataMode

Enumerator
DropLow 
DropFull 
DropHot 
DropDead 
CutTime 
DoCalib 
DoOther 
Redo 

Definition at line 30 of file EmcRawDataProvider.h.

Constructor & Destructor Documentation

◆ EmcRawDataProvider() [1/3]

EmcRawDataProvider::EmcRawDataProvider ( )

Definition at line 18 of file EmcRawDataProvider.cxx.

18 :
20 m_adcLowThreshold(0), m_tLowThreshold(0), m_tHighThreshold(60),
21 m_hotCrystals(0), m_deadCrystals(0),
22 m_emcDigiVec(){
23 m_emcCalibConstSvc=0;
24}

◆ EmcRawDataProvider() [2/3]

EmcRawDataProvider::EmcRawDataProvider ( const char * name,
uint32_t adclow = 0,
uint32_t tlow = 0,
uint32_t thigh = 60 )

Definition at line 26 of file EmcRawDataProvider.cxx.

26 :
28 m_adcLowThreshold(elow), m_tLowThreshold(tlow), m_tHighThreshold(thigh),
29 m_hotCrystals(0), m_deadCrystals(0),
30 m_emcDigiVec(){
31 m_emcCalibConstSvc=0;
32}

◆ EmcRawDataProvider() [3/3]

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 )

Definition at line 34 of file EmcRawDataProvider.cxx.

35 :
37 m_adcLowThreshold(elow), m_tLowThreshold(tlow), m_tHighThreshold(thigh),
38 m_hotCrystals(hot), m_deadCrystals(dead),
39 m_emcDigiVec(){
40 m_emcCalibConstSvc=0;
41}

◆ ~EmcRawDataProvider()

virtual EmcRawDataProvider::~EmcRawDataProvider ( )
inlinevirtual

Definition at line 23 of file EmcRawDataProvider.h.

23{m_emcDigiVec=EmcDigiCol();};
ObjectVector< EmcDigi > EmcDigiCol
Definition EmcDigi.h:43

Member Function Documentation

◆ addDeadCrystal()

void EmcRawDataProvider::addDeadCrystal ( const uint32_t id)

Definition at line 220 of file EmcRawDataProvider.cxx.

220 {
221 std::vector<uint32_t>::iterator it=m_hotCrystals.begin();
222 for(;it!=m_deadCrystals.end();it++){
223 if((*it)==teid) break;
224 }
225 if(it==m_deadCrystals.end()) m_deadCrystals.push_back(teid);
226
227 return;
228}

◆ addHotCrystal()

void EmcRawDataProvider::addHotCrystal ( const uint32_t id)

Definition at line 210 of file EmcRawDataProvider.cxx.

210 {
211 std::vector<uint32_t>::iterator it=m_hotCrystals.begin();
212 for(;it!=m_hotCrystals.end();it++){
213 if((*it)==teid) break;
214 }
215 if(it==m_hotCrystals.end()) m_hotCrystals.push_back(teid);
216
217 return;
218}

◆ doCalib() [1/2]

void EmcRawDataProvider::doCalib ( EmcDigi * emcDigi)

Definition at line 131 of file EmcRawDataProvider.cxx.

131 {
132 Identifier id=emcDigi->identify();
133 uint32_t adc=emcDigi->getChargeChannel();
134 uint32_t measure=emcDigi->getMeasure();
135 doCalib(id,measure,adc);
136 emcDigi->setChargeChannel(adc);
137 emcDigi->setMeasure(measure);
138}
unsigned int getMeasure() const
Definition EmcDigi.h:27
void setMeasure(const unsigned int measure)
Definition EmcDigi.h:24
void doCalib(Identifier &id, uint32_t &measure, uint32_t &adc)
virtual Identifier identify() const
Definition RawData.cxx:15
void setChargeChannel(const unsigned int chargeChannel)
Definition RawData.cxx:30
unsigned int getChargeChannel() const
Definition RawData.cxx:45

◆ doCalib() [2/2]

void EmcRawDataProvider::doCalib ( Identifier & id,
uint32_t & measure,
uint32_t & adc )

Definition at line 118 of file EmcRawDataProvider.cxx.

118 {
119
120 uint32_t part = EmcID::barrel_ec(id);
121 uint32_t itheta = EmcID::theta_module(id);
122 uint32_t iphi = EmcID::phi_module(id);
123 int index = m_emcCalibConstSvc->getIndex(part,itheta,iphi);
124 double adc2e = m_emcCalibConstSvc->getDigiCalibConst(index);
125 double e = RawDataUtil::EmcCharge(measure, adc)*adc2e;
126
129}
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition EmcID.cxx:38
static unsigned int theta_module(const Identifier &id)
Definition EmcID.cxx:43
static unsigned int phi_module(const Identifier &id)
Definition EmcID.cxx:48
virtual double getDigiCalibConst(int No) const =0
virtual int getIndex(unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const =0
static int EmcChargeChannel(double charge)
Definition RawDataUtil.h:43
static int EmcChargeMeasure(double charge)
Definition RawDataUtil.h:56
static double EmcCharge(int measure, int chargeChannel)
Definition RawDataUtil.h:23

Referenced by EmcConverter::convert(), doCalib(), and getEmcDigiVec().

◆ getAdcLowThreshold()

uint32_t EmcRawDataProvider::getAdcLowThreshold ( )
inline

Definition at line 62 of file EmcRawDataProvider.h.

62{ return m_adcLowThreshold; };

◆ getDeadCrystals()

std::vector< uint32_t > & EmcRawDataProvider::getDeadCrystals ( )
inline

Definition at line 66 of file EmcRawDataProvider.h.

66{ return m_deadCrystals; };

◆ getEmcDigiVec()

EmcDigiCol & EmcRawDataProvider::getEmcDigiVec ( uint32_t control)

Definition at line 140 of file EmcRawDataProvider.cxx.

140 {
141 MsgStream log(m_msgSvc, m_name);
142 log << MSG::INFO << "EmcRawDataProvider::getEmcDigiVec..." << endreq;
143 log << MSG::DEBUG << "vector size=" << m_emcDigiVec.size() << endreq;
144
145 if(m_emcDigiVec.size()>0){
146 if(control&Redo) m_emcDigiVec=EmcDigiCol();
147 else return m_emcDigiVec;
148 }
149 // Retrieve Hits Collection
150 // tianhl for mt
151 std::string evtDataSvc_name("EventDataSvc");
152 if(isGaudiThreaded(m_name)){
153 evtDataSvc_name += getGaudiThreadIDfromName(m_name);
154 }
155 // tianhl for mt
156 IDataProviderSvc* evtSvc;
157 StatusCode sc = m_svcLocator->service(evtDataSvc_name.c_str(),evtSvc,true);
158 if (!sc.isSuccess()){
159 log << MSG::FATAL << "EmcRawDataProvider: ERROR Could not load EventDataSvc" << endreq;
160 }
161
162 SmartDataPtr<EmcDigiCol> emcDigiCol(evtSvc,"/Event/Digi/EmcDigiCol");
163 if (!emcDigiCol) {
164 log << MSG::FATAL << "Could not find Emc digi!!" << endreq;
165 return m_emcDigiVec;
166 }
167 log << MSG::DEBUG << "start dealing with EmcRawCol " << emcDigiCol->size() << endreq;
168 EmcDigiCol::iterator iterEMC=emcDigiCol->begin();
169 for(;iterEMC!= emcDigiCol->end();iterEMC++) {
170 log << MSG::NIL << "vector size=" << m_emcDigiVec.size() << endreq;
171 if(isGoodEmcDigi(control,*iterEMC)) m_emcDigiVec.insert(m_emcDigiVec.end(),*iterEMC);
172 if(control&DoCalib) {
173 if(m_emcCalibConstSvc!=0) doCalib(*iterEMC);
174 else {
175 log << MSG::WARNING << "require EMC calibration, but none service, ignore." << endreq;
176 }
177 }
178 if(control&DoOther) { }
179 }
180 log << MSG::VERBOSE << "ready for return" << endreq;
181 return m_emcDigiVec;
182}
bool isGoodEmcDigi(uint32_t control, uint32_t id, uint32_t measure, uint32_t adc, uint32_t tdc)

Referenced by RawDataProviderSvc::getEmcDigiVec().

◆ getHotCrystals()

std::vector< uint32_t > & EmcRawDataProvider::getHotCrystals ( )
inline

Definition at line 65 of file EmcRawDataProvider.h.

65{ return m_hotCrystals; };

◆ getTdcHighThreshold()

uint32_t EmcRawDataProvider::getTdcHighThreshold ( )
inline

Definition at line 64 of file EmcRawDataProvider.h.

64{ return m_tHighThreshold; };

◆ getTdcLowThreshold()

uint32_t EmcRawDataProvider::getTdcLowThreshold ( )
inline

Definition at line 63 of file EmcRawDataProvider.h.

63{ return m_tLowThreshold; };

◆ handle()

void EmcRawDataProvider::handle ( const Incident & inc)

Definition at line 43 of file EmcRawDataProvider.cxx.

43 {
44 MsgStream log(m_msgSvc, m_name);
45 log << MSG::DEBUG << "inc.type=" << inc.type() << endreq;
46 if ( inc.type() == "BeginEvent" ){
47 EmcDigiCol empty;
48 m_emcDigiVec=empty;
49 }
50 return;
51}

Referenced by RawDataProviderSvc::handle().

◆ initialize()

StatusCode EmcRawDataProvider::initialize ( bool mode = 0,
ISvcLocator * svcLoc = 0,
IMessageSvc * pMsg = 0 )
virtual

Definition at line 53 of file EmcRawDataProvider.cxx.

53 {
54
56 // test cut value
57 MsgStream log(m_msgSvc, m_name);
58 if(log.level()<=MSG::INFO){
59 std::cout << "EmcRawDataProvider:: " << "elow=" << m_adcLowThreshold << ", tlow=" << m_tLowThreshold
60 << ", thigh=" << m_tHighThreshold << std::endl;
61 std::vector<uint32_t>::iterator it=m_hotCrystals.begin();
62 std::cout << " hot crystals ";
63 for(;it!=m_hotCrystals.end();it++){
64 std::cout << *it << " ";
65 }
66 std::cout << std::endl << " dead crystals ";
67 for(it=m_deadCrystals.begin();it!=m_deadCrystals.end();it++){
68 std::cout << *it << " ";
69 }
70 std::cout << std::endl;
71 }
72
73 // get point of EMC calibration service
74 StatusCode sc = m_svcLocator->service("EmcCalibConstSvc", m_emcCalibConstSvc);
75 if(sc != StatusCode::SUCCESS) {
76 log << MSG::ERROR << "Can't get EmcCalibConstSvc." << endreq;
77 m_emcCalibConstSvc=0;
78 }
79 else if(mode) m_emcCalibConstSvc->getDigiCalibConst(0);
80
81 return StatusCode::SUCCESS;
82}
StatusCode initialize(ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)

Referenced by RawDataProviderSvc::initialize().

◆ isGoodEmcDigi() [1/2]

bool EmcRawDataProvider::isGoodEmcDigi ( uint32_t control,
EmcDigi * emcDigi )

Definition at line 110 of file EmcRawDataProvider.cxx.

110 {
111 uint32_t adc=emcDigi->getChargeChannel();
112 uint32_t measure=emcDigi->getMeasure();
113 uint32_t tdc=emcDigi->getTimeChannel();
114 Identifier id=emcDigi->identify();
115 return isGoodEmcDigi(control,id.get_value(),measure,adc,tdc);
116}
unsigned int getTimeChannel() const
Definition RawData.cxx:40

◆ isGoodEmcDigi() [2/2]

bool EmcRawDataProvider::isGoodEmcDigi ( uint32_t control,
uint32_t id,
uint32_t measure,
uint32_t adc,
uint32_t tdc )

Definition at line 84 of file EmcRawDataProvider.cxx.

85 {
86 if(control&DropLow) {
87 if(measure==0&&adc<m_adcLowThreshold) return false;
88 }
89 if(control&DropFull) {
90 if(measure==3) return false;
91 }
92 if(control&CutTime) {
93 if(tdc<m_tLowThreshold||tdc>m_tHighThreshold) return false;
94 }
95 if(control&DropHot) {
96 std::vector<uint32_t>::iterator it=m_hotCrystals.begin();
97 for(;it!=m_hotCrystals.end();it++){
98 if((*it)==id) return false;
99 }
100 }
101 if(control&DropDead) {
102 std::vector<uint32_t>::iterator it=m_deadCrystals.begin();
103 for(;it!=m_deadCrystals.end();it++){
104 if((*it)==id) return false;
105 }
106 }
107 return true;
108}

Referenced by EmcConverter::convert(), getEmcDigiVec(), and isGoodEmcDigi().

◆ removeDeadCrystal()

bool EmcRawDataProvider::removeDeadCrystal ( const uint32_t id)

Definition at line 197 of file EmcRawDataProvider.cxx.

197 {
198 std::vector<uint32_t>::iterator it=m_hotCrystals.begin();
199 for(;it!=m_deadCrystals.end();it++){
200 if((*it)==teid) {
201 m_deadCrystals.erase(it);
202 break;
203 }
204 }
205 if(it==m_deadCrystals.end()) return false;
206
207 return true;
208}

◆ removeHotCrystal()

bool EmcRawDataProvider::removeHotCrystal ( const uint32_t id)

Definition at line 184 of file EmcRawDataProvider.cxx.

184 {
185 std::vector<uint32_t>::iterator it=m_hotCrystals.begin();
186 for(;it!=m_hotCrystals.end();it++){
187 if((*it)==teid) {
188 m_hotCrystals.erase(it);
189 break;
190 }
191 }
192 if(it==m_hotCrystals.end()) return false;
193
194 return true;
195}

◆ setDeadCrystals()

void EmcRawDataProvider::setDeadCrystals ( const std::vector< uint32_t > & idVec)
inline

Definition at line 56 of file EmcRawDataProvider.h.

56{ m_deadCrystals = idVec; };

◆ setELowThreshold()

void EmcRawDataProvider::setELowThreshold ( const uint32_t low)
inline

Definition at line 51 of file EmcRawDataProvider.h.

51{ m_adcLowThreshold = low; };

Referenced by RawDataProviderSvc::initialize().

◆ setHotCrystals()

void EmcRawDataProvider::setHotCrystals ( const std::vector< uint32_t > & idVec)
inline

Definition at line 54 of file EmcRawDataProvider.h.

54{ m_hotCrystals = idVec; };

Referenced by RawDataProviderSvc::initialize().

◆ setTHighThreshold()

void EmcRawDataProvider::setTHighThreshold ( const uint32_t high)
inline

Definition at line 53 of file EmcRawDataProvider.h.

53{ m_tHighThreshold = high; };

Referenced by RawDataProviderSvc::initialize().

◆ setTLowThreshold()

void EmcRawDataProvider::setTLowThreshold ( const uint32_t low)
inline

Definition at line 52 of file EmcRawDataProvider.h.

52{ m_tLowThreshold = low; };

Referenced by RawDataProviderSvc::initialize().


The documentation for this class was generated from the following files: