#include <MakeClusterSS.h>
Inheritance diagram for clusterss::MakeClusterSS:

|
|
Definition at line 51 of file MakeClusterSS.cxx. References houghHist, phHoughHist, and jobc::Module::SetCfgVersion(). 00051 : 00052 jobc::Module("MakeClusterSS"), 00053 printlevel(0), 00054 geom(), 00055 evtcntr(0), 00056 run(-1), 00057 event(-1), 00058 begPlane(-1), 00059 endPlane(-1), 00060 begWinPlane(-1), 00061 endWinPlane(-1), 00062 shwMaxPlane(-1), 00063 numPreMaxPlanes(-1), 00064 numPostMaxPlanes(-1), 00065 pMergeClusters(true), 00066 pMaxOvlpLink(0), 00067 pMaxPDiff(3), 00068 pMaxZDiff(18.), 00069 pMaxTDiff(12.), 00070 pMaxAngleDiff(1.), 00071 pMaxWidToLenP2(5.), 00072 pLongWindowMipCut(0.), 00073 pLongWindowGapPlaneCut(3), 00074 pMinHoughPlanes(5), 00075 pMinHoughPH(1.0), 00076 pBestHoughMaxPHFrac(0.75), 00077 pMAXHOUGHITER(5), 00078 xclusterlist(), 00079 yclusterlist() 00080 { 00081 00082 houghHist = new TH2D("houghHist", "Hough Histogram",1,-1,1,1,-1,1); 00083 phHoughHist = new TH2D("phHoughHist", "PH Weighted Hough Histogram",1,-1,1,1,-1,1); 00084 00085 // Set the configuration version tag 00086 this->SetCfgVersion(version); // Required! 00087 }
|
|
|
Definition at line 111 of file MakeClusterSS.cxx. References CleanUpAllContainers(). 00112 {
00113 CleanUpAllContainers();
00114 }
|
|
|
Reimplemented from jobc::Module. Definition at line 208 of file MakeClusterSS.cxx. References edm::EventHandle::Reco(), xclusterlist, and yclusterlist. 00209 {
00210 std::vector<const recobase::Cluster *>xclusterlist(0);
00211 bool foundx=true;
00212 try{evt.Reco().Get("./SSClusterX",xclusterlist);}
00213 catch(edm::Exception e){
00214 cerr<<"Couldn't find an xcluster"<<endl;
00215 foundx=false;
00216 }
00217
00218 std::vector<const recobase::Cluster *>yclusterlist(0);
00219 bool foundy=true;
00220 try{evt.Reco().Get("./SSClusterY",yclusterlist);}
00221 catch(edm::Exception e){
00222 cerr<<"Couldn't find an ycluster"<<endl;
00223 foundy=false;
00224 }
00225
00226 std::vector<const recobase::Cluster *> &clist=xclusterlist;
00227
00228 string sv[2]={"X","Y"};
00229 for(int i=0;i<2;i++){
00230 bool fc=false;
00231 geo::View_t view;
00232 if(i==0){
00233 clist=xclusterlist;
00234 fc = foundx;
00235 view=geo::kX;
00236 }
00237 else{
00238 clist=yclusterlist;
00239 fc = foundy;
00240 view=geo::kY;
00241 }
00242
00243 cout<<"******************************MakeClusterPrinting "<<sv[i]<<" clusters. Found "<<clist.size()<<endl;
00244 if(fc){
00245 for(unsigned int i=0;i<clist.size();i++){
00246 int ncell = clist[i]->NCell(view);
00247 cout<<""<<endl;
00248 cout<<"**********Printing cluster #"<<i<<" with NCELLS="<<ncell<<endl;
00249 for(int j=0;j<ncell;j++){
00250 cout<<"Cell: "<<j<<endl;
00251 clist[i]->Cell(view,j)->Print("");
00252 }
00253 }
00254 }
00255 }
00256
00257 return jobc::kPassed; // kFailed if you want to fail the event
00258
00259 }
|
|
|
Definition at line 2173 of file MakeClusterSS.cxx. References geo::PlaneGeo::Cell(), clusterss::houghResult::flat, geom, geo::CellGeo::HalfW(), houghHist, clusterss::houghStats::inter, clusterss::houghStats::iZ, clusterss::stats::mean, clusterss::stats::peak, clusterss::houghResult::ph, phHoughHist, geo::Geometry::Plane(), clusterss::stats::rms, and clusterss::houghStats::slope. Referenced by ClusterWindows(), and HoughTransCluster(). 02174 {
02175 //TV: this code can be streamlined quite a bit.
02176 //There are a few loops over things we've already figured out
02177 //Come back to this and make it cleaner soon
02178
02179
02180 std::vector<WindowSS*>::iterator winIterBeg = winVec.begin();
02181 std::vector<WindowSS*>::iterator winIterEnd = winVec.end();
02182 houghResult MCV;
02183
02184 Double_t STRIPWIDTHINMETRES=0;
02185
02186 //get extrema of windows:
02187 Int_t MaxPlane = -1;
02188 Int_t MinPlane = 1985;
02189 Double_t MaxStrip = -8.;
02190 Double_t MinStrip = 8.;
02191 //total PH:
02192 Double_t totPH = 0;
02193 //PH of window with max PH:
02194 Double_t maxWinPH = 0;
02195 //plane with maximum PH, and value of max PH:
02196 Int_t maxPlanePos = -1;
02197 Double_t maxPlanePosPH = 0;
02198 //plane by plane sum PH:
02199 Double_t PlanePH[2000] = {0};
02200
02201 //loop over vector of windoes
02202 while(winIterBeg!=winIterEnd){
02203 //keep track of max/mins
02204 // cout<<"on plane "<<(*winIterBeg)->plane<<" upper "<<(*winIterBeg)->upper<<" lower "<<(*winIterBeg)->lower<<endl;
02205 // cout<<" upper tpos "<<(*winIterBeg)->upper_tpos<<" lower tpos "<<(*winIterBeg)->lower_tpos<<" ph "<<(*winIterBeg)->ph<<endl;
02206 if(MaxPlane<(*winIterBeg)->plane) MaxPlane = (*winIterBeg)->plane;
02207 if(MinPlane>(*winIterBeg)->plane) MinPlane = (*winIterBeg)->plane;
02208 if(MaxStrip<(*winIterBeg)->upper_tpos) MaxStrip = (*winIterBeg)->upper_tpos;
02209 if(MinStrip>(*winIterBeg)->lower_tpos) MinStrip = (*winIterBeg)->lower_tpos;
02210 if(maxWinPH<(*winIterBeg)->ph) maxWinPH = (*winIterBeg)->ph;
02211 //keep track of total
02212 totPH+=(*winIterBeg)->ph;
02213 //keep track of plane PH
02214 PlanePH[(*winIterBeg)->plane]+= (*winIterBeg)->ph;
02215
02216 if(PlanePH[(*winIterBeg)->plane]>maxPlanePosPH) {
02217 maxPlanePos = (*winIterBeg)->plane;//this is plane of shw max.
02218 maxPlanePosPH = PlanePH[maxPlanePos];
02219 }
02220 // const geo::PlaneGeo gplane = geom->Plane((*winIterBeg)->plane);
02221 const geo::PlaneGeo gplane = geom->Plane(10);
02222 const geo::CellGeo gstrip = gplane.Cell(10);
02223 STRIPWIDTHINMETRES=gstrip.HalfW()*2.;
02224 winIterBeg++;
02225 }
02226
02227
02228 //window tpos position with max PH, and value of max PH
02229 Double_t maxWindowPos = 0.;
02230 Double_t maxWindowPH = 0.;
02231 winIterBeg = winVec.begin();
02232 //loop over windows again
02233 //to find transverse position in plane of shower max
02234 while(winIterBeg!=winIterEnd){
02235 if((*winIterBeg)->plane==maxPlanePos){
02236 if((*winIterBeg)->ph>maxWindowPH){
02237 maxWindowPos = (*winIterBeg)->phpos;
02238 maxWindowPH = (*winIterBeg)->ph;
02239 }
02240 }
02241 winIterBeg++;
02242 }
02243 // cout<<"Best hough: max plane "<<MaxPlane<<" min "<<MinPlane<<" max strip "<<MaxStrip<<" min "<<MinStrip<<endl;
02244 // cout<<" tot pH "<<totPH<<" maxWinPH "<<maxWinPH<<" maxplane pos "<<maxPlanePos<<" maxPlanePosPH "<<maxPlanePosPH<<endl;
02245
02246 //if we didn't have any windows, its just a one planer
02247 if(winVec.size()<=1 || MinPlane==MaxPlane){
02248 MCV.flat.slope.mean = 0;
02249 MCV.flat.inter.mean = maxWindowPos;
02250 MCV.flat.iZ = maxPlanePos;
02251 MCV.flat.slope.rms = 0;
02252 MCV.flat.inter.rms = 0;
02253 MCV.ph.slope.mean = 0;
02254 MCV.ph.inter.mean = maxWindowPos;
02255 MCV.ph.iZ = maxPlanePos;
02256 MCV.ph.slope.rms = 0;
02257 MCV.ph.inter.rms = 0;
02258 MCV.flat.slope.peak = 0;
02259 MCV.flat.inter.peak = maxWindowPos;
02260 MCV.ph.slope.peak = 0;
02261 MCV.ph.inter.peak = maxWindowPos;
02262 return MCV;
02263 }
02264
02265 Double_t TPosWin = MaxStrip-MinStrip+STRIPWIDTHINMETRES;
02266
02267 //MSG("SubShowerSR",Msg::kDebug) << "Hough extrema: plane " << MinPlane
02268 // define "x=0" to be at MinPlane-2,
02269 // so y-intercept is strip value at MinPlane-2
02270 // gradient is in units of Delta(tpos) per plane
02271
02272 houghHist->Reset();
02273
02274 Int_t param1 = Int_t(TPosWin/STRIPWIDTHINMETRES) + MaxPlane-MinPlane+2 ;
02275 Double_t param2 = -2.*TPosWin/Float_t(MaxPlane-MinPlane+2);
02276 Double_t param3 = 2.*TPosWin/Float_t(MaxPlane-MinPlane+2);
02277 Int_t param4 = Int_t(2.*TPosWin/STRIPWIDTHINMETRES);
02278 Double_t param5 = MinStrip-TPosWin ;
02279 Double_t param6 = MaxStrip+TPosWin;
02280
02281 houghHist->SetBins(param1,param2,param3,param4,param5,param6);
02282
02283 phHoughHist->Reset();
02284 phHoughHist->SetBins(Int_t(TPosWin/STRIPWIDTHINMETRES) +
02285 MaxPlane-MinPlane+2,
02286 -2.*TPosWin/Float_t(MaxPlane-MinPlane+2),
02287 2.*TPosWin/Float_t(MaxPlane-MinPlane+2),
02288 Int_t(2.*TPosWin/STRIPWIDTHINMETRES),
02289 MinStrip-TPosWin,
02290 MaxStrip+TPosWin);
02291 winIterBeg = winVec.begin();
02292
02293 while(winIterBeg!=winIterEnd){
02294
02295 Int_t plane = (*winIterBeg)->plane;
02296 Double_t strip = (*winIterBeg)->phpos;
02297 Double_t ph = (*winIterBeg)->ph;
02298 Int_t lastBin = -1;
02299
02300 // loop over all possible intercepts
02301
02302 for(Int_t ic=1; ic<=houghHist->GetYaxis()->GetNbins(); ic++)
02303 {
02304
02305 Double_t c = houghHist->GetYaxis()->GetBinCenter(ic);
02306 Double_t m = (strip - c)/Float_t(plane-MinPlane+2);
02307
02308 //MSG("SubShowerSR",Msg::kVerbose) << "Hough entries: " << m << " "
02309 // << c << " " << ph << endl;
02310 houghHist ->Fill(m,c,1);
02311 phHoughHist ->Fill(m,c,TMath::Sqrt(ph));
02312 lastBin = houghHist->FindBin(m,c);
02313 }
02314 winIterBeg++;
02315 }
02316
02317 Int_t maxBin = houghHist->GetMaximumBin();
02318 Float_t maxVal = houghHist->GetMaximum();
02319 Int_t xbin = maxBin%(houghHist->GetNbinsX()+2);
02320 Int_t ybin = maxBin/(houghHist->GetNbinsX()+2);
02321 Int_t phMaxBin = phHoughHist->GetMaximumBin();
02322 Float_t phMaxVal = phHoughHist->GetMaximum();
02323 Int_t phXbin = phMaxBin%(phHoughHist->GetNbinsX()+2);
02324 Int_t phYbin = phMaxBin/(phHoughHist->GetNbinsX()+2);
02325
02326 Double_t totx = 0;
02327 Double_t sumx=0,sumx2 = 0;
02328 Double_t ptotx = 0;
02329 Double_t psumx=0,psumx2= 0;
02330
02331 Double_t toty = 0;
02332 Double_t sumy=0,sumy2 = 0;
02333 Double_t ptoty = 0;
02334 Double_t psumy=0,psumy2= 0;
02335
02336 for(int xx = 1;xx<=houghHist->GetNbinsX();xx++){
02337 for(int yy = 1;yy<=houghHist->GetNbinsY();yy++){
02338 if(houghHist->GetBinContent(xx,yy)>maxVal*pBestHoughMaxPHFrac){
02339 totx+= houghHist->GetBinContent(xx,yy);
02340 sumx+= ( houghHist->GetBinContent(xx,yy) *
02341 houghHist->GetXaxis()->GetBinCenter(xx) );
02342 sumx2+= ( houghHist->GetBinContent(xx,yy) *
02343 houghHist->GetXaxis()->GetBinCenter(xx) *
02344 houghHist->GetXaxis()->GetBinCenter(xx) );
02345
02346 toty+= houghHist->GetBinContent(xx,yy);
02347 sumy+= ( houghHist->GetBinContent(xx,yy) *
02348 houghHist->GetYaxis()->GetBinCenter(yy) );
02349 sumy2+= ( houghHist->GetBinContent(xx,yy) *
02350 houghHist->GetYaxis()->GetBinCenter(yy) *
02351 houghHist->GetYaxis()->GetBinCenter(yy) );
02352 }
02353
02354 if(phHoughHist->GetBinContent(xx,yy)>phMaxVal*pBestHoughMaxPHFrac) {
02355
02356 ptotx+= phHoughHist->GetBinContent(xx,yy);
02357 psumx+= ( phHoughHist->GetBinContent(xx,yy) *
02358 phHoughHist->GetXaxis()->GetBinCenter(xx) );
02359 psumx2+= ( phHoughHist->GetBinContent(xx,yy) *
02360 phHoughHist->GetXaxis()->GetBinCenter(xx) *
02361 phHoughHist->GetXaxis()->GetBinCenter(xx) );
02362
02363 ptoty+= phHoughHist->GetBinContent(xx,yy);
02364 psumy+= ( phHoughHist->GetBinContent(xx,yy) *
02365 phHoughHist->GetYaxis()->GetBinCenter(yy) );
02366 psumy2+= ( phHoughHist->GetBinContent(xx,yy) *
02367 phHoughHist->GetYaxis()->GetBinCenter(yy) *
02368 phHoughHist->GetYaxis()->GetBinCenter(yy) );
02369 }
02370
02371 }
02372 }
02373
02374 MCV.flat.iZ = MinPlane - 2;
02375 if(totx>0) {
02376 MCV.flat.slope.mean = sumx/totx;
02377 MCV.flat.slope.rms = (sumx2/totx - TMath::Power(MCV.flat.slope.mean,2))/totx;
02378 if(MCV.flat.slope.rms>0) MCV.flat.slope.rms = TMath::Sqrt(MCV.flat.slope.rms);
02379 else MCV.flat.slope.rms = 0;
02380 }
02381 if(toty>0) {
02382 MCV.flat.inter.mean = sumy/toty;
02383 MCV.flat.inter.rms = (sumy2/toty - TMath::Power(MCV.flat.inter.mean,2))/toty;
02384 if(MCV.flat.inter.rms>0) MCV.flat.inter.rms = TMath::Sqrt(MCV.flat.inter.rms);
02385 else MCV.flat.inter.rms = 0;
02386 }
02387 if(MCV.flat.slope.rms<houghHist->GetXaxis()->GetBinWidth(1))
02388 MCV.flat.slope.rms = houghHist->GetXaxis()->GetBinWidth(1);
02389 if(MCV.flat.inter.rms<houghHist->GetYaxis()->GetBinWidth(1))
02390 MCV.flat.inter.rms = houghHist->GetYaxis()->GetBinWidth(1);
02391
02392 MCV.ph.iZ = MinPlane - 2;
02393 if(ptotx>0) {
02394 MCV.ph.slope.mean = psumx/ptotx;
02395 MCV.ph.slope.rms = (psumx2/ptotx - TMath::Power(MCV.ph.slope.mean,2))/ptotx;
02396 if(MCV.ph.slope.rms>0) MCV.ph.slope.rms = TMath::Sqrt(MCV.ph.slope.rms);
02397 else MCV.ph.slope.rms = 0;
02398 }
02399 if(ptoty>0) {
02400 MCV.ph.inter.mean = psumy/ptoty;
02401 MCV.ph.inter.rms = (psumy2/ptoty - TMath::Power(MCV.ph.inter.mean,2))/ptoty;
02402 if(MCV.ph.inter.rms>0) MCV.ph.inter.rms = TMath::Sqrt(MCV.ph.inter.rms);
02403 else MCV.ph.inter.rms = 0;
02404 }
02405 if(MCV.ph.slope.rms<phHoughHist->GetXaxis()->GetBinWidth(1))
02406 MCV.ph.slope.rms = phHoughHist->GetXaxis()->GetBinWidth(1);
02407 if(MCV.ph.inter.rms<phHoughHist->GetYaxis()->GetBinWidth(1))
02408 MCV.ph.inter.rms = phHoughHist->GetYaxis()->GetBinWidth(1);
02409
02410 MCV.flat.slope.peak = houghHist->GetXaxis()->GetBinCenter(xbin);
02411 MCV.flat.inter.peak = houghHist->GetYaxis()->GetBinCenter(ybin);
02412 MCV.ph.slope.peak = phHoughHist->GetXaxis()->GetBinCenter(phXbin);
02413 MCV.ph.inter.peak = phHoughHist->GetYaxis()->GetBinCenter(phYbin);
02414
02415
02416 if(maxVal < 3 ||
02417 (TMath::Abs(MCV.flat.slope.mean)-MCV.flat.slope.rms<0 &&
02418 TMath::Abs(MCV.flat.slope.peak)-MCV.flat.slope.rms<0)) {
02419 MCV.flat.slope.mean = 0;
02420 MCV.flat.inter.mean = maxWindowPos;
02421 MCV.flat.iZ = maxPlanePos;
02422 MCV.flat.slope.rms = 0;
02423 MCV.flat.inter.rms = 0;
02424 MCV.flat.slope.peak = 0;
02425 MCV.flat.inter.peak = maxWindowPos;
02426 }
02427
02428 if( (TMath::Abs(MCV.ph.slope.mean)-MCV.ph.slope.rms<0 ) &&
02429 (TMath::Abs(MCV.ph.slope.peak)-MCV.ph.slope.rms<0 )) {
02430 MCV.ph.slope.mean = 0;
02431 MCV.ph.inter.mean = maxWindowPos;
02432 MCV.ph.iZ = maxPlanePos;
02433 MCV.ph.slope.rms = 0;
02434 MCV.ph.inter.rms = 0;
02435 MCV.ph.slope.peak = 0;
02436 MCV.ph.inter.peak = maxWindowPos;
02437 }
02438
02439 return MCV;
02440 }
|
|
|
Definition at line 1677 of file MakeClusterSS.cxx. References clusterss::ClustVars::eslopen, clusterss::ClustVars::maxwid, printlevel, clusterss::ClustVars::RemoveWindow(), clusterss::ClustVars::shwmid, clusterss::ClustVars::slopen, clusterss::ClustVars::trustslopen, and windows. Referenced by ClusterWindows(). 01678 {
01679 if(printlevel) cout<<"CheckCurrSoln "<<endl;
01680
01681 //first decide which variables to use based on the view
01682
01683 // CHECK IF SOLUTION IS GOOD
01684 double usewid = cv.maxwid;
01685 if(printlevel) cout<<"Checkking solutions. use wid is "<<usewid<<" maxwid "<<cv.maxwid<<endl;
01686 for(unsigned int d = 0;d<windows.size();d++){
01687 // cout<<"Looping over windows "<<d<<" out of "<<windows.size()<<endl;
01688 if(d>0 && (windows[d]->upper>0||windows[d]->lower>0)){
01689 //there is a solution
01690 if(printlevel){
01691 cout<<"Found a soln to check: "<<d<<" trust slope? "<<cv.trustslopen<<endl
01692 <<" cv.shwmid "<<cv.shwmid<<" upper tpos "<<windows[d]->upper_tpos
01693 <<" lower tpos "<<windows[d]->lower_tpos
01694 <<" usewid: "<<usewid<<endl
01695 <<" window width sq: "<<(windows[d]->upper_tpos-cv.shwmid)*(windows[d]->lower_tpos-cv.shwmid)
01696 <<" usewid sq: "<<(usewid/2.)*(usewid/2.)<<endl;
01697 }
01698
01699 if(!cv.trustslopen &&
01700 (((windows[d]->upper_tpos-cv.shwmid)*(windows[d]->lower_tpos-cv.shwmid) >
01701 (usewid/2.)*(usewid/2.)))){
01702 //don't trust new slope
01703 //and window is too far away from centroid
01704 //remove these windows
01705 // cout<<"removing a soln"<<endl;
01706 cv.RemoveWindow(*windows[d]);
01707 if(printlevel==1) cout<<"removing a window at "<<windows[d]->plane<<endl;
01708 windows[d]->upper=-1;
01709 windows[d]->lower=-1;
01710 windows[d]->upper_tpos=-1000;// x 100 to make cm
01711 windows[d]->lower_tpos=-1000;// x 100 to make cm
01712 windows[d]->ph=0;
01713 windows[d]->type=0;
01714 windows[d]->phwidth=-100;
01715 windows[d]->centroid=-1000;// x 100 to make cm
01716 }
01717 else if(cv.trustslopen){
01718 //slope from fit was ok
01720 //this time account for slope on window boundaries:
01721 //try to find another window as a reference point
01722 //to compare the window in this plane with
01724 unsigned int i = 0;
01725 while(windows[i]->ph==0.&&i<=d){
01726 if(printlevel==1) cout<<"Looping over i "<<i<<" d "<<d<<endl;
01727 i++;
01728 }
01729 if(i==d){ //TV: 7-30-09 this doesnt' make sense
01730 while(windows[i]->ph==0.&&i<windows.size()){
01731 if(printlevel==1) cout<<"i==d"<<" i "<<i<<" d "<<d<<endl;
01732 i++;
01733 }
01734 }
01735 // cout<<" i is "<<i<<endl;
01736 int diff = windows[d]->plane-windows[i]->plane;
01737 if(printlevel==1) cout<<"diff is "<<diff<<endl;
01738 if(usewid<TMath::Abs(diff)*cv.eslopen){
01739 //find appropriate cut value on window width
01740 usewid = TMath::Abs(diff)*cv.eslopen;
01741 // cout<<"in if usewid "<<usewid<<endl;
01742 }
01743 if(printlevel==1) cout<<"usewid "<<usewid<<endl;
01744 //expected centroid for plane:
01745 double expmid = (windows[i]->upper_tpos+windows[i]->lower_tpos)/2.+
01746 (windows[d]->plane-windows[i]->plane)*cv.slopen;
01747 if(printlevel==1){
01748 cout<<"slopen "<<cv.slopen<<" i upper tpos "<<windows[i]->upper_tpos<<" lower "<<windows[i]->lower_tpos<<endl;
01749 cout<<" planes "<<windows[d]->plane<<" "<<windows[i]->plane<<endl;
01750 cout<<"expmid "<<expmid<<endl;
01751 }
01752 if((windows[d]->upper_tpos-expmid)*(windows[d]->lower_tpos-expmid)>(usewid/2.)*(usewid/2.)){
01753 if(printlevel==1) cout<<"too far away from expected middle"<<endl;
01754 //too far away from expected middle
01755 //get rid of this window
01756 //remove these windows
01757 cv.RemoveWindow(*windows[d]);
01758 if(printlevel==1) cout<<"removing a window at "<<windows[d]->plane<<endl;
01759 windows[d]->upper=-1;
01760 windows[d]->lower=-1;
01761 windows[d]->upper_tpos=-1000;// x 100 to make cm
01762 windows[d]->lower_tpos=-1000;// x 100 to make cm
01763 windows[d]->ph=0;
01764 windows[d]->type=0;
01765 windows[d]->phwidth=-100;
01766 windows[d]->centroid=-1000;// x 100 to make cm
01767 }
01768 }// trustslopen
01769 } //if there is a solution (d>0 etc.
01770 // cout<<"done checking this solution"<<endl;
01771 }// for d (plane index)
01772 // cout<<"all done with CheckingSolns"<<endl;
01773 //now vectors of windows are filled
01774 return;
01775 }
|
|
|
Definition at line 2617 of file MakeClusterSS.cxx. References CleanUpContainers(), xchglist, xclusterlist, ychglist, and yclusterlist. Referenced by Reco(), and ~MakeClusterSS(). 02618 {
02619 CleanUpContainers();
02620 // cout<<"in clean up"<<endl;
02621 for(unsigned int i=0;i<xchglist.size();i++){
02622 if(xchglist[i]){
02623 delete xchglist[i];
02624 xchglist[i]=0;
02625 }
02626 }
02627
02628 // cout<<"Cleans xchglist "<<xchglist.size()<<endl;
02629
02630 for(unsigned int i=0;i<ychglist.size();i++){
02631 if(ychglist[i]){
02632 delete ychglist[i];
02633 ychglist[i]=0;
02634 }
02635 }
02636 // cout<<"Cleans ychglist "<<ychglist.size()<<endl;
02637
02638 for(unsigned int i=0;i<xclusterlist.size();i++){
02639 if(xclusterlist[i]){
02640 delete xclusterlist[i];
02641 xclusterlist[i]=0;
02642 }
02643 }
02644 // cout<<"Cleans xclusterlist "<<xclusterlist.size()<<endl;
02645
02646 for(unsigned int i=0;i<yclusterlist.size();i++){
02647 if(yclusterlist[i]){
02648 delete yclusterlist[i];
02649 yclusterlist[i]=0;
02650 }
02651 }
02652 // cout<<"Cleans yclusterlist "<<yclusterlist.size()<<endl;
02653
02654 xchglist.clear();
02655 ychglist.clear();
02656 xclusterlist.clear();
02657 yclusterlist.clear();
02658 }
|
|
|
Definition at line 2663 of file MakeClusterSS.cxx. References plnclusters, plnwindows, and windows. Referenced by CleanUpAllContainers(), and Reco(). 02664 {
02665
02666 for(unsigned int i=0;i<plnclusters.size();i++){
02667 if(plnclusters[i]){
02668 delete plnclusters[i];
02669 plnclusters[i]=0;
02670 }
02671 }
02672 // cout<<"Cleans plnclusters "<<plnclusters.size()<<endl;
02673
02674 for(unsigned int i=0;i<plnwindows.size();i++){
02675 if(plnwindows[i]){
02676 delete plnwindows[i];
02677 plnwindows[i]=0;
02678 }
02679 }
02680 // cout<<"Cleans plnwindows "<<plnwindows.size()<<endl;
02681
02682 // cout<<"about to Cleans windows "<<windows.size()<<endl;
02683 for(unsigned int i=0;i<windows.size();i++){
02684 if(windows[i]){
02685 delete windows[i];
02686 windows[i]=0;
02687 }
02688 }
02689 // cout<<"Cleans windows "<<windows.size()<<endl;
02690
02691
02692 // cout<<"done with clean up"<<endl;
02693 plnclusters.clear();
02694 plnwindows.clear();
02695 windows.clear();
02696
02697 }
|
|
|
Definition at line 2509 of file MakeClusterSS.cxx. References numPreMaxPlanes, printlevel, and windows. Referenced by DoCluster(). 02510 {
02511 // Clean up the clustered window vector.
02512 // Check for longitudinal gaps within the proto-subshower
02513 // find new max plane based on the window ph
02514 // Remove windows after first gap on both sides of shower max plane
02515 // update begWin and endWin plane
02516
02517 if(printlevel==1){
02518 cout<<"Cleaning up Windows"<<endl;
02519 }
02520
02521 bool foundnonzerowin=false;
02522 int newshwmax = -1;
02523 double maxph=0.;
02524 // sort(windows.begin(),windows.end());
02525 std::vector<WindowSS *>::iterator winit = windows.begin();
02526 while(winit!=windows.end()){
02527 if(((*winit)->upper!=-1&&(*winit)->lower!=-1)&&!foundnonzerowin){
02528 //we've found a real window;
02529 foundnonzerowin=true;
02530 }
02531 // if(!foundnonzerowin){
02532 //get rid of any leading zero windows
02533 // windows.erase(winit);
02534 // continue;
02535 // }
02536 if((*winit)->ph>maxph){
02537 //keep track of new maxph plane
02538 maxph = (*winit)->ph;
02539 newshwmax = (*winit)->plane;
02540 }
02541 winit++;
02542 }
02543
02544 if(!foundnonzerowin) return;
02545
02546 int newbeg=begWinPlane;
02547 int newend=endWinPlane;
02548 bool foundpregap=false;
02549 bool foundpostgap=false;
02550 winit = windows.begin();
02551 while(winit!=windows.end()){
02552 if((*winit)->upper==-1&&(*winit)->lower==-1){
02553 //we've found a gap;
02554 if(numPreMaxPlanes>numPostMaxPlanes){
02555 if((*winit)->plane<=newshwmax){
02556 //its a pregap
02557 foundpregap=true;
02558 if((*winit)->plane>newbeg){
02559 //find the biggest plane with a gap less than the newshw max
02560 newbeg = (*winit)->plane;
02561 }
02562 }
02563 else{
02564 //its a postgap
02565 foundpostgap=true;
02566 if((*winit)->plane<newend){
02567 //find the smallest plane with a gap bigger than the newshw max
02568 newend = (*winit)->plane;
02569 }
02570 }
02571 }
02572 else{
02573 if((*winit)->plane>newshwmax){
02574 //its a postgap
02575 foundpostgap=true;
02576 if((*winit)->plane<newend){
02577 //find the smallest plane with a gap bigger than the newshw max
02578 newend = (*winit)->plane;
02579 }
02580 }
02581 else{
02582 //its a pregap
02583 foundpregap=true;
02584 if((*winit)->plane>newbeg){
02585 //find the biggest plane with a gap less than the newshw max
02586 newbeg = (*winit)->plane;
02587 }
02588 }
02589 }
02590 }
02591 winit++;
02592 }
02593
02594 if(printlevel==1) cout<<"In clean up: newshwmax "<<newshwmax<<" new beg "<<newbeg<<" new end "<<newend<<endl;
02595 // now loop one last time to get rid of everything not between newbeg and newend
02596 winit = windows.begin();
02597 while(winit!=windows.end()){
02598 if(((*winit)->plane<=newbeg&&foundpregap)||((*winit)->plane>=newend&&foundpostgap)){
02599 windows.erase(winit);
02600 continue;
02601 }
02602 winit++;
02603 }
02604
02605 if(printlevel==1){
02606 cout<<"Printing windows after Window Cleanup"<<endl;
02607 for(unsigned int i=0;i<windows.size();i++){
02608 cout<<" i "<<i<<" plane "<<windows[i]->plane<<" upper "<<windows[i]->upper<<" lower "<<windows[i]->lower<<endl;
02609 }
02610 }
02611
02612 return;
02613 }
|
|
|
Definition at line 988 of file MakeClusterSS.cxx. References clusterss::ClustVars::AddNewWindow(), begWinPlane, BestHough(), geo::PlaneGeo::Cell(), clusterss::WindowSS::centroid, CheckCurrSoln(), endWinPlane, clusterss::ClustVars::eslopen, FindPlaneFromShwMax(), clusterss::houghResult::flat, geom, geo::Geometry::GetPlanesByView(), geo::CellGeo::HalfW(), HoughTransCluster(), clusterss::WindowSS::lower, clusterss::WindowSS::lower_tpos, clusterss::ClustVars::maxwid, clusterss::stats::mean, geo::Geometry::NextPlaneInView(), numPreMaxPlanes, clusterss::houghResult::ph, clusterss::WindowSS::ph, clusterss::WindowSS::phwidth, geo::Geometry::Plane(), clusterss::WindowSS::plane, plnwindows, clusterss::ClustVars::Print(), printlevel, clusterss::stats::rms, shwMaxPlane, clusterss::ClustVars::shwmid, clusterss::ClustVars::shwwid, clusterss::houghStats::slope, clusterss::ClustVars::slopen, StupidHoughNoWork(), clusterss::ClustVars::trustslopen, clusterss::WindowSS::type, clusterss::WindowSS::upper, clusterss::WindowSS::upper_tpos, and windows. Referenced by DoCluster(). 00989 {
00990 //now, cluster the windows that we've found
00991 // cout<<"In Cluster Windows "<<view<<endl;
00992
00993 windows.clear();
00994
00995 if(printlevel==1){
00996 cout<<"Size of plnwindows "<<plnwindows.size()<<endl;
00997 }
00998 if(plnwindows.size()<1){ return false; }
00999
01000
01001 Int_t numLongPlanes = numPreMaxPlanes+numPostMaxPlanes;
01002 // cout<<"In Cluster windows: numLongPlanes: "<<numLongPlanes<<endl;
01003
01004
01005 // if(numLongPlanes/2<2){
01006 // if(begWinPlane==endWinPlane){
01007 //if there's only one plane in the Long Window,
01008 //we need to find the window that contains the max pulse height
01009 //then fill the windows vector up
01010 //with this one plane window
01011 //TV: actually the original code does this if
01012 //the count of the two end planes, and all the planes in between (possibly in the other view)
01013 //is less than 3 (or more precisely (int)(N/2)<2)
01014 //this will do weird things at module boundaries, but I will code it
01015 //so it behaves the way it did in RecoSubShower
01016 if(endWinPlane-begWinPlane<3){
01017 std::vector<WindowSS *>::iterator iter = plnwindows.begin();
01018 float maxph=0.;
01019 WindowSS* bestwin=0;
01020 while(iter!=plnwindows.end()){
01021 if((*iter)->ph>maxph){
01022 maxph=(*iter)->ph;
01023 bestwin = (*iter);
01024 }
01025 iter++;
01026 }
01027 if(endWinPlane==begWinPlane){
01028 WindowSS *bw = new WindowSS(*bestwin);
01029 windows.push_back(bw);
01030 }
01031 else{
01032 const std::set<UInt_t>& plv=geom->GetPlanesByView(view);
01033 std::set<UInt_t>::iterator fp = plv.find(begWinPlane);
01034 std::set<UInt_t>::iterator ep = plv.find(endWinPlane);
01035 ep++;
01036 if(printlevel==1){
01037 cout<<"begWInPlane is "<<begWinPlane<<" end "<<endWinPlane<<endl;
01038 cout<<"fp is "<<(*fp)<<" ep is "<<(*ep)<<endl;
01039 }
01040 while(fp!=ep){
01041 WindowSS *bw = new WindowSS(*bestwin);
01042 bw->plane=(*fp);
01043 windows.push_back(bw);
01044 fp++;
01045 }
01046 }
01047 if(printlevel==1){
01048 cout<<"About to return from special case of ClusterWindows"<<endl;
01049 cout<<"**And the Windows are:"<<endl;
01050 for(unsigned int i=0;i<windows.size();i++){
01051 cout<<" plane "<<windows[i]->plane<<" upper "<<windows[i]->upper<<" lower "<<windows[i]->lower<<endl;
01052 }
01053 }
01054
01055 return false; //we don't want to do the clean up step in this case
01056 }
01057
01058
01059 const geo::PlaneGeo gplane = geom->Plane(10);
01060 const geo::CellGeo gstrip = gplane.Cell(10); // IS THAT OK ? TRA LA RI LA (this must mean something in greek)
01061 Double_t STRIPWIDTHINMETRES=gstrip.HalfW()*2.;
01062
01063
01064 //otherwise cluster the transverse clusters ("windows")
01065 //to make a new vector of windows
01066
01067 // Int_t numPreMaxPlanes = shwMaxPlane-begWinPlane+1;//plus 1 to get the end points right
01068 // Int_t numPostMaxPlanes = endWinPlane-shwMaxPlane+1;
01069
01070 // cout<<"numPreMaxPlanes "<<numPreMaxPlanes<<" numPostMaxPlanes "<<numPostMaxPlanes<<endl;
01071
01072 //match up windows plane by plane
01073 ClustVars cv;
01074
01075 std::vector<clusterss::WindowSS*> houghcluster = HoughTransCluster();
01076
01077 if(houghcluster.size()==0){
01078 // cout<<"Stupid Hough found nothing. Using alternate"<<endl;
01079 StupidHoughNoWork(view, cv);
01080 CheckCurrSoln(cv);
01081 if(printlevel==1) cout<<"Finished removing solns from Stupid"<<endl;
01082 }
01083 else {
01084 // cout<<"Hough Solution found"<<endl;
01085 //use hough solution as a starting point
01086 for (int d = 0;d<numLongPlanes;d++){
01087 //the way this code was originally written,
01088 //null windows were added in the planes in the other view
01089 //rewriting so it doesn't worry about the other view
01090 //will be more efficient
01091 int pl = FindPlaneFromShwMax(view,d);
01092 // cout<<"on d: "<<d<<" pl is "<<pl<<endl;
01093 WindowSS *win = new WindowSS();
01094 //set equal to -1, will only get set to a real plane if
01095 //there was a hough window selected that failed the slope check
01096 //in which case we want to try to find a new window for that plane
01097 //if there was no hough solution to begin with, we dont want to
01098 //try to find a new window later
01099 win->plane=-1;
01100 //loop over hough windows
01101 std::vector<WindowSS *>::iterator hcIter = houghcluster.begin();
01102 std::vector<WindowSS *>::iterator hcEnd = houghcluster.end();
01103 while (hcIter!=hcEnd){
01104 if ((*hcIter)->plane==pl){
01105 //if it's in current plane:
01106 win->plane = (*hcIter)->plane;
01107 win->upper = (*hcIter)->upper;
01108 win->lower = (*hcIter)->lower;
01109 win->upper_tpos = (*hcIter)->upper_tpos;
01110 win->lower_tpos = (*hcIter)->lower_tpos;
01111 win->ph = (*hcIter)->ph;
01112 win->type = (*hcIter)->type;
01113 // cout<<"there's a Hough "<<win->plane<<" upper "<<win->upper<<" lower "<<win->lower<<endl;
01114
01115 cv.AddNewWindow(*win,STRIPWIDTHINMETRES);
01116 win->phwidth = cv.shwwid;
01117 win->centroid = cv.shwmid;
01118 }
01119 hcIter++;
01120 }
01121 windows.push_back(win);
01122 }//loop over d
01123
01124 houghResult hough = BestHough(houghcluster);
01125
01126 if(hough.ph.slope.mean!=0){
01127 cv.slopen = hough.ph.slope.mean;
01128 cv.eslopen = hough.ph.slope.rms;
01129 cv.trustslopen = true;
01130 }
01131 else if(hough.flat.slope.mean!=0){
01132 cv.slopen = hough.flat.slope.mean;
01133 cv.eslopen = hough.flat.slope.rms;
01134 cv.trustslopen = true;
01135 }
01136 else {
01137 cv.slopen = 0;
01138 cv.eslopen = 0;
01139 cv.trustslopen = false;
01140 }
01141
01142 //check if solution is good:
01143 CheckCurrSoln(cv);
01144 if(printlevel==1) cout<<"Finished removing solns from Hough"<<endl;
01145 }
01146
01147 if(printlevel==1){
01148 cout<<"*****After first pass clustering CV holds: "<<endl;
01149 cv.Print();
01150 cout<<"**And the Windows are:"<<endl;
01151 for(unsigned int i=0;i<windows.size();i++){
01152 cout<<" plane "<<windows[i]->plane<<" upper "<<windows[i]->upper<<" lower "<<windows[i]->lower<<endl;
01153 }
01154 }
01155 if(cv.maxwid<2*STRIPWIDTHINMETRES) cv.maxwid = 2*STRIPWIDTHINMETRES;
01156 if(printlevel==1) cout<<"STRIPWIDTHINMETRES "<<STRIPWIDTHINMETRES<<endl;
01162 //Try to fill planes with no windows
01164 //First find centroid and width for +/- 1 planes
01165 if(printlevel==1){
01166 cout<<"Trying to fill planes with no windows"<<endl;
01167 }
01168 for (int d = 0;d<numLongPlanes;d++){
01169 // cout<<"in d loop again "<<d<<" numlongplanes "<<numLongPlanes<<endl;
01170 int pl = FindPlaneFromShwMax(view,d);
01171 if(printlevel==1) cout<<"d: "<<d<<" on pl "<<pl<<endl;
01172
01173 double minwei = 20000; // x 100 to make cm //minimum distance to centroid (weight)
01174
01175 if(windows[d]->upper==-1&&windows[d]->lower==-1&&windows[d]->plane!=-1){
01176 if(printlevel==1) cout<<"No solution in entry d "<<d<<" plane "<<windows[d]->plane<<" pl "<<pl<<endl;
01177 //does this plane have a solution?
01178 //no
01179 double pmid = -1000; // x 100 to make cm //centroid for next plane (plus)
01180 double mmid = -1000; // x 100 to make cm //centroid for prev plane (minus)
01181 double pwid = -100; // x 100 to make cm //width
01182 double mwid = -100; // x 100 to make cm
01183 int pwt = -1; // window type plus
01184 int mwt = -1; // minus
01185 bool useslopep = false;
01186 bool useslopem = false;
01187 bool foundp = false;
01188 bool foundm = false;
01189
01190
01191 for (int c = 0;c<numLongPlanes;c++){
01192 //look one plane ahead
01193 if(windows[c]->plane==(int)geom->NextPlaneInView(pl,1)) {
01194 if(windows[c]->upper>=0){
01195 //if upper is not -1, then we have a real entry
01196 pmid = windows[c]->centroid;
01197 if (cv.trustslopen) useslopep = true;
01198 pwid = windows[c]->phwidth;
01199 pwt = windows[c]->type;
01200 foundp=true;
01201 }
01202 }
01203 //and one plane back
01204 if(windows[c]->plane==(int)geom->NextPlaneInView(pl,-1)) {
01205 if(windows[c]->upper>=0){
01206 //if upper is not -1, then we have a real entry
01207 mmid = windows[c]->centroid;
01208 if (cv.trustslopen) useslopem = true;
01209 mwid = windows[c]->phwidth;
01210 mwt = windows[c]->type;
01211 foundm=true;
01212 }
01213 }
01214 }
01215
01216 //Find compatible windows
01217 double usewid = cv.maxwid;
01218 // 10 became x 100 to turn in cm
01219 if(cv.maxwid>0){
01220 if((!foundp&&!foundm)||
01221 (!useslopem&&TMath::Abs(cv.shwmid-mmid)>2*cv.maxwid)||
01222 (!useslopep&&TMath::Abs(cv.shwmid-pmid)>2*cv.maxwid)||
01223 (useslopem&&(TMath::Abs(cv.shwmid-mmid-(geom->NextPlaneInView(pl,-1))*cv.slopen)>3*cv.maxwid))||
01224 (useslopep&&(TMath::Abs(cv.shwmid-pmid-(shwMaxPlane-geom->NextPlaneInView(pl,1))*cv.slopen)>3*cv.maxwid))){
01225 //do I really need this if?
01226 //either I didn't find a next plane or a previous plane
01227 //or I don't trust the minus slope and the centroid of the next plane is further way from
01228 //current shower middle than 2*the maximum width
01229 //or I don't trust he positive slope and the centroid is further away from current middle
01230 //than 2*maximum width
01231 //or I do trust the slope (in either view) and the predicted middle is further away than 3 times the maxwie
01232 minwei = 20000;// x 100 to make cm
01233
01234 while(usewid<=2*cv.maxwid){
01235 std::vector<clusterss::WindowSS *>::iterator winIter = plnwindows.begin();
01236 int tempcount=0;
01237 //loop over the transverse plane windows
01238 while(winIter!=plnwindows.end()){
01239 tempcount++;
01240 if((*winIter)->plane==pl){
01241 double justmid = cv.shwmid;
01242 if(printlevel==1){
01243 cout<<"justmid "<<justmid<<" pmid "<<pmid<<" mmid "<<mmid<<endl;
01244 }
01245 //10 became x 100 to turn in cm
01246 if(foundp) justmid = pmid;
01247 if(foundm&&(pl>shwMaxPlane||justmid==cv.shwmid)) justmid = mmid;
01248 if(printlevel==1){
01249 cout<<"Will I add this window? upper tpos "<<(*winIter)->upper_tpos<<" justmid "<<justmid
01250 <<" lower tpos "<<(*winIter)->lower_tpos<<" usewid "<<usewid<<" minwei "<< minwei<<endl;
01251 cout<<"first condition: "<<((*winIter)->upper_tpos-justmid)*((*winIter)->lower_tpos-justmid)
01252 <<" usewid/2^2"<<(usewid/2.)*(usewid/2.)
01253 <<" midpt "<<TMath::Abs(((*winIter)->upper_tpos+(*winIter)->lower_tpos)/2.-justmid)<<endl;
01254 }
01255 if ((((*winIter)->upper_tpos-justmid)*((*winIter)->lower_tpos-justmid)<=(usewid/2.)*(usewid/2.)) &&
01256 TMath::Abs(((*winIter)->upper_tpos +
01257 (*winIter)->lower_tpos)/2.-justmid)<minwei){
01258 if(printlevel==1) cout<<"YES!! Case 1"<<endl;
01259 //this window is the right size around justmid
01260 //and average distance from justmid is below minimum
01261 //reset minimum
01262 //this is an acceptible window for this plane, so put it in the real window vector
01263 //TV: we don't increment the info in the ClustVars holder, though
01264 minwei = TMath::Abs(((*winIter)->upper_tpos +
01265 (*winIter)->lower_tpos)/2.-justmid);
01266 windows[d]->upper = (*winIter)->upper;
01267 windows[d]->lower = (*winIter)->lower;
01268 windows[d]->upper_tpos = (*winIter)->upper_tpos;
01269 windows[d]->lower_tpos = (*winIter)->lower_tpos;
01270 windows[d]->ph = (*winIter)->ph;
01271 windows[d]->type = (*winIter)->type;
01272 windows[d]->centroid = (*winIter)->centroid;
01273 windows[d]->phpos = (*winIter)->phpos;
01274 windows[d]->phwidth = (*winIter)->phwidth;
01275 }
01276 }
01277 winIter++;
01278 }//end loop over plane windows
01279 usewid+=cv.maxwid;
01280 }
01281 }
01282 else{
01283 usewid = cv.maxwid;
01284 minwei = 20000;// x 100 to make cm
01285 while(usewid<=3*cv.maxwid){
01286 std::vector<clusterss::WindowSS *>::iterator winIter = plnwindows.begin();
01287 while(winIter!=plnwindows.end()){
01288 if((*winIter)->plane==pl){
01289 // 10 became x 100 to turn in cm
01290 if (!useslopem&&foundm&&(((*winIter)->upper_tpos-mmid)*((*winIter)->lower_tpos-mmid)<=
01291 (usewid/2.)*(usewid/2.)) &&
01292 TMath::Abs(((*winIter)->upper_tpos+(*winIter)->lower_tpos)/2.-mmid)<minwei){
01293 //this window is the right size around justmid
01294 //and average distance from justmid is below minimum
01295 //reset minimum
01296 //this is an acceptible window for this plane, so put it in the real window vector
01297 //TV, again we didn't increment CV info.
01298 if(printlevel==1) cout<<"YES!! Case 2"<<endl;
01299
01300 minwei = TMath::Abs(((*winIter)->upper_tpos +
01301 (*winIter)->lower_tpos)/2.-mmid);
01302 windows[d]->upper = (*winIter)->upper;
01303 windows[d]->lower = (*winIter)->lower;
01304 windows[d]->upper_tpos = (*winIter)->upper_tpos;
01305 windows[d]->lower_tpos = (*winIter)->lower_tpos;
01306 windows[d]->ph = (*winIter)->ph;
01307 windows[d]->type = (*winIter)->type;
01308 windows[d]->centroid = (*winIter)->centroid;
01309 windows[d]->phpos = (*winIter)->phpos;
01310 windows[d]->phwidth = (*winIter)->phwidth;
01311 }
01312 // 10 became x 100 to turn in cm
01313 else if (!useslopep&&foundp&&(((*winIter)->upper_tpos-pmid)*((*winIter)->lower_tpos-pmid)
01314 <=(usewid/2.)*(usewid/2.))
01315 && TMath::Abs(((*winIter)->upper_tpos +
01316 (*winIter)->lower_tpos)/2.-pmid)<minwei){
01317 //this window is the right size around justmid
01318 //and average distance from justmid is below minimum
01319 //reset minimum
01320 //this is an acceptible window for this plane, so put it in the real window vector
01321 if(printlevel==1) cout<<"YES!! Case 3"<<endl;
01322
01323 minwei = TMath::Abs(((*winIter)->upper_tpos +
01324 (*winIter)->lower_tpos)/2.-pmid);
01325 windows[d]->upper = (*winIter)->upper;
01326 windows[d]->lower = (*winIter)->lower;
01327 windows[d]->upper_tpos = (*winIter)->upper_tpos;
01328 windows[d]->lower_tpos = (*winIter)->lower_tpos;
01329 windows[d]->ph = (*winIter)->ph;
01330 windows[d]->type = (*winIter)->type;
01331 windows[d]->centroid = (*winIter)->centroid;
01332 windows[d]->phpos = (*winIter)->phpos;
01333 windows[d]->phwidth = (*winIter)->phwidth;
01334 }
01335 // 10 became x 100 to turn in cm
01336 else if (useslopem&&foundm){
01337 Int_t m=pl-geom->NextPlaneInView(pl,-1);
01338 if(usewid<m*cv.eslopen) usewid = m*cv.eslopen;
01339 if(((*winIter)->upper_tpos-mmid-m*cv.slopen) *
01340 ((*winIter)->lower_tpos-mmid-m*cv.slopen) <=
01341 (usewid/2.)*(usewid/2.)
01342 &&TMath::Abs(((*winIter)->upper_tpos +
01343 (*winIter)->lower_tpos)/2.-mmid-m*cv.slopen)<minwei){
01344 if(printlevel==1) cout<<"YES!! Case 4"<<endl;
01345
01346 minwei = TMath::Abs(((*winIter)->upper_tpos +
01347 (*winIter)->lower_tpos)/2.-mmid-m*cv.slopen);
01348 windows[d]->upper = (*winIter)->upper;
01349 windows[d]->lower = (*winIter)->lower;
01350 windows[d]->upper_tpos = (*winIter)->upper_tpos;
01351 windows[d]->lower_tpos = (*winIter)->lower_tpos;
01352 windows[d]->ph = (*winIter)->ph;
01353 windows[d]->type = (*winIter)->type;
01354 windows[d]->centroid = (*winIter)->centroid;
01355 windows[d]->phpos = (*winIter)->phpos;
01356 windows[d]->phwidth = (*winIter)->phwidth;
01357 }
01358 }
01359 // 10 became x 100 to turn in cm
01360 else if (useslopep&&foundp){
01361 Int_t p=geom->NextPlaneInView(pl,1)-pl;
01362 if(usewid<p*cv.eslopen) usewid = p*cv.eslopen;
01363 if(((*winIter)->upper_tpos-pmid+p*cv.slopen) *
01364 ((*winIter)->lower_tpos-pmid+p*cv.slopen) <=
01365 (usewid/2.)*(usewid/2.)
01366 &&TMath::Abs(((*winIter)->upper_tpos +
01367 (*winIter)->lower_tpos)/2.-pmid+p*cv.slopen)<minwei){
01368 if(printlevel==1) cout<<"YES!! Case 5"<<endl;
01369
01370 minwei = TMath::Abs(((*winIter)->upper_tpos +
01371 (*winIter)->lower_tpos)/2.-pmid+p*cv.slopen);
01372 windows[d]->upper = (*winIter)->upper;
01373 windows[d]->lower = (*winIter)->lower;
01374 windows[d]->upper_tpos = (*winIter)->upper_tpos;
01375 windows[d]->lower_tpos = (*winIter)->lower_tpos;
01376 windows[d]->ph = (*winIter)->ph;
01377 windows[d]->type = (*winIter)->type;
01378 windows[d]->centroid = (*winIter)->centroid;
01379 windows[d]->phpos = (*winIter)->phpos;
01380 windows[d]->phwidth = (*winIter)->phwidth;
01381 }
01382 }
01383 }
01384 winIter++;
01385 }
01386 usewid+=cv.maxwid;
01387 }
01388 }
01389 }
01390 cv.AddNewWindow(*windows[d],STRIPWIDTHINMETRES);
01391 } //if(newwinpl0>=0)
01392 windows[d]->plane=pl; //set the plane so we can sort later
01393 } // solution or not???
01394 // cout<<"End of ClusterWindows. We have "<<windows.size()<<endl;
01395 // cout<<"Printing windows found by ClusterWindows"<<endl;
01396 // for(unsigned int i=0;i<windows.size();i++){
01397 // cout<<" i "<<i<<" plane "<<windows[i]->plane<<" upper "<<windows[i]->upper<<" lower "<<windows[i]->lower<<endl;
01398 // }
01399
01400 return true; //if we get this far, we do want to clean up the windows found in the next function
01401 }
|
|
|
Definition at line 294 of file MakeClusterSS.cxx. References CleanUpWindows(), ClusterWindows(), FindAllTransverseWindows(), FindLongWindow(), MakePlaneClusters(), printlevel, PruneCellList(), and windows. Referenced by Reco(). 00295 {
00296
00297
00298 //group the strips into clusters in individial planes
00299 MakePlaneClusters(view);
00300
00301 //find an appropriate window for longitudnal clustering
00302 FindLongWindow(view);
00303
00304 //find transverse windows in all planes
00305 FindAllTransverseWindows(view);
00306
00307 //group the transverse windows into actual clusters
00308 bool docleanup=ClusterWindows(view);
00309 if(docleanup){
00310 if(printlevel==1){
00311 cout<<"About to clean up windows"<<endl;
00312 }
00313 //only clean up the windows in certain circumstances
00314 //that are determined in cluster windows
00315 CleanUpWindows();
00316 }
00317
00318 if(printlevel==1){
00319 cout<<"About to start filling clusters and PRUNING"<<endl;
00320 cout<<"I have "<<windows.size()<<" windows"<<endl;
00321 for(unsigned int i=0;i<windows.size();i++){
00322 cout<<"Plane: "<<windows[i]->plane<<" upper "<<windows[i]->upper<<" lower "<<windows[i]->lower<<endl;
00323 }
00324 }
00325
00326 //get rid of the Cells that we've clustered
00327 bool foundnewcluster = PruneCellList(view);
00328 // if(foundnewcluster){
00329 // cout<<" Found a new cluster "<<endl;
00330 // }
00331
00332 if(foundnewcluster) return true;
00333
00334 return false;
00335
00336 }
|
|
|
Definition at line 636 of file MakeClusterSS.cxx. References rawdata::RawDigit::ADC(), begWinPlane, geo::PlaneGeo::Cell(), recobase::CellHit::Cell(), recobase::Cluster::Cell(), clusterss::WindowSS::centroid, endWinPlane, geom, geo::CellGeo::HalfW(), clusterss::WindowSS::lower, clusterss::WindowSS::lower_tpos, recobase::Cluster::NCell(), numPostMaxPlanes, numPreMaxPlanes, clusterss::WindowSS::ph, clusterss::WindowSS::phpos, clusterss::WindowSS::phwidth, clusterss::WindowSS::plane, geo::Geometry::Plane(), recobase::CellHit::Plane(), plnclusters, plnwindows, clusterss::WindowSS::Print(), printlevel, shwMaxPlane, clusterss::CellHitGrad::TGM(), clusterss::CellHitGrad::TGP(), clusterss::WindowSS::type, clusterss::WindowSS::upper, and clusterss::WindowSS::upper_tpos. Referenced by DoCluster(). 00637 {
00638 //a function that first looks for clusters of hits in each plane
00639 //records the upper and lower edges of possible windows in each plane
00640 //upper(lower) edges are defined either by a Cell that has no signal in the Cell above(below)
00641 //or by a cell that has less pulseheight in it than either of its neighbors
00642 //(in which case, the current cell becomes both upper and lower edge)
00643 //after finding transverse windows in a plane, it tries to find the smallest window
00644 //final result is a vector of WindowSS classes, which holds all the smallest windows in every plane
00645 //code cut and pasted (more or less) from RecoSubShower.cxx
00646
00647 // cout<<"In FindAllTransverseWindows "<<view<<endl;
00648
00649 plnwindows.clear();
00650
00652 //Start Transverse Clustering
00653 //Loop over all planes in long. window
00654 //Find transverse windows per plane
00656
00657 if(plnclusters.size()==0) return;
00658
00659 std::map<int,recobase::Cluster *>::iterator pBegMax=plnclusters.find(begWinPlane);
00660 std::map<int,recobase::Cluster *>::iterator pEndMax=plnclusters.find(endWinPlane);
00661 std::map<int,recobase::Cluster *>::iterator pbeg=plnclusters.find(shwMaxPlane);
00662 std::map<int,recobase::Cluster *>::iterator pend;
00663 std::map<int,recobase::Cluster *>::iterator piter;
00664 std::map<int,recobase::Cluster *>::iterator pitersav;
00665
00666 // start at max plane. First, go upstream or downstream from there,
00667 // depending on which end of the window has more planes. Then, go
00668 // back and do the other end of the window.
00669
00670 //figure out where to start and which way to go
00671 //if shwmax plane is 0 or 1, we can only go forwards
00672 //there's probably an end constraint too that I haven't taken the time to figure out
00673 //this works if shwMaxPlane isn't the begining or the end of the plane window vec
00674 //if numPreMaxPlanes==1 (i.e. we only have one plane) we want to go forwards at first
00675 //I think this will still fail if we end up with just one entry in the plncluster vector
00676 //but that isn't really a cluster anymore, is it?
00677 if(numPreMaxPlanes>numPostMaxPlanes&&!(shwMaxPlane==0||shwMaxPlane==1)&&numPreMaxPlanes>1){
00678 pend=pBegMax;
00679 pend--;
00680 // cout<<"Going backwards at first"<<endl;
00681 }
00682 else{
00683 pend=pEndMax;
00684 pend++;
00685 // cout<<"Going forwards at first"<<endl;
00686 }
00687 piter = pbeg;
00688 pitersav = pend;
00689
00690 Int_t pass=1; // keep track of which pass we're on
00691
00692 //keep track of upper and lower limits of strip windows
00693 std::vector<Int_t> winu; // vector of upper dip
00694 std::vector<Int_t> wind; // vector of lower dip
00695 std::vector<Double_t> winu_tpos; // vector of tpos of upper dip
00696 std::vector<Double_t> wind_tpos; // vector of tpos of lower dip
00697 std::vector<Int_t> wintu; // vector of upper dip type
00698 std::vector<Int_t> wintd; // vector of lower dip type
00699
00700 // a jagged loop over planes
00701 if(printlevel==1) cout<<"Starting jagged loop: starting on "<<piter->first<<" ending on "<<pend->first<<endl;
00702 while(piter != pend){
00703 // find strip windows.
00704 //For this, we care either about: edges (type 1), isolated strips (type 2), pulseheight dips (type 0)
00705 winu.clear();
00706 wind.clear();
00707 winu_tpos.clear();
00708 wind_tpos.clear();
00709 wintu.clear();
00710 wintd.clear();
00711
00712 // find dips and categorize them
00713 Int_t plane=piter->first;
00714 if(printlevel==1){
00715 cout<<"Finding plane clusters: on plane "<<plane<<endl;
00716 }
00717 //get the cluster of strips in this plane
00718 recobase::Cluster *c=piter->second;
00719
00720 //loop over CellHits in c
00721 int NCELL = c->NCell(view);
00722 for(int icell = 0;icell<NCELL;icell++){
00723 const CellHitGrad *thiscell=0;
00724 bool foundcellup=false;
00725 bool foundcelldown=false;
00726 thiscell=dynamic_cast<const CellHitGrad *>(c->Cell(view,icell));
00727 int cn = thiscell->Cell();
00728 int pln = thiscell->Plane();
00729 const CellHitGrad *cellup=0;
00730 cellup=dynamic_cast<const CellHitGrad *>(c->Cell(view,cn+1,pln));
00731 if(cellup!=0&&cellup->Cell()==cn+1){
00732 //we found a cell and it has the right cell number
00733 foundcellup=true;
00734 }
00735 const CellHitGrad *celldown=0;
00736 celldown=dynamic_cast<const CellHitGrad *>(c->Cell(view,cn-1,pln));
00737 if(celldown!=0&&celldown->Cell()==cn-1){
00738 //we found a cell and it has the right cell number
00739 foundcelldown=true;
00740 }
00741
00742 // PH significance is not currently used
00743 //(only called dips if delta PH is significant given pe stats)
00744
00745 if(!foundcellup&&!foundcelldown){
00746 // cout<<"Found an isolated strip "<<plane<<" "<<cn<<endl;
00747 // isolated strip
00748 //this cell is both an upper and lower edge
00749 winu.push_back(cn);
00750 wind.push_back(cn);
00751 winu_tpos.push_back(thiscell->TCPos());
00752 wind_tpos.push_back(thiscell->TCPos());
00753 wintu.push_back(2); // isolated
00754 wintd.push_back(2); // isolated
00755 }
00756 else if(thiscell->TGP()<0&&thiscell->TGM()<0){
00757 // cout<<"Found a dip strip "<<plane<<" "<<cn<<endl;
00758 //wow. this is the only plane I've needed the gradient info so far
00759 //and I have the up and down strips, so I could have just computed
00760 //the gradients here.
00761 //It would simplify things to get rid of the CellHitGrad objects all together
00762 // dip - higher PH on either side
00763 //this cell is both an upper and lower edge
00764 winu.push_back(cn);
00765 winu_tpos.push_back(thiscell->TCPos());
00766 wintu.push_back(0); // type-0 (this is a dip)
00767 wind.push_back(cn);
00768 wind_tpos.push_back(thiscell->TCPos());
00769 wintd.push_back(0); // type-0 (this is a dip)
00770 }
00771 else if(foundcelldown&&!foundcellup){
00772 // cout<<"Found an upper edge"<<endl;
00773 // edge: there is a strip below, but not above
00774 //this cell is an upper edge
00775 winu.push_back(cn);
00776 winu_tpos.push_back(thiscell->TCPos());
00777 wintu.push_back(1); // type-1 (this is an edge strip)
00778 }
00779 else if(foundcellup&&!foundcelldown){
00780 // cout<<"Found a lower edge "<<plane<<" "<<cn<<endl;
00781 // edge: there is a strip above, but not below
00782 //this cell is a lower edge
00783 wind.push_back(cn);
00784 wind_tpos.push_back(thiscell->TCPos());
00785 wintd.push_back(1); //type-1
00786 }
00787 } //end loop over cells in this plane
00788
00790 //use dips to form windows
00792
00793 //if we didn't find the same number of upper edges as lower edges something isn't right
00794 //TV: 7-30-09
00795 //this code will do what RecoSubShower was doing when I took it over,
00796 //but I suspect there might be a problem with possible windows at edges of the detector...
00797 //once I get this working and validated, I will have to come back to this and check it out
00798 //if this comment is still here, it means I haven't done this yet.
00799 //if you're looking for a bug that affects clustering on the edges of the detector, its probably here.
00800 unsigned int wins = winu.size();
00801 if(wins!=wind.size()) {
00802 cerr<<"UP edges and down edges don't match. Returning"<<endl;
00803 return;
00804 }
00805
00806 //temporarily hold window info
00807 std::vector<Int_t> win0(wins,0); // strip of upper dip
00808 std::vector<Int_t> win1(wins,0); // strip of lower dip
00809 std::vector<Float_t> win0_tpos(wins,0); // tpos of strip of upper dip
00810 std::vector<Float_t> win1_tpos(wins,0); // tpos of strip of lower dip
00811 std::vector<Float_t> win2(wins,0); // PH of window
00812 std::vector<Int_t> win3(wins,0); // ID of window:
00813 // 0-both dips;
00814 // 1 or 10-one dip,one gap;
00815 // 11-both gaps;
00816 // 22-isolated strip
00817 std::vector<Float_t> win4(wins,0); // Centroid of window in tpos
00818 std::vector<Float_t> win5(wins,0); // PH weighted tpos of window
00819 std::vector<Float_t> win6(wins,0); // PH weighted width of window
00820
00821 //match up dips to form windows
00822 //loop over upper edges
00823 for(unsigned int w = 0; w<wins; w++){
00824 win0[w] = -1;
00825 win1[w] = -1;
00826 win0_tpos[w] = 0;
00827 win1_tpos[w] = 0;
00828 win2[w] = 0;
00829 win3[w] = -1;
00830 win4[w] = 0;
00831 win5[w] = 0;
00832 win6[w] = 0;
00833 int winw = geom->Plane(plane).Ncells();
00834 //loop over lower edges
00835 for (unsigned int s = 0; s<wind.size(); s++){
00836 //compute size of distance between upper edge and lower edge
00837 int diff = winu.at(w)-wind.at(s);
00838 if (((diff>0&&wintu.at(w)<2&& wintd.at(s)<2)||
00839 (diff==0 && wintu.at(w)==2 && wintd.at(s)==2))&&diff<winw){
00840 //either we have two edges and the upper and lower cells are not the same cell
00841 //or we have an isolated hit
00842 //and this diff is smaller than the any window diff we've already seen
00843
00844 //TV 7-30-09: this will save the smallest difference between any upper and any down
00845 //but if we have an isolated hit, won't that be the one we always save?
00846 //perhaps we get the isolated ones first, then get the others in subsquent clustering?
00847 //not sure I completely understand what this code does
00848 //will investigate once I get it working...
00849 winw = diff;
00850 win0[w] = winu.at(w);
00851 win1[w] = wind.at(s);
00852 win0_tpos[w] = winu_tpos.at(w);
00853 win1_tpos[w] = wind_tpos.at(s);
00854 win3[w] = wintu.at(w)*10+wintd.at(s);
00855 }
00856 } //for s
00857 } // for w
00858
00860 //now get PH of windows
00861 //and push_back windows into vectors
00863
00864 // const geo::PlaneGeo gplane = geom->Plane(plane);
00865 const geo::PlaneGeo gplane = geom->Plane(10);
00866 const geo::CellGeo gstrip = gplane.Cell(10); // IS THAT OK ? TRA LA RI LA (this must mean something in greek)
00867 Double_t STRIPWIDTHINMETRES=gstrip.HalfW()*2.;
00868
00869 //loop over windows
00870 for(unsigned int w = 0; w<wins; w++){
00871 Double_t biggestStripPH = 0;
00872 Int_t n = 0;
00873
00874 //loop over CellHits in c
00875 int NCELL = c->NCell(view);
00876 for(int icell = 0;icell<NCELL;icell++){
00877 const CellHitGrad *thiscell=0;
00878 thiscell=dynamic_cast<const CellHitGrad *>(c->Cell(view,icell));
00879 int celln=thiscell->Cell();
00880 float mip;
00881 bool calibrated = thiscell->MIP(mip);
00882 if(!calibrated){
00883 unsigned short adc;
00884 thiscell->ADC(adc);
00885 mip = adc/ADCTOMIP;
00886 }
00887
00888 if(celln<=win0[w] && celln>=win1[w]){
00889 //the current cell number is in this window
00890 //add this cell's pulseheight to the appropriate vector
00891 win2[w]+=mip;
00892 if(mip>biggestStripPH) {
00893 win4[w]=thiscell->TCPos();
00894 biggestStripPH=mip;
00895 }
00896 win5[w]+= mip*thiscell->TCPos();
00897 win6[w]+= mip*thiscell->TCPos()*thiscell->TCPos();
00898 n++;
00899 }
00900 }
00901 //divide by total pulseheight to find ph weighted TPOS of this window
00902 win5[w] /= win2[w];
00903
00904 if(n!=1){
00905 //more than one cell in this window
00906 //find phweighted TPOS^2 of the window
00907 win6[w] /= win2[w];
00908 //subtract off the mean tpos to find the width squared
00909 win6[w] -= win5[w]*win5[w];
00910 //then take the square root
00911 if(win6[w]>0) win6[w] = sqrt(win6[w]);
00912 else win6[w] = STRIPWIDTHINMETRES/sqrt(12.);
00913 }
00914 else{
00915 win6[w] = STRIPWIDTHINMETRES/sqrt(12.);
00916 }
00917 //now fill WindowSS Class
00918 WindowSS *win = new WindowSS();
00919 win->plane = plane;
00920 win->upper = win0[w];
00921 win->lower = win1[w];
00922 win->upper_tpos = win0_tpos[w];
00923 win->lower_tpos = win1_tpos[w];
00924 win->ph = win2[w];
00925 win->type = win3[w];
00926 win->centroid = win4[w];
00927 win->phpos = win5[w];
00928 win->phwidth = win6[w];
00929 //and put in our vector of windows
00930 // cout<<"Pushing back a window: "<<endl;
00931 // win->Print();
00932
00933 plnwindows.push_back(win);
00934 } //end loop over window edges
00935
00936 //figure out where we started and which way we're going in the jagged loop
00937 //increment iterators
00938 if(numPreMaxPlanes>numPostMaxPlanes){
00939 // we started out in the beginning of the LongWindow
00940 if(piter == pBegMax) {
00941 // cout<<"Reached the end of the upstream bit"<<endl;
00942 // reached the upstream end, need to reverse
00943 pbeg++; // don't repeat max plane
00944 pend=pEndMax; pend++; // set end iterator just beyond window
00945 piter=pbeg; // restart
00946 pass++; // change direction
00947 }
00948 else{
00949 //if its the first pass keep going backward, otherwise go forwards
00950 if(pass == 1) piter--;
00951 else piter++;
00952 }
00953 }
00954 else{
00955 // we started out in the end of the LongWindow
00956 if(piter == pEndMax){
00957 // cout<<"Reached the end of the downstream bit"<<endl;
00958 // reached the downstream end, need to reverse
00959 pbeg--; // don't repeat max plane
00960 pend=pBegMax; pend--;
00961 piter=pbeg;
00962 pass++;
00963 }
00964 else{
00965 //if its the first pass keep going forwards, otherwise go backwards
00966 if(pass == 1) piter++;
00967 else piter--;
00968 }
00969 }
00970
00971 pitersav = piter;
00972 //TV: 7-30-09, don't know why we need the next line, will comment out for now
00973 //if(winvec.size() > 3000 ) break; // !!!!!!!!!!!! FIX THIS!!!!!!!!!!!!
00974 }
00975 if(printlevel==1){
00976 cout<<"all done finding transverse windows. Found "<<plnwindows.size()<<endl;
00977 cout<<"Those windows are: "<<endl;
00978 for(unsigned int i=0;i<plnwindows.size();i++){
00979 cout<<"plnwindows plane "<<i<<endl;
00980 plnwindows[i]->Print();
00981 }
00982 }
00983
00984 }
|
|
|
Definition at line 456 of file MakeClusterSS.cxx. References begPlane, begWinPlane, endPlane, endWinPlane, event, geom, geo::Geometry::GetPlanesByView(), numPostMaxPlanes, numPreMaxPlanes, plnclusters, pLongWindowGapPlaneCut, printlevel, run, and shwMaxPlane. Referenced by DoCluster(). 00457 {
00458 //find the set of planes with the largest pulseheight per plane
00459 //fill begWinPlane and endWinPlane with the start and end of this range of planes
00460 //code more or less cut and pasted from RecoSubShower::FindMaxWindow
00461
00462 // cout<<"In find long window "<<view<<endl;
00463
00464 //TV: this code can not be doing the right thing for 1 plane windows
00465 //modifying it just go on if begPlane and endPlane are the same
00466 if(begPlane==endPlane){
00467 begWinPlane = begPlane;
00468 endWinPlane = endPlane;
00469 shwMaxPlane = begPlane;
00470 numPreMaxPlanes=1;
00471 numPostMaxPlanes=1;
00472 return;
00473 }
00474
00475 // cout<<"Doing work over plnclusters of size "<<plnclusters.size()<<endl;
00476 // cout<<"beginning plane: "<<begPlane<<" ending plane "<<endPlane<<endl;
00477 const std::set<UInt_t>& plv=geom->GetPlanesByView(view);
00478 // std::set<UInt_t>::iterator fp = plv.begin();
00479 // std::set<UInt_t>::iterator ep = plv.end();
00480 // cout<<"Printing all planes in this view:"<<endl;
00481 // int cc=0;
00482 // while(fp!=ep){
00483 // cout<<"This plane "<<cc<<" is "<<*fp<<endl;
00484 // cc++;
00485 // fp++;
00486 // }
00487 // ep--;
00488 // cout<<"Got planes from geom: first plane this view: "<<*fp<<" last: "<<*ep<<endl;
00489 // cout<<" tried to get planes from geom. size: "<<plv.size()<<endl;
00490 if (plv.size() == 0) assert(0);
00491
00492 std::set<UInt_t>::iterator itPlvBeg=plv.find(begPlane);
00493 std::set<UInt_t>::iterator itPlvEnd=plv.find(endPlane);
00494 itPlvEnd++;
00495 // pull end back if it's gone past THE end
00496 if(itPlvEnd==plv.end()) itPlvEnd--;
00497
00498 //Find highest strip density longitudinal window
00499 int maxbeg = 0; //first boundary plane of max window
00500 int maxend = 0;
00501 Float_t maxDensity = 0;
00502 Float_t density = 0;
00503
00504 Bool_t inAWindow=false;
00505 Bool_t currZero=true;
00506
00507 Int_t contigZero = 0;
00508 Int_t totalPlaneIndex = 0; // keep track of number of planes, since the
00509 // plane ID number is not a smooth function of total plane
00510 Int_t startPlane = -1;
00511 Int_t finPlane = 0;
00512 Int_t lastSeenPlane = 0;
00513 Int_t firstSeenTotalIndex = 0;
00514 Int_t lastSeenTotalIndex = 0;
00515
00516
00517 for(std::set<UInt_t>::iterator iter=itPlvBeg; iter!=itPlvEnd; iter++){
00518 totalPlaneIndex++;
00519 const Int_t plane=*iter;
00520 //does this plane have activity above threshold?
00521 currZero=true;
00522 if(plnclusters.find(plane) != plnclusters.end()){
00523 float mip=(plnclusters.find(plane))->second->Q();
00524 if(mip>pLongWindowMipCut){
00525 // cout<<"Not in a gap. On Plane "<<plane<<endl;
00526 //TV 8-3-09: Changed the following blocks of code
00527 //pretty sure that original RecoSubShower had a logical flaw here
00528 //that would mean we miss some windows of 1 plane long
00529 //is this the first plane of a new window?
00530 if (!inAWindow){
00531 //we weren't in a window before
00532 //reset the start and the density
00533 startPlane=plane;
00534 firstSeenTotalIndex=totalPlaneIndex;
00535 inAWindow=true;
00536 density=0;
00537 }
00538 lastSeenPlane=plane;
00539 lastSeenTotalIndex=totalPlaneIndex;
00540 currZero=false;
00541 // keep track of number of contiguous empty planes
00542 contigZero=0;
00543 density+=mip;
00544 // cout<<"Current density "<<density<<" lastSeenTotalIndex "<<lastSeenTotalIndex
00545 //<<" firstSeenTotalIndex "<<firstSeenTotalIndex<<" in a window "<<inAWindow
00546 //<<" startPlane "<<startPlane<<" finPlane "<<finPlane<<endl;
00547 }
00548 }
00549 if(currZero){
00550 contigZero++;
00551 //cout<<"In a gap of length "<<contigZero<<" Plane is "<<plane<<endl;
00552 }
00553
00554 // if there have been more than a certain number of empty planes,
00555 // close off previous window
00556 if(contigZero>=pLongWindowGapPlaneCut && finPlane<startPlane){
00557 // cout<<"This gap has gotten longer than the threshold: "<<contigZero<<endl;
00558 finPlane=lastSeenPlane;
00559 Int_t npln=lastSeenTotalIndex-firstSeenTotalIndex+1;
00560 inAWindow=false;
00561 density/=float(npln);
00562 //cout<<"Window this gap ends had "<<npln<<" planes and a density of "<<density<<endl;
00563
00564 if(density>maxDensity){ // check for max ph density window
00565 maxbeg=startPlane;
00566 maxend=finPlane;
00567 maxDensity=density;
00568 }
00569 }
00570 } // all planes in view (within this event)
00571
00572 // if (!currZero && finPlane<startPlane){ // there was an unfinished window at the end
00573 //TV: 8-3-09 think the above is not sufficient to end all started windows
00574 //instead, just check whether or not we think we're in a window
00575 if(inAWindow){ // there was an unfinished window at the end
00576 //cout<<"Out of loop, checking unfinished window"<<endl;
00577 finPlane=lastSeenPlane;
00578 Int_t npln=lastSeenTotalIndex-firstSeenTotalIndex+1;
00579 inAWindow=false;
00580 density/=float(npln);
00581 //cout<<"Window this gap ends had "<<npln<<" planes and a density of "<<density<<endl;
00582
00583 if (density>maxDensity) // check for max ph density window
00584 {
00585 maxbeg=startPlane;
00586 maxend=finPlane;
00587 maxDensity=density;
00588 }
00589 }
00590 // cout<<"Max density window: "<<maxDensity<<" start "<<maxbeg<<" end "<<maxend<<endl;
00591
00592 //now find the plane of maximum pulse height in our highest density window
00593 int maxpl=-1;
00594 Double_t maxPlanePH = 0;
00595
00596 itPlvBeg=plv.find(maxbeg);
00597 itPlvEnd=plv.find(maxend);
00598 itPlvEnd++;
00599 // pull end back if it's gone past THE end
00600 if(itPlvEnd==plv.end()) itPlvEnd--;
00601
00602 for(std::set<UInt_t>::iterator iter=itPlvBeg; iter!=itPlvEnd; iter++){
00603 const Int_t plane=*iter;
00604 if(plnclusters.find(plane) != plnclusters.end()){
00605 float mip=(plnclusters.find(plane))->second->Q();
00606 if(mip>maxPlanePH){
00607 maxpl = plane;
00608 maxPlanePH = mip;
00609 }
00610 }
00611 }
00612
00613 begWinPlane=maxbeg;
00614 endWinPlane=maxend;
00615 shwMaxPlane=maxpl;
00616 if(printlevel==1){
00617 cout<<"Found a LongWindow "<<view<<" run "<<run<<" event "<<event<<endl;
00618 cout<<"begWinPlane "<<maxbeg<<" endWinPlane "<<maxend<<" shwMaxPlane "<<maxpl<<endl;
00619 }
00620
00621 numPreMaxPlanes=0;
00622 numPostMaxPlanes=0;
00623 for(std::set<UInt_t>::iterator iter=itPlvBeg; iter!=itPlvEnd; iter++){
00624 const int thisplane = *iter;
00625 if(thisplane<=maxpl) numPreMaxPlanes++;
00626 else numPostMaxPlanes++;
00627 }
00628
00629 if(printlevel==1){
00630 cout<<"numPreMaxPlanes "<<numPreMaxPlanes<<" Post "<<numPostMaxPlanes<<endl;
00631 }
00632 }
|
|
||||||||||||
|
Definition at line 2451 of file MakeClusterSS.cxx. References geom, geo::Geometry::GetPlanesByView(), numPostMaxPlanes, numPreMaxPlanes, and shwMaxPlane. Referenced by ClusterWindows(), and StupidHoughNoWork(). 02452 {
02453 //TV: I've changed this code so it
02454 //will no longer put zeros in for planes in the view we're not working on
02455 //this code may be slow, in which case, I'll have to rethink this
02456
02457 //goal is to order planes starting with shwMax,
02458 //if pre is larger than post, step backwards through the planes, till you get to beg plane
02459 //then step forwards after shwMax until you get to end Plane
02460 //if post is larger than pre, step forwards till you get to end
02461 //then step backwards until you get to beg Plane
02462
02463 unsigned int pl=0;
02464
02465 const std::set<UInt_t>& plv=geom->GetPlanesByView(view);
02466 std::set<UInt_t>::iterator fp = plv.find(shwMaxPlane);
02467
02468 int d =away;
02469 if(numPreMaxPlanes>numPostMaxPlanes){
02470 if(away<numPreMaxPlanes){
02471 // cout<<"away<=NumPreMaxPlanes"<<endl;
02472 while(d){
02473 fp--;
02474 d--;
02475 }
02476 }
02477 else{
02478 // cout<<"away is bigger than Premaxplanes"<<endl;
02479 while(d>=numPreMaxPlanes){
02480 fp++;
02481 d--;
02482 }
02483 }
02484 }
02485 else{
02486 // cout<<"Post is bigger than pre"<<endl;
02487 if(away<=numPostMaxPlanes){
02488 // cout<<"away is less than numpost"<<endl;
02489 while(d){
02490 fp++;
02491 d--;
02492 }
02493 }
02494 else{
02495 // cout<<"away is bigger than numpost"<<endl;
02496 while(d>=numPostMaxPlanes+1){
02497 fp--;
02498 d--;
02499 }
02500 }
02501 }
02502 pl=*fp;
02503 // cout<<"Returning "<<pl<<endl;
02504 return pl;
02505 }
|
|
|
Definition at line 1863 of file MakeClusterSS.cxx. References BestHough(), geo::PlaneGeo::Cell(), clusterss::houghResult::flat, geom, geo::CellGeo::HalfW(), clusterss::houghStats::inter, clusterss::houghStats::iZ, clusterss::stats::mean, clusterss::stats::peak, clusterss::houghResult::ph, geo::Geometry::Plane(), plnwindows, pMinHoughPlanes, clusterss::stats::rms, and clusterss::houghStats::slope. Referenced by ClusterWindows(). 01864 {
01865 // cout<<"In HoughTransCluster: view: "<<view<<endl;
01866
01867
01868 std::vector<WindowSS *> cluster;
01869 std::vector<WindowSS *> emptyCluster;
01870
01871 //copy all windows into nonCluster:
01872 //also get best vertex estimate in first plane
01873
01874 Int_t vertexPlane = 1985;
01875 Double_t vertexPlanePH = 0;
01876 Double_t vertexTPos = 0;
01877 Double_t vertexTPosWidth = 0;
01878
01879 Int_t vertexPlane1 = 1985;
01880 Double_t vertexPlanePH1 = 0;
01881 Double_t vertexTPos1 = 0;
01882 Double_t vertexTPosWidth1 = 0;
01883
01884 //use these to calculate the density of hits in the long. window
01885 //this can be used to decide which Hough method to use
01886 Double_t totStrips = 0;
01887 Double_t maxTpos = -800.0;// x 100 to make cm
01888 Double_t minTpos = 800.0;
01889 Int_t lastPlane = 0;
01890 Double_t PHavgTpos = -800.0;// x 100 to make cm
01891 Double_t totPH1 = 0.;
01892
01893 std::vector<WindowSS *>::iterator wIt = plnwindows.begin();
01894 std::vector<WindowSS *>::iterator wEn = plnwindows.end();
01895
01896 //loop over the transverse windows in each plane
01897 while(wIt!=wEn){
01898 //save a copy of this window
01899 if((*wIt)->plane<vertexPlane){
01900 //save info on the most upstream plane
01901 vertexPlane1 = vertexPlane;
01902 vertexPlanePH1 = vertexPlanePH;
01903 vertexTPos1 = vertexTPos;
01904 vertexTPosWidth1 = vertexTPosWidth;
01905 if((*wIt)->ph>1.0) {
01906 //save info on the most upstream plane with pulseheight > 1 mip
01907 //TV: this will depend on MIP calibration...
01908 vertexPlane = (*wIt)->plane;
01909 vertexPlanePH = (*wIt)->ph;
01910 vertexTPos = (*wIt)->phpos;
01911 vertexTPosWidth = (*wIt)->phwidth;
01912 // const geo::PlaneGeo gplane = geom->Plane((*wIt)->plane);
01913 const geo::PlaneGeo gplane = geom->Plane(10);
01914 const geo::CellGeo gstrip = gplane.Cell(10);
01915 Double_t STRIPWIDTHINMETRES=gstrip.HalfW()*2.;
01916
01917 if(vertexTPosWidth<STRIPWIDTHINMETRES) vertexTPosWidth=STRIPWIDTHINMETRES;
01918 }
01919 else if(vertexPlanePH<1.0){
01920 //pulse height less than one mip
01921 vertexPlane = (*wIt)->plane;
01922 vertexPlanePH = (*wIt)->ph;
01923 vertexTPos = (*wIt)->phpos;
01924 vertexTPosWidth = (*wIt)->phwidth;
01925 // const geo::PlaneGeo gplane = geom->Plane((*wIt)->plane);
01926 const geo::PlaneGeo gplane = geom->Plane(10);
01927 const geo::CellGeo gstrip = gplane.Cell(10);
01928 Double_t STRIPWIDTHINMETRES=gstrip.HalfW()*2.;
01929 if(vertexTPosWidth<STRIPWIDTHINMETRES) vertexTPosWidth=STRIPWIDTHINMETRES;
01930 }
01931 }
01932 else if((*wIt)->plane==vertexPlane){
01933 if((*wIt)->ph>vertexPlanePH){
01934 //if we find another window in the vertex plane
01935 //save the one with the max pulse height
01936 vertexPlanePH = (*wIt)->ph;
01937 vertexTPos = (*wIt)->phpos;
01938 vertexTPosWidth = (*wIt)->phwidth;
01939 // const geo::PlaneGeo gplane = geom->Plane((*wIt)->plane);
01940 const geo::PlaneGeo gplane = geom->Plane(10);
01941 const geo::CellGeo gstrip = gplane.Cell(10);
01942 Double_t STRIPWIDTHINMETRES=gstrip.HalfW()*2.;
01943 if(vertexTPosWidth<STRIPWIDTHINMETRES) vertexTPosWidth=STRIPWIDTHINMETRES;
01944 }
01945 }
01946 if((*wIt)->ph>1.0) {
01947 //save last plane
01948 if((*wIt)->plane>lastPlane) lastPlane = (*wIt)->plane;
01949 //save maximum upper edge
01950 if((*wIt)->upper_tpos>maxTpos) maxTpos = (*wIt)->upper_tpos;
01951 //save minimum lower edge
01952 if((*wIt)->lower_tpos<minTpos) minTpos = (*wIt)->lower_tpos;
01953 //compute pulseheight weighted position
01954 PHavgTpos+= (*wIt)->phpos * (*wIt)->ph;
01955 //add up the number of contained strips
01956 totStrips+= Double_t((*wIt)->upper - (*wIt)->lower + 1);
01957 //add up total pulseheight
01958 totPH1+= (*wIt)->ph;
01959 }
01960 wIt++;
01961 }
01962 //compute pulseheight weighted position
01963 PHavgTpos /= totPH1;
01964
01965 if(TMath::Abs(vertexTPos-vertexTPos1)>2*(vertexTPosWidth+vertexTPosWidth1)&&
01966 TMath::Abs(vertexTPos-PHavgTpos)>TMath::Abs(vertexTPos1-PHavgTpos)){
01967 //vertex plane transverse position too far away from average trans position
01968 //reset the values
01969 vertexPlane = vertexPlane1;
01970 vertexPlanePH = vertexPlanePH1;
01971 vertexTPos = vertexTPos1;
01972 vertexTPosWidth = vertexTPosWidth1;
01973 }
01974
01975 //keep track of some quantities for quality checking at the end:
01976 Int_t lowPlane = 2000;
01977 Int_t uppPlane = 0;
01978 Double_t nStrips = 0;
01979 Double_t avePH = 0;
01980 Double_t aveWidth = 0;
01981
01982 //keep looping until we have all windows
01983 Bool_t keepGoing = true;
01984 Int_t nLoops = 0;
01985 while(keepGoing && nLoops<pMAXHOUGHITER) {
01986
01987 // MSG("SubShowerSR",Msg::kDebug) << "Running BestHough(): Loop number "
01988 // << nLoops << endl;
01989
01990 //remember number of strips in cluster after last loop
01991 //once this value does not change, then stop looping
01992 Double_t oldNStrips = nStrips;
01993
01994 //Get Hough m,c:
01995 houghResult MCV;
01996 Int_t badGradient[4] = {0};
01997
01999 //If we are on the first loop, use all windows to get angle
02000 //If we are not on first loop, just use previously
02001 //selected windows to get better determination of angle
02003
02004 if(cluster.size()==0){
02005 // cout << "cluster.size()=0" << endl;
02006 MCV = BestHough(plnwindows);
02007
02008 //verify that best hough passes reasonably close to vertex:
02009 //TV: huh? Does it ever do this?
02010 if(false){
02011 // cout<<"HOW THE FUCK DID I GET IN HERE?"<<endl;
02012 double vertexY_simple = (vertexPlane - MCV.flat.iZ)*
02013 MCV.flat.slope.mean + MCV.flat.inter.mean;
02014 double vertexY_simple_peak = (vertexPlane - MCV.flat.iZ)*
02015 MCV.flat.slope.peak + MCV.flat.inter.peak;
02016
02017 // MSG("SubShowerSR",Msg::kDebug)
02018 // cout<< "vertexY_simple = "
02019 // << vertexY_simple << endl;
02020
02021 if( vertexY_simple < vertexTPos - 2*vertexTPosWidth ||
02022 vertexY_simple > vertexTPos + 2*vertexTPosWidth ||
02023 MCV.flat.slope.mean==0 ) badGradient[0] = 1;
02024 if( vertexY_simple_peak < vertexTPos - 2*vertexTPosWidth ||
02025 vertexY_simple_peak > vertexTPos + 2*vertexTPosWidth ||
02026 MCV.flat.slope.peak==0 ) badGradient[1] = 1;
02027
02028 double vertexY_ph = (vertexPlane - MCV.ph.iZ)*MCV.ph.slope.mean + MCV.ph.inter.mean;
02029 double vertexY_ph_peak = (vertexPlane - MCV.ph.iZ)*MCV.ph.slope.peak + MCV.ph.inter.peak;
02030
02031 // MSG("SubShowerSR",Msg::kDebug)
02032 // cout << "vertexY_ph = "
02033 // << vertexY_ph << endl;
02034
02035 if( vertexY_ph < vertexTPos - 2*vertexTPosWidth ||
02036 vertexY_ph > vertexTPos + 2*vertexTPosWidth ||
02037 MCV.ph.slope.mean==0 ) badGradient[2] = 1;
02038 if( vertexY_ph_peak < vertexTPos - 2*vertexTPosWidth ||
02039 vertexY_ph_peak > vertexTPos + 2*vertexTPosWidth ||
02040 MCV.ph.slope.peak==0 ) badGradient[3] = 1;
02041 }//end of the statement that does nothing.
02042 } // cluster.size()==0, i.e., fisrt loop
02043 else {
02044 // cout << "cluster.size()="<< cluster.size() << endl;
02045
02046 MCV = BestHough(cluster);
02047
02048 }
02049 /*
02050 cout<<"MCV: flat slope "<<MCV.flat.slope.mean<<" inter "<<MCV.flat.inter.mean<<" iZ "<<MCV.flat.iZ<<endl;
02051 cout<<"MCV: flat slope "<<MCV.flat.slope.rms<<" inter "<<MCV.flat.inter.rms<<" iZ "<<MCV.flat.iZ<<endl;
02052 cout<<"MCV: flat slope "<<MCV.flat.slope.peak<<" inter "<<MCV.flat.inter.peak<<" iZ "<<MCV.flat.iZ<<endl;
02053 cout<<"MCV: ph slope "<<MCV.ph.slope.mean<<" inter "<<MCV.ph.inter.mean<<" iZ "<<MCV.ph.iZ<<endl;
02054 cout<<"MCV: ph slope "<<MCV.ph.slope.rms<<" inter "<<MCV.ph.inter.rms<<" iZ "<<MCV.ph.iZ<<endl;
02055 cout<<"MCV: ph slope "<<MCV.ph.slope.peak<<" inter "<<MCV.ph.inter.peak<<" iZ "<<MCV.ph.iZ<<endl;
02056 */
02057
02058
02059 cluster.clear();
02060 avePH = 0;
02061 aveWidth = 0;
02062 nStrips = 0;
02063 lowPlane = 2000;
02064 uppPlane = 0;
02065 std::vector<int> tempcluster[4];
02066 std::vector<WindowSS*>::iterator winIter = plnwindows.begin();
02067 std::vector<WindowSS*>::iterator winEnd = plnwindows.end();
02068 Int_t counter = 0;
02069 //loop over original windows
02070 while(winIter!=winEnd){
02071 double y[4] = {};
02072 double y_upp[4] = {};
02073 double y_low[4] = {};
02074 //compute predicted t. pos from the flat (mean and peak) and ph (mean and peak) solns.
02075 y[0] = ((*winIter)->plane - MCV.flat.iZ)*MCV.flat.slope.mean + MCV.flat.inter.mean;
02076 y[1] = ((*winIter)->plane - MCV.flat.iZ)*MCV.flat.slope.peak + MCV.flat.inter.peak;
02077 y[2] = ((*winIter)->plane - MCV.ph.iZ)*MCV.ph.slope.mean + MCV.ph.inter.mean;
02078 y[3] = ((*winIter)->plane - MCV.ph.iZ)*MCV.ph.slope.peak + MCV.ph.inter.peak;
02079
02080 // const geo::PlaneGeo gplane = geom->Plane((*winIter)->plane);
02081 const geo::PlaneGeo gplane = geom->Plane(10);
02082 const geo::CellGeo gstrip = gplane.Cell(10);
02083 Double_t STRIPWIDTHINMETRES=gstrip.HalfW()*2.;
02084
02085 if(cluster.size()==0) {
02086 for(int ii=0;ii<4;ii++) {
02087 //compute 1 strip tolerances around predicted tpos's
02088 y_upp[ii] = y[ii] + 1.*STRIPWIDTHINMETRES;
02089 y_low[ii] = y[ii] - 1.*STRIPWIDTHINMETRES;
02090 }
02091 }
02092 else {
02093 for(int ii=0;ii<4;ii++) {
02094 //compute tolerances based on rms around predicted tpos's
02095 Double_t rms = ii<2 ? MCV.flat.inter.rms : MCV.ph.inter.rms;
02096 y_upp[ii] = y[ii] + rms;
02097 y_low[ii] = y[ii] - rms;
02098 }
02099 }
02100
02101 for(int ii=0;ii<4;ii++){
02102 if(((*winIter)->upper_tpos>=y[ii] && (*winIter)->lower_tpos<=y[ii]) ||
02103 ((*winIter)->phpos<=y_upp[ii] && (*winIter)->phpos>=y_low[ii])) {
02104 //predicted tpos is in the window, or within the tolerances
02105 //bad gradient is always zero, unless false sometimes equals true.
02106 //so keep track of this window
02107 if(badGradient[ii]==0) tempcluster[ii].push_back(counter);
02108 }
02109 }
02110 winIter++;
02111 counter++;
02112 }
02113
02114 Int_t best_cluster = -1;
02115 Int_t max_size = 0;
02116
02117 for(unsigned int ii=0;ii<4;ii++){
02118 if((int)tempcluster[ii].size()>max_size) {
02119 //figure out which of the types of clusters has the most entries
02120 max_size = tempcluster[ii].size();
02121 best_cluster = ii;
02122 }
02123 }
02124
02125 if(best_cluster>=0 && best_cluster<=3) {
02126 std::vector<WindowSS*>::iterator winIter = plnwindows.begin();
02127 std::vector<WindowSS*>::iterator winEnd = plnwindows.end();
02128 std::vector<int>::iterator tempIter = tempcluster[best_cluster].begin();
02129 std::vector<int>::iterator tempEnd = tempcluster[best_cluster].end();
02130 counter = 0;
02131 //loop over plane windows
02132 while(winIter!=winEnd){
02133 //loop over tmpcluster
02134 // cout<<"Testing a hough to push back in plane "<<(*winIter)->plane<<" upper "<<(*winIter)->upper<<" lower "<<(*winIter)->lower<<" counter "<<counter<<" (*tempiter )"<<(*tempIter)<<endl;
02135
02136 if(tempIter!=tempEnd && (*tempIter) == counter) {
02137 //push back this window into the cluster
02138 // cout<<"Found a hough to push back in plane "<<(*winIter)->plane<<" upper "<<(*winIter)->upper<<" lower "<<(*winIter)->lower<<endl;
02139 cluster.push_back(*winIter);
02140 avePH+= (*winIter)->ph;
02141 aveWidth+= (*winIter)->upper_tpos - (*winIter)->lower_tpos;
02142 nStrips+= Double_t((*winIter)->upper - (*winIter)->lower + 1);
02143 if((*winIter)->plane<lowPlane) lowPlane = (*winIter)->plane;
02144 if((*winIter)->plane>uppPlane) uppPlane = (*winIter)->plane;
02145 tempIter++;
02146 }
02147 winIter++;
02148 counter++;
02149 }
02150 }
02151
02152 if(nStrips == oldNStrips) keepGoing = false;
02153 nLoops+=1;
02154
02155 }
02156 if(nStrips<=0) {
02157 return emptyCluster;
02158 }
02159
02160 // MSG("SubShowerSR",Msg::kDebug)
02161 // << "Returning Proto-SubShower from HoughTransCluster()" << endl;
02162
02163 avePH/=nStrips;
02164 if(((uppPlane-lowPlane + 2)/2)<pMinHoughPlanes&&avePH<pMinHoughPH ) {
02165 return emptyCluster;
02166 }
02167
02168 return cluster;
02169 }
|
|
|
Definition at line 340 of file MakeClusterSS.cxx. References rawdata::RawDigit::ADC(), begPlane, recobase::CellHit::Cell(), endPlane, clusterss::CellHitGrad::PHErr(), recobase::CellHit::Plane(), plnclusters, printlevel, clusterss::CellHitGrad::SetTGM(), clusterss::CellHitGrad::SetTGMe(), clusterss::CellHitGrad::TGM(), and clusterss::CellHitGrad::TGMe(). Referenced by DoCluster(). 00341 {
00342 // cout<<" In Make PlaneClusters "<<view<<endl;
00343 //first decide which variables to use based on the view
00344 std::vector<CellHitGrad*> *chglist;
00345
00346 if(view==geo::kX){ //xview
00347 chglist=&xchglist;
00348 }
00349 else{ //yview
00350 chglist=&ychglist;
00351 }
00352 plnclusters.clear();
00353 begPlane=-1;
00354 endPlane=-1;
00355
00356 if(printlevel==1){
00357 // cout<<" IN MakePlaneClusters "<<view<<endl;
00358 // cout<<"Working with strips: "<<endl;
00359 // for(unsigned int i=0;i<chglist->size();i++){
00360 // (*chglist)[i]->Print("");
00361 // }
00362 }
00363
00364
00365 //loop over the list of CellHits and put into map of clusters, indexed by plane number
00366 for(unsigned int ih=0;ih<chglist->size();ih++){
00367 CellHitGrad *chg = (*chglist)[ih];
00368
00369 //look for the beginning plane
00370 if(begPlane==-1){
00371 begPlane=chg->Plane();
00372 }
00373 if(chg->Plane()<begPlane){
00374 begPlane = chg->Plane();
00375 }
00376
00377 //look for the end plane
00378 if(endPlane==-1){
00379 endPlane=chg->Plane();
00380 }
00381 if(chg->Plane()>endPlane){
00382 endPlane = chg->Plane();
00383 }
00384
00385
00386 //loop over CellHits again to fill the extra information required by a CellHitGrad
00387 //look for adjacent cells
00388 //first look for one higher
00389 int cellp = chg->Cell()+1;
00390 //then one lower
00391 int cellm = chg->Cell()-1;
00392 for(unsigned int icell = 0;icell<chglist->size();icell++){
00393 CellHitGrad *nxtchg = (*chglist)[icell];
00394 if(nxtchg->Cell()==cellp){
00395 //found one up
00396 float mip;
00397 bool calibrated = nxtchg->MIP(mip);
00398 if(!calibrated){
00399 unsigned short adc;
00400 nxtchg->ADC(adc);
00401 mip = adc/ADCTOMIP;
00402 }
00403 chg->SetTGM(chg->TGM()+mip);
00404 chg->SetTGMe(chg->TGMe()+nxtchg->PHErr()*nxtchg->PHErr());
00405 }
00406 //now one lower
00407 if(nxtchg->Cell()==cellm){
00408 float mip;
00409 bool calibrated = nxtchg->MIP(mip);
00410 if(!calibrated){
00411 unsigned short adc;
00412 nxtchg->ADC(adc);
00413 mip = adc/ADCTOMIP;
00414 }
00415 chg->SetTGM(chg->TGM()+mip);
00416 chg->SetTGMe(chg->TGMe()+nxtchg->PHErr()*nxtchg->PHErr());
00417 }
00418 }
00419
00420 //add this to a cluster for the given plane
00421 //if we havent seen this plane before, setup a cluster for it
00422 if(plnclusters.find(chg->Plane())==plnclusters.end()){
00423 recobase::Cluster *c = new recobase::Cluster();
00424 plnclusters.insert(pair<int,recobase::Cluster*>(chg->Plane(),c));
00425 }
00426 //add this Cell to the plane cluster
00427 plnclusters[chg->Plane()]->Add(chg);
00428 // cout<<" *****Adding a Cell to a plane cluster! plane: "<<chg->Plane()<<endl;
00429 // chg->Print();
00430 // cout<<" *****"<<endl;
00431 //add pulseheight to cluster Q
00432 double Q = plnclusters[chg->Plane()]->Q();
00433 float mip;
00434 bool calibrated = chg->MIP(mip);
00435 if(!calibrated){
00436 unsigned short adc;
00437 chg->ADC(adc);
00438 mip = adc/ADCTOMIP;
00439 }
00440
00441 short unsigned int adc;
00442 chg->ADC(adc);
00443 plnclusters[chg->Plane()]->SetQ(Q+mip);
00444 }
00445 // cout<<" Put all Cells into Plane Clusters found "<<plnclusters.size()<<" of them"<<endl;
00446
00447 if(printlevel==1){
00448 cout<<"Leaving MakePlaneClusters "<<view<<endl;
00449 cout<<"Found "<<plnclusters.size()<<" planes"<<endl;
00450 cout<<"begPlane "<<begPlane<<" endPlane "<<endPlane<<endl;
00451 }
00452 }
|
|
|
Definition at line 2444 of file MakeClusterSS.cxx. Referenced by Reco(). 02445 {
02446 if(view==geo::kX){}
02447 }
|
|
|
Definition at line 1778 of file MakeClusterSS.cxx. References rawdata::RawDigit::ADC(), recobase::Cluster::Add(), begWinPlane, recobase::CellHit::Cell(), endWinPlane, event, recobase::Cluster::NCell(), recobase::CellHit::Plane(), printlevel, recobase::Cluster::Q(), run, recobase::Cluster::SetQ(), and windows. Referenced by DoCluster(). 01779 {
01780
01781 // cout<<"In PruneCellList "<<view<<endl;
01782 //first decide which variables to use based on the view
01783 std::vector<CellHitGrad*> *chglist;
01784 std::vector<recobase::Cluster *> *finalcluster;
01785
01786 if(view==geo::kX){ //xview
01787 chglist=&xchglist;
01788 finalcluster = &xclusterlist;
01789 }
01790 else{ //yview
01791 chglist=&ychglist;
01792 finalcluster = &yclusterlist;
01793 }
01794
01795 if(printlevel==1){
01796 cout<<"Printing windows in PruneStep"<<endl;
01797 for(unsigned int i=0;i<windows.size();i++){
01798 cout<<" i "<<i<<" plane "<<windows[i]->plane<<" upper "<<windows[i]->upper<<" lower "<<windows[i]->lower<<endl;
01799 }
01800 cout<<"at begining of prune, have "<<chglist->size()<<endl;
01801 cout<<"begWinPlane "<<begWinPlane<<" endwinPlane "<<endWinPlane<<endl;
01802 }
01803
01804 recobase::Cluster *c = new recobase::Cluster();
01805 std::vector<CellHitGrad *>::iterator iter = chglist->begin();
01806 while(iter!=chglist->end()){
01807 recobase::CellHit *stp = *iter;
01808 if(printlevel==1){
01809 // cout<<"Checking if this cell is in a window"<<endl;
01810 // stp->Print();
01811 }
01812 if(stp->Plane()>=begWinPlane && stp->Plane()<=endWinPlane){
01813 std::vector<WindowSS *>::iterator winIter = windows.begin();
01814 while(winIter!=windows.end()){
01815 // cout<<"Checking if "<<(*winIter)->plane<<" equals "<<stp->Plane()<<endl;
01816 if((*winIter)->plane==stp->Plane()){
01817 Int_t strp = stp->Cell();
01818 // cout<<"IT DOES! Checkign if "<<strp<<" is between "<<(*winIter)->upper<<" and "<<(*winIter)->lower<<endl;
01819 if(strp<=(*winIter)->upper && strp>=(*winIter)->lower) {
01820 c->Add(stp);
01821 if(printlevel==1){
01822 // cout<<"Added a cell to cluster "<<stp->Plane()<<" "<<strp<<endl;
01823 }
01824 double Q = c->Q();
01825 float mip;
01826 bool calibrated = stp->MIP(mip);
01827 if(!calibrated){
01828 unsigned short adc;
01829 stp->ADC(adc);
01830 mip = adc/ADCTOMIP;
01831 }
01832
01833 c->SetQ(Q+mip);
01834
01835 chglist->erase(iter);
01836 iter--;
01837 break;
01838 }
01839 }
01840 winIter++;
01841 }
01842 }
01843 iter++;
01844 }
01845 bool foundcluster = false;
01846 if(c->NCell()>0){
01847 foundcluster=true;
01848 finalcluster->push_back(c);
01849 }
01850
01851 if(printlevel==1){
01852 cout<<"Filled another cluster for Run: "<<run<<" event "<<event<<endl;
01853 cout<<"Now we have "<<finalcluster->size()<<" clusters for view: "<<view<<endl;
01854 cout<<"New cluster has "<<c->NCell()<<" strips "<<endl;
01855 cout<<"strips left over "<<chglist->size()<<endl;
01856 }
01857
01858 return foundcluster;
01859 }
|
|
|
Reimplemented from jobc::Module. Definition at line 118 of file MakeClusterSS.cxx. References edm::EventHandle::Cal(), CleanUpAllContainers(), CleanUpContainers(), edm::EventHandle::DAQ(), DoCluster(), edm::EventHeader::Event(), event, evtcntr, geom, edm::EventHandle::Header(), geo::Geometry::Instance(), MergeClusters(), edm::EventHandle::Reco(), edm::EventHeader::Run(), run, SplitIntoViews(), xclusterlist, and yclusterlist. 00119 {
00120 evtcntr++;
00121 // printlevel=1;
00122 // cout<<"PrintLevel in Make Cluster "<<printlevel<<endl;
00123 //get the list of CellHits
00124 std::vector<const recobase::CellHit*> hitlist(0);
00125 try{ evt.Cal().Get("./MergeHits",hitlist); }
00126 catch(edm::Exception e){
00127 cerr<<"Couldn't find the MergedCellHit list, trying for the original"<<endl;
00128 try{ evt.Cal().Get("./Hits",hitlist); }
00129 catch(edm::Exception e){
00130 cerr<<"Couldn't find the Original CellHit list either, failing."<<endl;
00131 return jobc::kFailed;
00132 }
00133 }
00134
00135 //now get a header
00136 std::vector<const hdr::Header*> head(0);
00137 try{ evt.DAQ().Get(".",head); }
00138 catch(edm::Exception e){
00139 cerr<<"Couldn't get a head"<<endl;
00140 return false;
00141 }
00142 geom = &geo::Geometry::Instance(1,head[0]->DetectorID());
00143
00144 edm::EventHeader &eh = evt.Header();
00145 run = eh.Run();
00146 event = eh.Event();
00147 // cout<<"*************************************************************************"<<endl;
00148 // cout<<"***IN RECO: On Run "<<run<<" "<<event<<" which is the "<<evtcntr<<" event we've seen"<<endl;
00149
00150 //split initial CellHit list into separate views
00151 //fill initial values of CellHitGrad class
00152 SplitIntoViews(hitlist);
00153
00154 //loop over the views (x or y)
00155 const int NVIEWS=2;
00156 for(int iv=0;iv<NVIEWS;iv++){
00157 std::vector<CellHitGrad*> *chglist;
00158 geo::View_t view;
00159 if(iv==0){ //xview
00160 chglist=&xchglist;
00161 view=geo::kX;
00162 }
00163 else{ //yview
00164 chglist=&ychglist;
00165 view=geo::kY;
00166 }
00167
00168 bool foundclus=true;
00169 //keep trying to find clusters until we run out of Cells
00170 //or we didn'y find another cluster
00171 while(chglist->size()!=0&&foundclus){
00172 // cout<<"TRYING TO FIND CLUSTERS. "<<chglist->size()<<" strips left"<<endl;
00173 foundclus = DoCluster(view);
00174 // if(foundclus){
00175 // cout<<"FOUND A CLUSTER, going around again"<<endl;
00176 // }
00177 CleanUpContainers();
00178 }
00179
00180 //if so configured, try to merge small clusters into bigger clusters
00181 if(pMergeClusters){
00182 MergeClusters(view);
00183 }
00184 }
00185
00186 //write the 2d clusters out
00187
00188 if(evt.Reco().GetFolder("./SSClusterX")==0){
00189 evt.Reco().MakeFolder("./SSClusterX");
00190 }
00191 evt.Reco().PutVector(xclusterlist,"SSClusterX");
00192
00193 if(evt.Reco().GetFolder("./SSClusterY")==0){
00194 evt.Reco().MakeFolder("./SSClusterY");
00195 }
00196 evt.Reco().PutVector(yclusterlist,"SSClusterY");
00197
00198 // cout<<"About to clean up"<<endl;
00199 CleanUpAllContainers();
00200
00201
00202
00203 return jobc::kPassed; // kFailed if you want to fail the event
00204 }
|
|
|
Definition at line 263 of file MakeClusterSS.cxx. References rawdata::RawDigit::ADC(), clusterss::CellHitGrad::SetPHErr(), clusterss::CellHitGrad::SetTGM(), clusterss::CellHitGrad::SetTGMe(), clusterss::CellHitGrad::SetTGP(), clusterss::CellHitGrad::SetTGPe(), recobase::CellHit::View(), xchglist, and ychglist. Referenced by Reco(). 00264 {
00265
00266 for(unsigned int ih=0;ih<hitlist.size();ih++){
00267 const recobase::CellHit* stp = hitlist[ih];
00268 CellHitGrad *chg = new CellHitGrad(*stp);
00269 float mip;
00270 bool calibrated = stp->MIP(mip);
00271 if(!calibrated){
00272 unsigned short adc;
00273 stp->ADC(adc);
00274 mip = adc/ADCTOMIP;
00275 }
00276
00277 chg->SetTGP(mip);
00278 double pherr = 0.;
00279 if(mip>0) pherr = mip/sqrt(mip);
00280 chg->SetPHErr(pherr);
00281 chg->SetTGP(mip);
00282 chg->SetTGM(mip);
00283 chg->SetTGPe(pherr*pherr);
00284 chg->SetTGMe(pherr*pherr);
00285
00286 if(stp->View()==geo::kX) xchglist.push_back(chg);
00287 else if(stp->View()==geo::kY) ychglist.push_back(chg);
00288 }
00289 return;
00290 }
|
|
||||||||||||
|
Definition at line 1405 of file MakeClusterSS.cxx. References clusterss::ClustVars::AddNewWindow(), geo::PlaneGeo::Cell(), clusterss::WindowSS::centroid, clusterss::ClustVars::chi2bn, clusterss::ClustVars::chi2tn, clusterss::ClustVars::eslopebn, clusterss::ClustVars::eslopen, clusterss::ClustVars::eslopetn, FindPlaneFromShwMax(), geom, geo::CellGeo::HalfW(), clusterss::WindowSS::lower, clusterss::WindowSS::lower_tpos, geo::Geometry::NextPlaneInView(), numPreMaxPlanes, clusterss::WindowSS::ph, clusterss::WindowSS::phwidth, clusterss::WindowSS::plane, geo::Geometry::Plane(), plnwindows, clusterss::ClustVars::shwmid, clusterss::ClustVars::shwwid, clusterss::ClustVars::slopebn, clusterss::ClustVars::slopen, clusterss::ClustVars::slopetn, clusterss::ClustVars::trustslopen, clusterss::WindowSS::type, clusterss::WindowSS::upper, clusterss::WindowSS::upper_tpos, and windows. Referenced by ClusterWindows(). 01406 {
01407 //TV: FIxes needed here. all of the ClustVars variables are doubles, so == comparisons won't work
01408
01409 //found no houghcluster
01410 //so try another approach to clustering
01411 // cout<<"StupidHoughNoWork "<<view<<endl;
01412
01413 //first decide which variables to use based on the view
01414 windows.clear();
01415
01416
01417 const geo::PlaneGeo gplane = geom->Plane(10);
01418 const geo::CellGeo gstrip = gplane.Cell(10); // IS THAT OK ? TRA LA RI LA (this must mean something in greek)
01419 Double_t STRIPWIDTHINMETRES=gstrip.HalfW()*2.;
01420
01421 Int_t numLongPlanes = numPreMaxPlanes+numPostMaxPlanes; // !!! change uint int
01422 // cout<<"Numlongplanes in Stupid "<<numLongPlanes<<endl;
01423 //loop over planes
01424
01425 int nt = 0; //count of number of windows found
01426 int nb = 0; //also a count of the number of winows found
01427
01428 for (int d = 0;d<numLongPlanes;d++){
01429 //find the dth plane from shower max
01430 //before if there are more planes in the prewindow
01431 //after if there are more planes in the postwindow
01432 int pl = FindPlaneFromShwMax(view,d);
01433 // cout<<"In stupid, d: "<<d<<" pl "<<pl<<endl;
01434 WindowSS *win = new WindowSS();
01435 //here, set the plane to be something real
01436 //if later we found no windows in this plane
01437 //we will want to try again, so we set the plane number
01438 win->plane=pl;
01439
01440 // PH for current best matched window:
01441 double weight = 0.;
01442 //deviation of best matched window from prediction of
01443 //centroid for this plane:
01444 double weight1 = 1000000.; // 100 to make cm
01445 //loop keeps track of # windows already checked on this plane:
01446 int loop = 0;
01447 // counts number of windows with a good match:
01448 int within = 0;
01449 //prediction of centroid for this plane (not using slope in info):
01450 double mid0 = 0;
01451 //prediction of centroid for this plane using slope info where available:
01452 double mid = 0;
01453
01454 //loop over all in windows
01455 std::vector<clusterss::WindowSS *>::iterator winIter = plnwindows.begin();
01456 while(winIter!=plnwindows.end()){
01457 if((*winIter)->plane==pl){
01458 //we have a window in our plane of interest
01459 // cout<<"Found a plnwindow for plane "<<pl<<" upper: "<<(*winIter)->upper<<" lower "<<(*winIter)->lower<<endl;
01460 // cout<<"what is cv.shwmid? "<<cv.shwmid<<endl;
01461 loop++;
01462 double dev = cv.shwwid;
01463
01464 //find the widest window in this plane
01465 if(dev<((*winIter)->upper_tpos-(*winIter)->lower_tpos+STRIPWIDTHINMETRES))
01466 dev =(*winIter)->upper_tpos-(*winIter)->lower_tpos+STRIPWIDTHINMETRES;
01467
01468 //if its too small, make it bigger (I don't know why)
01469 if(dev<2.*STRIPWIDTHINMETRES) dev = 2.*STRIPWIDTHINMETRES;
01470
01471 // cout<<"dev is "<<dev<<endl;
01472 //set the prediction of the centriod for this plane
01473 //both with and without slope info
01474 if(cv.shwmid!=0){
01475 mid0 = cv.shwmid;
01476 mid = cv.shwmid;
01477 }
01478 else{
01479 mid = ((*winIter)->upper+(*winIter)->lower)/2.;
01480 mid0 = mid;
01481 }
01482
01484 // check if this window is consistent with previously selected
01485 // windows and has a higher PH than current best match for this
01486 // plane or else if it's shower max plane
01488 if((cv.shwmid==0 ||
01489 (TMath::Abs((*winIter)->upper_tpos-mid)<dev &&
01490 TMath::Abs((*winIter)->lower_tpos-mid)<dev))
01491 && ((*winIter)->upper_tpos+(*winIter)->lower_tpos)/2.-mid0<weight1){
01492 //shower centroid is currently zero
01493 //or plane half width is smaller than dev (upper minus lower)
01494 //and half width minus best guess at half width is less than allowable deviation
01496 //loop through planes in long. window again to do a local
01497 //scan to ensure best match is found.
01498 //step forward and backward once each if possible
01500 int loopp = 0;
01501 int loopm = 0;
01502 int withinp = 0;
01503 int withinm = 0;
01504 double midp = 0;
01505 double midm = 0;
01506
01507 //find windows in next plane and in previous plane
01508 //to check to see if this window matches windows adjacent
01509 //matches if a window in next(prev) plane
01510 //has upper an lower edges that are less far away from the middle of the long. cluster
01511 //than the biggest window in the current plane seen so far
01512 std::vector<WindowSS *>::iterator winIter1 = plnwindows.begin();
01513 while(winIter1!=plnwindows.end()){
01514 //first look at next plane
01515 if((*winIter1)->plane==(int)geom->NextPlaneInView(pl,1)){
01516 //go to next plane in same view
01517 loopp++;
01518 if(cv.shwmid!=0){ //not shower max plane
01519 midp = cv.shwmid;
01520 if(TMath::Abs((*winIter1)->upper_tpos-midp)<dev
01521 ||TMath::Abs((*winIter1)->lower_tpos-midp)<dev){ //good match
01522 withinp++;
01523 }
01524 }
01525 else if(cv.shwmid==0){ //in shower max plane
01526 midp = ((*winIter)->upper_tpos+(*winIter)->lower_tpos)/2.;
01527 if(TMath::Abs((*winIter1)->upper_tpos-midp)<dev
01528 ||TMath::Abs((*winIter1)->lower_tpos-midp)<dev){ //good match
01529 withinp++;
01530 }
01531 }
01532 } // if (*winIter1)?
01533 //now previous plane
01534 if((*winIter1)->plane==(int)geom->NextPlaneInView(pl,-1)){
01535 //go to previous same view plane
01536 loopm++;
01537 if(cv.shwmid!=0){ // not shower max plane
01538 midm = cv.shwmid;
01539 if(TMath::Abs((*winIter1)->upper_tpos-midm)<dev
01540 ||TMath::Abs((*winIter1)->lower_tpos-midm)<dev){ //good match
01541 withinm++;
01542 }
01543 }
01544 else if(cv.shwmid==0){ //shower max plane
01545 midm = ((*winIter)->upper_tpos+(*winIter)->lower_tpos)/2.;
01546 // cout<<"midm "<<midm<<endl;
01547 // cout<<" prev plane upper: "<<(*winIter1)->upper_tpos<<" lower "<<(*winIter1)->lower_tpos<<endl;
01548
01549 if(TMath::Abs((*winIter1)->upper_tpos-midm)<dev
01550 ||TMath::Abs((*winIter1)->lower_tpos-midm)<dev){ //good match
01551 withinm++;
01552 }
01553 }// if shwmid!=0
01554 }//if winIter1
01555 winIter1++;
01556 } //done looking in planes ahead and behind the current one
01557
01558 // cout<<"Did we find a good window? within p "<<withinp<<" m "<<withinm<<" loopp "<<loopp<<" loopm "<<loopm<<endl;
01559
01560 if((withinp>0 && withinm>0)||(loopp==0 && withinm>0)||(loopm==0 && withinp>0)){
01561 // cout<<"Found a window inplane "<<pl<<endl;
01562 //success! current window is a good solution
01563 within++;
01564 //save solution:
01565 win->plane = (*winIter)->plane;
01566 win->upper = (*winIter)->upper;
01567 win->lower = (*winIter)->lower;
01568 win->upper_tpos = (*winIter)->upper_tpos;
01569 win->lower_tpos = (*winIter)->lower_tpos;
01570 win->ph = (*winIter)->ph;
01571 win->type = (*winIter)->type;
01572 weight = (*winIter)->ph;
01573 weight1 = ((*winIter)->upper_tpos+(*winIter)->lower_tpos)/2.-mid0;
01574 //these will be overwritten if there is another window
01575 //which is also a good match, but has more PH,
01576 //ensuring we get best possible match
01577 //TV: 7-30-09 where is it checking the PH? Won't this just store the last window
01578 //found in the current plane?
01579 //TV: weight1 can be negative, which means we won't add a better cluster much of the time
01580 //TV: I also think the criterion is not more PH, but is supposed to be distance (maybe comment is an old one)
01581 } // if withinp
01582 } // if shmid=0, etc.
01583 } //if (winIter->plane==pl)
01584 winIter++;
01585 } //while (winIter!=winEnd)
01586
01587 if(loop*within>0){ //got a matched window
01588 //we do this bit of the loop again if we find a hough solution
01589 //determine widest window:
01590 cv.AddNewWindow(*win,STRIPWIDTHINMETRES);
01591 win->phwidth = cv.shwwid;
01592 win->centroid = cv.shwmid;
01593 } // if (loop*within...)
01594 windows.push_back(win);
01595 if(windows[d]->ph>0){nt++; nb++;}
01596 } // for d (plane index)
01597
01598
01599 //if we found at least two windows
01600 if (nt>2 && nb>2) {
01601 TGraphErrors* grat = new TGraphErrors(nt);
01602 TGraphErrors* grab = new TGraphErrors(nb);
01603 int t = 0;
01604 int b = 0;
01605 for (int d = 0;d<numLongPlanes;d++){
01606 //fill some graphs of upper edge tpos vs. plane number
01607 //fill some graphs of lower edge tpos vs. plane number
01608 if(windows[d]->ph>0) {
01609 grat->SetPoint(t,windows[d]->plane,windows[d]->upper_tpos);
01610 grat->SetPointError(t,0,1./sqrt(windows[d]->ph));
01611 t++;
01612 grab->SetPoint(b,windows[d]->plane,windows[d]->lower_tpos);
01613 grab->SetPointError(b,0,1./sqrt(windows[d]->ph));
01614 b++;
01615 }
01616 } // for d (plane)
01617
01618 //fit second order polys to these graphs (why 2nd order?)
01619 //find the slopes of the upper limits/plane
01620 grat->Fit("pol2","Q", 0, 2000);
01621 TF1 *ssPol1 = grat->GetFunction("pol2");
01622 // if(!ssPol1 ){
01623 // cout << "**********************************************************" <<endl
01624 // << "ECK NO POL! " <<endl;
01625 // }
01626 cv.slopetn = ssPol1->GetParameter(1);
01627 cv.eslopetn = ssPol1->GetParError(1);
01628 cv.chi2tn = ssPol1->GetChisquare();
01629
01630 grab->Fit("pol2","Q", 0, 2000);
01631 ssPol1 = grab->GetFunction("pol2");
01632 // if(!ssPol1 ){
01633 // cout << "**********************************************************" <<endl
01634 // << "ECK NO POL! " <<endl;
01635 // }
01636 //find the slopes of the lower limits/plane
01637 cv.slopebn = ssPol1->GetParameter(1);
01638 cv.eslopebn = ssPol1->GetParError(1);
01639 cv.chi2bn = ssPol1->GetChisquare();
01640 ssPol1 = NULL;
01641 cv.slopen = (cv.slopetn+cv.slopebn)/2.;
01642 cv.eslopen = sqrt(cv.eslopetn*cv.eslopetn+cv.eslopebn*cv.eslopebn)/2.;
01643
01644 // cout<<"fit window "<<cv.slopetn<<" "<<cv.slopebn
01645 // <<" " <<cv.slopen<<" "<<cv.eslopetn<<" "
01646 // <<cv.eslopebn<<" "<<cv.eslopen<<" "
01647 // <<cv.chi2tn/nt<<" "<<cv.chi2bn/nb<<" "
01648 // <<nt<<" "<<nb<<endl;
01649
01650 if((cv.slopetn+cv.slopebn)!=0. && cv.slopetn*cv.slopebn!=0.){
01651 //non zero slopes
01652 if(cv.chi2tn/nt<100. && cv.chi2bn/nb<100. &&
01653 ((((cv.eslopetn/TMath::Abs(cv.slopetn)<0.1 &&
01654 cv.eslopebn/TMath::Abs(cv.slopebn)<0.1 &&
01655 cv.chi2tn/nt>0.1 && cv.chi2bn/nb>0.1)) &&
01656 (TMath::Abs(cv.slopetn-cv.slopebn)/TMath::Abs(cv.slopetn+cv.slopebn)<0.25)) ||
01657 TMath::Abs(cv.slopetn-cv.slopebn)==0)){
01658 //not crazy chi2/ndf, errors on slopes<10%
01659 //rel. difference between up and down slopes<0.25%
01660 //or we got the same slopes
01661 //use average slope and error, trust them
01662 if(TMath::Abs(cv.slopetn-cv.slopebn)>cv.eslopen) cv.eslopen = TMath::Abs(cv.slopetn-cv.slopebn);
01663 cv.trustslopen = true;
01664 }// if chi2
01665 } // if slope blah
01666
01667 //get rid of the graphs
01668 delete grat; grat=NULL;
01669 delete grab; grab=NULL;
01670 }
01671 return true;
01672 //done if no hough solution
01673 }
|
|
|
Implements cfg::Observer. Definition at line 91 of file MakeClusterSS.cxx. References pBestHoughMaxPHFrac, pLongWindowGapPlaneCut, pLongWindowMipCut, pMaxAngleDiff, pMAXHOUGHITER, pMaxOvlpLink, pMaxPDiff, pMaxTDiff, pMaxWidToLenP2, pMaxZDiff, pMergeClusters, pMinHoughPH, pMinHoughPlanes, and printlevel. 00092 {
00093 c("PrintLevel").Get(printlevel);
00094 c("MergeClusters").Get(pMergeClusters);
00095 c("MaxOvlpLink").Get(pMaxOvlpLink);
00096 c("MaxPDiff").Get(pMaxPDiff);
00097 c("MaxZDiff").Get(pMaxZDiff);
00098 c("MaxTDiff").Get(pMaxTDiff);
00099 c("MaxAngleDiff").Get(pMaxAngleDiff);
00100 c("MaxWidToLenP2").Get(pMaxWidToLenP2);
00101 c("LongWindowMipCut").Get(pLongWindowMipCut);
00102 c("LongWindowGapPlaneCut").Get(pLongWindowGapPlaneCut);
00103 c("MinHoughPlanes").Get(pMinHoughPlanes);
00104 c("MinHoughPH").Get(pMinHoughPH);
00105 c("BestHoughMaxPHFrac").Get(pBestHoughMaxPHFrac);
00106 c("MaxHoughIter").Get(pMAXHOUGHITER);
00107 }
|
|
|
Definition at line 49 of file MakeClusterSS.cxx. |
|
|
Definition at line 79 of file MakeClusterSS.h. Referenced by FindLongWindow(), and MakePlaneClusters(). |
|
|
Definition at line 82 of file MakeClusterSS.h. Referenced by ClusterWindows(), FindAllTransverseWindows(), FindLongWindow(), and PruneCellList(). |
|
|
Definition at line 80 of file MakeClusterSS.h. Referenced by FindLongWindow(), and MakePlaneClusters(). |
|
|
Definition at line 83 of file MakeClusterSS.h. Referenced by ClusterWindows(), FindAllTransverseWindows(), FindLongWindow(), and PruneCellList(). |
|
|
Definition at line 78 of file MakeClusterSS.h. Referenced by FindLongWindow(), PruneCellList(), and Reco(). |
|
|
Definition at line 76 of file MakeClusterSS.h. Referenced by Reco(). |
|
|
Definition at line 75 of file MakeClusterSS.h. Referenced by BestHough(), ClusterWindows(), FindAllTransverseWindows(), FindLongWindow(), FindPlaneFromShwMax(), HoughTransCluster(), Reco(), and StupidHoughNoWork(). |
|
|
Definition at line 115 of file MakeClusterSS.h. Referenced by BestHough(), and MakeClusterSS(). |
|
|
Definition at line 86 of file MakeClusterSS.h. Referenced by FindAllTransverseWindows(), FindLongWindow(), and FindPlaneFromShwMax(). |
|
|
Definition at line 85 of file MakeClusterSS.h. Referenced by CleanUpWindows(), ClusterWindows(), FindAllTransverseWindows(), FindLongWindow(), FindPlaneFromShwMax(), and StupidHoughNoWork(). |
|
|
Definition at line 101 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 116 of file MakeClusterSS.h. Referenced by BestHough(), and MakeClusterSS(). |
|
|
Definition at line 107 of file MakeClusterSS.h. Referenced by CleanUpContainers(), FindAllTransverseWindows(), FindLongWindow(), and MakePlaneClusters(). |
|
|
Definition at line 108 of file MakeClusterSS.h. Referenced by CleanUpContainers(), ClusterWindows(), FindAllTransverseWindows(), HoughTransCluster(), and StupidHoughNoWork(). |
|
|
Definition at line 98 of file MakeClusterSS.h. Referenced by FindLongWindow(), and Update(). |
|
|
Definition at line 97 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 94 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 102 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 90 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 91 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 93 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 95 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 92 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 89 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 100 of file MakeClusterSS.h. Referenced by Update(). |
|
|
Definition at line 99 of file MakeClusterSS.h. Referenced by HoughTransCluster(), and Update(). |
|
|
Definition at line 74 of file MakeClusterSS.h. Referenced by CheckCurrSoln(), CleanUpWindows(), ClusterWindows(), DoCluster(), FindAllTransverseWindows(), FindLongWindow(), MakePlaneClusters(), PruneCellList(), and Update(). |
|
|
Definition at line 77 of file MakeClusterSS.h. Referenced by FindLongWindow(), PruneCellList(), and Reco(). |
|
|
Definition at line 84 of file MakeClusterSS.h. Referenced by ClusterWindows(), FindAllTransverseWindows(), FindLongWindow(), and FindPlaneFromShwMax(). |
|
|
Definition at line 109 of file MakeClusterSS.h. Referenced by CheckCurrSoln(), CleanUpContainers(), CleanUpWindows(), ClusterWindows(), DoCluster(), PruneCellList(), and StupidHoughNoWork(). |
|
|
Definition at line 104 of file MakeClusterSS.h. Referenced by CleanUpAllContainers(), and SplitIntoViews(). |
|
|
Definition at line 112 of file MakeClusterSS.h. Referenced by Ana(), CleanUpAllContainers(), and Reco(). |
|
|
Definition at line 105 of file MakeClusterSS.h. Referenced by CleanUpAllContainers(), and SplitIntoViews(). |
|
|
Definition at line 113 of file MakeClusterSS.h. Referenced by Ana(), CleanUpAllContainers(), and Reco(). |
1.3.9.1