Beispiel #1
0
void
DrawPlot::drawPlot(const TString& pluginName, const TString& histName, const bool normalise, const bool plotZeroApe){
  TString* plugin = new TString(pluginName.Copy());
  if(!plugin->IsNull())plugin->Append("/");
  for(unsigned int iSector=1; ; ++iSector){
    std::stringstream ss_sectorName, ss_sector;
    ss_sectorName<<"Sector_"<<iSector;
    ss_sector<<*plugin<<ss_sectorName.str()<<"/";
    TDirectory* dir(0);
    //std::cout<<"Sector: "<<ss_sector.str()<<"\n";
    dir = (TDirectory*)designFile_->TDirectory::GetDirectory(ss_sector.str().c_str());
    if(!dir)break;
    
    TH1* SectorName(0);
    designFile_->GetObject((ss_sector.str()+"z_name;1").c_str(), SectorName);
    const TString sectorName(SectorName ? SectorName->GetTitle() : ss_sectorName.str().c_str());
    
    
    TTree* baselineTree(0);
    if(histName=="h_residualWidthX1"){baselineTree = baselineTreeX_;}
    else if(histName=="h_residualWidthY1"){baselineTree = baselineTreeY_;}
    if(baselineTree){
      std::stringstream ss_branch;
      ss_branch<<"Ape_Sector_"<<iSector;
      TBranch* branch(0);
      branch = baselineTree->GetBranch(ss_branch.str().c_str());
      if(branch){
	double delta0(999.);
	branch->SetAddress(&delta0);
        branch->GetEntry(0);
        delta0_ = new double(std::sqrt(delta0));
      }
      else delta0_ = 0;
    }
    else delta0_ = 0;
    
    if(histName=="h_entriesX" || histName=="h_entriesY" ||
       histName=="h_ResX" || histName=="h_ResY" ||
       histName=="h_NorResX" || histName=="h_NorResY")ss_sector<<"Results/";
    
    ss_sector<<histName;
    const TString fullName(ss_sector.str().c_str());
    this->printHist(fullName, histName.Copy().Append("_").Append(sectorName), normalise, plotZeroApe);
    
    if(delta0_)delete delta0_;
  }
}
Beispiel #2
0
        void Paint(ItemID pitemArg, Surface* psurface, bool bSelected, bool bFocus)
        {
            ImodelIGC* pDestination = (ImodelIGC*)pitemArg;
            IshipIGC* pship = NULL;
            IstationIGC* pstation = NULL;

            if (pDestination == NULL || trekClient.MyMission() == NULL)
                return;

            if (pDestination->GetObjectType() == OT_ship)
            {
                CastTo(pship, pDestination);
            }
            else
            {
                assert(pDestination->GetObjectType() == OT_station);
                CastTo(pstation, pDestination);
            }



            // draw the selection bar

            if (bSelected) {
                psurface->FillRect(
                    WinRect(0, 0, GetXSize(), GetYSize()),
                    Color::Red()
                );
            }

            TRef<IEngineFont> pfont;

            // show the place we currently are in bold
            if (pship && pship == trekClient.GetShip()->GetParentShip()
                || pstation && pstation == trekClient.GetShip()->GetStation())
            {
                pfont = TrekResources::SmallBoldFont();
            }
            else
            {
                pfont = TrekResources::SmallFont();
            }
         
            Color color;

            if (CanKeepCurrentShip(pDestination))
            {
                color = Color::White();
            }
            else
            {
                color = 0.75f * Color::White();
            }

            // draw the name

            psurface->DrawString(
                pfont, 
                color,
                WinPoint(0, 0),
                pship ? pship->GetName() : pstation->GetName()
            );


            // draw the ship type (if any)
            if (pship)
            {
                psurface->DrawString(
                    pfont, 
                    color,
                    WinPoint(m_viColumns[0], 0),
                    HullName(pDestination)
                );
            }
            
            // draw the cluster
            psurface->DrawString(
                pfont, 
                color,
                WinPoint(m_viColumns[1] + 2, 0),
                SectorName(pDestination)
            );

            // draw the total number of turrets (if appropriate)
            if (pship && NumTurrets(pship))
            {
                int nNumTurrets = NumTurrets(pship);

                if (nNumTurrets != 0)
                {
                    psurface->DrawString(
                        pfont,
                        color,
                        WinPoint(m_viColumns[2] + 2, 0), 
                        ZString((int)MannedTurrets(pship)) + ZString("/") + ZString(nNumTurrets)
                    );
                }
            }
        }