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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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::RctDigiToSourceCardText ( const edm::ParameterSet iConfig)
explicit

Definition at line 29 of file RctDigiToSourceCardText.cc.

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 }

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

◆ ~RctDigiToSourceCardText()

RctDigiToSourceCardText::~RctDigiToSourceCardText ( )
override

Definition at line 46 of file RctDigiToSourceCardText.cc.

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

References m_file.

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 52 of file RctDigiToSourceCardText.cc.

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 }

References SourceCardRouting::EMUtoSTRING(), DigiToRawDM_cff::HF, iEvent, LogDebug, m_file, m_nevt, m_rctInputLabel, m_scRouting, NUM_RCT_CRATES, SourceCardRouting::RC012toSTRING(), SourceCardRouting::RC234toSTRING(), SourceCardRouting::RC56HFtoSTRING(), SourceCardRouting::RoutingModetoLogicalCardID(), and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ m_file

std::ofstream RctDigiToSourceCardText::m_file
private

file handle

Definition at line 59 of file RctDigiToSourceCardText.h.

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

◆ m_nevt

unsigned short RctDigiToSourceCardText::m_nevt
private

event counter

Definition at line 62 of file RctDigiToSourceCardText.h.

Referenced by analyze().

◆ m_rctInputLabel

edm::InputTag RctDigiToSourceCardText::m_rctInputLabel
private

Label for RCT digis.

Definition at line 53 of file RctDigiToSourceCardText.h.

Referenced by analyze().

◆ m_scRouting

SourceCardRouting RctDigiToSourceCardText::m_scRouting
private

source card router

Definition at line 65 of file RctDigiToSourceCardText.h.

Referenced by analyze(), and RctDigiToSourceCardText().

◆ m_textFileName

std::string RctDigiToSourceCardText::m_textFileName
private

Name out output file.

Definition at line 56 of file RctDigiToSourceCardText.h.

Referenced by RctDigiToSourceCardText().

RctDigiToSourceCardText::m_rctInputLabel
edm::InputTag m_rctInputLabel
Label for RCT digis.
Definition: RctDigiToSourceCardText.h:53
SourceCardRouting::RC012toSTRING
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
Definition: SourceCardRouting.cc:651
RctDigiToSourceCardText::m_file
std::ofstream m_file
file handle
Definition: RctDigiToSourceCardText.h:59
edm::Handle
Definition: AssociativeIterator.h:50
SourceCardRouting
Definition: SourceCardRouting.h:13
SourceCardRouting::RC56HFtoSTRING
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
Definition: SourceCardRouting.cc:635
SourceCardRouting::EMUtoSTRING
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
Definition: SourceCardRouting.cc:615
RctDigiToSourceCardText::m_textFileName
std::string m_textFileName
Name out output file.
Definition: RctDigiToSourceCardText.h:56
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
SourceCardRouting::RC234toSTRING
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
Definition: SourceCardRouting.cc:665
iEvent
int iEvent
Definition: GenABIO.cc:224
RctDigiToSourceCardText::m_nevt
unsigned short m_nevt
event counter
Definition: RctDigiToSourceCardText.h:62
NUM_RCT_CRATES
const static int NUM_RCT_CRATES
Definition: RctDigiToSourceCardText.cc:27
Exception
Definition: hltDiff.cc:245
RctDigiToSourceCardText::m_scRouting
SourceCardRouting m_scRouting
source card router
Definition: RctDigiToSourceCardText.h:65
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
SourceCardRouting::RoutingModetoLogicalCardID
void RoutingModetoLogicalCardID(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) const
Definition: SourceCardRouting.cc:750
DigiToRawDM_cff.HF
HF
Definition: DigiToRawDM_cff.py:22
edm::InputTag
Definition: InputTag.h:15