48 #if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ > 4)
49 #include <x86intrin.h>
55 #include <emmintrin.h>
58 #include <pmmintrin.h>
61 #include <smmintrin.h>
79 template<
typename TKD>
80 void sortTKD( std::vector<TKD*> & det) {
81 std::sort(det.begin(),det.end(),CmpTKD());
93 int stripQualityFlags,
94 int stripQualityDebugFlags,
97 int pixelQualityFlags,
98 int pixelQualityDebugFlags,
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)
124 for(vector<TkPixelMeasurementDet*>::const_iterator it=thePixelDets.begin(); it!=thePixelDets.end(); ++it){
128 for(vector<TkStripMeasurementDet*>::const_iterator it=theStripDets.begin(); it!=theStripDets.end(); ++it){
132 for(vector<TkGluedMeasurementDet*>::const_iterator it=theGluedDets.begin(); it!=theGluedDets.end(); ++it){
140 addPixelDets( theTrackerGeom->detsPXB());
141 addPixelDets( theTrackerGeom->detsPXF());
142 addStripDets( theTrackerGeom->detsTIB());
143 addStripDets( theTrackerGeom->detsTID());
144 addStripDets( theTrackerGeom->detsTOB());
145 addStripDets( theTrackerGeom->detsTEC());
147 sortTKD(theStripDets);
148 sortTKD(thePixelDets);
149 sortTKD(theGluedDets);
156 for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
157 gd != dets.end(); gd++) {
158 addPixelDet(*gd, thePixelCPE);
164 for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
165 gd != dets.end(); gd++) {
175 addStripDet(*gd, theStripCPE);
182 addGluedDet(gluedDet, theHitMatcher);
192 theStripDets.push_back(det);
196 edm::LogError(
"MeasurementDet") <<
"Oops, got a MeasurementDetException: " << err.
what() ;
204 thePixelDets.push_back(det);
213 addStripDet(gd->
monoDet(), theStripCPE);
218 if (stereoDet == 0) {
219 addStripDet(gd->
stereoDet(), theStripCPE);
223 if (monoDet == 0 || stereoDet == 0) {
224 edm::LogError(
"MeasurementDet") <<
"MeasurementTracker ERROR: GluedDet components not found as MeasurementDets ";
230 theGluedDets.push_back( det);
256 LogDebug(
"MeasurementTracker")<<
"setClusterToSkip";
257 if (selfUpdateSkipClusters_)
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";
261 event.getByLabel(cluster,pixelClusterRefs);
262 for (std::vector<TkPixelMeasurementDet*>::const_iterator
i=thePixelDets.begin();
263 i!=thePixelDets.end();
i++) {
265 if (f!=pixelClusterRefs->end())
266 (**i).setClusterToSkip(f->
begin(),f->
end());
272 event.getByLabel(cluster,stripClusterRefs);
273 for (std::vector<TkStripMeasurementDet*>::const_iterator
i=theStripDets.begin();
274 i!=theStripDets.end();
i++){
276 if (f!=stripClusterRefs->end())
277 (**i).setClusterToSkip(f->
begin(),f->
end());
284 LogDebug(
"MeasurementTracker")<<
"unsetClusterToSkip";
285 if (selfUpdateSkipClusters_)
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";
288 for (std::vector<TkPixelMeasurementDet*>::const_iterator
i=thePixelDets.begin();
289 i!=thePixelDets.end();
i++) {
292 for (std::vector<TkStripMeasurementDet*>::const_iterator
i=theStripDets.begin();
293 i!=theStripDets.end();
i++){
305 bool switchOffPixelsIfEmpty = (!pset_.existsAs<
bool>(
"switchOffPixelsIfEmpty")) ||
306 (pset_.getParameter<
bool>(
"switchOffPixelsIfEmpty"));
308 std::vector<uint32_t> rawInactiveDetIds;
309 if (!theInactivePixelDetectorLabels.empty()) {
311 for (std::vector<edm::InputTag>::const_iterator itt = theInactivePixelDetectorLabels.begin(), edt = theInactivePixelDetectorLabels.end();
313 event.getByLabel(*itt, detIds);
314 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
316 if (!rawInactiveDetIds.empty())
std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
319 std::string pixelClusterProducer = pset_.getParameter<std::string>(
"pixelClusterProducer");
320 if( pixelClusterProducer.empty() ) {
321 for (std::vector<TkPixelMeasurementDet*>::const_iterator
i=thePixelDets.begin();
322 i!=thePixelDets.end();
i++) {
323 if (switchOffPixelsIfEmpty) {
324 (**i).setActiveThisEvent(
false);
332 if (selfUpdateSkipClusters_){
334 event.getByLabel(pset_.getParameter<
edm::InputTag>(
"skipClusters"),pixelClusterRefs);
335 LogDebug(
"MeasurementTracker")<<
"getting pxl refs to skip";
340 event.getByLabel(pixelClusterProducer, pixelClusters);
343 if (switchOffPixelsIfEmpty && pixelCollection->
empty()) {
344 for (std::vector<TkPixelMeasurementDet*>::const_iterator
i=thePixelDets.begin();
345 i!=thePixelDets.end();
i++) {
346 (**i).setActiveThisEvent(
false);
350 for (std::vector<TkPixelMeasurementDet*>::const_iterator
i=thePixelDets.begin();
351 i!=thePixelDets.end();
i++) {
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;
361 if ( it != pixelCollection->
end() ){
363 (**i).update( *it, pixelClusters,
id );
364 if (selfUpdateSkipClusters_){
366 if (f!=pixelClusterRefs->end())
367 (**i).setClusterToSkip(f->
begin(),f->
end());
381 std::vector<uint32_t> & rawInactiveDetIds)
const {
382 if (!theInactiveStripDetectorLabels.empty()) {
384 for (std::vector<edm::InputTag>::const_iterator itt = theInactiveStripDetectorLabels.begin(), edt = theInactiveStripDetectorLabels.end();
386 event.getByLabel(*itt, detIds);
387 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
389 if (!rawInactiveDetIds.empty())
std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
400 std::vector<uint32_t> rawInactiveDetIds;
401 getInactiveStrips(event,rawInactiveDetIds);
404 std::string stripClusterProducer = pset_.getParameter<std::string>(
"stripClusterProducer");
408 std::vector<TkStripMeasurementDet*>::const_iterator
end = theStripDets.end()-200;
409 for (std::vector<TkStripMeasurementDet*>::const_iterator
i=theStripDets.begin();
413 _mm_prefetch(((
char *)(*(
i+200))),_MM_HINT_T0);
416 for (std::vector<TkStripMeasurementDet*>::const_iterator
i=end;
417 i!=theStripDets.end();
i++)
420 if( !stripClusterProducer.compare(
"") ) {
425 if (selfUpdateSkipClusters_){
427 LogDebug(
"MeasurementTracker")<<
"getting strp refs to skip";
428 event.getByLabel(pset_.getParameter<
edm::InputTag>(
"skipClusters"),stripClusterRefs);
433 event.getByLabel(stripClusterProducer, clusterHandle);
436 std::vector<TkStripMeasurementDet*>::const_iterator
i=theStripDets.begin();
437 std::vector<TkStripMeasurementDet*>::const_iterator endDet=theStripDets.end();
441 for (;it!=endColl; ++it) {
442 StripDetSet detSet = *it;
443 unsigned int id = detSet.
id();
444 while (
id != (**i).rawId()) {
446 if (i==endDet)
throw "we have a problem!!!!";
449 if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
450 (**i).setActiveThisEvent(
false);
continue;
454 (**i).update( detSet, clusterHandle,
id );
455 if (selfUpdateSkipClusters_){
457 if (f!=stripClusterRefs->end())
458 (**i).setClusterToSkip(f->
begin(),f->
end());
464 if(selfUpdateSkipClusters_){
465 LogDebug(
"MeasurementTracker")<<
"getting reg strp refs to skip";
466 event.getByLabel(pset_.getParameter<
edm::InputTag>(
"skipClusters"),stripClusterRefs);
472 event.getByLabel(stripClusterProducer, refClusterHandle);
474 std::string lazyGetter = pset_.getParameter<std::string>(
"stripLazyGetterProducer");
476 event.getByLabel(lazyGetter,lazyClusterHandle);
479 vector<SiStripCluster>::const_iterator beginIterator;
481 for(;iregion!=refClusterHandle->end();++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;
490 for (;icluster!=endIterator;icluster++) {
495 if( icluster->geographicalId() != tmpId){
504 if(theConcreteDet == 0)
508 theConcreteDetUpdatable->
update(beginIterator,icluster,lazyClusterHandle,tmpId);
509 if (selfUpdateSkipClusters_){
511 if (f!=stripClusterRefs->end())
516 tmpId = icluster->geographicalId();
517 beginIterator = icluster;
518 if( icluster == (endIterator-1)){
522 if(theConcreteDet == 0)
526 theConcreteDetUpdatable->
update(icluster,endIterator,lazyClusterHandle,tmpId);
527 if (selfUpdateSkipClusters_){
529 if (f!=stripClusterRefs->end())
533 }
else if( icluster == (endIterator-1)){
537 if(theConcreteDet == 0)
543 theConcreteDetUpdatable->
update(beginIterator,endIterator,lazyClusterHandle,tmpId);
544 if (selfUpdateSkipClusters_){
546 if (f!=stripClusterRefs->end())
561 std::map<DetId,MeasurementDet*>::const_iterator it = theDetMap.find(
id);
562 if(it !=theDetMap.end()) {
573 if (qualityFlags & BadStrips) {
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) {
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");
596 (*i)->setActive(
true);
599 (*i)->set128StripStatus(
true);
600 if (qualityFlags & BadAPVFibers) {
603 for (
int j = 0;
j < 6;
j++) {
605 if (badApvs & (1 <<
j)) {
606 (*i)->set128StripStatus(
false,
j);
610 for (
int j = 0;
j < 3;
j++) {
612 if (badFibers & (1 <<
j)) {
613 (*i)->set128StripStatus(
false, 2*
j);
614 (*i)->set128StripStatus(
false, 2*
j+1);
618 (*i)->setMaskBad128StripBlocks((qualityFlags & MaskBad128StripBlocks) != 0);
620 std::vector<TkStripMeasurementDet::BadStripBlock> &badStrips = (*i)->getBadStripBlocks();
622 if (qualityFlags & BadStrips) {
625 badStrips.push_back(quality->
decode(*bit));
627 (*i)->setBadStripCuts(badStripCuts[
SiStripDetId(detid).subdetId()-3]);
630 if (qualityDebugFlags & BadModules) {
632 " Total modules: " << tot <<
", active " << on <<
", inactive " << (tot - on);
634 if (qualityDebugFlags & BadAPVFibers) {
636 " Total APVs: " << atot <<
", active " << (atot-aoff) <<
", inactive " << (aoff);
638 " Total Fibers: " << ftot <<
", active " << (ftot-foff) <<
", inactive " << (foff);
641 for (std::vector<TkStripMeasurementDet*>::const_iterator
i=theStripDets.begin();
642 i!=theStripDets.end();
i++) {
643 (*i)->setActive(
true);
644 (*i)->set128StripStatus(
true);
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) {
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");
664 (*i)->setActive(
true);
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);
671 (*i)->clearBadRocPositions();
674 if (qualityDebugFlags & BadModules) {
676 " Total modules: " << tot <<
", active " << on <<
", inactive " << (tot - on);
678 if (qualityDebugFlags & BadROCs) {
679 edm::LogInfo(
"MeasurementTracker PixelROCStatus") <<
" Total of bad ROCs: " << badrocs ;
682 for (std::vector<TkPixelMeasurementDet*>::const_iterator
i=thePixelDets.begin();
683 i!=thePixelDets.end();
i++) {
684 (*i)->setActive(
true);
virtual char const * what() const
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
short getBadFibers(const uint32_t &detid) const
virtual ~MeasurementTracker()
const GeomDetUnit * monoDet() const
bool selfUpdateSkipClusters_
void setRegionalClustersToSkip(IT begin, IT end)
void updateStrips(const edm::Event &) const
virtual void update(const edm::Event &) const
std::vector< unsigned int >::const_iterator ContainerIterator
virtual const GeomDet & geomDet() const
const_iterator end() const
Get off the end iterator.
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< GeomDet * > DetContainer
const_iterator find(id_type i) const
id_type id(size_t cell) const
uint32_t rawId() const
get the raw id
void updatePixels(const edm::Event &) const
short getBadApvs(const uint32_t &detid) const
bool IsModuleUsable(const uint32_t &detid) const
const std::vector< LocalPoint > getBadRocPositions(const uint32_t &detid, const TrackerGeometry &theTracker, const SiPixelFedCabling *map) const
DetId geographicalId() const
The label of this GeomDet.
const_iterator end() const
bool IsModuleUsable(const uint32_t &detid) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
const_iterator begin() const
Get begin iterator.
void getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
Detector identifier class for the strip tracker.
void update(const detset &detSet, const edm::Handle< edmNew::DetSetVector< SiStripCluster > > h, unsigned int id)
void addGluedDet(const GluedGeomDet *gd, const SiStripRecHitMatcher *matcher) const
boost::indirect_iterator< typename collection_type::const_iterator > const_iterator
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)
virtual const MeasurementDet * idToDet(const DetId &id) const
MeasurementDetSystem interface.
const Range getRange(const uint32_t &detID) const
T const * product() const
short getBadRocs(const uint32_t &detid) const
std::pair< ContainerIterator, ContainerIterator > Range
void initializeStripStatus(const SiStripQuality *stripQuality, int qualityFlags, int qualityDebugFlags) const
void setClusterToSkip(const edm::InputTag &cluster, const edm::Event &event) const
void addPixelDet(const GeomDet *gd, const PixelClusterParameterEstimator *cpe) const
void addStripDet(const GeomDet *gd, const StripClusterParameterEstimator *cpe) const
void addStripDets(const TrackingGeometry::DetContainer &dets) const
void addPixelDets(const TrackingGeometry::DetContainer &dets) const
const GeomDetUnit * stereoDet() const
data decode(const unsigned int &value) const
void initializePixelStatus(const SiPixelQuality *stripQuality, const SiPixelFedCabling *pixelCabling, int qualityFlags, int qualityDebugFlags) const
void unsetClusterToSkip() const