BOSS 7.1.2
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 24 of file EmcRawDataProvider.h.

24{m_emcDigiVec.clear();}

Member Function Documentation

◆ addDeadCrystal()

void EmcRawDataProvider::addDeadCrystal ( const uint32_t id)

Definition at line 221 of file EmcRawDataProvider.cxx.

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

◆ addHotCrystal()

void EmcRawDataProvider::addHotCrystal ( const uint32_t id)

Definition at line 211 of file EmcRawDataProvider.cxx.

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

◆ doCalib() [1/2]

void EmcRawDataProvider::doCalib ( EmcDigi * emcDigi)

Definition at line 132 of file EmcRawDataProvider.cxx.

132 {
133 Identifier id=emcDigi->identify();
134 uint32_t adc=emcDigi->getChargeChannel();
135 uint32_t measure=emcDigi->getMeasure();
136 doCalib(id,measure,adc);
137 emcDigi->setChargeChannel(adc);
138 emcDigi->setMeasure(measure);
139}
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 119 of file EmcRawDataProvider.cxx.

119 {
120
121 uint32_t part = EmcID::barrel_ec(id);
122 uint32_t itheta = EmcID::theta_module(id);
123 uint32_t iphi = EmcID::phi_module(id);
124 int index = m_emcCalibConstSvc->getIndex(part,itheta,iphi);
125 double adc2e = m_emcCalibConstSvc->getDigiCalibConst(index);
126 double e = RawDataUtil::EmcCharge(measure, adc)*adc2e;
127
130}
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:37
static int EmcChargeMeasure(double charge)
Definition RawDataUtil.h:50
static double EmcCharge(int measure, int chargeChannel)
Definition RawDataUtil.h:17

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 141 of file EmcRawDataProvider.cxx.

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

Referenced by RawDataProviderSvc::handle().

◆ initialize()

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

Definition at line 54 of file EmcRawDataProvider.cxx.

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

111 {
112 uint32_t adc=emcDigi->getChargeChannel();
113 uint32_t measure=emcDigi->getMeasure();
114 uint32_t tdc=emcDigi->getTimeChannel();
115 Identifier id=emcDigi->identify();
116 return isGoodEmcDigi(control,id.get_value(),measure,adc,tdc);
117}
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 85 of file EmcRawDataProvider.cxx.

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

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

◆ removeDeadCrystal()

bool EmcRawDataProvider::removeDeadCrystal ( const uint32_t id)

Definition at line 198 of file EmcRawDataProvider.cxx.

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

◆ removeHotCrystal()

bool EmcRawDataProvider::removeHotCrystal ( const uint32_t id)

Definition at line 185 of file EmcRawDataProvider.cxx.

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

◆ 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: