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()
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetToken rpcDigiToken_
Definition: EmulateCPPF.h:28
std::array< RecHitProcessor, 1 > recHit_processors_
Definition: EmulateCPPF.h:26
EmulateCPPF(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iConsumes)
Definition: EmulateCPPF.cc:14
enum EmulateCPPF::CppfSource cppfSource_
int MaxClusterSize_
Definition: EmulateCPPF.h:34
int iEvent
Definition: GenABIO.cc:224
void process(const edm::Event &iEvent, const edm::EventSetup &iSetup, l1t::CPPFDigiCollection &cppf_recHit)
Definition: EmulateCPPF.cc:55
HLT enums.
std::vector< RecHitProcessor::CppfItem > CppfVec_1
Definition: EmulateCPPF.h:33
const edm::EDGetToken recHitToken_
Definition: EmulateCPPF.h:29
const edm::EDGetToken rpcDigiSimLinkToken_
Definition: EmulateCPPF.h:30
std::vector< CPPFDigi > CPPFDigiCollection
Definition: CPPFDigi.h:83
def exit(msg="")