using namespace std;
MAPS::MAPS() {
-
+
};
MAPS::MAPS(Run* runp) {
- run = runp;
+ run = runp;
error = initMapsRun();
if (!error)
{
fHitTree->Branch("frame" , &fFrameInfo.frame , "frame/i" , 32000);
fHitTree->Branch("hits" , &fFrameInfo.hits , "hits/i" , 32000);
fHitTree->Branch("pixel" , &fFrameInfo.pixel[0] , "pixel[hits]/i" , 32000);
- fHitTree->Branch("pixelRaw" , &fFrameInfo.pixelRaw[0] , "pixelRaw[hits]/i" , 32000);
+ fHitTree->Branch("pixelRaw" , &fFrameInfo.pixelRaw[0] , "pixelRaw[hits]/i" , 32000);
fHitTree->Branch("pixelthreshold", &fFrameInfo.pixelthreshold[0],"pixelthreshold[hits]/i", 32000);
for(int i=0; i<25; i++) {
fHitTree->Branch( Form("p%i",i+1) , &fFrameInfo.p[i][0] , Form("p%i [hits]/F",i+1) , 32000);
if(fSave && fOk)
{
fOutputFile->cd();
-
+
fHitTree->Write("",TObject::kOverwrite);
fNoiseTree->Write("",TObject::kOverwrite);
fDynNoiseTree->Write("",TObject::kOverwrite);
-
+
hint1->Write("",TObject::kOverwrite);
hint2->Write("",TObject::kOverwrite);
-
+
fOutputFile->Save();
fOutputFile->Close();
-
+
cout<<endl<<"-----------------------"<<endl;
cout<<"\033[1;32mTTrees written!\033[0m"<<endl;
cout<< fRootFile <<" saved!"<<endl;
//fOutputFile->Close();
cout<<"...finished!"<<endl;
cout<<"-----------------------"<<endl;
-
-// TFile::Open(FILENAME);
-// gROOT->ProcessLine("new TBrowser;");
-
-// delete[] fOutputFile;
-// delete[] fHitNtup;
-// delete[] fNoiseNtup;
-// delete[] fMeanNoiseNtup;
-// delete[] hint1;
-// delete[] hint2;
+ // TFile::Open(FILENAME);
+ // gROOT->ProcessLine("new TBrowser;");
+
+ // delete[] fOutputFile;
+ // delete[] fHitNtup;
+ // delete[] fNoiseNtup;
+ // delete[] fMeanNoiseNtup;
+
+ // delete[] hint1;
+ // delete[] hint2;
}
-
+
for(Int_t i=0; i<fFile; i++)
{
fInn[i].close();
delete[] fNoise;
delete[] fPedestals;
cout<< colorwhite <<"================================================================="<<endlr;
-
+
};
//####################################################################
Bool_t MAPS::initMapsRun( ) {
-//
+ //
fInDir=run->storepathRAWLinux;
fOutDir = run->storepathOutLinux; // default ouput directory is input directory
-
- fRunNumber = run->labbook.runnumber;
+
+ fRunNumber = run->labbook.runnumber;
fRows = run->sensorinfocur.rows;
fColumns = run->sensorinfocur.columns;
- fPixels = fRows*fColumns;
- fMatrix = run->labbook.matrix;
- fOrderCode = run->labbook.chipGen;
- fSystem = run->labbook.system;
+ fPixels = fRows*fColumns;
+ fMatrix = run->labbook.matrix;
+ fOrderCode = run->labbook.chipGen;
+ fSystem = run->labbook.system;
fConfigFile = fInDir+Form("/RUN_%i_i.rz",fRunNumber);
fRootFile = fOutDir+Form("/RUN_%i_i.root",fRunNumber);
-
+
cout<<"================================================================="<<endl;
cout<<"-----------------------" << endl;
cout<<" == Initiate MAPS() ... == "<<endl;
cout<<" Save/Overwrite data : "<<fSave<<endl;
cout<<" System specified : "<<fSystem<<endl;
- if(fOrderCode=="FSBB")
- {
- fRows = 8;
- fColumns=208;
- fPixels = fRows*fColumns;
- cout<<"fOrderCode is" <<fOrderCode<<"therefore for data read use fRows: "<<fRows<<"and fColumns: "<<fColumns<<". This is changed after calling reOrder in getFrame()"<<endl;
- }
-// loadNoise();
-
-//-----------------------------------------------
+ if(fOrderCode=="FSBB")
+ {
+ fRows = 8;
+ fColumns=208;
+ fPixels = fRows*fColumns;
+ cout<<"fOrderCode is" <<fOrderCode<<"therefore for data read use fRows: "<<fRows<<"and fColumns: "<<fColumns<<". This is changed after calling reOrder in getFrame()"<<endl;
+ }
+ // loadNoise();
+
+ //-----------------------------------------------
unsigned short int vi,vj;
for (vi = 0; vi <= 0xFF; vi++) {
for (vj = 0; vj <= 0xFF; vj++) {
}
}
-// ifstream inn(fConfigFile, ios::binary);
-// if( !inn.good() )
-// {
-// cout<<"-----------------------"<<endl;
-// cout << colorred << "Configuration file not found: " ;
-// cout << fConfigFile;
-// cout << endlr;
-// return true;
-// }
+ // ifstream inn(fConfigFile, ios::binary);
+ // if( !inn.good() )
+ // {
+ // cout<<"-----------------------"<<endl;
+ // cout << colorred << "Configuration file not found: " ;
+ // cout << fConfigFile;
+ // cout << endlr;
+ // return true;
+ // }
return false;
-//-----------------------------------------------
+ //-----------------------------------------------
}
//####################################################################
{
UInt_t NrAdcBoards;
ifstream inn(fConfigFile, ios::binary);
-
+
if( inn.good() )
{
inn.seekg(0, ios::end);
int End = inn.tellg();
inn.seekg(0, ios::beg);
-
+
char* RAWDATA = new char[End];
inn.read ( RAWDATA, End);
inn.close();
-
+
NrAdcBoards = littleEndian32( RAWDATA, 4*9); // Number of Adc boards installed in the system
if( fSystem == "" )
FileEvNbInConfig = 20000; ///< Event number per file
FileTotalEvNbInConfig = 10000000;
fPixelsData = fColumns*fRows;
-//-----------------------------------------------
+ //-----------------------------------------------
cout<<"-----------------------"<<endl;
cout<<" ==> Load default config file ..."<<endl;
cout<<"-----------------------"<<endl;
cout<<" Config File : default" <<endl;
- cout<<" Events per File : "<<setw(10)<<left<< FileEvNbInConfig <<endl;
+ cout<<" Events per File : "<<setw(10)<<left<< FileEvNbInConfig <<endl;
cout<<" Total Events : "<<setw(10)<<left<< "?" <<endl;
cout<<" Pixels in Data : "<<fPixelsData<<endl;
cout<<"-----------------------"<<endl;
-
-//PARAMETER:
- fF0matrix = new Int_t [fPixelsData]();
- fF1matrix = new Int_t [fPixelsData]();
- fCdsmatrix = new Float_t [fPixelsData]();
- fNoise = new Float_t [fPixelsData]();
- fPedestals = new Float_t [fPixelsData]();
- fHittedPixel= new Int_t [fPixelsData]();
-//-----------------------------------------------
+
+ //PARAMETER:
+ fF0matrix = new Int_t [fPixelsData]();
+ fF1matrix = new Int_t [fPixelsData]();
+ fCdsmatrix = new Float_t [fPixelsData]();
+ fNoise = new Float_t [fPixelsData]();
+ fPedestals = new Float_t [fPixelsData]();
+ fHittedPixel= new Int_t [fPixelsData]();
+ //-----------------------------------------------
return true;
}
//####################################################################
bool MAPS::checkDataFiles( Int_t MaxFiles ) {
- UInt_t Frames;
- TString FILENAME;
-// if(MaxFiles>50)
-// {
-// cout<<"Expected Nr of Files is too big: " << MaxFiles << " ! Nr of Files reduced to 50!"<<endl;
-// MaxFiles=50;
-// }
- fEventsSum = 0;
- fEvents = new Int_t [MaxFiles];
- fInn = new ifstream [MaxFiles];
-
+ UInt_t Frames;
+ TString FILENAME;
+ // if(MaxFiles>50)
+ // {
+ // cout<<"Expected Nr of Files is too big: " << MaxFiles << " ! Nr of Files reduced to 50!"<<endl;
+ // MaxFiles=50;
+ // }
+ fEventsSum = 0;
+ fEvents = new Int_t [MaxFiles];
+ fInn = new ifstream [MaxFiles];
+
for(fFile = 0; fFile<MaxFiles; fFile++)
{
if( !checkDataFile(fFile, Frames) ) {
break;
}
-
- fEvents[fFile] = Frames;
- fEventsSum += Frames;
-
+
+ fEvents[fFile] = Frames;
+ fEventsSum += Frames;
+
FILENAME = fInDir+Form("/RUN_%i_%i.rz",fRunNumber,fFile);
fInn[fFile].open(FILENAME, ios::binary);
fInn[fFile].seekg(0, ios::beg);
-
- fOk = true;
+
+ fOk = true;
}
cout<<"-----------------------"<<endl;
cout<< "TOTAL FRAMES FOUND: "<<fEventsSum<<endl;
}
bool MAPS::checkDataFile( UInt_t FileNr, UInt_t &Frames ) {
-
- TString FILENAME = fInDir+Form("/RUN_%i_%i.rz",fRunNumber,FileNr);
-// cout << FILENAME<< endl;
- ifstream inn(FILENAME, ios::binary);
-// Int_t Pixels=0;
+
+ TString FILENAME = fInDir+Form("/RUN_%i_%i.rz",fRunNumber,FileNr);
+ // cout << FILENAME<< endl;
+ ifstream inn(FILENAME, ios::binary);
+ // Int_t Pixels=0;
if( !inn.good() )
{
return false;
else
{
ULong_t End;
-// UInt_t dataword;
-// int count = 0;
-// int count_tmp = -1;
-// int countframes = -1;
-// char* RAWDATA = new char[4];
-
+ // UInt_t dataword;
+ // int count = 0;
+ // int count_tmp = -1;
+ // int countframes = -1;
+ // char* RAWDATA = new char[4];
+
inn.seekg(0, ios::end);
End = inn.tellg();
-// inn.seekg(0, ios::beg);
-
-// while( inn.good() )
-// {
-// inn.read ( RAWDATA, 4);
-// dataword= littleEndian32( RAWDATA, 0);
-//
-// if( dataword==0x89abcdef )
-// {
-// countframes++;
-//
-// if( countframes==0 )
-// {
-// Pixels = count-28;
-// }
-// if( count-count_tmp!=Pixels+29 && count-count_tmp!=1 )
-// {
-// cout<<"Error in File -> Wrong Number of Pixels: ( "<< count-count_tmp-29 <<" ) in Framenr: "<<countframes<<endl;
-// }
-// count_tmp = count;
-// }
-//
-// count++;
-// }
-
+ // inn.seekg(0, ios::beg);
+
+ // while( inn.good() )
+ // {
+ // inn.read ( RAWDATA, 4);
+ // dataword= littleEndian32( RAWDATA, 0);
+ //
+ // if( dataword==0x89abcdef )
+ // {
+ // countframes++;
+ //
+ // if( countframes==0 )
+ // {
+ // Pixels = count-28;
+ // }
+ // if( count-count_tmp!=Pixels+29 && count-count_tmp!=1 )
+ // {
+ // cout<<"Error in File -> Wrong Number of Pixels: ( "<< count-count_tmp-29 <<" ) in Framenr: "<<countframes<<endl;
+ // }
+ // count_tmp = count;
+ // }
+ //
+ // count++;
+ // }
+
inn.close();
-// delete[] RAWDATA;
-// Frames = countframes;
+ // delete[] RAWDATA;
+ // Frames = countframes;
Frames = End/(4*(fPixelsData+29));
-//-----------------------------------------------
-// cout<<setw(25)<<right<<Form("RUN_%i_%i.rz --> ",fRunNumber,FileNr)<<left;
-//
-// 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<<setw(15)<<left<<Form("%7i Frames",Frames);
+ //-----------------------------------------------
+ // cout<<setw(25)<<right<<Form("RUN_%i_%i.rz --> ",fRunNumber,FileNr)<<left;
+ //
+ // 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<<setw(15)<<left<<Form("%7i Frames",Frames);
if (Frames != FileEvNbInConfig && Frames >= 20000)
cout << colorred << "Run could be corrupted, number of events in file doesn't match configuration! ("<< Frames << " != " << FileEvNbInConfig << ")" << endlr;
-// cout<<setw(15)<<left<<Form("%7i Pixels",Pixels);
-// cout<<endl;
-//-----------------------------------------------
+ // cout<<setw(15)<<left<<Form("%7i Pixels",Pixels);
+ // cout<<endl;
+ //-----------------------------------------------
return true;
}
}
hint2 = new TH2F("Pixmulit", "Pix multiplicity", fColumns, 0, fColumns, fRows, 0, fRows);
fdiscriminatedhitmatrix = new TH2F("HittedPixel Discri", "HittedPixel Discri", fColumns, 0, fColumns, fRows, 0, fRows);
fADCHitmatrix = new TH2F("HittedPixel ADC", "HittedPixel", fColumns, 0, fColumns, fRows, 0, fRows);
-
+
hint1->GetXaxis()->SetRangeUser(0, fColumns);
hint1->GetYaxis()->SetRangeUser(0, fRows);
hint1->GetXaxis()->SetTitle("column");
hint1->GetYaxis()->SetTitle("row");
hint1->GetZaxis()->SetTitle("Signal [ADC]");
-
+
hint2->GetXaxis()->SetRangeUser(0, fColumns);
hint2->GetYaxis()->SetRangeUser(0, fRows);
hint2->GetXaxis()->SetTitle("column");
//####################################################################
bool MAPS::getFrame(UInt_t FrameNumber) {
-
+
fFrameNumber = FrameNumber;
-
+
if(fFrameNumber<fEventsSum)
{
- UInt_t EVENTOFF = 0;
- Int_t FFILE = 0;
-
+ UInt_t EVENTOFF = 0;
+ Int_t FFILE = 0;
+
// Calculate offset, to start the readin of the file
// at a position which is correct for the given FrameNumber
for( ; FFILE<fFile; FFILE++)
{
EVENTOFF+=fEvents[FFILE];
-
+
if(fFrameNumber<EVENTOFF) {
EVENTOFF-=fEvents[FFILE];
break;
}
}
-
- Int_t POSFILE = 4*(fPixelsData+29)*(fFrameNumber-EVENTOFF);
- Int_t HDRLENGTH = 4*28;
- Int_t DATALENGTH = 4*fPixelsData;
-
- char* HDRDATA = new char[HDRLENGTH]; //delete[] HDRDATA;
- char* RAWDATA = new char[DATALENGTH]; //delete[] RAWDATA;
-
- fInn[FFILE].seekg (POSFILE, ios::beg);
- fInn[FFILE].read (HDRDATA,HDRLENGTH);
- fInn[FFILE].read (RAWDATA,DATALENGTH);
+
+ Int_t POSFILE = 4*(fPixelsData+29)*(fFrameNumber-EVENTOFF);
+ Int_t HDRLENGTH = 4*28;
+ Int_t DATALENGTH = 4*fPixelsData;
+
+ char* HDRDATA = new char[HDRLENGTH]; //delete[] HDRDATA;
+ char* RAWDATA = new char[DATALENGTH]; //delete[] RAWDATA;
+
+ fInn[FFILE].seekg (POSFILE, ios::beg);
+ fInn[FFILE].read (HDRDATA,HDRLENGTH);
+ fInn[FFILE].read (RAWDATA,DATALENGTH);
// Process Header Data
// Event number : Increment from 0 at each event taken
- UInt_t EvNo = littleEndian32(HDRDATA, 1*4);
+ UInt_t EvNo = littleEndian32(HDRDATA, 1*4);
// Event position in file : Increment from 0 after each event write
- UInt_t EvPos = littleEndian32(HDRDATA, 2*4);
-// UInt_t EvDate = littleEndian32(HDRDATA, 4*4); ///< Event date = 0
-// UInt_t EvTime = littleEndian32(HDRDATA, 5*4); // Event time = SSSS ssss ( S = second s = mS - 10 ms resolution )
-// UInt_t EvVmeTime = littleEndian32(HDRDATA, 7*4); // Time to read VME boards in ms [10 ms res]
-// UInt_t EvNetTime = littleEndian32(HDRDATA,10*4); // Time to send one event by ethernet in ms [10 ms res]
-//
- fFrameInfo.frame = fFrameNumber; // Own counting
- fFrameInfo.evno = EvNo;
- fFrameInfo.evpos = EvPos;
-
-// Process Pixel Data
+ UInt_t EvPos = littleEndian32(HDRDATA, 2*4);
+ // UInt_t EvDate = littleEndian32(HDRDATA, 4*4); ///< Event date = 0
+ // UInt_t EvTime = littleEndian32(HDRDATA, 5*4); // Event time = SSSS ssss ( S = second s = mS - 10 ms resolution )
+ // UInt_t EvVmeTime = littleEndian32(HDRDATA, 7*4); // Time to read VME boards in ms [10 ms res]
+ // UInt_t EvNetTime = littleEndian32(HDRDATA,10*4); // Time to send one event by ethernet in ms [10 ms res]
+ //
+ fFrameInfo.frame = fFrameNumber; // Own counting
+ fFrameInfo.evno = EvNo;
+ fFrameInfo.evpos = EvPos;
+
+ // Process Pixel Data
for(Int_t i=0; i<fPixelsData; i++)
{
- if ( fSystem == "PXI" )
+ if ( fSystem == "PXI" )
{
- fF0matrix [i] = (Int_t)littleEndian16(RAWDATA,4*i+2);
- fF1matrix [i] = (Int_t)littleEndian16(RAWDATA,4*i+0);
+ fF0matrix [i] = (Int_t)littleEndian16(RAWDATA,4*i+2);
+ fF1matrix [i] = (Int_t)littleEndian16(RAWDATA,4*i+0);
if( fF1matrix[i]<0 ) {
fF0matrix[i]+=1; // Correction to error in DAQ code
}
}
- else if ( fSystem == "USB" || fSystem == "Pegasus" )
+ else if ( fSystem == "USB" || fSystem == "Pegasus" )
{
- fF0matrix [i] = value1 [(UChar_t)RAWDATA[4*i+1]] [(UChar_t)RAWDATA[4*i+2]];
- fF1matrix [i] = value2 [(UChar_t)RAWDATA[4*i]] [(UChar_t)RAWDATA[4*i+1]];
+ fF0matrix [i] = value1 [(UChar_t)RAWDATA[4*i+1]] [(UChar_t)RAWDATA[4*i+2]];
+ fF1matrix [i] = value2 [(UChar_t)RAWDATA[4*i]] [(UChar_t)RAWDATA[4*i+1]];
}
- fCdsmatrix [i] = fF0matrix[i] - fF1matrix[i];
+ fCdsmatrix [i] = fF0matrix[i] - fF1matrix[i];
}
-//==========================================================================
-// -----------------
-// If pixel array is different from 'standard',
-// please manipulate these arrays accordingly:
-// - fCdsmatrix
-// - fF0matrix
-// - fF1matrix
-// Use 'fOrderCode' to choose the respective order!
-// -----------------
-
- if (fOrderCode == "") { }
- else if (fOrderCode == "Mi34") { }
- else if (fOrderCode == "Pegasus"){ }
- // else if (fOrderCode == "FSBB") { }
- else if (fOrderCode == "FSBB") { reorderFSBB(); }
- else if (fOrderCode == "Mi29a") { reorderMi29a(); }
-// else if (fOrderCode == "Mi29b") { reorderMi29b(); }
-//==========================================================================
+ //==========================================================================
+ // -----------------
+ // If pixel array is different from 'standard',
+ // please manipulate these arrays accordingly:
+ // - fCdsmatrix
+ // - fF0matrix
+ // - fF1matrix
+ // Use 'fOrderCode' to choose the respective order!
+ // -----------------
+
+ if (fOrderCode == "") { }
+ else if (fOrderCode == "Mi34") { }
+ else if (fOrderCode == "Pegasus"){ }
+ // else if (fOrderCode == "FSBB") { }
+ else if (fOrderCode == "FSBB") { reorderFSBB(); }
+ else if (fOrderCode == "Mi29a") { reorderMi29a(); }
+ // else if (fOrderCode == "Mi29b") { reorderMi29b(); }
+ //==========================================================================
delete[] HDRDATA;
delete[] RAWDATA;
-
+
fFrameOk = true;
return true;
}
return false;
}
};
-
+
//####################################################################
bool MAPS::getNoise(UInt_t Start, UInt_t Frames) {
//Noise + Pedestals
- if(fOk)
+if(fOk)
+{
+ cout<<"Run getNoise() ..."<<endl;
+ //Check amount of Frames
+ if(Frames<50)
{
- cout<<"Run getNoise() ..."<<endl;
-//Check amount of Frames
- if(Frames<50)
+ cout<<"Too few Frames! Change Frames from "<<Frames<<" to ";
+ Frames = 50;
+ cout<<Frames<<" !"<<endl;
+ }
+ //Check availabilty of Frames
+ if( Frames > fEventsSum ) {
+ Frames = fEventsSum;
+ printf("Changed 'Number Frames' to: %u\n", Frames );
+ }
+ if( Frames+Start > fEventsSum ) {
+ Start = fEventsSum-Frames;
+ printf("Changed 'First Event' to: %u\n", Start );
+ }
+ // Get fPixels and allocate array
+ Float_t *ARR = new Float_t[Frames*fPixels];
+ Float_t PEDESTAL;
+ Float_t NOISE;
+ Int_t PIXEL;
+
+ for(UInt_t i=Start; i<Frames+Start; i++)
+ {
+ getFrame(i);
+
+ for(Int_t j=0; j<fPixels; j++)
{
- cout<<"Too few Frames! Change Frames from "<<Frames<<" to ";
- Frames = 50;
- cout<<Frames<<" !"<<endl;
- }
-//Check availabilty of Frames
- if( Frames > fEventsSum ) {
- Frames = fEventsSum;
- printf("Changed 'Number Frames' to: %u\n", Frames );
- }
- if( Frames+Start > fEventsSum ) {
- Start = fEventsSum-Frames;
- printf("Changed 'First Event' to: %u\n", Start );
+ ARR[(i-Start)*fPixels+j] = fCdsmatrix[j];
}
-// Get fPixels and allocate array
- Float_t *ARR = new Float_t[Frames*fPixels];
- Float_t PEDESTAL;
- Float_t NOISE;
- Int_t PIXEL;
-
- for(UInt_t i=Start; i<Frames+Start; i++)
+ }
+
+
+ if(fSave)
+ {
+ fNoiseTree->Reset();
+ fNoiseTree->Branch("pixel" , &PIXEL , "pixel/i" , 32000);
+ fNoiseTree->Branch("noise" , &NOISE , "noise/F" , 32000);
+ fNoiseTree->Branch("pedestal" , &PEDESTAL , "pedestal/F" , 32000);
+ }
+
+ for(Int_t i=0; i<fPixels; i++)
+ {
+ PEDESTAL = 0;
+ NOISE = 0;
+
+ for(UInt_t j=0; j<Frames; j++)
{
- getFrame(i);
-
- for(Int_t j=0; j<fPixels; j++)
- {
- ARR[(i-Start)*fPixels+j] = fCdsmatrix[j];
- }
+ PEDESTAL+=ARR[j*fPixels+i];
}
-
-
- if(fSave)
+
+ PEDESTAL = PEDESTAL/Frames;
+
+ for(UInt_t j=0; j<Frames; j++)
{
- fNoiseTree->Reset();
- fNoiseTree->Branch("pixel" , &PIXEL , "pixel/i" , 32000);
- fNoiseTree->Branch("noise" , &NOISE , "noise/F" , 32000);
- fNoiseTree->Branch("pedestal" , &PEDESTAL , "pedestal/F" , 32000);
+ NOISE+=TMath::Power(ARR[j*fPixels+i]-PEDESTAL,2);
}
-
- for(Int_t i=0; i<fPixels; i++)
- {
- PEDESTAL = 0;
- NOISE = 0;
-
- for(UInt_t j=0; j<Frames; j++)
- {
- PEDESTAL+=ARR[j*fPixels+i];
- }
-
- PEDESTAL = PEDESTAL/Frames;
-
- for(UInt_t j=0; j<Frames; j++)
- {
- NOISE+=TMath::Power(ARR[j*fPixels+i]-PEDESTAL,2);
- }
-
- NOISE = TMath::Sqrt(NOISE/(Frames-1));
-
- fNoise[i] = NOISE;
- fPedestals[i] = PEDESTAL;
- PIXEL = i;
-
- if(fSave) {
- fNoiseTree->Fill();
- }
+
+ NOISE = TMath::Sqrt(NOISE/(Frames-1));
+
+ fNoise[i] = NOISE;
+ fPedestals[i] = PEDESTAL;
+ PIXEL = i;
+
+ if(fSave) {
+ fNoiseTree->Fill();
}
-
- cout<<"-----------------------"<<endl;
-
- delete[] ARR;
- fNoiseOk = true;
- return true;
- }
- else
- {
- return false;
}
+
+ cout<<"-----------------------"<<endl;
+
+ delete[] ARR;
+ fNoiseOk = true;
+ return true;
+}
+else
+{
+ return false;
+}
};
//####################################################################
Float_t* pixelpedestal2 = new Float_t[fPixels]();
/// temporal variable to save second noise estimate
Float_t* pixelnoise2 = new Float_t[fPixels]();
-
+
noiselastframes = new std::queue<Float_t>[fPixels]();
CDSlastframes = new std::queue<Float_t>[fPixels]();
-
+
/// number of frames cut away in second noise estimate (propably hit frames)
Int_t* nframescutawaysecondnoiseestimate = new Int_t[fPixels]();
Int_t npixelscutawaysecondnoiseestimate=0;
/// number of frames cut away in third noise estimate (hopefully hit frames)
Int_t* nframescutawaythirdnoiseestimate = new Int_t[fPixels]();
Int_t npixelscutawaythirdnoiseestimate=0;
-
-
-
-
-// fDynNoiseTree->Branch("frame" , &fFrameNumber , "frame/i" , 32000);
-// fDynNoiseTree->Branch("noise" , &fNoiseMean , "noise/F" , 32000);
-// fDynNoiseTree->Branch("pedestal" , &fPedestalsMean , "pedestal/F" , 32000);
-
+
+
+
+
+ // fDynNoiseTree->Branch("frame" , &fFrameNumber , "frame/i" , 32000);
+ // fDynNoiseTree->Branch("noise" , &fNoiseMean , "noise/F" , 32000);
+ // fDynNoiseTree->Branch("pedestal" , &fPedestalsMean , "pedestal/F" , 32000);
+
// check if all RAW data files are OK
if(fOk)
{
for(Int_t framei=startframe; framei<frames+startframe; framei++)
{
getFrame(framei);
-// cout << "RAW CDS signal, frame: "<< framei;;
-// debugStream(fCdsmatrix, fPixels, fColumns,3);
+ // cout << "RAW CDS signal, frame: "<< framei;;
+ // debugStream(fCdsmatrix, fPixels, fColumns,3);
for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
{
}
else
{
-// cout << "frame: " << framei << " pixel: " << pixeli << " CDS: " << fCdsmatrix[pixeli] << endl;
-// cout << 1.*fCdsmatrix[pixeli] << " > " << 5.*fNoise[pixeli] << endl;
+ // cout << "frame: " << framei << " pixel: " << pixeli << " CDS: " << fCdsmatrix[pixeli] << endl;
+ // cout << 1.*fCdsmatrix[pixeli] << " > " << 5.*fNoise[pixeli] << endl;
nframescutawaysecondnoiseestimate[pixeli]++;
}
}
}
npixelscutawaysecondnoiseestimate = SumOverArray(nframescutawaysecondnoiseestimate, fPixels);
cout << "In second estimate of dynamic noise, cutted away " << npixelscutawaysecondnoiseestimate << " pixels, in " << frames << " frames. (" << (npixelscutawaysecondnoiseestimate*100./fPixels/frames) << " %)" << endl;
-
+
// third estimate
// cut away pixels with cds - pedestial > 5 * sigma of noise value from second estimate
// sum up over all frames every CDS value, pixelwise
}
else
{
-// cout << "Pixel: " << pixeli << ": " << 1.*fCdsmatrix[pixeli] << " - " << fPedestals[pixeli] << " > " << 3.*pixelnoise2[pixeli] << endl;
+ // cout << "Pixel: " << pixeli << ": " << 1.*fCdsmatrix[pixeli] << " - " << fPedestals[pixeli] << " > " << 3.*pixelnoise2[pixeli] << endl;
nframescutawaythirdnoiseestimate[pixeli]++;
}
}
fNoiseTree->Branch("pixel" , &PIXEL , "pixel/i" , 32000);
fNoiseTree->Branch("noise" , &NOISE , "noise/F" , 32000);
fNoiseTree->Branch("pedestal" , &PEDESTAL , "pedestal/F" , 32000);
+
+ for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
+ {
+ PEDESTAL = fPedestals[pixeli];
+ NOISE = fNoise[pixeli];
+ PIXEL = pixeli;
- for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
- {
- PEDESTAL = fPedestals[pixeli];
- NOISE = fNoise[pixeli];
- PIXEL = pixeli;
-
- if (NOISE > 0)
- fNoiseTree->Fill();
- }
-// getNoise(startframe, frames);
+ if (NOISE > 0)
+ fNoiseTree->Fill();
+ }
+ // getNoise(startframe, frames);
}
fNoiseOk = true;
fPedestalhighFrames++;
pedestalhighinthisframe=true;
}
-// cout<<"\rFrame: "<<fFrameNumber<< " row: " << (Int_t)pixeli/fColumns << " Pedestial of pixel: " << fPedestals[pixeli] << " --> Pedestal suspiciously high!"<<endl;
-// cout<<" CDS signal of sensor: ";
-// debugStream<>(fCdsmatrix , fPixels, fColumns, 1, 20);
-// cout<<" Pedestial of sensor: ";
-// debugStream<>(fPedestals , fPixels, fColumns, 1, 20);
-// cout<<" Hitted Pixel discriminator matrix: ";
-// debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
-// exit(1);
+ // cout<<"\rFrame: "<<fFrameNumber<< " row: " << (Int_t)pixeli/fColumns << " Pedestial of pixel: " << fPedestals[pixeli] << " --> Pedestal suspiciously high!"<<endl;
+ // cout<<" CDS signal of sensor: ";
+ // debugStream<>(fCdsmatrix , fPixels, fColumns, 1, 20);
+ // cout<<" Pedestial of sensor: ";
+ // debugStream<>(fPedestals , fPixels, fColumns, 1, 20);
+ // cout<<" Hitted Pixel discriminator matrix: ";
+ // debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
+ // exit(1);
}
if (abs(fNoise[pixeli])>20)
{
noisehighinthisframe=true;
}
// cout << colorred << fFrameNumber << endlr;
-// if (fFrameNumber==15683 || fFrameNumber==15684)
-// {
-// cout <<"\rFrame: "<<fFrameNumber<< " row: " << (Int_t)pixeli/fColumns << " Noise of pixel: " << fNoise[pixeli] << " --> Noise suspiciously high! "<<endl;
-// cout<<" CDS signal of sensor: ";
-// debugStream<>(fCdsmatrix , fPixels, fColumns, 0, 20);
-// cout<<" Noise of sensor: ";
-// debugStream<>(fNoise , fPixels, fColumns, 0, 20);
-// cout<<" Hitted Pixel discriminator matrix: ";
-// debugStream<>(fHittedPixel, fPixels, fColumns, 0, 1);
-// }
+ // if (fFrameNumber==15683 || fFrameNumber==15684)
+ // {
+ // cout <<"\rFrame: "<<fFrameNumber<< " row: " << (Int_t)pixeli/fColumns << " Noise of pixel: " << fNoise[pixeli] << " --> Noise suspiciously high! "<<endl;
+ // cout<<" CDS signal of sensor: ";
+ // debugStream<>(fCdsmatrix , fPixels, fColumns, 0, 20);
+ // cout<<" Noise of sensor: ";
+ // debugStream<>(fNoise , fPixels, fColumns, 0, 20);
+ // cout<<" Hitted Pixel discriminator matrix: ";
+ // debugStream<>(fHittedPixel, fPixels, fColumns, 0, 1);
+ // }
}
}
else
{
-// cout << "Skipped pixel " << pixeli << " for noise calc in frame " << fFrameNumber << ", because fHittedPixel: " << fHittedPixel[pixeli] << endl;
+ // cout << "Skipped pixel " << pixeli << " for noise calc in frame " << fFrameNumber << ", because fHittedPixel: " << fHittedPixel[pixeli] << endl;
}
}
-// if (pedestalhighinthisframe)
-// cout<<"\rFrame: "<<fFrameNumber<< " --> Pedestal suspiciously high!"<<endl;
-// if (noisehighinthisframe)
-// cout<<"\rFrame: "<<fFrameNumber<< " --> Noise suspiciously high!"<<endl;
+ // if (pedestalhighinthisframe)
+ // cout<<"\rFrame: "<<fFrameNumber<< " --> Pedestal suspiciously high!"<<endl;
+ // if (noisehighinthisframe)
+ // cout<<"\rFrame: "<<fFrameNumber<< " --> Noise suspiciously high!"<<endl;
if (fFrameNumber%Frames == 0 && RefillNoiseBranch)
{
if(fSave)
fNoiseTree->Fill();
}
RefilledNoiseBranch = true;
-// for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
-// {
-// // fNoiseMean = TMath::Mean((const int)fPixels, fNoise);
-// fNoiseMean = fNoise[pixeli];
-// fPedestalsMean = fPedestals[pixeli];
-// fDynNoiseTree->Fill();
-// }
-//
-// cout << fNoiseMean << endl;
-// fNoiseMean = TMath::Mean((const int)fPixels, fNoise);
-// fPedestalsMean = TMath::Mean((const int)fPixels, fPedestals);
-// fDynNoiseTree->Fill();
+ // for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
+ // {
+ // // fNoiseMean = TMath::Mean((const int)fPixels, fNoise);
+ // fNoiseMean = fNoise[pixeli];
+ // fPedestalsMean = fPedestals[pixeli];
+ // fDynNoiseTree->Fill();
+ // }
+ //
+ // cout << fNoiseMean << endl;
+ // fNoiseMean = TMath::Mean((const int)fPixels, fNoise);
+ // fPedestalsMean = TMath::Mean((const int)fPixels, fPedestals);
+ // fDynNoiseTree->Fill();
}
}
-
-// debug
-// if ( fFrameNumber%10000==0)
-// {
-// debugStream<>(fNoise, fPixels, fColumns, 2, 5);
-// }
+
+ // debug
+ // if ( fFrameNumber%10000==0)
+ // {
+ // debugStream<>(fNoise, fPixels, fColumns, 2, 5);
+ // }
return true;
}
}
else
{
-
- TTree *noiseTree = (TNtuple*) f->Get("noise");
-
- UInt_t PIXEL;
- Float_t NOISE, PEDESTAL;
-
- noiseTree->SetBranchAddress("pixel" , &PIXEL );
+
+ TTree *noiseTree = (TNtuple*) f->Get("noise");
+
+ UInt_t PIXEL;
+ Float_t NOISE, PEDESTAL;
+
+ noiseTree->SetBranchAddress("pixel" , &PIXEL );
cout<<"Noise/Pedestals loaded from:"<< filename << "!"<<endl;
- noiseTree->SetBranchAddress("noise" , &NOISE );
- noiseTree->SetBranchAddress("pedestal" , &PEDESTAL );
-
- Int_t entries = noiseTree->GetEntries();
-
+ noiseTree->SetBranchAddress("noise" , &NOISE );
+ noiseTree->SetBranchAddress("pedestal" , &PEDESTAL );
+
+ Int_t entries = noiseTree->GetEntries();
+
for(Int_t i=0; i<entries; i++)
{
noiseTree->GetEntry(i);
-
- fNoise[i] = NOISE;
- fPedestals[i] = PEDESTAL;
+
+ fNoise[i] = NOISE;
+ fPedestals[i] = PEDESTAL;
}
cout<<"-----------------------"<<endl;
- fNoiseOk = true;
- fNoiseExt = true;
+ fNoiseOk = true;
+ fNoiseExt = true;
return true;
}
};
//####################################################################
bool MAPS::setNoise(Float_t Noise) {
-
for(Int_t i=0; i<fPixels; i++)
{
- fNoise[i] = Noise;
+ fNoise[i] = Noise;
}
fNoiseOk = true;
//####################################################################
bool MAPS::setPedestals(Float_t Pedestals) {
-
for(Int_t i=0; i<fPixels; i++)
{
- fPedestals[i] = Pedestals;
+ fPedestals[i] = Pedestals;
}
-// fNoiseOk = true;
+ // fNoiseOk = true;
return true;
};
//####################################################################
void MAPS::hitana() {
-
if(!fFrameOk) {
cout<<"\rNo frame loaded! ";
}
Bool_t bordercluster=false;
Float_t noisesumincluster=0;
Float_t chargesumincluster=0;
-
- Float_t cdsMatrixSum=0;
- Float_t cdsmatrixCorrPed[fPixels];
- for(Int_t i=0; i<fPixels; i++)
+
+ Float_t cdsMatrixSum=0;
+ Float_t cdsmatrixCorrPed[fPixels];
+ for(Int_t i=0; i<fPixels; i++)
{
- cdsMatrixSum+=fCdsmatrix[i];
- // cout<<fCdsmatrix[i]<<",";
- }
-
- // cout<<fFrameNumber<<":________:"<<cdsMatrixSum<<endl;
- // debugStream<>(fCdsmatrix, fPixels, fColumns, 2, 20);
- // cout<<"Pedestals"<<endl;
- // debugStream<>(fPedestals, fPixels, fColumns, 2, 20);
+ cdsMatrixSum+=fCdsmatrix[i];
+ // cout<<fCdsmatrix[i]<<",";
+ }
+
+ // cout<<fFrameNumber<<":________:"<<cdsMatrixSum<<endl;
+ // debugStream<>(fCdsmatrix, fPixels, fColumns, 2, 20);
+ // cout<<"Pedestals"<<endl;
+ // debugStream<>(fPedestals, fPixels, fColumns, 2, 20);
for(Int_t i=0; i<fPixels; i++)
{
- cdsmatrixCorrPed[i]=(float)(1.*fCdsmatrix[i]-fPedestals[i]);
+ cdsmatrixCorrPed[i]=(float)(1.*fCdsmatrix[i]-fPedestals[i]);
fHittedPixel[i] = 0;
- // if( (float)(1.*fCdsmatrix[i]-fPedestals[i]) > (50.) )
+ // if( (float)(1.*fCdsmatrix[i]-fPedestals[i]) > (50.) )
if( (float)(1.*fCdsmatrix[i]-fPedestals[i]) > (5.*fNoise[i]) )
{
HITNR++;
for(Int_t i=0; i<HITNR; i++)
{
Hitlist[i]=HITS.At(i);
- fFrameInfo.pixelRaw[i] = Hitlist[i];
+ fFrameInfo.pixelRaw[i] = Hitlist[i];
}
-// Begin loop over all negative CDS pixel
-// Determine clusters around them
+ // Begin loop over all negative CDS pixel
+ // Determine clusters around them
for(UInt_t rechargingpixeli=0; rechargingpixeli<rechargePixellist.size(); rechargingpixeli++)
{
seedrow = (rechargePixellist[rechargingpixeli])/fColumns; // row of seed
}
}
}
-
+
//Check seeds (whether lowest entry in cluster):
for(Int_t i=6; i<19; i++)
{
}
}
}
- // cout<<"Hitted pixel discriminator matrix:"<<endl;
- // debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
+ // cout<<"Hitted pixel discriminator matrix:"<<endl;
+ // debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
fHittedPixel[rechargePixellist[rechargingpixeli]] = -4;
}
}
-
+
//Begin: loop over all potential seed pixels:
//Determine 'hit-vicinity':
// Consider boundaries => Remove hits where the seed pixel is within 2 pixels beside the edge
// Hitlist[hit]%fColumn = x-coordinate of the seed pixel, Hitlist[hit]/fColumns = y-coordinate of the seed pixel
-// if (Hitlist[hit]%fColumns < 2 || Hitlist[hit]%fColumns > fColumns-3 || Hitlist[hit]/fColumns < 2 || Hitlist[hit]/fColumns > fRows-3)
-// continue;
-
-
+ // if (Hitlist[hit]%fColumns < 2 || Hitlist[hit]%fColumns > fColumns-3 || Hitlist[hit]/fColumns < 2 || Hitlist[hit]/fColumns > fRows-3)
+ // continue;
+
+
//Provide 5x5 clusters with CDS - content:
for(Int_t row=0; row<5; row++)
{
// wenn erste Reihe des Clusters gefüllt werden soll
// und das Seed Pixel am Rand - in erster oder zweiten Reihe des Matrix liegt
if ( (row==0) && (A<2) ) {
-// cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+ // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
pixelchargeincluster[(row*5)+column]=DUMMY;
noiseincluster[(row*5)+column]=DUMMY;
}
// wenn zweite Reihe des Clusters gefüllt werden soll
// und das Seed Pixel am Rand - in erster Reihe des Matrix liegt
else if ( (row==1) && (A<1) ) {
-// cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+ // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
pixelchargeincluster[(row*5)+column]=DUMMY;
noiseincluster[(row*5)+column]=DUMMY;
}
// wenn vierte Reihe des Clusters gefüllt werden soll
// und das Seed Pixel am Rand - in letzter Reihe des Matrix liegt
else if ( (row==3) && (A>= (fRows-1)) ) {
-// cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+ // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
pixelchargeincluster[(row*5)+column]=DUMMY;
noiseincluster[(row*5)+column]=DUMMY;
}
// wenn vierte Reihe des Clusters gefüllt werden soll
// und das Seed Pixel am Rand - in vorletzter Reihe des Matrix liegt
else if ( (row==4) && (A>= (fRows-2)) ) {
-// cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+ // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
pixelchargeincluster[(row*5)+column]=DUMMY;
noiseincluster[(row*5)+column]=DUMMY;
}
// wenn erste Spalte des Clusters gefüllt werden soll
// und das Seed Pixel am Rand - in erster oder zweiten Spalte des Matrix liegt
if ( (column==0) && (B<2) ) {
-// cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+ // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
pixelchargeincluster[(row*5)+column]=DUMMY;
noiseincluster[(row*5)+column]=DUMMY;
}
// wenn zweite Spalte des Clusters gefüllt werden soll
// und das Seed Pixel am Rand - in erster Spalte der Matrix liegt
else if ( (column==1) && (B==0) ) {
-// cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+ // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
pixelchargeincluster[(row*5)+column]=DUMMY;
noiseincluster[(row*5)+column]=DUMMY;
}
// wenn dritte Spalte des Clusters gefüllt werden soll
// und das Seed Pixel am Rand - in letzter Spalte der Matrix liegt
else if ( (column==3) && (B==fColumns-1)) {
-// cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+ // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
pixelchargeincluster[(row*5)+column]=DUMMY;
noiseincluster[(row*5)+column]=DUMMY;
}
// wenn letzte Spalte des Clusters gefüllt werden soll
// und das Seed Pixel am Rand - in vorletzter Spalte der Matrix liegt
else if ( (column==4) && (B>fColumns-3)) {
-// cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+ // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
pixelchargeincluster[(row*5)+column]=DUMMY;
noiseincluster[(row*5)+column]=DUMMY;
}
noiseincluster[(row*5)+column] = fNoise[Hitlist[hit]+(row-2)*fColumns+(column-2)];
pixelchargeincluster[(row*5)+column] = 1.*fCdsmatrix [Hitlist[hit]+(row-2)*fColumns+(column-2)] - fPedestals [Hitlist[hit]+(row-2)*fColumns+(column-2)];
noisesumincluster+=TMath::Power(noiseincluster[(row*5)+column],2);
- //noisesumincluster+=noiseincluster[(row*5)+column]; //Mathematicabug reconstructed
+ //noisesumincluster+=noiseincluster[(row*5)+column]; //Mathematicabug reconstructed
chargesumincluster+=pixelchargeincluster[(row*5)+column];
}
}
}
}
- int index[25];
- TMath::Sort(25,pixelchargeincluster,index,1);
- // for(int i=0;i<25;i++)
- // cout<<pixelchargeincluster[i]<<",";
- // cout<<endl;
- // for(int i=0;i<25;i++)
- // cout<<index[i]<<",";
- // cout<<endl;
- // cout<<"ChargeSorted"<<endl;
- // for(int i=0;i<25;i++)
- // cout<<pixelchargeincluster[index[i]]<<",";
- // cout<<endl;
- // cout<<"NoiseSorted"<<endl;
- // for(int i=0;i<25;i++)
- // cout<<noiseincluster[index[i]]<<",";
- // cout<<endl;
- Float_t chargesumincluster4=0;
- Float_t noisesumincluster4=0;
- Float_t noisesumincluster4Square=0;
- for(Int_t iClusterLauf=0;iClusterLauf<4;iClusterLauf++)
- {
- chargesumincluster4+=pixelchargeincluster[index[iClusterLauf]];
- //noisesumincluster4+=noiseincluster[index[iClusterLauf]];
- noisesumincluster4Square+=TMath::Power(noiseincluster[index[iClusterLauf]],2);
- }
- noisesumincluster=TMath::Sqrt(noisesumincluster);
- noisesumincluster4=TMath::Sqrt(noisesumincluster4Square);
- // cout<<"Chargesumme"<<chargesumincluster4<<","<<noisesumincluster4<<","<<noisesumincluster4Square<<endl;
- // Float_t cdsMatrixMinusPedestal[fPixels];
- // Float_t cdsMatrixSum=0;
- // for(Int_t i=0; i<fPixels; i++)
- // {
- // cdsMatrixMinusPedestal[i]=fCdsmatrix[i]-fPedestals[i];
- // cdsMatrixSum+=cdsMatrixMinusPedestal[i];
- // }
- // debugStream<>(cdsMatrixMinusPedestal, fPixels, fColumns, 0, 20);
+ int index[25];
+ TMath::Sort(25,pixelchargeincluster,index,1);
+ // for(int i=0;i<25;i++)
+ // cout<<pixelchargeincluster[i]<<",";
+ // cout<<endl;
+ // for(int i=0;i<25;i++)
+ // cout<<index[i]<<",";
+ // cout<<endl;
+ // cout<<"ChargeSorted"<<endl;
+ // for(int i=0;i<25;i++)
+ // cout<<pixelchargeincluster[index[i]]<<",";
+ // cout<<endl;
+ // cout<<"NoiseSorted"<<endl;
+ // for(int i=0;i<25;i++)
+ // cout<<noiseincluster[index[i]]<<",";
+ // cout<<endl;
+ Float_t chargesumincluster4=0;
+ Float_t noisesumincluster4=0;
+ Float_t noisesumincluster4Square=0;
+ for(Int_t iClusterLauf=0;iClusterLauf<4;iClusterLauf++)
+ {
+ chargesumincluster4+=pixelchargeincluster[index[iClusterLauf]];
+ //noisesumincluster4+=noiseincluster[index[iClusterLauf]];
+ noisesumincluster4Square+=TMath::Power(noiseincluster[index[iClusterLauf]],2);
+ }
+ noisesumincluster=TMath::Sqrt(noisesumincluster);
+ noisesumincluster4=TMath::Sqrt(noisesumincluster4Square);
+ // cout<<"Chargesumme"<<chargesumincluster4<<","<<noisesumincluster4<<","<<noisesumincluster4Square<<endl;
+ // Float_t cdsMatrixMinusPedestal[fPixels];
+ // Float_t cdsMatrixSum=0;
+ // for(Int_t i=0; i<fPixels; i++)
+ // {
+ // cdsMatrixMinusPedestal[i]=fCdsmatrix[i]-fPedestals[i];
+ // cdsMatrixSum+=cdsMatrixMinusPedestal[i];
+ // }
+ // debugStream<>(cdsMatrixMinusPedestal, fPixels, fColumns, 0, 20);
// cout << colorred << "Noise für Cluster: " << noisesumincluster << endlr;
// cout << colorred << "ChargeSum für Cluster: " << chargesumincluster <<"WholeMatrix:"<<cdsMatrixSum<< endlr;
-
+
// for(Int_t row=0; row<5; row++)
// {
- // for(Int_t column=0; column<5; column++)
- // {
- // std::cout.width(10);
- // std::cout << std::fixed;
- // std::cout << std::left << std::setprecision(2) << pixelchargeincluster[row*5+column];
- // }
- // cout << endl;
+ // for(Int_t column=0; column<5; column++)
+ // {
+ // std::cout.width(10);
+ // std::cout << std::fixed;
+ // std::cout << std::left << std::setprecision(2) << pixelchargeincluster[row*5+column];
+ // }
+ // cout << endl;
// }
// cout << endl;
{
if ( (i!=12) && (pixelchargeincluster[i] > pixelchargeincluster[12]) ) {
CHANCE=0;
-// cout << "kill cluster: " << Hitlist[hit] << " with ADC: " << pixelchargeincluster[12] << endl;
+ // cout << "kill cluster: " << Hitlist[hit] << " with ADC: " << pixelchargeincluster[12] << endl;
break;
}
// maybe this is unnecessary, if upper if clause is a >= comparison
//Begin: loop evaluate true seeds:
if(CHANCE==100)
{
- if(fOrderCode=="FSBB")
- {
- if (B < 2 || B > fColumns-3 || A < 1 || A > fRows-2)
- bordercluster = true;
- else
- bordercluster = false;
- }
- else //if not FSBB
- {
- if (B < 2 || B > fColumns-3 || A < 2 || A > fRows-3)
- bordercluster = true;
- else
- bordercluster = false;
- }
+ if(fOrderCode=="FSBB")
+ {
+ if (B < 2 || B > fColumns-3 || A < 1 || A > fRows-2)
+ bordercluster = true;
+ else
+ bordercluster = false;
+ }
+ else //if not FSBB
+ {
+ if (B < 2 || B > fColumns-3 || A < 2 || A > fRows-3)
+ bordercluster = true;
+ else
+ bordercluster = false;
+ }
for(Int_t row=0; row<5; row++)
{
for(Int_t column=0; column<5; column++)
}
}
}
- // cout<<"Hitted pixel discriminator matrix:"<<endl;
- // debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
+ // cout<<"Hitted pixel discriminator matrix:"<<endl;
+ // debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
if (bordercluster)
fHittedPixel[Hitlist[hit]] = -2;
else
{
fHittedPixel[Hitlist[hit]] = 2;
-
+
//Fill hit TTree:
fFrameInfo.pixel[fHits] = Hitlist[hit];
for(int clupos=0; clupos<25; clupos++)
{
fFrameInfo.p [clupos][fHits] = pixelchargeincluster[clupos];
}
- // for(Int_t row=0; row<5; row++)
- // {
- // for(Int_t column=0; column<5; column++)
- // {
+ // for(Int_t row=0; row<5; row++)
+ // {
+ // for(Int_t column=0; column<5; column++)
+ // {
// std::cout.width(10);
// std::cout << std::fixed;
// std::cout << std::left << std::setprecision(2) << pixelchargeincluster[row*5+column];
- // }
- // cout << endl;
- // }
- // cout << endl;
+ // }
+ // cout << endl;
+ // }
+ // cout << endl;
// if cluster charge > clusternoise * const
- if(fOrderCode=="FSBB")
- {
- if (1.0*chargesumincluster4 > noisesumincluster4*6.0)
- fFrameInfo.pixelthreshold[fHits] = Hitlist[hit];
- else
- fFrameInfo.pixelthreshold[fHits] = 0;
- }
- else
- {
- if (1.0*chargesumincluster > noisesumincluster*2.0)
- fFrameInfo.pixelthreshold[fHits] = Hitlist[hit];
- else
- fFrameInfo.pixelthreshold[fHits] = 0;
- }
+ if(fOrderCode=="FSBB")
+ {
+ if (1.0*chargesumincluster4 > noisesumincluster4*6.0)
+ fFrameInfo.pixelthreshold[fHits] = Hitlist[hit];
+ else
+ fFrameInfo.pixelthreshold[fHits] = 0;
+ }
+ else
+ {
+ if (1.0*chargesumincluster > noisesumincluster*2.0)
+ fFrameInfo.pixelthreshold[fHits] = Hitlist[hit];
+ else
+ fFrameInfo.pixelthreshold[fHits] = 0;
+ }
if(fSave) {
hint1->Fill( Hitlist[hit]%fColumns, (int)(Hitlist[hit]/fColumns) );
}
// if(fFrameInfo.pixelthreshold[fHits]!=0)
- // {
- // cout<<"Charge"<<chargesumincluster4<<"must bigger than NOISE"<<noisesumincluster4*6.0<<endl;
- // debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
- // for(Int_t row=0; row<5; row++)
- // {
- // for(Int_t column=0; column<5; column++)
- // {
- // std::cout.width(10);
- // std::cout << std::fixed;
- // std::cout << std::left << std::setprecision(2) << pixelchargeincluster[row*5+column];
- // }
- // cout << endl;
- // }
- // cout << endl;
- // debugStream<>(cdsmatrixCorrPed, fPixels, fColumns, 1, 10);
- // }
- fHits++;
+ // {
+ // cout<<"Charge"<<chargesumincluster4<<"must bigger than NOISE"<<noisesumincluster4*6.0<<endl;
+ // debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
+ // for(Int_t row=0; row<5; row++)
+ // {
+ // for(Int_t column=0; column<5; column++)
+ // {
+ // std::cout.width(10);
+ // std::cout << std::fixed;
+ // std::cout << std::left << std::setprecision(2) << pixelchargeincluster[row*5+column];
+ // }
+ // cout << endl;
+ // }
+ // cout << endl;
+ // debugStream<>(cdsmatrixCorrPed, fPixels, fColumns, 1, 10);
+ // }
+ fHits++;
}
}
}
//End: loop evaluate true seeds:
//End: loop over all potential seed pixels:
-
+
if(fSave)
{
for(Int_t i=0; i<fPixels; i++)
{
fdiscriminatedhitmatrix->SetBinContent(i%fColumns, (int)(i/fColumns), fHittedPixel[i]);
fADCHitmatrix->SetBinContent(i%fColumns, (int)(i/fColumns), fCdsmatrix[i]);
- // cout<<"HITHERE"<<i<<":"<<fHittedPixel[i]<<";"<<fCdsmatrix[i]<<endl;
+ // cout<<"HITHERE"<<i<<":"<<fHittedPixel[i]<<";"<<fCdsmatrix[i]<<endl;
}
}
void MAPS::filterCommonMode() {
- Float_t CommonModeInRow = 0;
+ Float_t CommonModeInRow = 0;
bool warning;
Float_t* Arr = new Float_t[fColumns]();
for(int row=0; row<fRows; row++ )
{
warning = false;
- CommonModeInRow = 0;
-
+ CommonModeInRow = 0;
+
for(int column=0; column<fColumns; column++ )
{
- Arr[column] = fCdsmatrix[ row*fColumns+column ] - fPedestals[ row*fColumns+column ]; // Bugfix: Considered pedestals in common mode calculation
+ Arr[column] = fCdsmatrix[ row*fColumns+column ] - fPedestals[ row*fColumns+column ]; // Bugfix: Considered pedestals in common mode calculation
}
-
+
CommonModeInRow = TMath::Median(fColumns, Arr); // Don't use mean, consider hitted pixel !
if (CommonModeInRow < 0)
plus++;
warning = true;
}
if(warning) { cout<<"\rFrame: "<<fFrameNumber<< " row: " << row << " Median of row: " << CommonModeInRow << " --> Common Mode suspiciously high! "<<endl;
- debugStream<>(fCdsmatrix, fPixels, fColumns, 1, 20);
+ debugStream<>(fCdsmatrix, fPixels, fColumns, 1, 20);
debugStream<>(Arr, fColumns, fColumns, 1, 20);
}
fCdsmatrix[ row*fColumns+column ] -= CommonModeInRow;
}
}
-// if ( fFrameNumber%10000==0)
-// {
-// debugStream<>(fPedestals, fPixels, fColumns, 2);
-// }
}
//####################################################################
cout <<endl <<endl << colorwhite << "---------------- FRAME " << fFrameNumber << " ----------------" << colorreset << endl << endl;
cout<<"CDS matrix:"<<endl;
debugStream<>(fCdsmatrix, fPixels, fColumns, 0, 39);
- Float_t cdsmatrixCorrPed[fPixels];
- for(Int_t i=0; i<fPixels; i++)
+ Float_t cdsmatrixCorrPed[fPixels];
+ for(Int_t i=0; i<fPixels; i++)
{
- cdsmatrixCorrPed[i]=(float)(1.*fCdsmatrix[i]-fPedestals[i]);
- }
- cout<<"CDS matrix minus pedestals:"<<endl;
- debugStream<>(cdsmatrixCorrPed, fPixels, fColumns, 0, 10);
- // cout<<fCdsmatrix[0]<<","<<fCdsmatrix[1]<<","<<fCdsmatrix[2]<<","<<fCdsmatrix[3]<<","<<fCdsmatrix[4]<<","<<fCdsmatrix[5]<<","<<fCdsmatrix[6]<<endl;
+ cdsmatrixCorrPed[i]=(float)(1.*fCdsmatrix[i]-fPedestals[i]);
+ }
+ cout<<"CDS matrix minus pedestals:"<<endl;
+ debugStream<>(cdsmatrixCorrPed, fPixels, fColumns, 0, 10);
+ // cout<<fCdsmatrix[0]<<","<<fCdsmatrix[1]<<","<<fCdsmatrix[2]<<","<<fCdsmatrix[3]<<","<<fCdsmatrix[4]<<","<<fCdsmatrix[5]<<","<<fCdsmatrix[6]<<endl;
cout<<"Hitted pixel discriminator matrix:"<<endl;
debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
gStyle->SetCanvasColor(0);
gStyle->SetFrameFillColor(10);
gStyle->SetOptStat(0);
-
- TH2F *h1 = new TH2F("CDS matrix", "CDS matrix", fColumns, 0, fColumns, fRows, 0, fRows);
- TH2F *h2 = new TH2F("Frame 0 matrix", "Frame 0 matrix", fColumns, 0, fColumns, fRows, 0, fRows);
- TH2F *h3 = new TH2F("Frame 1 matrix", "Frame 1 matrix", fColumns, 0, fColumns, fRows, 0, fRows);
- TH1F *h4 = new TH1F("Frame 0 histo", "Frame 0 histo", 2*16384, -16384, 16384);
- TH1F *h5 = new TH1F("Frame 1 histo", "Frame 1 histo", 2*16384, -16384, 16384);
-
+
+ TH2F *h1 = new TH2F("CDS matrix", "CDS matrix", fColumns, 0, fColumns, fRows, 0, fRows);
+ TH2F *h2 = new TH2F("Frame 0 matrix", "Frame 0 matrix", fColumns, 0, fColumns, fRows, 0, fRows);
+ TH2F *h3 = new TH2F("Frame 1 matrix", "Frame 1 matrix", fColumns, 0, fColumns, fRows, 0, fRows);
+ TH1F *h4 = new TH1F("Frame 0 histo", "Frame 0 histo", 2*16384, -16384, 16384);
+ TH1F *h5 = new TH1F("Frame 1 histo", "Frame 1 histo", 2*16384, -16384, 16384);
+
Int_t column;
Int_t row;
Float_t F0,F1,CDS;
-
+
for(Int_t i=0; i<fPixels; i++)
{
- row = i/fColumns;
- column = i%fColumns;
-
- CDS = fCdsmatrix[i];
-
- F0 = fF0matrix[i];
- F1 = fF1matrix[i];
-
+ row = i/fColumns;
+ column = i%fColumns;
+
+ CDS = fCdsmatrix[i];
+
+ F0 = fF0matrix[i];
+ F1 = fF1matrix[i];
+
h1->Fill(column,row,CDS);
h2->Fill(column,row,F0);
h3->Fill(column,row,F1);
h4->Fill(F0);
h5->Fill(F1);
}
-
+
cm1->cd(1);
h1->Draw("colz");
h1->GetXaxis()->SetTitle("column");
h1->GetYaxis()->SetTitle("row");
h1->GetZaxis()->SetTitle("Signal [ADC]");
-
+
cm1->cd(2);
h1->Draw("surf2z");
h1->GetXaxis()->SetTitle("column");
h1->GetYaxis()->SetTitle("row");
h1->GetZaxis()->SetTitle("Signal [ADC]");
-
+
cm1->cd(3);
h2->Draw("surf2z");
h2->GetXaxis()->SetTitle("column");
h2->GetYaxis()->SetTitle("row");
h2->GetZaxis()->SetTitle("Signal [ADC]");
-
+
cm1->cd(4);
h3->Draw("surf2z");
h3->GetXaxis()->SetTitle("column");
h3->GetYaxis()->SetTitle("row");
h3->GetZaxis()->SetTitle("Signal [ADC]");
-
+
cm1->cd(5);
h4->Draw();
h4->GetXaxis()->SetTitle("Signal [ADC]");
h4->GetYaxis()->SetTitle("Counts");
-
+
cm1->cd(6);
h5->Draw();
h5->GetXaxis()->SetTitle("Signal [ADC]");
//####################################################################
void MAPS::plotNoise() {
-
if(!fNoiseOk) {
cout<<"Noise/Pedestals not calculated/set!"<<endl;
}
else {
-
+
TCanvas* cm2;
cm2 = new TCanvas("cm2","Noise",50,100,1200,800);
cm2->Divide(2,2);
gStyle->SetCanvasColor(0);
gStyle->SetFrameFillColor(10);
gStyle->SetOptStat(1);
-
- TH1F *h1 = new TH1F("noisee", "noise", 2000, 0, 200);
- TH1F *h2 = new TH1F("pedestal", "pedestal", 1000, -50, 50);
- TH2F *h3 = new TH2F("noise matrix", "noise matrix", fColumns, 0, fColumns, fRows, 0, fRows);
- TH2F *h4 = new TH2F("pedestal matrix", "pedestal matrix", fColumns, 0, fColumns, fRows, 0, fRows);
-
+
+ TH1F *h1 = new TH1F("noisee", "noise", 2000, 0, 200);
+ TH1F *h2 = new TH1F("pedestal", "pedestal", 1000, -50, 50);
+ TH2F *h3 = new TH2F("noise matrix", "noise matrix", fColumns, 0, fColumns, fRows, 0, fRows);
+ TH2F *h4 = new TH2F("pedestal matrix", "pedestal matrix", fColumns, 0, fColumns, fRows, 0, fRows);
+
Int_t column;
Int_t row;
Float_t NOISE,PEDESTAL;
-
+
for(Int_t i=0; i<fPixels; i++)
{
-
- column = i%fColumns;
- row = i/fColumns;
- NOISE = fNoise[i];
- PEDESTAL = fPedestals[i];
-
+
+ column = i%fColumns;
+ row = i/fColumns;
+ NOISE = fNoise[i];
+ PEDESTAL = fPedestals[i];
+
h1->Fill(NOISE);
h2->Fill(PEDESTAL);
h3->Fill(column,row,NOISE);
h4->Fill(column,row,PEDESTAL);
}
-
+
cm2->cd(1);
h3->Draw("colz");
h3->GetXaxis()->SetTitle("column");
h3->GetYaxis()->SetTitle("row");
h3->GetZaxis()->SetTitle("Noise [ADC]");
-
+
cm2->cd(2);
h4->Draw("colz");
h4->GetXaxis()->SetTitle("column");
h4->GetYaxis()->SetTitle("row");
h4->GetZaxis()->SetTitle("Pedstals [ADC]");
-
+
cm2->cd(3);
h1->Draw();
h1->GetXaxis()->SetTitle("Noise [ADC]");
h1->GetYaxis()->SetTitle("Counts");
-
+
cm2->cd(4);
h2->Draw();
h2->GetXaxis()->SetTitle("Pedestal [ADC]");
h2->GetYaxis()->SetTitle("Counts");
-
+
cm2->DrawClone();
cm2->Close();
cm2->Update();
if(fOk)
{
-//Check availabilty of Frames
- if( Frames > fEventsSum ) {
+ //Check availabilty of Frames
+ if( Frames > fEventsSum ) {
Frames = fEventsSum;
printf("Changed 'Number Frames' to: %u\n", Frames );
}
- if( Frames+Start > fEventsSum ) {
+ if( Frames+Start > fEventsSum ) {
Start = fEventsSum-Frames;
printf("Changed 'First Event' to: %u\n", Start );
}
if(fOk)
{
-//Check availabilty of Frames
- if( Frames > fEventsSum ) {
+ //Check availabilty of Frames
+ if( Frames > fEventsSum ) {
Frames = fEventsSum;
printf("Changed 'Number Frames' to: %u\n", Frames );
}
- if( Frames+Start > fEventsSum ) {
+ if( Frames+Start > fEventsSum ) {
Start = fEventsSum-Frames;
printf("Changed 'First Event' to: %u\n", Start );
}
-
- TH2F *h1 = new TH2F("Frames 0 " , "Frame 0" , fPixels, 0, fPixels, 2*16384, -16384, 16384);
- TH2F *h2 = new TH2F("Frames 1" , "Frame 1" , fPixels, 0, fPixels, 2*16384, -16384, 16384);
- TH2F *h3 = new TH2F("CDS" , "CDS" , fPixels, 0, fPixels, 2*16384, -16384, 16384);
-
- TH1F *h4 = new TH1F("Frames 0 histo" , "Frames 0 histo" , 2*16384, -16384, 16384);
- 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);
-
+
+ TH2F *h1 = new TH2F("Frames 0 " , "Frame 0" , fPixels, 0, fPixels, 2*16384, -16384, 16384);
+ TH2F *h2 = new TH2F("Frames 1" , "Frame 1" , fPixels, 0, fPixels, 2*16384, -16384, 16384);
+ TH2F *h3 = new TH2F("CDS" , "CDS" , fPixels, 0, fPixels, 2*16384, -16384, 16384);
+
+ TH1F *h4 = new TH1F("Frames 0 histo" , "Frames 0 histo" , 2*16384, -16384, 16384);
+ 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(UInt_t i=Start; i<Start+Frames; i++)
{
if(getFrame(i))
{
for(int j=0; j<fPixels; j++)
{
- h1->Fill(j,fF0matrix [j]);
- h2->Fill(j,fF1matrix [j]);
- h3->Fill(j,fCdsmatrix [j]);
-
- h4->Fill(fF0matrix [j]);
- h5->Fill(fF1matrix [j]);
- h6->Fill(fCdsmatrix [j]);
+ h1->Fill(j,fF0matrix [j]);
+ h2->Fill(j,fF1matrix [j]);
+ h3->Fill(j,fCdsmatrix [j]);
+
+ h4->Fill(fF0matrix [j]);
+ h5->Fill(fF1matrix [j]);
+ h6->Fill(fCdsmatrix [j]);
}
}
}
-
-
+
+
TCanvas* cm11;
cm11 = new TCanvas("cm11","Signal",50,100,1200,800);
cm11->Divide(3,2);
gStyle->SetCanvasColor(0);
gStyle->SetFrameFillColor(10);
gStyle->SetOptStat(0);
-
+
cm11->cd(1);
h1->Draw("colz");
h1->GetXaxis()->SetTitle("Pixel#");
h1->GetYaxis()->SetTitle("Signal");
-
+
cm11->cd(2);
h2->Draw("colz");
h2->GetXaxis()->SetTitle("Pixel#");
h2->GetYaxis()->SetTitle("Signal");
-
+
cm11->cd(3);
h3->Draw("colz");
h3->GetXaxis()->SetTitle("Pixel#");
h3->GetYaxis()->SetTitle("Signal");
-
+
cm11->cd(4);
h4->Draw();
h4->GetXaxis()->SetTitle("Signal [ADC]");
h4->GetYaxis()->SetTitle("Counts");
-
+
cm11->cd(5);
h5->Draw();
h5->GetXaxis()->SetTitle("Signal [ADC]");
h5->GetYaxis()->SetTitle("Counts");
-
+
cm11->cd(6);
h6->Draw();
h6->GetXaxis()->SetTitle("Signal [ADC]");
h6->GetYaxis()->SetTitle("Counts");
-
+
cm11->DrawClone();
cm11->Close();
cm11->Update();
if(fOk)
{
-//Check availabilty of Frames
+ //Check availabilty of Frames
TCanvas* cm4;
cm4 = new TCanvas("cm4","PixelSignal",50,100,1200,800);
cm4->Divide(3,2);
gStyle->SetCanvasColor(0);
gStyle->SetFrameFillColor(10);
gStyle->SetOptStat(0);
-
- if( Frames > fEventsSum ) {
+
+ if( Frames > fEventsSum ) {
Frames = fEventsSum;
printf("Changed 'Number Frames' to: %u\n", Frames );
}
- if( Frames+Start > fEventsSum ) {
+ if( Frames+Start > fEventsSum ) {
Start = fEventsSum-Frames;
printf("Changed 'First Event' to: %u\n", Start );
}
-
- TH2F *h1 = new TH2F("Frame 0 vs T" , "Frame 0 vs T" , Frames, Start, Start+Frames, 2*16384, -16384, 16384);
- TH2F *h2 = new TH2F("Frame 1 vs T" , "Frame 1 vs T" , Frames, Start, Start+Frames, 2*16384, -16384, 16384);
- TH2F *h3 = new TH2F("CDS vs T" , "CDS vs T" , Frames, Start, Start+Frames, 2*16384, -16384, 16384);
-
- TH1F *h4 = new TH1F("Frames 0 phisto" , "Frames 0 phisto" , 2*16384, -16384, 16384);
- 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);
-
+
+ TH2F *h1 = new TH2F("Frame 0 vs T" , "Frame 0 vs T" , Frames, Start, Start+Frames, 2*16384, -16384, 16384);
+ TH2F *h2 = new TH2F("Frame 1 vs T" , "Frame 1 vs T" , Frames, Start, Start+Frames, 2*16384, -16384, 16384);
+ TH2F *h3 = new TH2F("CDS vs T" , "CDS vs T" , Frames, Start, Start+Frames, 2*16384, -16384, 16384);
+
+ TH1F *h4 = new TH1F("Frames 0 phisto" , "Frames 0 phisto" , 2*16384, -16384, 16384);
+ 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(UInt_t i=Start; i<Start+Frames; i++)
{
if(getFrame(i))
h1->Fill( i,fF0matrix[Pixel]) ;
h2->Fill( i,fF1matrix[Pixel]) ;
h3->Fill( i,fCdsmatrix[Pixel] );
-
+
h4->Fill( fF0matrix[Pixel] );
h5->Fill( fF1matrix[Pixel] );
h6->Fill( fCdsmatrix[Pixel] );
}
}
-
+
cm4->cd(1);
h1->Draw("colz");
h1->GetXaxis()->SetTitle("Frame#");
h1->GetYaxis()->SetTitle("Signal");
-
+
cm4->cd(2);
h2->Draw("colz");
h2->GetXaxis()->SetTitle("Frame#");
h2->GetYaxis()->SetTitle("Signal");
-
+
cm4->cd(3);
h3->Draw("colz");
h3->GetXaxis()->SetTitle("Frame#");
h3->GetYaxis()->SetTitle("Signal");
-
+
cm4->cd(4);
h4->Draw();
h4->GetXaxis()->SetTitle("Signal [ADC]");
h4->GetYaxis()->SetTitle("Counts");
-
+
cm4->cd(5);
h5->Draw();
h5->GetXaxis()->SetTitle("Signal [ADC]");
h5->GetYaxis()->SetTitle("Counts");
-
+
cm4->cd(6);
h6->Draw();
h6->GetXaxis()->SetTitle("Signal [ADC]");
h6->GetYaxis()->SetTitle("Counts");
-
-// cm4->DrawClone();
-// cm4->Update();
-// cm4->Close();
+
+ // cm4->DrawClone();
+ // cm4->Update();
+ // cm4->Close();
cout<<"\rPIXELSIGNALS plotted! "<<endl;
cout<<"-------------------"<<endl;
}
//####################################################################
void MAPS::writeData() {
-// int file=1;
+// int file=1;
//
-// TH1F *histo1[3];
-// TH2F *histo2[3];
+// TH1F *histo1[3];
+// TH2F *histo2[3];
//
-// histo1[0] = new TH1F("F0 matrixh" , "F0 matrixh", 2*16384*4, -16384*4, 16384*4);
-// histo1[1] = new TH1F("F1 matrixh" , "F1 matrixh", 2*16384*4, -16384*4, 16384*4);
-// histo1[2] = new TH1F("CDS matrixh" , "CDS matrixh", 2*16384*4, -16384*4, 16384*4);
+// histo1[0] = new TH1F("F0 matrixh" , "F0 matrixh", 2*16384*4, -16384*4, 16384*4);
+// histo1[1] = new TH1F("F1 matrixh" , "F1 matrixh", 2*16384*4, -16384*4, 16384*4);
+// histo1[2] = new TH1F("CDS matrixh" , "CDS matrixh", 2*16384*4, -16384*4, 16384*4);
//
-// histo2[0] = new TH2F("F0 matrix" , "F0 matrix", 16, 0, 16, 64, 0, 64);
-// histo2[1] = new TH2F("F1 matrix" , "F1 matrix", 16, 0, 16, 64, 0, 64);
-// histo2[2] = new TH2F("CDS matrix" , "CDS matrix", 16, 0, 16, 64, 0, 64);
+// histo2[0] = new TH2F("F0 matrix" , "F0 matrix", 16, 0, 16, 64, 0, 64);
+// histo2[1] = new TH2F("F1 matrix" , "F1 matrix", 16, 0, 16, 64, 0, 64);
+// histo2[2] = new TH2F("CDS matrix" , "CDS matrix", 16, 0, 16, 64, 0, 64);
//
-// // char* RAWDATA= new char[200];
-// char* PARDATA= new char[4];
+// // char* RAWDATA= new char[200];
+// char* PARDATA= new char[4];
//
-// fInn[file].seekg ( 0 , ios::beg );
-// // fInn[0].read ( RAWDATA , 200 );
+// fInn[file].seekg ( 0 , ios::beg );
+// // fInn[0].read ( RAWDATA , 200 );
//
-// uint a;//,b;
-// int16_t a1,a2;
-// int16_t b1,b2;
-// int x,y,z1,z2,z3;
+// uint a;//,b;
+// int16_t a1,a2;
+// int16_t b1,b2;
+// int x,y,z1,z2,z3;
//
-// // for(int i=0;i<200/4;i++)
-// // {
+// // for(int i=0;i<200/4;i++)
+// // {
// //
-// // a = TMath::Power(2,24)*(Int_t)RAWDATA[i]+TMath::Power(2,16)*(Int_t)RAWDATA[i+1]+TMath::Power(2,8)*(Int_t)RAWDATA[i+2]+TMath::Power(2,0)*(Int_t)RAWDATA[i+3];
-// // cout<<dec<<i<<"\t"<<a<<endl;
-// // }
+ // // a = TMath::Power(2,24)*(Int_t)RAWDAT for(int column=0; column<fColumns; column++ )
+// {
+// fCdsmatrix[ row*fColumns+column ] -= CommonModeInRow;
+// }A[i]+TMath::Power(2,16)*(Int_t)RAWDATA[i+1]+TMath::Power(2,8)*(Int_t)RAWDATA[i+2]+TMath::Power(2,0)*(Int_t)RAWDATA[i+3];
+// // cout<<dec<<i<<"\t"<<a<<endl;
+// // }
//
-// int count = 0;
-// int count_tmp = 0;
+// int count = 0;
+// int count_tmp = 0;
//
-// int countframes = 0;
-// int countinframe = 0;
+// int countframes = 0;
+// int countinframe = 0;
//
//
//
-// while( fInn[file].good() )
-// {
-// fInn[file].read ( PARDATA , 4);
+// while( fInn[file].good() )
+// {
+// fInn[file].read ( PARDATA , 4);
//
-// a = littleEndian32(PARDATA,0);
-// a1 = littleEndian16(PARDATA,0);
-// a2 = littleEndian16(PARDATA,2);
-// // if(a1<0) {a2+=1;}
+// a = littleEndian32(PARDATA,0);
+// a1 = littleEndian16(PARDATA,0);
+// a2 = littleEndian16(PARDATA,2);
+// // if(a1<0) {a2+=1;}
//
//
//
-// // b = TMath::Power(2,0)*(Int_t)(Char_t)PARDATA[0] + TMath::Power(2,8)*(Int_t)(Char_t)PARDATA[1]+TMath::Power(2,16)*(Int_t)(Char_t)PARDATA[2] + TMath::Power(2,24)*(Int_t)(Char_t)PARDATA[3];
-// // b1 = TMath::Power(2,0)*(Int_t)(Char_t)PARDATA[0] + TMath::Power(2,8)*(Int_t)(Char_t)PARDATA[1];
-// // b2 = TMath::Power(2,0)*(Int_t)(Char_t)PARDATA[2] + TMath::Power(2,8)*(Int_t)(Char_t)PARDATA[3];
+// // b = TMath::Power(2,0)*(Int_t)(Char_t)PARDATA[0] + TMath::Power(2,8)*(Int_t)(Char_t)PARDATA[1]+TMath::Power(2,16)*(Int_t)(Char_t)PARDATA[2] + TMath::Power(2,24)*(Int_t)(Char_t)PARDATA[3];
+// // b1 = TMath::Power(2,0)*(Int_t)(Char_t)PARDATA[0] + TMath::Power(2,8)*(Int_t)(Char_t)PARDATA[1];
+// // b2 = TMath::Power(2,0)*(Int_t)(Char_t)PARDATA[2] + TMath::Power(2,8)*(Int_t)(Char_t)PARDATA[3];
//
-// // a1 = conv[a1];
-// // a2 = conv[a2];
+// // a1 = conv[a1];
+// // a2 = conv[a2];
//
-// if(1)
-// // if(count==count_tmp+13)
-// {
-// // cout<<count%1053<<"\t"<<countframes<<endl;
-// // if( (count%1053)>=28 && (count%1053)<28+64*16 && countframes==11)
-// if( (count%1053)>=28 && (count%1053)<28+64*16)
-// {
-// y = ((count%1053)-28)%64;
-// x = ((count%1053)-28)/64;
+// if(1)
+// // if(count==count_tmp+13)
+// {
+// // cout<<count%1053<<"\t"<<countframes<<endl;
+// // if( (count%1053)>=28 && (count%1053)<28+64*16 && countframes==11)
+// if( (count%1053)>=28 && (count%1053)<28+64*16)
+// {
+// y = ((count%1053)-28)%64;
+// x = ((count%1053)-28)/64;
//
-// z1 = a1;
-// z2 = a2;
-// z3 = a1-a2;
+// z1 = a1;
+// z2 = a2;
+// z3 = a1-a2;
//
-// histo1[0]->Fill(z1);
-// histo1[1]->Fill(z2);
-// histo1[2]->Fill(z3);
+// histo1[0]->Fill(z1);
+// histo1[1]->Fill(z2);
+// histo1[2]->Fill(z3);
//
-// histo2[0]->Fill(x,y,z1);
-// histo2[1]->Fill(x,y,z2);
-// histo2[2]->Fill(x,y,z3);
+// histo2[0]->Fill(x,y,z1);
+// histo2[1]->Fill(x,y,z2);
+// histo2[2]->Fill(x,y,z3);
//
-// // cout<< (count%1053)-28 <<"\t"<<x<<"\t"<<y<<"\t"<<z1<<endl;
-// countinframe++;
-// }
+// // cout<< (count%1053)-28 <<"\t"<<x<<"\t"<<y<<"\t"<<z1<<endl;
+// countinframe++;
+// }
//
-// if(count<50 || (count>=1050 && count<1053+50))
-// // if( count%1053==13 )
-// {
-// cout<<right<<setw(5)<<dec<<count%1053;
-// cout<<right<<setw(5)<<dec<<count;
-// // cout<<right<<setw(10)<<hex<<a;
-// cout<<" | ";
-// for(int j=0;j<4;j++)
-// {
-// for(int i=0;i<8;i++)
-// {
-// cout<<(( PARDATA[3-j] >> (7-i)) & 1);
-// }
-// if(1) {cout<<" ";}
-// }
-// // cout<<" ";
-// // cout<<right<<setw(10)<<hex<<a2;
-// // cout<<right<<setw(10)<<hex<<a1;
-// // cout<<right<<setw(10)<<dec<<a2;
-// // cout<<right<<setw(10)<<dec<<a1;
-// // cout<<right<<setw(10)<<dec<<a2-a1;
+// if(count<50 || (count>=1050 && count<1053+50))
+// // if( count%1053==13 )
+// {
+// cout<<right<<setw(5)<<dec<<count%1053;
+// cout<<right<<setw(5)<<dec<<count;
+// // cout<<right<<setw(10)<<hex<<a;
+// cout<<" | ";
+// for(int j=0;j<4;j++)
+// {
+// for(int i=0;i<8;i++)
+// {
+// cout<<(( PARDATA[3-j] >> (7-i)) & 1);
+// }
+// if(1) {cout<<" ";}
+// }
+// // cout<<" ";
+// // cout<<right<<setw(10)<<hex<<a2;
+// // cout<<right<<setw(10)<<hex<<a1;
+// // cout<<right<<setw(10)<<dec<<a2;
+// // cout<<right<<setw(10)<<dec<<a1;
+// // cout<<right<<setw(10)<<dec<<a2-a1;
//
-// int n=CHAR_BIT*sizeof(a);
-// n=32;
-// cout<<"| ";
-// for (int i=16;i<n;i++)
-// {
-// if ( a2 & (1<<(n-1-i)) ) { printf("1"); }
-// else { printf("0"); }
-// }
-// cout<<" ";
-// for (int i=16;i<n;i++)
-// {
-// if ( a1 & (1<<(n-1-i)) ) { printf("1"); }
-// else { printf("0"); }
-// }
-// cout<<" | ";
-// for (int i=0;i<n;i++)
-// {
-// if ( a & (1<<(n-1-i)) ) { printf("1"); }
-// else { printf("0"); }
-// }
-// cout<<" | ";
-// for (int i=16;i<n;i++)
-// {
-// if ( b2 & (1<<(n-1-i)) ) { printf("1"); }
-// else { printf("0"); }
-// }
-// cout<<" ";
-// for (int i=16;i<n;i++)
-// {
-// if ( b1 & (1<<(n-1-i)) ) { printf("1"); }
-// else { printf("0"); }
-// }
-// cout<<" | ";
+// int n=CHAR_BIT*sizeof(a);
+// n=32;
+// cout<<"| ";
+// for (int i=16;i<n;i++)
+// {
+// if ( a2 & (1<<(n-1-i)) ) { printf("1"); }
+// else { printf("0"); }
+// }
+// cout<<" ";
+// for (int i=16;i<n;i++)
+// {
+// if ( a1 & (1<<(n-1-i)) ) { printf("1"); }
+// else { printf("0"); }
+// }
+// cout<<" | ";
+// for (int i=0;i<n;i++)
+// {
+// if ( a & (1<<(n-1-i)) ) { printf("1"); }
+// else { printf("0"); }
+// }
+// cout<<" | ";
+// for (int i=16;i<n;i++)
+// {
+// if ( b2 & (1<<(n-1-i)) ) { printf("1"); }
+// else { printf("0"); }
+// }
+// cout<<" ";
+// for (int i=16;i<n;i++)
+// {
+// if ( b1 & (1<<(n-1-i)) ) { printf("1"); }
+// else { printf("0"); }
+// }
+// cout<<" | ";
//
-// // cout<<right<<setw(10)<<dec<<a2;
-// // cout<<right<<setw(10)<<dec<<a1;
-// // cout<<right<<setw(15)<<dec<<a;
+// // cout<<right<<setw(10)<<dec<<a2;
+// // cout<<right<<setw(10)<<dec<<a1;
+// // cout<<right<<setw(15)<<dec<<a;
//
-// // cout<<right<<setw(10)<<dec<<(short)b2;
-// // cout<<right<<setw(10)<<dec<<(short)b1;
+// // cout<<right<<setw(10)<<dec<<(short)b2;
+// // cout<<right<<setw(10)<<dec<<(short)b1;
//
-// cout<<endl;
-// }
-// if( (count%1053) == 0)
-// {
-// countframes++;
-// }
-// }
+// cout<<endl;
+// }
+// if( (count%1053) == 0)
+// {
+// countframes++;
+// }
+// }
//
-// // if(a==0x88aaccef)
-// if(a==0x89abcdef)
-// {
-// // cout<<count<<"\t"<<count-count_tmp<<endl;
-// // count_tmp=count;
-// countframes++;
-// // break;
-// }
+// // if(a==0x88aaccef)
+// if(a==0x89abcdef)
+// {
+// // cout<<count<<"\t"<<count-count_tmp<<endl;
+// // count_tmp=count;
+// countframes++;
+// // break;
+// }
//
-// count++;
+// count++;
//
-// // if(count==50) break;
-// }
-// cout<<right<<setw(10)<<hex<<a2;
-// cout<<right<<setw(10)<<hex<<a1;
-// cout<<right<<setw(10)<<hex<<a<<endl;
-// cout<<dec<<countframes<<"\t"<<countinframe<<endl;
+// // if(count==50) break;
+// }
+// cout<<right<<setw(10)<<hex<<a2;
+// cout<<right<<setw(10)<<hex<<a1;
+// cout<<right<<setw(10)<<hex<<a<<endl;
+// cout<<dec<<countframes<<"\t"<<countinframe<<endl;
//
-// TCanvas* cm;
-// cm = new TCanvas("cc2","Matrix",50,100,1200,800);
-// cm->Divide(3,2);
-// gStyle->SetOptFit(1011);
-// gStyle->SetPalette(1);
-// gStyle->SetCanvasColor(0);
-// gStyle->SetFrameFillColor(10);
-// gStyle->SetOptStat(1);
+// TCanvas* cm;
+// cm = new TCanvas("cc2","Matrix",50,100,1200,800);
+// cm->Divide(3,2);
+// gStyle->SetOptFit(1011);
+// gStyle->SetPalette(1);
+// gStyle->SetCanvasColor(0);
+// gStyle->SetFrameFillColor(10);
+// gStyle->SetOptStat(1);
//
-// cm->cd(1);
-// histo1[0]->Draw();
-// histo1[0]->GetXaxis()->SetTitle("Signal [ADC]");
-// histo1[0]->GetYaxis()->SetTitle("Entries");
-// cm->Update();
-// cm->cd(2);
-// histo1[1]->Draw();
-// histo1[1]->GetXaxis()->SetTitle("Signal [ADC]");
-// histo1[1]->GetYaxis()->SetTitle("Entries");
-// cm->Update();
-// cm->cd(3);
-// histo1[2]->Draw();
-// histo1[2]->GetXaxis()->SetTitle("Signal [ADC]");
-// histo1[2]->GetYaxis()->SetTitle("Entries");
-// cm->Update();
+// cm->cd(1);
+// histo1[0]->Draw();
+// histo1[0]->GetXaxis()->SetTitle("Signal [ADC]");
+// histo1[0]->GetYaxis()->SetTitle("Entries");
+// cm->Update();
+// cm->cd(2);
+// histo1[1]->Draw();
+// histo1[1]->GetXaxis()->SetTitle("Signal [ADC]");
+// histo1[1]->GetYaxis()->SetTitle("Entries");
+// cm->Update();
+// cm->cd(3);
+// histo1[2]->Draw();
+// histo1[2]->GetXaxis()->SetTitle("Signal [ADC]");
+// histo1[2]->GetYaxis()->SetTitle("Entries");
+// cm->Update();
//
-// cm->cd(4);
-// histo2[0]->Draw("colz");
-// histo2[0]->GetXaxis()->SetTitle("column");
-// histo2[0]->GetYaxis()->SetTitle("row");
-// histo2[0]->GetZaxis()->SetTitle("Signal [ADC]");
-// cm->Update();
-// cm->cd(5);
-// histo2[1]->Draw("colz");
-// histo2[1]->GetXaxis()->SetTitle("column");
-// histo2[1]->GetYaxis()->SetTitle("row");
-// histo2[1]->GetZaxis()->SetTitle("Signal [ADC]");
-// cm->Update();
-// cm->cd(6);
-// histo2[2]->Draw("colz");
-// histo2[2]->GetXaxis()->SetTitle("column");
-// histo2[2]->GetYaxis()->SetTitle("row");
-// histo2[2]->GetZaxis()->SetTitle("Signal [ADC]");
-// cm->Update();
+// cm->cd(4);
+// histo2[0]->Draw("colz");
+// histo2[0]->GetXaxis()->SetTitle("column");
+// histo2[0]->GetYaxis()->SetTitle("row");
+// histo2[0]->GetZaxis()->SetTitle("Signal [ADC]");
+// cm->Update();
+// cm->cd(5);
+// histo2[1]->Draw("colz");
+// histo2[1]->GetXaxis()->SetTitle("column");
+// histo2[1]->GetYaxis()->SetTitle("row");
+// histo2[1]->GetZaxis()->SetTitle("Signal [ADC]");
+// cm->Update();
+// cm->cd(6);
+// histo2[2]->Draw("colz");
+// histo2[2]->GetXaxis()->SetTitle("column");
+// histo2[2]->GetYaxis()->SetTitle("row");
+// histo2[2]->GetZaxis()->SetTitle("Signal [ADC]");
+// cm->Update();
}
//####################################################################
//####################################################################
UInt_t MAPS::littleEndian32(char* RawData, Int_t Pos) {
-
-// for(int j=3;j>=0;j--)
-// {
-// char a = RawData[j+Pos];
-//
-// int n=CHAR_BIT*sizeof(a);
-//
-// cout<<" | ";
-// for (int i=0;i<n;i++)
-// {
-// if ( a & (1<<(n-1-i)) ) { printf("1"); }
-// else { printf("0"); }
-// }
-// }
-// cout<<right<<setw(20)<<
-// (UInt_t)((Int_t)(UChar_t)RawData[3+Pos]*TMath::Power(2,24) + (Int_t)(UChar_t)RawData[2+Pos]*TMath::Power(2,16) + (Int_t)(UChar_t) RawData[1+Pos]*TMath::Power(2,8) + (Int_t)(UChar_t)RawData[0+Pos]);
-
- return (Int_t)(UChar_t)RawData[3+Pos]*TMath::Power(2,24) +
- (Int_t)(UChar_t)RawData[2+Pos]*TMath::Power(2,16) +
- (Int_t)(UChar_t)RawData[1+Pos]*TMath::Power(2,8) +
- (Int_t)(UChar_t)RawData[0+Pos];
+
+ // for(int j=3;j>=0;j--)
+ // {
+ // char a = RawData[j+Pos];
+ //
+ // int n=CHAR_BIT*sizeof(a);
+ //
+ // cout<<" | ";
+ // for (int i=0;i<n;i++)
+ // {
+ // if ( a & (1<<(n-1-i)) ) { printf("1"); }
+ // else { printf("0"); }
+ // }
+ // }
+ // cout<<right<<setw(20)<<
+ // (UInt_t)((Int_t)(UChar_t)RawData[3+Pos]*TMath::Power(2,24) + (Int_t)(UChar_t)RawData[2+Pos]*TMath::Power(2,16) + (Int_t)(UChar_t) RawData[1+Pos]*TMath::Power(2,8) + (Int_t)(UChar_t)RawData[0+Pos]);
+
+ return (Int_t)(UChar_t)RawData[3+Pos]*TMath::Power(2,24) +
+ (Int_t)(UChar_t)RawData[2+Pos]*TMath::Power(2,16) +
+ (Int_t)(UChar_t)RawData[1+Pos]*TMath::Power(2,8) +
+ (Int_t)(UChar_t)RawData[0+Pos];
}
//####################################################################
Short_t MAPS::littleEndian16(char* RawData, Int_t Pos) {
-
- return (Int_t)(UChar_t)RawData[1+Pos]*TMath::Power(2,8) +
- (Int_t)(UChar_t)RawData[0+Pos];
+
+ return (Int_t)(UChar_t)RawData[1+Pos]*TMath::Power(2,8) +
+ (Int_t)(UChar_t)RawData[0+Pos];
}
//####################################################################
void MAPS::reorderMi29a() {
Int_t matrixNumber =run->stringToNumber((string)fMatrix);
-
+
if( matrixNumber>5 ) // TODO
{
cerr<<"ERROR: "<<matrixNumber<<". Matrix not found! Choose: 0 to 5 !"<<endl;
cerr<<"-----------------------"<<endl;
- fRows = 0;
- fColumns = 0;
- fPixels = 0;
+ fRows = 0;
+ fColumns = 0;
+ fPixels = 0;
}
else
{
- Int_t ROWSSUB[6] = {48,48,32,32,32,32};
- Int_t OFFSET = 0;
-
+ Int_t ROWSSUB[6] = {48,48,32,32,32,32};
+ Int_t OFFSET = 0;
+
for(Int_t i=0; i<matrixNumber; i++)
{
OFFSET+=ROWSSUB[i];
}
OFFSET = OFFSET*48;
-
- fRows = ROWSSUB[matrixNumber];
- fColumns = 48;
- fPixels = fRows*fColumns;
-
- Float_t CDSMATRIX [fPixels];
- Int_t F0MATRIX [fPixels];
- Int_t F1MATRIX [fPixels];
-
+
+ fRows = ROWSSUB[matrixNumber];
+ fColumns = 48;
+ fPixels = fRows*fColumns;
+
+ Float_t CDSMATRIX [fPixels];
+ Int_t F0MATRIX [fPixels];
+ Int_t F1MATRIX [fPixels];
+
for(Int_t i=0; i<fPixels; i++)
{
- CDSMATRIX [i] = fCdsmatrix[OFFSET+i];
- F0MATRIX [i] = fF0matrix [OFFSET+i];
- F1MATRIX [i] = fF1matrix [OFFSET+i];
+ CDSMATRIX [i] = fCdsmatrix[OFFSET+i];
+ F0MATRIX [i] = fF0matrix [OFFSET+i];
+ F1MATRIX [i] = fF1matrix [OFFSET+i];
}
-
+
for(Int_t i=0; i<fPixels; i++)
{
- fCdsmatrix [i] = CDSMATRIX [i];
- fF0matrix [i] = F0MATRIX [i];
- fF1matrix [i] = F1MATRIX [i];
+ fCdsmatrix [i] = CDSMATRIX [i];
+ fF0matrix [i] = F0MATRIX [i];
+ fF1matrix [i] = F1MATRIX [i];
}
}
}
//####################################################################
void MAPS::reorderFSBB() {
-
- Float_t CDSMATRIX [fPixels];
- Int_t F0MATRIX [fPixels];
- Int_t F1MATRIX [fPixels];
- for(Int_t i=0; i<fPixels; i++)
+
+ Float_t CDSMATRIX [fPixels];
+ Int_t F0MATRIX [fPixels];
+ Int_t F1MATRIX [fPixels];
+ for(Int_t i=0; i<fPixels; i++)
+ {
+ CDSMATRIX [i] = fCdsmatrix[i];
+ F0MATRIX [i] = fF0matrix [i];
+ F1MATRIX [i] = fF1matrix [i];
+ }
+ fRows = 4;
+ fColumns = 416;
+ fPixels = fRows*fColumns;
+ // debugStream(CDSMATRIX, fPixels, 208, 0, 39);
+
+ Int_t subRows = 4;
+ Int_t subColumns = 208;
+ Int_t a0[subRows][subColumns];
+ Int_t a1[subRows][subColumns];
+ Int_t aMerge[fRows][fColumns];
+
+ //Divide CDSMATRIX in the channels. First 208 pixels are from A0-0, then A0-1, then A0-2, then A0-3, then A1-0, then A1-1, then A1-2, then A1-3
+ for(Int_t iOutChannel=0; iOutChannel<subRows; iOutChannel++)
+ {
+ for(Int_t iPixelInZeile=0; iPixelInZeile<subColumns; iPixelInZeile++)
{
- CDSMATRIX [i] = fCdsmatrix[i];
- F0MATRIX [i] = fF0matrix [i];
- F1MATRIX [i] = fF1matrix [i];
+ a0[iOutChannel][iPixelInZeile]=CDSMATRIX [iOutChannel*subColumns+iPixelInZeile];
+ a1[iOutChannel][iPixelInZeile]=CDSMATRIX [(4+iOutChannel)*subColumns+iPixelInZeile];//4+iOutChannel, because this is A1, which is shifted by four channels of A0
}
- fRows = 4;
- fColumns = 416;
- fPixels = fRows*fColumns;
- // debugStream(CDSMATRIX, fPixels, 208, 0, 39);
-
- Int_t subRows = 4;
- Int_t subColumns = 208;
- Int_t a0[subRows][subColumns];
- Int_t a1[subRows][subColumns];
- Int_t aMerge[fRows][fColumns];
-
- //Divide CDSMATRIX in the channels. First 208 pixels are from A0-0, then A0-1, then A0-2, then A0-3, then A1-0, then A1-1, then A1-2, then A1-3
- for(Int_t iOutChannel=0; iOutChannel<subRows; iOutChannel++)
- {
- for(Int_t iPixelInZeile=0; iPixelInZeile<subColumns; iPixelInZeile++)
- {
- a0[iOutChannel][iPixelInZeile]=CDSMATRIX [iOutChannel*subColumns+iPixelInZeile];
- a1[iOutChannel][iPixelInZeile]=CDSMATRIX [(4+iOutChannel)*subColumns+iPixelInZeile];//4+iOutChannel, because this is A1, which is shifted by four channels of A0
- }
- }
- // for(Int_t i=0; i<208; i++)
- // {
- // cout<< a0[3][i]<<",";
- // }
- // cout<<endl;
- // for(Int_t i=0; i<208; i++)
- // {
- // cout<< a1[3][i]<<",";
- // }
- // cout<<endl;
-
- for(Int_t iOutChannel=0; iOutChannel<subRows; iOutChannel++)
+ }
+ // for(Int_t i=0; i<208; i++)
+ // {
+ // cout<< a0[3][i]<<",";
+ // }
+ // cout<<endl;
+ // for(Int_t i=0; i<208; i++)
+ // {
+ // cout<< a1[3][i]<<",";
+ // }
+ // cout<<endl;
+
+ for(Int_t iOutChannel=0; iOutChannel<subRows; iOutChannel++)
+ {
+ for(Int_t iMerge2channels=0; iMerge2channels<subColumns;iMerge2channels++)
{
- for(Int_t iMerge2channels=0; iMerge2channels<subColumns;iMerge2channels++)
- {
- //Merge A0-0[0],A1-0[0],A0-0[1],A1-0[1],A0-0[2],A1-0[2],... output is an array of 4 geometrically columns
- aMerge[iOutChannel][iMerge2channels*2]=a0[iOutChannel][iMerge2channels];//A0-iOutChannel[iMerge2channels]
- aMerge[iOutChannel][iMerge2channels*2+1]=a1[iOutChannel][iMerge2channels];//A1-iOutChannel[iMerge2channels]
- }
- }
- for(Int_t iOutChannel=0; iOutChannel<fRows; iOutChannel++)
- {
- for(Int_t iPixel=0; iPixel<fColumns;iPixel++)
- {
- fCdsmatrix[iOutChannel*fColumns+iPixel]=aMerge[iOutChannel][iPixel];//Write the merged data in fCdsmatrix, which is 1dim array (standard)
- }
- }
-
+ //Merge A0-0[0],A1-0[0],A0-0[1],A1-0[1],A0-0[2],A1-0[2],... output is an array of 4 geometrically columns
+ aMerge[iOutChannel][iMerge2channels*2]=a0[iOutChannel][iMerge2channels];//A0-iOutChannel[iMerge2channels]
+ aMerge[iOutChannel][iMerge2channels*2+1]=a1[iOutChannel][iMerge2channels];//A1-iOutChannel[iMerge2channels]
+ }
+ }
+ for(Int_t iOutChannel=0; iOutChannel<fRows; iOutChannel++)
+ {
+ for(Int_t iPixel=0; iPixel<fColumns;iPixel++)
+ {
+ fCdsmatrix[iOutChannel*fColumns+iPixel]=aMerge[iOutChannel][iPixel];//Write the merged data in fCdsmatrix, which is 1dim array (standard)
+ }
+ }
+
}
//####################################################################
#endif
+
\ No newline at end of file