#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 | UpdateClusterStat (recobase::Cluster &p) |
Private Attributes | |
| int | fClusterAlgType |
| geo::Geometry * | fGeo |
|
|
Definition at line 22 of file Clusterer.cxx. 00022 : jobc::Module("Clusterer") 00023 { 00024 fGeo=0; 00025 fClusterAlgType=0; 00026 this->SetCfgVersion(version); 00027 00028 }
|
|
|
Definition at line 36 of file Clusterer.cxx. References cfg::Observer::RemoveAllWatches(). 00037 {
00038 this->RemoveAllWatches();
00039 }
|
|
|
Reimplemented from jobc::Module. Definition at line 41 of file Clusterer.cxx. References edm::EventHandle::Cal(), fClusterAlgType, fGeo, util::EDMUtils::GetGeometry(), cluster::HitClusterFast::MakeClusters(), cluster::HitCluster::MakeClusters(), edm::EventHandle::Reco(), and UpdateClusterStat(). 00042 {
00043 //make cell hits from rawdigits
00044 /*
00045 std::vector<const rawdata::RawDigit*> rawdigits(0);
00046 evt.Raw().Get("./",rawdigits);
00047
00048 printf("cluster-\n");
00049 for (unsigned int i =0;i<rawdigits.size();i++)
00050 {
00051 printf("%d %d \n",i,rawdigits[i]->TDC(0));
00052 CellHit c(rawdigits[i]->Channel(),rawdigits[i]->ADC(0),rawdigits[i]->TDC(0));
00053 c.SetPlane(i/100);
00054 c.SetCell(i%100);
00055 evt.Reco().Put(c,"");
00056 }
00057 printf("-cluster\n");
00058
00059 */
00060
00061
00062
00063 //get cellhits from the file
00064 std::vector<const recobase::CellHit*> cellhit(0);
00065 //assert_jobc(evt.Reco().Get("Hits",cellhit),"No CellHits found in DetSim() folder!");
00066
00067 try{
00068 evt.Cal().Get("Hits",cellhit);
00069 }catch(...){return jobc::kFailed;}
00070
00071
00072 if (!fGeo) fGeo = &util::EDMUtils::GetGeometry(evt);
00073
00074 evt.Reco().List();
00075
00076 std::vector<recobase::Cluster> planecluster(0);
00077
00078 if (fClusterAlgType==0)
00079 {
00080 HitCluster a;
00081 planecluster = a.MakeClusters(cellhit);
00082 }
00083 if (fClusterAlgType==1)
00084 {
00085 HitClusterFast a;
00086 planecluster = a.MakeClusters(cellhit);
00087 }
00088
00089
00090 for(unsigned int i=0; i<planecluster.size(); i++)
00091 {
00092 UpdateClusterStat(planecluster[i]);
00093 // printf("cluster at %f %f w %f d %f\n",planecluster[i].Zpos(),planecluster[i].Tpos(),planecluster[i].fdt,planecluster[i].fdz);
00094 if(planecluster[i].NCell())
00095 evt.Reco().Put(planecluster[i],"");
00096 }
00097
00098 evt.Reco().List();
00099
00100 return jobc::kPassed;
00101 }
|
|
|
Implements cfg::Observer. Definition at line 31 of file Clusterer.cxx. References fClusterAlgType. 00032 {
00033 c("ClusterAlgType").Get(fClusterAlgType);
00034 }
|
|
|
Definition at line 104 of file Clusterer.cxx. References recobase::CellHit::Cell(), fGeo, recobase::Cluster::NXCell(), recobase::Cluster::NYCell(), recobase::CellHit::PE(), recobase::CellHit::Plane(), recobase::Cluster::Plane(), geo::Geometry::Plane(), recobase::Cluster::SetdXYZT(), recobase::Cluster::SetQ(), recobase::Cluster::SetXYZT(), recobase::Cluster::XCell(), and recobase::Cluster::YCell(). Referenced by Reco(). 00105 {
00106
00107
00108 double fQtot=0.0;
00109 double tmax=-1.E10, tmin=1.E10;
00110 double ftpos=0.0;
00111 double fzpos=0.0;
00112
00113 double fdt=0;
00114 double fdz=0;
00115
00116 if(!fGeo)
00117 {printf("NO GEO!!!\n");return;}
00118
00119
00120
00121 int view = fGeo->Plane(p.Plane(0)).View();
00122
00123
00124
00125 int cells = (view == geo::kX) ? p.NXCell() : p.NYCell();
00126
00127 for ( int i=0;i<cells;i++){
00128 const recobase::CellHit* ch = (view == geo::kX) ? p.XCell(i) : p.YCell(i);
00129
00130
00131 float mip=0.0;
00132 if(ch->PE() > 0) mip = ch->PE();else continue;
00133 fQtot +=mip;
00134
00135 double tpos=0;
00136 double zpos=0;
00137
00138
00139
00140 unsigned int cell = ch->Cell();
00141 unsigned int plane = ch->Plane();
00142 //printf("%d %d \n",plane,cell);
00143
00144 double posit[3];
00145
00146 fGeo->Plane(plane).Cell(cell).GetCenter(posit,0.0);
00147
00148 //fGeo->Plane(plane).Cell(cell).LocalToWorld(posit,posit);
00149
00150 if(i==0)
00151 {
00152 fdt=fGeo->Plane(plane).Cell(cell).HalfD();
00153 fdz=fGeo->Plane(plane).Cell(cell).HalfW();
00154
00155 }
00156 // double posit[3];
00157 // gcell.GetCenter(posit,0.0);
00158
00159 //printf(" (%d,%d,%f,%f,%f,%f)",plane,cell,posit[0],posit[1],posit[2],mip);
00160
00161
00162 if(fGeo->Plane(plane).View()==geo::kY)
00163 tpos = posit[1];
00164 else
00165 tpos=posit[0];
00166
00167 zpos = posit[2];
00168
00169 // tpos=zpos=1;
00170
00171 ftpos +=tpos*mip;
00172 fzpos +=zpos*mip;
00173
00174 if( tpos > tmax ) tmax = tpos;
00175 if( tpos < tmin ) tmin = tpos;
00176
00177 }
00178 ftpos/=fQtot;
00179 fzpos/=fQtot;
00180 fdt = sqrt(pow(fdt,2.) + pow((tmax-tmin)/2.,2.));
00181
00182 p.SetQ(fQtot);
00183
00184 double pos[4];
00185 double dpos[4];
00186 for(int i=0;i<4;i++)
00187 {
00188 pos[i]=0;
00189 dpos[i]=0;
00190 }
00191
00192
00193 pos[2]=fzpos;
00194 dpos[2]=fdz;
00195
00196 if(view==geo::kX)
00197 {
00198 pos[0]=ftpos;
00199 dpos[0]=fdt;
00200 }else{
00201 pos[1]=ftpos;
00202 dpos[1]=fdt;
00203 }
00204
00205 p.SetXYZT(pos);
00206 p.SetdXYZT(dpos);
00207
00208
00209 //printf("\n");
00210
00211
00212 }
|
|
|
Definition at line 26 of file Clusterer.h. |
|
|
Definition at line 27 of file Clusterer.h. Referenced by Reco(), and UpdateClusterStat(). |
1.3.9.1