BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
LumTau Class Reference

#include <LumTau.h>

+ Inheritance diagram for LumTau:

Public Member Functions

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

Detailed Description

Definition at line 10 of file LumTau.h.

Constructor & Destructor Documentation

◆ LumTau()

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

Definition at line 55 of file LumTau.cxx.

55 :
56 Algorithm(name, pSvcLocator)
57{
58}

Member Function Documentation

◆ execute()

StatusCode LumTau::execute ( )

Definition at line 105 of file LumTau.cxx.

106{
107 StatusCode sc=StatusCode::SUCCESS;
108
109 MsgStream log(msgSvc(),name());
110 log<<MSG::INFO<<"in execute()"<<endreq;
111
112
113 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
114 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
115
116 log<<MSG::DEBUG<<"ncharg, nneu, tottks = "<<evtRecEvent->totalCharged()<<" , "<<evtRecEvent->totalNeutral()<<" , "<<evtRecEvent->totalTracks()<<endreq;
117 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(),EventModel::EvtRec::EvtRecTrackCol);
118
119 log<<MSG::DEBUG <<"ncharg, nneu, tottks = "<<evtRecEvent->totalCharged()<<" , "<<evtRecEvent->totalNeutral()<<" , "<<evtRecEvent->totalTracks()<<endreq;
120 SmartDataPtr<RecEsTimeCol> evTimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
121
122 int interval = 200;
123 interval = m_intervalSvc->getTInterval();
124 log<<MSG::DEBUG << "interval = " << interval << endreq;
125 m_topup = false;
126 if (interval <= 0 ) {
127 log << MSG::FATAL << "error in reading the interval!" << endreq;
128 return StatusCode::FAILURE;
129 }
130 else if ( interval < 100 ) { // top-up mode
131 m_topup = true;
132 }
133
134 double time = eventHeader->time();
135 log << MSG::DEBUG << "time = " << time << endreq;
136 if (time <=0 ) return StatusCode::SUCCESS;
137 m_time = time;
138 m_etsT1 = eventHeader->etsT1()/2000000.; // convert to second
139 log << MSG::DEBUG << "ets time = " << m_etsT1 << endreq;
140
141 m_run = eventHeader->runNumber();
142 m_rec = eventHeader->eventNumber();
143
144 if(m_rec%1000==0) log << MSG::INFO <<"Run "<<m_run<<" Event "<<m_rec<<endreq;
145
146 double Emax1 = -1;
147 double Emax2 = -1;
148 int Imax[2];
149
150 if((evtRecEvent->totalTracks() >= 2)){
151 double etot = 0.;
152 for(int i = 0;i < evtRecEvent->totalTracks(); i++)
153 {
154 if(i>=evtRecTrkCol->size()) break;
155 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
156 if(!(*itTrk)->isEmcShowerValid()) continue;
157 RecEmcShower *emcTrk = (*itTrk)->emcShower();
158 double Ener=emcTrk->energy();
159 if(Ener>Emax2)
160 {
161 Emax2=Ener;
162 Imax[1]=i;
163 }
164 if(Ener>Emax1)
165 {
166 Emax2=Emax1;
167 Imax[1]=Imax[0];
168 Emax1=Ener;
169 Imax[0]=i;
170 }
171 etot += Ener;
172 }
173
174 m_etot = etot;
175 m_e1 = Emax1;
176 m_e2 = Emax2;
177
178 log << MSG::INFO << "Emax1 = " << Emax1 <<"Emax2= "<<Emax2<< endreq;
179 if(Emax1 > 0 && Emax2 > 0){
180 double emcphi[2],emctht[2];
181 for(int i = 0;i < 2; i++)
182 {
183 if(i>=evtRecTrkCol->size()) break;
184 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + Imax[i];
185 if(!(*itTrk)->isEmcShowerValid()) continue;
186 RecEmcShower *emcTrk = (*itTrk)->emcShower();
187 emcphi[i]=emcTrk->phi();
188 emctht[i]=emcTrk->theta();
189 }
190
191 double dltphi=(fabs(emcphi[0]-emcphi[1])-pai)*180./pai;
192 double dlttht=(fabs(emctht[0]+emctht[1])-pai)*180./pai;
193 m_costht1=cos(emctht[0]);
194 m_costht2=cos(emctht[1]);
195 m_phi1=emcphi[0];
196 m_phi2=emcphi[1];
197 m_dlttht=dlttht;
198 m_dltphi=dltphi;
199 }
200 else{
201 m_etot = -1;
202 m_e1 = -1;
203 m_e2 = -1;
204 m_costht1 = -1;
205 m_costht2 = -1;
206 m_phi1 = -1;
207 m_phi2 = -1;
208 m_dlttht = -1;
209 m_dltphi = -1;
210 }
211 }
212 else{
213 m_etot = -1;
214 m_e1 = -1;
215 m_e2 = -1;
216 m_costht1 = -1;
217 m_costht2 = -1;
218 m_phi1 = -1;
219 m_phi2 = -1;
220 m_dlttht = -1;
221 m_dltphi = -1;
222 }
223
224// m_tuple2->write();
225
226 int DiskWrite = m_tuple2->write();
227 if(DiskWrite != 1){
228 log<<MSG::FATAL<<"ERROR In LumTau DiskWrite!"<<endreq;
229 exit(1);
230 }
231
232 return StatusCode::SUCCESS;
233}
const double pai
Definition: BbEmc.cxx:48
double cos(const BesAngle a)
Definition: BesAngle.h:213
Double_t etot
Double_t dltphi
Double_t time
EvtRecTrackCol::iterator EvtRecTrackIterator
Definition: EvtRecTrack.h:111
IMessageSvc * msgSvc()
double theta() const
Definition: DstEmcShower.h:38
double phi() const
Definition: DstEmcShower.h:39
double energy() const
Definition: DstEmcShower.h:45
virtual int getTInterval() const =0
_EXTERN_ std::string EvtRecEvent
Definition: EventModel.h:116
_EXTERN_ std::string EvtRecTrackCol
Definition: EventModel.h:117

◆ finalize()

StatusCode LumTau::finalize ( )

Definition at line 235 of file LumTau.cxx.

236{
237 MsgStream log(msgSvc(),name());
238 log << MSG::INFO <<"Event Finalize"<<endreq;
239 return StatusCode::SUCCESS;
240}

◆ hello()

StatusCode LumTau::hello ( )

◆ initialize()

StatusCode LumTau::initialize ( )

Definition at line 61 of file LumTau.cxx.

62{
63 MsgStream log(msgSvc(), name());
64
65 log << MSG::INFO << "in initialize()" << endmsg;
66
67 StatusCode status;
68
69 status = service("InjSigIntervalSvc", m_intervalSvc);
70 if ( status != StatusCode::SUCCESS ){
71 log << MSG::FATAL << "can not use InjSigIntervalSvc" << endreq;
72 }
73
74 NTuplePtr nt2(ntupleSvc(), "LumTau/event");
75 if ( nt2 ) m_tuple2 = nt2;
76 else
77 {
78 m_tuple2 = ntupleSvc()->book ("LumTau/event", CLID_ColumnWiseTuple, "Bhabha N-Tuple signal");
79 if ( m_tuple2 )
80 {
81 status = m_tuple2->addItem ("topup", m_topup);
82 status = m_tuple2->addItem ("run", m_run);
83 status = m_tuple2->addItem ("rec", m_rec);
84 status = m_tuple2->addItem ("time", m_time);
85 status = m_tuple2->addItem ("etsT1", m_etsT1);
86 status = m_tuple2->addItem ("etot", m_etot);
87 status = m_tuple2->addItem ("e1", m_e1);
88 status = m_tuple2->addItem ("e2", m_e2);
89 status = m_tuple2->addItem ("costht1", m_costht1);
90 status = m_tuple2->addItem ("costht2", m_costht2);
91 status = m_tuple2->addItem ("dltphi", m_dltphi);
92 status = m_tuple2->addItem ("dlttht", m_dlttht);
93 status = m_tuple2->addItem ("phi1", m_phi1);
94 status = m_tuple2->addItem ("phi2", m_phi2);
95 }
96 else
97 {
98 log << MSG::ERROR << "Cannot book N-tuple2:"<<long(m_tuple2)<<endmsg;
99 return StatusCode::FAILURE;
100 }
101 }
102 return StatusCode::SUCCESS;
103}
INTupleSvc * ntupleSvc()

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