Embedded particles with vertex info and seq-nr for HADES


//Author: J. Markert

void makeEmbeddedParticlesVertexHGeant(
                           TString vertex_ntuple = "be05278234631_dst_vertex_real.root",
                           TString outFile = "be05278234631_pluto_embedded_vertex",
			   TString outDir  = "./"
			  )
{   // This macro creates n pluto particle per sector (60 deg) with white disribution
    // in theta , phi and momentum. The particles will be created
    // at the vertex given my the input ntuple extracted from REAL data.


    //---------------CONIGURATION----------------------
    //
    Int_t asciiOut     = 0;    // write pluto ascci output for HGeant (==0 if we use HGeantOutput)
    Int_t rootOut      = 0;    // write pluto root file
    Int_t calcVertex   = 1;    // write the vertex to the ascii output for HGeant
    PChannel* channel  = 0;    // no channel needed here
    Int_t    nChannel  = 0;    // number of channels will be 0
    TString myParticle = "e+"; // particle type used for embedding
    Bool_t  writeSeqNumber = kTRUE;  // write eventSeqNumber in addition
    Bool_t  writeIndex     = kTRUE;  // write parentIndex in addition

    Float_t pmin               = 0.050;   // minimum mom  [GeV/c]
    Float_t pmax               = 1.000;   // maximum mom  [GeV/c]
    Float_t thetamin           =    10;   // minimum theta angle  [deg]
    Float_t thetamax           =    90;   // maximum theta angle  [deg]
    Float_t phimin             =     0;   // minimum phi angle    [deg]
    Float_t phimax             =    60;   // maximum phi angle    [deg]
    Float_t phistart           =     0;   // start phi angle (+ sector * 60. deg will ber rotated later)
    Int_t numParticlePerSector =     1;   // number of Particles embedded per sector

    //-------------------------------------------------


    //-------------------------------------------------
    // the output file name will be constructed
    // outFile and OutDir (.hld or .root will be stripped)
    TString filename = outFile;
    filename.ReplaceAll(".root","");
    filename.ReplaceAll(".hld" ,"");
    filename = outDir + "/" + filename;

    cout<<"Output file name : "<<filename.Data()<<endl;
    //-------------------------------------------------



    PReaction my_reaction(channel,filename.Data(),nChannel,rootOut,0,calcVertex,asciiOut);
    my_reaction.SetWriteIndex(writeIndex);

    //Construct the vertex container:
    PVertexFile *vertex = new PVertexFile();
    vertex->OpenFile(vertex_ntuple);
    //add to prologue action
    my_reaction.AddPrologueBulk(vertex);


    PHGeantOutput* output = new PHGeantOutput();
    output->SetWriteSeqNumber(writeSeqNumber);
    output->OpenFile(Form("%s.evt",filename.Data()));
    my_reaction.AddFileOutput(output);

    //Construct the embedded container:
    PEmbeddedParticles* embedded = new PEmbeddedParticles();

    //Add an e+ which we emit at a single point:
    PParticle* particle = new PParticle(myParticle.Data(),1.,2.,3.);
    //Just add the particle to the container:
    embedded->AddParticle(particle);

    // added particle will be cloned with
    // n times per sector
    if (1) {
        // nparticle / sector
	embedded->SetSamplingSector(pmin    , pmax,                   // pmin,pmax
				    thetamin, thetamax,               // theta_min, theta_max
				    phimin  , phimax,                 // phi_min,phi_max
				    phistart, numParticlePerSector ); // phiStart, numParticle/sector
    } else {
        // nparticle / full acceptance
	embedded->SetSamplingSector(pmin    , pmax,                 // pmin,pmax
				    thetamin, thetamax,             // theta_min, theta_max
				    -180.    , 180.,                // phi_min,phi_max
				    phistart, numParticlePerSector, // phiStart, numParticle/sector
				    360.    , 1);                   // Delta-phi, nSec
	
    }




    //Add our container to the reaction:
    my_reaction.AddBulk(embedded);

    // number of events
    my_reaction.Loop(10000);
    output->CloseFile();

}
 plugin_makeEmbeddedParticlesVertexHGeant.C:1
 plugin_makeEmbeddedParticlesVertexHGeant.C:2
 plugin_makeEmbeddedParticlesVertexHGeant.C:3
 plugin_makeEmbeddedParticlesVertexHGeant.C:4
 plugin_makeEmbeddedParticlesVertexHGeant.C:5
 plugin_makeEmbeddedParticlesVertexHGeant.C:6
 plugin_makeEmbeddedParticlesVertexHGeant.C:7
 plugin_makeEmbeddedParticlesVertexHGeant.C:8
 plugin_makeEmbeddedParticlesVertexHGeant.C:9
 plugin_makeEmbeddedParticlesVertexHGeant.C:10
 plugin_makeEmbeddedParticlesVertexHGeant.C:11
 plugin_makeEmbeddedParticlesVertexHGeant.C:12
 plugin_makeEmbeddedParticlesVertexHGeant.C:13
 plugin_makeEmbeddedParticlesVertexHGeant.C:14
 plugin_makeEmbeddedParticlesVertexHGeant.C:15
 plugin_makeEmbeddedParticlesVertexHGeant.C:16
 plugin_makeEmbeddedParticlesVertexHGeant.C:17
 plugin_makeEmbeddedParticlesVertexHGeant.C:18
 plugin_makeEmbeddedParticlesVertexHGeant.C:19
 plugin_makeEmbeddedParticlesVertexHGeant.C:20
 plugin_makeEmbeddedParticlesVertexHGeant.C:21
 plugin_makeEmbeddedParticlesVertexHGeant.C:22
 plugin_makeEmbeddedParticlesVertexHGeant.C:23
 plugin_makeEmbeddedParticlesVertexHGeant.C:24
 plugin_makeEmbeddedParticlesVertexHGeant.C:25
 plugin_makeEmbeddedParticlesVertexHGeant.C:26
 plugin_makeEmbeddedParticlesVertexHGeant.C:27
 plugin_makeEmbeddedParticlesVertexHGeant.C:28
 plugin_makeEmbeddedParticlesVertexHGeant.C:29
 plugin_makeEmbeddedParticlesVertexHGeant.C:30
 plugin_makeEmbeddedParticlesVertexHGeant.C:31
 plugin_makeEmbeddedParticlesVertexHGeant.C:32
 plugin_makeEmbeddedParticlesVertexHGeant.C:33
 plugin_makeEmbeddedParticlesVertexHGeant.C:34
 plugin_makeEmbeddedParticlesVertexHGeant.C:35
 plugin_makeEmbeddedParticlesVertexHGeant.C:36
 plugin_makeEmbeddedParticlesVertexHGeant.C:37
 plugin_makeEmbeddedParticlesVertexHGeant.C:38
 plugin_makeEmbeddedParticlesVertexHGeant.C:39
 plugin_makeEmbeddedParticlesVertexHGeant.C:40
 plugin_makeEmbeddedParticlesVertexHGeant.C:41
 plugin_makeEmbeddedParticlesVertexHGeant.C:42
 plugin_makeEmbeddedParticlesVertexHGeant.C:43
 plugin_makeEmbeddedParticlesVertexHGeant.C:44
 plugin_makeEmbeddedParticlesVertexHGeant.C:45
 plugin_makeEmbeddedParticlesVertexHGeant.C:46
 plugin_makeEmbeddedParticlesVertexHGeant.C:47
 plugin_makeEmbeddedParticlesVertexHGeant.C:48
 plugin_makeEmbeddedParticlesVertexHGeant.C:49
 plugin_makeEmbeddedParticlesVertexHGeant.C:50
 plugin_makeEmbeddedParticlesVertexHGeant.C:51
 plugin_makeEmbeddedParticlesVertexHGeant.C:52
 plugin_makeEmbeddedParticlesVertexHGeant.C:53
 plugin_makeEmbeddedParticlesVertexHGeant.C:54
 plugin_makeEmbeddedParticlesVertexHGeant.C:55
 plugin_makeEmbeddedParticlesVertexHGeant.C:56
 plugin_makeEmbeddedParticlesVertexHGeant.C:57
 plugin_makeEmbeddedParticlesVertexHGeant.C:58
 plugin_makeEmbeddedParticlesVertexHGeant.C:59
 plugin_makeEmbeddedParticlesVertexHGeant.C:60
 plugin_makeEmbeddedParticlesVertexHGeant.C:61
 plugin_makeEmbeddedParticlesVertexHGeant.C:62
 plugin_makeEmbeddedParticlesVertexHGeant.C:63
 plugin_makeEmbeddedParticlesVertexHGeant.C:64
 plugin_makeEmbeddedParticlesVertexHGeant.C:65
 plugin_makeEmbeddedParticlesVertexHGeant.C:66
 plugin_makeEmbeddedParticlesVertexHGeant.C:67
 plugin_makeEmbeddedParticlesVertexHGeant.C:68
 plugin_makeEmbeddedParticlesVertexHGeant.C:69
 plugin_makeEmbeddedParticlesVertexHGeant.C:70
 plugin_makeEmbeddedParticlesVertexHGeant.C:71
 plugin_makeEmbeddedParticlesVertexHGeant.C:72
 plugin_makeEmbeddedParticlesVertexHGeant.C:73
 plugin_makeEmbeddedParticlesVertexHGeant.C:74
 plugin_makeEmbeddedParticlesVertexHGeant.C:75
 plugin_makeEmbeddedParticlesVertexHGeant.C:76
 plugin_makeEmbeddedParticlesVertexHGeant.C:77
 plugin_makeEmbeddedParticlesVertexHGeant.C:78
 plugin_makeEmbeddedParticlesVertexHGeant.C:79
 plugin_makeEmbeddedParticlesVertexHGeant.C:80
 plugin_makeEmbeddedParticlesVertexHGeant.C:81
 plugin_makeEmbeddedParticlesVertexHGeant.C:82
 plugin_makeEmbeddedParticlesVertexHGeant.C:83
 plugin_makeEmbeddedParticlesVertexHGeant.C:84
 plugin_makeEmbeddedParticlesVertexHGeant.C:85
 plugin_makeEmbeddedParticlesVertexHGeant.C:86
 plugin_makeEmbeddedParticlesVertexHGeant.C:87
 plugin_makeEmbeddedParticlesVertexHGeant.C:88
 plugin_makeEmbeddedParticlesVertexHGeant.C:89
 plugin_makeEmbeddedParticlesVertexHGeant.C:90
 plugin_makeEmbeddedParticlesVertexHGeant.C:91
 plugin_makeEmbeddedParticlesVertexHGeant.C:92
 plugin_makeEmbeddedParticlesVertexHGeant.C:93
 plugin_makeEmbeddedParticlesVertexHGeant.C:94
 plugin_makeEmbeddedParticlesVertexHGeant.C:95
 plugin_makeEmbeddedParticlesVertexHGeant.C:96
 plugin_makeEmbeddedParticlesVertexHGeant.C:97
 plugin_makeEmbeddedParticlesVertexHGeant.C:98
 plugin_makeEmbeddedParticlesVertexHGeant.C:99
 plugin_makeEmbeddedParticlesVertexHGeant.C:100
 plugin_makeEmbeddedParticlesVertexHGeant.C:101
 plugin_makeEmbeddedParticlesVertexHGeant.C:102