Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

cluster::HitClusterFast Class Reference

#include <HitClusterFast.h>

List of all members.

Public Member Functions

 HitClusterFast ()
 ~HitClusterFast ()
std::vector< ClusterMakeCluster (std::vector< unsigned int > splithits, std::vector< const CellHit * > &cellhit)
void printmap (planecellindex mappii, std::vector< const CellHit * > &cellhit)
void ProcessPlane (cellcellhitindex cchindex, std::vector< Cluster > &planecluster, std::vector< const CellHit * > &cellhit)
std::vector< ClusterMakeClusters (std::vector< const CellHit * > &cellhit)


Constructor & Destructor Documentation

cluster::HitClusterFast::HitClusterFast  )  [inline]
 

Definition at line 24 of file HitClusterFast.h.

00024 {};

cluster::HitClusterFast::~HitClusterFast  )  [inline]
 

Definition at line 25 of file HitClusterFast.h.

00025 {};


Member Function Documentation

std::vector< Cluster > HitClusterFast::MakeCluster std::vector< unsigned int >  splithits,
std::vector< const CellHit * > &  cellhit
 

Definition at line 139 of file HitClusterFast.cxx.

References recobase::Cluster::Add(), recobase::Cluster::Clear(), recobase::Cluster::NCell(), and recobase::CellHit::PECorr().

Referenced by ProcessPlane().

00140 {
00141   std::vector<Cluster> rp(0);
00142 
00143   //can look for multiple peaks here....
00144   //and if we find multiple peaks, we need a better way of handling it
00145 
00146 
00147 
00148   Cluster tp;
00149   //add all of the hits in the rand to tp
00150 
00151   for (unsigned int i=0;i<splithits.size();i++)
00152     {
00153 
00154 
00155 /*      if(i==0)
00156         {
00157           tp.fPlane=cellhit[splithits[i]]->Plane();
00158 
00159         }
00160 */
00161       float peCorrL=0.0;
00162       float peCorrR=0.0;
00163 
00164       if(i==0) peCorrL=0.0;
00165       else
00166         {
00167           const recobase::CellHit* conct = cellhit[splithits[i-1]];
00168           recobase::CellHit *ct = new recobase::CellHit(*conct);
00169           peCorrL = ct->PECorr();
00170         }
00171 
00172       if(i==splithits.size()-1) peCorrR=0.0;
00173       else
00174         {
00175           const recobase::CellHit* conct = cellhit[splithits[i+1]];
00176           recobase::CellHit *ct = new recobase::CellHit(*conct);
00177           peCorrR = ct->PECorr();
00178         }
00179 
00180       const recobase::CellHit* conct = cellhit[splithits[i]];
00181       recobase::CellHit *ct = new recobase::CellHit(*conct);
00182       tp.Add(ct);
00183         
00184       float curPECorr;
00185       curPECorr = ct->PECorr();
00186 
00187       if(curPECorr < peCorrL 
00188          && curPECorr < peCorrR 
00189          && curPECorr/(peCorrL + peCorrR) < 0.5)
00190         {
00191           rp.push_back(tp);
00192           tp.Clear();
00193         }
00194 
00195     }
00196 
00197   if(tp.NCell()>0)
00198     {
00199 
00200       rp.push_back(tp);
00201     }
00202 
00203 
00204 
00205   return rp;
00206 }

std::vector< Cluster > HitClusterFast::MakeClusters std::vector< const CellHit * > &  cellhit  ) 
 

Definition at line 14 of file HitClusterFast.cxx.

References cluster::planecellindex, and ProcessPlane().

Referenced by cluster::Clusterer::Reco().

00015 {
00016   std::vector<Cluster> planecluster(0);
00017   if(cellhit.size()<1)
00018     {
00019       cout <<"no cellhits!!!\n";
00020       return planecluster;
00021     }
00022 
00023 
00024   planecellindex pcindex;
00025 
00026   printf("hitclusterfast over %d hits\n",(int)cellhit.size());
00027   //load cell hits into maps so that they can be sorted by plane, cluster
00028   for (unsigned int i=0;i<cellhit.size();i++)
00029     {
00030       unsigned int p = cellhit[i]->Plane();
00031       unsigned int c = cellhit[i]->Cell();
00032 
00033 
00034       pcindex[p].insert(cellcellhitindex::value_type(c,i));
00035     }
00036 
00037 
00038   //printmap(pcindex,cellhit);
00039 
00040   //foreach plane in pcindex
00041   planecellindex::iterator pcitr=pcindex.begin();
00042   while(pcitr!=pcindex.end())
00043     {
00044       ProcessPlane(pcitr->second,planecluster,cellhit);
00045       pcitr++;
00046     }
00047 
00048 
00049   /*
00051 
00052 
00053 for(unsigned int a=0;a<planecluster.size();a++)
00054 {
00055 printf("plane: %d cell: ",planecluster[a].Plane());
00056 for(unsigned int aa=0;aa<planecluster[a].fCellHit.size();aa++)
00057 {
00058 printf("%d ",planecluster[a].fCellHit[aa]->Cell());
00059 
00060 }
00061 printf("\n");
00062 }
00063 
00065 */
00066 
00067      printf("Clusterer has created %d plane clusters...\n",(int)planecluster.size());
00068      return planecluster;
00069 }

void HitClusterFast::printmap planecellindex  mappii,
std::vector< const CellHit * > &  cellhit
 

Definition at line 209 of file HitClusterFast.cxx.

References recobase::CellHit::PECorr(), and recobase::CellHit::TNS().

00210 {
00211   map<unsigned int,cellcellhitindex>::iterator iter;
00212   for( iter = ma.begin(); iter != ma.end(); iter++ ) {
00213     cout << "plane " << iter->first <<"\n";
00214 
00215     map<unsigned int,unsigned int>::iterator iter2;
00216     for( iter2 = iter->second.begin(); iter2 != iter->second.end(); iter2++ ) {
00217      
00218       CellHit tc = *cellhit[iter2->second];
00219 
00220       if(tc.PECorr() > 0.0);
00221       if(tc.TNS() > 0.0);
00222       cout << "\t\t" << iter2->first << " " 
00223            << iter2->second << " " 
00224            << "Energy (PE): " << tc.PECorr() << " " 
00225            << "Time (ns): " << tc.TNS() 
00226            << endl;
00227     }
00228   }
00229 }

void HitClusterFast::ProcessPlane cellcellhitindex  cchindex,
std::vector< Cluster > &  planecluster,
std::vector< const CellHit * > &  cellhit
 

Definition at line 72 of file HitClusterFast.cxx.

References MakeCluster().

Referenced by MakeClusters().

00073 {
00074   if(cchindex.size()<1)return;
00075 
00076   //find split points
00077   unsigned int gapSize=3;
00078 
00079   std::vector<unsigned int> splithits(0);
00080   std::vector<std::vector<unsigned int> > splits(0);
00081 
00082   cellcellhitindex::iterator itr;
00083   cellcellhitindex::iterator itr2;
00084 
00085   itr=cchindex.begin();
00086 
00087   itr2=cchindex.begin();itr2++;
00088 
00089   unsigned int curcell=itr->first;
00090 
00091   while(itr != cchindex.end())
00092     {
00093       unsigned int nextcell = itr2->first;
00094       if(nextcell-curcell>gapSize)
00095         {
00096           splithits.push_back(itr->second);
00097           splits.push_back(splithits);
00098           splithits.clear();
00099         }
00100       else
00101         {
00102           splithits.push_back(itr->second);
00103         }
00104 
00105       curcell=nextcell;
00106       itr++;itr2++;
00107     }
00108 
00109 
00110   if(splithits.size()>0)
00111     {
00112       splits.push_back(splithits);
00113       splithits.clear();
00114     }
00115   //for each split point pair
00116   //MakeCluster(    map<unsigned int,unsigned int>::iterator beg,     map<unsigned int,unsigned int>::iterator end, std::vector<const CellHit*>&cellhit)
00117 
00118   for(unsigned int i=0;i<splits.size();i++)
00119     {
00120         
00121       //printf("split with %d hits\n",splits[i].size());
00122 
00123 
00124       std::vector<Cluster>  tc(0);
00125       tc = MakeCluster(splits[i],cellhit);
00126 
00127       //for each Cluster in tc, push back into planecluster
00128       for(unsigned int j=0;j<tc.size();j++)
00129         {
00130           planecluster.push_back(tc[j]);
00131         }
00132 
00133     }
00134 
00135 
00136 }


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 04:45:30 2009 for NOvA Offline by  doxygen 1.3.9.1