void VetoThres2(Int_t Lo, Int_t Hi)
{
  TCanvas* Window;
  TTimer* Refresh;
  TH1F* Energy;
  Char_t Buff[256];
  Char_t* Keyb;
  Double_t Pos[438];

  Window = new TCanvas();
  Window->SetCrosshair();
  Window->ToggleEventStatus();
  Refresh = new TTimer("Flush()", 50, kFALSE);
  for(Int_t ch=Lo; ch<Hi+1; ch++)
  {
    sprintf(Buff, "Veto_Energy%d", ch);
    Energy = (TH1F*)gROOT->FindObject(Buff);
    Energy->GetXaxis()->SetRange(0, 250);
    Energy->Draw();
    Window->Update();
    sprintf(Buff, "Threshold for %d: ", ch);
    Refresh->TurnOn();
    Refresh->Reset();
    Keyb = Getline(Buff);
    Refresh->TurnOff();
    Pos[ch] = atof(Keyb);
  }
  for(Int_t ch=Lo; ch<Hi+1; ch++)
    printf("%5.1f\n", Pos[ch]);
}
Exemple #2
0
void TTimer::enableTimer()
{
    if( canBeUnlocked( 0 ) )
    {
        if( activate() )
        {
            if( mScript.size() > 0 )
            {
                mpTimer->start();
            }
        }
        else
        {
            deactivate();
            mpTimer->stop();
        }
    }
    if( ! isOffsetTimer() )
    {
        typedef list<TTimer *>::const_iterator I;
        for( I it = mpMyChildrenList->begin(); it != mpMyChildrenList->end(); it++)
        {
            TTimer * pChild = *it;
            if( ! pChild->isOffsetTimer() ) pChild->enableTimer();
        }
    }
}
Exemple #3
0
void TTimer::enableTimer( QString & name )
{
    if( mName == name )
    {
        if( canBeUnlocked( 0 ) )
        {
            if( activate() )
            {
                mpTimer->start();
            }
            else
            {
                deactivate();
                mpTimer->stop();
            }
        }
    }

    if( ! isOffsetTimer() )
    {
        typedef list<TTimer *>::const_iterator I;
        for( I it = mpMyChildrenList->begin(); it != mpMyChildrenList->end(); it++)
        {
            TTimer * pChild = *it;
            pChild->enableTimer( pChild->getName() );
        }
    }
}
Exemple #4
0
 void RoutingTable::TouchKBucket(const KadID &node_id) {
     int index = KBucketIndex(node_id);
     if (index < 0)
         return;
     TTimer timer;
     k_buckets_[index]->set_last_accessed(static_cast<unsigned int>(timer.current()));
 }
Exemple #5
0
void TimerUnit::reenableAllTriggers()
{
    for(auto it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
    {
        TTimer * pChild = *it;
        pChild->enableTimer( pChild->getID() );
    }
}
Exemple #6
0
void TimerUnit::reenableAllTriggers()
{
    typedef list<TTimer *>::const_iterator I;
    for( I it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
    {
        TTimer * pChild = *it;
        pChild->enableTimer( pChild->getID() );
    }
}
int main(int argc, char** argv) {
  
	size_t iter = 1;
	int    q    = 1009;
	int    n    = 2000;
	std::string file = "";
  
	Argument as[] = {
		{ 'q', "-q Q", "Set the field characteristic (-1 for random).",  TYPE_INT , &q },
		{ 'n', "-n N", "Set the dimension of the matrix.",               TYPE_INT , &n },
		{ 'i', "-i R", "Set number of repetitions.",                     TYPE_INT , &iter },
		{ 'f', "-f FILE", "Set the input file (empty for random).",  TYPE_STR , &file },
		END_OF_ARGUMENTS
	};

	FFLAS::parseArguments(argc,argv,as);

  typedef Givaro::Modular<double> Field;
  typedef Field::Element Element;

  Field F(q);
  Element * A;

  TTimer chrono;
  double time=0.0;

  Field::RandIter G(F);
  for (size_t i=0;i<iter;++i){
    if (!file.empty()){
      A = read_field (F, file.c_str(), &n, &n);
    } else {
      A = FFLAS::fflas_new<Element>(n*n);
      for (size_t j=0; j<(size_t) n*n; ++j)
	G.random(*(A+j));
    }
    for (size_t k=0;k<(size_t)n;++k)
      while (F.isZero( G.random(*(A+k*(n+1)))));

    chrono.clear();
    chrono.start();
    clapack_dtrtri(CblasRowMajor,CblasUpper, CblasNonUnit,n,A,n);
    chrono.stop();

    time+=chrono.usertime();
    FFLAS::fflas_delete( A);

  }
  
	// -----------
	// Standard output for benchmark - Alexis Breust 2014/11/14
	std::cout << "Time: " << time / double(iter)
			  << " Gflops: " << (2.*double(n)/1000.*double(n)/1000.*double(n)/1000.0) / time * double(iter) / 3.;
	FFLAS::writeCommandString(std::cout, as) << std::endl;

  return 0;
}
Exemple #8
0
 void RoutingTable::GetRefreshList(const unsigned short int &start_kbucket,
                                   const bool &force, std::vector<KadID> *ids) {
     TTimer timer ;
     unsigned int curr_time = static_cast<unsigned int> (timer.system_time());
     for (size_t i = start_kbucket; i < k_buckets_.size(); ++i)
         if (force || curr_time-k_buckets_[i]->last_accessed() > KRefreshTime) {
             ids->push_back(KadID(k_buckets_[i]->range_min(),
                                  k_buckets_[i]->range_max()));
         }
 }
Exemple #9
0
void TimerUnit::compileAll()
{
    for(auto it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
    {
        TTimer * pChild = *it;
        if( pChild->isActive() )
        {
            pChild->mNeedsToBeCompiled = true;
        }
    }
}
Exemple #10
0
void TimerUnit::compileAll()
{
    typedef list<TTimer *>::const_iterator I;
    for( I it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
    {
        TTimer * pChild = *it;
        if( pChild->isActive() )
        {
            pChild->mNeedsToBeCompiled = true;
        }
    }
}
Exemple #11
0
/**
@SYMTestCaseID          SYSLIB-DBMS-CT-1315
@SYMTestCaseDesc        Database recovery test 
@SYMTestPriority        Medium
@SYMTestActions        	Calls up RDbStoreDatabase::Recover() function 
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void Recover()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1315 "));
#ifndef __TOOLS2__
	TheTimer.Start(_L("recover"));
#endif
	test(TheDatabase.Recover()==KErrNone);
#ifndef __TOOLS2__
	TheTimer.Stop();
#endif
	test(!TheDatabase.IsDamaged());
	}
Exemple #12
0
void TTimer::disableTimer()
{
    deactivate();
    mpTimer->stop();
    //qDebug()<<"timer "<<mName<<" has been stopped stopping children...\n";
    typedef list<TTimer *>::const_iterator I;
    for( I it = mpMyChildrenList->begin(); it != mpMyChildrenList->end(); it++)
    {
        TTimer * pChild = *it;
        pChild->disableTimer();
    }
}
Exemple #13
0
void TimerUnit::_assembleReport( TTimer * pChild )
{
    list<TTimer*> * childrenList = pChild->mpMyChildrenList;
    for(auto it2 = childrenList->begin(); it2 != childrenList->end(); it2++)
    {
        TTimer * pT = *it2;
        _assembleReport( pT );
        if( pT->isActive() ) statsActiveTriggers++;
        if( pT->isTempTimer() ) statsTempTriggers++;
        statsTriggerTotal++;
    }
}
/************ wait funtion !!  *************************************************************** 
*********************************************************************************************/
void wait(){

	TTimer *timer = new TTimer("gSystem->ProcessEvents();", 50, kFALSE);
	char *input;
	Bool_t done = kFALSE;
	do{
		timer->TurnOn();
		timer->Reset();
		input=Getline("Type <return> to continue : ");
		timer->TurnOff();
		if(input){			done =kTRUE;		}	
	}while(!done);
}
Exemple #15
0
void TimerUnit::removeAllTempTimers()
{
    mCleanupList.clear();
    for(auto it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
    {
        TTimer * pChild = *it;
        if( pChild->isTempTimer() )
        {
            pChild->killTimer();
            pChild->mOK_code = false; //important to not crash on stale Lua function args
            markCleanup( pChild );
        }
    }
}
Exemple #16
0
void TimerUnit::reParentTimer( int childID, int oldParentID, int newParentID, int parentPosition, int childPosition )
{
    TTimer * pOldParent = getTimerPrivate( oldParentID );
    TTimer * pNewParent = getTimerPrivate( newParentID );
    TTimer * pChild = getTimerPrivate( childID );
    if( ! pChild )
    {
        return;
    }

    pChild->disableTimer( childID );

    if( pOldParent )
    {
        pOldParent->popChild( pChild );
    }
    if( ! pOldParent )
    {
        mTimerRootNodeList.remove( pChild );
    }
    if( pNewParent )
    {
        pNewParent->addChild( pChild, parentPosition, childPosition );
        if( pChild ) pChild->setParent( pNewParent );
    }
    else
    {
        pChild->Tree<TTimer>::setParent( 0 );
        addTimerRootNode( pChild, parentPosition, childPosition );
    }

    pChild->enableTimer( childID );
}
Exemple #17
0
void TTimer::disableTimer( QString & name )
{
    if( mName == name )
    {
        deactivate();
        mpTimer->stop();
    }

    typedef list<TTimer *>::const_iterator I;
    for( I it = mpMyChildrenList->begin(); it != mpMyChildrenList->end(); it++)
    {
        TTimer * pChild = *it;
        pChild->disableTimer( pChild->getName() );
    }
}
Exemple #18
0
void TTimer::compileAll()
{
    mNeedsToBeCompiled = true;
    if( ! compileScript() )
    {
        if( mudlet::debugMode ) {TDebug(QColor(Qt::white),QColor(Qt::red))<<"ERROR: Lua compile error. compiling script of timer:"<<mName<<"\n">>0;}
        mOK_code = false;
    }
    typedef list<TTimer *>::const_iterator I;
    for( I it = mpMyChildrenList->begin(); it != mpMyChildrenList->end(); it++)
    {
        TTimer * pChild = *it;
        pChild->compileAll();
    }
}
Exemple #19
0
/**
@SYMTestCaseID          SYSLIB-DBMS-CT-0580
@SYMTestCaseDesc        Tests the database definition and enquiry functions
@SYMTestPriority        Medium
@SYMTestActions        	Tests by setting an active index for the table.   
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestIndex(const TDesC& aName,const CDbKey& aKey)
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0580 "));
#ifndef __TOOLS2__
	TheTimer.Start(_L("build"));
#endif
	test(TheDatabase.CreateIndex(aName,KTableName,aKey)==KErrNone);
#ifndef __TOOLS2__
	TheTimer.Stop();
#endif
	test(TheTable.Open(TheDatabase,KTableName)==KErrNone);
	test(TheTable.SetIndex(aName)==KErrNone);
	IterateL(TheTable.ENext);
	TheTable.Close();
	}
Exemple #20
0
/**
@SYMTestCaseID          SYSLIB-DBMS-CT-0579
@SYMTestCaseDesc        Tests the database definition and enquiry functions
@SYMTestPriority        Medium
@SYMTestActions        	Executes the index and bookmark tests
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void BigTestL()
	{
	test.Start(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0579 Table "));
	CreateDatabaseL();
	BuildTable(KRecords);
	test(TheTable.Open(TheDatabase,KTableName)==KErrNone);
	TheTable.EndL();
	IterateL(TheTable.EPrevious);
	TheTable.BeginningL();
	IterateL(TheTable.ENext);
	TheTable.EndL();
	IterateL(TheTable.EPrevious);
	TheTable.Close();
	test.Next(_L("Int32 Index"));
	CDbKey *key=CDbKey::NewLC();
	key->AddL(KColumnInt);
	key->MakeUnique();
	TestIndex(KIndexInt,*key);
	test.Next(_L("Text[200] Index"));
	key->Clear();
	key->AddL(KColumnText);
	key->MakeUnique();
	TestIndex(KIndexText,*key);
	test.Next(_L("Bookmarks"));
	TestBookmark();
	test.Next(_L("Int32 Index"));
#ifndef __TOOLS2__
	TheTimer.Start(_L("drop"));
#endif
	test(TheDatabase.DropIndex(KIndexInt,KTableName)==KErrNone);
#ifndef __TOOLS2__
	TheTimer.Stop();
#endif
	key->Clear();
	key->AddL(KColumnInt);
	key->MakeUnique();
	TestIndex(KIndexInt,*key);
	CleanupStack::PopAndDestroy();
	test.Next(_L("Break & Recover"));
	BreakIndex();
	Recover();
	test.Next(_L("Drop Indexes"));
	DropIndexes();
	test.Next(_L("Delete all records"));
	DeleteTable();
	CloseDatabaseL();
	test.End();
	}
Exemple #21
0
bool TimerUnit::killTimer(const QString & name )
{
    for(auto it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
    {
        TTimer * pChild = *it;
        if( pChild->getName() == name )
        {
            // only temporary timers can be killed
            if( ! pChild->isTempTimer() ) return false;
            pChild->killTimer();
            markCleanup( pChild );
            return true;
        }
    }
    return false;
}
Exemple #22
0
void trial1()
{
  gStyle->SetCanvasPreferGL(true);
  //gStyle->SetFrameFillColor(42);
  TCanvas *c1=new TCanvas("can1");
  //can1->SetFillColor(17);
  f1=new TF1("f1","[0]*x",0,10);
  f1->SetParameter(0,1);
  //f1->SetNpx(10);
  f1->SetMaximum(10);
  f1->SetMinimum(0);
  f1->Draw();
  TTimer *timer = new TTimer(20);
  timer->SetCommand("Animate()");
  timer->TurnOn();
}
Exemple #23
0
/**
@SYMTestCaseID          SYSLIB-DBMS-CT-1312
@SYMTestCaseDesc        Create a table in database
@SYMTestPriority        Medium
@SYMTestActions        	Build a table and write records into the table.Test for commiting the transactions.
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void BuildTable(TInt aCount)
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1312 "));
#ifndef __TOOLS2__
	TheTimer.Start(_L("build"));
#endif
	CreateTable();
	TheDatabase.Begin();
	test(TheTable.Open(TheDatabase,KTableName)==KErrNone);
	WriteRecords(aCount);
	test(TheDatabase.Commit()==KErrNone);
	TheTable.Close();
#ifndef __TOOLS2__
	TheTimer.Stop();
#endif
	}
Exemple #24
0
void TimerUnit::removeAllTempTimers()
{
    //qDebug()<<"vorher: TIMERS: insgesamt:"<<mTimerRootNodeList.size()<<" cleanup:"<<mCleanupList.size();
    mCleanupList.clear();
    typedef list<TTimer *>::const_iterator I;
    for( I it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
    {
        TTimer * pChild = *it;
        if( pChild->isTempTimer() )
        {
            pChild->killTimer();
            pChild->mOK_code = false; //important to not crash on stale Lua function args
            markCleanup( pChild );
        }
    }
    //qDebug()<<"TIMERS: insgesamt:"<<mTimerRootNodeList.size()<<" cleanup:"<<mCleanupList.size();
}
Exemple #25
0
void anim()
{
   gStyle->SetFrameFillColor(42);
   TCanvas *c1 = new TCanvas("c1");
   c1->SetFillColor(17);
   pi = TMath::Pi();
   f2 = new TF2("f2","sin(2*x)*sin(2*y)*[0]",0,pi,0,pi);
   f2->SetParameter(0,1);
   f2->SetNpx(15);
   f2->SetNpy(15);
   f2->SetMaximum(1);
   f2->SetMinimum(-1);
   f2->Draw("surf1");
   TTimer *timer = new TTimer(20);
   timer->SetCommand("Animate()");
   timer->TurnOn();
}   
Exemple #26
0
/**
@SYMTestCaseID          SYSLIB-DBMS-CT-1313
@SYMTestCaseDesc        Tests for total rows in the rowset
@SYMTestPriority        Medium
@SYMTestActions        	Iterate through the table.Test for the total numbers of rows available 
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void IterateL(RDbTable::TPosition aDirection)
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1313 "));
#ifndef __TOOLS2__
	TheTimer.Start(_L("iterate"));
#endif
	TInt cc=0;
	while (TheTable.GotoL(aDirection))
		{
		++cc;
		TheTable.GetL();
		}
#ifndef __TOOLS2__
	TheTimer.Stop();
#endif
	test(cc=TheTable.CountL());
	}
Exemple #27
0
/**
@SYMTestCaseID          SYSLIB-DBMS-CT-1314
@SYMTestCaseDesc        Discarding indexes belonging to the table on database 
@SYMTestPriority        Medium
@SYMTestActions        	Tests for RDbIncremental::DropTable(),RDbIncremental::Next() function.
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void BreakIndex()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1314 "));
#ifndef __TOOLS2__
	TheTimer.Start(_L("break"));
#endif
	TInt step;
	RDbIncremental drop;
	test(drop.DropTable(TheDatabase,KTableName,step)==KErrNone);
	test(drop.Next(step)==KErrNone);
	test(step>0);
	drop.Close();	// abort the drop
	test(TheDatabase.IsDamaged());
#ifndef __TOOLS2__
	TheTimer.Stop();
#endif
	}
Exemple #28
0
/**
@SYMTestCaseID          SYSLIB-DBMS-CT-1316
@SYMTestCaseDesc        Tests for dropping an index
@SYMTestPriority        Medium
@SYMTestActions        	Drop an integer and text index from the table. Test for damage of database
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void DropIndexes()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1316 "));
#ifndef __TOOLS2__
	TheTimer.Start(_L("drop Int[32]"));
#endif
	test(TheDatabase.DropIndex(KIndexInt,KTableName)==KErrNone);
#ifndef __TOOLS2__
	TheTimer.Stop();
	TheTimer.Start(_L("drop Text[200]"));
#endif
	test(TheDatabase.DropIndex(KIndexText,KTableName)==KErrNone);
#ifndef __TOOLS2__
	TheTimer.Stop();
#endif
	test(!TheDatabase.IsDamaged());
	}
Exemple #29
0
void TTimer::disableTimer( qint64 id )
{
    if( mID == id )
    {
        deactivate();
        mpTimer->stop();
    }

    typedef list<TTimer *>::const_iterator I;
    for( I it = mpMyChildrenList->begin(); it != mpMyChildrenList->end(); it++)
    {
        TTimer * pChild = *it;
        if( ! pChild->isOffsetTimer() && pChild->shouldBeActive() )
        {
            pChild->disableTimer( pChild->getID() );
        }
    }
}
Exemple #30
0
TSocket* Cat::GetSocket(const char* ip, int port){
  //    printf("inside GetSocket alarm start  %s:%d\n" ,  ip, port );
   qalarm->Start(3000, kTRUE);
   //    printf("inside GetSocket   %s:%d\n" ,  ip, port );
   TSocket *socks=new TSocket( ip, port);
   // unfortunately it makes  STDERR print
   //    printf("outside GetSocket   %s:%d\n" ,  ip, port );
   return socks;
}