CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions
FWSimTrackProxyBuilder Class Reference
Inheritance diagram for FWSimTrackProxyBuilder:
FWProxyBuilderBase

Public Member Functions

 FWSimTrackProxyBuilder (void)
 
 FWSimTrackProxyBuilder (const FWSimTrackProxyBuilder &)=delete
 
const FWSimTrackProxyBuilderoperator= (const FWSimTrackProxyBuilder &)=delete
 
const std::string & purpose () const
 
const std::string & typeName () const
 
const std::string & view () const
 
 ~FWSimTrackProxyBuilder (void) override
 
- Public Member Functions inherited from FWProxyBuilderBase
void build ()
 
virtual bool canHandle (const FWEventItem &)
 
const fireworks::Contextcontext () const
 
TEveElementList * createProduct (FWViewType::EType, const FWViewContext *)
 
 FWProxyBuilderBase ()
 
bool getHaveWindow () const
 
virtual bool havePerViewProduct (FWViewType::EType) const
 
virtual bool haveSingleProduct () const
 
const FWEventItemitem () const
 
virtual void itemBeingDestroyed (const FWEventItem *)
 
void itemChanged (const FWEventItem *)
 
int layer () const
 
void modelChanges (const FWModelIds &)
 
void removePerViewProduct (FWViewType::EType, const FWViewContext *vc)
 
void scaleChanged (const FWViewContext *)
 
void setHaveWindow (bool iFlag)
 
virtual void setInteractionList (FWInteractionList *, const std::string &)
 
virtual void setItem (const FWEventItem *iItem)
 
void setupAddElement (TEveElement *el, TEveElement *parent, bool set_color=true) const
 
void setupElement (TEveElement *el, bool color=true) const
 
virtual bool willHandleInteraction () const
 
virtual ~FWProxyBuilderBase ()
 

Static Public Member Functions

static const std::string & classPurpose ()
 
static const std::string & classRegisterTypeName ()
 
static const std::string & classTypeName ()
 
static const std::string & classView ()
 
- Static Public Member Functions inherited from FWProxyBuilderBase
static bool representsSubPart ()
 
static std::string typeOfBuilder ()
 Used by the plugin system to determine how the proxy uses the data from FWEventItem. More...
 

Private Member Functions

void addParticlesToPdgDataBase (void)
 
virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 
void build ()
 
void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 

Additional Inherited Members

- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >::iterator Product_it
 
- Protected Member Functions inherited from FWProxyBuilderBase
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
 
virtual void clean ()
 
virtual void cleanLocal ()
 
TEveCompound * createCompound (bool set_color=true, bool propagate_color_to_all_children=false) const
 
 FWProxyBuilderBase (const FWProxyBuilderBase &)
 
void increaseComponentTransparency (unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)
 
virtual void localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
 
virtual void modelChanges (const FWModelIds &, Product *)
 
const FWProxyBuilderBaseoperator= (const FWProxyBuilderBase &)
 
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
 
virtual bool visibilityModelChanges (const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Detailed Description

Definition at line 23 of file FWSimTrackProxyBuilder.cc.

Constructor & Destructor Documentation

◆ FWSimTrackProxyBuilder() [1/2]

FWSimTrackProxyBuilder::FWSimTrackProxyBuilder ( void  )
inline

Definition at line 25 of file FWSimTrackProxyBuilder.cc.

25 {}

◆ ~FWSimTrackProxyBuilder()

FWSimTrackProxyBuilder::~FWSimTrackProxyBuilder ( void  )
inlineoverride

Definition at line 26 of file FWSimTrackProxyBuilder.cc.

26 {}

◆ FWSimTrackProxyBuilder() [2/2]

FWSimTrackProxyBuilder::FWSimTrackProxyBuilder ( const FWSimTrackProxyBuilder )
delete

Member Function Documentation

◆ addParticlesToPdgDataBase()

void FWSimTrackProxyBuilder::addParticlesToPdgDataBase ( void  )
private

Definition at line 42 of file FWSimTrackProxyBuilder.cc.

Referenced by build().

42  {
43  static Bool_t bAdded = kFALSE;
44  // Check if already called
45  if (bAdded)
46  return;
47  bAdded = true;
48 
49  TDatabasePDG* pdgDB = TDatabasePDG::Instance();
50  const Int_t kspe = 50000000;
51 
52  // PDG nuclear states are 10-digit numbers
53  // 10LZZZAAAI e.g. deuteron is
54  // 1000010020
55  const Int_t kion = 1000000000;
56 
57  /*
58  const Double_t kAu2Gev=0.9314943228;
59  */
60 
61  const Double_t khSlash = 1.0545726663e-27;
62  const Double_t kErg2Gev = 1 / 1.6021773349e-3;
63  const Double_t khShGev = khSlash * kErg2Gev;
64  const Double_t kYear2Sec = 3600 * 24 * 365.25;
65 
66  //
67  // Bottom mesons
68  // mass and life-time from PDG
69  //
70  pdgDB->AddParticle("Upsilon(3S)", "Upsilon(3S)", 10.3552, kTRUE, 0, 1, "Bottonium", 200553);
71 
72  // QCD diffractive states
73  pdgDB->AddParticle("rho_diff0", "rho_diff0", 0, kTRUE, 0, 0, "QCD diffr. state", 9900110);
74  pdgDB->AddParticle("pi_diffr+", "pi_diffr+", 0, kTRUE, 0, 1, "QCD diffr. state", 9900210);
75  pdgDB->AddParticle("omega_di", "omega_di", 0, kTRUE, 0, 0, "QCD diffr. state", 9900220);
76  pdgDB->AddParticle("phi_diff", "phi_diff", 0, kTRUE, 0, 0, "QCD diffr. state", 9900330);
77  pdgDB->AddParticle("J/psi_di", "J/psi_di", 0, kTRUE, 0, 0, "QCD diffr. state", 9900440);
78  pdgDB->AddParticle("n_diffr0", "n_diffr0", 0, kTRUE, 0, 0, "QCD diffr. state", 9902110);
79  pdgDB->AddParticle("p_diffr+", "p_diffr+", 0, kTRUE, 0, 1, "QCD diffr. state", 9902210);
80 
81  // From Herwig
82  pdgDB->AddParticle("PSID ", " ", 3.7699, kFALSE, 0.0, 0, "meson", 30443);
83 
84  pdgDB->AddParticle("A_00 ", " ", 0.9960, kFALSE, 0.0, 0, "meson", 9000111);
85  pdgDB->AddParticle("A_0+ ", " ", 0.9960, kFALSE, 0.0, +3, "meson", 9000211);
86  pdgDB->AddParticle("A_0- ", " ", 0.9960, kFALSE, 0.0, -3, "meson", -9000211);
87 
88  pdgDB->AddParticle("F0P0 ", " ", 0.9960, kFALSE, 0.0, 0, "meson", 9010221);
89 
90  pdgDB->AddParticle("KDL_2+ ", " ", 1.773, kFALSE, 0.0, +3, "meson", 10325);
91  pdgDB->AddParticle("KDL_2- ", " ", 1.773, kFALSE, 0.0, -3, "meson", -10325);
92 
93  pdgDB->AddParticle("KDL_20 ", " ", 1.773, kFALSE, 0.0, 0, "meson", 10315);
94  pdgDB->AddParticle("KDL_2BR0", " ", 1.773, kFALSE, 0.0, 0, "meson", -10315);
95 
96  pdgDB->AddParticle("PI_2+ ", " ", 1.670, kFALSE, 0.0, +3, "meson", 10215);
97  pdgDB->AddParticle("PI_2- ", " ", 1.670, kFALSE, 0.0, -3, "meson", -10215);
98  pdgDB->AddParticle("PI_20 ", " ", 1.670, kFALSE, 0.0, 0, "meson", 10115);
99 
100  pdgDB->AddParticle("KD*+ ", " ", 1.717, kFALSE, 0.0, +3, "meson", 30323);
101  pdgDB->AddParticle("KD*- ", " ", 1.717, kFALSE, 0.0, -3, "meson", -30323);
102 
103  pdgDB->AddParticle("KD*0 ", " ", 1.717, kFALSE, 0.0, 0, "meson", 30313);
104  pdgDB->AddParticle("KDBR*0 ", " ", 1.717, kFALSE, 0.0, 0, "meson", -30313);
105 
106  pdgDB->AddParticle("RHOD+ ", " ", 1.700, kFALSE, 0.0, +3, "meson", 30213);
107  pdgDB->AddParticle("RHOD- ", " ", 1.700, kFALSE, 0.0, -3, "meson", -30213);
108  pdgDB->AddParticle("RHOD0 ", " ", 1.700, kFALSE, 0.0, 0, "meson", 30113);
109 
110  pdgDB->AddParticle("ETA_2(L)", " ", 1.632, kFALSE, 0.0, 0, "meson", 10225);
111  pdgDB->AddParticle("ETA_2(H)", " ", 1.854, kFALSE, 0.0, 0, "meson", 10335);
112  pdgDB->AddParticle("OMEGA(H)", " ", 1.649, kFALSE, 0.0, 0, "meson", 30223);
113 
114  pdgDB->AddParticle("KDH_2+ ", " ", 1.816, kFALSE, 0.0, +3, "meson", 20325);
115  pdgDB->AddParticle("KDH_2- ", " ", 1.816, kFALSE, 0.0, -3, "meson", -20325);
116 
117  pdgDB->AddParticle("KDH_20 ", " ", 1.816, kFALSE, 0.0, 0, "meson", 20315);
118  pdgDB->AddParticle("KDH_2BR0", " ", 1.816, kFALSE, 0.0, 0, "meson", -20315);
119 
120  pdgDB->AddParticle("KD_3+ ", " ", 1.773, kFALSE, 0.0, +3, "meson", 327);
121  pdgDB->AddParticle("KD_3- ", " ", 1.773, kFALSE, 0.0, -3, "meson", -327);
122 
123  pdgDB->AddParticle("KD_30 ", " ", 1.773, kFALSE, 0.0, 0, "meson", 317);
124  pdgDB->AddParticle("KD_3BR0 ", " ", 1.773, kFALSE, 0.0, 0, "meson", -317);
125 
126  pdgDB->AddParticle("RHO_3+ ", " ", 1.691, kFALSE, 0.0, +3, "meson", 217);
127  pdgDB->AddParticle("RHO_3- ", " ", 1.691, kFALSE, 0.0, -3, "meson", -217);
128  pdgDB->AddParticle("RHO_30 ", " ", 1.691, kFALSE, 0.0, 0, "meson", 117);
129  pdgDB->AddParticle("OMEGA_3 ", " ", 1.667, kFALSE, 0.0, 0, "meson", 227);
130  pdgDB->AddParticle("PHI_3 ", " ", 1.854, kFALSE, 0.0, 0, "meson", 337);
131 
132  pdgDB->AddParticle("CHI2P_B0", " ", 10.232, kFALSE, 0.0, 0, "meson", 110551);
133  pdgDB->AddParticle("CHI2P_B1", " ", 10.255, kFALSE, 0.0, 0, "meson", 120553);
134  pdgDB->AddParticle("CHI2P_B2", " ", 10.269, kFALSE, 0.0, 0, "meson", 100555);
135  pdgDB->AddParticle("UPSLON4S", " ", 10.580, kFALSE, 0.0, 0, "meson", 300553);
136 
137  // IONS
138  //
139  // Done by default now from Pythia6 table
140  // Needed for other generators
141  // So check if already defined
142 
143  Int_t ionCode = kion + 10020;
144  if (!pdgDB->GetParticle(ionCode)) {
145  pdgDB->AddParticle("Deuteron", "Deuteron", 1.875613, kTRUE, 0, 3, "Ion", ionCode);
146  }
147  pdgDB->AddAntiParticle("AntiDeuteron", -ionCode);
148 
149  ionCode = kion + 10030;
150  if (!pdgDB->GetParticle(ionCode)) {
151  pdgDB->AddParticle("Triton", "Triton", 2.80925, kFALSE, khShGev / (12.33 * kYear2Sec), 3, "Ion", ionCode);
152  }
153  pdgDB->AddAntiParticle("AntiTriton", -ionCode);
154 
155  ionCode = kion + 20030;
156  if (!pdgDB->GetParticle(ionCode)) {
157  pdgDB->AddParticle("HE3", "HE3", 2.80923, kFALSE, 0, 6, "Ion", ionCode);
158  }
159  pdgDB->AddAntiParticle("AntiHE3", -ionCode);
160 
161  ionCode = kion + 20040;
162  if (!pdgDB->GetParticle(ionCode)) {
163  pdgDB->AddParticle("Alpha", "Alpha", 3.727417, kTRUE, khShGev / (12.33 * kYear2Sec), 6, "Ion", ionCode);
164  }
165  pdgDB->AddAntiParticle("AntiAlpha", -ionCode);
166 
167  // Special particles
168  //
169  pdgDB->AddParticle("Cherenkov", "Cherenkov", 0, kFALSE, 0, 0, "Special", kspe + 50);
170  pdgDB->AddParticle("FeedbackPhoton", "FeedbackPhoton", 0, kFALSE, 0, 0, "Special", kspe + 51);
171  pdgDB->AddParticle("Lambda1520", "Lambda1520", 1.5195, kFALSE, 0.0156, 0, "Resonance", 3124);
172  pdgDB->AddAntiParticle("Lambda1520bar", -3124);
173 }

◆ build() [1/3]

void FWProxyBuilderBase::build
private

Definition at line 110 of file FWProxyBuilderBase.cc.

110  {
111  if (m_item) {
112  try {
113  size_t itemSize = m_item->size(); //cashed
114 
115  clean();
116  for (Product_it i = m_products.begin(); i != m_products.end(); ++i) {
117  //printf("build() %s \n", m_item->name().c_str());
118  TEveElementList* elms = (*i)->m_elements;
119  size_t oldSize = elms->NumChildren();
120 
121  if (haveSingleProduct()) {
122  build(m_item, elms, (*i)->m_viewContext);
123  } else {
124  buildViewType(m_item, elms, (*i)->m_viewType, (*i)->m_viewContext);
125  }
126 
127  // Project all children of current product.
128  // If product is not registered into any projection-manager,
129  // this does nothing.
130  TEveProjectable* pable = dynamic_cast<TEveProjectable*>(elms);
131  if (pable->HasProjecteds()) {
132  // loop projected holders
133  for (TEveProjectable::ProjList_i i = pable->BeginProjecteds(); i != pable->EndProjecteds(); ++i) {
134  TEveProjectionManager* pmgr = (*i)->GetManager();
135  Float_t oldDepth = pmgr->GetCurrentDepth();
136  pmgr->SetCurrentDepth(item()->layer());
137  size_t cnt = 0;
138 
139  TEveElement* projectedAsElement = (*i)->GetProjectedAsElement();
140  TEveElement::List_i parentIt = projectedAsElement->BeginChildren();
141  for (TEveElement::List_i prodIt = elms->BeginChildren(); prodIt != elms->EndChildren(); ++prodIt, ++cnt) {
142  // reused projected holder
143  if (cnt < oldSize) {
144  if ((*parentIt)->NumChildren()) {
145  // update projected (mislleading name)
146  for (TEveElement::List_i pci = (*parentIt)->BeginChildren(); pci != (*parentIt)->EndChildren(); pci++)
147  pmgr->ProjectChildrenRecurse(*parentIt);
148  } else {
149  // import projectable
150  pmgr->SubImportChildren(*prodIt, *parentIt);
151  }
152 
153  ++parentIt;
154  } else if (cnt < itemSize) {
155  // new product holder
156  pmgr->SubImportElements(*prodIt, projectedAsElement);
157  } else {
158  break;
159  }
160  }
161  pmgr->SetCurrentDepth(oldDepth);
162  }
163  }
164 
165  if (m_interactionList && itemSize > oldSize) {
166  TEveElement::List_i elIt = elms->BeginChildren();
167  for (size_t cnt = 0; cnt < itemSize; ++cnt, ++elIt) {
168  if (cnt >= oldSize)
169  m_interactionList->added(*elIt, cnt);
170  }
171  }
172  }
173  } catch (const std::runtime_error& iException) {
174  fwLog(fwlog::kError) << "Caught exception in build function for item " << m_item->name() << ":\n"
175  << iException.what() << std::endl;
176  exit(1);
177  }
178  }
179  m_mustBuild = false;
180 }
size_t size() const
Definition: FWEventItem.cc:457
virtual void buildViewType(const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
std::vector< Product * >::iterator Product_it
std::vector< Product * > m_products
virtual bool haveSingleProduct() const
const FWEventItem * m_item
void added(TEveElement *, unsigned int)
#define fwLog(_level_)
Definition: fwLog.h:45
const std::string & name() const
Definition: FWEventItem.cc:435
FWInteractionList * m_interactionList
const FWEventItem * item() const
def exit(msg="")

◆ build() [2/3]

void FWProxyBuilderBase::build
private

Definition at line 328 of file FWProxyBuilderBase.cc.

328  {
329  assert(
330  "virtual build(const FWEventItem*, TEveElementList*, const FWViewContext*) not implemented by inherited class");
331 }
assert(be >=bs)

◆ build() [3/3]

void FWSimTrackProxyBuilder::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext  
)
overrideprivatevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 177 of file FWSimTrackProxyBuilder.cc.

References addParticlesToPdgDataBase(), CoreSimTrack::charge(), universalConfigTemplate::collection, FWProxyBuilderBase::context(), mps_fire::end, FWEventItem::get(), edm::EventBase::getByLabel(), FWEventItem::getEvent(), fireworks::Context::getTrackPropagator(), mps_fire::i, edm::HandleBase::isValid(), FWProxyBuilderBase::item(), CoreSimTrack::momentum(), SimTrack::noVertex(), TrackCandidateProducer_cfi::propagator, FWProxyBuilderBase::setupAddElement(), HLT_2023v12_cff::track, SimTrack::trackerSurfaceMomentum(), SimTrack::trackerSurfacePosition(), CoreSimTrack::type(), and SimTrack::vertIndex().

177  {
178  const edm::SimTrackContainer* collection = nullptr;
179  iItem->get(collection);
180 
181  if (nullptr == collection) {
182  return;
183  }
185 
186  TEveTrackPropagator* propagator = context().getTrackPropagator();
187 
189  const edm::EventBase* event = item()->getEvent();
190  event->getByLabel(edm::InputTag("g4SimHits"), hitColl);
191 
192  int i = 0;
193  for (std::vector<SimTrack>::const_iterator it = collection->begin(), end = collection->end(); it != end; ++it) {
194  const SimTrack& iData = (*it);
195  double vx = 0.0;
196  double vy = 0.0;
197  double vz = 0.0;
198  double vt = 0.0;
199  if (!iData.noVertex() && (hitColl.isValid() && !hitColl->empty())) {
200  int vInd = iData.vertIndex();
201  vx = hitColl->at(vInd).position().x();
202  vy = hitColl->at(vInd).position().y();
203  vz = hitColl->at(vInd).position().z();
204  vt = hitColl->at(vInd).position().t();
205  }
206 
207  TParticle* particle = new TParticle;
208  particle->SetPdgCode(iData.type());
209  particle->SetMomentum(iData.momentum().px(), iData.momentum().py(), iData.momentum().pz(), iData.momentum().e());
210  particle->SetProductionVertex(vx, vy, vz, vt);
211 
212  TEveTrack* track = new TEveTrack(particle, ++i, propagator);
213  if (iData.charge() == 0) {
214  track->SetLineStyle(7);
215  }
216  track->AddPathMark(TEvePathMark(
217  TEvePathMark::kReference,
218  TEveVector(
219  iData.trackerSurfacePosition().x(), iData.trackerSurfacePosition().y(), iData.trackerSurfacePosition().z()),
220  TEveVector(iData.trackerSurfaceMomentum().px(),
221  iData.trackerSurfaceMomentum().py(),
222  iData.trackerSurfaceMomentum().pz())));
223  track->MakeTrack();
224  setupAddElement(track, product);
225  }
226 }
const math::XYZVectorD & trackerSurfacePosition() const
Definition: SimTrack.h:40
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
TEveTrackPropagator * getTrackPropagator() const
Definition: Context.h:62
void get(const T *&oData) const
Definition: FWEventItem.h:78
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:97
float charge() const
charge
Definition: CoreSimTrack.cc:17
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
const fireworks::Context & context() const
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:22
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
Definition: SimTrack.h:33
const edm::EventBase * getEvent() const
Definition: FWEventItem.h:131
bool noVertex() const
Definition: SimTrack.h:34
bool isValid() const
Definition: HandleBase.h:70
const math::XYZTLorentzVectorD & trackerSurfaceMomentum() const
Definition: SimTrack.h:42
std::vector< SimTrack > SimTrackContainer
const FWEventItem * item() const

◆ classPurpose()

const std::string & FWSimTrackProxyBuilder::classPurpose ( )
static

Definition at line 231 of file FWSimTrackProxyBuilder.cc.

◆ classRegisterTypeName()

const std::string & FWSimTrackProxyBuilder::classRegisterTypeName ( )
static

Definition at line 231 of file FWSimTrackProxyBuilder.cc.

◆ classTypeName()

const std::string & FWSimTrackProxyBuilder::classTypeName ( )
static

Definition at line 231 of file FWSimTrackProxyBuilder.cc.

◆ classView()

const std::string & FWSimTrackProxyBuilder::classView ( )
static

Definition at line 231 of file FWSimTrackProxyBuilder.cc.

◆ operator=()

const FWSimTrackProxyBuilder& FWSimTrackProxyBuilder::operator= ( const FWSimTrackProxyBuilder )
delete

◆ purpose()

const std::string& FWSimTrackProxyBuilder::purpose ( ) const
inline

Definition at line 28 of file FWSimTrackProxyBuilder.cc.

◆ typeName()

const std::string& FWSimTrackProxyBuilder::typeName ( ) const
inline

Definition at line 28 of file FWSimTrackProxyBuilder.cc.

◆ view()

const std::string& FWSimTrackProxyBuilder::view ( ) const
inline

Definition at line 28 of file FWSimTrackProxyBuilder.cc.