View
0
Download
0
Category
Preview:
Citation preview
MaterialandDetectorImplementationinFairSHIPAnnaritaBuonauraUniversità diNapoli&INFN
7thSHiPCollaborationMeeting,CERN,February10- 12,2016
OUTLINE
AnnaritaBu
onaura-FairS
hipTutoria
l
2
Ø IntroductionØ Creatinganewdetectorclass
Ø TheCMakeLists fileØ TheDetectorClass
Ø DescribingadetectorØ CreatingtheshapeØ CreatingthemediumØ Creatingandpositioning thevolumeØ ProcessHits() ,GetCollection()andAddHit() methods
Ø TheHitsclassØ Howtomakeeverythingwork
Ø TheLinkDef.h fileØ ParameterfileØ MakeFairShipknowaboutyourdetector
Ø Summary
Introduction• SHiP geometryenvironmentismainlybasedontheROOT/TGEOpackage.
• Itisatoolforbuilding,browsing,navigatingandvisualizingdetectorgeometries
• ParticletransportisobtainedbyworkingincorrelationwithsimulationpackagessuchasGEANT3,GEANT4andFLUKA
• Tocreateanewdetectoryouhavetoimplementsomeclasseswhichwilldescribeyourdetector.
• Todescribeadetector(possiblyinanewfolderofFairShip/)itisimportanttoimplement:• theCMakeFile• thedetectorclass• thedetectorMCPointclass
AnnaritaBu
onaura-FairS
hipTutoria
l
3
CREATINGANEWDETECTORCLASS
AnnaritaBu
onaura-FairS
hipTutoria
l
4
TheCMakeLists File
AnnaritaBu
onaura-FairS
hipTutoria
l
5
• Forastandalonedetectorcreateanewfolder.• Whencreatinganewfolder(e.g:FairShip/Box)itisnecessarytofirstdefinea
CMakeLists filecontainingthenamesofthe.cxxfileinthefolder.• Itwillcreatealibrarywhichincludes thesourcefileswritteninthefolder .
TheDetectorClass
AnnaritaBu
onaura-FairS
hipTutoria
l
6
• Twofilesmustbecreated:a.hfileanda.cxxusuallywiththesamename
• The.hfile(headerfile)containsdeclarationof:• private/protectedmemberoftheclass(NB:donotdefine
themhere)• functions(methods)
• The.cxxfilecontains:• implementationofthemethodsdeclaredinthe.hfile
AnnaritaBu
onaura-FairS
hipTutoria
l
7
Describingadetector
• Anewdetectorclasscaninheritfromtwodifferentabstractbaseclasses:• FairModule:
• DefinesageometryelementwhichdoesnotproduceMCpoints(passivedetectorssuchas/FairSHip/passive/ShipMuonShield.cxx)
• FairDetector:• Definesageometryelementwithactivevolumes(e.g.adetector)
• ItisasubclassoftheFairModule onewhichimplementsextrafunctionscalledfromtheeventloopoftheMCtomakesomeactionsduringsimulations
Createadetectorvolume
AnnaritaBu
onaura-FairS
hipTutoria
l
8
TGeoVolume *top=gGeoManager→GetTopVolume();
• Todefineavolumeitisnecessarytocreatemedia andshapes.• Bothcontainersandcontainedvolumesmustbecreatedbefore
linkingthemtogether:arelativetransformationmatrixmustalsobeprovided.
• Anyvolumehastobepositionedsomewhereotherwiseitwillnotbeconsideredaspartofthegeometry.
• Thebasicbricksforbuilding-upthemodelarecalledvolumes.• Volumesareputoneinsideanothermakinganin-depthhierarchy.The
onecontainingallothersdefinesthe “world” ofthemodel.• InFairShiptheworldhasalreadybeendefinedanditcanbecalled
using:
AnnaritaBu
onaura-FairS
hipTutoria
l
9
Createadetectorshape• Eachvolumehasashape.• Itprovidesthedefinitionofthelocalcoordinate
systemofthevolume.• Anyshapehastoderivefromthebase
TGeoShape class.• 20basic(primitive)shapesarealreadyprovided:
• Boxes:TGeoBBoxclass• Parallelepipid:TGeoParaclass• Trapezoids:TGeoTrd1class• Cones– TGeoConeClass• Arbitrary8verticesshapes- TGeoArb8class• Tubes– TGeoTubeClass…
• CompositeshapescanalsobecreatedasaresultofBooleanoperationsbetweenprimitives
AnnaritaBu
onaura-FairS
hipTutoria
l
10
Createadetectorshape(2)• Allprimitiveshaveconstructorslike:
TGeoXXX(const char*name,<type>param1,<type>param2,…);TGeoXXX(<type> param1,<type>param2,…);
• Example:
TGeoBBox(Double_t fX,Double_t fY,Double_t fZ,Double_t *origin=0);
HalflengthinXHalflengthinYHalflengthinZOriginofthebox:(0,0,0)bydefault
NB:Thedefaultlengthunitsarecentimetres
xz
ypbeam
AnnaritaBu
onaura-FairS
hipTutoria
l
11
Definingthemedia• Togetherwithshapes,volumesneedmediatobecreated,because
materialsrepresentthephysicalpropertiesofthesolid fromwhichavolume ismade.
• TheTGeoMedium class defines themedia,thatarematerialwithtrackingparametersneededforthetransport(sensitivity flag, fieldflag,maxfieldvalue....)
• Newmediacanbeaddedtothegeometry/media.geo.file• Therecanbemultiplekindofdefinitions accordingtotheknowledgeofthe
differentpropertiesof theconsideredmedium
AnnaritaBu
onaura-FairS
hipTutoria
l
12
Definingthemedia(2)
AnnaritaBu
onaura-FairS
hipTutoria
l
13
Createadetectorvolume(2)• Basicstrategy
Step1:Definethegeometry
Step2:Definethemedia
Step3:Definethevolume
TGeoBBox *fBox =newTGeoBBox(Double_t fX,Double_t fY,Double_t fZ);
InitMedium("iron");TGeoMedium *Fe=gGeoManager->GetMedium(“iron");
TGeoVolume *fBoxVol =newTGeoVolume("volBox",fBox,Fe);
Positioningthevolume
AnnaritaBu
onaura-FairS
hipTutoria
l
14
• Beforepositioningavolume,itsmothervolumemustbecreated
• Daughtervolumesmustnotextrudetheirmothershape.
• Positionsofdaughtervolumeswithrespecttothecenterofmothervolumemustbeknown:ageometricaltransformationwhenpositioningdaughtervolumesmustbeprovided.
• Volumesinthesamecontainermustnotoverlapwitheachother
• Ifthedetectorconsistsofarepetitionofunitarycells(e.g.10ironlayers):• Notcreateadifferentshapeandadifferentvolumeforeachcell• Itisenoughtoreplicatetheonesthathavebeenalreadycreated
Positioningthevolume(2)
AnnaritaBu
onaura-FairS
hipTutoria
l
15
Example:Boxpositionedintopvolume
TGeoVolume*top=gGeoManager→GetTopVolume();
TGeoBBox*fBox =newTGeoBBox(Double_t fX,Double_t fY,Double_t fZ);InitMedium("iron");TGeoMedium*Fe=gGeoManager->GetMedium(“iron");TGeoVolume*fBoxVol =newTGeoVolume("volBox",fBox,Fe);TGeoTranslation *fT =newTGeoTranslation(fTx,fTy, fTz);top ->AddNode(fBoxVol,1,fT);
TGeoBBox*fScint =newTGeoBBox (Double_t fX,Double_t fY,Double_t fScintZ);InitMedium(“scint”);TGeoMedium*Fe=gGeoManager->GetMedium(“Scintillator");TGeoVolume*fScintVol =newTGeoVolume("volScint",fScint,scint);for(Int_t n=0;n<nReplica;n++){
TGeoTranslation *t=new TGeoTranslation(0,0,-fZ+n*(fScintZ+0.1)]fScint/2);fBox ->AddNode(VBox,n,t);
}
Calltopvolume
DefineBox
DefineBoxmaterial
DefineBoxvolume
Position oftheboxw.r.t.topvolumePosition theboxintopvolume
Numberofreplica
TGeoTranslationNumberofreplica
Translationsalongx,y,z w.r.t.centerofmothervolume
Mothervolume
ProcessHits()
AnnaritaBu
onaura-FairS
hipTutoria
l
16
ProcessHits()
AnnaritaBu
onaura-FairS
hipTutoria
l
17
GetstheIDofthevolumewherethehitwasreleased
Checks ifthereareoverlappingvolumes
GetsthepdgCode associatedtotheTparticle object
Evaluatesmeanpositionofhitsinthesensitivevolume
Addinghitstosave
Savingthehits:GetCollection()&AddHit()
AnnaritaBu
onaura-FairS
hipTutoria
l
18
Thehitsclass
AnnaritaBu
onaura-FairS
hipTutoria
l
19
• Usuallycreatedwithaname***Point• ItinheritsfromtheFairMCPoint class
• Asforthedetectorclass:
• .hfile:• Pointconstructorwith/without arguments
• trackID =IndexofMCtrack• detID =DetectorID• pos =Coordinates atthecenteroftheactivevolume [cm]• mom =Momentumoftrackatentrance[GeV]• tof =Timesinceeventstart[ns]• length=Tracklengthsincecreation[cm]• eLoss =Energydeposit [GeV]• pdgcode=Pdg Codeofthetrack
• Definitionoffunctionsactingontheclass• Example:Int_t PdgCode()const {return fPdgCode;}
• .cxxfile:• …offuctionsdefined in.hfile
HOWTOMAKEEVERYTHINGWORK…
AnnaritaBu
onaura-FairS
hipTutoria
l
20
ParameterFile
AnnaritaBu
onaura-FairS
hipTutoria
l
21
• Inorder tostudydifferentdetectordesigns,basicgeometryparametersshouldbegivenbyinstantiationofthegeometryobjects,nothardcoded inC++class.
• Basicparametersareingeometry/geometry_config.py
Examplec.Box =AttrDict(z=0*u.cm)c.Box.BX =3*u.m;c.Box.BY =3*u.m;c.Box.BZ =3*u.m;
• Geometryobjectsarecreatedbypython/shipDet_conf.py anddeclaredtotherunmanagerFairRunSim()
ExampleBox=ROOT.Box("Box",ship_geo.Box.BX,ship_geo.Box.BY,ship_geo.Box.BZ,ROOT.kTRUE)run.AddModule(Box)
TheLinkDef.h file
AnnaritaBu
onaura-FairS
hipTutoria
l
22
• Inthefolderofyourdetector.• TheROOTCINTprogramgeneratestheStreamer(),TBuffer &operator>>() and
ShowMembers() methods forROOTclassesaswellastheCINTdictionariesneeded inorder togetaccesstoonesclassesviatheinterpreter
• TheLinkDef filetellsROOTCINTforwhichclassesthemethod interfacestubsshouldbegenerated.
MakeFairSHIPknowaboutyourdetector
AnnaritaBu
onaura-FairS
hipTutoria
l
23
• FairShip/CMakeLists.txt• TomaketheFairShipsoftwarereadthenewfolder, itisimportant toinsertthe
titleof thefolderamongthosecontainedinthegeneralCMakeLists.txt file
• shipdata/ShipDetectorList.h• IntheconstructoroftheBoxclassaunique identifier isgiventothedetector
thathastobeadded tothelistoftheotheridentifiers :
Summarizing
AnnaritaBu
onaura-FairS
hipTutoria
l
24
• Tocreateanewdetectorfolder:• Addyourfolder intheFairShipdirectory• Modify theFairShip/CMakeLists.txt adding thenameofyourfolderafterendif
(no fairrootfound) withcommandadd_subdirectory (foldername)• InShipdata/ShipDetectorList.h addtheunique identifieryougivetoyour
detector(thesameyouwillneedtouseinoneoftheconstructorofyourdetectorclass.
• Inthenewfolder:• CreateaCMakeLists.txt fileanda***LinkDef.h file• Ifdetectorisactivecreatethe***Point.h (.cxx) files(otherwiseskip)• Createthedetectorclass(YourDetector.h(.cxx))andifthedetectorispassivedo
notusefunctions readhits(seeforexampleFairShip/passive/ShipMagnet.h)• Checkifthemediaofwhichyourdetectorismadeisalreadybeencreatedin
geometry/media.geo (otherwisecreateusing infoon theslides)• Add theparametersofyourdetectorinthegeometry/geometry_config.py file• Createthegeometryobjectcorresponding toyourdetectorbydefining itin
python/shipDet_conf.py
Summarizing
AnnaritaBu
onaura-FairS
hipTutoria
l
25
• Thisisjustaveryshortintroduction onthepossibilitiesgivenbyFairROOT tocreatenewdetectorgeometries.
• Thebestwaytolearnistotry,tryandtry,alsobytakingalookatwhatotherpeoplehavedone.
• Forfurther information onthegeometrypackagepleaserefertotheFairROOTdocumentation
AnnaritaBu
onaura-FairS
hipTutoria
l
26
BACK– UPSLIDES
AnnaritaBu
onaura-FairS
hipTutoria
l
27
InitMediumFunction
AnnaritaBu
onaura-FairS
hipTutoria
l
28
InFairShip mediaareread bythegeometry/media.geo filethroughout theprivatefunction InitMedium:
Int_t XXX::InitMedium(const char*name){static FairGeoLoader *geoLoad=FairGeoLoader::Instance();static FairGeoInterface *geoFace=geoLoad->getGeoInterface();static FairGeoMedia *media=geoFace->getMedia();static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();FairGeoMedium *ShipMedium=media->getMedium(name);if (!ShipMedium){Fatal("InitMedium","Material %s not defined inmediafile.",name);return -1111;}
TGeoMedium*medium=gGeoManager->GetMedium(name);if (medium!=NULL)return ShipMedium->getMediumIndex();
return geoBuild->createMedium(ShipMedium);}
MagneticField
AnnaritaBu
onaura-FairS
hipTutoria
l
29
• Thevalueofthemagneticfieldcanbedefinedasaprivatememberofthedetectorclass.
Note:ThisisvalidonlyinFairShip.NecessarytomanipulateG4geometrytoenablemagneticfieldinactiveshielding.
Privatefixinrun_simScript.py tomakeitwork#manipulateG4geometrytoenablemagneticfieldinactiveshielding, VMCcan'tdoit.importgeomGeant4geomGeant4.setMagnetField()#('dump')forprintoutofmagfields
Example:
TGeoUniformMagField *magField =newTGeoUniformMagField(0.,-MagneticField,0.);fBoxVol->SetField(magField);
TheHitsclass(example)
AnnaritaBu
onaura-FairS
hipTutoria
l
30
TheDetectorClass(2)
AnnaritaBu
onaura-FairS
hipTutoria
l
31
Recommended