Hi Oliver, I followed your method. It is working. But, when I implementing in the script "efficiency.C (line no. 147-170) ", I faced with the following error --------------------------------------------------------------------------------------------------------- [jha@dulinux2 test]$ root efficiency.C Warning in <Format>: string truncated: .:/cms/external/lcg/external/r... ******************************************* * * * W E L C O M E to R O O T * * * * Version 3.10/01 8 October 2003 * * * * You are welcome to visit our Web site * * http://root.cern.ch * * * ******************************************* FreeType Engine v2.1.3 used to render TrueType fonts. Compiled for linux with thread support. CINT/ROOT C/C++ Interpreter version 5.15.105, Sep 28 2003 Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }. root [0] Processing efficiency.C... RTTI works locally ... Running on a Pentium One clock tick corresponds to 3.846e-10 seconds COBRA/GenUtil initializing adding file /cms/Releases/COBRA/COBRA_7_5_0/src/Data/.cobrarc 1 adding file /cms/Releases/COBRA/COBRA_7_5_0/src/Data/.orcarc 0 adding file /cms/Releases/ORCA/ORCA_7_6_1/src/Data/.cobrarc 0 adding file /cms/Releases/ORCA/ORCA_7_6_1/src/Data/.orcarc 1 adding file /home/jha/program/orca/ORCA_7_6_1/src/Data/.cobrarc 0 adding file /home/jha/program/orca/ORCA_7_6_1/src/Data/.orcarc 0 adding file ./.cobrarc 0 adding file ./.orcarc 0 eta = 1.6 Bin_efficiency 1 eta = 1.7 Bin_efficiency 0.915094 <TCanvas::MakeDefCanvas>: created default TCanvas with name c1 ======= END ====== root [1] *** Break *** segmentation violation Generating stack trace... 0x40a4ca68 in TGraph::Paint(char const*) + 0x8c from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libGraf.so 0x410d0ed0 in TPad::PaintModified() + 0x400 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libGpad.so 0x410b5e04 in TCanvas::Update() + 0x78 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libGpad.so 0x413c4077 in TRootCanvas::HandleContainerConfigure(Event_t*) + 0x4f from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libGui.so 0x413c47e1 in TRootContainer::HandleConfigureNotify(Event_t*) + 0x3b from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libGui.so 0x4136209c in TGFrame::HandleEvent(Event_t*) + 0x82 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libGui.so 0x41345f7b in TGClient::HandleEvent(Event_t*) + 0xd7 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libGui.so 0x41345c74 in TGClient::ProcessOneEvent() + 0x6e from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libGui.so 0x41345cfe in TGClient::HandleInput() + 0x28 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libGui.so 0x4134487a in TGInputHandler::Notify() + 0x22 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libGui.so 0x401c643e in TUnixSystem::DispatchOneEvent(bool) + 0x3a from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libCore.so 0x401313b3 in TSystem::InnerLoop() + 0x25 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libCore.so 0x40131341 in TSystem::Run() + 0x7b from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libCore.so 0x400e19f6 in TApplication::Run(bool) + 0x30 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libCore.so 0x40e12bdb in TRint::Run(bool) + 0x311 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/lib/libRint.so 0x08048890 in main + 0x90 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/bin/root.exe 0x40f225d9 in __libc_start_main + 0x95 from /lib/libc.so.6 0x08048711 in _Unwind_Resume + 0x35 from /cms/external/lcg/external/root/3.10.01/rh73_gcc32/bin/root.exe Root > ------------------------------------------------------------------------------------------------------------------------------------------------- Could you please enlighten me in this case ? Waiting for your response. Thanks and with regards, manoj Olivier Couet wrote: >Hello Manoj, > > Ah yes, it seems my way is better on the y axis :-) try: > >{ > Int_t n=20; > Double_t x[n],y[n]; > for (Int_t i=0; i<n; i++) { > x[i]=i*0.1; > y[i]=10*sin(x[i]+0.2); > } > TGraph *gr1 = new TGraph (n,x,y); > TH1F *h1 = new TH1F("","",100,0,5); > h1->SetMaximum(9); > h1->SetMinimum(2); > gr1->SetHistogram(h1); > TAxis *xaxis = gr1->GetXaxis(); > xaxis->SetLimits(0,5); > gr1->Draw("AC*"); >} > > Cheers, Olivier > > > >On Tue, 23 Mar 2004, Manoj Jha wrote: > > > >>Hi Oliver, >> Thanks again. Rene answer worked. But, it is not working in the >>script "efficiency.C" ( line no. 147-166). I have set the range of Y >>axis from (0,1) in the script. In the plot, the range is from (0.90,1.0). >> >>Thanks and with regards, >>manoj >> >> >>Olivier Couet wrote: >> >> >> >>>Hi Manoj, >>> >>>I answered you request before Rene's answer arrived. His answer is >>>simpler. The SetMaximum define the maximum of the histogram used by >>>TGraph >>> >>>Cheers, Olivier >>> >>> >>>On Tue, 23 Mar 2004, Manoj Jha wrote: >>> >>> >>> >>> >>> >>>>Hi Olivier, >>>> Thanks for mail. Could you please tell me the meaning of the >>>>following statment >>>> >>>>h1->SetMaximum(12); >>>> >>>> >>>> >>>>waiting for your response. >>>> >>>>Best wishes, >>>>manoj >>>> >>>> >>>> >>>> >>>>Olivier Couet wrote: >>>> >>>> >>>> >>>> >>>> >>>>>Hi Manoj, >>>>> >>>>>One possible way is; >>>>> >>>>>{ >>>>> Int_t n=20; >>>>> Double_t x[n],y[n]; >>>>> for (Int_t i=0; i<n; i++) { >>>>> x[i]=i*0.1; >>>>> y[i]=10*sin(x[i]+0.2); >>>>> } >>>>> TGraph *gr1 = new TGraph (n,x,y); >>>>> TH1F *h1 = new TH1F("","",100,0,5); >>>>> h1->SetMaximum(12); >>>>> gr1->SetHistogram(h1); >>>>> gr1->Draw("AC*"); >>>>>} >>>>> >>>>>Cheers, Olivier >>>>> >>>>>On Tue, 23 Mar 2004, Manoj Jha wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>Dear rooters, >>>>>> I am facing problem in setting range of the axis of the graph. For >>>>>>this purpose, I had written a root scripts and attaching it (51.C). In >>>>>>the scripts, I am trying to set the range of the X axis from (0,5). >>>>>>But, it is taking the default one (0,2). I am also attaching the output >>>>>>(graph.ps) that i am getting from the root script (51.C). Please let me >>>>>>know the possible solution for it. >>>>>> >>>>>>With best wishes , >>>>>>manoj >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> >>> >>> >>> >>> >> >> > > > { // library that handles input-output #include <iomanip> //Load the dictionary for egamma classes gSystem->Load("libPhysics.so"); gSystem->Load("libEgammaRootSupport.so"); //Load useful function gROOT->ProcessLine(".L ETAtransformation.C"); TClonesArray *top = new TClonesArray("TVector3",100); TClonesArray *top1 = new TClonesArray("IntVec",50); TClonesArray *mo_ele_Pele = new TClonesArray("TLorentzVector",20); // Load Trees, Branches , Leaves TFile *f = new TFile("egamma.root"); TTree *EGAMMA = (TTree*)f->Get("EGAMMA"); Int_t nL1iEM; EGAMMA->SetBranchAddress("nL1iEM",&nL1iEM); const Int_t kMax_nL1iEM = 200; Float_t L1iEM_L1iEMEt[kMax_nL1iEM]; //[nL1iEM] Float_t L1iEM_L1iEMEta[kMax_nL1iEM]; //[nL1iEM] Float_t L1iEM_L1iEMPhi[kMax_nL1iEM]; //[nL1iEM] EGAMMA->SetBranchAddress("L1iEM.L1iEMEt",L1iEM_L1iEMEt); EGAMMA->SetBranchAddress("L1iEM.L1iEMEta",L1iEM_L1iEMEta); EGAMMA->SetBranchAddress("L1iEM.L1iEMPhi",L1iEM_L1iEMPhi); Int_t nele; EGAMMA->SetBranchAddress("nele",&nele); EGAMMA->SetBranchAddress("ele.Pele",&mo_ele_Pele); const Int_t kMaxele_Pele = 200; Int_t ele_Ichrg[kMaxele_Pele]; EGAMMA->SetBranchAddress("ele.Ichrg",ele_Ichrg); // Parameters definition const Float_t Eta_End = 1.479; const Float_t PI = 3.1415927; const Float_t TWOPI = 2.0*PI; //Histograms TFile Isto("L1_Efficiency.root","recreate"); // Variables Int_t nBINeta = 2; Float_t etaLowLim = 1.6 , etaHiLim = 1.8 ; Int_t nBINphi = 360; Float_t phiLowLim = -PI , phiHiLim = +PI ; //------------------------------General_Plots-------------------- TH1F * KINE_ELE_PT = new TH1F("KINE_ELE_PT" ,"KINE_ELE_PT" ,nBINeta,0.,200); TH1F * KINE_ELE_ETA = new TH1F("KINE_ELE_ETA" ,"KINE_ELE_ETA" ,nBINeta,etaLowLim,etaHiLim); //TH2F * L1_ETAvsPt = new TH2F("L1_ETAvsPt" ,"L1_ETAvsPt" ,nBINeta,etaLowLim,etaHiLim,1000,0.,40.); TH1F * L1_KINE_ETA = new TH1F("L1_KINE_ETA" ,"L1_KINE_ETA" ,nBINeta,etaLowLim,etaHiLim); TH2F * efficiency = new TH2F("efficiency" ,"95 % threshold" ,nBINeta,etaLowLim,etaHiLim,10,0.,1.); //-------------------------------------------------------------------- Int_t nevents = (Int_t)EGAMMA->GetEntries(); Int_t nbytes = 0; //+++++++++++++++++++++++++++++++++++++++++++++++++ /// loop over the events ////+++++++++++++++++++++++++++++++++++++++++++++++++ nevents=1000; for(int ievent=0; ievent<nevents; ievent++) { nbytes += EGAMMA->GetEntry(ievent); // Loop over kine particles for(Int_t IE=0; IE<nele;IE++) { //Variable Initializations Float_t PTpar = 0.0 ; Float_t PPpar = 0.0 ; Float_t ETApar = 0.0 ; Float_t Zvtx = 0.0 ; Float_t Theta = 0.0 ; Float_t ETA = 0.0 ; Float_t PhiPar = 0.0 ; Float_t PhiGenPart = 0.0; Float_t ele_KINE_eta = 0.0; Float_t ele_KINE_phi = 0.0; TLorentzVector* v1 = (TLorentzVector*)((*mo_ele_Pele)[IE]); Float_t px_el =(*v1).X(); Float_t py_el =(*v1).Y(); Float_t pz_el =(*v1).Z(); //PPar->MOMENTUM FROM KINE INFO PPpar = sqrt(pow(px_el,2)+pow(py_el,2)+pow(pz_el,2)); //PTpar->TRANSVERSE MOMENTUM KINE INFO PTpar = sqrt(pow(px_el,2)+pow(py_el,2)); //ETApar->ETA FROM KINE INFO ETApar = 0.5*log((PPpar+pz_el)/(PPpar-pz_el)); //uncorrected for VTX.NE.0 // Eta correction ETA = ETAtransformation(ETApar,Zvtx); KINE_ELE_ETA->Fill(ETA); } // Kine electron loop // prepare ISOLATED triggers Float_t l1_et_cluster=0.0; for ( Int_t i=0; i<nL1iEM; i++) l1_et_cluster=l1_et_cluster+L1iEM_L1iEMEt[i]; if (l1_et_cluster > 14.75) L1_KINE_ETA->Fill(ETA); } // event loop // efficiency plot TAxis *xaxis; Int_t NbinsX; Float_t Xmax , Xmin ,Xbinsize; xaxis =KINE_ELE_ETA->GetXaxis(); NbinsX = xaxis->GetNbins(); Xmax = xaxis->GetXmax(); Xmin = xaxis->GetXmin(); Xbinsize = ( Xmax - Xmin )/Float_t(NbinsX); Float_t x1 =Xmin, bin1_t=0.0, bin2_t=0.0; for(Int_t i=0 ;i<NbinsX; i++) { Float_t bin1 = KINE_ELE_ETA->GetBinContent(i); Float_t bin2 = L1_KINE_ETA->GetBinContent(i); if (bin1==0.0) Float_t bin_efficiency=1.0; else Float_t bin_efficiency=bin2/bin1; efficiency->Fill(x1,bin_efficiency); cout << "eta = " << x1 << " Bin_efficiency " << bin_efficiency << endl ; x1=x1+Xbinsize; } // Rene, below is the script for changing the range of the Y-axis, i.e from the line no. 148-166 Float_t x[nBINeta+1], y[nBINeta+1]; x[0]=Xmin; for(Int_t i=0 ;i<NbinsX; i++) { Float_t bin1 = KINE_ELE_ETA->GetBinContent(i); Float_t bin2 = L1_KINE_ETA->GetBinContent(i); if (bin1==0.0) Float_t bin_efficiency=1.0; else Float_t bin_efficiency=bin2/bin1; efficiency->Fill(x1,bin_efficiency); y[i] = bin_efficiency; x[i+1]=x[i]+Xbinsize; } TGraph *gr = new TGraph (nBINeta, x,y); TH1F *h1 = new TH1F("h1","h1",nBINeta,1.5,1.9); h1->SetMaximum(1); h1->SetMinimum(0); gr->SetHistogram(h1); TAxis *axis = gr->GetXaxis(); axis->SetLimits(1.5,1.9); gr->Draw("AC*"); // // // Isto->Write(); Isto->Close(); cout << "======= END ======" << endl; return 0; }
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET