bool CSwordVerseKey::previous( const JumpType type ) {
    bool ret = true;

    switch (type) {

        case UseBook: {
            if ( (Book() == 1) && (Testament() == 1) ) { //Genesis
                return false;
            }
            else if ( (Book() == 1) && (Testament() == 2) ) { //Matthew
                Testament(1);
                Book(BMAX[0]);
            }
            else {
                Book( Book() - 1 );
            }

            break;
        }

        case UseChapter: {
            Chapter(Chapter() - 1);
            break;
        }

        case UseVerse: {
            if (m_module && m_module->module()) {
                const bool useHeaders = 1; //(Verse() == 0);
                const bool oldHeadingsStatus = ((VerseKey*)(m_module->module()->getKey()))->Headings( useHeaders );

                m_module->module()->getKey()->setText( key().toUtf8().constData() );

                const bool oldStatus = m_module->module()->getSkipConsecutiveLinks();
                m_module->module()->setSkipConsecutiveLinks(true);
                ( *( m_module->module() ) )--;

                ((VerseKey*)(m_module->module()->getKey()))->Headings( oldHeadingsStatus );
                m_module->module()->setSkipConsecutiveLinks(oldStatus);

                if (!m_module->module()->Error()) {
                    key( QString::fromUtf8(m_module->module()->KeyText()) );//don't use fromUtf8
                }
                else {
                    ret = false;
                    //         Verse(Verse()-1);
                    m_module->module()->getKey()->setText( key().toUtf8().constData() ); //restore module's key
                }
            }
            else {
                Verse(Verse() - 1);
            }

            break;
        }

        default:
            return false;
    }

    if ( CSwordBibleModuleInfo* bible = dynamic_cast<CSwordBibleModuleInfo*>(module()) ) {
        if (_compare(bible->lowerBound()) < 0 ) {
            key( bible->lowerBound() );
            ret = false;
        }

        if (_compare(bible->upperBound()) > 0 ) {
            key( bible->upperBound() );
            ret = false;
        }

        return ret;
    }
    else if (Error()) {
        return false;
    }

    return ret;
}
void ChargedHiggsQCDPurity::Init()
{
    // -- simplified selection
    for ( string& l : AllLabel()  ) 
        for (size_t iBin = -1 ; iBin + 1 < PtBins.size() ; ++iBin )
        {
            float pt = -1;
            if (iBin>=0 ) pt= PtBins[iBin];
            //                       direct, fullSel
            Book( dir + HistName(pt, true , false)+"_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
            // ---- 
            Book( dir + HistName(pt, true , false, "Upar")+"_"+ l  , ("EtMissParallel "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false, "Upar")+"_"+ l  , ("EtMissParallelIsoInv "+ l).c_str(),250,0.,500.);

            Book( dir + HistName(pt, true , false, "Uperp")+"_"+ l  , ("EtMissPerp "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false, "Uperp")+"_"+ l  , ("EtMissPerpIsoInv "+ l).c_str(),250,0.,500.);
            //  Used in case of spline reweighting iterations
            Book( dir + HistName(pt, true,  false, "TauPt")+"_"+ l  , ("PtTau "+ l).c_str(),1000,0.,1000.);
            Book( dir + HistName(pt, false, false, "TauPt")+"_"+ l  , ("PtTauIsoInv "+ l).c_str(),1000,0.,1000.);

            // QG ? Tau 
            Book( dir + HistName(pt, true , false)+"_Q_" + l  , ("EtMiss Q"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_Q_" + l  , ("EtMissIsoInv Q"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , false)+"_G_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_G_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , false)+"_T_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_T_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , false)+"_U_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_U_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);
            // Prong
            Book( dir + HistName(pt, true , false)+"_1p_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_1p_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , false)+"_3p_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, false)+"_3p_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
        }
    // --- for event NOT BINNED! CONTROL PLOTS
    for (string &l : AllLabel() )
    {
        
            // Cut flow with QCD
        Book(    "ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l , ("CutFlowQCD "+ l).c_str(), 10, -.5, 10.0-.5);
        GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(1, "N_{taus} #geq 1 \\ N_{leps} = 0 \\ N_{jets} #geq 3 \\ Trigger");
        GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(2,"N_{Bjets} #geq 1");
        GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(3,"MET > 60 GeV");
        GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(4,"R_{bb}^{Min}>40");
    
    
            //  Used for control plots
            string hist= "TauPt_IsoInv_Control";
            Book( dir + hist+"_"+ l  , ("PtTauIsoInv "+ l).c_str(),1000,0.,1000.); // this guys has the R factor applied in the loos selection
            hist= "TauPt_Control";
            Book( dir + hist+"_"+ l  , ("PtTau "+ l).c_str(),1000,0.,1000.); // this guys has the R factor applied in the loos selection
            hist= "EtMiss_IsoInv_Control";
            Book( dir + hist+"_"+ l  , ("EtMissTauIsoInv "+ l).c_str(),250,0,500);
            hist= "EtMiss_Control";
            Book( dir + hist+"_"+ l  , ("EtMiss "+ l).c_str(),250,0,500);
    }
    // -- full selection
    for ( string& l : AllLabel()  ) 
    {
        for (size_t iBin = -1 ; iBin + 1 < PtBins.size() ; ++iBin )
        {
            float pt = -1;
            if (iBin>=0 ) pt= PtBins[iBin];
            //                       direct full
            Book( dir + HistName(pt, true , true)+"_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true)+"_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);

            Book( dir + HistName(pt, true , true)+"_1p_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true)+"_1p_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , true)+"_3p_"+ l  , ("EtMiss "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true)+"_3p_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
            // ---  NoR
            Book( dir + HistName(pt, false, true)+"_NoR_"+ l  , ("EtMissIsoInv "+ l).c_str(),250,0.,500.);
            //
            Book( dir + HistName(pt, true , true, "Upar")+"_"+ l  , ("EtMissParallel "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, true, true, "Uperp")+"_"+ l  , ("EtMissPerp "+ l).c_str(),250,0.,500.);

            Book( dir + HistName(pt, false , true, "Upar")+"_"+ l  , ("EtMissParallelIsoInv "+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true, "Uperp")+"_"+ l  , ("EtMissPerpIsoInv "+ l).c_str(),250,0.,500.);
            // QG ? 
            Book( dir + HistName(pt, true , true )+"_Q_" + l  , ("EtMiss Q"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true )+"_Q_" + l  , ("EtMissIsoInv Q"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , true )+"_G_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true )+"_G_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , true )+"_T_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true )+"_T_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);
            Book( dir + HistName(pt, true , true )+"_U_" + l  , ("EtMiss G"+ l).c_str(),250,0.,500);
            Book( dir + HistName(pt, false, true )+"_U_" + l  , ("EtMissIsoInv G"+ l).c_str(),250,0.,500.);

        }
        // I don't need to split it by pt
            Book( dir + "Mt"+"_"+ l  , ("Mt "+ l).c_str(),8000,0.,8000); // same binning in TauNu
            Book( dir + "MtIsoInv"+"_"+ l  , ("MtIsoInv "+ l).c_str(),8000,0.,8000.);
            Book( none + "EtMissIsoInv"+"_"+ l  , ("EtMissIsoInv "+ l).c_str(),1000,0.,1000.);
            Book( none + "EtMiss"+"_"+ l  , ("EtMiss "+ l).c_str(),1000,0.,1000.); // copy of the Tau Nu ? 

        Book(    none+"RbbMin_"+l,"RbbMin "+l+";R_{bb}^{min}",100,0,2*TMath::Pi());
        Book(    none+"RCollMin_"+l,"RCollMin "+l+";R_{coll}^{min}",100,0,2*TMath::Pi());

        Book(    none+"RbbMinIsoInv_"+l,"RbbMin IsoInv "+l+";R_{bb}^{min}",100,0,2*TMath::Pi());
        Book(    none+"RCollMinIsoInv_"+l,"RCollMin IsoInv "+l+";R_{coll}^{min}",100,0,2*TMath::Pi());
 
        
        Book(    none+"NBjets_"+l,"NBjets "+l+";NBjets",1000,0,1000);
        Book(    none+"NBjetsIsoInv_"+l,"NBjets IsoInv "+l+";NBjets",1000,0,1000);
        
        Book(    none+"Tau1Pt_"+l,"Tau1Pt "+l+";Tau1Pt",1000,0,1000);
        Book(    none+"Tau1PtIsoInv_"+l,"Tau1Pt IsoInv "+l+";Tau1Pt",1000,0,1000);

    
    
    }

}
bool CSwordVerseKey::next( const JumpType type ) {
    Error(); //clear Error status
    bool ret = true;

    switch (type) {

        case UseBook: {
            const int currentTestament = Testament();
            const int currentBook = Book();

            if ((currentTestament == 2) && (currentBook >= BMAX[currentTestament-1])) { //Revelation, i.e. end of navigation
                return false;
            }
            else if ((currentTestament == 1) && (currentBook >= BMAX[currentTestament-1])) { //Malachi, switch to the NT
                Testament(currentTestament + 1);
                Book(1);
            }
            else {
                Book(Book() + 1);
            }
            break;
        }

        case UseChapter: {
            Chapter(Chapter() + 1);
            break;
        }

        case UseVerse: {
            if (m_module && m_module->module()) {
                const bool oldStatus = m_module->module()->getSkipConsecutiveLinks();
                m_module->module()->setSkipConsecutiveLinks(true);

                //disable headings for next verse
                const bool useHeaders = 1; //(Verse() == 0);
                const bool oldHeadingsStatus = ((VerseKey*)(m_module->module()->getKey()))->Headings( useHeaders );
                //don't use setKey(), that would create a new key without Headings set
                m_module->module()->getKey()->setText( key().toUtf8().constData() );

                (*(m_module->module()) )++;

                ((VerseKey*)(m_module->module()->getKey()))->Headings(oldHeadingsStatus);
                m_module->module()->setSkipConsecutiveLinks(oldStatus);

                if (!m_module->module()->Error()) {
                    key( QString::fromUtf8(m_module->module()->KeyText()) );
                }
                else {
                    //         Verse(Verse()+1);
                    //don't change the key, restore the module's position
                    m_module->module()->getKey()->setText( key().toUtf8().constData() );
                    ret = false;
                    break;
                }

            }
            else {
                Verse(Verse() + 1);
            }

            break;
        }

        default:
            return false;
    }

    if ( CSwordBibleModuleInfo* bible = dynamic_cast<CSwordBibleModuleInfo*>(module()) ) {
        if (_compare(bible->lowerBound()) < 0 ) {
            key( bible->lowerBound() );
            ret = false;
        }

        if (_compare(bible->upperBound()) > 0 ) {
            key( bible->upperBound() );
            ret = false;
        }

        return ret;
    }
    else if (Error()) { //we have no module, so take care of VerseKey::Error()
        return false;
    }

    return ret;
}
Esempio n. 4
0
 int main()
 {
	 string keep;
	 bool run=true;
	 int bookOrder=0;

	 Library ustcLibrary=Library();
	 while(run)
	 {
		 cout<<"-------------------主菜单---------------------\n";
		cout<<"0.退出\t1.添加\t2.查询\t3.借书\t4.还书\t5.费用\n";
		cout<<"请选择操作:\n";

		int  mainOperator=0;
		cin>>mainOperator;
	
		switch(mainOperator)
		{
		case 0:
			run=false;
			break;
		case 1:
			cout<<"------------添加子菜单------------\n";
			cout<<"0.返回\t1.添加图书\t2.添加读者\n";
			cout<<"请选择操作:\n";

			int addOperator=0;
			cin>>addOperator;

			switch(addOperator)
			{
			case 0:
				break;
			case 1:
				
				bookOrder=2;

				string strISBN;
				string strName;
				string strAuthor;
				string strPulishedDate;
				string getId;
				string getName;
				string getAuthor;
				string getPublishedDate;
				cout<<"----------添加图书----------\n";
				cout<<"请依次输入图书的ISBN码,书名,作者和出版日期:\n";
				cin>>strISBN>>strName>>strAuthor>>strPulishedDate;

				Book  newBook=Book(strISBN,strName,strAuthor,strPulishedDate);
				getId=newBook.GetISBNNum();
				bool wrongOnce=false;
				while(getId=="") 
				{
					wrongOnce=true;
					cout<<"请重新输入:\n";
					cin>>strISBN>>strName>>strAuthor>>strPulishedDate;
					Book newBook=Book(strISBN,strName,strAuthor,strPulishedDate);
					getId=newBook.GetISBNNum();
					getName=newBook.GetName();
					getAuthor=newBook.GetAuthor();
					getPublishedDate=newBook.GetDat();
				}
				if(wrongOnce)
				{
					Book rightBook=Book(getId,getName,getAuthor,getPublishedDate);
					ustcLibrary.AddBook(rightBook);
				}
				else
				{
					ustcLibrary.AddBook(newBook);
				}
				

			}

			break;
		}
	 }
	

	
	/*图书
	 //1.1初始化图书信息
	 Book newBook1= Book("1-2-2-s","面向对象技术1","林典鹏","2013-09-12");		//right
	 Book newBook2= Book("1-3-s-s","面向对象技术2","胡希望能","2013-09-12");		//wrong
	 Book newBook3=Book("1-2-3-w","C++ program","Jhon Tom","2012-10-19");
	 //1,2返回图书信息
	 cout<< newBook1.GetAuthor()<<endl;
	 cout<<newBook1.GetDat()<<endl;
	 cout<<newBook1.GetISBNNum()<<endl;
	 cout<<newBook1.GetIsOut()<<endl;
	 cout<<newBook1.GetName()<<endl;
	 newBook1.DisplayInfo();	//总体显示信息
// 


 ///*读者
	 //2.1初始化读者信息
	 Patron linPatron =Patron("林弘伟","PB11210245");
	 Patron wangPatron=Patron("王云峰","PB11210234");
	 Patron liPatron=Patron("李敏","SA11023234");
	 Patron xPatron=Patron("XJhon","PB12210345");
	 //2.2显示读者信息
	 linPatron.DisplayInfo();
	 wangPatron.DisplayInfo();
	 liPatron.DisplayInfo();
	 //2.3设定借书费
	 linPatron.SetOweCount(23.4);
	 //2.4显示是否欠费
	 linPatron.IsOwed();
	 linPatron.DisplayInfo();
// 

 ///*图书馆
	 //3.1新建图书馆
	 Library ustcLibrary=Library();
	 //3.2添加图书
	 ustcLibrary.AddBook(newBook1);					//right
	 ustcLibrary.AddBook(newBook2);					//wrong
	 ustcLibrary.AddBook(newBook3);
	 //3.3添加读者
	 ustcLibrary.AddPatron(linPatron);
	 ustcLibrary.AddPatron(wangPatron);
	 ustcLibrary.AddPatron(xPatron);
	 //3.4借书
	 ustcLibrary.LendABookToPatron(newBook1,wangPatron);		//欠费
	 ustcLibrary.LendABookToPatron(newBook1,wangPatron);	//未欠费
	 ustcLibrary.LendABookToPatron(newBook3,xPatron);
	// ustcLibrary.LendABookToPatron(newBook1,liPatron);		//已经借出
	 //3.5显示欠费读者列表
	 ustcLibrary.GetOwedInfo();
	 ustcLibrary.DisplayOut();
	 ustcLibrary.ReturnBook(newBook1,wangPatron);
	 ustcLibrary.DisplayOut();
//*/

	// cin>>keep;
 }
Esempio n. 5
0
QVector<Book> Library::booksSet()
{
    QVector<Book> books;
    books << Book("Beowulf", writer(WI_JohnTolkien), 1994);
    books << Book("The Hobbit", writer(WI_JohnTolkien), 1936);
    books << Book("The Lord of the Rings", writer(WI_JohnTolkien), 1955);

    books << Book("The Green Mile", writer(WI_StephenKing), 1996);
    books << Book("Mr. Mercedes", writer(WI_StephenKing), 2014);
    books << Book("Doctor Sleep", writer(WI_StephenKing), 2013);
    books << Book("Under the Dome", writer(WI_StephenKing), 2009);
    books << Book("11/22/63", writer(WI_StephenKing), 2011);
    books << Book("The Dead Zone", writer(WI_StephenKing), 1979);

    books << Book("Foundation", writer(WI_IssacAsimov), 1951);
    books << Book("Foundation and Empire", writer(WI_IssacAsimov), 1952);
    books << Book("Second Foundation", writer(WI_IssacAsimov), 1953);
    books << Book("Foundation's Edge", writer(WI_IssacAsimov), 1982);
    books << Book("Forward the Foundation", writer(WI_IssacAsimov), 1993);

    return books;
}
Esempio n. 6
0
    void testBook ()
    {
        Currency const c1 (1); Account const i1 (1);
        Currency const c2 (2); Account const i2 (2);
        Currency const c3 (3); Account const i3 (3);

        Issue a1 (c1, i1);
        Issue a2 (c1, i2);
        Issue a3 (c2, i2);
        Issue a4 (c3, i2);

        expect (Book (a1, a2) != Book (a2, a3));
        expect (Book (a1, a2) <  Book (a2, a3));
        expect (Book (a1, a2) <= Book (a2, a3));
        expect (Book (a2, a3) <= Book (a2, a3));
        expect (Book (a2, a3) == Book (a2, a3));
        expect (Book (a2, a3) >= Book (a2, a3));
        expect (Book (a3, a4) >= Book (a2, a3));
        expect (Book (a3, a4) >  Book (a2, a3));

        std::hash <Book> hash;

//         log << std::hex << hash (Book (a1, a2));
//         log << std::hex << hash (Book (a1, a2));
//
//         log << std::hex << hash (Book (a1, a3));
//         log << std::hex << hash (Book (a1, a3));
//
//         log << std::hex << hash (Book (a1, a4));
//         log << std::hex << hash (Book (a1, a4));
//
//         log << std::hex << hash (Book (a2, a3));
//         log << std::hex << hash (Book (a2, a3));
//
//         log << std::hex << hash (Book (a2, a4));
//         log << std::hex << hash (Book (a2, a4));
//
//         log << std::hex << hash (Book (a3, a4));
//         log << std::hex << hash (Book (a3, a4));

        expect (hash (Book (a1, a2)) == hash (Book (a1, a2)));
        expect (hash (Book (a1, a3)) == hash (Book (a1, a3)));
        expect (hash (Book (a1, a4)) == hash (Book (a1, a4)));
        expect (hash (Book (a2, a3)) == hash (Book (a2, a3)));
        expect (hash (Book (a2, a4)) == hash (Book (a2, a4)));
        expect (hash (Book (a3, a4)) == hash (Book (a3, a4)));

        expect (hash (Book (a1, a2)) != hash (Book (a1, a3)));
        expect (hash (Book (a1, a2)) != hash (Book (a1, a4)));
        expect (hash (Book (a1, a2)) != hash (Book (a2, a3)));
        expect (hash (Book (a1, a2)) != hash (Book (a2, a4)));
        expect (hash (Book (a1, a2)) != hash (Book (a3, a4)));
    }
std::pair<TER, core::Amounts>
CreateOffer::crossOffersDirect (
    core::LedgerView& view,
    core::Amounts const& taker_amount)
{
    core::Taker::Options const options (mTxn.getFlags());

    core::Clock::time_point const when (
        mEngine->getLedger ()->getParentCloseTimeNC ());

    core::LedgerView view_cancel (view.duplicate());
    core::OfferStream offers (
        view, view_cancel,
        Book (taker_amount.in.issue(), taker_amount.out.issue()),
        when, m_journal);
    core::Taker taker (offers.view(), mTxnAccountID, taker_amount, options);

    TER cross_result (tesSUCCESS);

    while (true)
    {
        // Modifying the order or logic of these
        // operations causes a protocol breaking change.

        // Checks which remove offers are performed early so we
        // can reduce the size of the order book as much as possible
        // before terminating the loop.

        if (taker.done())
        {
            m_journal.debug << "The taker reports he's done during crossing!";
            break;
        }

        if (! offers.step ())
        {
            // Place the order since there are no
            // more offers and the order has a balance.
            m_journal.debug << "No more offers to consider during crossing!";
            break;
        }

        auto const& offer (offers.tip());

        if (taker.reject (offer.quality()))
        {
            // Place the order since there are no more offers
            // at the desired quality, and the order has a balance.
            break;
        }

        if (offer.account() == taker.account())
        {
            // Skip offer from self. The offer will be considered expired and
            // will get deleted.
            continue;
        }

        if (m_journal.debug) m_journal.debug <<
                "  Offer: " << offer.entry()->getIndex() << std::endl <<
                "         " << offer.amount().in << " : " << offer.amount().out;

        cross_result = taker.cross (offer);

        if (cross_result != tesSUCCESS)
        {
            cross_result = tecFAILED_PROCESSING;
            break;
        }
    }

    return std::make_pair(cross_result, taker.remaining_offer ());
}
void ChargedHiggsTauNu::Init()
{
    Log(__FUNCTION__,"INFO",Form("nProngs selected=%d",nprongs) );

    if ( doGen ) initGen();

    for ( string& l : AllLabel()  ) {

        Log(__FUNCTION__,"INFO", "Booking Histo CutFlow_" + l);
  
        Book(    "ChargedHiggsTauNu/CutFlow/CutFlow_"+ l  , ("CutFlow "+ l).c_str(),100,-.5,100-.5);
        {
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(Total+1,"Total"); // bin shift
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(OneTau+1,"N_{taus} #geq 1");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(NoLep+1,"N_{leps} = 0");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(ThreeJets,"N_{jets} #geq 3");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(OneBjet,"N_{Bjets} #geq 1");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(Met,"MET > 60 GeV");
            //GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(7,"R_{sr}^{Max} < 1.96");
            //GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(7,"R_{sr}^{Max} < 140");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(AngColl,"R_{coll}^{Min}>40");
            GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(AngRbb,"R_{bb}^{Min}>40");
            //GetHisto("ChargedHiggsTauNu/CutFlow/CutFlow_"+l,"")->GetXaxis()->SetBinLabel(7,"#Delta #phi (Tau,Jet1)<2.09");
        }

        // Cut flow with QCD
        Book(    "ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l , ("CutFlowQCD "+ l).c_str(), 100, -.5, 100-.5);
        {
            GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(1, "N_{taus} #geq 1 \\ N_{leps} = 0 \\ N_{jets} #geq 3 \\ Trigger");
            GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(2,"N_{Bjets} #geq 1");
            GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(3,"MET > 60 GeV");
            GetHisto("ChargedHiggsTauNu/CutFlowQCD/CutFlowQCD_"+l,"")->GetXaxis()->SetBinLabel(4,"R_{bb}^{Min}>40");
        }

        // -- cut flow 2 is the one used to synchronized with HIP
        Book(    "ChargedHiggsTauNu/CutFlow/CutFlow2_"+ l  , ("CutFlow "+ l).c_str(),100,-.5,100-.5);

        // study on base selection
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_0Pi_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_1Pi_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_2Pi_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_0Pi_TrSingleTau_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_1Pi_TrSingleTau_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_0Pi_TrMet110_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_1Pi_TrMet110_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_TrMet110_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_Met150_TrMet110_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_TrSingleTau_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_TrBoth_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        Book(    "ChargedHiggsTauNu/Base/Tau1Pt_Met150_TrBoth_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);
        //

        Book(    "ChargedHiggsTauNu/NOne/NTaus_"+l,"NTaus "+l +";Number of selected hadronic tau" ,1000,0,1000);

        Book(    "ChargedHiggsTauNu/NOne/Tau1Pt_"+l,"Tau1Pt "+l +";p_{T}^{#tau}(leading #tau) [GeV]" ,1000,0,1000);


        //Book(    "ChargedHiggsTauNu/NOne/Tau1Eta_"+l,"Tau1Eta "+l +";#eta^{#tau}(leading #tau) [GeV]",100,-5,5);

        Book(    "ChargedHiggsTauNu/NOne/NJets_"+l,"NJets "+l + "; Number of selected jets",1000,0,1000);

        Book(    "ChargedHiggsTauNu/NOne/Jet1Pt_"+l,"Jet1Pt "+l+";p_{T}^{jet}(leading jet) [GeV]",1000,0,1000);

        Book(    "ChargedHiggsTauNu/NOne/Jet1Eta_"+l,"Jet1Eta "+l+";#eta^{jet}(leading jet) [GeV]",100,-5,5);

        //Book(    "ChargedHiggsTauNu/NOne/Jet2Pt_"+l,"Jet2Pt "+l+";p_{T}^{jet}(sub-leading jet) [GeV]",1000,0,1000);

        //Book(    "ChargedHiggsTauNu/NOne/Jet2Eta_"+l,"Jet2Eta "+l+";#eta^{jet}(sub-leading jet) [GeV]",100,-5,5);

        //Book(    "ChargedHiggsTauNu/NOne/Jet3Pt_"+l,"Jet3Pt "+l+";p_{T}^{jet}(subsub-leading jet) [GeV]",1000,0,1000);

        //Book(    "ChargedHiggsTauNu/NOne/Jet3Eta_"+l,"Jet3Eta "+l + ";#eta^{jet}(subsub-leading jet) [GeV]",100,-5,5);

        Book(    "ChargedHiggsTauNu/NOne/NBjets_"+l,"NBjets "+l + ";Number of selected b jets",1000,0,1000);

        Book(    "ChargedHiggsTauNu/NOne/Bdiscr_"+l,"BDiscr "+l + ";Btag Discr",1000,-2,2);

        Book(    "ChargedHiggsTauNu/NOne/Bjet1Pt_"+l,"Bjet1Pt "+l+"p_{T}^{b-tagged jet} [GeV]",1000,0,1000);

        //Book(    "ChargedHiggsTauNu/NOne/Bjet1Eta_"+l,"Bjet1Eta "+l+";#eta^{b-tagged jet} [GeV]",100,-5,5);

        //Book(    "ChargedHiggsTauNu/NOne/MaxDEtaBjetJets_"+l,"MaxDEtaBjetJets "+l+";Max #Delta#eta (b-tagged jet,jets)",100,0,10);

        //Book(    "ChargedHiggsTauNu/NOne/MaxInvMassBjetJets_"+l,"MaxInvMassBjetJets "+l+";Max invariant mass (b-tagged jet,jets) [GeV]",2000,0,2000);

        Book(    "ChargedHiggsTauNu/NOne/EtMiss_"+l,"EtMiss "+l+";E_{T}^{miss} [GeV]",1000,0,1000);

        //Book2D(  "ChargedHiggsTauNu/NOne/EtMissVsMt_"+l,"EtMissVsMt "+l+";m_{T} [GeV];E_{T}^{miss} [GeV]",1000,0,1000,1000,0,1000);

        Book2D(  "ChargedHiggsTauNu/NOne/DPhiJet1MetVsDPhiTauMet_"+l,"DPhiJetMetVsDPhiTauMet "+l + ";#Delta #phi(#tau,MET);#Delta #phi(Jet1,MET)",50,0,TMath::Pi(),50,0,TMath::Pi());

        Book2D(  "ChargedHiggsTauNu/NOne/DPhiJet2MetVsDPhiTauMet_"+l,"DPhiJetMetVsDPhiTauMet "+l+";Delta #phi(#tau,MET);#Delta #phi(Jet2,MET)",50,0,TMath::Pi(),50,0,TMath::Pi());

        Book2D(  "ChargedHiggsTauNu/NOne/DPhiJet3MetVsDPhiTauMet_"+l,"DPhiJetMetVsDPhiTauMet "+l+";#Delta #phi(#tau,MET);#Delta #phi(Jet3,MET)",50,0,TMath::Pi(),50,0,TMath::Pi());

        Book(    "ChargedHiggsTauNu/NOne/RCollMin_"+l,"RCollMin "+l+";R_{coll}^{min}",100,0,2*TMath::Pi());

        Book(    "ChargedHiggsTauNu/NOne/RbbMin_"+l,"RbbMin "+l+";R_{bb}^{min}",100,0,2*TMath::Pi());

        //Book(    "ChargedHiggsTauNu/NOne/RsrMax_"+l,"RsrMax "+l+";R_{sr}^{max}",100,0,2*TMath::Pi());

        //Book(    "ChargedHiggsTauNu/NOne/DPhiTauJet1_"+l,"DPhiTauJet1 "+l+";#Delta #phi (#tau, leading jet)",50,0,TMath::Pi());

        //Book2D(  "ChargedHiggsTauNu/NOne/RCollMinVsMt_"+l,"RCollMinVsMt "+l + ";m_{T} [GeV];R_{Coll}^{min}",1000,0,1000,100,0,2*TMath::Pi());

        //Book2D(  "ChargedHiggsTauNu/NOne/RbbMinVsMt_"+l,"RbbMinVsMt "+l+";m_{T} [GeV];R_{bb}^{min}",1000,0,1000,100,0,2*TMath::Pi());

        //Book2D(  "ChargedHiggsTauNu/NOne/RsrMaxVsMt_"+l,"RsrMaxVsMt "+l+";m_{T} [GeV];R_{sr}^{Max}",1000,0,1000,100,0,2*TMath::Pi());

        //Book2D(  "ChargedHiggsTauNu/NOne/DPhiTauJet1VsMt_"+l,"DPhiTauJet1VsMt "+l + ";m_{T} [GeV];#Delta #phi (#tau, leading jet)",1000,0,1000,50,0,TMath::Pi());

        /*********************************************
         *              FULL SELECTION               *
         *********************************************/

        // for the TTJets background
        Book(    "ChargedHiggsTauNu/Vars/JetInvMass_" + l ,"Jet Invariant mass;m_{jj} [GeV]",1000,0,1000) ;
        //Book(    "ChargedHiggsTauNu/Vars/Jet13InvMass_" + l ,"Jet Invariant mass;m_{jj} [GeV]",1000,0,1000) ;
        //Book(    "ChargedHiggsTauNu/Vars/Jet23InvMass_" + l ,"Jet Invariant mass;m_{jj} [GeV]",1000,0,1000) ;

        //Book(    "ChargedHiggsTauNu/Vars/Jet1QGL_" + l ,"QGL of the leading jet;QGL",300,-1.5,1.5) ;
        //Book(    "ChargedHiggsTauNu/Vars/Jet2QGL_" + l ,"QGL of the subleading jet;QGL",300,-1.5,1.5) ;

        //Book(    "ChargedHiggsTauNu/Vars/MtDecoQ_" + l ,"Mt deco;MtQ",1000,0,1000) ;
        //Book(    "ChargedHiggsTauNu/Vars/MtDecoCosPhi_" + l ,"Mt deco;MtCosPhi",1000,-1,1) ;

        Book(    "ChargedHiggsTauNu/Vars/Mt_matchTau_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        Book(    "ChargedHiggsTauNu/Vars/Mt_matchEle_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        Book(    "ChargedHiggsTauNu/Vars/Mt_matchMu_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        Book(    "ChargedHiggsTauNu/Vars/Mt_matchJet_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        Book(    "ChargedHiggsTauNu/Vars/Mt_matchOther_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        /**********************************************
         *                   MT                       *
         **********************************************/
        Book(    "ChargedHiggsTauNu/Vars/Mt_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        AddFinalHisto("ChargedHiggsTauNu/Vars/Mt_"+l);
        // study categorization
        for(int i=0;i<=1;++i)
        {
        Book(    string("ChargedHiggsTauNu/Vars/Mt_")+Form("cat%d",i)+"_"+l,"Mt "+l + ";m_{T} [GeV]",8000,0,8000); // the Vars directory contains the full selection
        }


    }

}
Esempio n. 9
0
 const Library::Transaction& default_transaction()
 {
     static const Library::Transaction tt = Library::Transaction(Book(), Patron(), Chrono::Date());
     return tt;
 }
Esempio n. 10
0
void DYAnalysis::Init(){

    for ( string l : AllLabel()  ) {
	    Log(__FUNCTION__,"INFO","Booking Histo Mass");
	    Book ("DYAnalysis/Vars/Mee_"+ l ,"Mee;m^{ee} [GeV];Events"    , 100,50,200);
	    Book ("DYAnalysis/Vars/Mmm_"+ l ,"Mmm;m^{#mu#mu} [GeV];Events", 100,50,200);
	    Book ("DYAnalysis/Vars/Mem_"+ l ,"Mem;m^{e#mu} [GeV];Events"  , 100,50,200);
	    // 
	    Book ("DYAnalysis/Vars/MuonIso_"+ l ,"Muon Isolation;Iso^{#mu} [GeV];Events", 1000,0,0.1);

	    Book ("DYAnalysis/Vars/Ptee_"+ l ,"Ptee;p_{T}^{ee} [GeV];Events"    , 1000,0,1000);
	    Book ("DYAnalysis/Vars/Ptmm_"+ l ,"Ptmm;p_{T}^{#mu#mu} [GeV];Events", 1000,0,1000);
	    Book ("DYAnalysis/Vars/Ptem_"+ l ,"Ptem;p_{T}^{e#mu} [GeV];Events"  , 1000,0,1000);
	    Book ("DYAnalysis/Vars/PtemNoMCut_"+ l ,"Ptem;p_{T}^{e#mu} [GeV];Events"  , 1000,0,1000);
        // counting unweighted events
	    Book ("DYAnalysis/Vars/PtmmUW_"+ l ,"Ptmm;p_{T}^{#mu#mu} [GeV];Events", 1000,0,1000);
        // trilepton
	    Book ("DYAnalysis/Vars/Ptlll_"+ l ,"Ptlll;p_{T}^{ll} [GeV];Events"  , 100,0,1000);
        // eta
	    Book ("DYAnalysis/Vars/EtaMu1_"+ l ,"EtaMu1;#eta^{#mu1} ;Events", 1000,-5,5);
        //
	    Book ("DYAnalysis/Vars/NJee_"+ l ,"NJee;N_{jets}^{ee};Events"    , 10,0,10);
	    Book ("DYAnalysis/Vars/NJmm_"+ l ,"NJmm;N_{jets}^{#mu#mu};Events", 10,0,10);
	    Book ("DYAnalysis/Vars/NJem_"+ l ,"NJem;N_{jets}^{e#mu};Events"  , 10,0,10);
        //
	    Book ("DYAnalysis/Vars/Npvee_"+ l ,"Npvee", 50,0,50);
	    Book ("DYAnalysis/Vars/Npvmm_"+ l ,"Npvmm", 50,0,50);
	    Book ("DYAnalysis/Vars/Npvem_"+ l ,"Npvem", 50,0,50);
        //
	    Book ("DYAnalysis/Vars/MHighPtee_"+ l ,"MHighPtee", 1000,0,1000);
	    Book ("DYAnalysis/Vars/MHighPtmm_"+ l ,"MHighPtmm", 1000,0,1000);
	    Book ("DYAnalysis/Vars/MJHighPtee_"+ l ,"MJHighPtee", 1000,0,1000);
	    Book ("DYAnalysis/Vars/MJHighPtmm_"+ l ,"MJHighPtmm", 1000,0,1000);
        //
	    Book ("DYAnalysis/Vars/MCloseMt_"+ l ,"MCloseMt", 1000,0,1000);
	    Book ("DYAnalysis/Vars/MCloseJZ_"+ l ,"MCloseJZ", 1000,0,1000);
        //
	    Book ("DYAnalysis/Vars/Pt20mm_"+ l ,"Ptmm20", 1000,0,1000);

	    Book ("DYAnalysis/Vars/Accmm_"+ l ,";Events", 10,0,10);
        {
            GetHisto("DYAnalysis/Vars/Accmm_"+ l,"") ->GetXaxis() ->SetBinLabel(1,"Gen-Reco");
            GetHisto("DYAnalysis/Vars/Accmm_"+ l,"") ->GetXaxis() ->SetBinLabel(2,"Gen-!Reco");
            GetHisto("DYAnalysis/Vars/Accmm_"+ l,"") ->GetXaxis() ->SetBinLabel(3,"!Gen-Reco");
        }
	    Book ("DYAnalysis/Vars/Accee_"+ l ,";Events", 10,0,10);
        {
            GetHisto("DYAnalysis/Vars/Accee_"+ l,"") ->GetXaxis() ->SetBinLabel(1,"Gen-Reco");
            GetHisto("DYAnalysis/Vars/Accee_"+ l,"") ->GetXaxis() ->SetBinLabel(2,"Gen-!Reco");
            GetHisto("DYAnalysis/Vars/Accee_"+ l,"") ->GetXaxis() ->SetBinLabel(3,"!Gen-Reco");
        }
    }

}
Esempio n. 11
0
Book Library::getBookByID(IdentNum bookID) const
{
	if (bookID > books.size() || bookID <= 0)
		return Book();
	else return books[bookID-1];
}
int main() {

	// Initialize Linked List
	LinkedList<Book> books = LinkedList<Book>();

	// Define Data
	Author author0 = Author("Dan", "Brown");
	Book theDavinciCode = Book("The DaVinci Code", author0, 597);
	Book angelsAndDemons = Book("Angels and Demons", author0, 496);
	Book deceptionPoint = Book("Deception Point", author0, 752);
	Book digitalFortress = Book("Digital Fortress", author0, 544);

	Author author1 = Author("Andy", "Weir");
	Book theMartian = Book("The Martian", author1, 369);

	// Add books to list
	books.add(deceptionPoint);
	books.add(theDavinciCode);
	books.add(theMartian);

	// Verify each book was added to end of list
	std::cout << "Initial Set of Books" << "\n";
	std::cout << "--------------------------------------------------" << "\n";
	std::cout << books.toString();

	// Push book to front of list
	books.push(digitalFortress);

	// Verify book was pushed to front of list
	std::cout << "Pushed Book" << "\n";
	std::cout << "--------------------------------------------------" << "\n";
	std::cout << books.get(0).toString();

	// Add book at index
	books.add(3, angelsAndDemons);

	// Verify book was added to correct index
	std::cout << "Set of Books" << "\n";
	std::cout << "--------------------------------------------------" << "\n";
	std::cout << books.toString();

	// Remove first book from list (Digital Fortress)
	books.remove(0);

	// Verify book was removed
	std::cout << "First Book" << "\n";
	std::cout << "--------------------------------------------------" << "\n";
	std::cout << books.get(0).toString();

	// Delete 3rd book (Angels and Demons)
	books.remove(2);

	// Verify book was removed
	std::cout << "Set of Books" << "\n";
	std::cout << "--------------------------------------------------" << "\n";
	std::cout << books.toString();

	// Delete last book (The Martian)
	books.remove(2);

	// Verify book was removed
	std::cout << "Set of Books" << "\n";
	std::cout << "--------------------------------------------------" << "\n";
	std::cout << books.toString();

	return 0;
}