Commit 9f9bdbb4 authored by Kostyleva D.A's avatar Kostyleva D.A

initial commit

parent b90755d7
*~
*.root
*.cal
This diff is collapsed.
#pragma once
#include <TObject.h>
#include <TFile.h>
#include <TTree.h>
#include <TH1I.h>
#include <TPolyMarker.h>
#include <TF1.h>
#include <TH1F.h>
#include <TH2F.h>
#include <TCanvas.h>
#include <TMath.h>
#include <TGraph.h>
#include <TObjArray.h>
#include <TRandom3.h>
#include <THStack.h>
#include <TString.h>
#include <TSpectrum.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <sstream>
#define DEFAULTNOPEAKS 20
#define BLOCKSNUMBER 100
#define ADDRESSNUMBER 32
using std::cout;
using std::endl;
using std::setw;
using std::setprecision;
using std::stringstream;
using std::ostringstream;
class AculCalibration : public TObject
{
public:
//smysl jako verejne globalni promenne maji:
//fNOSpectra - pocet zkalibrovanych spekter
//???? - pocet spravne zkalibrovanych spekter
//???? - pocet nespravne zkalibrovanych spekter
//fEnergy[4] - tabulka s energiemi piku, nacita se zvenci
//private:
// TObjArray *fHRawList; //list of raw histograms, list is set to owner
TObjArray fHRawList; //list of raw histograms, list is set to owner
TObjArray fHAnalyzedList; //list of fitted and analyzed histograms, list is set to owner
TObjArray fHEnergyList; //list of calibrated histograms, list is set to owner
THStack fHEnergyStack; //some stack
THStack *fCurrentHStack;
//dodelat current histograms
TObjArray fCurrentHistList;
// TRandom3 *fRanGen;
// static TRandom3 fRanGen; //!
// THStack *fHStack;
//parameters to be read from file
Int_t kRaNOPEAKS;
Double_t fEnergy[DEFAULTNOPEAKS];
Double_t fLowerChannel;
Double_t fUpperChannel;
Double_t fLowerPeakRelativeHight; //pouziva se, private
Double_t fUpperPeakRelativeHight; //pouziva se, private, nastavit nenulovou prednastavenou hodnotu
Double_t fPeakPositionTolerance; //pouziva se, private
Width_t fFitFuncLineWidth; //private
Double_t fFitMinSigma; //pouziva se, private
Double_t fFitPeakThreshold; //pouziva se, private, prozkoumat, k cemu vlastne slouzi ve fci ShowPeaks, popremyslet o vhodnem prednastaveni v konstruktoru
//tyto promenne jsou smyslem tridy, mely by tedy byt snad jako jedine verejne
Double_t fA[BLOCKSNUMBER][ADDRESSNUMBER]; //kalibracni parametry, f(x) = fA*x + fB
Double_t fB[BLOCKSNUMBER][ADDRESSNUMBER]; //kalibracni parametry, f(x) = fA*x + fB
Double_t fC[BLOCKSNUMBER][ADDRESSNUMBER]; //treti kalibracni parametr, jine zavislosti nez pol1
Double_t fD[BLOCKSNUMBER][ADDRESSNUMBER]; //ctvrty kalibracni parametr
//smysl je velmi pochybny
TFile *fCalInformation;
//private:
Double_t fPeak[DEFAULTNOPEAKS]; //v teto promenne je ulozena momentalni hodnota piku v kanalech, zejmena v jedne fci, mozno udelat ji jako lokalni, bude navratovou hodnotou fce PeaksFitting, predelat delku pole
public:
AculCalibration();
//default constructor
AculCalibration(const char* parfile); //
virtual ~AculCalibration();
Bool_t SetInputParameters(const char* inputparfile = "parforcal.par");
// Function which loads text file containing parameters for calibration
//
// -inputparfile: file containing information on calibration source
// -In file with the data must be preserved systematic
// -There cannot be whitelines (probably)
//
//Example of "parforcal.par" file
//................................................................
//223Ra
//
//4 nopeaks //number of peaks
//4.415 E1 //in MeV
//5.153 E2 //in MeV
//5.683 E3 //in MeV
//7.419 E4 //in MeV
//100 lowerchannel //in channels
//4096 upperchannel //in channels
//0.1 lowerpeakhight //in relative units
//0.1 upperpeakhight //in relative units
//0.1 peakpositiontolerance //in relative units
//2 fitfunctionlinewidth //integer 1 - 10
//5 minfitsigma //minimal sigma of the peaks to be fitted
//0.4 fithightthreshold //
//................................................................
Bool_t SetCalibrationParameters(const char* calparfile);
//Loads the file with calibration parameters
//
// calparfile: file containing calibration parameters in format: crate number, address, subaddress, fA, fB, fC, fD
//
// allowed comment characters: *, #, %, //
void PrintInputParameters();
//I hope this is selfunderstanding function
void PrintCalibrationParameters(const Int_t blockmin = 1, const Int_t blockmax = BLOCKSNUMBER - 1);
//Print calibration parameters fA, fB, fC, fD which are currently saved in object AculCalibration
//
// blockmin: minimum block data are displayed for
// blockmax: maximum block data are displayed for
Bool_t CalculateCalibParameters(const char* inputfile, const char* block,
const Int_t address, const char* treename, Int_t lowerchannel = 0,
Int_t upperchannel = 4095, Int_t nEBins = 1000, Int_t lowersubaddress = 0,
Int_t uppersubaddress = ADDRESSNUMBER-1); //calculate calibration parameters for given block in given file
//function is not completely ready to use
//
//function for calculation of calibrate parameters for DAQ system based on "Go4"
//
// inputfile: root file with calibration spectra
// block: block name to be calibrated
// lowerchannel: minimal channel from which the spectrum will be analysed
// upperchannel: maximal channel up to which the spectrum will be analysed
// lowersubaddress: block subaddress
// uppersubaddress: block subbaddress
Bool_t EnergyPositions(const char* inputfile, const char* block,
const Int_t address, const char* treename, Int_t lowerchannel = 0,
Int_t upperchannel = 4095, Int_t lowersubaddress = 0, Int_t uppersubaddress = ADDRESSNUMBER-1);
Int_t PeaksFitting(TH1* hSpectrum, Option_t* option = "", Double_t sigmamin = 2);
//
//possible options: "V", "Q", ""
Int_t SearchPeaks(const TH1 *hin, Double_t sigma = 2, Option_t *option = "", const Int_t searchedpeaks = 100);
void FillRawSpectraFile(const char* rawdatafile, const char* block, const char* treename, TCanvas* rawCanvas = NULL, Option_t *option = "", Int_t xaxismin = 0, Int_t xaxismax = 4096);
void ShowRawSpectra(const char* filename, const Int_t block, TCanvas* rawCanvas = NULL, Int_t xaxismin = 0, Int_t xaxismax = 4096, /*TObjArray* histList = NULL,*/ const Int_t subaddress = 16);
void ShowSpectra(const char* filename, TCanvas* rawCanvas = NULL, Option_t *option = "", Int_t xaxismin = 0, Int_t xaxismax = 4096, /*TObjArray* histList = NULL,*/ const Int_t subaddress = 16);
void ShowAnalyzedSpectra(const char* filename, TCanvas* fittedRawCanvas = NULL, Int_t xaxismin = 0, Int_t xaxismax = 4096, Int_t subaddress = 16);
//This function displays analyzed spectrum from a file, divides the canvas into a sufficient number of pads and displays
//spectrums of each block subadress on the suitable pads or displays one selected spectrum .
//Selects the peaks in the histogram and displays on the histogram how the spectrum were fitted.
//
// filename: file .root containing analysed spectra
// fittedRawCanvas: canvas on which one you will see the spectrum
// xaxismin: Minimum channel, which will be displayed
// xaxismax: Maximum channel, which will be displayed
// subaddress:
void ShowEnergySpectra(const char *filename, TCanvas* energyCanvas = NULL, const Int_t subaddress = 16, Option_t* option = "", Double_t xaxismin = 0., Double_t xaxismax = 10.); //option: "sum", "c", "+",
//Displays the spectrum of the selected subbaddress block in MeV
//
// filename: file .root containing calibrated spectra in MeV
// energyCanvas: : canvas on which one you will see the spectrum
// subaddress: block subaddress which will be drawn
// option: sum ,+ ,c
// xaxismin: Minimum channel, which will be displayed
// xaxismax: Maximum channel, which will be displayed
void DivideCanvas(TCanvas *c1, Int_t inputs);
// void
//dodelat funkce TTree* Get...(...) pro raw, anal i E spectra
Bool_t AddCalFileToList(const char* calfilelist = "CalFileList.log");
void ClearHistograms(Option_t* option = "");
void DeleteStacks(Option_t* option = "");
void MakeCalibrationFile(Char_t* calibrationfile, Char_t* calfilelist);
void Reset();
//private:
ClassDef(AculCalibration, 1);
};
################################################################################
# AculData input with some variables
################################################################################
ACULDATALIBS := -lCore -lCint -lRIO -lTree -lNet -lThread -lHist -lMatrix -lMathCore -lGpad -lGraf -lSpectrum
# Add inputs and outputs from these tool invocations to the build variables
ACULDATA_HEADERS += \
$(ACULDATA)/AculCalibration.h \
$(ACULDATA)/ConfigDictionary.h \
$(ACULDATA)/linkdef.h
ACULDATACPP_SRCS += \
$(ACULDATA)/AculCalibration.cpp \
$(ACULDATA)/ConfigDictionary.cpp \
$(ACULDATA)/AculDataCint.cpp
ACULDATAOBJS += \
$(ACULDATA)/AculCalibration.o \
$(ACULDATA)/ConfigDictionary.o \
$(ACULDATA)/AculDataCint.o
ACULDATACPP_DEPS += \
$(ACULDATA)/AculCalibration.d \
$(ACULDATA)/ConfigDictionary.d \
$(ACULDATA)/AculDataCint.d
\ No newline at end of file
This diff is collapsed.
/********************************************************************
* /home/dariak/Utilities/AculData/AculDataCint.h
* CAUTION: DON'T CHANGE THIS FILE. THIS FILE IS AUTOMATICALLY GENERATED
* FROM HEADER FILES LISTED IN G__setup_cpp_environmentXXX().
* CHANGE THOSE HEADER FILES AND REGENERATE THIS FILE.
********************************************************************/
#ifdef __CINT__
#error /home/dariak/Utilities/AculData/AculDataCint.h/C is only for compilation. Abort cint.
#endif
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define G__ANSIHEADER
#define G__DICTIONARY
#define G__PRIVATE_GVALUE
#include "G__ci.h"
#include "FastAllocString.h"
extern "C" {
extern void G__cpp_setup_tagtableAculDataCint();
extern void G__cpp_setup_inheritanceAculDataCint();
extern void G__cpp_setup_typetableAculDataCint();
extern void G__cpp_setup_memvarAculDataCint();
extern void G__cpp_setup_globalAculDataCint();
extern void G__cpp_setup_memfuncAculDataCint();
extern void G__cpp_setup_funcAculDataCint();
extern void G__set_cpp_environmentAculDataCint();
}
#include "TObject.h"
#include "TMemberInspector.h"
#include "/home/dariak/Utilities/AculData/AculCalibration.h"
#include "/home/dariak/Utilities/AculData/ConfigDictionary.h"
#include <algorithm>
namespace std { }
using namespace std;
#ifndef G__MEMFUNCBODY
#endif
extern G__linked_taginfo G__AculDataCintLN_TClass;
extern G__linked_taginfo G__AculDataCintLN_TBuffer;
extern G__linked_taginfo G__AculDataCintLN_TMemberInspector;
extern G__linked_taginfo G__AculDataCintLN_TObject;
extern G__linked_taginfo G__AculDataCintLN_string;
extern G__linked_taginfo G__AculDataCintLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR;
extern G__linked_taginfo G__AculDataCintLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR;
extern G__linked_taginfo G__AculDataCintLN_TObjArray;
extern G__linked_taginfo G__AculDataCintLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR;
extern G__linked_taginfo G__AculDataCintLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR;
extern G__linked_taginfo G__AculDataCintLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR;
extern G__linked_taginfo G__AculDataCintLN_TFile;
extern G__linked_taginfo G__AculDataCintLN_maplEstringcOTObjArraymUcOlesslEstringgRcOallocatorlEpairlEconstsPstringcOTObjArraymUgRsPgRsPgR;
extern G__linked_taginfo G__AculDataCintLN_TH1;
extern G__linked_taginfo G__AculDataCintLN_TVectorTlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TVectorTlEdoublegR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTBaselEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTBaselEdoublegR;
extern G__linked_taginfo G__AculDataCintLN_TCanvas;
extern G__linked_taginfo G__AculDataCintLN_THStack;
extern G__linked_taginfo G__AculDataCintLN_AculCalibration;
extern G__linked_taginfo G__AculDataCintLN_TElementActionTlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TElementPosActionTlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTRow_constlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTRowlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTDiag_constlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTColumn_constlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTFlat_constlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTSub_constlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTSparseRow_constlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTSparseDiag_constlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTColumnlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTDiaglEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTFlatlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTSublEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTSparseRowlEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_TMatrixTSparseDiaglEfloatgR;
extern G__linked_taginfo G__AculDataCintLN_ConfigDictionary;
extern G__linked_taginfo G__AculDataCintLN_maplEstringcOstringcOlesslEstringgRcOallocatorlEpairlEconstsPstringcOstringgRsPgRsPgR;
extern G__linked_taginfo G__AculDataCintLN_maplEstringcOstringcOlesslEstringgRcOallocatorlEpairlEconstsPstringcOstringgRsPgRsPgRcLcLiterator;
/* STUB derived class for protected member access */
#include "ConfigDictionary.h"
ClassImp(ConfigDictionary);
//////////////////////////////////////////////////////////////////////////////
// BEGIN_HTML
// <p><font size="4"><b>Config(uration)Dictionary class</b></font></p>
// <br>
// <i>Author: Bartlomiej Hnatio 2012-08-06</i>
// <br><br>
// This is very useful class to convert strings containing pairs "key"="value"
// into fast dictionaries. This strings are often read from external files.
// From dictionary created in such way one can easily
// extract values in few supported formats (integer, double, boolean, string)
// It can also be used in opposite direction: when dictionary is created with
// given values and keys, one can create config string, which is most
// convenient to write in external files.
// <br><br><br>
// <u>Most simple example of usage:</u>
// <br><br>Suppose you have two variables fD and fI:
// <pre>-------------------
// Double_t fD;
// Int_t fI;
//
//fD = 3.14;
//fI = 2012;
//-----------------------</pre>
// To save its parameters into file you can create ConfigDictionary class
// instance and use <b>SetDouble</b> and <b>SetInt</b> functions to
// insert parameters values with arbitrarly defined keys (let them be
// really long and descriptive in this example):
// <pre>---------------------
//ConfigDictionary CD;
//CD.SetDouble("Most important variable D",fD);
//CD.SetInt("Equally important integer I",fI);
//---------------------</pre>
// Now configuration string saved in <b>ConfigDictionary</b> CD
// can be obtained with <b>ToString</b> method and should look like:
//<pre>
//"Most important variable D"="3.14" "Equally important integer I"="2012"
//</pre>
// <br> It can be easily saved to a file using simplest <i>fstream</i>
// methods. And the advantage is that as a key one can use any string,
// so configuration file created in such way is very self-explanatory.
// <br>
// <br>
// Now lets suppose the opposite action - loading config from file.
// Imagine, that you have 1000 objects of A class, which config was saved
// to file - one object per line:
// <pre>-----------------
//"Most important variable D"="3.14" "Equally important integer I"="2012"
//"Equally important integer I"="1011" "Most important variable D"="8.15"
//"Most important variable D"="13.16" "Equally important integer I"="10"
//(...)
//----------------</pre>
// Please notice that order in which pairs of keys and values are placed
// in file doesn't make any difference to the ConfigDictionary class.
// To recreate objects, you just read each line containing single
// config string and then create with it ConfigDictionary object
// using special constructor with string as argument,
// or using <b>FromString</b> method. After this, you can
// extract parameters (using <b>GetDouble</b> and <b>GetInt</b> methods)
// with using same keys as were used for saving, and ConfigDictionary
// will return their values:
// <pre>----------------------
//string line;//This line you read from file
//ConfigDictionary CD(line);
//fD = CD.GetDouble("Most important variable D");
//fI = CD.GetInt("Equally important integer I");
//--------------------</pre>
//<br>
// And last but not least: what happens, if key requested by user doesn't
// exist in dictionary? (This can be caused by many reasons, mostly errors on
// user side, but not always).
// When you try to extract non-existent key using <b>Get</b> functions,
// an exception is risen. In normal program it should end execution and print
// some information about where program stopped working.
// But lets say that you don't want that, i.e. program may use default
// configs instead of those from files, or not all keys were that important.
// You can surround all uses of <b>Get</b> methods with try/catch clause.
// So when exception is risen, you will catch it, and decide, if you want
// the program to stop running, or anything else. Simple example is
// shown below:
//<pre>-------------------
//ConfigDictionary CD(some_string);
//try{//try to read important variables:
// double d = CD.GetDouble("crucial var");
// bool b = CD.GetBool("most important b");
// int i = CD.GetInt("unique ID");
// //...and so on
//}catch(std::string & e){//catch any kind of exception
// Error("Some crucial variable wasn't read, ending program!");
// return SOME_REALLY_BAD_ERROR_CODE;
//}
//try{//now less important, or optional:
// string name = CD.GetString("least important variable");
// double p = CD.GetDouble("optional parameter");
// //...and so on
//}catch(std::string & f){
// Info("Some optional variables wasn't read!");
//}
//--------------------</pre>
// END_HTML
//////////////////////////////////////////////////////////////////////////////
//_____________________________________________________________________________
ConfigDictionary::ConfigDictionary(){
//just empty map...
}
//_____________________________________________________________________________
ConfigDictionary::ConfigDictionary(std::string params){
//Just creates dictionary using FromString method
FromString(params);
}
//_____________________________________________________________________________
std::string ConfigDictionary::ToString(){
//Builds string that can be easily saved to file.
//Same format that can be read from files or from QtGui
//This should work same way for all uses
std::map<std::string,std::string>::iterator it;//Iterator to map elements
std::stringstream ss;//stream helpful with adding strings
//iterate whole dictionary:
for (it=configMap.begin();it!=configMap.end();++it){
//insert pairs "key"="value":
ss<<"\""<<it->first<<"\""<<"="<<"\""<<it->second<<"\""<<" ";
}
return ss.str();
}
//_____________________________________________________________________________
void ConfigDictionary::FromString(std::string params){
//params - TString containing list of key=value pairs
//
//Changes string formatted:
//"key1"="value1" "key2"="value with spaces 2" ...
//into map with keys and values
//Useful in lots of I/O functions,
//when we want to have a nice, readable format of data
std::stringstream loading(params);
std::string k,v;
while(!loading.fail()){
getline(loading,k,'\"');//removes everything to first "
getline(loading,k,'\"');//All chars between first two "" are the key
getline(loading,v,'\"');//removes all until third "
getline(loading,v,'\"');//All between another pair of "" is the value
if (!loading.fail())
configMap[k]=v;
}
}
//_____________________________________________________________________________
std::string ConfigDictionary::GetString(std::string key)throw(std::string){
//Extracts string from given key
//(if it exist, otherwise raises exception)
if (configMap.find(key) == configMap.end()){
Error("ConfigDictionary::GetString",
"Couldn't find the key: %s!",key.c_str());
throw(key);
}
return configMap[key];
}
//_____________________________________________________________________________
int ConfigDictionary::GetInt(std::string key)throw(std::string){
//Extracts integer from given key
//(if it exist, otherwise raises exception)
if (configMap.find(key) == configMap.end()){
Error("ConfigDictionary::GetInt",
"Couldn't find the key: %s!",key.c_str());
throw(key);
}
int returned=0;
//Convert string to int:
std::stringstream ss(configMap[key]);
ss>>returned;
return returned;
}
//_____________________________________________________________________________
double ConfigDictionary::GetDouble(std::string key)throw(std::string){
//Extracts integer from given key
//(if it exist, otherwise raises exception)
if (configMap.find(key) == configMap.end()){
Error("ConfigDictionary::GetDouble",
"Couldn't find the key: %s!",key.c_str());
throw(key);
}
double returned=0.0;
//Convert string to double:
std::stringstream ss(configMap[key]);
ss>>returned;
return returned;
}
//_____________________________________________________________________________
bool ConfigDictionary::GetBool(std::string key)throw(std::string){
//Extracts boolean from given key
//(if it exist, otherwise raises exception)
if (configMap.find(key) == configMap.end()){
Error("ConfigDictionary::GetBool",
"Couldn't find the key: %s!",key.c_str());
throw(key);
}
//Convert string to bool:
if (configMap[key].compare("true") == 0)
return true;
else return false;
}
//_____________________________________________________________________________
void ConfigDictionary::SetString(std::string key,std::string value){
//Sets value to key, no comments needed here...
configMap[key] = value;
}
//_____________________________________________________________________________
void ConfigDictionary::SetDouble(std::string key,double value){
//Sets value to key, converts double to string first
std::stringstream ss;
ss<<value;
configMap[key] = ss.str();
}
//_____________________________________________________________________________
void ConfigDictionary::SetInt(std::string key,int value){
//Sets value to key, converts int to string first
std::stringstream ss;
ss<<value;
configMap[key] = ss.str();
}
//_____________________________________________________________________________
void ConfigDictionary::SetBool(std::string key,bool value){
//Sets value to key, converts bool to string first
if (value == true) configMap[key] = "true";
else configMap[key] = "false";
}
#ifndef CONFIGDICTIONARY_H
#define CONFIGDICTIONARY_H
#include "TObject.h"
#include "ReturnCodes.h"
#include "TStopwatch.h"
#include "TROOT.h"
#include <string>
#include <map>
#include <sstream>
#include "TLorentzVector.h"
#include <iostream>
#include "TMath.h"
#include "TString.h"
#include "TTree.h"
class ConfigDictionary{
public:
typedef std::map<std::string,std::string>::iterator CDIter;
ConfigDictionary();
ConfigDictionary(std::string);
virtual ~ConfigDictionary(){};//empty virtual destructor
ClassDef(ConfigDictionary,1);
std::string ToString();
void FromString(std::string);
//These throw errors if couldn't find key:
std::string GetString(std::string)throw(std::string);
int GetInt(std::string)throw(std::string);
double GetDouble(std::string)throw(std::string);
bool GetBool(std::string)throw(std::string);
//These will always set 'something' into map:
void SetString(std::string,std::string);
void SetDouble(std::string,double);
void SetInt(std::string,int);
void SetBool(std::string,bool);
CDIter Begin(){return configMap.begin();};
CDIter End(){return configMap.end();};
private:
std::map<std::string,std::string> configMap;
};
#endif
#ifndef RETURN_CODES_H
#define RETURN_CODES_H
//Some useful return codes
const static int SUCCESS = 0;
const static int IOEXCEPTION = -1;
const static int NOTFOUND = -2;
const static int NULLPOINTER = -3;
const static int UNKNOWN = -4;
const static int FAILURE = -5;
const static int CDEXCEPTION = -6;
const static int EMPTYCONTAINER = -7;
const static int NOTDEFINED = -8;
const static int EXCEPTION = -11;
#endif
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
//#pragma link C++ class AculRaw;
//#pragma link C++ class AculConvert;
#pragma link C++ class AculCalibration;
#pragma link C++ class ConfigDictionary;
#endif
1) set path in makefile according to your operating system
2) type in terminal:
make all
make htmldoc
make install
3) add the install folder to LD_LIBRARY_PATH
{
gSystem->Load("/home/dariak/Utilities/libAculData.so");
AculCalibration cal;
cal.SetInputParameters();
cal.CalculateCalibParameters("clb01_0001.root", "SQ22", 22, "AnalysisxTree", 50, 700);
TCanvas *c1 = new TCanvas();
// cal->ShowRawSpectra("clb01_0001.root", 22, c1);
// cal.ShowSpectra("SQ22[].root", c1, "", 300, 800, 10);
// TFile filerootE("SQ22[]E.root");
// TFile filecal("SQ22[].cal");
// TDirectory dir("dir","dash");
// dir.Add("SQ22[].root");
}
{
gSystem->Load("/home/dariak/Utilities/libAculData.so");
AculCalibration cal;
cal->SetInputParameters();
TCanvas *c1 = new TCanvas();
TFile fr("SQ22[]E.root");
// TH1F *h1 = (TH1F*)fr.Get("HistSQ22[10]E");
// h1->Draw();
cout << fr.GetListOfKeys()->GetEntries() << " histograms" << endl;
TList *histList = fr.GetListOfKeys();
const Int_t noHist = histList->GetEntries();
const Double_t minE = 3;
const Double_t maxE = 8;
Int_t minBin, maxBin;
TH1 *hWork = 0;
c1->Clear();
c1->Divide(6, 6);
for (Int_t i = 0; i < 32; i++) {
fr.GetObject(histList->At(i)->GetName(), hWork);
c1->cd(i+1);
cal->PeaksFitting(hWork);
hWork->Draw();
}
}
{
gSystem->Load("~/workspace/Utilities/libAculData.so");
TFile fr("clb01_0001.root");
TTree *tr = (TTree*)fr.Get("AnalysisxTree");
tr->Draw("SQ22[0]", "SQ22[0]>100");
}
{
// gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo","*", "TStreamerInfo", "RIO", "TStreamerInfo()");
gSystem->Load("./libAculData.so");
// gSystem->Load("~/work/makefilesBe/libTELoss.so");
// gSystem->Load("~/work/makefilesBe/libDetectors.so");
// gSystem->Load("~/work/makefilesBe/libDetectors.so");
// gSystem->Load("~/work/makefilesBe/libBe.so");
THtml h;
h.SetInputDir(".");
// h.MakeIndex("");
// h.MakeClass("TELoss");
// h.MakeClass("TELoss");
// h.MakeClass("TELoss");
h.MakeAll();
/*h.SetInputDir("/media/commondata/work/Eclipse/AculData/Debug:/media/commondata/work/Eclipse/AculData:"
"../Detectors/Debug:../Detectors:"
"../TELoss/Debug:../TELoss:"
"../Be/Debug:../Be:"
);*/
// h.MakeIndex("");
/*h.SetInputDir("/media/commondata/work/makefiles/AculData/Debug:/media/commondata/work/Eclipse/AculData:"
"../Detectors/Debug:../Detectors:"
"../TELoss/Debug:../TELoss:"
"../Be/Debug:../Be:"
);*/
// "$ROOTSYS/include/root");
// h.MakeAll();
// h.MakeClass("AculRaw");
// h.MakeClass("AculConvert");
// h.MakeClass("AculCalibration");
//
// h.MakeClass("AnnularDetector");
//
// h.MakeClass("TELoss");
//
// h.MakeClass("TObject");
// h.MakeClass("TClass");
}
{
gSystem->Load("~/workspace/Utilities/libAculData.so");
}
################################################################################
# Makefile building all dynamic libraries:
# libCalib.so
#
# OBJS - files type *.o (subdir.mk)
# LIBS - list of the loaded libraries (objects.mk)
# RM - command "rm -rf"
# CPP_DEPS - files type *.d (subdir.mk)
# .PHONY -
# .SECONDARY -
#
# Vratislav Chudoba
################################################################################
RM := rm -rf
CC := g++
F90 := gfortran
#global paths
ROOTINCS = $(shell root-config --incdir)
ROOTLIBS = $(shell root-config --libdir)
ROOTCFLAGS = $(shell root-config --cflags)
PWD = $(shell pwd)
#INSTALLFOLDER = $(HOME)/AculLib
ACULDATA = $(PWD)/AculData
-include $(ACULDATA)/AculData.mk
all: libAculData.so \
#ROOT html documentation, it will be done as a program which will be alsa compiled by this makefile, program will be as a last condition after all of the libraries
htmldoc: libAculData.so
-$(RM) htmldoc
root -l -q html.cxx
clean:
-$(RM) $(ACULDATAOBJS) $(ACULDATACPP_DEPS)
-$(RM) $(ACULDATA)/AculDataCint.* libAculData.so
-@echo ' '
-$(RM) htmldoc
-@echo ' '
# Those *Cint* files below need special treating:
$(ACULDATA)/AculDataCint.cpp:
-@echo 'Pre-building AculDataCint.cpp and AculDataCint.h files'
-rootcint -f $(ACULDATA)/AculDataCint.cpp -c -p $(ACULDATA_HEADERS)
-@echo ' '
#*.so files
libAculData.so: $(ACULDATAOBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
$(CC) -L $(ROOTLIBS) -shared -o"libAculData.so" $(ACULDATAOBJS) $(ACULDATALIBS)
@echo 'Finished building target: $@'
@echo ' '
.PHONY: all clean
#.SECONDARY: AculData_pre-build TELoss_pre-build Detectors_pre-build libAculData.so libTELoss.so libDetectors.so
# Each subdirectory must supply rules for building sources it contributes
%.o: %.cpp
@echo 'Building file: $@'
@echo 'Invoking: $(CC) Compiler'
$(CC) -I$(ROOTINCS) -O0 -g3 -Wall -c -fmessage-length=0 -fPIC $(ROOTCFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
# $(CC) -I$(ROOTINCS) -O2 -Wall -mmmx -msse -msse2 -msse3 -mfpmath=sse,387 -march=nocona -mtune=nocona -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $@'
@echo ' '
# fortran object files
$(TELOSS)/ELOSS.o:
@echo 'Building file: $@'
@echo 'Invoking: gfortran'
$(F90) -c -fPIC -o"$(TELOSS)/ELOSS.o" $(TELOSS)/ELOSS.f90
@echo 'Finished building target: $@'
@echo ' '
//226Ra
4 nopeaks //number of peaks
4.784 E1 //in MeV
5.490 E2 //in MeV
6.002 E3 //in MeV
7.687 E4 //in MeV
100 lowerchannel //in channels
4096 upperchannel //in channels
0.35 lowerpeakhight //in relative units
0.5 upperpeakhight //in relative units
0.1 peakpositiontolerance //in relative units
2 fitfunctionlinewidth //integer 1 - 10
5 minfitsigma //minimal sigma of the peaks to be fitted
0.4 fithightthreshold //
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment