CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
GEMRawToDigiModule Class Reference
Inheritance diagram for GEMRawToDigiModule:
edm::global::EDProducer< edm::RunCache< GEMChMap > > edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GEMRawToDigiModule (const edm::ParameterSet &pset)
 Constructor. More...
 
std::shared_ptr< GEMChMapglobalBeginRun (edm::Run const &, edm::EventSetup const &) const override
 
void globalEndRun (edm::Run const &, edm::EventSetup const &) const override
 
void produce (edm::StreamID, edm::Event &, edm::EventSetup const &) const override
 
- Public Member Functions inherited from edm::global::EDProducer< edm::RunCache< GEMChMap > >
 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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< FEDRawDataCollectionfed_token
 
unsigned int fedIdEnd_
 
unsigned int fedIdStart_
 
bool ge21Off_
 
edm::ESGetToken< GEMChMap, GEMChMapRcdgemChMapToken_
 
std::unique_ptr< GEMRawToDigigemRawToDigi_
 
bool keepDAQStatus_
 
bool readMultiBX_
 
bool useDBEMap_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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
 
- 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 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)
 
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

for gem on CSCDigiToRawModule

Author
J. Lee - UoS

Definition at line 31 of file GEMRawToDigiModule.cc.

Constructor & Destructor Documentation

◆ GEMRawToDigiModule()

GEMRawToDigiModule::GEMRawToDigiModule ( const edm::ParameterSet pset)

Constructor.

Definition at line 55 of file GEMRawToDigiModule.cc.

References fedIdEnd_, fedIdStart_, ge21Off_, gemChMapToken_, keepDAQStatus_, FEDNumbering::MAXGEMFEDID, FEDNumbering::MINGE21FEDID, FEDNumbering::MINGEMFEDID, and useDBEMap_.

56  : fed_token(consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("InputLabel"))),
57  useDBEMap_(pset.getParameter<bool>("useDBEMap")),
58  keepDAQStatus_(pset.getParameter<bool>("keepDAQStatus")),
59  readMultiBX_(pset.getParameter<bool>("readMultiBX")),
60  ge21Off_(pset.getParameter<bool>("ge21Off")),
61  fedIdStart_(pset.getParameter<unsigned int>("fedIdStart")),
62  fedIdEnd_(pset.getParameter<unsigned int>("fedIdEnd")),
63  gemRawToDigi_(std::make_unique<GEMRawToDigi>()) {
64  produces<GEMDigiCollection>();
65  if (keepDAQStatus_) {
66  produces<GEMAMC13StatusCollection>("AMC13Status");
67  produces<GEMAMCStatusCollection>("AMCStatus");
68  produces<GEMOHStatusCollection>("OHStatus");
69  produces<GEMVFATStatusCollection>("VFATStatus");
70  }
71  if (useDBEMap_) {
72  gemChMapToken_ = esConsumes<GEMChMap, GEMChMapRcd, edm::Transition::BeginRun>();
73  }
76  } else if (ge21Off_) {
77  edm::LogError("InvalidSettings") << "Turning GE2/1 off requires changing the FEDIDs the GEM unpacker looks at. If "
78  "you wish to set the FEDIDs yourself, don't use the ge21Off switch.";
79  }
80 }
Log< level::Error, false > LogError
edm::EDGetTokenT< FEDRawDataCollection > fed_token
edm::ESGetToken< GEMChMap, GEMChMapRcd > gemChMapToken_
std::unique_ptr< GEMRawToDigi > gemRawToDigi_

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 82 of file GEMRawToDigiModule.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_2022v12_cff::InputTag, FEDNumbering::MAXGEMFEDID, and FEDNumbering::MINGEMFEDID.

82  {
84  desc.add<edm::InputTag>("InputLabel", edm::InputTag("rawDataCollector"));
85  desc.add<bool>("useDBEMap", false);
86  desc.add<bool>("keepDAQStatus", true);
87  desc.add<bool>("readMultiBX", false);
88  desc.add<bool>("ge21Off", false);
89  desc.add<unsigned int>("fedIdStart", FEDNumbering::MINGEMFEDID);
90  desc.add<unsigned int>("fedIdEnd", FEDNumbering::MAXGEMFEDID);
91  descriptions.add("muonGEMDigisDefault", desc);
92 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ globalBeginRun()

std::shared_ptr< GEMChMap > GEMRawToDigiModule::globalBeginRun ( edm::Run const &  ,
edm::EventSetup const &  iSetup 
) const
override

Definition at line 94 of file GEMRawToDigiModule.cc.

References gemChMapToken_, edm::EventSetup::getData(), and useDBEMap_.

94  {
95  if (useDBEMap_) {
96  const auto& eMap = iSetup.getData(gemChMapToken_);
97  auto gemChMap = std::make_shared<GEMChMap>(eMap);
98  return gemChMap;
99  } else {
100  // no EMap in DB, using dummy
101  auto gemChMap = std::make_shared<GEMChMap>();
102  gemChMap->setDummy();
103  return gemChMap;
104  }
105 }
edm::ESGetToken< GEMChMap, GEMChMapRcd > gemChMapToken_

◆ globalEndRun()

void GEMRawToDigiModule::globalEndRun ( edm::Run const &  ,
edm::EventSetup const &   
) const
inlineoverride

Definition at line 39 of file GEMRawToDigiModule.cc.

39 {};

◆ produce()

void GEMRawToDigiModule::produce ( edm::StreamID  iID,
edm::Event iEvent,
edm::EventSetup const &  iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 107 of file GEMRawToDigiModule.cc.

References amc, simKBmtfDigis_cfi::bx, GEMDetId::chamber(), officialStyle::chan, FEDRawData::data(), fed_token, l1tstage2_dqm_sourceclient-live_cfg::fedId, fedIdEnd_, fedIdStart_, gemRawToDigi_, LEDCalibrationChannels::ieta, iEvent, createfilelist::int, GEMAMC13Status::inValidAMC(), GEMOHStatus::inValidVFAT(), GEMAMC13Status::isBad(), GEMOHStatus::isBad(), keepDAQStatus_, GEMDetId::layer(), LogDebug, eostools::move(), GEMVFAT::nChannels, readMultiBX_, GEMDetId::region(), GEMDetId::ring(), FEDRawData::size(), GEMDetId::station(), and testProducerWithPsetDescEmpty_cfi::x1.

107  {
108  auto outGEMDigis = std::make_unique<GEMDigiCollection>();
109  auto outAMC13Status = std::make_unique<GEMAMC13StatusCollection>();
110  auto outAMCStatus = std::make_unique<GEMAMCStatusCollection>();
111  auto outOHStatus = std::make_unique<GEMOHStatusCollection>();
112  auto outVFATStatus = std::make_unique<GEMVFATStatusCollection>();
113 
114  // Take raw from the event
116  iEvent.getByToken(fed_token, fed_buffers);
117 
118  auto gemChMap = runCache(iEvent.getRun().index());
119 
120  for (unsigned int fedId = fedIdStart_; fedId <= fedIdEnd_; ++fedId) {
121  const FEDRawData& fedData = fed_buffers->FEDData(fedId);
122 
123  int nWords = fedData.size() / sizeof(uint64_t);
124  LogDebug("GEMRawToDigiModule") << "fedId:" << fedId << " words: " << nWords;
125  GEMAMC13Status st_amc13(fedData);
126  if (st_amc13.isBad()) {
127  LogDebug("GEMRawToDigiModule") << st_amc13;
128  if (keepDAQStatus_) {
129  outAMC13Status.get()->insertDigi(fedId, st_amc13);
130  }
131  continue;
132  }
133 
134  const uint64_t* word = reinterpret_cast<const uint64_t*>(fedData.data());
135  auto amc13 = gemRawToDigi_->convertWordToGEMAMC13(word);
136  LogDebug("GEMRawToDigiModule") << "Event bx:" << iEvent.bunchCrossing() << " lv1Id:" << iEvent.id().event()
137  << " orbitNumber:" << iEvent.orbitNumber();
138  LogDebug("GEMRawToDigiModule") << "AMC13 bx:" << amc13->bunchCrossing() << " lv1Id:" << int(amc13->lv1Id())
139  << " orbitNumber:" << amc13->orbitNumber();
140 
141  // Read AMC data
142  for (const auto& amc : *(amc13->getAMCpayloads())) {
143  uint8_t amcNum = amc.amcNum();
144  if (!gemChMap->isValidAMC(fedId, amcNum)) {
145  st_amc13.inValidAMC();
146  continue;
147  }
148 
149  GEMAMCStatus st_amc(amc13.get(), amc);
150  if (st_amc.isBad()) {
151  LogDebug("GEMRawToDigiModule") << st_amc;
152  if (keepDAQStatus_) {
153  outAMCStatus.get()->insertDigi(fedId, st_amc);
154  }
155  continue;
156  }
157 
158  uint16_t amcBx = amc.bunchCrossing();
159  LogDebug("GEMRawToDigiModule") << "AMC no.:" << int(amc.amcNum()) << " bx:" << int(amc.bunchCrossing())
160  << " lv1Id:" << int(amc.lv1Id()) << " orbitNumber:" << int(amc.orbitNumber());
161 
162  // Read GEB data
163  for (const auto& optoHybrid : *amc.gebs()) {
164  uint8_t gebId = optoHybrid.inputID();
165 
166  bool isValidChamber = gemChMap->isValidChamber(fedId, amcNum, gebId);
167  if (!isValidChamber) {
168  st_amc.inValidOH();
169  continue;
170  }
171  auto geb_dc = gemChMap->chamberPos(fedId, amcNum, gebId);
172  GEMDetId cId(geb_dc.detId);
173  int chamberType = geb_dc.chamberType;
174 
175  GEMOHStatus st_oh(optoHybrid);
176  if (st_oh.isBad()) {
177  LogDebug("GEMRawToDigiModule") << st_oh;
178  if (keepDAQStatus_) {
179  outOHStatus.get()->insertDigi(cId, st_oh);
180  }
181  }
182 
183  //Read vfat data
184  for (auto vfat : *optoHybrid.vFATs()) {
185  // set vfat fw version
186  if (chamberType < 10)
187  vfat.setVersion(2);
188  else
189  vfat.setVersion(3);
190  uint16_t vfatId = vfat.vfatId();
191 
192  if (!gemChMap->isValidVFAT(chamberType, vfatId)) {
193  st_oh.inValidVFAT();
194  continue;
195  }
196 
197  GEMVFATStatus st_vfat(amc, vfat, vfat.phi(), readMultiBX_);
198  if (st_vfat.isBad()) {
199  LogDebug("GEMRawToDigiModule") << st_vfat;
200  if (keepDAQStatus_) {
201  outVFATStatus.get()->insertDigi(cId, st_vfat);
202  }
203  continue;
204  }
205 
206  int bx(vfat.bc() - amcBx);
207 
208  for (int chan = 0; chan < GEMVFAT::nChannels; ++chan) {
209  uint8_t chan0xf = 0;
210  if (chan < 64)
211  chan0xf = ((vfat.lsData() >> chan) & 0x1);
212  else
213  chan0xf = ((vfat.msData() >> (chan - 64)) & 0x1);
214 
215  // no hits
216  if (chan0xf == 0)
217  continue;
218 
219  auto stMap = gemChMap->getStrip(chamberType, vfatId, chan);
220 
221  int stripId = stMap.stNum;
222  int ieta = stMap.iEta;
223 
224  GEMDetId gemId(cId.region(), cId.ring(), cId.station(), cId.layer(), cId.chamber(), ieta);
225 
226  GEMDigi digi(stripId, bx);
227 
228  LogDebug("GEMRawToDigiModule") << "fed: " << fedId << " amc:" << int(amcNum) << " geb:" << int(gebId)
229  << " vfat id:" << int(vfatId) << ",type:" << chamberType << " id:" << gemId
230  << " ch:" << chan << " st:" << digi.strip() << " bx:" << digi.bx();
231 
232  outGEMDigis.get()->insertDigi(gemId, digi);
233 
234  } // end of channel loop
235 
236  if (keepDAQStatus_) {
237  outVFATStatus.get()->insertDigi(cId, st_vfat);
238  }
239 
240  } // end of vfat loop
241 
242  if (keepDAQStatus_) {
243  outOHStatus.get()->insertDigi(cId, st_oh);
244  }
245 
246  } // end of optohybrid loop
247 
248  if (keepDAQStatus_) {
249  outAMCStatus.get()->insertDigi(fedId, st_amc);
250  }
251 
252  } // end of amc loop
253 
254  if (keepDAQStatus_) {
255  outAMC13Status.get()->insertDigi(fedId, st_amc13);
256  }
257 
258  } // end of amc13
259 
260  iEvent.put(std::move(outGEMDigis));
261 
262  if (keepDAQStatus_) {
263  iEvent.put(std::move(outAMC13Status), "AMC13Status");
264  iEvent.put(std::move(outAMCStatus), "AMCStatus");
265  iEvent.put(std::move(outOHStatus), "OHStatus");
266  iEvent.put(std::move(outVFATStatus), "VFATStatus");
267  }
268 }
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
static const int nChannels
Definition: GEMVFAT.h:116
edm::EDGetTokenT< FEDRawDataCollection > fed_token
uint64_t word
int iEvent
Definition: GenABIO.cc:224
double amc
Definition: hdecay.h:20
unsigned long long uint64_t
Definition: Time.h:13
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
std::unique_ptr< GEMRawToDigi > gemRawToDigi_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
Definition: AMCSpec.h:8
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ fed_token

edm::EDGetTokenT<FEDRawDataCollection> GEMRawToDigiModule::fed_token
private

Definition at line 45 of file GEMRawToDigiModule.cc.

Referenced by produce().

◆ fedIdEnd_

unsigned int GEMRawToDigiModule::fedIdEnd_
private

Definition at line 48 of file GEMRawToDigiModule.cc.

Referenced by GEMRawToDigiModule(), and produce().

◆ fedIdStart_

unsigned int GEMRawToDigiModule::fedIdStart_
private

Definition at line 48 of file GEMRawToDigiModule.cc.

Referenced by GEMRawToDigiModule(), and produce().

◆ ge21Off_

bool GEMRawToDigiModule::ge21Off_
private

Definition at line 47 of file GEMRawToDigiModule.cc.

Referenced by GEMRawToDigiModule().

◆ gemChMapToken_

edm::ESGetToken<GEMChMap, GEMChMapRcd> GEMRawToDigiModule::gemChMapToken_
private

Definition at line 46 of file GEMRawToDigiModule.cc.

Referenced by GEMRawToDigiModule(), and globalBeginRun().

◆ gemRawToDigi_

std::unique_ptr<GEMRawToDigi> GEMRawToDigiModule::gemRawToDigi_
private

Definition at line 49 of file GEMRawToDigiModule.cc.

Referenced by produce().

◆ keepDAQStatus_

bool GEMRawToDigiModule::keepDAQStatus_
private

Definition at line 47 of file GEMRawToDigiModule.cc.

Referenced by GEMRawToDigiModule(), and produce().

◆ readMultiBX_

bool GEMRawToDigiModule::readMultiBX_
private

Definition at line 47 of file GEMRawToDigiModule.cc.

Referenced by produce().

◆ useDBEMap_

bool GEMRawToDigiModule::useDBEMap_
private

Definition at line 47 of file GEMRawToDigiModule.cc.

Referenced by GEMRawToDigiModule(), and globalBeginRun().