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...
 
TkStripMeasurementDetconcreteDetUpdatable (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 95 of file MeasurementTrackerImpl.cc.

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

108  :
109  MeasurementTracker(trackerGeom,geometricSearchTracker),
110  pset_(conf),
111  name_(conf.getParameter<std::string>("ComponentName")),
112  theStDets(hitMatcher,stripCPE,isRegional),
113  thePixelCPE(pixelCPE),
114  theInactivePixelDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactivePixelDetectorLabels")),
115  theInactiveStripDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactiveStripDetectorLabels"))
116 {
117  this->initialize();
118  this->initializeStripStatus(stripQuality, stripQualityFlags, stripQualityDebugFlags);
119  this->initializePixelStatus(pixelQuality, pixelCabling, pixelQualityFlags, pixelQualityDebugFlags);
120  //the measurement tracking is set to skip clusters, the other option is set from outside
121  selfUpdateSkipClusters_=conf.exists("skipClusters");
123  {
124  edm::InputTag skip=conf.getParameter<edm::InputTag>("skipClusters");
125  if (skip==edm::InputTag("")) selfUpdateSkipClusters_=false;
126  }
127 
128 
129  LogDebug("MeasurementTracker")<<"skipping clusters: "<<selfUpdateSkipClusters_;
130 }
#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 132 of file MeasurementTrackerImpl.cc.

References thePixelDets.

133 {
134  for(vector<TkPixelMeasurementDet*>::const_iterator it=thePixelDets.begin(); it!=thePixelDets.end(); ++it){
135  delete *it;
136  }
137 
138 }
std::vector< TkPixelMeasurementDet * > thePixelDets

Member Function Documentation

void MeasurementTrackerImpl::addGluedDet ( const GluedGeomDet gd)
protected

Definition at line 220 of file MeasurementTrackerImpl.cc.

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

Referenced by addStripDets().

221 {
223 }
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 211 of file MeasurementTrackerImpl.cc.

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

Referenced by addPixelDets().

213 {
214  TkPixelMeasurementDet* det = new TkPixelMeasurementDet( gd, cpe);
215  thePixelDets.push_back(det);
217  theDetMap[gd->geographicalId()] = det;
218 }
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 168 of file MeasurementTrackerImpl.cc.

References addPixelDet(), and thePixelCPE.

Referenced by initialize().

169 {
170  for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
171  gd != dets.end(); gd++) {
172  addPixelDet(*gd, thePixelCPE);
173  }
174 }
const PixelClusterParameterEstimator * thePixelCPE
void addPixelDet(const GeomDet *gd, const PixelClusterParameterEstimator *cpe)
void MeasurementTrackerImpl::addStripDet ( const GeomDet gd)
protected

Definition at line 201 of file MeasurementTrackerImpl.cc.

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

Referenced by addStripDets().

202 {
203  try {
205  }
206  catch(MeasurementDetException& err){
207  edm::LogError("MeasurementDet") << "Oops, got a MeasurementDetException: " << err.what() ;
208  }
209 }
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 176 of file MeasurementTrackerImpl.cc.

References addGluedDet(), and addStripDet().

Referenced by initialize().

177 {
178  for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
179  gd != dets.end(); gd++) {
180 
181  const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(*gd);
182 
183  // StripSubdetector stripId( (**gd).geographicalId());
184  // bool isDetUnit( gdu != 0);
185  // cout << "StripSubdetector glued? " << stripId.glued()
186  // << " is DetUnit? " << isDetUnit << endl;
187 
188  if (gdu != 0) {
189  addStripDet(*gd);
190  }
191  else {
192  const GluedGeomDet* gluedDet = dynamic_cast<const GluedGeomDet*>(*gd);
193  if (gluedDet == 0) {
194  throw MeasurementDetException("MeasurementTracker ERROR: GeomDet neither DetUnit nor GluedDet");
195  }
196  addGluedDet(gluedDet);
197  }
198  }
199 }
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 528 of file MeasurementTrackerImpl.cc.

References findDet(), and idToDet().

Referenced by updateStrips().

528  {
529 #ifdef EDM_DEBUG //or similar
530  const TkStripMeasurementDet* theConcreteDet =
531  dynamic_cast<const TkStripMeasurementDet*>(findDet(id));
532  if(theConcreteDet == 0)
533  throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
534 #endif
535  // will trigger ondemand unpacking
536  return const_cast<TkStripMeasurementDet*>(static_cast<const TkStripMeasurementDet*>(idToDet(id)));
537 }
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 386 of file MeasurementTrackerImpl.cc.

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

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

387  {
388  if (!theInactiveStripDetectorLabels.empty()) {
390  for (std::vector<edm::InputTag>::const_iterator itt = theInactiveStripDetectorLabels.begin(), edt = theInactiveStripDetectorLabels.end();
391  itt != edt; ++itt) {
392  event.getByLabel(*itt, detIds);
393  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
394  }
395  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
396  }
397 }
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 225 of file MeasurementTrackerImpl.cc.

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

Referenced by initialize().

226 {
227  const GluedGeomDet& gd = det.specificGeomDet();
228  const MeasurementDet* monoDet = findDet( gd.monoDet()->geographicalId());
229  const MeasurementDet* stereoDet = findDet( gd.stereoDet()->geographicalId());
230  if (monoDet == 0 || stereoDet == 0) {
231  edm::LogError("MeasurementDet") << "MeasurementTracker ERROR: GluedDet components not found as MeasurementDets ";
232  throw MeasurementDetException("MeasurementTracker ERROR: GluedDet components not found as MeasurementDets");
233  }
234  det.init(monoDet,stereoDet);
235  theDetMap[gd.geographicalId()] = &det;
236 }
void init(const MeasurementDet *monoDet, const MeasurementDet *stereoDet)
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
const MeasurementDet * findDet(const DetId &id) const
const GluedGeomDet & specificGeomDet() 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 141 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().

142 {
145 
150 
151  // fist all stripdets
152  sortTKD(theStripDets);
154  for (unsigned int i=0; i!=theStripDets.size(); ++i)
156 
157  // now the glued dets
158  sortTKD(theGluedDets);
159  for (unsigned int i=0; i!=theGluedDets.size(); ++i)
161 
162  sortTKD(thePixelDets);
163 
164 
165 }
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 545 of file MeasurementTrackerImpl.cc.

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

Referenced by MeasurementTrackerImpl().

545  {
546  if ((quality != 0) && (qualityFlags != 0)) {
547  edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
548  unsigned int on = 0, tot = 0, badrocs = 0;
549  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
550  i!=thePixelDets.end(); i++) {
551  uint32_t detid = ((**i).geomDet().geographicalId()).rawId();
552  if (qualityFlags & BadModules) {
553  bool isOn = quality->IsModuleUsable(detid);
554  (*i)->setActive(isOn);
555  tot++; on += (unsigned int) isOn;
556  if (qualityDebugFlags & BadModules) {
557  edm::LogInfo("MeasurementTracker")<< "MeasurementTrackerImpl::initializePixelStatus : detid " << detid << " is " << (isOn ? "on" : "off");
558  }
559  } else {
560  (*i)->setActive(true);
561  }
562  if ((qualityFlags & BadROCs) && (quality->getBadRocs(detid) != 0)) {
563  std::vector<LocalPoint> badROCs = quality->getBadRocPositions(detid, *theTrackerGeom, pixelCabling);
564  badrocs += badROCs.size();
565  (*i)->setBadRocPositions(badROCs);
566  } else {
567  (*i)->clearBadRocPositions();
568  }
569  }
570  if (qualityDebugFlags & BadModules) {
571  edm::LogInfo("MeasurementTracker PixelModuleStatus") <<
572  " Total modules: " << tot << ", active " << on <<", inactive " << (tot - on);
573  }
574  if (qualityDebugFlags & BadROCs) {
575  edm::LogInfo("MeasurementTracker PixelROCStatus") << " Total of bad ROCs: " << badrocs ;
576  }
577  } else {
578  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
579  i!=thePixelDets.end(); i++) {
580  (*i)->setActive(true); // module ON
581  }
582  }
583 }
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 540 of file MeasurementTrackerImpl.cc.

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

Referenced by MeasurementTrackerImpl().

540  {
541  edm::ParameterSet cutPset = pset_.getParameter<edm::ParameterSet>("badStripCuts");
542  theStDets.initializeStripStatus(quality, qualityFlags, qualityDebugFlags, cutPset);
543 }
T getParameter(std::string const &) const
void initializeStripStatus(const SiStripQuality *quality, int qualityFlags, int qualityDebugFlags, 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 259 of file MeasurementTrackerImpl.cc.

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

260 {
261  //method called by user of the measurement tracker to tell what needs to be skiped from the event.
262  //there it is incompatible with a configuration in which the measurement tracker already knows what to skip
263  // i.e selfUpdateSkipClusters_=True
264 
265  LogDebug("MeasurementTracker")<<"setClusterToSkip";
267  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";
268 
270  event.getByLabel(cluster,pixelClusterMask);
271 
272 
273  thePixelsToSkip.resize(pixelClusterMask->size());
274  pixelClusterMask->copyMaskTo(thePixelsToSkip);
275 
277  event.getByLabel(cluster,stripClusterMask);
278 
279  theStDets.theStripsToSkip.resize(stripClusterMask->size());
280  stripClusterMask->copyMaskTo(theStDets.theStripsToSkip);
281 
282 }
#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 284 of file MeasurementTrackerImpl.cc.

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

284  {
285  //method called by user of the measurement tracker to tell what needs to be skiped from the event.
286  //there it is incompatible with a configuration in which the measurement tracker already knows what to skip
287  // i.e selfUpdateSkipClusters_=True
288 
289  LogDebug("MeasurementTracker")<<"unsetClusterToSkip";
291  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";
292 
293  thePixelsToSkip.clear();
294  theStDets.theStripsToSkip.clear();
295 }
#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 239 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().

240 {
241  updatePixels(event);
242  updateStrips(event);
243 
244  /*
245  for (std::vector<TkStripMeasurementDet>::const_iterator i=theStripDets.begin();
246  i!=theStripDets.end(); i++) {
247  if( (*i).isEmpty()){
248  std::cout << "stripDet id, #hits: "
249  << (*i).geomDet().geographicalId().rawId() << " , "
250  << 0 << std::endl;
251  }else{
252  std::cout << "stripDet id, #hits: "
253  << (*i).geomDet().geographicalId().rawId() << " , "
254  << (*i).size() << " " << (*i).detSet().size() std::endl;
255  }
256  }
257  */
258 }
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 297 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(), errorMatrix2Lands_multiChannel::id, LogDebug, name_, clustersummaryproducer_cfg::pixelClusters, edm::Handle< T >::product(), pset_, selfUpdateSkipClusters_, python.multivaluedict::sort(), theInactivePixelDetectorLabels, thePixelDets, and thePixelsToSkip.

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

298 {
299  // avoid to update twice from the same event
300  if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTrackerImpl::updatePixels::"+name_)) return;
301 
302  typedef edmNew::DetSet<SiPixelCluster> PixelDetSet;
303 
304  bool switchOffPixelsIfEmpty = (!pset_.existsAs<bool>("switchOffPixelsIfEmpty")) ||
305  (pset_.getParameter<bool>("switchOffPixelsIfEmpty"));
306 
307  std::vector<uint32_t> rawInactiveDetIds;
308  if (!theInactivePixelDetectorLabels.empty()) {
310  for (std::vector<edm::InputTag>::const_iterator itt = theInactivePixelDetectorLabels.begin(), edt = theInactivePixelDetectorLabels.end();
311  itt != edt; ++itt) {
312  if (event.getByLabel(*itt, detIds)){
313  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
314  }else{
315  static bool iFailedAlready=false;
316  if (!iFailedAlready){
317  edm::LogError("MissingProduct")<<"I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
318  iFailedAlready=true;
319  }
320  }
321  }
322  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
323  }
324  // Pixel Clusters
325  std::string pixelClusterProducer = pset_.getParameter<std::string>("pixelClusterProducer");
326  if( pixelClusterProducer.empty() ) { //clusters have not been produced
327  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
328  i!=thePixelDets.end(); i++) {
329  if (switchOffPixelsIfEmpty) {
330  (**i).setActiveThisEvent(false);
331  }else{
332  (**i).setEmpty();
333  }
334  }
335  }else{
336 
338  event.getByLabel(pixelClusterProducer, pixelClusters);
339  const edmNew::DetSetVector<SiPixelCluster>* pixelCollection = pixelClusters.product();
340 
341  if (switchOffPixelsIfEmpty && pixelCollection->empty()) {
342  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
343  i!=thePixelDets.end(); i++) {
344  (**i).setActiveThisEvent(false);
345  }
346  } else {
347 
348  //std::cout <<"updatePixels "<<pixelCollection->dataSize()<<std::endl;
349  thePixelsToSkip.resize(pixelCollection->dataSize());
350  std::fill(thePixelsToSkip.begin(),thePixelsToSkip.end(),false);
351 
354  //and get the collection of pixel ref to skip
355  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),pixelClusterMask);
356  LogDebug("MeasurementTracker")<<"getting pxl refs to skip";
357  if (pixelClusterMask.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the pixel clusters to skip";
358  if (pixelClusterMask->refProd().id()!=pixelClusters.id()){
359  edm::LogError("ProductIdMismatch")<<"The pixel masking does not point to the proper collection of clusters: "<<pixelClusterMask->refProd().id()<<"!="<<pixelClusters.id();
360  }
361  pixelClusterMask->copyMaskTo(thePixelsToSkip);
362  }
363 
364  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
365  i!=thePixelDets.end(); i++) {
366 
367  // foreach det get cluster range
368  unsigned int id = (**i).geomDet().geographicalId().rawId();
369  if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
370  (**i).setActiveThisEvent(false); continue;
371  }
372  //FIXME
373  //fill the set with what needs to be skipped
375  if ( it != pixelCollection->end() ){
376  // push cluster range in det
377  (**i).update( *it, pixelClusters, id );
378  } else{
379  (**i).setEmpty();
380  }
381  }
382  }
383  }
384 }
#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:356
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 399 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(), errorMatrix2Lands_multiChannel::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(), theStDets, StMeasurementDetSet::theStripsToSkip, and StMeasurementDetSet::update().

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

400 {
401  // avoid to update twice from the same event
402  if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTrackerImpl::updateStrips::"+name_)) return;
403 
404  typedef edmNew::DetSet<SiStripCluster> StripDetSet;
405 
406  std::vector<uint32_t> rawInactiveDetIds;
407  getInactiveStrips(event,rawInactiveDetIds);
408 
409  // Strip Clusters
410  std::string stripClusterProducer = pset_.getParameter<std::string>("stripClusterProducer");
411  //first clear all of them
413 
414 
415  if( !stripClusterProducer.compare("") ) return; //clusters have not been produced
416 
417  const int endDet = theStDets.id_.size();
418 
419 
420  // mark as inactive if in rawInactiveDetIds
421  int i=0;
422  unsigned int idp=0;
423  for ( auto id : rawInactiveDetIds) {
424  if (id==idp) continue; // skip multiple id
425  idp=id;
426  i=theStDets.find(id,i);
427  assert(i!=endDet && id == theStDets.id(i));
428  theStDets.setActiveThisEvent(i,false);
429  }
430 
431  //========= actually load cluster =============
432  if(!theStDets.isRegional()){
434  event.getByLabel(stripClusterProducer, clusterHandle);
435  const edmNew::DetSetVector<SiStripCluster>* clusterCollection = clusterHandle.product();
436 
437 
440  //and get the collection of pixel ref to skip
441  LogDebug("MeasurementTracker")<<"getting strp refs to skip";
442  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),stripClusterMask);
443  if (stripClusterMask.failedToGet()) edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
444  if (stripClusterMask->refProd().id()!=clusterHandle.id()){
445  edm::LogError("ProductIdMismatch")<<"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().id()<<"!="<<clusterHandle.id();
446  }
447  stripClusterMask->copyMaskTo(theStDets.theStripsToSkip);
448  }
449 
450  theStDets.handle_ = clusterHandle;
451  int i=0;
452  edmNew::DetSetVector<SiStripCluster>::const_iterator it = (*clusterCollection).begin();
453  edmNew::DetSetVector<SiStripCluster>::const_iterator endColl = (*clusterCollection).end();
454  // cluster and det and in order (both) and unique so let's use set intersection
455  for (;it!=endColl; ++it) {
456  StripDetSet detSet = *it;
457  unsigned int id = detSet.id();
458  while ( id != theStDets.id(i)) { // eventually change to lower_bound
459  ++i;
460  if (endDet==i) throw "we have a problem!!!!";
461  }
462 
463  // push cluster range in det
464  if ( theStDets.isActive(i) )
465  theStDets.update(i,detSet);
466  }
467 
468  }else{ // regional
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 
480  LogDebug("MeasurementTracker")<<"getting reg strp refs to skip";
481  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),stripClusterMask);
482  if (stripClusterMask.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
483  if (stripClusterMask->refProd().id()!=lazyClusterHandle.id()){
484  edm::LogError("ProductIdMismatch")<<"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().id()<<"!="<<lazyClusterHandle.id();
485  }
486  stripClusterMask->copyMaskTo(theStDets.theStripsToSkip);
487  }
488 
489  theStDets.regionalHandle_ = lazyClusterHandle;
490 
491  uint32_t tmpId=0;
492  vector<SiStripCluster>::const_iterator beginIterator;
493  edm::RefGetter<SiStripCluster>::const_iterator iregion = refClusterHandle->begin();
494  for(;iregion!=refClusterHandle->end();++iregion) {
495  const edm::RegionIndex<SiStripCluster>& region = *iregion;
496  vector<SiStripCluster>::const_iterator icluster = region.begin();
497  const vector<SiStripCluster>::const_iterator endIterator = region.end();
498  tmpId = icluster->geographicalId();
499  beginIterator = icluster;
500 
501  //std::cout << "== tmpId ad inizio loop dentro region: " << tmpId << std::endl;
502 
503  for (;icluster!=endIterator;icluster++) {
504  //std::cout << "===== cluster id,pos "
505  // << icluster->geographicalId() << " , " << icluster->barycenter()
506  // << std::endl;
507  //std::cout << "=====making ref in recHits() " << std::endl;
508  if( icluster->geographicalId() != tmpId){
509  //std::cout << "geo!=tmpId" << std::endl;
510 
511  //cannot we avoid to update the det with detId of itself?? (sure we can!, done!)
512  theStDets.update(concreteDetUpdatable(tmpId)->index(),beginIterator,icluster);
513 
514  tmpId = icluster->geographicalId();
515  beginIterator = icluster;
516  if( icluster == (endIterator-1)){
517  theStDets.update(concreteDetUpdatable(tmpId)->index(),icluster,endIterator);
518  }
519  }else if( icluster == (endIterator-1)){
520  theStDets.update(concreteDetUpdatable(tmpId)->index(),beginIterator,endIterator);
521  }
522  }//end loop cluster in one ragion
523  }
524  }//end of block for updating with regional clusters
525 }
#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:189
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:180
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().