#include <VisReco/VisCustomTracker/interface/VisCuTrackerRecHit.h>
Public Member Functions | |
void | drawrechit (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) |
VisCuTrackerRecHit () | |
Private Attributes | |
bool | firsteventloaded |
edm::ESHandle< TrackerGeometry > | geom |
bool | horizontal_view |
VisCuTkMap2D * | map |
std::string | pixelrechitProducerName |
std::vector< std::pair < LocalPoint, const GeomDetUnit * > > | rdigi |
std::string | striprechitProducerName |
VisCuCmsTracker * | tracker |
Definition at line 25 of file VisCuTrackerRecHit.h.
VisCuTrackerRecHit::VisCuTrackerRecHit | ( | ) |
Definition at line 51 of file VisCuTrackerRecHit.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), firsteventloaded, edm::ParameterSet::getUntrackedParameter(), horizontal_view, p, pixelrechitProducerName, VisConfigurationService::pSet(), python::EventAnalyzer_cfg::pset, striprechitProducerName, and VisConfigurationService_cff::VisConfigurationService.
00052 { 00053 horizontal_view =true; 00054 firsteventloaded=false; 00055 const edm::ParameterSet *pset=VisConfigurationService::pSet(); 00056 if(!pset) 00057 { 00058 edm::ParameterSet p; 00059 VisConfigurationService *visService = new VisConfigurationService(p); 00060 pset = visService->pSet(); 00061 delete visService; 00062 } 00063 striprechitProducerName = pset->getUntrackedParameter<std::string>("striprechitProducer", "siStripMatchedRecHits"); 00064 cout <<"striprechitProducer="<< striprechitProducerName << endl; 00065 pixelrechitProducerName = pset->getUntrackedParameter<std::string>("pixelrechitProducer", "siPixelRecHits"); 00066 cout <<"pixelrechitProducer="<< pixelrechitProducerName << endl; 00067 }
void VisCuTrackerRecHit::drawrechit | ( | VisCuTkModule * | mod, | |
int | nlay, | |||
QPainter * | p | |||
) |
Definition at line 339 of file VisCuTrackerRecHit.cc.
References a, VisCuTkModule::bufvalue, funct::cos(), firsteventloaded, VisCuTkSubLayer::getId(), VisCuTkModule::getId(), VisCuTkModule::getOwner(), cmsRelvalreport::green(), horizontal_view, VisCuTkSubLayer::isStereo(), j, VisCuTkModule::length, phi, VisCuTkMap2D::phival(), VisCuTkModule::posx, VisCuTkModule::posy, VisCuTkModule::posz, pv1, r, rdigi, VisCuTkModule::rechit_size, VisCuTkModule::rechit_start, funct::sin(), sl, funct::sqrt(), VisCuTkModule::value, VisCuTkModule::width, VisCuTkModule::widthAtHalfLength, x, y, and z.
Referenced by VisCuTkMap2D::paintEvent(), and VisCuTkMap2D::print().
00340 { 00341 int x,y; 00342 double phi,r,dx,dy,dy1; 00343 double xp[4],yp[4],xp1,yp1; 00344 double vhbot,vhtop,vhapo; 00345 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}; 00346 double xt1,yt1,xs1=0.,ys1=0.,xt2,yt2,xs2,ys2,pv1,pv2; 00347 unsigned int numberOfDigis = 0; 00348 00349 if(firsteventloaded){ 00350 QPointArray a = QPointArray(4); 00351 phi = VisCuTkMap2D::phival(mod->posx,mod->posy); 00352 r = sqrt(mod->posx*mod->posx+mod->posy*mod->posy); 00353 vhbot = mod->width; 00354 vhtop=mod->width; 00355 vhapo=mod->length; 00356 if(nlay < 31){ 00357 vhbot = mod->widthAtHalfLength/2.-(mod->width/2.-mod->widthAtHalfLength/2.); 00358 vhtop=mod->width/2.; 00359 vhapo=mod->length/2.; 00360 if(nlay >12 && nlay <19){ 00361 if(map->separated)r = r+r; 00362 xp[0]=r-vhtop;yp[0]=-vhapo; 00363 xp[1]=r+vhtop;yp[1]=-vhapo; 00364 xp[2]=r+vhtop;yp[2]=vhapo; 00365 xp[3]=r-vhtop;yp[3]=vhapo; 00366 }else{ 00367 if(map->separated)r = r + r/3.; 00368 xp[0]=r-vhapo;yp[0]=-vhbot; 00369 xp[1]=r+vhapo;yp[1]=-vhtop; 00370 xp[2]=r+vhapo;yp[2]=vhtop; 00371 xp[3]=r-vhapo;yp[3]=vhbot; 00372 } 00373 for(int j=0;j<4;j++){ 00374 xp1 = xp[j]*cos(phi)-yp[j]*sin(phi); 00375 yp1 = xp[j]*sin(phi)+yp[j]*cos(phi); 00376 xp[j] = xp1;yp[j]=yp1; 00377 } 00378 for(int idigi=mod->rechit_start;idigi!=(mod->rechit_start+mod->rechit_size);idigi++){ 00379 if(!map->separated){ 00380 LocalPoint point = rdigi[idigi].first; 00381 float x = rdigi[idigi].second->surface().toGlobal(point).x()/100; 00382 float y = rdigi[idigi].second->surface().toGlobal(point).y()/100; 00383 int xc = map->xpixel(x); 00384 int yc = map->ypixel(y); 00385 if(!map->acc){ 00386 p->setPen(QColor(255,0,255)); 00387 p->setBrush(QColor(255,0,255)); 00388 if(!horizontal_view)p->drawRect(xc,yc,3,3);else p->drawRect(yc,map->x_win-xc,3,3); 00389 } else { 00390 if(!horizontal_view){ 00391 if(xc > (map->ximg -1)) xc = (map->ximg -1); 00392 if(yc > (map->yimg -1)) yc =(map->yimg-1); 00393 } else { 00394 if(yc > (map->ximg -1)) yc = (map->ximg -1); 00395 if(xc > (map->yimg -1)) xc =(map->yimg-1); 00396 } 00397 QRgb pixel; 00398 if(!horizontal_view){ 00399 pixel = map->image->pixel(xc,yc); 00400 }else pixel = map->image->pixel(yc,map->x_win-xc); 00401 int green = qGreen(pixel); 00402 if(green > 1) green = green -20; 00403 if(green < 0) green = 0; 00404 if(!horizontal_view)map->image->setPixel(xc,yc,green);else map->image->setPixel(yc,map->x_win-xc,green); 00405 } 00406 } 00407 numberOfDigis++; 00408 } //for digis 00409 } else { //barrel 00410 int numod; 00411 numod=mod->getId();if(numod>100)numod=numod-100; 00412 int vane = mod->getOwner()->getId(); 00413 if(map->separated){ 00414 dx = vhapo; 00415 phi=M_PI; 00416 xt1=rmedio[nlay-31]; yt1=-vhtop/2.; 00417 xs1 = xt1*cos(phi)-yt1*sin(phi); 00418 ys1 = xt1*sin(phi)+yt1*cos(phi); 00419 xt2=rmedio[nlay-31]; yt2=vhtop/2.; 00420 xs2 = xt2*cos(phi)-yt2*sin(phi); 00421 ys2 = xt2*sin(phi)+yt2*cos(phi); 00422 dy=VisCuTkMap2D::phival(xs2,ys2)-VisCuTkMap2D::phival(xs1,ys1); 00423 dy1 = dy; 00424 if(nlay==31)dy1=0.39; 00425 if(nlay==32)dy1=0.23; 00426 if(nlay==33)dy1=0.16; 00427 xp[0]=vane*(dx+dx/8.);yp[0]=numod*(dy1); 00428 xp[1]=vane*(dx+dx/8.)+dx;yp[1]=numod*(dy1); 00429 xp[2]=vane*(dx+dx/8.)+dx;yp[2]=numod*(dy1)+dy; 00430 xp[3]=vane*(dx+dx/8.);yp[3]=numod*(dy1)+dy; 00431 }else{ 00432 xt1=r; yt1=-vhtop/2.; 00433 xs1 = xt1*cos(phi)-yt1*sin(phi); 00434 ys1 = xt1*sin(phi)+yt1*cos(phi); 00435 xt2=r; yt2=vhtop/2.; 00436 xs2 = xt2*cos(phi)-yt2*sin(phi); 00437 ys2 = xt2*sin(phi)+yt2*cos(phi); 00438 pv1=VisCuTkMap2D::phival(xs1,ys1); 00439 pv2=VisCuTkMap2D::phival(xs2,ys2); 00440 if(fabs(pv1-pv2)>M_PI && numod==1)pv1=pv1-2.*M_PI; 00441 if(fabs(pv1-pv2)>M_PI && numod!=1)pv2=pv2+2.*M_PI; 00442 xp[0]=mod->posz-vhapo/2.;yp[0]=4.2*pv1; 00443 xp[1]=mod->posz+vhapo/2.;yp[1]=4.2*pv1; 00444 xp[2]=mod->posz+vhapo/2. ;yp[2]=4.2*pv2; 00445 xp[3]=mod->posz-vhapo/2.;yp[3]=4.2*pv2; 00446 } 00447 for(int idigi=mod->rechit_start;idigi!=(mod->rechit_start+mod->rechit_size);idigi++){ 00448 if(!map->separated){ 00449 LocalPoint point = rdigi[idigi].first; 00450 float x = rdigi[idigi].second->surface().toGlobal(point).x()/100; 00451 float y = rdigi[idigi].second->surface().toGlobal(point).y()/100; 00452 float z = rdigi[idigi].second->surface().toGlobal(point).z()/100; 00453 int xc = map->xpixel(z); 00454 int yc = map->ypixel(4.2*VisCuTkMap2D::phival(x,y)); 00455 if(!map->acc){ 00456 p->setPen(QColor(255,0,0));//red 00457 p->setBrush(QColor(255,0,0)); 00458 if(!horizontal_view)p->drawRect(xc,yc,3,3);else p->drawRect(yc,map->x_win-xc,3,3); 00459 } else { 00460 if(!horizontal_view){ 00461 if(xc > (map->ximg -1)) xc = (map->ximg -1); 00462 if(yc > (map->yimg -1)) yc =(map->yimg-1); 00463 } else { 00464 if(yc > (map->ximg -1)) yc = (map->ximg -1); 00465 if(xc > (map->yimg -1)) xc =(map->yimg-1); 00466 } 00467 QRgb pixel; 00468 if(!horizontal_view){ 00469 pixel = map->image->pixel(xc,yc); 00470 }else pixel = map->image->pixel(yc,xc); 00471 int green = qGreen(pixel); 00472 if(green > 1) green = green -20; 00473 if(green < 0) green = 0; 00474 if(!horizontal_view)map->image->setPixel(xc,yc,green);else map->image->setPixel(yc,map->x_win-xc,green); 00475 } 00476 }//not separated 00477 numberOfDigis++; 00478 }//digis 00479 }//endcap 00480 VisCuTkSubLayer* sl = mod->getOwner(); 00481 if(sl->isStereo()&& map->separated) 00482 { 00483 if(mod->getId()>100 ){ 00484 for(int j=0;j<3;j++){ 00485 x=map->xpixel(xp[j]);y=map->ypixel(yp[j]); 00486 if(!horizontal_view)a.setPoint(j,x,y);else a.setPoint(j,y,map->x_win-x); 00487 } 00488 if(!horizontal_view)a.setPoint(3,x,y);else a.setPoint(3,y,map->x_win-x); 00489 }else { 00490 x=map->xpixel(xp[2]);y=map->ypixel(yp[2]); 00491 if(!horizontal_view)a.setPoint(0,x,y);else a.setPoint(0,y,map->x_win-x); 00492 x=map->xpixel(xp[3]);y=map->ypixel(yp[3]); 00493 if(!horizontal_view)a.setPoint(1,x,y);else a.setPoint(1,y,map->x_win-x); 00494 x=map->xpixel(xp[0]);y=map->ypixel(yp[0]); 00495 if(!horizontal_view)a.setPoint(2,x,y);else a.setPoint(2,y,map->x_win-x); 00496 if(!horizontal_view)a.setPoint(3,x,y);else a.setPoint(3,y,map->x_win-x); 00497 } 00498 } else { 00499 for(int j=0;j<4;j++){ 00500 x=map->xpixel(xp[j]);y=map->ypixel(yp[j]); 00501 if(!horizontal_view)a.setPoint(j,x,y);else a.setPoint(j,y,map->x_win-x); 00502 } 00503 } 00504 if(map->acc){mod->value = mod->value + mod->rechit_size;mod->bufvalue = mod->bufvalue + mod->rechit_size;} 00505 else mod->value = mod->rechit_size; 00506 if(map->separated){ 00507 p->setPen(QColor( 158, 185, 225)); 00508 int green = 255-mod->value; if (green < 0)green = 0;if(green > 255)green=255; 00509 p->setBrush(QColor(255,green,0)); 00510 if(mod->value==0)p->setBrush(QColor(255,255,255)); 00511 p->drawPolygon(a); 00512 } 00513 p->setPen(QColor(0,0,0)); 00514 p->setBrush(Qt::NoBrush); 00515 }//firsteventloaded 00516 }
void VisCuTrackerRecHit::setEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) |
Definition at line 70 of file VisCuTrackerRecHit.cc.
References begin, GenMuonPlsPt100GeV_cfg::cout, VisCuTkModule::detUnit, lat::endl(), firsteventloaded, GeomDet::geographicalId(), geom, edm::EventSetup::get(), edm::RangeMap< ID, C, P >::get(), i, edm::RangeMap< ID, C, P >::ids(), iter, BaseSiTrackerRecHit2DLocalPos::localPosition(), mod(), VisCuTkModuleMap::moduleMap, pixelrechitProducerName, rdigi, VisCuTkModule::rechit_size, VisCuTkModule::rechit_start, EgammaValidation_Zee_cff::sel, edm::RangeMap< ID, C, P >::size(), striprechitProducerName, and DetId::subdetId().
Referenced by VisCuTkGeometryTwig::onNewEvent().
00072 { 00073 eventSetup.get<TrackerDigiGeometryRecord> ().get (geom); 00074 00075 edm::Handle<SiStripMatchedRecHit2DCollection> rechitsmatched; 00076 edm::Handle<SiStripRecHit2DCollection> rechitsrphi; 00077 edm::Handle<SiStripRecHit2DCollection> rechitsstereo; 00078 rdigi.clear(); 00079 int rd_pointer=0; 00080 bool norechits=true; 00081 firsteventloaded=true; 00082 if(striprechitProducerName!="ignore"){ 00083 std::vector< edm::Handle<SiStripMatchedRecHit2DCollection> > rechit2d_matched_collections; 00084 ModuleLabelSelector sel(striprechitProducerName); 00085 event.getMany (sel, rechit2d_matched_collections); 00086 std::vector< edm::Handle<SiStripRecHit2DCollection> > rechit2d_collections; 00087 event.getMany (sel, rechit2d_collections); 00088 if (! rechit2d_matched_collections.empty () && !rechit2d_collections.empty ())norechits=false; 00089 if(norechits) cout << "no striprechits type "<<striprechitProducerName<<" in event" << endl; 00090 if(!norechits){ 00091 event.getByLabel(striprechitProducerName,"matchedRecHit", rechitsmatched); 00092 event.getByLabel(striprechitProducerName,"rphiRecHit", rechitsrphi); 00093 event.getByLabel(striprechitProducerName,"stereoRecHit", rechitsstereo); 00094 if(rechitsmatched->size()>0||rechitsrphi->size()>0||rechitsstereo->size()>0){ 00095 std::vector<std::pair<const GeomDetUnit *,std::pair<LocalPoint, const GeomDetUnit *> > > rtemp; 00096 if(rechitsmatched->size()>0){ 00097 const std::vector<DetId> detIDs = rechitsmatched->ids(); 00098 for ( std::vector<DetId>::const_iterator detunit_iterator = detIDs.begin(); detunit_iterator != detIDs.end(); detunit_iterator++ ) 00099 { 00100 unsigned int id = (*detunit_iterator).rawId(); 00101 if(id!=999999999){ //if is valid detector 00102 VisCuTkModule * mod = 0, *mod1 = 0,*mod2 = 0; 00103 DetId detIdObject(id); 00104 DetId detIdObject1(id+1); 00105 DetId detIdObject2(id+2); 00106 const GeomDetUnit * geoUnit,*geoUnit1,*geoUnit2; 00107 int isStereo=id&0x3; 00108 if(isStereo!=0){ 00109 geoUnit = geom->idToDetUnit( detIdObject ); 00110 mod = VisCuTkModuleMap::moduleMap[geoUnit]; 00111 }else{ 00112 geoUnit1 = geom->idToDetUnit( detIdObject1 ); 00113 geoUnit2 = geom->idToDetUnit( detIdObject2 ); 00114 mod1 = VisCuTkModuleMap::moduleMap[geoUnit1]; 00115 mod2 = VisCuTkModuleMap::moduleMap[geoUnit2]; 00116 } 00117 SiStripMatchedRecHit2DCollection::range rechitRange = rechitsmatched->get((*detunit_iterator)); 00118 SiStripMatchedRecHit2DCollection::const_iterator rechitRangeIteratorBegin = rechitRange.first; 00119 SiStripMatchedRecHit2DCollection::const_iterator rechitRangeIteratorEnd = rechitRange.second; 00120 SiStripMatchedRecHit2DCollection::const_iterator iter=rechitRangeIteratorBegin; 00121 00122 for(iter=rechitRangeIteratorBegin;iter!=rechitRangeIteratorEnd;++iter){//loop on the rechit 00123 SiStripMatchedRecHit2D const rechit=*iter; 00124 LocalPoint position=rechit.localPosition(); 00125 if(isStereo!=0){ 00126 std::pair<const GeomDetUnit*, std::pair<LocalPoint, const GeomDetUnit* > > pxd; 00127 pxd.first = geoUnit; 00128 pxd.second.first = position; 00129 pxd.second.second = geoUnit; 00130 rtemp.push_back(pxd); 00131 if(mod){ mod->rechit_size++; } else cout << "module not found " << endl; 00132 }else{ 00133 std::pair<const GeomDetUnit*, std::pair<LocalPoint, const GeomDetUnit* > > pxd1; 00134 pxd1.first = geoUnit1; 00135 pxd1.second.first = position; 00136 pxd1.second.second = geoUnit2; 00137 rtemp.push_back(pxd1); 00138 if(mod1){ mod1->rechit_size++; } else cout << "module not found " << endl; 00139 std::pair<const GeomDetUnit*, std::pair<LocalPoint, const GeomDetUnit* > > pxd2; 00140 pxd2.first = geoUnit2; 00141 pxd2.second.first = position; 00142 pxd2.second.second = geoUnit2; 00143 rtemp.push_back(pxd2); 00144 if(mod2){ mod2->rechit_size++; } else cout << "module not found " << endl; 00145 } 00146 } 00147 } 00148 } 00149 } 00150 if(rechitsrphi->size()>0){ 00151 const std::vector<DetId> detIDs1 = rechitsrphi->ids(); 00152 // loop over detunits 00153 for ( std::vector<DetId>::const_iterator detunit_iterator = detIDs1.begin(); detunit_iterator != detIDs1.end(); detunit_iterator++ ) 00154 { 00155 unsigned int id = (*detunit_iterator).rawId(); 00156 if(id!=999999999){ //if is valid detector 00157 DetId detIdObject(id); 00158 const GeomDetUnit * geoUnit = geom->idToDetUnit( detIdObject ); 00159 VisCuTkModule * mod = VisCuTkModuleMap::moduleMap[geoUnit]; 00160 SiStripRecHit2DCollection::range rechitRange = rechitsrphi->get((*detunit_iterator)); 00161 SiStripRecHit2DCollection::const_iterator rechitRangeIteratorBegin = rechitRange.first; 00162 SiStripRecHit2DCollection::const_iterator rechitRangeIteratorEnd = rechitRange.second; 00163 SiStripRecHit2DCollection::const_iterator iter=rechitRangeIteratorBegin; 00164 for(iter=rechitRangeIteratorBegin;iter!=rechitRangeIteratorEnd;++iter){//loop on the rechit 00165 SiStripRecHit2D const rechit=*iter; 00166 LocalPoint position=rechit.localPosition(); 00167 std::pair<const GeomDetUnit*, std::pair<LocalPoint, const GeomDetUnit* > > pxd; 00168 pxd.first = geoUnit; 00169 pxd.second.first = position; 00170 pxd.second.second = geoUnit; 00171 rtemp.push_back(pxd); 00172 if(mod){ mod->rechit_size++; } else cout << "module not found " << endl; 00173 } 00174 } 00175 } 00176 } 00177 if(rechitsstereo->size()>0){ 00178 const std::vector<DetId> detIDs2 = rechitsstereo->ids(); 00179 // loop over detunits 00180 for ( std::vector<DetId>::const_iterator detunit_iterator = detIDs2.begin(); detunit_iterator != detIDs2.end(); detunit_iterator++ ) 00181 { 00182 unsigned int id = (*detunit_iterator).rawId(); 00183 if(id!=999999999){ //if is valid detector 00184 DetId detIdObject(id); 00185 const GeomDetUnit * geoUnit = geom->idToDetUnit( detIdObject ); 00186 VisCuTkModule * mod = VisCuTkModuleMap::moduleMap[geoUnit]; 00187 SiStripRecHit2DCollection::range rechitRange = rechitsstereo->get((*detunit_iterator)); 00188 SiStripRecHit2DCollection::const_iterator rechitRangeIteratorBegin = rechitRange.first; 00189 SiStripRecHit2DCollection::const_iterator rechitRangeIteratorEnd = rechitRange.second; 00190 SiStripRecHit2DCollection::const_iterator iter=rechitRangeIteratorBegin; 00191 for(iter=rechitRangeIteratorBegin;iter!=rechitRangeIteratorEnd;++iter){//loop on the rechit 00192 SiStripRecHit2D const rechit=*iter; 00193 LocalPoint position=rechit.localPosition(); 00194 std::pair<const GeomDetUnit*, std::pair<LocalPoint, const GeomDetUnit* > > pxd; 00195 pxd.first = geoUnit; 00196 pxd.second.first = position; 00197 pxd.second.second = geoUnit; 00198 rtemp.push_back(pxd); 00199 if(mod){ mod->rechit_size++; } else cout << "module not found " << endl; 00200 } 00201 } 00202 } 00203 } 00204 cout << rtemp.size() << " rechits in sistrip " << endl; 00205 00206 std::map<const GeomDetUnit * , VisCuTkModule *>::iterator imod; 00207 for (imod=VisCuTkModuleMap::moduleMap.begin();imod != VisCuTkModuleMap::moduleMap.end(); imod++){ 00208 VisCuTkModule* mod = imod->second; 00209 if(mod->rechit_size>0){ 00210 mod->rechit_start=rd_pointer; rd_pointer = rd_pointer + mod->rechit_size; 00211 int rt = rtemp.size(); 00212 for(int i =0;i<rt;i++){ 00213 std::pair<const GeomDetUnit*, std::pair<LocalPoint, const GeomDetUnit* > > pxd = rtemp[i]; 00214 const GeomDetUnit * geomdet = pxd.first; 00215 if (geomdet==mod->detUnit)rdigi.push_back(pxd.second); 00216 } 00217 } 00218 } 00219 } 00220 } 00221 } 00222 norechits=true; 00223 edm::Handle<SiPixelRecHitCollection> rechitspixel; 00224 if(pixelrechitProducerName!="ignore"){ 00225 std::vector< edm::Handle<SiPixelRecHitCollection> > pixelrechit_collections; 00226 ModuleLabelSelector sel(pixelrechitProducerName); 00227 event.getMany (sel, pixelrechit_collections); 00228 if (! pixelrechit_collections.empty ())norechits=false; 00229 if(norechits) cout << "no pixelrechits type "<<pixelrechitProducerName<<" in event" << endl; 00230 if(!norechits){ 00231 std::vector< edm::Handle<SiPixelRecHitCollection> >::iterator i; 00232 i = pixelrechit_collections.begin (); 00233 const SiPixelRecHitCollection&rechitspixel = *(*i); 00234 if(rechitspixel.size()>0){ 00235 std::vector<std::pair<const GeomDetUnit *,std::pair<LocalPoint, const GeomDetUnit* > > > rtemp; 00236 const std::vector<DetId> detIDs3 = rechitspixel.ids(); 00237 for ( std::vector<DetId>::const_iterator detunit_iterator = detIDs3.begin(); detunit_iterator != detIDs3.end(); detunit_iterator++ ) 00238 { 00239 unsigned int id = (*detunit_iterator).rawId(); 00240 if(id!=999999999){ //if is valid detector 00241 DetId detIdObject(id); 00242 const GeomDetUnit * geoUnit = geom->idToDetUnit( detIdObject ); 00243 VisCuTkModule * mod = VisCuTkModuleMap::moduleMap[geoUnit]; 00244 SiPixelRecHitCollection::range rechitRange = rechitspixel.get((*detunit_iterator)); 00245 SiPixelRecHitCollection::const_iterator rechitRangeIteratorBegin = rechitRange.first; 00246 SiPixelRecHitCollection::const_iterator rechitRangeIteratorEnd = rechitRange.second; 00247 SiPixelRecHitCollection::const_iterator iter=rechitRangeIteratorBegin; 00248 00249 for(iter=rechitRangeIteratorBegin;iter!=rechitRangeIteratorEnd;++iter){//loop on the rechit 00250 LocalPoint position=iter->localPosition(); 00251 std::pair<const GeomDetUnit*, std::pair<LocalPoint, const GeomDetUnit* > > pxd; 00252 pxd.first = geoUnit; 00253 pxd.second.first = position; 00254 pxd.second.second = geoUnit; 00255 rtemp.push_back(pxd); 00256 if(mod){ mod->rechit_size++; } else cout << "module not found " << endl; 00257 } 00258 } 00259 } 00260 cout << rtemp.size() << " pixel rechits " << endl; 00261 std::map<const GeomDetUnit * , VisCuTkModule *>::iterator imod; 00262 for (imod=VisCuTkModuleMap::moduleMap.begin();imod != VisCuTkModuleMap::moduleMap.end(); imod++){ 00263 VisCuTkModule* mod = imod->second; 00264 unsigned int detType = mod->detUnit->geographicalId().subdetId(); 00265 if(detType<3 && mod->rechit_size>0){ 00266 mod->rechit_start=rd_pointer; rd_pointer = rd_pointer + mod->rechit_size; 00267 int rt = rtemp.size(); 00268 for(int i =0;i<rt;i++){ 00269 std::pair<const GeomDetUnit*, std::pair<LocalPoint, const GeomDetUnit* > > pxd = rtemp[i]; 00270 const GeomDetUnit * geomdet = pxd.first; 00271 if (geomdet==mod->detUnit)rdigi.push_back(pxd.second); 00272 } 00273 } 00274 } 00275 } 00276 } 00277 } 00278 }
void VisCuTrackerRecHit::setMap | ( | VisCuTkMap2D * | m | ) | [inline] |
Definition at line 33 of file VisCuTrackerRecHit.h.
Referenced by VisCuTkMapWindow::VisCuTkMapWindow().
00033 {map=m;};
void VisCuTrackerRecHit::setTracker | ( | VisCuCmsTracker * | tr | ) | [inline] |
Definition at line 31 of file VisCuTrackerRecHit.h.
References tracker.
Referenced by VisCuTkGeometryTwig::onNewEvent().
00031 {tracker=tr;};
SoSeparator * VisCuTrackerRecHit::update | ( | VisTrackingGeometry::DetectorRep | type | ) |
Definition at line 280 of file VisCuTrackerRecHit.cc.
References begin, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), VisCuTkModule::isVisible(), mod(), VisCuTkModuleMap::moduleMap, rdigi, VisCuTkModule::rechit_size, VisCuTkModule::rechit_start, VisTrackingGeometry::RZDet, edm::second(), funct::sqrt(), x, y, and z.
Referenced by VisCuTkGeometryTwig::update().
00281 { 00282 00283 SoSeparator *sep = new SoSeparator; 00284 if (! rdigi.empty ()) 00285 { 00286 00287 00288 00289 SoMaterial *mat = new SoMaterial; 00290 mat->diffuseColor.setValue (1.0, 0.0, 0.0);//red 00291 mat->emissiveColor.setValue(1.0, 0.0, 0.0); 00292 00293 SoDrawStyle *drawStyle = new SoDrawStyle; 00294 drawStyle->pointSize = 4.0; 00295 00296 // global 00297 sep->addChild (mat); 00298 sep->addChild (drawStyle); 00299 00300 try 00301 { 00302 SoVertexProperty *vertices = new SoVertexProperty; 00303 int nVrtx = 0; 00304 std::map<const GeomDetUnit * , VisCuTkModule *>::iterator imod; 00305 for (imod=VisCuTkModuleMap::moduleMap.begin();imod != VisCuTkModuleMap::moduleMap.end(); imod++){ 00306 VisCuTkModule* mod = imod->second; 00307 if(mod->rechit_size>0){ 00308 if(mod->isVisible()){ 00309 for(int idigi=mod->rechit_start;idigi!=(mod->rechit_start+mod->rechit_size);idigi++){ 00310 LocalPoint point = rdigi[idigi].first; 00311 float x = rdigi[idigi].second->surface().toGlobal(point).x()/100; 00312 float y; 00313 if(type==RZDet){ 00314 x=0.0; 00315 y = sqrt(rdigi[idigi].second->surface().toGlobal(point).x()*rdigi[idigi].second->surface().toGlobal(point).x()+rdigi[idigi].second->surface().toGlobal(point).y()*rdigi[idigi].second->surface().toGlobal(point).y()) / 100.0; if(rdigi[idigi].second->surface().toGlobal(point).y()< 0. )y = - y;} else y = rdigi[idigi].second->surface().toGlobal(point).y()/100; 00316 float z = rdigi[idigi].second->surface().toGlobal(point).z()/100; 00317 vertices->vertex.set1Value (nVrtx++, SbVec3f (x, y, z)); 00318 } 00319 }//if mod is visible 00320 }// if rechits in module 00321 }//loop on modules 00322 00323 vertices->vertex.setNum (nVrtx); 00324 SoPointSet *points = new SoPointSet; 00325 points->vertexProperty.setValue (vertices); 00326 points->numPoints.setValue (nVrtx); 00327 00328 sep->addChild (points); 00329 } 00330 catch (...) 00331 { 00332 std::cout << "No Rechits" << std::endl; 00333 } 00334 } 00335 return sep; 00336 00337 }
std::string VisCuTrackerRecHit::updatetext | ( | VisCuTkModule * | mod | ) |
Definition at line 518 of file VisCuTrackerRecHit.cc.
References rdigi, VisCuTkModule::rechit_size, VisCuTkModule::rechit_start, x, y, and z.
Referenced by VisCuTkGeometryTwig::update().
00519 { 00520 std::ostringstream text; 00521 if(mod->rechit_size>0){ 00522 int nrechit=0; 00523 text << mod->rechit_size << " rechit : --------------------------------------- <p>" ; 00524 for(int idigi=mod->rechit_start;idigi!=(mod->rechit_start+mod->rechit_size);idigi++){ 00525 LocalPoint point = rdigi[idigi].first; 00526 float x = rdigi[idigi].second->surface().toGlobal(point).x()/100; 00527 float y = rdigi[idigi].second->surface().toGlobal(point).y()/100; 00528 float z = rdigi[idigi].second->surface().toGlobal(point).z()/100; 00529 text << " Number=" << nrechit++ 00530 << " Position=" << x << ", " << y << ", " << z << "<p>"; 00531 } 00532 text << " -----------------------------" ; 00533 } 00534 return text.str(); 00535 }
bool VisCuTrackerRecHit::firsteventloaded [private] |
Definition at line 39 of file VisCuTrackerRecHit.h.
Referenced by drawrechit(), setEvent(), and VisCuTrackerRecHit().
edm::ESHandle<TrackerGeometry> VisCuTrackerRecHit::geom [private] |
bool VisCuTrackerRecHit::horizontal_view [private] |
Definition at line 39 of file VisCuTrackerRecHit.h.
Referenced by drawrechit(), and VisCuTrackerRecHit().
VisCuTkMap2D* VisCuTrackerRecHit::map [private] |
Definition at line 38 of file VisCuTrackerRecHit.h.
std::string VisCuTrackerRecHit::pixelrechitProducerName [private] |
Definition at line 43 of file VisCuTrackerRecHit.h.
Referenced by setEvent(), and VisCuTrackerRecHit().
std::vector<std::pair<LocalPoint, const GeomDetUnit* > > VisCuTrackerRecHit::rdigi [private] |
Definition at line 40 of file VisCuTrackerRecHit.h.
Referenced by drawrechit(), setEvent(), update(), and updatetext().
std::string VisCuTrackerRecHit::striprechitProducerName [private] |
Definition at line 42 of file VisCuTrackerRecHit.h.
Referenced by setEvent(), and VisCuTrackerRecHit().
VisCuCmsTracker* VisCuTrackerRecHit::tracker [private] |