simpleSpectrometer and some Geant4 insights :s

Slides:



Advertisements
Similar presentations
1 Inheritance Concepts n Derive a new class (subclass) from an existing class (base class or superclass). n Inheritance creates a hierarchy of related.
Advertisements

25/03/2003Simulation Application for the LHCb Experiment CHEP March 2003 Presented by: W. Pokorski / CERN Authors: I. Belyaev, Ph. Charpentier,
Makoto Asai (SLAC) Geant4 Users CERN Nov. 12 th, 2002 Detector Sensitivity.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Detector Sensitivity.
S. Guatelli, M.G Pia, INFN Genova S. Guatelli ( CERN, INFN Genova ) CERN, 13 November 2002 Users Workshop Where to put analysis in Geant4 Applications.
1 Data Structures - CSCI 102 CS102 C++ Polymorphism Prof Tejada.
Materials 1 Images: Isotopic composition Molecular composition Density Pressure State Temperature.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Collaboration.
Maria Grazia Pia Detector Response Acknowledgements: A. Lechner, J. Apostolakis, M. Asai, G. Cosmo, A. Howard.
LAV Software Status Emanuele Leonardi – Tommaso Spadaro Photon Veto WG meeting – 2015/03/24.
山下智弘 JST CREST/ 神戸大学 Borrowing especially from presentations of M. Asai(SLAC) Geant4 Japan Oct, RCNS, based on Geant4 9.0.p01.
DANA uses a factory model to deliver data “just in time”
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
1 Announcements Note from admins: Edit.cshrc.solaris instead of.tcshrc Note from admins: Do not use delta.ece.
Geant zemi 2007/1/11. Sensitive detector In a simulation, we want to know –Position and time of the particle at the detector –Momentum and energy of the.
Apr. 8, 2002Calibration Database Browser Workshop1 Database Access Using D0OM H. Greenlee Calibration Database Browser Workshop Apr. 8, 2002.
C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling.
Run and Event G4Run and G4RunManager In Geant4, the Run is the largest unit of simulation and it consist of a series of events Within a Run, the detector.
Geant4 Simulation of the Beam Line for the HARP Experiment M.Gostkin, A.Jemtchougov, E.Rogalev (JINR, Dubna)
SoLID simulation with GEMC Zhiwen Zhao 2015/03/26.
Bookkeeping Tutorial. 2 Bookkeeping content  Contains records of all “jobs” and all “files” that are produced by production jobs  Job:  In fact technically.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Object Oriented Programming in C++ Chapter 7 Dynamic Binding.
C++ Namespaces, Exceptions CSci 588: Data Structures, Algorithms and Software Design All material not from online sources copyright © Travis Desell, 2011.
Read-out and detector response
Detector Description - Materials
1 Exercises 0 Go inside the “hadrontherapy” directory: cd hadrontherapy Copy the Hadrontherapy example to your home folder: cp –r $G4INSTALL/examples/advanced/hadrontherapy.
Level 3 Tracking Tutorial R. Beuselinck 7 February 2001 Current status of level 3 tracking interface User access methods and parameter definitions Simple.
Defining Data Types in C++ Part 2: classes. Quick review of OOP Object: combination of: –data structures (describe object attributes) –functions (describe.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 4th Edition.
Abstract classes only used as base class from which other classes can be inherit cannot be used to instantiate any objects are incomplete Classes that.
1 MC Production and Reconstruction Summary and Plans Valeria Bartsch, Fabrizio Salvatore, A.-M. Magnan, and Nigel Watson.
Pointer to an Object Can define a pointer to an object:
Procedural and Object-Oriented Programming
Interaction with the Geant4 kernel
Creating Your Own Classes
J. Apostolakis, M. Asai, G. Cosmo, A. Howard
Persistency Author: Youhei Morita.
Interaction with the Geant4 kernel
Bonn Test Station data analysis with PandaRoot
Introduction to Classes
Introduction Goal: Can we reconstruct the energy depositions of the proton in the brain if we are able to reconstruct the photons produced during this.
Abstract Classes and Inheritence Operator over-loading
Templates.
Chapter 16-2 Linked Structures
C++ for Geant4 users A collection of most useful and/or common features used in and to use Geant4 Marc Verderi LLR – Ecole polytechnique 14/11/2018 Marc.
Field propagation in Geant4
Makoto Asai (SLAC) Geant4 Tutorial Course
Introduction to Classes
3.3 Abstract Classes, Assignment, and Casting in a Hierarchy
Geant4 introduction 2008/03/18 Nobu Katayama KEK
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11th, 2002
Read-out and detector response
Makoto Asai (SLAC) Geant4 Tutorial Course
Detector sensitivity Makoto Asai (SLAC Computing Services)
Inheritance: Polymorphism and Virtual Functions
Polymorphism CMSC 202, Version 4/02.
Read-out and detector response
Makoto Asai (SLAC) Geant4 Tutorial Course
Inheritance: Polymorphism and Virtual Functions
GAUSS - GEANT4 based simulation for LHCb
Makoto Asai (SLAC) Geant4 Tutorial Course
Geant4 in HARP V.Ivanchenko For the HARP Collaboration
Detector Description - Materials
User Application
The full set of lecture notes of this Geant4 Course is available at
Kernel Author: Makoto Asai.
Geant4: Detector description module
Static Binding Static binding chooses the function in the class of the base class pointer, ignoring any versions in the class of the object actually.
Presentation transcript:

simpleSpectrometer and some Geant4 insights :s Bino BPM spectrometer meeting 16 november 2006 UCL

spectrometerDipoleFieldMap Loads a fieldmap file, format : # Dubna Fieldmap - N. Morozon, S. Kostromin # Simulation of 10D37 magnet using TOSCA (N. Morozov) # All positions are in mm, (z,x) = (0,0) is center of magnet # Magnetic field values are in Gauss # z(mm) B(x=0mm) B(x=5mm) B(x=10 ) B(x=15 ) B(x=20 ) B(x=25 ) B(x=30 ) B(x=35m) B(x=40 ) * 0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 0.0 1125.36 1125.36 1125.39 1125.42 1125.47 1125.54 1125.61 1125.69 1125.78 10.0 1125.35 1125.36 1125.38 1125.42 1125.47 1125.53 1125.60 1125.69 1125.77 ... Dynamic ( using std::vector<double> ) so no need to specify size in the file, just need to know the x-positions for each z position... hence the “*”- line, characterizing the x positions.. Fieldmap specified only for a quadrant of the magnet... -z and -x are mirrored... Does this need to be more general ?? Interpolation Define closest 3x3 square, do first 3 parabolic interpolations ( 3 points = 1 parabola ) in z direction ( more points... ) and then 1 parabolic interpolation in x Implements the spectrometerDipoleFieldMap::GetFieldValue( ) as a concrete implementation of the pure virtual function in the abstract G4MagneticField class from which it is derived GetFieldValue( const G4double Point[4], G4double *Bfield ) Point[ x, y, z, time ] Returns Bfield[ x, y, z ]

SpectrometerMaterials Currently little hack to get to local coordinates in the dipole volume as the GetFieldValue() routine gets queried with the global coordinates Know how to do it properly ( see BDSIM ), just have to do it :) Sometimes the stepper queries the fieldmap with extreme positions, set field to 0 outside of the boundaries of the field ( no extrapolation...) SpectrometerMaterials Problem of defining vacuum : No real vacuum exists, vacuum is just low density air :) Get G4_AIR from NIST database ( implemented in Geant ) : G4NistManager Set temperature ( 300 K ) and pressure e.g. ( 1.e-9 mbar ) and calculate density using ideal gas law & molar mass of air ( ~29 g/mol ) construct vacuum : spec_Vacuum = new G4Material( "spec_Vacuum", dens, 1, kStateGas, temp, press ); spec_Vacuum->AddMaterial( spec_Air, 1. ); // ... a vacuum of air :) All materials will be in spectrometerMaterials Global extern spectrometerMaterials* gMat; object, instantiated at top of spectrometerMaterials.cc

SpectrometerOutput & the hits collection At end of event, a hits collection is available in Geant, so need to derive a concrete class , spectrometerUserEventAction, from G4UserEventAction that implements spectrometerUserEventAction::BeginOfEventAction( const G4Event * ); spectrometerUserEventAction::EndOfEventAction( const G4Event * ); Implement EndOfEventAction to do something with each hits collection, like e.g. Dump to output // get the hits collections of this event G4HCofThisEvent* hce = evt->GetHCofThisEvent(); // get the digit collections of this event //G4DCofThisEvent* dc = evt->GetDCofThisEvent(); if ( ! hce ) { G4cerr << "*** unable to retrieve hits collections in event " << evt->GetEventID() << std::endl; return; } // for each hit collection ( so each sensitive detector ), we dump the hits to the // output spectrometerBpmHitCollection *bpmHC; spectrometerBpmHit *bpmHit; for ( G4int i = 0; i < hce->GetNumberOfCollections(); i++ ) { bpmHC = ( spectrometerBpmHitCollection* ) hce->GetHC( i ); for ( G4int j = 0; j < bpmHC->entries(); j++ ) { G4cout << " - Hit collection " << i << " contains " << bpmHC->entries() << " entr" << (bpmHC->entries() > 1 ? "ies" : "y" ) << " : " << std::endl; bpmHit = (*bpmHC)[j]; } /* end of loop over the hits in one collection */ Each sensitive detector ( BPM in this case ) has a hits collection !! Can do something here with the hit So we can plug here also a routine that takes the events hce and spits to whatever

the EndOfEvent routine ( see spectrometerBpmSD::ProcessHits(...) The filling of the hits collections happens for each SD in the ProcessHits routine, and the EndOfEvent routine ( see spectrometerBpmSD::ProcessHits(...) /** Let's store the hit, so construct a spectrometerBpmHit... */ G4String BpmName = hitCollectionName + "Hit"; spectrometerBpmHit *bpmHit = new spectrometerBpmHit( BpmName, x, y, z, xPrime, yPrime, pdgType, id ); // insert the hit into the collection bpmCollection->insert( bpmHit ); and spectrometerBpmSD::EndOfEvent(...) : G4SDManager *SDman = G4SDManager::GetSDMpointer(); G4int HCID = SDman->GetCollectionID( hitCollectionName ); HCE->AddHitsCollection( HCID, bpmCollection ); So just would need then a global gOuput pointer which gets pointed to the current output object ( corresponding with a file ) for each run that gets created and destroyed at beginning and end of a run (spectrometerUserRunAction) and that has a routine gOuput->WriteHits( G4HCofThisEvent *hce ) that gets called at each spectrometerUserEventAction::EndOfEvent( ... )

SpectrometerConfiguration Based on tinyXML loader, example config file : proposal !!! : <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Energy spectrometer simulation configuration file --> <spectrometer> <simulation> <author>Bino</author> <comment>This is just an example...</comment> <runs>10</runs> <events>100000</events> </simulation> <beam> <energy>28.5</energy> <particle>e-</particle> </beam> <optics> ... </optics> <components> <bpm name="BPM1" xpos="0." ypos="0." zpos="10."> <adcbits>14</adcbits> </bpm> <dipole name="M1" xpos="0." ypos="0." zpos="10."> <length>3.</length> <sign>1</sign> <fieldmap>10D37.MAP</fieldmap> </dipole> <bpm name="BPM1" xpos="0." ypos="0." zpos="5."> <adcbits>12</adcbits> </components> </spectrometer> <!-- ....ooooOOOO0000 "This is the end" 0000OOOOoooo.... --> category variable Specify components with mandatory attributes --> can generate error upon missing attribute all other options can have default values...

Never store values in real member Example code : spectrometerConfig* cnf = new spectrometerConfig(); cnf->Load( "spectrometer.xml" ); double ebeam, betx; int runs; string particle; cnf->Get( "beam", "energy", &ebeam ); cnf->Get( "beam", "particle", &particle ); cnf->Get( "simulation", "runs", &runs ); cnf->Get( "optics", "betx", &(betx) ); cout << "energy = " << ebeam << endl; cout << "runs = " << runs << endl; cout << "particle = |" << particle << "|" << endl; Never store values in real member variables of the config object : most flexible. You define a new xml tag, and it is immediately available in program... Get( category, name, <type> *variable ) Overloading a “Get” function in the config class that each time queries the XML DOM which is read in from the xml file upon creation of the object : _dom = new TiXmlDocument( xmlfile ); _dom->LoadFile(); Private member of spectrometerConfiguration class Need to instantiate a global spectrometerConfiguration object upon starting the program...

Need to think about the components Need to think about the components... maybe store them in the configuration object as std::vector<spectrometerBpmConfig> std::vector<spectrometerDipoleConfig> where spectrometerBpmConfig and spectrometerDipoleConfig are then classes that represent the configuration of 1 BPM or 1 dipole magnet... What else... Implement somehow beampipe think of stuff tomorrow... brain doesn't cooperate anymore....

In summary... we can bend the beam using the fieldmap and obtain more or less the same deflection as Sergei's simulation...