CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
omtf::OmtfPacker Class Reference
Inheritance diagram for omtf::OmtfPacker:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
 OmtfPacker (const edm::ParameterSet &pset)
 
void produce (edm::Event &ev, const edm::EventSetup &es) override
 
 ~OmtfPacker () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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
 
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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Attributes

edm::ParameterSet theConfig
 
CscPacker theCscPacker
 
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollectiontheCscToken
 
DtPacker theDtPacker
 
edm::EDGetTokenT< L1MuDTChambPhContainertheDtPhToken
 
edm::EDGetTokenT< L1MuDTChambThContainertheDtThToken
 
unsigned long theEventCounter
 
std::string theOutputTag
 
RpcPacker theRpcPacker
 
edm::EDGetTokenT< RPCDigiCollectiontheRpcToken
 
bool theSkipCsc
 
bool theSkipDt
 
bool theSkipRpc
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Definition at line 46 of file OmtfPacker.cc.

Constructor & Destructor Documentation

omtf::OmtfPacker::OmtfPacker ( const edm::ParameterSet pset)

Definition at line 79 of file OmtfPacker.cc.

References edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, theCscToken, theDtPhToken, theDtThToken, theOutputTag, theRpcToken, theSkipCsc, theSkipDt, and theSkipRpc.

79  : theConfig(pset), theEventCounter(0)
80 {
81  theOutputTag = pset.getParameter<std::string>("outputTag");
82 
83  produces<FEDRawDataCollection>(theOutputTag);
84 
85  theRpcToken = consumes<RPCDigiCollection>(pset.getParameter<edm::InputTag>("rpcInputLabel"));
86  theCscToken = consumes<CSCCorrelatedLCTDigiCollection>(pset.getParameter<edm::InputTag>("cscInputLabel"));
87  theDtPhToken = consumes<L1MuDTChambPhContainer>(pset.getParameter<edm::InputTag>("dtPhInputLabel"));
88  theDtThToken = consumes<L1MuDTChambThContainer>(pset.getParameter<edm::InputTag>("dtThInputLabel"));
89 
90  theSkipDt = pset.getParameter<bool>("skipDt");
91  theSkipRpc = pset.getParameter<bool>("skipRpc");
92  theSkipCsc = pset.getParameter<bool>("skipCsc");
93 
94 }
T getParameter(std::string const &) const
edm::ParameterSet theConfig
Definition: OmtfPacker.cc:61
edm::EDGetTokenT< RPCDigiCollection > theRpcToken
Definition: OmtfPacker.cc:68
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > theCscToken
Definition: OmtfPacker.cc:69
edm::EDGetTokenT< L1MuDTChambThContainer > theDtThToken
Definition: OmtfPacker.cc:70
unsigned long theEventCounter
Definition: OmtfPacker.cc:62
edm::EDGetTokenT< L1MuDTChambPhContainer > theDtPhToken
Definition: OmtfPacker.cc:71
std::string theOutputTag
Definition: OmtfPacker.cc:64
omtf::OmtfPacker::~OmtfPacker ( )
inlineoverride

Definition at line 51 of file OmtfPacker.cc.

References beginRun(), ev, fillDescriptions(), produce(), and findQualityFiles::run.

51 {}

Member Function Documentation

void omtf::OmtfPacker::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
override

Definition at line 111 of file OmtfPacker.cc.

References edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), omtf::CscPacker::init(), omtf::RpcPacker::init(), AlCaHLTBitMon_QueryRunRegistry::string, theConfig, theCscPacker, theRpcPacker, theSkipCsc, and theSkipRpc.

Referenced by ~OmtfPacker().

111  {
112 
113  //
114  // initialise RPC packer
115  //
116  if (!theSkipRpc) {
117  if (theConfig.getParameter<bool>("useRpcConnectionFile")) {
119  } else {
120  theRpcPacker.init(es);
121  }
122  }
123 
124  //
125  // init CSC Link map
126  //
127  if (!theSkipCsc) theCscPacker.init();
128 }
T getParameter(std::string const &) const
edm::ParameterSet theConfig
Definition: OmtfPacker.cc:61
RpcPacker theRpcPacker
Definition: OmtfPacker.cc:74
CscPacker theCscPacker
Definition: OmtfPacker.cc:73
std::string fullPath() const
Definition: FileInPath.cc:184
void init(const edm::EventSetup &es)
void omtf::OmtfPacker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 96 of file OmtfPacker.cc.

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

Referenced by ~OmtfPacker().

96  {
98  desc.add<edm::InputTag>("rpcInputLabel",edm::InputTag(""));
99  desc.add<edm::InputTag>("cscInputLabel",edm::InputTag(""));
100  desc.add<edm::InputTag>("dtPhInputLabel",edm::InputTag(""));
101  desc.add<edm::InputTag>("dtThInputLabel",edm::InputTag(""));
102  desc.add<bool>("skipRpc",false);
103  desc.add<bool>("skipCsc",false);
104  desc.add<bool>("skipDt",false);
105  desc.add<bool>("useRpcConnectionFile",false);
106  desc.add<std::string>("rpcConnectionFile","");
107  desc.add<std::string>("outputTag","");
108  descriptions.add("omtfPacker",desc);
109 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void omtf::OmtfPacker::produce ( edm::Event ev,
const edm::EventSetup es 
)
override

Definition at line 131 of file OmtfPacker.cc.

References amc13::Packet::add(), edm::EventBase::bunchCrossing(), evf::compute_crc(), omtf::DataWord64::csc, FEDRawData::data(), DEFINE_FWK_MODULE, omtf::DataWord64::dt, edm::EventID::event(), edm::Event::eventAuxiliary(), l1t::stage2::layer2::fedId, edm::Event::getByToken(), RecoTauValidation_cfi::header, edm::EventBase::id(), LogDebug, LogTrace, eostools::move(), omtf::DataWord64::omtf, edm::EventAuxiliary::orbitNumber(), omtf::DtPacker::pack(), omtf::CscPacker::pack(), omtf::RpcPacker::pack(), jets_cff::payload, edm::Handle< T >::product(), edm::Event::put(), FEDRawData::resize(), omtf::DataWord64::rpc, FEDTrailer::set(), FEDHeader::set(), amc13::Packet::size(), findQualityFiles::size, theCscPacker, theCscToken, theDtPacker, theDtPhToken, theDtThToken, theEventCounter, theOutputTag, theRpcPacker, theRpcToken, theSkipCsc, theSkipDt, theSkipRpc, omtf::DataWord64::type(), and amc13::Packet::write().

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

132 {
133  LogDebug ("OmtfPacker::produce") <<"Beginning To Pack Event: "<<++theEventCounter;
134 
135  //
136  // prepare FedAmcRawsMap structure to collect Word64 raws from digi packers
137  //
138  FedAmcRawsMap raws;
139  std::list<unsigned int> amcIds = { 1, 3, 5, 7, 9, 11};
140  std::list<unsigned int> fedIds = { 1380, 1381};
141  for (auto & fedId : fedIds) { for (auto & amcId : amcIds) { raws[std::make_pair(fedId, amcId)]; } }
142 
143  //
144  // DT raws
145  //
146  if (!theSkipDt) {
147  edm::Handle<L1MuDTChambPhContainer> digiCollectionDTPh;
148  ev.getByToken(theDtPhToken, digiCollectionDTPh);
149  edm::Handle<L1MuDTChambThContainer> digiCollectionDTTh;
150  ev.getByToken(theDtThToken, digiCollectionDTTh);
151  theDtPacker.pack(digiCollectionDTPh.product(),digiCollectionDTTh.product(), raws);
152  }
153 
154  //
155  // csc raws
156  //
157  if (!theSkipCsc) {
159  ev.getByToken(theCscToken,digiCollectionCSC);
160  theCscPacker.pack(digiCollectionCSC.product(), raws);
161  }
162 
163  //
164  // rpc raws
165  //
166  if (!theSkipRpc) {
167  edm::Handle< RPCDigiCollection > digiCollectionRPC;
168  ev.getByToken(theRpcToken,digiCollectionRPC);
169  theRpcPacker.pack( digiCollectionRPC.product(), raws);
170  }
171 
172  auto bxId = ev.bunchCrossing();
173  auto evtId = ev.id().event();
174  auto orbit = ev.eventAuxiliary().orbitNumber();
175  std::unique_ptr<FEDRawDataCollection> raw_coll(new FEDRawDataCollection());
176  for (auto & fedId : fedIds) {
177 
178  //
179  // assign formatted raws to feds
180  //
182  for (const auto & it : raws) {
183  if (fedId != it.first.first) continue;
184  const std::vector<Word64> & amcData = it.second;
185  unsigned int amcId = it.first.second;
186  for (const auto & raw : amcData) {
187  std::ostringstream dataStr;
188  if (DataWord64::csc == DataWord64::type(raw)) dataStr << CscDataWord64(raw);
189  if (DataWord64::dt == DataWord64::type(raw)) dataStr << DtDataWord64(raw);
190  if (DataWord64::rpc == DataWord64::type(raw)) dataStr << RpcDataWord64(raw);
191  if (DataWord64::omtf == DataWord64::type(raw)) dataStr << MuonDataWord64(raw);
192  LogTrace("")<<" fed: "<< fedId <<" amcId: "<<amcId<<" RAW DATA: " << dataStr.str() << std::endl;
193  }
194  amc13.add(amcId, 43981, evtId, orbit, bxId, amcData);
195  }
196 
197  FEDRawData& fed_data = raw_coll->FEDData(fedId);
198 
199  const unsigned int slinkHeaderSize = 8;
200  const unsigned int slinkTrailerSize = 8;
201  unsigned int size = (amc13.size()) * sizeof(Word64)+slinkHeaderSize+slinkTrailerSize;
202  fed_data.resize(size);
203  unsigned char * payload = fed_data.data();
204  unsigned char * payload_start = payload;
205 
206  FEDHeader header(payload);
207  const unsigned int evtType = 1;
208  header.set(payload, evtType, evtId, bxId, fedId);
209 
210  amc13.write(ev, payload, slinkHeaderSize, size - slinkHeaderSize - slinkTrailerSize);
211 
212  payload += slinkHeaderSize;
213  payload += amc13.size() * 8;
214 
215  FEDTrailer trailer(payload);
216  trailer.set(payload, size / 8, evf::compute_crc(payload_start, size), 0, 0);
217  }
218  ev.put(std::move(raw_coll), theOutputTag);
219 
220 
221 }
#define LogDebug(id)
size
Write out results.
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:83
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
unsigned int size() const
Definition: AMC13Spec.cc:200
int bunchCrossing() const
Definition: EventBase.h:66
void add(unsigned int amc_no, unsigned int board, unsigned int lv1id, unsigned int orbit, unsigned int bx, const std::vector< uint64_t > &load, unsigned int user=0)
Definition: AMC13Spec.cc:61
std::map< std::pair< unsigned int, unsigned int >, std::vector< Word64 > > FedAmcRawsMap
bool write(const edm::Event &ev, unsigned char *ptr, unsigned int skip, unsigned int size) const
Definition: AMC13Spec.cc:218
DtPacker theDtPacker
Definition: OmtfPacker.cc:75
void pack(const RPCDigiCollection *prod, FedAmcRawsMap &raws)
void resize(size_t newsize)
Definition: FEDRawData.cc:32
int orbitNumber() const
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
Definition: CRC16.h:67
edm::EDGetTokenT< RPCDigiCollection > theRpcToken
Definition: OmtfPacker.cc:68
void pack(const CSCCorrelatedLCTDigiCollection *prod, FedAmcRawsMap &raws)
void pack(const L1MuDTChambPhContainer *phCont, const L1MuDTChambThContainer *thCont, FedAmcRawsMap &raws)
Definition: OmtfDtPacker.cc:8
RpcPacker theRpcPacker
Definition: OmtfPacker.cc:74
Type type(const T &)
#define LogTrace(id)
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > theCscToken
Definition: OmtfPacker.cc:69
uint64_t Word64
CscPacker theCscPacker
Definition: OmtfPacker.cc:73
edm::EDGetTokenT< L1MuDTChambThContainer > theDtThToken
Definition: OmtfPacker.cc:70
T const * product() const
Definition: Handle.h:81
unsigned long theEventCounter
Definition: OmtfPacker.cc:62
edm::EDGetTokenT< L1MuDTChambPhContainer > theDtPhToken
Definition: OmtfPacker.cc:71
std::string theOutputTag
Definition: OmtfPacker.cc:64
edm::EventID id() const
Definition: EventBase.h:60
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::ParameterSet omtf::OmtfPacker::theConfig
private

Definition at line 61 of file OmtfPacker.cc.

Referenced by beginRun().

CscPacker omtf::OmtfPacker::theCscPacker
private

Definition at line 73 of file OmtfPacker.cc.

Referenced by beginRun(), and produce().

edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> omtf::OmtfPacker::theCscToken
private

Definition at line 69 of file OmtfPacker.cc.

Referenced by OmtfPacker(), and produce().

DtPacker omtf::OmtfPacker::theDtPacker
private

Definition at line 75 of file OmtfPacker.cc.

Referenced by produce().

edm::EDGetTokenT<L1MuDTChambPhContainer> omtf::OmtfPacker::theDtPhToken
private

Definition at line 71 of file OmtfPacker.cc.

Referenced by OmtfPacker(), and produce().

edm::EDGetTokenT<L1MuDTChambThContainer> omtf::OmtfPacker::theDtThToken
private

Definition at line 70 of file OmtfPacker.cc.

Referenced by OmtfPacker(), and produce().

unsigned long omtf::OmtfPacker::theEventCounter
private

Definition at line 62 of file OmtfPacker.cc.

Referenced by produce().

std::string omtf::OmtfPacker::theOutputTag
private

Definition at line 64 of file OmtfPacker.cc.

Referenced by OmtfPacker(), and produce().

RpcPacker omtf::OmtfPacker::theRpcPacker
private

Definition at line 74 of file OmtfPacker.cc.

Referenced by beginRun(), and produce().

edm::EDGetTokenT<RPCDigiCollection> omtf::OmtfPacker::theRpcToken
private

Definition at line 68 of file OmtfPacker.cc.

Referenced by OmtfPacker(), and produce().

bool omtf::OmtfPacker::theSkipCsc
private

Definition at line 66 of file OmtfPacker.cc.

Referenced by beginRun(), OmtfPacker(), and produce().

bool omtf::OmtfPacker::theSkipDt
private

Definition at line 66 of file OmtfPacker.cc.

Referenced by OmtfPacker(), and produce().

bool omtf::OmtfPacker::theSkipRpc
private

Definition at line 66 of file OmtfPacker.cc.

Referenced by beginRun(), OmtfPacker(), and produce().