BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcRawDataProvider Class Reference

#include <MdcRawDataProvider.h>

+ Inheritance diagram for MdcRawDataProvider:

Public Types

enum  MdcControlMode {
  i_maxMdcDigi = 0x1FFF , b_keepUnmatch = 0x2000 , b_dropHot = 0x4000 , b_keepSkipped = 0x8000 ,
  b_keepBadTdc = 0x10000 , b_unRedo = 0x20000 , b_keepAllChannel = 0x40000
}
 

Public Member Functions

 MdcRawDataProvider ()
 
 MdcRawDataProvider (const char *name)
 
 ~MdcRawDataProvider ()
 
StatusCode initialize (ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
 
void handle (const Incident &)
 
void setSkipLayers (const std::vector< int > &skipLayers)
 
void setEffThreshold (float effThreshold)
 
void setAdcThresholds (const std::vector< float > &adcThresholds)
 
MdcDigiVecgetMdcDigiVec (uint32_t control=0)
 
- 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 14 of file MdcRawDataProvider.h.

Member Enumeration Documentation

◆ MdcControlMode

Enumerator
i_maxMdcDigi 
b_keepUnmatch 
b_dropHot 
b_keepSkipped 
b_keepBadTdc 
b_unRedo 
b_keepAllChannel 

Definition at line 33 of file MdcRawDataProvider.h.

Constructor & Destructor Documentation

◆ MdcRawDataProvider() [1/2]

MdcRawDataProvider::MdcRawDataProvider ( )

Definition at line 28 of file MdcRawDataProvider.cxx.

28 :
30 digiRef(0),
31 m_mdcCalibFunSvc(0)
32{}

◆ MdcRawDataProvider() [2/2]

MdcRawDataProvider::MdcRawDataProvider ( const char * name)

Definition at line 35 of file MdcRawDataProvider.cxx.

35 :
36 RawDataProviderBase( name ),
37 digiRef(0),
38 m_mdcCalibFunSvc(0)
39{}

◆ ~MdcRawDataProvider()

MdcRawDataProvider::~MdcRawDataProvider ( )

Definition at line 41 of file MdcRawDataProvider.cxx.

41 {
42}

Member Function Documentation

◆ getMdcDigiVec()

MdcDigiVec & MdcRawDataProvider::getMdcDigiVec ( uint32_t control = 0)

Definition at line 58 of file MdcRawDataProvider.cxx.

58 {
59 MsgStream log(m_msgSvc, m_name);
60 StatusCode sc;
61 bool unRedo = ((control&b_unRedo)==b_unRedo);
62 if(!unRedo) digiRef.clear();
63 else if(digiRef.size()>0) return digiRef;
64 //---- get event service
65 IDataProviderSvc* evtSvc;
66 // tianhl for mt
67 std::string evtDataSvc_name("EventDataSvc");
68 if(isGaudiThreaded(m_name)){
69 evtDataSvc_name += getGaudiThreadIDfromName(m_name);
70 }
71 // tianhl for mt
72 sc = m_svcLocator->service(evtDataSvc_name.c_str(),evtSvc,true);
73 if (!sc.isSuccess()){
74 log << MSG::FATAL << "Could not load EventDataSvc" << endreq;
75 return digiRef;
76 }
77
78 //---- get max MdcDigi
79 int maxMdcDigi = control&i_maxMdcDigi;
80
81 //---- prepare for drop Bad TDC
82 bool keepBadTdc = ((control&b_keepBadTdc)!=0x10000);
83 double t0 = 0.;
84 if (keepBadTdc){
85 //get MdcCalibFunSvc
86 sc = m_svcLocator->service("MdcCalibFunSvc", m_mdcCalibFunSvc);
87 if ( sc.isFailure() ){
88 log << MSG::FATAL << "Could not load MdcCalibFunSvc!" << endreq;
89 return digiRef;
90 }
91
92 //get event start time t0
93 SmartDataPtr<RecEsTimeCol> esTimeCol(evtSvc,"/Event/Recon/RecEsTimeCol");
94 if (!esTimeCol){
95 log << MSG::INFO<< " Could not retrieve RecEsTimeCol"<< endreq;
96 keepBadTdc = false;
97 }else if( (esTimeCol->size()==0)) {
98 log << MSG::INFO<< " Could not retrieve RecEsTimeCol"<< endreq;
99 keepBadTdc = false;
100 }else{
101 RecEsTimeCol::iterator iter= esTimeCol->begin();
102 for(; iter!=esTimeCol->end(); iter++){
103 t0 = (*iter)->getTest();
104 }
105 }//end esTimeCol
106 }
107
108 //----- mark hit on track
109 bool m_hitInUse[43][288];
110 for (int i=0; i<43; i++){
111 for (int j=0; j<288; j++) m_hitInUse[i][j]=false;
112 }
113 bool dropHot = ((control&b_dropHot)==0x4000);
114 if (dropHot){
115 SmartDataPtr<RecMdcHitCol> recHitCol(evtSvc, "/Event/Recon/RecMdcHitCol");
116 if (!recHitCol) {
117 log << MSG::INFO << "Could not retrieve RecMdcHitCol" << endreq;
118 dropHot = false;
119 }else{
120 RecMdcHitCol::iterator iter = recHitCol->begin();
121 for ( ; iter != recHitCol->end(); iter++) {
122 Identifier id = (*iter)->getMdcId();
123 m_hitInUse[MdcID::layer(id)][MdcID::wire(id)] = true;
124 }
125 }
126 }
127
128 //----- mark skipped layers
129 bool isSkipLayers = ((control&b_keepSkipped)!=0x8000) && (m_skipLayers.size()>0);
130
131 bool skipLayer[43];
132 for (int i=0; i<43; i++){skipLayer[i]= false;}
133 for(unsigned iSkip =0; iSkip < m_skipLayers.size(); iSkip++){
134 skipLayer[m_skipLayers[iSkip]]=true;
135 }
136
137 //----- loop MdcDigiCol to select------------------
138 int iDigi=0;
139 int nMatchedDigi=0;
140
141 SmartDataPtr<MdcDigiCol> mdcDigiCol(evtSvc,"/Event/Digi/MdcDigiCol");
142 if (sc!=StatusCode::SUCCESS) {
143 log << MSG::FATAL << "Could not find MdcDigiCol!" << endreq;
144 return digiRef;
145 }
146 MdcDigiCol::iterator iter = mdcDigiCol->begin();
147 for (;iter != mdcDigiCol->end(); iter++,iDigi++ ) {
148 MdcDigi *aDigi = (*iter);
149 Identifier id = aDigi->identify();
150 int layer = MdcID::layer(id);
151 int wire = MdcID::wire(id);
152 unsigned tdc = aDigi->getTimeChannel();
153 unsigned adc = aDigi->getChargeChannel();
154 unsigned overflow = aDigi->getOverflow();
155
156 //Give an adc threshold
157 if(m_adcThresholds.size()>0 && adc<m_adcThresholds[layer]) continue;
158
159 //--0. skip dead channel
160 if ( ((control&b_keepAllChannel)!=0x40000) && m_mdcCalibFunSvc
161 && m_mdcCalibFunSvc->getWireEff(layer,wire) < m_effThreshold) continue;
162
163 //--1. drop Mdc layer hits
164 if ( isSkipLayers && skipLayer[layer] ) continue;
165
166 //--2. drop hit on track
167 if ( dropHot && m_hitInUse[layer][wire]) continue;
168
169 //--3. drop unmatched, overflow and multi TDC
170 //overflow :
171 // 1, T overflow
172 // 2, Q overflow
173 // 4, multi TDC
174 // 8, multi TDC, earliest
175 if ( ((control&b_keepUnmatch)!=0x2000) &&
176 (((overflow & 1)>0) ||
177 (((overflow&12)!=12)&&((overflow&12)!=0)) ||
178 (tdc==0x7FFFFFFF) || (adc== 0x7FFFFFFF) ) ) { continue; }
179
180
181
182 //--4. drop bad hit(Tdc - t0 < -10 ns)
183 if (keepBadTdc) {
184 // Get T0
185 double T0Walk = 0.;
186 if (m_mdcCalibFunSvc) { T0Walk = m_mdcCalibFunSvc->getT0(layer,wire)
187 + m_mdcCalibFunSvc->getTimeWalk(layer,adc); }
188 if((RawDataUtil::MdcTime(tdc) - T0Walk - t0)<-10.) continue;
189 }
190
191 //--5. skip by max limit of digi number
192 nMatchedDigi++;
193 if ((maxMdcDigi>0) && (nMatchedDigi > maxMdcDigi)){
194 digiRef.clear();
195 return digiRef;
196 }
197
198 digiRef.push_back(aDigi);
199 }//end loop of MdcDigiCol
200 return digiRef;
201}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
std::vector< HoughRecHit > recHitCol
Definition Hough2D.h:22
virtual double getWireEff(int layid, int cellid) const =0
virtual double getT0(int layid, int cellid) const =0
virtual double getTimeWalk(int layid, double Q) const =0
unsigned int getOverflow() const
Definition MdcDigi.h:26
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
Definition MdcID.cxx:49
static int wire(const Identifier &id)
Definition MdcID.cxx:54
static double MdcTime(int timeChannel)
Definition RawDataUtil.h:8
virtual Identifier identify() const
Definition RawData.cxx:15
unsigned int getChargeChannel() const
Definition RawData.cxx:45
unsigned int getTimeChannel() const
Definition RawData.cxx:40

Referenced by RawDataProviderSvc::getMdcDigiVec().

◆ handle()

void MdcRawDataProvider::handle ( const Incident & inc)

Definition at line 49 of file MdcRawDataProvider.cxx.

49 {
50 MsgStream log( m_msgSvc, m_name );
51 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
52 if ( inc.type() == "BeginEvent" ){
53 digiRef.clear();
54 }
55 return;
56}

Referenced by RawDataProviderSvc::handle().

◆ initialize()

StatusCode MdcRawDataProvider::initialize ( ISvcLocator * svcLoc = 0,
IMessageSvc * pMsg = 0 )

Definition at line 44 of file MdcRawDataProvider.cxx.

44 {
45 RawDataProviderBase::initialize( pSvcLoc,pMsg );
46 return StatusCode::SUCCESS;
47}
StatusCode initialize(ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)

Referenced by RawDataProviderSvc::initialize().

◆ setAdcThresholds()

void MdcRawDataProvider::setAdcThresholds ( const std::vector< float > & adcThresholds)
inline

Definition at line 28 of file MdcRawDataProvider.h.

28{m_adcThresholds=adcThresholds;}

Referenced by RawDataProviderSvc::initialize().

◆ setEffThreshold()

void MdcRawDataProvider::setEffThreshold ( float effThreshold)
inline

Definition at line 27 of file MdcRawDataProvider.h.

27{m_effThreshold=effThreshold;}

Referenced by RawDataProviderSvc::initialize().

◆ setSkipLayers()

void MdcRawDataProvider::setSkipLayers ( const std::vector< int > & skipLayers)
inline

Definition at line 26 of file MdcRawDataProvider.h.

26{m_skipLayers=skipLayers;}

Referenced by RawDataProviderSvc::initialize().


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