Mixed Data Coincidence Analysis Software 1.0
A program to analyze files produced by the EventMixer software.
Public Member Functions | Private Member Functions | Private Attributes
CoincidenceFinder Class Reference

List of all members.

Public Member Functions

 CoincidenceFinder (FileEventParser *fParser, double maxWait, int nTubes=40, float detEps=1E-2, float minGe=1E-2, float maxGe=1E20, unsigned int multiImplant=1, float decayCut=1E20)
 Constructor, constructs the object.
 ~CoincidenceFinder ()
 Destructor, destroys the object.
pair< EventHit *, EventHit * > getNextCoincidence ()
 Returns the next coincidence pair. Please note that this might be invalid if the hasMoreCoincidences returns false. Calling this method will update the next coincidence to the next one automatically.
bool hasMoreCoincidences ()
 Returns true if there are more coincidences to be read from the class, otherwise false.
int getFailureReason (int reason)
 Returns the failure reason.
int getNoHits ()
 Get number of hits.
int getNoImplantations ()
 Get number of implantations.
int getNoDecays ()
 Get number of decays.
int getNoOther ()
 Get number of others.
int getNoCorrectImplantations ()
 Get number of correct implantations.
int getNoDoubleHit ()
 Get number of double hits.
int getNoGeHit ()
 Get number of Ge hits.
int getNoNonAssociatedDecays ()
 Get number of non-associated decays.
int getNoCorrConnected ()
 Get number of correctly connected implant-decays.
int getNoErrConnected ()
 Get number of incorrectly connected implant-decays.
int getNoDestroyedByOther ()
 Get number of implantations destroyed by other-events.
int getNoCorrCoincidence ()
 Get number of correct coincidences.
int getNoFoundCoincidences ()
 Get number of found coincidences.
double getTimeSpan ()
 Get time span.
vector< int > getDetectorCount ()
 Get detector count for each scintillator tube.

Private Member Functions

void FindNextCoincidence ()
 Finds the next coincidence and replaces the nextCoincidence with this. If no coincidence was found, the hasMoreCoincidences is set to false.
void DoImplantation (EventHit *myHit)
 Called from the FindNextCoincidence routine ONLY.
int DoDecay (EventHit *myHit)
 Called from the FindNextCoincidence routine ONLY.
void DoOther (EventHit *myHit)
 Called from the FindNextCoincidence routine ONLY.

Private Attributes

int noHits
 Number of hits.
int failureReasons [8]
 Information about why events were classified as "other".
int noImplantations
 Number of implantations..
int noDecays
 Number of decays.
int noOther
 Number of events other than decay or implant.
int noCorrectImplantations
 Number of correct implantations.
int noDoubleHit
 Number of double hits. Note that double-hits reduces the number of usable implantations.
int noGeHit
 Number of decays resulting in Ge hits.
int noNonAssociatedDecays
 Number of decays not associated with a correct implantation.
int noCorrConnected
 Number of decays connected with the correct implantation.
int noErrConnected
 Number of decays connected with wrong implantation. This should be orders of magnitude lower than noCorrConnected, otherwise we have serious problems...
int noCorrCoincidence
 Number of correct coincidences.
int noDestroyedByOther
 Number of implantations destroyed by another event.
int noFoundCoincidences
 Numer of found coincidences.
double timeSpan
 Time span.
unsigned int multipleImplant
 Multiple implantations allowed.
float decayCutTime
 Decay cut time.
bool myMoreCoincidences
 True if there are more coincidences to be read out from this object.
vector< pair< list< EventHit * >
, double > > 
myScintillatorTubes
FileEventParsermyParser
 The FileEventParser connected to this particular event.
list< pair< EventHit
*, EventHit * > > 
nextCoincidence
 Cointains the next coincidence(s). This may cointain NULL when the hasMoreCoincidences variable is set to false.
double maxDecayWait
 Maximum time to wait for a decay before deeming the tube empty.
int numberOfTubes
 Number of scintillator tubes in detector.
float detectorEpsilon
 Detector epsilon.
float minGeEnergy
 Minimum germanium energy.
float maxGeEnergy
 Maximum germanium energy.
vector< int > detectorCount
 Detector count.

Detailed Description

Definition at line 25 of file CoincidenceFinder.hh.


Constructor & Destructor Documentation

CoincidenceFinder::CoincidenceFinder ( FileEventParser fParser,
double  maxWait,
int  nTubes = 40,
float  detEps = 1E-2,
float  minGe = 1E-2,
float  maxGe = 1E20,
unsigned int  multiImplant = 1,
float  decayCut = 1E20 
)

Constructor, constructs the object.

Parameters:
fParserFileEventParser to read from.
maxWaitMaximum decay wait time.
nTubesNumber of scintillator tubes in detector.
detEpsMinimum energy to consider for the beta detector.
minGeMinimum energy to consider for the germanium detector.
maxGeMaximum energy to consider for the germanium detector.
multiImplantNumber of allowed multiple implantations.
decayCutDecay cut, if more than this the particle is considered as disappeared.

Definition at line 3 of file CoincidenceFinder.cc.

References detectorCount, detectorEpsilon, failureReasons, FindNextCoincidence(), myParser, noCorrCoincidence, noCorrConnected, noCorrectImplantations, noDecays, noDestroyedByOther, noDoubleHit, noErrConnected, noFoundCoincidences, noGeHit, noHits, noImplantations, noNonAssociatedDecays, noOther, numberOfTubes, and timeSpan.

  :multipleImplant(multiImplant), decayCutTime(decayCut), maxDecayWait(maxWait),  minGeEnergy(minGe), maxGeEnergy(maxGe)
{
  numberOfTubes = nTubes;
  detectorEpsilon = detEps;
  myParser = fParser;
  for(int i = 0; i<numberOfTubes; i++)
    {
      pair<list<EventHit*>, double> tmp;
      tmp.second=0-maxWait;
      myScintillatorTubes.push_back(tmp);
      detectorCount.push_back(0);
    }

  //For statistics purpose.
  noHits = 0;
  noImplantations = 0;
  noDecays = 0;
  noOther = 0;
  noCorrectImplantations = 0;
  noDoubleHit = 0;
  noGeHit = 0;
  noNonAssociatedDecays = 0;
  noCorrConnected = 0;
  noErrConnected = 0;
  noDestroyedByOther = 0;
  noCorrCoincidence = 0;
  noFoundCoincidences = 0;
  timeSpan = 0;
  
  memset(failureReasons, 0, sizeof(failureReasons));


  FindNextCoincidence();
}

Member Function Documentation

int CoincidenceFinder::DoDecay ( EventHit myHit) [private]

Called from the FindNextCoincidence routine ONLY.

Parameters:
myHitThe hit to pair decay with.

Definition at line 93 of file CoincidenceFinder.cc.

References HitType::affectedScintillators, decayCutTime, detectorCount, detectorEpsilon, EventHit::eventno, EventHit::Ge, EventHit::implantationType, maxDecayWait, maxGeEnergy, minGeEnergy, myMoreCoincidences, nextCoincidence, noCorrCoincidence, noCorrConnected, noDecays, noErrConnected, noGeHit, noNonAssociatedDecays, and EventHit::time.

Referenced by FindNextCoincidence().

{
  ++noDecays;
  int toReturn = 0;
  if(myHit->Ge>detectorEpsilon)
    {
      ++noGeHit;
    }

  if(!myScintillatorTubes[myHit->implantationType.affectedScintillators.front()].first.empty() && myHit->time - myScintillatorTubes[myHit->implantationType.affectedScintillators.front()].second < decayCutTime) //This decay can be associated with one/more specific implantation(s), hooray!
    {
      bool corrConnected = false;
      
      for(list<EventHit*>::iterator ig = myScintillatorTubes[myHit->implantationType.affectedScintillators.front()].first.begin(); ig!=myScintillatorTubes[myHit->implantationType.affectedScintillators.front()].first.end(); ig++)
        {
          if((*ig)->eventno==myHit->eventno)
            {
              corrConnected = true;
              ++noCorrConnected;
            }
          else
            {
              ++noErrConnected;
            }
        }
      
      //Now, if we could only have the gamma energy...
      if(myHit->Ge>minGeEnergy && myHit->Ge<maxGeEnergy)
        {
          //Now we have coincidence beta-gamma. Let's store the both events, and clean up.
          for(list<EventHit*>::iterator ig = myScintillatorTubes[myHit->implantationType.affectedScintillators.front()].first.begin(); ig!=myScintillatorTubes[myHit->implantationType.affectedScintillators.front()].first.end(); ig++)
            {
              nextCoincidence.push_back(make_pair(*ig,myHit));
              ++toReturn;
            }
          myMoreCoincidences = true;      
          ++detectorCount[myHit->implantationType.affectedScintillators.front()];
          if(corrConnected)
            ++noCorrCoincidence;
        }
      myScintillatorTubes[myHit->implantationType.affectedScintillators.front()].first.clear();
      
      myScintillatorTubes[myHit->implantationType.affectedScintillators.front()].second=-maxDecayWait;
    }
  else
    {
      ++noNonAssociatedDecays;
    }

  return toReturn;
}
void CoincidenceFinder::DoImplantation ( EventHit myHit) [private]

Called from the FindNextCoincidence routine ONLY.

Parameters:
myHitThe hit to do implantation with.

Definition at line 51 of file CoincidenceFinder.cc.

References HitType::affectedScintillators, EventHit::implantationType, maxDecayWait, multipleImplant, noCorrectImplantations, noDoubleHit, noImplantations, EventHit::time, and timeSpan.

Referenced by FindNextCoincidence().

{
  ++noImplantations;
  int scNr=myHit->implantationType.affectedScintillators.front();      
  timeSpan = myHit->time; //in ns.
  if(myScintillatorTubes[scNr].second+maxDecayWait<myHit->time )  //Availible for implantation (time-out).
    {
      ++noCorrectImplantations;
      if(myScintillatorTubes[scNr].first.size()>=multipleImplant) //We cannot add more, yet it is availible, so it is OK to clear it.
          {
            if(myScintillatorTubes[scNr].second>0) //If we have reset the time behind zero, we shall not delete the object since this means that we have returned this event to somewhere else.
            for(list<EventHit*>::iterator ig = myScintillatorTubes[scNr].first.begin(); ig!=myScintillatorTubes[scNr].first.end(); ig++)
              {
                delete *ig;
                ig=myScintillatorTubes[scNr].first.erase(ig);
                ig--;
              }
            myScintillatorTubes[scNr].first.clear();
          }
      
      myScintillatorTubes[scNr].first.push_back(myHit);
      if(myScintillatorTubes[scNr].first.size()>=multipleImplant) //No more, please.
        myScintillatorTubes[scNr].second=myHit->time;
      else
        myScintillatorTubes[scNr].second=-maxDecayWait; //Add more, please.

      return;
    }
  else //not availible for implantation, delete all elements and mark as unavailible.
    {
      ++noDoubleHit;
      myScintillatorTubes[scNr].second=myHit->time; //mark it as unavailible for an even longer time.
      delete myHit;
      for(list<EventHit*>::iterator ig = myScintillatorTubes[scNr].first.begin(); ig!=myScintillatorTubes[scNr].first.end(); ig++)
        {
          delete *ig;
        }
      myScintillatorTubes[scNr].first.clear();
      return;
    }
}
void CoincidenceFinder::DoOther ( EventHit myHit) [private]

Called from the FindNextCoincidence routine ONLY.

<If we have more than this, we probably haven't destroyed that much... hopefully.

Parameters:
myHitThe hit to do the other with.

Definition at line 145 of file CoincidenceFinder.cc.

References HitType::affectedScintillators, EventHit::implantationType, noDestroyedByOther, noOther, and EventHit::time.

Referenced by FindNextCoincidence().

{
  ++noOther;
  if(myHit->implantationType.affectedScintillators.size()<4) 
    {
      for(vector<int>::iterator it = myHit->implantationType.affectedScintillators.begin(); it!=myHit->implantationType.affectedScintillators.end(); it++)
        {
          for(list<EventHit*>::iterator ig = myScintillatorTubes[*it].first.begin(); ig!=myScintillatorTubes[*it].first.end(); ig++)
            {
              if(myScintillatorTubes[*it].second>0)
                {
                  delete *ig;
                  noDestroyedByOther++;
                }
              ig=myScintillatorTubes[*it].first.erase(ig);
              ig--;
            }
          myScintillatorTubes[*it].second=myHit->time; //Block.  
        }
    }
  delete myHit;
  return;
}
vector< int > CoincidenceFinder::getDetectorCount ( )

Get detector count for each scintillator tube.

Returns:
The detector count for each scintillator tube.

Definition at line 292 of file CoincidenceFinder.cc.

References detectorCount.

Referenced by printDetectorCount().

{
  return detectorCount;
}
int CoincidenceFinder::getFailureReason ( int  reason)

Returns the failure reason.

Parameters:
reasonReason

Definition at line 212 of file CoincidenceFinder.cc.

References failureReasons.

Referenced by printStatistics().

{
  return failureReasons[reason];
}

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines

Back to the main page of the Precalibrated Ion Beam Identification Detector project

Created by Rikard Lundmark