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

cluster::Clusterer Class Reference

#include <Clusterer.h>

Inheritance diagram for cluster::Clusterer:

jobc::Module cfg::Observer List of all members.

Public Member Functions

 Clusterer (const char *version)
void Update (const cfg::Config &c)
 ~Clusterer ()
jobc::Result Reco (edm::EventHandle &evt)

Private Member Functions

void UpdatePlaneClusterStat (recobase::PlaneCluster &p)

Private Attributes

int fClusterAlgType
geo::GeometryfGeo

Constructor & Destructor Documentation

Clusterer::Clusterer const char *  version  ) 
 

Definition at line 22 of file Clusterer.cxx.

References fClusterAlgType, and cfg::Observer::SetWatch().

00022                                         : jobc::Module("Clusterer")
00023 {
00024       fClusterAlgType=0;
00025         this->SetWatch("ClustererConfig","default");
00026 }

Clusterer::~Clusterer  ) 
 

Definition at line 34 of file Clusterer.cxx.

References cfg::Observer::RemoveAllWatches().

00035 {
00036         this->RemoveAllWatches();
00037 }


Member Function Documentation

jobc::Result Clusterer::Reco edm::EventHandle evt  )  [virtual]
 

Reimplemented from jobc::Module.

Definition at line 39 of file Clusterer.cxx.

References fClusterAlgType, fGeo, edm::EventHandle::Header(), geo::Geometry::Instance(), cluster::HitCluster::MakeClusters(), edm::EventHandle::Reco(), jobc::Result, and UpdatePlaneClusterStat().

00040 {
00041 //make cell hits from rawdigits
00042 /*
00043 std::vector<const rawdata::RawDigit*> rawdigits(0);
00044 evt.Raw().Get("./",rawdigits);
00045 
00046 printf("cluster-\n");
00047 for (unsigned int i =0;i<rawdigits.size();i++)
00048 {
00049 printf("%d %d \n",i,rawdigits[i]->TDC(0));
00050 CellHit c(rawdigits[i]->Channel(),rawdigits[i]->ADC(0),rawdigits[i]->TDC(0));
00051 c.SetPlane(i/100);
00052 c.SetCell(i%100);
00053 evt.Reco().Put(c,"");
00054 }
00055 printf("-cluster\n");
00056 
00057 */
00058 
00059 
00060 
00061 //get cellhits from the file
00062 std::vector<const recobase::CellHit*> cellhit(0);
00063 //assert_jobc(evt.Reco().Get("Hits",cellhit),"No CellHits found in DetSim() folder!");
00064 
00065 try
00066 {
00067 evt.Reco().Get("Hits",cellhit);
00068 }catch(...){return jobc::kFailed;}
00069 
00070 
00071 short fDetGeom=1;
00072 //  if (!fGeo) // ideally we would use DAQHeader instead of fDetGeom...
00073     fGeo = &geo::Geometry::Instance(evt.Header().Run(), fDetGeom);
00074 
00075 
00076 evt.Reco().List();
00077 
00078 std::vector<recobase::PlaneCluster> planecluster(0);
00079 
00080 
00081 
00082 
00083 if (fClusterAlgType==0)
00084 {
00085         HitCluster a;
00086         planecluster = a.MakeClusters(cellhit);
00087 }
00088 if (fClusterAlgType==1)
00089 {
00090         HitClusterFast a;
00091         planecluster = a.MakeClusters(cellhit);
00092 }
00093 
00094 
00095 for(unsigned int i=0; i<planecluster.size(); i++)
00096         {
00097                 UpdatePlaneClusterStat(planecluster[i]);
00098 //              printf("cluster at %f %f w %f d %f\n",planecluster[i].Zpos(),planecluster[i].Tpos(),planecluster[i].fdt,planecluster[i].fdz);
00099 
00100                 evt.Reco().Put(planecluster[i],"");
00101         }
00102 
00103 evt.Reco().List();
00104 
00105 return jobc::kPassed;
00106 }

void Clusterer::Update const cfg::Config c  )  [virtual]
 

Implements cfg::Observer.

Definition at line 29 of file Clusterer.cxx.

References fClusterAlgType.

00030 {
00031 c("ClusterAlgType").Get(fClusterAlgType);
00032 }

void Clusterer::UpdatePlaneClusterStat recobase::PlaneCluster p  )  [private]
 

Definition at line 109 of file Clusterer.cxx.

References recobase::PlaneCluster::fCellHit, recobase::PlaneCluster::fdt, recobase::PlaneCluster::fdz, fGeo, recobase::PlaneCluster::ftpos, recobase::PlaneCluster::fW, recobase::PlaneCluster::fzpos, and geo::Geometry::Plane().

Referenced by Reco().

00110 {
00111 //printf("\n");
00112 
00113     float fQtot=0.0;
00114     p.ftpos=0.0;
00115     p.fzpos=0.0;
00116     for (unsigned int i=0;i<p.fCellHit.size();i++){
00117       float mip;
00118       float f;
00119       if(p.fCellHit[i]->PE(f))mip=f;else continue;
00120       fQtot +=mip;
00121 
00122         double tpos=0;
00123         double zpos=0;
00124 
00125 unsigned int cell = p.fCellHit[i]->Cell();
00126 unsigned int plane = p.fCellHit[i]->Plane();
00127 //printf("%d %d \n",plane,cell);
00128         //const geo::CellGeo& gcell= fGeo->Plane(plane).Cell(cell);
00129   double posit[3];
00130 
00131 fGeo->Plane(plane).Cell(cell).GetCenter(posit,0.0);
00132 
00133 //fGeo->Plane(plane).Cell(cell).LocalToWorld(posit,posit);
00134 
00135 if(i==0)
00136 { 
00137         p.fdt=fGeo->Plane(plane).Cell(cell).HalfD();
00138         p.fdz=fGeo->Plane(plane).Cell(cell).HalfW();
00139 
00140 }
00141 //      double posit[3];
00142 //      gcell.GetCenter(posit,0.0);
00143 
00144 //printf("   (%d,%d,%f,%f,%f,%f)",plane,cell,posit[0],posit[1],posit[2],mip);
00145 
00146 
00147 if(fGeo->Plane(plane).View()==geo::kY)
00148         tpos = posit[1];
00149 else
00150 tpos=posit[0];
00151 
00152         zpos = posit[2];
00153      
00154 //      tpos=zpos=1;
00155 
00156       p.ftpos +=tpos*mip;
00157       p.fzpos +=zpos*mip;
00158     }
00159     p.ftpos/=fQtot;
00160     p.fzpos/=fQtot;
00161 
00162     p.fW=fQtot;
00163 
00164 
00165 //printf("\n");
00166 
00167 
00168 }


Member Data Documentation

int cluster::Clusterer::fClusterAlgType [private]
 

Definition at line 26 of file Clusterer.h.

Referenced by Clusterer(), Reco(), and Update().

geo::Geometry* cluster::Clusterer::fGeo [private]
 

Definition at line 27 of file Clusterer.h.

Referenced by Reco(), and UpdatePlaneClusterStat().


The documentation for this class was generated from the following files:
Generated on Fri Jul 25 02:05:52 2008 for NOvA Offline by doxygen 1.3.5