Subversion Repositories f9daq

Compare Revisions

Regard whitespace Rev 49 → Rev 50

/sipmScan/src/analysisBias.cpp
103,7 → 103,7
 
int analysisBias(char* dfile0="test", int dbg=0, double tdcCut=5.0)
{
const double c_tdcOffset = 372*TDC_BIN; // ns, SiPM4
const double c_tdcOffset = 97*TDC_BIN; // ns, SiPM4
printf(" Data to root conversion program\nUsage:\nd2r(input file name <without.dat>, debug on/off, TDC cut +-[ns])\n\n");
186,18 → 186,31
int nb;
int status;
char hname[256];
// Full range TDC data for every channel
TH2F* htdc = new TH2F("htdc",";TDC channel;SiPM channel",512,-0.5,511.5,NCH,-0.5,NCH-0.5);
// TDC data in specific time window
TH3F* h_correctedTDC = new TH3F("h_correctedTDC",";SiPM channel; ASD threshold [V]; t [ns]",
NCH, -0.5, NCH-0.5,
101, 1.0, 2.0,
33, -16.5*TDC_BIN, 16.5*TDC_BIN);
// Hits distribution in every channel per stage position
TH1F* hnhitsx[NCH]; // move to 2d with (channel, position)
TH1F* hnhitsy[NCH]; //-||-
// 2d hits distribution
TH2F* h2d[NCH]; //-||-
TH2F* h_bias = new TH2F("h_bias", "", 64, 0, 63, 20, 71.0,73.0);
int nBiasSteps = 20;
double biasLow = 71.0;
double biasUp = 73.0;
TH2F* h_bias = new TH2F("h_bias", "", 64, 0, 63, nBiasSteps, biasLow, biasUp);
int nSteps = 51;
double thrLow = 1.0;
double thrUp = 2.0;
TH2F* h_threshold = new TH2F("h_threshold",";SiPM ch;Threshold[V]",
64,-0.5,63.5,
101, 1.0, 2.0);
nSteps, thrLow, thrUp);
// Bias vs. ASD threshold per channel to estimate working point
TH3F* h_biasThreshold = new TH3F("h_biasThreshold","", 64,-0.5, 63.5,
31, 71.0, 74.0, 51, 1.0, 2.0);
TH2F* h_ch33 = new TH2F("h_ch33","ch. 33;x;y",100,20000,30000,100,0,10000);
TNtuple* nt = new TNtuple("nt", "nt", "ch:x:y:tdc");
212,9 → 225,9
if(dbg) printf("-----------------------------------------------\n");
if(dbg) printf("[%d] rec_id = %d | rec_len = %u\n", ceve, rec_id, rec_len);
int nSteps = 0;
int nBiasSteps = 0;
 
switch(rec_id)
{
case RUNREC_ID:
283,18 → 296,15
}
nBiasSteps = (run.biasUp - run.biasLow)/double(run.biasStep) + 1;
h_correctedTDC = (TH3F*) gROOT->FindObject("h_correctedTDC");
if (h_correctedTDC) delete h_correctedTDC;
nSteps = (run.thUp - run.thLow)/double(run.thStep) + 1;
if (dbg) printf("nSteps %d\n", nSteps);
biasLow = (run.biasLow - 0.5*run.biasStep)/1000.0;
biasUp = (run.biasUp + 0.5*run.biasStep)/1000.0;
h_correctedTDC = new TH3F("h_correctedTDC",";SiPM channel; ASD threshold [V]; t [ns]",
NCH,
-0.5,
NCH-0.5,
nBiasSteps,
(run.biasLow - 0.5*run.biasStep)/1000.0,
(run.biasUp + 0.5*run.biasStep)/1000.0,
NCH, -0.5, NCH-0.5,
nBiasSteps, biasLow, biasUp,
2*tdcCut+1,
-tdcCut*TDC_BIN - 0.5*TDC_BIN,
tdcCut*TDC_BIN + 0.5*TDC_BIN);
302,16 → 312,13
h_bias = (TH2F*) gROOT->FindObject("h_bias");
if (h_bias) delete h_bias;
h_bias = new TH2F("h_bias",";Channel; Bias [V]", 64, -0.5, 63.5,
nBiasSteps,
(run.biasLow - 0.5*run.biasStep)/1000.0,
(run.biasUp + 0.5*run.biasStep)/1000.0);
nBiasSteps, biasLow, biasUp);
if (h_threshold) delete h_threshold;
thrLow = (run.thLow - 0.5*run.thStep)/1000.0;
thrUp = (run.thUp + 0.5*run.thStep)/1000.0;
h_threshold = new TH2F("h_threshold",";SiPM ch;Threshold[V]",64,-0.5,63.5,
nSteps,
(run.thLow - 0.5*run.thStep)/1000.0,
(run.thUp + 0.5*run.thStep)/1000.0);
nSteps, thrLow, thrUp);
//h_threshold = new TH2F("h_threshold","Threshold scan;SiPM ch;Threshold[mV]",64,-0.5,63.5,
// 101,995,2005);
319,6 → 326,13
if (h_ch33) delete h_ch33;
h_ch33 = new TH2F("h_ch33","ch. 33;x;y",100,20000,30000,100,0,10000);
 
h_biasThreshold = (TH3F*) gROOT->FindObject("h_biasThreshold");
if (h_biasThreshold) delete h_biasThreshold;
h_biasThreshold = new TH3F("h_biasThreshold", ";Channel;Bias[V];Threshold[V]",
64, -0.5, 63.5,
nBiasSteps, biasLow, biasUp,
nSteps, thrLow, thrUp);
 
if (dbg) printf("RUNREC: all histos created.\n");
break;
362,6 → 376,7
nint = nb / ulsize; // no. of subrecords
if (dbg) printf("No. of subrecords %d \n", nint);
ii=0;
 
while (ii<nint){
int recid = buf[ii++];
int len = buf[ii++];
391,9 → 406,11
htdc->Fill(data, channel);
if (dbg) printf("ch: %d tdc: %d\n", channel, data);
if (dbg) nt->Fill(channel, pos.ix, pos.iy, data);
double tdcmin = tdcOffset[channel] - tdcCut;
double tdcmax = tdcOffset[channel] + tdcCut;
//double tdcmin = tdcOffset[channel] - tdcCut;
//double tdcmax = tdcOffset[channel] + tdcCut;
double time = data*TDC_BIN - tdcOffset[channel];
h_biasThreshold->Fill(channel, bias.bias/1000.0, thr.threshold/1000.0);
 
if(time >= -tdcCut and time <= tdcCut) {
h_correctedTDC->Fill(channel, bias.bias/1000.0, time);
hnhitsx[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN);
401,10 → 418,11
h2d[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN, (pos.yset - OFFSETY) * MIKRO_BIN);
 
if (position(pos.xset-OFFSETX, pos.yset-OFFSETY, channel)) {
h_ch33->Fill(pos.xset-OFFSETX, pos.yset-OFFSETY);
//h_ch33->Fill(pos.xset-OFFSETX, pos.yset-OFFSETY);
h_threshold->Fill(channel, thr.threshold/1000.0);
h_bias->Fill(channel, bias.bias/1000.0);
}
 
}
//gV673A->Fill(data,channel);
//gsumV673A[channel/16]->Fill(data);