00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #include <cassert>
00012
00013 #include "Algorithm/AlgFactory.h"
00014 #include "Algorithm/AlgHandle.h"
00015 #include "Algorithm/AlgConfig.h"
00016 #include "Candidate/CandContext.h"
00017 #include "Candidate/CandHandle.h"
00018 #include "Cluster3D/AlgCluster3DList.h"
00019 #include "Cluster3D/CandCluster3D.h"
00020 #include "Cluster3D/CandCluster3D.h"
00021 #include "Cluster3D/CandCluster3DHandle.h"
00022 #include "Cluster3D/CandCluster3DList.h"
00023 #include "Cluster3D/CandCluster3DListHandle.h"
00024 #include "Conventions/PlaneView.h"
00025 #include "MessageService/MsgService.h"
00026 #include "MinosObjectMap/MomNavigator.h"
00027 #include "Navigation/NavKey.h"
00028 #include "Navigation/NavSet.h"
00029 #include "RecoBase/CandClusterHandle.h"
00030 #include "RecoBase/CandSliceHandle.h"
00031 #include "RecoBase/CandSliceListHandle.h"
00032 #include "UgliGeometry/UgliGeomHandle.h"
00033 #include "Validity/VldContext.h"
00034 #include "Cluster3D/StripKG.h"
00035 #include "Cluster3D/StripListKG.h"
00036 #include "Cluster3D/CellKG.h"
00037 #include "Cluster3D/CellListKG.h"
00038 #include "Cluster3D/ClusterKG.h"
00039 #include "Cluster3D/ClusterListKG.h"
00040
00041 ClassImp(AlgCluster3DList)
00042
00043 CVSID("$Id:");
00044
00045
00046 void AlgCluster3DList::RunAlg(AlgConfig &ac, CandHandle &ch, CandContext &cx)
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 {
00062 MSG("Cluster3D", Msg::kDebug)
00063 << "Starting AlgCluster3DList::RunAlg()" << endl;
00064
00065 assert(cx.GetDataIn());
00066
00067
00068 if (!(cx.GetDataIn()->InheritsFrom("CandSliceListHandle"))) {
00069 MSG("Cluster3D", Msg::kError)
00070 << "AlgCluster3DList::RunAlg() No CandSliceListHandle input" << endl;
00071 return;
00072 }
00073
00074 const CandSliceListHandle *cslh =
00075 dynamic_cast<const CandSliceListHandle*>(cx.GetDataIn());
00076
00077
00078 CandContext cxx(this,cx.GetMom());
00079
00080
00081
00082
00083 AlgFactory &af = AlgFactory::GetInstance();
00084
00085
00086 AlgHandle ah = af.GetAlgHandle("AlgCluster3D","default");
00087
00088 const CandRecord *candrec = cx.GetCandRecord();
00089 assert(candrec);
00090 const VldContext *vldcptr = candrec->GetVldContext();
00091 assert(vldcptr);
00092 VldContext vldc = *vldcptr;
00093
00094 UgliGeomHandle ugh0(vldc);
00095 UgliGeomHandle *ugh = &ugh0;
00096
00097 Int_t islice=0;
00098
00099 CandSliceHandleItr sliceItr(cslh->GetDaughterIterator());
00100
00101
00102 while ( sliceItr.IsValid() ) {
00103
00104 MSG("Cluster3D", Msg::kDebug)
00105 << "Slice number = " << islice++ << endl;
00106
00107 CandSliceHandle *slice = sliceItr.Ptr();
00108
00109 StripListKG stripList;
00110 stripList.CreateStrips(ac,slice,ugh);
00111
00112 vector<StripKG> stps;
00113 stripList.GetStrips(stps);
00114
00115 MSG("Cluster3D", Msg::kDebug)
00116 << "Number of strips = " << stps.size() << endl;
00117
00118 CellListKG cellList;
00119
00120 cellList.CreateCells(ac,stripList);
00121
00122 vector<CellKG> cells;
00123 cellList.GetCells(cells);
00124
00125 MSG("Cluster3D", Msg::kDebug)
00126 << "Number of cells = " << cells.size() << endl;
00127
00128 ClusterListKG clusterList;
00129
00130 clusterList.CreateClusters(ac,stripList,cellList);
00131
00132 vector<ClusterKG> clsts;
00133 clusterList.GetClusters(clsts);
00134
00135 MSG("Cluster3D", Msg::kDebug)
00136 << "Number of clusters = " << clsts.size() << endl;
00137
00138 for(UInt_t i=0;i<clsts.size();++i){
00139 TObjArray striparray;
00140 MSG("Cluster3D", Msg::kDebug)
00141 << "Number of strips in " << i << " cluster= "
00142 << clsts[i].stpindexes.size() << endl;
00143 for(UInt_t j=0;j<clsts[i].stpindexes.size();++j){
00144 CandStripHandle *strip =
00145 stripList.GetStripHandle(clsts[i].stpindexes[j]);
00146 striparray.Add(strip);
00147 }
00148 cxx.SetDataIn(&striparray);
00149 CandCluster3DHandle clusterhandle =
00150 CandCluster3D::MakeCandidate(ah,cxx);
00151 ch.AddDaughterLink(clusterhandle);
00152 }
00153
00154
00155
00156
00157
00158 sliceItr.Next();
00159 }
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 }
00170
00171
00172 void AlgCluster3DList::Trace(const char * ) const
00173 {
00174 }
00175