当前位置: 首页>>代码示例>>C++>>正文


C++ Mapper::ModuleXY方法代码示例

本文整理汇总了C++中Mapper::ModuleXY方法的典型用法代码示例。如果您正苦于以下问题:C++ Mapper::ModuleXY方法的具体用法?C++ Mapper::ModuleXY怎么用?C++ Mapper::ModuleXY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mapper的用法示例。


在下文中一共展示了Mapper::ModuleXY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dqmDisplay

// inputs data file and event in file to display (default is to integrate all)
void dqmDisplay(TString fdat, int ndisplay = -1){

  gStyle->SetOptStat(0);

  TFile *f = new TFile(fdat);
  if (f->IsZombie()){
    cout << "Cannot open file: " << fdat << endl;
    return;
  }

  TBEvent *event = new TBEvent();
  TTree *t1041 = (TTree*)f->Get("t1041"); 
  TBranch *bevent = t1041->GetBranch("tbevent");
  bevent->SetAddress(&event);

  Bool_t singleEvent = (ndisplay >= 0);

  Mapper * mapper = Mapper::Instance();

  TH2F * hModU = (TH2F*)moduleHistogram(true, "RO", threshold, 2500, singleEvent);
  TH2F * hModD = (TH2F*)moduleHistogram(false, "RO", threshold, 2500, singleEvent);
  TH2F * hChanU = (TH2F*)channelHistogram(true, "RO", threshold, 2500, singleEvent);
  TH2F * hChanD = (TH2F*)channelHistogram(false, "RO", threshold, 2500, singleEvent);

  TH2F * hModU_time = (TH2F*)moduleHistogram(true, "Timing", 0, -1, singleEvent);
  TH2F * hModD_time = (TH2F*)moduleHistogram(false, "Timing", 0, -1, singleEvent);
  TH2F * hChanU_time = (TH2F*)channelHistogram(true, "Timing", 0, -1, singleEvent);
  TH2F * hChanD_time = (TH2F*)channelHistogram(false, "Timing", 0, -1, singleEvent);

  int nPerMod = t1041->GetEntries() / 16;
  int nPerFiber = t1041->GetEntries() / 64;

  TH2F * hModU_nhits = (TH2F*)moduleHistogram(true, "nHits", nPerMod * .85, nPerMod * 1.1, singleEvent);
  TH2F * hModD_nhits = (TH2F*)moduleHistogram(false, "nHits", nPerMod * .85, nPerMod * 1.1, singleEvent);
  TH2F * hChanU_nhits = (TH2F*)channelHistogram(true, "nHits", nPerFiber * .25, nPerFiber * 1.1, singleEvent);
  TH2F * hChanD_nhits = (TH2F*)channelHistogram(false, "nHits", nPerFiber * .25, nPerFiber * 1.1, singleEvent);

  TH2F * hModU_ntriggers = (TH2F*)moduleHistogram(true, "nTriggers", nPerMod * .95, nPerMod * 1.3, singleEvent);
  TH2F * hModD_ntriggers = (TH2F*)moduleHistogram(false, "nTriggers", nPerMod * .95, nPerMod * 1.3, singleEvent);
  TH2F * hChanU_ntriggers = (TH2F*)channelHistogram(true, "nTriggers", nPerFiber * .95, nPerFiber * 1.3, singleEvent);
  TH2F * hChanD_ntriggers = (TH2F*)channelHistogram(false, "nTriggers", nPerFiber * .95, nPerFiber * 1.3, singleEvent);

  Int_t start = 0; 
  Int_t end = t1041->GetEntries();

  if (singleEvent) {
    start = ndisplay;
    end = ndisplay + 1;
  }

  for (Int_t i=start; i < end; i++) {
    t1041->GetEntry(i);
    for (Int_t j = 0; j < event->NPadeChan(); j++){
      PadeChannel pch = event->GetPadeChan(j);

      UShort_t max = pch.GetMax();
      Int_t maxTime = pch.GetPeak();
      if (max>MAXADC) continue;    // skip channels with bad adc readings (should be RARE)

      int channelID=pch.GetChannelID();   // boardID*100+channelNum in PADE
      int moduleID,fiberID;
      mapper->ChannelID2ModuleFiber(channelID,moduleID,fiberID);  // get module and fiber IDs

      float xm,ym,xf,yf;
      mapper->ModuleXY(moduleID,xm,ym);
      mapper->FiberXY(fiberID, xf, yf);
	    
      if(moduleID < 0) {
	hModU_ntriggers->Fill(xm, ym);
	hChanU_ntriggers->Fill(xf, yf);
      }
      else {
	hModD_ntriggers->Fill(xm, ym);
	hChanD_ntriggers->Fill(xf, yf);
      }
      if(max <= threshold) continue;


      if (moduleID < 0) {
	hModU->Fill(xm, ym, max);
	hModU_time->Fill(xm, ym, maxTime);
	hModU_nhits->Fill(xm, ym);

	hChanU->Fill(xf, yf, max);
	hChanU_time->Fill(xf, yf, maxTime);
	hChanU_nhits->Fill(xf, yf);
      }
      else {
	hModD->Fill(xm, ym, max);
	hModD_time->Fill(xm, ym, maxTime);
	hModD_nhits->Fill(xm, ym);

	hChanD->Fill(xf, yf, max);
	hChanD_time->Fill(xf, yf, maxTime);
	hChanD_nhits->Fill(xf, yf);
      }
      
    }

//.........这里部分代码省略.........
开发者ID:ShashlikTB,项目名称:T1041,代码行数:101,代码来源:dqmPlots.C

示例2: beamPosition


//.........这里部分代码省略.........
  float c_d_maxADC = 0;
  float c_d_maxX = -99;
  float c_d_maxY = -99;
  
  for (Int_t j = 0; j < event->NPadeChan(); j++){
   if (haverechits && j>=(int)rechits->size()) break;
   
   double ped,sig, max, maxTime;
   int channelID;
   
   if (haverechits){
    TBRecHit &hit=rechits->at(j);
    ped=hit.Pedestal();
    sig=hit.NoiseRMS();
    max=hit.AMax();
    maxTime=hit.TRise();
    channelID=hit.GetChannelID();
   }
   else{
    PadeChannel pch = event->GetPadeChan(j);
    pch.GetPedestal(ped,sig);
    max = pch.GetMax()-ped;
    maxTime = pch.GetPeak();
    channelID=pch.GetChannelID();   // boardID*100+channelNum in PADE
   }
   
   if (max<0.1) continue;
   
   int moduleID,fiberID;
   mapper->ChannelID2ModuleFiber(channelID,moduleID,fiberID);  // get module and fiber IDs
   
      
   double x,y;
   mapper->ModuleXY(moduleID,x,y);
   if (moduleID<0) {
    if(max > m_u_maxADC){
     m_u_maxADC = max;
     m_u_maxX = x;
     m_u_maxY = y;
    }
   }
   else {
    if(max > m_d_maxADC){
     m_d_maxADC = max;
     m_d_maxX = x;
     m_d_maxY = y;
    }
   }
   
   mapper->FiberXY(fiberID, x, y);
   if (moduleID<0) {
    if(max > c_u_maxADC){
     c_u_maxADC = max;
     c_u_maxX = x;
     c_u_maxY = y;
    }
   }
   else {
    if(max > c_d_maxADC){
     c_d_maxADC = max;
     c_d_maxX = x;
     c_d_maxY = y;
    }
   }
   
  }
开发者ID:3wolf3,项目名称:H4TestBeam,代码行数:67,代码来源:beamPosition.C


注:本文中的Mapper::ModuleXY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。