/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/LumTauAlg/LumTauAlg-00-00-08/share/DataBase/tau_mode.c

Go to the documentation of this file.
00001 {
00002         gROOT->Reset();
00003 
00004         TFile *f1 = new TFile("YYYY/m_root_dir/LumTau_XXXX.root");
00005         TTree *data =event;
00006 
00007         Double_t time = 0.0,dltphi = 0.0,costht1 = 0.0,costht2 = 0.0,e1 = 0.0,e2 = 0.0,etot = 0.0,phi1 = 0.0,phi2 = 0.0;
00008         Int_t nentries = 0;
00009 
00010         data->SetBranchAddress("time",&time);
00011         data->SetBranchAddress("dltphi",&dltphi);
00012         data->SetBranchAddress("costht1",&costht1);
00013         data->SetBranchAddress("costht2",&costht2);
00014         data->SetBranchAddress("e1",&e1);
00015         data->SetBranchAddress("e2",&e2);
00016         data->SetBranchAddress("etot",&etot);
00017         data->SetBranchAddress("phi1",&phi1);
00018         data->SetBranchAddress("phi2",&phi2);
00019         TH1D  *hdltphi[10];
00020 
00021         for(Int_t i=0;i<10;i++)
00022         {
00023                 hdltphi[i] = new TH1D(" ","dltphi distribution",50,-50.,50.);
00024         }
00025 
00026         TH1 *htime = new TH1D("htime","time", 80, -10., 10.);
00027         Double_t timemin = 0.0,timemax = 0.0;
00028         nentries = (Int_t)data->GetEntries();
00029 
00030         data->GetEntry(0);
00031         timemin = time;
00032         data->GetEntry((nentries - 1));
00033         timemax = time;
00034 
00035         Double_t difft = timemax-timemin;
00036         Double_t xtime[11],lum[10];
00037         for(Int_t i=0;i<11;i++)
00038         {
00039                 xtime[i]=timemin+(difft/10.)*i;
00040         }
00041         for(Int_t i=0;i<10;i++)
00042         {
00043                 for(Int_t j=0;j<nentries;j++)
00044                 {
00045                         data->GetEntry(j);
00046                         bool lumcut = e1>1.2&&e2>0.8&&fabs(costht1)<0.8&&
00047                                 fabs(costht2)<0.8&&fabs(dltphi+1.055)>2.&&
00048                                 fabs(dltphi+1.055)<25.&&etot<4.0;
00049                         if(lumcut&&time>xtime[i]&&time<xtime[i+1])
00050                         {
00051                                 hdltphi[i]->Fill(dltphi);
00052                         }
00053                 }
00054         }
00055 
00056         Int_t nevt[10];
00057         Double_t x[10];
00058         for(Int_t i=0;i<10;i++)
00059         {
00060                 nevt[i] = hdltphi[i]->GetEntries();
00061                 x[i]=xtime[i+1]-xtime[0];
00062                 lum[i]=nevt[i]/(0.2*2514);
00063         }
00064 
00065         const Int_t n = 10;
00066         TF1 *g1    = new TF1("g1","[0]*exp(-x/[1])",0,10000.);
00067         g1->SetParameters(lum[0],1e+4.);
00068         g1->SetLineColor(2);
00069         TGraph* gr = new TGraph(n,x,lum);
00070         gr->SetLineColor(2);
00071         gr->SetLineWidth(2);
00072         gr->SetMarkerColor(4);
00073         gr->SetMarkerStyle(21);
00074         gr->SetTitle("BbLum_000XXXX");
00075         gr->GetXaxis()->SetTitle("Time");
00076         gr->GetYaxis()->SetTitle("Luminosity");
00077         gr->Fit("g1","R");
00078 //      gr->Draw("ap");
00079 
00080         std::ofstream m_outputFile;
00081         m_outputFile.open("YYYY/m_txt_dir/LumTau_XXXX.txt", ios_base::app);
00082         m_outputFile<<XXXX<<"           "<<difft<<"             "<<g1->GetParameter(0)<<"               "<<(g1->GetParameter(0) * exp(- 1.0 * difft / (g1->GetParameter(1))))<<"                "<<g1->GetParameter(1)<<endl;
00083         m_outputFile.close();
00084 
00085         gROOT->ProcessLine(".q");
00086 }

Generated on Tue Nov 29 23:12:43 2016 for BOSS_7.0.2 by  doxygen 1.4.7