CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
CTPPSPixelRawToDigi Class Reference

#include <CTPPSPixelRawToDigi.h>

Inheritance diagram for CTPPSPixelRawToDigi:
edm::stream::EDProducer<>

Public Member Functions

 CTPPSPixelRawToDigi (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 get data, convert to digis attach againe to Event More...
 
 ~CTPPSPixelRawToDigi () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::ParameterSet config_
 
std::set< unsigned int > fedIds_
 
edm::EDGetTokenT< FEDRawDataCollectionFEDRawDataCollection_
 
bool includeErrors_
 
edm::InputTag label_
 
std::string mappingLabel_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 22 of file CTPPSPixelRawToDigi.h.

Constructor & Destructor Documentation

CTPPSPixelRawToDigi::CTPPSPixelRawToDigi ( const edm::ParameterSet conf)
explicit

Definition at line 26 of file CTPPSPixelRawToDigi.cc.

References config_, FEDRawDataCollection_, edm::ParameterSet::getParameter(), includeErrors_, mappingLabel_, and AlCaHLTBitMon_QueryRunRegistry::string.

27  : config_(conf)
28 
29 {
30 
31  FEDRawDataCollection_ = consumes <FEDRawDataCollection> (config_.getParameter<edm::InputTag>("inputLabel"));
32 
33 
34  produces< edm::DetSetVector<CTPPSPixelDigi> >();
35 
36  includeErrors_ = config_.getParameter<bool> ("includeErrors");
37  mappingLabel_ = config_.getParameter<std::string> ("mappingLabel");
38 
39  if(includeErrors_){
40  produces< edm::DetSetVector<CTPPSPixelDataError> >();
41  }
42 }
T getParameter(std::string const &) const
edm::ParameterSet config_
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
CTPPSPixelRawToDigi::~CTPPSPixelRawToDigi ( )
override

Definition at line 45 of file CTPPSPixelRawToDigi.cc.

45  {
46  edm::LogInfo("CTPPSPixelRawToDigi") << " CTPPSPixelRawToDigi destructor!";
47 
48 }

Member Function Documentation

void CTPPSPixelRawToDigi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 50 of file CTPPSPixelRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

50  {
52  desc.add<bool>("includeErrors",true);
53  desc.add<edm::InputTag>("inputLabel",edm::InputTag("rawDataCollector"));
54  desc.add<std::string>("mappingLabel","RPix");
55  descriptions.add("ctppsPixelDigis", desc);
56 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void CTPPSPixelRawToDigi::produce ( edm::Event ev,
const edm::EventSetup es 
)
override

get data, convert to digis attach againe to Event

create product (digis & errors)

get event data for this fed

errors given dummy detId must be sorted by Fed

send digis and errors back to framework

Definition at line 59 of file CTPPSPixelRawToDigi.cc.

References universalConfigTemplate::collection, edm::DetSet< T >::data, TauDecayModes::dec, DEFINE_FWK_MODULE, RPixErrorChecker::dummyDetId, benchmark_cfg::errors, FEDRawDataCollection::FEDData(), l1t::stage2::layer2::fedId, CTPPSPixelDAQMapping::fedIds(), fedIds_, FEDRawDataCollection_, edm::EventSetup::get(), edm::Event::getByToken(), includeErrors_, CTPPSPixelDataFormatter::interpretRawData(), LogDebug, taus_updatedMVAIds_cff::mapping, FEDNumbering::MAXCTPPSPixelsFEDID, FEDNumbering::MINCTPPSPixelsFEDID, eostools::move(), edm::Event::put(), CTPPSPixelDAQMapping::ROCMapping, CTPPSPixelDataFormatter::setErrorStatus(), and FEDRawData::size().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

61 {
62 
64  ev.getByToken(FEDRawDataCollection_, buffers);
65 
67 
68  bool data_exist=false;
70  const FEDRawData& tempRawData = buffers->FEDData( fed );
71  if(tempRawData.size()!=0){
72  data_exist=true;
73  break;
74  }
75  }
77  auto collection = std::make_unique<edm::DetSetVector<CTPPSPixelDigi>>();
78 
79  auto errorcollection = std::make_unique<edm::DetSetVector<CTPPSPixelDataError>>();
80 
81  if(data_exist){
82  es.get<CTPPSPixelDAQMappingRcd>().get( mapping);
83 
84  fedIds_ = mapping->fedIds();
85 
86  CTPPSPixelDataFormatter formatter(mapping->ROCMapping);
87  formatter.setErrorStatus(includeErrors_);
88 
89  bool errorsInEvent = false;
91 
92 
93  for (auto aFed = fedIds_.begin(); aFed != fedIds_.end(); ++aFed) {
94  int fedId = *aFed;
95 
96  edm::LogInfo("CTPPSPixelRawToDigi")<< " PRODUCE DIGI FOR FED: " << dec <<fedId << endl;
97 
100  const FEDRawData& fedRawData = buffers->FEDData( fedId );
101 
102  formatter.interpretRawData( errorsInEvent, fedId, fedRawData, *collection, errors);
103 
104  if(includeErrors_) {
105  for(auto const &is : errors){
106  uint32_t errordetid = is.first;
108  if (errordetid==RPixErrorChecker::dummyDetId) {
109  nodeterrors.insert( nodeterrors.end(), errors[errordetid].begin(), errors[errordetid].end() );
110  } else {
111  edm::DetSet<CTPPSPixelDataError>& errorDetSet = errorcollection->find_or_insert(errordetid);
112  errorDetSet.data.insert(errorDetSet.data.end(), is.second.begin(), is.second.end());
113  }
114  }
115  }
116  }
117 
118  if(includeErrors_) {
119  errorcollection->find_or_insert(RPixErrorChecker::dummyDetId).data = nodeterrors;
120  }
121  if (errorsInEvent) LogDebug("CTPPSPixelRawToDigi") << "Error words were stored in this event";
122  }
124  ev.put(std::move(collection));
125 
126  if(includeErrors_){
127  ev.put(std::move(errorcollection));
128  }
129 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::set< unsigned int > fedIds() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::map< uint32_t, DetErrors > Errors
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
static constexpr Word32 dummyDetId
std::set< unsigned int > fedIds_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::vector< CTPPSPixelDataError > DetErrors
std::map< CTPPSPixelFramePosition, CTPPSPixelROCInfo > ROCMapping
collection_type data
Definition: DetSet.h:78
T get() const
Definition: EventSetup.h:68
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::ParameterSet CTPPSPixelRawToDigi::config_
private

Definition at line 36 of file CTPPSPixelRawToDigi.h.

Referenced by CTPPSPixelRawToDigi().

std::set<unsigned int> CTPPSPixelRawToDigi::fedIds_
private

Definition at line 40 of file CTPPSPixelRawToDigi.h.

Referenced by produce().

edm::EDGetTokenT<FEDRawDataCollection> CTPPSPixelRawToDigi::FEDRawDataCollection_
private

Definition at line 38 of file CTPPSPixelRawToDigi.h.

Referenced by CTPPSPixelRawToDigi(), and produce().

bool CTPPSPixelRawToDigi::includeErrors_
private

Definition at line 46 of file CTPPSPixelRawToDigi.h.

Referenced by CTPPSPixelRawToDigi(), and produce().

edm::InputTag CTPPSPixelRawToDigi::label_
private
std::string CTPPSPixelRawToDigi::mappingLabel_
private

Definition at line 44 of file CTPPSPixelRawToDigi.h.

Referenced by CTPPSPixelRawToDigi().