Data formats
Data formats usable for work with data from testbeams in confortabe environment of ROOT using standard format supported in ROOT: classis TTree, TBranch... histograms. Some preprocessing of data to help physicists to work with data for their own analysis is supported. Also bit flexibile format helps to use the same or similar macros - routines for different sensors in different experiments. Set of analysis macros supported those formats is in preparations.
-
Saving information in DST file
-
Histograms included to DST
-
Example of output
-
Some comments how to work with DST format C++ and ROOT commands
Saving information in DST file
Header of testbeam - identification (text)
Who is create DST (text)
DUT Name (text)
DUT Wafer (text)
DUT type (text)
Basic parameters:
RunNumber
NoOfEvents
Nominal Energy (GeV)
DAQ Date of raw data file creation
DAQ Time of raw data file creation
Bias
No. of telescopes
No. of DUTs
About telescopes:
NTelPlanes - No. of planes in telescope
NTelStrips - No. of strips in telescope
NClastMaxFull - No. of clusters in telescope
NTelClusterMax - if No. of clusters in telescope is too big, maximum was set to this value
Pitch[][] - sign include orientation direction compare with plane 0 of first telescope
TelPosition[][] - positions and rotations of all planes include their errors (from alignment)
h_TelEtaCor[][] - histograms of ETA correction for each telescope plane
Pedestal[][] - histograms of pedestal for each telescope plane
Threshold[][] - histograms of threshold for each telescope plane
Noise[][] - histograms of noise for each telescope plane
About DUTs:
DUTNRow, DUTNCol - maximal accepted DUT size
h_DUTPosition[] - DUT position - for each DUT
DUTNRow[], DUTNCol[] - DUT maximal matrix size (for 1D sensors (strips) DUTNCol=1) - for each DUT
pitchX[], pitchY[] - DUT cell size matrix or pitch in 1D sensors - for each DUT
Description of event saving in DST:
Int_t iEvent; //order No. of event
Int_t iTBEvent; //original No. of event in raw data fileInt_t iEvent;
Int_t flag;
// flag: -3: include masking channel or too small energy
// -2: unknown error
// -4: DUT raw data error
// 0: in some plane more events
// 1: in each tel plane one cluster
// 2: in axis 0 each tel plane one cluster
// 1: in axis 1 each tel plane one cluster
Int_t TDC; //TDC information
Int_t N_Tel; //No. of telescopes
Int_t **NClusters; //No. of clusters (N_Tel telescopes, N_TelPlane axes per telescope)
float ***Channel2; //channel position from 2 highest strips using COG (max NClusters clusters)
float ***Channel3; //channel position from 3 highest strips using COG
float ***ChannelEta; //channel position after Eta algorithm applying
Int_t ***ClusterSize; //cluster size for neighbored strips > 3*sigmaOfNoise
Int_t ***Signal; //sum of signal from all strips in cluster
float ***SignalErr; //error of channel position ChannelEta using theory
// (R. Turchetta, S. Straulino at al.)
float ***Track; // axis x/y; a0/a1; value/errValue/Chi2
float **DUTIntersection; // axis x/y; value/TrackEstimation/PredictionRegion
Int_t N_DUT; //No. of DUTs
Int_t ***DUT; //full information about DUT response
Histograms included to DST
Telescope Eta Correction [][] - plots
Telescopes: pedestal, threshold, noise [3][][] - plots
Residuals for all telescopes [][] - plots
hit map in DUT position [] + DUT Track Estimation [] +
DUT Prediction Region [] + Chi2 [] - plots
For telescope error 12um: Residuals for all telescopes [][] - plots
For telescope error 12um: hit map in DUT position [] + DUT Track Estimation [] +
DUT Prediction Region [] + Chi2 [] - plots
Example of output
dst file: ./dst/DST2147.root
nentries: 30039
---> Example of reading Event
Reading event: 235 (from 30039)
Event 236, TBEvent 236, flag 1
Tel0,Axis0,Clusters: 1
Cluster 0: Channel2 381.080566, Channel3 381.002991, ChannelEtaCor 381.161865
ClusterSize 1, Signal 856, PositionError 0.007841
Tel0,Axis1,Clusters: 1
Cluster 0: Channel2 307.224030, Channel3 307.198486, ChannelEtaCor 307.336365
ClusterSize 2, Signal 1174, PositionError 0.000385
Tel1,Axis0,Clusters: 1
Cluster 0: Channel2 238.150711, Channel3 238.196518, ChannelEtaCor 238.303284
ClusterSize 2, Signal 836, PositionError 0.001474
Tel1,Axis1,Clusters: 1
Cluster 0: Channel2 316.317810, Channel3 316.314850, ChannelEtaCor 316.375732
ClusterSize 2, Signal 881, PositionError 0.000342
Tel2,Axis0,Clusters: 1
Cluster 0: Channel2 396.618256, Channel3 396.556335, ChannelEtaCor 396.495941
ClusterSize 2, Signal 909, PositionError 0.000723
Tel2,Axis1,Clusters: 1
Cluster 0: Channel2 290.651886, Channel3 290.678741, ChannelEtaCor 290.447418
ClusterSize 2, Signal 1083, PositionError 0.000429
Tel3,Axis0,Clusters: 1
Cluster 0: Channel2 228.465988, Channel3 228.361145, ChannelEtaCor 228.457840
ClusterSize 2, Signal 779, PositionError 0.000970
Tel3,Axis1,Clusters: 1
Cluster 0: Channel2 312.030731, Channel3 312.004395, ChannelEtaCor 312.038269
ClusterSize 1, Signal 1072, PositionError 0.003732
Axis0, Track: a0=19.071960+-0.001783, a1=0.000181+-0.000013, Chi2=24.567848
DUT: intersection 19.084778, TrackEstimation 0.015005, PredictionRegion 0.033516
ConfidenceLevel 95.0 %
Axis1, Track: a0=15.368854+-0.000306, a1=0.000518+-0.000004, Chi2=80.873528
DUT: intersection 15.405603, TrackEstimationRegion +-0.011407, PredictionRegion +-0.025479
ConfidenceLevel 95.0 %
---> General preset parameters
Basic Description: TestBeam DEPFET DESY Hamburg January 2006
Person create this file: Peter Kodys
DUT Type: DEPFET module 2A
RunNumber 2147
Events 30039
Nominal Energy 4.0 GeV
DAQ Date 20060116
DAQ Time 233735
Bias 200.0 V
Next other 3 possible saving parameters...
---> Pitch of Telescopes and their orientation (sign of numbers)
Tel0 Axis0 Pitch 0.050
Tel0 Axis1 Pitch 0.050
Tel1 Axis0 Pitch -0.050
Tel1 Axis1 Pitch 0.050
Tel2 Axis0 Pitch 0.050
Tel2 Axis1 Pitch 0.050
Tel3 Axis0 Pitch -0.050
Tel3 Axis1 Pitch 0.050
---> Alignment of Telescopes
Tel0 Axis0 Position 0.0000000000 PosErr 0.0000000000 Rotation 0.0000000000 RotErr 0.0000000000
Tel0 Axis1 Position 0.0000000000 PosErr 0.0000000000 Rotation 0.0000000000 RotErr 0.0000000000
Tel0 Axis2 Position 0.0000000000 PosErr 1.0000000000 Rotation 0.0000000000 RotErr 0.0000000000
Tel1 Axis0 Position -1.1411154270 PosErr 0.0889386609 Rotation 0.0093985721 RotErr 0.0067485264
Tel1 Axis1 Position -0.2499619871 PosErr 0.1164376810 Rotation 0.0085875671 RotErr 0.0064898110
Tel1 Axis2 Position 37.0000000000 PosErr 1.0000000000 Rotation 0.0000000000 RotErr 0.0000000000
Tel2 Axis0 Position -0.6324646473 PosErr 0.0866843387 Rotation -0.0043046153 RotErr 0.0064860168
Tel2 Axis1 Position 0.8309021592 PosErr 0.1136767790 Rotation -0.0061457367 RotErr 0.0064405510
Tel2 Axis2 Position 130.5000000000 PosErr 1.0000000000 Rotation 0.0000000000 RotErr 0.0000000000
Tel3 Axis0 Position -1.5750333071 PosErr 0.0886298940 Rotation 0.0075332383 RotErr 0.0067273951
Tel3 Axis1 Position -0.0134979999 PosErr 0.1162271947 Rotation 0.0062652640 RotErr 0.0064861109
Tel3 Axis2 Position 167.5000000000 PosErr 1.0000000000 Rotation 0.0000000000 RotErr 0.0000000000
---> DUT_Position
DUT Position: 71.000000 +- 1.000000 mm
Some comments how to work with DST format
Dynamic size of arrays in C++ code:
float **ikuk2; //create array with size iYmax x iXmax
ikuk2 = malloc(sizeof(float *) * iYmax);
for (int i = 0; i < iYmax; i++) {
ikuk2[i] = malloc(sizeof(float) * iXmax);
}
ikuk2[2][3] = 26;
printf("%f\n",ikuk2[2][3]);
Dynamic size of arrays 1D in ROOT code:
float *ikuk;> //create array with size iXmax
ikuk = (float*) new float[iXmax];
ikuk1[3] = 26;
printf("%f\n",ikuk1[3]);
Dynamic size of arrays 2D in ROOT code:
int **ikuk3; //create array with size iYmax x iXmax
ikuk3 = (int**) new int*[iYmax];
for (int i = 0; i < iYmax; i++) {
ikuk3[i] = (int*) new int[iXmax];
}
ikuk3[2][3] = 21;
printf("%i\n",ikuk3[2][3]);
Dynamic size of arrays 2D mapping to objects in root data files in ROOT code:
sprintf(text,"PitchOfTelescopes");
if(h_DeleteTH1F = (TH1F*) gDirectory->GetList()->FindObject(text)) delete h_DeleteTH1F;
h_Pitch = (TH1F*)fDST->Get(text);
for (int i=0;i < NTel;i++) {
for (int j=0;j < NTelPlanes;j++) {
printf("Tel%i Axis%i Pitch %6.3f\n",i,j,h_Pitch->GetBinContent(NTelPlanes*i+j+1));
Pitch[i][j] = h_Pitch->GetBinContent(NTelPlanes*i+j+1);
}
}
Dynamic size of arrays 3D in ROOT code:
double ***fkuk5; //create array with size iZmax x iYmax x iXmax
fkuk5 = (double***) new double**[iZmax];
for (int k = 0; k < iZmax; k++) {
fkuk5[k] = (double**) new double*[iYmax];
for (int i = 0; i < iYmax; i++) {
fkuk5[k][i] = (double*) new double[iXmax];
for (int j=0;j < iXmax;j++) fkuk5[k][i][j] = 0; // preset to 0
}
}
fkuk5[3][2][3] = 21.01;
printf("3D: %f\n",fkuk5[3][2][3]);
In all previouse case raws of matrix are mapped in memory in no compact space and is impossible to share them out of macro (e.g. in submacros), for solving this problem we need to do:
// first we create linear 1D matrix to alocate memory space:
float *Channel2Lin = (float*) new float[NTel*NTelPlanes*NTelClusterMax];
// than create 3D matrix:
eventn->Channel2 = (float***) new float**[NTel];
for (int i = 0; i < NTel; i++) {
eventn->Channel2[i] = (float**) new float*[NTelPlanes];
for (int j = 0; j < NTelPlanes; j++) {
// finaly we map elements from 3D matrix tu linar space of 1D matrix:
eventn->Channel2[i][j] = (float*) (Channel2Lin + NTelPlanes*NTelClusterMax*i + NTelClusterMax*j);
}
}
Mapping to Branch in TREE od ROOT file:
DST->SetBranchAddress("Channel2",Channel2Lin);
printf("%f %f\n",Channel2Lin[3],Channel2[0][0][3]);
How to share dynamic arrays between macros:
void KukMain(void) {
int NDUT = 4;
int DUTNRow = 5;
int DUTNCol = 6;
int *MaskChannelsLin;
MaskChannelsLin = (int*) new int [NDUT*DUTNRow*DUTNCol];
int ***MaskChannels;
MaskChannels = (int ***) new int **[NDUT];
for (int k=0;k < NDUT;k++) {
MaskChannels[k] = (int **) new int *[DUTNRow];
for (int i=0;i < DUTNRow;i++) {
MaskChannels[k][i] = (int*) (MaskChannelsLin + DUTNRow*DUTNCol*k + DUTNCol*i);
for (int j=0;j < DUTNCol;j++) MaskChannelsLin[DUTNRow*DUTNCol*k + DUTNCol*i+j] = 4;
}
}
printf("****> %i %i\n",MaskChannels[0][3][4],MaskChannelsLin[24]);
DUTAnalysis1(MaskChannelsLin);
DUTAnalysis2(MaskChannels);
}
void DUTAnalysis1(int *MaskChannels) {
printf("----> %i\n",MaskChannels[0]);
}
void DUTAnalysis2(int ***MaskChannelsOK) {
int ***MaskChannels=MaskChannelsOK;
printf("----> %i\n",MaskChannels[0][0][0]);
}
Practical using of dynamic arrays are in ExampleReadDST.cpp