CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1MuGMTHWFileReader Class Reference

#include <L1MuGMTHWFileReader.h>

Inheritance diagram for L1MuGMTHWFileReader:
edm::ProducerSourceFromFiles edm::ProducerSourceBase edm::FromFiles edm::InputSource edm::ProductRegistryHelper

Public Member Functions

 L1MuGMTHWFileReader (edm::ParameterSet const &, edm::InputSourceDescription const &)
 
void readNextEvent ()
 
 ~L1MuGMTHWFileReader ()
 
- Public Member Functions inherited from edm::ProducerSourceFromFiles
virtual bool noFiles () const override
 
 ProducerSourceFromFiles (ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
 
virtual ~ProducerSourceFromFiles ()
 
- Public Member Functions inherited from edm::ProducerSourceBase
EventNumber_t event () const
 
unsigned int eventCreationDelay () const
 
EventID const & eventID () const
 
LuminosityBlockNumber_t luminosityBlock () const
 
unsigned int numberEventsInLumi () const
 
unsigned int numberEventsInRun () const
 
unsigned int numberEventsInThisLumi () const
 
unsigned int numberEventsInThisRun () const
 
TimeValue_t presentTime () const
 
 ProducerSourceBase (ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
 
RunNumber_t run () const
 
unsigned int timeBetweenEvents () const
 
virtual ~ProducerSourceBase ()
 
- Public Member Functions inherited from edm::InputSource
std::shared_ptr< ActivityRegistryactReg () const
 Accessor for Activity Registry. More...
 
std::shared_ptr
< BranchIDListHelper
branchIDListHelper () const
 Accessor for branchIDListHelper. More...
 
void closeFile (FileBlock *, bool cleaningUpAfterException)
 close current file More...
 
void doBeginJob ()
 Called by framework at beginning of job. More...
 
void doBeginLumi (LuminosityBlockPrincipal &lbp, ProcessContext const *)
 Called by framework at beginning of lumi block. More...
 
void doBeginRun (RunPrincipal &rp, ProcessContext const *)
 Called by framework at beginning of run. More...
 
void doEndJob ()
 Called by framework at end of job. More...
 
void doEndLumi (LuminosityBlockPrincipal &lbp, bool cleaningUpAfterException, ProcessContext const *)
 Called by framework at end of lumi block. More...
 
void doEndRun (RunPrincipal &rp, bool cleaningUpAfterException, ProcessContext const *)
 Called by framework at end of run. More...
 
void doPostForkReacquireResources (std::shared_ptr< multicore::MessageReceiverForSource >)
 
void doPreForkReleaseResources ()
 Called by the framework before forking the process. More...
 
ProcessingController::ForwardState forwardState () const
 
bool goToEvent (EventID const &eventID)
 
 InputSource (ParameterSet const &, InputSourceDescription const &)
 Constructor. More...
 
 InputSource (InputSource const &)=delete
 
void issueReports (EventID const &eventID)
 issue an event report More...
 
LuminosityBlockNumber_t luminosityBlock () const
 Accessor for current luminosity block number. More...
 
std::shared_ptr
< LuminosityBlockAuxiliary
luminosityBlockAuxiliary () const
 Called by the framework to merge or insert lumi in principal cache. More...
 
int maxEvents () const
 
int maxLuminosityBlocks () const
 
ModuleDescription const & moduleDescription () const
 Accessor for 'module' description. More...
 
ItemType nextItemType ()
 Advances the source to the next item. More...
 
InputSourceoperator= (InputSource const &)=delete
 
bool primary () const
 Accessor for primary input source flag. More...
 
ProcessConfiguration const & processConfiguration () const
 Accessor for Process Configuration. More...
 
std::string const & processGUID () const
 Accessor for global process identifier. More...
 
ProcessHistoryRegistry const & processHistoryRegistry () const
 Const accessor for process history registry. More...
 
ProcessHistoryRegistryprocessHistoryRegistryForUpdate ()
 Non-const accessor for process history registry. More...
 
ProcessingMode processingMode () const
 RunsLumisAndEvents (default), RunsAndLumis, or Runs. More...
 
std::shared_ptr
< ProductRegistry const > 
productRegistry () const
 Accessor for product registry. More...
 
bool randomAccess () const
 
void readAndMergeLumi (LuminosityBlockPrincipal &lbp)
 Read next luminosity block (same as a prior lumi) More...
 
void readAndMergeRun (RunPrincipal &rp)
 Read next run (same as a prior run) More...
 
void readEvent (EventPrincipal &ep, StreamContext &)
 Read next event. More...
 
bool readEvent (EventPrincipal &ep, EventID const &, StreamContext &)
 Read a specific event. More...
 
std::unique_ptr< FileBlockreadFile ()
 Read next file. More...
 
void readLuminosityBlock (LuminosityBlockPrincipal &lumiPrincipal, HistoryAppender &historyAppender)
 Read next luminosity block (new lumi) More...
 
std::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary ()
 Read next luminosity block Auxilary. More...
 
void readRun (RunPrincipal &runPrincipal, HistoryAppender &historyAppender)
 Read next run (new run) More...
 
std::shared_ptr< RunAuxiliaryreadRunAuxiliary ()
 Read next run Auxiliary. More...
 
ProcessHistoryID const & reducedProcessHistoryID () const
 
void registerProducts ()
 Register any produced products. More...
 
int remainingEvents () const
 
int remainingLuminosityBlocks () const
 
void repeat ()
 Reset the remaining number of events/lumis to the maximum number. More...
 
SharedResourcesAcquirerresourceSharedWithDelayedReader () const
 Returns nullptr if no resource shared between the Source and a DelayedReader. More...
 
ProcessingController::ReverseState reverseState () const
 
void rewind ()
 Begin again at the first event. More...
 
RunNumber_t run () const
 Accessor for current run number. More...
 
std::shared_ptr< RunAuxiliaryrunAuxiliary () const
 Called by the framework to merge or insert run in principal cache. More...
 
void setLuminosityBlockNumber_t (LuminosityBlockNumber_t lb)
 Set the luminosity block ID. More...
 
void setRunNumber (RunNumber_t r)
 Set the run number. More...
 
void skipEvents (int offset)
 
bool skipForForking ()
 
Timestamp const & timestamp () const
 Accessor for the current time, as seen by the input source. More...
 
virtual ~InputSource ()
 Destructor. More...
 

Private Member Functions

virtual void produce (edm::Event &)
 
virtual bool setRunAndEventInfo (edm::EventID &id, edm::TimeValue_t &time, edm::EventAuxiliary::ExperimentType &eType)
 

Private Attributes

L1MuGMTInputEvent m_evt
 
std::ifstream m_in
 

Additional Inherited Members

- Public Types inherited from edm::InputSource
enum  ItemType {
  IsInvalid, IsStop, IsFile, IsRun,
  IsLumi, IsEvent, IsRepeat, IsSynchronize
}
 
enum  ProcessingMode { Runs, RunsAndLumis, RunsLumisAndEvents }
 
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::ProducerSourceFromFiles
static void fillDescription (ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::ProducerSourceBase
static void fillDescription (ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::InputSource
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::InputSource
void decreaseRemainingEventsBy (int iSkipped)
 
bool eventCached () const
 
std::shared_ptr
< LuminosityBlockPrincipal >
const 
luminosityBlockPrincipal () const
 
bool newLumi () const
 
bool newRun () const
 
ProcessHistoryRegistryprocessHistoryRegistryUpdate () const
 
ProductRegistryproductRegistryUpdate () const
 
void reset () const
 
void resetEventCached ()
 
void resetLuminosityBlockAuxiliary (bool isNewLumi=true) const
 
void resetNewLumi ()
 
void resetNewRun ()
 
void resetRunAuxiliary (bool isNewRun=true) const
 
std::shared_ptr< RunPrincipal >
const 
runPrincipal () const
 
void setEventCached ()
 Called by the framework to merge or ached() const {return eventCached_;}. More...
 
void setLuminosityBlockAuxiliary (LuminosityBlockAuxiliary *lbp)
 
void setNewLumi ()
 
void setNewRun ()
 
void setRunAuxiliary (RunAuxiliary *rp)
 
void setTimestamp (Timestamp const &theTime)
 To set the current time, as seen by the input source. More...
 
ItemType state () const
 

Detailed Description

Definition at line 39 of file L1MuGMTHWFileReader.h.

Constructor & Destructor Documentation

L1MuGMTHWFileReader::L1MuGMTHWFileReader ( edm::ParameterSet const &  ps,
edm::InputSourceDescription const &  desc 
)
explicit

Definition at line 37 of file L1MuGMTHWFileReader.cc.

References edm::FromFiles::fileNames(), spr::find(), and m_in.

38  :
39  ProducerSourceFromFiles(ps, desc, true) {
40 
41  produces<std::vector<L1MuRegionalCand> >("DT");
42  produces<std::vector<L1MuRegionalCand> >("CSC");
43  produces<std::vector<L1MuRegionalCand> >("RPCb");
44  produces<std::vector<L1MuRegionalCand> >("RPCf");
45 
46  produces<L1CaloRegionCollection>();
47 
48  if(!fileNames().size()) {
49  throw std::runtime_error("L1MuGMTHWFileReader: no input file");
50  }
51  edm::LogInfo("GMT_HWFileReader_info") << "opening file " << fileNames()[0];
52  m_in.open((fileNames()[0].substr(fileNames()[0].find(":")+1)).c_str());
53  if(!m_in) {
54  throw std::runtime_error("L1MuGMTHWFileReader: file " + fileNames()[0]
55  + " could not be openned");
56  }
57 
58 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
ProducerSourceFromFiles(ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
std::vector< std::string > const & fileNames() const
Definition: FromFiles.h:22
L1MuGMTHWFileReader::~L1MuGMTHWFileReader ( )

Definition at line 63 of file L1MuGMTHWFileReader.cc.

References m_in.

63  {
64  m_in.close();
65 }

Member Function Documentation

void L1MuGMTHWFileReader::produce ( edm::Event e)
privatevirtual

Implements edm::ProducerSourceBase.

Definition at line 80 of file L1MuGMTHWFileReader.cc.

References L1MuGMTInputEvent::getInputMuon(), L1MuGMTInputEvent::getIsoBit(), L1MuGMTInputEvent::getMipBit(), i, m_evt, RPCpg::mu, and edm::Event::put().

80  {
81  L1MuRegionalCand empty_mu;
82 
83 
84  std::auto_ptr<std::vector<L1MuRegionalCand> > DTCands(new std::vector<L1MuRegionalCand>);
85  for (unsigned i = 0; i < 4; i++) {
86  const L1MuRegionalCand *mu = m_evt.getInputMuon("IND", i);
87  if (!mu) mu = &empty_mu;
88  DTCands->push_back(*mu);
89  }
90  e.put(DTCands,"DT");
91 
92  std::auto_ptr<std::vector<L1MuRegionalCand> > CSCCands(new std::vector<L1MuRegionalCand>);
93  for (unsigned i = 0; i < 4; i++) {
94  const L1MuRegionalCand *mu = m_evt.getInputMuon("INC", i);
95  if (!mu) mu = &empty_mu;
96  CSCCands->push_back(*mu);
97  }
98  e.put(CSCCands,"CSC");
99 
100  std::auto_ptr<std::vector<L1MuRegionalCand> > RPCbCands(new std::vector<L1MuRegionalCand>);
101  for (unsigned i = 0; i < 4; i++) {
102  const L1MuRegionalCand *mu = m_evt.getInputMuon("INB", i);
103  if (!mu) mu = &empty_mu;
104  RPCbCands->push_back(*mu);
105  }
106  e.put(RPCbCands,"RPCb");
107 
108  std::auto_ptr<std::vector<L1MuRegionalCand> > RPCfCands(new std::vector<L1MuRegionalCand>);
109  for (unsigned i = 0; i < 4; i++) {
110  const L1MuRegionalCand *mu = m_evt.getInputMuon("INF", i);
111  if (!mu) mu = &empty_mu;
112  RPCfCands->push_back(*mu);
113  }
114  e.put(RPCfCands,"RPCf");
115 
116  std::auto_ptr<L1CaloRegionCollection> rctRegions (new L1CaloRegionCollection);
117  for(int ieta = 4; ieta < 18; ieta++) {
118  for(int iphi = 0; iphi < 18; iphi++) {
119  rctRegions->push_back(L1CaloRegion(0,false,true,m_evt.getMipBit(ieta-4,iphi),m_evt.getIsoBit(ieta-4,iphi),ieta,iphi));
120  }
121  }
122 
123  e.put(rctRegions);
124 }
int i
Definition: DBlmapReader.cc:9
L1MuGMTInputEvent m_evt
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
const int mu
Definition: Constants.h:22
const L1MuRegionalCand * getInputMuon(std::string chipid, unsigned index) const
const bool & getMipBit(unsigned etaIndex, unsigned phiIndex)
const bool & getIsoBit(unsigned etaIndex, unsigned phiIndex)
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:22
std::vector< L1CaloRegion > L1CaloRegionCollection
void L1MuGMTHWFileReader::readNextEvent ( )

Definition at line 126 of file L1MuGMTHWFileReader.cc.

References L1MuGMTInputEvent::addInputMuon(), eta(), i, m_evt, m_in, phi, L1MuGMTInputEvent::reset(), dqmPostProcessing_online::runnr, L1MuRegionalCand::setBx(), L1MuGMTInputEvent::setEventNumber(), L1MuGMTInputEvent::setIsoBit(), L1MuGMTInputEvent::setMipBit(), L1MuGMTInputEvent::setRunNumber(), L1MuRegionalCand::setType(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setRunAndEventInfo().

126  {
127  m_evt.reset();
128 
129  std::string line_id;
130  do {
131  int bx = 0;
132 
133  m_in >> line_id;
134  if (line_id == "--") continue;
135 
136  if (line_id == "RUN") {
137  unsigned long runnr;
138  m_in >> runnr;
139  m_evt.setRunNumber(runnr);
140  }
141 
142  if (line_id == "EVT") {
143  unsigned long evtnr;
144  m_in >> evtnr;
145  m_evt.setEventNumber(evtnr);
146  }
147 
148 
149  if (line_id == "DT" || line_id == "CSC" || line_id == "BRPC" || line_id == "FRPC")
150  {
151 
152  // decode input muon
153 
154  unsigned inpmu = 0;
155  unsigned val;
156  m_in >> val; inpmu |= (val & 0x01) << 24; // valid charge
157  m_in >> val; inpmu |= (val & 0x01) << 23; // charge
158  m_in >> val; inpmu |= (val & 0x01) << 22; // halo / fine
159  m_in >> val; inpmu |= (val & 0x3f) << 16; // eta
160  m_in >> val; inpmu |= (val & 0x07) << 13; // quality
161  m_in >> val; inpmu |= (val & 0x1f) << 8; // pt
162  m_in >> val; inpmu |= (val & 0xff) ; // phi
163 
164  std::string chipid("IN");
165  chipid += line_id[0];
166 
167  int type=0;
168  if (line_id == "DT") type = 0;
169  if (line_id == "CSC") type = 2;
170  if (line_id == "BRPC") type = 1;
171  if (line_id == "FRPC") type = 3;
172 
173 
174  L1MuRegionalCand cand(inpmu);
175  cand.setType(type);
176  cand.setBx(bx);
177  m_evt.addInputMuon(chipid, cand);
178  }
179 
180  if (line_id == "MIP") {
181  int nPairs;
182  m_in >> nPairs;
183  for (int i=0; i<nPairs; i++) {
184  unsigned eta;
185  unsigned phi;
186  m_in >> eta;
187  m_in >> phi;
188  if (phi >= 9) phi-=9;
189  else phi+=9;
190  m_evt.setMipBit(eta, phi, true);
191  }
192  }
193 
194  if (line_id == "NQ") {
195  int nPairs;
196  m_in >> nPairs;
197  for (int i=0; i<nPairs; i++) {
198  unsigned eta;
199  unsigned phi;
200  m_in >> eta;
201  m_in >> phi;
202  if (phi >= 9) phi-=9;
203  else phi+=9;
204  m_evt.setIsoBit(eta, phi, false);
205  }
206  }
207 
208  //read the rest of the line
209  const int sz=4000; char buf[sz];
210  m_in.getline(buf, sz);
211 
212  } while (line_id != "NQ" && !m_in.eof());
213 
214 }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
T eta() const
void setRunNumber(unsigned long runnr)
L1MuGMTInputEvent m_evt
void addInputMuon(std::string chipid, const L1MuRegionalCand &inMu)
void setIsoBit(unsigned etaIndex, unsigned phiIndex, bool val)
void setEventNumber(unsigned long eventnr)
void setMipBit(unsigned etaIndex, unsigned phiIndex, bool val)
Definition: DDAxes.h:10
bool L1MuGMTHWFileReader::setRunAndEventInfo ( edm::EventID id,
edm::TimeValue_t time,
edm::EventAuxiliary::ExperimentType eType 
)
privatevirtual

Implements edm::ProducerSourceBase.

Definition at line 70 of file L1MuGMTHWFileReader.cc.

References L1MuGMTInputEvent::getEventNumber(), L1MuGMTInputEvent::getRunNumber(), m_evt, and readNextEvent().

70  {
71  readNextEvent();
72  if(!m_evt.getRunNumber() && !m_evt.getEventNumber()) return false;
73  id = edm::EventID(m_evt.getRunNumber(), id.luminosityBlock(), m_evt.getEventNumber());
74 
75  edm::LogInfo("GMT_HWFileReader_info") << "run: " << m_evt.getRunNumber() <<
76  " evt: " << m_evt.getEventNumber();
77  return true;
78 }
unsigned long getRunNumber() const
get the Run number
unsigned long getEventNumber() const
get the Event number
L1MuGMTInputEvent m_evt

Member Data Documentation

L1MuGMTInputEvent L1MuGMTHWFileReader::m_evt
private

Definition at line 57 of file L1MuGMTHWFileReader.h.

Referenced by produce(), readNextEvent(), and setRunAndEventInfo().

std::ifstream L1MuGMTHWFileReader::m_in
private

Definition at line 56 of file L1MuGMTHWFileReader.h.

Referenced by L1MuGMTHWFileReader(), readNextEvent(), and ~L1MuGMTHWFileReader().