test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
l1t::AMC13DumpToRaw Class Reference
Inheritance diagram for l1t::AMC13DumpToRaw:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AMC13DumpToRaw (const edm::ParameterSet &)
 
 ~AMC13DumpToRaw ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

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

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
void readEvent (std::vector< uint32_t > &load32)
 

Private Attributes

int boardId_
 
int evType_
 
int fedId_
 
std::ifstream file_
 
std::string filename_
 
int fwVer_
 
int iAmc_
 
int slinkHeaderSize_
 
int slinkTrailerSize_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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 51 of file AMC13DumpToRaw.cc.

Constructor & Destructor Documentation

AMC13DumpToRaw::AMC13DumpToRaw ( const edm::ParameterSet iConfig)
explicit

Definition at line 101 of file AMC13DumpToRaw.cc.

101  :
102  filename_(iConfig.getUntrackedParameter<std::string>("filename", "data.txt")),
103  fedId_(iConfig.getUntrackedParameter<int>("fedId", 1)),
104  iAmc_(iConfig.getUntrackedParameter<int>("iAmc", 1)),
105  boardId_(iConfig.getUntrackedParameter<int>("boardId", 1)),
106  evType_(iConfig.getUntrackedParameter<int>("eventType", 1)),
107  fwVer_(iConfig.getUntrackedParameter<int>("fwVersion", 1)),
108  slinkHeaderSize_(iConfig.getUntrackedParameter<int>("lenSlinkHeader", 8)),
109  slinkTrailerSize_(iConfig.getUntrackedParameter<int>("lenSlinkTrailer", 8))
110 {
111 
112  produces<FEDRawDataCollection>();
113 
114 }
T getUntrackedParameter(std::string const &, T const &) const
AMC13DumpToRaw::~AMC13DumpToRaw ( )

Definition at line 117 of file AMC13DumpToRaw.cc.

118 {
119 
120  // do anything here that needs to be done at desctruction time
121  // (e.g. close files, deallocate resources etc.)
122 
123 }

Member Function Documentation

void AMC13DumpToRaw::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 245 of file AMC13DumpToRaw.cc.

References file_, filename_, and recoMuon::in.

246 {
247 
248  // open VME file
249  file_.open(filename_.c_str(), std::ios::in);
250  if(!file_.good()) { edm::LogInfo("TextToDigi") << "Failed to open ASCII file " << filename_ << std::endl; }
251 
252 
253 }
std::ifstream file_
void AMC13DumpToRaw::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 258 of file AMC13DumpToRaw.cc.

References file_.

259 {
260 
261  file_.close();
262 
263 }
std::ifstream file_
void AMC13DumpToRaw::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 299 of file AMC13DumpToRaw.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

299  {
300  //The following says we do not know what parameters are allowed so do no validation
301  // Please change this to state exactly what you do use, even if it is no parameters
303  desc.setUnknown();
304  descriptions.addDefault(desc);
305 }
void addDefault(ParameterSetDescription const &psetDescription)
void AMC13DumpToRaw::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 132 of file AMC13DumpToRaw.cc.

References fedId_, i, j, LogDebug, edm::Event::put(), readEvent(), FEDRawData::resize(), and findQualityFiles::size.

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

133 {
134  using namespace edm;
135 
136  // create AMC 13 packet
137  // amc13::Packet amc13;
138 
139  std::vector<uint32_t> load32;
140 
141  readEvent(load32);
142 
143  // formatAMC(amc13, load32);
144 
145  int size = load32.size() * 4;
146 
147  LogDebug("L1T") << "AMC13 size " << size << " bytes";
148 
149  // prepare the raw data collection
150  std::auto_ptr<FEDRawDataCollection> raw_coll(new FEDRawDataCollection());
151  FEDRawData& fed_data = raw_coll->FEDData(fedId_);
152 
153  fed_data.resize(size);
154 
155  // fill FEDRawData object
156  for (unsigned i=0; i<load32.size(); ++i) {
157  for (unsigned j=0; j<4; ++j) {
158  fed_data.data()[i*4+j] = (load32.at(i)>>(8*j)) & 0xff;
159  }
160  }
161 
162  // formatRaw(iEvent, amc13, fed_data);
163 
164  LogDebug("L1T") << "Packing FED ID " << fedId_ << " size " << fed_data.size();
165 
166  // put the collection in the event
167  iEvent.put(raw_coll);
168 
169 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
void resize(size_t newsize)
Definition: FEDRawData.cc:32
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
int j
Definition: DBlmapReader.cc:9
void readEvent(std::vector< uint32_t > &load32)
tuple size
Write out results.
void AMC13DumpToRaw::readEvent ( std::vector< uint32_t > &  load32)
private

Definition at line 173 of file AMC13DumpToRaw.cc.

References ztail::d, file_, geometryCSVtoXML::line, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

173  {
174 
175  // read file
177 
178  // while not encountering dumb errors
179  while (getline(file_, line) && !line.empty() ) {
180 
181  std::istringstream iss(line);
182  unsigned long d;
183  iss >> std::hex >> d;
184 
185  load32.push_back( d ) ;
186 
187  }
188 
189 }
tuple d
Definition: ztail.py:151
std::ifstream file_

Member Data Documentation

int l1t::AMC13DumpToRaw::boardId_
private

Definition at line 82 of file AMC13DumpToRaw.cc.

int l1t::AMC13DumpToRaw::evType_
private

Definition at line 83 of file AMC13DumpToRaw.cc.

int l1t::AMC13DumpToRaw::fedId_
private

Definition at line 80 of file AMC13DumpToRaw.cc.

Referenced by produce().

std::ifstream l1t::AMC13DumpToRaw::file_
private

Definition at line 76 of file AMC13DumpToRaw.cc.

Referenced by beginJob(), endJob(), and readEvent().

std::string l1t::AMC13DumpToRaw::filename_
private

Definition at line 77 of file AMC13DumpToRaw.cc.

Referenced by beginJob().

int l1t::AMC13DumpToRaw::fwVer_
private

Definition at line 84 of file AMC13DumpToRaw.cc.

int l1t::AMC13DumpToRaw::iAmc_
private

Definition at line 81 of file AMC13DumpToRaw.cc.

int l1t::AMC13DumpToRaw::slinkHeaderSize_
private

Definition at line 85 of file AMC13DumpToRaw.cc.

int l1t::AMC13DumpToRaw::slinkTrailerSize_
private

Definition at line 86 of file AMC13DumpToRaw.cc.