Пример #1
0
 // Konsttruktor f�r Hauptfenster                                                                                                                                   
 MDIFrame (const char *title,    const IResourceId &r = IC_DEFAULT_FRAME_ID,                                                                                        
 const IFrameWindow::Style &s = defaultStyle ()) :                                                                                                                  
    IFrameWindow (title, r, s),                                                                                                                                     
    Client (0x8008, this, this)                                                                                                                                     
 {                                                                                                                                                                  
     setClient (&Client);                                                                                                                                           
 }                                                                                                                                                                  
Пример #2
0
    QRect subElementRect(SubElement element, const QStyleOption* option, const QWidget* widget) const
    {
        QRect result = defaultStyle()->subElementRect(element, option, widget);
        switch (element) {
        case SE_TabWidgetTabBar: {
            const YaTabWidget* tw = dynamic_cast<const YaTabWidget*>(widget);
            if (tw) {
                QSize sh = tw->tabSizeHint();
                QRect r  = tw->tabRect();
                result.setLeft(r.left());
                result.setWidth(qMin(r.right(), sh.width()));
                result.setHeight(sh.height() - (widget->height() - r.height()));
#ifdef CUSTOM_SHADOW
                result.moveTop(result.top() - Ya::VisualUtil::windowShadowSize());
#endif
            }
            return result;
        }
        case SE_TabWidgetTabContents:
#ifdef CUSTOM_SHADOW
            return result.adjusted(Ya::VisualUtil::windowShadowSize() - 4,
                                   Ya::VisualUtil::windowShadowSize() + 2,
                                   -Ya::VisualUtil::windowShadowSize() + 4,
                                   -Ya::VisualUtil::windowShadowSize());
#else
            return result.adjusted(-4, 2, 4, 0);
#endif
        default:
            return result;
        }
    }
Пример #3
0
 // Konstruktor f�r geschachtelte MDI-Fenster                                                                                                                       
 MDIFrame (const IResourceId &r,  IFrameWindow *parent,                                                                                                             
 const char *title = 0,   const IRectangle &rec = IRectangle (),                                                                                                    
 const IFrameWindow::Style &s =  defaultStyle () &~ windowList | alignNoAdjust) :                                                                                   
    IFrameWindow (r, parent->client (), parent->client (),                                                                                                          
    rec == IRectangle () ?   IRectangle (IPoint (), parent->client ()->size ()) : rec, s, title),                                                                   
    Client (0x8008, this, this)                                                                                                                                     
 {                                                                                                                                                                  
     setClient (&Client);                                                                                                                                           
 }                                                                                                                                                                  
Пример #4
0
 ToolButton (unsigned long id, IWindow *parent,                                                                                                    
                                             const IPointerHandle &pict) :                                                                         
         IGraphicPushButton (id, parent, parent, pict,                                                                                             
                 IRectangle (IPoint (), ISize (20, 20)),                                                                                           
                 // verkleinere Grafik falls n�tig                                                                                                 
                 defaultStyle () | sizeToGraphic)                                                                                                  
 // ISetCanvas benutzt Minimumgr��e um Controls zu                                                                                                 
 // Positionieren                                                                                                                                  
 { setMinimumSize (ISize (30, 30)); }                                                                                                              
Пример #5
0
void cutflowTOP12024(){

  gROOT->ProcessLine(".L tdrstyle.C");
  defaultStyle();

 //print("~/public/cutFlow/CSVM/","CSVM");
 //print("TTBB_01Sep2012_CSVT_CutFlow","CSVT");

 print("TTBB_01Sep2012_CSVM","CSVM", true, 0.079, 0.88);
 print("TTBB_01Sep2012_CSVT","CSVT", true, 0.080, 0.93);

}
Пример #6
0
bool MScore::readDefaultStyle(QString file)
      {
      if (file.isEmpty())
            return false;
      MStyle style = defaultStyle();
      QFile f(file);
      if (!f.open(QIODevice::ReadOnly))
            return false;
      bool rv = style.load(&f);
      if (rv)
            setDefaultStyle(style);
      f.close();
      return rv;
      }
Пример #7
0
ALWAYS_INLINE RenderStyle::RenderStyle()
    : m_box(defaultStyle()->m_box)
    , visual(defaultStyle()->visual)
    , m_background(defaultStyle()->m_background)
    , surround(defaultStyle()->surround)
    , rareNonInheritedData(defaultStyle()->rareNonInheritedData)
    , rareInheritedData(defaultStyle()->rareInheritedData)
    , inherited(defaultStyle()->inherited)
{
    setBitDefaults(); // Would it be faster to copy this from the default style?
    COMPILE_ASSERT((sizeof(InheritedFlags) <= 8), InheritedFlags_does_not_grow);
    COMPILE_ASSERT((sizeof(NonInheritedFlags) <= 8), NonInheritedFlags_does_not_grow);
}
Пример #8
0
    int styleHint(StyleHint hint, const QStyleOption* option, const QWidget* widget, QStyleHintReturn* returnData) const
    {
        switch (hint) {
        case SH_TabBar_Alignment:
            return Qt::AlignLeft;
        case SH_TabBar_PreferNoArrows:
            return true;
#ifdef USE_YAMULTILINETABBAR
        case SH_TabBar_SelectMouseType:
            return QEvent::MouseButtonRelease;
#endif
        default:
            break;
        }
        return defaultStyle()->styleHint(hint, option, widget, returnData);
    }
Пример #9
0
void getWeightCSV(){

  gROOT->ProcessLine(".L $CMSSW_BASE/src/KoPFA/CommonTools/macros/tdrstyle.C");
  defaultStyle();

  TString path = "../TTBB_27Apr2013_CSVWeight";
  TFile * f = new TFile(path+"/merged.root");

  double XBins[] = {0.0, 0.05,  0.1, 0.15,  0.2, 0.25, 0.3,0.35, 0.4, 0.45, 0.5, 0.6, 0.7, 0.8,0.9};//8 bins
  int nX = sizeof(XBins)/sizeof(double) - 1;

  double XBins2[] = {0.0,  0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9};//8 bins
  int nX2 = sizeof(XBins2)/sizeof(double) - 1;

  plot(f, "jet1_bDisCSV","csv_first", nX, XBins);
  plot(f, "jet2_bDisCSV","csv_second", nX2, XBins2);

}
//*****************************************************************************
// CLASS  EmployeeType - EmployeeType - constructor
//*****************************************************************************
EmployeeType :: EmployeeType(IWindow* pParent )
              : ISetCanvas(ID_EMPLOYEE_TYPE_GROUP_BOX, pParent, pParent,
                           IRectangle(),
                           defaultStyle() ),
                reg(ID_GEN_REG_BT,  this, this),
                mgr(ID_GEN_MGR_BT,  this, this),
                sup(ID_GEN_SUP_BT,  this, this)
{
   reg.setText(STR_GEN_REG_TEXT);
   mgr.setText(STR_GEN_MGR_TEXT);
   sup.setText(STR_GEN_SUP_TEXT);
   setText(STR_GEN_EMPLOYEE_TYPE_TEXT);

   setDeckOrientation(ISetCanvas::horizontal);

   // a regular employee is the default
   reg.select();
}
Пример #11
0
MStyle* MScore::defaultStyleForParts()
      {
      if (!_defaultStyleForParts) {
            QSettings s;
            QString partStyle = s.value("partStyle").toString();
            if (!partStyle.isEmpty()) {
                  QFile f(partStyle);
                  if (f.open(QIODevice::ReadOnly)) {
                        MStyle* s = new MStyle(*defaultStyle());
                        if (s->load(&f))
                              _defaultStyleForParts = s;
                        else
                              delete s;
                        }
                  }
            }
      return _defaultStyleForParts;
      }
Пример #12
0
void addbcsv(){

  gROOT->ProcessLine(".L $CMSSW_BASE/src/KoPFA/CommonTools/macros/tdrstyle.C");
  defaultStyle();

  TFile * f = new TFile("/afs/cern.ch/work/y/youngjo/public/For8Tev/v20130612_genjet/vallot_TTbarFullLepMGDecays.root");
  TTree * t = (TTree*) f->Get("MuEl/tree");
  
  TH1F * h_bfromtop =  new TH1F("h_bfromtop","h_bfromtop",20,0,1);
  TH1F * h_bnotfromtop =  new TH1F("h_bnotfromtop","h_bnotfromtop",20,0,1);

  t->Project("h_bfromtop","jets_bDiscriminatorCSV","jets_fromtop == 1 && abs(jets_flavor) == 5");
  t->Project("h_bnotfromtop","jets_bDiscriminatorCSV","jets_fromtop == 0 && abs(jets_flavor) == 5");

  h_bfromtop->Scale(1.0/h_bfromtop->Integral());
  h_bnotfromtop->Scale(1.0/h_bnotfromtop->Integral());

  TCanvas * c = new TCanvas("c","c",1);

  h_bfromtop->Draw();
  h_bfromtop->SetStats(0);
  h_bfromtop->SetTitle("");
  h_bfromtop->SetLineColor(2);
  h_bfromtop->SetLineWidth(2);
  h_bnotfromtop->Draw("same");
  h_bnotfromtop->SetLineColor(4);
  h_bnotfromtop->SetLineWidth(2);

  TLegend *l = new TLegend(0.48,0.65,0.58,0.80);
  l->AddEntry(h_bfromtop,"b from top","L");
  l->AddEntry(h_bnotfromtop,"b not from top","L");
  l->SetTextSize(0.04);
  l->SetFillColor(0);
  l->SetLineColor(0);

  l->Draw();

  TLatex *label= new TLatex;
  label->SetNDC();
  label->SetTextSize(0.05);
  label->DrawLatex(0.20,0.82,"CMS Simulation, at #sqrt{s} = 8 TeV");

  c->Print("csvshape_addb.eps");
}
Пример #13
0
void makePlotsCSVWeight(TString noteNumber = "TTBB_27Apr2013_CSVWeight/v1")
{

  gROOT->ProcessLine(".L $CMSSW_BASE/src/KoPFA/CommonTools/macros/tdrstyle.C");
  defaultStyle();

  TString path = "TTBB_27Apr2013_CSVWeight";

  f = TFile::Open(path+"/merged.root");

  outDirName += "/"+noteNumber;
  gSystem->Exec("mkdir "+outDirName);

  cutStepPlots("Step_5", "jet1_bDisCSV", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 100000, false);
  cutStepPlots("Step_5", "jet2_bDisCSV", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 170000, false);
  cutStepPlots("Step_5", "jet1_bDisCSV", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 400000000, true, "log");
  cutStepPlots("Step_5", "jet2_bDisCSV", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 70000000, true, "log");

}
Пример #14
0
void StyleHelper::apply()
{
    Preferences *preferences = Preferences::instance();

    QString desiredStyle;
    QPalette desiredPalette;

    switch (preferences->applicationStyle()) {
    default:
    case Preferences::SystemDefaultStyle:
        desiredStyle = defaultStyle();
        desiredPalette = defaultPalette();
        break;
    case Preferences::FusionStyle:
        desiredStyle = QLatin1String("fusion");
        desiredPalette = createPalette(preferences->baseColor(),
                                       preferences->selectionColor());
        break;
    case Preferences::TiledStyle:
        desiredStyle = QLatin1String("tiled");
        desiredPalette = createPalette(preferences->baseColor(),
                                       preferences->selectionColor());
        break;
    }

    if (QApplication::style()->objectName() != desiredStyle) {
        QStyle *style;

        if (desiredStyle == QLatin1String("tiled")) {
            style = QStyleFactory::create(QLatin1String("fusion"));
            style = new TiledProxyStyle(style);
        } else {
            style = QStyleFactory::create(desiredStyle);
        }

        QApplication::setStyle(style);
    }

    if (QApplication::palette() != desiredPalette)
        QApplication::setPalette(desiredPalette);

    emit styleApplied();
}
Пример #15
0
void TestKoGenStyles::testDefaultStyle()
{
    kDebug() ;
    /* Create a default style,
     * and then an auto style with exactly the same attributes
     * -> the insert gives the default style.
     *
     * Also checks how the default style gets written out to XML.
     */
    KOdfGenericStyles coll;

    KOdfGenericStyle defaultStyle(KOdfGenericStyle::ParagraphStyle, "paragraph");
    defaultStyle.addAttribute("style:master-page-name", "Standard");
    defaultStyle.addProperty("myfont", "isBold");
    defaultStyle.setDefaultStyle(true);
    QString defaultStyleName = coll.insert(defaultStyle);
    // default styles don't get a name
    QVERIFY(defaultStyleName.isEmpty());
    QCOMPARE(defaultStyle.type(), KOdfGenericStyle::ParagraphStyle);
    QVERIFY(defaultStyle.isDefaultStyle());

    KOdfGenericStyle anotherStyle(KOdfGenericStyle::ParagraphStyle, "paragraph");
    anotherStyle.addAttribute("style:master-page-name", "Standard");
    anotherStyle.addProperty("myfont", "isBold");
    QString anotherStyleName = coll.insert(anotherStyle);
    QVERIFY(anotherStyleName != defaultStyleName);

    QCOMPARE(coll.styles().count(), 1);

    // XML for default style
    TEST_BEGIN(0, 0);
    defaultStyle.writeStyle(&writer, coll, "style:default-style", defaultStyleName, "style:paragraph-properties");
    TEST_END_QTTEST("<r>\n <style:default-style style:family=\"paragraph\" style:master-page-name=\"Standard\">\n  <style:paragraph-properties myfont=\"isBold\"/>\n </style:default-style>\n</r>\n");

    // The kcells case: not writing out all properties, only if they differ
    // from the default style.
    // KOdfGenericStyles doesn't fetch info from the parent style when testing
    // for equality, so KCells uses isEmpty() to check for equality-to-parent.
    KOdfGenericStyle dataStyle(KOdfGenericStyle::ParagraphStyle, "paragraph", defaultStyleName);
    QVERIFY(dataStyle.isEmpty());
    // and then it doesn't look up the auto style, but rather uses the parent style directly.
}
Пример #16
0
void makePlots(TString noteNumber = "TTBB_27Apr2013/v1")
{

  gROOT->ProcessLine(".L $CMSSW_BASE/src/KoPFA/CommonTools/macros/tdrstyle.C");
  defaultStyle();

  TString path = "TTBB_27Apr2013";

  f = TFile::Open(path+"/merged.root");

  outDirName += "/"+noteNumber;
  gSystem->Exec("mkdir "+outDirName);

  nExclude = 0;
  cutStepPlots("Step_1", "ZMass", "Dilepton mass" ," Events/5 GeV/c^{2}", "Dilepton Mass (GeV/c^{2})", "LL", 0.1, 10000000, false);
  cutStepPlots("Step_1", "ZMass", "Dilepton mass" ," Events/5 GeV/c^{2}", "Dilepton Mass (GeV/c^{2})", "LL", 0.1, 400000000, true, "log");

  cutStepPlots("Step_3", "nJet", "Jet Multiplicity", "Events", "Jet Multiplicity", "LL", 0.1, 300000, false);
  cutStepPlots("Step_3", "nJet", "Jet Multiplicity", "Events", "Jet Multiplicity", "LL", 0.1, 10000000, true, "log");

  nExclude = 3;
  cutStepPlots("Step_4", "nbJet30_CSVT", "b-Jet Multiplicity (CSVT)", "Events", "b-Jet Multiplicity (CSVT)", "LL", 0.1, 4000, false);
  cutStepPlots("Step_4", "nbJet30_CSVM", "b-Jet Multiplicity (CSVM)", "Events", "b-Jet Multiplicity (CSVM)", "LL", 0.1, 4000, false);
  cutStepPlots("Step_4", "nbJet30_CSVT", "b-Jet Multiplicity (CSVT)", "Events", "b-Jet Multiplicity (CSVT)", "LL", 0.1, 40000, true, "log");
  cutStepPlots("Step_4", "nbJet30_CSVM", "b-Jet Multiplicity (CSVM)", "Events", "b-Jet Multiplicity (CSVM)", "LL", 0.1, 40000, true, "log");

  cutStepPlots("Step_5", "addjet1_bDisCSVnoweight", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 500, false);
  cutStepPlots("Step_5", "addjet2_bDisCSVnoweight", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 800, false);
  cutStepPlots("Step_5", "addjet1_bDisCSVnoweight", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 40000, true, "log");
  cutStepPlots("Step_5", "addjet2_bDisCSVnoweight", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 7000, true, "log");

  cutStepPlots("Step_5", "addjet1_bDisCSV", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 500, false);
  cutStepPlots("Step_5", "addjet2_bDisCSV", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 700, false);
  cutStepPlots("Step_5", "addjet1_bDisCSV", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 40000, true, "log");
  cutStepPlots("Step_5", "addjet2_bDisCSV", "b-Discriminator (CSV)", "Events/0.05", "b-Discriminator (CSV)", "LL", 0.1, 7000, true, "log");

  cutStepPlots("Step_5", "addjet1_bDisCSV_rebin", "b-Discriminator (CSV)", "Events", "b-Discriminator (CSV)", "LL", 0.1, 500, false);
  cutStepPlots("Step_5", "addjet2_bDisCSV_rebin", "b-Discriminator (CSV)", "Events", "b-Discriminator (CSV)", "LL", 0.1, 700, false);
  cutStepPlots("Step_5", "addjet1_bDisCSV_rebin", "b-Discriminator (CSV)", "Events", "b-Discriminator (CSV)", "LL", 0.1, 40000, true, "log");
  cutStepPlots("Step_5", "addjet2_bDisCSV_rebin", "b-Discriminator (CSV)", "Events", "b-Discriminator (CSV)", "LL", 0.1, 7000, true, "log");

}
Пример #17
0
void btagweight(){

  gROOT->ProcessLine(".L tdrstyle.C");
  defaultStyle();

  TString path = "TTbarTuneZ2";

  TFile* f_mm = new TFile(Form("/afs/cern.ch/work/t/tjkim/public/store/top/MuMu/v1/vallot_%s.root",path.Data()));
  TFile* f_ee = new TFile(Form("/afs/cern.ch/work/t/tjkim/public/store/top/ElEl/v1/vallot_%s.root",path.Data()));
  TFile* f_em = new TFile(Form("/afs/cern.ch/work/t/tjkim/public/store/top/MuEl/v1/vallot_%s.root",path.Data()));

  TTree * t_MuMu = (TTree*) f_mm->Get("MuMu/tree");
  TTree * t_ElEl = (TTree*) f_ee->Get("ElEl/tree");
  TTree * t_MuEl = (TTree*) f_em->Get("MuEl/tree");

  TCut cut = "ZMass > 12 && abs(ZMass - 91.2) > 15 && PairSign < 0 && isIso > 0 && MET > 30 && @jetspt30.size() >=4";
  TCut cut_em = "ZMass > 12 && abs(ZMass - 91.2) > 15 && PairSign < 0 && isIso > 0 && @jetspt30.size() >=4";

  TCut visible = "ttbarGen.NJets15() >= 4 && ttbarGen.NbJets15() >=2 && ttbarGen.lepton1().pt() > 20 && ttbarGen.lepton2().pt() > 20 && abs(ttbarGen.lepton1().eta()) < 2.5 && abs(ttbarGen.lepton2().eta()) < 2.5" ;
  TCut sig = "ttbarGen.NbJets15() >= 4";
 
  TH1 * h_nbjets_ttbb_MuMu = new TH1F("h_nbjets_ttbb_MuMu","h_nbjets_ttbb_MuMu",5,0,5);
  TH1 * h_nbjets_ttll_MuMu = new TH1F("h_nbjets_ttll_MuMu","h_nbjets_ttll_MuMu",5,0,5);

  TH1 * h_nbjets_ttbb_ElEl = new TH1F("h_nbjets_ttbb_ElEl","h_nbjets_ttbb_ElEl",5,0,5);
  TH1 * h_nbjets_ttll_ElEl = new TH1F("h_nbjets_ttll_ElEl","h_nbjets_ttll_ElEl",5,0,5);

  TH1 * h_nbjets_ttbb_MuEl = new TH1F("h_nbjets_ttbb_MuEl","h_nbjets_ttbb_MuEl",5,0,5);
  TH1 * h_nbjets_ttll_MuEl = new TH1F("h_nbjets_ttll_MuEl","h_nbjets_ttll_MuEl",5,0,5);

  TH1 * h_nbjets_dwlight_ttbb_MuMu = new TH1F("h_nbjets_dwlight_ttbb_MuMu","h_nbjets_dwlight_ttbb_MuMu",5,0,5);
  TH1 * h_nbjets_dwlight_ttll_MuMu = new TH1F("h_nbjets_dwlight_ttll_MuMu","h_nbjets_dwlight_ttll_MuMu",5,0,5);

  TH1 * h_nbjets_dwlight_ttbb_ElEl = new TH1F("h_nbjets_dwlight_ttbb_ElEl","h_nbjets_dwlight_ttbb_ElEl",5,0,5);
  TH1 * h_nbjets_dwlight_ttll_ElEl = new TH1F("h_nbjets_dwlight_ttll_ElEl","h_nbjets_dwlight_ttll_ElEl",5,0,5);

  TH1 * h_nbjets_dwlight_ttbb_MuEl = new TH1F("h_nbjets_dwlight_ttbb_MuEl","h_nbjets_dwlight_ttbb_MuEl",5,0,5);
  TH1 * h_nbjets_dwlight_ttll_MuEl = new TH1F("h_nbjets_dwlight_ttll_MuEl","h_nbjets_dwlight_ttll_MuEl",5,0,5);

  TH1 * h_nbjets_uplight_ttbb_MuMu = new TH1F("h_nbjets_uplight_ttbb_MuMu","h_nbjets_uplight_ttbb_MuMu",5,0,5);
  TH1 * h_nbjets_uplight_ttll_MuMu = new TH1F("h_nbjets_uplight_ttll_MuMu","h_nbjets_uplight_ttll_MuMu",5,0,5);

  TH1 * h_nbjets_uplight_ttbb_ElEl = new TH1F("h_nbjets_uplight_ttbb_ElEl","h_nbjets_uplight_ttbb_ElEl",5,0,5);
  TH1 * h_nbjets_uplight_ttll_ElEl = new TH1F("h_nbjets_uplight_ttll_ElEl","h_nbjets_uplight_ttll_ElEl",5,0,5);

  TH1 * h_nbjets_uplight_ttbb_MuEl = new TH1F("h_nbjets_uplight_ttbb_MuEl","h_nbjets_uplight_ttbb_MuEl",5,0,5);
  TH1 * h_nbjets_uplight_ttll_MuEl = new TH1F("h_nbjets_uplight_ttll_MuEl","h_nbjets_uplight_ttll_MuEl",5,0,5);

  TH1 * h_nbjets_ttbb = new TH1F("h_nbjets_ttbb","h_nbjets_ttbb",5,0,5);
  TH1 * h_nbjets_ttll = new TH1F("h_nbjets_ttll","h_nbjets_ttll",5,0,5);

  TH1 * h_nbjets_dwlight_ttbb = new TH1F("h_nbjets_dwlight_ttbb","h_nbjets_dwlight_ttbb",5,0,5);
  TH1 * h_nbjets_dwlight_ttll = new TH1F("h_nbjets_dwlight_ttll","h_nbjets_dwlight_ttll",5,0,5);

  TH1 * h_nbjets_uplight_ttbb = new TH1F("h_nbjets_uplight_ttbb","h_nbjets_uplight_ttbb",5,0,5);
  TH1 * h_nbjets_uplight_ttll = new TH1F("h_nbjets_uplight_ttll","h_nbjets_uplight_ttll",5,0,5);


  TCut weight = "puweight*bweight30CSVT";

  t_MuMu->Project("h_nbjets_ttbb_MuMu","nbjets30_CSVT",weight*(visible + sig + cut));
  t_MuMu->Project("h_nbjets_ttll_MuMu","nbjets30_CSVT",weight*(visible + !sig + cut));

  t_ElEl->Project("h_nbjets_ttbb_ElEl","nbjets30_CSVT",weight*(visible + sig + cut));
  t_ElEl->Project("h_nbjets_ttll_ElEl","nbjets30_CSVT",weight*(visible + !sig + cut));

  t_MuEl->Project("h_nbjets_ttbb_MuEl","nbjets30_CSVT",weight*(visible + sig + cut_em));
  t_MuEl->Project("h_nbjets_ttll_MuEl","nbjets30_CSVT",weight*(visible + !sig + cut_em));

  TCut weightdwlight = "puweight*bweight30CSVTdwlight";

  t_MuMu->Project("h_nbjets_dwlight_ttbb_MuMu","nbjets30_CSVT",weightdwlight*(visible + sig + cut));
  t_MuMu->Project("h_nbjets_dwlight_ttll_MuMu","nbjets30_CSVT",weightdwlight*(visible + !sig + cut));

  t_ElEl->Project("h_nbjets_dwlight_ttbb_ElEl","nbjets30_CSVT",weightdwlight*(visible + sig + cut));
  t_ElEl->Project("h_nbjets_dwlight_ttll_ElEl","nbjets30_CSVT",weightdwlight*(visible + !sig + cut));

  t_MuEl->Project("h_nbjets_dwlight_ttbb_MuEl","nbjets30_CSVT",weightdwlight*(visible + sig + cut_em));
  t_MuEl->Project("h_nbjets_dwlight_ttll_MuEl","nbjets30_CSVT",weightdwlight*(visible + !sig + cut_em));

  TCut weightuplight = "puweight*bweight30CSVTuplight";

  t_MuMu->Project("h_nbjets_uplight_ttbb_MuMu","nbjets30_CSVT",weightuplight*(visible + sig + cut));
  t_MuMu->Project("h_nbjets_uplight_ttll_MuMu","nbjets30_CSVT",weightuplight*(visible + !sig + cut));

  t_ElEl->Project("h_nbjets_uplight_ttbb_ElEl","nbjets30_CSVT",weightuplight*(visible + sig + cut));
  t_ElEl->Project("h_nbjets_uplight_ttll_ElEl","nbjets30_CSVT",weightuplight*(visible + !sig + cut));

  t_MuEl->Project("h_nbjets_uplight_ttbb_MuEl","nbjets30_CSVT",weightuplight*(visible + sig + cut_em));
  t_MuEl->Project("h_nbjets_uplight_ttll_MuEl","nbjets30_CSVT",weightuplight*(visible + !sig + cut_em));

  h_nbjets_ttll->Add(h_nbjets_ttll_MuMu);
  h_nbjets_ttll->Add(h_nbjets_ttll_ElEl);
  h_nbjets_ttll->Add(h_nbjets_ttll_MuEl);

  h_nbjets_dwlight_ttll->Add(h_nbjets_dwlight_ttll_MuMu);
  h_nbjets_dwlight_ttll->Add(h_nbjets_dwlight_ttll_ElEl);
  h_nbjets_dwlight_ttll->Add(h_nbjets_dwlight_ttll_MuEl);

  h_nbjets_uplight_ttll->Add(h_nbjets_uplight_ttll_MuMu);
  h_nbjets_uplight_ttll->Add(h_nbjets_uplight_ttll_ElEl);
  h_nbjets_uplight_ttll->Add(h_nbjets_uplight_ttll_MuEl);

  TCanvas * c = new TCanvas("c","c",1);
  h_nbjets_dwlight_ttll->SetLineWidth(2);
  h_nbjets_uplight_ttll->SetLineWidth(2);
  h_nbjets_ttll->SetLineWidth(2);
  h_nbjets_dwlight_ttll->SetLineColor(2);
  h_nbjets_uplight_ttll->SetLineColor(4);
  h_nbjets_uplight_ttll->SetTitle("");
  h_nbjets_uplight_ttll->Draw();
  h_nbjets_dwlight_ttll->Draw("same");
  h_nbjets_ttll->Draw("same");
  debugPrint(h_nbjets_ttll, h_nbjets_dwlight_ttll, h_nbjets_uplight_ttll);

  TLegend *l = new TLegend(0.75,0.62,0.92,0.88);
  l->AddEntry(h_nbjets_uplight_ttll,"tt + ll Up","L");
  l->AddEntry(h_nbjets_ttll,"tt + ll","L");
  l->AddEntry(h_nbjets_dwlight_ttll,"tt + ll Dw","L");

  l->SetTextSize(0.04);
  l->SetFillColor(0);
  l->SetLineColor(0);

  l->Draw();


  c->Print("lightSFvariation_CSVT.eps");

}
Пример #18
0
void Document::processStyles()
{
    kDebug(30513) ;

    const wvWare::StyleSheet& styles = m_parser->styleSheet();
    unsigned int count = styles.size();
    kDebug(30513) << "styles count=" << count;

    //loop through each style
    for (unsigned int i = 0; i < count ; ++i) {
        //grab style
        const wvWare::Style* style = styles.styleByIndex(i);
        Q_ASSERT(style);
        QString displayName = Conversion::string(style->name());
        QString name = Conversion::styleName2QString(style->name());

        // if the invariant style identifier says it's a style used for line numbers
        if (style->sti() == 40) {
            m_lineNumbersStyleName = name;  // store the name of that style
        }

        // Process paragraph styles.
        if (style && style->type() == sgcPara) {
            //create this style & add formatting info to it
            kDebug(30513) << "creating ODT paragraphstyle" << name;
            KoGenStyle userStyle(KoGenStyle::ParagraphStyle, "paragraph");
            userStyle.addAttribute("style:display-name", displayName);

            const wvWare::Style* followingStyle = styles.styleByIndex(style->followingStyle());
            if (followingStyle && followingStyle != style) {
                QString followingName = Conversion::styleName2QString(followingStyle->name());
                userStyle.addAttribute("style:next-style-name", followingName);
            }

            const wvWare::Style* parentStyle = styles.styleByIndex(style->m_std->istdBase);
            if (parentStyle) {
                userStyle.setParentName(Conversion::styleName2QString(parentStyle->name()));
            }

            //set font name in style
            QString fontName = m_textHandler->getFont(style->chp().ftcAscii);
            if (!fontName.isEmpty()) {
                m_mainStyles->insertFontFace(KoFontFace(fontName));
                userStyle.addProperty(QString("style:font-name"), fontName, KoGenStyle::TextType);
            }

            // Process the paragraph and character properties.
            Paragraph::applyParagraphProperties(style->paragraphProperties(), &userStyle, parentStyle, false, 0, 0, QString());
            Paragraph::applyCharacterProperties(&style->chp(), &userStyle, parentStyle, false, false, currentBgColor());

            // Add style to main collection, using the name that it
            // had in the .doc.
            QString actualName = m_mainStyles->insert(userStyle, name, KoGenStyles::DontAddNumberToName);
            kDebug(30513) << "added style " << actualName;

            //save names of TOC related styles
            if (actualName.contains("TOC")) {
                m_tocStyleNames.append(actualName);
            }
        } else if (style && style->type() == sgcChp) {
            //create this style & add formatting info to it
            kDebug(30513) << "creating ODT textstyle" << name;
            KoGenStyle userStyle(KoGenStyle::TextStyle, "text");
            userStyle.addAttribute("style:display-name", displayName);

            const wvWare::Style* parentStyle = styles.styleByIndex(style->m_std->istdBase);
            if (parentStyle) {
                userStyle.setParentName(Conversion::styleName2QString(parentStyle->name()));
            }

            //set font name in style
            QString fontName = m_textHandler->getFont(style->chp().ftcAscii);
            if (!fontName.isEmpty()) {
                m_mainStyles->insertFontFace(KoFontFace(fontName));
                userStyle.addProperty(QString("style:font-name"), fontName, KoGenStyle::TextType);
            }

            // Process the character and paragraph properties.
            Paragraph::applyCharacterProperties(&style->chp(), &userStyle, parentStyle, false, false, currentBgColor());

            //add style to main collection, using the name that it had in the .doc
            QString actualName = m_mainStyles->insert(userStyle, name, KoGenStyles::DontAddNumberToName);
            kDebug(30513) << "added style " << actualName;
        }
    }
    //also create a default style which is needed to store the default tab spacing
    KoGenStyle defaultStyle(KoGenStyle::ParagraphStyle, "paragraph");
    defaultStyle.setDefaultStyle(true);
    defaultStyle.addPropertyPt("style:tab-stop-distance", (qreal)m_parser->dop().dxaTab / 20.0);
    m_mainStyles->insert(defaultStyle, "nevershown");
}
Пример #19
0
 QRect subControlRect(ComplexControl cc, const QStyleOptionComplex* opt, SubControl sc, const QWidget* widget) const
 {
     return defaultStyle()->subControlRect(cc, opt, sc, widget);
 }
Пример #20
0
//using namespace std;
void btagefficiency(int ii, int jj)
{
    gROOT->ProcessLine(".L tdrstyle.C");
    defaultStyle();
    TFile* f1 = new TFile("/afs/cern.ch/work/y/youngjo/public/For8Tev/v20130208_V00-00-06/vallot_TTbarFullLepMGDecays.root");
	
    TTree* treeMuMu = (TTree*)f1->Get("MuMu/tree");
    TTree* treeElEl = (TTree*)f1->Get("ElEl/tree");
    TTree* treeMuEl = (TTree*)f1->Get("MuEl/tree");
	
    float binspt[] = {20,30,40,50,60,70,80,100,120,160,210,260,320,400,450};
    int nBinpt = sizeof(binspt)/sizeof(float) - 1;
    float binseta[] = {0.,0.4,0.8,1.2,1.6,2.0,2.4};
    int nBineta = sizeof(binseta)/sizeof(float) - 1;

    TCut precut_em = "ZMass > 12 && lep1_relIso03 < 0.15 && lep2_relIso03 < 0.15 && PairSign < 0 && nJet30 >= 4";
    TCut precut = precut_em + "abs(ZMass - 91.2) > 15 && MET > 30"; 
    TCut bcut =  "abs(jets_flavor) == 5";
    TCut ccut =  "abs(jets_flavor) == 4";
    TCut lcut =  "abs(jets_flavor) < 4";

    TCut etacut1 = "abs(jets_eta) <= 0.8";
    TCut etacut2 = "abs(jets_eta) > 0.8 && abs(jets_eta) <=1.6";
    TCut etacut3 = "abs(jets_eta) > 1.6";

    TCut etacutl1 = "abs(jets_eta) <= 0.5";
    TCut etacutl2 = "abs(jets_eta) > 0.5 && abs(jets_eta) <=1.0";
    TCut etacutl3 = "abs(jets_eta) > 1.0 && abs(jets_eta) <=1.5";
    TCut etacutl4 = "abs(jets_eta) > 1.5";


    TCut csvl =  "jets_bDiscriminatorCSV > 0.244";
    TCut csvm =  "jets_bDiscriminatorCSV > 0.679";
    TCut csvt =  "jets_bDiscriminatorCSV > 0.898";


    float binsDR[] = {0.5,0.6,0.7,0.8,0.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.2,3.5,4};
    int nBinDR = sizeof(binsDR)/sizeof(float) - 1;
    TString DR_ = "TMath::Sqrt( abs(jets_eta[csvd_jetid[2]]-jets_eta[csvd_jetid[3]])*abs(jets_eta[csvd_jetid[2]]-jets_eta[csvd_jetid[3]])+abs(TVector2::Phi_mpi_pi(jets_phi[csvd_jetid[2]]-jets_phi[csvd_jetid[3]]))*abs(TVector2::Phi_mpi_pi(jets_phi[csvd_jetid[2]]-jets_phi[csvd_jetid[3]])) )";  

    float binsCSV[] = {0.0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.0};
    int nBinCSV = sizeof(binsCSV)/sizeof(float) - 1;
    

 if(ii ==4)
 {
    TH1F* dist_b_csvd = dist(treeElEl, treeMuMu, treeMuEl, "jets_bDiscriminatorCSV", nBinCSV, binsCSV, precut, precut_em, bcut, "B flavor","b_csvd",2,"discriminator (CSV)"); 
    TH1F* dist_c_csvd = dist(treeElEl, treeMuMu, treeMuEl, "jets_bDiscriminatorCSV", nBinCSV, binsCSV, precut, precut_em, ccut, "C flavor","c_csvd",4,"discriminator (CSV)");
    TH1F* dist_l_csvd = dist(treeElEl, treeMuMu, treeMuEl, "jets_bDiscriminatorCSV", nBinCSV, binsCSV, precut, precut_em, lcut, "LF flavor","l_csvd",3,"discriminator (CSV)");

    TCanvas * c_b_csvd = new TCanvas("c_b_csvd","c_b_csvd",500,500);
    double ymax = dist_l_csvd->GetMaximum(); 
    if(ymax< dist_c_csvd->GetMaximum()) ymax=dist_c_csvd->GetMaximum();
    if(ymax< dist_b_csvd->GetMaximum()) ymax=dist_b_csvd->GetMaximum();   

    ymax=ymax*1.5;
    dist_l_csvd->SetMaximum(ymax);   
 
    dist_l_csvd->Draw("");
    dist_c_csvd->Draw("same");
    dist_b_csvd->Draw("same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(dist_b_csvd,"b-flavor","L");
    l->AddEntry(dist_c_csvd,"c-flavor","L");
    l->AddEntry(dist_l_csvd,"l-flavor","L");
    SetLegend(l);
    c_b_csvd->Print("compare_b_csvd.png");
    c_b_csvd->Print("compare_b_csvd.eps");
 }
 else if(ii ==3)
 {
    TH1F* eff_b_dr_CSVL = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, bcut, csvl, "b_dr_CSVL","CSVL",2,"#Delta R"); 
    TH1F* eff_c_dr_CSVL = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, ccut, csvl, "c_dr_CSVL","CSVL",4,"#Delta R");
    TH1F* eff_l_dr_CSVL = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, lcut, csvl, "l_dr_CSVL","CSVL",5,"#Delta R");

    TH1F* eff_b_dr_CSVM = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, bcut, csvm, "b_dr_CSVM","CSVM",2,"#Delta R"); 
    TH1F* eff_b_dr_CSVT = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, bcut, csvt, "b_dr_CSVT","CSVT",2,"#Delta R"); 

    TH1F* eff_c_dr_CSVM = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, ccut, csvm, "c_dr_CSVM","CSVM",4,"#Delta R");
    TH1F* eff_c_dr_CSVT = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, ccut, csvt, "c_dr_CSVT","CSVT",4,"#Delta R");

    TH1F* eff_l_dr_CSVM = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, lcut, csvm, "l_dr_CSVM","CSVM",5,"#Delta R");
    TH1F* eff_l_dr_CSVT = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, lcut, csvt, "l_dr_CSVT","CSVT",5,"#Delta R");

    TCanvas * c_b_dr_CSVL = new TCanvas("c_b_dr_CSVL","c_b_dr_CSVL",500,500);
    eff_b_dr_CSVL->Draw("e3");
    eff_c_dr_CSVL->Draw("e3 same");
    eff_l_dr_CSVL->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_dr_CSVL,"b-flavor","F");
    l->AddEntry(eff_c_dr_CSVL,"c-flavor","F");
    l->AddEntry(eff_l_dr_CSVL,"l-flavor","F");
    SetLegend(l);
    c_b_dr_CSVL->Print("compare_b_dr_CSVL.png");
    c_b_dr_CSVL->Print("compare_b_dr_CSVL.eps");


    TCanvas * c_b_dr_CSVM = new TCanvas("c_b_dr_CSVM","c_b_dr_CSVM",500,500);
    eff_b_dr_CSVM->Draw("e3");
    eff_c_dr_CSVM->Draw("e3 same");
    eff_l_dr_CSVM->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_dr_CSVM,"b-flavor","F");
    l->AddEntry(eff_c_dr_CSVM,"c-flavor","F");
    l->AddEntry(eff_l_dr_CSVM,"l-flavor","F");
    SetLegend(l);
    c_b_dr_CSVM->Print("compare_b_dr_CSVM.png");
    c_b_dr_CSVM->Print("compare_b_dr_CSVM.eps");

    TCanvas * c_b_dr_CSVT = new TCanvas("c_b_dr_CSVT","c_b_dr_CSVT",500,500);
    eff_b_dr_CSVT->Draw("e3");
    eff_c_dr_CSVT->Draw("e3 same");
    eff_l_dr_CSVT->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_dr_CSVT,"b-flavor","F");
    l->AddEntry(eff_c_dr_CSVT,"c-flavor","F");
    l->AddEntry(eff_l_dr_CSVT,"l-flavor","F");
    SetLegend(l);
    c_b_dr_CSVT->Print("compare_b_dr_CSVT.png");
    c_b_dr_CSVT->Print("compare_b_dr_CSVT.eps");

 }
 else if(ii ==0)
 {

    TH1F* eff_b_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, bcut, csvl, "b_pt_CSVL","CSVL",2,"p_{T}(GeV/c)"); 
    TH1F* eff_c_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, ccut, csvl, "c_pt_CSVL","CSVL",4,"p_{T}(GeV/c)");
    TH1F* eff_l_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut, csvl, "l_pt_CSVL","CSVL",5,"p_{T}(GeV/c)");

    TH1F* eff_b_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, bcut, csvm, "b_pt_CSVM","CSVM",2,"p_{T}(GeV/c)"); 
    TH1F* eff_b_pt_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, bcut, csvt, "b_pt_CSVT","CSVT",2,"p_{T}(GeV/c)"); 

    TH1F* eff_c_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, ccut, csvm, "c_pt_CSVM","CSVM",4,"p_{T}(GeV/c)");
    TH1F* eff_c_pt_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, ccut, csvt, "c_pt_CSVT","CSVT",4,"p_{T}(GeV/c)");

    TH1F* eff_l_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut, csvm, "l_pt_CSVM","CSVM",5,"p_{T}(GeV/c)");
    TH1F* eff_l_pt_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut, csvt, "l_pt_CSVT","CSVT",5,"p_{T}(GeV/c)");

    TCanvas * c_b_pt_CSVL = new TCanvas("c_b_pt_CSVL","c_b_pt_CSVL",500,500);
    eff_b_pt_CSVL->Draw("e3");
    eff_c_pt_CSVL->Draw("e3 same");
    eff_l_pt_CSVL->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_pt_CSVL,"b-flavor","F");
    l->AddEntry(eff_c_pt_CSVL,"c-flavor","F");
    l->AddEntry(eff_l_pt_CSVL,"l-flavor","F");
    SetLegend(l);
    c_b_pt_CSVL->Print("compare_b_pt_CSVL.png");
    c_b_pt_CSVL->Print("compare_b_pt_CSVL.eps");


    TCanvas * c_b_pt_CSVM = new TCanvas("c_b_pt_CSVM","c_b_pt_CSVM",500,500);
    eff_b_pt_CSVM->Draw("e3");
    eff_c_pt_CSVM->Draw("e3 same");
    eff_l_pt_CSVM->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_pt_CSVM,"b-flavor","F");
    l->AddEntry(eff_c_pt_CSVM,"c-flavor","F");
    l->AddEntry(eff_l_pt_CSVM,"l-flavor","F");
    SetLegend(l);
    c_b_pt_CSVM->Print("compare_b_pt_CSVM.png");
    c_b_pt_CSVM->Print("compare_b_pt_CSVM.eps");

    TCanvas * c_b_pt_CSVT = new TCanvas("c_b_pt_CSVT","c_b_pt_CSVT",500,500);
    eff_b_pt_CSVT->Draw("e3");
    eff_c_pt_CSVT->Draw("e3 same");
    eff_l_pt_CSVT->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_pt_CSVT,"b-flavor","F");
    l->AddEntry(eff_c_pt_CSVT,"c-flavor","F");
    l->AddEntry(eff_l_pt_CSVT,"l-flavor","F");
    SetLegend(l);
    c_b_pt_CSVT->Print("compare_b_pt_CSVT.png");
    c_b_pt_CSVT->Print("compare_b_pt_CSVT.eps");


 }
 else if(ii==2)
 {
    if(jj==0)
    {
        TH1F* eff_l1_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacutl1, csvl, "l1_pt_CSVL","CSVL",2,"p_{T}(GeV/c)"); 
        TH1F* eff_l2_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacutl2, csvl, "l2_pt_CSVL","CSVL",3,"p_{T}(GeV/c)");
        TH1F* eff_l3_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacutl3, csvl, "l3_pt_CSVL","CSVL",4,"p_{T}(GeV/c)");
        TH1F* eff_l4_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacutl4, csvl, "l4_pt_CSVL","CSVL",5,"p_{T}(GeV/c)");
        
        TCanvas * c_l3_pt_CSVL = new TCanvas("c_b_pt_CSVL","c_b_pt_CSVL",500,500);
        eff_l1_pt_CSVL->SetMaximum(0.4);
        eff_l1_pt_CSVL->Draw("e3");
        eff_l2_pt_CSVL->Draw("e3 same");
        eff_l3_pt_CSVL->Draw("e3 same");
        eff_l4_pt_CSVL->Draw("e3 same");
        
        TLegend *l = new TLegend(0.42,0.76,0.89,0.87);
        l->AddEntry(eff_l1_pt_CSVL,"l-flavor  #eta #leq 0.5","F");
        l->AddEntry(eff_l2_pt_CSVL,"l-flavor 0.5 < #eta #leq 1.0","F");
        l->AddEntry(eff_l3_pt_CSVL,"l-flavor 1.0 < #eta #leq 1.5","F");
        l->AddEntry(eff_l4_pt_CSVL,"l-flavor 1.5 < #eta","F");
        SetLegend(l);
        c_l3_pt_CSVL->Print("compare_l4_pt_CSVL.png");
        c_l3_pt_CSVL->Print("compare_l4_pt_CSVL.eps");
    }
    else if(jj==1)
    {
        TH1F* eff_l1_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacut1, csvm, "l1_pt_CSVM","CSVM",2,"p_{T}(GeV/c)"); 
        TH1F* eff_l2_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacut2, csvm, "l2_pt_CSVM","CSVM",4,"p_{T}(GeV/c)");
        TH1F* eff_l3_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacut3, csvm, "l3_pt_CSVM","CSVM",5,"p_{T}(GeV/c)");
        
        TCanvas * c_l3_pt_CSVM = new TCanvas("c_b_pt_CSVM","c_b_pt_CSVM",500,500);
        eff_l1_pt_CSVM->SetMaximum(0.1);
        eff_l1_pt_CSVM->Draw("e3");
        eff_l2_pt_CSVM->Draw("e3 same");
        eff_l3_pt_CSVM->Draw("e3 same");
        
        TLegend *l = new TLegend(0.42,0.76,0.89,0.87);
        l->AddEntry(eff_l1_pt_CSVM,"l-flavor #eta #leq 0.8","F");
        l->AddEntry(eff_l2_pt_CSVM,"l-flavor 0.8 < #eta #leq 1.6","F");
        l->AddEntry(eff_l3_pt_CSVM,"l-flavor 1.6 < #eta","F");
        SetLegend(l);
        c_l3_pt_CSVM->Print("compare_l3_pt_CSVM.png");
        c_l3_pt_CSVM->Print("compare_l3_pt_CSVM.eps");
    }
 }
 else if(ii==1)
 {
    TH1F* eff_b_eta_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, bcut, csvl, "b_eta_CSVL","CSVL",2, "#eta"); 
    TH1F* eff_c_eta_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, ccut, csvl, "c_eta_CSVL","CSVL",4, "#eta");
    TH1F* eff_l_eta_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, lcut, csvl, "l_eta_CSVL","CSVL",5, "#eta");

    TH1F* eff_b_eta_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, bcut, csvm, "b_eta_CSVM","CSVM",2, "#eta"); 
    TH1F* eff_b_eta_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, bcut, csvt, "b_eta_CSVT","CSVT",2, "#eta"); 

    TH1F* eff_c_eta_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, ccut, csvm, "c_eta_CSVM","CSVM",4, "#eta");
    TH1F* eff_c_eta_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, ccut, csvt, "c_eta_CSVT","CSVT",4, "#eta");

    TH1F* eff_l_eta_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, lcut, csvm, "l_eta_CSVM","CSVM",5, "#eta");
    TH1F* eff_l_eta_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, lcut, csvt, "l_eta_CSVT","CSVT",5, "#eta");

    TCanvas * c_b_eta_CSVL = new TCanvas("c_b_eta_CSVL","c_b_eta_CSVL",500,500);
    eff_b_eta_CSVL->Draw("e3");
    eff_c_eta_CSVL->Draw("e3 same");
    eff_l_eta_CSVL->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_eta_CSVL,"b-flavor","F");
    l->AddEntry(eff_c_eta_CSVL,"c-flavor","F");
    l->AddEntry(eff_l_eta_CSVL,"l-flavor","F");
    SetLegend(l);
    c_b_eta_CSVL->Print("compare_b_eta_CSVL.png");
    c_b_eta_CSVL->Print("compare_b_eta_CSVL.eps");


    TCanvas * c_b_eta_CSVM = new TCanvas("c_b_eta_CSVM","c_b_eta_CSVM",500,500);
    eff_b_eta_CSVM->Draw("e3");
    eff_c_eta_CSVM->Draw("e3 same");
    eff_l_eta_CSVM->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_eta_CSVM,"b-flavor","F");
    l->AddEntry(eff_c_eta_CSVM,"c-flavor","F");
    l->AddEntry(eff_l_eta_CSVM,"l-flavor","F");
    SetLegend(l);
    c_b_eta_CSVM->Print("compare_b_eta_CSVM.png");
    c_b_eta_CSVM->Print("compare_b_eta_CSVM.eps");

    TCanvas * c_b_eta_CSVT = new TCanvas("c_b_eta_CSVT","c_b_eta_CSVT",500,500);
    eff_b_eta_CSVT->Draw("e3");
    eff_c_eta_CSVT->Draw("e3 same");
    eff_l_eta_CSVT->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_eta_CSVT,"b-flavor","F");
    l->AddEntry(eff_c_eta_CSVT,"c-flavor","F");
    l->AddEntry(eff_l_eta_CSVT,"l-flavor","F");
    SetLegend(l);
    c_b_eta_CSVT->Print("compare_b_eta_CSVT.png");
    c_b_eta_CSVT->Print("compare_b_eta_CSVT.eps");
  }

}
Пример #21
0
 void drawComplexControl(ComplexControl cc, const QStyleOptionComplex* opt, QPainter* p, const QWidget* widget) const
 {
     defaultStyle()->drawComplexControl(cc, opt, p, widget);
 }
Пример #22
0
 void drawPrimitive(PrimitiveElement pe, const QStyleOption* opt, QPainter* p, const QWidget* w) const
 {
     defaultStyle()->drawPrimitive(pe, opt, p, w);
 }
Пример #23
0
 void drawControl(ControlElement ce, const QStyleOption* opt, QPainter* p, const QWidget* w) const
 {
     defaultStyle()->drawControl(ce, opt, p, w);
 }
Пример #24
0
void merge(){
	TFile* fMuMu = new TFile("resultMuMuntag3.root");
	TFile* fElEl = new TFile("resultElElntag3.root");
	TFile* fMuEl = new TFile("resultMuElntag3.root");
	
    gROOT->ProcessLine(".L ../tdrstyle.C");
    defaultStyle();
	
	TH1F* h_jet1_ttbb_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet1_ttbb_ntag3_MuMu"); 
	TH1F* h_jet2_ttbb_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet2_ttbb_ntag3_MuMu"); 
	TH1F* h_jet3_ttbb_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet3_ttbb_ntag3_MuMu"); 
	TH1F* h_jet4_ttbb_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet4_ttbb_ntag3_MuMu"); 
	TH1F* h_jet1_ttbb_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet1_ttbb_ntag3_ElEl"); 
	TH1F* h_jet2_ttbb_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet2_ttbb_ntag3_ElEl"); 
	TH1F* h_jet3_ttbb_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet3_ttbb_ntag3_ElEl"); 
	TH1F* h_jet4_ttbb_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet4_ttbb_ntag3_ElEl"); 
	TH1F* h_jet1_ttbb_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet1_ttbb_ntag3_MuEl"); 
	TH1F* h_jet2_ttbb_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet2_ttbb_ntag3_MuEl"); 
	TH1F* h_jet3_ttbb_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet3_ttbb_ntag3_MuEl"); 
	TH1F* h_jet4_ttbb_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet4_ttbb_ntag3_MuEl");
	
	TH1F* h_jet1_ttjj_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet1_ttjj_ntag3_MuMu"); 
	TH1F* h_jet2_ttjj_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet2_ttjj_ntag3_MuMu"); 
	TH1F* h_jet3_ttjj_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet3_ttjj_ntag3_MuMu"); 
	TH1F* h_jet4_ttjj_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet4_ttjj_ntag3_MuMu"); 
	TH1F* h_jet1_ttjj_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet1_ttjj_ntag3_ElEl"); 
	TH1F* h_jet2_ttjj_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet2_ttjj_ntag3_ElEl"); 
	TH1F* h_jet3_ttjj_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet3_ttjj_ntag3_ElEl"); 
	TH1F* h_jet4_ttjj_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet4_ttjj_ntag3_ElEl"); 
	TH1F* h_jet1_ttjj_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet1_ttjj_ntag3_MuEl"); 
	TH1F* h_jet2_ttjj_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet2_ttjj_ntag3_MuEl"); 
	TH1F* h_jet3_ttjj_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet3_ttjj_ntag3_MuEl"); 
	TH1F* h_jet4_ttjj_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet4_ttjj_ntag3_MuEl");
	
	TCanvas* can1 = new TCanvas("can1","leading jet",1200,1200);
	TCanvas* can2 = new TCanvas("can2","second leading jet",1200,1200);
	TCanvas* can3 = new TCanvas("can3","third leading jet",1200,1200);
	TCanvas* can4 = new TCanvas("can4","fourth leading jet",1200,1200);
	
	can1->cd();
	h_jet1_ttbb_ntag3_MuMu->Add(h_jet1_ttbb_ntag3_ElEl);
	h_jet1_ttbb_ntag3_MuMu->Add(h_jet1_ttbb_ntag3_MuEl);
	h_jet1_ttbb_ntag3_MuMu->Scale(1.0/(h_jet1_ttbb_ntag3_MuMu->Integral()+h_jet1_ttbb_ntag3_ElEl->Integral()+h_jet1_ttbb_ntag3_MuEl->Integral()));
	h_jet1_ttjj_ntag3_MuMu->Add(h_jet1_ttjj_ntag3_ElEl);
	h_jet1_ttjj_ntag3_MuMu->Add(h_jet1_ttjj_ntag3_MuEl);
	h_jet1_ttjj_ntag3_MuMu->Scale(1.0/(h_jet1_ttjj_ntag3_MuMu->Integral()+h_jet1_ttjj_ntag3_ElEl->Integral()+h_jet1_ttjj_ntag3_MuEl->Integral()));
	h_jet1_ttbb_ntag3_MuMu->Draw();
	h_jet1_ttjj_ntag3_MuMu->Draw("same");
	h_jet1_ttbb_ntag3_MuMu->SetTitle("leading jet pt distibution");
	h_jet1_ttbb_ntag3_MuMu->SetStats(0);
	h_jet1_ttbb_ntag3_MuMu->SetMaximum(0.3);
	h_jet1_ttbb_ntag3_MuMu->GetXaxis()->SetTitle("Jet p_{T} (GeV)");
	h_jet1_ttbb_ntag3_MuMu->GetYaxis()->SetTitle("Normalized Entries");
  	SetLegend(h_jet1_ttbb_ntag3_MuMu, h_jet1_ttjj_ntag3_MuMu);
	can2->cd();
	h_jet2_ttbb_ntag3_MuMu->Add(h_jet2_ttbb_ntag3_ElEl);
	h_jet2_ttbb_ntag3_MuMu->Add(h_jet2_ttbb_ntag3_MuEl);
	h_jet2_ttbb_ntag3_MuMu->Scale(1.0/(h_jet2_ttbb_ntag3_MuMu->Integral()+h_jet2_ttbb_ntag3_ElEl->Integral()+h_jet2_ttbb_ntag3_MuEl->Integral()));
	h_jet2_ttjj_ntag3_MuMu->Add(h_jet2_ttjj_ntag3_ElEl);
	h_jet2_ttjj_ntag3_MuMu->Add(h_jet2_ttjj_ntag3_MuEl);
	h_jet2_ttjj_ntag3_MuMu->Scale(1.0/(h_jet2_ttjj_ntag3_MuMu->Integral()+h_jet2_ttjj_ntag3_ElEl->Integral()+h_jet2_ttjj_ntag3_MuEl->Integral()));
	h_jet2_ttbb_ntag3_MuMu->Draw();
	h_jet2_ttjj_ntag3_MuMu->Draw("same");
	h_jet2_ttbb_ntag3_MuMu->SetStats(0);
	h_jet2_ttbb_ntag3_MuMu->SetMaximum(0.3);
	h_jet2_ttbb_ntag3_MuMu->SetTitle("second leading jet pt distibution");
	h_jet2_ttbb_ntag3_MuMu->GetXaxis()->SetTitle("Jet p_{T} (GeV)");
	h_jet2_ttbb_ntag3_MuMu->GetYaxis()->SetTitle("Normalized Entries");
  	SetLegend(h_jet2_ttbb_ntag3_MuMu, h_jet2_ttjj_ntag3_MuMu);
	can3->cd();
	h_jet3_ttbb_ntag3_MuMu->Add(h_jet3_ttbb_ntag3_ElEl);
	h_jet3_ttbb_ntag3_MuMu->Add(h_jet3_ttbb_ntag3_MuEl);
	h_jet3_ttbb_ntag3_MuMu->Scale(1.0/(h_jet3_ttbb_ntag3_MuMu->Integral()+h_jet3_ttbb_ntag3_ElEl->Integral()+h_jet3_ttbb_ntag3_MuEl->Integral()));
	h_jet3_ttjj_ntag3_MuMu->Add(h_jet3_ttjj_ntag3_ElEl);
	h_jet3_ttjj_ntag3_MuMu->Add(h_jet3_ttjj_ntag3_MuEl);
	h_jet3_ttjj_ntag3_MuMu->Scale(1.0/(h_jet3_ttjj_ntag3_MuMu->Integral()+h_jet3_ttjj_ntag3_ElEl->Integral()+h_jet3_ttjj_ntag3_MuEl->Integral()));
	h_jet3_ttbb_ntag3_MuMu->Draw();
	h_jet3_ttjj_ntag3_MuMu->Draw("same");
	h_jet3_ttbb_ntag3_MuMu->SetStats(0);
	h_jet3_ttbb_ntag3_MuMu->SetMaximum(0.3);
	h_jet3_ttbb_ntag3_MuMu->SetTitle("third leading jet pt distibution");
	h_jet3_ttbb_ntag3_MuMu->GetXaxis()->SetTitle("Jet p_{T} (GeV)");
	h_jet3_ttbb_ntag3_MuMu->GetYaxis()->SetTitle("Normalized Entries");
  	SetLegend(h_jet3_ttbb_ntag3_MuMu, h_jet3_ttjj_ntag3_MuMu);
	can4->cd();
	h_jet4_ttbb_ntag3_MuMu->Add(h_jet4_ttbb_ntag3_ElEl);
	h_jet4_ttbb_ntag3_MuMu->Add(h_jet4_ttbb_ntag3_MuEl);
	h_jet4_ttbb_ntag3_MuMu->Scale(1.0/(h_jet4_ttbb_ntag3_MuMu->Integral()+h_jet4_ttbb_ntag3_ElEl->Integral()+h_jet4_ttbb_ntag3_MuEl->Integral()));
	h_jet4_ttjj_ntag3_MuMu->Add(h_jet4_ttjj_ntag3_ElEl);
	h_jet4_ttjj_ntag3_MuMu->Add(h_jet4_ttjj_ntag3_MuEl);
	h_jet4_ttjj_ntag3_MuMu->Scale(1.0/(h_jet4_ttjj_ntag3_MuMu->Integral()+h_jet4_ttjj_ntag3_ElEl->Integral()+h_jet4_ttjj_ntag3_MuEl->Integral()));
	h_jet4_ttbb_ntag3_MuMu->Draw();
	h_jet4_ttjj_ntag3_MuMu->Draw("same");
	h_jet4_ttbb_ntag3_MuMu->SetStats(0);
	h_jet4_ttbb_ntag3_MuMu->SetMaximum(0.3);
	h_jet4_ttbb_ntag3_MuMu->SetTitle("fourth leading jet pt distibution");
	h_jet4_ttbb_ntag3_MuMu->GetXaxis()->SetTitle("Jet p_{T} (GeV)");
	h_jet4_ttbb_ntag3_MuMu->GetYaxis()->SetTitle("Normalized Entries");
  	SetLegend(h_jet4_ttbb_ntag3_MuMu, h_jet4_ttjj_ntag3_MuMu);
	
}
Пример #25
0
bool StyleReader::startElement(const QString&, const QString&, const QString &name, const QXmlAttributes &attrs) 
{
	if (name == "style:default-style")
		defaultStyle(attrs);
	else if (name == "style:paragraph-properties" ||
	         name == "style:text-properties" || 
	         name == "style:list-level-properties")
		styleProperties(attrs);
	else if (name == "style:style")
		styleStyle(attrs);
	else if (name == "style:tab-stop")
		tabStop(attrs);
	else if (name == "text:list-style")
	{
		for (int i = 0; i < attrs.count(); ++i)
			if (attrs.localName(i) == "style:name")
				currentList = attrs.value(i);
		currentListStyle = new ListStyle(currentList);
		inList = true;
	}
	else if (((name == "text:list-level-style-bullet") ||
	          (name == "text:list-level-style-number") ||
	          (name == "text:list-level-style-image")) && (inList))
	{
		BulletType bstyle = Bullet;
		QString prefix = "";
		QString suffix = "";
		QString bullet = "-";
		uint ulevel = 0;
		uint displayLevels = 1;
		uint startAt = 0;
		QString level = "";
		for (int i = 0; i < attrs.count(); ++i)
		{
			if (attrs.localName(i) == "text:level")
			{
				ulevel = QString(attrs.value(i)).toUInt();
				gtStyle *plist;
				if (attrs.value(i) == "1")
				{
					plist = listParents[currentList];
				}
				else
				{
					int level = (attrs.value(i)).toInt();
					--level;
					plist = styles[QString(currentList + "_%1").arg(level)]; 
				}
				gtParagraphStyle *pstyle;
				if (plist == NULL)
				{
					if (styles.contains("default-style"))
						plist = new gtStyle(*(styles["default-style"]));
					else
					{
						gtParagraphStyle* pstyle = new gtParagraphStyle(*(writer->getDefaultStyle()));
						pstyle->setDefaultStyle(true);
						plist = dynamic_cast<gtStyle*>(pstyle);
					}
				}

				if (plist->target() == "paragraph")
				{
					pstyle = dynamic_cast<gtParagraphStyle*>(plist);
					assert(pstyle != NULL);
					gtParagraphStyle* tmp = new gtParagraphStyle(*pstyle);
					currentStyle = tmp;
				}
				else
				{
					gtParagraphStyle* tmp = new gtParagraphStyle(*plist);
					currentStyle = tmp;
				}
				currentStyle->setName(currentList + "_" + attrs.value(i));
			}
			else if (attrs.localName(i) == "style:num-prefix")
				prefix = attrs.value(i);
			else if (attrs.localName(i) == "style:num-suffix")
				suffix = attrs.value(i);
			else if (attrs.localName(i) == "text:bullet-char")
				bullet = attrs.value(i);
			else if (attrs.localName(i) == "style:num-format") {
				QString tmp = attrs.value(i);
				if (tmp == "i")
					bstyle = LowerRoman;
				else if (tmp == "I")
					bstyle = UpperRoman;
				else if (tmp == "a")
					bstyle = LowerAlpha;
				else if (tmp == "A")
					bstyle = UpperAlpha;
				else if (tmp == "1")
					bstyle = Number;
			}
			else if (attrs.localName(i) == "text:start-value") {
				startAt = QString(attrs.value(i)).toUInt();
				if (startAt > 0)
					--startAt;
			}
			else if (attrs.localName(i) == "text:display-levels") {
				displayLevels = QString(attrs.value(i)).toUInt();
				if (displayLevels == 0)
					displayLevels = 1;
			}
		}
		if (bstyle == Bullet) {
			prefix = "";
			suffix = "";
		}
		ListLevel *llevel = new ListLevel(ulevel, bstyle, prefix, suffix, bullet, displayLevels, startAt);
		currentListStyle->addLevel(ulevel, llevel);
		readProperties = true;

		gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle);
		assert(s != NULL);
		if (bstyle == Bullet || bstyle == Graphic)
		{
			s->setBullet(true, bullet);
		}
		else
		{
			Q_ASSERT(((int) bstyle > 0) && ((int) bstyle < 6));
			s->setNum(true, (int) bstyle -1, ulevel, startAt+1, prefix, suffix);
		}
	}
	else if ((name == "style:drop-cap") && (readProperties))
	{
		if (currentStyle->target() == "paragraph")
		{
			for (int i = 0; i < attrs.count(); ++i)
			{
				if (attrs.localName(i) == "style:lines")
				{
					bool ok = false;
					QString sd = attrs.value(i);
					int dh = sd.toInt(&ok);
					if (ok)
					{
						gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle);
						assert(s != NULL);
						s->setDropCapHeight(dh);
						s->setDropCap(true);
					}
				}
			}
		}
	}
	else if (name == "style:font-face")
	{
		QString key = "";
		QString family = "";
		QString style = "";
		for (int i = 0; i < attrs.count(); ++i)
		{
			if (attrs.localName(i) == "style:name")
				key = attrs.value(i);
			else if (attrs.localName(i) == "svg:font-family")
			{
				family = attrs.value(i);
				family = family.remove("'");
			}
			else if (attrs.localName(i) == "style:font-style-name")
				style += attrs.value(i) + " ";
		}
		QString name = family + " " + style;
		name = name.simplified();
		fonts[key] = name;
	}
	return true;
}
Пример #26
0
 QSize sizeFromContents(ContentsType ct, const QStyleOption* opt, const QSize& contentsSize, const QWidget* w) const
 {
     return defaultStyle()->sizeFromContents(ct, opt, contentsSize, w);
 }
Пример #27
0
 SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex* opt, const QPoint& pos, const QWidget* widget) const
 {
     return defaultStyle()->hitTestComplexControl(cc, opt, pos, widget);
 }
Пример #28
0
 void unpolish(QWidget* widget)
 {
     defaultStyle()->unpolish(widget);
 }
Пример #29
0
void LatexLexer::styleText(int start,int end)
{
    // Ajouter support verbatim
    // Colorier les erreurs de syntaxe
    if (!editor())
        return;

    char *lineChars = new char[end - start+1];
    editor()->SendScintilla(QsciScintilla::SCI_GETTEXTRANGE, start, end, lineChars);
    QString source = QString(lineChars);
    free(lineChars);

    startStyling(start,0xFF);
    QStringList list=source.split('\n');
    int lineIndex=editor()->SendScintilla(QsciScintilla::SCI_LINEFROMPOSITION, start);

    int style=Default,nextStyle=Default;
    if(lineIndex>0){
        int pos = editor()->SendScintilla(QsciScintilla::SCI_GETLINEENDPOSITION, lineIndex-1 );
        if(pos>0){
            int s = editor()->SendScintilla(QsciScintilla::SCI_GETSTYLEAT, pos);
            if(s==MathInline || s==MathDisplay || s==Environment){
                style=s;
                nextStyle=s;
            }
        }
    }

    int level=QsciScintilla::SC_FOLDLEVELBASE;
    if(lineIndex>0){
        QString previousLine = getLine(lineIndex-1);
        level=(editor()->SendScintilla(QsciScintilla::SCI_GETFOLDLEVEL,lineIndex-1)&QsciScintilla::SC_FOLDLEVELNUMBERMASK)+getDiffLevel(previousLine);
    }

    int nbCharsToStyle;
    int styleBeforeMathDisplay=Default,styleBeforeMathInline=Default,styleInBrace=Default,styleBeforeBrace=Default;
    for (int i = 0; i < list.size(); i++) {
        QString line=list.at(i);
        int lineLength=line.size();
        if(style!=MathInline && style!=MathDisplay && style!=Environment){
            style=Default;
            nextStyle=Default;
        }
        int j=0;
        while(j<lineLength){
            QString l=line.mid(j);
            if(l.startsWith("\\%")){
                nbCharsToStyle=2;
                nextStyle=style;
                style=Command;
            }
            else if(l.startsWith("%")){
                nbCharsToStyle=lineLength-j;
                style=Comment;
                nextStyle=Comment;
            }
            else if(l.startsWith("\\[")){
                nbCharsToStyle=2;
                styleBeforeMathDisplay=style;
                style=Command;
                nextStyle=MathDisplay;
            }
            else if(l.startsWith("\\]")){
                nbCharsToStyle=2;
                style=Command;
                nextStyle=styleBeforeMathDisplay;
            }
            else if(l.startsWith("\\(")){
                nbCharsToStyle=2;
                styleBeforeMathInline=style;
                style=Command;
                nextStyle=MathInline;
            }
            else if(l.startsWith("\\)")){
                nbCharsToStyle=2;
                style=Command;
                nextStyle=styleBeforeMathInline;
            }
            else if(l.startsWith("\\$") || l.startsWith("\\{") || l.startsWith("\\}")){
                nbCharsToStyle=2;
                nextStyle=style;
                style=Command;
            }
            else if(l.startsWith("\\")){
                nbCharsToStyle=1;
                nextStyle=style;
                while(nbCharsToStyle<l.size() && l.at(nbCharsToStyle).isLetter()){
                    nbCharsToStyle++;
                }
                QString s=l.left(nbCharsToStyle);
                if(s=="\\begin" || s=="\\end"){
                    styleInBrace=Environment;
                }
                else if(s=="\\part"){
                    styleInBrace=Part;
                }
                else if(s=="\\chapter"){
                    styleInBrace=Chapter;
                }
                else if(s=="\\section"){
                    styleInBrace=Section;
                }
                else if(s=="\\subsection"){
                    styleInBrace=SubSection;
                }
                else if(s=="\\subsubsection"){
                    styleInBrace=SubSubSection;
                }
                else if(s=="\\paragraph"){
                    styleInBrace=Paragraph;
                }
                else if(s=="\\subparagraph"){
                    styleInBrace=SubParagraph;
                }
                style=Command;
            }
            else if(l.startsWith("$")){
                nbCharsToStyle=1;
                if(style==MathInline){
                    nextStyle=styleBeforeMathInline;
                }
                else{
                    styleBeforeMathInline=style;
                    nextStyle=MathInline;
                }
                style=SpecialChar;
            }
            else if(l.at(0).isDigit()){
                bool isNumber=true;
                nbCharsToStyle=1;
                nextStyle=style;
                while(isNumber && nbCharsToStyle<l.size()){
                    nbCharsToStyle++;
                    l.left(nbCharsToStyle).toFloat(&isNumber);
                }
                if(!isNumber){
                    nbCharsToStyle--;
                }
                style=Digit;
            }
            else if(l.startsWith("(")||l.startsWith(")")||l.startsWith("[")||l.startsWith("]")||l.startsWith("&")||l.startsWith("#")){
                nbCharsToStyle=1;
                nextStyle=style;
                style=SpecialChar;
            }
            else if(l.startsWith("{")){
                nbCharsToStyle=1;
                styleBeforeBrace=style;
                nextStyle=styleInBrace;
                style=SpecialChar;
            }
            else if(l.startsWith("}")){
                nbCharsToStyle=1;
                nextStyle=styleBeforeBrace;
                style=SpecialChar;
                styleInBrace=Default;
            }
            else{
                nbCharsToStyle=1;
                if(l.at(0)!=' '){
                    styleInBrace=style;
                }
            }
            setStyling(nbCharsToStyle,defaultStyle(style));
            style=nextStyle;
            j+=nbCharsToStyle;

        }
        setStyling(1,defaultStyle(style));


        QString s=trimComment(line);
        if(s.contains("\\part")){
            level=2000;

        }
        else if(s.contains("\\chapter")){
            level=2001;

        }
        else if(s.contains("\\section")){
            level=2002;

        }
        else if(s.contains("\\subsection")){
            level=2003;

        }
        else if(s.contains("\\subsubsection")){
            level=2004;

        }
        else if(s.contains("\\paragraph")){
            level=2005;

        }
        else if(s.contains("\\subparagraph")){
            level=2006;

        }
        if(isHeaderLine(s)){
            editor()->SendScintilla(QsciScintilla::SCI_SETFOLDLEVEL,lineIndex,level|QsciScintilla::SC_FOLDLEVELHEADERFLAG);
        }
        /*
        else if(line.trimmed().isEmpty()){
            editor()->SendScintilla(QsciScintilla::SCI_SETFOLDLEVEL,lineIndex,level|QsciScintilla::SC_FOLDLEVELWHITEFLAG);
        }
        */
        else{
            editor()->SendScintilla(QsciScintilla::SCI_SETFOLDLEVEL,lineIndex,level);

        }
        level+=getDiffLevel(s);

        lineIndex++;
    }
}