Commit 13088ecc authored by Muzalevsky I.A's avatar Muzalevsky I.A

programm for raw data to processed modified

parent 6833af68
......@@ -12,20 +12,31 @@
int main(int argc, char* argv[])
{
// gSystem->Load("../libData.so");
if (argc != 4) {
if ( (argc < 3) || (argc > 4) ) {
// Tell the user how to run the program
std::cerr << "Usage: " << argv[0] << " [list with input files] [outputfile] [number of points in one event (1000 of 1024)]" << std::endl;
std::cerr << "Usage: " << argv[0] << " [list with input files] [outputfile] [number of points in one event (1000)]" << std::endl;
/* "Usage messages" are a conventional way of telling the user
* how to run a program if they enter the command incorrectly.
*/
return 1;
}
// Print the user's name:
TString infiles = argv[1];
TString ofile = argv[2];
TString Asize = argv[3];
TString Asize = argv[3];
Int_t kEventSize;
if(argc==3) {
kEventSize = 1024;
Info("convertRawToAnalyzed", "Event size was set to %d", kEventSize);
}
if(argc==4) {
kEventSize = Asize.Atoi();
if(kEventSize!=1000) {
std::cerr<< argv[0] << " the size of Events should be 1000 in this case " << std::endl;
return 1;
}
}
TFile *f = new TFile(infiles.Data());
TTree *tr = (TTree*)f->Get("rtree");
......@@ -35,28 +46,27 @@ int main(int argc, char* argv[])
const Int_t cfTD = 5;
TString bName;
RawEvent *revent[noBranches]; // pointer to the array (of RawEvent class) in which raw data for each channel will be put
RawEvent *revent[noBranches];
for (Int_t j = 0; j<noBranches; j++) {
revent[j] = new RawEvent(); //each raw event element is of class RawEvent()
revent[j] = new RawEvent(kEventSize); //each Aevent element is of class AEvent()
bName.Form("ch%d.", j);
tr->SetBranchAddress(bName.Data(), &revent[j]); //read the tree tr with raw data and fill array revent with raw data
tr->SetBranchAddress(bName.Data(), &revent[j]);
}
// tr->SetMakeClass(1);
TFile *fw = new TFile(ofile.Data(), "RECREATE"); //create .root file with somehow analyzed data
TTree *tw = new TTree("atree", "title of drs4 analysis tree"); //create analysis tree atree in it
AEvent *wevent[noBranches]; // pointer to the array (of AEvent class) in which analyzed data for each channel will be put
for (Int_t j = 0; j<noBranches; j++) {
wevent[j] = new AEvent(atoi(Asize));
wevent[j] = new AEvent(kEventSize);
bName.Form("Ach%d.", j);
wevent[j]->SetInputEvent(&revent[j]); //takes raw event from RawEvent
wevent[j]->SetCFratio(cfRatio);
wevent[j]->SetCFtimeDelay(cfTD);
tw->Bronch(bName.Data(), "AEvent", &wevent[j]); // create branches in atree to hold analyzed data
}
//----event loop in tr input tree
Long64_t nentries = tr->GetEntries();
......@@ -75,6 +85,7 @@ int main(int argc, char* argv[])
}
//----end of event loop
printf("%d events are processed\n", nentries);
tw->Write();
fw->Close();
......
void integralFormSignal()
//void integralFormSignal()
{
gSystem->Load("../libData.so");
TFile *f = new TFile("../data/dataTektronix/exp2.root");
TFile *f = new TFile("../data/dataTektronix/exp7.root");
TTree *tr = (TTree*)f->Get("atree");
const Int_t noBranches = 4;
Double_t ZeroTime[4];
Int_t iZero[4],PosZero[4],deltaT[4];
TString bName;
AEvent *aevent[noBranches]; // pointer to the array (of RawEvent class) in which raw data for each channel will be put
for (Int_t j = 0; j<noBranches; j++) {
aevent[j] = new AEvent(); //each raw event element is of class RawEvent()
aevent[j] = new AEvent(1000); //each raw event element is of class RawEvent()
bName.Form("Ach%d.", j);
tr->SetBranchAddress(bName.Data(), &aevent[j]); //read the tree tr with raw data and fill array revent with raw data
//cout << tr->SetBranchAddress(bName.Data(), &aevent[j]) << endl; //read the tree tr with raw data and fill array revent with raw data
}
TH1F *hist0 = new TH1F("hist1", "h1 title", 2000, -100, 100);
TH1F *hist1 = new TH1F("hist2", "h2 title", 2000, -100, 100);
TH1F *hist2 = new TH1F("hist3", "h3 title", 2000, -100, 100);
......@@ -38,15 +38,12 @@ void integralFormSignal()
deltaT[k] = iZero[k] - PosZero[k];
}
//for(k=0;k<4;k++) {
for(Int_t i = 0; i<1000; i++){
if( ((i+deltaT[0])>-1) && ((i+deltaT[0])<1000)) hist0->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i+deltaT[0]));
if( ((i+deltaT[1])>-1) && ((i+deltaT[1])<1000)) hist1->AddBinContent(i+500,aevent[1]->GetOnefAmpPos(i+deltaT[1]));
hist2->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i));
hist3->AddBinContent(i+500,aevent[1]->GetOnefAmpPos(i));
}
//}
}
TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600);
......
......@@ -47,6 +47,10 @@ clean:
-@echo ' '
-$(RM) $(CONVERTDRS4)/read_binary_DRS4
-@echo ' '
-$(RM) $(CONVERTTEKTRONIX)/convertTektronix
-@echo ' '
-$(RM) $(CONVERTRAWTOANALYZED)/convertRawToAnalyzed
-@echo ' '
# Those *Cint* files below need special treating:
$(DATA)/DataCint.cpp:
......
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