#include <VisReco/VisCustomTracker/interface/VisCuTrackerDigi.h>
Public Member Functions | |
void | drawdigi (VisCuTkModule *mod, int nlay, QPainter *p) |
void | setEvent (const edm::Event &event, const edm::EventSetup &eventSetup) |
void | setMap (VisCuTkMap2D *m) |
void | setTracker (VisCuCmsTracker *tr) |
SoSeparator * | update (VisTrackingGeometry::DetectorRep type) |
std::string | updatetext (VisCuTkModule *mod) |
VisCuTrackerDigi () | |
Private Attributes | |
bool | firsteventloaded |
bool | horizontal_view |
edm::ESHandle< TrackerGeometry > | m_pDD |
VisCuTkMap2D * | map |
std::vector< PixelDigi > | mdigi |
std::string | pixeldigiLabelName |
std::string | pixeldigiProducerName |
std::vector< SiStripDigi > | sdigi |
std::string | stripdigiLabelName |
std::string | stripdigiProducerName |
VisCuCmsTracker * | tracker |
Definition at line 23 of file VisCuTrackerDigi.h.
VisCuTrackerDigi::VisCuTrackerDigi | ( | ) |
Definition at line 47 of file VisCuTrackerDigi.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), firsteventloaded, edm::ParameterSet::getUntrackedParameter(), horizontal_view, p, pixeldigiLabelName, pixeldigiProducerName, VisConfigurationService::pSet(), python::EventAnalyzer_cfg::pset, stripdigiLabelName, stripdigiProducerName, and VisConfigurationService_cff::VisConfigurationService.
00048 { 00049 horizontal_view = true; 00050 firsteventloaded=false; 00051 const edm::ParameterSet *pset=VisConfigurationService::pSet(); 00052 if(!pset) 00053 { 00054 edm::ParameterSet p; 00055 VisConfigurationService *visService = new VisConfigurationService(p); 00056 pset = visService->pSet(); 00057 delete visService; 00058 } 00059 stripdigiProducerName = pset->getUntrackedParameter<std::string>("stripdigiProducer", "ProdStripDigi"); 00060 stripdigiLabelName = pset->getUntrackedParameter<std::string>("stripdigiLabel","stripdigi"); 00061 cout <<"stripdigiProducer="<< stripdigiProducerName << " stripdigiLabel=" << stripdigiLabelName << endl; 00062 pixeldigiProducerName = pset->getUntrackedParameter<std::string>("pixeldigiProducer", "pixdigi"); 00063 pixeldigiLabelName = pset->getUntrackedParameter<std::string>("pixeldigiLabel",""); 00064 cout <<"pixeldigiProducer="<< pixeldigiProducerName << " pixeldigiLabel=" << pixeldigiLabelName << endl; 00065 }
void VisCuTrackerDigi::drawdigi | ( | VisCuTkModule * | mod, | |
int | nlay, | |||
QPainter * | p | |||
) |
Definition at line 239 of file VisCuTrackerDigi.cc.
References a, VisCuTkModule::bufvalue, funct::cos(), VisCuTkModule::detUnit, VisCuTkModule::digi_size, VisCuTkModule::digi_start, firsteventloaded, GeomDet::geographicalId(), VisCuTkSubLayer::getId(), VisCuTkModule::getId(), VisCuTkModule::getOwner(), cmsRelvalreport::green(), horizontal_view, VisCuTkSubLayer::isStereo(), j, VisCuTkModule::length, RectangularPixelTopology::localPosition(), StripTopology::localPosition(), mdigi, phi, VisCuTkMap2D::phival(), VisCuTkModule::posx, VisCuTkModule::posy, VisCuTkModule::posz, pv1, r, row, sdigi, funct::sin(), sl, StripGeomDetUnit::specificTopology(), PixelGeomDetUnit::specificTopology(), funct::sqrt(), strip(), DetId::subdetId(), GeomDet::surface(), Surface::toGlobal(), VisCuTkModule::value, VisCuTkModule::width, VisCuTkModule::widthAtHalfLength, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by VisCuTkMap2D::paintEvent(), and VisCuTkMap2D::print().
00240 { 00241 int x,y; 00242 double phi,r,dx,dy,dy1; 00243 double xp[4],yp[4],xp1,yp1; 00244 double vhbot,vhtop,vhapo; 00245 double rmedio[]={0.041,0.0701,0.0988,0.255,0.340,0.430,0.520,0.610,0.696,0.782,0.868,0.965,1.080}; 00246 double xt1,yt1,xs1=0.,ys1=0.,xt2,yt2,xs2,ys2,pv1,pv2; 00247 unsigned int numberOfDigis = 0; 00248 unsigned int detType = mod->detUnit->geographicalId().subdetId(); 00249 const RectangularPixelTopology * theTopol = 0; 00250 const StripTopology * theStripTopol = 0; 00251 const PixelGeomDetUnit* theDet; 00252 const StripGeomDetUnit* theStripDet; 00253 if(detType<3) {//pixel 00254 theDet = dynamic_cast<const PixelGeomDetUnit*>(mod->detUnit); 00255 theTopol = dynamic_cast<const RectangularPixelTopology *>( &(theDet->specificTopology ())); 00256 } else { //SiStrip 00257 theStripDet = dynamic_cast<const StripGeomDetUnit*>(mod->detUnit); 00258 theStripTopol = dynamic_cast<const StripTopology *>( &(theStripDet->specificTopology ())); 00259 } 00260 00261 if(firsteventloaded){ 00262 QPointArray a = QPointArray(4); 00263 phi = VisCuTkMap2D::phival(mod->posx,mod->posy); 00264 r = sqrt(mod->posx*mod->posx+mod->posy*mod->posy); 00265 vhbot = mod->width; 00266 vhtop=mod->width; 00267 vhapo=mod->length; 00268 if(nlay < 31){ 00269 vhbot = mod->widthAtHalfLength/2.-(mod->width/2.-mod->widthAtHalfLength/2.); 00270 vhtop=mod->width/2.; 00271 vhapo=mod->length/2.; 00272 if(nlay >12 && nlay <19){ 00273 if(map->separated)r = r+r; 00274 xp[0]=r-vhtop;yp[0]=-vhapo; 00275 xp[1]=r+vhtop;yp[1]=-vhapo; 00276 xp[2]=r+vhtop;yp[2]=vhapo; 00277 xp[3]=r-vhtop;yp[3]=vhapo; 00278 }else{ 00279 if(map->separated)r = r + r/3.; 00280 xp[0]=r-vhapo;yp[0]=-vhbot; 00281 xp[1]=r+vhapo;yp[1]=-vhtop; 00282 xp[2]=r+vhapo;yp[2]=vhtop; 00283 xp[3]=r-vhapo;yp[3]=vhbot; 00284 } 00285 for(int j=0;j<4;j++){ 00286 xp1 = xp[j]*cos(phi)-yp[j]*sin(phi); 00287 yp1 = xp[j]*sin(phi)+yp[j]*cos(phi); 00288 xp[j] = xp1;yp[j]=yp1; 00289 } 00290 if(detType<3) { //Pixel 00291 for(int idigi=mod->digi_start;idigi!=(mod->digi_start+mod->digi_size);idigi++){ 00292 if(!map->separated){ 00293 //int adc = mdigi[idigi].adc(); // charge 00294 int row = mdigi[idigi].row(); 00295 int column =mdigi[idigi].column(); 00296 GlobalPoint pos = mod->detUnit->surface().toGlobal(theTopol->localPosition(MeasurementPoint(row,column))); 00297 float x = pos.x () / 100.0; // cm -> m 00298 float y = pos.y () / 100.0; // cm -> m 00299 int xc = map->xpixel(x); 00300 int yc = map->ypixel(y); 00301 if(!map->acc){ 00302 p->setPen(QColor(0,255,0)); 00303 p->setBrush(QColor(0,255,0)); 00304 if(!horizontal_view)p->drawRect(xc,yc,3,3);else p->drawRect(yc,map->x_win-xc,3,3); 00305 } else { 00306 if(!horizontal_view){ 00307 if(xc > (map->ximg -1)) xc = (map->ximg -1); 00308 if(yc > (map->yimg -1)) yc =(map->yimg-1); 00309 } else { 00310 if(yc > (map->ximg -1)) yc = (map->ximg -1); 00311 if(xc > (map->yimg -1)) xc =(map->yimg-1); 00312 } 00313 QRgb pixel; 00314 if(!horizontal_view){ 00315 pixel = map->image->pixel(xc,yc); 00316 }else pixel = map->image->pixel(yc,map->x_win-xc); 00317 int green = qGreen(pixel); 00318 if(green > 1) green = green -20; 00319 if(green < 0) green = 0; 00320 if(!horizontal_view)map->image->setPixel(xc,yc,green); else map->image->setPixel(yc,map->x_win-xc,green); 00321 } 00322 } 00323 numberOfDigis++; 00324 } // for digis 00325 } else { //SiStrip 00326 for(int idigi=mod->digi_start;idigi!=(mod->digi_start+mod->digi_size);idigi++){ 00327 if(!map->separated){ 00328 short strip =sdigi[idigi].strip(); 00329 GlobalPoint pos = mod->detUnit->surface().toGlobal(theStripTopol->localPosition(strip)); 00330 float x = pos.x () / 100.0; // cm -> m 00331 float y = pos.y () / 100.0; // cm -> m 00332 //float z = pos.z () / 100.0; // cm -> m 00333 int xc = map->xpixel(x); 00334 int yc = map->ypixel(y); 00335 if(!map->acc){ 00336 p->setPen(QColor(0,255,0)); 00337 p->setBrush(QColor(0,255,0)); 00338 if(!horizontal_view)p->drawRect(xc,yc,3,3);else p->drawRect(yc,map->x_win-xc,3,3); 00339 } else { 00340 if(!horizontal_view){ 00341 if(xc > (map->ximg -1)) xc = (map->ximg -1); 00342 if(yc > (map->yimg -1)) yc =(map->yimg-1); 00343 } else { 00344 if(yc > (map->ximg -1)) yc = (map->ximg -1); 00345 if(xc > (map->yimg -1)) xc =(map->yimg-1); 00346 } 00347 QRgb pixel; 00348 if(!horizontal_view){ 00349 pixel = map->image->pixel(xc,yc); 00350 }else pixel = map->image->pixel(yc,map->x_win-xc); 00351 int green = qGreen(pixel); 00352 if(green > 1) green = green -20; 00353 if(green < 0) green = 0; 00354 if(!horizontal_view)map->image->setPixel(xc,yc,green);else map->image->setPixel(yc,map->x_win-xc,green); 00355 } 00356 } 00357 numberOfDigis++; 00358 } //for digis 00359 } 00360 } else { //barrel 00361 int numod; 00362 numod=mod->getId();if(numod>100)numod=numod-100; 00363 int vane = mod->getOwner()->getId(); 00364 if(map->separated){ 00365 dx = vhapo; 00366 phi=M_PI; 00367 xt1=rmedio[nlay-31]; yt1=-vhtop/2.; 00368 xs1 = xt1*cos(phi)-yt1*sin(phi); 00369 ys1 = xt1*sin(phi)+yt1*cos(phi); 00370 xt2=rmedio[nlay-31]; yt2=vhtop/2.; 00371 xs2 = xt2*cos(phi)-yt2*sin(phi); 00372 ys2 = xt2*sin(phi)+yt2*cos(phi); 00373 dy=VisCuTkMap2D::phival(xs2,ys2)-VisCuTkMap2D::phival(xs1,ys1); 00374 dy1 = dy; 00375 if(nlay==31)dy1=0.39; 00376 if(nlay==32)dy1=0.23; 00377 if(nlay==33)dy1=0.16; 00378 xp[0]=vane*(dx+dx/8.);yp[0]=numod*(dy1); 00379 xp[1]=vane*(dx+dx/8.)+dx;yp[1]=numod*(dy1); 00380 xp[2]=vane*(dx+dx/8.)+dx;yp[2]=numod*(dy1)+dy; 00381 xp[3]=vane*(dx+dx/8.);yp[3]=numod*(dy1)+dy; 00382 }else{ 00383 xt1=r; yt1=-vhtop/2.; 00384 xs1 = xt1*cos(phi)-yt1*sin(phi); 00385 ys1 = xt1*sin(phi)+yt1*cos(phi); 00386 xt2=r; yt2=vhtop/2.; 00387 xs2 = xt2*cos(phi)-yt2*sin(phi); 00388 ys2 = xt2*sin(phi)+yt2*cos(phi); 00389 pv1=VisCuTkMap2D::phival(xs1,ys1); 00390 pv2=VisCuTkMap2D::phival(xs2,ys2); 00391 if(fabs(pv1-pv2)>M_PI && numod==1)pv1=pv1-2.*M_PI; 00392 if(fabs(pv1-pv2)>M_PI && numod!=1)pv2=pv2+2.*M_PI; 00393 xp[0]=mod->posz-vhapo/2.;yp[0]=4.2*pv1; 00394 xp[1]=mod->posz+vhapo/2.;yp[1]=4.2*pv1; 00395 xp[2]=mod->posz+vhapo/2. ;yp[2]=4.2*pv2; 00396 xp[3]=mod->posz-vhapo/2.;yp[3]=4.2*pv2; 00397 } 00398 if(detType<3) {//pixel 00399 for(int idigi=mod->digi_start;idigi!=(mod->digi_start+mod->digi_size);idigi++){ 00400 if(!map->separated){ 00401 //int adc = mdigi[idigi].adc(); // charge 00402 int row = mdigi[idigi].row(); 00403 int column =mdigi[idigi].column(); 00404 GlobalPoint pos = mod->detUnit->surface().toGlobal(theTopol->localPosition(MeasurementPoint(row,column))); 00405 float x = pos.x () / 100.0; // cm -> m 00406 float y = pos.y () / 100.0; // cm -> m 00407 float z = pos.z () / 100.0; // cm -> m 00408 int xc = map->xpixel(z); 00409 int yc = map->ypixel(4.2*VisCuTkMap2D::phival(x,y)); 00410 if(!map->acc){ 00411 p->setPen(QColor(0,255,0)); 00412 p->setBrush(QColor(0,255,0)); 00413 if(!horizontal_view)p->drawRect(xc,yc,3,3);else p->drawRect(yc,map->x_win-xc,3,3); 00414 } else { 00415 if(!horizontal_view){ 00416 if(xc > (map->ximg -1)) xc = (map->ximg -1); 00417 if(yc > (map->yimg -1)) yc =(map->yimg-1); 00418 } else { 00419 if(yc > (map->ximg -1)) yc = (map->ximg -1); 00420 if(xc > (map->yimg -1)) xc =(map->yimg-1); 00421 } 00422 QRgb pixel; 00423 if(!horizontal_view){ 00424 pixel = map->image->pixel(xc,yc); 00425 }else pixel = map->image->pixel(yc,map->x_win-xc); 00426 int green = qGreen(pixel); 00427 if(green > 1) green = green -20; 00428 if(green < 0) green = 0; 00429 if(!horizontal_view)map->image->setPixel(xc,yc,green);else map->image->setPixel(yc,map->x_win-xc,green); 00430 } 00431 }//not separated 00432 numberOfDigis++; 00433 }//digis 00434 } else { //SiStrip 00435 for(int idigi=mod->digi_start;idigi!=(mod->digi_start+mod->digi_size);idigi++){ 00436 if(!map->separated){ 00437 short strip =sdigi[idigi].strip(); 00438 GlobalPoint pos = mod->detUnit->surface().toGlobal(theStripTopol->localPosition(strip)); 00439 float x = pos.x () / 100.0; // cm -> m 00440 float y = pos.y () / 100.0; // cm -> m 00441 float z = pos.z () / 100.0; // cm -> m 00442 int xc = map->xpixel(z); 00443 int yc = map->ypixel(4.2*VisCuTkMap2D::phival(x,y)); 00444 if(!map->acc){ 00445 p->setPen(QColor(0,255,0)); 00446 p->setBrush(QColor(0,255,0)); 00447 if(!horizontal_view)p->drawRect(xc,yc,3,3);else p->drawRect(yc,map->x_win-xc,3,3); 00448 } else { 00449 if(!horizontal_view){ 00450 if(xc > (map->ximg -1)) xc = (map->ximg -1); 00451 if(yc > (map->yimg -1)) yc =(map->yimg-1); 00452 } else { 00453 if(yc > (map->ximg -1)) yc = (map->ximg -1); 00454 if(xc > (map->yimg -1)) xc =(map->yimg-1); 00455 } 00456 QRgb pixel; 00457 if(!horizontal_view){ 00458 pixel = map->image->pixel(xc,yc); 00459 }else pixel = map->image->pixel(yc,map->x_win-xc); 00460 int green = qGreen(pixel); 00461 if(green > 1) green = green -20; 00462 if(green < 0) green = 0; 00463 if(!horizontal_view)map->image->setPixel(xc,yc,green);else map->image->setPixel(yc,map->x_win-xc,green); 00464 } 00465 }//not separated 00466 numberOfDigis++; 00467 }//digis 00468 } 00469 }//endcap 00470 VisCuTkSubLayer* sl = mod->getOwner(); 00471 if(sl->isStereo()&& map->separated) 00472 { 00473 if(mod->getId()>100 ){ 00474 for(int j=0;j<3;j++){ 00475 x=map->xpixel(xp[j]);y=map->ypixel(yp[j]); 00476 if(!horizontal_view)a.setPoint(j,x,y);else a.setPoint(j,y,map->x_win-x); 00477 } 00478 if(!horizontal_view)a.setPoint(3,x,y);else a.setPoint(3,y,map->x_win-x); 00479 }else { 00480 x=map->xpixel(xp[2]);y=map->ypixel(yp[2]); 00481 if(!horizontal_view)a.setPoint(0,x,y);else a.setPoint(0,y,map->x_win-x); 00482 x=map->xpixel(xp[3]);y=map->ypixel(yp[3]); 00483 if(!horizontal_view)a.setPoint(1,x,y);else a.setPoint(1,y,map->x_win-x); 00484 x=map->xpixel(xp[0]);y=map->ypixel(yp[0]); 00485 if(!horizontal_view)a.setPoint(2,x,y);else a.setPoint(2,y,map->x_win-x); 00486 if(!horizontal_view)a.setPoint(3,x,y);else a.setPoint(3,y,map->x_win-x); 00487 } 00488 } else { 00489 for(int j=0;j<4;j++){ 00490 x=map->xpixel(xp[j]);y=map->ypixel(yp[j]); 00491 if(!horizontal_view)a.setPoint(j,x,y);else a.setPoint(j,y,map->x_win-x); 00492 } 00493 } 00494 if(map->acc){mod->value = mod->value + mod->digi_size;mod->bufvalue = mod->bufvalue + mod->digi_size; } 00495 else mod->value = mod->digi_size; 00496 if(map->separated){ 00497 p->setPen(QColor( 158, 185, 225)); 00498 int green = 255-mod->value; if (green < 0)green = 0;if(green > 255)green=255; 00499 p->setBrush(QColor(255,green,0)); 00500 if(mod->value==0)p->setBrush(QColor(255,255,255)); 00501 p->drawPolygon(a); 00502 } 00503 p->setPen(QColor(0,0,0)); 00504 p->setBrush(Qt::NoBrush); 00505 }//firsteventloaded 00506 }
void VisCuTrackerDigi::setEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) |
Definition at line 68 of file VisCuTrackerDigi.cc.
References edm::DetSetVector< T >::begin(), GenMuonPlsPt100GeV_cfg::cout, edm::DetSet< T >::data, VisCuTkModule::digi_size, VisCuTkModule::digi_start, ds, edm::DetSetVector< T >::end(), lat::endl(), firsteventloaded, edm::EventSetup::get(), i, edm::DetSet< T >::id, m_pDD, mdigi, mod(), VisCuTkModuleMap::moduleMap, pixeldigiLabelName, pixeldigiProducerName, sdigi, EgammaValidation_Zee_cff::sel, edm::DetSetVector< T >::size(), stripdigiLabelName, and stripdigiProducerName.
Referenced by VisCuTkGeometryTwig::onNewEvent().
00070 { 00071 eventSetup.get<TrackerDigiGeometryRecord> ().get (m_pDD); 00072 00073 sdigi.clear (); 00074 00075 00076 firsteventloaded=true; 00077 bool nodigi=true; 00078 int sd_pointer=0; 00079 if(stripdigiProducerName!="ignore"){ 00080 std::vector< edm::Handle<edm::DetSetVector<SiStripDigi> > > s_digi_collections; 00081 Selector sel(ProductInstanceNameSelector(stripdigiLabelName) && 00082 ModuleLabelSelector(stripdigiProducerName)); 00083 event.getMany (sel, s_digi_collections); 00084 if (! s_digi_collections.empty ())nodigi=false; 00085 if(nodigi)cout << "no digi type "<<stripdigiProducerName<<"/"<<stripdigiLabelName<< " in event" << endl; 00086 if(!nodigi){ 00087 std::vector< edm::Handle<edm::DetSetVector<SiStripDigi> > >::iterator i; 00088 i = s_digi_collections.begin (); 00089 const edm::DetSetVector<SiStripDigi> &sinput = *(*i); 00090 00091 if (sinput.size()) 00092 { 00093 edm::DetSetVector<SiStripDigi>::const_iterator DSViter=sinput.begin(); 00094 cout << sinput.size() << endl; 00095 for (; DSViter!=sinput.end();DSViter++){ 00096 edm::DetSet<SiStripDigi> ds = *DSViter; 00097 if (ds.data.size()) 00098 { 00099 const uint32_t& detID = ds.id; 00100 DetId detIdObject(detID); 00101 00102 const GeomDetUnit * geoUnit = m_pDD->idToDetUnit( detIdObject ); 00103 edm::DetSet<SiStripDigi>::const_iterator idigi=ds.data.begin(); 00104 00105 VisCuTkModule * mod = VisCuTkModuleMap::moduleMap[geoUnit]; 00106 if(mod){ 00107 mod->digi_start=sd_pointer; 00108 mod->digi_size=ds.data.size(); 00109 } else cout << "module not found " << endl; 00110 for(;idigi!=ds.data.end();idigi++){ 00111 00112 sdigi.push_back(*idigi); 00113 00114 } 00115 sd_pointer=sd_pointer+ds.data.size(); 00116 } 00117 } 00118 } 00119 } 00120 } 00121 00122 mdigi.clear (); 00123 sd_pointer=0; 00124 nodigi=true; 00125 if(pixeldigiProducerName!="ignore"){ 00126 std::vector< edm::Handle<edm::DetSetVector<PixelDigi> > > p_digi_collections; 00127 Selector sel(ProductInstanceNameSelector(pixeldigiLabelName) && 00128 ModuleLabelSelector(pixeldigiProducerName)); 00129 event.getMany (sel, p_digi_collections); 00130 if (! p_digi_collections.empty ())nodigi=false; 00131 if(nodigi) cout << "no pixeldigi type "<<pixeldigiProducerName<<"/"<<pixeldigiLabelName<< " in event" << endl; 00132 if(!nodigi){ 00133 std::vector< edm::Handle<edm::DetSetVector<PixelDigi> > >::iterator i; 00134 i = p_digi_collections.begin (); 00135 const edm::DetSetVector<PixelDigi> &pinput = *(*i); 00136 if (pinput.size()) 00137 { 00138 edm::DetSetVector<PixelDigi>::const_iterator DSViter=pinput.begin(); 00139 cout << pinput.size() << endl; 00140 for (; DSViter!=pinput.end();DSViter++){ 00141 edm::DetSet<PixelDigi> ds = *DSViter; 00142 if (ds.data.size()) 00143 { 00144 const uint32_t& detID = ds.id; 00145 DetId detIdObject(detID); 00146 const GeomDetUnit * geoUnit = m_pDD->idToDetUnit( detIdObject ); 00147 edm::DetSet<PixelDigi>::const_iterator idigi=ds.data.begin(); 00148 VisCuTkModule * mod = VisCuTkModuleMap::moduleMap[geoUnit]; 00149 if(mod){ 00150 mod->digi_start=sd_pointer; 00151 mod->digi_size=ds.data.size(); 00152 } else cout << "module not found " << endl; 00153 for(;idigi!=ds.data.end();idigi++){ 00154 mdigi.push_back(*idigi); 00155 } // for digis 00156 sd_pointer=sd_pointer+ds.data.size(); 00157 } 00158 } 00159 } 00160 } 00161 } 00162 }
void VisCuTrackerDigi::setMap | ( | VisCuTkMap2D * | m | ) | [inline] |
void VisCuTrackerDigi::setTracker | ( | VisCuCmsTracker * | tr | ) | [inline] |
Definition at line 29 of file VisCuTrackerDigi.h.
References tracker.
Referenced by VisCuTkGeometryTwig::onNewEvent().
00029 {tracker=tr;};
SoSeparator * VisCuTrackerDigi::update | ( | VisTrackingGeometry::DetectorRep | type | ) |
Definition at line 164 of file VisCuTrackerDigi.cc.
References begin, GenMuonPlsPt100GeV_cfg::cout, d, VisCuTkModule::detUnit, VisCuTkModule::digi_size, VisCuTkModule::digi_start, lat::endl(), GeomDet::geographicalId(), VisCuTkModule::isVisible(), RectangularPixelTopology::localPosition(), StripTopology::localPosition(), mdigi, mod(), VisCuTkModuleMap::moduleMap, row, VisTrackingGeometry::RZDet, sdigi, StripGeomDetUnit::specificTopology(), PixelGeomDetUnit::specificTopology(), funct::sqrt(), SiStripDigi::strip(), strip(), DetId::subdetId(), GeomDet::surface(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by VisCuTkGeometryTwig::update().
00165 { 00166 SoSeparator *sep = new SoSeparator; // global 00167 if (! mdigi.empty () || !sdigi.empty()) 00168 { 00169 SoMaterial *mat = new SoMaterial; 00170 mat->diffuseColor.setValue (0.0, 1.0, 0.0);//green 00171 mat->emissiveColor.setValue(0.0, 1.0, 0.0); 00172 00173 SoDrawStyle *drawStyle = new SoDrawStyle; 00174 drawStyle->pointSize = 4.0; 00175 00176 sep->addChild (mat); 00177 sep->addChild (drawStyle); 00178 00179 try { 00180 SoVertexProperty *vertices = new SoVertexProperty; 00181 int nVrtx = 0; 00182 00183 std::map<const GeomDetUnit * , VisCuTkModule *>::iterator imod; 00184 for (imod=VisCuTkModuleMap::moduleMap.begin();imod != VisCuTkModuleMap::moduleMap.end(); imod++){ 00185 VisCuTkModule* mod = imod->second; 00186 unsigned int detType = mod->detUnit->geographicalId().subdetId(); 00187 if(mod->isVisible()){ 00188 if(detType < 3)//pixel 00189 { 00190 const PixelGeomDetUnit* theDet = dynamic_cast<const PixelGeomDetUnit*>(mod->detUnit); 00191 const RectangularPixelTopology *theTopol = dynamic_cast<const RectangularPixelTopology *>( &(theDet->specificTopology ())); 00192 for(int idigi=mod->digi_start;idigi!=(mod->digi_start+mod->digi_size);idigi++){ 00193 int row = mdigi[idigi].row(); 00194 int column =mdigi[idigi].column(); 00195 GlobalPoint pos = mod->detUnit->surface().toGlobal(theTopol->localPosition(MeasurementPoint(row,column))); 00196 float x = pos.x () / 100.0; // cm -> m 00197 float y; 00198 if(type==RZDet){ 00199 x=0.0; 00200 y = sqrt(pos.x ()*pos.x()+pos.y()*pos.y()) / 100.0; if(pos.y()< 0. )y = - y;} else y = pos.y () / 100.0; // cm -> m 00201 float z = pos.z () / 100.0; // cm -> m 00202 00203 vertices->vertex.set1Value (nVrtx++, SbVec3f (x, y, z)); 00204 } 00205 }else { 00206 for(int idigi=mod->digi_start;idigi!=(mod->digi_start+mod->digi_size);idigi++){ 00207 00208 SiStripDigi d = sdigi[idigi]; 00209 short strip = d.strip(); 00210 const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>(mod->detUnit); 00211 const StripTopology * theStripTopol = dynamic_cast<const StripTopology *>( &(theStripDet->specificTopology ())); 00212 GlobalPoint pos = mod->detUnit->surface().toGlobal(theStripTopol->localPosition(strip)); 00213 float x = pos.x () / 100.0; // cm -> m 00214 float y; 00215 if(type==RZDet){ 00216 y = sqrt(pos.x ()*pos.x()+pos.y()*pos.y()) / 100.0; if(pos.y()< 0. )y = - y;} else y = pos.y () / 100.0; // cm -> m 00217 float z = pos.z () / 100.0; // cm -> m 00218 00219 vertices->vertex.set1Value (nVrtx++, SbVec3f (x, y, z)); 00220 }//for 00221 }// else 00222 }//is visible 00223 }//module loop 00224 vertices->vertex.setNum (nVrtx); 00225 SoPointSet *points = new SoPointSet; 00226 points->vertexProperty.setValue (vertices); 00227 points->numPoints.setValue (nVrtx); 00228 00229 sep->addChild (points); 00230 } 00231 catch (...) 00232 { 00233 std::cout << "No PixelDigi Digis." << std::endl; 00234 } 00235 } 00236 return sep; 00237 }
std::string VisCuTrackerDigi::updatetext | ( | VisCuTkModule * | mod | ) |
Definition at line 508 of file VisCuTrackerDigi.cc.
References VisCuTkModule::detUnit, VisCuTkModule::digi_size, VisCuTkModule::digi_start, GeomDet::geographicalId(), RectangularPixelTopology::localPosition(), StripTopology::localPosition(), mdigi, row, sdigi, StripGeomDetUnit::specificTopology(), PixelGeomDetUnit::specificTopology(), strip(), DetId::subdetId(), GeomDet::surface(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by VisCuTkGeometryTwig::update().
00509 { 00510 const RectangularPixelTopology * theTopol = 0; 00511 const StripTopology * theStripTopol = 0; 00512 const PixelGeomDetUnit* theDet; 00513 const StripGeomDetUnit* theStripDet; 00514 std::ostringstream text; 00515 if(mod->digi_size>0){ 00516 unsigned int detType = mod->detUnit->geographicalId().subdetId(); 00517 if(detType<3) {//pixel 00518 theDet = dynamic_cast<const PixelGeomDetUnit*>(mod->detUnit); 00519 theTopol = dynamic_cast<const RectangularPixelTopology *>( &(theDet->specificTopology ())); 00520 text << mod->digi_size << " pixel digis : ---------------------------------------------------- <p>" ; 00521 } else { //SiStrip 00522 theStripDet = dynamic_cast<const StripGeomDetUnit*>(mod->detUnit); 00523 theStripTopol = dynamic_cast<const StripTopology *>( &(theStripDet->specificTopology ())); 00524 text << mod->digi_size << " strip digis : --------------------------------------- <p>" ; 00525 } 00526 int nSDigis=0; 00527 for(int idigi=mod->digi_start;idigi!=(mod->digi_start+mod->digi_size);idigi++){ 00528 text << " Number=" << nSDigis++ ; 00529 if(detType<3) {//pixel 00530 int row = mdigi[idigi].row(); 00531 int column =mdigi[idigi].column(); 00532 GlobalPoint pos = mod->detUnit->surface().toGlobal(theTopol->localPosition(MeasurementPoint(row,column))); 00533 text << " Position=" << pos.x () << ", " << pos.y () << ", " << pos.z () 00534 << " Charge=" << mdigi[idigi].adc () 00535 << " Row=" << row 00536 << " Column=" << column <<"<p>" ; 00537 } else { //SiStrip 00538 short strip =sdigi[idigi].strip(); 00539 GlobalPoint pos = mod->detUnit->surface().toGlobal(theStripTopol->localPosition(strip)); 00540 text << " Position=" << pos.x () << ", " << pos.y () << ", " << pos.z () 00541 << " Charge=" << sdigi[idigi].adc () 00542 << " Strip=" << strip<< "<p>"; 00543 } 00544 } 00545 text << " -----------------------------" ; 00546 } 00547 return text.str(); 00548 }
bool VisCuTrackerDigi::firsteventloaded [private] |
Definition at line 35 of file VisCuTrackerDigi.h.
Referenced by drawdigi(), setEvent(), and VisCuTrackerDigi().
bool VisCuTrackerDigi::horizontal_view [private] |
edm::ESHandle<TrackerGeometry> VisCuTrackerDigi::m_pDD [private] |
VisCuTkMap2D* VisCuTrackerDigi::map [private] |
Definition at line 37 of file VisCuTrackerDigi.h.
std::vector<PixelDigi> VisCuTrackerDigi::mdigi [private] |
Definition at line 39 of file VisCuTrackerDigi.h.
Referenced by drawdigi(), setEvent(), update(), and updatetext().
std::string VisCuTrackerDigi::pixeldigiLabelName [private] |
std::string VisCuTrackerDigi::pixeldigiProducerName [private] |
std::vector<SiStripDigi> VisCuTrackerDigi::sdigi [private] |
Definition at line 40 of file VisCuTrackerDigi.h.
Referenced by drawdigi(), setEvent(), update(), and updatetext().
std::string VisCuTrackerDigi::stripdigiLabelName [private] |
std::string VisCuTrackerDigi::stripdigiProducerName [private] |
VisCuCmsTracker* VisCuTrackerDigi::tracker [private] |