BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcCalibConstSvc Class Reference

#include <EmcCalibConstSvc.h>

+ Inheritance diagram for EmcCalibConstSvc:

Public Member Functions

 EmcCalibConstSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~EmcCalibConstSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
double getDigiCalibConst (int No) const
 
int getIxtalNumber (int No) const
 
int getDigiCalibConstNo () const
 
int getIxtalNumberNo () const
 
int getIndex (unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const
 
unsigned int getPartID (int Index) const
 
unsigned int getThetaIndex (int Index) const
 
unsigned int getPhiIndex (int Index) const
 
double getCrystalEmaxData (int Index) const
 
void setCrystalEmaxData (double CrystalEmaxData[6240])
 
double getCrystalDeadEcut (int Index) const
 
void setCrystalDeadEcut (double CrystalDeadEcut[6240])
 
void Dump ()
 
virtual double getDigiCalibConst (int No) const =0
 
virtual int getIxtalNumber (int No) const =0
 
virtual int getDigiCalibConstNo () const =0
 
virtual int getIxtalNumberNo () const =0
 
virtual int getIndex (unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const =0
 
virtual unsigned int getPartID (int Index) const =0
 
virtual unsigned int getThetaIndex (int Index) const =0
 
virtual unsigned int getPhiIndex (int Index) const =0
 
virtual double getCrystalEmaxData (int Index) const =0
 
virtual double getCrystalDeadEcut (int Index) const =0
 
virtual void Dump ()=0
 

Public Attributes

IDataProviderSvc * m_calDataSvc
 
EmcStructurem_theEmcStruc
 
double m_CrystalEmaxData [6240]
 
double m_CrystalEmaxData_1 [6240]
 
double m_CrystalEmaxData_2 [6240]
 
double m_CrystalDeadEcut [6240]
 
double m_CrystalDeadEcut_2020 [6240]
 
bool m_EmaxVersion1
 
bool m_EmaxVersion2
 
bool m_DeadEcutVersion2020
 
- Public Attributes inherited from IEmcCalibConstSvc
EmcStructurem_theEmcStruc
 
double m_CrystalEmaxData [6240]
 

Additional Inherited Members

- Static Public Member Functions inherited from IEmcCalibConstSvc
static const InterfaceID & interfaceID ()
 

Detailed Description

Definition at line 14 of file EmcCalibConstSvc.h.

Constructor & Destructor Documentation

◆ EmcCalibConstSvc()

EmcCalibConstSvc::EmcCalibConstSvc ( const std::string &  name,
ISvcLocator *  svcloc 
)

for version 1/////////

Definition at line 34 of file EmcCalibConstSvc.cxx.

34 :
35 Service (name, svcloc) {
36
37 m_EmaxVersion1=false;
38 m_EmaxVersion2=false;
40
41 for(int i=0;i<6240;i++){
47 }
48
49 int ixtal;
50 double emaxData;
51 int Nixt=0;
52
53 ///for version 1/////////
54 string paraPath = getenv("EMCCALIBCONSTSVCROOT");
55 paraPath += "/share/emax_data.dat"; // version=1
56 ifstream in;
57 in.open(paraPath.c_str());
58 assert(in);
59
60 while (in.peek() != EOF)
61 {
62
63 in >> ixtal>>emaxData;
64
65 m_CrystalEmaxData_1[ixtal]=emaxData;
66 Nixt++;
67 // cout<<"readFile==============="<<emaxData<<endl;
68 }
69
70 in.close();
71
72
73 ////version 2///////////
74 string paraPath2 = getenv("EMCCALIBCONSTSVCROOT");
75 paraPath2 += "/share/emax_data_2.dat"; // version=2
76
77 ifstream in2;
78 in2.open(paraPath2.c_str());
79 assert(in2);
80
81 Nixt=0;
82 while (in2.peek() != EOF)
83 {
84
85 in2 >> ixtal>>emaxData;
86
87 m_CrystalEmaxData_2[ixtal]=emaxData;
88
89 Nixt++;
90 // cout<<"readFile2==============="<<emaxData<<endl;
91 }
92
93 in2.close();
94
95 ////read dead channel energy threshould Ecut///////////
96 string paraPath3 = getenv("EMCCALIBCONSTSVCROOT");
97 paraPath3 += "/share/DeadThresholdEcut_2020.conf";
98
99 ifstream in3;
100 in3.open(paraPath3.c_str());
101 assert(in3);
102
103 Nixt=0;
104 double satuEn,Ecut;
105 double DeltaEcut=0.0;
106
107 while (in3.peek() != EOF)
108 {
109
110 in3 >> ixtal>>satuEn>>Ecut;
111 if ((Ecut-satuEn)>DeltaEcut) {
112 m_CrystalDeadEcut_2020[ixtal]=Ecut-DeltaEcut;
113 } else {
114 m_CrystalDeadEcut_2020[ixtal]=Ecut;
115 }
116 Nixt++;
117
118 }
119
120 in3.close();
121
122}
double m_CrystalDeadEcut_2020[6240]
double m_CrystalEmaxData_2[6240]
double m_CrystalEmaxData[6240]
double m_CrystalEmaxData_1[6240]
double m_CrystalDeadEcut[6240]
std::ifstream ifstream
Definition: bpkt_streams.h:44

◆ ~EmcCalibConstSvc()

EmcCalibConstSvc::~EmcCalibConstSvc ( )

Definition at line 124 of file EmcCalibConstSvc.cxx.

124 {
125
126}

Member Function Documentation

◆ Dump()

void EmcCalibConstSvc::Dump ( )
virtual

Implements IEmcCalibConstSvc.

Definition at line 348 of file EmcCalibConstSvc.cxx.

349{
350 /*
351 for(int iNo=0;iNo<6;iNo++){
352 cout<<"getDigiCalibConst "<<getDigiCalibConst(iNo)<<endl;
353 }
354
355 cout<<"getDigiCalibConstNo "<<getDigiCalibConstNo()<<endl;
356
357
358 cout<<"ind"<<" "<<"getThetaIndex(ind)"<<" "
359 <<"getPhiIndex(ind)"<<"getPartID"<<endl;
360
361 for(int ind=0; ind<6240;ind++){
362
363 cout<<ind<<" "<<getThetaIndex(ind)<<" "
364 <<getPhiIndex(ind)<<" "<<getPartID(ind)<<endl;
365
366 }
367
368 cout<<"getIndex(0,5,95)="<<getIndex(0,5,95)<<endl;
369 cout<<"getIndex(1,43,119)="<<getIndex(1,43,119)<<endl;
370 cout<<"getIndex(2,5,95)="<<getIndex(2,5,95)<<endl;
371 cout<<"getIndex(0,5,96)="<<getIndex(0,5,96)<<endl;
372 cout<<"getIndex(1,43,120)="<<getIndex(1,43,120)<<endl;
373 cout<<"getIndex(2,5,96)="<<getIndex(2,5,96)<<endl;
374 */
375 for(int i=0;i<6240;i++){
376 cout<<i<<"\t"<<getCrystalEmaxData(i) <<endl;
377 }
378
379
380}
double getCrystalEmaxData(int Index) const

◆ finalize()

StatusCode EmcCalibConstSvc::finalize ( )
virtual

Definition at line 178 of file EmcCalibConstSvc.cxx.

178 {
179
180 delete m_theEmcStruc;
181
182 MsgStream log(messageService(), name());
183 log << MSG::INFO << "EmcCalibConstSvc::finalize()" << endreq;
184 return StatusCode::SUCCESS;
185
186}
EmcStructure * m_theEmcStruc

◆ getCrystalDeadEcut()

double EmcCalibConstSvc::getCrystalDeadEcut ( int  Index) const
virtual

Implements IEmcCalibConstSvc.

Definition at line 342 of file EmcCalibConstSvc.cxx.

343{
344 return m_CrystalDeadEcut[Index];
345}

◆ getCrystalEmaxData()

double EmcCalibConstSvc::getCrystalEmaxData ( int  Index) const
virtual

Implements IEmcCalibConstSvc.

Definition at line 337 of file EmcCalibConstSvc.cxx.

338{
339 return m_CrystalEmaxData[Index];
340}

Referenced by Dump().

◆ getDigiCalibConst()

double EmcCalibConstSvc::getDigiCalibConst ( int  No) const
virtual

Implements IEmcCalibConstSvc.

Definition at line 242 of file EmcCalibConstSvc.cxx.

243 {
244 double digiCalibConst = 0.0;
245 MsgStream log(messageService(), name());
246
247 std::string fullPath = "/Calib/EmcCal";
248 SmartDataPtr<CalibData::EmcCalibData> calConst(m_calDataSvc, fullPath);
249 if( ! calConst ){
250 log << MSG::ERROR << "can not access to EmcDigi CalibData via SmartPtr"
251 << endreq;
252 }else {
253 digiCalibConst = calConst->getDigiCalibConst(No);
254 }
255
256 return digiCalibConst;
257}
IDataProviderSvc * m_calDataSvc

◆ getDigiCalibConstNo()

int EmcCalibConstSvc::getDigiCalibConstNo ( ) const
virtual

Implements IEmcCalibConstSvc.

Definition at line 276 of file EmcCalibConstSvc.cxx.

277 {
278 int digiCalibConstNo = 0;
279 MsgStream log(messageService(), name());
280
281 std::string fullPath = "/Calib/EmcCal";
282 SmartDataPtr<CalibData::EmcCalibData> calConst(m_calDataSvc, fullPath);
283 if( ! calConst ){
284 log << MSG::ERROR << "can not access to EmcDigiNo CalibData via SmartPtr"
285 << endreq;
286 }else {
287 digiCalibConstNo = calConst->getDigiCalibConstNo();
288 }
289
290 return digiCalibConstNo;
291}

◆ getIndex()

int EmcCalibConstSvc::getIndex ( unsigned int  PartId,
unsigned int  ThetaIndex,
unsigned int  PhiIndex 
) const
virtual

Implements IEmcCalibConstSvc.

Definition at line 312 of file EmcCalibConstSvc.cxx.

315{
316 return m_theEmcStruc->getGeomIndex(PartId, ThetaIndex, PhiIndex);
317}
int getGeomIndex(unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const

◆ getIxtalNumber()

int EmcCalibConstSvc::getIxtalNumber ( int  No) const
virtual

Implements IEmcCalibConstSvc.

Definition at line 259 of file EmcCalibConstSvc.cxx.

260 {
261 int IxtalNumber = 999999;
262 MsgStream log(messageService(), name());
263
264 std::string fullPath = "/Calib/EmcCal";
265 SmartDataPtr<CalibData::EmcCalibData> calConst(m_calDataSvc, fullPath);
266 if( ! calConst ){
267 log << MSG::ERROR << "can not access to EmcDigi CalibData via SmartPtr"
268 << endreq;
269 }else {
270 IxtalNumber = calConst->getIxtalNumber(No);
271 }
272
273 return IxtalNumber;
274}

◆ getIxtalNumberNo()

int EmcCalibConstSvc::getIxtalNumberNo ( ) const
virtual

Implements IEmcCalibConstSvc.

Definition at line 293 of file EmcCalibConstSvc.cxx.

294 {
295 int IxtalNumberNo = 0;
296 MsgStream log(messageService(), name());
297
298 std::string fullPath = "/Calib/EmcCal";
299 SmartDataPtr<CalibData::EmcCalibData> calConst(m_calDataSvc, fullPath);
300 if( ! calConst ){
301 log << MSG::ERROR << "can not access to EmcDigiNo CalibData via SmartPtr"
302 << endreq;
303 }else {
304 IxtalNumberNo = calConst->getIxtalNumberNo();
305 }
306
307 return IxtalNumberNo;
308}

◆ getPartID()

unsigned int EmcCalibConstSvc::getPartID ( int  Index) const
virtual

Implements IEmcCalibConstSvc.

Definition at line 320 of file EmcCalibConstSvc.cxx.

321{
322 return m_theEmcStruc->getPartId(Index);
323}
unsigned int getPartId(long Index) const
Definition: EmcStructure.h:35

◆ getPhiIndex()

unsigned int EmcCalibConstSvc::getPhiIndex ( int  Index) const
virtual

Implements IEmcCalibConstSvc.

Definition at line 330 of file EmcCalibConstSvc.cxx.

331{
332 return m_theEmcStruc->getPhi(Index);
333}
unsigned int getPhi(long Index) const
Definition: EmcStructure.h:37

◆ getThetaIndex()

unsigned int EmcCalibConstSvc::getThetaIndex ( int  Index) const
virtual

Implements IEmcCalibConstSvc.

Definition at line 325 of file EmcCalibConstSvc.cxx.

326{
327 return m_theEmcStruc->getTheta(Index);
328}
unsigned int getTheta(long Index) const
Definition: EmcStructure.h:36

◆ handle()

void EmcCalibConstSvc::handle ( const Incident &  inc)

Definition at line 188 of file EmcCalibConstSvc.cxx.

188 {
189 MsgStream log( messageService(), name() );
190 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
191
192
193
194 if ( inc.type() == "NewRun" ){
195 log << MSG::DEBUG << "NewRun" << endreq;
196
197
198 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader");
199 int run = eventHeader->runNumber();
200 //cout<<"&&&&&&&&&&&&&&:&&&&&&&&&&&&&&&&&&&& EmcCalibConstSvc handle,run="<<run<<endl;
201 if (run<0) run = -run;
202
203
204 log << MSG::DEBUG << "handle: " <<"Run in handle is: "<<run<< endreq;
205 //run <63075: EmaxVersion=1; run>=63075: EmaxVersion=2;
206 cout<< "handle: " <<"Run in handle is: "<<run<<endl;
207 if (run<63075&& !m_EmaxVersion1) {
209 m_EmaxVersion1=true;
210 m_EmaxVersion2=false;
211
212
213 cout<< "handle: " <<"EmaxVersion="<<"111111111111111"<<endl;
214 }
215
216
217 if (run>=63075&& !m_EmaxVersion2) {
219 m_EmaxVersion2=true;
220 m_EmaxVersion1=false;
221 cout<< "handle: " <<"EmaxVersion="<<"222222222222"<<endl;
222 }
223
224 if (run>=63075&&run<=65092&&!m_DeadEcutVersion2020){
227 cout<< "handle: " <<"DeadEcutVersion="<<"2020"<<endl;
228 }
229
230 //if(!getCrystalEmaxDataFileInfo()){
231 // log << MSG::ERROR << "can not find the crystal EmaxData file" << endreq;
232 //}
233
234 // Dump();
235 }
236
237
238}
void setCrystalDeadEcut(double CrystalDeadEcut[6240])
void setCrystalEmaxData(double CrystalEmaxData[6240])

◆ initialize()

StatusCode EmcCalibConstSvc::initialize ( )
virtual

Definition at line 137 of file EmcCalibConstSvc.cxx.

137 {
138 MsgStream log(messageService(), name());
139 log << MSG::INFO << "EmcCalibConstSvc::initialize()" << endreq;
140
141 StatusCode sc = Service::initialize();
142 if( sc.isFailure() ) return sc;
143
144
145 IIncidentSvc* incsvc;
146 sc = service("IncidentSvc", incsvc);
147 int priority = 100;
148 if( sc.isSuccess() ){
149 incsvc -> addListener(this, "NewRun", priority);
150 }
151
152 sc = serviceLocator()->service("EventDataSvc", m_eventSvc, true);
153 if (sc .isFailure() ) {
154 log << MSG::ERROR << "Unable to find EventDataSvc " << endreq;
155 return sc;
156 }
157
158 sc = service("CalibDataSvc", m_calDataSvc, true);
159 if( sc == StatusCode::SUCCESS ){
160 log << MSG::INFO << "Retrieve IDataProviderSvc" << endreq;
161 }else{
162 log << MSG::FATAL << "can not get IDataProviderSvc" << endreq;
163 }
164
165 // sc = service("EmcRecGeoSvc", m_emcGeomSvc);
166 // if( sc != StatusCode::SUCCESS ){
167 // log << MSG::ERROR << "can not use EmcRecGeoSvc" << endreq;
168 // }
169
172
173 //Dump();
174 //cout<<"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& EmcCalibConstSvc initialize"<<endl;
175 return StatusCode::SUCCESS;
176}
void setEmcStruc()

◆ queryInterface()

StatusCode EmcCalibConstSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvUnknown 
)
virtual

Definition at line 128 of file EmcCalibConstSvc.cxx.

128 {
129 if( IID_IEmcCalibConstSvc.versionMatch(riid) ){
130 *ppvInterface = static_cast<IEmcCalibConstSvc*> (this);
131 } else{
132 return Service::queryInterface(riid, ppvInterface);
133 }
134 return StatusCode::SUCCESS;
135}

◆ setCrystalDeadEcut()

void EmcCalibConstSvc::setCrystalDeadEcut ( double  CrystalDeadEcut[6240])
inline

Definition at line 59 of file EmcCalibConstSvc.h.

60 {
61 for(int i=0;i<6240;i++){
62 m_CrystalDeadEcut[i]=CrystalDeadEcut[i];
63
64 }
65 };

Referenced by handle().

◆ setCrystalEmaxData()

void EmcCalibConstSvc::setCrystalEmaxData ( double  CrystalEmaxData[6240])
inline

Definition at line 49 of file EmcCalibConstSvc.h.

50 {
51 for(int i=0;i<6240;i++){
52 m_CrystalEmaxData[i]=CrystalEmaxData[i];
53
54 }
55 };

Referenced by handle().

Member Data Documentation

◆ m_calDataSvc

IDataProviderSvc* EmcCalibConstSvc::m_calDataSvc

◆ m_CrystalDeadEcut

double EmcCalibConstSvc::m_CrystalDeadEcut[6240]

Definition at line 75 of file EmcCalibConstSvc.h.

Referenced by EmcCalibConstSvc(), getCrystalDeadEcut(), and setCrystalDeadEcut().

◆ m_CrystalDeadEcut_2020

double EmcCalibConstSvc::m_CrystalDeadEcut_2020[6240]

Definition at line 76 of file EmcCalibConstSvc.h.

Referenced by EmcCalibConstSvc(), and handle().

◆ m_CrystalEmaxData

double EmcCalibConstSvc::m_CrystalEmaxData[6240]

Definition at line 72 of file EmcCalibConstSvc.h.

Referenced by EmcCalibConstSvc(), getCrystalEmaxData(), and setCrystalEmaxData().

◆ m_CrystalEmaxData_1

double EmcCalibConstSvc::m_CrystalEmaxData_1[6240]

Definition at line 73 of file EmcCalibConstSvc.h.

Referenced by EmcCalibConstSvc(), and handle().

◆ m_CrystalEmaxData_2

double EmcCalibConstSvc::m_CrystalEmaxData_2[6240]

Definition at line 74 of file EmcCalibConstSvc.h.

Referenced by EmcCalibConstSvc(), and handle().

◆ m_DeadEcutVersion2020

bool EmcCalibConstSvc::m_DeadEcutVersion2020

Definition at line 80 of file EmcCalibConstSvc.h.

Referenced by EmcCalibConstSvc(), and handle().

◆ m_EmaxVersion1

bool EmcCalibConstSvc::m_EmaxVersion1

Definition at line 78 of file EmcCalibConstSvc.h.

Referenced by EmcCalibConstSvc(), and handle().

◆ m_EmaxVersion2

bool EmcCalibConstSvc::m_EmaxVersion2

Definition at line 79 of file EmcCalibConstSvc.h.

Referenced by EmcCalibConstSvc(), and handle().

◆ m_theEmcStruc

EmcStructure* EmcCalibConstSvc::m_theEmcStruc

Definition at line 71 of file EmcCalibConstSvc.h.

Referenced by finalize(), getIndex(), getPartID(), getPhiIndex(), getThetaIndex(), and initialize().


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