Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "Utilities/Configuration/interface/Architecture.h"
0002 #include "Muon/MuonNeutrons/interface/AsciiNeutronHitWriter.h"
0003 #include "Muon/MuonNeutrons/interface/AsciiNeutronHitReader.h"
0004 #include "Profound/PersistentTrackingHits/interface/PSimHit.h"
0005 #include "Muon/MuonNeutrons/test/DummySimHit.h"
0006 
0007 
0008 /*
0009  *  should write:
0010  * one event of one hit
0011  * one event of two hits
0012  *  Then read out three events, so it loops back.
0013  */
0014 
0015 int main() {
0016   AsciiNeutronHitWriter writer("NeutronsME");
0017   int detType = 10;
0018   int nevent = 2;
0019   int hitCount = 0;
0020   for(int event = 1; event <= nevent; ++event) {
0021     vector<PSimHit> hits;
0022     int nhits = event;
0023     for(int i = 0; i < nhits; ++i) {
0024       int layer   = i%6 + 1;
0025       ++hitCount;
0026       // leaks like crazy, but it's just a test
0027       PSimHit * pSimHit = new PSimHit(LocalPoint(i, hitCount,-0.25), LocalPoint(i, hitCount,0.25),
0028               100., 300., 0.0001, 11, layer, 1, 0., 0.);
0029       DummySimHit * simHit = new DummySimHit(pSimHit, 0., 1);
0030       hits.push_back(writer.makePSimHit(simHit, layer));
0031     }
0032     writer.writeCluster(detType, hits);
0033   }
0034 
0035   AsciiNeutronHitReader reader("NeutronsME", 11);
0036   for(int i = 0; i < 3; ++i) {
0037     vector<PSimHit> hits = reader.readNextEvent(detType);
0038     for(int i = 0; i != hits.size(); ++i) {
0039       cout <<  "OVAL " << hits[i] << endl;
0040     }
0041   }
0042 }
0043 
0044   
0045