Commit 15ea401b authored by Sarah Seif El Nasr's avatar Sarah Seif El Nasr
Browse files

Minor modifications

parent dbca354d
Pipeline #3075125 passed with stages
in 58 minutes and 45 seconds
......@@ -9,6 +9,10 @@
#include "../tools/PedestalEqualization.h"
#include <cstring>
#include "tools/BackEndAlignment.h"
#include "tools/StubBackEndAlignment.h"
#include "tools/CicFEAlignment.h"
#include "../Utils/argvparser.h"
#include <TApplication.h>
//#include "../Utils/easylogging++.h"
......@@ -97,6 +101,34 @@ int main(int argc, char* argv[])
cTool.StartHttpServer();
cTool.ConfigureHw();
// Align lpGBT-CIC first
CicFEAlignment cCicAligner;
cCicAligner.Inherit(&cTool);
cCicAligner.Initialise();
cCicAligner.CicLpGbtAlignment();
// align back-end
BackEndAlignment cBackEndAligner;
cBackEndAligner.Inherit(&cTool);
cBackEndAligner.Start(0);
cBackEndAligner.waitForRunToBeCompleted();
// if CIC is enabled then align CIC first
if(true)
{
cCicAligner.AlignInputs();
}
cCicAligner.Reset();
cCicAligner.dumpConfigFiles();
// time align stubs in back-end
StubBackEndAlignment cStubBackEndAligner;
cStubBackEndAligner.Inherit(&cTool);
cStubBackEndAligner.Initialise();
cStubBackEndAligner.Reset();
if(cCalibrate) // Calibrate Voffset
{
// Find offsets
......@@ -114,7 +146,7 @@ int main(int argc, char* argv[])
PedeNoise cPedeNoise;
cPedeNoise.Inherit(&cTool);
cPedeNoise.Initialise(true); // true = all channels (as opposed to test groups)
cPedeNoise.measureNoise();
// cPedeNoise.measureNoise();
// cPedeNoise.Validate(); // This masks noisy channels, already done optionally by CMTester ScanNoiseChannels
cPedeNoise.writeObjects();
......
......@@ -23,6 +23,8 @@ void CMTester::Initialize()
for(auto cCbc: *cHybrid)
{
averageMap [cCbc] = 0;
squareAverageMap[cCbc] = 0;
uint32_t cCbcId = cCbc->getId();
// Fill Canvas Map
......@@ -339,6 +341,7 @@ void CMTester::TakeData()
//{
// Run( theBoard, cNthAcq );
// ReadData (theBoard);
fNevents = 60000;
ReadNEvents(theBoard, fNevents);
const std::vector<Event*>& events = GetEvents();
......@@ -355,7 +358,7 @@ void CMTester::TakeData()
if(cN % 100 == 0)
{
LOG(INFO) << cN << " Events recorded!";
updateHists();
// updateHists();
}
cN++;
......@@ -370,6 +373,19 @@ void CMTester::TakeData()
updateHists();
}
float CMTester::getLambda(ChipContainer *theCbc)
{
float average = averageMap[theCbc]/fNevents;
float variance = squareAverageMap[theCbc]/fNevents - (average*average);
float sinAlfa = sin(2*M_PI * (variance - average*(1-(average/NCHANNELS)))/(NCHANNELS*(NCHANNELS-1)));
float lambda = sqrt(sinAlfa/(1-sinAlfa));
return lambda;
}
void CMTester::FinishRun()
{
// Iterate through maps, pick histogram that I need and the other one
......@@ -398,6 +414,7 @@ void CMTester::FinishRun()
float CMnoiseFrac = fabs(cNHitsFit->GetParameter(1));
float CMnoiseFracErr = fabs(cNHitsFit->GetParError(1));
if(fTotalNoise[iCbc] > 0)
LOG(INFO) << BOLDRED << "Average noise on FE " << +static_cast<ReadoutChip*>(cCbc.first)->getHybridId() << " CBC " << +cCbc.first->getId() << " : " << fTotalNoise[iCbc] << " . At Vcth "
<< cVcth << " CM is " << CMnoiseFrac << "+/-" << CMnoiseFracErr << "%, so " << CMnoiseFrac * fTotalNoise[iCbc] << " VCth." << RESET;
......@@ -405,6 +422,7 @@ void CMTester::FinishRun()
LOG(INFO) << BOLDRED << "FE " << +static_cast<ReadoutChip*>(cCbc.first)->getHybridId() << " CBC " << +cCbc.first->getId() << " . At Vcth " << cVcth << " CM is " << CMnoiseFrac << "+/-"
<< CMnoiseFracErr << "%" << RESET;
LOG(INFO) << BOLDBLUE << "Lambda = " << getLambda(cCbc.first) << RESET;
// now compute the correlation coefficient and the uncorrelated probability
TProfile2D* cTmpOccProfile = dynamic_cast<TProfile2D*>(getHist(cCbc.first, "combinedoccupancy"));
TProfile* cUncorrHitProb = dynamic_cast<TProfile*>(getHist(cCbc.first, "uncorr_occupancyprojection"));
......@@ -490,16 +508,22 @@ void CMTester::analyze(BeBoard* pBoard, const Event* pEvent)
for(auto cCbc: *cHybrid)
{
TH1F* cTmpNHits = dynamic_cast<TH1F*>(getHist(cCbc, "nhits"));
int cEventHits = pEvent->GetNHits(cHybrid->getId(), cCbc->getId());
cTmpNHits->Fill(cEventHits);
averageMap [cCbc] += cEventHits;
squareAverageMap[cCbc] += cEventHits*cEventHits;
continue;
// here loop over the channels and fill the histograms
// dont forget to get them first
TH1F* cTmpNHits = dynamic_cast<TH1F*>(getHist(cCbc, "nhits"));
TProfile* cTmpHitProb = dynamic_cast<TProfile*>(getHist(cCbc, "hitprob"));
TProfile2D* cTmpOccProfile = dynamic_cast<TProfile2D*>(getHist(cCbc, "combinedoccupancy"));
TProfile* cTmpCombinedOcc = dynamic_cast<TProfile*>(getHist(cCbc, "occupancyprojection"));
TProfile* cTmpCombinedOccPM = dynamic_cast<TProfile*>(getHist(cCbc, "occupancyprojectionplusminus"));
int cNHits = 0;
int cEventHits = pEvent->GetNHits(cHybrid->getId(), cCbc->getId());
if(cEventHits > 250) LOG(INFO) << " Found an event with " << cEventHits << " hits on a CBC! Is this expected?";
......@@ -564,7 +588,11 @@ void CMTester::analyze(BeBoard* pBoard, const Event* pEvent)
// Fill NHits Histogram
cTmpNHits->Fill(cNHits);
averageMap [cCbc] += cNHits;
squareAverageMap[cCbc] += cNHits*cNHits;
}
continue;
// Here deal with per-hybrid Histograms
TProfile2D* cTmpOccProfile = dynamic_cast<TProfile2D*>(getHist(cHybrid, "hybrid_combinedoccupancy"));
......
......@@ -61,12 +61,15 @@ class CMTester : public Tool
bool randHit(float pProbability);
bool isMasked(Ph2_HwDescription::ReadoutChip* pCbc, int pChan);
bool isMasked(int pGlobalChannel);
float getLambda(ChipContainer *theCbc);
uint32_t fNevents, fDoSimulate, fSimOccupancy;
std::vector<double> fTotalNoise;
uint32_t fVcth;
std::map<ChipContainer*, std::set<int>> fNoiseStripMap;
std::map<ChipContainer*, float> averageMap;
std::map<ChipContainer*, float> squareAverageMap;
};
#endif
......
/*!
*
* \file OTCommonNoise.h
* \brief OTCommonNoise class
* \brief OTCommonNoise class using Gamma function and correlation matrix techniques as described in https://inspirehep.net/literature/600273
* \author Fabio Ravera
* \date 17/09/21
*
......@@ -34,7 +34,7 @@ class OTCommonNoise : public Tool
void Reset();
private:
//
#ifdef __USE_ROOT__
// Calibration is not running on the SoC: Histogrammer is handeld by the calibration itself
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment