Mixed Data Coincidence Analysis Software 1.0
A program to analyze files produced by the EventMixer software.
GammaEnergyChart.cc
Go to the documentation of this file.
00001 #include "GammaEnergyChart.hh"
00002 
00003 GammaEnergyChart::~GammaEnergyChart()
00004 {
00005   for(map<pair<int, int>, vector<GammaLine*> >::iterator it = myGammaLines->begin(); it!=myGammaLines->end(); it++)
00006     {
00007       for(vector<GammaLine*>::iterator ig = it->second.begin(); ig!=it->second.end(); ig++)
00008         {
00009           delete *ig;
00010         }
00011     }
00012   delete myGammaLines;
00013 }
00014 
00015 GammaEnergyChart::GammaEnergyChart(char * gammaFile, int minA, int maxA, int minZ, int maxZ, float tol, float bgTol)
00016 {  
00017   FILE * myFileStream = fopen(gammaFile,"r");
00018   if(myFileStream==NULL)
00019     {
00020       fprintf (stderr,"Could not open input event file %s, exiting.", gammaFile);
00021       exit(1);
00022     }
00023   myGammaLines = new map<pair<int, int>, vector<GammaLine*> >;
00024   //Read in all gamma lines
00025   while(!feof(myFileStream))
00026     {
00027       int tempA, tempZ;
00028       float tempGamma, tempProb;
00029       fscanf(myFileStream, "%d %d %e %e", &tempA, &tempZ, &tempGamma, &tempProb);
00030       tempGamma/=1000;
00031       if(!(tempA< minA || tempA > maxA || tempZ < minZ || tempZ > maxZ))
00032         {
00033           (*myGammaLines)[make_pair(tempA, tempZ)].push_back(new GammaLine(tol, bgTol));
00034           (*myGammaLines)[make_pair(tempA, tempZ)].back()->gamma = tempGamma;
00035           (*myGammaLines)[make_pair(tempA, tempZ)].back()->probability = tempProb;
00036         }
00037     }
00038 }
00039 
00040 void GammaEnergyChart::addCoincidence(pair<EventHit*, EventHit*> toAdd, float epsilon)
00041 {
00042   for(map< pair< int , int > , vector < GammaLine * > > ::iterator it = 
00043         myGammaLines->begin(); it!=myGammaLines->end(); it++)
00044     {
00045       for(vector<GammaLine*>::iterator ig = it->second.begin(); ig!=it->second.end(); ig++)
00046         {
00047           //cout << (*ig)->gamma << "  " << toAdd.second->Ge << "  " << abs((*ig)->gamma-toAdd.second->Ge) << " " << (*ig)->gamma-toAdd.second->Ge << " EPS: " << epsilon << endl;
00048           (*ig)->addCoincidenceIfValid(toAdd);
00049         }
00050     }
00051 }
00052   
00053 
00054 map<pair<int, int>, vector<GammaLine*> > * GammaEnergyChart::getGammaLines()
00055 {
00056   return myGammaLines;
00057 }
 All Classes Files Functions Variables Defines

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

Created by Rikard Lundmark