CMS 3D CMS Logo

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