355 G4cerr<<
"=== \n File opening Error to write the output ===="<<
G4endl;
362 tSingles =
new TTree(
"tSingles",
"SinglesTree");
363 tSingles->Branch(
"eventID",&
eventID,
"eventID/I");
364 tSingles->Branch(
"blockID",&
blockID,
"blockID/I");
365 tSingles->Branch(
"crystalID_axial",&
crystalID_axial,
"crystalID_axial/I");
366 tSingles->Branch(
"crystalID_tangential",&
crystalID_axial,
"crystalID_tangential/I");
367 tSingles->Branch(
"DOI_ID",&
DOI_ID0,
"DOI_ID/I");
368 tSingles->Branch(
"timeStamp",&
timeStamp,
"timeStamp/D");
369 tSingles->Branch(
"totalEdep",&
totalEdep,
"totalEdep/D");
374 tCoincidence =
new TTree(
"tCoincidence",
"CoincidenceTree");
376 tCoincidence->Branch(
"eventID0",&
eventID0,
"eventID0/I");
377 tCoincidence->Branch(
"blockID0",&
blockID0,
"blockID0/I");
378 tCoincidence->Branch(
"crystalID_axial0",&
crystalID_axial0,
"crystalID_axial0/I");
379 tCoincidence->Branch(
"crystalID_tangential0",&
crystalID_axial0,
"crystalID_tangential0/I");
380 tCoincidence->Branch(
"DOI_ID0",&
DOI_ID0,
"DOI_ID0/I");
381 tCoincidence->Branch(
"timeStamp0",&
timeStamp0,
"timeStamp0/D");
382 tCoincidence->Branch(
"totalEdep0",&
totalEdep0,
"totalEdep0/D");
385 tCoincidence->Branch(
"eventID1",&
eventID1,
"eventID1/I");
386 tCoincidence->Branch(
"blockID1",&
blockID1,
"blockID1/I");
387 tCoincidence->Branch(
"crystalID_axial1",&
crystalID_axial1,
"crystalID_axial1/I");
388 tCoincidence->Branch(
"crystalID_tangential1",&
crystalID_axial1,
"crystalID_tangential1/I");
389 tCoincidence->Branch(
"DOI_ID1",&
DOI_ID1,
"DOI_ID1/I");
390 tCoincidence->Branch(
"timeStamp1",&
timeStamp1,
"timeStamp1/D");
391 tCoincidence->Branch(
"totalEdep1",&
totalEdep1,
"totalEdep1/D");
406 for(
G4int i=0; i<2; i++){
434 tCoincidence->Fill();
455 tCoincidence->Write();
511 std::string inputLine;
513 std::string
filename =
"inputParameter.txt";
514 ifs.open(filename.c_str());
516 G4cerr<<
"File opening Error: Could not open "<<filename<<
G4endl;
520 ifs.getline(inputChar,256);
521 inputLine = inputChar;
522 if(inputChar[0]!=
'#' && inputLine.length()!=0 ){
523 if( (std::string::size_type)inputLine.find(
"block_DeadTime:")!=std::string::npos){
524 std::istringstream tmpStream(inputLine);
525 tmpStream >> value[0] >> value[1] >> value[2];
527 if(value[2] !=
"ns"){
528 G4cerr<<
" Dead time unit is not in nano seconds (ns), Make it in 'ns' "<<
G4endl;
534 if( (std::string::size_type)inputLine.find(
"module_DeadTime:")!=std::string::npos){
535 std::istringstream tmpStream(inputLine);
536 tmpStream >> value[0] >> value[1] >> value[2];
538 if(value[2] !=
"ns"){
539 G4cerr<<
" Dead time unit is not in nano seconds (ns), Make it in 'ns' "<<
G4endl;
546 if( (std::string::size_type)inputLine.find(
"crystalResolutionMin:")!=std::string::npos){
547 std::istringstream tmpStream(inputLine);
548 tmpStream >> value[0] >> value[1];
552 if( (std::string::size_type)inputLine.find(
"crystalResolutionMax:")!=std::string::npos){
553 std::istringstream tmpStream(inputLine);
554 tmpStream >> value[0] >> value[1];
560 if( (std::string::size_type)inputLine.find(
"fixedResolution:")!=std::string::npos){
561 std::istringstream tmpStream(inputLine);
562 tmpStream >> value[0] >> value[1];
563 if(value[1]==
"true"){
574 G4cout<<
" \n Crystal dependent resolution is used. preparing look-up table .... "<<
G4endl;
590 if( (std::string::size_type)inputLine.find(
"crystalEnergyRef:")!=std::string::npos){
591 std::istringstream tmpStream(inputLine);
592 tmpStream >> value[0] >> value[1] >> value[2];
594 if(value[2] !=
"keV"){
595 G4cerr<<
" The unit of reference energy is not in keV, Make it in 'keV' "<<
G4endl;
601 if( (std::string::size_type)inputLine.find(
"crystalQuantumEfficiency:")!=std::string::npos){
602 std::istringstream tmpStream(inputLine);
603 tmpStream >> value[0] >> value[1];
607 if( (std::string::size_type)inputLine.find(
"lowerThreshold:")!=std::string::npos){
608 std::istringstream tmpStream(inputLine);
609 tmpStream >> value[0] >> value[1] >> value[2];
611 if(value[2] !=
"keV"){
612 G4cerr<<
" The unit of Lower energy threshold is not in keV, Make it in 'keV' "<<
G4endl;
619 if( (std::string::size_type)inputLine.find(
"upperThreshold:")!=std::string::npos){
620 std::istringstream tmpStream(inputLine);
621 tmpStream >> value[0] >> value[1] >> value[2];
623 if(value[2] !=
"keV"){
624 G4cerr<<
" The unit of Upper energy threshold is not in keV, Make it in 'keV' "<<
G4endl;
632 if( (std::string::size_type)inputLine.find(
"numberOfPixel_2D_Pixel:")!=std::string::npos){
633 std::istringstream tmpStream(inputLine);
634 tmpStream >> value[0] >> value[1] >> value[2];
641 if( (std::string::size_type)inputLine.find(
"TypeOfOutput:")!=std::string::npos){
642 std::istringstream tmpStream(inputLine);
643 tmpStream >> value[0] >> value[1];
644 if(value[1]==
"singlesOutput"){
648 else if(value[1]==
"coincidenceOutput") {
669 std::vector<std::string> stringReflectorValue;
672 std::string inputLine;
675 std::string
filename =
"inputParameter.txt";
679 ifs.open(filename.c_str());
681 G4cerr<<
"File opening Error: Could not open "<<filename<<
G4endl;
685 ifs.getline(inputChar,256);
686 inputLine = inputChar;
689 if(inputChar[0]!=
'#' && inputLine.length()!=0 ){
692 if( (std::string::size_type)inputLine.find(
"reflectorLayer1_Tangential:")!=std::string::npos){
693 std::istringstream tmpStream(inputLine);
694 while(tmpStream >> refValue){
695 stringReflectorValue.push_back(refValue);
696 if(stringReflectorValue.size()>1){
697 G4int tmp_value = atoi(stringReflectorValue[stringReflectorValue.size()-1].c_str());
702 stringReflectorValue.clear();
705 if( (std::string::size_type)inputLine.find(
"reflectorLayer1_Axial:")!=std::string::npos){
706 std::istringstream tmpStream(inputLine);
707 while(tmpStream >> refValue){
708 stringReflectorValue.push_back(refValue);
709 if(stringReflectorValue.size()>1){
710 G4int tmp_value = atoi(stringReflectorValue[stringReflectorValue.size()-1].c_str());
715 stringReflectorValue.clear();
718 if( (std::string::size_type)inputLine.find(
"reflectorLayer2_Tangential:")!=std::string::npos){
719 std::istringstream tmpStream(inputLine);
720 while(tmpStream >> refValue){
721 stringReflectorValue.push_back(refValue);
722 if(stringReflectorValue.size()>1){
723 G4int tmp_value = atoi(stringReflectorValue[stringReflectorValue.size()-1].c_str());
728 stringReflectorValue.clear();
731 if( (std::string::size_type)inputLine.find(
"reflectorLayer2_Axial:")!=std::string::npos){
732 std::istringstream tmpStream(inputLine);
733 while(tmpStream >> refValue){
734 stringReflectorValue.push_back(refValue);
735 if(stringReflectorValue.size()>1){
736 G4int tmp_value = atoi(stringReflectorValue[stringReflectorValue.size()-1].c_str());
741 stringReflectorValue.clear();
744 if( (std::string::size_type)inputLine.find(
"reflectorLayer3_Tangential:")!=std::string::npos){
745 std::istringstream tmpStream(inputLine);
746 while(tmpStream >> refValue){
747 stringReflectorValue.push_back(refValue);
748 if(stringReflectorValue.size()>1){
749 G4int tmp_value = atoi(stringReflectorValue[stringReflectorValue.size()-1].c_str());
754 stringReflectorValue.clear();
757 if( (std::string::size_type)inputLine.find(
"reflectorLayer3_Axial:")!=std::string::npos){
758 std::istringstream tmpStream(inputLine);
759 while(tmpStream >> refValue){
760 stringReflectorValue.push_back(refValue);
761 if(stringReflectorValue.size()>1){
762 G4int tmp_value = atoi(stringReflectorValue[stringReflectorValue.size()-1].c_str());
767 stringReflectorValue.clear();
770 if( (std::string::size_type)inputLine.find(
"reflectorLayer4_Tangential:")!=std::string::npos){
771 std::istringstream tmpStream(inputLine);
772 while(tmpStream >> refValue){
773 stringReflectorValue.push_back(refValue);
774 if(stringReflectorValue.size()>1){
775 G4int tmp_value = atoi(stringReflectorValue[stringReflectorValue.size()-1].c_str());
780 stringReflectorValue.clear();
783 if( (std::string::size_type)inputLine.find(
"reflectorLayer4_Axial:")!=std::string::npos){
784 std::istringstream tmpStream(inputLine);
785 while(tmpStream >> refValue){
786 stringReflectorValue.push_back(refValue);
787 if(stringReflectorValue.size()>1){
788 G4int tmp_value = atoi(stringReflectorValue[stringReflectorValue.size()-1].c_str());
793 stringReflectorValue.clear();
799 G4cout<<
"DOI look-up table is being prepared. "<<
G4endl;
800 std::string outputFileName =
"check_2Dposition.txt";
801 std::ofstream outFile(outputFileName.c_str());
813 AngerLogic(i_DOI, i_tan, i_axial, crystalPositionY, crystalPositionZ, 1, 0.5);