6 #include "HepMC/SimpleVector.h"
8 #include <CLHEP/Units/GlobalSystemOfUnits.h>
13 #include "H_Parameters.h"
22 : tok_pdt_(token), m_verbosity(verbosity), m_FP420Transport(FP420Transport), m_ZDCTransport(ZDCTransport) {
45 edm::LogInfo(
"HectorSetup") <<
"==================================================================="
47 <<
" * * * * * * * * * * * * * * * * * * * * * * * * * * * * "
51 <<
" * --<--<-- A fast simulator --<--<-- * "
53 <<
" * | --<--<-- of particle --<--<-- * "
55 <<
" * ----HECTOR----< * "
57 <<
" * | -->-->-- transport through-->-->-- * "
59 <<
" * -->-->-- generic beamlines -->-->-- * "
63 <<
" * JINST 2:P09005 (2007) * "
65 <<
" * X Rouby, J de Favereau, K Piotrzkowski (CP3) * "
67 <<
" * http://www.fynu.ucl.ac.be/hector.html * "
71 <<
" * Center for Cosmology, Particle Physics and Phenomenology * "
73 <<
" * Universite catholique de Louvain * "
75 <<
" * Louvain-la-Neuve, Belgium * "
79 <<
" * * * * * * * * * * * * * * * * * * * * * * * * * * * * "
81 <<
" Hector configuration: \n"
84 <<
" lengthfp420 = " << lengthfp420 <<
"\n"
85 <<
" m_rpp420_f = " << m_rpp420_f <<
"\n"
88 <<
" lengthd1 = " << lengthd1 <<
"\n"
89 <<
"==================================================================="
137 for (std::map<unsigned int, H_BeamParticle *>::iterator it =
m_beamPart.begin(); it !=
m_beamPart.end(); ++it) {
156 for (std::map<unsigned int, H_BeamParticle *>::iterator it =
m_beamPart.begin(); it !=
m_beamPart.end(); ++it) {
171 for (HepMC::GenEvent::particle_const_iterator eventParticle = evt->particles_begin();
172 eventParticle != evt->particles_end();
174 if ((*eventParticle)->status() == 1) {
175 if (
abs((*eventParticle)->momentum().eta()) >
etacut) {
176 line = (*eventParticle)->barcode();
184 charge = part->charge();
188 double mass = (*eventParticle)->generatedMass();
190 h_p =
new H_BeamParticle(mass, charge);
193 px = (*eventParticle)->momentum().px();
194 py = (*eventParticle)->momentum().py();
195 pz = (*eventParticle)->momentum().pz();
197 h_p->set4Momentum(px, py, pz, (*eventParticle)->momentum().e());
200 double XforPosition = (*eventParticle)->production_vertex()->position().x() / micrometer;
201 double YforPosition = (*eventParticle)->production_vertex()->position().y() / micrometer;
202 double ZforPosition = (*eventParticle)->production_vertex()->position().z() / meter;
205 double TXforPosition = 0.0, TYforPosition = 0.0;
208 h_p->setPosition(XforPosition, YforPosition, TXforPosition, TYforPosition, ZforPosition);
214 m_eta[
line] = (*eventParticle)->momentum().eta();
215 m_pdg[
line] = (*eventParticle)->pdg_id();
216 m_pz[
line] = (*eventParticle)->momentum().pz();
220 <<
"Hector:add: barcode = " << line <<
" status = " << g->status() <<
" PDG Id = " << g->pdg_id()
221 <<
" mass = " << mass <<
" pz = " << pz <<
" charge = " << charge
232 H_BeamParticle *
part;
233 std::map<unsigned int, H_BeamParticle *>::iterator it;
247 LogDebug(
"HectorEventProcessing") <<
"Hector:filterFP420: barcode = " <<
line;
250 direction = (*
m_direct.find(line)).second;
258 part->smearAng(STX, STY, rootEngine);
263 part->smearE(
m_sig_e, rootEngine);
265 part->smearE(SBE, rootEngine);
273 <<
"Hector:filterFP420: barcode = " << line <<
" positive is_stop= " << is_stop;
279 <<
"Hector:filterFP420: barcode = " << line <<
" negative is_stop= " << is_stop;
284 <<
"Hector:filterFP420: barcode = " << line <<
" 0 is_stop= " << is_stop;
291 <<
"Hector:filterFP420: barcode = " << line <<
" isStopped=" << (*
m_isStoppedfp420.find(line)).second;
298 x1_420 = part->getX();
299 y1_420 = part->getY();
302 <<
"Hector:filterFP420: barcode = " << line <<
" x= " << x1_420 <<
" y= " << y1_420;
315 <<
"Hector:filterFP420: barcode = " << line <<
" isStopped=" << (*
m_isStoppedfp420.find(line)).second;
324 H_BeamParticle *
part;
325 std::map<unsigned int, H_BeamParticle *>::iterator it;
327 bool is_stop_zdc =
false;
336 <<
"Hector:filterZDC: barcode = " << line <<
" charge = " << (*
m_isCharged.find(line)).
second;
342 LogDebug(
"HectorEventProcessing") <<
"Hector:filterZDC: barcode = " << line <<
" propagated ";
344 direction = (*
m_direct.find(line)).second;
346 LogDebug(
"HectorEventProcessing") <<
"Hector:filterZDC: barcode = " << line <<
" direction = " << direction;
354 part->smearAng(STX, STY, rootEngine);
359 part->smearE(
m_sig_e, rootEngine);
361 part->smearE(SBE, rootEngine);
370 <<
"Hector:filterZDC: barcode " << line <<
" positive is_stop_zdc= " << is_stop_zdc;
377 <<
"Hector:filterZDC: barcode " << line <<
" negative is_stop_zdc= " << is_stop_zdc;
382 <<
"Hector:filterZDC: barcode " << line <<
" 0 is_stop_zdc= " << is_stop_zdc;
398 <<
"Hector:filterZDC: barcode = " << line <<
" isStopped=" << (*
m_isStoppedzdc.find(line)).second;
407 H_BeamParticle *
part;
408 std::map<unsigned int, H_BeamParticle *>::iterator it;
422 <<
"Hector:filterD1: barcode = " << line <<
" isStoppedZDC =" << (*
m_isStoppedzdc.find(line)).
second;
425 edm::LogVerbatim(
"HectorEventProcessing") <<
"Hector:filterD1: barcode = " << line <<
" propagated ";
427 direction = (*
m_direct.find(line)).second;
429 LogDebug(
"HectorEventProcessing") <<
"Hector:filterD1:direction=" << direction;
437 part->smearAng(STX, STY, rootEngine);
442 part->smearE(
m_sig_e, rootEngine);
444 part->smearE(SBE, rootEngine);
453 <<
"Hector:filterD1 barcode " << line <<
" positive is_stop_d1 = " << is_stop_d1;
460 <<
"Hector:filterD1 barcode " << line <<
" negative is_stop_d1 = " << is_stop_d1;
466 <<
"Hector:filterD1 barcode " << line <<
" 0 is_stop_d1 = " << is_stop_d1;
471 x1_d1 = part->getX();
472 y1_d1 = part->getY();
485 <<
"Hector:filterD1: barcode = " << line <<
" isStopped=" << (*
m_isStoppedd1.find(line)).second;
493 std::map<unsigned int, int>::const_iterator it =
m_direct.find(part_n);
501 for (std::map<unsigned int, H_BeamParticle *>::const_iterator it =
m_beamPart.begin(); it !=
m_beamPart.end(); ++it) {
502 (*it).second->printProperties();
513 std::map<unsigned int, H_BeamParticle *>::iterator it;
524 LogDebug(
"HectorEventProcessing") <<
"Hector:addPartToHepMC: barcode = " << line <<
"\n"
525 <<
"Hector:addPartToHepMC: isStoppedfp420="
533 gpart = evt->barcode_to_particle(line);
537 theta =
sqrt((tx * tx) + (ty * ty));
540 if ((*
m_direct.find(line)).second > 0) {
542 }
else if ((*
m_direct.find(line)).second < 0) {
548 if ((*
m_direct.find(line)).second < 0)
552 fi = std::atan2(tx, ty);
555 time = (ddd * meter - gpart->production_vertex()->position().z() * mm);
559 LogDebug(
"HectorEventProcessing") <<
"Hector:: x= " << (*(
m_xAtTrPoint.find(line))).second * 0.001 <<
"\n"
560 <<
"Hector:: y= " << (*(
m_yAtTrPoint.find(line))).second * 0.001 <<
"\n"
561 <<
"Hector:: z= " << ddd * (*(
m_direct.find(line))).second * 1000. <<
"\n"
562 <<
"Hector:: t= " << time;
565 HepMC::GenVertex *vert =
new HepMC::GenVertex(HepMC::FourVector((*(
m_xAtTrPoint.find(line))).second * 0.001,
567 ddd * (*(
m_direct.find(line))).second * 1000.,
568 time + .001 * time));
570 gpart->set_status(2);
571 vert->add_particle_in(gpart);
579 evt->add_vertex(vert);
581 int ingoing = (*vert->particles_in_const_begin())->barcode();
582 int outgoing = (*vert->particles_out_const_begin())->barcode();
585 LogDebug(
"HectorEventProcessing") <<
"Hector:addPartToHepMC: LHCTransportLink " << theLink;
589 LogDebug(
"HectorEventProcessing") <<
"Hector::TRANSPORTED pz= " << gpart->momentum().pz()
590 <<
" eta= " << gpart->momentum().eta() <<
" status= " << gpart->status();
597 gpart = evt->barcode_to_particle(line);
600 gpart->set_status(2);
605 LogDebug(
"HectorEventProcessing") <<
"Hector::NON-transp. pz= " << gpart->momentum().pz()
606 <<
" eta= " << gpart->momentum().eta() <<
" status= " << gpart->status();
Log< level::Info, true > LogVerbatim
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
std::map< unsigned int, bool > m_isStoppedzdc
H_BeamLine * m_beamlineZDC1
edm::ESHandle< ParticleDataTable > pdt
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
std::map< unsigned int, double > m_eAtTrPoint
U second(std::pair< T, U > const &p)
H_BeamLine * m_beamlineZDC2
void filterD1(TRandom3 *)
std::map< unsigned int, double > m_pz
Cos< T >::type cos(const T &t)
std::map< unsigned int, double > m_TyAtTrPoint
Abs< T >::type abs(const T &t)
void filterFP420(TRandom3 *)
std::vector< LHCTransportLink > theCorrespondenceMap
Hector(const edm::ParameterSet &ps, const edm::ESGetToken< HepPDT::ParticleDataTable, PDTRecord > &, bool verbosity, bool FP420Transport, bool ZDCTransport)
HepPDT::ParticleData ParticleData
Log< level::Info, false > LogInfo
void filterZDC(TRandom3 *)
H_BeamLine * m_beamlineFP4201
T getParameter(std::string const &) const
const edm::ESGetToken< HepPDT::ParticleDataTable, PDTRecord > tok_pdt_
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
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
static constexpr float b2
std::map< unsigned int, int > m_pdg
std::map< unsigned int, double > m_TxAtTrPoint
std::map< unsigned int, double > m_xAtTrPoint
std::map< unsigned int, H_BeamParticle * > m_beamPart
static constexpr float b1
void clearApertureFlags()