New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PixelFed25 error propagation to tracking #20151
Changes from all commits
f94f3be
918f76e
1b2c227
52ed124
aa06281
9c8105a
c11c6c5
e86c229
1a1fa22
8d2d883
ef534f3
b1e1541
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef SiPixelDetId_PixelFEDChannel_H | ||
#define SiPixelDetId_PixelFEDChannel_H | ||
|
||
#include "DataFormats/Common/interface/DetSetVectorNew.h" | ||
|
||
struct PixelFEDChannel { | ||
unsigned int fed, link, roc_first, roc_last; | ||
}; | ||
|
||
inline bool operator<( const PixelFEDChannel& one, const PixelFEDChannel& other) { | ||
if (one.fed == other.fed) return one.link<other.link; | ||
return one.fed < other.fed; | ||
} | ||
|
||
typedef edmNew::DetSetVector<PixelFEDChannel> PixelFEDChannelCollection; | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,17 @@ | |
<version ClassVersion="11" checksum="1218239916"/> | ||
<version ClassVersion="10" checksum="64579558"/> | ||
</class> | ||
<class name="PixelFEDChannel" ClassVersion="3"> | ||
<version ClassVersion="3" checksum="2591256255"/> | ||
</class> | ||
<class name="std::vector<PixelFEDChannel>"/> | ||
<class name="edm::EDCollection<PixelFEDChannel>"/> | ||
<class name="edmNew::DetSet<PixelFEDChannel>"/> | ||
<class name="std::vector<edmNew::DetSet<PixelFEDChannel> >"/> | ||
<class name="edmNew::DetSetVector<PixelFEDChannel>"/> | ||
<class name="edm::Wrapper<std::vector<PixelFEDChannel> >"/> | ||
<class name="edm::Wrapper<edm::EDCollection<PixelFEDChannel> >"/> | ||
<class name="edm::Wrapper<edmNew::DetSet<PixelFEDChannel> >"/> | ||
<class name="edm::Wrapper<std::vector<edmNew::DetSet<PixelFEDChannel> > >"/> | ||
<class name="edm::Wrapper<edmNew::DetSetVector<PixelFEDChannel> >"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are all of these dictionaries really necessary, considering that only
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DetSetVector is the one actually used for the bad channel propagation. So I believe EDCollection is the only line above that is not being used (explicitly or implicitly) for the time being; however, if there is no argument against keeping it, it would be a good to do so in case some user does not want to put the overhead of the DetId mapping in the event that otherwise comes with PixelFEDChannelCollection. (PixelFEDChannel is a generic class, not necessarily for what we use it here.) |
||
</lcgdict> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
// enabled by: process.siPixelDigis.UseQualityInfo = True (BY DEFAULT NOT USED) | ||
// 20-10-2010 Andrew York (Tennessee) | ||
// Jan 2016 Tamas Almos Vami (Tav) (Wigner RCP) -- Cabling Map label option | ||
// Jul 2017 Viktor Veszpremi -- added PixelFEDChannel | ||
|
||
#include "SiPixelRawToDigi.h" | ||
|
||
|
@@ -31,6 +32,7 @@ | |
|
||
#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" | ||
|
||
#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" | ||
#include "EventFilter/SiPixelRawToDigi/interface/PixelUnpackingRegions.h" | ||
#include "FWCore/Framework/interface/ConsumesCollector.h" | ||
|
||
|
@@ -42,9 +44,9 @@ using namespace std; | |
// ----------------------------------------------------------------------------- | ||
SiPixelRawToDigi::SiPixelRawToDigi( const edm::ParameterSet& conf ) | ||
: config_(conf), | ||
badPixelInfo_(0), | ||
regions_(0), | ||
hCPU(0), hDigi(0) | ||
badPixelInfo_(nullptr), | ||
regions_(nullptr), | ||
hCPU(nullptr), hDigi(nullptr) | ||
{ | ||
|
||
includeErrors = config_.getParameter<bool>("IncludeErrors"); | ||
|
@@ -67,11 +69,12 @@ SiPixelRawToDigi::SiPixelRawToDigi( const edm::ParameterSet& conf ) | |
produces< edm::DetSetVector<SiPixelRawDataError> >(); | ||
produces<DetIdCollection>(); | ||
produces<DetIdCollection>("UserErrorModules"); | ||
produces<edmNew::DetSetVector<PixelFEDChannel> >(); | ||
} | ||
|
||
// regions | ||
if (config_.exists("Regions")) { | ||
if(config_.getParameter<edm::ParameterSet>("Regions").getParameterNames().size() > 0) | ||
if(!config_.getParameter<edm::ParameterSet>("Regions").getParameterNames().empty()) | ||
{ | ||
regions_ = new PixelUnpackingRegions(config_, consumesCollector()); | ||
} | ||
|
@@ -96,7 +99,7 @@ SiPixelRawToDigi::SiPixelRawToDigi( const edm::ParameterSet& conf ) | |
usePhase1 = false; | ||
if (config_.exists("UsePhase1")) { | ||
usePhase1 = config_.getParameter<bool> ("UsePhase1"); | ||
if(usePhase1) edm::LogInfo("SiPixelRawToDigi") << " Use pilot blade data (FED 40)"; | ||
if(usePhase1) edm::LogInfo("SiPixelRawToDigi") << " Using phase1"; | ||
} | ||
//CablingMap could have a label //Tav | ||
cablingMapLabel = config_.getParameter<std::string> ("CablingMapLabel"); | ||
|
@@ -191,6 +194,7 @@ void SiPixelRawToDigi::produce( edm::Event& ev, | |
auto errorcollection = std::make_unique<edm::DetSetVector<SiPixelRawDataError>>(); | ||
auto tkerror_detidcollection = std::make_unique<DetIdCollection>(); | ||
auto usererror_detidcollection = std::make_unique<DetIdCollection>(); | ||
auto disabled_channelcollection = std::make_unique<edmNew::DetSetVector<PixelFEDChannel> >(); | ||
|
||
//PixelDataFormatter formatter(cabling_.get()); // phase 0 only | ||
PixelDataFormatter formatter(cabling_.get(), usePhase1); // for phase 1 & 0 | ||
|
@@ -241,30 +245,58 @@ void SiPixelRawToDigi::produce( edm::Event& ev, | |
// in the configurable error list in the job option cfi. | ||
// Code needs to be here, because there can be a set of errors for each | ||
// entry in the for loop over PixelDataFormatter::Errors | ||
if(!tkerrorlist.empty() || !usererrorlist.empty()){ | ||
DetId errorDetId(errordetid); | ||
edm::DetSet<SiPixelRawDataError>::const_iterator itPixelError=errorDetSet.begin(); | ||
for(; itPixelError!=errorDetSet.end(); ++itPixelError){ | ||
// fill list of detIds to be turned off by tracking | ||
if(!tkerrorlist.empty()) { | ||
std::vector<int>::iterator it_find = find(tkerrorlist.begin(), tkerrorlist.end(), itPixelError->getType()); | ||
if(it_find != tkerrorlist.end()){ | ||
|
||
std::vector<PixelFEDChannel> disabledChannelsDetSet; | ||
|
||
for (auto const& aPixelError : errorDetSet) { | ||
// For the time being, we extend the error handling functionality with ErrorType 25 | ||
// In the future, we should sort out how the usage of tkerrorlist can be generalized | ||
if (aPixelError.getType()==25) { | ||
assert(aPixelError.getFedId()==fedId); | ||
const sipixelobjects::PixelFEDCabling* fed = cabling_->fed(fedId); | ||
if (fed) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be fed != nullptr (surprising that clang-tidy did not flag this) |
||
cms_uint32_t linkId = formatter.linkId(aPixelError.getWord32()); | ||
const sipixelobjects::PixelFEDLink* link = fed->link(linkId); | ||
if (link) { | ||
// The "offline" 0..15 numbering is fixed by definition, also, the FrameConversion depends on it | ||
// in contrast, the ROC-in-channel numbering is determined by hardware --> better to use the "offline" scheme | ||
PixelFEDChannel ch = {fed->id(), linkId, 25, 0}; | ||
for (unsigned int iRoc=1; iRoc<=link->numberOfROCs(); iRoc++) { | ||
const sipixelobjects::PixelROC * roc = link->roc(iRoc); | ||
if (roc->idInDetUnit()<ch.roc_first) ch.roc_first=roc->idInDetUnit(); | ||
if (roc->idInDetUnit()>ch.roc_last) ch.roc_last=roc->idInDetUnit(); | ||
} | ||
disabledChannelsDetSet.push_back(ch); | ||
} | ||
} | ||
} else { | ||
// fill list of detIds to be turned off by tracking | ||
if(!tkerrorlist.empty()) { | ||
std::vector<int>::iterator it_find = find(tkerrorlist.begin(), tkerrorlist.end(), aPixelError.getType()); | ||
if(it_find != tkerrorlist.end()){ | ||
tkerror_detidcollection->push_back(errordetid); | ||
} | ||
} | ||
} | ||
// fill list of detIds with errors to be studied | ||
if(!usererrorlist.empty()) { | ||
std::vector<int>::iterator it_find = find(usererrorlist.begin(), usererrorlist.end(), itPixelError->getType()); | ||
if(it_find != usererrorlist.end()){ | ||
usererror_detidcollection->push_back(errordetid); | ||
} | ||
} | ||
|
||
// fill list of detIds with errors to be studied | ||
if(!usererrorlist.empty()) { | ||
std::vector<int>::iterator it_find = find(usererrorlist.begin(), usererrorlist.end(), aPixelError.getType()); | ||
if(it_find != usererrorlist.end()){ | ||
usererror_detidcollection->push_back(errordetid); | ||
} | ||
} | ||
|
||
} // loop on DetSet of errors | ||
|
||
if (!disabledChannelsDetSet.empty()) { | ||
disabled_channelcollection->insert(errordetid, disabledChannelsDetSet.data(), disabledChannelsDetSet.size()); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} // if error assigned to a real DetId | ||
} // loop on errors in event for this FED | ||
} // if errors to be included in the event | ||
} // loop on FED data to be unpacked | ||
|
||
if(includeErrors) { | ||
edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection->find_or_insert(dummydetid); | ||
|
@@ -289,5 +321,6 @@ void SiPixelRawToDigi::produce( edm::Event& ev, | |
ev.put(std::move(errorcollection)); | ||
ev.put(std::move(tkerror_detidcollection)); | ||
ev.put(std::move(usererror_detidcollection), "UserErrorModules"); | ||
ev.put(std::move(disabled_channelcollection)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ namespace { | |
constexpr int PXID_bits = 8; | ||
constexpr int ADC_bits = 8; | ||
constexpr int OMIT_ERR_bits = 1; | ||
constexpr int AUTO_MASK_bits = 1; | ||
|
||
constexpr int CRC_shift = 2; | ||
constexpr int ADC_shift = 0; | ||
|
@@ -33,6 +34,7 @@ namespace { | |
constexpr int ROC_shift = DCOL_shift + DCOL_bits; | ||
constexpr int LINK_shift = ROC_shift + ROC_bits; | ||
constexpr int OMIT_ERR_shift = 20; | ||
constexpr int AUTO_MASK_shift = 20; | ||
|
||
constexpr cms_uint32_t dummyDetId = 0xffffffff; | ||
|
||
|
@@ -110,13 +112,16 @@ bool ErrorChecker::checkTrailer(bool& errorsInEvent, int fedId, int nWords, cons | |
return fedTrailer.moreTrailers(); | ||
} | ||
|
||
bool ErrorChecker::checkROC(bool& errorsInEvent, int fedId, const SiPixelFrameConverter* converter, Word32& errorWord, Errors& errors) | ||
bool ErrorChecker::checkROC(bool& errorsInEvent, int fedId, const SiPixelFrameConverter* converter, | ||
const SiPixelFedCabling* theCablingTree, Word32& errorWord, Errors& errors) | ||
{ | ||
int errorType = (errorWord >> ROC_shift) & ERROR_mask; | ||
if likely(errorType<25) return true; | ||
|
||
switch (errorType) { | ||
case(25) : { | ||
CablingPathToDetUnit cablingPath = { unsigned(fedId), (errorWord >> LINK_shift) & LINK_mask, 1 }; | ||
if (!theCablingTree->findItem(cablingPath)) return false; | ||
LogDebug("")<<" invalid ROC=25 found (errorType=25)"; | ||
errorsInEvent = true; | ||
break; | ||
|
@@ -145,6 +150,15 @@ bool ErrorChecker::checkROC(bool& errorsInEvent, int fedId, const SiPixelFrameCo | |
} | ||
case(30) : { | ||
LogDebug("")<<" TBM error trailer (errorType=30)"; | ||
int StateMatch_bits = 4; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please make these const and unsigned ints in a follow up pr. |
||
int StateMatch_shift = 8; | ||
uint32_t StateMatch_mask = ~(~uint32_t(0) << StateMatch_bits); | ||
int StateMatch = (errorWord >> StateMatch_shift) & StateMatch_mask; | ||
if( StateMatch!=1 && StateMatch!=8 ) { | ||
LogDebug("")<<" FED error 30 with unexpected State Bits (errorType=30)"; | ||
return false; | ||
} | ||
if( StateMatch==1 ) errorType = 40; // 1=Overflow -> 40, 8=number of ROCs -> 30 | ||
errorsInEvent = true; | ||
break; | ||
} | ||
|
@@ -157,15 +171,6 @@ bool ErrorChecker::checkROC(bool& errorsInEvent, int fedId, const SiPixelFrameCo | |
}; | ||
|
||
if(includeErrors) { | ||
// check to see if overflow error for type 30, change type to 40 if so | ||
if(errorType==30) { | ||
int StateMach_bits = 4; | ||
int StateMach_shift = 8; | ||
uint32_t StateMach_mask = ~(~uint32_t(0) << StateMach_bits); | ||
int StateMach = (errorWord >> StateMach_shift) & StateMach_mask; | ||
if( StateMach==4 || StateMach==9 ) errorType = 40; | ||
} | ||
|
||
// store error | ||
SiPixelRawDataError error(errorWord, errorType, fedId); | ||
cms_uint32_t detId; | ||
|
@@ -232,16 +237,15 @@ cms_uint32_t ErrorChecker::errorDetId(const SiPixelFrameConverter* converter, | |
|
||
switch (errorType) { | ||
case 25 : case 30 : case 31 : case 36 : case 40 : { | ||
// set dummy values for cabling just to get detId from link if in Barrel | ||
// set dummy values for cabling just to get detId from link | ||
cabling.dcol = 0; | ||
cabling.pxid = 2; | ||
cabling.roc = 1; | ||
cabling.link = (word >> LINK_shift) & LINK_mask; | ||
|
||
DetectorIndex detIdx; | ||
int status = converter->toDetector(cabling, detIdx); | ||
if (status) break; | ||
if(DetId(detIdx.rawId).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) return detIdx.rawId; | ||
if (!status) return detIdx.rawId; | ||
break; | ||
} | ||
case 29 : { | ||
|
@@ -274,8 +278,7 @@ cms_uint32_t ErrorChecker::errorDetId(const SiPixelFrameConverter* converter, | |
cabling.link = chanNmbr; | ||
DetectorIndex detIdx; | ||
int status = converter->toDetector(cabling, detIdx); | ||
if (status) break; | ||
if(DetId(detIdx.rawId).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) return detIdx.rawId; | ||
if (!status) return detIdx.rawId; | ||
break; | ||
} | ||
case 37 : case 38: { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@veszpv how often is this warning issued actually?
I am just concerned that this might fill up logs at Tier0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was changed to debug as a hack, I am putting the warning back now. Should never be issued after the PR. If so, it is a good reason to investigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't seen this show up in my test on run 300517 (LS ~600) on 4K events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It used to generate ~418 warning per event for uncabled FED channels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@veszpv, @slava77 thanks!