BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/Pi0RecAlg/Pi0RecAlg-00-00-06/Pi0RecAlg/MakeGroupList.h
Go to the documentation of this file.
1#ifndef MAKEGROUPLIST__H
2#define MAKEGROUPLIST__H
3
4#include <list>
5#include <algorithm>
6#include "Criteria.h"
7#include "VertexFit/KinematicFit.h"
8#include "CLHEP/Vector/LorentzVector.h"
9#include "EvtRecEvent/EvtRecEvent.h"
10#include "EvtRecEvent/EvtRecTrack.h"
11#include "Pi0Cut.h"
12namespace Pi0{
13
14
15 typedef std::list<Criteria> CriteriaList;
16 typedef std::list<Criteria>::iterator CriteriaIterator;
17 typedef std::list<Criteria>::const_iterator Const_CriteriaIteator;
18
19 typedef std::list<GammaPair> Pi0List;
20 typedef std::list<GammaPair>::iterator Pi0Iterator;
21 typedef std::list<GammaPair>::const_iterator Const_Pi0Iterator;
22
23 typedef std::list<EvtRecTrack*> GammaList;
24 typedef std::list<EvtRecTrack*>::iterator GammaIterator;
25 typedef std::list<EvtRecTrack*>::const_iterator Const_GammaIterator;
26
30 GammaList default_gamma_list;//one copy of all photons
31// GammaList update_gamma_list;//a subset of default_gamma_list
32
34// GammaList& GetUpdateGammaList() { return update_gamma_list;}
37
38// GammaList& make_gamma_list(EvtRecEvent* recEvt, EvtRecTrackCol* recTrkCol)
40 {
43
44 default_gamma_list.clear();
45// update_gamma_list.clear();
46 for(int i1 = recEvt->totalCharged(); i1 < (recEvt->totalTracks()); ++i1)
47 {
48
49 EvtRecTrack* gTrk = *(recTrkCol->begin() + i1);
50 if(cut.isGoodPhoton(gTrk))
51 {
52 default_gamma_list.push_back(gTrk);
53// update_gamma_list.push_back(gTrk);
54 }
55 }
56 return default_gamma_list;
57 }
58/* GammaList& remake_gamma_list_by_remove(const GammaPair& gp)//remove two gamma ref by gp from list
59 {
60 update_gamma_list.remove(gp.First);
61 update_gamma_list.remove(gp.Second);
62 return update_gamma_list;
63 }*/
64 void print_gamma_list(const GammaList& list)
65 {
66 if(list.size() == 0) {std::cout<<"GammaList->()"<<std::endl; return;}
67 std::cout<<"GammaList->(";
68 for(Const_GammaIterator it = list.begin(); it!= list.end(); it++)
69 {
70 std::cout<<(*it)->trackId()<<", ";
71 }
72 std::cout<<')'<<std::endl;
73 }
74 //=============
75 Pi0List& make_pi0_list(const GammaList& gamma_list)
76 {
77 candidate_pi0_list.clear();
78 Const_GammaIterator i_it = gamma_list.begin();
79 Const_GammaIterator i_it_end = gamma_list.end();
80 Const_GammaIterator j_it_end = gamma_list.end();
81
82 --i_it_end;
83
84 // KinematicFit * kmfit = KinematicFit::instance();
86 for(; i_it != i_it_end; ++i_it)
87 {
88 for( j_it = i_it, ++j_it ; j_it != j_it_end; ++j_it)
89 {
90
91 EvtRecTrack* g1Trk = *i_it;
92 EvtRecTrack* g2Trk = *j_it;
93
94 RecEmcShower* g1Shower = g1Trk->emcShower();
95 RecEmcShower* g2Shower = g2Trk->emcShower();
96 double inv_m = (getP4(g1Shower) + getP4(g2Shower)).m();
97
98 /* kmfit->init();
99 kmfit->AddTrack(0, 0.0, g1Shower);
100 kmfit->AddTrack(1, 0.0, g2Shower);
101 kmfit->AddResonance(0, 0.1349766, 0, 1);
102 kmfit->Fit(0);*/
103
104 candidate_pi0_list.push_back(GammaPair(*i_it, *j_it, inv_m));
105 }
106 }
107 return candidate_pi0_list;
108 }
109 void print_pi0_list(const Pi0List& list)
110 {
111 std::cout<<"OK Pi0List->{";
112 for(Const_Pi0Iterator it = list.begin(); it!= list.end(); it++)
113 {
114 std::cout<<"("<<(*it).inv_m<<","<<(*it).First->trackId()<<","<<(*it).Second->trackId()<<"), ";
115 }
116 std::cout<<'}'<<std::endl;
117 }
118 Pi0List& apply_criteria(const Criteria& cri)
119 {
120 Pi0Iterator it = candidate_pi0_list.begin();
121 for(; it!=candidate_pi0_list.end();)
122 {
123 if( cri.check(*it))
124 ++it;
125 else{
126 filter_pi0_list.push_back(*it);
127 it = candidate_pi0_list.erase(it);
128 }
129
130 }
131 return candidate_pi0_list;
132 }
133 void Pi0ListToTDS(const Pi0List& pi0list, EvtRecPi0Col* recPi0Col)
134 {
135 assert(recPi0Col);
136 static double xmpi0= 0.1349766;
138
139 for(Const_Pi0Iterator it = pi0list.begin(); it != pi0list.end(); ++it)
140 {
141 EvtRecTrack* g1Trk = (*it).First;
142 EvtRecTrack* g2Trk = (*it).Second;
143 RecEmcShower* g1Shower = g1Trk->emcShower();
144 RecEmcShower* g2Shower = g2Trk->emcShower();
145
146 kmfit->init();
147 kmfit->AddTrack(0, 0.0, g1Shower);
148 kmfit->AddTrack(1, 0.0, g2Shower);
149 kmfit->AddResonance(0, xmpi0, 0, 1);
150 kmfit->Fit(0);
151
152 HepLorentzVector g1P4 = getP4(g1Shower);
153 HepLorentzVector g2P4 = getP4(g2Shower);
154 HepLorentzVector p2g = g1P4 + g2P4;
155 EvtRecPi0* recPi0 = new EvtRecPi0();
156
157 recPi0->setUnconMass(p2g.restMass());
158 recPi0->setChisq(kmfit->chisq(0));
159 if ( g1P4.e() >= g2P4.e() ) {
160 recPi0->setHiPfit(kmfit->pfit(0));
161 recPi0->setLoPfit(kmfit->pfit(1));
162 recPi0->setHiEnGamma(g1Trk);
163 recPi0->setLoEnGamma(g2Trk);
164 }
165 else {
166 recPi0->setHiPfit(kmfit->pfit(1));
167 recPi0->setLoPfit(kmfit->pfit(0));
168 recPi0->setHiEnGamma(g2Trk);
169 recPi0->setLoEnGamma(g1Trk);
170 }
171
172 recPi0Col->push_back(recPi0);
173 }
174 }
175 //pi0 reconstruction strategy
176 /* void priority_method(int nPi0, EvtRecPi0Col* pi0_col) //reconstruct pi0 one by one
177 {
178 assert(pi0_col);
179 int i = 0;
180 Pi0List& _this = make_pi0_list(update_gamma_list);
181 print_pi0_list(_this);
182 Pi0List ret = the_most_optimized(_this);
183 Pi0List2TDS(ret, pi0_col);
184 ++i;
185 while(i<nPi0){
186 remake_gamma_list_by_remove(*(ret.begin()));
187 Pi0List& _this = make_pi0_list(update_gamma_list);
188 print_pi0_list(_this);
189 Pi0List ret = the_most_optimized(_this);
190 Pi0List2TDS(ret, pi0_col);
191 };
192 }*/
193 /* void general_method(EvtRecPi0Col* pi0_col)
194 {
195 make_pi0_list(default_gamma_list);
196 Criteria cri_inv;
197 apply_criteria(cri_inv);
198 BasicCriteria cri_kfit;
199 apply_criteria(cri_kfit);
200 Pi0ListToTDS(candidate_pi0_list, pi0_col);
201 }*/
202 void apply_criterias()
203 {
204 for(CriteriaIterator it = default_criteria_list.begin(); it != default_criteria_list.end(); ++it)
205 {
206 apply_criteria(*it);
207 }
208 }
209 void add_cut(const Criteria& cri)
210 {
211 default_criteria_list.push_back(cri);
212 }
213 /* void rec_pi0(EvtRecEvent* recEvt, EvtRecTrackCol* recTrkCol, EvtRecPi0Col* pi0_col, int nPi0=0)//nPi0, you want to reconstruct n Pi0
214 {
215 // assert(recEvt);assert(recTrkCol);
216 GammaList& gamma_list = make_gamma_list(recEvt, recTrkCol);
217 // std::cout<<"gamma in total = "<<gamma_list.size()<<std::endl;
218 // std::cout<<"maximum pi0 N = "<<gamma_list.size()/2<<std::endl;
219 // if(gamma_list.size()/2 <nPi0) nPi0 = gamma_list.size()/2;
220 // print_gamma_list(gamma_list);
221 // priority_method(nPi0, pi0_col);
222 make_pi0_list(gamma_list);
223 apply_criterias();
224 // Criteria cri_inv;
225 // apply_criteria(cri_inv);
226 // KFitCriteria cri_kfit;
227 // apply_criteria(cri_kfit);
228 candidate_pi0_list.sort(high_momentum());
229 print_pi0_list(candidate_pi0_list);
230 Pi0ListToTDS(candidate_pi0_list, pi0_col);
231 }*/
232}
233#endif
HepLorentzVector getP4(RecEmcShower *gtrk)
Definition: MyUtil.cxx:16
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared cut
Definition: KarFin.h:27
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations xmb DOUBLE PRECISION xcb DOUBLE PRECISION xmpi0
Definition: RRes.h:32
void setLoPfit(const HepLorentzVector &loPfit)
void setHiPfit(const HepLorentzVector &hiPfit)
static KinematicFit * instance()
void AddResonance(int number, double mres, std::vector< int > tlis)
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition: TrackPool.cxx:22
std::list< GammaPair >::iterator Pi0Iterator
Pi0List & make_pi0_list(const GammaList &gamma_list)
void print_gamma_list(const GammaList &list)
void print_pi0_list(const Pi0List &list)
std::list< EvtRecTrack * >::iterator GammaIterator
GammaList & make_gamma_list(UserPi0Cut &cut)
std::list< EvtRecTrack * >::const_iterator Const_GammaIterator
void Pi0ListToTDS(const Pi0List &pi0list, EvtRecPi0Col *recPi0Col)
std::list< Criteria >::const_iterator Const_CriteriaIteator
std::list< Criteria >::iterator CriteriaIterator
std::list< GammaPair >::const_iterator Const_Pi0Iterator
std::list< EvtRecTrack * > GammaList
Pi0List & apply_criteria(const Criteria &cri)
virtual bool check(const GammaPair &gp) const