CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
Phase2Tracker::Phase2TrackerDigiProducer Class Reference
Inheritance diagram for Phase2Tracker::Phase2TrackerDigiProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  Registry
 

Public Member Functions

 Phase2TrackerDigiProducer (const edm::ParameterSet &pset)
 constructor More...
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 ~Phase2TrackerDigiProducer () override=default
 default constructor More...
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

const edm::ESGetToken< Phase2TrackerCabling, Phase2TrackerCablingRcdph2CablingESToken_
 
const edm::EDPutTokenT< edm::DetSetVector< Phase2TrackerDigi > > putToken_
 
const edm::EDGetTokenT< FEDRawDataCollectiontoken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 25 of file Phase2TrackerDigiProducer.cc.

Constructor & Destructor Documentation

◆ Phase2TrackerDigiProducer()

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

constructor

Definition at line 64 of file Phase2TrackerDigiProducer.cc.

66  token_(consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("ProductLabel"))),
const edm::EDGetTokenT< FEDRawDataCollection > token_
const edm::EDPutTokenT< edm::DetSetVector< Phase2TrackerDigi > > putToken_
const edm::ESGetToken< Phase2TrackerCabling, Phase2TrackerCablingRcd > ph2CablingESToken_

◆ ~Phase2TrackerDigiProducer()

Phase2Tracker::Phase2TrackerDigiProducer::~Phase2TrackerDigiProducer ( )
overridedefault

default constructor

Member Function Documentation

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 69 of file Phase2TrackerDigiProducer.cc.

References edmScanValgrind::buffer, Phase2Tracker::Phase2TrackerFEDHeader::CBCStatus(), Phase2Tracker::CMS_FED_ID_MAX, FEDRawData::data(), TauDecayModes::dec, Phase2Tracker::FED_ID_MIN, FEDRawDataCollection::FEDData(), stripgpu::fedIndex(), Phase2Tracker::Phase2TrackerFEDHeader::frontendStatus(), Phase2Tracker::Phase2TrackerFEDHeader::getConditionData(), edm::EventSetup::getData(), 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, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, Phase2Tracker::Phase2TrackerFEDChannel::length(), LogTrace, Phase2Tracker::MAX_CBC_PER_FE, Phase2Tracker::MAX_FE_PER_FED, mod(), ph2CablingESToken_, putToken_, FEDRawData::size(), jetUpdater_cfi::sort, contentValuesCheck::ss, Phase2Tracker::Phase2TrackerFEDRawChannelUnpacker::stripIndex(), Phase2Tracker::Phase2TrackerFEDRawChannelUnpacker::stripOn(), Phase2Tracker::STRIPS_PADDING, Phase2Tracker::STRIPS_PER_CBC, and token_.

69  {
70  // fetch cabling from event setup
71  auto const& cabling = es.getData(ph2CablingESToken_);
72 
73  // Retrieve FEDRawData collection
75  event.getByToken(token_, buffers);
76 
77  //reserve enough working memory
78  std::vector<Registry> proc_work_registry;
79  std::vector<Phase2TrackerDigi> proc_work_digis;
80  {
81  size_t reserve_count = 0;
82  size_t reserve_digis = 0;
84  const FEDRawData& fed = buffers->FEDData(fedIndex);
85  if (fed.size() != 0) {
86  // construct buffer
88  int ichan = 0;
89  for (int ife = 0; ife < MAX_FE_PER_FED; ife++) {
90  for (int icbc = 0; icbc < MAX_CBC_PER_FE; icbc++) {
91  if (buffer.channel(ichan).length() > 0) {
92  ++reserve_count;
93  //calculation from Phase2TrackerFEDRawChannelUnpacker.h
94  reserve_digis += buffer.channel(ichan).length() * 8 - STRIPS_PADDING;
95  ++ichan;
96  }
97  }
98  }
99  }
100  }
101  proc_work_registry.reserve(2 * reserve_count);
102  proc_work_digis.reserve(reserve_digis);
103  }
104  // Analyze strip tracker FED buffers in data
106  const FEDRawData& fed = buffers->FEDData(fedIndex);
107  if (fed.size() != 0) {
108  // construct buffer
110 
111 #ifdef EDM_ML_DEBUG
112  std::ostringstream ss;
113  ss << " -------------------------------------------- " << endl;
114  ss << " buffer debug ------------------------------- " << endl;
115  ss << " -------------------------------------------- " << endl;
116  ss << " buffer size : " << buffer.bufferSize() << endl;
117  ss << " fed id : " << fedIndex << endl;
118  ss << " -------------------------------------------- " << endl;
119  ss << " tracker header debug ------------------------" << endl;
120  ss << " -------------------------------------------- " << endl;
121  LogTrace("Phase2TrackerDigiProducer") << ss.str();
122  ss.clear();
123  ss.str("");
124 
125  Phase2TrackerFEDHeader tr_header = buffer.trackerHeader();
126  ss << " Version : " << hex << setw(2) << (int)tr_header.getDataFormatVersion() << endl;
127  ss << " Mode : " << hex << setw(2) << tr_header.getDebugMode() << endl;
128  ss << " Type : " << hex << setw(2) << (int)tr_header.getEventType() << endl;
129  ss << " Readout : " << hex << setw(2) << tr_header.getReadoutMode() << endl;
130  ss << " Condition Data : " << (tr_header.getConditionData() ? "Present" : "Absent") << "\n";
131  ss << " Data Type : " << (tr_header.getDataType() ? "Real" : "Fake") << "\n";
132  ss << " Status : " << hex << setw(16) << (int)tr_header.getGlibStatusCode() << endl;
133  ss << " FE stat : ";
134  for (int i = 15; i >= 0; i--) {
135  if ((tr_header.frontendStatus())[i]) {
136  ss << "1";
137  } else {
138  ss << "0";
139  }
140  }
141  ss << endl;
142  ss << " Nr CBC : " << hex << setw(16) << (int)tr_header.getNumberOfCBC() << endl;
143  ss << " CBC stat : ";
144  for (int i = 0; i < tr_header.getNumberOfCBC(); i++) {
145  ss << hex << setw(2) << (int)tr_header.CBCStatus()[i] << " ";
146  }
147  ss << endl;
148  LogTrace("Phase2TrackerDigiProducer") << ss.str();
149  ss.clear();
150  ss.str("");
151  ss << " -------------------------------------------- " << endl;
152  ss << " Payload ----------------------------------- " << endl;
153  ss << " -------------------------------------------- " << endl;
154 #endif
155 
156  // loop channels
157  int ichan = 0;
158  for (int ife = 0; ife < MAX_FE_PER_FED; ife++) {
159  for (int icbc = 0; icbc < MAX_CBC_PER_FE; icbc++) {
160  const Phase2TrackerFEDChannel& channel = buffer.channel(ichan);
161  if (channel.length() > 0) {
162  // get fedid from cabling
163  const Phase2TrackerModule mod = cabling.findFedCh(std::make_pair(fedIndex, ife));
164  uint32_t detid = mod.getDetid();
165 #ifdef EDM_ML_DEBUG
166  ss << dec << " id from cabling : " << detid << endl;
167  ss << dec << " reading channel : " << icbc << " on FE " << ife;
168  ss << dec << " with length : " << (int)channel.length() << endl;
169 #endif
170 
171  // container for this channel's digis
172  std::vector<Phase2TrackerDigi> stripsTop;
173  std::vector<Phase2TrackerDigi> stripsBottom;
174 
175  // unpacking data
176  Phase2TrackerFEDRawChannelUnpacker unpacker = Phase2TrackerFEDRawChannelUnpacker(channel);
177  while (unpacker.hasData()) {
178  if (unpacker.stripOn()) {
179  if (unpacker.stripIndex() % 2) {
180  stripsTop.push_back(Phase2TrackerDigi((int)(STRIPS_PER_CBC * icbc + unpacker.stripIndex()) / 2, 0));
181 #ifdef EDM_ML_DEBUG
182  ss << "t";
183 #endif
184  } else {
185  stripsBottom.push_back(
186  Phase2TrackerDigi((int)(STRIPS_PER_CBC * icbc + unpacker.stripIndex()) / 2, 0));
187 #ifdef EDM_ML_DEBUG
188  ss << "b";
189 #endif
190  }
191  } else {
192 #ifdef EDM_ML_DEBUG
193  ss << "_";
194 #endif
195  }
196  unpacker++;
197  }
198 #ifdef EDM_ML_DEBUG
199  ss << endl;
200  LogTrace("Phase2TrackerDigiProducer") << ss.str();
201  ss.clear();
202  ss.str("");
203 #endif
204 
205  // store beginning and end of this digis for this detid and add this registry to the list
206  // and store data
207  proc_work_registry.emplace_back(
208  detid + 1, STRIPS_PER_CBC * icbc / 2, proc_work_digis.size(), stripsTop.size());
209  proc_work_digis.insert(proc_work_digis.end(), stripsTop.begin(), stripsTop.end());
210  proc_work_registry.emplace_back(
211  detid + 2, STRIPS_PER_CBC * icbc / 2, proc_work_digis.size(), stripsBottom.size());
212  proc_work_digis.insert(proc_work_digis.end(), stripsBottom.begin(), stripsBottom.end());
213  }
214  ichan++;
215  }
216  } // end loop on channels
217  }
218  }
219 
220  // store digis in edm collections
221  std::sort(proc_work_registry.begin(), proc_work_registry.end());
222  std::vector<edm::DetSet<Phase2TrackerDigi>> sorted_and_merged;
223 
224  std::vector<Registry>::iterator it = proc_work_registry.begin(), it2 = it + 1, end = proc_work_registry.end();
225  while (it < end) {
226  sorted_and_merged.push_back(edm::DetSet<Phase2TrackerDigi>(it->detid));
227  std::vector<Phase2TrackerDigi>& digis = sorted_and_merged.back().data;
228  // first count how many digis we have
229  size_t len = it->length;
230  for (it2 = it + 1; (it2 != end) && (it2->detid == it->detid); ++it2) {
231  len += it2->length;
232  }
233  // reserve memory
234  digis.reserve(len);
235  // push them in
236  for (it2 = it + 0; (it2 != end) && (it2->detid == it->detid); ++it2) {
237  digis.insert(digis.end(), &proc_work_digis[it2->index], &proc_work_digis[it2->index + it2->length]);
238  }
239  it = it2;
240  }
241  event.emplace(putToken_, sorted_and_merged, true);
242  }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:48
static const uint16_t CMS_FED_ID_MAX
Definition: utils.h:20
#define LogTrace(id)
static const int MAX_CBC_PER_FE
Definition: utils.h:26
const edm::EDGetTokenT< FEDRawDataCollection > token_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
const edm::EDPutTokenT< edm::DetSetVector< Phase2TrackerDigi > > putToken_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
static const int STRIPS_PER_CBC
Definition: utils.h:27
const edm::ESGetToken< Phase2TrackerCabling, Phase2TrackerCablingRcd > ph2CablingESToken_
static const uint16_t FED_ID_MIN
Definition: utils.h:18
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
static const int MAX_FE_PER_FED
Definition: utils.h:25
__host__ __device__ fedId_t fedIndex(fedId_t fed)
static const int STRIPS_PADDING
Definition: utils.h:28

Member Data Documentation

◆ ph2CablingESToken_

const edm::ESGetToken<Phase2TrackerCabling, Phase2TrackerCablingRcd> Phase2Tracker::Phase2TrackerDigiProducer::ph2CablingESToken_
private

Definition at line 34 of file Phase2TrackerDigiProducer.cc.

Referenced by produce().

◆ putToken_

const edm::EDPutTokenT<edm::DetSetVector<Phase2TrackerDigi> > Phase2Tracker::Phase2TrackerDigiProducer::putToken_
private

Definition at line 37 of file Phase2TrackerDigiProducer.cc.

Referenced by produce().

◆ token_

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

Definition at line 36 of file Phase2TrackerDigiProducer.cc.

Referenced by produce().