@@ -23,9 +23,9 @@ int main(int argc, char* argv[])
...
@@ -23,9 +23,9 @@ int main(int argc, char* argv[])
if((argc<3)||(argc>4)){
if((argc<3)||(argc>5)){
// Tell the user how to run the program
// 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)]"<<std::endl;
std::cerr<<"Usage: "<<argv[0]<<" [list with input files] [outputfile] [smoothParameter (1 - smoothed, 0 - not)] [number of points in one event (1000 or 1024)]"<<std::endl;
/* "Usage messages" are a conventional way of telling the user
/* "Usage messages" are a conventional way of telling the user
* how to run a program if they enter the command incorrectly.
* how to run a program if they enter the command incorrectly.
*/
*/
...
@@ -34,8 +34,10 @@ int main(int argc, char* argv[])
...
@@ -34,8 +34,10 @@ int main(int argc, char* argv[])
TStringinfiles=argv[1];
TStringinfiles=argv[1];
TStringofile=argv[2];
TStringofile=argv[2];
TStringAsize=argv[3];
TStringsmooth=argv[3];
Int_tkEventSize;
TStringAsize=argv[4];
Int_tkEventSize,intSmoth;
Bool_tsmoothPar=kFALSE;
if(argc==3){
if(argc==3){
kEventSize=1024;
kEventSize=1024;
...
@@ -43,10 +45,24 @@ int main(int argc, char* argv[])
...
@@ -43,10 +45,24 @@ int main(int argc, char* argv[])
noiseMax=100.;
noiseMax=100.;
Info("convertRawToAnalyzed","Event size was set to %d",kEventSize);
Info("convertRawToAnalyzed","Event size was set to %d",kEventSize);
}
}
if(argc==4){
if(argc>3){
intSmoth=smooth.Atoi();
if((intSmoth!=1)&&(intSmoth!=0)){
std::cerr<<argv[3]<<" smoothpar should be 1 or 0 "<<std::endl;
return1;
}
if(intSmoth==1){
smoothPar=kTRUE;
Info("convertRawToAnalyzed","we gona SMOOTH");
}
else{Info("convertRawToAnalyzed","we NOT gonna SMOOTH");}
}
if(argc==5){
kEventSize=Asize.Atoi();
kEventSize=Asize.Atoi();
if(kEventSize!=1000){
if((kEventSize!=1000)&&((kEventSize!=1024))){
std::cerr<<argv[0]<<" the size of Events should be 1000 in this case "<<std::endl;
std::cerr<<argv[0]<<" the size of Events should be 1000 or 1024 "<<std::endl;
return1;
return1;
}
}
}
}
...
@@ -54,7 +70,7 @@ int main(int argc, char* argv[])
...
@@ -54,7 +70,7 @@ int main(int argc, char* argv[])
TFile*f=newTFile(infiles.Data());
TFile*f=newTFile(infiles.Data());
if(/*f == 0 || */f->IsZombie()){
if(/*f == 0 || */f->IsZombie()){
Error("convertRawToAnalyzed","Input file was not opened. Program will be terminated");
Error("convertRawToAnalyzed","Input file was not opened. Program will be terminated");
return2;
return1;
}
}
TTree*tr=(TTree*)f->Get("rtree");
TTree*tr=(TTree*)f->Get("rtree");
...
@@ -66,8 +82,6 @@ int main(int argc, char* argv[])
...
@@ -66,8 +82,6 @@ int main(int argc, char* argv[])
tr->SetBranchAddress(bName.Data(),&revent[j]);
tr->SetBranchAddress(bName.Data(),&revent[j]);
}
}
TFile*fw=newTFile(ofile.Data(),"RECREATE");//create .root file with somehow analyzed data
TFile*fw=newTFile(ofile.Data(),"RECREATE");//create .root file with somehow analyzed data
TTree*tw=newTTree("atree","title of drs4 analysis tree");//create analysis tree atree in it
TTree*tw=newTTree("atree","title of drs4 analysis tree");//create analysis tree atree in it
...
@@ -90,7 +104,7 @@ int main(int argc, char* argv[])
...
@@ -90,7 +104,7 @@ int main(int argc, char* argv[])
//cout<<" Event "<<i<<endl;
//cout<<" Event "<<i<<endl;
for(Int_tj=0;j<noBranches;j++){
for(Int_tj=0;j<noBranches;j++){
wevent[j]->Reset();
wevent[j]->Reset();
wevent[j]->ProcessEvent();//here all the analysis is going on so far
wevent[j]->ProcessEvent(smoothPar);//here all the analysis is going on so far