#include #include #include #include "TSystem.h" #include "TFile.h" #include "TTree.h" //#include "/media/users_NAS/Muzalevsky/exp1803/go4/TNeEvent.h" using namespace std; void fill1mm(){ string input_file_name_cs = "/media/users_NAS/Muzalevsky/exp1803/calSi/si_20_03_0002.root"; Int_t max_channel = 300; TTree* t; UShort_t NeEvent_SQ20[16]; UShort_t NeEvent_SQX_L[32]; TBranch *b_NeEvent_SQ20; TBranch *b_NeEvent_SQX_L; //TNeEvent *revent = new TNeEvent(); Float_t parSQ1[32], parSQ2[32],par201[16],par202[16]; TString line1; ifstream myfile1; Int_t count=0; myfile1.open("/home/muzalevsky/AculUti/exp1803/cali1mm/calDL/SQX_L.cal"); while (! myfile1.eof() ){ line1.ReadLine(myfile1); //cout << line1.Data() << endl; // if(count<3) continue; if(line1.IsNull()) break; sscanf(line1.Data(),"%g %g", parSQ1+count,parSQ2+count); count++; } cout << " pars for 1mm " << endl; for(Int_t i=0;i<32;i++){ cout << parSQ1[i] << " " << parSQ2[i] << endl; } ifstream myfile2; TString line2; count=0; myfile2.open("/home/muzalevsky/AculUti/macroexp18/si20cal/SQ20_58.cal"); while (! myfile2.eof() ){ line2.ReadLine(myfile2); cout << line2.Data() << endl; // if(count<3) continue; if(line2.IsNull()) break; sscanf(line2.Data(),"%g %g", par201+count,par202+count); count++; } cout << " pars for 20 mkm " << endl; for(Int_t i=0;i<16;i++){ cout << par201[i] << " " << par202[i] << endl; } f = new TFile(input_file_name_cs.c_str()); f->GetObject("AnalysisxTree",t); t->SetMakeClass(1); t->SetBranchAddress("NeEvent.SQX_L[32]", NeEvent_SQX_L, &b_NeEvent_SQX_L); t->SetBranchAddress("NeEvent.SQ20[16]", NeEvent_SQ20, &b_NeEvent_SQ20); const Long64_t nentries1 = t->GetEntries(); cout << nentries1 << endl; Float_t SQX_L[32],SQ20[16]; TFile *fw = new TFile("cal_20.root", "RECREATE"); TTree *tw = new TTree("cal", "20mk spec in energies"); tw->Branch("SQX_L",&SQX_L,"SQX_L[32]/F"); tw->Branch("SQ20",&SQ20,"SQ20[16]/F"); Int_t maxE = nentries1; cout<<">>> filling TREE up to "<GetEntry(jentry); for(Int_t i=0; i<32; i++){ SQX_L[i]=0.;// обнуление if(i<16) { SQ20[i]=0.; } if(NeEvent_SQX_L[i]>50.){ //cut the pedestal, calculating SQX_L[i] = NeEvent_SQX_L[i]*parSQ2[i] + parSQ1[i]; } if(i<14){ if(NeEvent_SQ20[i]>200.) { //cut the pedestal, calculating SQ20[i] = NeEvent_SQ20[i]*par202[i] + par201[i]; } } } // i<32 tw->Fill(); }//entries //htest->Draw(); tw->Write(); fw->Close(); }