CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
CSCFileDumper Class Reference

#include <CSCFileDumper.h>

Inheritance diagram for CSCFileDumper:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
 CSCFileDumper (const edm::ParameterSet &pset)
 
 ~CSCFileDumper (void) override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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)
 

Public Attributes

std::map< int, FILE * > dump_files
 
std::string events
 
std::set< unsigned long > eventsToDump
 
std::string output
 

Private Attributes

std::vector< unsigned int > cscFEDids
 
edm::EDGetTokenT< FEDRawDataCollectioni_token
 Token for consumes interface & access to data. More...
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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 14 of file CSCFileDumper.h.

Constructor & Destructor Documentation

◆ CSCFileDumper()

CSCFileDumper::CSCFileDumper ( const edm::ParameterSet pset)

Definition at line 23 of file CSCFileDumper.cc.

23  {
24  i_token = consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("source"));
25  // source_ = pset.getUntrackedParameter<std::string>("source","rawDataCollector");
26  output = pset.getUntrackedParameter<std::string>("output");
27  events = pset.getUntrackedParameter<std::string>("events", "");
28 
29  cscFEDids.clear();
30  /*
31  for (unsigned int id=FEDNumbering::MINCSCFEDID;
32  id<=FEDNumbering::MAXCSCFEDID; ++id) // loop over DCCs
33  {
34  cscFEDids.push_back(id);
35  }
36  */
37  for (unsigned int id = FEDNumbering::MINCSCDDUFEDID; id <= FEDNumbering::MAXCSCDDUFEDID; ++id) // loop over DDUs
38  {
39  cscFEDids.push_back(id);
40  }
41  /*
42  for (unsigned int id=FEDNumbering::MINCSCTFFEDID; id<=FEDNumbering::MAXCSCTFFEDID; id++)
43  {
44  cscFEDids.push_back(id);
45  }
46  */
47 
48  if (events.length()) {
49  for (size_t pos1 = 0, pos2 = events.find(',');; pos1 = pos2 + 1, pos2 = events.find(',', pos2 + 1)) {
50  if (pos2 != std::string::npos) {
51  long event = 0;
52  if (sscanf(events.substr(pos1, pos2 - pos1).c_str(), "%ld", &event) == 1 && event >= 0)
53  eventsToDump.insert((unsigned long)event);
54  else
55  edm::LogError("CSCFileDumper") << " cannot parse events (" << events
56  << ") parameter: " << events.substr(pos1, pos2 - pos1);
57  } else {
58  long event = 0;
59  if (sscanf(events.substr(pos1, events.length() - pos1).c_str(), "%ld", &event) == 1 && event >= 0)
60  eventsToDump.insert((unsigned long)event);
61  else
62  edm::LogError("CSCFileDumper") << " cannot parse events (" << events
63  << ") parameter: " << events.substr(pos1, events.length() - pos1);
64  break;
65  }
66  }
67  std::ostringstream tmp;
68  for (std::set<unsigned long>::const_iterator evt = eventsToDump.begin(); evt != eventsToDump.end(); evt++)
69  tmp << *evt << " ";
70  edm::LogInfo("CSCFileDumper") << " Following events will be dumped: " << tmp.str();
71  } else
72  edm::LogInfo("CSCFileDumper") << " All events will be dumped";
73 }

References cscFEDids, edmPickEvents::event, events, eventsToDump, i_token, triggerObjects_cff::id, FEDNumbering::MAXCSCDDUFEDID, FEDNumbering::MINCSCDDUFEDID, output, muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

◆ ~CSCFileDumper()

CSCFileDumper::~CSCFileDumper ( void  )
override

Definition at line 75 of file CSCFileDumper.cc.

75  {
76  std::map<int, FILE *>::const_iterator stream = dump_files.begin();
77  while (stream != dump_files.end()) {
78  fclose(stream->second);
79  stream++;
80  }
81 }

References dump_files, and cms::cuda::stream.

Member Function Documentation

◆ analyze()

void CSCFileDumper::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Take a reference to this FED's data

Implements edm::EDAnalyzer.

Definition at line 83 of file CSCFileDumper.cc.

83  {
84  // Get a handle to the FED data collection
86  e.getByToken(i_token, rawdata);
87 
88  // Get a handle to the FED data collection
89 
90  for (unsigned int i = 0; i < cscFEDids.size(); i++) //for each of our DCCs
91  {
92  unsigned int id = cscFEDids[i];
93  std::map<int, FILE *>::const_iterator stream = dump_files.find(id);
95  const FEDRawData &fedData = rawdata->FEDData(id);
96  unsigned short int length = fedData.size();
97 
98  if (length && (eventsToDump.empty() || (eventsToDump.find((unsigned long)e.id().event()) != eventsToDump.end()))) {
99  if (stream == dump_files.end()) {
100  std::ostringstream name;
101  name << output << "_FED" << id << ".raw" << std::ends;
102  FILE *file;
103  if ((file = fopen(name.str().c_str(), "wt")) == nullptr) {
104  edm::LogError("CSCFileDumper") << "Cannot open the file: " << name.str();
105  continue;
106  } else
107  dump_files[id] = file;
108  stream = dump_files.find(id);
109  }
110 
111  // Event buffer
112  size_t size = length / 2;
113  const unsigned short *buf = (unsigned short *)fedData.data();
114  fwrite(buf, 2, size, stream->second);
115  }
116  }
117 }

References visDQMUpload::buf, cscFEDids, FEDRawData::data(), dump_files, MillePedeFileConverter_cfg::e, eventsToDump, FEDRawDataCollection::FEDData(), geometryDiff::file, mps_fire::i, i_token, triggerObjects_cff::id, Skims_PA_cff::name, output, FEDRawData::size(), findQualityFiles::size, and cms::cuda::stream.

Member Data Documentation

◆ cscFEDids

std::vector<unsigned int> CSCFileDumper::cscFEDids
private

Definition at line 29 of file CSCFileDumper.h.

Referenced by analyze(), and CSCFileDumper().

◆ dump_files

std::map<int, FILE*> CSCFileDumper::dump_files

Definition at line 16 of file CSCFileDumper.h.

Referenced by analyze(), and ~CSCFileDumper().

◆ events

std::string CSCFileDumper::events

◆ eventsToDump

std::set<unsigned long> CSCFileDumper::eventsToDump

Definition at line 17 of file CSCFileDumper.h.

Referenced by analyze(), and CSCFileDumper().

◆ i_token

edm::EDGetTokenT<FEDRawDataCollection> CSCFileDumper::i_token
private

Token for consumes interface & access to data.

Definition at line 33 of file CSCFileDumper.h.

Referenced by analyze(), and CSCFileDumper().

◆ output

std::string CSCFileDumper::output

Definition at line 20 of file CSCFileDumper.h.

Referenced by analyze(), and CSCFileDumper().

mps_fire.i
i
Definition: mps_fire.py:428
CSCFileDumper::eventsToDump
std::set< unsigned long > eventsToDump
Definition: CSCFileDumper.h:17
FEDNumbering::MAXCSCDDUFEDID
Definition: FEDNumbering.h:90
cms::cuda::stream
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Definition: HistoContainer.h:51
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::Handle< FEDRawDataCollection >
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
CSCFileDumper::i_token
edm::EDGetTokenT< FEDRawDataCollection > i_token
Token for consumes interface & access to data.
Definition: CSCFileDumper.h:33
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
geometryDiff.file
file
Definition: geometryDiff.py:13
edmPickEvents.event
event
Definition: edmPickEvents.py:273
FEDNumbering::MINCSCDDUFEDID
Definition: FEDNumbering.h:89
CSCFileDumper::output
std::string output
Definition: CSCFileDumper.h:20
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
visDQMUpload.buf
buf
Definition: visDQMUpload.py:160
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
CSCFileDumper::events
std::string events
Definition: CSCFileDumper.h:20
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CSCFileDumper::dump_files
std::map< int, FILE * > dump_files
Definition: CSCFileDumper.h:16
event
Definition: event.py:1
CSCFileDumper::cscFEDids
std::vector< unsigned int > cscFEDids
Definition: CSCFileDumper.h:29
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37