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

MDIReader: Added "photons" and "general" input flags #20

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
630a642
added old version of MDIReader
aciarma Apr 13, 2022
c90cc08
MDIReader - using MutableMCParticle
aciarma Apr 13, 2022
8824975
MDIReader - minor changes
aciarma Apr 13, 2022
b240a7d
MDIReader - added 'InputType' property
aciarma Apr 13, 2022
1a6b1b2
MDIReader - added 'xtrack' rotation
aciarma Apr 13, 2022
9dccdfe
MDIReader - 'xtrack' minor upd
aciarma Apr 13, 2022
f62341b
MDIReader - 'xtrack' minor upd
aciarma Apr 13, 2022
1ecf138
typo HEPPDT_INCLUDE_DIR, added package HEPMC
aciarma May 5, 2022
d321837
typo
aciarma May 5, 2022
716b773
set RPATH
aciarma May 6, 2022
b329de8
changed std::cout to debug()
aciarma May 6, 2022
4bec2dd
MDIReader: removed HepMC dependancy
aciarma May 6, 2022
9c14623
MDIReader: removed HepMC dependancy - fix
aciarma May 6, 2022
200df77
MDIReader: added test
aciarma May 6, 2022
10158eb
MDIReader: test fix
aciarma May 6, 2022
096cc65
removed Geant4 call in mdireader_test.py
aciarma Jun 28, 2022
982f6fe
resolve conflicts
aciarma Jun 29, 2022
c696f33
resolve conflicts
aciarma Jun 29, 2022
64bb0ca
resolving conflicts
aciarma Jun 29, 2022
ffb2637
Update CMakeLists.txt
vvolkl Jul 1, 2022
338f7b6
Update k4Gen/options/mdireader_test.py
vvolkl Jul 1, 2022
59a2af7
Merge branch 'main' of github.com:HEP-FCC/k4Gen into main
aciarma Jul 4, 2022
ecd7113
Merge branch 'HEP-FCC:main' into main
aciarma Jul 4, 2022
f32c3ed
Merge pull request #1 from HEP-FCC/main
aciarma Dec 16, 2022
7bf63e4
MDIReader: added 'photons' and 'general' flags
aciarma Dec 16, 2022
3a0566d
MDIReader: added 'photons' and 'general' flags
aciarma Dec 16, 2022
40b8c79
Merge branch 'main' of github.com:aciarma/k4Gen into main
aciarma Dec 16, 2022
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
88 changes: 83 additions & 5 deletions k4Gen/src/components/MDIReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GaudiAlgorithm(name, svcLoc),
declareProperty("GenParticles", m_genphandle, "Generated particles collection (output)");
declareProperty("CrossingAngle",xing,"Half the crossing angle beam in [rad]");
declareProperty("LongitudinalCut",cut_z,"the value for cut_z used in GP++ in [um]");
declareProperty("InputType",input_type,"string: guineapig, xtrack");
declareProperty("InputType",input_type,"string: guineapig, xtrack, photons, general");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add here an explanation about what those input types correspond to? It is not immediately obvious to me, especially the two new additions.

declareProperty("BeamEnergy",beam_energy,"beam energy [GeV], necessary for xtrack type");
}

Expand Down Expand Up @@ -50,7 +50,7 @@ StatusCode MDIReader::execute()
}

// Check the input type flag
if(input_type!="guineapig" && input_type!="xtrack")
if(input_type!="guineapig" && input_type!="xtrack" && input_type!="photons" && input_type!="general")
{
error() << "Input type flag - wrong definition: "<< input_type << endmsg;
return StatusCode::FAILURE;
Expand Down Expand Up @@ -89,6 +89,7 @@ StatusCode MDIReader::execute()

size_t pcount = 0;
PHEP5 = 5.11e-4;

while(m_input.good())
{
if(input_type=="guineapig"){
Expand All @@ -97,7 +98,7 @@ StatusCode MDIReader::execute()
>> VHEP1 >> VHEP2 >> VHEP3
>> process >> trash >> id_ee;

PHEP5 = 5.11e-4;
//std::cout<<PHEP4<<" "<<sqrt(PHEP1*PHEP1 + PHEP2*PHEP2 + PHEP3*PHEP3)<<" "<<sqrt((PHEP1*PHEP1 + PHEP2*PHEP2 + PHEP3*PHEP3)*PHEP4*PHEP4 + PHEP5*PHEP5)<<std::endl;

if(m_input.eof())break;
Expand Down Expand Up @@ -157,7 +158,7 @@ StatusCode MDIReader::execute()
error() << "End of file reached before reading all the hits" << endmsg;
return StatusCode::FAILURE;
}

PHEP5 = 5.11e-4;
//VHEP3 = VHEP3 + temp_z; //is ct necessary? prob not

//---position rotation in CLD frame
Expand Down Expand Up @@ -185,8 +186,85 @@ StatusCode MDIReader::execute()
CHARGE = -1;

} //end if xtrack
else if(input_type=="photons"){
m_input >> VHEP1 >> PHEP1
>> VHEP2 >> PHEP2
>> PHEP4 >> PHEP3
>> trash ;
PHEP5 = 0;
if(m_input.eof())break;
else if(!m_input.good())
{
debug() << "End of file reached before reading all the hits" << endmsg;
error() << "End of file reached before reading all the hits" << endmsg;
return StatusCode::FAILURE;
}

//std::cout<<VHEP1<<" "<<PHEP1<<" "<<VHEP2<<" "<<PHEP2<<" "<<PHEP4<<" "<<PHEP3<<" " <<trash<<std::endl;

VHEP3 = -2.13;//hardcoded [m]

temp_z = VHEP3*cos(-xing) + VHEP1*sin(-xing);
temp_x = -VHEP3*sin(-xing) + VHEP1*cos(-xing);
VHEP1 = temp_x;
VHEP3 = temp_z;

VHEP1 *=1e3; //convert from m to mm
VHEP2 *=1e3; //convert from m to mm
VHEP3 *=1e3; //convert from m to mm

PHEP1 = PHEP1*PHEP4;
PHEP2 = PHEP2*PHEP4;
PHEP3 = sqrt(pow(PHEP4,2) - pow(PHEP1,2) - pow(PHEP2,2) );

//---momentum rotation in CLD frame
temp_pz = PHEP3*cos(-xing) + PHEP1*sin(-xing);
temp_px = -PHEP3*sin(-xing) + PHEP1*cos(-xing);
PHEP3 = temp_pz;
PHEP1 = temp_px;

IDHEP = 22;
CHARGE = 0;
}//end if photons
else if(input_type=="general"){
m_input >> VHEP1 >> VHEP2 >> VHEP3
>> PHEP1 >> PHEP2 >> PHEP3
>> PHEP4 >> IDHEP;
if(m_input.eof())break;
else if(!m_input.good())
{
debug() << "End of file reached before reading all the hits" << endmsg;
error() << "End of file reached before reading all the hits" << endmsg;
return StatusCode::FAILURE;
}

//std::cout<<VHEP1<<" "<<PHEP1<<" "<<VHEP2<<" "<<PHEP2<<" "<<PHEP4<<" "<<PHEP3<<" " <<trash<<std::endl;
// VHEP1, VHEP2, VHEP3 [m]
// PHEP1, PHEP2, PHEP3 [GeV/c]
// PHEP4 [GeV]
// IDHEP [int]


//VHEP1 *=1e3; //convert from m to mm
//VHEP2 *=1e3; //convert from m to mm
//VHEP3 *=1e3; //convert from m to mm

//PHEP1 = PHEP1*PHEP4;
//PHEP2 = PHEP2*PHEP4;
//PHEP3 = PHEP3*PHEP4;

PHEP5 = 0;
CHARGE = 0; //HARDCODED FOR NOW!!!
}//end if general
else{
debug() << "Unknown input type!" << endmsg;
error() << "Unknown input type!" << endmsg;
return StatusCode::FAILURE;
}//end else





edm4hep::MutableMCParticle particle = particles->create();

particle.setPDG(IDHEP);
Expand Down