Monte carlo and analysis tool study Shi-hong yao.

Slides:



Advertisements
Similar presentations
山下智弘 JST CREST/ 神戸大学 Borrowing especially from presentations of M. Asai(SLAC) Geant4 Japan Oct, RCNS, based on Geant4 9.0.p01.
Advertisements

山下智弘 JST CREST/ 神戸大学 Borrowing especially from presentations of M. Asai(SLAC) Geant4 Japan Oct, RCNS, based on Geant4 9.0.p01.
Geant4 v9.2p02 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Primary particle generation Makoto Asai (SLAC) Geant4 Users CERN Nov. 12 th, 2002.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Getting Started.
Primary particle generation Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 15 th, 2002 Customizing Run Management.
Geant4 v9.4 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11 th, 2002 Getting Started.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Getting Started.
Geant4 v9.3p01 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Primary particle generation Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002.
Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01.
Detector Description - Materials
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Japan.
IEEE Nuclear Science Symposium and Medical Imaging Conference Short Course The Geant4 Simulation Toolkit Sunanda Banerjee (Saha Inst. Nucl. Phys., Kolkata,
A introduction Luciano Pandola INFN-LNGS Partially based on a presentation by G.A.P. Cirrone (INFN-LNS) and M.G. Pia (INFN-Ge) Queen’s University, Belfast.
Tabular Editors for Geant4 Geant4 Geometry Editor and Geant4 Physics Editor CHEP 2000 at Padova Hajime Yoshida Naruto University of Education.
Introduction to Geant4 Makoto Asai (SLAC Computing Services) Geant4 Tutorial Course February 2004, Geant4 v6.0p01.
Materials 1 Images: Isotopic composition Molecular composition Density Pressure State Temperature.
Tuesday, Nov 9th 9:30-12:30 –Visualization attributes –Physics processes 14:00-17:00 –Kinematics and event generation (from yesterday) Particle gun –Boolean.
Geant4 Electromagnetic Physics Introduction V.Ivanchenko, M.Maire, M.Verderi  Process interface  Physics categories  Electromagnetic physics  PhysicsList.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Collaboration.
Physics I: Physics Lists Geant4 Tutorial at Jefferson Lab 10 July 2012 Dennis Wright (SLAC) Geant4 9.6 beta.
1 Primary particles Geant4 User's Tutorial CERN, February 2010 Talk from previous tutorial by Giovanni Santin Ecole Geant4, Annecy 2008.
Geant4 Training 2003 Basic structure of the Geant4 Simulation Toolkit The full set of lecture notes of this Geant4 Course is available.
Work_Geant4 Bo-Wen Shiou. #include "G4RunManager.hh“ #include "G4RunManager.hh“ #include "G4UImanager.hh" #include "G4UImanager.hh" #include "ExN01DetectorConstruction.hh“
Special Topics in Nuclear Physics, JU, Second Semester, (Saed Dababneh). 1 Course web or
Basic Structure of the Geant4 Simulation Toolkit
Primary particle Giovanni Santin ESA / ESTEC and RheaTech Ltd On behalf of the Geant4 collaboration Ecole Geant4 Annecy, and Nov 2008 With.
Geant4 Visualization 1 OpenGL DAWN VRML. Visualization Visualization Seeing what one does usually helps One can visualize geometry, hits, trajectories.
7th December 2007Geant4 Manchester Seminar1 Geant4 A simulation toolkit Geometry and tracking 4th incarnation.
W. Pokorski - CERN Simulation Project1 Python binding for Geant4 toolkit using Reflex/PyROOT tool Witek Pokorski EuroPython 2006, CERN, Geneva
Geant4 internal Classes and Objects Gunter Folger / CERN Geant4 course, Annecy 2008 User Action & Information Classes.
1 Physics I: Physics Lists Paris Geant4 Tutorial 4 June 2007 Marc Verderi Laboratoire Leprince-Ringuet (Heavily copied from D. Wright) Geant4 V8.3.
Monte Carlo /12/07. What is Geant ? Monte Carlo simulation tool for nuclear and particle physics Set up detectors –Sensitive detector which returns.
User Application Toolkit + User application toolkit Geant4 is a toolkit –i.e. you cannot “run” it out of the box –You must write.
User Application Luciano Pandola INFN-LNGS Partially based on a presentation by Maria Grazia Pia (INFN-Ge)
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Collaboration.
Geant4 internal Classes and Objects Geant4 Users’ Tutorial February 2010 Gunter Folger / CERN User Action & Information Classes.
Maria Grazia Pia INFN Genova Salamanca, July 2002
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.
WORK Bo-Wen Shiou. GNUmakefile GNUmakefile XXX.cc (ex:try03.cc) XXX.cc (ex:try03.cc) include folder (xxx.hh) include folder (xxx.hh) src folder (xxx.cc)
V.Ivanchenko Salamanca1 Geant4: Electromagnetic Processes 1  Introduction  Interfaces  PhysicsList  Optical process.
Makoto Asai (SLAC) Getting Started MGP: added class diagram of basic user application.
Physics I: Physics Lists Puebla Geant4 Tutorial 15 June 2010 Dennis Wright Geant4 V9.3.p01.
Geant4 Training 2003 Primary Particle Generation The full set of lecture notes of this Geant4 Course is available at
Geant4 internal Classes and Objects Gunter Folger / CERN MC-PAD, DESY/Hamburg January 2010 User Action & Information Classes.
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.
Maria Grazia Pia Retrieving information from kernel Acknowledgements: A. Lechner, J. Apostolakis, M. Asai, G. Cosmo, A. Howard.
Interaction with the Geant4 kernel
Interaction with the Geant4 kernel
Basics of a user application
Primary Particle Generation
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11th, 2002
G.A.P.Cirrone, S.E.Mazzaglia - INFN/LNS, Italy
Physics I: Physics Lists
Primary Particle Generation
User Application
Detector Description - Materials
User Application
User Application
The full set of lecture notes of this Geant4 Course is available at
Customizing Run Management
The full set of lecture notes of this Geant4 Course is available at
Kernel Author: Makoto Asai.
Primary particle Makoto Asai (SLAC Computing Services)
The full set of lecture notes of this Geant4 Course is available at
Monte Carlo /12/25.
Presentation transcript:

Monte carlo and analysis tool study Shi-hong yao

motivation Geant4 -- interest, because it’s seem to very useful for many science domain. -- to understand how to design a big program? -- work need…if I need to add/change something. ROOT, Mysql -- for analysis, histogram, data store.

G4RunManager In your Main G4VUserDetectorConstruction G4VUserPhysicsList G4VUserPrimaryGeneratorAction G4UserRunAction G4RunManager is the only manager class in Geant4 kernel. SetUserInitialization(…) SetUserAction(…) Initialize(); beamOn(numberOfEvent); Required Optional G4UserEventAction G4UserStackingAction G4UserTrackingAction G4UserSteppingAction User must be implement his own classes drivered from the three abstract classes respective and register them to the RunManager. You can collect data from these classes or even change/interfere the process in order to reach some purpose.

In your Main G4UIManagerG4UIterminal In interactive mode, G4UIsession* session = new G4UIterminal; session->SessionStart(); // Work… work… work…your work… delete session; It’s hard-coded batch mode, G4UImanager* UI =G4UImanager::GetUIpointer(); UI->ApplyCommand(“/run/verbose 1"); UI->ApplyCommand(“/control/execute macrofile"); Idle> your command #macro file #set verbose level /run/verbose 2 #start run /run/beamOn 100

Geant4 as a state machine PreInit Abort Quit Idle EventProc GeomClose Initialized beamOn exit

Basic - Units Length(meter) km, m, cm, mm, um, nm, fm … Surface(meter 2 ) km2, m2, cm2, mm2, barn, mbarn, … Angle(radian) rad, mrad, sr, deg … …and a lot of extend unit… Energy(electron volt) eV, keV, MeV, …, PeV J(joule) Mass(gram) mg, g, kg Time(second) s, ms, mus, ns, ps The units in blue are defined by one. global

When you read-in a value, it is recommend to set the units. If the units are not specified, it implicitly use the internal units. You can output your data with the units you wish. By divide the unit. You can get the list of units by static function G4UnitDefinition::PrintUnitsTable() or UI command /units/list. density = 12.0*g/cm3; length = 1*cm; G4cout << density/(g/cm3); G4cout << length/cm;

Construct Detector G4VUserDetectorConstruction myDetectorConstruction Public Construct(); //pure virtual method which is invoked by G4RunManager when it's Initialize() method is invoked. This method must return the G4VPhysicalVolume pointer which represents the world volume. Call from G4RunManager your own concrete class

Material – molecule or mixture G4Element H G4Material H 2 O It include: Name, atomic number Z, number of nucleons N, atomic mass A, Or, Isotopes. G4Element O … x2 x1 G4Material Other It include: Name, Density, State, Temperature, Pressure, Or Components G4Element* elH = new G4Element(name="Hydrogen", symbol="H", z= 1., a = 1.01*g/mole); G4Element* elO = new G4Element(name="Oxygen",symbol="O", z= 8., a 16.00*g/mole); G4Material* H2O = new G4Material(name="Water", density = 1.000*g/cm3, ncomponents=2); H2O->AddElement (elH, natoms=2); H2O->AddElement (elO, natoms=1); Or get material from Geant4 database G4NistManager* man = G4NistManager::Instance(); G4Material* H2O = man->FindOrBuildMaterial("G4_WATER"); See the list: Geant4 Material DatabaseGeant4 Material Database

Detector construct G4LogicalVolume LogiVolMother G4BOX G4Tube SD G4PVPlacement PhysicsWorld G4LogicalVolume LogiVolDaughter G4LogicalVolume LogiVolOther … Air World volume SolidBox = new G4Box(name, xLangth, yLangth, zLangth); LogiVolMother = new G4LogicalVolume( SolidBox, Air, name2); LogiVolDaughter = new G4LogicalVolume( SolidTube, H2O, name3); PhysicsVolume = new G4PVPlacement( Rot, trans, LogiVolDaughter, name?, LogiVolMother, 0, copyNo); PhysicsWorld = new G4PVPlacement(0, G4ThreeVector(), LogicalVolume, “WORLD”, 0, false, 0); Return to G4RunManager G4PVPlacement PhysicsVolume G4PVPlacement other

Physics list G4VUserPhysicsList Three pure virtual method must be implemented by the user. ConstructParticle(); // construction of particles ConstructProcess(); // construct processes and register them to particles SetCuts(); // setting a range cut value for all particles myPhysicsList Public Other method for using: AddTransportation(); //register the G4Transportation class which describes the particle motion in space and time with all particles. SetCutsWithDefault();// Call from G4RunManager your own concrete class

ConstructParticle() pure virtual method. User must define "All PARTICLE TYPES" include not only primary particles, but also all secondaries. In constructParticle(), explicitly invoke static methods of all particle classes G4Proton::ProtonDefinition(); G4Gamma::GammaDefinition(); G4MuonMinus::MuonMinusDefinition(); … #include “G4LeptonConstructor.hh” G4LeptonConstructor pConstructor; pConstructor.ConstructParticle(); G4Proton G4Gamma G4Electron G4MuonPlus More than 100 types of particles are provided by default. … G4BosonConstructor G4LeptonConstructor G4MesonConstructor G4BarionConstructor G4IonConstructor G4ShortlivedConstructor. Define particles one by one or use this six utility classes, corresponding to each of the particle categories.

What is process seven major categories of processes, electromagnetic, hadronic, transportation, decay, optical, photolepton_hadron, and parameterisation. G4VProcess Abstract base class for all physics processes. GPIL method: PostStepGetPhysicalInteractionLength(…); AlongStepGetPhysicalInteractionLength(…); AtRestGetPhysicalInteractionLength(…); DoIt method: AlongStepDoIt(..); PostStepDoIt(…); AtRestDoIt(…); Physics processes describe how particles interact with materials. The GPIL method gives the step length from the current space-time point to the next space-time point. It does this by calculating the probability of interaction based on the process's cross section information. The DoIt method implements the details of the interaction, changing the particle's energy, momentum, direction and position, and producing secondary tracks if required. G4Transportation G4Cerenkov G4ComptonScattering … G4eplusAnnihilation

G4PhotoElectricEffect ConstructProcess AddTransportation(); particle = G4Gamma::GammaDefinition(); G4ProcessManager* pmanager = particle->GetProcessManager(); G4PhotoElectricEffect * thePhotoElectricEffect = new G4PhotoElectricEffect(); pmanager->AddDiscreteProcess(thePhotoElectricEffect); pmanager->AddDiscreteProcess(theComptonEffect); pmanager->AddDiscreteProcess(thePairProduction); … a lot... G4ComptonScattering … G4Gamma G4ProcessManager Register related physics process to each particle type. This maybe a big project.

Range Cut SetCuts pure virtual method. A "unique cut value in range“ should be defined as a distance which is internally converted to an energy for individual materials. Geant4 recommend cut value is 1.0 mm. SetCutsWithDefault(); or defaultCutValue = 1.0*mm; //set cut value for different particle types. SetCutValue(cutForGamma, "gamma"); SetCutValue(cutForElectron, "e-"); …

Primary Generation G4VUserPrimaryGeneratorActionmyPrimaryGeneratorAction Public your own concrete class GeneratePrimaries(G4Event* anEvent ); Pure virtual method which is invoked at the beginning of each event. G4int n_particle = 1; particleGun = new G4ParticleGun(n_particle); particleGun->SetParticleDefinition(G4Proton::ProtonDefinition()); particleGun->SetParticleEnergy(120.0*GeV); particleGun->SetParticlePosition(G4ThreeVector(0.0*m, 0.0*m, -5.0*m)); particleGun->GeneratePrimaryVertex(anEvent); G4ParticleGun G4VPrimaryGenerator Public This class generates primary particle(s) with a given momentum and position. This is an abstract base class of all of primary generators. GeneratePrimaryVertex() = 0; G4GeneralParticleSource G4HEPEvtInterface For spatial distributions Call from G4RunManager

PYTHIA8 PYTHIA is a program for the generation of high-energy physics events, i.e. for the description of collisions at high energies between elementary particles such as e+, e-, p and pbar in various combinations. ……Excerpt from PYTHIA’s site

Three step of PYTHIA Pythia pythia; pythia.readString(“ProcessGroup:ProcessName = ON|OFF”); //List see appendix 1 pythia.readFile(FileName); … pythia.init(idA, idB, eA, eB); //pythia.init(idA, idB, eCM); //Currently the program only works with pp, pbar p, e + e - and μ + μ - incoming beams. while(!pythia.next()); //event record found in pythia.event pythia.event.list(); //do something…. pythia.statistics(); Only PYTHIA itself: 1.Initialization 2.Event loop 3.Finish, statistics

PYTHIA play a generator role myPrimaryGeneratorAction G4ParticleGunPYTHIA while(!pythia.next()); for (int i = 1; i < pythia.event.size(); i++) { Pythia8::Particle par = pythia.event[i]; if (par.status() > 0) { ParticleGun -> SetParticlePosition(G4ThreeVector(par.xProd()*mm,par.yProd()*mm,par.zProd()*mm)); ParticleGun -> SetParticleDefinition(ParticleTable->FindParticle(par.id())); ParticleGun -> SetParticleMomentumDirection(G4ThreeVector(par.px(),par.py(),par.pz())*GeV); ParticleGun -> SetParticleEnergy(par.pAbs()*GeV); ParticleGun -> GeneratePrimaryVertex(anEvent); } Particle remnants sent to the particle gun.

visualization OpenGL What you can visualize -Detector components -A hierarchical structure of physical volumes -Particle trajectories and tracking steps -Hits of particles in detector components. HepRep/WIRED DAWN ???

OpenGL #Create an empty scene ("world" is default): /vis/scene/create #Create a scene handler for a specific graphics system /vis/open OGLIX #/vis/open DAWNFILE #/vis/open HepRepFile # for drawing the tracks,hits /vis/scene/add/trajectories /vis/scene/add/hits /tracking/storeTrajectory 1 #too many tracks may cause core dump /vis/scene/endOfEventAction accumulate | refresh /run/beamOn number View directly from Geant4 when you are running, it can zoom, rotate, translate, but poor for graphics. Addition on follow two line before session start. G4VisManager* visManager = new G4VisExecutive; visManager->Initialize(); Then execute your program and stop at idle state.

WIRED Replace OGLIX by HepRepFile beamOn and produce G4DataX.heprep by Geant4, X is the event number. View in the WIRED Event Display, you need to install java runtime environment. And download WIRED from here.here >java -jar HepRApp.jar -file G4DataX.heprep It can zoom, rotate, translate,… click to show attributes, control visibility from hierarchical (tree) view of data Export to many vector graphic formats (PostScript, PDF, etc.)

Data store -- Mysql Benefits It is a well-designed database manager system. It is convenient for query specify data with some condition. Some calculate capability, average, maximum, minimum, and so on. Run two or more program parallelize without worry about the file conflict. Short You need one computer to do the server. You can’t run simulation without the server. Efficiency depend on the network. You still need other analysis tool for complex calculate.

Using Mysql API #include “mysql.hh”  if you can’t find this file, please contact your system manager…. MYSQL *conn = mysql_init(NULL); mysql_real_connect(conn, host,user,pass,database, 0, NULL, 0) mysql_query(conn, querystring); //receive returned data… result = mysql_store_result(conn); for(num_rows=0;row = mysql_fetch_row(result);num_rows++){ eventlist[num_rows]=atoi(row[0]); } mysql_free_result(result); mysql_close(conn); Get the data you want to store from Geant4 or PYTHIA. According to the Mysql syntax, combine the data into string. Through function mysql_query() or mysql_

Data store – ROOT Benefits ROOT is a very efficient and complete frameworks for analysing large amounts of data. Root file can store many type of object include TTree. Structure of TTree is similar to mysql but root provide many fancy function for drawing histogram. The data directly store at local disk – fast. Short If data has some problem or error, it’s inconvenient to find out and correct.

User Action G4UserRunAction G4UserEventAction G4UserStackingAction G4UserTrackingAction G4UserSteppingAction //at the beginning of the BeamOn() method virtual void BeginOfRunAction(const G4Run* aRun); // at the end of the BeamOn() method virtual void EndOfRunAction(const G4Run* aRun) ; virtual void BeginOfEventAction(const G4Event* anEvent); virtual void EndOfEventAction(const G4Event* anEvent); void PreUserTrackingAction(const G4Track*); void PostUserTrackingAction(const G4Track*) void UserSteppingAction(const G4Step*) void PrepareNewEvent (); G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*) void NewStage () NewStage

Feature work I have not yet understand all the detail/concept of Geant4. Try to understand the physics process. Thanks for Listening.

Appendix 1 ProcessGroupProcessName SoftQCDminBias,elastic, singleDiffractive, doubleDiffractive HardQCDgg2gg, gg2qqbar, qg2qg, qq2qq, qqbar2gg, qqbar2qqbarNew, gg2ccbar, qqbar2ccbar, gg2bbbar, qqbar2bbbar PromptPhotonqg2qgamma, qqbar2ggamma, gg2ggamma, ffbar2gammagamma, gg2gammagamma WeakBosonExchangeff2ff(t:gmZ), ff2ff(t:W) WeakSingleBosonffbar2gmZ, ffbar2W, ffbar2ffbar(s:gm) WeakDoubleBosonffbar2gmZgmZ, ffbar2ZW, ffbar2WW WeakBosonAndPartonWeakBosonAndParton qqbar2gmZg, qg2gmZq, ffbar2gmZgm, fgm2gmZf qqbar2Wg, qg2Wq, ffbar2Wgm, fgm2Wf Currently implemented processes, complete with respect to groups, but with some individual processes missing for lack of space (represented by “...”). In the names, a “2” separates initial and final state, an “(s:X)”, “(t:X)” or “(l:X)” occasionally appends info on an s- or t- channel- or loop-exchanged particle X.

ProcessGroupProcessName Charmoniumgg2QQbar[3S1(1)]g, qg2QQbar[3PJ(8)]q,... Bottomoniumgg2QQbar[3S1(1)]g, gg2QQbar[3P2(1)]g,... Topgg2ttbar, qqbar2ttbar, qq2tq(t:W), ffbar2ttbar(s:gmZ), ffbar2tqbar(s:W) FourthBottom, FourthTop, FourthPair (fourth generation) HiggsSMffbar2H, gg2H, ffbar2HZ, ff2Hff(t:WW),... HiggsBSMh, H and A as above, charged Higgs, pairs SUSYqqbar2chi0chi0 (not yet completed) NewGaugeBosonffbar2gmZZprime, ffbar2Wprime, ffbar2R0 LeftRightSymmmetryffbar2ZR, ffbar2WR, ffbar2HLHL,... LeptoQuarkql2LQ, qg2LQl, gg2LQLQbar, qqbar2LQLQbar ExcitedFermiondg2dStar, qq2uStarq, qqbar2muStarmu,... ExtraDimensionsG*gg2G*, qqbar2G*,... back