From: Dennis Doering Date: Wed, 22 Jul 2015 15:30:51 +0000 (+0200) Subject: FSBB-Versuch X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=220f2b79eb46be39c6a5d79f1561a6c9e7d84874;p=radhard.git FSBB-Versuch --- diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index bf8ded8..8c44ad4 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -142,10 +142,10 @@ void ChargeSpektrum(TString runnumber = "") // runs[runi]->analyzeFrame(15684); // runs[runi]->analyzeFrame(803316); -// runs[runi]->analyzeFrame(8319); + // runs[runi]->analyzeFrame(8319); // creates or opens .root file, can analyze the RAW data - runs[runi]->error=runs[runi]->analyzeRun(false); // creates or opens .root file, can analyze the RAW data + runs[runi]->error=runs[runi]->analyzeRun(true); // creates or opens .root file, can analyze the RAW data if (!runs[runi]->error) { // gROOT->SetBatch(kTRUE); @@ -159,18 +159,21 @@ void ChargeSpektrum(TString runnumber = "") // runs[runi]->plotNoise(); if (!isBatch) gROOT->SetBatch(kFALSE); - runs[runi]->plotAllHistograms(); -// runs[runi]->plotAllHistogramsThresholdCluster(); - runs[runi]->plotAllHistogramsThresholdClusterCalibrated(); - runs[runi]->plotAllHistogramsCalibrated(); +// runs[runi]->plotAllHistograms(); + runs[runi]->plotAllHistogramsThresholdCluster(); + // runs[runi]->plotAllHistogramsThresholdClusterCalibrated(); + // runs[runi]->plotAllHistogramsCalibrated(); runs[runi]->writeAllHistogramsToFile(); } } + } } // plotAllRuns(""); plotAllRuns("seed calibrated"); // writeObservableToFile("seed threshold calibrated"); -// writeObservableToFile("seed threshold"); + writeObservableToFile("seed threshold"); + writeObservableToFile("veto threshold"); writeObservableToFile("seed threshold calibrated"); + } diff --git a/MABS_run_analyzer/MAPS.c b/MABS_run_analyzer/MAPS.c index 6465962..c49a017 100644 --- a/MABS_run_analyzer/MAPS.c +++ b/MABS_run_analyzer/MAPS.c @@ -198,6 +198,7 @@ Bool_t MAPS::initMapsRun( ) { fColumns = run->sensorinfocur.columns; 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); @@ -647,12 +648,12 @@ bool MAPS::getFrame(UInt_t FrameNumber) { // - fF1matrix // Use 'fOrderCode' to choose the respective order! // ----------------- - if (fOrderCode == "") { } -// else if (fOrderCode == "Mi26") { reorderMi26(); } - else if (fOrderCode == "Mi29a") { - reorderMi29a(); - } -// else if (fOrderCode == "Mi29b") { reorderMi29b(); } + if (fOrderCode == "") { } + else if (fOrderCode == "Mi34") { } + else if (fOrderCode == "Pegasus"){ } + else if (fOrderCode == "FSBB") { reorderFSBB(); } + else if (fOrderCode == "Mi29a") { reorderMi29a(); } +// else if (fOrderCode == "Mi29b") { reorderMi29b(); } //========================================================================== delete[] HDRDATA; delete[] RAWDATA; @@ -996,10 +997,16 @@ void MAPS::debugStream(const arraytype* (a), Int_t n, Int_t columns, Int_t preci std::cout << std::left << std::setprecision(precision); std::cout << a[i] << colorreset; if ((i+1)%columns==0) - cout << endl << endl; + cout << endl; + // cout << endl << endl; } cout << colorwhite << "----------------------------------" << colorreset << endl; cout << endl; + for (int i=0; i highlightabove) + // cout<<"Pixelpos"< fColumns-3 || seedrow < 2 || seedrow > fRows-3) + bordercluster = true; + else + bordercluster = false; + for(Int_t row=0; row<5; row++) + { + for(Int_t column=0; column<5; column++) + { + if ( (row==0) && (seedrow<2) ) { } + else if ( (row==1) && (seedrow<1) ) { } + else if ( (row==3) && (seedrow>= (fRows-1)) ) { } + else if ( (row==4) && (seedrow>= (fRows-2)) ) { } + else + { + if ( (column==0) && (seedcolumn<2) ) { } + else if ( (column==1) && (seedcolumn==0) ) { } + else if ( (column==3) && (seedcolumn==fColumns-1)) { } + else if ( (column==4) && (seedcolumn>fColumns-3)) { } + else { + fHittedPixel[rechargePixellist[rechargingpixeli]+(row-2)*fColumns+(column-2)] = -3; + } + } + } + } + cout<<"Hitted pixel discriminator matrix:"<(fHittedPixel, fPixels, fColumns, 1, 1); + fHittedPixel[rechargePixellist[rechargingpixeli]] = -4; + + } + + } + + //Begin: loop over all potential seed pixels: + //Determine 'hit-vicinity': + fHits = 0; + /// Array which holds the hit pixels indices, in other words: it holds the pixel number of the fired pixels + for(Int_t hit=0; hit 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; + + + //Provide 5x5 clusters with CDS - content: + for(Int_t row=0; row<5; row++) + { + for(Int_t column=0; column<5; column++) + { + // 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; + 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; + 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; + 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; + pixelchargeincluster[(row*5)+column]=DUMMY; + noiseincluster[(row*5)+column]=DUMMY; + } + else + { + // 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; + 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; + 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; + 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; + pixelchargeincluster[(row*5)+column]=DUMMY; + noiseincluster[(row*5)+column]=DUMMY; + } + else { + 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 + chargesumincluster+=pixelchargeincluster[(row*5)+column]; + } + } + } + } + noisesumincluster=TMath::Sqrt(noisesumincluster); +// cout << coloryellow << "Noise für Cluster: " << noisesumincluster << endlr; +// cout << coloryellow << "ChargeSum für Cluster: " << chargesumincluster << endlr; +// debug +// 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; + + //Check seeds (whether highest entry in cluster): + for(Int_t i=6; i<19; i++) // why not over full cluster? (I=0 i<25 TODO + { + if ( (i!=12) && (pixelchargeincluster[i] > pixelchargeincluster[12]) ) { + CHANCE=0; +// cout << "kill cluster: " << Hitlist[hit] << " with ADC: " << pixelchargeincluster[12] << endl; + break; + } + // maybe this is unnecessary, if upper if clause is a >= comparison + else if ( (i!=12) && (pixelchargeincluster[i] == pixelchargeincluster[12]) && i>12 ) { + cout << "WARNING: next pixel value identical to precessor" << endl; + CHANCE=0; //NOTE: potential error source + break; + } + else { + CHANCE=100; + if(i%5==3) { + i+=2; + }; + } + } + + + + + + //Begin: loop evaluate true seeds: + if(CHANCE==100) + { + 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++) + { + if ( (row==0) && (A<2) ) { } + else if ( (row==1) && (A<1) ) { } + else if ( (row==3) && (A>= (fRows-1)) ) { } + else if ( (row==4) && (A>= (fRows-2)) ) { } + else + { + if ( (column==0) && (B<2) ) { } + else if ( (column==1) && (B==0) ) { } + else if ( (column==3) && (B==fColumns-1)) { } + else if ( (column==4) && (B>fColumns-3)) { } + else { + fHittedPixel[Hitlist[hit]+(row-2)*fColumns+(column-2)] = bordercluster?-1:1; + } + } + } + } +// cout<<"Hitted pixel discriminator matrix:"<(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]; + } + + // if cluster charge > clusternoise * const + 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) ); + } + fHits++; + + } + + } + } + //End: loop evaluate true seeds: + //End: loop over all potential seed pixels: + + if(fSave) + { + for(Int_t i=0; iSetBinContent(i%fColumns, (int)(i/fColumns), fHittedPixel[i]); + fADCHitmatrix->SetBinContent(i%fColumns, (int)(i/fColumns), fCdsmatrix[i]); + } + } + + fFrameInfo.hits = fHits; + if(fHits<100) + { + fHitTree->Fill(); + } + else + { + cout<<"\rFrame: "< rechargePixellist; + Int_t A; + Int_t B; + Int_t seedrow; + Int_t seedcolumn; + Int_t DUMMY=0; + /// F0 - F1 of specific pixel in cluster + Float_t pixelchargeincluster[25]={ 0 }; + ///noise of specific pixel in cluster + Float_t noiseincluster[25]={ 0 }; + Int_t CHANCE; + Float_t CLUSTER[25]; + Bool_t bordercluster=false; + Float_t noisesumincluster=0; + Float_t chargesumincluster=0; + + for(Int_t i=0; i (100) ) + { + HITNR++; + HITS.Set(HITNR); + HITS.AddAt(i,(HITNR-1)); + if(fSave) { + hint2->Fill(i%fColumns+0.1, (int)(i/fColumns)+0.1); // counts up in 2dimensional pixel matrix + } + cout <(fCdsmatrix, fPixels, fColumns, 0, 39); + } + + if( (float)(1.*fCdsmatrix[i]-fPedestals[i]) < (-5.*fNoise[i]) ) // loop to find pixel with highly negative CDS + { + rechargePixellist.push_back(i); + } + } + + //Rewrite HITS to fHitlist array (why?) + Hitlist= new Int_t[HITNR]; + + for(Int_t i=0; i= (fRows-1)) ) {CLUSTER[(row*5)+column]=DUMMY; } + else if ( (row==4) && (A>= (fRows-2)) ) {CLUSTER[(row*5)+column]=DUMMY; } + else + { + if ( (column==0) && (B<2) ) {CLUSTER[(row*5)+column]=DUMMY; } + else if ( (column==1) && (B==0) ) {CLUSTER[(row*5)+column]=DUMMY; } + else if ( (column==3) && (B==fColumns-1)) {CLUSTER[(row*5)+column]=DUMMY; } + else if ( (column==4) && (B>fColumns-3)) {CLUSTER[(row*5)+column]=DUMMY; } +// else {CLUSTER[(row*5)+column] = fCdsmatrix[Hitlist[hit]+(row-2)*fColumns+(column-2)];} + else {CLUSTER[(row*5)+column] = 1.*fCdsmatrix[Hitlist[hit]+(row-2)*fColumns+(column-2)] ;} + } + } + } +debugStream<>(CLUSTER, 25, 5, 0, 100); +for(Int_t row=0;row<3;row++) + { + for(Int_t column=0;column<3;column++) + { + {CLUSTER[(row*3)+column] = 1.*fCdsmatrix[Hitlist[hit]+(row-1)*fColumns+(column-1)] ;} + + } + } +debugStream<>(CLUSTER, 9, 3, 0, 100); + + + cout<<"HIER BIN ICH"<(fHittedPixel, fPixels, fColumns, 1, 1); + /* +// Begin loop over all negative CDS pixel +// Determine clusters around them + for(UInt_t rechargingpixeli=0; rechargingpixeli= (fRows-1)) ) { + // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl; + pixelchargeincluster[(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) && (seedrow>= (fRows-2)) ) { + // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl; + pixelchargeincluster[(row*5)+column]=DUMMY; + } + else + { + // 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) && (seedcolumn<2) ) { + // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl; + pixelchargeincluster[(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) && (seedcolumn==0) ) { + // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl; + pixelchargeincluster[(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) && (seedcolumn==fColumns-1)) { + // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl; + pixelchargeincluster[(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) && (seedcolumn>fColumns-3)) { + // cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl; + pixelchargeincluster[(row*5)+column]=DUMMY; + } + else { + pixelchargeincluster[(row*5)+column] = 1.*fCdsmatrix [rechargePixellist[rechargingpixeli]+(row-2)*fColumns+(column-2)] - fPedestals [rechargePixellist[rechargingpixeli]+(row-2)*fColumns+(column-2)]; + } + } + } + } + + //Check seeds (whether lowest entry in cluster): + for(Int_t i=6; i<19; i++) + { + if ( (i!=12) && (pixelchargeincluster[i] < pixelchargeincluster[12]) ) { + CHANCE=0; + break; + } + // maybe this is unnecessary, if upper if clause is a >= comparison + else if ( (i!=12) && (pixelchargeincluster[i] == pixelchargeincluster[12]) && i>12 ) { + cout << "WARNING: next pixel value identical to precessor" << endl; + CHANCE=0; //NOTE: potential error source + break; + } + else { + CHANCE=100; + if(i%5==3) { + i+=2; + }; + } + } + //Begin: loop evaluate true seeds: if(CHANCE==100) { @@ -1588,7 +2046,7 @@ void MAPS::hitana() { cout<<"\rFrame: "<GetNumberFrames(); // for(int i=15580; i<15685;i++) // TODO remove 100000 run 342272 - for(int i=0; igetFrame(i); // processed->filterCommonMode(); -// cout << "hitana " << i << endl; + // cout << "hitana " << i << endl; processed->hitana(); // cout << "regetDynNoise " << endl; if (dynamicalNoise)