CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
MeasurementTracker Class Reference

#include <MeasurementTracker.h>

Inheritance diagram for MeasurementTracker:
MeasurementDetSystem OnDemandMeasurementTracker

Public Types

typedef std::map< DetId,
MeasurementDet * > 
DetContainer
 
enum  QualityFlags {
  BadModules =1, BadAPVFibers =2, BadStrips =4, MaskBad128StripBlocks =8,
  BadROCs =2
}
 

Public Member Functions

const DetContainerallDets () const
 For debug only. More...
 
const GeometricSearchTrackergeometricSearchTracker () const
 
const TrackingGeometrygeomTracker () const
 
const std::vector
< TkGluedMeasurementDet * > & 
gluedDets () const
 
virtual const MeasurementDetidToDet (const DetId &id) const
 MeasurementDetSystem interface. More...
 
 MeasurementTracker (const edm::ParameterSet &conf, const PixelClusterParameterEstimator *pixelCPE, const StripClusterParameterEstimator *stripCPE, const SiStripRecHitMatcher *hitMatcher, const TrackerGeometry *trackerGeom, const GeometricSearchTracker *geometricSearchTracker, const SiStripQuality *stripQuality, int stripQualityFlags, int stripQualityDebugFlags, const SiPixelQuality *pixelQuality, const SiPixelFedCabling *pixelCabling, int pixelQualityFlags, int pixelQualityDebugFlags, bool isRegional=false)
 
const std::vector
< TkPixelMeasurementDet * > & 
pixelDets () const
 
void setClusterToSkip (const edm::InputTag &cluster, const edm::Event &event) const
 
const std::vector
< TkStripMeasurementDet * > & 
stripDets () const
 
void unsetClusterToSkip () const
 
virtual void update (const edm::Event &) const
 
void updatePixels (const edm::Event &) const
 
void updateStrips (const edm::Event &) const
 
virtual ~MeasurementTracker ()
 

Protected Member Functions

void addGluedDet (const GluedGeomDet *gd, const SiStripRecHitMatcher *matcher) const
 
void addPixelDet (const GeomDet *gd, const PixelClusterParameterEstimator *cpe) const
 
void addPixelDets (const TrackingGeometry::DetContainer &dets) const
 
void addStripDet (const GeomDet *gd, const StripClusterParameterEstimator *cpe) const
 
void addStripDets (const TrackingGeometry::DetContainer &dets) const
 
void getInactiveStrips (const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
 
void initialize () const
 
void initializePixelStatus (const SiPixelQuality *stripQuality, const SiPixelFedCabling *pixelCabling, int qualityFlags, int qualityDebugFlags) const
 
void initializeStripStatus (const SiStripQuality *stripQuality, int qualityFlags, int qualityDebugFlags) const
 

Protected Attributes

bool isRegional_
 
const std::string name_
 
const edm::ParameterSetpset_
 
bool selfUpdateSkipClusters_
 
DetContainer theDetMap
 
const GeometricSearchTrackertheGeometricSearchTracker
 
std::vector
< TkGluedMeasurementDet * > 
theGluedDets
 
const SiStripRecHitMatchertheHitMatcher
 
const std::vector< edm::InputTagtheInactivePixelDetectorLabels
 
const std::vector< edm::InputTagtheInactiveStripDetectorLabels
 
const SiPixelFedCablingthePixelCabling
 
const
PixelClusterParameterEstimator
thePixelCPE
 
std::vector
< TkPixelMeasurementDet * > 
thePixelDets
 
const
StripClusterParameterEstimator
theStripCPE
 
std::vector
< TkStripMeasurementDet * > 
theStripDets
 
const TrackerGeometrytheTrackerGeom
 

Detailed Description

Definition at line 40 of file MeasurementTracker.h.

Member Typedef Documentation

Definition at line 74 of file MeasurementTracker.h.

Member Enumeration Documentation

Enumerator
BadModules 
BadAPVFibers 
BadStrips 
MaskBad128StripBlocks 
BadROCs 

Definition at line 42 of file MeasurementTracker.h.

Constructor & Destructor Documentation

MeasurementTracker::MeasurementTracker ( const edm::ParameterSet conf,
const PixelClusterParameterEstimator pixelCPE,
const StripClusterParameterEstimator stripCPE,
const SiStripRecHitMatcher hitMatcher,
const TrackerGeometry trackerGeom,
const GeometricSearchTracker geometricSearchTracker,
const SiStripQuality stripQuality,
int  stripQualityFlags,
int  stripQualityDebugFlags,
const SiPixelQuality pixelQuality,
const SiPixelFedCabling pixelCabling,
int  pixelQualityFlags,
int  pixelQualityDebugFlags,
bool  isRegional = false 
)

Definition at line 86 of file MeasurementTracker.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), initialize(), initializePixelStatus(), initializeStripStatus(), LogDebug, selfUpdateSkipClusters_, and createPayload::skip.

99  :
100  pset_(conf),
101  name_(conf.getParameter<std::string>("ComponentName")),
102  thePixelCPE(pixelCPE),theStripCPE(stripCPE),theHitMatcher(hitMatcher),
103  theTrackerGeom(trackerGeom),theGeometricSearchTracker(geometricSearchTracker),
104  theInactivePixelDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactivePixelDetectorLabels")),
105  theInactiveStripDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactiveStripDetectorLabels")),
106  isRegional_(isRegional)
107 {
108  this->initialize();
109  this->initializeStripStatus(stripQuality, stripQualityFlags, stripQualityDebugFlags);
110  this->initializePixelStatus(pixelQuality, pixelCabling, pixelQualityFlags, pixelQualityDebugFlags);
111  //the measurement tracking is set to skip clusters, the other option is set from outside
112  selfUpdateSkipClusters_=conf.exists("skipClusters");
114  {
115  edm::InputTag skip=conf.getParameter<edm::InputTag>("skipClusters");
116  if (skip==edm::InputTag("")) selfUpdateSkipClusters_=false;
117  }
118 
119  LogDebug("MeasurementTracker")<<"skipping clusters: "<<selfUpdateSkipClusters_;
120 }
#define LogDebug(id)
T getParameter(std::string const &) const
const std::vector< edm::InputTag > theInactiveStripDetectorLabels
const GeometricSearchTracker * theGeometricSearchTracker
const TrackerGeometry * theTrackerGeom
bool exists(std::string const &parameterName) const
checks if a parameter exists
const StripClusterParameterEstimator * theStripCPE
const edm::ParameterSet & pset_
const SiStripRecHitMatcher * theHitMatcher
void initializeStripStatus(const SiStripQuality *stripQuality, int qualityFlags, int qualityDebugFlags) const
const std::vector< edm::InputTag > theInactivePixelDetectorLabels
const std::string name_
const PixelClusterParameterEstimator * thePixelCPE
void initializePixelStatus(const SiPixelQuality *stripQuality, const SiPixelFedCabling *pixelCabling, int qualityFlags, int qualityDebugFlags) const
MeasurementTracker::~MeasurementTracker ( )
virtual

Definition at line 122 of file MeasurementTracker.cc.

123 {
124  for(vector<TkPixelMeasurementDet*>::const_iterator it=thePixelDets.begin(); it!=thePixelDets.end(); ++it){
125  delete *it;
126  }
127 
128  for(vector<TkStripMeasurementDet*>::const_iterator it=theStripDets.begin(); it!=theStripDets.end(); ++it){
129  delete *it;
130  }
131 
132  for(vector<TkGluedMeasurementDet*>::const_iterator it=theGluedDets.begin(); it!=theGluedDets.end(); ++it){
133  delete *it;
134  }
135 }
std::vector< TkStripMeasurementDet * > theStripDets
std::vector< TkGluedMeasurementDet * > theGluedDets
std::vector< TkPixelMeasurementDet * > thePixelDets

Member Function Documentation

void MeasurementTracker::addGluedDet ( const GluedGeomDet gd,
const SiStripRecHitMatcher matcher 
) const
protected

Definition at line 208 of file MeasurementTracker.cc.

References GeomDet::geographicalId(), GluedGeomDet::monoDet(), and GluedGeomDet::stereoDet().

210 {
211  const MeasurementDet* monoDet = idToDet( gd->monoDet()->geographicalId());
212  if (monoDet == 0) {
213  addStripDet(gd->monoDet(), theStripCPE); // in case glued det comes before components
214  monoDet = idToDet( gd->monoDet()->geographicalId());
215  }
216 
217  const MeasurementDet* stereoDet = idToDet( gd->stereoDet()->geographicalId());
218  if (stereoDet == 0) {
219  addStripDet(gd->stereoDet(), theStripCPE); // in case glued det comes before components
220  stereoDet = idToDet( gd->stereoDet()->geographicalId());
221  }
222 
223  if (monoDet == 0 || stereoDet == 0) {
224  edm::LogError("MeasurementDet") << "MeasurementTracker ERROR: GluedDet components not found as MeasurementDets ";
225  throw MeasurementDetException("MeasurementTracker ERROR: GluedDet components not found as MeasurementDets");
226  }
227 
229  monoDet, stereoDet);
230  theGluedDets.push_back( det);
231  theDetMap[gd->geographicalId()] = det;
232 }
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
const StripClusterParameterEstimator * theStripCPE
std::vector< TkGluedMeasurementDet * > theGluedDets
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:74
virtual const MeasurementDet * idToDet(const DetId &id) const
MeasurementDetSystem interface.
const SiStripRecHitMatcher * theHitMatcher
void addStripDet(const GeomDet *gd, const StripClusterParameterEstimator *cpe) const
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
void MeasurementTracker::addPixelDet ( const GeomDet gd,
const PixelClusterParameterEstimator cpe 
) const
protected

Definition at line 200 of file MeasurementTracker.cc.

References GeomDet::geographicalId().

202 {
203  TkPixelMeasurementDet* det = new TkPixelMeasurementDet( gd, cpe);
204  thePixelDets.push_back(det);
205  theDetMap[gd->geographicalId()] = det;
206 }
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:74
std::vector< TkPixelMeasurementDet * > thePixelDets
void MeasurementTracker::addPixelDets ( const TrackingGeometry::DetContainer dets) const
protected

Definition at line 154 of file MeasurementTracker.cc.

155 {
156  for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
157  gd != dets.end(); gd++) {
158  addPixelDet(*gd, thePixelCPE);
159  }
160 }
void addPixelDet(const GeomDet *gd, const PixelClusterParameterEstimator *cpe) const
const PixelClusterParameterEstimator * thePixelCPE
void MeasurementTracker::addStripDet ( const GeomDet gd,
const StripClusterParameterEstimator cpe 
) const
protected

Definition at line 187 of file MeasurementTracker.cc.

References GeomDet::geographicalId(), and cms::Exception::what().

189 {
190  try {
192  theStripDets.push_back(det);
193  theDetMap[gd->geographicalId()] = det;
194  }
195  catch(MeasurementDetException& err){
196  edm::LogError("MeasurementDet") << "Oops, got a MeasurementDetException: " << err.what() ;
197  }
198 }
virtual char const * what() const
Definition: Exception.cc:97
std::vector< TkStripMeasurementDet * > theStripDets
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:74
void MeasurementTracker::addStripDets ( const TrackingGeometry::DetContainer dets) const
protected

Definition at line 162 of file MeasurementTracker.cc.

163 {
164  for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
165  gd != dets.end(); gd++) {
166 
167  const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(*gd);
168 
169  // StripSubdetector stripId( (**gd).geographicalId());
170  // bool isDetUnit( gdu != 0);
171  // cout << "StripSubdetector glued? " << stripId.glued()
172  // << " is DetUnit? " << isDetUnit << endl;
173 
174  if (gdu != 0) {
175  addStripDet(*gd, theStripCPE);
176  }
177  else {
178  const GluedGeomDet* gluedDet = dynamic_cast<const GluedGeomDet*>(*gd);
179  if (gluedDet == 0) {
180  throw MeasurementDetException("MeasurementTracker ERROR: GeomDet neither DetUnit nor GluedDet");
181  }
182  addGluedDet(gluedDet, theHitMatcher);
183  }
184  }
185 }
const StripClusterParameterEstimator * theStripCPE
void addGluedDet(const GluedGeomDet *gd, const SiStripRecHitMatcher *matcher) const
const SiStripRecHitMatcher * theHitMatcher
void addStripDet(const GeomDet *gd, const StripClusterParameterEstimator *cpe) const
const DetContainer& MeasurementTracker::allDets ( ) const
inline

For debug only.

Definition at line 77 of file MeasurementTracker.h.

References theDetMap.

77 {return theDetMap;}
const GeometricSearchTracker* MeasurementTracker::geometricSearchTracker ( ) const
inline
const TrackingGeometry* MeasurementTracker::geomTracker ( ) const
inline
void MeasurementTracker::getInactiveStrips ( const edm::Event event,
std::vector< uint32_t > &  rawInactiveDetIds 
) const
protected

Definition at line 380 of file MeasurementTracker.cc.

References python.multivaluedict::sort().

Referenced by OnDemandMeasurementTracker::updateStrips().

381  {
382  if (!theInactiveStripDetectorLabels.empty()) {
384  for (std::vector<edm::InputTag>::const_iterator itt = theInactiveStripDetectorLabels.begin(), edt = theInactiveStripDetectorLabels.end();
385  itt != edt; ++itt) {
386  event.getByLabel(*itt, detIds);
387  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
388  }
389  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
390  }
391 }
const std::vector< edm::InputTag > theInactiveStripDetectorLabels
const std::vector<TkGluedMeasurementDet*>& MeasurementTracker::gluedDets ( ) const
inline

Definition at line 80 of file MeasurementTracker.h.

References theGluedDets.

80 {return theGluedDets;}
std::vector< TkGluedMeasurementDet * > theGluedDets
const MeasurementDet * MeasurementTracker::idToDet ( const DetId id) const
virtual

MeasurementDetSystem interface.

Implements MeasurementDetSystem.

Reimplemented in OnDemandMeasurementTracker.

Definition at line 559 of file MeasurementTracker.cc.

Referenced by MuonRoadTrajectoryBuilder::GatherHits().

560 {
561  std::map<DetId,MeasurementDet*>::const_iterator it = theDetMap.find(id);
562  if(it !=theDetMap.end()) {
563  return it->second;
564  }else{
565  //throw exception;
566  }
567 
568  return 0; //to avoid compile warning
569 }
void MeasurementTracker::initialize ( ) const
protected

Definition at line 138 of file MeasurementTracker.cc.

Referenced by MeasurementTracker().

139 {
146 
147  sortTKD(theStripDets);
148  sortTKD(thePixelDets);
149  sortTKD(theGluedDets);
150 
151 }
std::vector< TkStripMeasurementDet * > theStripDets
const TrackerGeometry * theTrackerGeom
std::vector< TkGluedMeasurementDet * > theGluedDets
const DetContainer & detsTEC() const
const DetContainer & detsPXB() const
std::vector< TkPixelMeasurementDet * > thePixelDets
const DetContainer & detsTIB() const
const DetContainer & detsPXF() const
const DetContainer & detsTOB() const
void addStripDets(const TrackingGeometry::DetContainer &dets) const
void addPixelDets(const TrackingGeometry::DetContainer &dets) const
const DetContainer & detsTID() const
void MeasurementTracker::initializePixelStatus ( const SiPixelQuality stripQuality,
const SiPixelFedCabling pixelCabling,
int  qualityFlags,
int  qualityDebugFlags 
) const
protected

Definition at line 649 of file MeasurementTracker.cc.

References cond::rpcobgas::detid, SiPixelQuality::getBadRocPositions(), SiPixelQuality::getBadRocs(), i, and SiPixelQuality::IsModuleUsable().

Referenced by MeasurementTracker().

649  {
650  if ((quality != 0) && (qualityFlags != 0)) {
651  edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
652  unsigned int on = 0, tot = 0, badrocs = 0;
653  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
654  i!=thePixelDets.end(); i++) {
655  uint32_t detid = ((**i).geomDet().geographicalId()).rawId();
656  if (qualityFlags & BadModules) {
657  bool isOn = quality->IsModuleUsable(detid);
658  (*i)->setActive(isOn);
659  tot++; on += (unsigned int) isOn;
660  if (qualityDebugFlags & BadModules) {
661  edm::LogInfo("MeasurementTracker")<< "MeasurementTracker::initializePixelStatus : detid " << detid << " is " << (isOn ? "on" : "off");
662  }
663  } else {
664  (*i)->setActive(true);
665  }
666  if ((qualityFlags & BadROCs) && (quality->getBadRocs(detid) != 0)) {
667  std::vector<LocalPoint> badROCs = quality->getBadRocPositions(detid, *theTrackerGeom, pixelCabling);
668  badrocs += badROCs.size();
669  (*i)->setBadRocPositions(badROCs);
670  } else {
671  (*i)->clearBadRocPositions();
672  }
673  }
674  if (qualityDebugFlags & BadModules) {
675  edm::LogInfo("MeasurementTracker PixelModuleStatus") <<
676  " Total modules: " << tot << ", active " << on <<", inactive " << (tot - on);
677  }
678  if (qualityDebugFlags & BadROCs) {
679  edm::LogInfo("MeasurementTracker PixelROCStatus") << " Total of bad ROCs: " << badrocs ;
680  }
681  } else {
682  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
683  i!=thePixelDets.end(); i++) {
684  (*i)->setActive(true); // module ON
685  }
686  }
687 }
int i
Definition: DBlmapReader.cc:9
const TrackerGeometry * theTrackerGeom
std::vector< TkPixelMeasurementDet * > thePixelDets
void MeasurementTracker::initializeStripStatus ( const SiStripQuality stripQuality,
int  qualityFlags,
int  qualityDebugFlags 
) const
protected

Definition at line 571 of file MeasurementTracker.cc.

References SiStripBadStrip::decode(), cond::rpcobgas::detid, SiStripQuality::getBadApvs(), SiStripQuality::getBadFibers(), edm::ParameterSet::getParameter(), SiStripBadStrip::getRange(), i, SiStripQuality::IsModuleUsable(), j, SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, and SiStripDetId::TOB.

Referenced by MeasurementTracker().

571  {
572  TkStripMeasurementDet::BadStripCuts badStripCuts[4];
573  if (qualityFlags & BadStrips) {
574  edm::ParameterSet cutPset = pset_.getParameter<edm::ParameterSet>("badStripCuts");
579  }
580 
581  if ((quality != 0) && (qualityFlags != 0)) {
582  edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
583  unsigned int on = 0, tot = 0;
584  unsigned int foff = 0, ftot = 0, aoff = 0, atot = 0;
585  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
586  i!=theStripDets.end(); i++) {
587  uint32_t detid = ((**i).geomDet().geographicalId()).rawId();
588  if (qualityFlags & BadModules) {
589  bool isOn = quality->IsModuleUsable(detid);
590  (*i)->setActive(isOn);
591  tot++; on += (unsigned int) isOn;
592  if (qualityDebugFlags & BadModules) {
593  edm::LogInfo("MeasurementTracker")<< "MeasurementTracker::initializeStripStatus : detid " << detid << " is " << (isOn ? "on" : "off");
594  }
595  } else {
596  (*i)->setActive(true);
597  }
598  // first turn all APVs and fibers ON
599  (*i)->set128StripStatus(true);
600  if (qualityFlags & BadAPVFibers) {
601  short badApvs = quality->getBadApvs(detid);
602  short badFibers = quality->getBadFibers(detid);
603  for (int j = 0; j < 6; j++) {
604  atot++;
605  if (badApvs & (1 << j)) {
606  (*i)->set128StripStatus(false, j);
607  aoff++;
608  }
609  }
610  for (int j = 0; j < 3; j++) {
611  ftot++;
612  if (badFibers & (1 << j)) {
613  (*i)->set128StripStatus(false, 2*j);
614  (*i)->set128StripStatus(false, 2*j+1);
615  foff++;
616  }
617  }
618  (*i)->setMaskBad128StripBlocks((qualityFlags & MaskBad128StripBlocks) != 0);
619  }
620  std::vector<TkStripMeasurementDet::BadStripBlock> &badStrips = (*i)->getBadStripBlocks();
621  badStrips.clear();
622  if (qualityFlags & BadStrips) {
623  SiStripBadStrip::Range range = quality->getRange(detid);
624  for (SiStripBadStrip::ContainerIterator bit = range.first; bit != range.second; ++bit) {
625  badStrips.push_back(quality->decode(*bit));
626  }
627  (*i)->setBadStripCuts(badStripCuts[SiStripDetId(detid).subdetId()-3]);
628  }
629  }
630  if (qualityDebugFlags & BadModules) {
631  edm::LogInfo("MeasurementTracker StripModuleStatus") <<
632  " Total modules: " << tot << ", active " << on <<", inactive " << (tot - on);
633  }
634  if (qualityDebugFlags & BadAPVFibers) {
635  edm::LogInfo("MeasurementTracker StripAPVStatus") <<
636  " Total APVs: " << atot << ", active " << (atot-aoff) <<", inactive " << (aoff);
637  edm::LogInfo("MeasurementTracker StripFiberStatus") <<
638  " Total Fibers: " << ftot << ", active " << (ftot-foff) <<", inactive " << (foff);
639  }
640  } else {
641  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
642  i!=theStripDets.end(); i++) {
643  (*i)->setActive(true); // module ON
644  (*i)->set128StripStatus(true); // all APVs and fibers ON
645  }
646  }
647 }
std::vector< TkStripMeasurementDet * > theStripDets
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned int >::const_iterator ContainerIterator
int j
Definition: DBlmapReader.cc:9
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
const edm::ParameterSet & pset_
std::pair< ContainerIterator, ContainerIterator > Range
const std::vector<TkPixelMeasurementDet*>& MeasurementTracker::pixelDets ( ) const
inline

Definition at line 79 of file MeasurementTracker.h.

References thePixelDets.

79 {return thePixelDets;}
std::vector< TkPixelMeasurementDet * > thePixelDets
void MeasurementTracker::setClusterToSkip ( const edm::InputTag cluster,
const edm::Event event 
) const

Definition at line 254 of file MeasurementTracker.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::end(), f, i, and LogDebug.

Referenced by BaseCkfTrajectoryBuilder::setEvent().

255 {
256  LogDebug("MeasurementTracker")<<"setClusterToSkip";
258  edm::LogError("MeasurementTracker")<<"this mode of operation is not supported, either the measurement tracker is set to skip clusters, or is being told to skip clusters. not both";
259 
261  event.getByLabel(cluster,pixelClusterRefs);
262  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
263  i!=thePixelDets.end(); i++) {
264  edmNew::DetSetVector<SiPixelClusterRefNew>::const_iterator f=pixelClusterRefs->find((**i).geomDet().geographicalId().rawId());
265  if (f!=pixelClusterRefs->end())
266  (**i).setClusterToSkip(f->begin(),f->end());
267  else
268  (**i).unset();
269  }
270 
272  event.getByLabel(cluster,stripClusterRefs);
273  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
274  i!=theStripDets.end(); i++){
275  edmNew::DetSetVector<TkStripMeasurementDet::SiStripClusterRef>::const_iterator f=stripClusterRefs->find((**i).geomDet().geographicalId().rawId());
276  if (f!=stripClusterRefs->end())
277  (**i).setClusterToSkip(f->begin(),f->end());
278  else
279  (**i).unset();
280  }
281 }
#define LogDebug(id)
std::vector< TkStripMeasurementDet * > theStripDets
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
double f[11][100]
const_iterator end() const
std::vector< TkPixelMeasurementDet * > thePixelDets
const std::vector<TkStripMeasurementDet*>& MeasurementTracker::stripDets ( ) const
inline

Definition at line 78 of file MeasurementTracker.h.

References theStripDets.

78 {return theStripDets;}
std::vector< TkStripMeasurementDet * > theStripDets
void MeasurementTracker::unsetClusterToSkip ( ) const

Definition at line 283 of file MeasurementTracker.cc.

References i, and LogDebug.

Referenced by BaseCkfTrajectoryBuilder::unset().

283  {
284  LogDebug("MeasurementTracker")<<"unsetClusterToSkip";
286  edm::LogError("MeasurementTracker")<<"this mode of operation is not supported, either the measurement tracker is set to skip clusters, or is being told to skip clusters. not both";
287 
288  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
289  i!=thePixelDets.end(); i++) {
290  (**i).unset();
291  }
292  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
293  i!=theStripDets.end(); i++){
294  (**i).unset();
295  }
296 }
#define LogDebug(id)
std::vector< TkStripMeasurementDet * > theStripDets
int i
Definition: DBlmapReader.cc:9
std::vector< TkPixelMeasurementDet * > thePixelDets
void MeasurementTracker::update ( const edm::Event event) const
virtual

Reimplemented in OnDemandMeasurementTracker.

Definition at line 234 of file MeasurementTracker.cc.

Referenced by python.Vispa.Gui.VispaWidget.VispaWidget::autosize(), python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), python.Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), python.Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), python.Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), python.Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), python.Vispa.Gui.FindDialog.FindDialog::reset(), RoadSearchTrackCandidateMakerAlgorithm::run(), SiStripElectronSeedGenerator::run(), python.Vispa.Gui.PortConnection.PointToPointConnection::select(), python.Vispa.Gui.VispaWidget.VispaWidget::select(), python.Vispa.Views.LineDecayView.LineDecayContainer::select(), ConversionTrackFinder::setEvent(), MuonRoadTrajectoryBuilder::setEvent(), BaseCkfTrajectoryBuilder::setEvent(), ConversionSeedFinder::setEvent(), NuclearInteractionFinder::setEvent(), python.Vispa.Gui.VispaWidget.VispaWidget::setText(), python.Vispa.Gui.VispaWidget.VispaWidget::setTitle(), python.Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), python.Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection(), MultiRecHitCollector::updateEvent(), and MultiTrackFilterHitCollector::updateEvent().

235 {
236  updatePixels(event);
237  updateStrips(event);
238 
239  /*
240  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
241  i!=theStripDets.end(); i++) {
242  if( (*i)->isEmpty()){
243  std::cout << "stripDet id, #hits: "
244  << (*i)->geomDet().geographicalId().rawId() << " , "
245  << 0 << std::endl;
246  }else{
247  std::cout << "stripDet id, #hits: "
248  << (*i)->geomDet().geographicalId().rawId() << " , "
249  << (*i)->size() << std::endl;
250  }
251  }
252  */
253 }
void updateStrips(const edm::Event &) const
void updatePixels(const edm::Event &) const
void MeasurementTracker::updatePixels ( const edm::Event event) const

Definition at line 298 of file MeasurementTracker.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::empty(), edmNew::DetSetVector< T >::end(), f, edm::HandleBase::failedToGet(), edmNew::DetSetVector< T >::find(), i, LogDebug, edm::Handle< T >::product(), and python.multivaluedict::sort().

Referenced by OnDemandMeasurementTracker::update().

299 {
300  // avoid to update twice from the same event
301  if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTracker::updatePixels::"+name_)) return;
302 
303  typedef edmNew::DetSet<SiPixelCluster> PixelDetSet;
304 
305  bool switchOffPixelsIfEmpty = (!pset_.existsAs<bool>("switchOffPixelsIfEmpty")) ||
306  (pset_.getParameter<bool>("switchOffPixelsIfEmpty"));
307 
308  std::vector<uint32_t> rawInactiveDetIds;
309  if (!theInactivePixelDetectorLabels.empty()) {
311  for (std::vector<edm::InputTag>::const_iterator itt = theInactivePixelDetectorLabels.begin(), edt = theInactivePixelDetectorLabels.end();
312  itt != edt; ++itt) {
313  event.getByLabel(*itt, detIds);
314  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
315  }
316  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
317  }
318  // Pixel Clusters
319  std::string pixelClusterProducer = pset_.getParameter<std::string>("pixelClusterProducer");
320  if( pixelClusterProducer.empty() ) { //clusters have not been produced
321  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
322  i!=thePixelDets.end(); i++) {
323  if (switchOffPixelsIfEmpty) {
324  (**i).setActiveThisEvent(false);
325  }else{
326  (**i).setEmpty();
327  }
328  }
329  }else{
330 
333  //and get the collection of pixel ref to skip
334  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),pixelClusterRefs);
335  LogDebug("MeasurementTracker")<<"getting pxl refs to skip";
336  if (pixelClusterRefs.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the pixel clusters to skip";
337  }
338 
340  event.getByLabel(pixelClusterProducer, pixelClusters);
341  const edmNew::DetSetVector<SiPixelCluster>* pixelCollection = pixelClusters.product();
342 
343  if (switchOffPixelsIfEmpty && pixelCollection->empty()) {
344  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
345  i!=thePixelDets.end(); i++) {
346  (**i).setActiveThisEvent(false);
347  }
348  } else {
349 
350  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
351  i!=thePixelDets.end(); i++) {
352 
353  // foreach det get cluster range
354  unsigned int id = (**i).geomDet().geographicalId().rawId();
355  if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
356  (**i).setActiveThisEvent(false); continue;
357  }
358  //FIXME
359  //fill the set with what needs to be skipped
361  if ( it != pixelCollection->end() ){
362  // push cluster range in det
363  (**i).update( *it, pixelClusters, id );
366  if (f!=pixelClusterRefs->end())
367  (**i).setClusterToSkip(f->begin(),f->end());
368  }
369  }else{
370  (**i).setEmpty();
371  }
372  }
373  }
374  }
375 
376 
377 
378 }
#define LogDebug(id)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:181
const_iterator find(id_type i) const
double f[11][100]
const_iterator end() const
std::vector< TkPixelMeasurementDet * > thePixelDets
bool failedToGet() const
Definition: HandleBase.h:80
const edm::ParameterSet & pset_
T const * product() const
Definition: Handle.h:74
const std::vector< edm::InputTag > theInactivePixelDetectorLabels
const std::string name_
void MeasurementTracker::updateStrips ( const edm::Event event) const

Definition at line 393 of file MeasurementTracker.cc.

References edm::RegionIndex< T >::begin(), edmNew::DetSetVector< T >::begin(), end, edm::RegionIndex< T >::end(), edmNew::DetSetVector< T >::end(), f, edm::HandleBase::failedToGet(), i, edmNew::DetSetVector< T >::id(), LogDebug, edm::Handle< T >::product(), TkStripMeasurementDet::setRegionalClustersToSkip(), and TkStripMeasurementDet::update().

Referenced by OnDemandMeasurementTracker::update().

394 {
395  // avoid to update twice from the same event
396  if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTracker::updateStrips::"+name_)) return;
397 
398  typedef edmNew::DetSet<SiStripCluster> StripDetSet;
399 
400  std::vector<uint32_t> rawInactiveDetIds;
401  getInactiveStrips(event,rawInactiveDetIds);
402 
403  // Strip Clusters
404  std::string stripClusterProducer = pset_.getParameter<std::string>("stripClusterProducer");
405  //first clear all of them
406 
407  {
408  std::vector<TkStripMeasurementDet*>::const_iterator end = theStripDets.end()-200;
409  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
410  i!=end; i++) {
411  (**i).setEmpty();
412 #ifdef __SSE2__
413  _mm_prefetch(((char *)(*(i+200))),_MM_HINT_T0);
414 #endif
415  }
416  for (std::vector<TkStripMeasurementDet*>::const_iterator i=end;
417  i!=theStripDets.end(); i++)
418  (**i).setEmpty();
419  }
420  if( !stripClusterProducer.compare("") ) { //clusters have not been produced
421  }else{
422  //========= actually load cluster =============
423  if(!isRegional_){
426  //and get the collection of pixel ref to skip
427  LogDebug("MeasurementTracker")<<"getting strp refs to skip";
428  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),stripClusterRefs);
429  if (stripClusterRefs.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
430  }
431 
433  event.getByLabel(stripClusterProducer, clusterHandle);
434  const edmNew::DetSetVector<SiStripCluster>* clusterCollection = clusterHandle.product();
435 
436  std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
437  std::vector<TkStripMeasurementDet*>::const_iterator endDet=theStripDets.end();
438  edmNew::DetSetVector<SiStripCluster>::const_iterator it = (*clusterCollection).begin();
439  edmNew::DetSetVector<SiStripCluster>::const_iterator endColl = (*clusterCollection).end();
440  // cluster and det and in order (both) and unique so let's use set intersection
441  for (;it!=endColl; ++it) {
442  StripDetSet detSet = *it;
443  unsigned int id = detSet.id();
444  while ( id != (**i).rawId()) { // eventually change to lower_range
445  ++i;
446  if (i==endDet) throw "we have a problem!!!!";
447  }
448 
449  if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
450  (**i).setActiveThisEvent(false); continue;
451  }
452  // push cluster range in det
453 
454  (**i).update( detSet, clusterHandle, id );
457  if (f!=stripClusterRefs->end())
458  (**i).setClusterToSkip(f->begin(),f->end());
459  }
460  }
461  }else{
462 
465  LogDebug("MeasurementTracker")<<"getting reg strp refs to skip";
466  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),stripClusterRefs);
467  if (stripClusterRefs.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
468  }
469 
470  //then set the not-empty ones only
472  event.getByLabel(stripClusterProducer, refClusterHandle);
473 
474  std::string lazyGetter = pset_.getParameter<std::string>("stripLazyGetterProducer");
476  event.getByLabel(lazyGetter,lazyClusterHandle);
477 
478  uint32_t tmpId=0;
479  vector<SiStripCluster>::const_iterator beginIterator;
480  edm::RefGetter<SiStripCluster>::const_iterator iregion = refClusterHandle->begin();
481  for(;iregion!=refClusterHandle->end();++iregion) {
482  const edm::RegionIndex<SiStripCluster>& region = *iregion;
483  vector<SiStripCluster>::const_iterator icluster = region.begin();
484  const vector<SiStripCluster>::const_iterator endIterator = region.end();
485  tmpId = icluster->geographicalId();
486  beginIterator = icluster;
487 
488  //std::cout << "== tmpId ad inizio loop dentro region: " << tmpId << std::endl;
489 
490  for (;icluster!=endIterator;icluster++) {
491  //std::cout << "===== cluster id,pos "
492  // << icluster->geographicalId() << " , " << icluster->barycenter()
493  // << std::endl;
494  //std::cout << "=====making ref in recHits() " << std::endl;
495  if( icluster->geographicalId() != tmpId){
496  //std::cout << "geo!=tmpId" << std::endl;
497  //we should find a way to avoid this casting. it is slow
498  //create also another map for TkStripMeasurementDet ??
499 
500  // the following castings are really ugly. To be corrected ASAP
501  const TkStripMeasurementDet* theConcreteDet =
502  dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
503 
504  if(theConcreteDet == 0)
505  throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
506  TkStripMeasurementDet* theConcreteDetUpdatable =
507  const_cast<TkStripMeasurementDet*>(theConcreteDet);
508  theConcreteDetUpdatable->update(beginIterator,icluster,lazyClusterHandle,tmpId);
511  if (f!=stripClusterRefs->end())
512  theConcreteDetUpdatable->setRegionalClustersToSkip(f->begin(),f->end());
513  }
514  //cannot we avoid to update the det with detId of itself??
515 
516  tmpId = icluster->geographicalId();
517  beginIterator = icluster;
518  if( icluster == (endIterator-1)){
519  const TkStripMeasurementDet* theConcreteDet =
520  dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
521 
522  if(theConcreteDet == 0)
523  throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
524  TkStripMeasurementDet* theConcreteDetUpdatable =
525  const_cast<TkStripMeasurementDet*>(theConcreteDet);
526  theConcreteDetUpdatable->update(icluster,endIterator,lazyClusterHandle,tmpId);
529  if (f!=stripClusterRefs->end())
530  theConcreteDetUpdatable->setRegionalClustersToSkip(f->begin(),f->end());
531  }
532  }
533  }else if( icluster == (endIterator-1)){
534  const TkStripMeasurementDet* theConcreteDet =
535  dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
536 
537  if(theConcreteDet == 0)
538  throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
539  TkStripMeasurementDet* theConcreteDetUpdatable =
540  const_cast<TkStripMeasurementDet*>(theConcreteDet);
541  //std::cout << "=== option3. fill det with id,#clust: " << tmpId << " , "
542  // << iregion->end() - beginIterator << std::endl;
543  theConcreteDetUpdatable->update(beginIterator,endIterator,lazyClusterHandle,tmpId);
546  if (f!=stripClusterRefs->end())
547  theConcreteDetUpdatable->setRegionalClustersToSkip(f->begin(),f->end());
548  }
549  }
550  }//end loop cluster in one ragion
551  }
552  }//end of block for updating with regional clusters
553  }
554 }
#define LogDebug(id)
std::vector< TkStripMeasurementDet * > theStripDets
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
void setRegionalClustersToSkip(IT begin, IT end)
const_iterator end() const
Get off the end iterator.
Definition: LazyGetter.h:189
id_type id(size_t cell) const
double f[11][100]
#define end
Definition: vmac.h:38
const_iterator end() const
const_iterator begin() const
Get begin iterator.
Definition: LazyGetter.h:180
void getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
void update(const detset &detSet, const edm::Handle< edmNew::DetSetVector< SiStripCluster > > h, unsigned int id)
bool failedToGet() const
Definition: HandleBase.h:80
Definition: DetId.h:20
boost::indirect_iterator< typename collection_type::const_iterator > const_iterator
Definition: RefGetter.h:25
virtual const MeasurementDet * idToDet(const DetId &id) const
MeasurementDetSystem interface.
const edm::ParameterSet & pset_
T const * product() const
Definition: Handle.h:74
const std::string name_

Member Data Documentation

bool MeasurementTracker::isRegional_
protected

Definition at line 104 of file MeasurementTracker.h.

const std::string MeasurementTracker::name_
protected

Definition at line 87 of file MeasurementTracker.h.

Referenced by OnDemandMeasurementTracker::updateStrips().

const edm::ParameterSet& MeasurementTracker::pset_
protected

Definition at line 86 of file MeasurementTracker.h.

Referenced by OnDemandMeasurementTracker::updateStrips().

bool MeasurementTracker::selfUpdateSkipClusters_
protected
DetContainer MeasurementTracker::theDetMap
mutableprotected
const GeometricSearchTracker* MeasurementTracker::theGeometricSearchTracker
protected

Definition at line 98 of file MeasurementTracker.h.

Referenced by geometricSearchTracker().

std::vector<TkGluedMeasurementDet*> MeasurementTracker::theGluedDets
mutableprotected

Definition at line 92 of file MeasurementTracker.h.

Referenced by gluedDets().

const SiStripRecHitMatcher* MeasurementTracker::theHitMatcher
protected

Definition at line 96 of file MeasurementTracker.h.

const std::vector<edm::InputTag> MeasurementTracker::theInactivePixelDetectorLabels
protected

Definition at line 101 of file MeasurementTracker.h.

const std::vector<edm::InputTag> MeasurementTracker::theInactiveStripDetectorLabels
protected
const SiPixelFedCabling* MeasurementTracker::thePixelCabling
protected

Definition at line 99 of file MeasurementTracker.h.

const PixelClusterParameterEstimator* MeasurementTracker::thePixelCPE
protected

Definition at line 94 of file MeasurementTracker.h.

std::vector<TkPixelMeasurementDet*> MeasurementTracker::thePixelDets
mutableprotected

Definition at line 91 of file MeasurementTracker.h.

Referenced by pixelDets().

const StripClusterParameterEstimator* MeasurementTracker::theStripCPE
protected

Definition at line 95 of file MeasurementTracker.h.

std::vector<TkStripMeasurementDet*> MeasurementTracker::theStripDets
mutableprotected

Definition at line 90 of file MeasurementTracker.h.

Referenced by stripDets().

const TrackerGeometry* MeasurementTracker::theTrackerGeom
protected

Definition at line 97 of file MeasurementTracker.h.

Referenced by geomTracker().