void BandSlider::setMinimum(int min)
{
    QSlider::setMinimum(min);
    setStyle();
}
BandSlider::BandSlider(QWidget *parent) : QSlider(parent)
{
    setStyle();
}
void BandSlider::setMaximum(int max)
{
    QSlider::setMaximum(max);
    setStyle();
}
bool QgsComposerLegend::readXML( const QDomElement& itemElem, const QDomDocument& doc )
{
  if ( itemElem.isNull() )
  {
    return false;
  }

  //read general properties
  mSettings.setTitle( itemElem.attribute( "title" ) );
  if ( !itemElem.attribute( "titleAlignment" ).isEmpty() )
  {
    mSettings.setTitleAlignment(( Qt::AlignmentFlag )itemElem.attribute( "titleAlignment" ).toInt() );
  }
  int colCount = itemElem.attribute( "columnCount", "1" ).toInt();
  if ( colCount < 1 ) colCount = 1;
  mSettings.setColumnCount( colCount );
  mSettings.setSplitLayer( itemElem.attribute( "splitLayer", "0" ).toInt() == 1 );
  mSettings.setEqualColumnWidth( itemElem.attribute( "equalColumnWidth", "0" ).toInt() == 1 );

  QDomNodeList stylesNodeList = itemElem.elementsByTagName( "styles" );
  if ( stylesNodeList.size() > 0 )
  {
    QDomNode stylesNode = stylesNodeList.at( 0 );
    for ( int i = 0; i < stylesNode.childNodes().size(); i++ )
    {
      QDomElement styleElem = stylesNode.childNodes().at( i ).toElement();
      QgsComposerLegendStyle style;
      style.readXML( styleElem, doc );
      QString name = styleElem.attribute( "name" );
      QgsComposerLegendStyle::Style s;
      if ( name == "title" ) s = QgsComposerLegendStyle::Title;
      else if ( name == "group" ) s = QgsComposerLegendStyle::Group;
      else if ( name == "subgroup" ) s = QgsComposerLegendStyle::Subgroup;
      else if ( name == "symbol" ) s = QgsComposerLegendStyle::Symbol;
      else if ( name == "symbolLabel" ) s = QgsComposerLegendStyle::SymbolLabel;
      else continue;
      setStyle( s, style );
    }
  }

  //font color
  QColor fontClr;
  fontClr.setNamedColor( itemElem.attribute( "fontColor", "#000000" ) );
  mSettings.setFontColor( fontClr );

  //spaces
  mSettings.setBoxSpace( itemElem.attribute( "boxSpace", "2.0" ).toDouble() );
  mSettings.setColumnSpace( itemElem.attribute( "columnSpace", "2.0" ).toDouble() );

  mSettings.setSymbolSize( QSizeF( itemElem.attribute( "symbolWidth", "7.0" ).toDouble(), itemElem.attribute( "symbolHeight", "14.0" ).toDouble() ) );
  mSettings.setWmsLegendSize( QSizeF( itemElem.attribute( "wmsLegendWidth", "50" ).toDouble(), itemElem.attribute( "wmsLegendHeight", "25" ).toDouble() ) );

  mSettings.setWrapChar( itemElem.attribute( "wrapChar" ) );

  //composer map
  mLegendFilterByMap = itemElem.attribute( "legendFilterByMap", "0" ).toInt();
  if ( !itemElem.attribute( "map" ).isEmpty() )
  {
    setComposerMap( mComposition->getComposerMapById( itemElem.attribute( "map" ).toInt() ) );
  }

  QDomElement oldLegendModelElem = itemElem.firstChildElement( "Model" );
  if ( !oldLegendModelElem.isNull() )
  {
    // QGIS <= 2.4
    QgsLayerTreeGroup* nodeRoot = new QgsLayerTreeGroup();
    _readOldLegendGroup( oldLegendModelElem, nodeRoot );
    setCustomLayerTree( nodeRoot );
  }
  else
  {
    // QGIS >= 2.6
    QDomElement layerTreeElem = itemElem.firstChildElement( "layer-tree-group" );
    setCustomLayerTree( QgsLayerTreeGroup::readXML( layerTreeElem ) );
  }

  //restore general composer item properties
  QDomNodeList composerItemList = itemElem.elementsByTagName( "ComposerItem" );
  if ( composerItemList.size() > 0 )
  {
    QDomElement composerItemElem = composerItemList.at( 0 ).toElement();
    _readXML( composerItemElem, doc );
  }

  // < 2.0 projects backward compatibility >>>>>
  //title font
  QString titleFontString = itemElem.attribute( "titleFont" );
  if ( !titleFontString.isEmpty() )
  {
    rstyle( QgsComposerLegendStyle::Title ).rfont().fromString( titleFontString );
  }
  //group font
  QString groupFontString = itemElem.attribute( "groupFont" );
  if ( !groupFontString.isEmpty() )
  {
    rstyle( QgsComposerLegendStyle::Group ).rfont().fromString( groupFontString );
  }

  //layer font
  QString layerFontString = itemElem.attribute( "layerFont" );
  if ( !layerFontString.isEmpty() )
  {
    rstyle( QgsComposerLegendStyle::Subgroup ).rfont().fromString( layerFontString );
  }
  //item font
  QString itemFontString = itemElem.attribute( "itemFont" );
  if ( !itemFontString.isEmpty() )
  {
    rstyle( QgsComposerLegendStyle::SymbolLabel ).rfont().fromString( itemFontString );
  }

  if ( !itemElem.attribute( "groupSpace" ).isEmpty() )
  {
    rstyle( QgsComposerLegendStyle::Group ).setMargin( QgsComposerLegendStyle::Top, itemElem.attribute( "groupSpace", "3.0" ).toDouble() );
  }
  if ( !itemElem.attribute( "layerSpace" ).isEmpty() )
  {
    rstyle( QgsComposerLegendStyle::Subgroup ).setMargin( QgsComposerLegendStyle::Top, itemElem.attribute( "layerSpace", "3.0" ).toDouble() );
  }
  if ( !itemElem.attribute( "symbolSpace" ).isEmpty() )
  {
    rstyle( QgsComposerLegendStyle::Symbol ).setMargin( QgsComposerLegendStyle::Top, itemElem.attribute( "symbolSpace", "2.0" ).toDouble() );
    rstyle( QgsComposerLegendStyle::SymbolLabel ).setMargin( QgsComposerLegendStyle::Top, itemElem.attribute( "symbolSpace", "2.0" ).toDouble() );
  }
  // <<<<<<< < 2.0 projects backward compatibility

  emit itemChanged();
  return true;
}
bool QgsComposerLegend::readXml( const QDomElement &itemElem, const QDomDocument &doc )
{
  if ( itemElem.isNull() )
  {
    return false;
  }

  //read general properties
  mTitle = itemElem.attribute( QStringLiteral( "title" ) );
  mSettings.setTitle( mTitle );
  if ( !itemElem.attribute( QStringLiteral( "titleAlignment" ) ).isEmpty() )
  {
    mSettings.setTitleAlignment( static_cast< Qt::AlignmentFlag >( itemElem.attribute( QStringLiteral( "titleAlignment" ) ).toInt() ) );
  }
  int colCount = itemElem.attribute( QStringLiteral( "columnCount" ), QStringLiteral( "1" ) ).toInt();
  if ( colCount < 1 ) colCount = 1;
  mColumnCount = colCount;
  mSettings.setColumnCount( mColumnCount );
  mSettings.setSplitLayer( itemElem.attribute( QStringLiteral( "splitLayer" ), QStringLiteral( "0" ) ).toInt() == 1 );
  mSettings.setEqualColumnWidth( itemElem.attribute( QStringLiteral( "equalColumnWidth" ), QStringLiteral( "0" ) ).toInt() == 1 );

  QDomNodeList stylesNodeList = itemElem.elementsByTagName( QStringLiteral( "styles" ) );
  if ( !stylesNodeList.isEmpty() )
  {
    QDomNode stylesNode = stylesNodeList.at( 0 );
    for ( int i = 0; i < stylesNode.childNodes().size(); i++ )
    {
      QDomElement styleElem = stylesNode.childNodes().at( i ).toElement();
      QgsLegendStyle style;
      style.readXml( styleElem, doc );
      QString name = styleElem.attribute( QStringLiteral( "name" ) );
      QgsLegendStyle::Style s;
      if ( name == QLatin1String( "title" ) ) s = QgsLegendStyle::Title;
      else if ( name == QLatin1String( "group" ) ) s = QgsLegendStyle::Group;
      else if ( name == QLatin1String( "subgroup" ) ) s = QgsLegendStyle::Subgroup;
      else if ( name == QLatin1String( "symbol" ) ) s = QgsLegendStyle::Symbol;
      else if ( name == QLatin1String( "symbolLabel" ) ) s = QgsLegendStyle::SymbolLabel;
      else continue;
      setStyle( s, style );
    }
  }

  //font color
  QColor fontClr;
  fontClr.setNamedColor( itemElem.attribute( QStringLiteral( "fontColor" ), QStringLiteral( "#000000" ) ) );
  mSettings.setFontColor( fontClr );

  //spaces
  mSettings.setBoxSpace( itemElem.attribute( QStringLiteral( "boxSpace" ), QStringLiteral( "2.0" ) ).toDouble() );
  mSettings.setColumnSpace( itemElem.attribute( QStringLiteral( "columnSpace" ), QStringLiteral( "2.0" ) ).toDouble() );

  mSettings.setSymbolSize( QSizeF( itemElem.attribute( QStringLiteral( "symbolWidth" ), QStringLiteral( "7.0" ) ).toDouble(), itemElem.attribute( QStringLiteral( "symbolHeight" ), QStringLiteral( "14.0" ) ).toDouble() ) );
  mSettings.setWmsLegendSize( QSizeF( itemElem.attribute( QStringLiteral( "wmsLegendWidth" ), QStringLiteral( "50" ) ).toDouble(), itemElem.attribute( QStringLiteral( "wmsLegendHeight" ), QStringLiteral( "25" ) ).toDouble() ) );
  mSettings.setLineSpacing( itemElem.attribute( QStringLiteral( "lineSpacing" ), "1.0" ).toDouble() );

  mSettings.setDrawRasterStroke( itemElem.attribute( QStringLiteral( "rasterBorder" ), QStringLiteral( "1" ) ) != QLatin1String( "0" ) );
  mSettings.setRasterStrokeColor( QgsSymbolLayerUtils::decodeColor( itemElem.attribute( QStringLiteral( "rasterBorderColor" ), QStringLiteral( "0,0,0" ) ) ) );
  mSettings.setRasterStrokeWidth( itemElem.attribute( QStringLiteral( "rasterBorderWidth" ), QStringLiteral( "0" ) ).toDouble() );

  mSettings.setWrapChar( itemElem.attribute( QStringLiteral( "wrapChar" ) ) );

  mSizeToContents = itemElem.attribute( QStringLiteral( "resizeToContents" ), QStringLiteral( "1" ) ) != QLatin1String( "0" );

  //composer map
  mLegendFilterByMap = itemElem.attribute( QStringLiteral( "legendFilterByMap" ), QStringLiteral( "0" ) ).toInt();
  if ( !itemElem.attribute( QStringLiteral( "map" ) ).isEmpty() )
  {
    setComposerMap( mComposition->getComposerMapById( itemElem.attribute( QStringLiteral( "map" ) ).toInt() ) );
  }

  // QGIS >= 2.6
  QDomElement layerTreeElem = itemElem.firstChildElement( QStringLiteral( "layer-tree" ) );
  if ( layerTreeElem.isNull() )
    layerTreeElem = itemElem.firstChildElement( QStringLiteral( "layer-tree-group" ) );

  setCustomLayerTree( QgsLayerTree::readXml( layerTreeElem ) );

  //restore general composer item properties
  QDomNodeList composerItemList = itemElem.elementsByTagName( QStringLiteral( "ComposerItem" ) );
  if ( !composerItemList.isEmpty() )
  {
    QDomElement composerItemElem = composerItemList.at( 0 ).toElement();
    _readXml( composerItemElem, doc );
  }

  // < 2.0 projects backward compatibility >>>>>
  //title font
  QString titleFontString = itemElem.attribute( QStringLiteral( "titleFont" ) );
  if ( !titleFontString.isEmpty() )
  {
    rstyle( QgsLegendStyle::Title ).rfont().fromString( titleFontString );
  }
  //group font
  QString groupFontString = itemElem.attribute( QStringLiteral( "groupFont" ) );
  if ( !groupFontString.isEmpty() )
  {
    rstyle( QgsLegendStyle::Group ).rfont().fromString( groupFontString );
  }

  //layer font
  QString layerFontString = itemElem.attribute( QStringLiteral( "layerFont" ) );
  if ( !layerFontString.isEmpty() )
  {
    rstyle( QgsLegendStyle::Subgroup ).rfont().fromString( layerFontString );
  }
  //item font
  QString itemFontString = itemElem.attribute( QStringLiteral( "itemFont" ) );
  if ( !itemFontString.isEmpty() )
  {
    rstyle( QgsLegendStyle::SymbolLabel ).rfont().fromString( itemFontString );
  }

  if ( !itemElem.attribute( QStringLiteral( "groupSpace" ) ).isEmpty() )
  {
    rstyle( QgsLegendStyle::Group ).setMargin( QgsLegendStyle::Top, itemElem.attribute( QStringLiteral( "groupSpace" ), QStringLiteral( "3.0" ) ).toDouble() );
  }
  if ( !itemElem.attribute( QStringLiteral( "layerSpace" ) ).isEmpty() )
  {
    rstyle( QgsLegendStyle::Subgroup ).setMargin( QgsLegendStyle::Top, itemElem.attribute( QStringLiteral( "layerSpace" ), QStringLiteral( "3.0" ) ).toDouble() );
  }
  if ( !itemElem.attribute( QStringLiteral( "symbolSpace" ) ).isEmpty() )
  {
    rstyle( QgsLegendStyle::Symbol ).setMargin( QgsLegendStyle::Top, itemElem.attribute( QStringLiteral( "symbolSpace" ), QStringLiteral( "2.0" ) ).toDouble() );
    rstyle( QgsLegendStyle::SymbolLabel ).setMargin( QgsLegendStyle::Top, itemElem.attribute( QStringLiteral( "symbolSpace" ), QStringLiteral( "2.0" ) ).toDouble() );
  }
  // <<<<<<< < 2.0 projects backward compatibility

  emit itemChanged();
  return true;
}
bool LLGAnalysis::Init() {
    
    gROOT->ProcessLine(".L Loader.C+");
    gROOT->ProcessLine("#include <vector>");
    gSystem->Load("Loader_C.so");
    setStyle(1.0,true,0.15);
   
    _inputTree = new TChain(_inputTreeName.c_str());
    for( vector<string>::iterator itr = _inputFileNames.begin(); itr != _inputFileNames.end(); ++itr ) {
        _inputTree -> Add( (*itr).c_str() );  
    }

    // create the histograms and add them to the list
    makeHist( "MET_allEvents", 50, 0., 2000., "MET [GeV]", "Number of Events" );
    makeHist( "MET_HLT_PFMET170_NoiseCleaned_v1", 50, 0., 2000., "MET [GeV]", "Number of Events" );
    makeHist( "jet1_pt_allEvents", 50, 0., 1000., "Leading Jet p_{T} [GeV]", "Number of Events");
    makeHist( "jet1_pt_HLT_PFJet260_v1", 50, 0., 1000., "Leading Jet p_{T} [GeV]", "Number of Events");

    // allocate memory for all the variables
    recoJet_pt = new vector<double>;
    recoJet_phi = new vector<double>;
    recoJet_eta = new vector<double>;
    recoJet_btag_combinedInclusiveSecondaryVertexV2BJetTags = new vector<double>;
    recoJet_vertex_x = new vector<double>;
    recoJet_vertex_y = new vector<double>;
    recoJet_vertex_z = new vector<double>;

    muon_px = new vector<double>;
    muon_py = new vector<double>;
    muon_pz = new vector<double>;
    muon_phi = new vector<double>;
    muon_eta = new vector<double>;
    muon_iso = new vector<double>;
    muon_isTightMuon = new vector<bool>;
    muon_isLooseMuon = new vector<bool>;
    
    electron_px = new vector<double>;
    electron_py = new vector<double>;
    electron_pz = new vector<double>;
    electron_phi = new vector<double>;
    electron_eta = new vector<double>;
    electron_iso = new vector<double>;
    electron_isVeto = new vector<bool>;
    electron_isLoose = new vector<bool>;
    electron_isMedium = new vector<bool>;
    electron_isTight = new vector<bool>;
    electron_isHEEP = new vector<bool>;

    triggerBits = new vector<int>;
    triggerNames = new vector<string>;
    /* 
    recoJet_constVertex_x = new vector<vector<double> >;
    recoJet_constVertex_y = new vector<vector<double> >;
    recoJet_constVertex_z = new vector<vector<double> >;
    recoJet_const_pt = new vector<vector<double> >;
    recoJet_const_closestVertex_dxy = new vector<vector<double> >;
    recoJet_const_closestVertex_dz = new vector<vector<double> >;
    recoJet_const_closestVertex_d = new vector<vector<double> >;
    recoJet_const_charge = new vector<vector<int> >;
    */
    recoJet_isLeptonLike = new vector<bool>;
    vertex_x = new vector<double>;
    vertex_y = new vector<double>;
    vertex_z = new vector<double>;
    vertex_dx = new vector<double>;
    vertex_dy = new vector<double>;
    vertex_dz = new vector<double>;
    vertex_nTracks = new vector<double>;
    vertex_pt = new vector<double>;
    vertex_ndof = new vector<double>;
    secVertex_x = new vector<double>;
    secVertex_y = new vector<double>;
    secVertex_z = new vector<double>;
    secVertex_dx = new vector<double>;
    secVertex_dy = new vector<double>;
    secVertex_dz = new vector<double>;
    secVertex_pt = new vector<double>;
    secVertex_ndof = new vector<double>;
    
    // and set the branch addresses
    _inputTree->SetBranchAddress("RecoMuon_px", &muon_px );
    _inputTree->SetBranchAddress("RecoMuon_py", &muon_py );
    _inputTree->SetBranchAddress("RecoMuon_pz", &muon_pz );
    _inputTree->SetBranchAddress("RecoMuon_eta", &muon_eta );
    _inputTree->SetBranchAddress("RecoMuon_phi", &muon_phi );
    _inputTree->SetBranchAddress("RecoMuon_iso", &muon_iso );
    _inputTree->SetBranchAddress("RecoMuon_isLooseMuon", &muon_isLooseMuon );
    _inputTree->SetBranchAddress("RecoMuon_isTightMuon", &muon_isTightMuon );
    _inputTree->SetBranchAddress("RecoElectron_px", &electron_px );
    _inputTree->SetBranchAddress("RecoElectron_py", &electron_py );
    _inputTree->SetBranchAddress("RecoElectron_pz", &electron_pz );
    _inputTree->SetBranchAddress("RecoElectron_eta", &electron_eta );
    _inputTree->SetBranchAddress("RecoElectron_phi", &electron_phi );
    _inputTree->SetBranchAddress("RecoElectron_iso", &electron_iso );
    _inputTree->SetBranchAddress("RecoElectron_isVeto", &electron_isVeto );
    _inputTree->SetBranchAddress("RecoElectron_isLoose", &electron_isLoose );
    _inputTree->SetBranchAddress("RecoElectron_isMedium", &electron_isMedium );
    _inputTree->SetBranchAddress("RecoElectron_isTight", &electron_isTight );
    _inputTree->SetBranchAddress("RecoElectron_isHEEP", &electron_isHEEP );
    _inputTree->SetBranchAddress("TriggerNames", &triggerNames );
    _inputTree->SetBranchAddress("TriggerBits", &triggerBits );
    _inputTree->SetBranchAddress("RecoJet_pt", &recoJet_pt );
    _inputTree->SetBranchAddress("RecoJet_eta", &recoJet_eta );
    _inputTree->SetBranchAddress("RecoJet_phi", &recoJet_phi );
    _inputTree->SetBranchAddress("RecoJet_btag_pfCombinedInclusiveSecondaryVertexV2BJetTags", &recoJet_btag_combinedInclusiveSecondaryVertexV2BJetTags );
    _inputTree->SetBranchAddress("RecoJet_btag_pfJetBProbabilityBJetTags", &recoJet_btag_jetBProbabilityBJetTags );
    _inputTree->SetBranchAddress("RecoJet_btag_pfJetProbabilityBJetTags", &recoJet_btag_jetProbabilityBJetTags );
    _inputTree->SetBranchAddress("RecoJet_btag_pfTrackCountingHighPurBJetTags", &recoJet_btag_trackCountingHighPurBJetTags );
    _inputTree->SetBranchAddress("RecoJet_btag_pfTrackCountingHighEffBJetTags", &recoJet_btag_trackCountingHighEffBJetTags );
    _inputTree->SetBranchAddress("RecoJet_Vertex_x", &recoJet_vertex_x );
    _inputTree->SetBranchAddress("RecoJet_Vertex_y", &recoJet_vertex_y );
    _inputTree->SetBranchAddress("RecoJet_Vertex_z", &recoJet_vertex_z );
    /*
    _inputTree->SetBranchAddress("RecoJet_constVertex_x", &recoJet_constVertex_x );
    _inputTree->SetBranchAddress("RecoJet_constVertex_y", &recoJet_constVertex_y );
    _inputTree->SetBranchAddress("RecoJet_constVertex_z", &recoJet_constVertex_z );
    _inputTree->SetBranchAddress("RecoJet_const_pt", &recoJet_const_pt );
    _inputTree->SetBranchAddress("RecoJet_const_charge", &recoJet_const_charge );
    _inputTree->SetBranchAddress("RecoJet_const_closestVertex_dxy", &recoJet_const_closestVertex_dxy );
    _inputTree->SetBranchAddress("RecoJet_const_closestVertex_dz", &recoJet_const_closestVertex_dz );
    _inputTree->SetBranchAddress("RecoJet_const_closestVertex_d", &recoJet_const_closestVertex_d );
    */
    _inputTree->SetBranchAddress("RecoVertex_x", &vertex_x );
    _inputTree->SetBranchAddress("RecoVertex_y", &vertex_y );
    _inputTree->SetBranchAddress("RecoVertex_z", &vertex_z );
    _inputTree->SetBranchAddress("RecoVertex_xError", &vertex_dx );
    _inputTree->SetBranchAddress("RecoVertex_yError", &vertex_dy );
    _inputTree->SetBranchAddress("RecoVertex_zError", &vertex_dz );
    _inputTree->SetBranchAddress("RecoVertex_nTracks", &vertex_nTracks );
    _inputTree->SetBranchAddress("RecoVertex_pt", &vertex_pt );
    _inputTree->SetBranchAddress("RecoVertex_ndof", &vertex_ndof );
    _inputTree->SetBranchAddress("RecoSecVertex_x", &secVertex_x );
    _inputTree->SetBranchAddress("RecoSecVertex_y", &secVertex_y );
    _inputTree->SetBranchAddress("RecoSecVertex_z", &secVertex_z );
    _inputTree->SetBranchAddress("RecoSecVertex_xError", &secVertex_dx );
    _inputTree->SetBranchAddress("RecoSecVertex_yError", &secVertex_dy );
    _inputTree->SetBranchAddress("RecoSecVertex_zError", &secVertex_dz );
    _inputTree->SetBranchAddress("RecoSecVertex_pt", &secVertex_pt );
    _inputTree->SetBranchAddress("RecoSecVertex_ndof", &secVertex_ndof );
    _inputTree->SetBranchAddress("MET", &met );
    _inputTree->SetBranchAddress("MET_x", &met_x );
    _inputTree->SetBranchAddress("MET_y", &met_y );
    
    _outputTree->Branch("RecoMuon_px", &muon_px );
    _outputTree->Branch("RecoMuon_py", &muon_py );
    _outputTree->Branch("RecoMuon_pz", &muon_pz );
    _outputTree->Branch("RecoMuon_eta", &muon_eta );
    _outputTree->Branch("RecoMuon_phi", &muon_phi );
    _outputTree->Branch("RecoMuon_iso", &muon_iso );
    _outputTree->Branch("RecoMuon_isLooseMuon", &muon_isLooseMuon );
    _outputTree->Branch("RecoMuon_isTightMuon", &muon_isTightMuon );
    _outputTree->Branch("RecoElectron_px", &electron_px );
    _outputTree->Branch("RecoElectron_py", &electron_py );
    _outputTree->Branch("RecoElectron_pz", &electron_pz );
    _outputTree->Branch("RecoElectron_eta", &electron_eta );
    _outputTree->Branch("RecoElectron_phi", &electron_phi );
    _outputTree->Branch("RecoElectron_iso", &electron_iso );
    _outputTree->Branch("RecoElectron_isVeto", &electron_isVeto );
    _outputTree->Branch("RecoElectron_isLoose", &electron_isLoose );
    _outputTree->Branch("RecoElectron_isMedium", &electron_isMedium );
    _outputTree->Branch("RecoElectron_isTight", &electron_isTight );
    _outputTree->Branch("RecoElectron_isHEEP", &electron_isHEEP );
    _outputTree->Branch("TriggerNames", &triggerNames );
    _outputTree->Branch("TriggerBits", &triggerBits );
    _outputTree->Branch("RecoJet_pt", &recoJet_pt );
    _outputTree->Branch("RecoJet_eta", &recoJet_eta );
    _outputTree->Branch("RecoJet_phi", &recoJet_phi );
    _outputTree->Branch("RecoJet_btag_combinedInclusiveSecondaryVertexV2BJetTags", &recoJet_btag_combinedInclusiveSecondaryVertexV2BJetTags );
    _outputTree->Branch("RecoJet_btag_jetBProbabilityBJetTags", &recoJet_btag_jetBProbabilityBJetTags );
    _outputTree->Branch("RecoJet_btag_jetProbabilityBJetTags", &recoJet_btag_jetProbabilityBJetTags );
    _outputTree->Branch("RecoJet_btag_trackCountingHighPurBJetTags", &recoJet_btag_trackCountingHighPurBJetTags );
    _outputTree->Branch("RecoJet_btag_trackCountingHighEffBJetTags", &recoJet_btag_trackCountingHighEffBJetTags );
    /*
    _outputTree->Branch("RecoJet_constVertex_x", &recoJet_constVertex_x );
    _outputTree->Branch("RecoJet_constVertex_y", &recoJet_constVertex_y );
    _outputTree->Branch("RecoJet_constVertex_z", &recoJet_constVertex_z );
    _outputTree->Branch("RecoJet_const_pt", &recoJet_const_pt );
    _outputTree->Branch("RecoJet_const_charge", &recoJet_const_charge );
    _outputTree->Branch("RecoJet_const_closestVertex_dxy", &recoJet_const_closestVertex_dxy );
    _outputTree->Branch("RecoJet_const_closestVertex_dz", &recoJet_const_closestVertex_dz );
    _outputTree->Branch("RecoJet_const_closestVertex_d", &recoJet_const_closestVertex_d );
    */
    _outputTree->Branch("RecoVertex_x", &vertex_x );
    _outputTree->Branch("RecoVertex_y", &vertex_y );
    _outputTree->Branch("RecoVertex_z", &vertex_z );
    _outputTree->Branch("RecoVertex_dx", &vertex_dx );
    _outputTree->Branch("RecoVertex_dy", &vertex_dy );
    _outputTree->Branch("RecoVertex_dz", &vertex_dz );
    _outputTree->Branch("RecoVertex_nTracks", &vertex_nTracks );
    _outputTree->Branch("RecoVertex_pt", &vertex_pt );
    _outputTree->Branch("RecoVertex_ndof", &vertex_ndof );
    _outputTree->Branch("RecoSecVertex_x", &secVertex_x );
    _outputTree->Branch("RecoSecVertex_y", &secVertex_y );
    _outputTree->Branch("RecoSecVertex_z", &secVertex_z );
    _outputTree->Branch("RecoSecVertex_pt", &secVertex_pt );
    _outputTree->Branch("RecoSecVertex_ndof", &secVertex_ndof );
    _outputTree->Branch("RecoSecVertex_dx", &secVertex_dx );
    _outputTree->Branch("RecoSecVertex_dy", &secVertex_dy );
    _outputTree->Branch("RecoSecVertex_dz", &secVertex_dz );
    _outputTree->Branch("MET", &met );
    _outputTree->Branch("MET_x", &met_x );
    _outputTree->Branch("MET_y", &met_y );
  

    // crate eps, png and pdf in the end
    //_plotFormats.push_back(".eps");
    //_plotFormats.push_back(".png");
    //_plotFormats.push_back(".pdf");

    // finally set the style
    setStyle();

    return true;
}
Exemple #7
0
ATCMbutton::ATCMbutton(QWidget * parent):
    QPushButton(parent)
{
    m_pagename = "";
    m_remember = true;
    m_status = STATUS_ENABLED;
    m_CtIndex = -1;
    m_CtVisibilityIndex = -1;
    m_CtPasswordVarIndex = -1;
    m_text = "";
    m_text_press = "";
    m_icon = QIcon();
    m_icon_press = QIcon();
    m_visibilityvar = "";
    m_passwordVar = "";
    m_passwordValue = "";
    m_viewstatus = false;
    m_statuspressval = 1;
    m_statusreleaseval = 0;
    m_justchanged = 0;
    m_forcedAction = false;
    m_statusactualval = m_statusreleaseval;

    m_bgcolor = BG_COLOR_SEL_DEF;
    m_bgcolor_press = BG_COLOR_SEL_DEF;
    m_fontcolor = FONT_COLOR_DEF;
    m_fontcolor_press = FONT_COLOR_SEL_DEF;
    m_bordercolor = BORDER_COLOR_DEF;
    m_bordercolor_press = BORDER_COLOR_SEL_DEF;
    m_borderwidth = BORDER_WIDTH_DEF;
    m_borderradius = BORDER_RADIUS_DEF;

    //setMinimumSize(QSize(150,50));
    setFocusPolicy(Qt::NoFocus);
    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    setFlat(true);
    setStyle(new ATCMStyle);
#ifdef TARGET_ARM
    setToolTip("");
#endif

    /*
     * put there a default stylesheet
     */
    setStyleSheet(
            #ifndef ENABLE_STYLESHEET
                ""
            #else
                "/* property into normal status */\n"
                "QPushButton {\n"
                "    /* set the border width and color  */\n"
                "    /*border:2px solid black;*/\n"
                "    /* set the border radius */\n"
                "    /*border-radius:4px;*/\n"
                "    /* set the background image */\n"
                "    /*background-image: url();*/\n"
                "    /* set the image */\n"
                "    /*image: url();*/\n"
                "    /* set the icon image */\n"
                "    /*qproperty-icon: url();*/\n"
                "    /* set the icon image size */\n"
                "    /*qproperty-iconSize: 24px;*/\n"
                "    /* set the background color */\n"
                "    /*background-color: rgb(230, 230, 230);*/\n"
                "    /* set the text at normal status */\n"
                "    /*qproperty-text: \"text\";*/\n"
                "    /* set the font color */\n"
                "    /*color: black;*/\n"
                "}\n"
                "/* property into pressed status */\n"
                "QPushButton:pressed {\n"
                "    /* set the background color */\n"
                "    /*background-color: rgb(230, 230, 130);*/\n"
                "    /* set the border width and color  */\n"
                "    /*border:2px solid black;*/\n"
                "    /* set the border radius */\n"
                "    /*border-radius:4px;*/\n"
                "    /* set the text at pressed status */\n"
                "    /*qproperty-text: \"text pressed\";*/\n"
                "    /* set the font color */\n"
                "    /*color: black;*/\n"
                "    /* set the background image */\n"
                "    /*background-image: url();*/\n"
                "    /* set the image */\n"
                "    /*image: url();*/\n"
                "    /* set the icon image */\n"
                "    /*qproperty-icon: url();*/\n"
                "    /* set the icon image size */\n"
                "    /*qproperty-iconSize: 24px;*/\n"
                "}\n"
                "/* property into checked status */\n"
                "QPushButton:checked {\n"
                "    /* set the background color */\n"
                "    /*background-color: rgb(130, 130, 130);*/\n"
                "    /* set the border width and color  */\n"
                "    /*border:2px solid black;*/\n"
                "    /* set the border radius */\n"
                "    /*border-radius:4px;*/\n"
                "    /* set the text at cecked status */\n"
                "    /*qproperty-text: \"text checked\";*/\n"
                "    /* set the font color */\n"
                "    /*color: black;*/\n"
                "    /* set the background image */\n"
                "    /*background-image: url();*/\n"
                "    /* set the image */\n"
                "    /*image: url();*/\n"
                "    /* set the icon image */\n"
                "    /*qproperty-icon: url();*/\n"
                "    /* set the icon image size */\n"
                "    /*qproperty-iconSize: 24px;*/\n"
                "}\n"
                "/* property into disabled status */\n"
                "QPushButton:disabled {\n"
                "    /* set the background color */\n"
                "    /*background-color: rgb(255, 255, 255);*/\n"
                "    /* set the border width and color  */\n"
                "    /*border:2px solid black;*/\n"
                "    /* set the border radius */\n"
                "    /*border-radius:4px;*/\n"
                "    /* set the text at pressed status */\n"
                "    /*qproperty-text: \"text disabled\";*/\n"
                "    /* set the font color */\n"
                "    /*color: rgb(155, 155, 155);*/\n"
                "    /* set the background image */\n"
                "    /*background-image: url();*/\n"
                "    /* set the image */\n"
                "    /*image: url();*/\n"
                "    /* set the icon image */\n"
                "    /*qproperty-icon: url();*/\n"
                "    /* set the icon image size */\n"
                "    /*qproperty-iconSize: 24px;*/\n"
                "}\n"
            #endif
                );

    m_parent = parent;
    connect(m_parent, SIGNAL(varRefresh()), this, SLOT(updateData()));
    /* connect spostate in setStatusVar */
}
Exemple #8
0
void makeStripCharts(const Char_t* ratefn,
                     const Char_t* voltfn,
                     const Char_t* outtag,
                     const Char_t* statfn=0, // def 0 for backwards compatibility
                     const Float_t zoomDays=7.0,
                     const Bool_t  finFromData=kFALSE) {
   // finFromData = true => max of time axis determined by last data point
   //             = false => determined by time at which the script is run
   
   gSystem->Setenv("TZ","UTC");
   gStyle->SetTimeOffset(0);
   gStyle->SetOptStat(0);

   ratef = TFile::Open(ratefn);
   if ( (ratef==0) || (ratef->IsZombie()) ) {
      Error("makeStripCharts","Could not open [%s]",ratefn);
   } else {
      gERvsT = dynamic_cast<TGraph*>(ratef->Get("gERvsT"));
   }
   voltf = TFile::Open(voltfn);
   if ( (voltf==0) || (voltf->IsZombie()) ) {
      Error("makeStripCharts","Could not open [%s]",voltfn);
   } else {
      gVolt  = dynamic_cast<TGraph*>(voltf->Get("gVolt"));
      gCurr  = dynamic_cast<TGraph*>(voltf->Get("gCurr"));
   }
   
   if (statfn!=0) {
      statf = TFile::Open(statfn);
      if ( (statf!=0) && (statf->IsZombie()==kFALSE) ) {
         gStERvsT = dynamic_cast<TGraph*>(statf->Get("gStERvsT"));
         gStVvsT  = dynamic_cast<TGraph*>(statf->Get("gStVvsT"));
         gStCvsT  = dynamic_cast<TGraph*>(statf->Get("gStCvsT"));
      }
      if (gERvsT==0) {
         gERvsT = gStERvsT;
      }
      if (gVolt==0) {
         gVolt = gStVvsT;
      }
      if (gCurr==0) {
         gCurr = gStCvsT;
      }
   }
   
   if ( (gERvsT!=0) && (gVolt!=0) && (gCurr!=0) ) {
   
      setStyle(gERvsT, kRate);
      setStyle(gVolt, kVolt);
      setStyle(gCurr, kCurr);

      if (gStVvsT!=0) {
         setStyle(gStVvsT, kStVolt);
      }
      if (gStCvsT!=0) {
         setStyle(gStCvsT, kStCurr);
      }
      
      // assume gERvsT is ordered
      Double_t start = (gERvsT->GetX())[0];
      Double_t fin   = (gERvsT->GetX())[(gERvsT->GetN())-1];
      if (gStERvsT!=0) {
         setStyle(gStERvsT, kStRate);
         // gStERvsT not ordered
         Double_t sst, sfn;
         getStartFinFrom(*gStERvsT, sst, sfn);
         if (sst<start) {
            start = sst;
         }
         if (sfn>fin) {
            fin = sfn;
         }
      }
      if (finFromData==kFALSE) {
         const TDatime now;
         fin = now.Convert();
      }
      Int_t tbins(100);
      Double_t tmin(0), tmax(1);
      TSnMath::GetNiceDateAxisFor(start, fin, tbins, tmin, tmax);
      TH2F* hrd = new TH2F("hrd",
                           gERvsT->GetTitle(),
                           tbins, tmin, tmax,
                           rbins, rmin, rmax);
      TH2F* hvd = new TH2F("hvd",
                           gVolt->GetTitle(),
                           tbins, tmin, tmax,
                           vbins, vmin, vmax);
      TH2F* hzd = new TH2F("hzd",
                           gVolt->GetTitle(),
                           tbins, tmin, tmax,
                           zbins, zmin, zmax);
      TH2F* hcd = new TH2F("hcd",
                           gCurr->GetTitle(),
                           tbins, tmin, tmax,
                           cbins, cmin, cmax);
      setTimeDisp(*hrd);
      setTimeDisp(*hvd);
      setTimeDisp(*hzd);
      setTimeDisp(*hcd);

      c1 = new TCanvas("c1","c1",cwid,chit);
      c1->Divide(1,4);
      c1->cd(1);
      hrd->Draw("axis");
      if (gStERvsT!=0) {
         gStERvsT->Draw(grphDrawOpt);
      }
      gERvsT->Draw(grphDrawOpt);
      c1->GetPad(1)->SetLogy();
      c1->GetPad(1)->SetGridx();
      c1->cd(2);
      hzd->Draw("axis");
      if (gStVvsT!=0) {
         gStVvsT->Draw(grphDrawOpt);
      }
      gVolt->Draw(grphDrawOpt);
      c1->GetPad(2)->SetGridx();
      c1->cd(3);
      hvd->Draw("axis");
      if (gStVvsT!=0) {
         gStVvsT->Draw(grphDrawOpt);
      }
      gVolt->Draw(grphDrawOpt);
      c1->GetPad(3)->SetGridx();
      c1->cd(4);
      hcd->Draw("axis");
      if (gStCvsT!=0) {
         gStCvsT->Draw(grphDrawOpt);
      }
      gCurr->Draw(grphDrawOpt);
      c1->GetPad(4)->SetGridx();
      c1->cd();
      c1->Update();

      c1->Print(Form("%s.root",outtag));
      c1->Print(Form("%s.gif",outtag));
      

      TSnMath::GetNiceDateAxisFor( fin - (zoomDays*kSecPerDay),
                                   fin,
                                   tbins, tmin, tmax);
      TH2F* hrz = new TH2F("hrz",
                           gERvsT->GetTitle(),
                           tbins, tmin, tmax,
                           rbins, rmin, rmax);
      TH2F* hvz = new TH2F("hvz",
                           gVolt->GetTitle(),
                           tbins, tmin, tmax,
                           zbins, zmin, zmax);
      TH2F* hzz = new TH2F("hzz",
                           gVolt->GetTitle(),
                           tbins, tmin, tmax,
                           vbins, vmin, vmax);
      TH2F* hcz = new TH2F("hcz",
                           gCurr->GetTitle(),
                           tbins, tmin, tmax,
                           cbins, cmin, cmax);
      setTimeDisp(*hrz, 515);
      setTimeDisp(*hvz, 515);
      setTimeDisp(*hzz, 515);
      setTimeDisp(*hcz, 515);
      
      c2 = new TCanvas("c2","c2",cwid,chit);
      c2->Divide(1,4);
      c2->cd(1);
      hrz->Draw("axis");
      if (gStERvsT!=0) {
         gStERvsT->Draw(grphDrawOpt);
      }
      gERvsT->Draw(grphDrawOpt);
      c2->GetPad(1)->SetLogy();
      c2->GetPad(1)->SetGridx();
      c2->cd(2);
      hvz->Draw("axis");
      if (gStVvsT!=0) {
         gStVvsT->Draw(grphDrawOpt);
      }
      gVolt->Draw(grphDrawOpt);
      c2->GetPad(2)->SetGridx();
      c2->cd(3);
      hzz->Draw("axis");
      if (gStVvsT!=0) {
         gStVvsT->Draw(grphDrawOpt);
      }
      gVolt->Draw(grphDrawOpt);
      c2->GetPad(3)->SetGridx();
      c2->cd(4);
      hcz->Draw("axis");
      if (gStCvsT!=0) {
         gStCvsT->Draw(grphDrawOpt);
      }
      gCurr->Draw(grphDrawOpt);
      c2->GetPad(4)->SetGridx();
      c2->cd();
      c2->Update();

      c2->Print(Form("%s.now.root",outtag));
      c2->Print(Form("%s.now.gif",outtag));

      
   } else {
      Error("makeStripCharts","Could not get graphs");
   }
   
}
Exemple #9
0
void makeSBWcharts(const Char_t* sbgfn,
                   const Char_t* outtag,
                   const Float_t zoomDays=7.0,
                   const Bool_t  drawMinMax=kFALSE,
                   const Bool_t  finFromData=kFALSE) {
   // finFromData = true => max of time axis determined by last data point
   //             = false => determined by time at which the script is run
   
   gROOT->Reset();
   
   gSystem->Setenv("TZ","UTC");
   gStyle->SetTimeOffset(0);
   gStyle->SetOptStat(0);

   TH1::AddDirectory(kTRUE);

   sbgf = TFile::Open(sbgfn);
   if ( (sbgf==0) || (sbgf->IsZombie()) ) {
      Error("makeSBWcharts","Could not open [%s]",sbgfn);
   }
   
   gMaxTemp = dynamic_cast<TGraph*>(sbgf->Get("gMaxTemp"));
   gMinTemp = dynamic_cast<TGraph*>(sbgf->Get("gMinTemp"));
   gMaxGust = dynamic_cast<TGraph*>(sbgf->Get("gMaxGust"));
   gCTemp   = dynamic_cast<TGraph*>(sbgf->Get("gCTemp"));
   gAveWind = dynamic_cast<TGraph*>(sbgf->Get("gAveWind"));
   
   const TDatime dnow;
   const UInt_t  now = dnow.Convert();
   Double_t start(0), fin(0);
   Int_t tbins(100);
   Double_t tmin(0), tmax(1);
   
   c1 = new TCanvas("c1","c1",cwid,static_cast<Int_t>(chit/2.0));
   c1->Divide(1,2);

   TLegend* mleg=0, * wleg=0;
   TLine* tzline=0;
   
   if (drawMinMax) {
      mleg = new TLegend(.258,.742,.410,.993);
      mleg->SetFillColor(0);
      mleg->SetBorderSize(1);
      
      wleg = new TLegend(.244,.794,.444,.993);
      wleg->SetFillColor(0);
      wleg->SetBorderSize(1);
   }
   
   if (gCTemp!=0) {
      setStyle(gCTemp, kCTemp);
      
      // get time scale from CTemp (only)
      getStartFinFrom(*gCTemp, start, fin);
      if (finFromData==kFALSE) {
         fin = now;
      }
      TSnMath::GetNiceDateAxisFor(start, fin, tbins, tmin, tmax);
      TH2F* htd = new TH2F("htd",
                           gCTemp->GetTitle(),
                           tbins, tmin, tmax,
                           mbins, mmin, mmax);
      setTimeDisp(*htd);

      tzline = new TLine(tmin, 0, tmax, 0);
      tzline->SetLineColor(kBlack);
      tzline->SetLineWidth(1);
      tzline->SetLineStyle(2);
      
      c1->cd(1);
      htd->Draw("axis");
      tzline->Draw();
      gCTemp->Draw(grphDrawOpt);
      c1->GetPad(1)->SetGridx();
      c1->GetPad(1)->SetGridy();
      if (drawMinMax) {
         mleg->AddEntry(newDumHistForLegend(gCTemp), "Temp", "fp");
         if (gMaxTemp!=0) {
            setStyle(gMaxTemp, kMaxTemp);
            gMaxTemp->Draw(grphDrawOpt);
            mleg->AddEntry(newDumHistForLegend(gMaxTemp), "Max Temp", "fp");
         }
         if (gMinTemp!=0) {
            setStyle(gMinTemp, kMinTemp);
            gMinTemp->Draw(grphDrawOpt);
            mleg->AddEntry(newDumHistForLegend(gMinTemp), "Min Temp", "fp");
         }
         mleg->Draw();
      }
      
      // use time scale from temp
      if (gAveWind!=0) {
         setStyle(gAveWind, kAveWind);
         TH2F* hwd = new TH2F("hwd",
                              gAveWind->GetTitle(),
                              tbins, tmin, tmax,
                              wbins, wmin, wmax);
         setTimeDisp(*hwd);
         
         c1->cd(2);
         hwd->Draw("axis");
         gAveWind->Draw(grphDrawOpt);
         c1->GetPad(2)->SetGridx();
         c1->GetPad(2)->SetGridy();
         if (drawMinMax) {
            wleg->AddEntry(newDumHistForLegend(gAveWind), "Wind Speed", "fp");
            if (gMaxGust!=0) {
               setStyle(gMaxGust, kMaxGust);
               gMaxGust->Draw(grphDrawOpt);
               wleg->AddEntry(newDumHistForLegend(gMaxGust), "Max Gust", "fp");
            }
            wleg->Draw();
         }
      }
   }
   
   c1->cd();
   c1->Update();
   
   c1->Print(Form("%s.root",outtag));
   c1->Print(Form("%s.gif",outtag));
   
   
   c2 = new TCanvas("c2","c2",cwid,static_cast<Int_t>(chit/2.0));
   c2->Divide(1,2);
   
   TSnMath::GetNiceDateAxisFor( fin - (zoomDays*kSecPerDay),
                                fin,
                                tbins, tmin, tmax);
   if (gCTemp!=0) {
      c2->cd(1);
      TH2F* htz = new TH2F("htz", gCTemp->GetTitle(),
                           tbins, tmin, tmax,
                           mbins, mmin, mmax);
      setTimeDisp(*htz, 515);
      htz->Draw("axis");
      gCTemp->Draw(grphDrawOpt);
      tzline->DrawLine(tmin, 0, tmax, 0);
      c2->GetPad(1)->SetGridx();
      c2->GetPad(1)->SetGridy();
      if (drawMinMax) {
         if (gMaxTemp!=0) {
            gMaxTemp->Draw(grphDrawOpt);
         }
         if (gMinTemp!=0) {
            gMinTemp->Draw(grphDrawOpt);
         }
         mleg->Draw();
      }
      if (gAveWind!=0) {
         TH2F* hwz = new TH2F("hwz",
                              gAveWind->GetTitle(),
                              tbins, tmin, tmax,
                              wbins, wmin, wmax);
         setTimeDisp(*hwz, 515);
         
         c2->cd(2);
         hwz->Draw("axis");
         gAveWind->Draw(grphDrawOpt);
         c2->GetPad(2)->SetGridx();
         c2->GetPad(2)->SetGridy();
         if (drawMinMax) {
            if (gMaxGust!=0) {
               gMaxGust->Draw(grphDrawOpt);
            }
            wleg->Draw();
         }
      }
   }
   
   c2->cd();
   c2->Update();
   
   c2->Print(Form("%s.now.root",outtag));
   c2->Print(Form("%s.now.gif",outtag));
   
   // cleanup
   delete sbgf;
   delete gMaxTemp; delete gMinTemp; delete gCTemp;
   delete gMaxGust; delete gAveWind;
   delete c1; delete c2;
   delete tzline;
   if (drawMinMax) {
      delete mleg; delete wleg;
   }
   
}
Exemple #10
0
SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static )
          : QSlider( q, _parent ), b_classic( _static )
{
    isSliding = false;
    f_buffering = 1.0;
    mHandleOpacity = 1.0;
    chapters = NULL;
    mHandleLength = -1;
    b_seekable = true;
    alternativeStyle = NULL;

    // prepare some static colors
    QPalette p = palette();
    QColor background = p.color( QPalette::Active, QPalette::Window );
    tickpointForeground = p.color( QPalette::Active, QPalette::WindowText );
    tickpointForeground.setHsv( tickpointForeground.hue(),
            ( background.saturation() + tickpointForeground.saturation() ) / 2,
            ( background.value() + tickpointForeground.value() ) / 2 );

    // set the background color and gradient
    QColor backgroundBase( p.window().color() );
    backgroundGradient.setColorAt( 0.0, backgroundBase.darker( 140 ) );
    backgroundGradient.setColorAt( 1.0, backgroundBase );

    // set the foreground color and gradient
    QColor foregroundBase( 50, 156, 255 );
    foregroundGradient.setColorAt( 0.0,  foregroundBase );
    foregroundGradient.setColorAt( 1.0,  foregroundBase.darker( 140 ) );

    // prepare the handle's gradient
    handleGradient.setColorAt( 0.0, p.window().color().lighter( 120 ) );
    handleGradient.setColorAt( 0.9, p.window().color().darker( 120 ) );

    // prepare the handle's shadow gradient
    QColor shadowBase = p.shadow().color();
    if( shadowBase.lightness() > 100 )
        shadowBase = QColor( 60, 60, 60 ); // Palette's shadow is too bright
    shadowDark = shadowBase.darker( 150 );
    shadowLight = shadowBase.lighter( 180 );
    shadowLight.setAlpha( 50 );

    /* Timer used to fire intermediate updatePos() when sliding */
    seekLimitTimer = new QTimer( this );
    seekLimitTimer->setSingleShot( true );

    /* Tooltip bubble */
    mTimeTooltip = new TimeTooltip( this );
    mTimeTooltip->setMouseTracking( true );

    /* Properties */
    setRange( MINIMUM, MAXIMUM );
    setSingleStep( 2 );
    setPageStep( 10 );
    setMouseTracking( true );
    setTracking( true );
    setFocusPolicy( Qt::NoFocus );

    /* Use the new/classic style */
    if( !b_classic )
    {
        alternativeStyle = new SeekStyle;
        setStyle( alternativeStyle );
    }

    /* Init to 0 */
    setPosition( -1.0, 0, 0 );
    secstotimestr( psz_length, 0 );

    animHandle = new QPropertyAnimation( this, "handleOpacity", this );
    animHandle->setDuration( FADEDURATION );
    animHandle->setStartValue( 0.0 );
    animHandle->setEndValue( 1.0 );

    hideHandleTimer = new QTimer( this );
    hideHandleTimer->setSingleShot( true );
    hideHandleTimer->setInterval( FADEOUTDELAY );

    CONNECT( this, sliderMoved( int ), this, startSeekTimer() );
    CONNECT( seekLimitTimer, timeout(), this, updatePos() );
    CONNECT( hideHandleTimer, timeout(), this, hideHandle() );
    mTimeTooltip->installEventFilter( this );
}