*
*/
-Bool_t isBatch = kFALSE;
-
-#include "MAPS.c"
-#include "Run.c"
#include "help.h"
+#include "Run.h"
+#include "MAPS.h"
+
+// #include "Run.cpp"
+#include "HistogramType.cpp"
+#include "MAPS.cpp"
+
Run** runs;
Int_t numberRuns;
void ChargeSpektrum(TString runnumber = "")
{
cout << endl << endl;
- if (gROOT->IsBatch())
- isBatch = kTRUE;
numberRuns=0;
std::vector<int> runList;
std::vector<TString> runListCustomTitle;
std::vector<TString> sumuprunList; // not used yet, add runs to each other, combine statistics
- #include "SetStyle.c"
+ setStyle();
InterpreteUserInput(runnumber, &runList, &runListForceAnalysis, &runListCustomTitle, &sumuprunList, &analysisType);
runs = new Run*[numberRuns];
compareHistogramClassVectorMABSBot.push_back(runs[runi]->histogramwoRTS);
// gROOT->SetBatch(kTRUE);
- if (!isBatch)
+ if (!(gROOT->IsBatch()))
gROOT->SetBatch(kFALSE);
// ****************************************************************
return 1;
}
+/** @brief sets the style for the ROOT plots
+ *
+ * This code block is used to init the global ROOT plotting style, it is included in the ChargeSpectrum main function
+ */
+Bool_t setStyle()
+{
+ ////////////////////////////////////////////////////////////////////////////
+ // //
+ // who: Pete Alonzi (lpa2a@virginia.edu) //
+ // what: rootlogon file (~/.rootlogon.C) //
+ // when: last update: 2009_June_11 //
+ // where: galileo.phys.virginia.edu //
+ // why: change the default root canvas to acceptable configuration //
+ // //
+ // This file is run when you open root. //
+ // Just place it in your home directory and it works automatically. //
+ // If you make a change to this file simply start //
+ // a new root session and the changes will be implemented. //
+ // //
+ // If you did not install roofit then there will be an error //
+ // message when you login, it can be ignored. //
+ // //
+ ////////////////////////////////////////////////////////////////////////////
+
+ // Definition of new styles
+ TStyle *Nab_collaboration = new TStyle("RadHard_AutoTitle","How we like it");
+ TStyle *Nab_collaboration_work = new TStyle("RadHard_NoTitle","How we like it without title");
+
+ // Set the default parameters for style Nab_collaboration
+ Nab_collaboration->SetCanvasBorderMode(0); // Removes Canvas Border
+ Nab_collaboration->SetPadBorderMode(0); // Removes Pad Border
+ Nab_collaboration->SetCanvasColor(0); // Changes Canvas color to white
+ Nab_collaboration->SetPadColor(0); // Changes Pad color to white
+ Nab_collaboration->SetStatColor(0); // Changes Stats bg color to white
+ Nab_collaboration->SetTitleFillColor(0); // Changes Title bg color to white
+ Nab_collaboration->SetLabelFont(42,"xyz"); // Changes Label Font
+ Nab_collaboration->SetTitleFont(42,"xyz"); // Changes Axis Title Font
+ Nab_collaboration->SetPadTickX(1); // Sets tic marks on both horizontal axes
+ Nab_collaboration->SetPadTickY(1); // Sets tic marks on both vertical axes
+ Nab_collaboration->SetTickLength(0.018,"xyz"); // Sets tic length
+ Nab_collaboration->SetOptStat(0); // Turns off Statistics display
+ Nab_collaboration->SetOptTitle(-1); // Turns off Title display
+ Nab_collaboration->SetHistLineWidth(2); // Changes Histogram Line width
+ Nab_collaboration->SetFrameBorderMode(0); // Removes the Frame Border
+ Nab_collaboration->SetFrameFillStyle(0);
+ Nab_collaboration->SetCanvasDefH(494); // Sets Default Canva Height
+ Nab_collaboration->SetCanvasDefW(800); // Sets Default Canvas Width
+ Nab_collaboration->SetPalette(1);
+
+
+ // The next for commands set the default margin size
+ // n.b. the margins do not take axis labels into account! grr!!
+ Nab_collaboration->SetPadTopMargin(0.1); // Set Margin Top
+ Nab_collaboration->SetPadRightMargin(0.1); // Set Margin Right
+ Nab_collaboration->SetPadBottomMargin(0.1); // Set Margin Bottom
+ Nab_collaboration->SetPadLeftMargin(0.1); // Set Margin Left
+
+ //make a nice palette
+ int NRGBs = 7, NCont = 999;
+ Nab_collaboration->SetNumberContours(NCont);
+ Double_t stops[7] = { 0.00, 0.10, 0.25, 0.45, 0.60, 0.75, 1.00 };
+ Double_t red[7] = { 1.00, 0.00, 0.00, 0.00, 0.97, 0.97, 0.10 };
+ Double_t green[7] = { 1.00, 0.97, 0.30, 0.40, 0.97, 0.00, 0.00 };
+ Double_t blue[7] = { 1.00, 0.97, 0.97, 0.00, 0.00, 0.00, 0.00 };
+ TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
+
+ // Make Nab_collaboration_work a copy of Nab_collaboration and remove stats
+ Nab_collaboration->Copy(*Nab_collaboration_work);
+ //Nab_collaboration_work->SetOptStat(1);
+ Nab_collaboration_work->SetOptTitle(0);
+ Nab_collaboration_work->SetPadTopMargin(0.1);
+ Nab_collaboration_work->SetPadRightMargin(0.1);
+
+ // Select Which Style to
+ gROOT->SetStyle("RadHard_AutoTitle");
+ // gROOT->SetStyle("Nab_Collaboration");
+
+
+ // Use the RooFit functions
+ // using namespace RooFit;
+
+ // Force Root to run Nab_collaboration/Nab_collaboration_work style
+ gROOT->ForceStyle();
+
+ return 1;
+}
+
Bool_t CompareLeageCurrent(vector<HistogramType*>* ptCompareHistogramClassVector)
{
#define __HISTOGRAMTYPE__C
#include "HistogramType.h"
-#include <Rtypes.h>
using namespace std;
#include <TStyle.h>
#include <TMinuit.h>
#include <TFitResult.h>
+#include <Rtypes.h>
+#include <vector>
#include "help.h"
-
+class TH1FO;
class HistogramType;
-
-
-/**
- * @brief A class which stores one Histogram, derived from TH1F, see Cern root documentation for more information
- *
- */
-class TH1FO: public TH1F {
-public:
- HistogramType* itsHistogramType = 0;
-
-// TH1FO* Clone(const char *newname="") {
-// TObject *newTObject = this->Clone(newname);
-// TH1FO *newTH1FO = (TH1FO *)newTObject;
-// newTH1FO->itsHistogramType = this->itsHistogramType;
-// return newTH1FO;
-// }
-//
- // Overload = operator
- TH1FO operator=(const TH1FO &h1) {
- TH1FO h2;
- h2 = h1;
- h2.itsHistogramType = h1.itsHistogramType;
- return h2;
- };
- TH1FO& operator=(const TH1F &h1);
-};
-
+class Run;
+struct systemparam;
+struct sensorinfostruct;
+struct labbooksctruct;
/**
* @file HistogramType.h
/// init one custom histogram
void initHistogramCustom(TH1FO* &histogrampointer, TString prefix, Int_t color, Int_t style, Double_t xLow, Double_t xUp, Int_t nBins, TString xaxistitle, TString yaxistitle);
/// init a histogram pointer array
- void initHistogramArray(vector<TH1FO*>* histogramarraypointer, int numberofhisto, TString prefix, Int_t color, Int_t style);
+ void initHistogramArray(std::vector<TH1FO*>* histogramarraypointer, int numberofhisto, TString prefix, Int_t color, Int_t style);
//*****************
// GENERAL HISTOGRAM PROPERTIES
//*****************
/// Sum spectrum, the charge of whole cluster is summed up in binned into this TH1F histogram
// TH1FO* Sum9 = 0;
/// Sum spectrum array, the charge of whole cluster is summed up in binned into this TH1F histogram
- vector<TH1FO*> * a_Sum;
- vector<TH1FO*> a_Sum9;
- vector<TH1FO*> a_Sum25;
+ std::vector<TH1FO*> * a_Sum;
+ std::vector<TH1FO*> a_Sum9;
+ std::vector<TH1FO*> a_Sum25;
/// Veto spectrum, used to find better calibration peak, only entries where Sum over not seed pixels is below @c Run::vetothreshold are binned into this histogram
TH1FO* Veto = 0;
/// Noise histogram
Double_t integralSeedErr=0;
/// fitted position of the most probable value in the over cluster summed spectrum
Float_t posSum=0;
- vector<Float_t> * a_posSum;
- vector<Float_t> a_posSum9;
- vector<Float_t> a_posSum25;
+ std::vector<Float_t> * a_posSum;
+ std::vector<Float_t> a_posSum9;
+ std::vector<Float_t> a_posSum25;
/// fintegral over the sum peak, normalized to number of events
Double_t integralSum=0;
- vector<Double_t> * a_integralSum;
- vector<Double_t> a_integralSum9;
- vector<Double_t> a_integralSum25;
+ std::vector<Double_t> * a_integralSum;
+ std::vector<Double_t> a_integralSum9;
+ std::vector<Double_t> a_integralSum25;
/// fintegral error over the Seed peak, poisson dist. assumed -> sqrt(N) for each bin
Double_t integralSumErr=0;
- vector<Double_t> * a_integralSumErr;
- vector<Double_t> a_integralSumErr9;
- vector<Double_t> a_integralSumErr25;
+ std::vector<Double_t> * a_integralSumErr;
+ std::vector<Double_t> a_integralSumErr9;
+ std::vector<Double_t> a_integralSumErr25;
/// fitted position of the calibration peak of Fe55-beta-photons in the seed spectrum, from a run best suited to the current
Float_t posVeto=0;
/// fintegral over the veto peak, normalized to number of events
/// Integral value, after integrating from #noisethresholdborder to maxbin.
Double_t sr90IntegralVal = -1;
Double_t sr90IntegralErr = -1;
- vector<Double_t> * a_sr90IntegralVal;
- vector<Double_t> a_sr90IntegralVal9;
- vector<Double_t> a_sr90IntegralVal25;
- vector<Double_t> * a_sr90IntegralErr;
- vector<Double_t> a_sr90IntegralErr9;
- vector<Double_t> a_sr90IntegralErr25;
+ std::vector<Double_t> * a_sr90IntegralVal;
+ std::vector<Double_t> a_sr90IntegralVal9;
+ std::vector<Double_t> a_sr90IntegralVal25;
+ std::vector<Double_t> * a_sr90IntegralErr;
+ std::vector<Double_t> a_sr90IntegralErr9;
+ std::vector<Double_t> a_sr90IntegralErr25;
/// Peak and sigma of Seed to Sum ratio
Float_t posSeedPerc = 0;
Bool_t isnormalized = false;
/// Stats if the histograms in this class where created without RTS pixel
Bool_t maskRTSpixel = false;
- /** @brief This vector holds the pixel numbers with RTS noise, found by Run::FindRTSPixelToMask */
- vector<uint> RTSpixel;
+ /** @brief This std::vector holds the pixel numbers with RTS noise, found by Run::FindRTSPixelToMask */
+ std::vector<uint> RTSpixel;
/// stores information from the SQL database of a given run
labbooksctruct* labbook;
*/
#ifndef __MAPS__C
#define __MAPS__C
-#include"MAPS.h"
+#include "MAPS.h"
#include "Run.h"
using namespace std;
if (std::isnan(value)) {
cout << colorred << "Error in updating SQL value for '" << databasevaluename << ", it is 'NaN'." << endlr;
return; }
- if (std::isinf(value)) {
- cout << colorred << "Error in updating SQL value for '" << databasevaluename << ", it is 'NaN'." << endlr;
- return; }
- if (!(abs(value)>=0.0)) {
- cout << colorred << "Error in updating SQL value for '" << databasevaluename << ", it is 'NaN'." << endlr;
- return; }
- if (value > maxval) {
- cout << colorred << "Error in updating SQL value for '" << databasevaluename << ", it is out of range: " << value << " > " << maxval << "." << endlr;
- return; }
- if (value < minval) {
- cout << colorred << "Error in updating SQL value for '" << databasevaluename << ", it is out of range: " << value << " < " << maxval << "." << endlr;
- return; }
- if ((*sqlupdatequery).length() > 0)
- *sqlupdatequery+= ", ";
- *sqlupdatequery += "`" + databasevaluename + "`="+ to_str_w_prec(value, precision);
+ if (std::isinf(value)) {
+ cout << colorred << "Error in updating SQL value for '" << databasevaluename << ", it is 'NaN'." << endlr;
+ return; }
+ if (!(abs(value)>=0.0)) {
+ cout << colorred << "Error in updating SQL value for '" << databasevaluename << ", it is 'NaN'." << endlr;
+ return; }
+ if (value > maxval) {
+ cout << colorred << "Error in updating SQL value for '" << databasevaluename << ", it is out of range: " << value << " > " << maxval << "." << endlr;
+ return; }
+ if (value < minval) {
+ cout << colorred << "Error in updating SQL value for '" << databasevaluename << ", it is out of range: " << value << " < " << maxval << "." << endlr;
+ return; }
+ if ((*sqlupdatequery).length() > 0)
+ *sqlupdatequery+= ", ";
+ *sqlupdatequery += "`" + databasevaluename + "`="+ to_str_w_prec(value, precision);
}
void Run::updateDatabase() {
constructUpdateString(&sqlupdatequery, "LeakageCurfA", histogramwoRTS->calibrated->medianLeakageCurrent);
constructUpdateString(&sqlupdatequery, "LeakageCurfA+", histogramwoRTS->calibrated->medianLeakageCurrentPlus);
constructUpdateString(&sqlupdatequery, "LeakageCurfA-", histogramwoRTS->calibrated->medianLeakageCurrentMinus);
- constructUpdateString(&sqlupdatequery, "CalibrationPeak", Fe55run.posVeto, 4, 0, 1000);
+ constructUpdateString(&sqlupdatequery, "CalibrationPeak", Fe55run.posVeto, 4, -1, 1000);
}
}
if (histogramclassToUseForDB->normalized->calibrated != 0)
#include <TF1.h>
#include <TImageDump.h>
#include <TFitResult.h>
+#include <TRandom.h>
#include <TMath.h>
#include <TF1.h>
class MAPS;
class Run;
-#include "MAPS.c"
-#include "HistogramType.c"
/**
- * @file Run.h
- * @brief Has all the raw and processed information from MAPS about a specific run
- *
- * This class makes SQL requests to the server, gets database results to a given runnumber,
- * stores information about a specific run, writes the analyzed data and results back
- * to the databases and stores the analyzed data as histograms.
- *
- */
-/**
- * @brief Has all the raw and processed information from MAPS about a specific run
- *
- * This class makes SQL requests to the server, gets database results to a given runnumber,
- * stores information about a specific run, writes the analyzed data and results back
- * to the databases and stores the analyzed data as histograms.
- *
- */
-
+* @brief Has all the raw and processed information from MAPS about a specific run
+*
+* This class makes SQL requests to the server, gets database results to a given runnumber,
+* stores information about a specific run, writes the analyzed data and results back
+* to the databases and stores the analyzed data as histograms.
+*
+*/
class Run {
private:
TSQLResult *res;
/// number of rows the SQL database found to a given request
int nrows=0;
-
+
/** @brief is set to true, if custom label is used */
Bool_t customLabel = false;
TCanvas* noisecanvas = NULL;
-
+
/** @brief formats and checks SQL statements */
template <typename T>
string prepareSQLStatement( T );
/**
- * @brief tries to get veto peak position from other, but close runs
- */
+ * @brief tries to get veto peak position from other, but close runs
+ */
void getVetoPeakPositionFromFe55Run();
/**
- * @brief takes a float and a precision and returns the number as a string with given precision
- */
+ * @brief takes a float and a precision and returns the number as a string with given precision
+ */
string to_str_w_prec(const Float_t, const int);
/**
- * @brief takes a float value and a precision and appends it to an SQL statement used to update the database
- */
+ * @brief takes a float value and a precision and appends it to an SQL statement used to update the database
+ */
void constructUpdateString(string *sqlupdatequery, const string databasevaluename, const Double_t value, const int precision, const Double_t minval, const Double_t maxval, const TString defaultval);
-
+
/**
- * @brief writes values back to the SQL database
- */
+ * @brief writes values back to the SQL database
+ */
void updateDatabase();
/**
- * @brief removes all numbers from given string
- */
+ * @brief removes all numbers from given string
+ */
string removeNumbers(std::string x);
-
+
/**
- * @brief removes all punctuation from given string
- */
+ * @brief removes all punctuation from given string
+ */
string removePunctuation(std::string x);
/// if the submatrix is devided in two parts (#devided==true), then here are the rows where the border starts and ends,
// number of pixel, which have fired
uint numberofactivepixel=0;
-
+
/**
- * @brief Generates a human readable string with information about the run
- *
- * The labbook data is used to make a string with useful information about the run
- */
+ * @brief Generates a human readable string with information about the run
+ *
+ * The labbook data is used to make a string with useful information about the run
+ */
Bool_t generateReadableRunCode();
-
+
/// is set to true if an entry was found in the SQL database
Bool_t runexistsAsRootFile = 0;
/// is set to true if the RAW Data is consistent
Bool_t runRAWok = 0;
-
+
TRandom* random1;
/// host name of the machine, used to find correct mount points
char hostname[1024];
/**
- * @brief fills noise histograms in #Run::histogramstruct */
+ * @brief fills noise histograms in #Run::histogramstruct */
Bool_t binNoise(HistogramType* oneHistogramClass);
/**
- * @brief fills leakage histograms in #Run::histogramstruct */
+ * @brief fills leakage histograms in #Run::histogramstruct */
Bool_t binLeakageCurrent(HistogramType* oneHistogramClass);
/**
- * @brief fills Seedm, Sum and Veto #Run::histogramstruct */
+ * @brief fills Seedm, Sum and Veto #Run::histogramstruct */
Bool_t binSeedSumVeto();
/**
- * @brief fills averageF0Hist with average F0 values */
+ * @brief fills averageF0Hist with average F0 values */
Bool_t binF0();
/**
- * @brief fills the average cluster distribution into a 2 dimension histogram #Run::histogramstruct */
+ * @brief fills the average cluster distribution into a 2 dimension histogram #Run::histogramstruct */
Bool_t binCluster();
/// noise quantiles: mean value, sigma in postive direction and sigma in negative direction
Double_t noisequantiles[3];
/// noise quantiles: mean value, sigma in postive direction and sigma in negative direction
Double_t leakagequantiles[3];
-
+
/**
- * @brief Checks if a file exists
- */
+ * @brief Checks if a file exists
+ */
Bool_t checkFileExists(TString);
-
+
Int_t* rootlinestyle;
-
+
/** @brief calls #initCluster for each structure of type @c Run::histogram
- *
- * For the initialization parameters calculated by #findRotatedClusterDimension() are used.
- */
+ *
+ * For the initialization parameters calculated by #findRotatedClusterDimension() are used.
+ */
void initClusters(Float_t xcoord_min_step, Float_t xcoord_abs_min, Float_t xcoord_abs_max, Float_t ycoord_min_step, Float_t ycoord_abs_min, Float_t ycoord_abs_max);
/**
- * @brief Find dimensions and borders of rotated cluster
- *
- * This function ias needed to find out the
- * final cluster size and its dimensions, to properly initialize the
- * TH2F cluster bins
- */
+ * @brief Find dimensions and borders of rotated cluster
+ *
+ * This function ias needed to find out the
+ * final cluster size and its dimensions, to properly initialize the
+ * TH2F cluster bins
+ */
Bool_t findRotatedClusterDimension(Float_t rotateangle = 45);
void initRootParameters();
-
+
/**
- * @brief Fills typical histograms in HistomTyoe
- *
- *
- */
+ * @brief Fills typical histograms in HistomTyoe
+ *
+ *
+ */
void fillAHistogramsinclass(HistogramType* histogramtypepointer, Int_t hiti, Int_t completeclustersize, Float_t pixelSum, Float_t notSeedSum, Float_t* pt_a_pixelSum, Float_t* pt_a_notSeedSum, Float_t pixelSum25, Float_t notSeedSum25, Float_t* pt_a_pixelSum25, Float_t* pt_a_notSeedSum25, Float_t pixelSum9, Float_t notSeedSum9, Float_t* pt_a_pixelSum9, Float_t* pt_a_notSeedum9);
/** @brief set this variable to true, to use the dynamical noise calculation in MAPS:analyzeRun() */
Bool_t dynamicalNoise = 1;
/** @brief set this variable to true, to use the common mode noise filter in MAPS:analyzeRun() */
Bool_t commonModeFilter = 1;
-
+
/** @brief overwrite value from which the integral should be taken, overwrite noise cut in electrons */
Float_t noisethresholdborderE = -1;
/** @brief finds and and masks RTS pixel if maskRTSpixel isset to true */
Bool_t FindRTSPixelToMask(HistogramType* histogramtypepointer, Bool_t verbose = kFALSE);
-
+
public:
/** @brief empty constructor */
Run (void);
Run ( Int_t, Int_t , TString customtitle = "");
/** @brief writes values back to the database, destroys the #MAPS object */
~Run (void);
-
+
systemparam cursystemparam;
void setPlotStyle(Int_t);
/** @brief sets a custom description to be used as a label when plotting the run */
Bool_t setLabel(TString newlabel);
-
+
/** @brief Compare histograms
- *
- * Compare histograms given in the vector
- * #Run::plothistogramtypepointerarray which holds structures
- * of type #Run::histogram into one canvas
- * *
- * Use a line such as
- * @code runs[runi]->plothistogramtypepointerarray.push_back(&runs[runi]->histogramfixedthreshold);
- * @endcode
- * to add histograms to compare, after adding a few, execute
- * @code runs[runi]->plotCompareHistograms();
- * @endcode
- * in ChargeSpectrum.c
- *
- */
+ *
+ * Compare histograms given in the vector
+ * #Run::plothistogramtypepointerarray which holds structures
+ * of type #Run::histogram into one canvas
+ * *
+ * Use a line such as
+ * @code runs[runi]->plothistogramtypepointerarray.push_back(&runs[runi]->histogramfixedthreshold);
+ * @endcode
+ * to add histograms to compare, after adding a few, execute
+ * @code runs[runi]->plotCompareHistograms();
+ * @endcode
+ * in ChargeSpectrum.c
+ *
+ */
Bool_t plotCompareHistograms( );
-
+
/** @brief Writes a given 2D-histogram into a file */
Bool_t writeHistogramToFile(TH1F* onehistogram);
-
+
/** @brief Writes a given histogram into a file */
Bool_t write2DHistogramToFile(TH2F* onehistogram);
/** @brief Makes a gnuplot file to plot the histogram data created in @c Run::writeAllHistogramsToFile() */
void MakeGnuplotFile();
-
+
/// is set to true if an error occured
Bool_t error = 0;
/**
- * @brief analysis the RAW data
- *
- * Seed, sum and Veto spectrum are generated
- * Clusters are found
- * All analysis can be started after initialization of #MAPS
- */
+ * @brief analysis the RAW data
+ *
+ * Seed, sum and Veto spectrum are generated
+ * Clusters are found
+ * All analysis can be started after initialization of #MAPS
+ */
Bool_t analyzeRun(Bool_t force = 0);
/**
- * @brief initialize the RAW root file
- */
+ * @brief initialize the RAW root file
+ */
Bool_t initRun();
/**
- * @brief analysis the RAW data of a given frame
- *
- * F0, F1 matrix are generated
- */
+ * @brief analysis the RAW data of a given frame
+ *
+ * F0, F1 matrix are generated
+ */
Bool_t analyzeFrame(Int_t frame);
Int_t getClustersize();
Bool_t runAllreadyAnalyzed();
-
+
/** @brief Prints all data gathered from the database */
Bool_t debugDBreadout();
Bool_t useDynamicalNoise(Bool_t);
/** @brief Turn on or off the the time dependant filling of the Noise branch in the TTree @c MAPS::regetDynNoise()
- *
- * If set to off: Only the Initial Noise is put into the TTree
- * If set to on: Every 100 frames the TTree is filled with the current noise and pedestials of the pixels, allows time dependant noise analysis
- * You have to rerun the analysis to make this change be applied, that means recreate the ROOT file.
- *
- */
+ *
+ * If set to off: Only the Initial Noise is put into the TTree
+ * If set to on: Every 100 frames the TTree is filled with the current noise and pedestials of the pixels, allows time dependant noise analysis
+ * You have to rerun the analysis to make this change be applied, that means recreate the ROOT file.
+ *
+ */
Bool_t fillTTreeWithMoreThenInitialNoiseValues(Bool_t);
/** @brief Turn on or off the use of common mode noise filter @c MAPS::regetDynNoise() */
/** @brief set a threshold value in ADU to use in the histogram Run::histogramfixedthreshold, this value is used in @c MAPS::initMapsRun() */
Bool_t setFixedThresholdValueADU(HistogramType*, Float_t);
Bool_t setFixedThresholdValueADU(Float_t);
-
+
/**
- * @brief set pathwhere images and data to save to
- */
+ * @brief set pathwhere images and data to save to
+ */
Bool_t setResultsPath(TString path);
/**
- * @brief set dynamical noise mode, exponential decaying noise windows (modified moving average), simple moving average (SMA)
- */
+ * @brief set dynamical noise mode, exponential decaying noise windows (modified moving average), simple moving average (SMA)
+ */
Bool_t setDynamicalNoiseMode(TString mode);
/**
- * @brief set noise threshold border in ADU
- */
+ * @brief set noise threshold border in ADU
+ */
Bool_t setNoisethresholdborderADU(Float_t noisethresholdborder);
-
+
/**
- * @brief set noise threshold border in e
- */
+ * @brief set noise threshold border in e
+ */
Bool_t setNoisethresholdborderE(Float_t noisethresholdborder);
/// stores information from the SQL database of a given run
/** @brief sets #Run::submatrix_x_start, #Run::submatrix_x_end, #Run::submatrix_y_start and #Run::submatrix_y_end to default values */
void setMatrixSpecificParameters();
-
+
/** @brief sets system dependant variables after run data got from db, USB or PXI */
void setSystemSpecificParameters();
///
/** @brief A vector able to hold pointer of type #Run::histogramstruct
- *
- * You push in pointer of the type Run::histogramstruct in ChargeSpectrum.C and then
- * compare different histograms of the same run.
- *
- * See Run::plotCompareHistograms( ) for more information and usage.
- *
- */
+ *
+ * You push in pointer of the type Run::histogramstruct in ChargeSpectrum.C and then
+ * compare different histograms of the same run.
+ *
+ * See Run::plotCompareHistograms( ) for more information and usage.
+ *
+ */
vector<HistogramType*> compareHistogramClassVector;
vector<HistogramType*> compareHistogramClassVector2;
/** @brief The average F0 value of the run over the complete chip in dependance of the time */
TH1FO* averageF0Hist = 0;
-
+
/** @brief The average F0 value of the run over some frames, for each pixel */
TH1FO* averageF0PixelwiseStart = 0; // Over first 1000 frames for each pixel
TH1FO* averageF0PixelwiseEnd = 0; // Over last 1000 frames for each pixel
-
+
TH1FO* averageF0DistrStart = 0; // Over first 1000 frames
TH1FO* averageF0DistrEnd = 0; // Over last 1000 frames
TH1FO* averageF0Distr = 0; // Over first 1000 frames and last 1000 frames
TH1FO* averageF1DistrStart = 0; // Over first 1000 frames
TH1FO* averageF1DistrEnd = 0; // Over last 1000 frames
TH1FO* averageF1Distr = 0; // Over first 1000 frames and last 1000 frames
-
+
/** @brief Plots all histograms from #Run::HistogramType into one canvas
- *
- * @param HistogramType pointer to a histogram structure of type #Run::histogramstruct
- */
+ *
+ * @param HistogramType pointer to a histogram structure of type #Run::histogramstruct
+ */
Bool_t plotAllHistograms(HistogramType*);
-
+
/** @brief Plots average cluster charge distribution
- *
- * Creates a graphical view of the average charge distribution in a
- * cluster
- *
- * @param HistogramType Pointer to a structure of type #Run::histogramstruct
- *
- */
+ *
+ * Creates a graphical view of the average charge distribution in a
+ * cluster
+ *
+ * @param HistogramType Pointer to a structure of type #Run::histogramstruct
+ *
+ */
Bool_t plotClusterDistribution(HistogramType*);
TCanvas* plot1DHistogram(TH1FO* onehistogram, TString fitFuncType = "landau", Bool_t verbose = false, Bool_t logscale =false, Bool_t withOverflow=false, Float_t fitstart=-1, TString titlestr = "", TString legendstr = "");
TCanvas* plot1DHistogram(HistogramType* histogramtypepointer, TH1FO* onehistogram, TString fitFuncType = "landau", Bool_t verbose = false, Bool_t logscale =false, Bool_t withOverflow=false, Float_t fitstart=-1, TString titlestr = "", TString legendstr = "");
-
+
pixelinfo pixelinfoMi34[32];
-
+
/// analyze only half of matrix
Bool_t dividedmatrix = false;
/// if #dividedmatrix ist set to true, which part to analyze?
/// set to TRUE if fits should be drawn and calculated
Bool_t doFits = true;
/// fit curve ro use, gauss or landau
-
+
/** @brief related Fe55 run
- *
- * if the analyzed run is not a Fe55 calibration run, find a related Fe55 run
- * and fill this structure
- *
- * The run can be used to calibrate the run by using the position of the
- * Fe55 calibration peak. ADU can be converted to e-
- */
+ *
+ * if the analyzed run is not a Fe55 calibration run, find a related Fe55 run
+ * and fill this structure
+ *
+ * The run can be used to calibrate the run by using the position of the
+ * Fe55 calibration peak. ADU can be converted to e-
+ */
struct OtherRun
{
-// /// runnumber from where the position of the veto peak was taken
+ // /// runnumber from where the position of the veto peak was taken
Int_t posVetorunnumber = 0;
/// fitted position of the calibration peak of Fe55-beta-photons in the seed spectrum, from a run best suited to the current
Float_t posVeto=-1;
Float_t temperature = -1;
};
/** @brief related Fe55 run
- *
- * if the analyzed run is not a Fe55 calibration run, find a related Fe55 run
- * and fill this structure
- *
- * The run can be used to calibrate the run by using the position of the
- * Fe55 calibration peak. ADU can be converted to e-
- */
+ *
+ * if the analyzed run is not a Fe55 calibration run, find a related Fe55 run
+ * and fill this structure
+ *
+ * The run can be used to calibrate the run by using the position of the
+ * Fe55 calibration peak. ADU can be converted to e-
+ */
OtherRun Fe55run;
-
+
/** @brief specific string wich encodes the database information of the run */
TString runcode="";
/** @brief other information to include in the #Run::humanreadable, not set automatically or gathered by the database */
TString humanreadablesuffix="";
-
+
/// processed run class
MAPS *processed;
+++ /dev/null
-/**
- * @file SetStyle.c
- * @brief sets the style for the ROOT plots
- *
- * This code block is used to init the ROOT plotting style, it is included in the ChargeSpectrum main function
- */
-
-/** @brief sets the style for the ROOT plots
- *
- * This code block is used to init the ROOT plotting style, it is included in the ChargeSpectrum main function
- */
-{
- ////////////////////////////////////////////////////////////////////////////
- // //
- // who: Pete Alonzi (lpa2a@virginia.edu) //
- // what: rootlogon file (~/.rootlogon.C) //
- // when: last update: 2009_June_11 //
- // where: galileo.phys.virginia.edu //
- // why: change the default root canvas to acceptable configuration //
- // //
- // This file is run when you open root. //
- // Just place it in your home directory and it works automatically. //
- // If you make a change to this file simply start //
- // a new root session and the changes will be implemented. //
- // //
- // If you did not install roofit then there will be an error //
- // message when you login, it can be ignored. //
- // //
- ////////////////////////////////////////////////////////////////////////////
-
- // Definition of new styles
- TStyle *Nab_collaboration = new TStyle("RadHard_AutoTitle","How we like it");
- TStyle *Nab_collaboration_work = new TStyle("RadHard_NoTitle","How we like it without title");
-
- // Set the default parameters for style Nab_collaboration
- Nab_collaboration->SetCanvasBorderMode(0); // Removes Canvas Border
- Nab_collaboration->SetPadBorderMode(0); // Removes Pad Border
- Nab_collaboration->SetCanvasColor(0); // Changes Canvas color to white
- Nab_collaboration->SetPadColor(0); // Changes Pad color to white
- Nab_collaboration->SetStatColor(0); // Changes Stats bg color to white
- Nab_collaboration->SetTitleFillColor(0); // Changes Title bg color to white
- Nab_collaboration->SetLabelFont(42,"xyz"); // Changes Label Font
- Nab_collaboration->SetTitleFont(42,"xyz"); // Changes Axis Title Font
- Nab_collaboration->SetPadTickX(1); // Sets tic marks on both horizontal axes
- Nab_collaboration->SetPadTickY(1); // Sets tic marks on both vertical axes
- Nab_collaboration->SetTickLength(0.018,"xyz"); // Sets tic length
- Nab_collaboration->SetOptStat(0); // Turns off Statistics display
- Nab_collaboration->SetOptTitle(-1); // Turns off Title display
- Nab_collaboration->SetHistLineWidth(2); // Changes Histogram Line width
- Nab_collaboration->SetFrameBorderMode(0); // Removes the Frame Border
- Nab_collaboration->SetFrameFillStyle(0);
- Nab_collaboration->SetCanvasDefH(494); // Sets Default Canva Height
- Nab_collaboration->SetCanvasDefW(800); // Sets Default Canvas Width
- Nab_collaboration->SetPalette(1);
-
-
- // The next for commands set the default margin size
- // n.b. the margins do not take axis labels into account! grr!!
- Nab_collaboration->SetPadTopMargin(0.1); // Set Margin Top
- Nab_collaboration->SetPadRightMargin(0.1); // Set Margin Right
- Nab_collaboration->SetPadBottomMargin(0.1); // Set Margin Bottom
- Nab_collaboration->SetPadLeftMargin(0.1); // Set Margin Left
-
- //make a nice palette
- int NRGBs = 7, NCont = 999;
- Nab_collaboration->SetNumberContours(NCont);
- Double_t stops[7] = { 0.00, 0.10, 0.25, 0.45, 0.60, 0.75, 1.00 };
- Double_t red[7] = { 1.00, 0.00, 0.00, 0.00, 0.97, 0.97, 0.10 };
- Double_t green[7] = { 1.00, 0.97, 0.30, 0.40, 0.97, 0.00, 0.00 };
- Double_t blue[7] = { 1.00, 0.97, 0.97, 0.00, 0.00, 0.00, 0.00 };
- TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
-
- // Make Nab_collaboration_work a copy of Nab_collaboration and remove stats
- Nab_collaboration->Copy(*Nab_collaboration_work);
- //Nab_collaboration_work->SetOptStat(1);
- Nab_collaboration_work->SetOptTitle(0);
- Nab_collaboration_work->SetPadTopMargin(0.1);
- Nab_collaboration_work->SetPadRightMargin(0.1);
-
- // Select Which Style to
- gROOT->SetStyle("RadHard_AutoTitle");
- // gROOT->SetStyle("Nab_Collaboration");
-
-
- // Use the RooFit functions
- // using namespace RooFit;
-
- // Force Root to run Nab_collaboration/Nab_collaboration_work style
- gROOT->ForceStyle();
-
-}
#ifndef HELP_H
#define HELP_H
+#include <TROOT.h>
+#include <TStyle.h>
+
#include <iomanip>
#include <sstream>
#include <iostream>
#include <stddef.h>
#include <stdio.h>
#include <unistd.h>
-#include <algorithm> // std::sort
-
-#include "TStopwatch.h"
+#include <algorithm> // sort
+#include <TStopwatch.h>
#include <TCanvas.h>
#include <Rtypes.h>
#include <TNtuple.h>
#include <TString.h>
#include <TTimeStamp.h>
#include <TLegend.h>
+#include <TH1F.h>
+#include <TLine.h>
+
#include "TThread.h"
+#include "HistogramType.h"
-#define MAXHITS 1000000
-#define MAXPIXELS 100000
+#define MAXHITS 1000000
+#define MAXPIXELS 100000
+using namespace std;
//####################################################################
* One example of such a constant are the colors for the console
*
*/
-
Int_t print_progress(Float_t ProgressInPercent) {
Int_t nCharacter = printf("\r [");
for( iBlock=0; iBlock<ProgressInPercent/2; ++iBlock )
{
- putchar( '=' );
+ putchar( '=' );
nCharacter++;
}
for( ; iBlock<100/2; ++iBlock )
{
- putchar( ' ' );
+ putchar( ' ' );
nCharacter++;
}
if((Int_t)ProgressInPercent==100)
{
- printf("\r");
+ printf("\r");
for(Int_t i=0; i<nCharacter; i++)
{
- putchar( ' ' );
+ putchar( ' ' );
}
- printf("\r ... done! \n");
+ printf("\r ... done! \n");
}
return nCharacter;
for( iBlock=0; iBlock<ProgressInPercent/2; ++iBlock )
{
- putchar( '=' );
+ putchar( '=' );
nCharacter++;
}
for( ; iBlock<100/2; ++iBlock )
{
- putchar( ' ' );
+ putchar( ' ' );
nCharacter++;
}
if(ProgressInPercent==100)
{
- printf("\r");
+ printf("\r");
for(Int_t i=0; i<nCharacter; i++)
{
- putchar( ' ' );
+ putchar( ' ' );
}
- printf("\r ...done! \t ( %i:%02i:%02i ) \n", hours, min, sec );
+ printf("\r ...done! \t ( %i:%02i:%02i ) \n", hours, min, sec );
}
return nCharacter;
/// setter
systemparam( Int_t mb, Int_t nb, Int_t vt, Int_t mbn, Int_t nbn ) :
maxbin(mb), nbins(nb), vetothreshold(vt), maxbinnoise(mbn), nbinsnoise(nbn){}
-};
+};
+
+/**
+ * @brief A class which stores one Histogram, derived from TH1F, see Cern root documentation for more information
+ *
+ */
+class TH1FO: public TH1F {
+public:
+ HistogramType* itsHistogramType = 0;
+
+ // TH1FO* Clone(const char *newname="") {
+ // TObject *newTObject = this->Clone(newname);
+ // TH1FO *newTH1FO = (TH1FO *)newTObject;
+ // newTH1FO->itsHistogramType = this->itsHistogramType;
+ // return newTH1FO;
+ // }
+ //
+ // Overload = operator
+ TH1FO operator=(const TH1FO &h1) {
+ TH1FO h2;
+ h2 = h1;
+ h2.itsHistogramType = h1.itsHistogramType;
+ return h2;
+ };
+ TH1FO& operator=(const TH1F &h1);
+};
/**
TString matrix = "";
/// ionizing radiation dose of the measured chip in MRad
Float_t radDoseIon = -1;
- /// non-ionizing radiation dose of the chip in \f$ 10^{10} \frac{\text{neq}}{\text{cm}^2} \f$
+ /// non-ionizing radiation dose of the chip in \f$ 10^{10} \frac{neq}{cm^2} \f$
Float_t radDoseNonIon = -1;
/// position of th seed peak found in the database in ADU for this specific run
Float_t posSeedDB = -1;
/// TODO: add more
};
-void preparecanvas() {
-// TCanvas* canvas = new TCanvas("Canvas1", 700, 500);
-// histogram->SetTitle(titlestr);
-// histogram->SetLineStyle(rootlinestyle[plotStyle]);
-// histogram->SetLineColor(rootcolors[plotStyle]);
-// histogram->SetLineWidth(3);
-// histogram->Draw();
-// TLegend* leg = new TLegend(0.5,0.8,0.89,0.89);//(0.6,0.7,0.89,0.89);
-// leg->SetFillColor(0);
-// leg->SetBorderSize(0);
-// if (legendstr.Length() < 1)
-// legendstr = humanreadablestr;
-// leg->AddEntry(histogram, legendstr, "l");
-//
-// leg->SetTextSize(0.03);
-// leg->Draw();
-//
-// canvas -> SaveAs( savepathresults + "/" + runcode + " " + histogram->GetName() + ".eps");
-//
-// TImage *img = TImage::Create();
-// img->FromPad(canvas);
-// img->WriteImage(savepathresults + "/" + runcode + " " + histogram->GetName() + ".png");
-//
-// TFile *f = new TFile(savepathresults + "/" + runcode + " " + histogram->GetName() + ".root","UPDATE");
-// f->WriteTObject(canvas);
-// f->WriteTObject(img);
-// return 0;
-}
-
void MSaveBigPNG(TCanvas* old_canv, TString filename="", double scale=1) {
gROOT->SetBatch(kTRUE);
// gROOT->ForceStyle(kTRUE);
gStyle->SetLineWidth(orig_lt);
gStyle->SetHistLineWidth(orig_lt);
gStyle->SetFuncWidth(orig_lt);
+
- if (!isBatch) {
+ if (!(gROOT->IsBatch())) {
// gROOT->ForceStyle(kFALSE);
gROOT->SetBatch(kFALSE);
}
}
}
-void *sortThread(void *ptr)
-{
-// TStopwatch timer;
-// args_t *args = (args_t *)ptr;
-// timer.Start();
-// TThread::Lock();
-// TGraph *gr = new TGraph();
-// TThread::UnLock();
-// gr->SetMarkerStyle(20);
-// gr->SetMarkerSize(0.7);
-// gr->SetMarkerColor(args->color);
-// gr->SetLineColor(args->color);
-// gr->SetLineWidth(2);
-//
-// Int_t k = 0;
-// Double_t diffpi;
-// Long64_t npi = 0;
-// Double_t pi = TMath::Pi();
-// const Int_t NR = 20000;
-// const Int_t NR2 = NR/2;
-// Double_t rn[NR];
-// Long64_t i = 0;
-// while (i<=args->n) {
-// i += NR2;
-// args->r->RndmArray(NR,rn);
-// for (Int_t j=0;j<NR;j+=2) {
-// if (rn[j]*rn[j]+rn[j+1]*rn[j+1] <= 1) npi++;
-// }
-// if (i && i %100000000 == 0) {
-// Double_t norm = 4./Double_t(i);
-// diffpi = norm*npi - pi;
-// gr->SetPoint(k,i,diffpi);
-// if (k ==0) {
-// TThread::Lock();
-// gr->Draw("lp");
-// TThread::UnLock();
-// }
-// c1->Modified();
-// c1->Update();
-// k++;
-// }
-// // yield execution to another thread that is ready to run
-// // MSDN :
-// // Sleep(0) causes the thread to relinquish the remainder of its
-// // time slice to any other thread of equal priority that is ready to run.
-// // If there are no other threads of equal priority ready to run,
-// // the function returns immediately, and the thread continues execution.
-// gSystem->Sleep(0);
-// }
-// timer.Stop();
-// Double_t cpu = timer.CpuTime();
-// cputot += cpu;
-// Double_t nanos = 1.e9*cpu/Double_t(args->n);
-// legend->AddEntry(gr,Form("%-14s: %6.1f ns/call",args->name,nanos),"lp");
-// c1->Modified();
-// c1->Update();
-// TThread::Printf("RANDOM = %s : RT=%7.3f s, Cpu=%7.3f s\n",args->name,timer.RealTime(),cpu);
- return 0;
-}
//####################################################################
#endif