Exemplo n.º 1
0
void CSpliceScreenConfigDlg::EnableOutputs( const WMBlock* pBlockActive )
{
	int i = 0;
	for (i = 0; i < m_lbOutputs.GetCount(); ++i)
	{
		m_lbOutputs.Enable(i, TRUE);
		m_lbOutputs.SetCheck(i, FALSE);
	}

	for (i = 0; i < m_wndWall.GetBlockCount(); ++i)
	{
		const WMBlock* pBlock = m_wndWall.GetBlock(i);
		if (pBlock && pBlock != pBlockActive)
		{
			for (int j = 0; j < pBlock->vecOutputs.size(); ++j)
			{
				EnableOutput(pBlock->vecOutputs[j], FALSE);
			}
		}
	}

	for (i = 0; i < pBlockActive->vecOutputs.size(); ++i)
	{
		CheckOutput(pBlockActive->vecOutputs[i], TRUE);
	}
}
Exemplo n.º 2
0
void BiasAdderNet::Execute() {
  CheckInput();

  const Blob* const input = this->input_blobs(0);
  const Blob* const bias = this->params(0);
  Blob* const output = this->output_blobs(0);

  int channels = bias->channels();
  CHECK_EQ(channels, input->channels());

  int height = input->height();
  int width = input->width();
  int num = input->num();
  
  LOG(DEBUG) << "input blob: (" << num << "," << input->channels() << "," 
    << height << "," << width << ")";
  LOG(DEBUG) << "bias blob: (" << bias->num() << "," << bias->channels() 
    << "," << bias->height() << "," << bias->width() << ")";
  
  float* const dst_head = new float[num*channels*height*width];

  int size = height * width;
  for (int n = 0, offset = 0; n < num; ++n) {
    for (int ichannel = 0; ichannel < channels; ++ichannel) {
      for(int i = 0; i < size; ++i, ++offset) {
        dst_head[offset] = (*input)[offset] + (*bias)[ichannel];
      }
    }
  }

  output->CopyData(num, channels, height, width, dst_head);
  delete []dst_head;
  CheckOutput();
}
Exemplo n.º 3
0
void MaxPoolingNet::Execute() {
  // *** Argument *** //
  const float MIN_THRESHOLD = 0.0f;
  // *** //
  
  CheckInput();
  const Blob* const input = this->input_blobs(0);
  Blob* const output = this->output_blobs(0);
  
  int src_h = input->height();
  int src_w = input->width();
  int num = input->num();
  int channels = input->channels();

  int dst_h = static_cast<int>(ceil(static_cast<float>(
    src_h - kernel_h_) / stride_h_)) + 1;
  int dst_w = static_cast<int>(ceil(static_cast<float>(
    src_w - kernel_w_) / stride_w_)) + 1;

  int dst_count = num * channels * dst_h * dst_w;
  float* const dst_head = new float[dst_count];
  const float* src_data = input->data().get();
  float* dst_data = dst_head;
  int src_channel_off = src_h * src_w;
  int dst_channel_off = dst_h * dst_w;
  for (int n = 0; n < num; ++n) {
    for (int c = 0; c < channels; ++c) {
      for (int dh = 0, hstart = 0; dh < dst_h;
            ++dh, hstart += stride_h_) {
        int hend = std::min(hstart + kernel_h_, src_h);
        for (int dw = 0, wstart = 0; dw < dst_w;
            ++dw, wstart += stride_w_) {
          int wend = std::min(wstart + kernel_w_, src_w);
          int didx = dh * dst_w + dw;

          float max_val = MIN_THRESHOLD;
          for (int sh = hstart; sh < hend; ++sh) {
            for (int sw = wstart; sw < wend; ++sw) {
              int sidx = sh * src_w + sw;
              if (src_data[sidx] > max_val) {
                max_val = src_data[sidx];
              }
            } // for sw
          } // for sh
          dst_data[didx] = max_val;

        } // for dw
      } // for dh

      src_data += src_channel_off;
      dst_data += dst_channel_off;
    } // for c
  } // for n

  output->CopyData(num, channels, dst_h, dst_w, dst_head);
  delete[] dst_head;
  CheckOutput();
}
Exemplo n.º 4
0
void AliAnalysisTaskFilteredTest(const char *esdList,
                                 Int_t run = 0,
                                 Float_t scalingTracks = 1,
                                 Float_t scalingV0 = 1,
                                 Float_t scalingFriend = 1,
                                 const char *ocdb = "cvmfs://",
                                 Int_t nFiles = 100000,
                                 Int_t firstFile = 0,
                                 Int_t nEvents = 1000000000,
                                 Int_t firstEvent = 0,
                                 Bool_t mc = kFALSE)
{
    TStopwatch timer;
    timer.Start();
 
    printf("\n\n\n");
    printf("scalingTracks=%d\n",scalingTracks);
    printf("scalingV0=%d\n",scalingV0);
    printf("nFiles=%d\n",nFiles);

    gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT -I$ALICE_ROOT/TRD");

    //____________________________________________//
    // Make the analysis manager
    AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
    mgr->SetDebugLevel(0);

    AliESDInputHandler* esdH = new AliESDInputHandler();
    //esdH->SetReadFriends(1);
    esdH->SetReadFriends(1);
    mgr->SetInputEventHandler(esdH);  

    // Enable MC event handler
    AliMCEventHandler* handlerMC = new AliMCEventHandler;
    //handler->SetReadTR(kFALSE);
    if (mc) mgr->SetMCtruthEventHandler(handlerMC);

    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskCDBconnect.C");
    AddTaskCDBconnect(ocdb,run);

    if (gSystem->AccessPathName("localOCDBaccessConfig.C", kFileExists)==0) {
      gROOT->LoadMacro("localOCDBaccessConfig.C");
      localOCDBaccessConfig();
    }
    // Create input chain
    TChain* chain = AliXRDPROOFtoolkit::MakeChain(esdList, "esdTree",0,nFiles,firstFile);

    if(!chain) {
        printf("ERROR: chain cannot be created\n");
        return;
    }
    chain->Lookup();
  

    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
    Bool_t isMC=kFALSE; // kTRUE in case of MC
    AddTaskPIDResponse(isMC); 

    //
    // Wagons to run 
    //
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskFilteredTree.C");
    AliAnalysisTaskFilteredTree* task = (AliAnalysisTaskFilteredTree*)AddTaskFilteredTree("Filtered.root");
    task->SetLowPtTrackDownscaligF(scalingTracks);
    task->SetLowPtV0DownscaligF(scalingV0);
    task->SetFriendDownscaling(scalingFriend);
    task->SetUseESDfriends(kTRUE);
    task->Dump();
    // Init
    if (!mgr->InitAnalysis()) 
        mgr->PrintStatus();
    //
    // Run on dataset
    mgr->StartAnalysis("local",chain,nEvents, firstEvent);
    timer.Stop();
    timer.Print();
    delete mgr;
    CheckOutput();
}