BOSS 8.0.0
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"
16#include "TrkBase/TrkHotListFull.h"
17#include "TrkBase/TrkHitOnTrk.h"
18#include "TrkBase/TrkPredicates.h"
19#include "TrkBase/TrkView.h"
20// #include "ErrLogger/ErrLog.h"
21#include "MdcRecoUtil/BesCollectionUtils.h"
22#include <algorithm>
23#include <assert.h>
24#include <functional>
25
26// Default ctor
27// Special case of ctor below:
28
30
32 // TrkHotListFull::clone come here
33 _hotlist.reserve( dfltCapac() );
34 // Clones Hots, and makes each point at the new track.
35 for ( TrkHotList::hot_iterator i = inHots.begin(); i != inHots.end(); ++i )
36 {
37 // i->printAll(std::cout);//yzhang debug
38 _hotlist.push_back( f( *i ) );
39 }
40}
41
43 _hotlist.reserve( dfltCapac() );
44 // shallow copy the hots and remove from input hotList
45 for ( TrkHotList::nc_hot_iterator i = inHots.begin(); i != inHots.end(); ++i )
46 { _hotlist.push_back( f( *i ) ); }
47 inHots.hotlist().clear();
48}
49
53
55 // std::cout << " ~TrkHotListFull" << std::endl;//yzhang debug
56 // turn the parents off before deleting hots. This avoids a cyclic delete error
57 // when deleting a track
58 // std::for_each(begin(),end(),setParent(0));
59 std::for_each( _hotlist.begin(), _hotlist.end(), bes::Collection::DeleteObject() );
60}
61
62size_t TrkHotListFull::dfltCapac() {
63 static size_t _dfltCapac = 75;
64 return _dfltCapac;
65}
66
68 std::for_each( begin(), end(), updateMeasurement( 0, false ) );
69 sort();
70}
71
72void TrkHotListFull::append( TrkHitOnTrk* newHot ) { _hotlist.push_back( newHot ); }
73
75 typedef std::vector<TrkHitOnTrk*>::iterator iter_t;
76 iter_t i = std::find( _hotlist.begin(), _hotlist.end(), deadHot );
77 if ( i != _hotlist.end() )
78 {
79 delete *i;
80 _hotlist.erase( i );
81 }
82 else
83 std::cout << "ErrMsg(error) "
84 << " you asked to remove a hit which I don't have! " << std::endl;
85}
86
89 TrkHotList::hot_iterator i = std::find_if( begin(), end(), match );
90 return i == end() ? 0 : const_cast<TrkHitOnTrk*>( i.get() ); // FIXME: return (non)const
91 // TrkHitOnTrk from (non)const
92}
93
95 int nAct = 0;
96 for ( TrkHotList::hot_iterator i = begin(); i != end(); ++i )
97 {
98 if ( i->isActive() )
99 if ( view == TrkEnums::bothView || i->whatView() == view ) ++nAct;
100 }
101 return nAct;
102}
103
105 if ( view == TrkEnums::bothView ) return end() - begin();
106 else
107 {
108 int nAct = 0;
109 for ( TrkHotList::hot_iterator i = begin(); i != end(); ++i )
110 {
111 if ( i->whatView() == view ) ++nAct;
112 }
113 return nAct;
114 }
115}
116
117bool TrkHotListFull::hitCapable() const { return true; }
118
120 bool activeOnly( true );
123 // FIXME: W6U1 doesn't have std::count (at least, not in the config used by BaBar!)
124 // FIXME: std::compose2 is an SGI extension...
125 // return std::count(begin(),end(),std::compose2(std::logical_and<bool>(),mdc,v);
126 int n = 0;
127 for ( TrkHotList::hot_iterator i = begin(); i != end(); ++i )
128 if ( mdc( *i ) && v( *i ) ) ++n;
129 return n;
130}
131
133 bool activeOnly( true );
134 TrkBase::Predicates::isSvtHitOnTrack svt( activeOnly );
136 // FIXME: W6U1 doesn't have std::count (at least, not in the config used by BaBar!)
137 // FIXME: std::compose2 is an SGI extension...
138 // return std::count(begin(),end(),std::compose2(std::logical_and<bool>(),svt,v);
139 int n = 0;
140 for ( TrkHotList::hot_iterator i = begin(); i != end(); ++i )
141 if ( svt( *i ) && v( *i ) ) ++n;
142 return n;
143}
144
147 TrkHotList::hot_iterator i = std::find_if( begin(), end(), active );
148 return i == end() ? 9999 : i->fltLen();
149}
150
152 double maxFlt = -9999;
156 while ( i-- != b )
157 {
158 if ( predicate( *i ) )
159 {
160 maxFlt = i->fltLen();
161 break;
162 }
163 }
164 return maxFlt;
165}
166
168 TrkView retval;
169 bool activeOnly( true );
170 TrkBase::Predicates::isSvtHitOnTrack svt( activeOnly );
172 // FIXME: std::compose2 is an SGI extension...
173 for ( TrkHotList::hot_iterator i = begin(); i != end(); ++i )
174 if ( svt( *i ) && l( *i ) ) retval.addView( i->whatView() );
175 return retval;
176}
177
179 unsigned firstlay( 50 );
180 bool activeOnly( true );
182 for ( TrkHotList::hot_iterator i = begin(); i != end(); ++i )
183 {
184 if ( mdc( *i ) ) firstlay = std::min( firstlay, i->layerNumber() );
185 }
186 return firstlay < 50 ? firstlay : 0;
187}
188
190 unsigned lastlay( 0 );
191 bool activeOnly( true );
193 for ( TrkHotList::hot_iterator i = begin(); i != end(); ++i )
194 {
195 if ( mdc( *i ) ) lastlay = std::max( lastlay, i->layerNumber() );
196 }
197 return lastlay;
198}
199
200const std::vector<TrkHitOnTrk*>& TrkHotListFull::hotlist() const { return _hotlist; }
201
202std::vector<TrkHitOnTrk*>& TrkHotListFull::hotlist() { return _hotlist; }
203
204bool TrkHotListFull::isActive( unsigned ihot ) const {
205 if ( ihot < _hotlist.size() ) return _hotlist[ihot]->isActive();
206 else return false;
207}
std::string mdc
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
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
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 *)
TrkHitOnTrkIter< TrkHotList::iterator_traits > nc_hot_iterator
TrkHitOnTrkIter< TrkHotList::const_iterator_traits > hot_iterator
virtual void sort()
void addView(TrkEnums::TrkViewInfo view)
Definition TrkView.cxx:37