BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
DQA_EMC Class Reference

#include <DQA_EMC.h>

+ Inheritance diagram for DQA_EMC:

Public Member Functions

 DQA_EMC (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 DQA_EMC (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Constructor & Destructor Documentation

◆ DQA_EMC() [1/2]

DQA_EMC::DQA_EMC ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 37 of file DQA_EMC.cxx.

37 :
38 Algorithm(name, pSvcLocator) {
39
40 //Declare the properties
41}

◆ DQA_EMC() [2/2]

DQA_EMC::DQA_EMC ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Member Function Documentation

◆ execute() [1/2]

StatusCode DQA_EMC::execute ( )

Definition at line 298 of file DQA_EMC.cxx.

298 {
299
300 MsgStream log(msgSvc(), name());
301 log << MSG::INFO << "in execute()" << endreq;
302
303 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
304 m_runNo=eventHeader->runNumber();
305 m_event=eventHeader->eventNumber();
306 log << MSG::DEBUG <<"run, evtnum = "
307 << m_runNo << " , "
308 << m_event <<endreq;
309
310
311 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
312
313 SmartDataPtr<DQAEvent::DQAEvent> dqaevt(eventSvc(), "/Event/DQATag");
314 if ( dqaevt ) {
315 log << MSG::INFO << "success get DQAEvent" << endreq;
316 } else {
317 log << MSG::ERROR << "Error accessing DQAEvent" << endreq;
318 return StatusCode::FAILURE;
319 }
320
321 log << MSG::DEBUG << "event tag = " << dqaevt->EventTag() << endreq;
322
323 // get the required control sample with DQA tag
324 if ( dqaevt->Bhabha() ) {
325 log << MSG::INFO << "Bhabha event" << endreq;
326 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
327
328
329 double eneShower,theta,phi,costheta;
330 RecEmcID showerId;
331 unsigned int npart;
332 int ntheta,nphi;
333 char Name[60];
334 std::string HistName;
335
336 for(int i = 0; i < evtRecEvent->totalCharged(); i++){
337 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
338
339 log << MSG::DEBUG << i << " " << (*itTrk)->partId() << " "
340 << (*itTrk)->quality() << endreq;
341 // get the required particle through the track's PID
342 // Pid: 1 - electron, 2 - muon, 3 - pion, 4 - kaon, 5 - proton
343 if ( (*itTrk)->partId() != 1 ) continue; // only e+, e-
344 // if you want to do dE/dx or TOF study, select track with no bias
345 // Quality: defined by whether dE/dx or TOF is used to identify particle
346 // 0 - no dE/dx, no TOF (can be used for dE/dx and TOF calibration)
347 // 1 - only dE/dx (can be used for TOF calibration)
348 // 2 - only TOF (can be used for dE/dx calibration)
349 // 3 - Both dE/dx and TOF
350 // int qual = (*itTrk)->quality();
351 // if ( qual != 0 && qual != 2) continue; // no dE/dx PID is used in selection
352// if ( qual != 0 && qual != 1) continue; // no TOF PID is used in the selection
353
354 RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack();
355 if ( mdcTrk->charge() > 0 ) {
356 log << MSG::DEBUG << "is electron" << endreq;
357 } else {
358 log << MSG::DEBUG << "is positron" << endreq;
359 }
360
361 if((*itTrk)->isEmcShowerValid()) {
362
363 RecEmcShower *theShower = (*itTrk)->emcShower();
364 eneShower=theShower->energy(); //corrected energy unit GeV
365 theta = theShower->theta();
366 phi= theShower->phi();
367 costheta=cos(theta);
368 showerId = theShower->getShowerId();
369
370 npart = EmcID::barrel_ec(showerId);
371
372 //The theta number is defined by Endcap_east(0-5),Barrel(0-43),Endcap_west(0-5)
373 //module is defined by Endcap_east(0),Barrel(1),Endcap_west(2)
374
375 ntheta=EmcID::theta_module(showerId);
376
377 nphi=EmcID::phi_module(showerId);
378
379 m_npart = npart;
380 m_ntheta = ntheta;
381 m_nphi = nphi;
382 m_ixtal=m_emcCalibConstSvc->getIndex(npart,ntheta,nphi);
383 m_theta = theta;
384 m_phi = phi;
385 m_emcX = theShower->x();
386 m_emcY = theShower->y();
387 m_eSeed = theShower->eSeed();
388 m_e5x5 = theShower->e5x5();
389 m_energy = theShower->energy();
390 m_time = theShower->time();
391
392 TH1 *hmom(0);
393
394
395
396 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_Time-T0");
397 HistName=Name;
398 if (m_thistsvc->getHist(HistName, hmom).isSuccess()) {
399 hmom->Fill(m_time);
400 } else {
401 log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
402 }
403
404 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ixtal");
405 HistName=Name;
406 if (m_thistsvc->getHist(HistName, hmom).isSuccess()) {
407 hmom->Fill(m_ixtal);
408 } else {
409 log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
410 }
411
412
413 m_eSeedIxtal->Fill(m_ixtal,m_eSeed);
414
415
416
417
418 if (npart==1){
419
420 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerEneBarrelVsEvent");
421 HistName=Name;
422 if (m_thistsvc->getHist(HistName, hmom).isSuccess()) {
423 hmom->Fill(eneShower);
424 } else {
425 log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
426 }
427
428 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerPhiBarrelVsEvent");
429 HistName=Name;
430 if (m_thistsvc->getHist(HistName, hmom ).isSuccess()) {
431 hmom->Fill(nphi);
432 } else {
433 log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
434 }
435
436 }
437
438 if (npart==0){
439
440 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerEneEastVsEvent");
441 HistName=Name;
442 if (m_thistsvc->getHist(HistName, hmom ).isSuccess()) {
443 hmom->Fill( eneShower);
444 } else {
445 log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
446 }
447
448 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerPhiEastVsEvent");
449 HistName=Name;
450 if (m_thistsvc->getHist(HistName, hmom ).isSuccess()) {
451 hmom->Fill(phi);
452 } else {
453 log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
454 }
455
456 m_XYeast->Fill(m_emcX,m_emcY);
457
458 }
459 if (npart==2){
460
461 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerEneWestVsEvent");
462 HistName=Name;
463 if (m_thistsvc->getHist(HistName, hmom ).isSuccess()) {
464 hmom->Fill( eneShower);
465 } else {
466 log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
467 }
468
469 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerPhiWestVsEvent");
470 HistName=Name;
471 if (m_thistsvc->getHist(HistName, hmom ).isSuccess()) {
472 hmom->Fill(phi);
473 } else {
474 log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
475 }
476
477 m_XYwest->Fill(m_emcX,m_emcY);
478
479 }
480
481 int m_nthe=-9;
482 if (npart==0){
483 m_nthe = ntheta;
484 }
485 if (npart==2){
486 m_nthe = 55-ntheta;
487 }
488 if (npart==1){
489 m_nthe = ntheta+6;
490 }
491
492 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerThetaVsvent");
493 HistName=Name;
494 if (m_thistsvc->getHist(HistName, hmom ).isSuccess()) {
495 hmom->Fill(m_nthe);
496 } else {
497 log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
498 }
499
500 sprintf( Name,"/DQAHist/EMC/EMC_Bhabha_ShowerCosTheta");
501 HistName=Name;
502 if (m_thistsvc->getHist(HistName, hmom ).isSuccess()) {
503 hmom->Fill(costheta);
504 } else {
505 log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
506 }
507
508// TH2 *hmom2(0);
509// sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerThetaPhi");
510// HistName=Name;
511// if (m_thistsvc->getHist(HistName, hmom2 ).isSuccess()) {
512// hmom2->Fill(phi,theta);
513// } else {
514// log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endreq;
515// }
516 m_ThetaPhi->Fill(phi, theta);
517
518 m_tuple->write();
519
520 }
521 }
522 }
523
524 return StatusCode::SUCCESS;
525
526}
double cos(const BesAngle a)
std::ostringstream Name
Definition: PartProduce.cc:22
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 int getIndex(unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const =0

◆ execute() [2/2]

StatusCode DQA_EMC::execute ( )

◆ finalize() [1/2]

StatusCode DQA_EMC::finalize ( )

Definition at line 529 of file DQA_EMC.cxx.

529 {
530
531 MsgStream log(msgSvc(), name());
532 log << MSG::INFO << "in finalize()" << endmsg;
533 return StatusCode::SUCCESS;
534}

◆ finalize() [2/2]

StatusCode DQA_EMC::finalize ( )

◆ initialize() [1/2]

StatusCode DQA_EMC::initialize ( )

Definition at line 44 of file DQA_EMC.cxx.

44 {
45 MsgStream log(msgSvc(), name());
46
47 log << MSG::INFO << "in initialize()" << endmsg;
48 StatusCode status;
49
50 // DQA
51 // The first directory specifier must be "DQAFILE"
52 // The second is the sub-system name: MDC, DEDX, TOF, EMC, MUC, TRG
53 // user can define more directory, such as DAQFILE/MDC/Bhabha.
54 NTuplePtr nt(ntupleSvc(), "DQAFILE/EMC");
55 if ( nt ) m_tuple = nt;
56 else {
57 m_tuple = ntupleSvc()->book("DQAFILE/EMC", CLID_ColumnWiseTuple, "EMC ntuple");
58 if( m_tuple ) {
59 status = m_tuple->addItem("ixtal", m_ixtal);
60 status = m_tuple->addItem("npart", m_npart);
61 status = m_tuple->addItem("ntheta",m_ntheta);
62 status = m_tuple->addItem("nphi", m_nphi);
63 status = m_tuple->addItem("theta", m_theta);
64 status = m_tuple->addItem("phi", m_phi);
65 status = m_tuple->addItem("emcX", m_emcX);
66 status = m_tuple->addItem("emcY", m_emcY);
67 status = m_tuple->addItem("eSeed", m_eSeed);
68 status = m_tuple->addItem("e5x5", m_e5x5);
69 status = m_tuple->addItem("energy",m_energy);
70 status = m_tuple->addItem("time", m_time);
71
72 } else {
73 log << MSG::ERROR << "Can not book N-tuple:" << long(m_tuple) << endreq;
74 }
75 }
76
77
78 if(service("THistSvc", m_thistsvc).isFailure()) {
79 log << MSG::ERROR << "Couldn't get THistSvc" << endreq;
80 return StatusCode::FAILURE;
81 }
82
83 char name[60];
84 char title[60];
85
86 std::string HistName0, HistName;
87 HistName0="/DQAHist/EMC/";
88
89 sprintf( name, "EMC_Bhabha_ShowerEneBarrelVsEvent");
90 sprintf( title, "EMC Bhabha ShowerEneBarrel vs event");
91
92 m_HistEnergyB =new TH1F(name,title,200,0.,2.0);
93 m_HistEnergyB->GetXaxis()->SetTitle("shower energy(GeV)");
94 m_HistEnergyB->GetXaxis()->CenterTitle();
95 m_HistEnergyB->GetYaxis()->SetTitle("Number of event");
96 m_HistEnergyB->GetYaxis()->CenterTitle();
97
98 HistName=HistName0+name;
99 if(m_thistsvc->regHist(HistName, m_HistEnergyB).isFailure()){
100 log << MSG::ERROR << "Couldn't register " <<name<< endreq;
101 }
102
103 sprintf( name, "EMC_Bhabha_ShowerEneEastVsEvent");
104 sprintf( title, "EMC Bhabha ShowerEneEast vs event");
105 m_HistEnergyEast =new TH1F(name,title,200,0.,2.0);
106 m_HistEnergyEast->GetXaxis()->SetTitle("shower energy(GeV)");
107 m_HistEnergyEast->GetXaxis()->CenterTitle();
108 m_HistEnergyEast->GetYaxis()->SetTitle("Number of event");
109 m_HistEnergyEast->GetYaxis()->CenterTitle();
110
111 HistName=HistName0+name;
112 if(m_thistsvc->regHist(HistName, m_HistEnergyEast).isFailure()){
113 log << MSG::ERROR << "Couldn't register "<<name << endreq;
114 }
115
116
117 sprintf( name, "EMC_Bhabha_ShowerEneWestVsEvent");
118 sprintf( title, "EMC Bhabha ShowerEneWest vs event");
119 m_HistEnergyWest =new TH1F(name,title,200,0.,2.0);
120 m_HistEnergyWest->GetXaxis()->SetTitle("shower energy(GeV)");
121 m_HistEnergyWest->GetXaxis()->CenterTitle();
122 m_HistEnergyWest->GetYaxis()->SetTitle("Number of event");
123 m_HistEnergyWest->GetYaxis()->CenterTitle();
124
125
126 HistName=HistName0+name;
127 if( m_thistsvc->regHist(HistName, m_HistEnergyWest).isFailure()){
128 log << MSG::ERROR << "Couldn't register "<<name << endreq;
129 }
130
131
132 sprintf( name, "EMC_Bhabha_ShowerThetaVsvent");
133 sprintf( title, "EMC Bhabha ShowerTheta vs event");
134 m_HistTheta =new TH1F(name,title,56, 0, 56);
135 m_HistTheta->GetXaxis()->SetTitle("shower ID(theta)");
136 m_HistTheta->GetXaxis()->CenterTitle();
137 m_HistTheta->GetYaxis()->SetTitle("Number of event");
138 m_HistTheta->GetYaxis()->CenterTitle();
139
140 HistName=HistName0+name;
141 if( m_thistsvc->regHist(HistName, m_HistTheta).isFailure()){
142 log << MSG::ERROR << "Couldn't register" <<name<< endreq;
143 }
144
145 sprintf(name,"EMC_Bhabha_ShowerCosTheta");
146 sprintf(title,"Emc Bhabha Costheta");
147 m_HistCosTheta =new TH1F(name,title,200, -1.0, 1.0);
148 m_HistCosTheta->GetXaxis()->SetTitle("shower cos(theta)");
149 m_HistCosTheta->GetXaxis()->CenterTitle();
150 m_HistCosTheta->GetYaxis()->SetTitle("Number of event");
151 m_HistCosTheta->GetYaxis()->CenterTitle();
152
153 HistName=HistName0+name;
154 if(m_thistsvc->regHist(HistName, m_HistCosTheta).isFailure()){
155 log << MSG::ERROR << "Couldn't register "<<name << endreq;
156 }
157
158
159 sprintf( name, "EMC_Bhabha_ShowerPhiBarrelVsEvent");
160 sprintf( title, "EMC Bhabha ShowerPhiBarrel vs event");
161 m_HistPhiB =new TH1F(name,title,120, 0, 120);
162 m_HistPhiB->GetXaxis()->SetTitle("shower ID(phi)");
163 m_HistPhiB->GetXaxis()->CenterTitle();
164 m_HistPhiB->GetYaxis()->SetTitle("Number of event");
165 m_HistPhiB->GetYaxis()->CenterTitle();
166
167
168 HistName=HistName0+name;
169 if( m_thistsvc->regHist(HistName, m_HistPhiB).isFailure()){
170 log << MSG::ERROR << "Couldn't register "<<name << endreq;
171 }
172
173 sprintf( name, "EMC_Bhabha_ShowerPhiEastVsEvent");
174 sprintf( title, "EMC Bhabha ShowerPhiEast vs event");
175 m_HistPhiEast =new TH1F(name,title,256, -3.14, 3.14);
176 m_HistPhiEast->GetXaxis()->SetTitle("shower phi(radian)");
177 m_HistPhiEast->GetXaxis()->CenterTitle();
178 m_HistPhiEast->GetYaxis()->SetTitle("Number of event");
179 m_HistPhiEast->GetYaxis()->CenterTitle();
180
181 HistName=HistName0+name;
182 if(m_thistsvc->regHist(HistName, m_HistPhiEast).isFailure()){
183 log << MSG::ERROR << "Couldn't register"<<name << endreq;
184 }
185
186 sprintf( name, "EMC_Bhabha_ShowerPhiWestVsEvent");
187 sprintf( title, "EMC Bhabha ShowerPhiWest vs event");
188 m_HistPhiWest =new TH1F(name,title,256, -3.14, 3.14);
189 m_HistPhiWest->GetXaxis()->SetTitle("shower phi(radian)");
190 m_HistPhiWest->GetXaxis()->CenterTitle();
191 m_HistPhiWest->GetYaxis()->SetTitle("Number of event");
192 m_HistPhiWest->GetYaxis()->CenterTitle();
193
194 HistName=HistName0+name;
195 if(m_thistsvc->regHist(HistName, m_HistPhiWest).isFailure()){
196 log << MSG::ERROR << "Couldn't register" <<name<<endreq;
197 }
198
199 sprintf( name, "EMC_Bhabha_ShowerThetaPhi");
200 sprintf( title, "EMC Bhabha ShowerThetaPhi");
201 m_ThetaPhi =new TH2F(name,"Theta versus Phi",
202 2000, -3.15, 3.15, 2000, 0.1, 3.0);
203 m_ThetaPhi->GetXaxis()->SetTitle("shower phi(radian)");
204 m_ThetaPhi->GetXaxis()->CenterTitle();
205 m_ThetaPhi->GetYaxis()->SetTitle("shower theta(radian)");
206 m_ThetaPhi->GetYaxis()->CenterTitle();
207
208 HistName=HistName0+name;
209 if(m_thistsvc->regHist(HistName, m_ThetaPhi).isFailure()){
210 log << MSG::ERROR << "Couldn't register" <<name<< endreq;
211 }
212
213
214 /////////////////////////////
215 sprintf( name, "EMC_Bhabha_Time-T0");
216 sprintf( title, "EMC Bhabha Time-T0 distribution");
217 m_HistTime =new TH1F(name,title,100, -40, 60);
218 m_HistTime->GetXaxis()->SetTitle("EmcTime-T0 (50ns)");
219 m_HistTime->GetXaxis()->CenterTitle();
220 m_HistTime->GetYaxis()->SetTitle("Number of event");
221 m_HistTime->GetYaxis()->CenterTitle();
222
223 HistName=HistName0+name;
224 if(m_thistsvc->regHist(HistName, m_HistTime).isFailure()){
225 log << MSG::ERROR << "Couldn't register" <<name<<endreq;
226 }
227
228 sprintf( name, "EMC_Bhabha_ixtal");
229 sprintf( title, "EMC Bhabha ixtal distribution");
230 m_HistHitMap =new TH1F(name,title,6240, 0, 6240);
231 m_HistHitMap->GetXaxis()->SetTitle("ixtalNumber");
232 m_HistHitMap->GetXaxis()->CenterTitle();
233 m_HistHitMap->GetYaxis()->SetTitle("Number of event");
234 m_HistHitMap->GetYaxis()->CenterTitle();
235
236 HistName=HistName0+name;
237 if(m_thistsvc->regHist(HistName, m_HistHitMap).isFailure()){
238 log << MSG::ERROR << "Couldn't register" <<name<<endreq;
239 }
240
241 sprintf( name, "EMC_Bhabha_eSeedvsIxtal ");
242 sprintf( title, "EMC Bhabha eSeed vs ixtal");
243 m_eSeedIxtal =new TH2F(name,"eSeed:Ixtal",
244 6240, 0, 6240, 2000, 0, 1.8);
245 m_eSeedIxtal->GetXaxis()->SetTitle("Ixtal)");
246 m_eSeedIxtal->GetXaxis()->CenterTitle();
247 m_eSeedIxtal->GetYaxis()->SetTitle("eSeed(GeV)");
248 m_eSeedIxtal->GetYaxis()->CenterTitle();
249
250 HistName=HistName0+name;
251 if(m_thistsvc->regHist(HistName, m_eSeedIxtal).isFailure()){
252 log << MSG::ERROR << "Couldn't register" <<name<< endreq;
253 }
254
255 sprintf( name, "EMC_Bhabha_emcX:emcYeast ");
256 sprintf( title, "EMC Bhabha emcX vs emcY of east endcap");
257 m_XYeast =new TH2F(name,"emcX:emcY",
258 2000, -100, 100, 2000, -100, 100);
259 m_XYeast->GetXaxis()->SetTitle("emcX");
260 m_XYeast->GetXaxis()->CenterTitle();
261 m_XYeast->GetYaxis()->SetTitle("emcY");
262 m_XYeast->GetYaxis()->CenterTitle();
263
264 HistName=HistName0+name;
265 if(m_thistsvc->regHist(HistName, m_XYeast).isFailure()){
266 log << MSG::ERROR << "Couldn't register" <<name<< endreq;
267 }
268
269 sprintf( name, "EMC_Bhabha_emcX:emcYwest ");
270 sprintf( title, "EMC Bhabha emcX vs emcY of west endcap");
271 m_XYwest =new TH2F(name,"emcX:emcY",
272 2000, -100, 100, 2000, -100, 100);
273 m_XYwest->GetXaxis()->SetTitle("emcX");
274 m_XYwest->GetXaxis()->CenterTitle();
275 m_XYwest->GetYaxis()->SetTitle("emcY");
276 m_XYwest->GetYaxis()->CenterTitle();
277
278 HistName=HistName0+name;
279 if(m_thistsvc->regHist(HistName, m_XYwest).isFailure()){
280 log << MSG::ERROR << "Couldn't register" <<name<< endreq;
281 }
282
283 // use EmcCalibConstSvc
284 StatusCode scCalib;
285 scCalib = Gaudi::svcLocator() -> service("EmcCalibConstSvc", m_emcCalibConstSvc);
286 if( scCalib != StatusCode::SUCCESS){
287 log << MSG::ERROR << "can not use EmcCalibConstSvc" << endreq;
288 }
289
290
291 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
292 return StatusCode::SUCCESS;
293
294
295}

◆ initialize() [2/2]

StatusCode DQA_EMC::initialize ( )

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