Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-15 04:15:22

0001 #include "Geometry/RPCGeometry/interface/RPCRoll.h"
0002 #include "Geometry/RPCGeometry/interface/RPCRollSpecs.h"
0003 
0004 #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h"
0005 #include "DataFormats/Common/interface/Handle.h"
0006 #include "FWCore/Framework/interface/Event.h"
0007 #include "FWCore/Framework/interface/EventSetup.h"
0008 
0009 #include "RPCFakeEvent.h"
0010 #include <iostream>
0011 
0012 RPCFakeEvent::RPCFakeEvent(const edm::ParameterSet& config)
0013     : filesed(config.getParameter<std::vector<std::string> >("FakeEvents")),
0014       rpcdigiprint(config.getParameter<bool>("printOut")),
0015       tokGeom_(esConsumes<RPCGeometry, MuonGeometryRecord>()) {
0016   std::cout << "Initialize the Event Dump" << std::endl;
0017   produces<RPCDigiCollection>();
0018 
0019   std::cout << "Number of Input files =" << filesed.size() << std::endl;
0020   if (rpcdigiprint) {
0021     std::cout << "Event Dump Digi Creation" << std::endl;
0022     std::cout << "Number of Input files =" << filesed.size() << std::endl;
0023     for (auto i = filesed.begin(); i < filesed.end(); i++) {
0024       std::cout << "input file " << *i << std::endl;
0025     }
0026   }
0027 }
0028 
0029 void RPCFakeEvent::produce(edm::Event& e, const edm::EventSetup& c) {
0030   std::cout << "Getting the rpc geometry" << std::endl;
0031   std::cout << "Getting the Muon geometry" << std::endl;
0032   auto rpcGeom = c.getHandle(tokGeom_);
0033 
0034   if (rpcdigiprint) {
0035     std::cout << " Evento Done : "
0036               << "run=" << e.id().run() << " event=" << e.id().event() << std::endl;
0037   }
0038   if (e.id().event() <= filesed.size()) {
0039     if (rpcdigiprint) {
0040       std::cout << "Opening file " << filesed[e.id().event() - 1] << std::endl;
0041     }
0042   }
0043   std::unique_ptr<RPCDigiCollection> pDigis(new RPCDigiCollection());
0044 
0045   {
0046     std::cout << "Station 1 RB1in" << std::endl;
0047     RPCDetId r(0, 1, 1, 10, 1, 1, 3);
0048     const RPCRoll* roll = rpcGeom->roll(r);
0049     std::cout << r << " Number of strip " << roll->nstrips() << std::endl;
0050     //    RPCDigi rpcDigi1(67,0);
0051     //    RPCDigi rpcDigi2(68,0);
0052     //    RPCDigi rpcDigi3(69,0);
0053     RPCDigi rpcDigi1(22, 0);
0054     RPCDigi rpcDigi2(23, 0);
0055     RPCDigi rpcDigi3(24, 0);
0056     pDigis->insertDigi(r, rpcDigi1);
0057     pDigis->insertDigi(r, rpcDigi2);
0058     pDigis->insertDigi(r, rpcDigi3);
0059   }
0060   {
0061     std::cout << "Station 1 RB1out" << std::endl;
0062     RPCDetId r(0, 1, 1, 10, 2, 1, 3);
0063     std::cout << " RB1 out " << r << std::endl;
0064     const RPCRoll* roll = rpcGeom->roll(r);
0065     std::cout << r << " Number of strip " << roll->nstrips() << std::endl;
0066     //    RPCDigi rpcDigi1(63,0);
0067     // RPCDigi rpcDigi2(64,0);
0068     //RPCDigi rpcDigi3(65,0);
0069 
0070     RPCDigi rpcDigi1(20, 0);
0071     RPCDigi rpcDigi2(21, 0);
0072     RPCDigi rpcDigi3(22, 0);
0073     pDigis->insertDigi(r, rpcDigi1);
0074     pDigis->insertDigi(r, rpcDigi2);
0075     pDigis->insertDigi(r, rpcDigi3);
0076   }
0077   {
0078     RPCDetId r(0, 1, 2, 10, 1, 1, 3);
0079     const RPCRoll* roll = rpcGeom->roll(r);
0080     std::cout << r << " Number of strip " << roll->nstrips() << std::endl;
0081     RPCDigi rpcDigi1(8, 0);
0082     RPCDigi rpcDigi2(9, 0);
0083     RPCDigi rpcDigi3(12, 0);
0084     pDigis->insertDigi(r, rpcDigi1);
0085     pDigis->insertDigi(r, rpcDigi2);
0086     pDigis->insertDigi(r, rpcDigi3);
0087   }
0088   {
0089     RPCDetId r(0, 1, 2, 10, 2, 1, 3);
0090     const RPCRoll* roll = rpcGeom->roll(r);
0091     std::cout << r << " Number of strip " << roll->nstrips() << std::endl;
0092     RPCDigi rpcDigi1(8, 0);
0093     RPCDigi rpcDigi2(9, 0);
0094     pDigis->insertDigi(r, rpcDigi1);
0095     pDigis->insertDigi(r, rpcDigi2);
0096   }
0097   {
0098     RPCDetId r(0, 1, 3, 10, 1, 2, 3);
0099     const RPCRoll* roll = rpcGeom->roll(r);
0100     std::cout << r << " Number of strip " << roll->nstrips() << std::endl;
0101     //    RPCDigi rpcDigi1(16,0);
0102     // RPCDigi rpcDigi2(17,0);
0103     RPCDigi rpcDigi1(23, 0);
0104     RPCDigi rpcDigi2(24, 0);
0105 
0106     pDigis->insertDigi(r, rpcDigi1);
0107     pDigis->insertDigi(r, rpcDigi2);
0108   }
0109   {
0110     RPCDetId r(0, 1, 4, 10, 1, 2, 3);
0111     const RPCRoll* roll = rpcGeom->roll(r);
0112     std::cout << r << " Number of strip " << roll->nstrips() << std::endl;
0113     RPCDigi rpcDigi1(46, 0);
0114     pDigis->insertDigi(r, rpcDigi1);
0115   }
0116   e.put(std::move(pDigis));
0117 }
0118 
0119 DEFINE_FWK_MODULE(RPCFakeEvent);