67 produces< edm::DetSetVector<PixelDigi> >();
69 produces< edm::DetSetVector<SiPixelRawDataError> >();
70 produces<DetIdCollection>();
71 produces<DetIdCollection>(
"UserErrorModules");
72 produces<edmNew::DetSetVector<PixelFEDChannel> >();
87 hCPU =
new TH1D (
"hCPU",
"hCPU",100,0.,0.050);
88 hDigi =
new TH1D(
"hDigi",
"hDigi",50,0.,15000.);
112 edm::LogInfo(
"SiPixelRawToDigi") <<
" HERE ** SiPixelRawToDigi destructor!";
117 TFile
rootFile(
"analysis.root",
"RECREATE",
"my histograms");
127 desc.
add<
bool>(
"IncludeErrors",
true);
128 desc.
add<
bool>(
"UseQualityInfo",
false);
130 std::vector<int> temp1;
133 desc.
add<std::vector<int> >(
"ErrorList",temp1)->setComment(
"## ErrorList: list of error codes used by tracking to invalidate modules");
136 std::vector<int> temp1;
139 desc.
add<std::vector<int> >(
"UserErrorList",temp1)->setComment(
"## UserErrorList: list of error codes used by Pixel experts for investigation");
144 psd0.
addOptional<std::vector<edm::InputTag>>(
"inputs");
151 desc.
add<
bool>(
"UsePilotBlade",
false)->setComment(
"## Use pilot blades");
152 desc.
add<
bool>(
"UsePhase1",
false)->setComment(
"## Use phase1");
153 desc.
add<
std::string>(
"CablingMapLabel",
"")->setComment(
"CablingMap label");
155 descriptions.
add(
"siPixelRawToDigi",desc);
165 const uint32_t dummydetid = 0xffffffff;
184 edm::LogError(
"SiPixelQualityNotPresent")<<
" Configured to use SiPixelQuality, but SiPixelQuality not present"<<endl;
192 auto collection = std::make_unique<edm::DetSetVector<PixelDigi>>();
194 auto errorcollection = std::make_unique<edm::DetSetVector<SiPixelRawDataError>>();
195 auto tkerror_detidcollection = std::make_unique<DetIdCollection>();
196 auto usererror_detidcollection = std::make_unique<DetIdCollection>();
197 auto disabled_channelcollection = std::make_unique<edmNew::DetSetVector<PixelFEDChannel> >();
207 bool errorsInEvent =
false;
217 for (
auto aFed =
fedIds.begin(); aFed !=
fedIds.end(); ++aFed) {
224 if(
debug)
LogDebug(
"SiPixelRawToDigi")<<
" PRODUCE DIGI FOR FED: " << fedId << endl;
232 formatter.interpretRawData( errorsInEvent, fedId, fedRawData, *
collection, errors);
236 typedef PixelDataFormatter::Errors::iterator IE;
237 for (IE is = errors.begin(); is != errors.end(); is++) {
238 uint32_t errordetid = is->first;
239 if (errordetid==dummydetid) {
240 nodeterrors.insert( nodeterrors.end(), errors[errordetid].begin(), errors[errordetid].end() );
243 errorDetSet.
data.insert(errorDetSet.
data.end(), is->second.begin(), is->second.end());
249 std::vector<PixelFEDChannel> disabledChannelsDetSet;
251 for (
auto const& aPixelError : errorDetSet) {
254 if (aPixelError.getType()==25) {
255 assert(aPixelError.getFedId()==
fedId);
258 cms_uint32_t linkId = formatter.linkId(aPixelError.getWord32());
264 for (
unsigned int iRoc=1; iRoc<=link->
numberOfROCs(); iRoc++) {
269 disabledChannelsDetSet.push_back(ch);
277 tkerror_detidcollection->push_back(errordetid);
286 usererror_detidcollection->push_back(errordetid);
292 if (!disabledChannelsDetSet.empty()) {
293 disabled_channelcollection->insert(errordetid, disabledChannelsDetSet.data(), disabledChannelsDetSet.size());
303 errorDetSet.
data = nodeterrors;
305 if (errorsInEvent)
LogDebug(
"SiPixelRawToDigi") <<
"Error words were stored in this event";
309 LogDebug(
"SiPixelRawToDigi") <<
"TIMING IS: (real)" <<
theTimer->realTime() ;
310 ndigis += formatter.nDigis();
311 nwords += formatter.nWords();
312 LogDebug(
"SiPixelRawToDigi") <<
" (Words/Digis) this ev: " 313 <<formatter.nWords()<<
"/"<<formatter.nDigis() <<
"--- all :"<<
nwords<<
"/"<<
ndigis;
315 hDigi->Fill(formatter.nDigis());
323 ev.
put(
std::move(usererror_detidcollection),
"UserErrorModules");
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< edm::CPUTimer > theTimer
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
const PixelROC * roc(unsigned int id) const
return ROC identified by id. ROC ids are ranged [1,numberOfROCs]
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
static MessageDrop * instance()
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< int > usererrorlist
const std::set< unsigned int > * modulesToUnpack() const
full set of module ids to unpack
std::string cablingMapLabel
void produce(edm::Event &, const edm::EventSetup &) override
get data, convert to digis attach againe to Event
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
PixelUnpackingRegions * regions_
unsigned int numberOfROCs() const
number of ROCs in fed
std::vector< unsigned int > fedIds
SiPixelRawToDigi(const edm::ParameterSet &)
ctor
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
std::unique_ptr< SiPixelFedCablingTree > cabling_
unsigned int nBarrelModules() const
edm::EDGetTokenT< FEDRawDataCollection > tFEDRawDataCollection
std::vector< std::string > getParameterNames() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
unsigned int cms_uint32_t
~SiPixelRawToDigi() override
dtor
edm::ESWatcher< SiPixelFedCablingMapRcd > recordWatcher
void run(const edm::Event &e, const edm::EventSetup &es)
has to be run during each event
std::unique_ptr< SiPixelFedCablingTree > cablingTree() const
unsigned int nModules() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< int > tkerrorlist
bool check(const edm::EventSetup &iSetup)
edm::ParameterSet config_
unsigned int nForwardModules() const
unsigned int nFEDs() const
various informational accessors:
bool mayUnpackFED(unsigned int fed_n) const
check whether a FED has to be unpacked
std::vector< unsigned int > fedIds() const
edm::ESWatcher< SiPixelQualityRcd > qualityWatcher
T const * product() const
const SiPixelQuality * badPixelInfo_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)