CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
RctDigiToRctText Class Reference

#include <RctDigiToRctText.h>

Inheritance diagram for RctDigiToRctText:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 RctDigiToRctText (const edm::ParameterSet &)
 
 ~RctDigiToRctText () 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 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)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::ofstream fdebug
 handle for debug file More...
 
std::ofstream m_file [NUM_RCT_CRATES]
 handles for output files More...
 
bool m_hexUpperCase
 write upper case hex words More...
 
edm::InputTag m_rctInputLabel
 label for RCT digis More...
 
std::string m_textFileName
 basename for output files 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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (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 () noexcept
 
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...
 
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 30 of file RctDigiToRctText.h.

Constructor & Destructor Documentation

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

open output text files

open info|debug file

Definition at line 11 of file RctDigiToRctText.cc.

References Exception, fdebug, MillePedeFileConverter_cfg::fileName, good, mps_fire::i, m_file, m_textFileName, NUM_RCT_CRATES, submitPVResolutionJobs::out, and AlCaHLTBitMon_QueryRunRegistry::string.

12  : m_rctInputLabel(iConfig.getParameter<edm::InputTag>("RctInputLabel")),
13  m_textFileName(iConfig.getParameter<std::string>("TextFileName")),
14  m_hexUpperCase(iConfig.getParameter<bool>("HexUpperCase")) {
16  for (unsigned i = 0; i < NUM_RCT_CRATES; i++) {
17  std::stringstream fileStream;
18  fileStream << m_textFileName << std::setw(2) << std::setfill('0') << i << ".txt";
19  std::string fileName(fileStream.str());
20  m_file[i].open(fileName.c_str(), std::ios::out);
21 
22  if (!m_file[i].good()) {
23  throw cms::Exception("RctDigiToRctTextTextFileOpenError")
24  << "RctDigiToRctText::RctDigiToRctText : "
25  << " couldn't create the file " << fileName << std::endl;
26  }
27  }
28 
30  fdebug.open("rctdigitorcttext_debug.txt", std::ios::out);
31 }
static const unsigned NUM_RCT_CRATES
bool m_hexUpperCase
write upper case hex words
edm::InputTag m_rctInputLabel
label for RCT digis
std::ofstream m_file[NUM_RCT_CRATES]
handles for output files
auto const good
min quality of good
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string m_textFileName
basename for output files
std::ofstream fdebug
handle for debug file
RctDigiToRctText::~RctDigiToRctText ( )
override

close files

Definition at line 33 of file RctDigiToRctText.cc.

References fdebug, mps_fire::i, m_file, and NUM_RCT_CRATES.

33  {
35  for (unsigned i = 0; i < NUM_RCT_CRATES; i++)
36  m_file[i].close();
37  fdebug.close();
38 }
static const unsigned NUM_RCT_CRATES
std::ofstream m_file[NUM_RCT_CRATES]
handles for output files
std::ofstream fdebug
handle for debug file

Member Function Documentation

void RctDigiToRctText::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

count bunch crossing

get the RCT data

debug flags and stream

— ELECTRONS —

debug

— REGIONS —

print electrons

print regions

mip bits

quiet bits

region info

HF

flush data to files

Implements edm::EDAnalyzer.

Definition at line 40 of file RctDigiToRctText.cc.

References data, TauDecayModes::dec, Exception, fdebug, edm::Event::getByLabel(), DigiToRawDM_cff::HF, mps_fire::i, gpuClustering::id, dqmiolumiharvest::j, LogDebug, m_file, m_hexUpperCase, m_rctInputLabel, nevt, NUM_RCT_CRATES, metsig::tau, and createJobs::tmp.

40  {
42  static int nevt = -1;
43  nevt++;
44 
48  iEvent.getByLabel(m_rctInputLabel, em);
49  iEvent.getByLabel(m_rctInputLabel, rgn);
50 
52  bool ldebug = false;
53  bool debug_NOTEMPTY[18] = {false};
54  for (int i = 0; i < 18; i++)
55  debug_NOTEMPTY[i] = false;
56  std::stringstream dstrm;
57 
59 
60  unsigned long int CAND[18][8];
61  int n_iso[18] = {0};
62  int n_niso[18] = {0};
63  bool iso;
64  int id;
65 
66  for (L1CaloEmCollection::const_iterator iem = em->begin(); iem != em->end(); iem++) {
67  int crate = iem->rctCrate();
68  iso = iem->isolated();
69  unsigned data = iem->raw();
70 
71  id = iso ? n_iso[crate]++ : 4 + n_niso[crate]++;
72 
73  CAND[crate][id] = data;
74 
76  if (crate > 17 || id > 7)
77  throw cms::Exception("RctDigiToRctTextElectronIndexOutBounds")
78  << "out of bounds indices crate:" << crate << "id:" << id << std::endl;
79  if (ldebug && data != 0)
80  debug_NOTEMPTY[crate] = true;
81  dstrm.str("");
82  dstrm << "electron "
83  << " bx:" << nevt << " crate:" << crate << " iso:" << iso << " raw:" << data << " \t cand:" << *iem;
84  if (debug_NOTEMPTY[crate])
85  fdebug << dstrm.str() << std::endl;
86  }
87 
89 
90  unsigned short MIPbits[18][7][2] = {{{0}}};
91  unsigned short QIEbits[18][7][2] = {{{0}}};
92  unsigned short RC[18][7][2] = {{{0}}};
93  unsigned short RCof[18][7][2] = {{{0}}};
94  unsigned short RCtau[18][7][2] = {{{0}}};
95  unsigned short HF[18][4][2] = {{{0}}};
96 
97  for (L1CaloRegionCollection::const_iterator irgn = rgn->begin(); irgn != rgn->end(); irgn++) {
98  int crate = irgn->rctCrate();
99  int card = irgn->rctCard();
100  int rgnidx = irgn->rctRegionIndex();
101 
102  dstrm.str("");
103  if (!irgn->id().isHf()) {
104  RC[crate][card][rgnidx] = irgn->et();
105  RCof[crate][card][rgnidx] = irgn->overFlow();
106  RCtau[crate][card][rgnidx] = irgn->tauVeto();
107  MIPbits[crate][card][rgnidx] = irgn->mip();
108  QIEbits[crate][card][rgnidx] = irgn->quiet();
109  // debug info
110  dstrm << hex << "Et=" << irgn->et() << " OverFlow=" << irgn->overFlow() << " tauVeto=" << irgn->tauVeto()
111  << " mip=" << irgn->mip() << " quiet=" << irgn->quiet() << " Card=" << irgn->rctCard()
112  << " Region=" << irgn->rctRegionIndex() << " Crate=" << irgn->rctCrate() << dec;
113  if (ldebug)
114  LogDebug("Regions") << dstrm.str();
115  } else {
116  HF[crate][irgn->id().rctEta() - 7][irgn->id().rctPhi()] = irgn->et();
117  // debug info
118  dstrm << hex << "Et=" << irgn->et() << " FGrain=" << irgn->fineGrain() << " Eta=" << irgn->id().rctEta()
119  << " Phi=" << irgn->id().rctPhi() << " Crate=" << irgn->rctCrate() << dec;
120  if (ldebug)
121  LogDebug("HFRegions") << dstrm.str();
122  }
123 
124  if (ldebug && irgn->et() != 0)
125  debug_NOTEMPTY[crate] = true; // debug
126  if (debug_NOTEMPTY[crate]) {
127  fdebug << "region"
128  << " bx:" << nevt << " crate:" << crate << "\t";
129  fdebug << dstrm.str() << std::endl;
130  }
131  }
132 
133  std::stringstream sstrm;
134  if (m_hexUpperCase)
135  sstrm << std::uppercase;
136  else
137  sstrm.unsetf(std::ios::uppercase);
138 
140 
141  for (unsigned crate = 0; crate < NUM_RCT_CRATES; crate++) {
142  sstrm.str("");
143  sstrm << "Crossing " << nevt << std::endl;
144 
145  for (int j = 0; j < 8; j++) {
146  sstrm << setw(3) << setfill('0') << hex << (CAND[crate][j] & 0x3ff);
147  if (j < 7)
148  sstrm << " ";
149  }
150  sstrm << setfill(' ') << dec;
151  m_file[crate] << sstrm.str() << std::endl;
152 
153  // debug
154  if (debug_NOTEMPTY[crate])
155  fdebug << sstrm.str() << std::endl;
156  if (ldebug)
157  LogDebug("Electrons") << sstrm.str() << std::endl;
158  }
159 
161 
162  for (unsigned crate = 0; crate < NUM_RCT_CRATES; crate++) {
164  sstrm.str("");
165  for (int card = 0; card < 7; card++) {
166  for (int j = 0; j < 2; j++) {
167  sstrm << " " << MIPbits[crate][card][j];
168  }
169  }
170  m_file[crate] << sstrm.str() << std::endl;
171  if (debug_NOTEMPTY[crate])
172  fdebug << sstrm.str() << std::endl; // debug
173 
175  sstrm.str("");
176  for (int card = 0; card < 7; card++) {
177  for (int j = 0; j < 2; j++) {
178  sstrm << " " << QIEbits[crate][card][j];
179  }
180  }
181  m_file[crate] << sstrm.str() << std::endl;
182  if (debug_NOTEMPTY[crate])
183  fdebug << sstrm.str() << std::endl; // debug
184 
186  sstrm.str("");
187  for (int card = 0; card < 7; card++) {
188  for (int j = 0; j < 2; j++) {
189  unsigned long int tmp;
190  unsigned et = RC[crate][card][j];
191  unsigned ovf = RCof[crate][card][j];
192  unsigned tau = RCtau[crate][card][j];
193  // ovf = ovf || (et>=0x400);
194  tmp = ((tau & 0x1) << 11) | ((ovf & 0x1) << 10) | ((et & 0x3ff));
195  sstrm << " " << setw(3) << setfill('0') << hex << tmp;
196  }
197  }
198  m_file[crate] << sstrm.str() << std::endl;
199  if (debug_NOTEMPTY[crate])
200  fdebug << sstrm.str() << std::endl << std::endl; // debug
201 
203  sstrm.str("");
204  for (int ip = 0; ip < 2; ip++) {
205  for (int ie = 0; ie < 4; ie++) {
206  unsigned et = HF[crate][ie][ip] & 0xff;
207  sstrm << " " << setw(2) << setfill('0') << hex << et;
208  }
209  }
210  m_file[crate] << sstrm.str() << std::endl;
211  if (debug_NOTEMPTY[crate])
212  fdebug << sstrm.str() << std::endl; // debug
213  sstrm << setfill(' ') << dec;
214 
215  } // end crate loop
216 
218  for (unsigned i = 0; i < NUM_RCT_CRATES; i++)
219  m_file[i] << std::flush;
220 
221  fdebug << std::flush;
222 }
static const unsigned NUM_RCT_CRATES
uint16_t *__restrict__ id
bool m_hexUpperCase
write upper case hex words
edm::InputTag m_rctInputLabel
label for RCT digis
std::ofstream m_file[NUM_RCT_CRATES]
handles for output files
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:500
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
tmp
align.sh
Definition: createJobs.py:716
std::ofstream fdebug
handle for debug file
#define LogDebug(id)

Member Data Documentation

std::ofstream RctDigiToRctText::fdebug
private

handle for debug file

Definition at line 51 of file RctDigiToRctText.h.

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

std::ofstream RctDigiToRctText::m_file[NUM_RCT_CRATES]
private

handles for output files

Definition at line 48 of file RctDigiToRctText.h.

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

bool RctDigiToRctText::m_hexUpperCase
private

write upper case hex words

Definition at line 45 of file RctDigiToRctText.h.

Referenced by analyze().

edm::InputTag RctDigiToRctText::m_rctInputLabel
private

label for RCT digis

Definition at line 39 of file RctDigiToRctText.h.

Referenced by analyze().

std::string RctDigiToRctText::m_textFileName
private

basename for output files

Definition at line 42 of file RctDigiToRctText.h.

Referenced by RctDigiToRctText().