![]() |
Mixed Data Coincidence Analysis Software 1.0
A program to analyze files produced by the EventMixer software.
|
00001 #include "EventHit.hh" 00002 EventHit::EventHit(int nTubes, float detEpsilon, float dRatio) 00003 { 00004 numberOfTubes = nTubes; 00005 detectorEpsilon = detEpsilon; 00006 dominateRatio = dRatio; 00007 for(int i = 0; i<nTubes; i++) 00008 DET.push_back(0); 00009 } 00010 00011 int EventHit::GetDominating() 00012 { 00013 int dominating = -10; 00014 for(vector<int>::iterator it = implantationType.affectedScintillators.begin(); it!=implantationType.affectedScintillators.end(); it++) 00015 { 00016 bool itDominating = true; 00017 for(vector<int>::iterator iw = implantationType.affectedScintillators.begin(); iw!=implantationType.affectedScintillators.end(); iw++) 00018 { 00019 if(*it!=*iw) 00020 { 00021 if(DET[(*it)]/DET[(*iw)]<dominateRatio) 00022 itDominating=false; 00023 } 00024 } 00025 if(itDominating) 00026 dominating=*it; 00027 } 00028 return dominating; 00029 } 00030 00031 00032 void EventHit::ComputeHitType() 00033 { 00034 //Check which scintillators were affected. 00035 for(int i = 0; i<numberOfTubes; i++) 00036 { 00037 if(DET[i]>detectorEpsilon) 00038 { 00039 implantationType.affectedScintillators.push_back(i); 00040 } 00041 } 00042 00043 if(UFSP>detectorEpsilon || LFSP>detectorEpsilon) //Particle entered. If something, this must be an implantation. 00044 { 00045 if(BSP>detectorEpsilon) //Particle exited. No implantation. 00046 { 00047 implantationType.statvar = 1; 00048 implantationType.wasOther=true; 00049 implantationType.affectedScintillators.clear(); //If we know that the particle exited, no need to disregard future decays in the affected scintillators. 00050 return; 00051 } 00052 if(implantationType.affectedScintillators.size()<1 || (GetDominating()<-1)) //More than one scintillator affected. No obvious implantation, we also might need to invalidate scintillator implants. 00053 { 00054 if(implantationType.affectedScintillators.size()<1) //no scintillator affected. 00055 implantationType.statvar=2; 00056 else //More than one scintillator affected. 00057 implantationType.statvar=3; 00058 00059 implantationType.wasOther=true; 00060 return; 00061 } 00062 else //Real implantation (or dominating...) 00063 { 00064 int domin = GetDominating(); 00065 implantationType.affectedScintillators.clear(); 00066 implantationType.affectedScintillators.push_back(domin); 00067 implantationType.wasImplantation=true; 00068 return; 00069 } 00070 } 00071 else if(BSP<detectorEpsilon) //Particle did not enter, this is clearly a decay. 00072 { 00073 //Not obvious which scintillator was affected, we might need to invalidate implanted particles in several... 00074 if(implantationType.affectedScintillators.size()<1 || (GetDominating()<-1)) 00075 { 00076 if(implantationType.affectedScintillators.size()<1) //no scintillator affected. 00077 implantationType.statvar=4; 00078 else //More than one scintillator affected. 00079 implantationType.statvar=5; 00080 implantationType.wasOther=true; 00081 return; 00082 } 00083 else //We had an actual decay. This does not guarantee that we had a Ge energy though, that must be checked separately. 00084 { 00085 int domin = GetDominating(); 00086 implantationType.affectedScintillators.clear(); 00087 implantationType.affectedScintillators.push_back(domin); 00088 implantationType.wasDecay=true; 00089 return; 00090 } 00091 } 00092 else //Back scintillator only. 00093 { 00094 if(implantationType.affectedScintillators.size()<1 || (GetDominating()<-1)) 00095 { 00096 if(implantationType.affectedScintillators.size()<1) //no scintillator affected. 00097 implantationType.statvar=6; 00098 else //More than one scintillator affected. 00099 implantationType.statvar=7; 00100 implantationType.wasOther=true; 00101 return; 00102 } 00103 else 00104 { 00105 implantationType.statvar=8; 00106 implantationType.wasOther=true; 00107 return; 00108 } 00109 } 00110 } 00111 00112 string EventHit::toString() 00113 { 00114 stringstream ss; 00115 ss << "EID:" << eventno << " A:" << A << " Z:" << Z << " time:" << time << " UFSP=" << UFSP << " LFSP=" << LFSP << " BSP=" << BSP << " Ge=" << Ge; 00116 ss << ". Hits in scintillators: "; 00117 for(vector<int>::iterator it = implantationType.affectedScintillators.begin(); it!=implantationType.affectedScintillators.end(); it++) 00118 { 00119 ss << " SCid" << *it << "=" << DET[*it]; 00120 } 00121 ss << ". Identified as "; 00122 if(implantationType.wasImplantation) 00123 ss << "IMPLANTATION"; 00124 if(implantationType.wasDecay) 00125 ss << "DECAY"; 00126 if(implantationType.wasOther) 00127 ss << "OTHER"; 00128 ss << " statvar=" <<implantationType.statvar << endl; 00129 return ss.str(); 00130 return ""; 00131 }