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::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
 
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
 
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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 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, 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")) {
15 
17  for (unsigned i = 0; i < NUM_RCT_CRATES; i++) {
18  std::stringstream fileStream;
19  fileStream << m_textFileName << std::setw(2) << std::setfill('0') << i
20  << ".txt";
21  std::string fileName(fileStream.str());
22  m_file[i].open(fileName.c_str(), std::ios::out);
23 
24  if (!m_file[i].good()) {
25  throw cms::Exception("RctDigiToRctTextTextFileOpenError")
26  << "RctDigiToRctText::RctDigiToRctText : "
27  << " couldn't create the file " << fileName << std::endl;
28  }
29  }
30 
32  fdebug.open("rctdigitorcttext_debug.txt", std::ios::out);
33 }
T getParameter(std::string const &) const
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
std::string m_textFileName
basename for output files
std::ofstream fdebug
handle for debug file
RctDigiToRctText::~RctDigiToRctText ( )
override

close files

Definition at line 35 of file RctDigiToRctText.cc.

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

35  {
37  for (unsigned i = 0; i < NUM_RCT_CRATES; i++)
38  m_file[i].close();
39  fdebug.close();
40 }
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 
)
overrideprivate

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

Definition at line 42 of file RctDigiToRctText.cc.

References data, TauDecayModes::dec, stringResolutionProvider_cfi::et, Exception, fdebug, edm::Event::getByLabel(), CaloTPGTranscoder_cfi::HF, mps_fire::i, triggerObjects_cff::id, LogDebug, m_file, m_hexUpperCase, m_rctInputLabel, nevt, NUM_RCT_CRATES, metsig::tau, and tmp.

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

Member Data Documentation

std::ofstream RctDigiToRctText::fdebug
private

handle for debug file

Definition at line 52 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 49 of file RctDigiToRctText.h.

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

bool RctDigiToRctText::m_hexUpperCase
private

write upper case hex words

Definition at line 46 of file RctDigiToRctText.h.

Referenced by analyze().

edm::InputTag RctDigiToRctText::m_rctInputLabel
private

label for RCT digis

Definition at line 40 of file RctDigiToRctText.h.

Referenced by analyze().

std::string RctDigiToRctText::m_textFileName
private

basename for output files

Definition at line 43 of file RctDigiToRctText.h.

Referenced by RctDigiToRctText().