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
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
 
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 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 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< 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

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 submitPVResolutionJobs::out.

30  : m_rctInputLabel(iConfig.getParameter<edm::InputTag>("RctInputLabel")),
31  m_textFileName(iConfig.getParameter<std::string>("TextFileName")),
32  m_nevt(0) {
33  // Open the output file
34  m_file.open(m_textFileName.c_str(), std::ios::out);
35 
36  if (!m_file.good()) {
37  throw cms::Exception("RctDigiToSourceCardTextFileOpenError")
38  << "RctDigiToSourceCardText::RctDigiToSourceCardText : "
39  << " couldn't open the file " << m_textFileName << " for writing" << std::endl;
40  }
41 
42  // Make a SC routing object
44 }
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
RctDigiToSourceCardText::~RctDigiToSourceCardText ( )
override

Definition at line 46 of file RctDigiToSourceCardText.cc.

References m_file.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 52 of file RctDigiToSourceCardText.cc.

References SourceCardRouting::EMUtoSTRING(), edm::Event::getByLabel(), DigiToRawDM_cff::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.

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

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