double sps2(double l, double r, int dep){ //printf("%lf %lf %d\n", l, r, dep); double cur = sps(l, r), mid = (l + r)/2; double y = sps(l, mid) + sps(mid, r); if(sgn(cur-y) == 0 && dep > 9) return cur; return sps2(l, mid, dep+1) + sps2(mid, r, dep+1); }
bool Collide::_update_scene() { CGELlist objects = VIEW::peek()->active(); //if the geom has been scaled or skewed non-uniformly we can't use it if (!_land->xform().is_equal_scaling_orthogonal()) { cout << "COLLIDE::Warning - Land model not scaled uniformely" << endl; return false; } //create a octree from the "land" model of the scene ARRAY<OctreeNode*> nodes; if (_land && BMESH::isa(_land->body())) { Bvert_list list; Bface_list fs; ARRAY<Wvec> bcs; double spacing=0; nodes += sps(BMESH::upcast(_land->body()), _height, _regularity, _min_dist, fs, bcs, spacing); _RootNode = nodes[0]; _objs += 1; } //_spsTree = &_RootNodes; return true; }
void Player::SetPosByPos(FrameList::Itr log_pos, double time) { // сохраняем, потому что последующее декодирование в SetPos() // изменит позицию (и dmx будет рассогласован для послед. SetTime()) StreamPosSaver sps(srcStrm); SetPos(log_pos); curTime = time; }
int H264FileReader::Init() { //assert(IsOpened()); //assert(0 == ftell(m_fp)); assert(m_ptr == search_start_code(m_ptr, m_bytes)); long offset = 0; size_t count = 0; bool spspps = true; const unsigned char* nalu = m_ptr; do { const unsigned char* nalu2 = ReadNextFrame(); nalu = m_ptr + m_offset; int nal_unit_type = h264_nal_type(nalu); assert(0 != nal_unit_type); if(nal_unit_type <= 5) { if(m_sps.size() > 0) spspps = false; // don't need more sps/pps long n = ftell(m_fp); vframe_t frame; frame.offset = offset; frame.bytes = (nalu2 ? toOffset(nalu2) : n) - offset; frame.time = 40 * count++; frame.idr = 5 == nal_unit_type; // IDR-frame m_videos.push_back(frame); offset += frame.bytes; } else if(NAL_SPS == nal_unit_type || NAL_PPS == nal_unit_type) { assert(nalu2); if(spspps && nalu2) { size_t n = 0x01 == nalu[2] ? 3 : 4; sps_t sps(nalu2 - nalu - n); memcpy(&sps[0], nalu+n, nalu2-nalu-n); // filter last 0x00 bytes while(sps.size() > 0 && !*sps.rbegin()) sps.resize(sps.size()-1); m_sps.push_back(sps); } } nalu = nalu2; m_offset = nalu - m_ptr; } while(nalu); m_duration = 40 * count; return 0; }
// see header file for explanation of parameters void generate_samples( BMESHptr mesh, Bface_list& flist, // output: faces that contain samples ARRAY<Wvec>& blist, // output: sample barycentric coordinates WRT faces double& spacing, int height, double min_dist, double regularity ) { OctreeNode* n = sps(mesh, height, regularity, min_dist, flist, blist, spacing); delete n; }
void generate_samples( Patch* p, Bface_list& flist, // output: faces that contain samples ARRAY<Wvec>& blist, // output: sample barycentric coordinates WRT faces double& spacing, int height, double min_dist, double regularity ) { assert(p); OctreeNode* n = sps(p->faces(), height, regularity, min_dist, flist, blist, spacing); delete n; }
void MainWindow::on_actionExtTypes_triggered() { QVariant v1(QLatin1String("hallo")); QVariant v2(QStringList(QLatin1String("hallo"))); QVector<QString> vec; vec.push_back("Hallo"); vec.push_back("Hallo2"); std::set<std::string> stdSet; stdSet.insert("s1"); QWidget *ww = this; QWidget &wwr = *ww; QSharedPointer<QString> sps(new QString("hallo")); QList<QSharedPointer<QString> > spsl; spsl.push_back(sps); QMap<QString,QString> stringmap; QMap<int,int> intmap; std::map<std::string, std::string> stdstringmap; stdstringmap[std::string("A")] = std::string("B"); int hidden = 45; if (1 == 1 ) { int hidden = 7; qDebug() << hidden; } QLinkedList<QString> lls; lls << "link1" << "link2"; QStandardItemModel *model =new QStandardItemModel; model->appendRow(new QStandardItem("i1")); QList <QList<int> > nestedIntList; nestedIntList << QList<int>(); nestedIntList.front() << 1 << 2; QVariantList vList; vList.push_back(QVariant(42)); vList.push_back(QVariant("HALLO")); stringmap.insert("A", "B"); intmap.insert(3,4); QSet<QString> stringSet; stringSet.insert("S1"); stringSet.insert("S2"); qDebug() << *(spsl.front()) << hidden; }
Bonds get_internal_bonds(Hierarchy mhd) { kernel::ParticlesTemp ps = core::get_all_descendants(mhd); IMP::base::set<kernel::Particle *> sps(ps.begin(), ps.end()); Bonds ret; for (kernel::ParticlesTemp::iterator pit = ps.begin(); pit != ps.end(); ++pit) { kernel::Particle *p = *pit; if (Bonded::get_is_setup(p)) { Bonded b(p); for (unsigned int i = 0; i < b.get_number_of_bonds(); ++i) { kernel::Particle *op = b.get_bonded(i).get_particle(); if (op < p && sps.find(op) != sps.end()) { ret.push_back(b.get_bond(i)); } } } } return ret; }
void GetHeaders(DataPacket &packet) { if(!HeaderPacket.Num()) { IPCSignalledType<spspps_size> spspps((event_prefix + SPSPPS_SIZES).Array()); IPCSignalledArray<mfxU8> sps((event_prefix + SPS_BUFF).Array(), spspps->sps_size), pps((event_prefix + PPS_BUFF).Array(), spspps->pps_size); IPCWaiter spspps_waiter = process_waiter; spspps_waiter.push_back(spspps.signal_); if(!spspps_waiter.wait_for(2, INFINITE)) return; BufferOutputSerializer headerOut(HeaderPacket); headerOut.OutputByte(0x17); headerOut.OutputByte(0); headerOut.OutputByte(0); headerOut.OutputByte(0); headerOut.OutputByte(0); headerOut.OutputByte(1); headerOut.Serialize(sps+5, 3); headerOut.OutputByte(0xff); headerOut.OutputByte(0xe1); headerOut.OutputWord(htons(spspps->sps_size-4)); headerOut.Serialize(sps+4, spspps->sps_size-4); headerOut.OutputByte(1); headerOut.OutputWord(htons(spspps->pps_size-4)); headerOut.Serialize(pps+4, spspps->pps_size-4); } packet.lpPacket = HeaderPacket.Array(); packet.size = HeaderPacket.Num(); }
///Randomly rotate sgrid_m void NonLocalECPComponent::randomize_grid(ParticleSet::ParticlePos_t& sphere, bool randomize) { if(randomize) { //const RealType twopi(6.28318530718); //RealType phi(twopi*Random()),psi(twopi*Random()),cth(Random()-0.5), RealType phi(TWOPI*((*myRNG)())), psi(TWOPI*((*myRNG)())), cth(((*myRNG)())-0.5); RealType sph(std::sin(phi)),cph(std::cos(phi)), sth(std::sqrt(1.0-cth*cth)),sps(std::sin(psi)), cps(std::cos(psi)); TensorType rmat( cph*cth*cps-sph*sps, sph*cth*cps+cph*sps,-sth*cps, -cph*cth*sps-sph*cps,-sph*cth*sps+cph*cps, sth*sps, cph*sth, sph*sth, cth ); SpherGridType::iterator it(sgridxyz_m.begin()); SpherGridType::iterator it_end(sgridxyz_m.end()); SpherGridType::iterator jt(rrotsgrid_m.begin()); int ic=0; while(it != it_end) {*jt = dot(rmat,*it); ++it; ++jt;} //copy the radomized grid to sphere std::copy(rrotsgrid_m.begin(), rrotsgrid_m.end(), sphere.begin()); } else { //copy sphere to the radomized grid std::copy(sphere.begin(), sphere.end(), rrotsgrid_m.begin()); } }
void InteractiveTV::Remote::Input::GestureTrackingRoutine( ) { pxcStatus sts; PXCSmartSPArray sps( 2 ); PXCSmartArray<PXCImage> images; m_remote_input_timer.Reset( ); m_is_running = TRUE; m_is_busy = TRUE; m_is_feed_busy = FALSE; while ( !concurrency::is_current_task_group_canceling( ) && !concurrency::is_task_cancellation_requested( ) && !IsReady( ) ) { _Oasis_air_grabot( this, OasisAirMsg::kInfo, "waiting for device..." ); ::Sleep( 1500 ); } _Oasis_air_grabot( this, OasisAirMsg::kInfo, "device is ready" ); _Oasis_air_grabot( this, OasisAirMsg::kInfo, "on" ); while ( !concurrency::is_current_task_group_canceling( ) && !concurrency::is_task_cancellation_requested( ) ) { if ( m_feed_tgt == FeedTarget::kIdle ) { ::Sleep( 1000 ); } else { if ( (m_feed_tgt & FeedTarget::kGestures) == FeedTarget::kGestures ) { if ( !m_is_feed_busy ) { sts = VideoSampler->SubmitReadTask( images.ReleaseRefs( ), sps.ReleaseRef( 0 ) ); if ( Nena::Video::Utility::Failed( sts ) ) break; sts = GestureTracker.SubmitProcessTask( images, sps.ReleaseRef( 1 ) ); if ( Nena::Video::Utility::Failed( sts ) ) break; sts = sps.SynchronizeEx( ); if ( Nena::Video::Utility::Failed( sts ) ) break; m_is_busy = TRUE; QueryGestureData( &m_remote_input_details, GestureTracker.Base ); m_is_busy = FALSE; } else { _Oasis_air_grabot( this, OasisAirMsg::kWarning, "waiting for feed..." ); } } } m_remote_input_timer.Update( ); } m_is_running = FALSE; _Oasis_air_grabot( this, OasisAirMsg::kInfo, "off" ); }
int binfit_function_dy_y_squarecuts() { gROOT->Reset(); float scaledps,scaledpsy,scalesps,scalenlo,siggg,siggu,sigug; float datamass[81]={0}; int dpsmass[81]={0}; int spsmass[81]={0}; float nlomass[81]={0.0}; int nloggmass[81]={0}; int nlogumass[81]={0}; int nlougmass[81]={0}; float rapmax = 1.9; float ptmin = 8.0; // float datapt[60],datady[20],datay[20]; TChain data("PATEventTree"); TChain dps("PATEventTree"); TChain sps("PATEventTree"); TChain nlogg("PATEventTree"); TChain nlogu("PATEventTree"); TChain nloug("PATEventTree"); data.Add("Selected_events_newAcc.root"); // dps.Add("Modified_Input_To_Fit_2012DPS_TMTight_3MuL3Match.root"); dps.Add("Modified_Input_To_Fit_2012DPS_PUold_TMTight_3MuL3MatchPv.root"); //dps.Add("Modified_Input_To_Fit_2012DPS_GENTupleOnly_TMTight_MuL3Match.root"); sps.Add("Modified_Input_To_Fit_2012SPSLOpy8_TMTight_3MuL3Match.root"); //nlogg.Add("Modified_Input_To_Fit_2012SPSNLOpy8_gg_TMTight_3MuL3Match.root"); nlogg.Add("Modified_Input_To_Fit_2012SPSNLO_gg_TMTight_MuL3Match_PU_OffsetBS.root"); //float massbins[]={6.2,7,8,10,13,17,23,30,42,80}; //float ptbins[]={0,7,12,16,20,25,80}; //float dybins[]={0,0.2,0.4,0.6,0.9,1.3,1.8,2.4,4.5}; ////float ybins[]={-2.2,-1.8,-1.6,-1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.2}; //float ybins[]={0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.2}; //int nmbins = 9; //int nptbins = 6; //int ndybins = 8; //int nybins = 10; float massbins[]={0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80}; float ptbins[]={0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80}; float dybins[]={0,.3,.6,.9,1.2,1.5,1.8,2.1,2.4,2.7,3.0,3.3,3.6}; //float dybins[]={0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6}; float ybins[]={0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2}; int nmbins = 40; int nptbins = 40; int ndybins =12; //int ndybins = 36; int nybins = 22; //int nybins = 20; int mbinerr = -99; int ptbinerr = -99; int dybinerr = -99; int ybinerr = -99; TH1F *mass_data = new TH1F("mass_data","mass_data",nmbins,massbins); TH1F *mass_dps = new TH1F("mass_dps","mass_dps",nmbins,massbins); TH1F *mass_sps = new TH1F("mass_sps","mass_sps",nmbins,massbins); TH1F *mass_nlogg = new TH1F("mass_nlogg","mass_nlogg",nmbins,massbins); TH1F *mass_nlogu = new TH1F("mass_nlogu","mass_nlogu",nmbins,massbins); TH1F *mass_nloug = new TH1F("mass_nloug","mass_nloug",nmbins,massbins); TH1F *mass_nlo = new TH1F("mass_nlo","mass_nlo",nmbins,massbins); TH1F *pt_data = new TH1F("pt_data","pt_data",nptbins,ptbins); TH1F *pt_dps = new TH1F("pt_dps","pt_dps",nptbins,ptbins); TH1F *pt_sps = new TH1F("pt_sps","pt_sps",nptbins,ptbins); TH1F *pt_nlogg = new TH1F("pt_nlogg","pt_nlogg",nptbins,ptbins); TH1F *pt_nlogu = new TH1F("pt_nlogu","pt_nlogu",nptbins,ptbins); TH1F *pt_nloug = new TH1F("pt_nloug","pt_nloug",nptbins,ptbins); TH1F *pt_nlo = new TH1F("pt_nlo","pt_nlo",nptbins,ptbins); TH1F *dy_data = new TH1F("dy_data","dy_data",ndybins,dybins); TH1F *dy_dps = new TH1F("dy_dps","dy_dps",ndybins,dybins); TH1F *dy_sps = new TH1F("dy_sps","dy_sps",ndybins,dybins); TH1F *dy_nlogg = new TH1F("dy_nlogg","dy_nlogg",ndybins,dybins); TH1F *dy_nlogu = new TH1F("dy_nlogu","dy_nlogu",ndybins,dybins); TH1F *dy_nloug = new TH1F("dy_nloug","dy_nloug",ndybins,dybins); TH1F *dy_nlo = new TH1F("dy_nlo","dy_nlo",ndybins,dybins); TH1F *y_data = new TH1F("y_data","y_data",nybins,ybins); TH1F *y_dps = new TH1F("y_dps","y_dps",nybins,ybins); TH1F *y_sps = new TH1F("y_sps","y_sps",nybins,ybins); TH1F *y_nlogg = new TH1F("y_nlogg","y_nlogg",nybins,ybins); TH1F *y_nlogu = new TH1F("y_nlogu","y_nlogu",nybins,ybins); TH1F *y_nloug = new TH1F("y_nloug","y_nloug",nybins,ybins); TH1F *y_nlo = new TH1F("y_nlo","y_nlo",nybins,ybins); data.Draw("FourMu_Mass >> mass_data",Form("FourMu_pT<80&&abs(FourMu_Rapidity)<1.8&&FourMu_Mass<60&&Sum$(Psi_pT>%.1f&&abs(Psi_y)<=%.1f)==2",ptmin,rapmax),"goff"); mass_dps->SetEntries(109951.); // mass_dps->SetEntries(127.); dps.Draw("FourMu_Mass >> mass_dps",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); sps.Draw("FourMu_Mass >> mass_sps",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); nlogg.Draw("FourMu_Mass >> mass_nlogg",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); nlogu.Draw("FourMu_Mass >> mass_nlogu",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); nloug.Draw("FourMu_Mass >> mass_nloug",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); datamass[0]=mass_data->Integral(); std::cout<<datamass[0]<<std::endl; //dps MC reco integral dpsmass[2]=127.; //data reshuffle integral dpsmass[1]=109951./7.14777; dpsmass[0]=mass_dps->Integral(); spsmass[0]=mass_sps->Integral(); nloggmass[0]=mass_nlogg->Integral(); nlogumass[0]=mass_nlogu->Integral(); nlougmass[0]=mass_nlogg->Integral(); //siggg=2.01;siggu=0.45;sigug=0.13; siggg=1.0;siggu=0.0;sigug=0.0; nlomass[0]=siggg*nloggmass[0] + siggu*nlogumass[0] + sigug*nlougmass[0]; scaledps = datamass[0]/ (float) dpsmass[0]; scaledps1 = datamass[0]/ (float) dpsmass[1]; scaledps2 = datamass[0]/ (float) dpsmass[1]; scalesps= datamass[0]/ (float) spsmass[0]; scalenlo= datamass[0]/ (float) nloggmass[0]; float Chi2=0; float minchi2norm=99999999.9; float minchi2=9999999.9; float mina, minb, minc, minan, minbn, mincn; TH1F *DpsBestdy = new TH1F("DpsBestdy","DpsBestdy",ndybins,dybins); TH1F *DpsBesty = new TH1F("DpsBesty","DpsBesty",nybins,ybins); // Chi2 = Chi2 + pow((datamass[1] - (0.00*scaledps*dpsmass[1] + 0.0*scalesps*spsmass[1] + 0.0*scalenlo*nlomass[1])),2)/sqrt(datamass[1]); // std::cout<<"Scale: " <<datamass[0]<<" " << dpsmass[0]<<" "<<scaledps<<" "<<scalesps<<" "<<scalenlo<<" "<<std::endl; for(float a=0.0; a<0.5; a=a+0.01){ for(float b=0.0; b<0.009; b=b+0.01){ for(float c=0.5; c<1; c=c+0.01){ data.Draw("FourMu_Mass >> mass_data",Form("FourMu_pT<80&&abs(FourMu_Rapidity)<1.8&&FourMu_Mass<60&&Sum$(Psi_pT>%.1f&&abs(Psi_y)<=%.1f)==2",ptmin,rapmax),"goff"); dps.Draw("FourMu_Mass >> mass_dps",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); sps.Draw("FourMu_Mass >> mass_sps",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); nlogg.Draw("FourMu_Mass >> mass_nlogg",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); data.Draw("FourMu_pT >> pt_data",Form("FourMu_pT<80&&abs(FourMu_Rapidity)<1.8&&FourMu_Mass<60&&Sum$(Psi_pT>%.1f&&abs(Psi_y)<=%.1f)==2",ptmin,rapmax),"goff"); dps.Draw("FourMu_pT >> pt_dps",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); sps.Draw("FourMu_pT >> pt_sps",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); nlogg.Draw("FourMu_pT >> pt_nlogg",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); data.Draw("Psi1To2_dY >> dy_data",Form("FourMu_pT<80&&abs(FourMu_Rapidity)<1.8&&FourMu_Mass<60&&Sum$(Psi_pT>%.1f&&abs(Psi_y)<=%.1f)==2",ptmin,rapmax),"goff"); dps.Draw("Psi1To2_dY ",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); sps.Draw("Psi1To2_dY >> dy_sps",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); nlogg.Draw("Psi1To2_dY >> dy_nlogg",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); data.Draw("abs(FourMu_Rapidity)>> y_data",Form("FourMu_pT<80&&abs(FourMu_Rapidity)<1.8&&FourMu_Mass<60&&Sum$(Psi_pT>%.1f&&abs(Psi_y)<=%.1f)==2",ptmin,rapmax),"goff"); dps.Draw("abs(FourMu_Rapidity)",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); sps.Draw("abs(FourMu_Rapidity) >> y_sps",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); nlogg.Draw("abs(FourMu_Rapidity) >> y_nlogg",Form("FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4",rapmax,ptmin),"goff"); for(int mbin=1; mbin<=nmbins; ++mbin){ if (mass_data->GetBinContent(mbin) == 0){ //mbinerr = 1.; continue; } else{mbinerr = sqrt(abs(mass_data->GetBinContent(mbin)));} // Chi2=Chi2 + pow((mass_data->GetBinContent(mbin) - (a*scaledps*mass_dps->GetBinContent(mbin) + b*scalesps*mass_sps->GetBinContent(mbin) + c*scalenlo*mass_nlogg->GetBinContent(mbin))),2)/mbinerr; // Chi2=Chi2 + pow((mass_data->GetBinContent(mbin) - (a*scaledps*mass_dps->GetBinContent(mbin) + b*scalesps*mass_sps->GetBinContent(mbin) + c*scalenlo*mass_nlogg->GetBinContent(mbin)))/sqrt(abs(mass_data->GetBinContent(mbin))),2); // std::cout<<Chi2<<std::endl; } for(int ptbin=1; ptbin<=nptbins; ++ptbin){ if (pt_data->GetBinContent(ptbin) == 0){ ptbinerr = 1.; } else{ptbinerr = sqrt(abs(pt_data->GetBinContent(ptbin)));} Chi2=Chi2 + pow((pt_data->GetBinContent(ptbin) - (a*scaledps*pt_dps->GetBinContent(ptbin) + b*scalesps*pt_sps->GetBinContent(ptbin) + c*scalenlo*pt_nlogg->GetBinContent(ptbin)))/ptbinerr,2); // std::cout<<pt_data->GetBinContent(ptbin)<<std::endl; } for(int dybin=1; dybin<=ndybins; ++dybin){ if (dy_data->GetBinContent(dybin) == 0){ dybinerr = 1.; } else{dybinerr = sqrt(abs(dy_data->GetBinContent(dybin)));} float avgval = (dpsget(dybins[dybin])+dpsget(dybins[dybin-1]))/2.; dy_dps->SetBinContent(dybin,avgval); if(avgval>=0){ DpsBestdy->SetBinContent(dybin,avgval); } Chi2=Chi2 + pow((dy_data->GetBinContent(dybin) - (a*scaledps1*dy_dps->GetBinContent(dybin) + b*scalesps*dy_sps->GetBinContent(dybin) + c*scalenlo*dy_nlogg->GetBinContent(dybin)))/dybinerr,2); // std::cout<<Chi2<<std::endl; } for(int ybin=1; ybin<=nybins; ++ybin){ if (y_data->GetBinContent(ybin) == 0){ ybinerr = 1.; } else{ybinerr = sqrt(abs(y_data->GetBinContent(ybin)));} float avgval = (dpsgety(ybins[ybin])+dpsgety(ybins[ybin-1]))/2.; y_dps->SetBinContent(ybin,avgval); if(avgval>=0){ DpsBesty->SetBinContent(ybin,avgval); } Chi2=Chi2 + pow((y_data->GetBinContent(ybin) - (a*scaledps2*y_dps->GetBinContent(ybin) + b*scalesps*y_sps->GetBinContent(ybin) + c*scalenlo*y_nlogg->GetBinContent(ybin)))/ybinerr,2); // std::cout<<Chi2<<std::endl; } // std::cout<<"a, b, c: "<<a<<" "<<b<<" "<<c<<" Chi2: "<<Chi2<<std::endl; if (Chi2<=minchi2norm){ if ( abs(1. - abs(a+b+c))<0.001){ minchi2norm=Chi2; minan = a; minbn = b; mincn = c; std::cout<<a<<" "<<b<<" "<<c<<" "<<Chi2<<std::endl; } } if (Chi2<=minchi2){ minchi2=Chi2; mina = a; minb = b; minc = c; } // std::cout<<a<<" "<<b<<" "<<c<<" "<<Chi2<<std::endl; Chi2=0; } } } std::cout<<"Min Chi2: "<<minchi2<<" dps, sps, nlo: "<<mina<<" "<<minb<<" "<<minc<<std::endl; std::cout<<"Min normed Chi2: "<<minchi2norm<<" dps, sps, nlo: "<<minan<<" "<<minbn<<" "<<mincn<<std::endl; TCanvas* disp = new TCanvas("disp","disp",900,900); disp->Divide(2,2); TH1F *MassSum = new TH1F("MassSum","MassSum",nmbins,massbins); TH1F *MassBest = new TH1F("MassBest","MassBest",nmbins,massbins); TH1F *DpsBestM = new TH1F("DpsBestM","DpsBestM",nmbins,massbins); TH1F *SpsBestM = new TH1F("SpsBestM","SpsBestM",nmbins,massbins); TH1F *NloBestM = new TH1F("NloBestM","NloBestM",nmbins,massbins); TH1F *pTBest = new TH1F("pTBest","pTBest",nptbins,ptbins); TH1F *pTSum = new TH1F("pTSum","pTSum",nptbins,ptbins); TH1F *DpsBestpt = new TH1F("DpsBestpt","DpsBestpt",nptbins,ptbins); TH1F *SpsBestpt = new TH1F("SpsBestpt","SpsBestpt",nptbins,ptbins); TH1F *NloBestpt = new TH1F("NloBestpt","NloBestpt",nptbins,ptbins); TH1F *dyBest = new TH1F("dyBest","dyBest",ndybins,dybins); TH1F *dySum = new TH1F("dySum","dySum",ndybins,dybins); TH1F *SpsBestdy = new TH1F("SpsBestdy","SpsBestdy",ndybins,dybins); TH1F *NloBestdy = new TH1F("NloBestdy","NloBestdy",ndybins,dybins); TH1F *yBest = new TH1F("yBest","yBest",nybins,ybins); TH1F *ySum = new TH1F("ySum","ySum",nybins,ybins); TH1F *SpsBesty = new TH1F("SpsBesty","SpsBesty",nybins,ybins); TH1F *NloBesty = new TH1F("NloBesty","NloBesty",nybins,ybins); MassBest->SetMinimum(0);pTBest->SetMinimum(0);dyBest->SetMinimum(0);yBest->SetMinimum(0); dps.Draw("FourMu_Mass>>DpsBestM",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); sps.Draw("FourMu_Mass>>SpsBestM",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); nlogg.Draw("FourMu_Mass>>NloBestM",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); dps.Draw("FourMu_pT>>DpsBestpt",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); sps.Draw("FourMu_pT>>SpsBestpt",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); nlogg.Draw("FourMu_pT>>NloBestpt",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); // dps.Draw("Psi1To2_dY>>DpsBestdy",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); sps.Draw("Psi1To2_dY>>SpsBestdy",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); nlogg.Draw("Psi1To2_dY>>NloBestdy",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); // dps.Draw("abs(FourMu_Rapidity)>>DpsBesty",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); sps.Draw("abs(FourMu_Rapidity)>>SpsBesty",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); nlogg.Draw("abs(FourMu_Rapidity)>>NloBesty",Form("(FourMu_Mass>=0&&FourMu_Mass<=60&&FourMu_VtxProb>=0.1&&Sum$(abs(Psi_y)<=%.1f&&Psi_pT>%.1f)==2&&Sum$(abs(Mu_Eta)<=1.2&&Mu_pT>3.5||abs(Mu_Eta)>1.2&&abs(Mu_Eta)<1.6&&(Mu_pT>-3.75*abs(Mu_Eta)+8)||abs(Mu_Eta)>=1.6&&abs(Mu_Eta)<=2.0&&Mu_pT>2.0)==4)",rapmax,ptmin),"goff"); //MassSum->Add(DpsBest,(float) mina); //MassSum->Add(SpsBest,minb); //MassSum->Add(NloBest,minc); MassBest->SetMinimum(0); disp->cd(1); DpsBestM->SetLineColor(kRed); SpsBestM->SetLineColor(kBlue); NloBestM->SetLineColor(kGreen); DpsBestM->Scale(minan*scaledps); SpsBestM->Scale(minbn*scalesps); NloBestM->Scale(mincn*scalenlo); MassSum->Add(DpsBestM); MassSum->Add(SpsBestM); MassSum->Add(NloBestM); data.Draw("FourMu_Mass >> MassBest",Form("FourMu_pT<80&&abs(FourMu_Rapidity)<1.8&&FourMu_Mass<60&&Sum$(Psi_pT>%.1f&&abs(Psi_y)<=%.1f)==2",ptmin,rapmax),"e"); MassSum->Draw("same"); DpsBestM->Draw("same"); SpsBestM->Draw("same"); NloBestM->Draw("same"); disp->cd(2); DpsBestpt->SetLineColor(kRed); SpsBestpt->SetLineColor(kBlue); NloBestpt->SetLineColor(kGreen); DpsBestpt->Scale(minan*scaledps); SpsBestpt->Scale(minbn*scalesps); NloBestpt->Scale(mincn*scalenlo); pTSum->Add(DpsBestpt); pTSum->Add(SpsBestpt); pTSum->Add(NloBestpt); data.Draw("FourMu_pT >> pTBest",Form("FourMu_pT<80&&abs(FourMu_Rapidity)<1.8&&FourMu_Mass<60&&Sum$(Psi_pT>%.1f&&abs(Psi_y)<=%.1f)==2",ptmin,rapmax),"e"); pTSum->Draw("same"); DpsBestpt->Draw("same"); SpsBestpt->Draw("same"); NloBestpt->Draw("same"); disp->cd(3); DpsBestdy->SetLineColor(kRed); SpsBestdy->SetLineColor(kBlue); NloBestdy->SetLineColor(kGreen); DpsBestdy->Scale(minan*scaledps1); SpsBestdy->Scale(minbn*scalesps); NloBestdy->Scale(mincn*scalenlo); dySum->Add(DpsBestdy); dySum->Add(SpsBestdy); dySum->Add(NloBestdy); data.Draw("Psi1To2_dY >> dyBest",Form("FourMu_pT<80&&abs(FourMu_Rapidity)<1.8&&FourMu_Mass<60&&Sum$(Psi_pT>%0.1f&&abs(Psi_y)<=%0.1f)==2",ptmin,rapmax),"e"); dySum->Draw("same"); DpsBestdy->Draw("same"); SpsBestdy->Draw("same"); NloBestdy->Draw("same"); disp->cd(4); DpsBesty->SetLineColor(kRed); SpsBesty->SetLineColor(kBlue); NloBesty->SetLineColor(kGreen); DpsBesty->Scale(minan*scaledps2); SpsBesty->Scale(minbn*scalesps); NloBesty->Scale(mincn*scalenlo); ySum->Add(DpsBesty); ySum->Add(SpsBesty); ySum->Add(NloBesty); data.Draw("abs(FourMu_Rapidity)>> yBest",Form("FourMu_pT<80&&abs(FourMu_Rapidity)<1.8&&FourMu_Mass<60&&Sum$(Psi_pT>%0.1f&&abs(Psi_y)<=%.1f)==2",ptmin,rapmax),"e"); ySum->Draw("same"); DpsBesty->Draw("same"); SpsBesty->Draw("same"); NloBesty->Draw("same"); }
int Xsec_calcTtreeFewerbins_Jan2017SavedXSEC() { gROOT->Reset(); float scaledps,scalesps,scalenlo,siggg,siggu,sigug; // float datapt[60],datady[20],datay[20]; TChain data("ntuple"); TChain dps("PATEventTree"); TChain sps("PATEventTree"); TChain nlogg("PATEventTree"); TChain nlogu("PATEventTree"); TChain nloug("PATEventTree"); float massbins[]={6.2,7,9,11,14,18,25,30,45,80}; float massbins2[]={0,6.2,7,9,11,14,18,25,30,45,80}; float ptbins[]={0,7,12,16,20,25,80}; float dybins[]={0,0.2,0.4,0.6,0.9,1.3,1.8,2.4,4.5}; //float ybins[]={-2.2,-1.8,-1.6,-1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.2}; float ybins[]={0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.2}; int nmbins = 9; int nmbins2 = 10; int nptbins = 6; int ndybins = 8; int nybins = 10; // float massbins[]={6.2,6.5,7,8.5,11,14,18,24,30,45,80}; // float massbins2[]={0,6.2,6.5,7,8.5,11,14,18,24,30,45,80}; // float ptbins[]={0,4,8,12,15,18,22,26,30,80}; // float dybins[]={0,0.1,0.2,0.3,0.45,0.6,0.9,1.3,1.8,2.4,4.5}; //// float ybins[]={-2.2,-1.8,-1.6,-1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.2}; // float ybins[]={0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.2}; // int nmbins = 10; // int nmbins2 = 10; // int nptbins = 9; // int ndybins = 10; // int nybins = 10; float fracDPS = 0.3; float fracNLO = 0.7; float corrPop = 0; float corrPoppt = 0; float corrPopdy = 0; float corrPopy = 0; float xsec_sum_mass = 0; float xsec_sum_dy= 0; float xsec_sum_y= 0; float xsec_sum_pt = 0; TH1F *mass_data = new TH1F("mass_data","mass_data",nmbins,massbins); TH1F *pt_data = new TH1F("pt_data","pt_data",nptbins,ptbins); TH1F *dy_data = new TH1F("dy_data","dy_data",ndybins,dybins); TH1F *y_data = new TH1F("y_data","y_data",nybins,ybins); TH1F *xsec_mass = new TH1F("xsec_mass","xsec_mass",nmbins2,massbins2); TH1F *xsec_pt = new TH1F("xsec_pt","xsec_pt",nptbins,ptbins); TH1F *xsec_dy = new TH1F("xsec_dy","xsec_dy",ndybins,dybins); TH1F *xsec_y = new TH1F("xsec_y","xsec_y",nybins,ybins); mass_data->Sumw2(); pt_data->Sumw2(); dy_data->Sumw2(); y_data->Sumw2(); xsec_mass->Sumw2(); xsec_pt->Sumw2(); xsec_dy->Sumw2(); xsec_y->Sumw2(); xsec_pt->SetMinimum(0); xsec_dy->SetMinimum(0); xsec_y->SetMinimum(0); data.Add("TMTight_Selected.root"); //data.Draw("FourMu_Mass>>mass_data","","egoff"); //data.Draw("FourMu_pT>>pt_data","","egoff"); //data.Draw("Psi1To2_dY>>dy_data","","egoff"); //data.Draw("abs(FourMu_Rapidity)>>y_data","","egoff"); mass_data->SetBinContent(1,123.); mass_data->SetBinContent(2,141.); mass_data->SetBinContent(3,82.); mass_data->SetBinContent(4,91.); mass_data->SetBinContent(5,78.); mass_data->SetBinContent(6,87.); mass_data->SetBinContent(7,63.); mass_data->SetBinContent(8,79.); mass_data->SetBinContent(9,55.); pt_data->SetBinContent(1,144.); pt_data->SetBinContent(2,106.); pt_data->SetBinContent(3,111.); pt_data->SetBinContent(4,123.); pt_data->SetBinContent(5,140.); pt_data->SetBinContent(6,171.); dy_data->SetBinContent(1,268.); dy_data->SetBinContent(2,157.); dy_data->SetBinContent(3,79.); dy_data->SetBinContent(4,66.); dy_data->SetBinContent(5,58.); dy_data->SetBinContent(6,46.); dy_data->SetBinContent(7,48.); dy_data->SetBinContent(8,74.); y_data->SetBinContent(1,67.); y_data->SetBinContent(2,78.); y_data->SetBinContent(3,63.); y_data->SetBinContent(4,78.); y_data->SetBinContent(5,67.); y_data->SetBinContent(6,65.); y_data->SetBinContent(7,87.); y_data->SetBinContent(8,105.); y_data->SetBinContent(9,98.); y_data->SetBinContent(10,78.); //corrections from DPS PU TH1D *acc_eff_shape_dps = new TH1D("acc_eff_shape_dps","acc_eff_shape_dps",nmbins, massbins); acc_eff_shape_dps->SetBinContent(1,0.004512168); acc_eff_shape_dps->SetBinContent(2,0.005237332); acc_eff_shape_dps->SetBinContent(3,0.004232796); acc_eff_shape_dps->SetBinContent(4,0.006519035); acc_eff_shape_dps->SetBinContent(5,0.01182224); acc_eff_shape_dps->SetBinContent(6,0.01551388); acc_eff_shape_dps->SetBinContent(7,0.01087612); acc_eff_shape_dps->SetBinContent(8,0.006657566); acc_eff_shape_dps->SetBinContent(9,0.01604464); acc_eff_shape_dps->SetBinError(1,0.001010145); acc_eff_shape_dps->SetBinError(2,0.0007732624); acc_eff_shape_dps->SetBinError(3,0.0006617851); acc_eff_shape_dps->SetBinError(4,0.0007255745); acc_eff_shape_dps->SetBinError(5,0.001216691); acc_eff_shape_dps->SetBinError(6,0.001440083); acc_eff_shape_dps->SetBinError(7,0.001342571); acc_eff_shape_dps->SetBinError(8,0.0004800581); acc_eff_shape_dps->SetBinError(9,0.001441102); TH1D *acc_eff_shape_dps_pt = new TH1D("acc_eff_shape_dps_pt","acc_eff_shape_dps_pt",nptbins, ptbins); acc_eff_shape_dps_pt->SetBinContent(1,0.00547208); acc_eff_shape_dps_pt->SetBinContent(2,0.005942975); acc_eff_shape_dps_pt->SetBinContent(3,0.01422075); acc_eff_shape_dps_pt->SetBinContent(4,0.02905163); acc_eff_shape_dps_pt->SetBinContent(5,0.0450849); acc_eff_shape_dps_pt->SetBinContent(6,0.03631651); acc_eff_shape_dps_pt->SetBinError(1,0.0003975557); acc_eff_shape_dps_pt->SetBinError(2,0.0003866389); acc_eff_shape_dps_pt->SetBinError(3,0.0009944951); acc_eff_shape_dps_pt->SetBinError(4,0.002856667); acc_eff_shape_dps_pt->SetBinError(5,0.007399703); acc_eff_shape_dps_pt->SetBinError(6,0.01296153); TH1D *acc_eff_shape_dps_dy = new TH1D("acc_eff_shape_dps_dy","acc_eff_shape_dps_dy",ndybins, dybins); acc_eff_shape_dps_dy->SetBinContent(1,0.005870714); acc_eff_shape_dps_dy->SetBinContent(2,0.007500112); acc_eff_shape_dps_dy->SetBinContent(3,0.007700724); acc_eff_shape_dps_dy->SetBinContent(4,0.01043607); acc_eff_shape_dps_dy->SetBinContent(5,0.01419795); acc_eff_shape_dps_dy->SetBinContent(6,0.0144408); acc_eff_shape_dps_dy->SetBinContent(7,0.01547821); acc_eff_shape_dps_dy->SetBinContent(8,0.007100947); acc_eff_shape_dps_dy->SetBinError(1,0.0006340292); acc_eff_shape_dps_dy->SetBinError(2,0.0008150998); acc_eff_shape_dps_dy->SetBinError(3,0.001031129); acc_eff_shape_dps_dy->SetBinError(4,0.001362374); acc_eff_shape_dps_dy->SetBinError(5,0.001855286); acc_eff_shape_dps_dy->SetBinError(6,0.001770893); acc_eff_shape_dps_dy->SetBinError(7,0.001705836); acc_eff_shape_dps_dy->SetBinError(8,0.0004184799); TH1D *acc_eff_shape_dps_y = new TH1D("acc_eff_shape_dps_y","acc_eff_shape_dps_y",nybins, ybins); acc_eff_shape_dps_y->SetBinContent(1,0.006797462); acc_eff_shape_dps_y->SetBinContent(2,0.008447607); acc_eff_shape_dps_y->SetBinContent(3,0.01434022); acc_eff_shape_dps_y->SetBinContent(4,0.01521911); acc_eff_shape_dps_y->SetBinContent(5,0.01412309); acc_eff_shape_dps_y->SetBinContent(6,0.01530765); acc_eff_shape_dps_y->SetBinContent(7,0.01599881); acc_eff_shape_dps_y->SetBinContent(8,0.008404481); acc_eff_shape_dps_y->SetBinContent(9,0.005915134); acc_eff_shape_dps_y->SetBinContent(10,0.005450354); acc_eff_shape_dps_y->SetBinError(1,0.000494813); acc_eff_shape_dps_y->SetBinError(2,0.0008358758); acc_eff_shape_dps_y->SetBinError(3,0.001751432); acc_eff_shape_dps_y->SetBinError(4,0.002086759); acc_eff_shape_dps_y->SetBinError(5,0.002096988); acc_eff_shape_dps_y->SetBinError(6,0.002249875); acc_eff_shape_dps_y->SetBinError(7,0.002117485); acc_eff_shape_dps_y->SetBinError(8,0.001127806); acc_eff_shape_dps_y->SetBinError(9,0.0007090816); acc_eff_shape_dps_y->SetBinError(10,0.0005697851); TH1D *acc_eff_shape_nlo = new TH1D("acc_eff_shape_nlo","acc_eff_shape_nlo",nmbins, massbins); acc_eff_shape_nlo->SetBinContent(0,0.01846972); acc_eff_shape_nlo->SetBinContent(1,0.02142697); acc_eff_shape_nlo->SetBinContent(2,0.02221486); acc_eff_shape_nlo->SetBinContent(3,0.02262098); acc_eff_shape_nlo->SetBinContent(4,0.01853098); acc_eff_shape_nlo->SetBinContent(5,0.02843624); acc_eff_shape_nlo->SetBinContent(6,0.04699465); acc_eff_shape_nlo->SetBinContent(7,0.06688011); acc_eff_shape_nlo->SetBinContent(8,0.1080789); acc_eff_shape_nlo->SetBinContent(9,0.09860529); acc_eff_shape_nlo->SetBinError(0,0.002909392); acc_eff_shape_nlo->SetBinError(1,0.001357906); acc_eff_shape_nlo->SetBinError(2,0.001055741); acc_eff_shape_nlo->SetBinError(3,0.001298359); acc_eff_shape_nlo->SetBinError(4,0.001058198); acc_eff_shape_nlo->SetBinError(5,0.001610718); acc_eff_shape_nlo->SetBinError(6,0.002596644); acc_eff_shape_nlo->SetBinError(7,0.007227739); acc_eff_shape_nlo->SetBinError(8,0.01309785); acc_eff_shape_nlo->SetBinError(9,0.046094); TH1D *acc_eff_shape_nlo_pt = new TH1D("acc_eff_shape_nlo_pt","acc_eff_shape_nlo_pt",nptbins, ptbins); acc_eff_shape_nlo_pt->SetBinContent(1,0.01642734); acc_eff_shape_nlo_pt->SetBinContent(2,0.01386493); acc_eff_shape_nlo_pt->SetBinContent(3,0.01767661); acc_eff_shape_nlo_pt->SetBinContent(4,0.02705417); acc_eff_shape_nlo_pt->SetBinContent(5,0.05204162); acc_eff_shape_nlo_pt->SetBinContent(6,0.09543021); acc_eff_shape_nlo_pt->SetBinError(1,0.0009637853); acc_eff_shape_nlo_pt->SetBinError(2,0.0008030143); acc_eff_shape_nlo_pt->SetBinError(3,0.0009694275); acc_eff_shape_nlo_pt->SetBinError(4,0.001426161); acc_eff_shape_nlo_pt->SetBinError(5,0.002597588); acc_eff_shape_nlo_pt->SetBinError(6,0.004561025); TH1D *acc_eff_shape_nlo_dy = new TH1D("acc_eff_shape_nlo_dy","acc_eff_shape_nlo_dy",ndybins, dybins); acc_eff_shape_nlo_dy->SetBinContent(1,0.02650818); acc_eff_shape_nlo_dy->SetBinContent(2,0.0255388); acc_eff_shape_nlo_dy->SetBinContent(3,0.02563938); acc_eff_shape_nlo_dy->SetBinContent(4,0.02482702); acc_eff_shape_nlo_dy->SetBinContent(5,0.02566114); acc_eff_shape_nlo_dy->SetBinContent(6,0.02265824); acc_eff_shape_nlo_dy->SetBinContent(7,0.01357843); acc_eff_shape_nlo_dy->SetBinContent(8,0.02730608); acc_eff_shape_nlo_dy->SetBinError(1,0.0009077435); acc_eff_shape_nlo_dy->SetBinError(2,0.001072157); acc_eff_shape_nlo_dy->SetBinError(3,0.001377081); acc_eff_shape_nlo_dy->SetBinError(4,0.001666925); acc_eff_shape_nlo_dy->SetBinError(5,0.002453789); acc_eff_shape_nlo_dy->SetBinError(6,0.003491914); acc_eff_shape_nlo_dy->SetBinError(7,0.005164781); acc_eff_shape_nlo_dy->SetBinError(8,0.01596601); TH1D *acc_eff_shape_nlo_y = new TH1D("acc_eff_shape_nlo_y","acc_eff_shape_nlo_y",nybins, ybins); acc_eff_shape_nlo_y->SetBinContent(1,0.03577394); acc_eff_shape_nlo_y->SetBinContent(2,0.03567842); acc_eff_shape_nlo_y->SetBinContent(3,0.04134786); acc_eff_shape_nlo_y->SetBinContent(4,0.03799442); acc_eff_shape_nlo_y->SetBinContent(5,0.04216027); acc_eff_shape_nlo_y->SetBinContent(6,0.03112481); acc_eff_shape_nlo_y->SetBinContent(7,0.03069787); acc_eff_shape_nlo_y->SetBinContent(8,0.02323072); acc_eff_shape_nlo_y->SetBinContent(9,0.02243196); acc_eff_shape_nlo_y->SetBinContent(10,0.01597226); acc_eff_shape_nlo_y->SetBinError(1,0.003503381); acc_eff_shape_nlo_y->SetBinError(2,0.003430908); acc_eff_shape_nlo_y->SetBinError(3,0.003631484); acc_eff_shape_nlo_y->SetBinError(4,0.003283295); acc_eff_shape_nlo_y->SetBinError(5,0.003130688); acc_eff_shape_nlo_y->SetBinError(6,0.002317426); acc_eff_shape_nlo_y->SetBinError(7,0.00187935); acc_eff_shape_nlo_y->SetBinError(8,0.001321922); acc_eff_shape_nlo_y->SetBinError(9,0.001154492); acc_eff_shape_nlo_y->SetBinError(10,0.0008532619); for(int mbin=1; mbin<=nmbins; ++mbin){ corrPop = mass_data->GetBinContent(mbin)/(0.0593*0.0593*20.339*((fracDPS*acc_eff_shape_dps->GetBinContent(mbin))+(fracNLO*acc_eff_shape_nlo->GetBinContent(mbin)))*(massbins[mbin]-massbins[mbin-1])); xsec_mass->SetBinContent(mbin+1,corrPop*1e-6); xsec_sum_mass = xsec_sum_mass+(corrPop*1e-6*(massbins[mbin]-massbins[mbin-1])); xsec_mass->SetBinError(mbin+1, xsec_mass->GetBinContent(mbin)/sqrt(mass_data->GetBinContent(mbin))); } for(int ptbin=1; ptbin<=nptbins; ++ptbin){ corrPoppt = pt_data->GetBinContent(ptbin)/(pow(0.0593,2)*20.339*(fracDPS*acc_eff_shape_dps_pt->GetBinContent(ptbin)+fracNLO*acc_eff_shape_nlo_pt->GetBinContent(ptbin))*(ptbins[ptbin]-ptbins[ptbin-1])); // std::cout<<pt_data->GetBinContent(ptbin)<<" over "<<0.0593*0.0593*20.339<<" times "<<((fracDPS*acc_eff_shape_dps_pt->GetBinContent(ptbin))+(fracNLO*acc_eff_shape_nlo_pt->GetBinContent(ptbin)))<<" times "<<(ptbins[ptbin]-ptbins[ptbin-1])<<" equals??? "<<corrPoppt<<std::endl; xsec_pt->SetBinContent(ptbin,corrPoppt*1e-6); xsec_sum_pt = xsec_sum_pt+(corrPoppt*1e-6*(ptbins[ptbin]-ptbins[ptbin-1])); xsec_pt->SetBinError(ptbin, xsec_pt->GetBinContent(ptbin)/sqrt(pt_data->GetBinContent(ptbin))); } for(int dybin=1; dybin<=ndybins; ++dybin){ corrPopdy = dy_data->GetBinContent(dybin)/(pow(0.0593,2)*20.339*(fracDPS*acc_eff_shape_dps_dy->GetBinContent(dybin)+fracNLO*acc_eff_shape_nlo_dy->GetBinContent(dybin))*(dybins[dybin]-dybins[dybin-1])); // std::cout<<dy_data->GetBinContent(dybin)<<" over "<<0.0593*0.0593*20.339<<" times "<<((fracDPS*acc_eff_shape_dps_dy->GetBinContent(dybin))+(fracNLO*acc_eff_shape_nlo_dy->GetBinContent(dybin)))<<" times "<<(dybins[dybin]-dybins[dybin-1])<<" equals??? "<<corrPopdy<<std::endl; xsec_dy->SetBinContent(dybin,corrPopdy*1e-6); xsec_sum_dy = xsec_sum_dy+(corrPopdy*1e-6*(dybins[dybin]-dybins[dybin-1])); xsec_dy->SetBinError(dybin, xsec_dy->GetBinContent(dybin)/sqrt(dy_data->GetBinContent(dybin))); } for(int ybin=1; ybin<=nybins; ++ybin){ corrPopy = y_data->GetBinContent(ybin)/(pow(0.0593,2)*20.339*(fracDPS*acc_eff_shape_dps_y->GetBinContent(ybin)+fracNLO*acc_eff_shape_nlo_y->GetBinContent(ybin))*(ybins[ybin]-ybins[ybin-1])); // std::cout<<dy_data->GetBinContent(dybin)<<" over "<<0.0593*0.0593*20.339<<" times "<<((fracDPS*acc_eff_shape_dps_dy->GetBinContent(dybin))+(fracNLO*acc_eff_shape_nlo_dy->GetBinContent(dybin)))<<" times "<<(dybins[dybin]-dybins[dybin-1])<<" equals??? "<<corrPopdy<<std::endl; xsec_y->SetBinContent(ybin,corrPopy*1e-6); xsec_sum_y = xsec_sum_y+(corrPopy*1e-6*(ybins[ybin]-ybins[ybin-1])); xsec_y->SetBinError(ybin, xsec_y->GetBinContent(ybin)/sqrt(y_data->GetBinContent(ybin))); } std::cout<<"Mass Integral: "<<xsec_sum_mass<<std::endl; std::cout<<"pT Integral: "<<xsec_sum_pt<<std::endl; std::cout<<"dY Integral: "<<xsec_sum_dy<<std::endl; std::cout<<"Y Integral: "<<xsec_sum_y<<std::endl; TCanvas* disp = new TCanvas("disp","disp",900,900); disp->Divide(2,2); disp->cd(1); xsec_mass->SetXTitle("M_{J/#psi J/#psi} (GeV/c^{2})"); xsec_mass->SetYTitle("d#sigma/dM_{J/#psi J/#psi} (nb/(GeV/c^{2}))"); xsec_mass->Draw("e1"); disp->cd(2); xsec_pt->SetXTitle("p_{T}^{J/#psi J/#psi} (GeV/c)"); xsec_pt->SetYTitle("d#sigma/dp_{T}^{J/#psi J/#psi} (nb/(GeV/c))"); xsec_pt->Draw("e1"); disp->cd(3); xsec_dy->SetXTitle("|#Delta y| between J/#psi"); xsec_dy->SetYTitle("d#sigma/d|#Delta y| (nb)"); xsec_dy->Draw("e1"); disp->cd(4); xsec_y->SetXTitle("|Rapidity|_{J/#psi J/#psi}"); xsec_y->SetYTitle("d#sigma/d|y| (nb)"); xsec_y->Draw("e1"); // dy_data.Draw("e"); }
int binfit_ttree_genlvl_atlas() { gROOT->Reset(); gErrorIgnoreLevel=kError; float scaledps,scalesps,scalenlo,siggg,siggu,sigug; float datamass[81]={0}; int dpsmass[81]={0}; int spsmass[81]={0}; float nlomass[81]={0.0}; int nloggmass[81]={0}; int nlogumass[81]={0}; int nlougmass[81]={0}; // float datapt[60],datady[20],datay[20]; TChain dps("Events"); TChain nlogg("Events"); TChain sps("Events"); // dps.Add("Modified_Input_To_Fit_2012DPS_TMTight_3MuL3Match.root"); dps.Add("genevents/GENEventTree_dps_pu_old_1.root"); dps.Add("genevents/GENEventTree_dps_pu_old_2.root"); dps.Add("genevents/GENEventTree_dps_pu_old_3.root"); nlogg.Add("genevents/GENEventTree_pythia8_PU_OffsetBS_fixp3_1.root"); nlogg.Add("genevents/GENEventTree_pythia8_PU_OffsetBS_fixp3_2.root"); nlogg.Add("genevents/GENEventTree_pythia8_PU_OffsetBS_fixp3_3.root"); nlogg.Add("genevents/GENEventTree_pythia8_PU_OffsetBS_fixp3_4.root"); nlogg.Add("genevents/GENEventTree_pythia8_PU_OffsetBS_fixp3_5.root"); nlogg.Add("genevents/GENEventTree_pythia8_PU_OffsetBS_fixp3_6_1.root "); nlogg.Add("genevents/GENEventTree_pythia8_PU_OffsetBS_fixp3_6_2.root "); sps.Add("genevents/GENEventTree_SPSLO_xl21_1.root"); sps.Add("genevents/GENEventTree_SPSLO_xl21_2.root"); sps.Add("genevents/GENEventTree_SPSLO_xl22_1.root"); sps.Add("genevents/GENEventTree_SPSLO_xl22_2.root"); sps.Add("genevents/GENEventTree_SPSLO_xl23_1.root"); sps.Add("genevents/GENEventTree_SPSLO_xl23_2.root"); sps.Add("genevents/GENEventTree_SPSLO_xl26_1.root"); sps.Add("genevents/GENEventTree_SPSLO_xl26_2.root"); sps.Add("genevents/GENEventTree_SPSLO_xl27_1.root"); sps.Add("genevents/GENEventTree_SPSLO_xl27_2.root"); sps.Add("genevents/GENEventTree_SPSLO_xl28_1.root"); sps.Add("genevents/GENEventTree_SPSLO_xl28_2.root"); float massbins[]={6.2,7,9,11,14,18,25,30,60}; //float ptbins[]={0.,7,12,16,20,25,50,80}; float ptbins[]={0.,2.5,5.,7.5,10.,12.5,15.,17.5,20.,22.5,25.,27.5,30.,35.,40.,45.,50.,55.,60.,65.,70.}; float dybins[]={0.,0.2,0.4,0.6,0.9,1.3,1.8,2.4,4.5}; //float ybins[]={-2.2,-1.8,-1.6,-1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.2}; float ybins[]={0.,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8}; int nmbins = 8; int nptbins = 20; int ndybins = 8; int nybins = 9; //float massbins[]={0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60}; //float ptbins[]={0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80}; //float dybins[]={0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,4.4,4.5}; //float ybins[]={0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8}; // int nmbins = 30; // int nptbins = 40; // int ndybins = 45; // int nybins = 18; //int nybins = 20; int mbinerr = -99; int ptbinerr = -99; int dybinerr = -99; int ybinerr = -99; TH1F *mass_data = new TH1F("mass_data","mass_data",nmbins,massbins); TH1F *mass_dps = new TH1F("mass_dps","mass_dps",nmbins,massbins); TH1F *mass_nlogg = new TH1F("mass_nlogg","mass_nlogg",nmbins,massbins); TH1F *mass_nlo = new TH1F("mass_nlo","mass_nlo",nmbins,massbins); TH1F *mass_sps = new TH1F("mass_sps","mass_sps",nmbins,massbins); TH1F *mass_width = new TH1F("mass_width","mass_width",nmbins,massbins); TH1F *pt_data = new TH1F("pt_data","pt_data",nptbins,ptbins); TH1F *pt_dps = new TH1F("pt_dps","pt_dps",nptbins,ptbins); TH1F *pt_nlogg = new TH1F("pt_nlogg","pt_nlogg",nptbins,ptbins); TH1F *pt_nlo = new TH1F("pt_nlo","pt_nlo",nptbins,ptbins); TH1F *pt_sps = new TH1F("pt_sps","pt_sps",nptbins,ptbins); TH1F *pt_width = new TH1F("pt_width","pt_width",nptbins,ptbins); TH1F *dy_data = new TH1F("dy_data","dy_data",ndybins,dybins); TH1F *dy_dps = new TH1F("dy_dps","dy_dps",ndybins,dybins); TH1F *dy_nlogg = new TH1F("dy_nlogg","dy_nlogg",ndybins,dybins); TH1F *dy_nlo = new TH1F("dy_nlo","dy_nlo",ndybins,dybins); TH1F *dy_sps = new TH1F("dy_sps","dy_sps",ndybins,dybins); TH1F *dy_width = new TH1F("dy_width","dy_width",ndybins,dybins); TH1F *y_data = new TH1F("y_data","y_data",nybins,ybins); TH1F *y_dps = new TH1F("y_dps","y_dps",nybins,ybins); TH1F *y_nlogg = new TH1F("y_nlogg","y_nlogg",nybins,ybins); TH1F *y_nlo = new TH1F("y_nlo","y_nlo",nybins,ybins); TH1F *y_sps = new TH1F("y_sps","y_sps",nybins,ybins); TH1F *y_width = new TH1F("y_width","y_width",nybins,ybins); mass_data->SetBinContent(1,47.43199); mass_data->SetBinContent(2,22.88957); mass_data->SetBinContent(3,10.52912); mass_data->SetBinContent(4,7.297879); mass_data->SetBinContent(5,4.679995); mass_data->SetBinContent(6,2.752399); mass_data->SetBinContent(7,2.321633); mass_data->SetBinContent(8,0.4013286); mass_data->SetBinError(1,6.281534); mass_data->SetBinError(2,2.358319); mass_data->SetBinError(3,1.509835); mass_data->SetBinError(4,1.177612); mass_data->SetBinError(5,0.7126356); mass_data->SetBinError(6,0.3761612); mass_data->SetBinError(7,0.3408355); mass_data->SetBinError(8,0.05351048); pt_data->SetBinContent(1, 1.5 ); pt_data->SetBinContent(2, 1.75); pt_data->SetBinContent(3, 1.85); pt_data->SetBinContent(4, 1.5); pt_data->SetBinContent(5, 0.35); pt_data->SetBinContent(6,0.61); pt_data->SetBinContent(7, 1.7); pt_data->SetBinContent(8, 2.05); pt_data->SetBinContent(9, 2.95); pt_data->SetBinContent(10,3.6); pt_data->SetBinContent(11,2.5); pt_data->SetBinContent(12,2.1); pt_data->SetBinContent(13,1.5); pt_data->SetBinContent(14,0.95); pt_data->SetBinContent(15,0.23); pt_data->SetBinContent(16,0.13); pt_data->SetBinContent(17,0.15); pt_data->SetBinContent(18,0.14); pt_data->SetBinContent(19,0.04); pt_data->SetBinContent(20,0.025); pt_data->SetBinError(1,0.25); pt_data->SetBinError(2, 0.25); pt_data->SetBinError(3,0.25); pt_data->SetBinError(4,0.25); pt_data->SetBinError(5,0.15); pt_data->SetBinError(6,0.15); pt_data->SetBinError(7,0.25); pt_data->SetBinError(8,0.25); pt_data->SetBinError(9,0.25); pt_data->SetBinError(10, 0.1); pt_data->SetBinError(11, 0.1); pt_data->SetBinError(12, 0.25); pt_data->SetBinError(13, 0.1); pt_data->SetBinError(14, 0.25); pt_data->SetBinError(15, 0.07); pt_data->SetBinError(16, 0.07); pt_data->SetBinError(17, 0.07); pt_data->SetBinError(18, 0.07); pt_data->SetBinError(19, 0.06); pt_data->SetBinError(20, 0.025); dy_data->SetBinContent(1,353.6836); dy_data->SetBinContent(2,208.9763); dy_data->SetBinContent(3,100.067); dy_data->SetBinContent(4,59.72152); dy_data->SetBinContent(5,39.28412); dy_data->SetBinContent(6,23.76292); dy_data->SetBinContent(7,22.76975); dy_data->SetBinContent(8,10.52381); dy_data->SetBinError(1,28.61261); dy_data->SetBinError(2,21.71715); dy_data->SetBinError(3,14.11659); dy_data->SetBinError(4,10.30196); dy_data->SetBinError(5,6.846661); dy_data->SetBinError(6,5.372485); dy_data->SetBinError(7,4.64503); dy_data->SetBinError(8,2.287784); y_data->SetBinContent(1,96.87107); y_data->SetBinContent(2,110.5371); y_data->SetBinContent(3,89.27422); y_data->SetBinContent(4,101.8527); y_data->SetBinContent(5,77.61348); y_data->SetBinContent(6,95.7653); y_data->SetBinContent(7,137.6607); y_data->SetBinContent(8,168.4277); y_data->SetBinContent(9,120.5354); y_data->SetBinError(1,14.97098); y_data->SetBinError(2,15.67618); y_data->SetBinError(3,12.3992); y_data->SetBinError(4,13.63791); y_data->SetBinError(5,10.98304); y_data->SetBinError(6,14.26707); y_data->SetBinError(7,17.44995); y_data->SetBinError(8,23.01054); y_data->SetBinError(9,22.7678); mass_width->SetBinContent(1,0.8); mass_width->SetBinContent(2,2.); mass_width->SetBinContent(3,2.); mass_width->SetBinContent(4,3.); mass_width->SetBinContent(5,4.); mass_width->SetBinContent(6,5.); mass_width->SetBinContent(7,5.); mass_width->SetBinContent(8,30.); pt_width->SetBinContent(1,2.5); pt_width->SetBinContent(2,2.5); pt_width->SetBinContent(3,2.5); pt_width->SetBinContent(4,2.5); pt_width->SetBinContent(5,2.5); pt_width->SetBinContent(6,2.5); pt_width->SetBinContent(7,2.5); pt_width->SetBinContent(8,2.5); pt_width->SetBinContent(9,2.5); pt_width->SetBinContent(10,2.5); pt_width->SetBinContent(11,2.5); pt_width->SetBinContent(12,2.5); pt_width->SetBinContent(13,5); pt_width->SetBinContent(14,5); pt_width->SetBinContent(15,5); pt_width->SetBinContent(16,5); pt_width->SetBinContent(17,5); pt_width->SetBinContent(18,5); pt_width->SetBinContent(19,5); pt_width->SetBinContent(20,5); dy_width->SetBinContent(1,0.2); dy_width->SetBinContent(2,0.2); dy_width->SetBinContent(3,0.2); dy_width->SetBinContent(4,0.3); dy_width->SetBinContent(5,0.4); dy_width->SetBinContent(6,0.5); dy_width->SetBinContent(7,0.6); dy_width->SetBinContent(8,2.1); y_width->SetBinContent(1,0.2); y_width->SetBinContent(2,0.2); y_width->SetBinContent(3,0.2); y_width->SetBinContent(4,0.2); y_width->SetBinContent(5,0.2); y_width->SetBinContent(6,0.2); y_width->SetBinContent(7,0.2); y_width->SetBinContent(8,0.2); y_width->SetBinContent(9,0.2); dps.Draw("FourMu_pT >> pt_dps","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); nlogg.Draw("FourMu_pT >> pt_nlogg","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); sps.Draw("FourMu_pT >> pt_sps","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); pt_dps->Divide(pt_width); pt_nlogg->Divide(pt_width); pt_sps->Divide(pt_width); datamass[0]=pt_data->Integral("width"); std::cout<<datamass[0]<<std::endl; dpsmass[0]=pt_dps->Integral("width"); spsmass[0]=pt_sps->Integral("width"); nloggmass[0]=pt_nlogg->Integral("width"); nlomass[0]=nloggmass[0]; scaledps = datamass[0]/ (float) dpsmass[0]; scalesps= datamass[0]/ (float) spsmass[0]; scalenlo= datamass[0]/ (float) nloggmass[0]; float Chi2=0; float minchi2norm=99999999.9; float minchi2=9999999.9; float mina, minb, minc, minan, minbn, mincn; // Chi2 = Chi2 + pow((datamass[1] - (0.00*scaledps*dpsmass[1] + 0.0*scalesps*spsmass[1] + 0.0*scalenlo*nlomass[1])),2)/sqrt(datamass[1]); // std::cout<<"Scale: " <<datamass[0]<<" " << dpsmass[0]<<" "<<scaledps<<" "<<scalesps<<" "<<scalenlo<<" "<<std::endl; for(float a=0.0; a<1.0; a=a+0.01){ dps.Draw("FourMu_Mass >> mass_dps","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); nlogg.Draw("FourMu_Mass >> mass_nlogg","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); sps.Draw("FourMu_Mass >> mass_sps","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); dps.Draw("FourMu_pT >> pt_dps","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); nlogg.Draw("FourMu_pT >> pt_nlogg","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); sps.Draw("FourMu_pT >> pt_sps","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); dps.Draw("Psi1To2_dY >> dy_dps","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); nlogg.Draw("Psi1To2_dY >> dy_nlogg","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); sps.Draw("Psi1To2_dY >> dy_sps","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); dps.Draw("abs(FourMu_Rapidity)>> y_dps","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); nlogg.Draw("abs(FourMu_Rapidity) >> y_nlogg","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); sps.Draw("abs(FourMu_Rapidity) >> y_sps","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); mass_dps->Divide(mass_width); mass_nlogg->Divide(mass_width); mass_sps->Divide(mass_width); pt_dps->Divide(pt_width); pt_nlogg->Divide(pt_width); pt_sps->Divide(pt_width); dy_dps->Divide(dy_width); dy_nlogg->Divide(dy_width); dy_sps->Divide(dy_width); y_dps->Divide(y_width); y_nlogg->Divide(y_width); y_sps->Divide(y_width); // for(int mbin=1; mbin<=nmbins; ++mbin){ // if (mass_data->GetBinContent(mbin) == 0){ // //mbinerr = 1.; // continue; // } // //else{mbinerr = sqrt(abs(mass_data->GetBinContent(mbin)));} // //Chi2=Chi2 + pow((mass_data->GetBinContent(mbin) - (a*scaledps*mass_dps->GetBinContent(mbin) + b*scalesps*mass_sps->GetBinContent(mbin) + c*scalenlo*mass_nlogg->GetBinContent(mbin))),2)/mbinerr; //// Chi2=Chi2 + pow((mass_data->GetBinContent(mbin) - (a*scaledps*mass_dps->GetBinContent(mbin) + b*scalesps*mass_sps->GetBinContent(mbin) + c*scalenlo*mass_nlogg->GetBinContent(mbin)))/sqrt(abs(mass_data->GetBinContent(mbin))),2); // // std::cout<<Chi2<<std::endl; // } for(int ptbin=1; ptbin<=nptbins; ++ptbin){ Chi2=Chi2 + pow((pt_data->GetBinContent(ptbin) - (a*scaledps*pt_dps->GetBinContent(ptbin) + (1.-a)*scalenlo*pt_nlogg->GetBinContent(ptbin)))/pt_data->GetBinError(ptbin),2); // std::cout<<pt_data->GetBinContent(ptbin)<<std::endl; } // for(int dybin=1; dybin<=ndybins; ++dybin){ // if (dy_data->GetBinContent(dybin) == 0){ // dybinerr = 1.; // } // else{dybinerr = dy_data->GetBinError(dybin);} //// Chi2=Chi2 + pow((dy_data->GetBinContent(dybin) - (a*scaledps*dy_dps->GetBinContent(dybin) + b*scalesps*dy_sps->GetBinContent(dybin) + c*scalenlo*dy_nlogg->GetBinContent(dybin)))/dybinerr,2); // // std::cout<<Chi2<<std::endl; // } // for(int ybin=1; ybin<=nybins; ++ybin){ // Chi2=Chi2 + pow((y_data->GetBinContent(ybin) - (a*scaledps*y_dps->GetBinContent(ybin) + (1.-a)*scalenlo*y_nlogg->GetBinContent(ybin)))/y_data->GetBinError(ybin),2); // // std::cout<<Chi2<<std::endl; // } // std::cout<<"a, b, c: "<<a<<" "<<b<<" "<<c<<" Chi2: "<<Chi2<<std::endl; std::cout<<a<<" "<<Chi2<<std::endl; if (Chi2<=minchi2){ minchi2=Chi2; minan = a; minbn = 0.; mincn=(1.-a); } // std::cout<<a<<" "<<b<<" "<<c<<" "<<Chi2<<std::endl; Chi2=0; } std::cout<<"Min Chi2: "<<minchi2<<" dps, sps, nlo: "<<minan<<" "<<minbn<<" "<<mincn<<std::endl; TCanvas* disp = new TCanvas("disp","disp",900,900); disp->Divide(2,2); TH1F *MassSum = new TH1F("MassSum","MassSum",nmbins,massbins); TH1F *MassBest = new TH1F("MassBest","MassBest",nmbins,massbins); TH1F *DpsBestM = new TH1F("DpsBestM","DpsBestM",nmbins,massbins); TH1F *SpsBestM = new TH1F("SpsBestM","SpsBestM",nmbins,massbins); TH1F *NloBestM = new TH1F("NloBestM","NloBestM",nmbins,massbins); TH1F *pTBest = new TH1F("pTBest","pTBest",nptbins,ptbins); TH1F *pTSum = new TH1F("pTSum","pTSum",nptbins,ptbins); TH1F *DpsBestpt = new TH1F("DpsBestpt","DpsBestpt",nptbins,ptbins); TH1F *NloBestpt = new TH1F("NloBestpt","NloBestpt",nptbins,ptbins); TH1F *SpsBestpt = new TH1F("SpsBestpt","SpsBestpt",nptbins,ptbins); TH1F *dyBest = new TH1F("dyBest","dyBest",ndybins,dybins); TH1F *dySum = new TH1F("dySum","dySum",ndybins,dybins); TH1F *DpsBestdy = new TH1F("DpsBestdy","DpsBestdy",ndybins,dybins); TH1F *NloBestdy = new TH1F("NloBestdy","NloBestdy",ndybins,dybins); TH1F *SpsBestdy = new TH1F("SpsBestdy","SpsBestdy",ndybins,dybins); TH1F *yBest = new TH1F("yBest","yBest",nybins,ybins); TH1F *ySum = new TH1F("ySum","ySum",nybins,ybins); TH1F *DpsBesty = new TH1F("DpsBesty","DpsBesty",nybins,ybins); TH1F *NloBesty = new TH1F("NloBesty","NloBesty",nybins,ybins); TH1F *SpsBesty = new TH1F("SpsBesty","SpsBesty",nybins,ybins); MassBest->SetMinimum(0);pTBest->SetMinimum(0);dyBest->SetMinimum(0);yBest->SetMinimum(0); mass_data->SetMinimum(0);pt_data->SetMinimum(0);dy_data->SetMinimum(0);y_data->SetMinimum(0); dps.Draw("FourMu_Mass>>DpsBestM","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); nlogg.Draw("FourMu_Mass>>NloBestM","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); sps.Draw("FourMu_Mass>>SpsBestM","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); dps.Draw("FourMu_pT>>DpsBestpt","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); nlogg.Draw("FourMu_pT>>NloBestpt","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); sps.Draw("FourMu_pT>>SpsBestpt","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); dps.Draw("Psi1To2_dY>>DpsBestdy","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); nlogg.Draw("Psi1To2_dY>>NloBestdy","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); sps.Draw("Psi1To2_dY>>SpsBestdy","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); dps.Draw("abs(FourMu_Rapidity)>>DpsBesty","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); nlogg.Draw("abs(FourMu_Rapidity)>>NloBesty","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); sps.Draw("abs(FourMu_Rapidity)>>SpsBesty","Sum$(Psi_pT>8.5&&abs(Psi_y)<2.1&&Psi_Mass[]<3.35&&Psi_Mass>2.85)==2","goff"); DpsBestM->Divide(mass_width); NloBestM->Divide(mass_width); SpsBestM->Divide(mass_width); DpsBestpt->Divide(pt_width); NloBestpt->Divide(pt_width); SpsBestpt->Divide(pt_width); DpsBestdy->Divide(dy_width); NloBestdy->Divide(dy_width); SpsBestdy->Divide(dy_width); DpsBesty->Divide(y_width); NloBesty->Divide(y_width); SpsBesty->Divide(y_width); //MassSum->Add(DpsBest,(float) mina); //MassSum->Add(SpsBest,minb); //MassSum->Add(NloBest,minc); mass_data->SetMinimum(0); mass_data->SetXTitle("Four Mu Mass (GeV)"); pt_data->SetXTitle("Four Mu pT (GeV)"); dy_data->SetXTitle("|#Delta Y| between J/#psi"); y_data->SetXTitle("Four Mu Rapidity |Y|"); mass_data->SetTitle(""); pt_data->SetTitle(""); dy_data->SetTitle(""); y_data->SetTitle(""); disp->cd(1); DpsBestM->SetLineColor(kRed); NloBestM->SetLineColor(kGreen); SpsBestM->SetLineColor(kBlue); DpsBestM->Scale(minan*scaledps); NloBestM->Scale(mincn*scalenlo); SpsBestM->Scale(minbn*scalesps); MassSum->Add(DpsBestM); MassSum->Add(NloBestM); MassSum->Add(SpsBestM); mass_data->Draw("E1"); MassSum->Draw("same"); DpsBestM->Draw("same"); NloBestM->Draw("same"); SpsBestM->Draw("same"); TLegend *leg = new TLegend(0.6,0.7,0.90,0.9); leg->SetFillStyle(0); leg->SetBorderSize(0); leg->SetShadowColor(0); leg->AddEntry(DpsBestM,"DPS model","l"); leg->AddEntry(NloBestM,"SPS NLO model","l"); leg->AddEntry(MassSum,"MC model sum","l"); leg->AddEntry(MassBest,"Data","lep"); leg->Draw(); disp->cd(2); DpsBestpt->SetLineColor(kRed); NloBestpt->SetLineColor(kGreen); SpsBestpt->SetLineColor(kBlue); DpsBestpt->Scale(minan*scaledps); NloBestpt->Scale(mincn*scalenlo); SpsBestpt->Scale(minbn*scalesps); pTSum->Add(DpsBestpt); pTSum->Add(NloBestpt); pTSum->Add(SpsBestpt); pt_data->Draw("e1"); pTSum->Draw("same"); DpsBestpt->Draw("same"); NloBestpt->Draw("same"); SpsBestpt->Draw("same"); leg->Draw(); disp->cd(3); DpsBestdy->SetLineColor(kRed); NloBestdy->SetLineColor(kGreen); SpsBestdy->SetLineColor(kBlue); DpsBestdy->Scale(minan*scaledps); NloBestdy->Scale(mincn*scalenlo); SpsBestdy->Scale(minbn*scalesps); dySum->Add(DpsBestdy); dySum->Add(NloBestdy); dySum->Add(SpsBestdy); dy_data->Draw("e1"); dySum->Draw("same"); DpsBestdy->Draw("same"); NloBestdy->Draw("same"); SpsBestdy->Draw("same"); leg->Draw(); disp->cd(4); DpsBesty->SetLineColor(kRed); NloBesty->SetLineColor(kGreen); SpsBesty->SetLineColor(kBlue); DpsBesty->Scale(minan*scaledps); NloBesty->Scale(mincn*scalenlo); SpsBesty->Scale(minbn*scalesps); ySum->Add(DpsBesty); ySum->Add(NloBesty); ySum->Add(SpsBesty); y_data->Draw("e1"); ySum->Draw("same"); DpsBesty->Draw("same"); NloBesty->Draw("same"); SpsBesty->Draw("same"); leg->Draw(); }