#include <PlaneView.h>
Inheritance diagram for evd::PlaneView:
Public Member Functions | |
PlaneView (TGMainFrame *mf) | |
~PlaneView () | |
const char * | Description () const |
const char * | PrintTag () const |
void | Draw (const char *opt="") |
void | DrawTrackCandidates () |
void | DrawTracks () |
void | DrawMC () |
void | DrawMCHits () |
void | DrawRawDigit () |
void | DrawFilament (int use_avg_path=1) |
void | DrawPlaneClusters () |
void | DrawShowers () |
void | Draw3DShowers () |
Private Attributes | |
TPad * | fXviewPad |
TPad * | fYviewPad |
TH2F * | fXviewHisto |
TH2F * | fYviewHisto |
evdb::View2D * | fXview |
evdb::View2D * | fYview |
const PlaneViewOption * | fOption |
double | zmin |
double | zmax |
double | xmin |
double | xmax |
double | ymin |
double | ymax |
|
Definition at line 42 of file PlaneView.cxx. References edm::EventHandle::DAQ(), geo::Geometry::DetHalfHeight(), geo::Geometry::DetHalfWidth(), geo::Geometry::DetLength(), fOption, fXview, fXviewHisto, fXviewPad, fYview, fYviewHisto, fYviewPad, edm::EventHandle::Header(), PlaneViewOption::Instance(), geo::Geometry::Instance(), and evdb::IoModule::Instance(). 00042 : evdb::Canvas(mf) 00043 { 00044 00045 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00046 std::vector<const rawdata::DAQHeader*> header; 00047 short int det = rawdata::kFar; 00048 try{ evt.DAQ().Get("./",header); } 00049 catch(edm::Exception e){ 00050 std::cerr << "Error retrieving daq header, while looking "<< 00051 "in PlaneView::PlaneView(), using default fardet geometry" << std::endl; 00052 } 00053 if(header.size() > 0) det = header[0]->DetId(); 00054 00055 geo::Geometry &fGeo = geo::Geometry::Instance(evt.Header().Run(),det); 00056 00057 evdb::Canvas::fCanvas->cd(); 00058 00059 fXviewPad = new TPad("fXviewPad","Xview",0.0,0.5,0.75,1.0); 00060 fXviewPad->Draw(); 00061 00062 fYviewPad = new TPad("fYviewPad","Yview",0.0,0.0,0.75,0.5); 00063 fYviewPad->Draw(); 00064 00065 fXviewPad->cd(); 00066 fXviewHisto = new TH2F("fXviewHisto",";z (cm);x (cm)", 00067 200,0.,fGeo.DetLength(), 00068 32,-fGeo.DetHalfWidth(),fGeo.DetHalfWidth()); 00069 fXviewHisto->Draw(); 00070 00071 fYviewPad->cd(); 00072 fYviewHisto = new TH2F("fYviewHisto",";z (cm);y (cm)", 00073 200,0.,fGeo.DetLength(), 00074 32,-fGeo.DetHalfHeight(),fGeo.DetHalfHeight()); 00075 00076 fYviewHisto->Draw(); 00077 00078 fXview = new evdb::View2D(); 00079 fYview = new evdb::View2D(); 00080 00081 fOption = &PlaneViewOption::Instance(); 00082 00083 }
|
|
Definition at line 87 of file PlaneView.cxx. 00087 { }
|
|
Give a medium length description of what the view holds to be printed. Examples: "Full view of experiment", "3D View", ... Reimplemented from evdb::Canvas. Definition at line 17 of file PlaneView.h. 00017 { return "Plane View"; }
|
|
Implements evdb::Canvas. Definition at line 90 of file PlaneView.cxx. References evdb::View2D::Clear(), evdb::View2D::Draw(), Draw3DShowers(), DrawFilament(), DrawMC(), DrawMCHits(), DrawPlaneClusters(), DrawRawDigit(), DrawShowers(), DrawTrackCandidates(), DrawTracks(), PlaneViewOption::fDraw3DShowers, PlaneViewOption::fDrawFilaments, PlaneViewOption::fDrawMCTruthHits, PlaneViewOption::fDrawMCTruthVectors, PlaneViewOption::fDrawPlaneClusters, PlaneViewOption::fDrawRawDigits, PlaneViewOption::fDrawShowers, PlaneViewOption::fDrawTrackCandidates, PlaneViewOption::fDrawTracks, fOption, fXview, fXviewHisto, fXviewPad, fYview, fYviewHisto, fYviewPad, xmax, xmin, ymax, ymin, zmax, and zmin. 00091 { 00092 fXview->Clear(); 00093 fYview->Clear(); 00094 00095 zmin = 1e20, zmax = -1e20; 00096 xmin = 1e20, xmax = -1e20; 00097 ymin = 1e20, ymax = -1e20; 00098 00099 00100 if (fOption->fDrawMCTruthVectors) 00101 DrawMC(); 00102 if (fOption->fDrawMCTruthHits) 00103 DrawMCHits(); 00104 if (fOption->fDrawTracks) 00105 DrawTracks(); 00106 if (fOption->fDrawTrackCandidates) 00107 DrawTrackCandidates(); 00108 if (fOption->fDrawRawDigits) 00109 DrawRawDigit(); 00110 if (fOption->fDrawFilaments) 00111 DrawFilament(fOption->fDrawFilaments!=2); 00112 if (fOption->fDrawPlaneClusters) 00113 DrawPlaneClusters(); 00114 if(fOption->fDrawShowers) 00115 DrawShowers(); 00116 if(fOption->fDraw3DShowers) 00117 Draw3DShowers(); 00118 00119 // Force the x and y views to have the same vertical scale 00120 if (xmax-xmin > ymax-ymin) { 00121 double tmp = 0.5*((xmax-xmin)-(ymax-ymin)); 00122 ymax += tmp; 00123 ymin -= tmp; 00124 } 00125 else { 00126 double tmp = 0.5*((ymax-ymin)-(xmax-xmin)); 00127 xmax += tmp; 00128 xmin -= tmp; 00129 } 00130 xmin -= 25.0; xmax += 25.0; 00131 ymin -= 25.0; ymax += 25.0; 00132 zmin -= 25.0; zmax += 25.0; 00133 00134 fXviewHisto->GetXaxis()->SetRangeUser(zmin,zmax); 00135 fXviewHisto->GetYaxis()->SetRangeUser(xmin,xmax); 00136 00137 fYviewHisto->GetXaxis()->SetRangeUser(zmin,zmax); 00138 fYviewHisto->GetYaxis()->SetRangeUser(ymin,ymax); 00139 00140 // std::cout << "Drawing X-view" << std::endl; 00141 00142 fXviewPad->cd(); 00143 fXviewHisto->Draw(); 00144 fXview->Draw(); 00145 00146 // std::cout << "Drawing Y-view" << std::endl; 00147 00148 fYviewPad->cd(); 00149 fYviewHisto->Draw(); 00150 fYview->Draw(); 00151 00152 evdb::Canvas::fCanvas->Update(); 00153 00154 }
|
|
Definition at line 855 of file PlaneView.cxx. References evdb::View2D::AddBox(), evdb::View2D::AddLine(), recobase::CellHit::Cell(), edm::EventHandle::DAQ(), fXview, fYview, recobase::ShowerBase::GetCells(), recobase::ShowerBase::GetEndT(), recobase::ShowerBase::GetEndZ(), recobase::ShowerBase::GetEnergy(), recobase::ShowerBase::GetLength(), recobase::ShowerBase::GetView(), recobase::ShowerBase::GetVtxT(), recobase::ShowerBase::GetVtxZ(), edm::EventHandle::Header(), geo::Geometry::Instance(), evdb::IoModule::Instance(), recobase::CellHit::Plane(), geo::Geometry::Plane(), edm::EventHandle::Reco(), xmax, xmin, ymax, ymin, zmax, and zmin. Referenced by Draw(). 00856 { 00857 printf("Drawing Reco 3D SubShowers\n"); 00858 typedef std::map<UInt_t,std::multimap<Double_t,const recobase::CellHit*> > CellMap_t; 00859 00860 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00861 00862 std::vector<const rawdata::DAQHeader*> header; 00863 short int det = rawdata::kFar; 00864 try{ evt.DAQ().Get("./",header); } 00865 catch(edm::Exception e){ 00866 std::cerr << "Error retrieving daq header, while looking "<< 00867 "in PlaneView::Draw3DShowers(), using default fardet geometry" << std::endl; 00868 } 00869 if(header.size() > 0) det = header[0]->DetId(); 00870 geo::Geometry &fGeo = geo::Geometry::Instance(evt.Header().Run(),det); 00871 00872 std::vector<const recobase::ShowerBase3D*> shower3D(0); 00873 try {evt.Reco().Get("./Final3DShw",shower3D);//Final or Segment 00874 } 00875 catch (edm::Exception e) { } 00876 00877 int jx=-1; 00878 int jy=-1; 00879 00880 for(unsigned int i=0;i<shower3D.size();i++) 00881 { 00882 00883 00884 const recobase::ShowerBase *showerX = shower3D[i]->GetMatchX(); 00885 const recobase::ShowerBase *showerY = shower3D[i]->GetMatchY(); 00886 00887 jx=jx+1; 00888 TLine& lx = fXview->AddLine(showerX->GetVtxZ(),showerX->GetVtxT(), showerX->GetEndZ(), showerX->GetEndT()); 00889 lx.SetLineColor(jx+2); 00890 lx.SetLineWidth(2); 00891 printf("x Shower (%f %f , %f %f)\n", showerX->GetVtxZ(), showerX->GetVtxT(), showerX->GetEndZ(), showerX->GetEndT()); 00892 00893 jy=jy+1; 00894 TLine& ly = fYview->AddLine(showerY->GetVtxZ(),showerY->GetVtxT(), showerY->GetEndZ(), showerY->GetEndT()); 00895 ly.SetLineColor(jy+2); 00896 ly.SetLineWidth(2); 00897 printf("Y Shower (%f %f , %f %f)\n", showerY->GetVtxZ() ,showerY->GetVtxT(), showerY->GetEndZ(), showerY->GetEndT()); 00898 00899 // NOW DISPLAY THE 2D SHOWER HITS WITH DIFFERENT COLORS 00900 00901 recobase::ShowerBase* showergx = new recobase::ShowerBase(*showerX); 00902 recobase::ShowerBase* showergy = new recobase::ShowerBase(*showerY); 00903 00904 std::multimap<Double_t,recobase::CellHit*> cells; 00905 std::multimap<Double_t,recobase::CellHit*>::const_iterator citer; 00906 00907 const recobase::ShowerBase::CellMap_t& planesx = showergx->GetCells(); 00908 recobase::ShowerBase::CellMap_t::const_iterator piterx; 00909 for (piterx=planesx.begin();piterx!= planesx.end();piterx++) 00910 { 00911 cells=piterx->second; 00912 00913 const recobase::CellHit* rc; 00914 00915 for(citer=cells.begin();citer!=cells.end();citer++) 00916 { 00917 rc = citer->second; 00918 00919 double pos[3]; 00920 fGeo.Plane(rc->Plane()).Cell(rc->Cell()).GetCenter(pos); 00921 double w= fGeo.Plane(rc->Plane()).Cell(rc->Cell()).HalfW(); 00922 double d= fGeo.Plane(rc->Plane()).Cell(rc->Cell()).HalfD(); 00923 TBox& bx = fXview->AddBox(pos[2]-d,pos[0]-w,pos[2]+d,pos[0]+w); 00924 if(pos[0]<xmin) xmin=pos[0]; 00925 if(pos[0]>xmax) xmax=pos[0]; 00926 bx.SetFillColor(jx+2); 00927 00928 if(pos[2]<zmin) zmin=pos[2]; 00929 if(pos[2]>zmax) zmax=pos[2]; 00930 } 00931 00932 } 00933 00934 // PRINT SOME ADDITION INFO 00935 00936 cout << " Shower View " << showerX->GetView() << endl; 00937 cout << " Shower Energy " << showerX->GetEnergy() << " Length " << showerX->GetLength() << endl; 00938 00939 // Y CELLS 00940 00941 const recobase::ShowerBase::CellMap_t& planesy = showergy->GetCells(); 00942 recobase::ShowerBase::CellMap_t::const_iterator pitery; 00943 00944 for (pitery=planesy.begin();pitery!= planesy.end();pitery++) 00945 { 00946 cells=pitery->second; 00947 00948 const recobase::CellHit* rc; 00949 00950 for(citer=cells.begin();citer!=cells.end();citer++) 00951 { 00952 rc = citer->second; 00953 00954 double pos[3]; 00955 fGeo.Plane(rc->Plane()).Cell(rc->Cell()).GetCenter(pos); 00956 double w= fGeo.Plane(rc->Plane()).Cell(rc->Cell()).HalfW(); 00957 double d= fGeo.Plane(rc->Plane()).Cell(rc->Cell()).HalfD(); 00958 00959 TBox& by = fYview->AddBox(pos[2]-d,pos[1]-w,pos[2]+d,pos[1]+w); 00960 if(pos[1]<ymin) ymin=pos[1]; 00961 if(pos[1]>ymax) ymax=pos[1]; 00962 by.SetFillColor(jy+2); 00963 00964 if(pos[2]<zmin) zmin=pos[2]; 00965 if(pos[2]>zmax) zmax=pos[2]; 00966 } 00967 00968 } 00969 00970 // PRINT SOME ADDITION INFO 00971 00972 cout << " Shower View " << showerY->GetView() << endl; 00973 cout << " Shower Energy " << showerY->GetEnergy() << " Length " << showerY->GetLength() << endl; 00974 00975 00976 } 00977 00978 }
|
|
Definition at line 474 of file PlaneView.cxx. References evdb::View2D::AddPolyLine(), fXview, fYview, evdb::IoModule::Instance(), edm::EventHandle::Reco(), xmax, xmin, ymax, ymin, zmax, and zmin. Referenced by Draw(). 00475 { 00476 #ifdef DRAW_FILAMENT 00477 printf("Drawing Filaments\n"); 00478 00479 00480 00481 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00482 std::vector<const spider::Filament*> fillaments(0); 00483 00484 00485 00486 try { 00487 evt.Reco().Get("./",fillaments); 00488 } 00489 catch (edm::Exception e) { } 00490 00491 00492 00493 00494 00495 for(unsigned int i=0;i<fillaments.size();i++) 00496 { 00497 //FilamentView::DrawFilaments(fillaments[i],fXview,fYview,xmin,xmax,ymin,ymax,zmin,zmax); 00498 //} 00499 00500 /* 00501 float bp = fillaments[i]->begplane; 00502 float ep = fillaments[i]->endplane; 00503 float bc = fillaments[i]->begcell; 00504 float ec = fillaments[i]->endcell; 00505 00506 double lowpos[3],highpos[3]; 00507 */ 00508 00509 float bp = fillaments[i]->fitbegz; 00510 float ep = fillaments[i]->fitendz; 00511 float bc = fillaments[i]->fitbegt; 00512 float ec = fillaments[i]->fitendt; 00513 /* 00514 printf("%d want geo for (%f %f , %f %f)\n",fillaments[i]->depth,bp,bc,ep,ec); 00515 00516 try{ 00517 fGeo.Plane((int)bp).Cell((int)bc).GetCenter(lowpos); 00518 fGeo.Plane((int)ep).Cell((int)ec).GetCenter(highpos); 00519 }catch(...){printf("geo error...\n");continue;} 00520 */ 00521 00522 if(fillaments[i]->fXY==geo::kX) { 00523 printf("%d x fillament (%f %f , %f %f)\n",fillaments[i]->depth,bp,bc,ep,ec); 00524 /* 00525 bp=lowpos[2]; 00526 ep=highpos[2]; 00527 bc=lowpos[0]; 00528 ec=highpos[0]; 00529 */ 00530 //TLine& l =fXview->AddLine(bp,bc,ep,ec); 00532 //l.SetLineColor(fillaments[i]->depth==0?2:3); 00533 //l.SetLineStyle(1); 00534 //l.SetLineWidth(2); 00535 00536 00537 zmax=bp>zmax?bp:zmax; 00538 zmax=ep>zmax?ep:zmax; 00539 xmax=bc>xmax?bc:xmax; 00540 xmax=ec>xmax?ec:xmax; 00541 00542 zmin=bp<zmin?bp:zmin; 00543 zmin=ep<zmin?ep:zmin; 00544 xmin=bc<xmin?bc:xmin; 00545 xmin=ec<xmin?ec:xmin; 00546 00547 00548 00549 00550 TPolyLine& ll = fXview->AddPolyLine(fillaments[i]->hitt.size(),fillaments[i]->depth==0?2:3,fillaments[i]->depth==0?2:1,1); 00551 00552 Double_t az[fillaments[i]->hitt.size()]; 00553 Double_t at[fillaments[i]->hitt.size()]; 00554 00555 for(int ji=0;ji<fillaments[i]->hitt.size();ji++) 00556 { 00557 az[ji]=fillaments[i]->hitz.at(ji); 00558 at[ji]=fillaments[i]->hitt.at(ji); 00559 00560 } 00561 00562 if(use_avg_path==1) 00563 { 00564 Int_t cur_z=0; 00565 for(int ji=0;ji<fillaments[i]->hitt.size();ji++) 00566 { 00567 Double_t avg_t=0; 00568 Int_t tcnt=0; 00569 Double_t last_z=az[ji]; 00570 00571 for(int jji=ji;jji<fillaments[i]->hitt.size();jji++) 00572 { 00573 if(last_z!=az[jji]) 00574 { 00575 ji=jji-1; 00576 break; 00577 } 00578 00579 tcnt++; 00580 avg_t+=at[jji]; 00581 } 00582 00583 avg_t/=tcnt; 00584 az[cur_z]=last_z; 00585 at[cur_z]=avg_t; 00586 cur_z++; 00587 } 00588 00589 ll.SetPolyLine(cur_z,az,at); 00590 00591 } 00592 else 00593 { 00594 ll.SetPolyLine(fillaments[i]->hitt.size(),az,at); 00595 } 00596 00597 00598 }else{ 00599 printf("%d y fillament (%f %f , %f %f)\n",fillaments[i]->depth,bp,bc,ep,ec); 00600 /* 00601 bp=lowpos[2]; 00602 ep=highpos[2]; 00603 bc=lowpos[1]; 00604 ec=highpos[1]; 00605 */ 00606 //TLine& l = fYview->AddLine(bp,bc,ep,ec); 00607 00609 //l.SetLineColor(fillaments[i]->depth==0?2:3); 00610 //l.SetLineStyle(1); 00611 //l.SetLineWidth(2); 00612 00613 00614 zmax=bp>zmax?bp:zmax; 00615 zmax=ep>zmax?ep:zmax; 00616 ymax=bc>ymax?bc:ymax; 00617 ymax=ec>ymax?ec:ymax; 00618 00619 zmin=bp<zmin?bp:zmin; 00620 zmin=ep<zmin?ep:zmin; 00621 ymin=bc<ymin?bc:ymin; 00622 ymin=ec<ymin?ec:ymin; 00623 00624 00625 00626 TPolyLine& ll = fYview->AddPolyLine(fillaments[i]->hitt.size(),fillaments[i]->depth==0?2:3,fillaments[i]->depth==0?2:1,1); 00627 00628 Double_t az[fillaments[i]->hitt.size()]; 00629 Double_t at[fillaments[i]->hitt.size()]; 00630 00631 for(int ji=0;ji<fillaments[i]->hitt.size();ji++) 00632 { 00633 az[ji]=fillaments[i]->hitz.at(ji); 00634 at[ji]=fillaments[i]->hitt.at(ji); 00635 00636 } 00637 00638 00639 if(use_avg_path==1) 00640 { 00641 Int_t cur_z=0; 00642 for(int ji=0;ji<fillaments[i]->hitt.size();ji++) 00643 { 00644 Double_t avg_t=0; 00645 Int_t tcnt=0; 00646 Double_t last_z=az[ji]; 00647 00648 for(int jji=ji;jji<fillaments[i]->hitt.size();jji++) 00649 { 00650 if(last_z!=az[jji]) 00651 { 00652 ji=jji-1; 00653 break; 00654 } 00655 00656 tcnt++; 00657 avg_t+=at[jji]; 00658 } 00659 00660 avg_t/=tcnt; 00661 az[cur_z]=last_z; 00662 at[cur_z]=avg_t; 00663 cur_z++; 00664 } 00665 ll.SetPolyLine(cur_z,az,at); 00666 00667 }else{ 00668 ll.SetPolyLine(fillaments[i]->hitt.size(),az,at); 00669 } 00670 00671 00672 } 00673 00674 00675 00676 } 00677 #endif 00678 }
|
|
Definition at line 272 of file PlaneView.cxx. References evdb::View2D::AddLine(), edm::EventHandle::DetSim(), evd::Style::FromPDG(), fXview, fYview, evdb::IoModule::Instance(), edm::EventHandle::MC(), xmax, xmin, ymax, ymin, zmax, and zmin. Referenced by Draw(). 00273 { 00274 printf("Drawing MC\n"); 00275 00276 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00277 00278 std::vector<const sim::MCTruth*> mctruth; 00279 try { evt.MC().Get(".",mctruth); } 00280 catch (edm::Exception e) { } 00281 00282 for (int i=0; i<mctruth[0]->NParticles(); ++i) { 00283 const TParticle& p = mctruth[0]->GetParticle(i); 00284 00285 double xyz0[3]; 00286 xyz0[0] = p.Vx(); 00287 xyz0[1] = p.Vy(); 00288 xyz0[2] = p.Vz(); 00289 00290 double xyz1[3]; 00291 // Incident particles 00292 if (p.GetStatusCode()==0) { 00293 xyz1[0] = xyz0[0] - p.Px()/2E-3; 00294 xyz1[1] = xyz0[1] - p.Py()/2E-3; 00295 xyz1[2] = xyz0[2] - p.Pz()/2E-3; 00296 } 00297 // Particles to be tracked 00298 else if (p.GetStatusCode()==1) { 00299 xyz1[0] = xyz0[0] + p.Px()/2E-3; 00300 xyz1[1] = xyz0[1] + p.Py()/2E-3; 00301 xyz1[2] = xyz0[2] + p.Pz()/2E-3; 00302 } 00303 // Intermediate states 00304 else continue; 00305 00306 // Find limits of display 00307 if (xyz0[0]<xmin) xmin = xyz0[0]; 00308 if (xyz1[0]<xmin) xmin = xyz1[0]; 00309 if (xyz0[0]>xmax) xmax = xyz0[0]; 00310 if (xyz1[0]>xmax) xmax = xyz1[0]; 00311 if (xyz0[1]<ymin) ymin = xyz0[1]; 00312 if (xyz1[1]<ymin) ymin = xyz1[1]; 00313 if (xyz0[1]>ymax) ymax = xyz0[1]; 00314 if (xyz1[1]>ymax) ymax = xyz1[1]; 00315 if (xyz0[2]<zmin) zmin = xyz0[2]; 00316 if (xyz1[2]<zmin) zmin = xyz1[2]; 00317 if (xyz0[2]>zmax) zmax = xyz0[2]; 00318 if (xyz1[2]>zmax) zmax = xyz1[2]; 00319 00320 TLine& lx = fXview->AddLine(xyz0[2],xyz0[0],xyz1[2],xyz1[0]); 00321 TLine& ly = fYview->AddLine(xyz0[2],xyz0[1],xyz1[2],xyz1[1]); 00322 00323 Style::FromPDG(lx,p.GetPdgCode()); 00324 Style::FromPDG(ly,p.GetPdgCode()); 00325 } 00326 00327 std::vector<const sim::ParticleList*> particleList; 00328 try { 00329 evt.DetSim().Get(".",particleList); 00330 } 00331 catch (edm::Exception e) { } 00332 00333 std::cerr << "Interactions in this record=" 00334 << particleList.size()<<std::endl; 00335 00336 for (unsigned int iev=0; iev<particleList.size(); iev++) { 00337 std::vector<sim::Particle> particles=particleList[iev]->fParticles; 00338 std::cerr <<"Event "<<iev<<" has "<<particles.size() 00339 <<" particles."<<std::endl; 00340 for (unsigned int i=0; i<particles.size(); ++i) { 00341 std::cerr << particles[i].PdgCode()<<" "; 00342 if ( (i>0 && i%10==0) || i==particles.size()-1) std::cerr << std::endl; 00343 } 00344 } 00345 00346 }
|
|
Definition at line 348 of file PlaneView.cxx. References evdb::View2D::AddBox(), edm::EventHandle::DAQ(), edm::EventHandle::DetSim(), sim::FLSHit::fCellId, sim::FLSHit::fEdep, sim::FLSHit::fPlaneId, sim::FLSHit::fT, fXview, fYview, edm::EventHandle::Header(), geo::Geometry::Instance(), evdb::IoModule::Instance(), evd::kColdToHot, evd::kCustom, evd::kLinear, geo::Geometry::Plane(), xmax, xmin, ymax, ymin, zmax, and zmin. Referenced by Draw(). 00349 { 00350 printf("Drawing MCHits\n"); 00351 cout << "PlaneView::DrawMCHits\n"; 00352 00353 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00354 00355 std::vector<const rawdata::DAQHeader*> header; 00356 short int det = rawdata::kFar; 00357 try{ evt.DAQ().Get("./",header); } 00358 catch(edm::Exception e){ 00359 std::cerr << "Error retrieving daq header, while looking "<< 00360 "in PlaneView::DrawMCHits(), using default fardet geometry" << std::endl; 00361 } 00362 if(header.size() > 0) det = header[0]->DetId(); 00363 geo::Geometry &fGeo = geo::Geometry::Instance(evt.Header().Run(),det); 00364 00365 std::vector<const sim::FLSHitList*> hitlist; 00366 try { evt.DetSim().Get(".",hitlist); } 00367 catch (edm::Exception e) { } 00368 00369 for (unsigned int i=0; i<hitlist.size(); ++i) { 00370 00371 for (unsigned int j=0; j< hitlist[i]->fHits.size(); ++j) { 00372 // Color scale for energy deposition ranging from 0 to 20 MeV 00373 static evd::ColorScale edepColorScale(0.0,20.0E-3,kColdToHot); 00374 static evd::ColorScale timeColorScale(-10.0E-6,10.0E6, 00375 kCustom,kLinear, 00376 100,-300.0,240.0,0.2,0.8); 00377 00378 // Unpack hit[i,j] once to avoid lots of array look-ups 00379 const sim::FLSHit& hit = hitlist[i]->fHits[j]; 00380 00381 // Skip tiny hits 00382 if(hit.fEdep < 1.E-4) continue; 00383 00384 double pos[3]; 00385 fGeo.Plane(hit.fPlaneId).Cell(hit.fCellId).GetCenter(pos); 00386 double w= fGeo.Plane(hit.fPlaneId).Cell(hit.fCellId).HalfW(); 00387 double d= fGeo.Plane(hit.fPlaneId).Cell(hit.fCellId).HalfD(); 00388 00389 int fMCHitColorOption = 1; 00390 if(fGeo.Plane(hit.fPlaneId).View()==geo::kX) { 00391 TBox& bx = fXview->AddBox(pos[2]-d,pos[0]-w,pos[2]+d,pos[0]+w); 00392 if(pos[0]<xmin) xmin=pos[0]; 00393 if(pos[0]>xmax) xmax=pos[0]; 00394 if (fMCHitColorOption==0) { 00395 bx.SetFillColor(timeColorScale(hit.fT)); 00396 } 00397 else { 00398 bx.SetFillColor(edepColorScale(hit.fEdep)); 00399 } 00400 } 00401 else { 00402 TBox& by = fYview->AddBox(pos[2]-d,pos[1]-w,pos[2]+d,pos[1]+w); 00403 if(pos[1]<ymin) ymin=pos[1]; 00404 if(pos[1]>ymax) ymax=pos[1]; 00405 if (fMCHitColorOption==0) { 00406 by.SetFillColor(timeColorScale(hit.fT)); 00407 } 00408 else { 00409 by.SetFillColor(edepColorScale(hit.fEdep)); 00410 } 00411 } 00412 00413 if(pos[2]<zmin) zmin=pos[2]; 00414 if(pos[2]>zmax) zmax=pos[2]; 00415 } 00416 } 00417 }
|
|
Definition at line 681 of file PlaneView.cxx. References evdb::View2D::AddBox(), edm::EventHandle::DAQ(), fXview, fYview, edm::EventHandle::Header(), geo::Geometry::Instance(), evdb::IoModule::Instance(), geo::Geometry::Plane(), edm::EventHandle::Reco(), xmax, xmin, ymax, ymin, zmax, and zmin. Referenced by Draw(). 00682 { 00683 00684 printf("Drawing PlaneClusters\n"); 00685 00686 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00687 00688 std::vector<const rawdata::DAQHeader*> header; 00689 short int det = rawdata::kFar; 00690 try{ evt.DAQ().Get("./",header); } 00691 catch(edm::Exception e){ 00692 std::cerr << "Error retrieving daq header, while looking "<< 00693 "in PlaneView::DrawPlaneClusters(), using default fardet geometry" << std::endl; 00694 } 00695 if(header.size() > 0) det = header[0]->DetId(); 00696 geo::Geometry &fGeo = geo::Geometry::Instance(evt.Header().Run(),det); 00697 00698 00699 std::vector<const recobase::PlaneCluster*> planecluster(0); 00700 00701 00702 00703 try { evt.Reco().Get("./",planecluster); 00704 } 00705 catch (edm::Exception e) { } 00706 00707 00708 for (unsigned int i=0; i<planecluster.size(); ++i) { 00709 00710 unsigned int lowcell=planecluster[i]->fCellHit[0]->Cell(); 00711 unsigned int highcell=planecluster[i]->fCellHit[planecluster[i]->fCellHit.size()-1]->Cell(); 00712 unsigned int plane = planecluster[i]->Plane(); 00713 double lowpos[3],highpos[3]; 00714 00715 fGeo.Plane(plane).Cell(lowcell).GetCenter(lowpos); 00716 fGeo.Plane(plane).Cell(highcell).GetCenter(highpos); 00717 00718 float fT = (float)(planecluster[i]->Tpos()); 00719 float fZ = (float)(planecluster[i]->Zpos()); 00720 00721 00722 float fdT = (float)(planecluster[i]->dT()); 00723 float fdZ = (float)(planecluster[i]->dZ()); 00724 00725 // std::cout << i << " " << fCell << " " << fPlane << std::endl; 00726 00727 if(fGeo.Plane(planecluster[i]->fPlane).View()==geo::kX) { 00728 TBox& bx = fXview->AddBox(fZ-fdT,lowpos[0],fZ+fdZ,highpos[0]); 00729 if(fT<xmin) xmin=fT; 00730 if(fT>xmax) xmax=fT; 00731 bx.SetFillColor(2); 00732 // Style::FromPDG(bx,2); 00733 } else { 00734 TBox& by = fYview->AddBox(fZ-fdZ,lowpos[1],fZ+fdZ,highpos[1]); 00735 if(fT<ymin) ymin=fT; 00736 if(fT>ymax) ymax=fT; 00737 by.SetFillColor(2); 00738 // Style::FromPDG(by,2); 00739 } 00740 00741 if(fZ<zmin) zmin=fZ; 00742 if(fZ>zmax) zmax=fZ; 00743 00744 } 00745 }
|
|
Definition at line 419 of file PlaneView.cxx. References evdb::View2D::AddBox(), edm::EventHandle::DAQ(), fXview, fYview, edm::EventHandle::Header(), geo::Geometry::Instance(), evdb::IoModule::Instance(), geo::Geometry::Plane(), edm::EventHandle::Raw(), xmax, xmin, ymax, ymin, zmax, and zmin. Referenced by Draw(). 00420 { 00421 00422 printf("Drawing RawDigits\n"); 00423 00424 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00425 00426 std::vector<const rawdata::DAQHeader*> header; 00427 short int det = rawdata::kFar; 00428 try{ evt.DAQ().Get("./",header); } 00429 catch(edm::Exception e){ 00430 std::cerr << "Error retrieving daq header, while looking "<< 00431 "in PlaneView::DrawRawDigit(), using default fardet geometry" << std::endl; 00432 } 00433 if(header.size() > 0) det = header[0]->DetId(); 00434 00435 geo::Geometry &fGeo = geo::Geometry::Instance(evt.Header().Run(),det); 00436 00437 std::vector<const rawdata::RawDigit*> rawdigit; 00438 try { evt.Raw().Get(".",rawdigit); } 00439 catch (edm::Exception e) { } 00440 for (unsigned int i=0; i<rawdigit.size(); ++i) { 00441 00442 //float fCell = (float)(rawdigit[i]->GetCell()); 00443 //float fPlane = (float)(rawdigit[i]->GetPlane()); 00444 00445 // std::cout << i << " " << fCell << " " << fPlane << std::endl; 00446 00447 double pos[3]; 00448 fGeo.Plane(rawdigit[i]->GetPlane()).Cell(rawdigit[i]->GetCell()).GetCenter(pos); 00449 double w= fGeo.Plane(rawdigit[i]->GetPlane()).Cell(rawdigit[i]->GetCell()).HalfW(); 00450 double d= fGeo.Plane(rawdigit[i]->GetPlane()).Cell(rawdigit[i]->GetCell()).HalfD(); 00451 00452 if(fGeo.Plane(rawdigit[i]->GetPlane()).View()==geo::kX) { 00453 TBox& bx = fXview->AddBox(pos[2]-d,pos[0]-w,pos[2]+d,pos[0]+w); 00454 if(pos[0]<xmin) xmin=pos[0]; 00455 if(pos[0]>xmax) xmax=pos[0]; 00456 bx.SetFillColor(1); 00457 // Style::FromPDG(bx,2); 00458 } else { 00459 TBox& by = fYview->AddBox(pos[2]-d,pos[1]-w,pos[2]+d,pos[1]+w); 00460 if(pos[1]<ymin) ymin=pos[1]; 00461 if(pos[1]>ymax) ymax=pos[1]; 00462 by.SetFillColor(1); 00463 // Style::FromPDG(by,2); 00464 } 00465 00466 if(pos[2]<zmin) zmin=pos[2]; 00467 if(pos[2]>zmax) zmax=pos[2]; 00468 00469 } 00470 00471 }
|
|
Definition at line 748 of file PlaneView.cxx. References evdb::View2D::AddBox(), evdb::View2D::AddLine(), recobase::CellHit::Cell(), edm::EventHandle::DAQ(), fXview, fYview, recobase::ShowerBase::GetCells(), edm::EventHandle::Header(), geo::Geometry::Instance(), evdb::IoModule::Instance(), recobase::CellHit::Plane(), geo::Geometry::Plane(), edm::EventHandle::Reco(), xmax, xmin, ymax, ymin, zmax, and zmin. Referenced by Draw(). 00749 { 00750 printf("Drawing Reco SubShowers\n"); 00751 typedef std::map<UInt_t,std::multimap<Double_t,const recobase::CellHit*> > CellMap_t; 00752 00753 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00754 00755 std::vector<const rawdata::DAQHeader*> header; 00756 short int det = rawdata::kFar; 00757 try{ evt.DAQ().Get("./",header); } 00758 catch(edm::Exception e){ 00759 std::cerr << "Error retrieving daq header, while looking "<< 00760 "in PlaneView::Showers(), using default fardet geometry" << std::endl; 00761 } 00762 if(header.size() > 0) det = header[0]->DetId(); 00763 geo::Geometry &fGeo = geo::Geometry::Instance(evt.Header().Run(),det); 00764 00765 std::vector<const recobase::ShowerBase*> shower(0); 00766 try {evt.Reco().Get("./Final2DShw",shower);//Final or Segment 00767 } 00768 catch (edm::Exception e) { } 00769 00770 int jx=-1; 00771 int jy=-1; 00772 00773 Double_t endz; 00774 Double_t endt; 00775 00776 for(unsigned int i=0;i<shower.size();i++) 00777 { 00778 00779 if(shower[i]->GetNCell()>5){ // Draw Only Showers with > 5 Cells 00780 00781 Double_t slope = shower[i]->GetSlope(); 00782 Double_t intercept = shower[i]->GetTMax(); 00783 00784 endz = shower[i]->GetVtxZ() + (shower[i]->GetEndZ()-shower[i]->GetVtxZ())/2.; 00785 endt = intercept+slope*(endz-shower[i]->GetZMax()); 00786 00787 if(shower[i]->GetView()==geo::kX) { 00788 00789 jx=jx+1; 00790 TLine& lx = fXview->AddLine(shower[i]->GetVtxZ(),shower[i]->GetVtxT(), shower[i]->GetEndZ(), shower[i]->GetEndT()); 00791 // TLine& lx = fXview->AddLine(shower[i]->GetVtxZ(),shower[i]->GetVtxT(), endz, endt); 00792 lx.SetLineWidth(2); 00793 lx.SetLineColor(jx+2); 00794 printf("x Shower (%f %f , %f %f)\n", shower[i]->GetVtxZ(), shower[i]->GetVtxT(), shower[i]->GetEndZ(), shower[i]->GetEndT()); 00795 } 00796 else if(shower[i]->GetView()==geo::kY) { 00797 jy=jy+1; 00798 TLine& ly = fYview->AddLine(shower[i]->GetVtxZ(),shower[i]->GetVtxT(), shower[i]->GetEndZ(), shower[i]->GetEndT()); 00799 ly.SetLineWidth(2); 00800 ly.SetLineColor(jy+2); 00801 printf("Y Shower (%f %f , %f %f)\n", shower[i]->GetVtxZ() ,shower[i]->GetVtxT(), shower[i]->GetEndZ(), shower[i]->GetEndT()); 00802 } 00803 // NOW DISPLAY THE 2D SHOWER HITS WITH DIFFERENT COLORS 00804 00805 recobase::ShowerBase* showerg = new recobase::ShowerBase(*shower[i]); 00806 const recobase::ShowerBase::CellMap_t& planes = showerg->GetCells(); 00807 recobase::ShowerBase::CellMap_t::const_iterator piter; 00808 std::multimap<Double_t,recobase::CellHit*> cells; 00809 std::multimap<Double_t,recobase::CellHit*>::const_iterator citer; 00810 00811 for (piter=planes.begin();piter!= planes.end();piter++) 00812 { 00813 cells=piter->second; 00814 00815 const recobase::CellHit* rc; 00816 00817 for(citer=cells.begin();citer!=cells.end();citer++) 00818 { 00819 rc = citer->second; 00820 00821 double pos[3]; 00822 fGeo.Plane(rc->Plane()).Cell(rc->Cell()).GetCenter(pos); 00823 double w= fGeo.Plane(rc->Plane()).Cell(rc->Cell()).HalfW(); 00824 double d= fGeo.Plane(rc->Plane()).Cell(rc->Cell()).HalfD(); 00825 if(shower[i]->GetView()==geo::kX) { 00826 TBox& bx = fXview->AddBox(pos[2]-d,pos[0]-w,pos[2]+d,pos[0]+w); 00827 if(pos[0]<xmin) xmin=pos[0]; 00828 if(pos[0]>xmax) xmax=pos[0]; 00829 bx.SetFillColor(jx+2); 00830 } 00831 else if(shower[i]->GetView()==geo::kY){ 00832 TBox& by = fYview->AddBox(pos[2]-d,pos[1]-w,pos[2]+d,pos[1]+w); 00833 if(pos[1]<ymin) ymin=pos[1]; 00834 if(pos[1]>ymax) ymax=pos[1]; 00835 by.SetFillColor(jy+2); 00836 } 00837 00838 if(pos[2]<zmin) zmin=pos[2]; 00839 if(pos[2]>zmax) zmax=pos[2]; 00840 } 00841 00842 } 00843 00844 // PRINT SOME ADDITION INFO 00845 00846 cout << " Shower View " << shower[i]->GetView() << endl; 00847 cout << " Shower Energy " << shower[i]->GetEnergy() << " Length " << shower[i]->GetLength() << endl; 00848 00849 } 00850 00851 } 00852 00853 }
|
|
get the positions at the first and last clusters assumes the clusters are in order loop over clusters to draw them as well loop over the x and y cells in the cluster and add them to the view get the center of the cell in the world coordinates get the center of the cell in the world coordinates Definition at line 156 of file PlaneView.cxx. References evdb::View2D::AddBox(), evdb::View2D::AddLine(), recobase::CellHit::Cell(), edm::EventHandle::DAQ(), fOption, PlaneViewOption::fTrackRecoName, fXview, fYview, edm::EventHandle::Header(), geo::Geometry::Instance(), evdb::IoModule::Instance(), recobase::Cluster::NXCell(), recobase::Cluster::NYCell(), recobase::CellHit::Plane(), geo::Geometry::Plane(), edm::EventHandle::Reco(), recobase::Cluster::XCell(), recobase::Cluster::YCell(), and recobase::Cluster::Z(). Referenced by Draw(). 00157 { 00158 printf("Drawing Track Candidates\n"); 00159 00160 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00161 00162 std::vector<const rawdata::DAQHeader*> header; 00163 short int det = rawdata::kFar; 00164 try{ evt.DAQ().Get("./",header); } 00165 catch(edm::Exception e){ 00166 std::cerr << "Error retrieving daq header, while looking "<< 00167 "in PlaneView::DrawTrackCandidates(), using default fardet geometry" << std::endl; 00168 } 00169 if(header.size() > 0) det = header[0]->DetId(); 00170 geo::Geometry &fGeo = geo::Geometry::Instance(evt.Header().Run(),det); 00171 00172 std::vector<const recobase::Cluster*> cluster(0); 00173 00174 std::vector<const recobase::Track*> track(0); 00175 00176 try { evt.Reco().Get("./",cluster); 00177 } 00178 catch (edm::Exception e) { } 00179 00180 std::string dir = "./"+fOption->fTrackRecoName+"Candidates"; 00181 try {evt.Reco().Get(dir.c_str(),track);//Final or Segment 00182 } 00183 catch (edm::Exception e) { } 00184 00185 00186 for(unsigned int i=0;i<track.size();i++){ 00187 00190 double first[] = {track[i]->Cluster(0)->X(), 00191 track[i]->Cluster(0)->Y(), 00192 track[i]->Cluster(0)->Z()}; 00193 double last[] = {track[i]->Cluster(track[i]->NCluster()-1)->X(), 00194 track[i]->Cluster(track[i]->NCluster()-1)->Y(), 00195 track[i]->Cluster(track[i]->NCluster()-1)->Z()}; 00196 00197 00198 00199 fXview->AddLine(first[2], first[0], last[2], last[0]); 00200 fYview->AddLine(first[2], first[1], last[2], last[1]); 00201 00203 for(int nc = 0; nc < track[i]->NCluster(); ++nc){ 00204 00205 const recobase::Cluster* clus = track[i]->Cluster(i); 00206 00207 double cellHalfD = fGeo.Plane(0).Cell(0).HalfD(); 00208 double cellHalfW = fGeo.Plane(0).Cell(0).HalfW(); 00209 double xyzw[3] = {0.}; 00210 double xyzl[3] = {0.}; 00211 00213 for(int nx = 0; nx < clus->NXCell(); ++nx){ 00215 fGeo.Plane(clus->XCell(nx)->Plane()).Cell(clus->XCell(nx)->Cell()).LocalToWorld(xyzl,xyzw); 00216 TBox& bx = fXview->AddBox(clus->Z() - cellHalfW, 00217 xyzw[0] - cellHalfD, 00218 clus->Z() + cellHalfW, 00219 xyzw[0] + cellHalfD); 00220 bx.SetFillColor(2); 00221 } 00222 for(int ny = 0; ny < clus->NYCell(); ++ny){ 00224 fGeo.Plane(clus->YCell(ny)->Plane()).Cell(clus->YCell(ny)->Cell()).LocalToWorld(xyzl,xyzw); 00225 TBox& by = fYview->AddBox(clus->Z() - cellHalfW, 00226 xyzw[1] - cellHalfD, 00227 clus->Z() + cellHalfW, 00228 xyzw[1] + cellHalfD); 00229 by.SetFillColor(2); 00230 } 00231 }//end loop over clusters 00232 }//end loop over tracks 00233 00234 }
|
|
get the positions at the first and last clusters assumes the clusters are in order Definition at line 236 of file PlaneView.cxx. References evdb::View2D::AddLine(), fOption, PlaneViewOption::fTrackRecoName, fXview, fYview, evdb::IoModule::Instance(), and edm::EventHandle::Reco(). Referenced by Draw(). 00237 { 00238 printf("Drawing Tracks\n"); 00239 00240 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00241 00242 std::vector<const recobase::Track*> track3d(0); 00243 00244 std::string dir = "./"+fOption->fTrackRecoName; 00245 try {evt.Reco().Get(dir.c_str(),track3d); 00246 } 00247 catch (edm::Exception e) { } 00248 00249 for(unsigned int i=0;i<track3d.size();i++){ 00250 00253 double first[] = {track3d[i]->Cluster(0)->X(), 00254 track3d[i]->Cluster(0)->Y(), 00255 track3d[i]->Cluster(0)->Z()}; 00256 double last[] = {track3d[i]->Cluster(track3d[i]->NCluster()-1)->X(), 00257 track3d[i]->Cluster(track3d[i]->NCluster()-1)->Y(), 00258 track3d[i]->Cluster(track3d[i]->NCluster()-1)->Z()}; 00259 00260 00261 00262 TLine& lx = fXview->AddLine(first[2], first[0], last[2], last[0]); 00263 TLine& ly = fYview->AddLine(first[2], first[1], last[2], last[1]); 00264 00265 lx.SetLineColor(6); 00266 ly.SetLineColor(6); 00267 00268 }//end loop over tracks 00269 00270 }
|
|
Give a short tag which can be included in filename to ID object printed Keep to ~4 characters Reimplemented from evdb::Canvas. Definition at line 18 of file PlaneView.h. 00018 { return "planeview"; }
|
|
Definition at line 38 of file PlaneView.h. Referenced by Draw(), DrawTrackCandidates(), DrawTracks(), and PlaneView(). |
|
Definition at line 36 of file PlaneView.h. Referenced by Draw(), Draw3DShowers(), DrawFilament(), DrawMC(), DrawMCHits(), DrawPlaneClusters(), DrawRawDigit(), DrawShowers(), DrawTrackCandidates(), DrawTracks(), and PlaneView(). |
|
Definition at line 34 of file PlaneView.h. Referenced by Draw(), and PlaneView(). |
|
Definition at line 32 of file PlaneView.h. Referenced by Draw(), and PlaneView(). |
|
Definition at line 37 of file PlaneView.h. Referenced by Draw(), Draw3DShowers(), DrawFilament(), DrawMC(), DrawMCHits(), DrawPlaneClusters(), DrawRawDigit(), DrawShowers(), DrawTrackCandidates(), DrawTracks(), and PlaneView(). |
|
Definition at line 35 of file PlaneView.h. Referenced by Draw(), and PlaneView(). |
|
Definition at line 33 of file PlaneView.h. Referenced by Draw(), and PlaneView(). |
|
Definition at line 41 of file PlaneView.h. Referenced by Draw(), Draw3DShowers(), DrawFilament(), DrawMC(), DrawMCHits(), DrawPlaneClusters(), DrawRawDigit(), and DrawShowers(). |
|
Definition at line 41 of file PlaneView.h. Referenced by Draw(), Draw3DShowers(), DrawFilament(), DrawMC(), DrawMCHits(), DrawPlaneClusters(), DrawRawDigit(), and DrawShowers(). |
|
Definition at line 42 of file PlaneView.h. Referenced by Draw(), Draw3DShowers(), DrawFilament(), DrawMC(), DrawMCHits(), DrawPlaneClusters(), DrawRawDigit(), and DrawShowers(). |
|
Definition at line 42 of file PlaneView.h. Referenced by Draw(), Draw3DShowers(), DrawFilament(), DrawMC(), DrawMCHits(), DrawPlaneClusters(), DrawRawDigit(), and DrawShowers(). |
|
Definition at line 40 of file PlaneView.h. Referenced by Draw(), Draw3DShowers(), DrawFilament(), DrawMC(), DrawMCHits(), DrawPlaneClusters(), DrawRawDigit(), and DrawShowers(). |
|
Definition at line 40 of file PlaneView.h. Referenced by Draw(), Draw3DShowers(), DrawFilament(), DrawMC(), DrawMCHits(), DrawPlaneClusters(), DrawRawDigit(), and DrawShowers(). |