CMS 3D CMS Logo

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

#include <RctDigiToSourceCardText.h>

Inheritance diagram for RctDigiToSourceCardText:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 RctDigiToSourceCardText (const edm::ParameterSet &)
 
 ~RctDigiToSourceCardText () 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 m_file
 file handle More...
 
unsigned short m_nevt
 event counter More...
 
edm::InputTag m_rctInputLabel
 Label for RCT digis. More...
 
SourceCardRouting m_scRouting
 source card router More...
 
std::string m_textFileName
 Name out output file. 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

L1Trigger/TextToDigi/src/RctDigiToSourceCardText.cc

Description: Input RCT digis and output GCT text file to be loaded into the source cards for pattern tests.

L1Trigger/TextToDigi/interface/RctDigiToSourceCardText.h

Description: Input RCT digis and output text file to be loaded into the source cards for pattern tests.

Implementation: <Notes on="" implementation>="">

Definition at line 44 of file RctDigiToSourceCardText.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file RctDigiToSourceCardText.cc.

References Exception, m_file, m_scRouting, m_textFileName, and MillePedeFileConverter_cfg::out.

31  : m_rctInputLabel(iConfig.getParameter<edm::InputTag>("RctInputLabel")),
32  m_textFileName(iConfig.getParameter<std::string>("TextFileName")),
33  m_nevt(0) {
34  // Open the output file
35  m_file.open(m_textFileName.c_str(), std::ios::out);
36 
37  if (!m_file.good()) {
38  throw cms::Exception("RctDigiToSourceCardTextFileOpenError")
39  << "RctDigiToSourceCardText::RctDigiToSourceCardText : "
40  << " couldn't open the file " << m_textFileName << " for writing"
41  << std::endl;
42  }
43 
44  // Make a SC routing object
46 }
T getParameter(std::string const &) const
std::ofstream m_file
file handle
edm::InputTag m_rctInputLabel
Label for RCT digis.
std::string m_textFileName
Name out output file.
unsigned short m_nevt
event counter
SourceCardRouting m_scRouting
source card router
RctDigiToSourceCardText::~RctDigiToSourceCardText ( )
override

Definition at line 48 of file RctDigiToSourceCardText.cc.

References m_file.

48  {
49  // Close the output file
50  m_file.close();
51 }
std::ofstream m_file
file handle

Member Function Documentation

void RctDigiToSourceCardText::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 54 of file RctDigiToSourceCardText.cc.

References SourceCardRouting::EMUtoSTRING(), edm::Event::getByLabel(), CaloTPGTranscoder_cfi::HF, LogDebug, m_file, m_nevt, m_rctInputLabel, m_scRouting, NUM_RCT_CRATES, SourceCardRouting::RC012toSTRING(), SourceCardRouting::RC234toSTRING(), SourceCardRouting::RC56HFtoSTRING(), SourceCardRouting::RoutingModetoLogicalCardID(), and AlCaHLTBitMon_QueryRunRegistry::string.

55  {
56 
57  // get the RCT data
60  iEvent.getByLabel(m_rctInputLabel, em);
61  iEvent.getByLabel(m_rctInputLabel, rgn);
62 
63  // General variables
64  int RoutingMode;
65  unsigned short logicalCardID;
66  std::string dataString;
67 
68  // Arrays to hold electron variables
69  unsigned short eIsoRank[18][4] = {{0}};
70  unsigned short eIsoCardId[18][4] = {{0}};
71  unsigned short eIsoRegionId[18][4] = {{0}};
72  unsigned short eNonIsoRank[18][4] = {{0}};
73  unsigned short eNonIsoCardId[18][4] = {{0}};
74  unsigned short eNonIsoRegionId[18][4] = {{0}};
75 
76  // Fill electrons
77  unsigned numIsoEM[18] = {0};
78  unsigned numNonIsoEM[18] = {0};
79 
80  for (L1CaloEmCollection::const_iterator iem = em->begin(); iem != em->end();
81  iem++) {
82  if (iem->isolated()) {
83  eIsoRank[iem->rctCrate()][numIsoEM[iem->rctCrate()]] = iem->rank();
84  eIsoCardId[iem->rctCrate()][numIsoEM[iem->rctCrate()]] = iem->rctCard();
85  eIsoRegionId[iem->rctCrate()][numIsoEM[iem->rctCrate()]] =
86  iem->rctRegion();
87  numIsoEM[iem->rctCrate()]++;
88  } else {
89  eNonIsoRank[iem->rctCrate()][numNonIsoEM[iem->rctCrate()]] = iem->rank();
90  eNonIsoCardId[iem->rctCrate()][numNonIsoEM[iem->rctCrate()]] =
91  iem->rctCard();
92  eNonIsoRegionId[iem->rctCrate()][numNonIsoEM[iem->rctCrate()]] =
93  iem->rctRegion();
94  numNonIsoEM[iem->rctCrate()]++;
95  }
96  // Debug info
97  LogDebug("Electrons") << "Rank=" << iem->rank()
98  << " Card=" << iem->rctCard()
99  << " Region=" << iem->rctRegion()
100  << " Crate=" << iem->rctCrate()
101  << " Isolated=" << iem->isolated();
102  }
103 
104  // Arrays to hold region variables
105  unsigned short RC[18][7][2] = {{{0}}};
106  unsigned short RCof[18][7][2] = {{{0}}};
107  unsigned short RCtau[18][7][2] = {{{0}}};
108  unsigned short HF[18][4][2] = {{{0}}};
109  unsigned short HFQ[18][4][2] = {{{0}}};
110  unsigned short MIPbits[18][7][2] = {{{0}}};
111  unsigned short Qbits[18][7][2] = {{{0}}};
112 
113  // Fill regions
114  for (L1CaloRegionCollection::const_iterator irgn = rgn->begin();
115  irgn != rgn->end(); irgn++) {
116  if (irgn->id().isHf()) {
117  HF[irgn->rctCrate()][irgn->id().rctEta() - 7][irgn->id().rctPhi()] =
118  irgn->et();
119  HFQ[irgn->rctCrate()][irgn->id().rctEta() - 7][irgn->id().rctPhi()] =
120  irgn->fineGrain();
121  // Debug info
122  LogDebug("HFRegions")
123  << "Et=" << irgn->et() << " FineGrain=" << irgn->fineGrain()
124  << " Eta=" << irgn->id().rctEta() << " Phi=" << irgn->id().rctPhi()
125  << " Crate=" << irgn->rctCrate();
126  } else {
127  RC[irgn->rctCrate()][irgn->rctCard()][irgn->rctRegionIndex()] =
128  irgn->et();
129  RCof[irgn->rctCrate()][irgn->rctCard()][irgn->rctRegionIndex()] =
130  irgn->overFlow();
131  RCtau[irgn->rctCrate()][irgn->rctCard()][irgn->rctRegionIndex()] =
132  irgn->tauVeto();
133  MIPbits[irgn->rctCrate()][irgn->rctCard()][irgn->rctRegionIndex()] =
134  irgn->mip();
135  Qbits[irgn->rctCrate()][irgn->rctCard()][irgn->rctRegionIndex()] =
136  irgn->quiet();
137  // Debug info
138  LogDebug("Regions") << "Et=" << irgn->et()
139  << " OverFlow=" << irgn->overFlow()
140  << " tauVeto=" << irgn->tauVeto()
141  << " mip=" << irgn->mip()
142  << " quiet=" << irgn->quiet()
143  << " Card=" << irgn->rctCard()
144  << " Region=" << irgn->rctRegionIndex()
145  << " Crate=" << irgn->rctCrate();
146  }
147  }
148 
149  for (int crate = 0; crate < NUM_RCT_CRATES; crate++) {
150 
151  // Logical Card ID = Source Card number
152  RoutingMode = 0;
153  m_scRouting.RoutingModetoLogicalCardID(logicalCardID, RoutingMode, crate);
154 
155  // Convert electrons to SC format
157  logicalCardID, m_nevt, eIsoRank[crate], eIsoCardId[crate],
158  eIsoRegionId[crate], eNonIsoRank[crate], eNonIsoCardId[crate],
159  eNonIsoRegionId[crate], MIPbits[crate], Qbits[crate], dataString);
160 
161  // Write electrons
162  m_file << dataString;
163 
164  // Logical Card ID = Source Card number
165  RoutingMode = 1;
166  m_scRouting.RoutingModetoLogicalCardID(logicalCardID, RoutingMode, crate);
167 
168  // Convert regions to SC format
169  m_scRouting.RC56HFtoSTRING(logicalCardID, m_nevt, RC[crate], RCof[crate],
170  RCtau[crate], HF[crate], HFQ[crate], dataString);
171 
172  // Write regions
173  m_file << dataString;
174 
175  // Logical Card ID = Source Card number
176  RoutingMode = 2;
177  m_scRouting.RoutingModetoLogicalCardID(logicalCardID, RoutingMode, crate);
178 
179  // Convert regions to SC format
180  m_scRouting.RC012toSTRING(logicalCardID, m_nevt, RC[crate], RCof[crate],
181  RCtau[crate], dataString);
182 
183  // Write regions
184  m_file << dataString;
185 
186  // This is to 9 only as this is the shared source card
187  if (crate < 9) {
188  // Logical Card ID = Source Card number
189  RoutingMode = 3;
190  m_scRouting.RoutingModetoLogicalCardID(logicalCardID, RoutingMode, crate);
191 
192  // Convert regions to SC format
193  m_scRouting.RC234toSTRING(logicalCardID, m_nevt, RC[crate], RCof[crate],
194  RCtau[crate], RC[crate + 9], RCof[crate + 9],
195  RCtau[crate + 9], dataString);
196 
197  // Write regions
198  m_file << dataString;
199  }
200  }
201 
202  // Force write to file
203  m_file << flush;
204 
205  m_nevt++;
206 }
#define LogDebug(id)
void RC012toSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], std::string &dataString) const
std::ofstream m_file
file handle
edm::InputTag m_rctInputLabel
Label for RCT digis.
void RC234toSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], std::string &dataString) const
void RoutingModetoLogicalCardID(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) const
void EMUtoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], std::string &dataString) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
unsigned short m_nevt
event counter
void RC56HFtoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], std::string &dataString) const
SourceCardRouting m_scRouting
source card router
static const int NUM_RCT_CRATES

Member Data Documentation

std::ofstream RctDigiToSourceCardText::m_file
private

file handle

Definition at line 59 of file RctDigiToSourceCardText.h.

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

unsigned short RctDigiToSourceCardText::m_nevt
private

event counter

Definition at line 62 of file RctDigiToSourceCardText.h.

Referenced by analyze().

edm::InputTag RctDigiToSourceCardText::m_rctInputLabel
private

Label for RCT digis.

Definition at line 53 of file RctDigiToSourceCardText.h.

Referenced by analyze().

SourceCardRouting RctDigiToSourceCardText::m_scRouting
private

source card router

Definition at line 65 of file RctDigiToSourceCardText.h.

Referenced by analyze(), and RctDigiToSourceCardText().

std::string RctDigiToSourceCardText::m_textFileName
private

Name out output file.

Definition at line 56 of file RctDigiToSourceCardText.h.

Referenced by RctDigiToSourceCardText().