#include <LCDG4McPartManager.hh>
Collaboration diagram for LCDG4McPartManager:

Public Member Functions | |
| LCDG4McPartManager () | |
| LCDG4McPartManager (std::map< G4LogicalVolume *, G4int > *m, int dbflg=0) | |
| virtual | ~LCDG4McPartManager () |
| void | SetDetTypeMap (std::map< G4LogicalVolume *, G4int > *m) |
| void | SetDebugFlag (int dbflg) |
| void | PreTracking (const G4Track *aTrack) |
| void | PostTracking (const G4Track *aTrack, const G4TrackingManager *aTrackMgr) |
| LCDMcPart * | CheckPrimaryParticle (const G4Track *aTrack) |
| void | MakeLCDMcPart (const G4Track *aTrack) |
| const G4int & | GetShowerFlag (G4int parentTrkID) const |
| void | Clear () |
| int | GetDetType (G4LogicalVolume *lvol) const |
| int | GetNumMCparticles () const |
| void | PrintMcPart () |
| void | PrintTrkid2MctagMap () |
| G4int | trkidToMctag (G4int trkid) const |
| LCDMcPart * | GetMcPartFromTag (G4int mctag) const |
| LCDMcPart * | GetMcPartFromTrkid (G4int trkid) const |
| bool | CheckLastProcess (G4String proc) const |
| bool | IsShowerProcess () const |
| bool | IsInOutput (G4int trkid) const |
| bool | IsInOutput () const |
| bool | IsShowered () |
| bool | IsLeft () const |
| bool | IsInteracted () const |
| bool | IsDecayed () const |
| bool | IsStopped () const |
| void | GetDaughterCandidates (const G4int dau1, const G4int dau2, const G4int pdgidref, std::vector< LCDMcPart * > &cands) |
| void | SetCalorimeterEntrancePoint (const G4ThreeVector &pos, const G4ThreeVector &mom) |
Static Public Member Functions | |
| LCDG4McPartManager * | GetPointer () |
Public Attributes | |
| std::vector< LCDMcPart * > | MCparticles |
| std::vector< G4int > | trkids |
Private Member Functions | |
| void | PreAssignedDecay (G4TrackVector *SecTrkV) |
| void | EraseAllPreassignedDescendants (G4int m_mctag) |
| void | AssignTagToTrack (const G4Track *trk, const G4int tag) |
| void | AssignTagToTrack (const G4Track *trk, const LCDMcPart *mcp) |
| void | AssociateFromComplexLists (std::list< G4Track * > &trks, std::list< LCDMcPart * > &mcps) |
| void | FindSingleBestAssociation (std::vector< G4Track * > &trks2, std::vector< LCDMcPart * > &mcps2) |
| void | DumpLists (std::list< G4Track * > &trks, std::list< LCDMcPart * > &mcps) |
| void | DumpVectors (std::vector< G4Track * > &trks, std::vector< LCDMcPart * > &mcps) |
Private Attributes | |
| int | m_nmcprim |
| int | m_debug |
| G4int | m_trkid |
| int | m_mctag |
| G4Track * | curTrack |
| const G4ParticleDefinition * | dpart |
| const G4StepPoint * | postStep |
| const G4VProcess * | lastProc |
| std::map< G4LogicalVolume *, G4int > * | m_pdettype |
| std::map< G4int, G4int > | m_trkid2McTag |
| std::map< G4int, G4int > | m_trkid2dettype |
| std::map< G4int, G4int > | m_showerFlag |
Static Private Attributes | |
| LCDG4McPartManager * | _me = NULL |
|
|
Definition at line 41 of file LCDG4McPartManager.cc. References _me, m_trkid2dettype, and m_trkid2McTag.
00042 : m_nmcprim(0), m_debug(0), m_pdettype(0) { 00043 m_trkid2McTag.clear(); 00044 m_trkid2dettype.clear(); 00045 if ( _me == NULL ) _me = this; 00046 } |
|
||||||||||||
|
Definition at line 49 of file LCDG4McPartManager.cc. References _me, m_trkid2dettype, and m_trkid2McTag.
00050 : m_nmcprim(0), m_debug(dbflg), m_pdettype(m) 00051 { 00052 m_trkid2McTag.clear(); 00053 m_trkid2dettype.clear(); 00054 if ( _me == NULL ) _me = this; 00055 } |
|
|
Definition at line 19 of file LCDG4McPartManager.hh.
00019 {};
|
|
||||||||||||
|
Definition at line 93 of file LCDG4McPartManager.hh. References AssignTagToTrack(), and LCDMcPart::GetParticleTag().
00093 {
00094 AssignTagToTrack( trk, mcp->GetParticleTag() );
00095 }
|
|
||||||||||||
|
Definition at line 822 of file LCDG4McPartManager.cc. References LCDG4Trk2McPart::GetMcPartTag(), LCDMcPart::getTrkID(), m_debug, m_trkid2McTag, MCparticles, LCDG4Trk2McPart::SetMcPartTag(), and LCDMcPart::setTrkID(). Referenced by AssignTagToTrack(), and PreTracking().
00823 {
00824 assert(tag>0);
00825
00826 // set the tag in UserTrkInfo
00827 LCDG4Trk2McPart* trkInfo = (LCDG4Trk2McPart*)trk->GetUserInformation();
00828 assert(trkInfo);
00829
00830 // trk->trackID may be zero here, so better check it
00831 G4int trkid = trk->GetTrackID();
00832
00833 if(trkid==0) {
00834 // if trkid=0, set trkinfo tag to -tag (incomplete connection)
00835 trkInfo->SetMcPartTag(-tag);
00836 if(m_debug & 0x10) {
00837 G4cout<< "Negate tag (incomplete association): tag="
00838 << trkInfo->GetMcPartTag() << G4endl;
00839 }
00840 }
00841 else {
00842 // connection can be made complete
00843 trkInfo->SetMcPartTag(tag);
00844 // set trkid for this LCDMcPart -- tags start at 1, not zero
00845 LCDMcPart* mcp = MCparticles[tag-1];
00846 G4int trkid2 = mcp->getTrkID();
00847 if(trkid2)
00848 G4cout <<"AssignTagToTrack trkid2!=0: trkid(trac)="<< trkid
00849 <<", trkid(mcpart)="<< trkid2 << G4endl;
00850 assert( trkid2==0 || trkid2==trkid );
00851 mcp->setTrkID(trkid);
00852 // save tag in trkid->tag map
00853 if(m_debug & 0x10) {
00854 G4cout<< "AssignTag2Trk: Set trkid2McTag["<<trkid<<"]="<<tag<< G4endl;
00855 }
00856 m_trkid2McTag[trkid] = tag;
00857 }
00858 }
|
|
||||||||||||
|
Definition at line 863 of file LCDG4McPartManager.cc. References LCDMcPart::GetParticleID(). Referenced by PreAssignedDecay().
00867 {
00868 list<G4Track*>::const_iterator itrk;
00869 list<LCDMcPart*>::const_iterator imcp;
00870
00871 // debugging printout ==========
00872 // G4cout<<"\n*** ComplexList: sizes(trk,mcp)="<< trks.size() <<' '<< mcps.size() << G4endl;
00873 // DumpLists(trks,mcps);
00874 //===========
00875
00876 // loop over mcps to build the vector of distinct PDGIDs
00877 vector<int> pdgids;
00878 for(imcp=mcps.begin(); imcp!=mcps.end(); imcp++) {
00879 pdgids.push_back( (*imcp)->GetParticleID() );
00880 }
00881 // sort
00882 sort(pdgids.begin(), pdgids.end());
00883 // eliminate repeated ids
00884 vector<int>::iterator newend = unique(pdgids.begin(), pdgids.end());
00885 int newsize = newend-pdgids.begin();
00886
00887 // loop over unique pdgids
00888 vector<LCDMcPart*> mcps2;
00889 vector<G4Track*> trks2;
00890 for( int iid=0; iid<newsize; iid++ ) {
00891 // for each pdgid
00892 int idref = pdgids[iid];
00893
00894 // build subvector of LCDMcPart*
00895 for( imcp=mcps.begin(); imcp!=mcps.end(); imcp++) {
00896 LCDMcPart* pmcp = *imcp;
00897 if( pmcp->GetParticleID() == idref ) {
00898 mcps2.push_back(pmcp);
00899 }
00900 }
00901 assert( mcps2.size()>0 );
00902
00903 // build subvector of G4Track*
00904 for( itrk=trks.begin(); itrk!=trks.end(); itrk++) {
00905 G4Track* ptrk = *itrk;
00906 if( ptrk->GetDefinition()->GetPDGEncoding() == idref )
00907 trks2.push_back(ptrk);
00908 }
00909
00910 // find all possible matches
00911 while( trks2.size()>0 && mcps2.size()>0 ) {
00912 // G4cout<< "\nSubvectors:";
00913 // DumpVectors(trks2,mcps2);
00914
00915 // non trivial case
00916 if(mcps2.size()>1 || trks2.size()>1)
00917 FindSingleBestAssociation(trks2, mcps2);
00918
00919 AssignTagToTrack( trks2[0], mcps2[0] );
00920 trks.erase( find(trks.begin(), trks.end(), trks2[0]) );
00921 mcps.erase( find(mcps.begin(), mcps.end(), mcps2[0]) );
00922 trks2.erase( trks2.begin() );
00923 mcps2.erase( mcps2.begin() );
00924 }
00925
00926 // All possible matches have been found, there might be some trks or
00927 // mcps left. Reset both before going to next PDGID
00928 mcps2.clear();
00929 trks2.clear();
00930 }
00931 }
|
|
|
Definition at line 609 of file LCDG4McPartManager.cc. References lastProc. Referenced by IsDecayed(), IsLeft(), IsShowerProcess(), IsStopped(), and PostTracking().
00609 {
00610 return lastProc->GetProcessName().contains(proc);
00611 }
|
|
|
Definition at line 297 of file LCDG4McPartManager.cc. References LCDMcPart::Get4Momentum(), LCDMcPart::GetParticleID(), LCDMcPart::GetParticleTag(), GeV, m_debug, m_nmcprim, and MCparticles. Referenced by PreTracking().
00298 {
00299 LCDMcPart* result = NULL;
00300
00301 // trkids for track and parent
00302 G4int trkid = aTrack->GetTrackID();
00303 G4int pdgidref = aTrack->GetDefinition()->GetPDGEncoding();
00304
00305 // Look for this particle in the vector<LCDMcPart*>
00306 G4LorentzVector emomref = aTrack->GetDynamicParticle()->Get4Momentum();
00307 if(m_debug & 0x20) {
00308 G4int ptrkid = aTrack->GetParentID(); // always zero for input particles
00309 G4cout << " CheckPrimaryParticle called, MCparticles.size() = "
00310 << MCparticles.size()<<", trkID,parID="
00311 << trkid <<',' << ptrkid <<", idref ="<< pdgidref
00312 <<", Emomref="<< emomref/GeV << G4endl;
00313 }
00314
00315 // loop over primary MCparticles backwards
00316 vector<LCDMcPart*>::iterator iter = MCparticles.begin();
00317 LCDMcPart* pmcp;
00318 G4int imcp = 0;
00319 G4int pdgid = 0;
00320 G4LorentzVector emomvec;
00321 vector<G4double> diffs;
00322 vector<LCDMcPart*> mcps;
00323 for( ; imcp<m_nmcprim; imcp++, iter++) {
00324 pmcp = *iter;
00325 if(!pmcp) continue;
00326 // require same PDGID
00327 if( pmcp->GetParticleID() != pdgidref ) continue;
00328
00329 // build a list of differences on vector 3-momenta
00330 G4LorentzVector delta = pmcp->Get4Momentum() - emomref;
00331 diffs.push_back( delta.vect().mag2() );
00332 mcps.push_back( pmcp );
00333 }
00334
00335 // Return false if no matching LCDMcPart was found
00336 if(diffs.size()==0) return result=NULL;
00337
00338 // sort vector
00339 vector<G4double> sorted(diffs);
00340 sort(sorted.begin(), sorted.end());
00341 G4double dmin = sorted[0];
00342 unsigned int isave= find( diffs.begin(), diffs.end(), dmin ) - diffs.begin();
00343
00344 if(m_debug & 0x20) {
00345 G4double dmin2 = sorted.size()>1 ? sorted[1] : 9e10;
00346 G4cout <<"sorted: d(Min,Min2) =" << dmin <<' '<< dmin2
00347 <<", size="<< sorted.size()
00348 <<", id="<< mcps[isave]->GetParticleID() << G4endl;
00349 }
00350
00351 // criteria for finding a match
00352 if( dmin < 1e-6 ) {
00353 result = mcps[isave];
00354 pdgid = result->GetParticleID();
00355 assert( pdgid==pdgidref );
00356 }
00357
00358 if(m_debug & 0x20) {
00359 G4cout<<"LCDG4McPartManager::CheckPrimaryParticle:"
00360 <<" Primary trkid="<< trkid
00361 <<", tag="<< result->GetParticleTag()
00362 <<", pdgid="<< pdgid << G4endl;
00363 }
00364
00365 // // set particle starting position
00366 // G4cout<< "Set starting position: "<< aTrack->GetVertexPosition() << G4endl;
00367 // result->SetPosition( aTrack->GetVertexPosition() );
00368 // // set also parent ending position
00369 // LCDMcPart* parent = GetMcPartFromTag( result->GetParentTag() );
00370 // parent->SetTermPosition( aTrack->GetVertexPosition() );
00371
00372 return result;
00373 }
|
|
|
Definition at line 34 of file LCDG4McPartManager.hh. References m_nmcprim, m_trkid2dettype, m_trkid2McTag, MCparticles, and trkids. Referenced by LCDG4EventAction::EndOfEventAction(), and LCDG4readStdFile::MakeMcParts().
00034 {
00035 m_nmcprim = 0;
00036 m_trkid2McTag.clear();
00037 m_trkid2dettype.clear();
00038 for(unsigned int i=0; i<MCparticles.size(); ++i) {
00039 if(MCparticles[i]) {
00040 // G4cout<< "deleting MCparticles[" << i << "]\n";
00041 delete MCparticles[i];
00042 }
00043 }
00044 MCparticles.clear();
00045 trkids.clear();
00046 }
|
|
||||||||||||
|
Definition at line 1000 of file LCDG4McPartManager.cc.
01002 {
01003 list<G4Track*>::const_iterator itrk;
01004 list<LCDMcPart*>::const_iterator imcp;
01005
01006 G4cout << "\n List of mcps:";
01007 for(imcp=mcps.begin(); imcp!=mcps.end(); imcp++) {
01008 G4cout<<" ("<< (*imcp) <<')';
01009 if( *imcp ) G4cout<<' '<< (*imcp)->GetParticleID() <<',';
01010 }
01011 G4cout <<"\n List of trks:";
01012 for(itrk=trks.begin(); itrk!=trks.end(); itrk++) {
01013 G4cout<<' '<< (*itrk)->GetDefinition()->GetParticleName();
01014 }
01015 G4cout << G4endl;
01016 }
|
|
||||||||||||
|
Definition at line 1018 of file LCDG4McPartManager.cc.
01020 {
01021 vector<G4Track*>::const_iterator itrk;
01022 vector<LCDMcPart*>::const_iterator imcp;
01023
01024 G4cout << "\n List of mcps:";
01025 for(imcp=mcps.begin(); imcp!=mcps.end(); imcp++) {
01026 G4cout<<' '<< (*imcp)->GetParticleID();
01027 }
01028 G4cout <<"\n List of trks:";
01029 for(itrk=trks.begin(); itrk!=trks.end(); itrk++) {
01030 G4cout<<' '<< (*itrk)->GetDefinition()->GetParticleName();
01031 }
01032 G4cout << G4endl;
01033 }
|
|
|
Definition at line 1035 of file LCDG4McPartManager.cc. References LCDMcPart::GetDaughterTags(), MCparticles, and LCDMcPart::SetGenStatus(). Referenced by PostTracking().
01035 {
01036
01037 LCDMcPart* parmcp = MCparticles[m_mctag-1];
01038 if(!parmcp) {
01039 G4cout<<"EraseAllPreassDescends: parmcp=0: m_mctag="<< m_mctag<<G4endl;
01040 return;
01041 }
01042
01043 // reset parent generator status code to FINAL STATE
01044 int FinalState = 1;
01045 parmcp->SetGenStatus(FinalState);
01046
01047 // recursively erase all descendants
01048 G4int dau1,dau2;
01049 parmcp->GetDaughterTags(dau1,dau2);
01050 if(dau1>0) {
01051 for(int itag=dau1; itag<=dau2; itag++) {
01052 // erase grandchildren
01053 EraseAllPreassignedDescendants(itag);
01054 // erase this child
01055 delete MCparticles[itag-1];
01056 MCparticles[itag-1] = NULL;
01057 G4cout<< "*** Erasing tag="<< itag << G4endl;
01058 }
01059 }
01060 }
|
|
||||||||||||
|
Definition at line 937 of file LCDG4McPartManager.cc. References LCDMcPart::Get4Momentum().
00941 {
00942 // loop over McParts
00943 vector<G4Track*> trks3;
00944 vector<LCDMcPart*> mcps3;
00945 vector<G4double> diffs;
00946 for( unsigned int i=0; i<mcps2.size(); i++) {
00947 LCDMcPart* pmcp = mcps2[i];
00948 G4LorentzVector emomref = pmcp->Get4Momentum();
00949
00950 // loop over G4Tracks
00951 for( unsigned int j=0; j<trks2.size(); j++) {
00952 G4Track* ptrk = trks2[j];
00953 G4LorentzVector deltaPvec =
00954 ptrk->GetDynamicParticle()->Get4Momentum() - emomref;
00955
00956 // store deltaPs, mcps and trks
00957 diffs.push_back( deltaPvec.vect().mag2() );
00958 mcps3.push_back(mcps2[i]);
00959 trks3.push_back(trks2[j]);
00960 }
00961 }
00962
00963 // Smallest element in diffs is the best match in terms of mom components
00964 vector<G4double> sorted(diffs);
00965 sort(sorted.begin(), sorted.end());
00966 G4double dmin = sorted[0];
00967 unsigned int isave =
00968 find( diffs.begin(), diffs.end(), dmin ) - diffs.begin();
00969
00970 if(sorted[0]>1.e+3) {
00971 G4cout<<"SimpleList problem? dmin="<< sorted[0] << G4endl;
00972
00973 // Debugging printout
00974 for(unsigned int i=0; i<diffs.size(); i++) {
00975 G4cout<<"SimpleList: mcps,trks,diff="<< mcps3[i] <<' '<< trks3[i]
00976 <<' '<< diffs[i] << G4endl;
00977 }
00978 G4cout<< "Best match:"<< mcps3[isave]<<' '<< trks3[isave] <<' '
00979 << diffs[isave] << G4endl;
00980 }
00981
00982 // swap positions of first and best-matching elements
00983
00984 // mcps swap
00985 unsigned int bestpos =
00986 find(mcps2.begin(), mcps2.end(), mcps3[isave]) - mcps2.begin();
00987 if(bestpos!=0) {
00988 mcps2[bestpos] = mcps2[0];
00989 mcps2[0] = mcps3[isave];
00990 }
00991
00992 // trks swap
00993 bestpos = find(trks2.begin(), trks2.end(), trks3[isave]) - trks2.begin();
00994 if(bestpos!=0) {
00995 trks2[bestpos] = trks2[0];
00996 trks2[0] = trks3[isave];
00997 }
00998 }
|
|
||||||||||||||||||||
|
Definition at line 756 of file LCDG4McPartManager.cc. References LCDMcPart::GetParticleID().
00762 {
00763 for(int i=dau1; i<=dau2; i++) {
00764 LCDMcPart* test = MCparticles[i-1];
00765 if(test->GetParticleID()==pdgidref) {
00766 cands.push_back(test);
00767 }
00768 }
00769 }
|
|
|
Definition at line 48 of file LCDG4McPartManager.hh. Referenced by IsInteracted(), and LCDG4SteppingAction::UserSteppingAction().
00048 { return (*m_pdettype)[lvol]; }
|
|
|
Definition at line 57 of file LCDG4McPartManager.hh. References MCparticles. Referenced by GetMcPartFromTrkid(), MakeLCDMcPart(), and PostTracking().
00057 {
00058 return MCparticles[mctag-1];
00059 }
|
|
|
Definition at line 585 of file LCDG4McPartManager.cc. References GetMcPartFromTag(), IsInOutput(), and trkidToMctag(). Referenced by MakeLCDMcPart(), and PreTracking().
00585 {
00586 if( IsInOutput(trkid) )
00587 return GetMcPartFromTag( trkidToMctag( trkid ) );
00588 else
00589 return NULL;
00590 }
|
|
|
Definition at line 49 of file LCDG4McPartManager.hh. References MCparticles.
00049 { return MCparticles.size(); }
|
|
|
Definition at line 16 of file LCDG4McPartManager.hh. References _me. Referenced by LCDG4PrimaryGeneratorAction::GeneratePrimaries(), LCDG4LcioHelper::getCalHitLcio(), and LCDG4LcioHelper::getTrkHitLcio().
00016 { return _me; }
|
|
|
Definition at line 152 of file LCDG4McPartManager.hh. References m_showerFlag. Referenced by LCDG4EventAction::EndOfEventAction(), and LCDG4SteppingAction::UserSteppingAction().
00153 {
00154 return m_showerFlag.find(trkid)->second;
00155 }
|
|
|
Definition at line 642 of file LCDG4McPartManager.cc. References CheckLastProcess(). Referenced by PostTracking().
00642 {
00643 return CheckLastProcess( G4String("Decay") );
00644 }
|
|
|
Definition at line 605 of file LCDG4McPartManager.cc. References m_trkid. Referenced by GetMcPartFromTrkid(), PostTracking(), PreTracking(), and SetCalorimeterEntrancePoint().
00605 {
00606 return IsInOutput(m_trkid);
00607 }
|
|
|
Definition at line 595 of file LCDG4McPartManager.cc. References LCDMcPart::getTrkID(), MCparticles, and trkidToMctag(). Referenced by LCDG4SteppingAction::UserSteppingAction().
00595 {
00596 LCDMcPart* pMcPart = 0;
00597 G4int tag = trkidToMctag(trkid);
00598 if(tag<=0) G4cout<< "IsInOutput: trkid="<< trkid<< ", tag="<< tag << G4endl;
00599 if(tag>0) pMcPart = MCparticles[tag-1];
00600 if( pMcPart ) return ( pMcPart->getTrkID() == trkid );
00601 else return false;
00602 }
|
|
|
Definition at line 662 of file LCDG4McPartManager.cc. References GetDetType(), IsShowerProcess(), and postStep. Referenced by IsShowered(), and PostTracking().
00662 {
00663 // always check for a showering process
00664 if( !IsShowerProcess() ) return false;
00665
00666 G4VPhysicalVolume* physVol = postStep->GetPhysicalVolume();
00667 G4LogicalVolume* lvol=0;
00668 if(physVol) lvol = physVol->GetLogicalVolume();
00669 G4int dtype = GetDetType(lvol);
00670 if( dtype >= 10 && dtype <= 20 ) { // inside calorimeters or muon system
00671 // to be flagged as showered, not interacted
00672 return false;
00673 }
00674 else {
00675 // showering process outside calorimeters, keep particle as INTERACTED
00676 return true;
00677 }
00678 }
|
|
|
Definition at line 657 of file LCDG4McPartManager.cc. References CheckLastProcess(), and curTrack. Referenced by PostTracking().
00657 {
00658 double kinE = curTrack->GetKineticEnergy();
00659 return ( CheckLastProcess( G4String("Transportation") ) && kinE>0 );
00660 }
|
|
|
Definition at line 681 of file LCDG4McPartManager.cc. References curTrack, IsInteracted(), IsShowerProcess(), m_debug, m_mctag, m_showerFlag, m_trkid, and MCparticles. Referenced by PostTracking().
00681 {
00682
00683 G4int parTrkId = curTrack->GetParentID();
00684 if(m_debug&0x80) {
00685 G4cout << "IsShowered(): trkid,parTrkId="<< m_trkid <<' '<< parTrkId
00686 <<", parent ShowerFlag="<< m_showerFlag[parTrkId] << G4endl;
00687 }
00688
00689 // catch most obvious cases first
00690 if( m_showerFlag[parTrkId]>1 ) {
00691 // definitely a shower!
00692 // keep track of particle generations inside showers
00693 m_showerFlag[m_trkid] = m_showerFlag[parTrkId] + 1;
00694 if(m_debug&0x80) G4cout << "Showered, showerFlag set to "<< m_showerFlag[m_trkid] << G4endl;
00695 return true;
00696 }
00697
00698
00699 /*
00700 Now for most tricky cases:
00701
00702 Shower initiators (showerFlag=1) are those who enter the
00703 calorimeters, as opposed to shower secondaries (showerFlag>1),
00704 which are produced inside the calorimeters.
00705
00706 Some initiators may have non-shower children, which are produced
00707 before the calorimeters and may become shower initiators themselves.
00708
00709 So the trick here is to separate and identify all these possibilities.
00710 */
00711 m_showerFlag[m_trkid]=0;
00712 bool originator = IsShowerProcess() && !IsInteracted();
00713 // G4cout <<"More checks: IsShowerProc,IsInteracted = " << IsShowerProcess()
00714 // <<' '<< IsInteracted() << G4endl;
00715
00716 if( m_showerFlag[parTrkId]==0 ) {
00717 // parent was not part of a shower, so return true only if
00718 // child is an originator
00719 if( originator ) {
00720 // child has showered in calorimeters
00721 m_showerFlag[m_trkid] = 1;
00722 return true;
00723 }
00724 }
00725
00726 else if(m_showerFlag[parTrkId]==1) {
00727 // parent started a shower, but child may have been produced
00728 // before the calorimeters. More checks are needed
00729 if( MCparticles[m_mctag-1]->getTrkID() != m_trkid ) {
00730 // no LCDMcPart, so child is just a shower secondary
00731 m_showerFlag[m_trkid] = m_showerFlag[parTrkId] + 1;
00732 if(m_debug&0x80) G4cout <<"Just a shower secondary, not saved"<< G4endl;
00733 return true;
00734 }
00735 else {
00736 // it has its own LCDMcPart, but it may still be an originator
00737 if( originator ) {
00738 // child has showered in calorimeters
00739 m_showerFlag[m_trkid] = 1;
00740 if(m_debug&0x80) G4cout <<"Both parent and child are originators."<< G4endl;
00741 return true;
00742 }
00743 }
00744 }
00745 else {
00746 G4cout << "***** LCDG4McPartManager error, please investigate!"<< G4endl;
00747 exit(1);
00748 }
00749
00750 if(m_debug&0x80) G4cout<<" Not a shower particle!" << G4endl;
00751 return false;
00752 }
|
|
|
Definition at line 613 of file LCDG4McPartManager.cc. References CheckLastProcess(), and dpart. Referenced by IsInteracted(), and IsShowered().
00613 {
00614 if( CheckLastProcess( G4String("Inelastic") ) ) return true;
00615 // When pions stop, they are absorbed by a nucleus producing
00616 // several byproducts like neutrons, protons, deuterons, tritons, etc
00617 if( CheckLastProcess( G4String("AbsorptionAtRest") ) ) return true;
00618
00619 // EM interaction before cal
00620 // gamma
00621 G4int pdgid = dpart->GetPDGEncoding();
00622 if( pdgid==22 ) {
00623 // for now all gamma processes are considered showering
00624 return true;
00625 }
00626
00627 // electron
00628 else if( abs(pdgid)==11 ) {
00629 // for now all e+/e- processes are considered showering
00630 return true;
00631 }
00632
00633 else if( abs(pdgid)==111 ) {
00634 // pizero
00635 // pizero decays are considered showering
00636 if( CheckLastProcess("Decay") ) return true;
00637 }
00638
00639 return false;
00640 }
|
|
|
Definition at line 646 of file LCDG4McPartManager.cc. References CheckLastProcess(), and curTrack. Referenced by PostTracking().
00646 {
00647 double kinE = curTrack->GetKineticEnergy();
00648 if(kinE==0) {
00649 // G4cout << "E=0: lastproc="<< lastProc->GetProcessName() << G4endl;
00650 // inelastics are included in interacted or showered
00651 if( CheckLastProcess( G4String("Inelastic") ) ) return false;
00652 return true;
00653 }
00654 return false;
00655 }
|
|
|
Definition at line 375 of file LCDG4McPartManager.cc. References dpart, LCDMcPart::Get4Momentum(), LCDMcPart::GetGenStatus(), GetMcPartFromTag(), GetMcPartFromTrkid(), LCDG4Trk2McPart::GetParent4Momentum(), LCDMcPart::GetParentTag(), LCDMcPart::GetParticleID(), LCDMcPart::GetParticleTag(), LCDMcPart::GetTermPosition(), LCDMcPart::getTrkID(), m_debug, m_mctag, m_trkid, m_trkid2McTag, MCparticles, LCDMcPart::Set4Momentum(), LCDMcPart::SetChargeFromPid(), LCDMcPart::SetG4Status(), LCDMcPart::SetGenStatus(), LCDG4Trk2McPart::SetMcPartTag(), LCDMcPart::SetParentTag(), LCDMcPart::SetParticleID(), LCDMcPart::SetParticleTag(), LCDMcPart::SetPosition(), LCDMcPart::setTrkID(), and trkidToMctag(). Referenced by LCDG4SteppingAction::UserSteppingAction().
00376 {
00377 G4int trkid = aTrack->GetTrackID();
00378 assert(trkid==m_trkid);
00379
00380 // if parent does not have its own LCDMcPart, bail out
00381 G4int ptrkid = aTrack->GetParentID();
00382 LCDMcPart* parMcPart = GetMcPartFromTrkid(ptrkid);
00383 if( !parMcPart ) {
00384 if(m_debug & 0x40) {
00385 G4cout<<"MakeLCDMcPart: denial: No LCDMcPart for parent" << G4endl;
00386 }
00387 return;
00388 }
00389
00390 // If parent decay was preassigned by generator, the daughter's
00391 // LCDMcPart already exists, and daughter tag was already found
00392 // at parent's PostTracking()
00393 G4int parStat = parMcPart->GetGenStatus();
00394 if( parStat==2 || parStat==3 ) {
00395 // make sure tag is already assigned here...
00396 G4int tag = trkidToMctag(trkid);
00397
00398 if(tag>0) {
00399 // some printout
00400 LCDMcPart* mcp = MCparticles[tag-1];
00401 if(m_debug & 0x40) {
00402 G4cout<<"Using existing LCDMcPart: tag="<< tag
00403 <<", pdgid="<< mcp->GetParticleID()
00404 <<", parTag="<< parMcPart->GetParticleTag()
00405 <<", genStat="<< mcp->GetGenStatus() << G4endl;
00406 }
00407
00408 // Update momentum of preassigned decay products
00409 HepLorentzVector& mom = mcp->Get4Momentum();
00410 mom.setVect( aTrack->GetStep()->GetPreStepPoint()->GetMomentum() );
00411 mom.setE( aTrack->GetStep()->GetPreStepPoint()->GetTotalEnergy() );
00412 return;
00413 }
00414
00415 else {
00416 // This should never happen, as neg tags become positive in PreTracking
00417 assert(false);
00418 }
00419 }
00420
00421 //****** Split parent G4Track into two McParts ********
00422 // If produced by an interaction (not a decay)
00423 const G4VProcess* proc = aTrack->GetCreatorProcess();
00424 if( (!proc->GetProcessName().contains("Decay")) ) {
00425 /* At this point, the particle being processed (DAU) has been produced
00426 * from an non-destructive interaction of its parent (PAR) in the
00427 * tracker volume.
00428 * In order to save the production point of DAU, one has to split PAR
00429 * into two McParts (PAR->PAR2+DAU+X) at that point, so that the
00430 * production point of DAU and PAR2 is the endpoint of PAR. Other
00431 * daughter particles (X) may also be produced in the interaction.
00432 */
00433 // Check endpoint of PAR. If it is the same as starting point of
00434 // current track, that means PAR2 was already created previously,
00435 // so no need to create another one...
00436 if( parMcPart->GetTermPosition() == aTrack->GetVertexPosition() ) {
00437 if(m_debug & 0x40) {
00438 G4cout<< " PAR was already split at this very same point: "
00439 << parMcPart->GetTermPosition()
00440 <<", no need to split it again."<< G4endl;
00441 }
00442 }
00443 else {
00444 // create a new McPart for PAR2, so the starting point is saved
00445 int par2Tag = MCparticles.size()+1;
00446 LCDMcPart* par2Mcp
00447 = new LCDMcPart( par2Tag, parMcPart, aTrack->GetVertexPosition() );
00448
00449 // PAR McPart's children to be inherited by PAR2 McPart
00450 G4int oldParentTag = parMcPart->GetParticleTag();
00451 for(int i=1; i<par2Tag; i++) { // par2Tag excluded, of course!
00452 LCDMcPart* mcp = GetMcPartFromTag(i);
00453 // make sure mcp is valid, as some McParts may have been erased
00454 if( mcp && mcp->GetParentTag() == oldParentTag ) {
00455 if(m_debug & 0x40) {
00456 G4cout << "Resetting parent tags: "<< oldParentTag <<" -> "<< par2Tag
00457 <<" for tag="<< i << G4endl;
00458 }
00459 mcp->SetParentTag( par2Tag );
00460 }
00461 }
00462
00463 // 4-momentum of PAR2 McPart after interaction
00464 // Makoto: save momentum in daughter's TrackInfo, and use it here
00465 LCDG4Trk2McPart* secInfo = (LCDG4Trk2McPart*)aTrack->GetUserInformation();
00466 const HepLorentzVector& emom = secInfo->GetParent4Momentum();
00467 par2Mcp->Set4Momentum( emom );
00468
00469 // save McPart* into list
00470 if(m_debug & 0x40) {
00471 G4cout << "Creating new parent McPart: tag="<< par2Tag
00472 <<", emom="<< emom << G4endl;
00473 }
00474 MCparticles.push_back( par2Mcp );
00475 } // else
00476 }
00477 // Next, resume processing DAU
00478 //********************************
00479
00480 // create a new LCDMcPart
00481 LCDMcPart* mc = new LCDMcPart();
00482 mc->SetParticleTag( MCparticles.size() + 1 );
00483 // particles created by Geant4, GenStatus=4
00484 mc->SetGenStatus(4);
00485
00486 if(mc->getTrkID()>0) {
00487 G4cout<<"problem: TrkID already set!! tag="<< mc->GetParticleTag()
00488 <<", old=" << mc->getTrkID() <<", new="<< trkid << G4endl;
00489 }
00490 mc->setTrkID(trkid);
00491
00492 G4int newTag = mc->GetParticleTag();
00493 // G4cout<< "MakeLCDMcPart: Set trkid2McTag["<<trkid<<"]="<<newTag<< G4endl;
00494 m_trkid2McTag[trkid] = newTag;
00495 m_mctag = newTag;
00496
00497 // Set G4VUserTrackInfo so that SensitiveDetectors can see it
00498 LCDG4Trk2McPart* TrkInfo = (LCDG4Trk2McPart*)(aTrack->GetUserInformation());
00499 TrkInfo->SetMcPartTag(newTag);
00500 if(m_debug & 0x40) {
00501 G4cout << " Setting UserTrkInfo: trkid,newTag = "<< aTrack->GetTrackID()
00502 <<' '<< newTag << G4endl;
00503 }
00504
00505 //((LCDG4Trk2McPart*)aTrack->GetUserInformation())->SetMcPartTag(newTag);
00506 G4ThreeVector pos = aTrack->GetVertexPosition();
00507 G4ThreeVector mom = aTrack->GetVertexMomentumDirection();
00508 G4double Ekin = aTrack->GetVertexKineticEnergy();
00509 // sets momentum magnitude
00510 if(abs(mom.mag() - 1.0) < 1e-4) {
00511 G4double mass = aTrack->GetDefinition()->GetPDGMass();
00512 G4double pmag = sqrt(Ekin*Ekin + 2*mass*Ekin);
00513 // mom.setMag(Ekin);
00514 mom.setMag(pmag);
00515 }
00516 else {
00517 G4cout<< "Problem: mom.mag() != 1?!?"<<G4endl;
00518 }
00519
00520 Hep3Vector vpos(pos.x(),pos.y(),pos.z());
00521 HepLorentzVector vmom4(mom.x(),mom.y(),mom.z(),
00522 aTrack->GetTotalEnergy());
00523
00524 G4ParticleDefinition* dpart = aTrack->GetDefinition();
00525 G4int pdgid = dpart->GetPDGEncoding();
00526
00527 mc->SetG4Status(0);
00528 mc->SetParticleID(pdgid);
00529 mc->SetChargeFromPid(pdgid);
00530 mc->SetPosition(vpos);
00531 mc->Set4Momentum(vmom4);
00532
00533 // debugging printout
00534 if(m_debug & 0x40) {
00535 G4cout<<"Creating new LCDMcPart: tag="<< newTag
00536 <<", pdgid="<< mc->GetParticleID()
00537 <<", parTag="<< parMcPart->GetParticleTag()
00538 <<", genStat="<< mc->GetGenStatus() << G4endl;
00539 }
00540
00541 // add to list
00542 if( newTag==(int)MCparticles.size()+1 ) {
00543 // note: parentage is only kept at daughters, as in the current scheme,
00544 // parents can only keep track of adjacent-tagged daughters
00545 mc->SetParentTag( parMcPart->GetParticleTag() );
00546 MCparticles.push_back(mc);
00547 }
00548 }
|
|
||||||||||||
|
Definition at line 176 of file LCDG4McPartManager.cc. References CheckLastProcess(), dpart, EraseAllPreassignedDescendants(), GetMcPartFromTag(), LCDG4Trk2McPart::GetMcPartTag(), LCDMcPart::GetParentTag(), LCDMcPart::GetPosition(), LCDMcPart::GetTermPosition(), IsDecayed(), IsInOutput(), IsInteracted(), IsLeft(), IsShowered(), IsStopped(), lastProc, m_debug, m_mctag, m_showerFlag, m_trkid, MCparticles, postStep, PreAssignedDecay(), LCDMcPart::SetG4Status(), LCDMcPart::SetPosition(), and LCDMcPart::SetTermPosition(). Referenced by LCDG4TrackingAction::PostUserTrackingAction().
00178 {
00179 // get tag and trkid for this track
00180 LCDG4Trk2McPart* trkInfo = (LCDG4Trk2McPart*)aTrack->GetUserInformation();
00181 assert( m_mctag == trkInfo->GetMcPartTag() );
00182
00183 // Find out what happened at very last step
00184 dpart = aTrack->GetDefinition();
00185 postStep = aTrack->GetStep()->GetPostStepPoint();
00186 lastProc = postStep->GetProcessDefinedStep();
00187
00188 // Deal with all possibilities
00189
00190 // set shower particle tag in IsShowered()
00191 m_showerFlag[m_trkid]=0;
00192 IsShowered();
00193
00194 // Save startPoint,endPoint if this particle has its own LCDMcPart
00195 const G4ThreeVector& startPoint = aTrack->GetVertexPosition();
00196 const G4ThreeVector& endPoint = postStep->GetPosition();
00197 if( IsInOutput() ) {
00198 LCDMcPart* pMcPart = MCparticles[m_mctag-1];
00199 pMcPart->SetPosition(startPoint);
00200 pMcPart->SetTermPosition(endPoint);
00201 // Make sure parent endpoint is the same as daughter starting point
00202 int parentTag = pMcPart->GetParentTag();
00203 if(parentTag>0) {
00204 LCDMcPart* parentMcPart = GetMcPartFromTag( parentTag );
00205 if( parentMcPart->GetTermPosition() != pMcPart->GetPosition() ) {
00206 if(m_debug&0x80) {
00207 G4cout<< "Resetting parent endPoint: tag="<< pMcPart->GetParentTag()
00208 << ", from "
00209 << parentMcPart->GetTermPosition()
00210 <<" to "<< pMcPart->GetPosition() << G4endl;
00211 }
00212 parentMcPart->SetTermPosition(pMcPart->GetPosition());
00213 }
00214 }
00215
00216 // classify track and assign Geant4 status
00217 if( IsShowered() ) {
00218 if(m_debug&0x80) G4cout<<" PostTrk: Showered: "<< G4endl;
00219 pMcPart->SetG4Status(9);
00220 }
00221 else if( IsDecayed() ) {
00222 if(m_debug&0x80) G4cout<<" PostTrk: Decay: "<< G4endl;
00223 pMcPart->SetG4Status(1);
00224 }
00225 else if( IsInteracted() ) {
00226 if(m_debug&0x80) G4cout<<" PostTrk: Interacted: "<< G4endl;
00227 pMcPart->SetG4Status(2);
00228 }
00229 else if( IsLeft() ) {
00230 if(m_debug&0x80) G4cout<<" PostTrk: Left: "<< G4endl;
00231 pMcPart->SetG4Status(3);
00232 }
00233 else if( IsStopped() ) {
00234 if(m_debug&0x80) G4cout<<" PostTrk: Stopped: "<< G4endl;
00235 pMcPart->SetG4Status(4);
00236 }
00237 else {
00238 // should never reach this point
00239 assert(false);
00240 }
00241 }
00242
00243
00244 // loop over secondaries
00245 G4TrackVector* secTrkV = aTrackMgr->GimmeSecondaries();
00246 G4Track *trk = 0;
00247 if(m_debug&0x80) {
00248 G4cout<<"PostTrk: # secondaries = "<< secTrkV->size() <<G4endl;
00249 }
00250 for(unsigned int isectrk = 0; isectrk < secTrkV->size(); isectrk++) {
00251 trk = (*secTrkV)[isectrk];
00252 // set m_trkid2McTag map so that shower secondaries' tags point to
00253 // the same tag as its parent tag
00254 LCDG4Trk2McPart* trkInfo = (LCDG4Trk2McPart*)trk->GetUserInformation();
00255 if(trkInfo == 0) {
00256 trk->SetUserInformation(new LCDG4Trk2McPart(m_mctag));
00257 }
00258
00259 if(m_debug&0x80) {
00260 // trk->GetTrackID() returns zero at this point
00261 if(isectrk==0) G4cout<<"PostTrk: secondaries= ";
00262 G4cout<< trk->GetDefinition()->GetParticleName();
00263 if( isectrk == secTrkV->size()-1) G4cout << G4endl;
00264 else G4cout <<", ";
00265 }
00266 }
00267 //printf("LCDG4MCP::Postracking--m_mctag=%d\n",m_mctag);
00268
00269 // Check preassigned decay -- if so, tags in daughter's trkInfos
00270 // will be reset
00271 const G4DecayProducts* pKids =
00272 aTrack->GetDynamicParticle()->GetPreAssignedDecayProducts();
00273
00274 if( pKids ) {
00275 if(m_debug&0x100) {
00276 G4cout<< "*************** Check preassigned decays ********" << G4endl;
00277 pKids->DumpInfo();
00278 }
00279 if( CheckLastProcess( G4String("Decay") ) ) {
00280 // try to associate secondaries to LCDMcParts
00281 PreAssignedDecay(secTrkV);
00282 }
00283 else if( CheckLastProcess( G4String("Inelastic") ) ) {
00284 // an inelastic interaction happens before the preassigned decay
00285 // erase the LCDMcParts for the children of the preassigned decay
00286 EraseAllPreassignedDescendants(m_mctag);
00287 }
00288 }
00289
00290 // finished processing for this track
00291 m_trkid = 0;
00292 }
|
|
|
Definition at line 776 of file LCDG4McPartManager.cc. References AssociateFromComplexLists(), m_mctag, and MCparticles. Referenced by PostTracking().
00776 {
00777 G4Track *trk = 0;
00778
00779 // build list of G4Track secondaries
00780 list<G4Track*> secTrks;
00781
00782 for(unsigned int i=0; i<secTrkV->size(); i++) {
00783 trk = (*secTrkV)[i];
00784 // make sure we don't pick any other secondaries than
00785 // those from preassigned decays, which have associated G4PrimaryParticles
00786 bool isPrimary=(trk->GetDynamicParticle()->GetPrimaryParticle() != NULL);
00787 if( isPrimary ) secTrks.push_back(trk);
00788 }
00789
00790 // remember that m_trkid,m_mctag refer to the parent!
00791 list<LCDMcPart*> mcParts;
00792 mcParts.push_back( MCparticles[m_mctag-1] );
00793
00794 while(mcParts.size()>0) {
00795
00796 // replace particles in the list by its immediate daughters
00797 list<LCDMcPart*> moms(mcParts);
00798 mcParts.clear();
00799 for(list<LCDMcPart*>::iterator
00800 itmcp=moms.begin(); itmcp!=moms.end(); itmcp++) {
00801
00802 G4int dau1,dau2;
00803 (*itmcp)->GetDaughterTags( dau1, dau2 );
00804 if(dau1>0) {
00805 for(int i=dau1; i<=dau2; i++) {
00806 LCDMcPart* mcp = MCparticles[i-1];
00807 mcParts.push_back( mcp );
00808 }
00809 }
00810 }
00811
00812 // Make associations between G4Tracks and LCDMcParts
00813 AssociateFromComplexLists( secTrks, mcParts );
00814 }
00815
00816 //printf("LCDG4MCP::Postracking--m_mctag=%d\n",m_mctag);
00817 }
|
|
|
Definition at line 70 of file LCDG4McPartManager.cc. References AssignTagToTrack(), CheckPrimaryParticle(), curTrack, LCDMcPart::GetGenStatus(), GetMcPartFromTrkid(), LCDG4Trk2McPart::GetMcPartTag(), LCDMcPart::GetParticleID(), LCDMcPart::GetParticleTag(), GeV, IsInOutput(), m_debug, m_mctag, m_nmcprim, m_trkid, m_trkid2McTag, and MCparticles. Referenced by LCDG4TrackingAction::PreUserTrackingAction().
00070 {
00071 // set member data for track id being processed
00072 m_trkid = aTrack->GetTrackID();
00073 if(m_debug & 0x10) {
00074 G4ThreeVector pvec = aTrack->GetDynamicParticle()->GetMomentum();
00075 G4cout<< "PreTrking: trkid=" << m_trkid
00076 << ", id="<< aTrack->GetDefinition()->GetParticleName()
00077 << ", parID="<< aTrack->GetParentID()
00078 <<", E="<< aTrack->GetDynamicParticle()->GetTotalEnergy()/GeV
00079 // <<", pvec=("<< pvec.x()/GeV <<", "<< pvec.y()/GeV <<", "<< pvec.z()/GeV <<')'
00080 << G4endl;
00081 }
00082
00083 // m_nmcprim is cleared at EndOfEventAction
00084 if(m_nmcprim == 0) {
00085 // initialize m_nmcprim for each event
00086 m_nmcprim = MCparticles.size();
00087 }
00088
00089 // creates TrkInfo with tag=-1 if non-existing
00090 curTrack = const_cast<G4Track*>(aTrack);
00091 if(aTrack->GetUserInformation() == 0) {
00092 if(m_debug&0x10) {
00093 G4cout<<" Create invalid TrkInfo (tag=-1) for this track!"<< G4endl;
00094 }
00095 curTrack->SetUserInformation( new LCDG4Trk2McPart(-1) );
00096 }
00097
00098 // If no G4parent, it certainly comes from input file.
00099 // Find its LCDMcPart and save its tag
00100 LCDMcPart* mcp = NULL;
00101 G4int parTrkid = aTrack->GetParentID();
00102 if(parTrkid==0) {
00103 mcp = CheckPrimaryParticle(aTrack);
00104 assert( mcp );
00105
00106 // connect LCDMcPart <--> G4Track
00107 if(mcp) AssignTagToTrack( aTrack, mcp );
00108
00109 // debugging printout
00110 if(m_debug & 0x10) {
00111 G4cout<<"primary: <"<< m_trkid <<','<< mcp->GetParticleTag() <<'>'
00112 <<", pdgid="<< mcp->GetParticleID()
00113 <<", trkid2mctag.size="<< m_trkid2McTag.size()
00114 << G4endl;
00115 }
00116 } // if( parentTrackID == 0 )
00117
00118 else { // It might come from input file (preassigned decays) or not
00119
00120 // does immediate parent have an LCDMcPart?
00121 if( IsInOutput(parTrkid) ) { // yes it does
00122 // Is parent decay preassigned?
00123 LCDMcPart* mcpPar = GetMcPartFromTrkid(parTrkid);
00124 G4int parStat = mcpPar->GetGenStatus();
00125 if( parStat==2 || parStat==3 ) { // yes
00126
00127 // Check if tag assigned from PostTracking of parent
00128 // (negative tag stored in trkInfo)
00129 LCDG4Trk2McPart* trkInfo = (LCDG4Trk2McPart*)aTrack->GetUserInformation();
00130 G4int tag = trkInfo->GetMcPartTag();
00131 if( tag<0 ) {
00132 // set to positive tag and complete G4Track <--> LCDMcPart connection
00133 tag *= -1;
00134
00135 // Some invalid trackinfo have been created elsewhere with tag=-1,
00136 // we don't want to get those here...
00137 assert(tag!=1);
00138
00139 AssignTagToTrack( aTrack, tag );
00140
00141 // debugging printout
00142 if(m_debug & 0x10) {
00143 G4cout<<"reusing: <"<< m_trkid <<','<< tag <<'>'
00144 <<", pdgid="<< MCparticles[tag-1]->GetParticleID()
00145 <<", trkid2mctag.size="<< m_trkid2McTag.size()
00146 << G4endl;
00147 }
00148 }
00149
00150 else {
00151 // Tracks showing up here are secondaries from a GenStatus=2 parent
00152 // (preassigned decays), but other than its preassigned decay
00153 // products.
00154 // These secondaries are usually from EM interactions before the
00155 // calorimeters, so they don't get associated to any preexisting
00156 // McPart here, and a new one might be created at its first step.
00157 }
00158
00159 } // endif(genStatus==2)
00160 } // endif(parent has its own LCDMcPart)
00161 } // endif(G4ParentID()!=0)
00162
00163 LCDG4Trk2McPart* trkInfo = (LCDG4Trk2McPart*)aTrack->GetUserInformation();
00164 m_mctag = trkInfo->GetMcPartTag();
00165 // This tag may be invalid at this point (-1)
00166
00167 // set trkid to tag map for this track, if not done yet
00168 if(m_trkid2McTag[m_trkid] == 0) {
00169 // G4cout<<"PreTrk: Setting trkid2McTag["<<m_trkid<<"]="<<m_mctag<< G4endl;
00170 m_trkid2McTag[m_trkid] = m_mctag;
00171 }
00172 }
|
|
|
Definition at line 550 of file LCDG4McPartManager.cc. References LCDMcPart::Get4Momentum(), LCDMcPart::GetChargeFromPid(), LCDMcPart::GetG4Status(), LCDMcPart::GetGenStatus(), LCDMcPart::GetParentTag(), LCDMcPart::GetParticleID(), LCDMcPart::GetPosition(), and MCparticles.
00551 {
00552 // vector<LCDMcPart*>::const_iterator part;
00553 // for(part = MCparticles.begin(); part != MCparticles.end(); part++) {
00554 for(unsigned int i=0; i<MCparticles.size(); i++) {
00555 LCDMcPart *mcp = MCparticles[i];
00556 G4cout << "GenStatus:" << mcp->GetGenStatus() << G4endl;
00557 G4cout << "G4Status:" << mcp->GetG4Status() << G4endl;
00558 G4cout << "PDGID:" << mcp->GetParticleID() << G4endl;
00559 G4cout << "Charge:" << mcp->GetChargeFromPid() << G4endl;
00560 G4cout << "Position:" << mcp->GetPosition() << G4endl;
00561 G4cout << "Momentum:" << mcp->Get4Momentum() << G4endl;
00562 G4cout << "Parent Index->" << mcp->GetParentTag() << G4endl;
00563 G4cout << G4endl;
00564 }
00565 }
|
|
|
Definition at line 567 of file LCDG4McPartManager.cc. References m_trkid2McTag.
00568 {
00569 std::map<G4int,G4int>::const_iterator iter = m_trkid2McTag.begin();
00570 for (; iter != m_trkid2McTag.end(); iter++)
00571 {
00572 G4cout<<"trkid, mcid = <"<< iter->first <<','<< iter->second <<">"<<G4endl;
00573 }
00574 }
|
|
||||||||||||
|
Definition at line 58 of file LCDG4McPartManager.cc. References IsInOutput(), m_mctag, m_trkid, MCparticles, LCDMcPart::SetCalorimeterEntranceMomentum(), and LCDMcPart::SetCalorimeterEntrancePoint(). Referenced by LCDG4SteppingAction::UserSteppingAction().
00059 {
00060 if( IsInOutput(m_trkid) ) {
00061 LCDMcPart* mcp = MCparticles[ m_mctag-1 ];
00062 mcp->SetCalorimeterEntrancePoint(pos);
00063 mcp->SetCalorimeterEntranceMomentum(mom);
00064 }
00065 }
|
|
|
Definition at line 22 of file LCDG4McPartManager.hh. References m_debug. Referenced by LCDG4EventAction::BeginOfEventAction().
00022 {
00023 G4cout << "***** Setting debug flag to "<< dbflg << G4endl;
00024 m_debug = dbflg;
00025 }
|
|
|
Definition at line 21 of file LCDG4McPartManager.hh. References m_pdettype.
00021 { m_pdettype = m; }
|
|
|
Definition at line 53 of file LCDG4McPartManager.hh. References m_trkid2McTag. Referenced by LCDG4EventAction::EndOfEventAction(), LCDG4LcioHelper::getCalHitLcio(), GetMcPartFromTrkid(), LCDG4LcioHelper::getTrkHitLcio(), IsInOutput(), and MakeLCDMcPart().
00053 {
00054 return m_trkid2McTag.find(trkid)->second;
00055 }
|
|
|
Definition at line 38 of file LCDG4McPartManager.cc. Referenced by GetPointer(), and LCDG4McPartManager(). |
|
|
Definition at line 128 of file LCDG4McPartManager.hh. Referenced by IsLeft(), IsShowered(), IsStopped(), and PreTracking(). |
|
|
Definition at line 129 of file LCDG4McPartManager.hh. Referenced by IsShowerProcess(), MakeLCDMcPart(), and PostTracking(). |
|
|
Definition at line 131 of file LCDG4McPartManager.hh. Referenced by CheckLastProcess(), and PostTracking(). |
|
|
Definition at line 123 of file LCDG4McPartManager.hh. Referenced by AssignTagToTrack(), CheckPrimaryParticle(), IsShowered(), MakeLCDMcPart(), PostTracking(), PreTracking(), and SetDebugFlag(). |
|
|
Definition at line 127 of file LCDG4McPartManager.hh. Referenced by IsShowered(), MakeLCDMcPart(), PostTracking(), PreAssignedDecay(), PreTracking(), and SetCalorimeterEntrancePoint(). |
|
|
Definition at line 122 of file LCDG4McPartManager.hh. Referenced by CheckPrimaryParticle(), Clear(), and PreTracking(). |
|
|
Definition at line 144 of file LCDG4McPartManager.hh. Referenced by SetDetTypeMap(). |
|
|
Definition at line 147 of file LCDG4McPartManager.hh. Referenced by GetShowerFlag(), IsShowered(), and PostTracking(). |
|
|
Definition at line 125 of file LCDG4McPartManager.hh. Referenced by IsInOutput(), IsShowered(), MakeLCDMcPart(), PostTracking(), PreTracking(), and SetCalorimeterEntrancePoint(). |
|
|
Definition at line 146 of file LCDG4McPartManager.hh. Referenced by Clear(), and LCDG4McPartManager(). |
|
|
Definition at line 145 of file LCDG4McPartManager.hh. Referenced by AssignTagToTrack(), Clear(), LCDG4McPartManager(), MakeLCDMcPart(), PreTracking(), PrintTrkid2MctagMap(), and trkidToMctag(). |
|
|
|
Definition at line 130 of file LCDG4McPartManager.hh. Referenced by IsInteracted(), and PostTracking(). |
|
|
Definition at line 85 of file LCDG4McPartManager.hh. Referenced by Clear(). |
1.3.4