************* * Homework * ************* Part I 1. Create empty Mokka driver using the indications given in the presentation .cc and .hh files 2. Fill the empty driver with some geometry (taken from the homework G4 for beginers given by XU Yin ) 3. Create new model for this subdetector 4. Run Mokka using the new model Part II 1. Add two parameters: dim_arms_z and drift_chamber_material Part I == Create local Mokka work in directory == > mkdir Mokka_g4example > cd Mokka_g4example > svn co http://llrforge.in2p3.fr/svn/Mokka/tags/mokka-08-03 or put a mokka-08-03 package you have into VM > mkdir Mokka_g4example > cd Mokka_g4example > cp -rf mokka-08-03 Mokka_g4example > cd mokka-08-03 > cp /home/ihep/ilcsoft/v01-17-05/init_ilcsoft.sh . #change Mokka path >export MOKKA="/home/ihep/Mokka_g4example/mokka-08-03" - Rename driver_empty.cc and driver_empty.hh to new_det.cc and new_det.hh. Change the name of the class accordinlgy >cp new_det.cc source/Geometry/LDC/src/ >cp new_det.hh source/Geometry/LDC/include >mkdir build >cmake -C /home/ihep/ilcsoft/v01-17-05/ILCSoft.cmake . >make >make install - Put the geometry from homework Examples geant4 for beginners (see homework from Xu Yin) == 1. In new_det.cc comment the world volume (solide, logical, physical) 2. The physical top volume of the ContextualConstruct method should be placed in the world logical volume which is argument of ContextualConstruct method In our case => replace worldLV (tube volume, first arm, second arm), with the name of logical volume of Mokka theWorld 3. Compile - In order to can run your driver you should create: 1. New Concept -> table "detector_concept" 2. New Model -> table "model" 3. New entry in Ingredients table (model,subdet, build_order) 4. New entry in Sub_detector table (name, db, driver) - Before start writing into a db make a dump. > mysqldump -uroot -p --all-databases > dump_allDatabases - Use sql quiries from dump_allDatabases in order to create a script for filling the informations above. The script file is the following: ==== script_db_newdet.sql =================== USE `models03`; LOCK TABLES `detector_concept` WRITE; INSERT INTO `detector_concept` VALUES ('New_geom','First tentative', 9000,9000,14000,1842,2500,3490,4044); UNLOCK TABLES; LOCK TABLES `model` WRITE; INSERT INTO `model` VALUES ('NewGeom_v00','Integrate geom from G4 examples','New_geom','unstable') ; UNLOCK TABLES; LOCK TABLES `ingredients` WRITE; INSERT INTO `ingredients` VALUES (1654,'NewGeom_v00','new_det',0); UNLOCK TABLES; LOCK TABLES `sub_detector` WRITE; INSERT INTO `sub_detector` VALUES (376,'new_det','VOID','new_det','New geometry from Xu Yin example','') ; UNLOCK TABLES; ============================================ Explanations == Create a detector concept == use models03; LOCK TABLES `detector_concept` WRITE; INSERT INTO `detector_concept` VALUES ('New_geom','First tentatives', 9000,9000,14000,1842,2500,3490,4044); UNLOCK TABLES; == Create a model == LOCK TABLES `model` WRITE; INSERT INTO `model` VALUES ('NewGeom_v00','Integrate geom from G4 examples','New_geom','unstable') ; UNLOCK TABLES; mysql> select id from ingredients order by id; The last id is 1653 == Fill table ingredients == LOCK TABLES `ingredients` WRITE; INSERT INTO `ingredients` VALUES (1654,'NewGeom_v00','new_det',0) UNLOCK TABLES; In order to see the last id number, please type: mysql> select id from sub_detector order by id; The last id is 375. == Create a new sub_detector == LOCK TABLES `sub_detector` WRITE; INSERT INTO `sub_detector` VALUES (376,'new_det','VOID','SEcal_cepc','New geometry from Xu Yin example','') ; UNLOCK TABLES; - take script_db_newdet.sql from mokka.in2p3.fr or copy the text above into a file. - Fill the db with the information about the new model mysql -uroot -p < script_db_newdet.sql - Dump again the db, please give a different name to your dump file mysqldump -uroot -p --all-databases > dump_allDatabases_new_det Now compare files dump_allDatabases and dump_allDatabases_new_det in order to see new entries. Or in mysql: mysql -uconsult -pconsult mysql> use models03; mysql> select * from detector_concept where name='New_geom'; +----------+------------------+--------------+--------------+--------------+---------------------+---------------------+-------------------------+-------------------------+ | name | description | world_box_hx | world_box_hy | world_box_hz | tracker_region_rmax | tracker_region_zmax | calorimeter_region_rmax | calorimeter_region_zmax | +----------+------------------+--------------+--------------+--------------+---------------------+---------------------+-------------------------+-------------------------+ | New_geom | First tentatives | 9000 | 9000 | 14000 | 1842 | 2500 | 3490 | 4044 | +----------+------------------+--------------+--------------+--------------+---------------------+---------------------+------- mysql> select * from model where name='NewGeom_v00'; +-------------+---------------------------------+------------------+--------------+ | name | description | detector_concept | model_status | +-------------+---------------------------------+------------------+--------------+ | NewGeom_v00 | Integrate geom from G4 examples | New_geom | unstable | +-------------+---------------------------------+------------------+--------------+ mysql> select * from sub_detector where name='new_det'; +-----+---------+------+---------+----------------------------------+-----------+ | id | name | db | driver | description | subdriver | +-----+---------+------+---------+----------------------------------+-----------+ | 375 | new_det | VOID | new_det | New geometry from Xu Yin example | | +-----+---------+------+---------+----------------------------------+-----------+ - Run the mokka_newDet.steer Mokka mokka_newDet.steer > out_newDet Part II - Create two parameters: dim_arms_z for firstArmS and secondArmS drift_chamber_material for the drift chamber, 2 possible materials Ar, N2 - dump the table materials02 - Define in new.hh G4double dim_arms_z; G4String drift_chamber_material; G4Material *DriftChamberMaterial; - in new_Det.cc get the parameters from the db dim_arms_z = aGeometryEnvironment.GetParameterAsDouble("dim_arms_z"); G4VSolid* firstArmS = new G4Box("FirstArmS", hx, hy, dim_arms_z); G4VSolid* secondArmS = new G4Box("SecondArmS", hx, hy, dim_arms_z); drift_chamber_material = aGeometryEnvironment.GetParameterAsString("drift_chamber_material"); if(drift_chamber_material == "argon") { DriftChamberMaterial = CGAGeometryManager::GetMaterial("G4_Ar"); } else{ if (drift_chamber_material="N2"){ DriftChamberMaterial = CGAGeometryManager::GetMaterial("G4_N"); } else { Control::Abort("new_det: invalid drift chamber material name. \nIt has to be either argon or N2", MOKKA_ERROR_BAD_GLOBAL_PARAMETERS); } } - Introduce into db materials02 into the table materials Ar (G4_Ar) and N2 (G4_N) mysqldump -uroot -p materials02 > dump_materials02 mysql -uroot -p < script_params_newdet.sql - Introduce dim_arms_z in db models03 and table "parameters" and "sharing". The value for the dim_arms_z are in mm !!!! In the XU Yin code the value is 3.0m so for Mokka we should put 3000 because all the parameters should be in mm. === script_params_newdet.sql =========== USE `models03`; LOCK TABLES `sharing` WRITE; INSERT INTO `sharing` VALUES ('new_det','dim_arms_z','3000.0'), ('new_det','drift_chamber_material','argon'); UNLOCK TABLES; LOCK TABLES `parameters` WRITE; INSERT INTO `parameters` VALUES ('dim_arms_z','dim z for first and second arms','3000.0'); UNLOCK TABLES; ======================================== - Test the parameters from the steering file /Mokka/init/globalModelParameter dim_arms_z 3500 /Mokka/init/globalModelParameter drift_chamber_material N2