21 #pragma GCC system_header 28 #include "TObjArray.h" 29 #include "TObjString.h" 30 #include "TPaletteAxis.h" 31 #include "TMultiLayerPerceptron.h" 32 #include "TMLPAnalyzer.h" 92 TTree* nnTree2 =
new TTree (
"nnTree",
"nnTree");
94 nnTree2->SetDirectory(0);
100 for (
int jj=0; jj<nINP;jj++) x[jj]=0.;
101 char ilabel[nINP][16];
103 for (
int jj=0; jj<
NPIX;jj++) dt[jj]=0.;
104 char ilabeldt[
NPIX][16];
110 for(
int i=0;
i<nINP;
i++) {
112 char tlabel[16];
sprintf(tlabel,
"x%i/F",i+1);
113 nnTree2->Branch(ilabel[i], &x[i], tlabel);
119 char tlabeldt[16];
sprintf(tlabeldt,
"dt%i/D",i+1);
120 nnTree2->Branch(ilabeldt[i], &dt[i], tlabeldt);
123 nnTree2->Branch(
"duration", &dT,
"duration/D");
124 nnTree2->Branch(
"frequency_width", &dF,
"frequency_width/D");
125 nnTree2->Branch(
"central_frequency", &Fc,
"central_frequency/D");
129 nnTree2->Branch(
"type",&type,
"type/I");
138 nnTree2->Branch(
"amplitude_mode",&yi,
"amplitude_mode/I");
139 nnTree2->Branch(
"Matrix_dim",&nDim,
"Matrix_dim/I");
140 nnTree2->Branch(
"#inputs",&nInp,
"#inputs/I");
141 nnTree2->Branch(
"index",&index,
"index/I");
142 nnTree2->Branch(
"#Entries_type",&entriesTot,
"#Entries_type/I");
144 nnTree2->Branch(
"Files_name",&fname,
"Files_name/C");
147 char wlabel[nINP][16];
149 for(
int i=0;
i<nINP;
i++) {
151 char llabel[16];
sprintf(llabel,
"w%d/F",i+1);
152 nnTree2->Branch(ilabel[i], &w[i], tlabel);
158 nnTree2->Branch(
"w",&w,
"w/F");
162 cout<<
"fine definizione foglie"<<endl;
165 TChain TreeS(
"waveburst");
166 TreeS.Add(ifileS.Data());
169 cout <<
"Sig entries : " << entriesTot << endl;
170 std::vector<double>* frameS =
new vector<double>;
171 entryS.
fChain->SetBranchAddress(
"nnframe", &frameS);
172 std::vector<double>* dtvS =
new vector<double>;
173 entryS.
fChain->SetBranchAddress(
"dt_corepixels", &dtvS);
179 entryS.
fChain->SetBranchAddress(
"t_duration", &dTS);
180 entryS.
fChain->SetBranchAddress(
"f_duration", &dFS);
181 entryS.
fChain->SetBranchAddress(
"central_f", &FcS);
184 sprintf(fname,
"%s",ifileS.Data());
191 for (
int j=0;
j<
NPIX;
j++) dt[
j]=(*dtvS)[
j];
192 for (
int j=0;
j<nINP;
j++)
195 if((*frameS)[
j]>0.001) x[
j]=1;
199 else x[
j]=(*frameS)[
j];
205 cout<<
"Fine ciclo sul segnale"<<endl;
208 TChain TreeB(
"waveburst");
209 TreeB.Add(ifileB.Data());
212 cout <<
"Bg entries : " << entriesTot << endl;
213 std::vector<double>* frameB =
new vector<double>;
214 entryB.
fChain->SetBranchAddress(
"nnframe", &frameB);
215 std::vector<double>* dtvB =
new vector<double>;
216 entryB.
fChain->SetBranchAddress(
"dt_corepixels", &dtvB);
222 entryB.
fChain->SetBranchAddress(
"t_duration", &dTB);
223 entryB.
fChain->SetBranchAddress(
"f_duration", &dFB);
224 entryB.
fChain->SetBranchAddress(
"central_f", &FcB);
227 sprintf(fname,
"%s",ifileB.Data());
234 for (
int j=0;
j<
NPIX;
j++) dt[
j]=(*dtvB)[
j];
235 for (
int j=0;
j<nINP;
j++)
238 if((*frameB)[
j]>0.001) x[
j]=1;
242 else x[
j]=(*frameB)[
j];
248 cout<<
"fine ciclo sul Bg"<<endl;
257 sprintf(nomefile,
"nnTREE/nnTree_%s.root",ofile.Data());
259 TFile*
f=
new TFile(nomefile,
"RECREATE");
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\ layers : "<< nLAYERS<< "\ dF(hz) : "<< dF<< "\ dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1) *itime+ifreq;double time=itime *dT;double freq=(ifreq >0) ? ifreq *dF :dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
void TreeTest_CTFmod(TString ifileS, TString ifileB, TString ofile, int const y=1, int const NDIM=8, int const nINP=64)
TTree * fChain
root input file cointainig the analyzed TTree
cout<< "SNR "<< xsnr<< endl;wavearray< double > f
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)