GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » Hades » Pluto » [SOLVED] PVertexFile
[SOLVED] PVertexFile [message #13599] Wed, 13 June 2012 23:01 Go to next message
Michael Kunkel is currently offline  Michael Kunkel
Messages: 53
Registered: June 2011
continuous participant
From: 129.57.114*
Greetings,

I had a question on the format of PVertexFile.
Is it one leaf of array vX:vY:vZ, or seperate leafs?

I ask because I am trying to smear vertices along a target that is 400mm in length and 20mm in radius.
I create a uniform distribution of 50M events of a cylinder equally the dimensions mentioned, called vertex.root with separate leaves vX, vY, vZ, tree name "vertex" as prescribed in
http://www-linux.gsi.de/~hadeshyp/pluto/v5.40/PVertexFile.html

When I attempt to use this

//#include "loadPluto.h";
//Program to generate multiple PLUTO root file
//Author Michael C. Kunkel
#include "TH1.h"
#include "TH2.h"
#include "TH3.h"
#include "TChain.h"
#include "TCanvas.h"
#include "TF1.h"
#include "/w/hallb/clasg12/mkunkel/PLUTO/pluto_v5.40/src/PParticle.h"
#include "/w/hallb/clasg12/mkunkel/PLUTO/pluto_v5.40/src/PReaction.h"
#include "/w/hallb/clasg12/mkunkel/PLUTO/pluto_v5.40/src/PBeamSmearing.h"
#include "/w/hallb/clasg12/mkunkel/PLUTO/pluto_v5.40/src/PVertexFile.h"


void Vertex_Simulation(){

    gROOT->Reset();

    char nam1[60] = "/volatile/clas/clasg12/mkunkel/GG_ETA_SIM/PLUTO_GEN/eta_";
    
    char nam2[25] = "_gammagamma_vertex";
   
    for(int ij = 1; ij<=1; ij++){
		char c[10];
		sprintf(c,"%d",ij);
		char creater[75];
		sprintf(creater,"%s%s%s",nam1,c,nam2);
		cout << creater<<endl;
	

    double ebeam_min = 1.1725;
    double ebeam_max = 5.44575;
    PBeamSmearing *beam_smear = new PBeamSmearing("beam_smear", "Beam smearing");
    
    TF1* beam_smear_fn = new TF1("beam_smear_fn", "1./x", ebeam_min, ebeam_max);    

    beam_smear->SetReaction("g + p");
    beam_smear->SetMomentumFunction(beam_smear_fn);
    makeDistributionManager()->Add(beam_smear);


    PReaction my_reaction("_P1 = 2.2","g","p","p eta [g g]",creater,1,0,1,0);
    
        //Construct the vertex container:
    PVertexFile *vertex = new PVertexFile();
    vertex->OpenFile("/w/hallb/clasg12/mkunkel/PLUTO/ETA_GAMMAGAMMA_SIM/VERTICES/vertex.root");
    //add to prologue action
    my_reaction.AddPrologueBulk(vertex);
    // my_reaction.Print();   //The "Print()" statement is optional
    my_reaction.Loop(50000);

    }
    
}


I receive a segmentation fault, if I remove the vertex the code runs correctly.

[Updated on: Wed, 22 May 2013 12:45] by Moderator

Report message to a moderator

Re: PVertexFile [message #13603 is a reply to message #13599] Thu, 14 June 2012 22:07 Go to previous messageGo to next message
Michael Kunkel is currently offline  Michael Kunkel
Messages: 53
Registered: June 2011
continuous participant
From: 129.57.112*
I have tried various ways to fill a ntuple with vertex information.
Named the leafs vX, vY, xZ as prescribed in the link previously given. I have made it into array of vertex[3], tried with and without seqNr and still when I run the PLUTO code previously given I see this error

Info in <PParticle::operator+>: (ALLOCATION) The composite g + p has been added
Info in <PStaticData::AddDecay>: (ALLOCATION) Decay index 14001: g + p --> p + eta
Info in <PStdModels::GetModels>: Read std models
Info in <PDistributionManager::Attach>: Re-iteration of std plugin done
OPENING VERTEX FILE <<DONE with a COUT statement from code>>
PReaction: calculating widths in PData...

 *** Break *** segmentation violation


Any help is appreciated.
Thanks
Michael C. Kunkel
Re: PVertexFile [message #13608 is a reply to message #13603] Fri, 15 June 2012 12:45 Go to previous messageGo to next message
Ingo Froehlich is currently offline  Ingo Froehlich
Messages: 167
Registered: March 2004
Location: IKF - Frankfurt
first-grade participant
From: *x-matter.uni-frankfurt.de
Dear Michael,

just for testing I have created a small script for generating the vertex events as follows:

TFile *f = new TFile("Vertex.root", "RECREATE");
TNtuple *ntuple = new TNtuple("vertex", "Vertex data", "vx:vy:vz");

PReaction my_reaction;
my_reaction.Do("vz = sampleFlat() * 400 - 200;");
my_reaction.Do("loop: vx = sampleFlat() * 20 - 10; vy = sampleFlat() * 20 - 10; ");
my_reaction.Do("if ((vx*vx + vy*vy) > 100); goto loop");
my_reaction.Output(ntuple);

cout << my_reaction.Loop(10000) << " vertex events created" << endl;

f->cd();
ntuple->Write();
f->Close();

At least running a part of your script:

PReaction my_reaction("_P1 = 2.2","g","p","p eta [g g]","delme",1,0,1,0);

//Construct the vertex container:
PVertexFile *vertex = new PVertexFile();
vertex->OpenFile("Vertex.root");
//add to prologue action
my_reaction.AddPrologueBulk(vertex);
// my_reaction.Print();   //The "Print()" statement is optional
my_reaction.Loop(10000);

seems to work for me...


--
Ingo Froehlich
IKF - University of Frankfurt
069-798-47027, FAX: -47024
Re: PVertexFile [message #13609 is a reply to message #13603] Fri, 15 June 2012 12:51 Go to previous messageGo to next message
Ingo Froehlich is currently offline  Ingo Froehlich
Messages: 167
Registered: March 2004
Location: IKF - Frankfurt
first-grade participant
From: *x-matter.uni-frankfurt.de
Just for additional info:

one can of course combine the scripts and access the vertex info directly via the variables _event_vertex_*:

PReaction my_reaction("_P1 = 2.2","g","p","p eta [g g]","delme",1,0,1,0);
my_reaction.Do("vz = sampleFlat() * 400 - 200;");
my_reaction.Do("loop: vx = sampleFlat() * 20 - 10; vy = sampleFlat() * 20 - 10; ");
my_reaction.Do("if ((vx*vx + vy*vy) > 100); goto loop");
my_reaction.Do("_event_vertex_x=vx; _event_vertex_y=vy; _event_vertex_z=vz; ");
my_reaction.Loop(10000);


--
Ingo Froehlich
IKF - University of Frankfurt
069-798-47027, FAX: -47024
Re: PVertexFile [message #13613 is a reply to message #13609] Fri, 15 June 2012 13:46 Go to previous messageGo to next message
Michael Kunkel is currently offline  Michael Kunkel
Messages: 53
Registered: June 2011
continuous participant
From: *hr.hr.cox.net
I will attempt this. One more question that might seem silly. What units are required and outputted for vertex information? I seem to not seem this in documentation.

Thanks Again
Re: PVertexFile [message #13614 is a reply to message #13613] Fri, 15 June 2012 13:50 Go to previous message
Ingo Froehlich is currently offline  Ingo Froehlich
Messages: 167
Registered: March 2004
Location: IKF - Frankfurt
first-grade participant
From: *x-matter.uni-frankfurt.de
I also had to search, and found in PParticle.h that it should be in mm

--
Ingo Froehlich
IKF - University of Frankfurt
069-798-47027, FAX: -47024
Previous Topic: [SOLVED] pp->K0s+X with V5.34
Next Topic: Multiple branches in the Pluto-file
Goto Forum:
  


Current Time: Fri Mar 29 08:43:07 CET 2024

Total time taken to generate the page: 0.00865 seconds