CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
DQASelHadron.cxx
Go to the documentation of this file.
1#include <vector>
2
3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/AlgFactory.h"
5#include "GaudiKernel/ISvcLocator.h"
6#include "GaudiKernel/SmartDataPtr.h"
7#include "GaudiKernel/IDataProviderSvc.h"
8#include "GaudiKernel/PropertyMgr.h"
10#include "GaudiKernel/Bootstrap.h"
11#include "GaudiKernel/ISvcLocator.h"
12
14#include "EventModel/Event.h"
15
20
21#include "TMath.h"
22#include "GaudiKernel/INTupleSvc.h"
23#include "GaudiKernel/NTuple.h"
24#include "GaudiKernel/Bootstrap.h"
25#include "GaudiKernel/IHistogramSvc.h"
26#include "CLHEP/Vector/ThreeVector.h"
27#include "CLHEP/Vector/LorentzVector.h"
28#include "CLHEP/Vector/TwoVector.h"
29
30using CLHEP::Hep3Vector;
31using CLHEP::Hep2Vector;
32using CLHEP::HepLorentzVector;
33#include "CLHEP/Geometry/Point3D.h"
34
36#include "VertexFit/VertexFit.h"
38#include "VertexFit/Helix.h"
41//
43
44#ifndef ENABLE_BACKWARDS_COMPATIBILITY
46#endif
47using CLHEP::HepLorentzVector;
48
49const double mpi = 0.13957;
50const double mk = 0.493677;
51const double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
52const double velc = 299.792458; // tof path unit in mm
53typedef std::vector<int> Vint;
54typedef std::vector<HepLorentzVector> Vp4;
55//declare one counter
56static int counter[10]={0,0,0,0,0,0,0,0,0,0};
57static int nhadron=0;
58static int n0prong=0;
59static int n2prong=0;
60static int n4prong=0;
61static int ng4prong=0;
62
63/////////////////////////////////////////////////////////////////////////////
64
65DQASelHadron::DQASelHadron(const std::string& name, ISvcLocator* pSvcLocator) :
66 Algorithm(name, pSvcLocator) {
67
68 //Declare the properties
69 declareProperty("writentuple",m_writentuple = false);
70 declareProperty("ecms",m_ecms = 3.097);
71 declareProperty("beamangle",m_beamangle = 0.022);
72 declareProperty("Vr0cut", m_vr0cut=1.0);
73 declareProperty("Vz0cut", m_vz0cut=10.0);
74 declareProperty("Coscut", m_coscut=0.93);
75
76 declareProperty("EnergyThreshold", m_energyThreshold=0.04);
77 declareProperty("GammaPhiCut", m_gammaPhiCut=20.0);
78 declareProperty("GammaThetaCut", m_gammaThetaCut=20.0);
79 declareProperty("GammaTrkCut", m_gammaTrkCut=20.0);
80 declareProperty("GammaTLCut", m_gammatlCut=0);
81 declareProperty("GammaTHCut", m_gammathCut=60);
82
83
84
85 declareProperty ("acoll_h_cut", m_acoll_h_cut=10.);
86 declareProperty ("poeb_h_cut", m_poeb_h_cut=0.2);
87 declareProperty ("dtof_h_cut", m_dtof_h_cut=6.);
88 declareProperty ("eop_h_cut", m_eop_h_cut=0.2);
89 declareProperty ("etotal_h_cut", m_etotal_h_cut=0.2);
90 declareProperty ("ngam_h_cut", m_ngam_h_cut=2);
91 declareProperty ("br_h_cut", m_br_h_cut=0.65);
92 declareProperty ("bz_h_cut", m_bz_h_cut=0.7);
93 declareProperty ("thr_h_cut", m_thr_h_cut=0.5);
94
95 //normally, MDC+EMC, otherwise EMC only
96 declareProperty ("m_useEMConly", m_useEMConly= false);
97 declareProperty ("m_usePID", m_usePID= false);// sub-system is under study
98 declareProperty ("m_useMDC", m_useMDC= true);
99 declareProperty ("m_useDEDX", m_useDEDX= false);// not used
100 declareProperty ("m_useTOF", m_useTOF= false);//sub-system is under study
101 declareProperty ("m_useEMC", m_useEMC= true);
102 declareProperty ("m_useMUC", m_useMUC= false);// efficiency
103
104
105}
106
107
108// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
110 MsgStream log(msgSvc(), name());
111
112 log << MSG::INFO << "in initialize()" << endmsg;
113 StatusCode status;
114 status = service("THistSvc", m_thistsvc);
115 if(status.isFailure() ){
116 log << MSG::INFO << "Unable to retrieve pointer to THistSvc" << endreq;
117 return status;
118 }
119
120
121 m_ha_costheta = new TH1F( "PHY_HAD_SUM_costheta", "PHY_HAD_SUM_costheta", 100, -1, 1 );
122 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_costheta", m_ha_costheta);
123 m_ha_phi = new TH1F( "PHY_HAD_SUM_phi", "PHY_HAD_SUM_phi", 128, -3.2, 3.2 );
124 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_phi", m_ha_phi);
125 m_ha_pmax = new TH1F( "PHY_HAD_SUM_pmax", "PHY_HAD_SUM_pmax", 100, 0, 2 );
126 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_pmax", m_ha_pmax);
127 m_ha_emax = new TH1F( "PHY_HAD_SUM_emax", "PHY_HAD_SUM_emax", 100, 0, 2 );
128 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_emax", m_ha_emax);
129 m_ha_etot = new TH1F( "PHY_HAD_SUM_etot", "PHY_HAD_SUM_etot", 100, 0, 4 );
130 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_etot", m_ha_etot);
131 m_ha_br = new TH1F( "PHY_HAD_SUM_br", "PHY_HAD_SUM_br", 100, 0, 2 );
132 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_br", m_ha_br);
133 m_ha_bz = new TH1F( "PHY_HAD_SUM_bz", "PHY_HAD_SUM_bz", 100, 0, 2 );
134 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_bz", m_ha_bz);
135 m_ha_nneu = new TH1I( "PHY_HAD_SUM_nneu", "PHY_HAD_SUM_nneu", 20, 0, 20 );
136 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_nneu", m_ha_nneu);
137 m_ha_nchg = new TH1I( "PHY_HAD_SUM_nchg", "PHY_HAD_SUM_nchg", 20, 0, 20 );
138 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_nchg", m_ha_nchg);
139
140 m_ha_vx = new TH1F( "PHY_HAD_FLS_vx", "PHY_HAD_FLS_vx", 100, -1., 1.);
141 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_vx", m_ha_vx);
142 m_ha_vy = new TH1F( "PHY_HAD_FLS_vy", "PHY_HAD_FLS_vy", 100, -1., 1.);
143 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_vy", m_ha_vy);
144 m_ha_vz = new TH1F( "PHY_HAD_FLS_vz", "PHY_HAD_FLS_vz", 100, -10.0, 10.);
145 status = m_thistsvc->regHist("/DQAHist/Hadron/ha_vz", m_ha_vz);
146
147
148
149
150
151
152NTuplePtr nt1(ntupleSvc(), "DQAFILE/Hadron");
153if ( nt1 ) m_tuple1 = nt1;
154else {
155 m_tuple1 = ntupleSvc()->book ("DQAFILE/Hadron", CLID_ColumnWiseTuple, "N-Tuple");
156 if ( m_tuple1 ) {
157 status = m_tuple1->addItem ("run", m_run);
158 status = m_tuple1->addItem ("rec", m_rec);
159 status = m_tuple1->addItem ("Nchrg", m_ncharg);
160 status = m_tuple1->addItem ("Nneu", m_nneu,0,40);
161 status = m_tuple1->addItem ("NGch", m_ngch, 0, 40);
162 status = m_tuple1->addItem ("NGam", m_nGam);
163
164
165 status = m_tuple1->addItem ("hadrontag", m_hadrontag);
166
167 status = m_tuple1->addItem ("br", m_br);
168 status = m_tuple1->addItem ("bz", m_bz);
169 status = m_tuple1->addItem ("evis", m_evis);
170 status = m_tuple1->addItem ("thr", m_thr);
171
172 status = m_tuple1->addItem ("acoll", m_acoll);
173 status = m_tuple1->addItem ("acopl", m_acopl);
174 status = m_tuple1->addItem ("deltatof", m_deltatof);
175 status = m_tuple1->addItem ("eop1", m_eop1);
176 status = m_tuple1->addItem ("eop2", m_eop2);
177 status = m_tuple1->addItem ("eoeb1", m_eoeb1);
178 status = m_tuple1->addItem ("eoeb2", m_eoeb2);
179 status = m_tuple1->addItem ("poeb1", m_poeb1);
180 status = m_tuple1->addItem ("poeb2", m_poeb2);
181 status = m_tuple1->addItem ("etoeb1", m_etoeb1);
182 status = m_tuple1->addItem ("etoeb2", m_etoeb2);
183 status = m_tuple1->addItem ("mucinfo1", m_mucinfo1);
184 status = m_tuple1->addItem ("mucinfo2", m_mucinfo2);
185
186 status = m_tuple1->addIndexedItem ("delang",m_nneu, m_delang);
187 status = m_tuple1->addIndexedItem ("delphi",m_nneu, m_delphi);
188 status = m_tuple1->addIndexedItem ("delthe",m_nneu, m_delthe);
189 status = m_tuple1->addIndexedItem ("npart",m_nneu, m_npart);
190 status = m_tuple1->addIndexedItem ("nemchits",m_nneu, m_nemchits);
191 status = m_tuple1->addIndexedItem ("module",m_nneu, m_module);
192 status = m_tuple1->addIndexedItem ("x",m_nneu, m_x);
193 status = m_tuple1->addIndexedItem ("y",m_nneu, m_y);
194 status = m_tuple1->addIndexedItem ("z",m_nneu, m_z);
195 status = m_tuple1->addIndexedItem ("px",m_nneu, m_px);
196 status = m_tuple1->addIndexedItem ("py",m_nneu, m_py);
197 status = m_tuple1->addIndexedItem ("pz",m_nneu, m_pz);
198 status = m_tuple1->addIndexedItem ("theta",m_nneu, m_theta);
199 status = m_tuple1->addIndexedItem ("phi",m_nneu, m_phi);
200 status = m_tuple1->addIndexedItem ("dx",m_nneu, m_dx);
201 status = m_tuple1->addIndexedItem ("dy",m_nneu, m_dy);
202 status = m_tuple1->addIndexedItem ("dz",m_nneu, m_dz);
203 status = m_tuple1->addIndexedItem ("dtheta",m_nneu, m_dtheta);
204 status = m_tuple1->addIndexedItem ("dphi",m_nneu, m_dphi);
205 status = m_tuple1->addIndexedItem ("energy",m_nneu, m_energy);
206 status = m_tuple1->addIndexedItem ("dE",m_nneu, m_dE);
207 status = m_tuple1->addIndexedItem ("eSeed",m_nneu, m_eSeed);
208 status = m_tuple1->addIndexedItem ("nSeed",m_nneu, m_nSeed);
209 status = m_tuple1->addIndexedItem ("e3x3",m_nneu, m_e3x3);
210 status = m_tuple1->addIndexedItem ("e5x5",m_nneu, m_e5x5);
211 status = m_tuple1->addIndexedItem ("secondMoment",m_nneu, m_secondMoment);
212 status = m_tuple1->addIndexedItem ("latMoment",m_nneu, m_latMoment);
213 status = m_tuple1->addIndexedItem ("a20Moment",m_nneu, m_a20Moment);
214 status = m_tuple1->addIndexedItem ("a42Moment",m_nneu, m_a42Moment);
215 status = m_tuple1->addIndexedItem ("getTime",m_nneu, m_getTime);
216 status = m_tuple1->addIndexedItem ("getEAll",m_nneu, m_getEAll);
217
218
219
220 status = m_tuple1->addIndexedItem("charge", m_ngch, m_charge);
221 status = m_tuple1->addIndexedItem ("vx", m_ngch, m_vx0);
222 status = m_tuple1->addIndexedItem ("vy", m_ngch, m_vy0);
223 status = m_tuple1->addIndexedItem ("vz", m_ngch, m_vz0);
224
225
226 status = m_tuple1->addIndexedItem ("px", m_ngch, m_px) ;
227 status = m_tuple1->addIndexedItem ("py", m_ngch, m_py) ;
228 status = m_tuple1->addIndexedItem ("pz", m_ngch, m_pz) ;
229 status = m_tuple1->addIndexedItem ("p", m_ngch, m_p) ;
230
231
232
233 status = m_tuple1->addIndexedItem ("kal_vx", m_ngch, m_kal_vx0);
234 status = m_tuple1->addIndexedItem ("kal_vy", m_ngch, m_kal_vy0);
235 status = m_tuple1->addIndexedItem ("kal_vz", m_ngch, m_kal_vz0);
236
237
238 status = m_tuple1->addIndexedItem ("kal_px", m_ngch, m_kal_px) ;
239 status = m_tuple1->addIndexedItem ("kal_py", m_ngch, m_kal_py) ;
240 status = m_tuple1->addIndexedItem ("kal_pz", m_ngch, m_kal_pz) ;
241 status = m_tuple1->addIndexedItem ("kal_p", m_ngch, m_kal_p) ;
242
243
244 status = m_tuple1->addIndexedItem ("probPH" , m_ngch, m_probPH) ;
245 status = m_tuple1->addIndexedItem ("normPH" , m_ngch, m_normPH) ;
246 status = m_tuple1->addIndexedItem ("chie" , m_ngch, m_chie) ;
247 status = m_tuple1->addIndexedItem ("chimu" , m_ngch, m_chimu) ;
248 status = m_tuple1->addIndexedItem ("chipi" , m_ngch, m_chipi) ;
249 status = m_tuple1->addIndexedItem ("chik" , m_ngch, m_chik) ;
250 status = m_tuple1->addIndexedItem ("chip" , m_ngch, m_chip) ;
251 status = m_tuple1->addIndexedItem ("ghit" , m_ngch, m_ghit) ;
252 status = m_tuple1->addIndexedItem ("thit" , m_ngch, m_thit) ;
253
254 status = m_tuple1->addIndexedItem ("e_emc" , m_ngch, m_e_emc) ;
255 status = m_tuple1->addIndexedItem ("phi_emc" , m_ngch, m_phi_emc) ;
256 status = m_tuple1->addIndexedItem ("theta_emc" , m_ngch, m_theta_emc) ;
257
258 status = m_tuple1->addIndexedItem ("nhit_muc" , m_ngch, m_nhit_muc) ;
259 status = m_tuple1->addIndexedItem ("nlay_muc" , m_ngch, m_nlay_muc) ;
260 status = m_tuple1->addIndexedItem ("t_btof" , m_ngch, m_t_btof );
261 status = m_tuple1->addIndexedItem ("t_etof" , m_ngch, m_t_etof );
262 status = m_tuple1->addIndexedItem ("qual_etof" , m_ngch, m_qual_etof );
263 status = m_tuple1->addIndexedItem ("tof_etof" , m_ngch, m_tof_etof );
264 status = m_tuple1->addIndexedItem ("te_etof" , m_ngch, m_te_etof );
265 status = m_tuple1->addIndexedItem ("tmu_etof" , m_ngch, m_tmu_etof );
266 status = m_tuple1->addIndexedItem ("tpi_etof" , m_ngch, m_tpi_etof );
267 status = m_tuple1->addIndexedItem ("tk_etof" , m_ngch, m_tk_etof );
268 status = m_tuple1->addIndexedItem ("tp_etof" , m_ngch, m_tp_etof );
269
270 status = m_tuple1->addIndexedItem ("qual_btof1", m_ngch, m_qual_btof1 );
271 status = m_tuple1->addIndexedItem ("tof_btof1" , m_ngch, m_tof_btof1 );
272 status = m_tuple1->addIndexedItem ("te_btof1" , m_ngch, m_te_btof1 );
273 status = m_tuple1->addIndexedItem ("tmu_btof1" , m_ngch, m_tmu_btof1 );
274 status = m_tuple1->addIndexedItem ("tpi_btof1" , m_ngch, m_tpi_btof1 );
275 status = m_tuple1->addIndexedItem ("tk_btof1" , m_ngch, m_tk_btof1 );
276 status = m_tuple1->addIndexedItem ("tp_btof1" , m_ngch, m_tp_btof1 );
277
278 status = m_tuple1->addIndexedItem ("qual_btof2", m_ngch, m_qual_btof2 );
279 status = m_tuple1->addIndexedItem ("tof_btof2" , m_ngch, m_tof_btof2 );
280 status = m_tuple1->addIndexedItem ("te_btof2" , m_ngch, m_te_btof2 );
281 status = m_tuple1->addIndexedItem ("tmu_btof2" , m_ngch, m_tmu_btof2 );
282 status = m_tuple1->addIndexedItem ("tpi_btof2" , m_ngch, m_tpi_btof2 );
283 status = m_tuple1->addIndexedItem ("tk_btof2" , m_ngch, m_tk_btof2 );
284 status = m_tuple1->addIndexedItem ("tp_btof2" , m_ngch, m_tp_btof2 );
285 status = m_tuple1->addIndexedItem ("pidcode" , m_ngch, m_pidcode);
286 status = m_tuple1->addIndexedItem ("pidprob" , m_ngch, m_pidprob);
287 status = m_tuple1->addIndexedItem ("pidchiDedx" , m_ngch, m_pidchiDedx);
288 status = m_tuple1->addIndexedItem ("pidchiTof1" , m_ngch, m_pidchiTof1);
289 status = m_tuple1->addIndexedItem ("pidchiTof2" , m_ngch, m_pidchiTof2);
290
291 status = m_tuple1->addItem ("px_cms_ep", m_px_cms_ep); //momentum of electron+
292 status = m_tuple1->addItem ("py_cms_ep", m_py_cms_ep); //momentum of electron+
293 status = m_tuple1->addItem ("pz_cms_ep", m_pz_cms_ep); //momentum of electron+
294 status = m_tuple1->addItem ("e_cms_ep", m_e_cms_ep); //momentum of electron+
295 status = m_tuple1->addItem ("cos_ep", m_cos_ep); //momentum of electron+
296 status = m_tuple1->addItem ("px_cms_em", m_px_cms_em); //momentum of electron-
297 status = m_tuple1->addItem ("py_cms_em", m_py_cms_em); //momentum of electron-
298 status = m_tuple1->addItem ("pz_cms_em", m_pz_cms_em); //momentum of electron-
299 status = m_tuple1->addItem ("e_cms_em", m_e_cms_em); //momentum of electron-
300 status = m_tuple1->addItem ("cos_em", m_cos_em); //momentum of electron-
301 status = m_tuple1->addItem ("mass_ee", m_mass_ee); //
302 status = m_tuple1->addItem ("emax", m_emax); //
303 status = m_tuple1->addItem ("esum", m_esum); //
304 status = m_tuple1->addItem ( "npip", m_npip );
305 status = m_tuple1->addItem ( "npim", m_npim );
306 status = m_tuple1->addItem ( "nkp", m_nkp );
307 status = m_tuple1->addItem ( "nkm", m_nkm );
308 status = m_tuple1->addItem ( "np", m_np );
309 status = m_tuple1->addItem ( "npb", m_npb );
310
311 status = m_tuple1->addItem ( "nep", m_nep );
312 status = m_tuple1->addItem ( "nem", m_nem );
313 status = m_tuple1->addItem ( "nmup", m_nmup );
314 status = m_tuple1->addItem ( "nmum", m_nmum );
315
316 }
317 else {
318 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple1) << endmsg;
319 return StatusCode::FAILURE;
320 }
321}
322
323//
324//--------end of book--------
325//
326
327log << MSG::INFO << "successfully return from initialize()" <<endmsg;
328return StatusCode::SUCCESS;
329
330
331
332
333}
334
335// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
337 setFilterPassed(false);
338 const double beamEnergy = m_ecms/2.;
339 const HepLorentzVector p_cms(m_ecms*sin(m_beamangle*0.5),0.0,0.0,m_ecms);
340 const Hep3Vector u_cms = -p_cms.boostVector();
341 MsgStream log(msgSvc(), name());
342 log << MSG::INFO << "in execute()" << endreq;
343
344
345 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
346 if (!eventHeader)
347 {
348 log << MSG::FATAL << "Could not find Event Header" << endreq;
349 return StatusCode::SUCCESS;
350 }
351
352 m_run = eventHeader->runNumber();
353 m_rec = eventHeader->eventNumber();
354
355
356
357
358 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
359 if (!evtRecEvent)
360 {
361 log << MSG::FATAL << "Could not find EvtRecEvent" << endreq;
362 return StatusCode::SUCCESS;
363 }
364 log << MSG::INFO <<"ncharg, nneu, tottks = "
365 << evtRecEvent->totalCharged() << " , "
366 << evtRecEvent->totalNeutral() << " , "
367 << evtRecEvent->totalTracks() <<endreq;
368 // if(evtRecEvent->totalNeutral()>30)return sc;
369 m_ncharg = evtRecEvent->totalCharged();
370
371 m_nneu = evtRecEvent->totalNeutral();
372
373
374
375 HepPoint3D vx(0., 0., 0.);
376 HepSymMatrix Evx(3, 0);
377 IVertexDbSvc* vtxsvc;
378 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
379 if(vtxsvc->isVertexValid()){
380 double* dbv = vtxsvc->PrimaryVertex();
381 double* vv = vtxsvc->SigmaPrimaryVertex();
382 // if (m_reader.isRunNumberValid( m_run)) {
383 // HepVector dbv = m_reader.PrimaryVertex( m_run);
384 // HepVector vv = m_reader.SigmaPrimaryVertex( m_run);
385 vx.setX(dbv[0]);
386 vx.setY(dbv[1]);
387 vx.setZ(dbv[2]);
388 Evx[0][0]=vv[0]*vv[0];
389 Evx[0][1]=vv[0]*vv[1];
390 Evx[1][1]=vv[1]*vv[1];
391 Evx[1][2]=vv[1]*vv[2];
392 Evx[2][2]=vv[2]*vv[2];
393 }
394
395 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
396 if (!evtRecTrkCol)
397 {
398 log << MSG::FATAL << "Could not find EvtRecTrackCol" << endreq;
399 return StatusCode::SUCCESS;
400 }
401 Vint iGood;
402 iGood.clear();
403
404 int nCharge = 0;
405
406 for(int i = 0; i < evtRecEvent->totalCharged(); i++){
407 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
408 if(!(*itTrk)->isMdcTrackValid()) continue;
409 if(!(*itTrk)->isMdcKalTrackValid()) continue;
410
411 RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack();
412 double pch=mdcTrk->p();
413 double x0=mdcTrk->x();
414 double y0=mdcTrk->y();
415 double z0=mdcTrk->z();
416// double phi0=mdcTrk->helix(1);
417// double xv=vx.x();
418// double yv=vx.y();
419// double zv=vx.z();
420// double Rxy=(x0-xv)*cos(phi0)+(y0-yv)*sin(phi0);
421// double m_vx0 = x0;
422// double m_vy0 = y0;
423// double m_vz0 = z0;
424// double m_vr0 = Rxy;
425// if(fabs(z0) >= m_vz0cut) continue;
426// if(fabs(Rxy) >= m_vr0cut) continue;
427
428
429// if(fabs(m_vz0) >= m_vz0cut) continue;
430// if(m_vr0 >= m_vr0cut) continue;
431
432
433 HepVector a = mdcTrk->helix();
434 HepSymMatrix Ea = mdcTrk->err();
435 HepPoint3D point0(0.,0.,0.);
436 HepPoint3D IP(vx[0],vx[1],vx[2]);
437 VFHelix helixip(point0,a,Ea);
438 helixip.pivot(IP);
439 HepVector vecipa = helixip.a();
440 double Rvxy0=fabs(vecipa[0]); //the distance to IP in xy plane
441 double Rvz0=vecipa[3]; //the distance to IP in z direction
442 double Rvphi0=vecipa[1];
443 if(fabs(Rvz0) >= m_vr0cut) continue;
444 if(fabs(Rvxy0) >= m_vr0cut) continue;
445
446
447 // double cost = cos(mdcTrk->theta());
448 // if(fabs(cost) >= m_coscut ) continue;
449// iGood.push_back((*itTrk)->trackId());
450 iGood.push_back(i);
451 nCharge += mdcTrk->charge();
452
453 }
454
455
456
457
458
459 //
460 // Finish Good Charged Track Selection
461 //
462 int nGood = iGood.size();
463 m_ngch=nGood;
464 log << MSG::DEBUG << "ngood, totcharge = " << nGood << " , " << nCharge << endreq;
465
466
467 if(m_ngch<2 ||m_ngch>20||(nCharge >4) ) { return StatusCode::SUCCESS; }
468 counter[1]++;
469
470 //
471 // Particle ID
472 //
473 Vint ipip, ipim, iep,iem,imup,imum;
474 ipip.clear();
475 ipim.clear();
476 iep.clear();
477 iem.clear();
478 imup.clear();
479 imum.clear();
480
481 if (m_usePID){
483 for(int i = 0; i < m_ngch; i++) {
484 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i];
485 // if(pid) delete pid;
486 pid->init();
487 pid->setMethod(pid->methodProbability());
488 pid->setChiMinCut(4);
489 pid->setRecTrack(*itTrk);
490 pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2());//|pid->useEmc()|pid->useMuc()); // use PID sub-system
491 pid->identify(pid->onlyElectron()|pid->onlyMuon()|pid->onlyPion()); // seperater Pion/Kaon/Proton
492 pid->calculate();
493 if(!(pid->IsPidInfoValid())) continue;
494 RecMdcTrack* mdcTrk = (*itTrk)->mdcTrack();
495 /// RecMdcKalTrack* mdcKalTrk = 0 ;
496 /// if((*itTrk)->isMdcKalTrackValid()) mdcKalTrk = (*itTrk)->mdcKalTrack();
497 double prob_pi = pid->probPion();
498 double prob_K = pid->probKaon();
499 double prob_p = pid->probProton();
500 double prob_e = pid->probElectron();
501 double prob_mu = pid->probMuon();
502 // std::cout << "prob "<< prob_pi << ", "<< prob_K << ", "<< prob_p << std::endl;
503 HepLorentzVector ptrk;
504 ptrk.setPx(mdcTrk->px()) ;
505 ptrk.setPy(mdcTrk->py()) ;
506 ptrk.setPz(mdcTrk->pz()) ;
507 double p3 = ptrk.mag() ;
508
509
510
511 m_pidcode[i]=1;
512 m_pidprob[i]=pid->prob(1);
513 m_pidchiDedx[i]=pid->chiDedx(1);
514 m_pidchiTof1[i]=pid->chiTof1(1);
515 m_pidchiTof2[i]=pid->chiTof2(1);
516 if(mdcTrk->charge() > 0) {
517 imup.push_back(iGood[i]);
518
519 }
520 if (mdcTrk->charge() < 0) {
521 imum.push_back(iGood[i]);
522
523 }
524
525
526 }
527 }
528 m_nep = iep.size() ;
529 m_nem = iem.size() ;
530 m_nmup = imup.size() ;
531 m_nmum = imum.size() ;
532
533 counter[2]++;
534
535 //
536 // Good neutral track selection
537 //
538 Vint iGam;
539 iGam.clear();
540 int iphoton=0;
541 for(int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
542 if(i>=evtRecTrkCol->size())break;
543 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
544 if(!(*itTrk)->isEmcShowerValid()) continue;
545 RecEmcShower *emcTrk = (*itTrk)->emcShower();
546 Hep3Vector emcpos(emcTrk->x(), emcTrk->y(), emcTrk->z());
547
548 RecEmcID showerId = emcTrk->getShowerId();
549 unsigned int npart = EmcID::barrel_ec(showerId);
550 int n = emcTrk->numHits();
551 int module=emcTrk->module();
552 double x = emcTrk->x();
553 double y = emcTrk->y();
554 double z = emcTrk->z();
555 double dx = emcTrk->dx();
556 double dy = emcTrk->dy();
557 double dth = emcTrk->dtheta();
558 double dph = emcTrk->dphi();
559 double dz = emcTrk->dz();
560 double energy = emcTrk->energy();
561 double dE = emcTrk->dE();
562 double eSeed = emcTrk->eSeed();
563 double e3x3 = emcTrk->e3x3();
564 double e5x5 = emcTrk->e5x5();
565 double secondMoment = emcTrk->secondMoment();
566 double latMoment = emcTrk->latMoment();
567 double getTime = emcTrk->time();
568 double getEAll = emcTrk->getEAll();
569 double a20Moment = emcTrk->a20Moment();
570 double a42Moment = emcTrk->a42Moment();
571 // int phigap=emcTrk->PhiGap();
572 // int thetagap=emcTrk->ThetaGap();
573 // double getETof2x1 = emcTrk->getETof2x1();
574 // double getETof2x3 = emcTrk->getETof2x3();
575 // double getELepton = emcTrk->getELepton();
576 double nseed=0;//(emcTrk->getCluster() )->getSeedSize() ;
577 HepPoint3D EmcPos(x,y,z);
578 m_nemchits[iphoton]=n;
579 m_npart[iphoton]=npart;
580 m_module[iphoton]=module;
581 m_theta[iphoton]=EmcPos.theta();
582 m_phi[iphoton]=EmcPos.phi();
583 m_x[iphoton]=x;
584 m_y[iphoton]=y;
585 m_z[iphoton]=z;
586 m_dx[iphoton]=dx;
587 m_dy[iphoton]=dy;
588 m_dz[iphoton]=dz;
589 m_dtheta[iphoton]=dth;
590 m_dphi[iphoton]=dph;
591 m_energy[iphoton]=energy;
592 m_dE[iphoton]=dE;
593 m_eSeed[iphoton]=eSeed;
594 m_nSeed[iphoton]=nseed;
595 m_e3x3[iphoton]=e3x3;
596 m_e5x5[iphoton]=e5x5;
597 m_secondMoment[iphoton]=secondMoment;
598 m_latMoment[iphoton]=latMoment;
599 m_getTime[iphoton]=getTime;
600 m_getEAll[iphoton]=getEAll;
601 m_a20Moment[iphoton]=a20Moment;
602 m_a42Moment[iphoton]=a42Moment;
603
604 // m_getELepton[iphoton]=getELepton;
605 // m_getETof2x1[iphoton]=getETof2x1;
606 // m_getETof2x3[iphoton]=getETof2x3;
607 // m_PhiGap[iphoton]=phigap;
608 // m_ThetaGap[iphoton]=thetagap;
609 double dthe = 200.;
610 double dphi = 200.;
611 double dang = 200.;
612
613 // find the nearest charged track
614 for(int j = 0; j < nGood; j++) {
615
616
617 EvtRecTrackIterator jtTrk = evtRecTrkCol->begin() +iGood[j];
618 if (!(*jtTrk)->isMdcTrackValid()) continue;
619 RecMdcTrack *jtmdcTrk = (*jtTrk)->mdcTrack();
620 double jtcharge = jtmdcTrk->charge();
621 if(!(*jtTrk)->isExtTrackValid()) continue;
622 RecExtTrack *extTrk = (*jtTrk)->extTrack();
623 if(extTrk->emcVolumeNumber() == -1) continue;
624 Hep3Vector extpos = extTrk->emcPosition();
625 // double ctht = extpos.cosTheta(emcpos);
626 double angd = extpos.angle(emcpos);
627 double thed = extpos.theta() - emcpos.theta();
628 double phid = extpos.deltaPhi(emcpos);
629 thed = fmod(thed+CLHEP::twopi+CLHEP::twopi+pi, CLHEP::twopi) - CLHEP::pi;
630 phid = fmod(phid+CLHEP::twopi+CLHEP::twopi+pi, CLHEP::twopi) - CLHEP::pi;
631
632 if(fabs(thed) < fabs(dthe)) dthe = thed;
633 if(fabs(phid) < fabs(dphi)) dphi = phid;
634 if(angd < dang) dang = angd;
635
636 }
637
638
639
640 //
641 // good photon cut will be set here
642 //
643
644 dthe = dthe * 180 / (CLHEP::pi);
645 dphi = dphi * 180 / (CLHEP::pi);
646 dang = dang * 180 / (CLHEP::pi);
647 double eraw = emcTrk->energy();
648 double phi = emcTrk->phi();
649 double the = emcTrk->theta();
650
651 m_delphi[iphoton]=dphi;
652 m_delthe[iphoton]=dthe;
653 m_delang[iphoton]=dang;
654 if(energy < m_energyThreshold) continue;
655 if(getTime>m_gammathCut||getTime<m_gammatlCut)continue;
656 // if((fabs(dthe) < m_gammaThetaCut) && (fabs(dphi)<m_gammaPhiCut) ) continue;
657 if(dang< m_gammaTrkCut) continue;
658 iphoton++;
659 iGam.push_back(i);
660 if(iphoton>=40)return StatusCode::SUCCESS;
661 }
662
663 int nGam = iGam.size();
664 m_nGam=nGam;
665 // std::cout << "num Good Photon " << m_nGam << " , " <<evtRecEvent->totalNeutral()<<std::endl;
666 //std::cout<<"dbg_4"<<std::endl;
667 counter[3]++;
668
669 double egam_ext=0;
670 double ex_gam=0;
671 double ey_gam=0;
672 double ez_gam=0;
673 double et_gam=0;
674 double e_gam=0;
675 for(int i = 0; i < m_nGam; i++) {
676 EvtRecTrackIterator itTrk = evtRecTrkCol->begin()+ iGam[i];
677 if(!(*itTrk)->isEmcShowerValid()) continue;
678 RecEmcShower* emcTrk = (*itTrk)->emcShower();
679 double eraw = emcTrk->energy();
680 double phi = emcTrk->phi();
681 double the = emcTrk->theta();
682 HepLorentzVector ptrk;
683 ex_gam+=eraw*sin(the)*cos(phi);
684 ey_gam+=eraw*sin(the)*sin(phi);
685 ez_gam+=eraw*cos(the);
686 et_gam+=eraw*sin(the);
687 e_gam+=eraw ;
688 if(eraw>=egam_ext)
689 {
690 egam_ext=eraw;
691 }
692
693 }
694
695
696
697
698
699 double px_had=0;
700 double py_had=0;
701 double pz_had=0;
702 double pt_had=0;
703 double p_had=0;
704 double e_had=0;
705 double p_max=0.;
706 double e_max=0.;
707 //
708 // check good charged track's infomation
709 //
710
711
712
713 for(int i = 0; i < m_ngch; i++ ){
714
715 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i];
716
717 if(!(*itTrk)->isMdcTrackValid()) continue; // MDC information
718 if(!(*itTrk)->isMdcKalTrackValid()) continue;
719
720 RecMdcTrack* mdcTrk = (*itTrk)->mdcTrack();
721 RecMdcKalTrack *mdcKalTrk = (*itTrk)->mdcKalTrack();
722
723
724 // if ( m_ngch==2 &&mdcTrk->charge()>0) i = 0 ;
725 // if ( m_ngch==2 &&mdcTrk->charge()<0) i = 1 ;
726 m_charge[i] = mdcTrk->charge();
727 m_vx0[i] = mdcTrk->x();
728 m_vy0[i] = mdcTrk->y();
729 m_vz0[i] = mdcTrk->z();
730 m_px[i] = mdcTrk->px();
731 m_py[i] = mdcTrk->py();
732 m_pz[i] = mdcTrk->pz();
733 m_p[i] = mdcTrk->p();
734 m_theta[i]=mdcTrk->theta();
735 m_phi[i]=mdcTrk->phi();
737 double ptrk = mdcKalTrk->p() ;
738 m_kal_vx0[i] = mdcKalTrk->x();
739 m_kal_vy0[i] = mdcKalTrk->y();
740 m_kal_vz0[i] = mdcKalTrk->z();
741
742
743 m_kal_px[i] = mdcKalTrk->px();
744 m_kal_py[i] = mdcKalTrk->py();
745 m_kal_pz[i] = mdcKalTrk->pz();
746 m_kal_p[i] = mdcKalTrk->p();
747 px_had+=mdcKalTrk->px();
748 py_had+=mdcKalTrk->py();
749 pz_had+=mdcKalTrk->pz();
750 pt_had+=mdcKalTrk->pxy();
751 p_had+=mdcKalTrk->p();
752 e_had+=sqrt(mdcKalTrk->p()*mdcKalTrk->p()+xmass[2]*xmass[2]);
753 if(m_useDEDX&&(*itTrk)->isMdcDedxValid()) { // DEDX information
754
755 RecMdcDedx* dedxTrk = (*itTrk)->mdcDedx();
756 m_probPH[i]= dedxTrk->probPH();
757 m_normPH[i]= dedxTrk->normPH();
758
759 m_chie[i] = dedxTrk->chiE();
760 m_chimu[i] = dedxTrk->chiMu();
761 m_chipi[i] = dedxTrk->chiPi();
762 m_chik[i] = dedxTrk->chiK();
763 m_chip[i] = dedxTrk->chiP();
764 m_ghit[i] = dedxTrk->numGoodHits();
765 m_thit[i] = dedxTrk->numTotalHits();
766 }
767
768 if((*itTrk)->isEmcShowerValid()) {
769
770 RecEmcShower *emcTrk = (*itTrk)->emcShower();
771 m_e_emc[i] = emcTrk->energy();
772 m_phi_emc[i] = emcTrk->phi();
773 m_theta_emc[i] = emcTrk->theta();
774 if(m_e_emc[i]>e_max){
775 p_max=m_p[i];
776 e_max=m_e_emc[i];
777 }
778 }
779
780
781
782 if(m_useMUC&&(*itTrk)->isMucTrackValid()){
783
784 RecMucTrack* mucTrk = (*itTrk)->mucTrack() ;
785 m_nhit_muc[i] = mucTrk->numHits() ;
786 m_nlay_muc[i] = mucTrk->numLayers() ;
787
788 }
789
790
791 if(m_useTOF&&(*itTrk)->isTofTrackValid()) { //TOF information
792
793 SmartRefVector<RecTofTrack> tofTrkCol = (*itTrk)->tofTrack();
794
795 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
796
797 for(;iter_tof != tofTrkCol.end(); iter_tof++ ) {
798 TofHitStatus *status = new TofHitStatus;
799 status->setStatus((*iter_tof)->status());
800
801 if(!(status->is_barrel())){//endcap
802 if( (status->is_cluster()) ) m_t_etof[i] = (*iter_tof)->tof();
803 if( !(status->is_counter()) ){if(status) delete status; continue;} // ?
804 if( status->layer()!=0 ){if(status) delete status; continue;}//layer1
805 double path=(*iter_tof)->path(); // ?
806 double tof = (*iter_tof)->tof();
807 double ph = (*iter_tof)->ph();
808 double rhit = (*iter_tof)->zrhit();
809 double qual = 0.0 + (*iter_tof)->quality();
810 double cntr = 0.0 + (*iter_tof)->tofID();
811 double texp[5];
812 for(int j = 0; j < 5; j++) {
813 double gb = ptrk/xmass[j];
814 double beta = gb/sqrt(1+gb*gb);
815 texp[j] = path /beta/velc;
816 }
817
818 m_qual_etof[i] = qual;
819 m_tof_etof[i] = tof ;
820 }
821 else {//barrel
822 if( (status->is_cluster()) ) m_t_btof[i] = (*iter_tof)->tof();
823 if( !(status->is_counter()) ){if(status) delete status; continue;} // ?
824 if(status->layer()==1){ //layer1
825 double path=(*iter_tof)->path(); // ?
826 double tof = (*iter_tof)->tof();
827 double ph = (*iter_tof)->ph();
828 double rhit = (*iter_tof)->zrhit();
829 double qual = 0.0 + (*iter_tof)->quality();
830 double cntr = 0.0 + (*iter_tof)->tofID();
831 double texp[5];
832 for(int j = 0; j < 5; j++) {
833 double gb = ptrk/xmass[j];
834 double beta = gb/sqrt(1+gb*gb);
835 texp[j] = path /beta/velc;
836 }
837
838 m_qual_btof1[i] = qual;
839 m_tof_btof1[i] = tof ;
840 }
841
842 if(status->layer()==2){//layer2
843 double path=(*iter_tof)->path(); // ?
844 double tof = (*iter_tof)->tof();
845 double ph = (*iter_tof)->ph();
846 double rhit = (*iter_tof)->zrhit();
847 double qual = 0.0 + (*iter_tof)->quality();
848 double cntr = 0.0 + (*iter_tof)->tofID();
849 double texp[5];
850 for(int j = 0; j < 5; j++) {
851 double gb = ptrk/xmass[j];
852 double beta = gb/sqrt(1+gb*gb);
853 texp[j] = path /beta/velc;
854 }
855
856 m_qual_btof2[i] = qual;
857 m_tof_btof2[i] = tof ;
858 }
859 }
860 if(status) delete status;
861 }
862
863
864
865 }
866
867 }
868
869 //tag
870
871
872 m_hadrontag=0;
874 if(m_ngch != 2 )m_hadrontag=11111;
875 else if(m_ngch == 2 &&nCharge==0) {
876 EvtRecTrackIterator itTrk1;
877
878 EvtRecTrackIterator itTrk2;
879
880 RecMdcKalTrack *mdcKalTrk1;
881
882 RecMdcKalTrack *mdcKalTrk2;
883
884 HepLorentzVector p41e,p42e,p4le;
885 Hep3Vector p31e,p32e,p3le;
886 HepLorentzVector p41m,p42m,p4lm;
887 Hep3Vector p31m,p32m,p3lm;
888 HepLorentzVector p41h,p42h,p4lh;
889 Hep3Vector p31h,p32h,p3lh;
890 WTrackParameter w1_ini,w1_ve,w1_vmu;
891 WTrackParameter w2_ini,w2_ve,w2_vmu;
892 int iip=0;
893 int iim=0;
894 for(int i = 0; i < m_ngch; i++ ){
895 if(m_charge[i]>0)itTrk1= evtRecTrkCol->begin() + iGood[i];
896 if(m_charge[i]<0) itTrk2= evtRecTrkCol->begin() + iGood[i];
897 if(m_charge[i]>0) mdcKalTrk1 = (*itTrk1)->mdcKalTrack();
898 if(m_charge[i]<0) mdcKalTrk2 = (*itTrk2)->mdcKalTrack();
899 if(m_charge[i]>0)iip=i;
900 if(m_charge[i]<0)iim=i;
901
902
903
904 if(m_charge[i]>0) w1_ini=WTrackParameter (xmass[2],mdcKalTrk1->helix(),mdcKalTrk1->err());
905 if(m_charge[i]<0) w2_ini=WTrackParameter (xmass[2],mdcKalTrk2 ->helix(),mdcKalTrk2 ->err());
906 if(m_charge[i]>0) p41h =w1_ini.p();
907 if(m_charge[i]<0) p42h =w2_ini.p();
908 if(m_charge[i]>0) p41h.boost(u_cms);
909 if(m_charge[i]<0) p42h.boost(u_cms);
910 if(m_charge[i]>0) p31h = p41h.vect();
911 if(m_charge[i]<0) p32h = p42h.vect();
912
913 if(m_charge[i]>0) p41e =w1_ini.p();
914 if(m_charge[i]<0) p42e =w2_ini.p();
915 if(m_charge[i]>0) p41e.boost(u_cms);
916 if(m_charge[i]<0) p42e.boost(u_cms);
917 if(m_charge[i]>0) p31e = p41e.vect();
918 if(m_charge[i]<0) p32e = p42e.vect();
919
920
921
922
923 if(m_charge[i]>0){
924 m_px_cms_ep=p41h.px();
925 m_py_cms_ep=p41h.py();
926 m_pz_cms_ep=p41h.pz();
927 m_e_cms_ep=p41h.e();
928 }
929 if(m_charge[i]<0){
930 m_px_cms_em=p42h.px();
931 m_py_cms_em=p42h.py();
932 m_pz_cms_em=p42h.pz();
933 m_e_cms_em=p42h.e();
934 }
935
936 }
937 double e01=m_e_emc[iip];//m_e_cms_ep;
938 double e02=m_e_emc[iim];//m_e_cms_em;
939
940 int ilarge=( e01 > e02 ) ?iip:iim;
941
942 p4lh=( e01 > e02 ) ?p41h:p42h;
943
944 p3lh=( e01 > e02 ) ?p31h:p32h;
945
946 double acollh= 180.-p31h.angle(p32h)* 180.0 / CLHEP::pi;
947 double acoplh= 180.- (p31h.perpPart()).angle(p32h.perpPart ())* 180.0 / CLHEP::pi;
948 double poeb1h=p41h.rho()/beamEnergy;
949 double poeb2h=p42h.rho()/beamEnergy;
950 double poeblh=p4lh.rho()/beamEnergy;
951
952 double eoeb1=m_e_emc[iip]/beamEnergy;
953 double eoeb2=m_e_emc[iim]/beamEnergy;
954 double eop1=0;
955 if(p41h.rho()>0)eop1=m_e_emc[iip]/p41h.rho();
956 double eop2=0;
957 if(p42h.rho()>0)eop2=m_e_emc[iim]/p42h.rho();
958
959 double eope1=0;
960 if(p41e.rho()>0)eope1=m_e_emc[iip]/p41e.rho();
961 double eope2=0;
962 if(p42e.rho()>0)eope2=m_e_emc[iim]/p42e.rho();
963 double eopm1=0;
964 if(p41m.rho()>0)eopm1=m_e_emc[iip]/p41m.rho();
965 double eopm2=0;
966 if(p42m.rho()>0)eopm2=m_e_emc[iim]/p42m.rho();
967
968 double exoeb1= m_e_emc[iip]*sin(m_theta_emc[iip])*cos(m_phi_emc[iip])/beamEnergy;
969 double eyoeb1= m_e_emc[iip]*sin(m_theta_emc[iip])*sin(m_phi_emc[iip])/beamEnergy;
970 double ezoeb1=m_e_emc[iip]*cos(m_theta_emc[iip])/beamEnergy;
971 double etoeb1=m_e_emc[iip]*sin(m_theta_emc[iip])/beamEnergy;
972
973 double exoeb2= m_e_emc[iim]*sin(m_theta_emc[iim])*cos(m_phi_emc[iim])/beamEnergy;
974 double eyoeb2= m_e_emc[iim]*sin(m_theta_emc[iim])*sin(m_phi_emc[iim])/beamEnergy;
975 double ezoeb2=m_e_emc[iim]*cos(m_theta_emc[iim])/beamEnergy;
976 double etoeb2=m_e_emc[iim]*sin(m_theta_emc[iim])/beamEnergy;
977
978 double eoebl=m_e_emc[ilarge]/beamEnergy;
979
980 double eopl=0;
981 if(p4lh.rho()>0)eopl=m_e_emc[ilarge]/p4lh.rho();
982
983 double exoebl= m_e_emc[ilarge]*sin(m_theta_emc[ilarge])*cos(m_phi_emc[ilarge])/beamEnergy;
984 double eyoebl= m_e_emc[ilarge]*sin(m_theta_emc[ilarge])*sin(m_phi_emc[ilarge])/beamEnergy;
985 double ezoebl=m_e_emc[ilarge]*cos(m_theta_emc[ilarge])/beamEnergy;
986 double etoebl=m_e_emc[ilarge]*sin(m_theta_emc[ilarge])/beamEnergy;
987
988 int mucinfo1=(m_nhit_muc[iip]>=2&&m_nlay_muc[iip]>=2 ) ? 1 : 0;
989 int mucinfo2=(m_nhit_muc[iim]>=2&&m_nlay_muc[iim]>=2) ? 1 : 0;
990 int mucinfol=(m_nhit_muc[ilarge]>=2&&m_nlay_muc[ilarge]>=2) ? 1 : 0;
991 int pidel=( e01 > e02 ) ? m_nep : m_nem;
992 int pidmul=( e01 > e02 ) ? m_nmup : m_nmum;
993 double deltatof=0.0;
994
995
996// if(m_tof_btof2[iip]*m_tof_btof2[iim]!=0) deltatof+=fabs(m_tof_btof2[iip]-m_tof_btof2[iim]);
997// if(m_tof_btof1[iip]*m_tof_btof1[iim]!=0)deltatof+=fabs(m_tof_btof1[iip]-m_tof_btof1[iim]);
998// if(m_tof_etof[iip]*m_tof_etof[iim]!=0)deltatof+=fabs(m_tof_etof[iip]-m_tof_etof[iim]);
999
1000 // if(!m_endcap) {
1001 if(m_t_btof[iip]*m_t_btof[iim]!=0) deltatof=fabs(m_t_btof[iip]-m_t_btof[iim]);
1002 // }
1003 // else {
1004 // if(m_t_etof[iip]*m_t_etof[iim]!=0)deltatof=fabs(m_t_etof[iip]-m_t_etof[iim]);
1005 // }
1006
1007
1008
1009
1010
1011
1012 // if (acollh>m_acoll_h_cut)m_hadrontag+=1;
1013 if ((acollh>m_acoll_h_cut)||(!m_useEMC||m_nGam>=m_ngam_h_cut))m_hadrontag+=11;
1014 if (!m_useTOF||(deltatof<m_dtof_h_cut))m_hadrontag+=100;
1015 if (!m_useMUC||(mucinfo1==0||mucinfo2==0))m_hadrontag+=1000;
1016 if (!m_useEMC||(fabs(eope1-1)>m_eop_h_cut&&fabs(eope2-1)>m_eop_h_cut))m_hadrontag+=10000;
1017
1018
1019
1020 m_deltatof=deltatof;
1021 m_eop1=eope1;
1022 m_eop2=eope2;
1023 m_eoeb1=eoeb1;
1024 m_eoeb2=eoeb2;
1025
1026 m_etoeb1=etoeb1;
1027 m_etoeb2=etoeb2;
1028 m_mucinfo1=mucinfo1;
1029 m_mucinfo2=mucinfo2;
1030
1031
1032
1033
1034
1035 m_acoll=acollh;
1036 m_acopl=acoplh;
1037 m_poeb1=poeb1h;
1038 m_poeb2=poeb2h;
1039 m_cos_ep=p41h.cosTheta ();
1040 m_cos_em=p42h.cosTheta ();
1041 m_mass_ee=(p41h+p42h).m();
1042
1043
1044
1045
1046
1047 }
1048 double br=0;
1049 double bz=0;
1050 double thr=0;
1051 double evis=0;
1052 WTrackParameter w1_vh,w2_vh,w3_vh;
1053
1054 br=sqrt((px_had+ex_gam)*(px_had+ex_gam)+
1055 (py_had+ey_gam)*(py_had+ey_gam))/(pt_had+et_gam);
1056 bz= fabs(pz_had+ez_gam)/(p_had+e_gam);
1057 thr=p_had+e_gam;
1058 evis=e_had+e_gam;
1059 if(!m_useEMC||((br<m_br_h_cut)&&(bz<m_bz_h_cut)))m_hadrontag+=100000;
1060 if(!m_useEMC||thr/beamEnergy>m_thr_h_cut) m_hadrontag+=1000000;
1061 m_emax=egam_ext;
1062 m_esum=e_gam;
1063 m_br=br;
1064 m_bz=bz;
1065 m_thr=thr;
1066 m_evis=evis;
1067 log << MSG::INFO << "m_hadrontag= "<<m_hadrontag << endreq;
1068// std::cout<<"m_sbhabhatag= "<<m_sbhabhatag<<std::endl;
1069// std::cout<<"m_sdimutag= "<<m_sdimutag<<std::endl;
1070// std::cout<<"m_hadrontag= "<<m_hadrontag<<std::endl;
1071 if(m_hadrontag==1111111){
1072 nhadron++;
1073 if(m_writentuple)m_tuple1 -> write();
1074 for(int i = 0; i < m_ngch; i++ ){
1075 m_ha_costheta->Fill(cos(m_theta[i]));
1076 m_ha_phi->Fill(m_phi[i]);
1077 }
1078 if(m_ngch >= 3){
1079 RecMdcKalTrack *ktrk0 = (*(evtRecTrkCol->begin() + iGood[0]))->mdcKalTrack();
1080 RecMdcKalTrack *ktrk1 = (*(evtRecTrkCol->begin() + iGood[1]))->mdcKalTrack();
1081 RecMdcKalTrack *ktrk2 = (*(evtRecTrkCol->begin() + iGood[2]))->mdcKalTrack();
1082// w1_vh=WTrackParameter (xmass[2],ktrk0->getZHelix(),ktrk0->getZError());
1083// w2_vh=WTrackParameter (xmass[2],ktrk1->getZHelix(),ktrk1->getZError());
1084// w3_vh=WTrackParameter (xmass[2],ktrk2->getZHelix(),ktrk2->getZError());
1085// vtxfit->init();
1086// vtxfit->AddTrack(0, w1_vh);
1087// vtxfit->AddTrack(1, w2_vh);
1088// vtxfit->AddTrack(2, w3_vh);
1089// vtxfit->AddVertex(0, vxpar,0, 1);
1090// if(vtxfit->Fit(0)) {
1091// m_ha_vx->Fill((vtxfit->vx(0)).x());
1092// m_ha_vy->Fill((vtxfit->vx(0)).y());
1093// m_ha_vz->Fill((vtxfit->vx(0)).z());
1094// }
1095
1096 //ktrk0->setPidType(RecMdcKalTrack::pion);
1097 // ktrk1->setPidType(RecMdcKalTrack::pion);
1098 // ktrk2->setPidType(RecMdcKalTrack::pion);
1099 fvtxfit->init();
1100 fvtxfit->addTrack(0,ktrk0->helix(), ktrk0->err());
1101 fvtxfit->addTrack(1,ktrk1->helix(), ktrk1->err());
1102 fvtxfit->addTrack(2,ktrk2->helix(), ktrk2->err());
1103 if(fvtxfit->Fit()) {
1104 m_ha_vx->Fill((fvtxfit->Vx())[0]);
1105 m_ha_vy->Fill((fvtxfit->Vx())[1]);
1106 m_ha_vz->Fill((fvtxfit->Vx())[2]);
1107 }
1108
1109
1110 }
1111
1112 m_ha_br->Fill(br);
1113 m_ha_bz->Fill(bz);
1114 m_ha_pmax->Fill(p_max);
1115 m_ha_emax->Fill(e_max);
1116 m_ha_etot->Fill(evis);
1117 m_ha_nneu->Fill(nGam);
1118 m_ha_nchg->Fill(m_ngch);
1119 setFilterPassed(true);
1120 if(m_ngch==0){
1121 n0prong++;
1122
1123 }
1124 if(m_ngch==2&&nCharge == 0){
1125 n2prong++;
1126
1127 }
1128 if(m_ngch==4&&nCharge == 0){
1129 n4prong++;
1130
1131 }
1132
1133 if(m_ngch>4){
1134 ng4prong++;
1135
1136 }
1137
1138 }
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154 return StatusCode::SUCCESS;
1155
1156
1157
1158
1159
1160
1161}
1162
1163// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1165
1166 MsgStream log(msgSvc(), name());
1167 log << MSG::INFO << "in finalize()" << endmsg;
1168 return StatusCode::SUCCESS;
1169}
1170
1171
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
const Hep3Vector u_cms
Definition: DQADtagAlg.cxx:62
const HepLorentzVector p_cms(0.034067, 0.0, 0.0, 3.097)
HepGeom::Point3D< double > HepPoint3D
std::vector< HepLorentzVector > Vp4
const double xmass[5]
const double velc
const double mk
const double mpi
std::vector< int > Vint
const Int_t n
Double_t x[10]
EvtRecTrackCol::iterator EvtRecTrackIterator
Definition: EvtRecTrack.h:131
const double xmass[5]
Definition: Gam4pikp.cxx:50
const double velc
Definition: Gam4pikp.cxx:51
std::vector< int > Vint
Definition: Gam4pikp.cxx:52
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition: KK2f.h:50
INTupleSvc * ntupleSvc()
IMessageSvc * msgSvc()
StatusCode initialize()
StatusCode finalize()
StatusCode execute()
DQASelHadron(const std::string &name, ISvcLocator *pSvcLocator)
double dy() const
double latMoment() const
Definition: DstEmcShower.h:52
double a42Moment() const
Definition: DstEmcShower.h:54
double eSeed() const
Definition: DstEmcShower.h:47
double dphi() const
Definition: DstEmcShower.h:44
double theta() const
Definition: DstEmcShower.h:38
int module() const
Definition: DstEmcShower.h:33
double e3x3() const
Definition: DstEmcShower.h:48
double dz() const
double phi() const
Definition: DstEmcShower.h:39
double dx() const
Definition: DstEmcShower.cxx:3
double secondMoment() const
Definition: DstEmcShower.h:51
double x() const
Definition: DstEmcShower.h:35
double e5x5() const
Definition: DstEmcShower.h:49
double time() const
Definition: DstEmcShower.h:50
double z() const
Definition: DstEmcShower.h:37
int numHits() const
Definition: DstEmcShower.h:30
double a20Moment() const
Definition: DstEmcShower.h:53
double energy() const
Definition: DstEmcShower.h:45
double dE() const
Definition: DstEmcShower.h:46
double dtheta() const
Definition: DstEmcShower.h:43
double y() const
Definition: DstEmcShower.h:36
const Hep3Vector emcPosition() const
Definition: DstExtTrack.h:126
const int emcVolumeNumber() const
Definition: DstExtTrack.h:132
double probPH() const
Definition: DstMdcDedx.h:66
double chiE() const
Definition: DstMdcDedx.h:59
int numTotalHits() const
Definition: DstMdcDedx.h:65
int numGoodHits() const
Definition: DstMdcDedx.h:64
double normPH() const
Definition: DstMdcDedx.h:67
double chiPi() const
Definition: DstMdcDedx.h:61
double chiK() const
Definition: DstMdcDedx.h:62
double chiMu() const
Definition: DstMdcDedx.h:60
double chiP() const
Definition: DstMdcDedx.h:63
const double y() const
const HepVector & helix() const
const double px() const
const double z() const
static void setPidType(PidType pidType)
const double pz() const
const double py() const
const double p() const
const HepSymMatrix & err() const
const double x() const
const double pxy() const
const double theta() const
Definition: DstMdcTrack.h:59
const double py() const
Definition: DstMdcTrack.h:56
const HepSymMatrix err() const
const int charge() const
Definition: DstMdcTrack.h:53
const double px() const
Definition: DstMdcTrack.h:55
const double phi() const
Definition: DstMdcTrack.h:60
const double pz() const
Definition: DstMdcTrack.h:57
const HepVector helix() const
......
const double z() const
Definition: DstMdcTrack.h:63
const double p() const
Definition: DstMdcTrack.h:58
const double y() const
Definition: DstMdcTrack.h:62
const double x() const
Definition: DstMdcTrack.h:61
int numHits() const
Definition: DstMucTrack.h:41
int numLayers() const
Definition: DstMucTrack.h:42
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition: EmcID.cxx:38
static FastVertexFit * instance()
void addTrack(const int number, const HepVector helix, const HepSymMatrix err)
HepVector Vx() const
Definition: FastVertexFit.h:40
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
int useTof2() const
int methodProbability() const
int useDedx() const
int onlyMuon() const
int onlyElectron() const
int onlyPion() const
int useTof1() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
double probKaon() const
Definition: ParticleID.h:131
void setMethod(const int method)
Definition: ParticleID.h:101
double prob(int n) const
Definition: ParticleID.h:121
double chiTof2(int n) const
void identify(const int pidcase)
Definition: ParticleID.h:110
double probMuon() const
Definition: ParticleID.h:129
double probElectron() const
Definition: ParticleID.h:128
void usePidSys(const int pidsys)
Definition: ParticleID.h:104
static ParticleID * instance()
Definition: ParticleID.cxx:22
bool IsPidInfoValid() const
double probPion() const
Definition: ParticleID.h:130
double chiTof1(int n) const
void calculate()
Definition: ParticleID.cxx:101
void init()
Definition: ParticleID.cxx:27
double probProton() const
Definition: ParticleID.h:132
double chiDedx(int n) const
RecEmcID getShowerId() const
Definition: RecEmcShower.h:55
RecEmcEnergy getEAll() const
Definition: RecEmcShower.h:92
bool is_barrel() const
Definition: TofHitStatus.h:26
unsigned int layer() const
Definition: TofHitStatus.h:28
bool is_cluster() const
Definition: TofHitStatus.h:25
void setStatus(unsigned int status)
bool is_counter() const
Definition: TofHitStatus.h:24
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.
HepLorentzVector p() const
_EXTERN_ std::string EvtRecEvent
Definition: EventModel.h:134
_EXTERN_ std::string EvtRecTrackCol
Definition: EventModel.h:135
const float pi
Definition: vector3.h:133