37 ROOT::Math::SMatrixIdentity
id;
39 const float uncert = 0.001;
43 void setPropagationTargetZ(
const float &
z);
45 bool propagate(
const double px,
93 trackStateP = RKProp().propagate(startingStateP, *targetPlaneForward_);
95 trackStateP = RKProp().propagate(startingStateP, *targetPlaneBackward_);
113 momentum.px(), momentum.py(), momentum.pz(), position.x(), position.y(), position.z(),
charge,
output);
125 enum ReachHGCal { notReach = 0, outsideEESurface = 1, onEESurface = 2 };
203 mySimEvent_ = std::make_unique<FSimEvent>(particleFilter_);
207 tree.Branch(
"gen_n", &
gen_n_,
"gen_n/I");
208 tree.Branch(
"gen_PUNumInt", &
gen_PUNumInt_,
"gen_PUNumInt/I");
216 tree.Branch(
"vtx_x", &
vtx_x_);
217 tree.Branch(
"vtx_y", &
vtx_y_);
218 tree.Branch(
"vtx_z", &
vtx_z_);
222 tree.Branch(
"gen_pt", &
gen_pt_);
259 const std::vector<PileupSummaryInfo> &PupInfo = *PupInfo_h;
283 mySimEvent_->fill(*simTracksHandle, *simVerticesHandle);
285 HepMC::GenVertex *
primaryVertex = *(hevH)->GetEvent()->vertices_begin();
286 const float mm2cm = 0.1;
287 vtx_x_ = primaryVertex->position().x() * mm2cm;
288 vtx_y_ = primaryVertex->position().y() * mm2cm;
289 vtx_z_ = primaryVertex->position().z() * mm2cm;
293 std::vector<FSimTrack *> allselectedgentracks;
294 const float eeInnerRadius = 25.;
295 const float eeOuterRadius = 160.;
297 for (
unsigned int i = 0;
i <
npart; ++
i) {
298 std::vector<float> xp, yp, zp;
302 int reachedEE = ReachHGCal::notReach;
310 if (myTrack.noEndVertex())
314 toHGCalPropagator.
propagate(myTrack.momentum(), myTrack.vertex().position(), myTrack.charge(), propcoords);
317 if (reachesHGCal && vtx.Rho() < eeOuterRadius && vtx.Rho() > eeInnerRadius) {
318 reachedEE = ReachHGCal::onEESurface;
321 for (
int i = 0;
i < myTrack.nDaughters(); ++
i)
322 dpt += myTrack.daughter(
i).momentum().pt();
323 if (
abs(myTrack.type()) == 11)
324 fbrem = dpt / myTrack.momentum().pt();
325 }
else if (reachesHGCal && vtx.Rho() > eeOuterRadius)
326 reachedEE = ReachHGCal::outsideEESurface;
329 for (
unsigned il = 1; il <=
nlayers; ++il) {
330 const float charge = myTrack.charge();
333 indiv_particleProp.
propagate(myTrack.momentum(), myTrack.vertex().position(),
charge, propCoords);
335 xp.push_back(propCoords.
x);
336 yp.push_back(propCoords.
y);
337 zp.push_back(propCoords.
z);
340 vtx = myTrack.endVertex().position();
342 auto orig_vtx = myTrack.vertex().position();
359 toHGCalPropagator.
propagate(myTrack.momentum(), orig_vtx, myTrack.charge(), hitsHGCal);
379 gen_n_ = genParticlesHandle->size();
381 for (
const auto &particle : *genParticlesHandle) {
384 gen_pt_.push_back(particle.pt());
389 std::vector<int>
daughters(particle.daughterRefVector().size(), 0);
390 for (
unsigned j = 0; j < particle.daughterRefVector().size(); ++j) {
391 daughters[j] =
static_cast<int>(particle.daughterRefVector().at(j).key());
398 for (
size_t i = 0;
i < allselectedgentracks.size();
i++) {
399 const auto tracki = allselectedgentracks.at(
i);
401 for (
size_t j =
i + 1; j < allselectedgentracks.size(); j++) {
402 const auto trackj = allselectedgentracks.at(j);
404 if (!tracki->noMother()) {
405 if (&tracki->mother() == trackj)
408 if (!trackj->noMother()) {
409 if (&trackj->mother() == tracki)
415 for (
const auto &PVI : PupInfo) {
416 if (PVI.getBunchCrossing() == 0) {
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
static AlgebraicMatrix initialize()
const MagneticField * aField_
std::vector< int > genpart_mother_
const MagneticField * field_
std::vector< std::vector< int > > gen_daughters_
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Geom::Phi< T > phi() const
std::vector< std::vector< float > > genpart_posy_
CurvilinearTrajectoryError err_
GlobalPoint globalPosition() const
edm::EDGetToken gen_PU_token_
edm::ESWatcher< PDTRecord > pdt_watcher_
std::vector< float > genpart_phi_
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
edm::EDGetToken gen_token_
void initialize(TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) final
std::vector< float > gen_energy_
std::vector< float > genpart_exy_
std::unique_ptr< FSimEvent > mySimEvent_
edm::EDGetToken simVertices_token_
std::vector< float > gen_eta_
std::vector< std::vector< float > > genpart_posz_
std::vector< int > gen_status_
std::vector< float > genpart_dvy_
std::vector< int > genpart_reachedEE_
std::vector< int > gen_pdgid_
std::vector< float > genpart_exx_
std::vector< float > gen_phi_
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
static PlanePointer build(Args &&...args)
std::vector< int > genpart_pid_
void fill(const edm::Event &, const edm::EventSetup &) final
std::vector< int > gen_charge_
std::vector< bool > genpart_fromBeamPipe_
Abs< T >::type abs(const T &t)
edm::EDGetToken hepmcev_token_
std::vector< float > genpart_fbrem_
std::vector< float > genpart_eta_
std::vector< float > genpart_pt_
std::vector< float > genpart_ovz_
const RKPropagatorInS & RKProp() const
edm::ESWatcher< IdealMagneticFieldRecord > magfield_watcher_
HGCalTriggerTools triggerTools_
Plane::PlanePointer targetPlaneForward_
TrajectoryStateOnSurface TSOS
std::vector< std::vector< float > > genpart_posx_
SimpleTrackPropagator(const MagneticField *f)
std::vector< float > genpart_ovy_
std::vector< float > gen_pt_
std::vector< float > genpart_exphi_
bool check(const edm::EventSetup &iSetup)
bool propagate(const double px, const double py, const double pz, const double x, const double y, const double z, const float charge, Coordinates &coords) const
void setPropagationTargetZ(const float &z)
std::vector< float > genpart_energy_
math::XYZTLorentzVectorD toVector()
static int position[264][3]
std::vector< float > genpart_ovx_
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< float > genpart_exeta_
HGCalTriggerNtupleGen(const edm::ParameterSet &)
edm::EDGetToken simTracks_token_
std::vector< float > genpart_dvz_
std::vector< int > genpart_gen_
std::vector< float > genpart_dvx_
defaultRKPropagator::Product prod_