#include <Clusterer.h>
Inheritance diagram for cluster::Clusterer:
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::Geometry * | fGeo |
|
Definition at line 20 of file Clusterer.cxx. 00020 : jobc::Module("Clusterer") 00021 { 00022 fClusterAlgType=0; 00023 this->SetWatch("ClustererConfig","default"); 00024 }
|
|
Definition at line 32 of file Clusterer.cxx. References cfg::Observer::RemoveAllWatches(). 00033 { 00034 this->RemoveAllWatches(); 00035 }
|
|
Reimplemented from jobc::Module. Definition at line 37 of file Clusterer.cxx. References edm::EventHandle::DAQ(), fClusterAlgType, fGeo, edm::EventHandle::Header(), geo::Geometry::Instance(), cluster::HitCluster::MakeClusters(), edm::EventHandle::Reco(), and UpdatePlaneClusterStat(). 00038 { 00039 //make cell hits from rawdigits 00040 /* 00041 std::vector<const rawdata::RawDigit*> rawdigits(0); 00042 evt.Raw().Get("./",rawdigits); 00043 00044 printf("cluster-\n"); 00045 for (unsigned int i =0;i<rawdigits.size();i++) 00046 { 00047 printf("%d %d \n",i,rawdigits[i]->TDC(0)); 00048 CellHit c(rawdigits[i]->Channel(),rawdigits[i]->ADC(0),rawdigits[i]->TDC(0)); 00049 c.SetPlane(i/100); 00050 c.SetCell(i%100); 00051 evt.Reco().Put(c,""); 00052 } 00053 printf("-cluster\n"); 00054 00055 */ 00056 00057 00058 00059 //get cellhits from the file 00060 std::vector<const recobase::CellHit*> cellhit(0); 00061 //assert_jobc(evt.Reco().Get("Hits",cellhit),"No CellHits found in DetSim() folder!"); 00062 00063 try{ 00064 evt.Reco().Get("Hits",cellhit); 00065 }catch(...){return jobc::kFailed;} 00066 00067 00068 std::vector<const rawdata::DAQHeader*> header; 00069 short int det = rawdata::kFar; 00070 try{ evt.DAQ().Get("./",header); } 00071 catch(edm::Exception e){ 00072 std::cerr << "Error retrieving daq header, while looking "<< 00073 "in TrackReco::Reco(), using default fardet geometry" << std::endl; 00074 } 00075 if(header.size() > 0) det = header[0]->DetId(); 00076 // if (!fGeo) // ideally we would use DAQHeader instead of fDetGeom... 00077 fGeo = &geo::Geometry::Instance(evt.Header().Run(), det); 00078 00079 evt.Reco().List(); 00080 00081 std::vector<recobase::PlaneCluster> planecluster(0); 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 }
|
|
Implements cfg::Observer. Definition at line 27 of file Clusterer.cxx. References fClusterAlgType. 00028 {
00029 c("ClusterAlgType").Get(fClusterAlgType);
00030 }
|
|
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, geo::Geometry::Plane(), and recobase::PlaneCluster::Plane(). Referenced by Reco(). 00110 { 00111 //printf("\n"); 00112 00113 float fQtot=0.0; 00114 float tmax=-1.E10, tmin=1.E10; 00115 p.ftpos=0.0; 00116 p.fzpos=0.0; 00117 for (unsigned int i=0;i<p.fCellHit.size();i++){ 00118 float mip; 00119 float f; 00120 if(p.fCellHit[i]->PE(f))mip=f;else continue; 00121 fQtot +=mip; 00122 00123 double tpos=0; 00124 double zpos=0; 00125 00126 unsigned int cell = p.fCellHit[i]->Cell(); 00127 unsigned int plane = p.fCellHit[i]->Plane(); 00128 //printf("%d %d \n",plane,cell); 00129 //const geo::CellGeo& gcell= fGeo->Plane(plane).Cell(cell); 00130 double posit[3]; 00131 00132 fGeo->Plane(plane).Cell(cell).GetCenter(posit,0.0); 00133 00134 //fGeo->Plane(plane).Cell(cell).LocalToWorld(posit,posit); 00135 00136 if(i==0) 00137 { 00138 p.fdt=fGeo->Plane(plane).Cell(cell).HalfD(); 00139 p.fdz=fGeo->Plane(plane).Cell(cell).HalfW(); 00140 00141 } 00142 // double posit[3]; 00143 // gcell.GetCenter(posit,0.0); 00144 00145 //printf(" (%d,%d,%f,%f,%f,%f)",plane,cell,posit[0],posit[1],posit[2],mip); 00146 00147 00148 if(fGeo->Plane(plane).View()==geo::kY) 00149 tpos = posit[1]; 00150 else 00151 tpos=posit[0]; 00152 00153 zpos = posit[2]; 00154 00155 // tpos=zpos=1; 00156 00157 p.ftpos +=tpos*mip; 00158 p.fzpos +=zpos*mip; 00159 00160 if( tpos > tmax ) tmax = tpos; 00161 if( tpos < tmin ) tmin = tpos; 00162 00163 } 00164 p.ftpos/=fQtot; 00165 p.fzpos/=fQtot; 00166 p.fdt = sqrt(pow(p.fdt,2.) + pow((tmax-tmin)/2.,2.)); 00167 00168 p.fW=fQtot; 00169 00170 00171 //printf("\n"); 00172 00173 00174 }
|
|
Definition at line 26 of file Clusterer.h. |
|
Definition at line 27 of file Clusterer.h. Referenced by Reco(), and UpdatePlaneClusterStat(). |