Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/parton_string/hadronization/src/G4ExcitedStringDecay.cc

    r1337 r1340  
    6161}
    6262
    63 G4bool G4ExcitedStringDecay::
    64 EnergyAndMomentumCorrector(G4KineticTrackVector* Output, G4LorentzVector& TotalCollisionMom)   
     63G4KineticTrackVector *G4ExcitedStringDecay::FragmentString
     64                                (const G4ExcitedString &theString)
     65{
     66        if ( theStringDecay == NULL )
     67
     68            theStringDecay=new G4LundStringFragmentation();
     69   
     70        return theStringDecay->FragmentString(theString);
     71}
     72       
     73G4KineticTrackVector *G4ExcitedStringDecay::FragmentStrings
     74                                (const G4ExcitedStringVector * theStrings)
     75{
     76  G4LorentzVector KTsum(0.,0.,0.,0.);
     77  for ( unsigned int astring=0; astring < theStrings->size(); astring++)
     78  {
     79        KTsum+= theStrings->operator[](astring)->Get4Momentum();
     80
     81        if( !(KTsum.e()<1) && !(KTsum.e()>-1) )
     82        {
     83          throw G4HadronicException(__FILE__, __LINE__,
     84                                   "G4ExcitedStringDecay::FragmentStrings received nan string...");
     85        }
     86  }
     87
     88  G4KineticTrackVector * theResult = new G4KineticTrackVector;
     89  G4int attempts(0);
     90  G4bool success=false;
     91  do {
     92
     93        std::for_each(theResult->begin() , theResult->end() , DeleteKineticTrack());
     94        theResult->clear();
     95
     96        attempts++;
     97        G4LorentzVector KTsecondaries(0.,0.,0.,0.);
     98        G4bool NeedEnergyCorrector=false;
     99
     100        for ( unsigned int astring=0; astring < theStrings->size(); astring++)
     101        {
     102//G4cout<<G4endl<<"String No "<<astring+1<<" "<<theStrings->operator[](astring)->Get4Momentum().mag()<<G4endl;
     103
     104          G4KineticTrackVector * generatedKineticTracks = NULL;
     105 
     106          if ( theStrings->operator[](astring)->IsExcited() )
     107          {
     108             generatedKineticTracks=FragmentString(*theStrings->operator[](astring));
     109          } else {
     110             generatedKineticTracks = new G4KineticTrackVector;
     111             generatedKineticTracks->push_back(theStrings->operator[](astring)->GetKineticTrack());
     112          }   
     113
     114          if (generatedKineticTracks == NULL)
     115          {
     116             G4cerr << "G4VPartonStringModel:No KineticTracks produced" << G4endl;
     117             continue;
     118          }
     119
     120          G4LorentzVector KTsum1(0.,0.,0.,0.);
     121          for ( unsigned int aTrack=0; aTrack<generatedKineticTracks->size();aTrack++)
     122          {
     123//G4cout<<" Prod part "<<(*generatedKineticTracks)[aTrack]->GetDefinition()->GetParticleName()<<" "<<(*generatedKineticTracks)[aTrack]->Get4Momentum()<<G4endl;
     124             theResult->push_back(generatedKineticTracks->operator[](aTrack));
     125             KTsum1+= (*generatedKineticTracks)[aTrack]->Get4Momentum();
     126          }
     127          KTsecondaries+=KTsum1;
     128       
     129          if  ( KTsum1.e() > 0 && std::abs((KTsum1.e()-theStrings->operator[](astring)->Get4Momentum().e()) / KTsum1.e()) > perMillion )
     130          {
     131//--debug--           G4cout << "String secondaries(" <<generatedKineticTracks->size()<< ")  momentum: "
     132//--debug--               << theStrings->operator[](astring)->Get4Momentum() << " " << KTsum1 << G4endl;
     133            NeedEnergyCorrector=true;
     134          }
     135
     136//        clean up
     137          delete generatedKineticTracks;
     138        }
     139//--DEBUG  G4cout << "Strings/secs total  4 momentum " << KTsum << " " <<KTsecondaries << G4endl;
     140
     141        success=true;
     142        if ( NeedEnergyCorrector ) success=EnergyAndMomentumCorrector(theResult, KTsum);
     143
     144  } while(!success && (attempts < 100));
     145
     146#ifdef debug_ExcitedStringDecay
     147  G4LorentzVector  KTsum1=0;
     148  for ( unsigned int aTrack=0; aTrack<theResult->size();aTrack++)
     149  {
     150      G4cout << " corrected tracks .. " << (*theResult)[aTrack]->GetDefinition()->GetParticleName()
     151      <<"  " << (*theResult)[aTrack]->Get4Momentum() << G4endl;
     152      KTsum1+= (*theResult)[aTrack]->Get4Momentum();
     153  }
     154  G4cout << "Needcorrector/success " << NeedEnergyCorrector << "/" << success << ", Corrected total  4 momentum " << KTsum1  << G4endl;
     155  if ( ! success ) G4cout << "failed to correct E/p" << G4endl; 
     156#endif
     157
     158  return theResult;
     159}
     160
     161G4bool G4ExcitedStringDecay::EnergyAndMomentumCorrector
     162                (G4KineticTrackVector* Output, G4LorentzVector& TotalCollisionMom)   
    65163  {
    66164    const int    nAttemptScale = 500;
     
    71169    G4double        SumMass = 0;     
    72170    G4double        TotalCollisionMass = TotalCollisionMom.m();
     171
    73172    if( !(TotalCollisionMass<1) && !(TotalCollisionMass>-1) )
    74173    {
     
    77176    }
    78177
     178//G4cout<<G4endl<<"EnergyAndMomentumCorrector "<<Output->size()<<G4endl;
    79179    // Calculate sum hadron 4-momenta and summing hadron mass
    80180    unsigned int cHadron;
     
    92192        }
    93193    }
     194
     195//G4cout<<"SumMass TotalCollisionMass "<<SumMass<<" "<<TotalCollisionMass<<G4endl;
    94196
    95197    // Cannot correct a single particle
Note: See TracChangeset for help on using the changeset viewer.