diff --git a/convertDRS4/read_binary.cpp b/convertDRS4/read_binary.cpp index d001c21035086f52ef177a555ad67982362c1754..cb38c231a9f641d2dc070560a0c22a41314f9329 100644 --- a/convertDRS4/read_binary.cpp +++ b/convertDRS4/read_binary.cpp @@ -123,8 +123,18 @@ int main(int argc, const char * argv[]) // rtree->Branch("amp_ch1", amp_ch1, "amp_ch1[ncell]/D"); // rtree->Branch("time_ch1", time_ch1, "time_ch1[ncell]/D"); - RawEvent *event = new RawEvent(); - rtree->Bronch("rawEvent", "RawEvent", &event); +// RawEvent *event = new RawEvent(); +// rtree->Bronch("rawEvent", "RawEvent", &event); + + TString bName; + RawEvent *event[4]; + for (Int_t i = 0; i<4; i++) { + event[i] = new RawEvent(); + bName.Form("ch%d", i); + rtree->Bronch(bName.Data(), "RawEvent", &event[i]); + } + + //------for other channels // rtree->Branch("amp_ch2", amp_ch2, "amp_ch2[ncell]/D"); @@ -200,7 +210,9 @@ int main(int argc, const char * argv[]) // loop over all events in the data file for (n=0 ; ; n++) { - event->Reset(); + + //reset Events + for (Int_t noChannel = 0; noChannel < 4; noChannel++) { event[noChannel]->Reset(); } // read event header i = (int)fread(&eh, sizeof(eh), 1, f); if (i < 1) @@ -251,14 +263,10 @@ int main(int argc, const char * argv[]) //for ROOT //ncell = i; - if(chn_index == 0) { - //amp_ch1[i] = waveform[b][chn_index][i]; - event->SetAmp(waveform[b][chn_index][i], i); -// event->InvertAmp(waveform[b][chn_index][i], i); - /*printf("old ampl %f ",amp_ch1[i]); - event->PrintAmp(i); - printf("\n");*/ - } +// if(chn_index == 0) { +// event[0]->SetAmp(waveform[b][chn_index][i], i); +// } + event[chn_index]->SetAmp(waveform[b][chn_index][i], i); // if(chn_index == 1) {amp_ch2[i] = waveform[b][chn_index][i];} // calculate time for this cell @@ -270,6 +278,7 @@ int main(int argc, const char * argv[]) // align cell #0 of all channels t1 = time[b][0][(1024-tch.trigger_cell) % 1024]; +// event[0]->SetTime(time[b][chn][i],i); //my print; // printf("t1 %1.6lf \n",time[b][0][(1024-tch.trigger_cell) % 1024]); for (chn=1 ; chn<4 ; chn++) { @@ -285,6 +294,7 @@ int main(int argc, const char * argv[]) time[b][chn][i] += dt; //each element of time gets dt correction //my print; // printf("time %1.6lf for %d %d %d \n",time[b][chn][i], b, chn, i); +// event[chn]->SetTime(time[b][chn][i],i); } } @@ -295,12 +305,7 @@ int main(int argc, const char * argv[]) //for ROOT for(i=0 ; i<1024 ; i++) { - //time_ch1[i] = time[b][0][i]; - event->SetTime(time[b][0][i],i); - /*printf("old time %f ",time_ch1[i]); - event->PrintTime(i); - printf("\n");*/ - // time_ch2[i] = time[b][1][i]; + for (Int_t chNum = 0; chNum < 4; chNum++) { event[chNum]->SetTime(time[b][chNum][i],i); } } //event->Print(); // find peak in channel 1 above threshold @@ -345,7 +350,8 @@ int main(int argc, const char * argv[]) rfile->Write(); rfile->Close(); - delete event; +// delete event; +// delete[] event; return 1; } diff --git a/data/rawDataDSR4/NeuRad_test_07_1.root b/data/rawDataDSR4/NeuRad_test_07_1.root index a90be9ad699a72e85aec0c911f7414fde1378bde..0edec10b15f7435cac6d9bcd5211b22b4f881ae7 100644 Binary files a/data/rawDataDSR4/NeuRad_test_07_1.root and b/data/rawDataDSR4/NeuRad_test_07_1.root differ diff --git a/dataClasses/RawEvent.cpp b/dataClasses/RawEvent.cpp index 6e9be6be8ec270cf6a951228f071128f104f7810..7a77ba87a58f97aa37bcc7eed2732539087b5a09 100644 --- a/dataClasses/RawEvent.cpp +++ b/dataClasses/RawEvent.cpp @@ -10,11 +10,13 @@ RawEvent::RawEvent() : fNPoints(1024) { // TODO Auto-generated constructor stub Init(); + Reset(); } RawEvent::RawEvent(const Int_t npoints) : fNPoints(npoints) { // TODO Auto-generated constructor stub Init(); + Reset(); } RawEvent::~RawEvent() {