Pluto v6.3.0
Loading...
Searching...
No Matches
makeEmbeddedParticlesVertexHGeant.C
Go to the documentation of this file.
1//TITLE <UserClass> Embedded particles with vertex info and seq-nr for HADES
2
3//Author: J. Markert
4
6 TString vertex_ntuple = "be05278234631_dst_vertex_real.root",
7 TString outFile = "be05278234631_pluto_embedded_vertex",
8 TString outDir = "./"
9 )
10{ // This macro creates n pluto particle per sector (60 deg) with white disribution
11 // in theta , phi and momentum. The particles will be created
12 // at the vertex given my the input ntuple extracted from REAL data.
13
14
15 //---------------CONIGURATION----------------------
16 //
17 Int_t asciiOut = 0; // write pluto ascci output for HGeant (==0 if we use HGeantOutput)
18 Int_t rootOut = 0; // write pluto root file
19 Int_t calcVertex = 1; // write the vertex to the ascii output for HGeant
20 PChannel* channel = 0; // no channel needed here
21 Int_t nChannel = 0; // number of channels will be 0
22 TString myParticle = "e+"; // particle type used for embedding
23 Bool_t writeSeqNumber = kTRUE; // write eventSeqNumber in addition
24 Bool_t writeIndex = kTRUE; // write parentIndex in addition
25
26 Float_t pmin = 0.050; // minimum mom [GeV/c]
27 Float_t pmax = 1.000; // maximum mom [GeV/c]
28 Float_t thetamin = 10; // minimum theta angle [deg]
29 Float_t thetamax = 90; // maximum theta angle [deg]
30 Float_t phimin = 0; // minimum phi angle [deg]
31 Float_t phimax = 60; // maximum phi angle [deg]
32 Float_t phistart = 0; // start phi angle (+ sector * 60. deg will ber rotated later)
33 Int_t numParticlePerSector = 1; // number of Particles embedded per sector
34
35 //-------------------------------------------------
36
37
38 //-------------------------------------------------
39 // the output file name will be constructed
40 // outFile and OutDir (.hld or .root will be stripped)
41 TString filename = outFile;
42 filename.ReplaceAll(".root","");
43 filename.ReplaceAll(".hld" ,"");
44 filename = outDir + "/" + filename;
45
46 cout<<"Output file name : "<<filename.Data()<<endl;
47 //-------------------------------------------------
48
49
50
51 PReaction my_reaction(channel,filename.Data(),nChannel,rootOut,0,calcVertex,asciiOut);
52 my_reaction.SetWriteIndex(writeIndex);
53
54 //Construct the vertex container:
55 PVertexFile *vertex = new PVertexFile();
56 vertex->OpenFile(vertex_ntuple);
57 //add to prologue action
58 my_reaction.AddPrologueBulk(vertex);
59
60
61 PHGeantOutput* output = new PHGeantOutput();
62 output->SetWriteSeqNumber(writeSeqNumber);
63 output->OpenFile(Form("%s.evt",filename.Data()));
64 my_reaction.AddFileOutput(output);
65
66 //Construct the embedded container:
68
69 //Add an e+ which we emit at a single point:
70 PParticle* particle = new PParticle(myParticle.Data(),1.,2.,3.);
71 //Just add the particle to the container:
72 embedded->AddParticle(particle);
73
74 // added particle will be cloned with
75 // n times per sector
76 if (1) {
77 // nparticle / sector
78 embedded->SetSamplingSector(pmin , pmax, // pmin,pmax
79 thetamin, thetamax, // theta_min, theta_max
80 phimin , phimax, // phi_min,phi_max
81 phistart, numParticlePerSector ); // phiStart, numParticle/sector
82 } else {
83 // nparticle / full acceptance
84 embedded->SetSamplingSector(pmin , pmax, // pmin,pmax
85 thetamin, thetamax, // theta_min, theta_max
86 -180. , 180., // phi_min,phi_max
87 phistart, numParticlePerSector, // phiStart, numParticle/sector
88 360. , 1); // Delta-phi, nSec
89
90 }
91
92
93
94
95 //Add our container to the reaction:
96 my_reaction.AddBulk(embedded);
97
98 // number of events
99 my_reaction.Loop(10000);
100 output->CloseFile();
101
102}
void SetWriteSeqNumber(Bool_t write)
bool OpenFile(const char *_filename)
bool CloseFile(void)
Bool_t OpenFile(TString inputfile="")
PEmbeddedParticles * embedded
TString filename("eta_dalitz_a")
void makeEmbeddedParticlesVertexHGeant(TString vertex_ntuple="be05278234631_dst_vertex_real.root", TString outFile="be05278234631_pluto_embedded_vertex", TString outDir="./")
PReaction my_reaction("3.5","p","7Li","p (n) phi [K+ K-] (6Li)","delme")