Presentation is loading. Please wait.

Presentation is loading. Please wait.

Monte carlo and analysis tool study Shi-hong yao.

Similar presentations


Presentation on theme: "Monte carlo and analysis tool study Shi-hong yao."— Presentation transcript:

1 Monte carlo and analysis tool study Shi-hong yao

2 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.

3 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.

4 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

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

6 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

7 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;

8 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

9 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

10 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

11 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

12 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.

13 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

14 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.

15 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-"); …

16 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 http://reat.space.qinetiq.com/gps/ Call from G4RunManager

17 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

18 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

19

20 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.

21 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 ???

22 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.

23 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.)

24 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.

25 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_

26 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.

27 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

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

29 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.

30 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


Download ppt "Monte carlo and analysis tool study Shi-hong yao."

Similar presentations


Ads by Google