50 GenParticlePtr p1 = std::make_shared<GenParticle>(
FourVector( 0.0, 0.0, 7000.0, 7000.0 ),2212, 3 );
51 GenParticlePtr p2 = std::make_shared<GenParticle>(
FourVector( 0.750, -1.569, 32.191, 32.238), 1, 3 );
52 GenParticlePtr p3 = std::make_shared<GenParticle>(
FourVector( 0.0, 0.0, -7000.0, 7000.0 ),2212, 3 );
53 GenParticlePtr p4 = std::make_shared<GenParticle>(
FourVector(-3.047,-19.0, -54.629, 57.920), -2, 3 );
55 GenVertexPtr v1 = std::make_shared<GenVertex>();
56 v1->add_particle_in (p1);
57 v1->add_particle_out(p2);
63 GenVertexPtr v2 = std::make_shared<GenVertex>();
64 v2->add_particle_in (p3);
65 v2->add_particle_out(p4);
68 GenVertexPtr v3 = std::make_shared<GenVertex>();
69 v3->add_particle_in(p2);
70 v3->add_particle_in(p4);
73 GenParticlePtr p5 = std::make_shared<GenParticle>(
FourVector(-3.813, 0.113, -1.833, 4.233), 22, 1 );
74 GenParticlePtr p6 = std::make_shared<GenParticle>(
FourVector( 1.517,-20.68, -20.605,85.925), -24, 3 );
76 v3->add_particle_out(p5);
77 v3->add_particle_out(p6);
79 GenVertexPtr v4 =std:: make_shared<GenVertex>();
80 v4->add_particle_in (p6);
83 GenParticlePtr p7 = std::make_shared<GenParticle>(
FourVector(-2.445, 28.816, 6.082,29.552), 1, 1 );
84 GenParticlePtr p8 = std::make_shared<GenParticle>(
FourVector( 3.962,-49.498,-26.687,56.373), -2, 1 );
86 v4->add_particle_out(p7);
87 v4->add_particle_out(p8);
130 std::shared_ptr<GenPdfInfo> pdf_info = std::make_shared<GenPdfInfo>();
131 evt.add_attribute(
"GenPdfInfo",pdf_info);
133 pdf_info->set(1,2,3.4,5.6,7.8,9.0,1.2,3,4);
135 std::shared_ptr<GenHeavyIon> heavy_ion = std::make_shared<GenHeavyIon>();
136 evt.add_attribute(
"GenHeavyIon",heavy_ion);
138 heavy_ion->set( 1,2,3,4,5,6,7,8,9,0.1,2.3,4.5,6.7);
140 std::shared_ptr<GenCrossSection> cross_section = std::make_shared<GenCrossSection>();
141 evt.add_attribute(
"GenCrossSection",cross_section);
143 cross_section->set_cross_section(1.2,3.4);
149 std::cout << std::endl <<
" Manipulating attributes:" << std::endl;
152 std::shared_ptr<GenCrossSection> cs = evt.attribute<
GenCrossSection>(
"GenCrossSection");
159 else std::cout <<
"Problem accessing attribute!" <<std::endl;
162 evt.remove_attribute(
"GenCrossSection");
163 evt.remove_attribute(
"GenCrossSection");
168 if(!cs)std::cout <<
"Successfully removed attribute" <<std::endl;
169 else std::cout <<
"Problem removing attribute!" <<std::endl;
175 std::shared_ptr<Attribute> tool1 = std::make_shared<IntAttribute>(1);
176 std::shared_ptr<Attribute> tool999 = std::make_shared<IntAttribute>(999);
177 std::shared_ptr<Attribute> test_attribute = std::make_shared<StringAttribute>(
"test attribute");
178 std::shared_ptr<Attribute> test_attribute2 = std::make_shared<StringAttribute>(
"test attribute2");
180 p2->add_attribute(
"tool" , tool1 );
181 p2->add_attribute(
"other" , test_attribute );
183 p4->add_attribute(
"tool" , tool1 );
185 p6->add_attribute(
"tool" , tool999 );
186 p6->add_attribute(
"other" , test_attribute2 );
188 v3->add_attribute(
"vtx_att" , test_attribute );
189 v4->add_attribute(
"vtx_att" , test_attribute2 );
199 for(ConstGenParticlePtr p: applyFilter(Selector::ATTRIBUTE("tool"), evt.particles())){
203 std::cout <<std::endl << "Find all particles with attribute 'tool' equal 1 "<< std::endl;
204 std::cout << "(should return particles 2,4):" <<std::endl;
206 for(ConstGenParticlePtr p: applyFilter(Selector::ATTRIBUTE("tool") && Selector::ATTRIBUTE("tool") == tool1, evt.particles())){
210 std::cout << std::endl << "Find all particles with a string attribute 'other' equal 'test attribute' "<< std::endl;
211 std::cout << "(should return particle 2):" << std::endl;
214 for(ConstGenParticlePtr p: applyFilter(Selector::ATTRIBUTE("other") && Selector::ATTRIBUTE("other") == "test_attribute", evt.particles())){
219 std::cout << std::endl <<
"Offsetting event position by 5,5,5,5" << std::endl;
225 std::cout << std::endl <<
"Printing full content of the GenEvent object " << std::endl
226 <<
"(including particles and vertices in one-line format):" << std::endl << std::endl;
230 std::cout <<std::endl <<
"Now: removing particle with id 6 and printing again:" <<std::endl <<std::endl;
231 evt.remove_particle(p6);
236 std::cout <<std::endl <<
"Now: removing beam particles, leaving an empty event" <<std::endl <<std::endl;
237 evt.remove_particles( evt.beams() );
Definition of class GenEvent.
Definition of class GenParticle.
Definition of class GenVertex.
Definition of static class Print.
Defines helper classes to extract relatives of an input GenParticle or GenVertex.
definition of /b Selector class
Stores additional information about cross-section.
void set_cross_section(const double &xs, const double &xs_err, const long &n_acc=-1, const long &n_att=-1)
Set all fields.
Stores event-related information.
int main(int argc, char **argv)