BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
inclphi Class Reference

#include <inclphi.h>

+ Inheritance diagram for inclphi:

Public Member Functions

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

Detailed Description

Definition at line 15 of file inclphi.h.

Constructor & Destructor Documentation

◆ inclphi()

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

Definition at line 60 of file inclphi.cxx.

60 :
61 Algorithm(name, pSvcLocator) {
62
63 m_tuple1 = 0;
64 m_tuple2 = 0;
65 for(int i = 0; i < 10; i++) m_pass[i] = 0;
66
67//Declare the properties
68 declareProperty("Vr0cut", m_vr0cut=5.0);
69 declareProperty("Vz0cut", m_vz0cut=10.0);
70 declareProperty("CheckDedx", m_checkDedx = 1);
71 declareProperty("CheckTof", m_checkTof = 1);
72}

Member Function Documentation

◆ execute()

StatusCode inclphi::execute ( )

Definition at line 137 of file inclphi.cxx.

137 {
138 StatusCode sc = StatusCode::SUCCESS;
139
140 MsgStream log(msgSvc(), name());
141 log << MSG::INFO << "in execute()" << endreq;
142
143 // DQA
144 // Add the line below at the beginning of execute()
145 //
146 setFilterPassed(false);
147
148 m_pass[0] += 1;
149
150 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
151 int run=eventHeader->runNumber();
152 int event=eventHeader->eventNumber();
153
154 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
155 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
156
157 m_pass[1] += 1;
158
159 Vint ikp, ikm, iGood;
160 iGood.clear();
161 ikp.clear();
162 ikm.clear();
163
164 Vp4 pkp, pkm;
165 pkp.clear();
166 pkm.clear();
167
168 int TotCharge = 0;
169 for(int i = 0; i < evtRecEvent->totalCharged(); i++){
170 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
171 if(!(*itTrk)->isMdcTrackValid()) continue;
172 RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack();
173 if(fabs(mdcTrk->z()) >= m_vz0cut) continue;
174 if(mdcTrk->r() >= m_vr0cut) continue;
175 iGood.push_back(i);
176 TotCharge += mdcTrk->charge();
177 }
178 //
179 // Finish Good Charged Track Selection
180 //
181 int nGood = iGood.size();
182
183 //
184 // Charge track number cut
185 //
186
187 if((nGood < 2) || (TotCharge!=0)) return sc;
188
189 m_pass[2] += 1;
190
191 //
192 // Assign 4-momentum to each charged track
193 //
195 for(int i = 0; i < nGood; i++) {
196 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i];
197 // if(pid) delete pid;
198 pid->init();
199 pid->setMethod(pid->methodProbability());
200 pid->setChiMinCut(4);
201 pid->setRecTrack(*itTrk);
202 pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2()); // use PID sub-system
203 pid->identify(pid->onlyPion() | pid->onlyKaon()); // seperater Pion/Kaon
204 pid->calculate();
205 if(!(pid->IsPidInfoValid())) continue;
206 if(!(*itTrk)->isMdcKalTrackValid()) continue ;
207 RecMdcKalTrack* mdcKalTrk = (*itTrk)->mdcKalTrack();
208// RecMdcTrack* mdcTrk = (*itTrk)->mdcTrack();
209
210 if(pid->probKaon() < 0.001 || (pid->probKaon() < pid->probPion())) continue;
211// if(pid->probPion() < 0.001) continue;
213 HepLorentzVector ptrk;
214 ptrk.setPx(mdcKalTrk->px());
215 ptrk.setPy(mdcKalTrk->py());
216 ptrk.setPz(mdcKalTrk->pz());
217 double p3 = ptrk.mag();
218 ptrk.setE(sqrt(p3*p3+mk*mk));
219 if(mdcKalTrk->charge() >0) {
220 ikp.push_back(iGood[i]);
221 pkp.push_back(ptrk);
222 } else {
223 ikm.push_back(iGood[i]);
224 pkm.push_back(ptrk);
225 }
226 }
227
228 m_pass[4] += 1;
229 int nkp = ikp.size();
230 int nkm = ikm.size();
231
232 m_nkp=nkp;
233 m_nkm=nkm;
234 m_ncharge=nGood;
235
236
237 if(nkp < 1 || nkm <1) return sc;
238
239 m_pass[5] += 1;
240
241//
242//**************** Phi Finding ************
243//
244//
245
246 HepLorentzVector pphi, pTot;
247 Vint iphi;
248 iphi.clear();
249
250 double difchi0=99999.0;
251 int ixk1 = -1;
252 int ixk2 = -1;
253
254 for (int i = 0; i < nkm; i++) {
255 for (int j = 0; j < nkp; j++) {
256
257 pphi = pkm[i] + pkp[j];
258 m_mphiall = pphi.m();
259 m_pphiall = pphi.rho();
260 m_tuple1->write();
261
262 double difchi =fabs(pphi.m()-mphi);
263 if(difchi < difchi0){
264 difchi0 = difchi;
265 ixk1 = i;
266 ixk2 = j;
267 } //good phi
268 } //K+
269 } //K-
270
271 m_difchi = difchi0;
272
273 if (ixk1 == -1) return sc;
274
275 m_pass[6] += 1;
276
277 pTot = pkm[ixk1] + pkp[ixk2];
278
279 m_pk1 = pkm[ixk1].m();
280 m_mphi = pTot.m();
281 m_pphi = pTot.rho();
282
283 TH1 *h(0);
284 if (m_thsvc->getHist("/DQAHist/InclPhi/InclPhi_mass", h).isSuccess()) {
285 h->Fill(pTot.m());
286 } else {
287 log << MSG::ERROR << "Couldn't retrieve inclphi_mass" << endreq;
288 }
289 m_tuple2->write();
290////////////////////////////////////
291//DQA
292// set tag and quality
293 // Pid: 1 - electron, 2 - muon, 3 - pion, 4 - kaon, 5 - proton
294// (*(evtRecTrkCol->begin()+ikm[ixk1]))->setPartId(4);
295// (*(evtRecTrkCol->begin()+ikp[ixk2]))->setPartId(4);
296 (*(evtRecTrkCol->begin()+ikm[ixk1]))->tagKaon();
297 (*(evtRecTrkCol->begin()+ikp[ixk2]))->tagKaon();
298 // Quality: defined by whether dE/dx or TOF is used to identify particle
299 // 0 - no dE/dx, no TOF (can be used for dE/dx and TOF calibration)
300 // 1 - only dE/dx (can be used for TOF calibration)
301 // 2 - only TOF (can be used for dE/dx calibration)
302 // 3 - Both dE/dx and TOF
303 (*(evtRecTrkCol->begin()+ikm[ixk1]))->setQuality(3);
304 (*(evtRecTrkCol->begin()+ikp[ixk2]))->setQuality(3);
305//--------------------------------------------------
306 // Add the line below at the end of execute(), (before return)
307 //
308 setFilterPassed(true);
309
310 return StatusCode::SUCCESS;
311}
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
Definition Gam4pikp.cxx:53
const double mk
Definition Gam4pikp.cxx:48
std::vector< int > Vint
Definition Gam4pikp.cxx:52
IMessageSvc * msgSvc()
const double px() const
static void setPidType(PidType pidType)
const double pz() const
const double py() const
const int charge() const
const double r() const
Definition DstMdcTrack.h:64
const int charge() const
Definition DstMdcTrack.h:53
const double z() const
Definition DstMdcTrack.h:63
int useTof2() const
int methodProbability() const
int useDedx() const
int onlyKaon() const
int onlyPion() const
int useTof1() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
double probKaon() const
Definition ParticleID.h:124
void setMethod(const int method)
Definition ParticleID.h:94
void identify(const int pidcase)
Definition ParticleID.h:103
void usePidSys(const int pidsys)
Definition ParticleID.h:97
static ParticleID * instance()
bool IsPidInfoValid() const
double probPion() const
Definition ParticleID.h:123
void calculate()
void init()
const double mphi
Definition inclphi.cxx:44
_EXTERN_ std::string EvtRecEvent
Definition EventModel.h:116
_EXTERN_ std::string EvtRecTrackCol
Definition EventModel.h:117
float ptrk
double double * p3
Definition qcdloop1.h:76

◆ finalize()

StatusCode inclphi::finalize ( )

Definition at line 314 of file inclphi.cxx.

314 {
315
316 MsgStream log(msgSvc(), name());
317 log << MSG::INFO << "in finalize()" << endmsg;
318 log << MSG::INFO << "Total Entries : " << m_pass[0] << endreq;
319 log << MSG::INFO << "dstCol, trkCol: " << m_pass[1] << endreq;
320 log << MSG::INFO << "Ncharge Cut : " << m_pass[2] << endreq;
321 log << MSG::INFO << "TOF dEdx : " << m_pass[3] << endreq;
322 log << MSG::INFO << "PID : " << m_pass[4] << endreq;
323 log << MSG::INFO << "NK Cut : " << m_pass[5] << endreq;
324 log << MSG::INFO << "Nphi select : " << m_pass[6] << endreq;
325 return StatusCode::SUCCESS;
326}

◆ initialize()

StatusCode inclphi::initialize ( )

Definition at line 75 of file inclphi.cxx.

75 {
76 MsgStream log(msgSvc(), name());
77
78 log << MSG::INFO << "in initialize()" << endmsg;
79
80 StatusCode status;
81
82 if(service("THistSvc", m_thsvc).isFailure()) {
83 log << MSG::ERROR << "Couldn't get THistSvc" << endreq;
84 return StatusCode::FAILURE;
85 }
86 // "DQAHist" is fixed
87 TH1F* inclphi_mass = new TH1F("InclPhi_mass","INCLUSIVE_PHI_MASS",80,1.01,1.05);
88 inclphi_mass->GetXaxis()->SetTitle("M_{KK} (GeV)");
89 inclphi_mass->GetYaxis()->SetTitle("Nentries/0.5MeV/c^{2}");
90 if(m_thsvc->regHist("/DQAHist/InclPhi/InclPhi_mass", inclphi_mass).isFailure()) {
91 log << MSG::ERROR << "Couldn't register inclphi_mass" << endreq;
92 }
93
94//*****************************************
95
96 NTuplePtr nt1(ntupleSvc(), "DQAFILE/InclPhi");
97 if ( nt1 ) m_tuple1 = nt1;
98 else {
99 m_tuple1 = ntupleSvc()->book ("DQAFILE/InclPhi1", CLID_ColumnWiseTuple, "inclphi Ntuple");
100 if ( m_tuple1 ) {
101 status = m_tuple1->addItem ("mphiall", m_mphiall);
102 status = m_tuple1->addItem ("mpphiall", m_pphiall);
103 }
104 else {
105 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple1) << endmsg;
106 return StatusCode::FAILURE;
107 }
108 }
109 NTuplePtr nt2(ntupleSvc(), "DQAFILE/InclPhi2");
110 if ( nt2 ) m_tuple2 = nt2;
111 else {
112 m_tuple2 = ntupleSvc()->book ("DQAFILE/InclPhi2", CLID_ColumnWiseTuple, "inclphi Ntuple");
113 if ( m_tuple2 ) {
114 status = m_tuple2->addItem ("nkp", m_nkp);
115 status = m_tuple2->addItem ("nkm", m_nkm);
116 status = m_tuple2->addItem ("ncharge", m_ncharge);
117 status = m_tuple2->addItem ("difchi0", m_difchi);
118 status = m_tuple2->addItem ("mmphi", m_mphi);
119 status = m_tuple2->addItem ("pphi", m_pphi);
120 status = m_tuple2->addItem ("pk1", m_pk1);
121 }
122 else {
123 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple2) << endmsg;
124 return StatusCode::FAILURE;
125 }
126 }
127 //
128 //--------end of book--------
129 //
130
131 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
132 return StatusCode::SUCCESS;
133
134}
INTupleSvc * ntupleSvc()

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