File indexing completed on 2024-04-06 12:11:52
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Fireworks/Core/interface/FWProxyBuilderBase.h"
0010 #include "Fireworks/Core/interface/Context.h"
0011 #include "Fireworks/Core/interface/FWEventItem.h"
0012 #include "SimDataFormats/Track/interface/SimTrack.h"
0013 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0014 #include "SimDataFormats/Vertex/interface/SimVertex.h"
0015 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0016
0017 #include "FWCore/Common/interface/EventBase.h"
0018
0019 #include "TEveTrack.h"
0020 #include "TParticle.h"
0021 #include "TDatabasePDG.h"
0022
0023 class FWSimTrackProxyBuilder : public FWProxyBuilderBase {
0024 public:
0025 FWSimTrackProxyBuilder(void) {}
0026 ~FWSimTrackProxyBuilder(void) override {}
0027
0028 REGISTER_PROXYBUILDER_METHODS();
0029
0030
0031 FWSimTrackProxyBuilder(const FWSimTrackProxyBuilder&) = delete;
0032
0033 const FWSimTrackProxyBuilder& operator=(const FWSimTrackProxyBuilder&) = delete;
0034
0035 private:
0036 using FWProxyBuilderBase::build;
0037 void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
0038
0039 void addParticlesToPdgDataBase(void);
0040 };
0041
0042 void FWSimTrackProxyBuilder::addParticlesToPdgDataBase(void) {
0043 static Bool_t bAdded = kFALSE;
0044
0045 if (bAdded)
0046 return;
0047 bAdded = true;
0048
0049 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
0050 const Int_t kspe = 50000000;
0051
0052
0053
0054
0055 const Int_t kion = 1000000000;
0056
0057
0058
0059
0060
0061 const Double_t khSlash = 1.0545726663e-27;
0062 const Double_t kErg2Gev = 1 / 1.6021773349e-3;
0063 const Double_t khShGev = khSlash * kErg2Gev;
0064 const Double_t kYear2Sec = 3600 * 24 * 365.25;
0065
0066
0067
0068
0069
0070 pdgDB->AddParticle("Upsilon(3S)", "Upsilon(3S)", 10.3552, kTRUE, 0, 1, "Bottonium", 200553);
0071
0072
0073 pdgDB->AddParticle("rho_diff0", "rho_diff0", 0, kTRUE, 0, 0, "QCD diffr. state", 9900110);
0074 pdgDB->AddParticle("pi_diffr+", "pi_diffr+", 0, kTRUE, 0, 1, "QCD diffr. state", 9900210);
0075 pdgDB->AddParticle("omega_di", "omega_di", 0, kTRUE, 0, 0, "QCD diffr. state", 9900220);
0076 pdgDB->AddParticle("phi_diff", "phi_diff", 0, kTRUE, 0, 0, "QCD diffr. state", 9900330);
0077 pdgDB->AddParticle("J/psi_di", "J/psi_di", 0, kTRUE, 0, 0, "QCD diffr. state", 9900440);
0078 pdgDB->AddParticle("n_diffr0", "n_diffr0", 0, kTRUE, 0, 0, "QCD diffr. state", 9902110);
0079 pdgDB->AddParticle("p_diffr+", "p_diffr+", 0, kTRUE, 0, 1, "QCD diffr. state", 9902210);
0080
0081
0082 pdgDB->AddParticle("PSID ", " ", 3.7699, kFALSE, 0.0, 0, "meson", 30443);
0083
0084 pdgDB->AddParticle("A_00 ", " ", 0.9960, kFALSE, 0.0, 0, "meson", 9000111);
0085 pdgDB->AddParticle("A_0+ ", " ", 0.9960, kFALSE, 0.0, +3, "meson", 9000211);
0086 pdgDB->AddParticle("A_0- ", " ", 0.9960, kFALSE, 0.0, -3, "meson", -9000211);
0087
0088 pdgDB->AddParticle("F0P0 ", " ", 0.9960, kFALSE, 0.0, 0, "meson", 9010221);
0089
0090 pdgDB->AddParticle("KDL_2+ ", " ", 1.773, kFALSE, 0.0, +3, "meson", 10325);
0091 pdgDB->AddParticle("KDL_2- ", " ", 1.773, kFALSE, 0.0, -3, "meson", -10325);
0092
0093 pdgDB->AddParticle("KDL_20 ", " ", 1.773, kFALSE, 0.0, 0, "meson", 10315);
0094 pdgDB->AddParticle("KDL_2BR0", " ", 1.773, kFALSE, 0.0, 0, "meson", -10315);
0095
0096 pdgDB->AddParticle("PI_2+ ", " ", 1.670, kFALSE, 0.0, +3, "meson", 10215);
0097 pdgDB->AddParticle("PI_2- ", " ", 1.670, kFALSE, 0.0, -3, "meson", -10215);
0098 pdgDB->AddParticle("PI_20 ", " ", 1.670, kFALSE, 0.0, 0, "meson", 10115);
0099
0100 pdgDB->AddParticle("KD*+ ", " ", 1.717, kFALSE, 0.0, +3, "meson", 30323);
0101 pdgDB->AddParticle("KD*- ", " ", 1.717, kFALSE, 0.0, -3, "meson", -30323);
0102
0103 pdgDB->AddParticle("KD*0 ", " ", 1.717, kFALSE, 0.0, 0, "meson", 30313);
0104 pdgDB->AddParticle("KDBR*0 ", " ", 1.717, kFALSE, 0.0, 0, "meson", -30313);
0105
0106 pdgDB->AddParticle("RHOD+ ", " ", 1.700, kFALSE, 0.0, +3, "meson", 30213);
0107 pdgDB->AddParticle("RHOD- ", " ", 1.700, kFALSE, 0.0, -3, "meson", -30213);
0108 pdgDB->AddParticle("RHOD0 ", " ", 1.700, kFALSE, 0.0, 0, "meson", 30113);
0109
0110 pdgDB->AddParticle("ETA_2(L)", " ", 1.632, kFALSE, 0.0, 0, "meson", 10225);
0111 pdgDB->AddParticle("ETA_2(H)", " ", 1.854, kFALSE, 0.0, 0, "meson", 10335);
0112 pdgDB->AddParticle("OMEGA(H)", " ", 1.649, kFALSE, 0.0, 0, "meson", 30223);
0113
0114 pdgDB->AddParticle("KDH_2+ ", " ", 1.816, kFALSE, 0.0, +3, "meson", 20325);
0115 pdgDB->AddParticle("KDH_2- ", " ", 1.816, kFALSE, 0.0, -3, "meson", -20325);
0116
0117 pdgDB->AddParticle("KDH_20 ", " ", 1.816, kFALSE, 0.0, 0, "meson", 20315);
0118 pdgDB->AddParticle("KDH_2BR0", " ", 1.816, kFALSE, 0.0, 0, "meson", -20315);
0119
0120 pdgDB->AddParticle("KD_3+ ", " ", 1.773, kFALSE, 0.0, +3, "meson", 327);
0121 pdgDB->AddParticle("KD_3- ", " ", 1.773, kFALSE, 0.0, -3, "meson", -327);
0122
0123 pdgDB->AddParticle("KD_30 ", " ", 1.773, kFALSE, 0.0, 0, "meson", 317);
0124 pdgDB->AddParticle("KD_3BR0 ", " ", 1.773, kFALSE, 0.0, 0, "meson", -317);
0125
0126 pdgDB->AddParticle("RHO_3+ ", " ", 1.691, kFALSE, 0.0, +3, "meson", 217);
0127 pdgDB->AddParticle("RHO_3- ", " ", 1.691, kFALSE, 0.0, -3, "meson", -217);
0128 pdgDB->AddParticle("RHO_30 ", " ", 1.691, kFALSE, 0.0, 0, "meson", 117);
0129 pdgDB->AddParticle("OMEGA_3 ", " ", 1.667, kFALSE, 0.0, 0, "meson", 227);
0130 pdgDB->AddParticle("PHI_3 ", " ", 1.854, kFALSE, 0.0, 0, "meson", 337);
0131
0132 pdgDB->AddParticle("CHI2P_B0", " ", 10.232, kFALSE, 0.0, 0, "meson", 110551);
0133 pdgDB->AddParticle("CHI2P_B1", " ", 10.255, kFALSE, 0.0, 0, "meson", 120553);
0134 pdgDB->AddParticle("CHI2P_B2", " ", 10.269, kFALSE, 0.0, 0, "meson", 100555);
0135 pdgDB->AddParticle("UPSLON4S", " ", 10.580, kFALSE, 0.0, 0, "meson", 300553);
0136
0137
0138
0139
0140
0141
0142
0143 Int_t ionCode = kion + 10020;
0144 if (!pdgDB->GetParticle(ionCode)) {
0145 pdgDB->AddParticle("Deuteron", "Deuteron", 1.875613, kTRUE, 0, 3, "Ion", ionCode);
0146 }
0147 pdgDB->AddAntiParticle("AntiDeuteron", -ionCode);
0148
0149 ionCode = kion + 10030;
0150 if (!pdgDB->GetParticle(ionCode)) {
0151 pdgDB->AddParticle("Triton", "Triton", 2.80925, kFALSE, khShGev / (12.33 * kYear2Sec), 3, "Ion", ionCode);
0152 }
0153 pdgDB->AddAntiParticle("AntiTriton", -ionCode);
0154
0155 ionCode = kion + 20030;
0156 if (!pdgDB->GetParticle(ionCode)) {
0157 pdgDB->AddParticle("HE3", "HE3", 2.80923, kFALSE, 0, 6, "Ion", ionCode);
0158 }
0159 pdgDB->AddAntiParticle("AntiHE3", -ionCode);
0160
0161 ionCode = kion + 20040;
0162 if (!pdgDB->GetParticle(ionCode)) {
0163 pdgDB->AddParticle("Alpha", "Alpha", 3.727417, kTRUE, khShGev / (12.33 * kYear2Sec), 6, "Ion", ionCode);
0164 }
0165 pdgDB->AddAntiParticle("AntiAlpha", -ionCode);
0166
0167
0168
0169 pdgDB->AddParticle("Cherenkov", "Cherenkov", 0, kFALSE, 0, 0, "Special", kspe + 50);
0170 pdgDB->AddParticle("FeedbackPhoton", "FeedbackPhoton", 0, kFALSE, 0, 0, "Special", kspe + 51);
0171 pdgDB->AddParticle("Lambda1520", "Lambda1520", 1.5195, kFALSE, 0.0156, 0, "Resonance", 3124);
0172 pdgDB->AddAntiParticle("Lambda1520bar", -3124);
0173 }
0174
0175
0176
0177 void FWSimTrackProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) {
0178 const edm::SimTrackContainer* collection = nullptr;
0179 iItem->get(collection);
0180
0181 if (nullptr == collection) {
0182 return;
0183 }
0184 addParticlesToPdgDataBase();
0185
0186 TEveTrackPropagator* propagator = context().getTrackPropagator();
0187
0188 edm::Handle<edm::SimVertexContainer> hitColl;
0189 const edm::EventBase* event = item()->getEvent();
0190 event->getByLabel(edm::InputTag("g4SimHits"), hitColl);
0191
0192 int i = 0;
0193 for (std::vector<SimTrack>::const_iterator it = collection->begin(), end = collection->end(); it != end; ++it) {
0194 const SimTrack& iData = (*it);
0195 double vx = 0.0;
0196 double vy = 0.0;
0197 double vz = 0.0;
0198 double vt = 0.0;
0199 if (!iData.noVertex() && (hitColl.isValid() && !hitColl->empty())) {
0200 int vInd = iData.vertIndex();
0201 vx = hitColl->at(vInd).position().x();
0202 vy = hitColl->at(vInd).position().y();
0203 vz = hitColl->at(vInd).position().z();
0204 vt = hitColl->at(vInd).position().t();
0205 }
0206
0207 TParticle* particle = new TParticle;
0208 particle->SetPdgCode(iData.type());
0209 particle->SetMomentum(iData.momentum().px(), iData.momentum().py(), iData.momentum().pz(), iData.momentum().e());
0210 particle->SetProductionVertex(vx, vy, vz, vt);
0211
0212 TEveTrack* track = new TEveTrack(particle, ++i, propagator);
0213 if (iData.charge() == 0) {
0214 track->SetLineStyle(7);
0215 }
0216 track->AddPathMark(TEvePathMark(
0217 TEvePathMark::kReference,
0218 TEveVector(
0219 iData.trackerSurfacePosition().x(), iData.trackerSurfacePosition().y(), iData.trackerSurfacePosition().z()),
0220 TEveVector(iData.trackerSurfaceMomentum().px(),
0221 iData.trackerSurfaceMomentum().py(),
0222 iData.trackerSurfaceMomentum().pz())));
0223 track->MakeTrack();
0224 setupAddElement(track, product);
0225 }
0226 }
0227
0228 REGISTER_FWPROXYBUILDER(FWSimTrackProxyBuilder,
0229 edm::SimTrackContainer,
0230 "SimTracks",
0231 FWViewType::kAll3DBits | FWViewType::kAllRPZBits);