10 #include "CLHEP/Units/GlobalSystemOfUnits.h"
11 #include "CLHEP/Units/GlobalPhysicalConstants.h"
12 #include "HepMC/SimpleVector.h"
14 #include "H_Parameters.h"
19 m_verbosity(verbosity),
20 m_FP420Transport(FP420Transport),
21 m_ZDCTransport(ZDCTransport),
46 if ( ! rng.isAvailable() ) {
48 <<
"LHCTransport (Hector) requires the RandomNumberGeneratorService\n"
49 "which is not present in the configuration file. You must add the service\n"
50 "in the configuration file or remove the modules that require it.";
52 if ( (rng->getEngine()).
name() ==
"TRandom3" ) {
57 edm::LogError(
"WrongRandomNumberGenerator") <<
"The TRandom3 engine must be used, Random Number Generator Service not correctly initialized!";
64 edm::LogInfo(
"HectorSetup") <<
"===================================================================\n"
65 <<
" * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n"
67 <<
" * --<--<-- A fast simulator --<--<-- * \n"
68 <<
" * | --<--<-- of particle --<--<-- * \n"
69 <<
" * ----HECTOR----< * \n"
70 <<
" * | -->-->-- transport through-->-->-- * \n"
71 <<
" * -->-->-- generic beamlines -->-->-- * \n"
73 <<
" * JINST 2:P09005 (2007) * \n"
74 <<
" * X Rouby, J de Favereau, K Piotrzkowski (CP3) * \n"
75 <<
" * http://www.fynu.ucl.ac.be/hector.html * \n"
77 <<
" * Center for Cosmology, Particle Physics and Phenomenology * \n"
78 <<
" * Universite catholique de Louvain * \n"
79 <<
" * Louvain-la-Neuve, Belgium * \n"
81 <<
" * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n"
82 <<
" Hector configuration: \n"
85 <<
" lengthfp420 = " << lengthfp420 <<
"\n"
86 <<
" m_rpp420_f = " << m_rpp420_f <<
"\n"
89 <<
" lengthd1 = " << lengthd1 <<
"\n"
90 <<
"===================================================================\n";
141 for (std::map<unsigned int,H_BeamParticle*>::iterator it =
m_beamPart.begin(); it !=
m_beamPart.end(); ++it ) {
161 for ( std::map<unsigned int,H_BeamParticle*>::iterator it =
m_beamPart.begin(); it !=
m_beamPart.end(); ++it ) {
185 H_BeamParticle * h_p;
188 for (HepMC::GenEvent::particle_const_iterator eventParticle =evt->particles_begin();
189 eventParticle != evt->particles_end();
191 if ( (*eventParticle)->status() == 1 ) {
192 if (
abs( (*eventParticle)->momentum().eta())>
etacut){
193 line = (*eventParticle)->barcode();
201 charge = part->charge();
204 double mass = (*eventParticle)->generatedMass();
206 h_p =
new H_BeamParticle(mass,charge);
209 px = (*eventParticle)->momentum().px();
210 py = (*eventParticle)->momentum().py();
211 pz = (*eventParticle)->momentum().pz();
213 h_p->set4Momentum( px, py, pz, (*eventParticle)->momentum().e() );
216 double XforPosition = (*eventParticle)->production_vertex()->position().x()/micrometer;
217 double YforPosition = (*eventParticle)->production_vertex()->position().y()/micrometer;
218 double ZforPosition = (*eventParticle)->production_vertex()->position().z()/meter;
220 double TXforPosition=0.0, TYforPosition=0.0;
223 h_p->setPosition(XforPosition, YforPosition, TXforPosition, TYforPosition, ZforPosition );
229 m_eta[
line] = (*eventParticle)->momentum().eta();
230 m_pdg[
line] = (*eventParticle)->pdg_id();
231 m_pz[
line] = (*eventParticle)->momentum().pz();
234 LogDebug(
"HectorEventProcessing") <<
"Hector:add: barcode = " << line
235 <<
" status = " << g->status()
236 <<
" PDG Id = " << g->pdg_id()
237 <<
" mass = " << mass
239 <<
" charge = " << charge
251 H_BeamParticle *
part;
252 std::map< unsigned int, H_BeamParticle* >::iterator it;
267 LogDebug(
"HectorEventProcessing") <<
"Hector:filterFP420: barcode = " <<
line;
270 direction = (*
m_direct.find( line )).second;
292 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterFP420: barcode = " << line <<
" positive is_stop= "<< is_stop;
297 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterFP420: barcode = " << line <<
" negative is_stop= "<< is_stop;
301 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterFP420: barcode = " << line <<
" 0 is_stop= "<< is_stop;
309 if ( direction == 1 ) part->propagate(
m_rpp420_f );
310 if ( direction == -1 ) part->propagate(
m_rpp420_b );
311 x1_420 = part->getX();
312 y1_420 = part->getY();
313 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterFP420: barcode = " << line <<
" x= "<< x1_420 <<
" y= " << y1_420;
335 H_BeamParticle *
part;
336 std::map< unsigned int, H_BeamParticle* >::iterator it;
338 bool is_stop_zdc =
false;
347 LogDebug(
"HectorEventProcessing") <<
"Hector:filterZDC: barcode = " << line <<
" charge = " << (*
m_isCharged.find(line)).
second;
353 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterZDC: barcode = " << line <<
" propagated ";
355 direction = (*
m_direct.find( line )).second;
356 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterZDC: barcode = " << line <<
" direction = " << direction;
377 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterZDC: barcode " << line <<
" positive is_stop_zdc= "<< is_stop_zdc;
382 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterZDC: barcode " << line <<
" negative is_stop_zdc= "<< is_stop_zdc;
385 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterZDC: barcode " << line <<
" 0 is_stop_zdc= "<< is_stop_zdc;
406 H_BeamParticle *
part;
407 std::map< unsigned int, H_BeamParticle* >::iterator it;
423 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterD1: barcode = " << line <<
" propagated ";
425 direction = (*
m_direct.find( line )).second;
426 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterD1:direction=" << direction;
447 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterD1 barcode " << line <<
" positive is_stop_d1 = "<< is_stop_d1;
452 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterD1 barcode " << line <<
" negative is_stop_d1 = "<< is_stop_d1;
456 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:filterD1 barcode " << line <<
" 0 is_stop_d1 = "<< is_stop_d1;
461 x1_d1 = part->getX();
462 y1_d1 = part->getY();
481 std::map<unsigned int, int>::const_iterator it =
m_direct.find( part_n );
489 for (std::map<unsigned int,H_BeamParticle*>::const_iterator it =
m_beamPart.begin(); it !=
m_beamPart.end(); ++it ) {
490 (*it).second->printProperties();
503 std::map< unsigned int, H_BeamParticle* >::iterator it;
511 LogDebug(
"HectorEventProcessing") <<
"Hector:addPartToHepMC: barcode = " << line <<
"\n"
518 gpart = evt->barcode_to_particle( line );
522 theta =
sqrt((tx*tx) + (ty*ty));
525 if( (*
m_direct.find( line )).second >0 ) {
528 else if((*
m_direct.find( line )).second <0 ) {
538 fi = std::atan2(tx,ty);
541 time = ( ddd*meter - gpart->production_vertex()->position().z()*mm );
545 LogDebug(
"HectorEventProcessing") <<
"Hector:: x= "<< (*(
m_xAtTrPoint.find(line))).second*0.001<<
"\n"
546 <<
"Hector:: y= "<< (*(
m_yAtTrPoint.find(line))).second*0.001<<
"\n"
547 <<
"Hector:: z= "<< ddd * (*(
m_direct.find( line ))).second*1000. <<
"\n"
548 <<
"Hector:: t= "<<
time;
551 HepMC::GenVertex * vert =
new HepMC::GenVertex( HepMC::FourVector( (*(
m_xAtTrPoint.find(line))).second*0.001,
553 ddd * (*(
m_direct.find( line ))).second*1000.,
554 time + .001*
time ) );
556 gpart->set_status( 2 );
557 vert->add_particle_in( gpart );
562 gpart->pdg_id(), 1, gpart->flow() ) );
563 evt->add_vertex( vert );
565 int ingoing = (*vert->particles_in_const_begin())->barcode();
566 int outgoing = (*vert->particles_out_const_begin())->barcode();
568 if (
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector:addPartToHepMC: LHCTransportLink " << theLink;
571 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector::TRANSPORTED pz= " << gpart->momentum().pz()
572 <<
" eta= "<< gpart->momentum().eta()
573 <<
" status= "<< gpart->status();
581 gpart = evt->barcode_to_particle( line );
584 gpart->set_status( 2 );
588 if(
m_verbosity)
LogDebug(
"HectorEventProcessing") <<
"Hector::NON-transp. pz= " << gpart->momentum().pz()
589 <<
" eta= "<< gpart->momentum().eta()
590 <<
" status= "<< gpart->status();
T getParameter(std::string const &) const
std::map< unsigned int, int > m_direct
std::map< unsigned int, bool > m_isCharged
int getDirect(unsigned int part_n) const
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
std::map< unsigned int, double > m_eta
edm::ESHandle< ParticleDataTable > pdt
std::map< unsigned int, bool > m_isStoppedzdc
H_BeamLine * m_beamlineZDC1
H_BeamLine * m_beamlineD11
std::map< unsigned int, bool > m_isStoppedd1
std::map< unsigned int, bool > m_isStoppedfp420
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
void getData(T &iHolder) const
Hector(const edm::ParameterSet &ps, bool verbosity, bool FP420Transport, bool ZDCTransport)
std::map< unsigned int, double > m_eAtTrPoint
U second(std::pair< T, U > const &p)
H_BeamLine * m_beamlineZDC2
std::map< unsigned int, double > m_pz
Cos< T >::type cos(const T &t)
std::map< unsigned int, double > m_TyAtTrPoint
std::vector< LHCTransportLink > theCorrespondenceMap
HepPDT::ParticleData ParticleData
std::map< unsigned int, H_BeamParticle * > m_beamPart
H_BeamLine * m_beamlineFP4201
void add(const HepMC::GenEvent *ev, const edm::EventSetup &es)
H_BeamLine * m_beamlineD12
H_BeamLine * m_beamlineFP4202
HepMC::GenEvent * addPartToHepMC(HepMC::GenEvent *event)
std::map< unsigned int, double > m_yAtTrPoint
std::map< unsigned int, int > m_pdg
std::map< unsigned int, double > m_TxAtTrPoint
std::map< unsigned int, double > m_xAtTrPoint
void clearApertureFlags()