![]() |
![]() |
#include <VisReco/VisRecoTools/interface/VisCSCSeg2HETwig.h>
Public Member Functions | |
virtual void | onNewEvent (const edm::Event &event, const edm::EventSetup &eventSetup) |
virtual void | update (IgRZRep *rep) |
virtual void | update (IgRPhiRep *rep) |
virtual void | update (IgLegoRep *rep) |
virtual void | update (Ig3DRep *rep) |
virtual void | update (IgTextRep *rep) |
VisCSCSeg2HETwig (IgState *state, IgTwig *parent, const std::string &name, const edm::Event &event, const edm::EventSetup &eventSetup) | |
Private Attributes | |
const edm::Event & | m_event |
const edm::EventSetup & | m_eventSetup |
std::vector< CSCSegment > | m_segs |
Definition at line 18 of file VisCSCSeg2HETwig.h.
VisCSCSeg2HETwig::VisCSCSeg2HETwig | ( | IgState * | state, | |
IgTwig * | parent, | |||
const std::string & | name, | |||
const edm::Event & | event, | |||
const edm::EventSetup & | eventSetup | |||
) |
Definition at line 46 of file VisCSCSeg2HETwig.cc.
00050 : VisQueuedTwig (state, parent, name), 00051 m_event (event), 00052 m_eventSetup (eventSetup) 00053 { 00054 }
void VisCSCSeg2HETwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 57 of file VisCSCSeg2HETwig.cc.
References c, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, IgRepSet::invalidate(), m_segs, VisQueuedTwig::onBaseInvalidate(), and IgTwig::SELF_MASK.
00059 { 00060 VisQueuedTwig::onBaseInvalidate (); 00061 00062 std::vector<edm::Handle<CSCSegmentCollection> > segCollections; 00063 try 00064 { 00065 event.getManyByType (segCollections); 00066 } 00067 catch (...) 00068 { 00069 std::cout << "Failed to get the segments." << std::endl; 00070 } 00071 00072 // 00073 if (! segCollections.empty ()) 00074 { 00075 std::vector<edm::Handle<CSCSegmentCollection> >::iterator i; 00076 for (i = segCollections.begin (); i != segCollections.end (); i++) 00077 { 00078 const CSCSegmentCollection& c = *(*i); 00079 00080 CSCSegmentCollection::const_iterator segIt; 00081 for (segIt = c.begin (); segIt != c.end (); ++segIt) 00082 { 00083 m_segs.push_back (*segIt); 00084 } 00085 } 00086 } 00087 00088 IgRepSet::invalidate (this, SELF_MASK); 00089 }
Reimplemented from VisQueuedTwig.
Definition at line 136 of file VisCSCSeg2HETwig.cc.
References BoundSurface::bounds(), Ig3DBaseRep::clear(), GenMuonPlsPt100GeV_cfg::cout, dir, lat::endl(), eta, g1, g2, edm::EventSetup::get(), h, edm::Event::id(), int, parsecf::pyparsing::line(), funct::log(), m_event, m_eventSetup, m_segs, Ig3DBaseRep::node(), phi, funct::sqrt(), GeomDet::surface(), funct::tan(), theta, Bounds::thickness(), Surface::toGlobal(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), X, x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00137 { 00138 // Get debugging dump. 00139 VisQueuedTwig::update (rep); 00140 00141 IgQtLock (); 00142 00143 SoSeparator *sep = new SoSeparator; 00144 SoMaterial *mat = new SoMaterial; 00145 mat->ambientColor.setValue (0.135, 0.2225, 0.1575); 00146 sep->addChild (mat); 00147 00148 using namespace edm; 00149 00150 ESHandle<CSCGeometry> pDD; 00151 try 00152 { 00153 m_eventSetup.get<MuonGeometryRecord> ().get (pDD); 00154 } 00155 catch (...) 00156 { 00157 std::cout << "Failed to get the goemetry." << std::endl; 00158 } 00159 00160 // std::vector<CSCSegment> segs; 00161 00162 // std::vector<edm::Handle<CSCSegmentCollection> > segCollections; 00163 // try 00164 // { 00165 // m_event.getManyByType (segCollections); 00166 // } 00167 // catch (...) 00168 // { 00169 // std::cout << "Failed to get the segments." << std::endl; 00170 // } 00171 00172 // // 00173 // if (! segCollections.empty ()) 00174 // { 00175 // std::vector<edm::Handle<CSCSegmentCollection> >::iterator i; 00176 // for (i = segCollections.begin (); i != segCollections.end (); i++) 00177 // { 00178 // const CSCSegmentCollection& c = *(*i); 00179 00180 // CSCSegmentCollection::const_iterator segIt; 00181 // for (segIt = c.begin (); segIt != c.end (); ++segIt) 00182 // { 00183 // segs.push_back (*segIt); 00184 // } 00185 // } 00186 // } 00187 // // 00188 00189 if (! m_segs.empty () && pDD.isValid ()) 00190 { 00191 try 00192 { 00193 float h ; 00194 std::cout << "== Run # " << m_event.id ().run () << ", event # " << m_event.id ().event () << std::endl; // latin1 ***** 00195 for (std::vector<CSCSegment>::const_iterator iseg = m_segs.begin (); iseg != m_segs.end (); iseg++) 00196 { 00197 h = 5.7; 00198 const GeomDet *det = pDD->idToDet ((*iseg).cscDetId ()); 00199 00200 SoVertexProperty *vtx = new SoVertexProperty; 00201 00202 SoLineSet *line = new SoLineSet; 00203 line->numVertices = 2; 00204 00205 // Local pos & dir 00206 LocalPoint pos = (*iseg).localPosition(); 00207 LocalVector dir = (*iseg).localDirection(); 00208 00209 float halfThickness = det->surface ().bounds ().thickness ()/2.; 00210 00211 float z1 = halfThickness; 00212 float x1 = pos.x() + dir.x()*z1/dir.z(); 00213 float y1 = pos.y() + dir.y()*z1/dir.z(); 00214 GlobalPoint g1 = det->surface().toGlobal( LocalPoint(x1,y1,z1) ); 00215 00216 float z2 = -halfThickness; 00217 float x2 = pos.x() + dir.x()*z2/dir.z(); 00218 float y2 = pos.y() + dir.y()*z2/dir.z(); 00219 GlobalPoint g2 = det->surface().toGlobal( LocalPoint(x2,y2,z2) ); 00220 00221 float x = g1.x () / 100.0; // cm -> m 00222 float y = g1.y () / 100.0; // cm -> m 00223 float z = g1.z () / 100.0; // cm -> m 00224 00225 //std::cout << "\n*** 1st POINT *** (" << x << ", " << y << ", " << z << ")" << std::endl; 00226 vtx->vertex.set1Value(0,SbVec3f(x,y,z)); 00227 00228 float X = g2.x () / 100.0; // cm -> m 00229 float Y = g2.y () / 100.0; // cm -> m 00230 float Z = g2.z () / 100.0; // cm -> m 00231 00232 //std::cout << "\n*** 2nd POINT *** (" << x << ", " << y << ", " << z << ")" << std::endl; 00233 00234 h = (z+Z)/2 - h; 00235 //std::cout << " *** " << h << std::endl; 00236 00237 x = (x+X)/2 - (x-X)/(z-Z)*h; 00238 y = (y+Y)/2 - (y-Y)/(z-Z)*h; 00239 z = 5.7; 00240 00241 vtx->vertex.set1Value(1,SbVec3f(x,y,z)); 00242 00243 float phi, theta, eta; 00244 int iphi, ieta; 00245 00246 phi = atan2(y,x); 00247 theta = acos(z/sqrt(x*x+y*y+z*z)); 00248 00249 if (phi<0) phi += 2*3.141592; // if the range of phi is defined to be from 0 to 2*PI *****1 00250 eta = -log(tan(theta/2)); 00251 00252 //std::cout << " ETA!!! = " << eta << std::endl; 00253 iphi = (int)((phi - 0.087/2)/0.087 + 1); // casting check *****2 00254 ieta = (int)((eta - 0.087/2)/0.087); 00255 00256 // if (myfile.is_open()) 00257 // { 00258 std::cout << "( iphi = " << iphi << ", ieta = " << ieta << " )" << std::endl; 00259 // } 00260 // else std::cout << "Unable to open file" << std::endl; 00261 00262 line->vertexProperty = vtx; 00263 00264 sep->addChild (line); 00265 } 00266 } 00267 catch (...) 00268 { 00269 std::cout << "Muon Endcap Segments Info: Nothing to display: an exception is caught."; 00270 } 00271 } 00272 00273 rep->clear (); 00274 rep->node ()->addChild (sep); 00275 }
Reimplemented from VisQueuedTwig.
Definition at line 92 of file VisCSCSeg2HETwig.cc.
References arg, edm::Event::id(), m_event, IgTextRep::setText(), and VisQueuedTwig::update().
00093 { 00094 // Get debugging dump. 00095 VisQueuedTwig::update (rep); 00096 00097 // Prepare property description. 00098 std::ostringstream text; 00099 00100 text << QString ("Run # %1, event # %2") 00101 .arg (m_event.id ().run ()) 00102 .arg (m_event.id ().event ()).latin1 () << "<br>"; 00103 00104 // text << "<table width='100%' border=1>" 00105 // << "<TR align = center>" 00106 // << "<TH>E<SUB>em (GeV)</TH>" 00107 // << "<TH>E<SUB>had</TH>" 00108 // << "<TH>E<SUB>inv</TH>" 00109 // << "<TH>E<SUB>aux</TH>" 00110 // << "<TH>Eta</TH>" 00111 // << "<TH>Phi</TH>" 00112 // << "<TH>Particles</TH>" 00113 // << "</TR>"; 00114 // text << setiosflags (std::ios::showpoint | std::ios::fixed); 00115 // text.setf (std::ios::right, std::ios::adjustfield); 00116 00117 // text << "<TR align = right>" 00118 // << "<TD>" << std::setw (2) << std::setprecision (3) << eEm << "</TD>" 00119 // << "<TD>" << std::setw (6) << std::setprecision (3) << eHad << "</TD>" 00120 // << "<TD>" << std::setw (5) << std::setprecision (3) << eInv << "</TD>" 00121 // << "<TD>" << std::setw (5) << std::setprecision (3) << eAux << "</TD>" 00122 // << "<TD>" << std::setw (5) << std::setprecision (3) << m_jet.eta () << "</TD>" 00123 // << "<TD>" << std::setw (5) << std::setprecision (3) << m_jet.phi () << "</TD>" 00124 // << "<TD>"; 00125 // text << "</TD></TR>"; 00126 00127 // text << "</table>"; 00128 00129 // Send it over. 00130 IgQtLock (); 00131 00132 rep->setText (text.str ()); 00133 }
const edm::Event& VisCSCSeg2HETwig::m_event [private] |
const edm::EventSetup& VisCSCSeg2HETwig::m_eventSetup [private] |
std::vector<CSCSegment> VisCSCSeg2HETwig::m_segs [private] |