#include <DetectorView.h>
Inheritance diagram for evd::DetectorView:

Public Member Functions | |
| DetectorView (TGMainFrame *mf) | |
| ~DetectorView () | |
| const char * | Description () const |
| const char * | PrintTag () const |
| void | Draw (const char *opt="") |
Private Member Functions | |
| void | DrawMCTruth (edm::EventHandle &) |
Private Attributes | |
| TPad * | f3DviewPad |
| TH3F * | f3DviewHisto |
| evdb::View3D * | f3Dview |
| const DetectorViewOption * | fOption |
|
|
Definition at line 35 of file DetectorView.cxx. References geo::Geometry::DetHalfHeight(), geo::Geometry::DetHalfWidth(), geo::Geometry::DetLength(), f3Dview, f3DviewHisto, f3DviewPad, fOption, util::EDMUtils::GetGeometry(), DetectorViewOption::Instance(), and evdb::IoModule::Instance(). 00035 : evdb::Canvas(mf) 00036 { 00037 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent(); 00038 geo::Geometry *geom = &util::EDMUtils::GetGeometry(evt); 00039 00040 evdb::Canvas::fCanvas->cd(); 00041 00042 f3DviewPad = new TPad("fYviewPad","Yview",0.0,0.0,0.75,0.9); 00043 f3DviewPad->Draw(); 00044 00045 f3DviewPad->cd(); 00046 f3DviewHisto = new TH3F("f3DviewHisto",";z (cm);x (cm); y(cm)", 00047 200,0.,geom->DetLength(), 00048 32,-geom->DetHalfWidth(), geom->DetHalfWidth(), 00049 32,-geom->DetHalfHeight(),geom->DetHalfHeight()); 00050 f3DviewHisto->Draw(); 00051 00052 f3Dview = new evdb::View3D(); 00053 00054 fOption = &DetectorViewOption::Instance(); 00055 }
|
|
|
Definition at line 59 of file DetectorView.cxx. 00059 { }
|
|
|
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 19 of file DetectorView.h. 00019 { return "Detector View"; }
|
|
|
Implements evdb::Canvas. Definition at line 172 of file DetectorView.cxx. References evdb::View3D::Clear(), evdb::View3D::Draw(), DrawMCTruth(), f3Dview, f3DviewHisto, f3DviewPad, DetectorViewOption::fDrawMCTruthVectors, fOption, and evdb::IoModule::Instance(). 00173 {
00174 edm::EventHandle& evt = evdb::IoModule::Instance()->GetEvent();
00175
00176 f3Dview->Clear();
00177
00178 if (fOption->fDrawMCTruthVectors)
00179 DrawMCTruth(evt);
00180
00181 f3DviewPad->cd();
00182 f3DviewHisto->Draw();
00183 f3Dview->Draw();
00184
00185 evdb::Canvas::fCanvas->Update();
00186 }
|
|
|
Definition at line 63 of file DetectorView.cxx. References evdb::View3D::AddPolyLine3D(), edm::EventHandle::DetSim(), f3Dview, f3DviewHisto, and edm::EventHandle::MC(). Referenced by Draw(). 00064 {
00065 double zmin = 1e20, zmax = -1e20;
00066 double xmin = 1e20, xmax = -1e20;
00067 double ymin = 1e20, ymax = -1e20;
00068
00069 std::vector<const simb::MCTruth*> mctruth;
00070
00071 try { evt.MC().Get(".",mctruth); }
00072 catch (edm::Exception e) { }
00073
00074 for (int i=0; i<mctruth[0]->NParticles(); ++i) {
00075 const TParticle& p = mctruth[0]->GetParticle(i);
00076
00077 double xyz0[3];
00078 xyz0[0] = p.Vx();
00079 xyz0[1] = p.Vy();
00080 xyz0[2] = p.Vz();
00081
00082 double xyz1[3];
00083 // Incident particles
00084 if (p.GetStatusCode()==0) {
00085 xyz1[0] = xyz0[0] - p.Px()/2E-3;
00086 xyz1[1] = xyz0[1] - p.Py()/2E-3;
00087 xyz1[2] = xyz0[2] - p.Pz()/2E-3;
00088 }
00089 // Particles to be tracked
00090 else if (p.GetStatusCode()==1) {
00091 xyz1[0] = xyz0[0] + p.Px()/2E-3;
00092 xyz1[1] = xyz0[1] + p.Py()/2E-3;
00093 xyz1[2] = xyz0[2] + p.Pz()/2E-3;
00094 }
00095 // Intermediate states
00096 else continue;
00097
00098 // Find limits of display
00099 if (xyz0[0]<xmin) xmin = xyz0[0];
00100 if (xyz1[0]<xmin) xmin = xyz1[0];
00101 if (xyz0[0]>xmax) xmax = xyz0[0];
00102 if (xyz1[0]>xmax) xmax = xyz1[0];
00103 if (xyz0[1]<ymin) ymin = xyz0[1];
00104 if (xyz1[1]<ymin) ymin = xyz1[1];
00105 if (xyz0[1]>ymax) ymax = xyz0[1];
00106 if (xyz1[1]>ymax) ymax = xyz1[1];
00107 if (xyz0[2]<zmin) zmin = xyz0[2];
00108 if (xyz1[2]<zmin) zmin = xyz1[2];
00109 if (xyz0[2]>zmax) zmax = xyz0[2];
00110 if (xyz1[2]>zmax) zmax = xyz1[2];
00111
00112 int ic = Style::ColorFromPDG(p.GetPdgCode());
00113 int iw = Style::LineWidthFromPDG(p.GetPdgCode());
00114 int is = Style::LineStyleFromPDG(p.GetPdgCode());
00115
00116 TPolyLine3D& line = f3Dview->AddPolyLine3D(100,ic,iw,is);
00117 double dz = 2.;
00118 int npnt = (int)((xyz1[2]-xyz0[2])/dz); // 2 cm step sizes
00119 double dxdz = p.Px()/p.Pz();
00120 double dydz = p.Py()/p.Pz();
00121 double x, y, z;
00122 for (int i=0; i<npnt; ++i) {
00123 x = xyz0[0] + i*dz*dxdz;
00124 y = xyz0[1] + i*dz*dydz;
00125 z = xyz0[2] + i*dz;
00126 line.SetPoint(i,z,x,y);
00127 }
00128 }
00129
00130 std::vector<const sim::ParticleList*> particleList;
00131 try {
00132 evt.DetSim().Get(".",particleList);
00133 }
00134 catch (edm::Exception e) { }
00135
00136 std::cerr << "Interactions in this record="
00137 << particleList.size()<<std::endl;
00138
00139 for (unsigned int iev=0; iev<particleList.size(); iev++) {
00140 std::vector<sim::Particle> particles=particleList[iev]->fParticles;
00141 std::cerr <<"Event "<<iev<<" has "<<particles.size()
00142 <<" particles."<<std::endl;
00143 for (unsigned int i=0; i<particles.size(); ++i) {
00144 std::cerr << particles[i].PdgCode()<<" ";
00145 if ( (i>0 && i%10==0) || i==particles.size()-1) std::cerr << std::endl;
00146 }
00147 }
00148
00149 // Force the x and y views to have the same vertical scale
00150 if (xmax-xmin > ymax-ymin) {
00151 double tmp = 0.5*((xmax-xmin)-(ymax-ymin));
00152 ymax += tmp;
00153 ymin -= tmp;
00154 }
00155 else {
00156 double tmp = 0.5*((ymax-ymin)-(xmax-xmin));
00157 xmax += tmp;
00158 xmin -= tmp;
00159 }
00160 xmin -= 100; xmax += 100;
00161 ymin -= 100; ymax += 100;
00162 zmin -= 100; zmax += 100;
00163
00164 f3DviewHisto->GetXaxis()->SetRangeUser(zmin,zmax);
00165 f3DviewHisto->GetYaxis()->SetRangeUser(xmin,xmax);
00166 f3DviewHisto->GetZaxis()->SetRangeUser(ymin,ymax);
00167
00168 }
|
|
|
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 20 of file DetectorView.h. 00020 { return "detectorview"; }
|
|
|
Definition at line 27 of file DetectorView.h. Referenced by DetectorView(), Draw(), and DrawMCTruth(). |
|
|
Definition at line 26 of file DetectorView.h. Referenced by DetectorView(), Draw(), and DrawMCTruth(). |
|
|
Definition at line 25 of file DetectorView.h. Referenced by DetectorView(), and Draw(). |
|
|
Definition at line 29 of file DetectorView.h. Referenced by DetectorView(), and Draw(). |
1.3.9.1