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
MeasurementTrackerImpl Class Reference

#include <MeasurementTrackerImpl.h>

Inheritance diagram for MeasurementTrackerImpl:
MeasurementTracker MeasurementDetSystem OnDemandMeasurementTracker

Public Types

typedef std::unordered_map
< unsigned int, MeasurementDet * > 
DetContainer
 
enum  QualityFlags {
  BadModules =1, BadAPVFibers =2, BadStrips =4, MaskBad128StripBlocks =8,
  BadROCs =2
}
 
- Public Types inherited from MeasurementTracker
enum  QualityFlags {
  BadModules =1, BadAPVFibers =2, BadStrips =4, MaskBad128StripBlocks =8,
  BadROCs =2
}
 

Public Member Functions

const DetContainerallDets () const
 For debug only. More...
 
TkStripMeasurementDet * concreteDetUpdatable (DetId id) const
 
const MeasurementDetfindDet (const DetId &id) const
 
const GeometricSearchTrackergeometricSearchTracker () const
 
const TrackingGeometrygeomTracker () const
 
const std::vector
< TkGluedMeasurementDet > & 
gluedDets () const
 
virtual const MeasurementDetidToDet (const DetId &id) const
 MeasurementDetSystem interface (can be overloaded!) More...
 
 MeasurementTrackerImpl (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 ~MeasurementTrackerImpl ()
 
- Public Member Functions inherited from MeasurementTracker
const GeometricSearchTrackergeometricSearchTracker () const
 
const TrackingGeometrygeomTracker () const
 
 MeasurementTracker (TrackerGeometry const *trackerGeom, GeometricSearchTracker const *geometricSearchTracker)
 
virtual ~MeasurementTracker ()
 

Protected Member Functions

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

Protected Attributes

const std::string name_
 
const edm::ParameterSetpset_
 
bool selfUpdateSkipClusters_
 
DetContainer theDetMap
 
std::vector
< TkGluedMeasurementDet > 
theGluedDets
 
const std::vector< edm::InputTagtheInactivePixelDetectorLabels
 
const std::vector< edm::InputTagtheInactiveStripDetectorLabels
 
const SiPixelFedCablingthePixelCabling
 
const
PixelClusterParameterEstimator
thePixelCPE
 
std::vector
< TkPixelMeasurementDet * > 
thePixelDets
 
std::vector< bool > thePixelsToSkip
 
StMeasurementDetSet theStDets
 
std::vector
< TkStripMeasurementDet > 
theStripDets
 
- Protected Attributes inherited from MeasurementTracker
const GeometricSearchTrackertheGeometricSearchTracker
 
const TrackerGeometrytheTrackerGeom
 

Detailed Description

Definition at line 44 of file MeasurementTrackerImpl.h.

Member Typedef Documentation

typedef std::unordered_map<unsigned int,MeasurementDet*> MeasurementTrackerImpl::DetContainer

Definition at line 97 of file MeasurementTrackerImpl.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

MeasurementTrackerImpl::MeasurementTrackerImpl ( 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 74 of file MeasurementTrackerImpl.cc.

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

87  :
88  MeasurementTracker(trackerGeom,geometricSearchTracker),
89  pset_(conf),
90  name_(conf.getParameter<std::string>("ComponentName")),
91  theStDets(hitMatcher,stripCPE,isRegional),
92  thePixelCPE(pixelCPE),
93  theInactivePixelDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactivePixelDetectorLabels")),
94  theInactiveStripDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactiveStripDetectorLabels"))
95 {
96  this->initialize();
97  this->initializeStripStatus(stripQuality, stripQualityFlags, stripQualityDebugFlags);
98  this->initializePixelStatus(pixelQuality, pixelCabling, pixelQualityFlags, pixelQualityDebugFlags);
99  //the measurement tracking is set to skip clusters, the other option is set from outside
100  selfUpdateSkipClusters_=conf.exists("skipClusters");
102  {
103  edm::InputTag skip=conf.getParameter<edm::InputTag>("skipClusters");
104  if (skip==edm::InputTag("")) selfUpdateSkipClusters_=false;
105  }
106 
107 
108  LogDebug("MeasurementTracker")<<"skipping clusters: "<<selfUpdateSkipClusters_;
109 }
#define LogDebug(id)
T getParameter(std::string const &) const
void initializeStripStatus(const SiStripQuality *stripQuality, int qualityFlags, int qualityDebugFlags)
bool exists(std::string const &parameterName) const
checks if a parameter exists
const std::vector< edm::InputTag > theInactiveStripDetectorLabels
const PixelClusterParameterEstimator * thePixelCPE
void initializePixelStatus(const SiPixelQuality *stripQuality, const SiPixelFedCabling *pixelCabling, int qualityFlags, int qualityDebugFlags)
const std::vector< edm::InputTag > theInactivePixelDetectorLabels
const edm::ParameterSet & pset_
MeasurementTracker(TrackerGeometry const *trackerGeom, GeometricSearchTracker const *geometricSearchTracker)
StMeasurementDetSet theStDets
MeasurementTrackerImpl::~MeasurementTrackerImpl ( )
virtual

Definition at line 111 of file MeasurementTrackerImpl.cc.

References thePixelDets.

112 {
113  for(vector<TkPixelMeasurementDet*>::const_iterator it=thePixelDets.begin(); it!=thePixelDets.end(); ++it){
114  delete *it;
115  }
116 
117 }
std::vector< TkPixelMeasurementDet * > thePixelDets

Member Function Documentation

void MeasurementTrackerImpl::addGluedDet ( const GluedGeomDet gd)
protected

Definition at line 199 of file MeasurementTrackerImpl.cc.

References StMeasurementDetSet::matcher(), StMeasurementDetSet::stripCPE(), theGluedDets, and theStDets.

Referenced by addStripDets().

200 {
201  theGluedDets.push_back(TkGluedMeasurementDet( gd, theStDets.matcher(), theStDets.stripCPE()));
202 }
const SiStripRecHitMatcher * matcher() const
const StripClusterParameterEstimator * stripCPE() const
std::vector< TkGluedMeasurementDet > theGluedDets
StMeasurementDetSet theStDets
void MeasurementTrackerImpl::addPixelDet ( const GeomDet gd,
const PixelClusterParameterEstimator cpe 
)
protected

Definition at line 190 of file MeasurementTrackerImpl.cc.

References GeomDet::geographicalId(), TkPixelMeasurementDet::setClusterToSkip(), theDetMap, thePixelDets, and thePixelsToSkip.

Referenced by addPixelDets().

192 {
193  TkPixelMeasurementDet* det = new TkPixelMeasurementDet( gd, cpe);
194  thePixelDets.push_back(det);
196  theDetMap[gd->geographicalId()] = det;
197 }
void setClusterToSkip(const std::vector< bool > *skip)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
std::vector< bool > thePixelsToSkip
std::vector< TkPixelMeasurementDet * > thePixelDets
void MeasurementTrackerImpl::addPixelDets ( const TrackingGeometry::DetContainer dets)
protected

Definition at line 147 of file MeasurementTrackerImpl.cc.

References addPixelDet(), and thePixelCPE.

Referenced by initialize().

148 {
149  for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
150  gd != dets.end(); gd++) {
151  addPixelDet(*gd, thePixelCPE);
152  }
153 }
const PixelClusterParameterEstimator * thePixelCPE
void addPixelDet(const GeomDet *gd, const PixelClusterParameterEstimator *cpe)
void MeasurementTrackerImpl::addStripDet ( const GeomDet gd)
protected

Definition at line 180 of file MeasurementTrackerImpl.cc.

References theStDets, theStripDets, and cms::Exception::what().

Referenced by addStripDets().

181 {
182  try {
183  theStripDets.push_back(TkStripMeasurementDet( gd, theStDets));
184  }
185  catch(MeasurementDetException& err){
186  edm::LogError("MeasurementDet") << "Oops, got a MeasurementDetException: " << err.what() ;
187  }
188 }
virtual char const * what() const
Definition: Exception.cc:141
std::vector< TkStripMeasurementDet > theStripDets
StMeasurementDetSet theStDets
void MeasurementTrackerImpl::addStripDets ( const TrackingGeometry::DetContainer dets)
protected

Definition at line 155 of file MeasurementTrackerImpl.cc.

References addGluedDet(), and addStripDet().

Referenced by initialize().

156 {
157  for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
158  gd != dets.end(); gd++) {
159 
160  const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(*gd);
161 
162  // StripSubdetector stripId( (**gd).geographicalId());
163  // bool isDetUnit( gdu != 0);
164  // cout << "StripSubdetector glued? " << stripId.glued()
165  // << " is DetUnit? " << isDetUnit << endl;
166 
167  if (gdu != 0) {
168  addStripDet(*gd);
169  }
170  else {
171  const GluedGeomDet* gluedDet = dynamic_cast<const GluedGeomDet*>(*gd);
172  if (gluedDet == 0) {
173  throw MeasurementDetException("MeasurementTracker ERROR: GeomDet neither DetUnit nor GluedDet");
174  }
175  addGluedDet(gluedDet);
176  }
177  }
178 }
void addStripDet(const GeomDet *gd)
void addGluedDet(const GluedGeomDet *gd)
const DetContainer& MeasurementTrackerImpl::allDets ( ) const
inline

For debug only.

Definition at line 100 of file MeasurementTrackerImpl.h.

References theDetMap.

100 {return theDetMap;}
TkStripMeasurementDet * MeasurementTrackerImpl::concreteDetUpdatable ( DetId  id) const

Definition at line 507 of file MeasurementTrackerImpl.cc.

References findDet(), and idToDet().

Referenced by updateStrips().

507  {
508 #ifdef EDM_DEBUG //or similar
509  const TkStripMeasurementDet* theConcreteDet =
510  dynamic_cast<const TkStripMeasurementDet*>(findDet(id));
511  if(theConcreteDet == 0)
512  throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
513 #endif
514  // will trigger ondemand unpacking
515  return const_cast<TkStripMeasurementDet*>(static_cast<const TkStripMeasurementDet*>(idToDet(id)));
516 }
const MeasurementDet * findDet(const DetId &id) const
virtual const MeasurementDet * idToDet(const DetId &id) const
MeasurementDetSystem interface (can be overloaded!)
const MeasurementDet* MeasurementTrackerImpl::findDet ( const DetId id) const
inline

Definition at line 82 of file MeasurementTrackerImpl.h.

References theDetMap.

Referenced by concreteDetUpdatable(), idToDet(), and initGluedDet().

83  {
84  auto it = theDetMap.find(id);
85  if(it !=theDetMap.end()) {
86  return it->second;
87  }else{
88  //throw exception;
89  }
90 
91  return 0; //to avoid compile warning
92  }
const GeometricSearchTracker* MeasurementTrackerImpl::geometricSearchTracker ( ) const
inline

Definition at line 73 of file MeasurementTrackerImpl.h.

References MeasurementTracker::theGeometricSearchTracker.

const GeometricSearchTracker * theGeometricSearchTracker
const TrackingGeometry* MeasurementTrackerImpl::geomTracker ( ) const
inline

Definition at line 71 of file MeasurementTrackerImpl.h.

References MeasurementTracker::theTrackerGeom.

71 { return theTrackerGeom;}
const TrackerGeometry * theTrackerGeom
void MeasurementTrackerImpl::getInactiveStrips ( const edm::Event event,
std::vector< uint32_t > &  rawInactiveDetIds 
) const
protected

Definition at line 365 of file MeasurementTrackerImpl.cc.

References python.multivaluedict::sort(), and theInactiveStripDetectorLabels.

Referenced by OnDemandMeasurementTracker::updateStrips(), and updateStrips().

366  {
367  if (!theInactiveStripDetectorLabels.empty()) {
369  for (std::vector<edm::InputTag>::const_iterator itt = theInactiveStripDetectorLabels.begin(), edt = theInactiveStripDetectorLabels.end();
370  itt != edt; ++itt) {
371  event.getByLabel(*itt, detIds);
372  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
373  }
374  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
375  }
376 }
const std::vector< edm::InputTag > theInactiveStripDetectorLabels
const std::vector<TkGluedMeasurementDet>& MeasurementTrackerImpl::gluedDets ( ) const
inline

Definition at line 103 of file MeasurementTrackerImpl.h.

References theGluedDets.

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

MeasurementDetSystem interface (can be overloaded!)

Implements MeasurementTracker.

Reimplemented in OnDemandMeasurementTracker.

Definition at line 77 of file MeasurementTrackerImpl.h.

References findDet().

Referenced by concreteDetUpdatable().

77  {
78  return findDet(id);
79  }
const MeasurementDet * findDet(const DetId &id) const
void MeasurementTrackerImpl::initGluedDet ( TkGluedMeasurementDet &  det)
protected

Definition at line 204 of file MeasurementTrackerImpl.cc.

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

Referenced by initialize().

205 {
206  const GluedGeomDet& gd = det.specificGeomDet();
207  const MeasurementDet* monoDet = findDet( gd.monoDet()->geographicalId());
208  const MeasurementDet* stereoDet = findDet( gd.stereoDet()->geographicalId());
209  if (monoDet == 0 || stereoDet == 0) {
210  edm::LogError("MeasurementDet") << "MeasurementTracker ERROR: GluedDet components not found as MeasurementDets ";
211  throw MeasurementDetException("MeasurementTracker ERROR: GluedDet components not found as MeasurementDets");
212  }
213  det.init(monoDet,stereoDet);
214  theDetMap[gd.geographicalId()] = &det;
215 }
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
const MeasurementDet * findDet(const DetId &id) const
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
void MeasurementTrackerImpl::initialize ( )
protected

Definition at line 120 of file MeasurementTrackerImpl.cc.

References addPixelDets(), addStripDets(), TrackerGeometry::detsPXB(), TrackerGeometry::detsPXF(), TrackerGeometry::detsTEC(), TrackerGeometry::detsTIB(), TrackerGeometry::detsTID(), TrackerGeometry::detsTOB(), i, StMeasurementDetSet::id(), StMeasurementDetSet::init(), initGluedDet(), theDetMap, theGluedDets, thePixelDets, theStDets, theStripDets, and MeasurementTracker::theTrackerGeom.

Referenced by MeasurementTrackerImpl().

121 {
124 
129 
130  // fist all stripdets
131  sortTKD(theStripDets);
133  for (unsigned int i=0; i!=theStripDets.size(); ++i)
135 
136  // now the glued dets
137  sortTKD(theGluedDets);
138  for (unsigned int i=0; i!=theGluedDets.size(); ++i)
140 
141  sortTKD(thePixelDets);
142 
143 
144 }
int i
Definition: DBlmapReader.cc:9
std::vector< TkStripMeasurementDet > theStripDets
const TrackerGeometry * theTrackerGeom
void initGluedDet(TkGluedMeasurementDet &det)
void addPixelDets(const TrackingGeometry::DetContainer &dets)
void addStripDets(const TrackingGeometry::DetContainer &dets)
unsigned int id(int i) const
const DetContainer & detsTEC() const
const DetContainer & detsPXB() const
const DetContainer & detsTIB() const
std::vector< TkGluedMeasurementDet > theGluedDets
const DetContainer & detsPXF() const
const DetContainer & detsTOB() const
std::vector< TkPixelMeasurementDet * > thePixelDets
void init(std::vector< TkStripMeasurementDet > &stripDets)
const DetContainer & detsTID() const
StMeasurementDetSet theStDets
void MeasurementTrackerImpl::initializePixelStatus ( const SiPixelQuality stripQuality,
const SiPixelFedCabling pixelCabling,
int  qualityFlags,
int  qualityDebugFlags 
)
protected

Definition at line 524 of file MeasurementTrackerImpl.cc.

References BadModules, BadROCs, cond::rpcobgas::detid, SiPixelQuality::getBadRocPositions(), SiPixelQuality::getBadRocs(), i, SiPixelQuality::IsModuleUsable(), thePixelDets, and MeasurementTracker::theTrackerGeom.

Referenced by MeasurementTrackerImpl().

524  {
525  if ((quality != 0) && (qualityFlags != 0)) {
526  edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
527  unsigned int on = 0, tot = 0, badrocs = 0;
528  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
529  i!=thePixelDets.end(); i++) {
530  uint32_t detid = ((**i).geomDet().geographicalId()).rawId();
531  if (qualityFlags & BadModules) {
532  bool isOn = quality->IsModuleUsable(detid);
533  (*i)->setActive(isOn);
534  tot++; on += (unsigned int) isOn;
535  if (qualityDebugFlags & BadModules) {
536  edm::LogInfo("MeasurementTracker")<< "MeasurementTrackerImpl::initializePixelStatus : detid " << detid << " is " << (isOn ? "on" : "off");
537  }
538  } else {
539  (*i)->setActive(true);
540  }
541  if ((qualityFlags & BadROCs) && (quality->getBadRocs(detid) != 0)) {
542  std::vector<LocalPoint> badROCs = quality->getBadRocPositions(detid, *theTrackerGeom, pixelCabling);
543  badrocs += badROCs.size();
544  (*i)->setBadRocPositions(badROCs);
545  } else {
546  (*i)->clearBadRocPositions();
547  }
548  }
549  if (qualityDebugFlags & BadModules) {
550  edm::LogInfo("MeasurementTracker PixelModuleStatus") <<
551  " Total modules: " << tot << ", active " << on <<", inactive " << (tot - on);
552  }
553  if (qualityDebugFlags & BadROCs) {
554  edm::LogInfo("MeasurementTracker PixelROCStatus") << " Total of bad ROCs: " << badrocs ;
555  }
556  } else {
557  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
558  i!=thePixelDets.end(); i++) {
559  (*i)->setActive(true); // module ON
560  }
561  }
562 }
int i
Definition: DBlmapReader.cc:9
const TrackerGeometry * theTrackerGeom
std::vector< TkPixelMeasurementDet * > thePixelDets
void MeasurementTrackerImpl::initializeStripStatus ( const SiStripQuality stripQuality,
int  qualityFlags,
int  qualityDebugFlags 
)
protected

Definition at line 519 of file MeasurementTrackerImpl.cc.

References edm::ParameterSet::getParameter(), StMeasurementDetSet::initializeStripStatus(), pset_, and theStDets.

Referenced by MeasurementTrackerImpl().

519  {
520  edm::ParameterSet cutPset = pset_.getParameter<edm::ParameterSet>("badStripCuts");
521  theStDets.initializeStripStatus(quality, qualityFlags, qualityDebugFlags, cutPset);
522 }
T getParameter(std::string const &) const
void initializeStripStatus(const SiStripQuality *quality, int qualityFlags, int qualityDebugFlags, const edm::ParameterSet &cutPset)
const edm::ParameterSet & pset_
StMeasurementDetSet theStDets
const std::vector<TkPixelMeasurementDet*>& MeasurementTrackerImpl::pixelDets ( ) const
inline

Definition at line 102 of file MeasurementTrackerImpl.h.

References thePixelDets.

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

Implements MeasurementTracker.

Definition at line 238 of file MeasurementTrackerImpl.cc.

References LogDebug, selfUpdateSkipClusters_, thePixelsToSkip, theStDets, and StMeasurementDetSet::theStripsToSkip.

239 {
240  //method called by user of the measurement tracker to tell what needs to be skiped from the event.
241  //there it is incompatible with a configuration in which the measurement tracker already knows what to skip
242  // i.e selfUpdateSkipClusters_=True
243 
244  LogDebug("MeasurementTracker")<<"setClusterToSkip";
246  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";
247 
249  event.getByLabel(cluster,pixelClusterMask);
250 
251 
252  thePixelsToSkip.resize(pixelClusterMask->size());
253  pixelClusterMask->copyMaskTo(thePixelsToSkip);
254 
256  event.getByLabel(cluster,stripClusterMask);
257 
258  theStDets.theStripsToSkip.resize(stripClusterMask->size());
259  stripClusterMask->copyMaskTo(theStDets.theStripsToSkip);
260 
261 }
#define LogDebug(id)
std::vector< bool > thePixelsToSkip
std::vector< bool > theStripsToSkip
StMeasurementDetSet theStDets
const std::vector<TkStripMeasurementDet>& MeasurementTrackerImpl::stripDets ( ) const
inline

Definition at line 101 of file MeasurementTrackerImpl.h.

References theStripDets.

101 {return theStripDets;}
std::vector< TkStripMeasurementDet > theStripDets
void MeasurementTrackerImpl::unsetClusterToSkip ( ) const
virtual

Implements MeasurementTracker.

Definition at line 263 of file MeasurementTrackerImpl.cc.

References LogDebug, selfUpdateSkipClusters_, thePixelsToSkip, theStDets, and StMeasurementDetSet::theStripsToSkip.

263  {
264  //method called by user of the measurement tracker to tell what needs to be skiped from the event.
265  //there it is incompatible with a configuration in which the measurement tracker already knows what to skip
266  // i.e selfUpdateSkipClusters_=True
267 
268  LogDebug("MeasurementTracker")<<"unsetClusterToSkip";
270  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";
271 
272  thePixelsToSkip.clear();
273  theStDets.theStripsToSkip.clear();
274 }
#define LogDebug(id)
std::vector< bool > thePixelsToSkip
std::vector< bool > theStripsToSkip
StMeasurementDetSet theStDets
void MeasurementTrackerImpl::update ( const edm::Event event) const
virtual

Implements MeasurementTracker.

Reimplemented in OnDemandMeasurementTracker.

Definition at line 218 of file MeasurementTrackerImpl.cc.

References updatePixels(), and updateStrips().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

219 {
220  updatePixels(event);
221  updateStrips(event);
222 
223  /*
224  for (std::vector<TkStripMeasurementDet>::const_iterator i=theStripDets.begin();
225  i!=theStripDets.end(); i++) {
226  if( (*i).isEmpty()){
227  std::cout << "stripDet id, #hits: "
228  << (*i).geomDet().geographicalId().rawId() << " , "
229  << 0 << std::endl;
230  }else{
231  std::cout << "stripDet id, #hits: "
232  << (*i).geomDet().geographicalId().rawId() << " , "
233  << (*i).size() << " " << (*i).detSet().size() std::endl;
234  }
235  }
236  */
237 }
void updateStrips(const edm::Event &) const
void updatePixels(const edm::Event &) const
void MeasurementTrackerImpl::updatePixels ( const edm::Event event) const
virtual

Implements MeasurementTracker.

Definition at line 276 of file MeasurementTrackerImpl.cc.

References edmNew::DetSetVector< T >::dataSize(), edmNew::DetSetVector< T >::empty(), edmNew::DetSetVector< T >::end(), edm::ParameterSet::existsAs(), edm::HandleBase::failedToGet(), lumiContext::fill, edmNew::DetSetVector< T >::find(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), i, edm::HandleBase::id(), LogDebug, name_, clustersummaryproducer_cfg::pixelClusters, edm::Handle< T >::product(), pset_, selfUpdateSkipClusters_, python.multivaluedict::sort(), AlCaHLTBitMon_QueryRunRegistry::string, theInactivePixelDetectorLabels, thePixelDets, and thePixelsToSkip.

Referenced by OnDemandMeasurementTracker::update(), and update().

277 {
278  // avoid to update twice from the same event
279  if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTrackerImpl::updatePixels::"+name_)) return;
280 
281  typedef edmNew::DetSet<SiPixelCluster> PixelDetSet;
282 
283  bool switchOffPixelsIfEmpty = (!pset_.existsAs<bool>("switchOffPixelsIfEmpty")) ||
284  (pset_.getParameter<bool>("switchOffPixelsIfEmpty"));
285 
286  std::vector<uint32_t> rawInactiveDetIds;
287  if (!theInactivePixelDetectorLabels.empty()) {
289  for (std::vector<edm::InputTag>::const_iterator itt = theInactivePixelDetectorLabels.begin(), edt = theInactivePixelDetectorLabels.end();
290  itt != edt; ++itt) {
291  if (event.getByLabel(*itt, detIds)){
292  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
293  }else{
294  static bool iFailedAlready=false;
295  if (!iFailedAlready){
296  edm::LogError("MissingProduct")<<"I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
297  iFailedAlready=true;
298  }
299  }
300  }
301  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
302  }
303  // Pixel Clusters
304  std::string pixelClusterProducer = pset_.getParameter<std::string>("pixelClusterProducer");
305  if( pixelClusterProducer.empty() ) { //clusters have not been produced
306  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
307  i!=thePixelDets.end(); i++) {
308  if (switchOffPixelsIfEmpty) {
309  (**i).setActiveThisEvent(false);
310  }else{
311  (**i).setEmpty();
312  }
313  }
314  }else{
315 
317  event.getByLabel(pixelClusterProducer, pixelClusters);
318  const edmNew::DetSetVector<SiPixelCluster>* pixelCollection = pixelClusters.product();
319 
320  if (switchOffPixelsIfEmpty && pixelCollection->empty()) {
321  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
322  i!=thePixelDets.end(); i++) {
323  (**i).setActiveThisEvent(false);
324  }
325  } else {
326 
327  //std::cout <<"updatePixels "<<pixelCollection->dataSize()<<std::endl;
328  thePixelsToSkip.resize(pixelCollection->dataSize());
329  std::fill(thePixelsToSkip.begin(),thePixelsToSkip.end(),false);
330 
333  //and get the collection of pixel ref to skip
334  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),pixelClusterMask);
335  LogDebug("MeasurementTracker")<<"getting pxl refs to skip";
336  if (pixelClusterMask.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the pixel clusters to skip";
337  if (pixelClusterMask->refProd().id()!=pixelClusters.id()){
338  edm::LogError("ProductIdMismatch")<<"The pixel masking does not point to the proper collection of clusters: "<<pixelClusterMask->refProd().id()<<"!="<<pixelClusters.id();
339  }
340  pixelClusterMask->copyMaskTo(thePixelsToSkip);
341  }
342 
343  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
344  i!=thePixelDets.end(); i++) {
345 
346  // foreach det get cluster range
347  unsigned int id = (**i).geomDet().geographicalId().rawId();
348  if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
349  (**i).setActiveThisEvent(false); continue;
350  }
351  //FIXME
352  //fill the set with what needs to be skipped
354  if ( it != pixelCollection->end() ){
355  // push cluster range in det
356  (**i).update( *it, pixelClusters, id );
357  } else{
358  (**i).setEmpty();
359  }
360  }
361  }
362  }
363 }
#define LogDebug(id)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
size_type dataSize() const
string fill
Definition: lumiContext.py:319
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:187
ProductID id() const
Definition: HandleBase.cc:15
const_iterator find(id_type i) const
const std::vector< edm::InputTag > theInactivePixelDetectorLabels
const edm::ParameterSet & pset_
const_iterator end() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
bool failedToGet() const
Definition: HandleBase.h:80
T const * product() const
Definition: Handle.h:74
std::vector< bool > thePixelsToSkip
std::vector< TkPixelMeasurementDet * > thePixelDets
void MeasurementTrackerImpl::updateStrips ( const edm::Event event) const
virtual

Implements MeasurementTracker.

Reimplemented in OnDemandMeasurementTracker.

Definition at line 378 of file MeasurementTrackerImpl.cc.

References edm::RegionIndex< T >::begin(), concreteDetUpdatable(), edm::RegionIndex< T >::end(), edm::HandleBase::failedToGet(), StMeasurementDetSet::find(), getInactiveStrips(), edm::ParameterSet::getParameter(), StMeasurementDetSet::handle_, i, StMeasurementDetSet::id(), edm::HandleBase::id(), edmNew::DetSetVector< T >::id(), StMeasurementDetSet::id_, getHLTprescales::index, StMeasurementDetSet::isActive(), StMeasurementDetSet::isRegional(), LogDebug, name_, edm::Handle< T >::product(), pset_, StMeasurementDetSet::regionalHandle_, selfUpdateSkipClusters_, StMeasurementDetSet::setActiveThisEvent(), StMeasurementDetSet::setEmpty(), AlCaHLTBitMon_QueryRunRegistry::string, theStDets, StMeasurementDetSet::theStripsToSkip, and StMeasurementDetSet::update().

Referenced by OnDemandMeasurementTracker::update(), and update().

379 {
380  // avoid to update twice from the same event
381  if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTrackerImpl::updateStrips::"+name_)) return;
382 
383  typedef edmNew::DetSet<SiStripCluster> StripDetSet;
384 
385  std::vector<uint32_t> rawInactiveDetIds;
386  getInactiveStrips(event,rawInactiveDetIds);
387 
388  // Strip Clusters
389  std::string stripClusterProducer = pset_.getParameter<std::string>("stripClusterProducer");
390  //first clear all of them
392 
393 
394  if( !stripClusterProducer.compare("") ) return; //clusters have not been produced
395 
396  const int endDet = theStDets.id_.size();
397 
398 
399  // mark as inactive if in rawInactiveDetIds
400  int i=0;
401  unsigned int idp=0;
402  for ( auto id : rawInactiveDetIds) {
403  if (id==idp) continue; // skip multiple id
404  idp=id;
405  i=theStDets.find(id,i);
406  assert(i!=endDet && id == theStDets.id(i));
407  theStDets.setActiveThisEvent(i,false);
408  }
409 
410  //========= actually load cluster =============
411  if(!theStDets.isRegional()){
413  event.getByLabel(stripClusterProducer, clusterHandle);
414  const edmNew::DetSetVector<SiStripCluster>* clusterCollection = clusterHandle.product();
415 
416 
419  //and get the collection of pixel ref to skip
420  LogDebug("MeasurementTracker")<<"getting strp refs to skip";
421  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),stripClusterMask);
422  if (stripClusterMask.failedToGet()) edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
423  if (stripClusterMask->refProd().id()!=clusterHandle.id()){
424  edm::LogError("ProductIdMismatch")<<"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().id()<<"!="<<clusterHandle.id();
425  }
426  stripClusterMask->copyMaskTo(theStDets.theStripsToSkip);
427  }
428 
429  theStDets.handle_ = clusterHandle;
430  int i=0;
431  edmNew::DetSetVector<SiStripCluster>::const_iterator it = (*clusterCollection).begin();
432  edmNew::DetSetVector<SiStripCluster>::const_iterator endColl = (*clusterCollection).end();
433  // cluster and det and in order (both) and unique so let's use set intersection
434  for (;it!=endColl; ++it) {
435  StripDetSet detSet = *it;
436  unsigned int id = detSet.id();
437  while ( id != theStDets.id(i)) { // eventually change to lower_bound
438  ++i;
439  if (endDet==i) throw "we have a problem!!!!";
440  }
441 
442  // push cluster range in det
443  if ( theStDets.isActive(i) )
444  theStDets.update(i,detSet);
445  }
446 
447  }else{ // regional
448 
449  //then set the not-empty ones only
451  event.getByLabel(stripClusterProducer, refClusterHandle);
452 
453  std::string lazyGetter = pset_.getParameter<std::string>("stripLazyGetterProducer");
455  event.getByLabel(lazyGetter,lazyClusterHandle);
456 
459  LogDebug("MeasurementTracker")<<"getting reg strp refs to skip";
460  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),stripClusterMask);
461  if (stripClusterMask.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
462  if (stripClusterMask->refProd().id()!=lazyClusterHandle.id()){
463  edm::LogError("ProductIdMismatch")<<"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().id()<<"!="<<lazyClusterHandle.id();
464  }
465  stripClusterMask->copyMaskTo(theStDets.theStripsToSkip);
466  }
467 
468  theStDets.regionalHandle_ = lazyClusterHandle;
469 
470  uint32_t tmpId=0;
471  vector<SiStripCluster>::const_iterator beginIterator;
472  edm::RefGetter<SiStripCluster>::const_iterator iregion = refClusterHandle->begin();
473  for(;iregion!=refClusterHandle->end();++iregion) {
474  const edm::RegionIndex<SiStripCluster>& region = *iregion;
475  vector<SiStripCluster>::const_iterator icluster = region.begin();
476  const vector<SiStripCluster>::const_iterator endIterator = region.end();
477  tmpId = icluster->geographicalId();
478  beginIterator = icluster;
479 
480  //std::cout << "== tmpId ad inizio loop dentro region: " << tmpId << std::endl;
481 
482  for (;icluster!=endIterator;icluster++) {
483  //std::cout << "===== cluster id,pos "
484  // << icluster->geographicalId() << " , " << icluster->barycenter()
485  // << std::endl;
486  //std::cout << "=====making ref in recHits() " << std::endl;
487  if( icluster->geographicalId() != tmpId){
488  //std::cout << "geo!=tmpId" << std::endl;
489 
490  //cannot we avoid to update the det with detId of itself?? (sure we can!, done!)
491  theStDets.update(concreteDetUpdatable(tmpId)->index(),beginIterator,icluster);
492 
493  tmpId = icluster->geographicalId();
494  beginIterator = icluster;
495  if( icluster == (endIterator-1)){
496  theStDets.update(concreteDetUpdatable(tmpId)->index(),icluster,endIterator);
497  }
498  }else if( icluster == (endIterator-1)){
499  theStDets.update(concreteDetUpdatable(tmpId)->index(),beginIterator,endIterator);
500  }
501  }//end loop cluster in one ragion
502  }
503  }//end of block for updating with regional clusters
504 }
#define LogDebug(id)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
ProductID id() const
Definition: HandleBase.cc:15
const_iterator end() const
Get off the end iterator.
Definition: LazyGetter.h:191
std::vector< unsigned int > id_
void update(int i, const StripDetset &detSet)
id_type id(size_t cell) const
unsigned int id(int i) const
edm::Handle< edm::LazyGetter< SiStripCluster > > regionalHandle_
void setActiveThisEvent(int i, bool active)
Turn on/off the module for reconstruction for one events. This per-event flag is cleared by any call ...
TkStripMeasurementDet * concreteDetUpdatable(DetId id) const
const edm::ParameterSet & pset_
const_iterator begin() const
Get begin iterator.
Definition: LazyGetter.h:182
void getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
int find(unsigned int jd, int i=0)
bool failedToGet() const
Definition: HandleBase.h:80
boost::indirect_iterator< typename collection_type::const_iterator > const_iterator
Definition: RefGetter.h:25
T const * product() const
Definition: Handle.h:74
bool isActive(int i) const
edm::Handle< edmNew::DetSetVector< SiStripCluster > > handle_
std::vector< bool > theStripsToSkip
StMeasurementDetSet theStDets

Member Data Documentation

const std::string MeasurementTrackerImpl::name_
protected
const edm::ParameterSet& MeasurementTrackerImpl::pset_
protected
bool MeasurementTrackerImpl::selfUpdateSkipClusters_
protected
DetContainer MeasurementTrackerImpl::theDetMap
mutableprotected
std::vector<TkGluedMeasurementDet> MeasurementTrackerImpl::theGluedDets
mutableprotected

Definition at line 120 of file MeasurementTrackerImpl.h.

Referenced by addGluedDet(), gluedDets(), and initialize().

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

Definition at line 127 of file MeasurementTrackerImpl.h.

Referenced by updatePixels().

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

Definition at line 125 of file MeasurementTrackerImpl.h.

const PixelClusterParameterEstimator* MeasurementTrackerImpl::thePixelCPE
protected

Definition at line 124 of file MeasurementTrackerImpl.h.

Referenced by addPixelDets().

std::vector<TkPixelMeasurementDet*> MeasurementTrackerImpl::thePixelDets
mutableprotected
std::vector<bool> MeasurementTrackerImpl::thePixelsToSkip
mutableprotected
StMeasurementDetSet MeasurementTrackerImpl::theStDets
mutableprotected
std::vector<TkStripMeasurementDet> MeasurementTrackerImpl::theStripDets
mutableprotected

Definition at line 119 of file MeasurementTrackerImpl.h.

Referenced by addStripDet(), initialize(), and stripDets().