BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
TrkHotListFull.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: TrkHotListFull.cxx,v 1.1.1.1 2005/04/21 06:01:42 zhangy Exp $
4//
5// Description:
6//
7//
8// Environment:
9// Software developed for the BaBar Detector at the SLAC B-Factory.
10//
11// Author(s): Steve Schaffner
12//
13//------------------------------------------------------------------------
14
15//#include "BaBar/BaBar.h"
18#include "TrkBase/TrkHitOnTrk.h"
19#include "TrkBase/TrkView.h"
20//#include "ErrLogger/ErrLog.h"
22#include <assert.h>
23#include <algorithm>
24#include <functional>
25
26// Default ctor
27// Special case of ctor below:
28
30{
31}
32
33
35{
36 //TrkHotListFull::clone come here
37 _hotlist.reserve(dfltCapac());
38//Clones Hots, and makes each point at the new track.
39 for (TrkHotList::hot_iterator i = inHots.begin();i!=inHots.end();++i) {
40// i->printAll(std::cout);//yzhang debug
41 _hotlist.push_back(f(*i));
42 }
43}
44
45
47{
48 _hotlist.reserve(dfltCapac());
49// shallow copy the hots and remove from input hotList
50 for (TrkHotList::nc_hot_iterator i = inHots.begin();i!=inHots.end();++i) {
51 _hotlist.push_back(f(*i));
52 }
53 inHots.hotlist().clear();
54}
55
56
59{
60 return new TrkHotListFull(*this, f);
61}
62
64{
65// std::cout << " ~TrkHotListFull" << std::endl;//yzhang debug
66// turn the parents off before deleting hots. This avoids a cyclic delete error
67// when deleting a track
68// std::for_each(begin(),end(),setParent(0));
69 std::for_each(_hotlist.begin(),_hotlist.end(),bes::Collection::DeleteObject());
70}
71
72size_t
73TrkHotListFull::dfltCapac()
74{
75 static size_t _dfltCapac = 75;
76 return _dfltCapac;
77}
78
79void
81{
82 std::for_each(begin(),end(),updateMeasurement(0,false));
83 sort();
84}
85
86void
88{
89 _hotlist.push_back(newHot);
90}
91
92void
94{
95 typedef std::vector<TrkHitOnTrk*>::iterator iter_t;
96 iter_t i = std::find(_hotlist.begin(),_hotlist.end(),deadHot);
97 if (i!=_hotlist.end()) {
98 delete *i;
99 _hotlist.erase(i);
100 } else
101 std::cout<<"ErrMsg(error) "<< " you asked to remove a hit which I don't have! " << std::endl;
102}
103
106{
108 TrkHotList::hot_iterator i = std::find_if(begin(),end(),match);
109 return i==end()?0:const_cast<TrkHitOnTrk*>( i.get() ); // FIXME: return (non)const TrkHitOnTrk from (non)const
110}
111
112int
114{
115 int nAct = 0;
116 for (TrkHotList::hot_iterator i = begin();i!=end();++i) {
117 if (i->isActive())
118 if(view == TrkEnums::bothView || i->whatView() == view)++nAct;
119 }
120 return nAct;
121}
122
123int
125{
126 if(view == TrkEnums::bothView)
127 return end()-begin();
128 else {
129 int nAct = 0;
130 for (TrkHotList::hot_iterator i = begin();i!=end();++i) {
131 if(i->whatView() == view)++nAct;
132 }
133 return nAct;
134 }
135}
136
137bool
139{
140 return true;
141}
142
143int
145{
146 bool activeOnly(true);
149// FIXME: W6U1 doesn't have std::count (at least, not in the config used by BaBar!)
150// FIXME: std::compose2 is an SGI extension...
151// return std::count(begin(),end(),std::compose2(std::logical_and<bool>(),mdc,v);
152 int n = 0;
153 for (TrkHotList::hot_iterator i = begin();i!=end();++i)
154 if(mdc(*i)&&v(*i)) ++n;
155 return n;
156}
157
158int
160{
161 bool activeOnly(true);
164// FIXME: W6U1 doesn't have std::count (at least, not in the config used by BaBar!)
165// FIXME: std::compose2 is an SGI extension...
166// return std::count(begin(),end(),std::compose2(std::logical_and<bool>(),svt,v);
167 int n = 0;
168 for (TrkHotList::hot_iterator i = begin();i!=end();++i)
169 if (svt(*i)&&v(*i)) ++n;
170 return n;
171}
172
173double
175{
177 TrkHotList::hot_iterator i = std::find_if(begin(),end(),active);
178 return i == end() ? 9999 : i->fltLen();
179}
180
181double
183{
184 double maxFlt = -9999;
188 while (i-- != b) {
189 if (predicate(*i)) {
190 maxFlt = i->fltLen();
191 break;
192 }
193 }
194 return maxFlt;
195}
196
197
200{
201 TrkView retval;
202 bool activeOnly(true);
205 // FIXME: std::compose2 is an SGI extension...
206 for(TrkHotList::hot_iterator i=begin();i!=end();++i)
207 if (svt(*i)&&l(*i)) retval.addView(i->whatView());
208 return retval;
209}
210
211unsigned
213{
214 unsigned firstlay(50);
215 bool activeOnly(true);
217 for (TrkHotList::hot_iterator i = begin();i!=end();++i) {
218 if (mdc(*i)) firstlay = std::min(firstlay,i->layerNumber());
219 }
220 return firstlay<50?firstlay:0;
221}
222
223unsigned
225{
226 unsigned lastlay(0);
227 bool activeOnly(true);
229 for (TrkHotList::hot_iterator i = begin();i!=end();++i) {
230 if (mdc(*i)) lastlay = std::max(lastlay,i->layerNumber());
231 }
232 return lastlay;
233}
234
235const std::vector<TrkHitOnTrk*>&
237{
238 return _hotlist;
239}
240
241std::vector<TrkHitOnTrk*>&
243{
244 return _hotlist;
245}
246
247bool
248TrkHotListFull::isActive(unsigned ihot) const {
249 if(ihot<_hotlist.size())
250 return _hotlist[ihot]->isActive();
251 else
252 return false;
253}
254
std::string mdc
Definition: CalibModel.cxx:45
const Int_t n
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
pointer get() const
TrkErrCode updateMeasurement(TrkHitOnTrk &hot, const TrkDifTraj *traj=0, bool maintainAmbiguity=false) const
virtual unsigned firstMdcLayer() const
virtual int nActive(TrkEnums::TrkViewInfo view=TrkEnums::bothView) const
virtual unsigned lastMdcLayer() const
virtual bool isActive(unsigned ihot) const
TrkHotList * clone(TrkBase::Functors::cloneHot func) const
virtual int nSvt(TrkEnums::TrkViewInfo view=TrkEnums::bothView) const
virtual TrkView svtView(int layer) const
virtual double startFoundRange() const
virtual int nHit(TrkEnums::TrkViewInfo view=TrkEnums::bothView) const
virtual const std::vector< TrkHitOnTrk * > & hotlist() const
TrkHitOnTrk * findHot(const TrkFundHit *) const
virtual int nMdc(TrkEnums::TrkViewInfo view=TrkEnums::bothView) const
virtual double endFoundRange() const
virtual ~TrkHotListFull()
virtual bool hitCapable() const
void append(TrkHitOnTrk *)
void remove(TrkHitOnTrk *)
hot_iterator end() const
Definition: TrkHotList.h:45
virtual void sort()
Definition: TrkHotList.cxx:71
hot_iterator begin() const
Definition: TrkHotList.h:44
void addView(TrkEnums::TrkViewInfo view)
Definition: TrkView.cxx:53
TrkViewInfo
Definition: TrkEnums.h:22
@ bothView
Definition: TrkEnums.h:22