BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcAliEvent.cxx
Go to the documentation of this file.
2
3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/IMessageSvc.h"
5#include "GaudiKernel/StatusCode.h"
6#include "GaudiKernel/ISvcLocator.h"
7#include "GaudiKernel/Bootstrap.h"
8#include "GaudiKernel/SmartDataPtr.h"
9#include "GaudiKernel/IDataProviderSvc.h"
10#include "GaudiKernel/PropertyMgr.h"
11
14
15#include "EventModel/Event.h"
17#include "EventModel/Event.h"
18
21
27
29#include "Identifier/MdcID.h"
30
31#include <iostream>
32#include <math.h>
33
34using namespace Event;
35
37 IMessageSvc *msgSvc;
38 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
39 MsgStream log(msgSvc, "MdcAliEvent");
40 log << MSG::INFO << "MdcAliEvent::setRecEvent" << endreq;
41
42 IDataProviderSvc* eventSvc = NULL;
43 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
44
45 // get EsTimeCol
46 SmartDataPtr<RecEsTimeCol> aevtimeCol(eventSvc,"/Event/Recon/RecEsTimeCol");
47 if( ! aevtimeCol || (aevtimeCol->size()==0) ){
48 m_tes = -9999.0;
49 m_esFlag = -1;
50 }else{
51 RecEsTimeCol::iterator iter_evt = aevtimeCol->begin();
52 for(; iter_evt!=aevtimeCol->end(); iter_evt++){
53 m_tes = (*iter_evt)->getTest();
54 m_esFlag = (*iter_evt)->getStat();
55 }
56 }
57
58 m_esCutFg = false;
59 bool flagTes = false;
60 for(int iEs=0; iEs<m_param.nEsFlag; iEs++){
61 if(m_esFlag == m_param.esFlag[iEs]){
62 flagTes = true;
63 break;
64 }
65 }
66 if( flagTes && (m_tes > m_param.tesMin) && (m_tes < m_param.tesMax) ) m_esCutFg = true;
67
68 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc, "/Event/Recon/RecMdcTrackCol");
69 if(!newtrkCol){
70 log << MSG::ERROR << "Could not find RecMdcTrackCol" << endreq;
71 return ( StatusCode::FAILURE );
72 }
73
74 int i = 0;
75 MdcAliRecTrk* rectrk;
76 RecMdcTrackCol::iterator it_trk = newtrkCol->begin();
77 for(; it_trk != newtrkCol->end(); it_trk++){
78 rectrk = new MdcAliRecTrk();
79 rectrk -> setRecTrk(it_trk);
80 m_rectrk.push_back(rectrk);
81
82 i++;
83 }
84
85 return StatusCode::SUCCESS;
86}
87
89 IMessageSvc *msgSvc;
90 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
91 MsgStream log(msgSvc, "MdcAliEvent");
92 log << MSG::INFO << "MdcAliEvent::setKalEvent" << endreq;
93
94 IDataProviderSvc* eventSvc = NULL;
95 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
96
97 // get EsTimeCol
98 SmartDataPtr<RecEsTimeCol> aevtimeCol(eventSvc,"/Event/Recon/RecEsTimeCol");
99 if( ! aevtimeCol || (aevtimeCol->size()==0) ){
100 m_tes = -9999.0;
101 m_esFlag = -1;
102 }else{
103 RecEsTimeCol::iterator iter_evt = aevtimeCol->begin();
104 for(; iter_evt!=aevtimeCol->end(); iter_evt++){
105 m_tes = (*iter_evt)->getTest();
106 m_esFlag = (*iter_evt)->getStat();
107 }
108 }
109
110 m_esCutFg = false;
111 bool flagTes = false;
112 for(int iEs=0; iEs<m_param.nEsFlag; iEs++){
113 if(m_esFlag == m_param.esFlag[iEs]){
114 flagTes = true;
115 break;
116 }
117 }
118 if( flagTes && (m_tes > m_param.tesMin) && (m_tes < m_param.tesMax) ) m_esCutFg = true;
119
120 SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc,"/Event/Recon/RecMdcKalTrackCol");
121 if (!kaltrkCol) {
122 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
123 return StatusCode::FAILURE;
124 }
125
126 int i = 0;
127 MdcAliRecTrk* rectrk;
128 RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
129 for(; iter_trk != kaltrkCol->end(); iter_trk++) {
130 rectrk = new MdcAliRecTrk();
131 rectrk -> setKalTrk(iter_trk);
132 m_rectrk.push_back(rectrk);
133
134 i++;
135 }
136 log << MSG::INFO << "KalTrack ntrk = " << i << endreq;
137
138 return StatusCode::SUCCESS;
139}
140
142 unsigned int i;
143 for(i=0; i<m_rectrk.size(); i++){
144 delete m_rectrk[i];
145 }
146 m_rectrk.clear();
147}
IMessageSvc * msgSvc()
#define NULL
StatusCode setKalEvent()
StatusCode setRecEvent()
int esFlag[50]
Definition Event.h:21