C++ / G4MICE Course
description
Transcript of C++ / G4MICE Course
![Page 1: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/1.jpg)
C++ / G4MICE Course
Session 7
Models vs RepresentationsPersistency
Real Data FormatsReader
![Page 2: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/2.jpg)
Models vs Representations• So far we have been making models of various
experiments using the MiceModule class.• When we run the simulation, event display,
reconstruction, etc, some information from the model is required.
• This information needs to be supplied in a manner appropriate to the use of the model (e.g. GEANT4 vs RecPack)
• To solve the potential problem of having the modelling code depend on every potential use that it could be put to, we make the distinction between models and representations.
2
![Page 3: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/3.jpg)
If We Only had a Model
3
Model
GEANT4
RecPackHepRep
ROOT
Reconstruction
SimulationEvent Display
![Page 4: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/4.jpg)
With Representations
4
Model
GEANT4
Simulation
Simulation Representation
RecPack
Reconstruction
Reconstruction Representation
![Page 5: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/5.jpg)
G4MICE Representations
• Simulation:– DetModel and EngModel– Take the MiceModule model and create the
necessary G4 objects
• Reconstruction:– SetupKalman (Recon/SciFi)
• Event Display:– Visualization– Uses HepRep XML writer.
5
![Page 6: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/6.jpg)
“The Data”
• When using G4MICE or writing use applications, we don’t think about the data files or the data formats.
• The data exists in instances of various classes (e.g. SciFiHit, VlpcHit, etc...)
• So when you want to find “some data” what you really need to do is work out what class(es) represent that data and what method(s) can provide it.
6
![Page 7: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/7.jpg)
Persistency
• The classes that represent the data only exist in the computer’s memory while the program is running – they are transient.
• We want to store the classes in some format so that they can “live” beyond the execution of the program – make them persistent.
• This can involve writing them to disk, to a database, ...
7
![Page 8: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/8.jpg)
Gzipped Text File• The current persistency method that is
implemented is a gzipped text file.• The Zlib library is used to perform zipping and
unzipping as the files are written or read.• The format is plain text so can be read for
debugging purposes.• You should never write your own code to read
this (or any other format) file unless you are specifically involved in the development of the persistency code.
8
![Page 9: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/9.jpg)
Persistency Design
9
Transient Class(e.g. SciFiHit)
Gzipped Text File
SciFiHitTextFileIo
MySQL
SciFiHitMySQL
![Page 10: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/10.jpg)
Real Data Formats• We currently have code that reads a
number of other specific file formats associated with different DAQs that have been used in MICE to date:– KEK test beam (2 different formats)– Tracker test with Visual Basic (2 different
formats)
• Work is in progress to implement the code to read in the DATE format files and produce the relevant classes.
10
![Page 11: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/11.jpg)
Reader• All of the classes that read the various file formats
(whether persistent text file, or test beam or other DAQ formats) are derived from a purely virtual base class called Reader.
• It requires all the derived classes to implement a few methods:– readEvent()– isOK()– closeInputFile()– skipEvents()
11
![Page 12: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/12.jpg)
Code Inspection• Have a look at:
– Interface/include/Reader.hh– Persist/textFile/include/TextFileReader.hh– RealData/include/VlsbReadout2006.hh
• See how each of the classes implements a version of (a kind of!) the Reader class.
• See how this is used in:– Applications/common/GlobalReader.hh– Applications/KekOct2005/Kek2005.cc– Applications/KekOct2005/cards.in
12
![Page 13: C++ / G4MICE Course](https://reader036.fdocuments.in/reader036/viewer/2022081515/5681521a550346895dc05c02/html5/thumbnails/13.jpg)
Remaining Time this Session
• Continue work on the MuScat modelling and simulation assignment...
13