Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron gun: config files #6

Merged
merged 1 commit into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions evtgen/013-electrongun/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Electron gun:

- pT: uniform between 1-1500 GeV;
- theta: uniform between 10-170 deg;
- phi: uniform between 0-360 deg.
140 changes: 140 additions & 0 deletions evtgen/013-electrongun/gen_electron_gun.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#####################################
#
# simple script to create lcio files with single particle
# events - modify as needed
# @author F.Gaede, DESY
# @date 1/07/2014
#
# initialize environment:
# export PYTHONPATH=${LCIO}/src/python:${ROOTSYS}/lib
#
#####################################
import math
import random
from array import array

# --- LCIO dependencies ---
from pyLCIO import UTIL, EVENT, IMPL, IO, IOIMPL

#---- number of events ----------------------
nevt = 100000

outfile = "electronGun_gen.slcio"

#--------------------------------------------


wrt = IOIMPL.LCFactory.getInstance().createLCWriter( )

wrt.open( outfile , EVENT.LCIO.WRITE_NEW )

random.seed()


#========== particle properties ===================

# particles per event
npart = 1

pdg = 11

mass = 0.00051099895
charge = -1.

decayLen = 1.e32

genstat = 1

pt_min = 1.
pt_max = 1500.

theta_min = 10./180.*math.pi
theta_max = 170./180.*math.pi


#=================================================


for j in range( 0, nevt ):

col = IMPL.LCCollectionVec( EVENT.LCIO.MCPARTICLE )
evt = IMPL.LCEventImpl()

evt.setEventNumber( j )

evt.addCollection( col , "MCParticle" )

print (j, "-----------------------------")

for ipart in range( 0, npart ):

pt = random.uniform(pt_min, pt_max)
theta = random.uniform(theta_min, theta_max)
phi = random.random() * math.pi * 2.

p = pt/math.sin( theta )
energy = math.sqrt( mass*mass + p * p )

px = pt * math.cos( phi )
py = pt * math.sin( phi )
pz = p * math.cos( theta )

momentum = array('f',[ px, py, pz ] )


# --- endpoint

epx = decayLen * math.cos( phi ) * math.sin( theta )
epy = decayLen * math.sin( phi ) * math.sin( theta )
epz = decayLen * math.cos( theta )

endpoint = array('d',[ epx, epy, epz ] )


# --- production vertex

vpx = 0.
vpy = 0.
vpz = 0.

vertex = array('d',[ vpx, vpy, vpz ] )

time = 0.


# --- particle charge

if j % 2 == 1:
pdg = -pdg
charge = -charge



#--------------- create MCParticle -------------------

mcp = IMPL.MCParticleImpl()

mcp.setGeneratorStatus( genstat )
mcp.setMass( mass )
mcp.setPDG( pdg )
mcp.setMomentum( momentum )
mcp.setCharge( charge )
mcp.setVertex( vertex )
mcp.setTime( time )

if( decayLen < 1.e9 ) : # arbitrary ...
mcp.setEndpoint( endpoint )

print (" ", ipart, pdg, charge, pt, phi, theta)


#-------------------------------------------------------


col.addElement( mcp )


wrt.writeEvent( evt )


wrt.close()
1 change: 1 addition & 0 deletions reconstruction/013-electrongun/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Electro gun.
199 changes: 199 additions & 0 deletions reconstruction/013-electrongun/ntuplizer_all.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
<?xml version="1.0" encoding="us-ascii"?>
<!--
?xml-stylesheet type="text/xsl"
href="http://ilcsoft.desy.de/marlin/marlin.xsl"?
-->
<!-- ?xml-stylesheet type="text/xsl" href="marlin.xsl"? -->

<marlin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ilcsoft.desy.de/marlin/marlin.xsd">
<execute>

<!-- ========== setup ========== -->
<processor name="MyAIDAProcessor"/>

<processor name="MyFastJetProcessor" />

<!-- <processor name="MyFastJetMCProcessor" /> -->
<!-- <processor name="MyLCIOOutputProcessor" /> -->

<group name="MergeCollections" />

<processor name="MyLCTuple" />

</execute>


<global>
<parameter name="LCIOInputFiles">
input_file.slcio
</parameter>
<parameter name="MaxRecordNumber" value="-1" />
<parameter name="SkipNEvents" value="0" />
<parameter name="SupressCheck" value="false" />
<parameter name="Verbosity" options="DEBUG0-4,MESSAGE0-4,WARNING0-4,ERROR0-4,SILENT"> MESSAGE0 </parameter>
</global>


<processor name="MyAIDAProcessor" type="AIDAProcessor">
<!--Processor that handles AIDA files. Creates on directory per processor. Processors only need to create and fill the histograms, clouds and tuples. Needs to be the first ActiveProcessor-->
<!-- compression of output file 0: false >0: true (default) -->
<parameter name="Compress" type="int" value="1"/>
<!-- filename without extension-->
<parameter name="FileName" type="string" value="ntuple"/>
<!-- type of output file xml (default) or root ( only OpenScientist)-->
<parameter name="FileType" type="string" value="root "/>
</processor>

<processor name="MyLCTuple" type="LCTuple">
<!--LCTuple creates a ROOT TTRee with a column wise ntuple from LCIO collections ....-->
<!-- <parameter name="FullSubsetCollections" type="StringVec"> EfficientMCParticles InefficientMCParticles </parameter> -->
<!--Name of the CalorimeterHit collection-->
<!-- <parameter name="CalorimeterHitCollection" type="string" lcioInType="CalorimeterHit"> </parameter> -->
<!--Name of the Cluster collection-->
<!-- <parameter name="ClusterCollection" type="string" lcioInType="Cluster"> </parameter> -->
<!--Name of the IsoLep collection-->
<!-- <parameter name="IsoLepCollection" type="string" lcioInType="ReconstructedParticle"> </parameter> -->
<!--Name of the Jet collection-->
<parameter name="JetCollection" type="string" lcioInType="ReconstructedParticle"> JetOut </parameter>
<!--Switch to write out extra parameters calculated using information from Jet Finder-->
<!-- <parameter name="JetCollectionExtraParameters" type="bool">true </parameter> -->
<!--Switch to write out jet parameters coming from LCFIPlus tagging processor-->
<!-- <parameter name="JetCollectionTaggingParameters" type="bool">false </parameter> -->
<!--Names of LCRelation collections - need parallel prefix names in RelPrefixes-->

<!--Names of LCRelation collections - need parallel prefix names in RelPrefixes-->
<parameter name="LCRelationCollections" type="StringVec" lcioInType="LCRelation">
RecoMCTruthLink
</parameter>

<!-- Names of prefixes for variables from LCRelation collections - needs to be parallel to LCRelationCollections (one prefix per collection)-->
<parameter name="LCRelationPrefixes" type="StringVec">
r2
</parameter>


<!--Names of LCRelation collections of PFO-->
<!-- <parameter name="LCRelationwithPFOCollections" type="string" lcioInType="LCRelation"> </parameter> -->

<!--Name of the MCParticle collection-->
<parameter name="MCParticleCollection" type="string" lcioInType="MCParticle"> MCParticle </parameter>
<!-- <parameter name="MCParticleNotReco" type="string" lcioOutType="MCParticle"> </parameter> -->
<!--Name of the MCParticle collection where the overlay is removed-->
<!--parameter name="MCParticleRemoveOverlayCollection" type="string" lcioInType="MCParticle"> </parameter-->
<!--Name of the PFO collection with Relation-->
<!-- <parameter name="PFOwithRelationCollection" type="string" lcioInType="ReconstructedParticle"> </parameter> -->
<!--Name of the ReconstructedParticle collection-->
<parameter name="RecoParticleCollection" type="string" lcioInType="ReconstructedParticle"> MergedRecoParticles </parameter>
<!--Name of the SimCalorimeterHit collection-->
<!-- <parameter name="SimCalorimeterHitCollection" type="string" lcioInType="SimCalorimeterHit"> </parameter> -->
<!--Name of the SimTrackerHit collection-->
<!-- <parameter name="SimTrackerHitCollection" type="string" lcioInType="SimTrackerHit"> -->
<!-- MergedTrackerSimHits -->
<!-- </parameter> -->
<!--Name of the Track collection-->
<parameter name="TrackCollection" type="string" lcioInType="Track">SiTracks_Refitted </parameter>
<!--Name of the TrackerHit collection-->
<!-- <parameter name="TrackerHitCollection" type="string" lcioInType="TrackerHit"> -->
<!-- MergedTrackerHits -->
<!-- </parameter> -->

<!--verbosity level of this processor ("DEBUG0-4,MESSAGE0-4,WARNING0-4,ERROR0-4,SILENT")-->
<!--parameter name="Verbosity" type="string">DEBUG </parameter-->
<!--Name of the Vertex collection-->
<parameter name="VertexCollection" type="string" lcioInType="Vertex"> PrimaryVertices </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteCalorimeterHitCollectionParameters" type="bool">false </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteClusterCollectionParameters" type="bool">false </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteIsoLepCollectionParameters" type="bool">false </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteJetCollectionParameters" type="bool">false </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteMCParticleCollectionParameters" type="bool">false </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteRecoParticleCollectionParameters" type="bool">false </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteSimCalorimeterHitCollectionParameters" type="bool">false </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteSimTrackerHitCollectionParameters" type="bool">false </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteTrackCollectionParameters" type="bool">false </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteTrackerHitCollectionParameters" type="bool">false </parameter>
<!--Switch to write out collection parameters-->
<parameter name="WriteVertexCollectionParameters" type="bool">false </parameter>
</processor>


<processor name="MyFastJetProcessor" type="FastJetProcessor">
<parameter name="algorithm" type="StringVec">kt_algorithm 0.5</parameter>
<parameter name="clusteringMode" type="StringVec"> Inclusive 5</parameter>
<parameter name="jetOut" type="string" lcioOutType="ReconstructedParticle">JetOut </parameter>
<parameter name="recParticleIn" type="string" lcioInType="ReconstructedParticle"> PandoraPFOs </parameter>

<parameter name="recombinationScheme" type="string">E_scheme </parameter>
</processor>

<processor name="MyLCIOOutputProcessor" type="LCIOOutputProcessor">
<parameter name="LCIOOutputFile" type="string">outputfile.slcio </parameter>
<parameter name="LCIOWriteMode" type="string">WRITE_NEW</parameter>
<!--parameter name="SplitFileSizekB" type="int">1992294 </parameter-->
</processor>

<processor name="ProgressProcessor" type="ProgressProcessor">
</processor>


<group name="MergeCollections">


<processor name="MergeTrackerHits" type="MergeCollections">
<parameter name="CollectionParameterIndex" type="int">0 </parameter>
<!-- <parameter name="InputCollectionIDs" type="IntVec"> </parameter> -->
<parameter name="InputCollections" type="StringVec">
VBTrackerHits
VETrackerHits
IBTrackerHits
IETrackerHits
OBTrackerHits
OETrackerHits
</parameter>
<parameter name="OutputCollection" type="string"> MergedTrackerHits </parameter>
</processor>

<processor name="MergeTrackerSimHits" type="MergeCollections">
<parameter name="CollectionParameterIndex" type="int">0 </parameter>
<!-- <parameter name="InputCollectionIDs" type="IntVec"> </parameter> -->
<parameter name="InputCollections" type="StringVec">
VertexBarrelCollection
VertexEndcapCollection
InnerTrackerBarrelCollection
InnerTrackerEndcapCollection
OuterTrackerBarrelCollection
OuterTrackerEndcapCollection
</parameter>
<parameter name="OutputCollection" type="string"> MergedTrackerSimHits </parameter>
</processor>

<processor name="MergeTrackerHitsRelations" type="MergeCollections">
<parameter name="CollectionParameterIndex" type="int">0 </parameter>
<!-- <parameter name="InputCollectionIDs" type="IntVec"> </parameter> -->
<parameter name="InputCollections" type="StringVec">
VBTrackerHitRelations
VETrackerHitRelations
IBTrackerHitsRelations
IETrackerHitsRelations
OBTrackerHitsRelations
OETrackerHitsRelations
</parameter>
<parameter name="OutputCollection" type="string"> MergedTrackerHitsRelations </parameter>
</processor>

</group>





</marlin>
Loading