Commit 9e319806 authored by Daniel Hynds's avatar Daniel Hynds
Browse files

Merge branch 'master' of ssh://gitlab.cern.ch:7999/CLICdp/tbAnalysis


Former-commit-id: 902f9065172d32cab8dfb052774fbb28f844fd7c
parents 5a999f41 d1caba90
......@@ -5,7 +5,7 @@
Alignment::Alignment(bool debugging)
: Algorithm("Alignment"){
debug = debugging;
m_numberOfTracksForAlignment = 400000;
m_numberOfTracksForAlignment = 200000;
nIterations = 5;
}
......@@ -20,6 +20,8 @@ void Alignment::initialise(Parameters* par){
// Pick up the global parameters
parameters = par;
if(parameters->alignmentMethod == 1) m_numberOfTracksForAlignment*=10;
}
StatusCode Alignment::run(Clipboard* clipboard){
......@@ -148,7 +150,7 @@ void MinimiseResiduals(Int_t &npar, Double_t *grad, Double_t &result, Double_t *
void Alignment::finalise(){
// If not enough tracks were produced, do nothing
if(m_alignmenttracks.size() < m_numberOfTracksForAlignment) return;
//if(m_alignmenttracks.size() < m_numberOfTracksForAlignment) return;
// Make the fitting object
TVirtualFitter* residualFitter = TVirtualFitter::Fitter(0,50);
......
......@@ -6,8 +6,8 @@
ClicpixAnalysis::ClicpixAnalysis(bool debugging)
: Algorithm("ClicpixAnalysis"){
debug = debugging;
m_associationCut = 0.1; // 100 um
m_proximityCut = 0.00001; // 125 um
m_associationCut = 0.05; // 100 um
m_proximityCut = 0.0005; // 125 um
timepix3Telescope = false;
}
......@@ -122,10 +122,10 @@ void ClicpixAnalysis::initialise(Parameters* par){
hChipEfficiencyMap = new TH2F("hChipEfficiencyMap","hChipEfficiencyMap",65,-0.5,64.5,65,-0.5,64.5);
hGlobalEfficiencyMap = new TH2F("hGlobalEfficiencyMap","hGlobalEfficiencyMap",200,-2.0,2.0,300,-1.,2);
hInterceptClusterSize1 = new TH2F("hInterceptClusterSize1","hInterceptClusterSize1",50,0,50,25,0,25);
hInterceptClusterSize2 = new TH2F("hInterceptClusterSize2","hInterceptClusterSize2",50,0,50,25,0,25);
hInterceptClusterSize3 = new TH2F("hInterceptClusterSize3","hInterceptClusterSize3",50,0,50,25,0,25);
hInterceptClusterSize4 = new TH2F("hInterceptClusterSize4","hInterceptClusterSize4",50,0,50,25,0,25);
hInterceptClusterSize1 = new TH2F("hInterceptClusterSize1","hInterceptClusterSize1",25,0,25,25,0,25);
hInterceptClusterSize2 = new TH2F("hInterceptClusterSize2","hInterceptClusterSize2",25,0,25,25,0,25);
hInterceptClusterSize3 = new TH2F("hInterceptClusterSize3","hInterceptClusterSize3",25,0,25,25,0,25);
hInterceptClusterSize4 = new TH2F("hInterceptClusterSize4","hInterceptClusterSize4",25,0,25,25,0,25);
m_nBinsX=32; m_nBinsY=32;
hMapClusterSizeAssociated = new TH2F("hMapClusterSizeAssociated","hMapClusterSizeAssociated",m_nBinsX,0,parameters->detector[dutID]->nPixelsX(),m_nBinsY,0,parameters->detector[dutID]->nPixelsY());
......@@ -180,6 +180,9 @@ StatusCode ClicpixAnalysis::run(Clipboard* clipboard){
Track* track = (*itTrack);
if (!track) continue;
// Cut on the track chi2/ndof
if(track->chi2ndof() < 3.0) continue;
// Get the track intercept with the clicpix plane (global and local co-ordinates)
PositionVector3D< Cartesian3D<double> > trackIntercept = parameters->detector[dutID]->getIntercept(track);
PositionVector3D< Cartesian3D<double> > trackInterceptLocal = *(parameters->detector[dutID]->m_globalToLocal) * trackIntercept;
......
......@@ -82,7 +82,18 @@ StatusCode DataDump::run(Clipboard* clipboard){
// Read one 64-bit chunk of data
ULong64_t pixdata = 0;
const int retval = fread(&pixdata, sizeof(ULong64_t), 1, currentFile);
dataDumpFile << hex << pixdata << dec << endl;
// Check if this is a trigger packet for Adrian
const UChar_t header = ((pixdata & 0xF000000000000000) >> 60) & 0xF;
// Use header 0x4 to get the long timestamps (called syncTime here)
if(header == 0x6){
const UChar_t header2 = ((pixdata & 0x0F00000000000000) >> 56) & 0xF;
if(header2 == 0xF){
dataDumpFile << hex << pixdata << dec << endl;
}
}
//dataDumpFile << hex << pixdata << dec << endl;
}
}
......
......@@ -258,17 +258,19 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
if(header2 == 0x4){
// The data is shifted 16 bits to the right, then 12 to the left in order to match the timestamp format (net 4 right)
m_syncTime[detectorID] = (m_syncTime[detectorID] & 0xFFFFF00000000000) + ((pixdata & 0x0000FFFFFFFF0000) >> 4);
// if(detectorID == "W0019_F07") tcout<<"Updating heartbeat part 1. Now syncTime = "<<(double)m_syncTime[detectorID]/(4096. * 40000000.)<<endl;
}
// 0x5 is the most significant part of the timestamp
if(header2 == 0x5){
// The data is shifted 16 bits to the right, then 44 to the left in order to match the timestamp format (net 28 left)
m_syncTime[detectorID] = (m_syncTime[detectorID] & 0x00000FFFFFFFFFFF) + ((pixdata & 0x00000000FFFF0000) << 28);
// if(detectorID == "W0019_F07") tcout<<"Updating heartbeat part 2. Now syncTime = "<<(double)m_syncTime[detectorID]/(4096. * 40000000.)<<endl;
// if( m_syncTime[detectorID] < 0x0000010000000000 && !m_clearedHeader[detectorID]) m_clearedHeader[detectorID] = true;
if(!m_clearedHeader[detectorID] && (double)m_syncTime[detectorID]/(4096. * 40000000.) < 6.) m_clearedHeader[detectorID] = true;
if(!m_clearedHeader[detectorID] && (double)m_syncTime[detectorID]/(4096. * 40000000.) < 2.5) m_clearedHeader[detectorID] = true;
}
// if(detectorID == "W0019_F07") tcout<<"Updating heartbeat. Now syncTime = "<<(double)m_syncTime[detectorID]/(4096. * 40000000.)<<endl;
//tcout<<"Updating heartbeat. Now syncTime = "<<(double)m_syncTime[detectorID]/(4096. * 40000000.)<<" for detector "<<detectorID<<endl;
// tcout<<"Updating heartbeat. Now syncTime = "<<(double)m_syncTime[detectorID]/(4096. * 40000000.)<<" for detector "<<detectorID<<endl;
}
if(!m_clearedHeader[detectorID]) continue;
......@@ -294,9 +296,9 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
// Ignore packets if they arrive before the current event window
if( parameters->eventLength != 0. && ((double)time/(4096. * 40000000.)) < (parameters->currentTime) ){
continue;
}
// if( parameters->eventLength != 0. && ((double)time/(4096. * 40000000.)) < (parameters->currentTime) ){
// continue;
// }
// Stop looking at data if the signal is after the current event window (and rewind the file
......@@ -407,9 +409,9 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
// If events are loaded based on time intervals, take all hits where the time is within this window
// Ignore pixels if they arrive before the current event window
if( parameters->eventLength != 0. && ((double)time/(4096. * 40000000.)) < (parameters->currentTime) ){
continue;
}
// if( parameters->eventLength != 0. && ((double)time/(4096. * 40000000.)) < (parameters->currentTime) ){
// continue;
// }
// Stop looking at data if the pixel is after the current event window (and rewind the file
// reader so that we start with this pixel next event)
......@@ -423,6 +425,7 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
// Otherwise create a new pixel object
Pixel* pixel = new Pixel(detectorID,row,col,(int)tot,time);
devicedata->push_back(pixel);
// bufferedData[detectorID]->push_back(pixel);
npixels++;
m_prevTime = time;
......@@ -436,6 +439,9 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
}
// Now we have data buffered into the temporary storage. We will sort this by time, and then load
// the data from one event onto it.
debug = false;
// If no data was loaded, return false
......
......@@ -36,6 +36,9 @@ public:
double m_timingCut;
long long int m_prevTime;
bool m_shutterOpen;
map<string, Pixels*> bufferedData;
map<string, SpidrSignals*> bufferedSignals;
};
......
Markdown is supported
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