//####################################################################
-bool MAPS::getFrame(Int_t FrameNumber) {
+bool MAPS::getFrame(UInt_t FrameNumber) {
fFrameNumber = FrameNumber;
if(fFrameNumber<fEventsSum)
{
- Int_t EVENTOFF = 0;
+ UInt_t EVENTOFF = 0;
Int_t FFILE = 0;
// Calculate offset, to start the readin of the file
//####################################################################
-bool MAPS::getNoise(Int_t Start, Int_t Frames) {
+bool MAPS::getNoise(UInt_t Start, UInt_t Frames) {
//Noise + Pedestals
if(fOk)
{
Float_t NOISE;
Int_t PIXEL;
- for(Int_t i=Start; i<Frames+Start; i++)
+ for(UInt_t i=Start; i<Frames+Start; i++)
{
getFrame(i);
PEDESTAL = 0;
NOISE = 0;
- for(Int_t j=0; j<Frames; j++)
+ for(UInt_t j=0; j<Frames; j++)
{
PEDESTAL+=ARR[j*fPixels+i];
}
PEDESTAL = PEDESTAL/Frames;
- for(Int_t j=0; j<Frames; j++)
+ for(UInt_t j=0; j<Frames; j++)
{
NOISE+=TMath::Power(ARR[j*fPixels+i]-PEDESTAL,2);
}
template <typename arraytype>
-arraytype MAPS::debugStream(const arraytype* (a), Int_t n, Int_t columns, Int_t precision, float highlightabove) {
+void MAPS::debugStream(const arraytype* (a), Int_t n, Int_t columns, Int_t precision, float highlightabove) {
cout << colorwhite << "----------------------------------" << colorreset << endl;
for (int i=0; i<n;i++)
{
cout << endl;
}
-
-bool MAPS::getDynNoise2(Int_t Frames) {
-
- if( fNoiseDyn )
- {
- delete[] fDynFrameArr;
- delete[] fDynCounter;
-
- fDynFrameArr = new Float_t[Frames*fPixels];
- fDynCounter = new Int_t[fPixels];
- }
- else
- {
- fDynNoiseTree->Branch("frame" , &fFrameNumber , "frame/i" , 32000);
- fDynNoiseTree->Branch("noise" , &fNoiseMean , "noise/F" , 32000);
- fDynNoiseTree->Branch("pedestal" , &fPedestalsMean , "pedestal/F" , 32000);
- }
-
- if(fOk)
- {
-//Check amount of Frames
- if(Frames<50)
- {
- cout<<"Too few Frames! Change Frames from "<<Frames<<" to ";
- Frames = 50;
- cout<<Frames<<" !"<<endl;
- }
-// Warning: if too many pixels the dynamic array overflow the ram
- Int_t End = Frames*fPixels*4;
- cout<<"Run getDynNoise() initiated ..."<<endl;
- cout<<"---"<<endl;
- cout<<"'fDynFrameArr' allocates ";
- if (End/(TMath::Power(2,40)) >= 1) {
- printf("%6.2f TB ", (Float_t)(End/(TMath::Power(2,40))) );
- }
- else if (End/(TMath::Power(2,30)) >= 1) {
- printf("%6.2f GB ", (Float_t)(End/(TMath::Power(2,30))) );
- }
- else if (End/(TMath::Power(2,20)) >= 1) {
- printf("%6.2f MB ", (Float_t)(End/(TMath::Power(2,20))) );
- }
- else if (End/(TMath::Power(2,10)) >= 1) {
- printf("%6.2f kB ", (Float_t)(End/(TMath::Power(2,10))) );
- }
- else {
- printf("%6.2f B ", (Float_t)(End));
- }
- cout<<"for dynamic noise calculation! "<<endl;
-
- fDynFrameArr = new Float_t[Frames*fPixels];
- fDynCounter = new Int_t[fPixels];
-
- for(Int_t i=0; i<fPixels; i++) {
- fDynCounter[i]=0;
- }
-
- bool STOP = false;
- fNoiseDyn = false;
-
-//Check availabilty of Frames
- if( Frames > fEventsSum ) {
- Frames = fEventsSum;
- printf("Changed 'Number Frames' to: %u\n", Frames );
- }
-// Get fPixels and allocate array
- Float_t PEDESTAL;
- Float_t NOISE;
-// Int_t PIXEL=0;
-
- if(!fNoiseOk) {
- getNoise(0,Frames);
- }
- {
- int i=0;
-
-
- while(!STOP)
- {
- getFrame(i);
- hitana();
-
- STOP = true;
-
- for(Int_t j=0; j<fPixels; j++)
- {
- if( fHittedPixel[j]==0)
- {
- if( fDynCounter[j]<Frames )
- {
- fDynFrameArr[Frames*j+fDynCounter[j]] = fCdsmatrix[j];//-fPedestals[j];
- fDynCounter[j]++;
-
- STOP = false;
- }
- }
- }
- i++;
- }
- }
-
- for(Int_t i=0; i<fPixels; i++)
- {
- PEDESTAL = 0;
- NOISE = 0;
-
- for(Int_t j=0; j<Frames; j++)
- {
- PEDESTAL+=fDynFrameArr[Frames*i+j];
- }
-
- PEDESTAL = PEDESTAL/Frames;
-
- for(Int_t j=0; j<Frames; j++)
- {
- NOISE+=TMath::Power(fDynFrameArr[Frames*i+j]-PEDESTAL,2);
- }
-
- NOISE = TMath::Sqrt(NOISE/(Frames));
-
- fNoise[i] = NOISE;
- fPedestals[i] = PEDESTAL;
-// PIXEL = i;
-
- fDynCounter[i] = 0;
- }
-
- cout<<"-----------------------"<<endl;
-
- fNoiseOk = true;
- fNoiseDyn = Frames;
-
- if( fSave )
- {
- fFrameNumber = 0;
- fNoiseMean = 0;
- fPedestalsMean = 0;
-
- fDynNoiseTree->Fill();
-
- fFrameNumber = 0;
- fNoiseMean = TMath::Mean((const int)fPixels, fNoise);
- fPedestalsMean = TMath::Mean((const int)fPixels, fPedestals);
-
- fDynNoiseTree->Fill();
- }
- return true;
- }
- else
- {
- return false;
- }
-};
-
-//####################################################################
-
-
bool MAPS::regetDynNoise(Int_t Frames) {
for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
{
//###################################################################
bool MAPS::loadNoise() {
loadNoise(fRootFile);
+ return 0;
}
bool MAPS::loadNoise( TString filename) {
//####################################################################
-void MAPS::plotHitDis(Int_t Start, Int_t Frames) {
+void MAPS::plotHitDis(UInt_t Start, UInt_t Frames) {
if(fOk)
{
//####################################################################
-void MAPS::plotSignal(Int_t Start, Int_t Frames) {
+void MAPS::plotSignal(UInt_t Start, UInt_t Frames) {
if(fOk)
{
TH1F *h5 = new TH1F("Frames 1 histo" , "Frames 1 histo" , 2*16384, -16384, 16384);
TH1F *h6 = new TH1F("CDS histo" , "CDS histo" , 2*16384, -16384, 16384);
- for(int i=Start; i<Start+Frames; i++)
+ for(UInt_t i=Start; i<Start+Frames; i++)
{
if(getFrame(i))
{
//####################################################################
-void MAPS::plotPixSignal(Int_t Start, Int_t Frames, Int_t Pixel) {
+void MAPS::plotPixSignal(UInt_t Start, UInt_t Frames, Int_t Pixel) {
if(fOk)
{
TH1F *h5 = new TH1F("Frames 1 phisto" , "Frames 1 phisto" , 2*16384, -16384, 16384);
TH1F *h6 = new TH1F("CDS phisto" , "CDS phisto" , 2*16384, -16384, 16384);
- for(int i=Start; i<Start+Frames; i++)
+ for(UInt_t i=Start; i<Start+Frames; i++)
{
if(getFrame(i))
{
UInt_t fEventsSum;
Int_t fFile;
- Int_t fFrameNumber; /**< enum value 1 */
+ UInt_t fFrameNumber; /**< enum value 1 */
/// true if all data files OK
bool fOk;
/// if set to true, a root file for the analyzed run will be created, set and passed initMapsRun() to in the constructor
arraytype SumOverArray(const arraytype* (a), Int_t n);
template <typename arraytype>
- arraytype debugStream(const arraytype* (a), Int_t n=512, Int_t columns=8, Int_t precision=2, float highlightabove = 99999999);
+ void debugStream(const arraytype* (a), Int_t n=512, Int_t columns=8, Int_t precision=2, float highlightabove = 99999999);
/**
* @brief Initialize histogram labels and histograms #hint1, #hint2, #fdiscriminatedhitmatrix, #fADCHitmatrix
* @param FrameNumber TheFrame
*
*/
- bool getFrame (Int_t FrameNumber);
+ bool getFrame (UInt_t FrameNumber);
/**
* @brief Old routine, shoould be deletable without side effects */
- bool getNoise (Int_t Start, Int_t Frames);
+ bool getNoise (UInt_t Start, UInt_t Frames);
/**
* @brief Calculates a first estimate of the noise and pedestial of each pixel in #frames
/**
* @brief Old routine, shoould be deletable without side effects */
bool getDynNoise (Int_t Frames = numberofframesfornoise);
- /**
- * @brief Old routine, shoould be deletable without side effects */
- bool getDynNoise2(Int_t Frames = numberofframesfornoise);
-
/**
* @brief Eliminates line structures in the chip
*
void plotNoise (void);
void plotFrame (Int_t FrameNumber);
- void plotHitDis (Int_t Start, Int_t Frames);
- void plotSignal (Int_t Start, Int_t Frames);
- void plotPixSignal (Int_t Start, Int_t Frames, Int_t Pixel);
+ void plotHitDis (UInt_t Start, UInt_t Frames);
+ void plotSignal (UInt_t Start, UInt_t Frames);
+ void plotPixSignal (UInt_t Start, UInt_t Frames, Int_t Pixel);
void writeData ();