CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
Phase2Tracker::Phase2TrackerDigiProducer Class Reference

#include <Phase2TrackerDigiProducer.h>

Inheritance diagram for Phase2Tracker::Phase2TrackerDigiProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  Registry
 

Public Member Functions

void beginJob () override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endJob () override
 
 Phase2TrackerDigiProducer (const edm::ParameterSet &pset)
 constructor More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~Phase2TrackerDigiProducer () override
 default constructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

const Phase2TrackerCablingcabling_
 
uint32_t cacheId_
 
DetIdCollection detids_
 
std::vector< Phase2TrackerDigiproc_work_digis_
 
std::vector< Registryproc_work_registry_
 
unsigned int runNumber_
 
edm::EDGetTokenT< FEDRawDataCollectiontoken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 24 of file Phase2TrackerDigiProducer.h.

Constructor & Destructor Documentation

◆ Phase2TrackerDigiProducer()

Phase2Tracker::Phase2TrackerDigiProducer::Phase2TrackerDigiProducer ( const edm::ParameterSet pset)

constructor

Definition at line 25 of file Phase2TrackerDigiProducer.cc.

26  : runNumber_(0), cabling_(nullptr), cacheId_(0) {
27  // define product
28  produces<edm::DetSetVector<Phase2TrackerDigi>>("ProcessedRaw");
29  token_ = consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("ProductLabel"));
30  }

References muonDTDigis_cfi::pset, and token_.

◆ ~Phase2TrackerDigiProducer()

Phase2Tracker::Phase2TrackerDigiProducer::~Phase2TrackerDigiProducer ( )
override

default constructor

Definition at line 32 of file Phase2TrackerDigiProducer.cc.

32 {}

Member Function Documentation

◆ beginJob()

void Phase2Tracker::Phase2TrackerDigiProducer::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 34 of file Phase2TrackerDigiProducer.cc.

34 {}

◆ beginRun()

void Phase2Tracker::Phase2TrackerDigiProducer::beginRun ( edm::Run const &  run,
edm::EventSetup const &  es 
)
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 36 of file Phase2TrackerDigiProducer.cc.

36  {
37  // fetch cabling from event setup
39  es.get<Phase2TrackerCablingRcd>().get(c);
40  cabling_ = c.product();
41  }

References HltBtagPostValidation_cff::c, cabling_, edm::EventSetup::get(), and get.

◆ endJob()

void Phase2Tracker::Phase2TrackerDigiProducer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 43 of file Phase2TrackerDigiProducer.cc.

43 {}

◆ produce()

void Phase2Tracker::Phase2TrackerDigiProducer::produce ( edm::Event event,
const edm::EventSetup es 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 45 of file Phase2TrackerDigiProducer.cc.

45  {
46  // empty vectors for the next event
47  proc_work_registry_.clear();
48  proc_work_digis_.clear();
49 
50  // Retrieve FEDRawData collection
52  event.getByToken(token_, buffers);
53 
54  // Analyze strip tracker FED buffers in data
55  size_t fedIndex;
56  for (fedIndex = Phase2Tracker::FED_ID_MIN; fedIndex < Phase2Tracker::CMS_FED_ID_MAX; ++fedIndex) {
57  const FEDRawData& fed = buffers->FEDData(fedIndex);
58  if (fed.size() != 0) {
59  // construct buffer
62 
63 #ifdef EDM_ML_DEBUG
64  std::ostringstream ss;
65  ss << " -------------------------------------------- " << endl;
66  ss << " buffer debug ------------------------------- " << endl;
67  ss << " -------------------------------------------- " << endl;
68  ss << " buffer size : " << buffer->bufferSize() << endl;
69  ss << " fed id : " << fedIndex << endl;
70  ss << " -------------------------------------------- " << endl;
71  ss << " tracker header debug ------------------------" << endl;
72  ss << " -------------------------------------------- " << endl;
73  LogTrace("Phase2TrackerDigiProducer") << ss.str();
74  ss.clear();
75  ss.str("");
76 
77  Phase2TrackerFEDHeader tr_header = buffer->trackerHeader();
78  ss << " Version : " << hex << setw(2) << (int)tr_header.getDataFormatVersion() << endl;
79  ss << " Mode : " << hex << setw(2) << tr_header.getDebugMode() << endl;
80  ss << " Type : " << hex << setw(2) << (int)tr_header.getEventType() << endl;
81  ss << " Readout : " << hex << setw(2) << tr_header.getReadoutMode() << endl;
82  ss << " Condition Data : " << (tr_header.getConditionData() ? "Present" : "Absent") << "\n";
83  ss << " Data Type : " << (tr_header.getDataType() ? "Real" : "Fake") << "\n";
84  ss << " Status : " << hex << setw(16) << (int)tr_header.getGlibStatusCode() << endl;
85  ss << " FE stat : ";
86  for (int i = 15; i >= 0; i--) {
87  if ((tr_header.frontendStatus())[i]) {
88  ss << "1";
89  } else {
90  ss << "0";
91  }
92  }
93  ss << endl;
94  ss << " Nr CBC : " << hex << setw(16) << (int)tr_header.getNumberOfCBC() << endl;
95  ss << " CBC stat : ";
96  for (int i = 0; i < tr_header.getNumberOfCBC(); i++) {
97  ss << hex << setw(2) << (int)tr_header.CBCStatus()[i] << " ";
98  }
99  ss << endl;
100  LogTrace("Phase2TrackerDigiProducer") << ss.str();
101  ss.clear();
102  ss.str("");
103  ss << " -------------------------------------------- " << endl;
104  ss << " Payload ----------------------------------- " << endl;
105  ss << " -------------------------------------------- " << endl;
106 #endif
107 
108  // loop channels
109  int ichan = 0;
110  for (int ife = 0; ife < MAX_FE_PER_FED; ife++) {
111  for (int icbc = 0; icbc < MAX_CBC_PER_FE; icbc++) {
112  const Phase2TrackerFEDChannel& channel = buffer->channel(ichan);
113  if (channel.length() > 0) {
114  // get fedid from cabling
115  const Phase2TrackerModule mod = cabling_->findFedCh(std::make_pair(fedIndex, ife));
116  uint32_t detid = mod.getDetid();
117 #ifdef EDM_ML_DEBUG
118  ss << dec << " id from cabling : " << detid << endl;
119  ss << dec << " reading channel : " << icbc << " on FE " << ife;
120  ss << dec << " with length : " << (int)channel.length() << endl;
121 #endif
122 
123  // container for this channel's digis
124  std::vector<Phase2TrackerDigi> stripsTop;
125  std::vector<Phase2TrackerDigi> stripsBottom;
126 
127  // unpacking data
128  Phase2TrackerFEDRawChannelUnpacker unpacker = Phase2TrackerFEDRawChannelUnpacker(channel);
129  while (unpacker.hasData()) {
130  if (unpacker.stripOn()) {
131  if (unpacker.stripIndex() % 2) {
132  stripsTop.push_back(Phase2TrackerDigi((int)(STRIPS_PER_CBC * icbc + unpacker.stripIndex()) / 2, 0));
133 #ifdef EDM_ML_DEBUG
134  ss << "t";
135 #endif
136  } else {
137  stripsBottom.push_back(
138  Phase2TrackerDigi((int)(STRIPS_PER_CBC * icbc + unpacker.stripIndex()) / 2, 0));
139 #ifdef EDM_ML_DEBUG
140  ss << "b";
141 #endif
142  }
143  } else {
144 #ifdef EDM_ML_DEBUG
145  ss << "_";
146 #endif
147  }
148  unpacker++;
149  }
150 #ifdef EDM_ML_DEBUG
151  ss << endl;
152  LogTrace("Phase2TrackerDigiProducer") << ss.str();
153  ss.clear();
154  ss.str("");
155 #endif
156 
157  // store beginning and end of this digis for this detid and add this registry to the list
158  // and store data
159  Registry regItemTop(detid + 1, STRIPS_PER_CBC * icbc / 2, proc_work_digis_.size(), stripsTop.size());
160  proc_work_registry_.push_back(regItemTop);
161  proc_work_digis_.insert(proc_work_digis_.end(), stripsTop.begin(), stripsTop.end());
162  Registry regItemBottom(
163  detid + 2, STRIPS_PER_CBC * icbc / 2, proc_work_digis_.size(), stripsBottom.size());
164  proc_work_registry_.push_back(regItemBottom);
165  proc_work_digis_.insert(proc_work_digis_.end(), stripsBottom.begin(), stripsBottom.end());
166  }
167  ichan++;
168  }
169  } // end loop on channels
170  // store digis in edm collections
171  std::sort(proc_work_registry_.begin(), proc_work_registry_.end());
172  std::vector<edm::DetSet<Phase2TrackerDigi>> sorted_and_merged;
173 
175 
176  std::vector<Registry>::iterator it = proc_work_registry_.begin(), it2 = it + 1, end = proc_work_registry_.end();
177  while (it < end) {
178  sorted_and_merged.push_back(edm::DetSet<Phase2TrackerDigi>(it->detid));
179  std::vector<Phase2TrackerDigi>& digis = sorted_and_merged.back().data;
180  // first count how many digis we have
181  size_t len = it->length;
182  for (it2 = it + 1; (it2 != end) && (it2->detid == it->detid); ++it2) {
183  len += it2->length;
184  }
185  // reserve memory
186  digis.reserve(len);
187  // push them in
188  for (it2 = it + 0; (it2 != end) && (it2->detid == it->detid); ++it2) {
189  digis.insert(digis.end(), &proc_work_digis_[it2->index], &proc_work_digis_[it2->index + it2->length]);
190  }
191  it = it2;
192  }
193 
194  edm::DetSetVector<Phase2TrackerDigi> proc_raw_dsv(sorted_and_merged, true);
195  pr->swap(proc_raw_dsv);
196  event.put(std::unique_ptr<edm::DetSetVector<Phase2TrackerDigi>>(pr), "ProcessedRaw");
197  delete buffer;
198  }
199  }
200  }

References edmScanValgrind::buffer, cabling_, Phase2Tracker::Phase2TrackerFEDHeader::CBCStatus(), Phase2Tracker::CMS_FED_ID_MAX, FEDRawData::data(), TauDecayModes::dec, end, Phase2Tracker::FED_ID_MIN, FEDRawDataCollection::FEDData(), Phase2TrackerCabling::findFedCh(), Phase2Tracker::Phase2TrackerFEDHeader::frontendStatus(), Phase2Tracker::Phase2TrackerFEDHeader::getConditionData(), Phase2Tracker::Phase2TrackerFEDHeader::getDataFormatVersion(), Phase2Tracker::Phase2TrackerFEDHeader::getDataType(), Phase2Tracker::Phase2TrackerFEDHeader::getDebugMode(), Phase2Tracker::Phase2TrackerFEDHeader::getEventType(), Phase2Tracker::Phase2TrackerFEDHeader::getGlibStatusCode(), Phase2Tracker::Phase2TrackerFEDHeader::getNumberOfCBC(), Phase2Tracker::Phase2TrackerFEDHeader::getReadoutMode(), Phase2Tracker::Phase2TrackerFEDRawChannelUnpacker::hasData(), mps_fire::i, createfilelist::int, Phase2Tracker::Phase2TrackerFEDChannel::length(), LogTrace, Phase2Tracker::MAX_CBC_PER_FE, Phase2Tracker::MAX_FE_PER_FED, mod(), proc_work_digis_, proc_work_registry_, FEDRawData::size(), contentValuesCheck::ss, Phase2Tracker::Phase2TrackerFEDRawChannelUnpacker::stripIndex(), Phase2Tracker::Phase2TrackerFEDRawChannelUnpacker::stripOn(), Phase2Tracker::STRIPS_PER_CBC, and token_.

Member Data Documentation

◆ cabling_

const Phase2TrackerCabling* Phase2Tracker::Phase2TrackerDigiProducer::cabling_
private

Definition at line 38 of file Phase2TrackerDigiProducer.h.

Referenced by beginRun(), and produce().

◆ cacheId_

uint32_t Phase2Tracker::Phase2TrackerDigiProducer::cacheId_
private

Definition at line 39 of file Phase2TrackerDigiProducer.h.

◆ detids_

DetIdCollection Phase2Tracker::Phase2TrackerDigiProducer::detids_
private

Definition at line 40 of file Phase2TrackerDigiProducer.h.

◆ proc_work_digis_

std::vector<Phase2TrackerDigi> Phase2Tracker::Phase2TrackerDigiProducer::proc_work_digis_
private

Definition at line 57 of file Phase2TrackerDigiProducer.h.

Referenced by produce().

◆ proc_work_registry_

std::vector<Registry> Phase2Tracker::Phase2TrackerDigiProducer::proc_work_registry_
private

Definition at line 56 of file Phase2TrackerDigiProducer.h.

Referenced by produce().

◆ runNumber_

unsigned int Phase2Tracker::Phase2TrackerDigiProducer::runNumber_
private

Definition at line 36 of file Phase2TrackerDigiProducer.h.

◆ token_

edm::EDGetTokenT<FEDRawDataCollection> Phase2Tracker::Phase2TrackerDigiProducer::token_
private

Definition at line 37 of file Phase2TrackerDigiProducer.h.

Referenced by Phase2TrackerDigiProducer(), and produce().

edm::DetSetVector
Definition: DetSetVector.h:61
mps_fire.i
i
Definition: mps_fire.py:355
Phase2Tracker::CMS_FED_ID_MAX
static const uint16_t CMS_FED_ID_MAX
Definition: utils.h:19
edm::DetSet
Definition: DetSet.h:23
Phase2Tracker::Phase2TrackerDigiProducer::proc_work_digis_
std::vector< Phase2TrackerDigi > proc_work_digis_
Definition: Phase2TrackerDigiProducer.h:57
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
edm::Handle
Definition: AssociativeIterator.h:50
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
end
#define end
Definition: vmac.h:39
FEDRawData
Definition: FEDRawData.h:19
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
Phase2Tracker::MAX_CBC_PER_FE
static const int MAX_CBC_PER_FE
Definition: utils.h:25
edm::ESHandle
Definition: DTSurvey.h:22
Phase2TrackerCabling::findFedCh
const Phase2TrackerModule & findFedCh(std::pair< unsigned int, unsigned int > fedch) const
Definition: Phase2TrackerCabling.cc:84
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
Phase2Tracker::Phase2TrackerDigiProducer::token_
edm::EDGetTokenT< FEDRawDataCollection > token_
Definition: Phase2TrackerDigiProducer.h:37
sipixeldigitoraw
Definition: SiPixelDigiToRaw.cc:38
Phase2Tracker::Phase2TrackerFEDBuffer
Definition: Phase2TrackerFEDBuffer.h:14
createfilelist.int
int
Definition: createfilelist.py:10
Phase2TrackerModule
Definition: Phase2TrackerModule.h:9
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
Phase2Tracker::Phase2TrackerDigiProducer::runNumber_
unsigned int runNumber_
Definition: Phase2TrackerDigiProducer.h:36
get
#define get
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
cms::cuda::device::unique_ptr
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
Definition: device_unique_ptr.h:33
Phase2TrackerDigi
Definition: Phase2TrackerDigi.h:12
Phase2Tracker::Phase2TrackerDigiProducer::proc_work_registry_
std::vector< Registry > proc_work_registry_
Definition: Phase2TrackerDigiProducer.h:56
Phase2TrackerCablingRcd
Definition: SiStripCondDataRecords.h:63
Phase2Tracker::Phase2TrackerDigiProducer::cabling_
const Phase2TrackerCabling * cabling_
Definition: Phase2TrackerDigiProducer.h:38
Phase2Tracker::MAX_FE_PER_FED
static const int MAX_FE_PER_FED
Definition: utils.h:24
Phase2Tracker::Phase2TrackerDigiProducer::cacheId_
uint32_t cacheId_
Definition: Phase2TrackerDigiProducer.h:39
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
Phase2Tracker::STRIPS_PER_CBC
static const int STRIPS_PER_CBC
Definition: utils.h:26
Phase2Tracker::FED_ID_MIN
static const uint16_t FED_ID_MIN
Definition: utils.h:17
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27