/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenBase/EvtNT3.cc

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 //
00003 // Environment:
00004 //
00005 // Module: EvtGen/EvtNT3.hh
00006 //
00007 // Description: Class to handle NTuple for three body decays
00008 // usage:
00009 // Users need to provide the MC and data file in NTuple style. The decays are described as
00010 //                        A->  x1    +   x2     +  x3
00011 // angular distribution:  costheta1, costheta2 ,costheta3
00012 // mass distribution:     m12, m13, and m23, here, m12 ==> mass of x1 and x2, etc.
00013 // these variables are defined as double type, the tree name is mc and data, repectively
00014 // Modification history:
00015 //
00016 //    PING RG     September 11, 2010         Module created
00017 //
00018 //------------------------------------------------------------------------
00019 #include "EvtGenBase/EvtNT3.hh"
00020 #include <stdlib.h>
00021 #include <string>
00022 #include <fstream>
00023 #include <iostream>
00024 
00025 void EvtNT3::init(){
00026   max=0;
00027   Ncos=20;
00028   chainMC = new TChain("mc");
00029   chainDT = new TChain("data");
00030 
00031   chainMC->SetDirectory(0);
00032   chainDT->SetDirectory(0);
00033 
00034   chainMC->Add(mcfile);
00035   chainDT->Add(datafile); 
00036   //--MC
00037   chainMC->SetBranchAddress("costheta1",&costheta1); 
00038   chainMC->SetBranchAddress("costheta2",&costheta2); 
00039   chainMC->SetBranchAddress("costheta3",&costheta3); 
00040   chainMC->SetBranchAddress("m12",&m12); 
00041   chainMC->SetBranchAddress("m13",&m13); 
00042   chainMC->SetBranchAddress("m23",&m23); 
00043   //--Data
00044   chainDT->SetBranchAddress("costheta1",&costheta1); 
00045   chainDT->SetBranchAddress("costheta2",&costheta2); 
00046   chainDT->SetBranchAddress("costheta3",&costheta3); 
00047   chainDT->SetBranchAddress("m12",&m12); 
00048   chainDT->SetBranchAddress("m13",&m13); 
00049   chainDT->SetBranchAddress("m23",&m23); 
00050 
00051   entriesMC=(Int_t)chainMC->GetEntries(); 
00052   entriesDT=(Int_t)chainDT->GetEntries(); 
00053 
00054   m12_low=chainDT->GetMinimum("m12");
00055   m13_low=chainDT->GetMinimum("m13");
00056   m23_low=chainDT->GetMinimum("m23");
00057 
00058   m12_up =chainDT->GetMaximum("m12");
00059   m13_up =chainDT->GetMaximum("m13");
00060   m23_up =chainDT->GetMaximum("m23");
00061 
00062   Int_t  ny=calculateBins(entriesDT); //bins in mass axisis (Y-axisis)
00063 
00064   MC1 = new TH2F("myMC1","",Ncos,-1.0,1.0,ny,m23_low,m23_up); // costheta1 vs. m23
00065   MC2 = new TH2F("myMC2","",Ncos,-1.0,1.0,ny,m13_low,m13_up); // costheta2 vs. m13
00066   MC3 = new TH2F("myMC3","",Ncos,-1.0,1.0,ny,m12_low,m12_up); // costheta3 vs. m12
00067 
00068   DT1 = new TH2F("myDT1","",Ncos,-1.0,1.0,ny,m23_low,m23_up); // costheta1 vs. m23
00069   DT2 = new TH2F("myDT2","",Ncos,-1.0,1.0,ny,m13_low,m13_up); // costheta2 vs. m13
00070   DT3 = new TH2F("myDT3","",Ncos,-1.0,1.0,ny,m12_low,m12_up); // costheta3 vs. m12
00071 
00072   WT1 = new TH2F("myWT1","",Ncos,-1.0,1.0,ny,m23_low,m23_up); // costheta1 vs. m23
00073   WT2 = new TH2F("myWT2","",Ncos,-1.0,1.0,ny,m13_low,m13_up); // costheta2 vs. m13
00074   WT3 = new TH2F("myWT3","",Ncos,-1.0,1.0,ny,m12_low,m12_up); // costheta3 vs. m12
00075 
00076   MC1->SetDirectory(0);
00077   MC2->SetDirectory(0);
00078   MC3->SetDirectory(0);
00079 
00080   DT1->SetDirectory(0);
00081   DT2->SetDirectory(0);
00082   DT3->SetDirectory(0);
00083 
00084   WT1->SetDirectory(0);
00085   WT2->SetDirectory(0);
00086   WT3->SetDirectory(0);
00087 
00088   //filling MC histogram
00089    for(Int_t j=0;j<entriesMC;j++) {
00090      chainMC->GetEntry(j);  
00091      MC1->Fill(costheta1,m23);
00092      MC2->Fill(costheta2,m13);
00093      MC3->Fill(costheta3,m12);
00094    }
00095 
00096   //filling data histogram
00097    for(Int_t j=0;j<entriesDT;j++) {
00098      chainDT->GetEntry(j);  
00099      DT1->Fill(costheta1,m23);
00100      DT2->Fill(costheta2,m13);
00101      DT3->Fill(costheta3,m12);
00102    }
00103    //--------debugging ---------
00104    //  showFrame(MC1);
00105    //  showFrame(MC2);
00106    //  showFrame(MC3);
00107  
00108   EvtHis2F::init(MC1,DT1,WT1);
00109   WT1  = EvtHis2F::getHwt();
00110   max1 = EvtHis2F::getZmax();
00111 
00112   EvtHis2F::init(MC2,DT2,WT2);
00113   WT2  = EvtHis2F::getHwt();
00114   max2 = EvtHis2F::getZmax();
00115 
00116   EvtHis2F::init(MC3,DT3,WT3);
00117   WT3  = EvtHis2F::getHwt();
00118   max3 = EvtHis2F::getZmax();
00119  
00120  //------------
00121  
00122   /* 
00123    show(WT1);
00124    std::cout<<"================================================="<<std::endl;
00125    show(WT2);
00126    std::cout<<"================================================="<<std::endl;
00127    show(WT3);
00128   */
00129 
00130 }
00131 
00132 
00133 int EvtNT3::calculateBins(int entries){
00134   int bins,ncell;
00135   ncell=30;  //at lease to require each cell to have 30 events
00136   bins=entries/ncell/Ncos;
00137   if(bins>100){bins=100;}
00138   return bins;
00139 }
00140 
00141 
00142 bool EvtNT3::AR1(double costheta, double mass){
00143   bool accept=false;
00144   accept= EvtHis2F::AR(costheta,mass,max1,WT1);
00145   //--- debugging
00146   //  std::cout<<"Max_mass= "<<getZmax()<<std::endl;
00147 
00148   return accept;
00149 }
00150 
00151 bool EvtNT3::AR2(double costheta, double mass){
00152   bool accept=false;
00153   accept= EvtHis2F::AR(costheta,mass,max2,WT2);
00154  
00155   return accept;
00156 }
00157 
00158 
00159 bool EvtNT3::AR3(double costheta, double mass){
00160   bool accept=false;
00161   accept= EvtHis2F::AR(costheta,mass,max3,WT3);
00162  
00163   return accept;
00164 }
00165 

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