CMS 3D CMS Logo

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

#include <RctDigiToRctText.h>

Inheritance diagram for RctDigiToRctText:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 RctDigiToRctText (const edm::ParameterSet &)
 
 ~RctDigiToRctText () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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...
 
int nevt = -1
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Definition at line 30 of file RctDigiToRctText.h.

Constructor & Destructor Documentation

◆ RctDigiToRctText()

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, MillePedeFileConverter_cfg::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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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
std::string m_textFileName
basename for output files
std::ofstream fdebug
handle for debug file

◆ ~RctDigiToRctText()

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

◆ analyze()

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::one::EDAnalyzerBase.

Definition at line 40 of file RctDigiToRctText.cc.

References data, TauDecayModes::dec, EgHLTOffHistBins_cfi::et, Exception, fdebug, tpScales_cff::HF, mps_fire::i, l1ctLayer2EG_cff::id, iEvent, dqmiolumiharvest::j, LogDebug, m_file, m_hexUpperCase, m_rctInputLabel, nevt, NUM_RCT_CRATES, metsig::tau, and createJobs::tmp.

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

◆ fdebug

std::ofstream RctDigiToRctText::fdebug
private

handle for debug file

Definition at line 51 of file RctDigiToRctText.h.

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

◆ m_file

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().

◆ m_hexUpperCase

bool RctDigiToRctText::m_hexUpperCase
private

write upper case hex words

Definition at line 45 of file RctDigiToRctText.h.

Referenced by analyze().

◆ m_rctInputLabel

edm::InputTag RctDigiToRctText::m_rctInputLabel
private

label for RCT digis

Definition at line 39 of file RctDigiToRctText.h.

Referenced by analyze().

◆ m_textFileName

std::string RctDigiToRctText::m_textFileName
private

basename for output files

Definition at line 42 of file RctDigiToRctText.h.

Referenced by RctDigiToRctText().

◆ nevt

int RctDigiToRctText::nevt = -1
private

Definition at line 53 of file RctDigiToRctText.h.

Referenced by analyze().