00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "Fireworks/Core/interface/FWProxyBuilderBase.h"
00010 #include "Fireworks/Core/interface/Context.h"
00011 #include "Fireworks/Core/interface/FWEventItem.h"
00012 #include "SimDataFormats/Track/interface/SimTrack.h"
00013 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00014 #include "SimDataFormats/Vertex/interface/SimVertex.h"
00015 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
00016
00017 #include "FWCore/Common/interface/EventBase.h"
00018
00019 #include "TEveTrack.h"
00020 #include "TParticle.h"
00021 #include "TDatabasePDG.h"
00022
00023 class FWSimTrackProxyBuilder : public FWProxyBuilderBase
00024 {
00025 public:
00026 FWSimTrackProxyBuilder( void ) {}
00027 virtual ~FWSimTrackProxyBuilder( void ) {}
00028
00029 REGISTER_PROXYBUILDER_METHODS();
00030
00031 private:
00032
00033 FWSimTrackProxyBuilder( const FWSimTrackProxyBuilder& );
00034
00035 const FWSimTrackProxyBuilder& operator=( const FWSimTrackProxyBuilder& );
00036
00037 virtual void build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* );
00038
00039 void addParticlesToPdgDataBase( void );
00040 };
00041
00042 void
00043 FWSimTrackProxyBuilder::addParticlesToPdgDataBase( void )
00044 {
00045 static Bool_t bAdded = kFALSE;
00046
00047 if(bAdded)return;
00048 bAdded = true;
00049
00050 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
00051 const Int_t kspe=50000000;
00052
00053
00054
00055
00056 const Int_t kion=1000000000;
00057
00058
00059
00060
00061
00062 const Double_t khSlash = 1.0545726663e-27;
00063 const Double_t kErg2Gev = 1/1.6021773349e-3;
00064 const Double_t khShGev = khSlash*kErg2Gev;
00065 const Double_t kYear2Sec = 3600*24*365.25;
00066
00067
00068
00069
00070
00071 pdgDB->AddParticle("Upsilon(3S)","Upsilon(3S)",10.3552,kTRUE,
00072 0,1,"Bottonium",200553);
00073
00074
00075 pdgDB->AddParticle("rho_diff0","rho_diff0",0,kTRUE,
00076 0,0,"QCD diffr. state",9900110);
00077 pdgDB->AddParticle("pi_diffr+","pi_diffr+",0,kTRUE,
00078 0,1,"QCD diffr. state",9900210);
00079 pdgDB->AddParticle("omega_di","omega_di",0,kTRUE,
00080 0,0,"QCD diffr. state",9900220);
00081 pdgDB->AddParticle("phi_diff","phi_diff",0,kTRUE,
00082 0,0,"QCD diffr. state",9900330);
00083 pdgDB->AddParticle("J/psi_di","J/psi_di",0,kTRUE,
00084 0,0,"QCD diffr. state",9900440);
00085 pdgDB->AddParticle("n_diffr0","n_diffr0",0,kTRUE,
00086 0,0,"QCD diffr. state",9902110);
00087 pdgDB->AddParticle("p_diffr+","p_diffr+",0,kTRUE,
00088 0,1,"QCD diffr. state",9902210);
00089
00090
00091 pdgDB->AddParticle("PSID ", " ", 3.7699, kFALSE, 0.0, 0, "meson", 30443);
00092
00093 pdgDB->AddParticle("A_00 ", " ", 0.9960, kFALSE, 0.0, 0, "meson", 9000111);
00094 pdgDB->AddParticle("A_0+ ", " ", 0.9960, kFALSE, 0.0,+3, "meson", 9000211);
00095 pdgDB->AddParticle("A_0- ", " ", 0.9960, kFALSE, 0.0,-3, "meson", -9000211);
00096
00097 pdgDB->AddParticle("F0P0 ", " ", 0.9960, kFALSE, 0.0, 0, "meson", 9010221);
00098
00099 pdgDB->AddParticle("KDL_2+ ", " ", 1.773, kFALSE, 0.0,+3, "meson", 10325);
00100 pdgDB->AddParticle("KDL_2- ", " ", 1.773, kFALSE, 0.0,-3, "meson", -10325);
00101
00102 pdgDB->AddParticle("KDL_20 ", " ", 1.773, kFALSE, 0.0, 0, "meson", 10315);
00103 pdgDB->AddParticle("KDL_2BR0", " ", 1.773, kFALSE, 0.0, 0, "meson", -10315);
00104
00105 pdgDB->AddParticle("PI_2+ ", " ", 1.670, kFALSE, 0.0,+3, "meson", 10215);
00106 pdgDB->AddParticle("PI_2- ", " ", 1.670, kFALSE, 0.0,-3, "meson", -10215);
00107 pdgDB->AddParticle("PI_20 ", " ", 1.670, kFALSE, 0.0, 0, "meson", 10115);
00108
00109
00110 pdgDB->AddParticle("KD*+ ", " ", 1.717, kFALSE, 0.0,+3, "meson", 30323);
00111 pdgDB->AddParticle("KD*- ", " ", 1.717, kFALSE, 0.0,-3, "meson", -30323);
00112
00113 pdgDB->AddParticle("KD*0 ", " ", 1.717, kFALSE, 0.0, 0, "meson", 30313);
00114 pdgDB->AddParticle("KDBR*0 ", " ", 1.717, kFALSE, 0.0, 0, "meson", -30313);
00115
00116 pdgDB->AddParticle("RHOD+ ", " ", 1.700, kFALSE, 0.0,+3, "meson", 30213);
00117 pdgDB->AddParticle("RHOD- ", " ", 1.700, kFALSE, 0.0,-3, "meson", -30213);
00118 pdgDB->AddParticle("RHOD0 ", " ", 1.700, kFALSE, 0.0, 0, "meson", 30113);
00119
00120 pdgDB->AddParticle("ETA_2(L)", " ", 1.632, kFALSE, 0.0, 0, "meson", 10225);
00121 pdgDB->AddParticle("ETA_2(H)", " ", 1.854, kFALSE, 0.0, 0, "meson", 10335);
00122 pdgDB->AddParticle("OMEGA(H)", " ", 1.649, kFALSE, 0.0, 0, "meson", 30223);
00123
00124
00125 pdgDB->AddParticle("KDH_2+ ", " ", 1.816, kFALSE, 0.0,+3, "meson", 20325);
00126 pdgDB->AddParticle("KDH_2- ", " ", 1.816, kFALSE, 0.0,-3, "meson", -20325);
00127
00128 pdgDB->AddParticle("KDH_20 ", " ", 1.816, kFALSE, 0.0, 0, "meson", 20315);
00129 pdgDB->AddParticle("KDH_2BR0", " ", 1.816, kFALSE, 0.0, 0, "meson", -20315);
00130
00131
00132 pdgDB->AddParticle("KD_3+ ", " ", 1.773, kFALSE, 0.0,+3, "meson", 327);
00133 pdgDB->AddParticle("KD_3- ", " ", 1.773, kFALSE, 0.0,-3, "meson", -327);
00134
00135 pdgDB->AddParticle("KD_30 ", " ", 1.773, kFALSE, 0.0, 0, "meson", 317);
00136 pdgDB->AddParticle("KD_3BR0 ", " ", 1.773, kFALSE, 0.0, 0, "meson", -317);
00137
00138 pdgDB->AddParticle("RHO_3+ ", " ", 1.691, kFALSE, 0.0,+3, "meson", 217);
00139 pdgDB->AddParticle("RHO_3- ", " ", 1.691, kFALSE, 0.0,-3, "meson", -217);
00140 pdgDB->AddParticle("RHO_30 ", " ", 1.691, kFALSE, 0.0, 0, "meson", 117);
00141 pdgDB->AddParticle("OMEGA_3 ", " ", 1.667, kFALSE, 0.0, 0, "meson", 227);
00142 pdgDB->AddParticle("PHI_3 ", " ", 1.854, kFALSE, 0.0, 0, "meson", 337);
00143
00144 pdgDB->AddParticle("CHI2P_B0", " ", 10.232, kFALSE, 0.0, 0, "meson", 110551);
00145 pdgDB->AddParticle("CHI2P_B1", " ", 10.255, kFALSE, 0.0, 0, "meson", 120553);
00146 pdgDB->AddParticle("CHI2P_B2", " ", 10.269, kFALSE, 0.0, 0, "meson", 100555);
00147 pdgDB->AddParticle("UPSLON4S", " ", 10.580, kFALSE, 0.0, 0, "meson", 300553);
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 Int_t ionCode = kion+10020;
00158 if(!pdgDB->GetParticle(ionCode)){
00159 pdgDB->AddParticle("Deuteron","Deuteron", 1.875613, kTRUE,
00160 0,3,"Ion",ionCode);
00161 }
00162 pdgDB->AddAntiParticle("AntiDeuteron", - ionCode);
00163
00164 ionCode = kion+10030;
00165 if(!pdgDB->GetParticle(ionCode)){
00166 pdgDB->AddParticle("Triton","Triton", 2.80925, kFALSE,
00167 khShGev/(12.33*kYear2Sec),3,"Ion",ionCode);
00168 }
00169 pdgDB->AddAntiParticle("AntiTriton", - ionCode);
00170
00171 ionCode = kion+20030;
00172 if(!pdgDB->GetParticle(ionCode)){
00173 pdgDB->AddParticle("HE3","HE3", 2.80923,kFALSE,
00174 0,6,"Ion",ionCode);
00175 }
00176 pdgDB->AddAntiParticle("AntiHE3", - ionCode);
00177
00178 ionCode = kion+20040;
00179 if(!pdgDB->GetParticle(ionCode)){
00180 pdgDB->AddParticle("Alpha","Alpha", 3.727417, kTRUE,
00181 khShGev/(12.33*kYear2Sec), 6, "Ion", ionCode);
00182 }
00183 pdgDB->AddAntiParticle("AntiAlpha", - ionCode);
00184
00185
00186
00187 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
00188 0,0,"Special",kspe+50);
00189 pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
00190 0,0,"Special",kspe+51);
00191 pdgDB->AddParticle("Lambda1520","Lambda1520",1.5195,kFALSE,
00192 0.0156,0,"Resonance",3124);
00193 pdgDB->AddAntiParticle("Lambda1520bar",-3124);
00194 }
00195
00196
00197
00198 void
00199 FWSimTrackProxyBuilder::build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* )
00200 {
00201 const edm::SimTrackContainer* collection = 0;
00202 iItem->get( collection );
00203
00204 if( 0 == collection )
00205 {
00206 return;
00207 }
00208 addParticlesToPdgDataBase();
00209
00210 TEveTrackPropagator* propagator = context().getTrackPropagator();
00211
00212
00213 edm::Handle<edm::SimVertexContainer> hitColl;
00214 const edm::EventBase *event = item()->getEvent();
00215 event->getByLabel( edm::InputTag( "g4SimHits" ), hitColl );
00216
00217 int i = 0;
00218 for( std::vector<SimTrack>::const_iterator it = collection->begin(), end = collection->end(); it != end; ++it )
00219 {
00220 const SimTrack& iData = (*it);
00221 double vx = 0.0;
00222 double vy = 0.0;
00223 double vz = 0.0;
00224 double vt = 0.0;
00225 if(! iData.noVertex() && ( hitColl.isValid() && !hitColl->empty()))
00226 {
00227 int vInd = iData.vertIndex();
00228 vx = hitColl->at(vInd).position().x();
00229 vy = hitColl->at(vInd).position().y();
00230 vz = hitColl->at(vInd).position().z();
00231 vt = hitColl->at(vInd).position().t();
00232 }
00233
00234 TParticle* particle = new TParticle;
00235 particle->SetPdgCode( iData.type());
00236 particle->SetMomentum( iData.momentum().px(), iData.momentum().py(), iData.momentum().pz(), iData.momentum().e());
00237 particle->SetProductionVertex( vx, vy, vz, vt );
00238
00239 TEveTrack* track = new TEveTrack( particle, ++i, propagator );
00240 if( iData.charge() == 0 )
00241 {
00242 track->SetLineStyle( 7 );
00243 }
00244 track->AddPathMark( TEvePathMark( TEvePathMark::kReference,
00245 TEveVector( iData.trackerSurfacePosition().x(), iData.trackerSurfacePosition().y(), iData.trackerSurfacePosition().z()),
00246 TEveVector( iData.trackerSurfaceMomentum().px(), iData.trackerSurfaceMomentum().py(), iData.trackerSurfaceMomentum().pz())));
00247 track->MakeTrack();
00248 setupAddElement( track, product );
00249 }
00250 }
00251
00252 REGISTER_FWPROXYBUILDER( FWSimTrackProxyBuilder, edm::SimTrackContainer, "SimTracks", FWViewType::kAll3DBits | FWViewType::kAllRPZBits );