BOSS 8.0.0
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 ()

Detailed Description

Definition at line 26 of file DQA_EMC.h.

Constructor & Destructor Documentation

◆ DQA_EMC()

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

Definition at line 18 of file DQA_EMC.cxx.

19 : Algorithm( name, pSvcLocator ) {
20
21 // Declare the properties
22 declareProperty( "NtupleOutput", m_NtupleOutput = 0 );
23}

Referenced by DQA_EMC().

Member Function Documentation

◆ execute()

StatusCode DQA_EMC::execute ( )

Definition at line 252 of file DQA_EMC.cxx.

252 {
253
254 MsgStream log( msgSvc(), name() );
255 log << MSG::INFO << "in execute()" << endmsg;
256
257 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
258 m_runNo = eventHeader->runNumber();
259 m_event = eventHeader->eventNumber();
260 log << MSG::DEBUG << "run, evtnum = " << m_runNo << " , " << m_event << endmsg;
261
262 SmartDataPtr<EvtRecEvent> evtRecEvent( eventSvc(), EventModel::EvtRec::EvtRecEvent );
263
264 SmartDataPtr<DQAEvent::DQAEvent> dqaevt( eventSvc(), "/Event/DQATag" );
265 if ( dqaevt ) { log << MSG::INFO << "success get DQAEvent" << endmsg; }
266 else
267 {
268 log << MSG::ERROR << "Error accessing DQAEvent" << endmsg;
269 return StatusCode::FAILURE;
270 }
271
272 log << MSG::DEBUG << "event tag = " << dqaevt->EventTag() << endmsg;
273
274 // get the required control sample with DQA tag
275 if ( dqaevt->Bhabha() )
276 {
277 log << MSG::INFO << "Bhabha event" << endmsg;
278 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol( eventSvc(),
280
281 double eneShower, theta, phi, costheta;
282 RecEmcID showerId;
283 unsigned int npart;
284 int ntheta, nphi;
285 char Name[60];
286 std::string HistName;
287
288 for ( int i = 0; i < evtRecEvent->totalCharged(); i++ )
289 {
290 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + i;
291
292 log << MSG::DEBUG << i << " " << ( *itTrk )->partId() << " " << ( *itTrk )->quality()
293 << endmsg;
294 // get the required particle through the track's PID
295 // Pid: 1 - electron, 2 - muon, 3 - pion, 4 - kaon, 5 - proton
296 // if ( (*itTrk)->partId() != 1 ) continue; // only e+, e-
297 if ( !( *itTrk )->isElectron() ) continue;
298 // if you want to do dE/dx or TOF study, select track with no bias
299 // Quality: defined by whether dE/dx or TOF is used to identify particle
300 // 0 - no dE/dx, no TOF (can be used for dE/dx and TOF calibration)
301 // 1 - only dE/dx (can be used for TOF calibration)
302 // 2 - only TOF (can be used for dE/dx calibration)
303 // 3 - Both dE/dx and TOF
304 // int qual = (*itTrk)->quality();
305 // if ( qual != 0 && qual != 2) continue; // no dE/dx PID is used in selection
306 // if ( qual != 0 && qual != 1) continue; // no TOF PID is used in the selection
307
308 RecMdcTrack* mdcTrk = ( *itTrk )->mdcTrack();
309 if ( mdcTrk->charge() > 0 ) { log << MSG::DEBUG << "is electron" << endmsg; }
310 else { log << MSG::DEBUG << "is positron" << endmsg; }
311
312 if ( ( *itTrk )->isEmcShowerValid() )
313 {
314
315 RecEmcShower* theShower = ( *itTrk )->emcShower();
316 eneShower = theShower->energy(); // corrected energy unit GeV
317 theta = theShower->theta();
318 phi = theShower->phi();
319 costheta = cos( theta );
320 // showerId = theShower->getShowerId(); // only in the rec data file
321 showerId = RecEmcID( theShower->cellId() );
322
323 npart = EmcID::barrel_ec( showerId );
324
325 // The theta number is defined by Endcap_east(0-5),Barrel(0-43),Endcap_west(0-5)
326 // module is defined by Endcap_east(0),Barrel(1),Endcap_west(2)
327
328 ntheta = EmcID::theta_module( showerId );
329
330 nphi = EmcID::phi_module( showerId );
331 log << MSG::DEBUG << "test program " << npart << " " << ntheta << " " << nphi
332 << endmsg;
333
334 m_npart = npart;
335 m_ntheta = ntheta;
336 m_nphi = nphi;
337 m_ixtal = m_emcCalibConstSvc->getIndex( npart, ntheta, nphi );
338 m_theta = theta;
339 m_phi = phi;
340 m_emcX = theShower->x();
341 m_emcY = theShower->y();
342 m_eSeed = theShower->eSeed();
343 m_e5x5 = theShower->e5x5();
344 m_energy = theShower->energy();
345 m_time = theShower->time();
346
347 TH1* hmom( 0 );
348
349 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_Time-T0" );
350 HistName = Name;
351 if ( m_thistsvc->getHist( HistName, hmom ).isSuccess() ) { hmom->Fill( m_time ); }
352 else { log << MSG::ERROR << "Couldn't retrieve" << HistName << endmsg; }
353
354 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ixtal" );
355 HistName = Name;
356 if ( m_thistsvc->getHist( HistName, hmom ).isSuccess() ) { hmom->Fill( m_ixtal ); }
357 else { log << MSG::ERROR << "Couldn't retrieve" << HistName << endmsg; }
358
359 m_eSeedIxtal->Fill( m_ixtal, m_eSeed );
360
361 if ( npart == 1 )
362 {
363
364 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerEneBarrelVsEvent" );
365 HistName = Name;
366 if ( m_thistsvc->getHist( HistName, hmom ).isSuccess() ) { hmom->Fill( eneShower ); }
367 else { log << MSG::ERROR << "Couldn't retrieve" << HistName << endmsg; }
368
369 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerPhiBarrelVsEvent" );
370 HistName = Name;
371 if ( m_thistsvc->getHist( HistName, hmom ).isSuccess() ) { hmom->Fill( nphi ); }
372 else { log << MSG::ERROR << "Couldn't retrieve" << HistName << endmsg; }
373 }
374
375 if ( npart == 0 )
376 {
377
378 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerEneEastVsEvent" );
379 HistName = Name;
380 if ( m_thistsvc->getHist( HistName, hmom ).isSuccess() ) { hmom->Fill( eneShower ); }
381 else { log << MSG::ERROR << "Couldn't retrieve" << HistName << endmsg; }
382
383 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerPhiEastVsEvent" );
384 HistName = Name;
385 if ( m_thistsvc->getHist( HistName, hmom ).isSuccess() ) { hmom->Fill( phi ); }
386 else { log << MSG::ERROR << "Couldn't retrieve" << HistName << endmsg; }
387
388 m_XYeast->Fill( m_emcX, m_emcY );
389 }
390 if ( npart == 2 )
391 {
392
393 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerEneWestVsEvent" );
394 HistName = Name;
395 if ( m_thistsvc->getHist( HistName, hmom ).isSuccess() ) { hmom->Fill( eneShower ); }
396 else { log << MSG::ERROR << "Couldn't retrieve" << HistName << endmsg; }
397
398 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerPhiWestVsEvent" );
399 HistName = Name;
400 if ( m_thistsvc->getHist( HistName, hmom ).isSuccess() ) { hmom->Fill( phi ); }
401 else { log << MSG::ERROR << "Couldn't retrieve" << HistName << endmsg; }
402
403 m_XYwest->Fill( m_emcX, m_emcY );
404 }
405
406 int m_nthe = -9;
407 if ( npart == 0 ) { m_nthe = ntheta; }
408 if ( npart == 2 ) { m_nthe = 55 - ntheta; }
409 if ( npart == 1 ) { m_nthe = ntheta + 6; }
410
411 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerThetaVsvent" );
412 HistName = Name;
413 if ( m_thistsvc->getHist( HistName, hmom ).isSuccess() ) { hmom->Fill( m_nthe ); }
414 else { log << MSG::ERROR << "Couldn't retrieve" << HistName << endmsg; }
415
416 sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerCosTheta" );
417 HistName = Name;
418 if ( m_thistsvc->getHist( HistName, hmom ).isSuccess() ) { hmom->Fill( costheta ); }
419 else { log << MSG::ERROR << "Couldn't retrieve" << HistName << endmsg; }
420
421 // TH2 *hmom2(0);
422 // sprintf( Name, "/DQAHist/EMC/EMC_Bhabha_ShowerThetaPhi");
423 // HistName=Name;
424 // if (m_thistsvc->getHist(HistName, hmom2 ).isSuccess()) {
425 // hmom2->Fill(phi,theta);
426 // } else {
427 // log << MSG::ERROR << "Couldn't retrieve" <<HistName<< endmsg;
428 // }
429 m_ThetaPhi->Fill( phi, theta );
430
431 if ( m_NtupleOutput == 1 ) m_tuple->write().ignore();
432 }
433 }
434 }
435
436 return StatusCode::SUCCESS;
437}
sprintf(cut, "kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_" "pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
EvtRecTrackCol::iterator EvtRecTrackIterator
std::ostringstream Name
IMessageSvc * msgSvc()
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0).
Definition EmcID.cxx:36
static unsigned int theta_module(const Identifier &id)
Definition EmcID.cxx:41
static unsigned int phi_module(const Identifier &id)
Definition EmcID.cxx:46

◆ finalize()

StatusCode DQA_EMC::finalize ( )

Definition at line 440 of file DQA_EMC.cxx.

440 {
441
442 MsgStream log( msgSvc(), name() );
443 log << MSG::INFO << "in finalize()" << endmsg;
444 return StatusCode::SUCCESS;
445}

◆ initialize()

StatusCode DQA_EMC::initialize ( )

Definition at line 26 of file DQA_EMC.cxx.

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

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