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  rpcGeomToken_(iConsumes.esConsumes()),
21  cppfSource_(CppfSource::EventSetup),
22  MaxClusterSize_(0) {
23  MaxClusterSize_ = iConfig.getParameter<int>("MaxClusterSize");
24  const std::string cppfSource = iConfig.getParameter<std::string>("cppfSource");
25  // Look up table
26  if (cppfSource == "File") {
28  edm::FileInPath fp = iConfig.getParameter<edm::FileInPath>("cppfvecfile");
29  std::ifstream inputFile(fp.fullPath().c_str(), std::ios::in);
30  if (!inputFile) {
31  throw cms::Exception("No LUT") << "Error: CPPF look up table file cannot not be opened";
32  exit(1);
33  }
34  while (inputFile.good()) {
36  inputFile >> Item.rawId >> Item.strip >> Item.lb >> Item.halfchannel >> Item.int_phi >> Item.int_theta;
37  if (inputFile.good())
38  CppfVec_1.push_back(Item);
39  }
40  inputFile.close();
41  }
42  // RPC Geometry
43  else if (cppfSource == "Geo") {
45  }
46  // Error for wrong input
47  else {
48  throw cms::Exception("Invalid option")
49  << "Error: Specify in python/emulatorCppfDigis_cfi 'File' for look up table or 'Geo' for RPC Geometry";
50  exit(1);
51  }
52 }
53 
55 
57  const edm::EventSetup &iSetup,
58  l1t::CPPFDigiCollection &cppf_recHit) {
59  if (cppfSource_ == CppfSource::File) { // Using the look up table to fill the information
60  cppf_recHit.clear();
61  for (auto &recHit_processor : recHit_processors_) {
62  recHit_processor.processLook(iEvent,
63  iSetup,
68  CppfVec_1,
69  cppf_recHit,
71  }
72  } else if (cppfSource_ == CppfSource::EventSetup) {
73  // Clear output collections
74  // cppf_rpcDigi.clear();
75  cppf_recHit.clear();
76 
77  //Get the RPCDigis from the event
78  // Run the CPPF clusterization+coordinate conversion algo on RPCDigis and
79  // RecHits
80 
81  // For now, treat CPPF as single board
82  // In the future, may want to treat the 4 CPPF boards in each endcap as
83  // separate entities
84 
85  // for (unsigned int iBoard = 0; iBoard < rpcDigi_processors_.size();
86  // iBoard++) { rpcDigi_processors_.at(iBoard).process( iSetup, rpcDigis,
87  // cppf_rpcDigi );
88  // }
89  for (auto &recHit_processor : recHit_processors_) {
90  recHit_processor.process(
92  }
93  }
94 } // End void EmulateCPPF::process()
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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:35
int iEvent
Definition: GenABIO.cc:224
void process(const edm::Event &iEvent, const edm::EventSetup &iSetup, l1t::CPPFDigiCollection &cppf_recHit)
Definition: EmulateCPPF.cc:56
HLT enums.
std::vector< RecHitProcessor::CppfItem > CppfVec_1
Definition: EmulateCPPF.h:34
const edm::EDGetToken recHitToken_
Definition: EmulateCPPF.h:29
const edm::EDGetToken rpcDigiSimLinkToken_
Definition: EmulateCPPF.h:30
std::vector< CPPFDigi > CPPFDigiCollection
Definition: CPPFDigi.h:83
const edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeomToken_
Definition: EmulateCPPF.h:31
def exit(msg="")