Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:49

0001 #include "SimMuon/Neutron/interface/SubsystemNeutronReader.h"
0002 #include "CLHEP/Random/JamesRandom.h"
0003 
0004 
0005 class TestNeutronReader : public SubsystemNeutronReader
0006 {
0007 public:
0008   TestNeutronReader(const edm::ParameterSet & p) : SubsystemNeutronReader(p)
0009   {
0010   }
0011 
0012   virtual int detId(int chamberIndex, int localDetId ) {return 0;}
0013 };
0014 
0015 
0016 int main() {
0017 
0018   CLHEP::HepJamesRandom engine;
0019 
0020   edm::ParameterSet p;
0021   p.addParameter("luminosity", 1.);
0022   p.addParameter("startTime", -50.);
0023   p.addParameter("endTime", 150.);
0024   p.addParameter("eventOccupancy", std::vector<double>(11, 0.01));
0025   p.addParameter("reader", std::string("ROOT"));
0026   p.addParameter("output" , std::string("CSCNeutronHits.root"));
0027   p.addParameter("nChamberTypes", 10);
0028 std::cout << "BUILD " << std::endl;
0029 try {
0030   TestNeutronReader reader(p);
0031 std::cout << "BUILT " << std::endl;
0032   for(int ev = 0; ev < 10; ++ev) {
0033     std::cout << "NEW EVENT " << std::endl;
0034     reader.clear();
0035     for(int ch = 1; ch <= 10; ++ch) {
0036       edm::PSimHitContainer cont;
0037       reader.generateChamberNoise(ch, ch, cont, &engine);
0038       std::cout << "This event has " << cont.size() << " SimHits " << std::endl;
0039     }
0040   }
0041 }
0042 catch (cms::Exception& x)
0043 {
0044       std::cerr << "cms Exception caught, message follows\n"
0045                 << x.what();
0046 }
0047 
0048 }
0049