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 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/ChargeExchangeMC/src/CexmcChargeExchangeReconstructor.cc (Version 11.3.0) and /examples/advanced/ChargeExchangeMC/src/CexmcChargeExchangeReconstructor.cc (Version 8.3)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 /*                                                
 27  * ===========================================    
 28  *                                                
 29  *       Filename:  CexmcChargeExchangeReconst    
 30  *                                                
 31  *    Description:  charge exchange reconstruc    
 32  *                                                
 33  *        Version:  1.0                           
 34  *        Created:  02.12.2009 15:17:13           
 35  *       Revision:  none                          
 36  *       Compiler:  gcc                           
 37  *                                                
 38  *         Author:  Alexey Radkov (),             
 39  *        Company:  PNPI                          
 40  *                                                
 41  * ===========================================    
 42  */                                               
 43                                                   
 44 #include <cmath>                                  
 45 #include <G4ThreeVector.hh>                       
 46 #include <G4LorentzVector.hh>                     
 47 #include "CexmcChargeExchangeReconstructor.hh"    
 48 #include "CexmcChargeExchangeReconstructorMess    
 49 #include "CexmcEnergyDepositStore.hh"             
 50 #include "CexmcPrimaryGeneratorAction.hh"         
 51 #include "CexmcParticleGun.hh"                    
 52 #include "CexmcProductionModel.hh"                
 53 #include "CexmcRunManager.hh"                     
 54 #include "CexmcException.hh"                      
 55                                                   
 56                                                   
 57 CexmcChargeExchangeReconstructor::CexmcChargeE    
 58                             const CexmcProduct    
 59     outputParticleMass( 0 ), nucleusOutputPart    
 60     useTableMass( false ), useMassCut( false )    
 61     massCutNOPCenter( 0 ), massCutOPWidth( 0 )    
 62     massCutEllipseAngle( 0 ), useAbsorbedEnerg    
 63     absorbedEnergyCutCLCenter( 0 ), absorbedEn    
 64     absorbedEnergyCutCLWidth( 0 ), absorbedEne    
 65     absorbedEnergyCutEllipseAngle( 0 ), expect    
 66     edCollectionAlgorithm( CexmcCollectEDInAll    
 67     hasMassCutTriggered( false ), hasAbsorbedE    
 68     beamParticleIsInitialized( false ), partic    
 69 {                                                 
 70     if ( ! productionModel )                      
 71         throw CexmcException( CexmcWeirdExcept    
 72                                                   
 73     productionModelData.incidentParticle =        
 74                                     production    
 75                                                   
 76     CexmcRunManager *  runManager( static_cast    
 77                                             G4    
 78     const CexmcPrimaryGeneratorAction *  prima    
 79                         static_cast< const Cex    
 80                                 runManager->Ge    
 81     CexmcPrimaryGeneratorAction *  thePrimaryG    
 82                         const_cast< CexmcPrima    
 83                                 primaryGenerat    
 84     particleGun = thePrimaryGeneratorAction->G    
 85                                                   
 86     productionModelData.nucleusParticle =         
 87                                     production    
 88     productionModelData.outputParticle =          
 89                                     production    
 90     productionModelData.nucleusOutputParticle     
 91                                     production    
 92                                                   
 93     messenger = new CexmcChargeExchangeReconst    
 94 }                                                 
 95                                                   
 96                                                   
 97 CexmcChargeExchangeReconstructor::~CexmcCharge    
 98 {                                                 
 99     delete messenger;                             
100 }                                                 
101                                                   
102                                                   
103 void  CexmcChargeExchangeReconstructor::SetupB    
104 {                                                 
105     if ( *productionModelData.incidentParticle    
106                                         *parti    
107         throw CexmcException( CexmcBeamAndInci    
108                                                   
109     beamParticleIsInitialized = true;             
110 }                                                 
111                                                   
112                                                   
113 void  CexmcChargeExchangeReconstructor::Recons    
114                                     const Cexm    
115 {                                                 
116     if ( ! beamParticleIsInitialized )            
117     {                                             
118         if ( *productionModelData.incidentPart    
119                                         *parti    
120             throw CexmcException( CexmcBeamAnd    
121                                                   
122         beamParticleIsInitialized = true;         
123     }                                             
124                                                   
125     if ( edCollectionAlgorithm == CexmcCollect    
126         collectEDInAdjacentCrystals = true;       
127                                                   
128     ReconstructEntryPoints( edStore );            
129     if ( hasBasicTrigger )                        
130         ReconstructTargetPoint();                 
131     if ( hasBasicTrigger )                        
132         ReconstructAngle();                       
133                                                   
134     G4ThreeVector  epLeft( calorimeterEPLeftWo    
135                            targetEPWorldPositi    
136     G4ThreeVector  epRight( calorimeterEPRight    
137                             targetEPWorldPosit    
138                                                   
139     G4double  cosTheAngle( std::cos( theAngle     
140     G4double  calorimeterEDLeft( edStore->calo    
141     G4double  calorimeterEDRight( edStore->cal    
142                                                   
143     if ( edCollectionAlgorithm == CexmcCollect    
144     {                                             
145         calorimeterEDLeft = calorimeterEDLeftA    
146         calorimeterEDRight = calorimeterEDRigh    
147     }                                             
148                                                   
149     //G4double  cosOutputParticleLAB(             
150         //( calorimeterEDLeft * cosAngleLeft +    
151           //calorimeterEDRight * cosAngleRight    
152           //std::sqrt( calorimeterEDLeft * cal    
153                      //calorimeterEDRight * ca    
154                      //calorimeterEDLeft * cal    
155                                                   
156     outputParticleMass = std::sqrt( 2 * calori    
157                                     calorimete    
158                                                   
159     G4ThreeVector    opdpLeftMomentum( epLeft     
160     opdpLeftMomentum.setMag( calorimeterEDLeft    
161     G4ThreeVector    opdpRightMomentum( epRigh    
162     opdpRightMomentum.setMag( calorimeterEDRig    
163     G4ThreeVector    opMomentum( opdpLeftMomen    
164                                                   
165     /* opMass will be used only in calculation    
166      * energy, in other places outputParticleM    
167     G4double         opMass( useTableMass ?       
168                              productionModelDa    
169                              outputParticleMas    
170     /* the formula below is equivalent to         
171      * calorimeterEDLeft + calorimeterEDRight     
172     G4double         opEnergy( std::sqrt( opMo    
173                                           opMa    
174     productionModelData.outputParticleLAB = G4    
175                                                   
176                                                   
177     G4ThreeVector  incidentParticleMomentum( p    
178     G4double       incidentParticleMomentumAmp    
179                     expectedMomentumAmp : part    
180     incidentParticleMomentum *= incidentPartic    
181                                                   
182     G4double       incidentParticlePDGMass(       
183                         productionModelData.in    
184     G4double       incidentParticlePDGMass2( i    
185                                              i    
186     G4double       incidentParticleEnergy(        
187         std::sqrt( incidentParticleMomentumAmp    
188                    incidentParticlePDGMass2 )     
189                                                   
190     productionModelData.incidentParticleLAB =     
191                         incidentParticleMoment    
192     G4double       nucleusParticlePDGMass(        
193                         productionModelData.nu    
194     productionModelData.nucleusParticleLAB = G    
195                         G4ThreeVector( 0, 0, 0    
196                                                   
197     G4LorentzVector  lVecSum( productionModelD    
198                         productionModelData.nu    
199     G4ThreeVector    boostVec( lVecSum.boostVe    
200                                                   
201     productionModelData.nucleusOutputParticleL    
202             lVecSum - productionModelData.outp    
203                                                   
204     productionModelData.incidentParticleSCM =     
205             productionModelData.incidentPartic    
206     productionModelData.nucleusParticleSCM =      
207             productionModelData.nucleusParticl    
208     productionModelData.outputParticleSCM =       
209             productionModelData.outputParticle    
210     productionModelData.nucleusOutputParticleS    
211             productionModelData.nucleusOutputP    
212                                                   
213     productionModelData.incidentParticleSCM.bo    
214     productionModelData.nucleusParticleSCM.boo    
215     productionModelData.outputParticleSCM.boos    
216     productionModelData.nucleusOutputParticleS    
217                                                   
218     G4ThreeVector  nopMomentum( incidentPartic    
219     G4double       nopEnergy( incidentParticle    
220                               opEnergy );         
221     nucleusOutputParticleMass = std::sqrt( nop    
222                                            nop    
223                                                   
224     if ( useMassCut )                             
225     {                                             
226         G4double  cosMassCutEllipseAngle( std:    
227         G4double  sinMassCutEllipseAngle( std:    
228                                                   
229         if ( massCutOPWidth <= 0. || massCutNO    
230         {                                         
231             hasMassCutTriggered = false;          
232         }                                         
233         else                                      
234         {                                         
235             G4double  massCutOPWidth2( massCut    
236             G4double  massCutNOPWidth2( massCu    
237                                                   
238             hasMassCutTriggered =                 
239                 std::pow( ( outputParticleMass    
240                               cosMassCutEllips    
241                           ( nucleusOutputParti    
242                               sinMassCutEllips    
243                 std::pow( - ( outputParticleMa    
244                               sinMassCutEllips    
245                           ( nucleusOutputParti    
246                               cosMassCutEllips    
247                 1;                                
248         }                                         
249     }                                             
250                                                   
251     if ( useAbsorbedEnergyCut )                   
252     {                                             
253         G4double  cosAbsorbedEnergyCutEllipseA    
254                                 std::cos( abso    
255         G4double  sinAbsorbedEnergyCutEllipseA    
256                                 std::sin( abso    
257                                                   
258         if ( absorbedEnergyCutCLWidth <= 0. ||    
259         {                                         
260             hasAbsorbedEnergyCutTriggered = fa    
261         }                                         
262         else                                      
263         {                                         
264             G4double  absorbedEnergyCutCLWidth    
265                         absorbedEnergyCutCLWid    
266             G4double  absorbedEnergyCutCRWidth    
267                         absorbedEnergyCutCRWid    
268                                                   
269             hasAbsorbedEnergyCutTriggered =       
270                 std::pow( ( calorimeterEDLeft     
271                               cosAbsorbedEnerg    
272                           ( calorimeterEDRight    
273                               sinAbsorbedEnerg    
274                 absorbedEnergyCutCLWidth2 +       
275                 std::pow( - ( calorimeterEDLef    
276                               sinAbsorbedEnerg    
277                           ( calorimeterEDRight    
278                               cosAbsorbedEnerg    
279                 absorbedEnergyCutCRWidth2 <       
280                 1;                                
281         }                                         
282     }                                             
283                                                   
284     hasBasicTrigger = true;                       
285 }                                                 
286                                                   
287                                                   
288 G4bool  CexmcChargeExchangeReconstructor::HasF    
289 {                                                 
290     if ( ! hasBasicTrigger )                      
291         return false;                             
292     if ( useMassCut && ! hasMassCutTriggered )    
293         return false;                             
294     if ( useAbsorbedEnergyCut && ! hasAbsorbed    
295         return false;                             
296                                                   
297     return true;                                  
298 }                                                 
299                                                   
300                                                   
301 void  CexmcChargeExchangeReconstructor::SetExp    
302                                                   
303 {                                                 
304     expectedMomentumAmp = particleGun->GetOrig    
305 }                                                 
306                                                   
307