Geant4 Cross Reference |
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: CexmcEventAction.cc 30 * 31 * Description: event action 32 * 33 * Version: 1.0 34 * Created: 27.10.2009 22:48:08 35 * Revision: none 36 * Compiler: gcc 37 * 38 * Author: Alexey Radkov (), 39 * Company: PNPI 40 * 41 * =========================================== 42 */ 43 44 #include <cmath> 45 #ifdef CEXMC_USE_PERSISTENCY 46 #include <boost/archive/binary_oarchive.hpp> 47 #endif 48 #include <G4DigiManager.hh> 49 #include <G4Event.hh> 50 #include <G4Circle.hh> 51 #include <G4VisAttributes.hh> 52 #include <G4VisManager.hh> 53 #include <G4VTrajectory.hh> 54 #include <G4TrajectoryContainer.hh> 55 #include <G4Colour.hh> 56 #include <G4SystemOfUnits.hh> 57 #include "CexmcEventAction.hh" 58 #include "CexmcEventActionMessenger.hh" 59 #include "CexmcEventInfo.hh" 60 #include "CexmcEventSObject.hh" 61 #include "CexmcEventFastSObject.hh" 62 #include "CexmcTrackingAction.hh" 63 #include "CexmcChargeExchangeReconstructor.hh" 64 #include "CexmcRunManager.hh" 65 #include "CexmcHistoManager.hh" 66 #include "CexmcRun.hh" 67 #include "CexmcPhysicsManager.hh" 68 #include "CexmcProductionModel.hh" 69 #include "CexmcProductionModelData.hh" 70 #include "CexmcEnergyDepositDigitizer.hh" 71 #include "CexmcEnergyDepositStore.hh" 72 #include "CexmcTrackPointsDigitizer.hh" 73 #include "CexmcTrackPointsStore.hh" 74 #include "CexmcTrackPointInfo.hh" 75 #include "CexmcException.hh" 76 #include "CexmcCommon.hh" 77 78 79 namespace 80 { 81 G4double CexmcSmallCircleScreenSize( 5.0 82 G4double CexmcBigCircleScreenSize( 10.0 ) 83 G4Colour CexmcTrackPointsMarkerColour( 0. 84 G4Colour CexmcRecTrackPointsMarkerColour( 85 86 #ifdef CEXMC_USE_ROOT 87 inline G4double CexmcGetKinEnergy( G4doub 88 { 89 return std::sqrt( momentumAmp * moment 90 } 91 #endif 92 } 93 94 95 CexmcEventAction::CexmcEventAction( CexmcPhysi 96 G4int ver 97 physicsManager( physicsManager_ ), reconst 98 #ifdef CEXMC_USE_ROOT 99 opKinEnergy( 0. ), 100 #endif 101 verbose( verbose_ ), verboseDraw( 4 ), mes 102 { 103 G4DigiManager * digiManager( G4DigiManage 104 digiManager->AddNewModule( new CexmcEnergy 105 106 digiManager->AddNewModule( new CexmcTrackP 107 108 reconstructor = new CexmcChargeExchangeRec 109 physic 110 messenger = new CexmcEventActionMessenger( 111 } 112 113 114 CexmcEventAction::~CexmcEventAction() 115 { 116 delete reconstructor; 117 delete messenger; 118 } 119 120 121 void CexmcEventAction::BeamParticleChangeHook 122 { 123 reconstructor->SetupBeamParticle(); 124 } 125 126 127 void CexmcEventAction::BeginOfEventAction( co 128 { 129 G4RunManager * runManager( G4RunMa 130 CexmcTrackingAction * trackingAction 131 ( static_cast< CexmcTrackingAction 132 const_cast< G4UserTrac 133 runManager 134 trackingAction->BeginOfEventAction(); 135 136 physicsManager->ResetNumberOfTriggeredStud 137 } 138 139 140 CexmcEnergyDepositStore * CexmcEventAction::M 141 const CexmcEne 142 { 143 G4double monitorED( digitizer->GetMonitor 144 G4double vetoCounterEDLeft( digitizer->Ge 145 G4double vetoCounterEDRight( digitizer->G 146 G4double calorimeterEDLeft( digitizer->Ge 147 G4double calorimeterEDRight( digitizer->G 148 G4int calorimeterEDLeftMaxX( digitizer 149 G4int calorimeterEDLeftMaxY( digitizer 150 G4int calorimeterEDRightMaxX( digitize 151 G4int calorimeterEDRightMaxY( digitize 152 153 const CexmcEnergyDepositCalorimeterCollect 154 calorimeterEDLeftCollection( 155 digitizer->GetCalo 156 const CexmcEnergyDepositCalorimeterCollect 157 calorimeterEDRightCollection( 158 digitizer->GetCalo 159 160 /* ATTENTION: return object in heap - must 161 return new CexmcEnergyDepositStore( monito 162 vetoCounterEDRight, calori 163 calorimeterEDLeftMaxX, cal 164 calorimeterEDRightMaxX, ca 165 calorimeterEDLeftCollectio 166 } 167 168 169 CexmcTrackPointsStore * CexmcEventAction::Mak 170 const CexmcTra 171 { 172 const CexmcTrackPointInfo & 173 monitorTP( digitizer->GetMonit 174 const CexmcTrackPointInfo & 175 targetTPBeamParticle( 176 digitizer->GetTargetTPBeam 177 const CexmcTrackPointInfo & 178 targetTPOutputParticle( 179 digitizer->GetTargetTPOutp 180 const CexmcTrackPointInfo & 181 targetTPNucleusParticle( 182 digitizer->GetTargetTPNucl 183 const CexmcTrackPointInfo & 184 targetTPOutputParticleDecayPro 185 digitizer-> 186 GetTargetTPOutputParticleD 187 const CexmcTrackPointInfo & 188 targetTPOutputParticleDecayPro 189 digitizer-> 190 GetTargetTPOutputParticleD 191 const CexmcTrackPointInfo & 192 vetoCounterTPLeft( 193 digitizer->GetVetoCounterT 194 const CexmcTrackPointInfo & 195 vetoCounterTPRight( 196 digitizer->GetVetoCounterT 197 const CexmcTrackPointInfo & 198 calorimeterTPLeft( 199 digitizer->GetCalorimeterT 200 const CexmcTrackPointInfo & 201 calorimeterTPRight( 202 digitizer->GetCalorimeterT 203 204 /* ATTENTION: return object in heap - must 205 return new CexmcTrackPointsStore( monitorT 206 targetTPOutputParticle, targ 207 targetTPOutputParticleDecayP 208 targetTPOutputParticleDecayP 209 vetoCounterTPLeft, vetoCount 210 calorimeterTPLeft, calorimet 211 } 212 213 214 void CexmcEventAction::PrintEnergyDeposit( 215 const Cexm 216 { 217 G4cout << " --- Energy Deposit" << G4endl; 218 G4cout << " monitor : " << 219 G4BestUnit( edStore->monitorED, "E 220 G4cout << " vc (l) : " << 221 G4BestUnit( edStore->vetoCounterED 222 G4cout << " vc (r) : " << 223 G4BestUnit( edStore->vetoCounterED 224 G4cout << " cal (l) : " << 225 G4BestUnit( edStore->calorimeterED 226 G4cout << edStore->calorimeterEDLeftCollec 227 G4cout << " cal (r) : " << 228 G4BestUnit( edStore->calorimeterED 229 G4cout << edStore->calorimeterEDRightColle 230 } 231 232 233 void CexmcEventAction::PrintTrackPoints( 234 const Cexm 235 { 236 if ( ! tpStore ) 237 return; 238 239 G4cout << " --- Track Points" << G4endl; 240 G4cout << " monitor : " << tpStore-> 241 G4cout << " target : " << tpStore-> 242 G4cout << " : " << tpStore-> 243 G4cout << " : " << tpStore-> 244 G4cout << " : " << 245 tpStore->targetTPOutputParticleDec 246 G4cout << " : " << 247 tpStore->targetTPOutputParticleDec 248 G4cout << " vc (l) : " << tpStore-> 249 G4cout << " vc (r) : " << tpStore-> 250 G4cout << " cal (l) : " << tpStore-> 251 G4cout << " cal (r) : " << tpStore-> 252 G4cout << " ---" << G4endl; 253 G4cout << " angle between the " << 254 tpStore->targetTPOutputParticle.partic 255 " decay products : " << 256 tpStore->targetTPOutputParticleDecayPr 257 angle( 258 tpStore->targetTPOutputParticleDecayPr 259 deg << " deg" << G4endl; 260 } 261 262 263 void CexmcEventAction::PrintProductionModelDa 264 const CexmcAng 265 const CexmcPro 266 { 267 G4cout << " --- Triggered angular ranges: 268 G4cout << " --- Production model data: " < 269 } 270 271 272 void CexmcEventAction::PrintReconstructedData 273 const CexmcAngularRangeLis 274 const CexmcAngularRange & 275 { 276 G4cout << " --- Reconstructed data: " << G 277 G4cout << " -- entry points:" << G4e 278 G4cout << " left: " << G4Best 279 reconstructor->GetCalorimeterEPLeftPos 280 G4cout << " right: " << G4Best 281 reconstructor->GetCalorimeterEPRightPo 282 G4cout << " target: " << G4Best 283 reconstructor->GetTargetEPPosition(), 284 G4cout << " -- the angle: " << recon 285 " deg" << G4endl; 286 G4cout << " -- mass of the output pa 287 reconstructor->GetOutputParticleMass() 288 G4cout << " -- mass of the nucleus o 289 reconstructor->GetNucleusOutputParticl 290 if ( reconstructor->IsMassCutUsed() ) 291 { 292 if ( reconstructor->HasMassCutTriggere 293 G4cout << " < mass cut 294 else 295 G4cout << " < mass cut 296 } 297 if ( reconstructor->IsAbsorbedEnergyCutUse 298 { 299 if ( reconstructor->HasAbsorbedEnergyC 300 G4cout << " < absorbed 301 else 302 G4cout << " < absorbed 303 } 304 const CexmcProductionModelData & pmData( 305 reconstruc 306 G4cout << " -- production model data 307 G4cout << " -- triggered angular ran 308 if ( triggeredRecAngularRanges.empty() ) 309 G4cout << "< orphan detected, gap " << 310 else 311 G4cout << triggeredRecAngularRanges; 312 } 313 314 315 #ifdef CEXMC_USE_ROOT 316 317 void CexmcEventAction::FillEDTHistos( const C 318 const CexmcAngularRangeList & 319 { 320 CexmcHistoManager * histoManager( CexmcHi 321 322 histoManager->Add( CexmcAbsorbedEnergy_EDT 323 edStore->calorimeterEDL 324 edStore->calorimeterEDR 325 326 for ( CexmcAngularRangeList::const_iterato 327 k( triggeredAngularRan 328 k != trigg 329 { 330 histoManager->Add( CexmcAbsEnInLeftCal 331 k->index, edStore-> 332 histoManager->Add( CexmcAbsEnInRightCa 333 k->index, edStore-> 334 } 335 } 336 337 338 void CexmcEventAction::FillTPTHistos( const C 339 const CexmcProductionModelData 340 const CexmcAngularRangeList & 341 { 342 CexmcHistoManager * histoManager( CexmcHi 343 344 if ( tpStore->monitorTP.IsValid() ) 345 { 346 histoManager->Add( CexmcMomentumBP_TPT 347 tpStore->monitorTP. 348 histoManager->Add( CexmcTPInMonitor_TP 349 tpStore->monitorTP. 350 tpStore->monitorTP. 351 } 352 353 if ( tpStore->targetTPOutputParticle.IsVal 354 { 355 histoManager->Add( CexmcTPInTarget_TPT 356 tpStore->targetTPOu 357 tpStore->targetTPOu 358 tpStore->targetTPOu 359 if ( histoManager->GetVerboseLevel() > 360 { 361 histoManager->Add( CexmcMomentumIP 362 pmData.incident 363 } 364 } 365 366 for ( CexmcAngularRangeList::const_iterato 367 k( triggeredAngularRan 368 k != trigg 369 { 370 if ( tpStore->calorimeterTPLeft.IsVali 371 { 372 /* kinetic energy and momentum of 373 G4double kinEnergy( tpStore->calo 374 histoManager->Add( CexmcKinEnAtLef 375 k->index, kinEn 376 } 377 if ( tpStore->calorimeterTPRight.IsVal 378 { 379 G4double kinEnergy( tpStore->calo 380 histoManager->Add( CexmcKinEnAtRig 381 k->index, kinEn 382 } 383 if ( tpStore->targetTPOutputParticle.I 384 { 385 histoManager->Add( CexmcTPInTarget 386 tpStore->targetTPOu 387 tpStore->targetTPOu 388 tpStore->targetTPOu 389 histoManager->Add( CexmcKinEnOP_LA 390 opKinEnergy ); 391 histoManager->Add( CexmcAngleOP_SC 392 pmData.outputPa 393 } 394 if ( tpStore->targetTPOutputParticleDe 395 tpStore->targetTPOutputParticleDe 396 { 397 G4double openAngle( 398 tpStore->targetTPOutpu 399 directionWorld.angle( 400 targetTPOutput 401 direct 402 histoManager->Add( CexmcOpenAngle_ 403 openAngle ); 404 } 405 } 406 } 407 408 409 void CexmcEventAction::FillRTHistos( G4bool 410 const CexmcEnergyDepositStore 411 const CexmcTrackPointsStore * 412 const CexmcProductionModelData 413 const CexmcAngularRangeList & 414 { 415 CexmcHistoManager * histoManager( CexmcHi 416 417 G4double opMass( reconstructor->GetOutp 418 G4double nopMass( reconstructor->GetNuc 419 420 histoManager->Add( CexmcRecMasses_EDT_Hist 421 422 for ( CexmcAngularRangeList::const_iterato 423 k( triggeredAngularRan 424 k != trigg 425 { 426 if ( tpStore->calorimeterTPLeft.IsVali 427 { 428 histoManager->Add( CexmcOPDPAtLeft 429 k->index, 430 tpStore->calori 431 tpStore->calori 432 } 433 if ( tpStore->calorimeterTPRight.IsVal 434 { 435 histoManager->Add( CexmcOPDPAtRigh 436 k->index, 437 tpStore->calori 438 tpStore->calori 439 } 440 histoManager->Add( CexmcRecOPDPAtLeftC 441 k->index, 442 reconstructor->GetC 443 reconstructor->GetC 444 histoManager->Add( CexmcRecOPDPAtRight 445 k->index, 446 reconstructor->GetC 447 reconstructor->GetC 448 } 449 450 if ( ! reconstructorHasFullTrigger ) 451 return; 452 453 if ( tpStore->monitorTP.IsValid() ) 454 { 455 histoManager->Add( CexmcMomentumBP_RT_ 456 tpStore->monitorTP. 457 } 458 459 if ( tpStore->targetTPOutputParticle.IsVal 460 { 461 histoManager->Add( CexmcTPInTarget_RT_ 462 tpStore->targetTPOu 463 tpStore->targetTPOu 464 tpStore->targetTPOu 465 } 466 467 histoManager->Add( CexmcRecMasses_RT_Histo 468 reconstructor->GetOutpu 469 reconstructor->GetNucle 470 471 histoManager->Add( CexmcAbsorbedEnergy_RT_ 472 edStore->calorimeterEDL 473 edStore->calorimeterEDR 474 475 G4double recCosTheta( reconstructor->GetP 476 477 478 for ( CexmcAngularRangeList::const_iterato 479 k( triggeredAngularRan 480 k != trigg 481 { 482 histoManager->Add( CexmcRecMassOP_ARRe 483 histoManager->Add( CexmcRecMassNOP_ARR 484 if ( tpStore->calorimeterTPLeft.IsVali 485 { 486 G4double kinEnergy( tpStore->calo 487 histoManager->Add( CexmcKinEnAtLef 488 k->index, kinEn 489 histoManager->Add( CexmcMissEnFrom 490 k->index, 491 kinEnergy - edS 492 } 493 if ( tpStore->calorimeterTPRight.IsVal 494 { 495 G4double kinEnergy( tpStore->calo 496 histoManager->Add( CexmcKinEnAtRig 497 k->index, kinEn 498 histoManager->Add( CexmcMissEnFrom 499 k->index, 500 kinEnergy - edS 501 } 502 if ( tpStore->targetTPOutputParticle.I 503 { 504 histoManager->Add( CexmcTPInTarget 505 tpStore->targetTPOu 506 tpStore->targetTPOu 507 tpStore->targetTPOu 508 histoManager->Add( CexmcKinEnOP_LA 509 opKinEnergy ); 510 histoManager->Add( CexmcAngleOP_SC 511 pmData.outputPa 512 G4double diffCosTheta( pmData.out 513 recCosThet 514 histoManager->Add( CexmcDiffAngleO 515 diffCosTheta ); 516 } 517 if ( tpStore->targetTPOutputParticleDe 518 tpStore->targetTPOutputParticleDe 519 { 520 G4double openAngle( 521 tpStore->targetTPOutpu 522 directionWorld.angle( 523 targetTPOutput 524 direct 525 histoManager->Add( CexmcOpenAngle_ 526 openAngle ); 527 G4double diffOpenAngle( openAngle 528 deg ); 529 histoManager->Add( CexmcDiffOpenAn 530 diffOpenAngle ) 531 } 532 if ( tpStore->calorimeterTPLeft.IsVali 533 { 534 histoManager->Add( CexmcOPDPAtLeft 535 k->index, 536 tpStore->calori 537 tpStore->calori 538 } 539 if ( tpStore->calorimeterTPRight.IsVal 540 { 541 histoManager->Add( CexmcOPDPAtRigh 542 k->index, 543 tpStore->calori 544 tpStore->calori 545 } 546 histoManager->Add( CexmcAbsEnInLeftCal 547 k->index, edStore-> 548 histoManager->Add( CexmcAbsEnInRightCa 549 k->index, edStore-> 550 histoManager->Add( CexmcRecAngleOP_SCM 551 k->index, recCosThe 552 histoManager->Add( CexmcRecOpenAngle_A 553 k->index, reconstru 554 histoManager->Add( CexmcRecOPDPAtLeftC 555 k->index, 556 reconstructor->GetC 557 reconstructor->GetC 558 histoManager->Add( CexmcRecOPDPAtRight 559 k->index, 560 reconstructor->GetC 561 reconstructor->GetC 562 } 563 } 564 565 #endif 566 567 568 void CexmcEventAction::DrawTrajectories( cons 569 { 570 G4VisManager * visManager( static_cast< G 571 G4VVisMana 572 if ( ! visManager || ! visManager->GetCurr 573 return; 574 575 G4int nTraj( 0 ); 576 G4TrajectoryContainer * trajContainer( ev 577 578 if ( ! trajContainer ) 579 return; 580 581 nTraj = trajContainer->entries(); 582 583 for ( int i( 0 ); i < nTraj; ++i ) 584 { 585 G4VTrajectory * traj( ( *trajContaine 586 traj->DrawTrajectory(); 587 } 588 } 589 590 591 void CexmcEventAction::DrawTrackPoints( 592 const CexmcTra 593 { 594 G4VisManager * visManager( static_cast< G 595 G4VVisMana 596 if ( ! visManager || ! visManager->GetCurr 597 return; 598 599 G4Circle circle; 600 G4VisAttributes visAttributes( CexmcTrack 601 circle.SetScreenSize( CexmcSmallCircleScre 602 circle.SetFillStyle( G4Circle::filled ); 603 circle.SetVisAttributes( visAttributes ); 604 605 if ( tpStore->monitorTP.IsValid() ) 606 { 607 circle.SetPosition( tpStore->monitorTP 608 visManager->Draw( circle ); 609 } 610 611 if ( tpStore->targetTPBeamParticle.IsValid 612 { 613 circle.SetPosition( tpStore->targetTPB 614 visManager->Draw( circle ); 615 } 616 617 if ( tpStore->targetTPOutputParticle.IsVal 618 { 619 circle.SetPosition( tpStore->targetTPO 620 visManager->Draw( circle ); 621 } 622 623 if ( tpStore->vetoCounterTPLeft.IsValid() 624 { 625 circle.SetPosition( tpStore->vetoCount 626 visManager->Draw( circle ); 627 } 628 629 if ( tpStore->vetoCounterTPRight.IsValid() 630 { 631 circle.SetPosition( tpStore->vetoCount 632 visManager->Draw( circle ); 633 } 634 635 if ( tpStore->calorimeterTPLeft.IsValid() 636 { 637 circle.SetPosition( tpStore->calorimet 638 visManager->Draw( circle ); 639 } 640 641 if ( tpStore->calorimeterTPRight.IsValid() 642 { 643 circle.SetPosition( tpStore->calorimet 644 visManager->Draw( circle ); 645 } 646 } 647 648 649 void CexmcEventAction::DrawReconstructionData 650 { 651 G4VisManager * visManager( static_cast< G 652 G4VVisMana 653 if ( ! visManager || ! visManager->GetCurr 654 return; 655 656 G4Circle circle( reconstructor->GetTarget 657 circle.SetScreenSize( CexmcSmallCircleScre 658 circle.SetFillStyle( G4Circle::filled ); 659 G4VisAttributes visAttributes( CexmcRecTr 660 circle.SetVisAttributes( visAttributes ); 661 visManager->Draw( circle ); 662 663 circle.SetScreenSize( CexmcBigCircleScreen 664 circle.SetPosition( reconstructor->GetCalo 665 visManager->Draw( circle ); 666 667 circle.SetPosition( reconstructor->GetCalo 668 visManager->Draw( circle ); 669 } 670 671 672 void CexmcEventAction::UpdateRunHits( 673 const Cexm 674 const Cexm 675 G4bool tp 676 G4bool ed 677 G4bool ed 678 G4bool re 679 const Cexm 680 { 681 G4RunManager * runManager( G4RunManager 682 const CexmcRun * run( static_cast< const 683 684 CexmcRun * theRun( const_cast< Cexm 685 686 if ( tpDigitizerHasTriggered ) 687 { 688 for ( CexmcAngularRangeList::const_ite 689 690 { 691 theRun->IncrementNmbOfHitsSampledF 692 if ( edDigitizerMonitorHasTriggere 693 theRun->IncrementNmbOfHitsSamp 694 if ( reconstructorHasFullTrigger ) 695 theRun->IncrementNmbOfHitsTrig 696 } 697 if ( reconstructorHasFullTrigger ) 698 { 699 if ( aRangesRec.empty() ) 700 { 701 theRun->IncrementNmbOfOrphanHi 702 } 703 else 704 { 705 for ( CexmcAngularRangeList::c 706 k( aRangesRec.begin() 707 { 708 theRun->IncrementNmbOfHits 709 } 710 } 711 } 712 } 713 else 714 { 715 if ( edDigitizerHasTriggered ) 716 theRun->IncrementNmbOfFalseHitsTri 717 if ( reconstructorHasFullTrigger ) 718 theRun->IncrementNmbOfFalseHitsTri 719 } 720 } 721 722 723 #ifdef CEXMC_USE_PERSISTENCY 724 725 void CexmcEventAction::SaveEvent( const G4Eve 726 G4bool edD 727 const Cexmc 728 const Cexmc 729 const Cexmc 730 { 731 CexmcRunManager * runManager( static_cast 732 G4 733 if ( ! runManager->ProjectIsSaved() ) 734 return; 735 736 if ( runManager->GetEventDataVerboseLevel( 737 return; 738 739 if ( ! edDigitizerHasTriggered && runManag 740 741 return; 742 743 boost::archive::binary_oarchive * archive 744 ru 745 if ( archive ) 746 { 747 CexmcEventSObject sObject = { event-> 748 edDigitizerHasTriggered, edStore-> 749 edStore->vetoCounterEDLeft, edStor 750 edStore->calorimeterEDLeft, edStor 751 edStore->calorimeterEDLeftCollecti 752 edStore->calorimeterEDRightCollect 753 tpStore->monitorTP, tpStore->targe 754 tpStore->targetTPOutputParticle, t 755 tpStore->targetTPOutputParticleDec 756 tpStore->targetTPOutputParticleDec 757 tpStore->vetoCounterTPLeft, tpStor 758 tpStore->calorimeterTPLeft, tpStor 759 archive->operator<<( sObject ); 760 const CexmcRun * run( static_cast< co 761 762 CexmcRun * theRun( const_cast< 763 theRun->IncrementNmbOfSavedEvents(); 764 } 765 } 766 767 768 void CexmcEventAction::SaveEventFast( const G 769 G4bool 770 G4bool 771 G4bool 772 G4doubl 773 { 774 CexmcRunManager * runManager( static_cast 775 G4 776 if ( ! runManager->ProjectIsSaved() ) 777 return; 778 779 if ( runManager->GetEventDataVerboseLevel( 780 return; 781 782 boost::archive::binary_oarchive * archive 783 runMan 784 if ( archive ) 785 { 786 if ( ! tpDigitizerHasTriggered ) 787 opCosThetaSCM = CexmcInvalidCosThe 788 789 CexmcEventFastSObject sObject = { eve 790 edD 791 edD 792 archive->operator<<( sObject ); 793 const CexmcRun * run( static_cast< co 794 795 CexmcRun * theRun( const_cast< 796 theRun->IncrementNmbOfSavedFastEvents( 797 } 798 } 799 800 #endif 801 802 803 void CexmcEventAction::EndOfEventAction( cons 804 { 805 G4DigiManager * digiManager 806 CexmcEnergyDepositDigitizer * energyDepos 807 static_cast< CexmcEnergyDepositDig 808 FindDigitizerM 809 CexmcTrackPointsDigitizer * trackPoints 810 static_cast< CexmcTrackPointsDigit 811 FindDigitizerM 812 813 energyDepositDigitizer->Digitize(); 814 trackPointsDigitizer->Digitize(); 815 816 G4bool edDigitizerMonitorHasTriggered( 817 energyDepositD 818 G4bool edDigitizerHasTriggered( false ); 819 820 CexmcEventInfo * eventInfo( static_cast< 821 822 if ( ! eventInfo || eventInfo->EdTriggerIs 823 edDigitizerHasTriggered = energyDeposi 824 825 G4bool tpDigitizerHasTriggered( trackPoin 826 G4bool reconstructorHasBasicTrigger( fals 827 G4bool reconstructorHasFullTrigger( false 828 829 CexmcEnergyDepositStore * edStore( MakeEn 830 831 CexmcTrackPointsStore * tpStore( MakeTr 832 833 834 try 835 { 836 CexmcProductionModel * productionMode 837 physic 838 839 if ( ! productionModel ) 840 throw CexmcException( CexmcWeirdEx 841 842 const CexmcAngularRangeList & angu 843 productionMode 844 const CexmcAngularRangeList & trig 845 productionMode 846 const CexmcProductionModelData & pmDa 847 productionMode 848 849 if ( edDigitizerHasTriggered ) 850 { 851 reconstructor->Reconstruct( edStor 852 reconstructorHasBasicTrigger = rec 853 reconstructorHasFullTrigger = reco 854 } 855 856 CexmcAngularRangeList triggeredRecAng 857 858 if ( reconstructorHasBasicTrigger ) 859 { 860 for ( CexmcAngularRangeList::const 861 k( angularRanges.begin() ); 862 { 863 G4double cosTheta( reconstruc 864 outputPart 865 if ( cosTheta <= k->top && cos 866 triggeredRecAngularRanges. 867 868 } 869 } 870 871 CexmcAngularRange angularGap( 0.0, 0. 872 if ( triggeredRecAngularRanges.empty() 873 { 874 CexmcAngularRangeList angularGaps 875 GetAngularGaps( angularRanges, ang 876 for ( CexmcAngularRangeList::const 877 k( angularGaps.begin() ); 878 { 879 G4double cosTheta( reconstruc 880 outputPart 881 if ( cosTheta <= k->top && cos 882 { 883 angularGap = *k; 884 break; 885 } 886 } 887 } 888 889 UpdateRunHits( triggeredAngularRanges, 890 tpDigitizerHasTriggered 891 edDigitizerMonitorHasTr 892 reconstructorHasFullTri 893 894 if ( verbose > 0 ) 895 { 896 G4bool printMessages( verbose > 3 897 ( ( verbose == 1 ) && 898 ( ( verbose == 2 ) && 899 ( ( verbose == 3 ) && 900 901 if ( printMessages ) 902 { 903 G4cout << "Event " << event->G 904 if ( tpDigitizerHasTriggered ) 905 { 906 PrintTrackPoints( tpStore 907 PrintProductionModelData( 908 } 909 if ( reconstructorHasBasicTrig 910 PrintReconstructedData( tr 911 an 912 if ( edDigitizerHasTriggered ) 913 PrintEnergyDeposit( edStor 914 } 915 } 916 917 if ( verboseDraw > 0 ) 918 { 919 G4bool drawTrajectories( verboseD 920 ( ( verboseDraw == 1 ) 921 ( ( verboseDraw == 2 ) 922 ( ( verboseDraw == 3 ) 923 924 if ( drawTrajectories ) 925 { 926 DrawTrajectories( event ); 927 if ( tpDigitizerHasTriggered ) 928 DrawTrackPoints( tpStore ) 929 if ( reconstructorHasBasicTrig 930 DrawReconstructionData(); 931 } 932 } 933 934 #ifdef CEXMC_USE_PERSISTENCY 935 if ( edDigitizerHasTriggered || tpDigi 936 { 937 SaveEventFast( event, tpDigitizerH 938 edDigitizerHasTrigg 939 edDigitizerMonitorH 940 pmData.outputPartic 941 SaveEvent( event, edDigitizerHasTr 942 pmData ); 943 } 944 #endif 945 946 #ifdef CEXMC_USE_ROOT 947 /* opKinEnergy will be used in several 948 if ( tpStore->targetTPOutputParticle.I 949 { 950 opKinEnergy = CexmcGetKinEnergy( 951 tpStore->targetTPOutputPar 952 tpStore->targetTPOutputPar 953 } 954 955 if ( edDigitizerHasTriggered ) 956 FillEDTHistos( edStore, triggeredA 957 958 /* fill TPT histos only when the monit 959 * when it was missed have less value 960 if ( tpDigitizerHasTriggered && edDigi 961 FillTPTHistos( tpStore, pmData, tr 962 963 if ( reconstructorHasBasicTrigger ) 964 FillRTHistos( reconstructorHasFull 965 pmData, triggeredAng 966 #endif 967 968 G4Event * theEvent( const_cast< G4Eve 969 if ( eventInfo ) 970 { 971 delete eventInfo; 972 theEvent->SetUserInformation( NULL 973 } 974 theEvent->SetUserInformation( new Cexm 975 976 977 978 } 979 catch ( CexmcException & e ) 980 { 981 G4cout << e.what() << G4endl; 982 } 983 catch ( ... ) 984 { 985 G4cout << "Unknown exception caught" < 986 } 987 988 delete edStore; 989 delete tpStore; 990 } 991 992