CMS 3D CMS Logo

EmulateCPPF.cc
Go to the documentation of this file.
1 
5 #include <fstream>
6 #include <string>
13 
15  : recHit_processors_(),
16  rpcDigiToken_(iConsumes.consumes<RPCDigiCollection>(iConfig.getParameter<edm::InputTag>("rpcDigiLabel"))),
17  recHitToken_(iConsumes.consumes<RPCRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitLabel"))),
18  rpcDigiSimLinkToken_(iConsumes.consumes<edm::DetSetVector<RPCDigiSimLink> >(
19  iConfig.getParameter<edm::InputTag>("rpcDigiSimLinkLabel"))),
20  cppfSource_(CppfSource::EventSetup),
21  MaxClusterSize_(0) {
22  MaxClusterSize_ = iConfig.getParameter<int>("MaxClusterSize");
23  const std::string cppfSource = iConfig.getParameter<std::string>("cppfSource");
24  // Look up table
25  if (cppfSource == "File") {
27  edm::FileInPath fp = iConfig.getParameter<edm::FileInPath>("cppfvecfile");
28  std::ifstream inputFile(fp.fullPath().c_str(), std::ios::in);
29  if (!inputFile) {
30  throw cms::Exception("No LUT") << "Error: CPPF look up table file cannot not be opened";
31  exit(1);
32  }
33  while (inputFile.good()) {
35  inputFile >> Item.rawId >> Item.strip >> Item.lb >> Item.halfchannel >> Item.int_phi >> Item.int_theta;
36  if (inputFile.good())
37  CppfVec_1.push_back(Item);
38  }
39  inputFile.close();
40  }
41  // RPC Geometry
42  else if (cppfSource == "Geo") {
44  }
45  // Error for wrong input
46  else {
47  throw cms::Exception("Invalid option")
48  << "Error: Specify in python/emulatorCppfDigis_cfi 'File' for look up table or 'Geo' for RPC Geometry";
49  exit(1);
50  }
51 }
52 
54 
56  const edm::EventSetup &iSetup,
57  l1t::CPPFDigiCollection &cppf_recHit) {
58  if (cppfSource_ == CppfSource::File) { // Using the look up table to fill the information
59  cppf_recHit.clear();
60  for (auto &recHit_processor : recHit_processors_) {
61  recHit_processor.processLook(
63  }
64  } else if (cppfSource_ == CppfSource::EventSetup) {
65  // Clear output collections
66  // cppf_rpcDigi.clear();
67  cppf_recHit.clear();
68 
69  //Get the RPCDigis from the event
70  // Run the CPPF clusterization+coordinate conversion algo on RPCDigis and
71  // RecHits
72 
73  // For now, treat CPPF as single board
74  // In the future, may want to treat the 4 CPPF boards in each endcap as
75  // separate entities
76 
77  // for (unsigned int iBoard = 0; iBoard < rpcDigi_processors_.size();
78  // iBoard++) { rpcDigi_processors_.at(iBoard).process( iSetup, rpcDigis,
79  // cppf_rpcDigi );
80  // }
81  for (auto &recHit_processor : recHit_processors_) {
82  recHit_processor.process(iEvent, iSetup, recHitToken_, rpcDigiToken_, rpcDigiSimLinkToken_, cppf_recHit);
83  }
84  }
85 } // End void EmulateCPPF::process()
EmulateCPPF::recHit_processors_
std::array< RecHitProcessor, 1 > recHit_processors_
Definition: EmulateCPPF.h:26
EmulateCPPF::CppfSource
CppfSource
Definition: EmulateCPPF.h:32
RecHitProcessor::CppfItem::strip
int strip
Definition: RecHitProcessor.h:40
EmulateCPPF::EmulateCPPF
EmulateCPPF(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iConsumes)
Definition: EmulateCPPF.cc:14
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
personalPlayback.fp
fp
Definition: personalPlayback.py:523
RPCRoll.h
EmulateCPPF.h
CPPFCluster.h
l1t::CPPFDigiCollection
std::vector< CPPFDigi > CPPFDigiCollection
Definition: CPPFDigi.h:83
RecHitProcessor::CppfItem::lb
int lb
Definition: RecHitProcessor.h:38
EmulateCPPF::~EmulateCPPF
~EmulateCPPF()
Definition: EmulateCPPF.cc:53
EmulateCPPF::rpcDigiToken_
const edm::EDGetToken rpcDigiToken_
Definition: EmulateCPPF.h:28
RPCDeadStrips.h
RPCDigiCollection
EmulateCPPF::MaxClusterSize_
int MaxClusterSize_
Definition: EmulateCPPF.h:34
edm::FileInPath
Definition: FileInPath.h:64
RPCRecHitCollection
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EmulateCPPF::cppfSource_
enum EmulateCPPF::CppfSource cppfSource_
RecHitProcessor::CppfItem::int_phi
int int_phi
Definition: RecHitProcessor.h:43
edm::ParameterSet
Definition: ParameterSet.h:47
RecHitProcessor::CppfItem::rawId
int rawId
Definition: RecHitProcessor.h:39
recoMuon::in
Definition: RecoMuonEnumerators.h:6
EmulateCPPF::CppfSource::EventSetup
iEvent
int iEvent
Definition: GenABIO.cc:224
dtResolutionTest_cfi.inputFile
inputFile
Definition: dtResolutionTest_cfi.py:14
edm::EventSetup
Definition: EventSetup.h:58
RecHitProcessor::CppfItem
Definition: RecHitProcessor.h:37
DetSetVector.h
CPPFClusterContainer.h
EmulateCPPF::process
void process(const edm::Event &iEvent, const edm::EventSetup &iSetup, l1t::CPPFDigiCollection &cppf_recHit)
Definition: EmulateCPPF.cc:55
EmulateCPPF::recHitToken_
const edm::EDGetToken recHitToken_
Definition: EmulateCPPF.h:29
EmulateCPPF::rpcDigiSimLinkToken_
const edm::EDGetToken rpcDigiSimLinkToken_
Definition: EmulateCPPF.h:30
Exception
Definition: hltDiff.cc:245
RecHitProcessor::CppfItem::int_theta
int int_theta
Definition: RecHitProcessor.h:44
RecHitProcessor::CppfItem::halfchannel
int halfchannel
Definition: RecHitProcessor.h:42
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EventSetup
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
EmulateCPPF::CppfSource::File
emulatorCppfDigis_cfi.cppfSource
cppfSource
Definition: emulatorCppfDigis_cfi.py:10
edm::Event
Definition: Event.h:73
CPPFMaskReClusterizer.h
RPCMaskedStrips.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
CPPFClusterizer.h
EmulateCPPF::CppfVec_1
std::vector< RecHitProcessor::CppfItem > CppfVec_1
Definition: EmulateCPPF.h:33