Locked History Actions

attachment:makevsta.C of ANAROOT/Macros

Attachment 'makevsta.C'

Download

void makevsta(){
// use if these are not loaded
// gSystem->Load("libanacore.so");
// gSystem->Load("libXMLParser.so");
// gSystem->Load("libanasamurai.so");

  const int Fpl=1;
  const int DetID_NEBULAA=42;
  const int nch_NEBULA=144;
  TString file_peakU ="ped_peak.txt" ;//temporary
  TString file_sigmaU="ped_sigma.txt";//temporary
  TString file_peakD ="ped_peak.txt" ;//temporary
  TString file_sigmaD="ped_sigma.txt";//temporary

  vector<double> peak_U;
  vector<double> sigma_U;
  vector<double> peak_D;
  vector<double> sigma_D;

  double val;

  // read peak values (UP)
  ifstream ifs1(file_peakU);
  while ( ifs1 >> val ) peak_U.push_back(val);
  ifs1.close();

  // read sigma values (UP)
  ifstream ifs2(file_sigmaU);
  while ( ifs2 >> val ) sigma_U.push_back(val);
  ifs2.close();

  // read peak values (DOWN)
  ifstream ifs3(file_peakD);
  while ( ifs3 >> val ) peak_D.push_back(val);
  ifs3.close();

  // read sigma values (DOWN)
  ifstream ifs4(file_sigmaD);
  while ( ifs4 >> val ) sigma_D.push_back(val);
  ifs4.close();

  // calculate THE value for vsta file
  int nch=peak_U.size();//assume nch of DOWN is same as UP
  vector<int> THE_U;
  vector<int> THE_D;
  for(int i=0;i<nch;i++){
    val = (peak_U[i]+5*sigma_U[i])/2;
    THE_U.push_back((int)val);
    val = (peak_D[i]+5*sigma_D[i])/2;
    THE_D.push_back((int)val);
  }

  TArtNEBULAParameters *setup = new TArtNEBULAParameters();
  setup->LoadParameter("db/NEBULA.xml");
  TArtRIDFMap map;
  for (int igeo=21;igeo<31;igeo++){
    bool igeo_use=false;
    for (int ich=0;ich<32;ich++){
      map = TArtRIDFMap(Fpl,DetID_NEBULAA,igeo,ich);
      TArtNEBULAPlaPara *para = setup->FindNEBULAPlaPara(map);
      if (para==NULL) {
          printf("0x%x THE %3i %3i\n",igeo2addr(igeo),ich,255);
      }else{
        int id = para->GetID(); 
        if (para->GetDetectorName()=="Interrupt"){
          printf("0x%x THE %3i %3i\n",igeo2addr(igeo),ich,0);
        }else if (id<nch_NEBULA+1) {
          if (para->GetUDLR()=="U") {
            if (!igeo_use){
              igeo_use=true;
              cout<<"--- igeo ="<<igeo<<endl;
              cout<<"    ich THE"<<endl;
            }
            printf("0x%x THE %3i %3i\n",igeo2addr(igeo),ich,THE_U[id-1]);
          }else if (para->GetUDLR()=="D") {
            if (!igeo_use){
              igeo_use=true;
              cout<<"--- igeo ="<<igeo<<endl;
              cout<<"    ich THE"<<endl;
            }
            printf("0x%x THE %3i %3i\n",igeo2addr(igeo),ich,THE_D[id-1]);
          }
        }
      }
    }
  }

  return;
}

//__________________________________________________________
int igeo2addr(int igeo){
  int moduleid=igeo-21;// the first id = 0
  int moduleaddr = 0x0500 + moduleid;
  return moduleaddr;
}

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2012-11-02 05:21:15, 1.6 KB) [[attachment:BPCHist.C]]
  • [get | view] (2013-02-27 09:18:59, 0.8 KB) [[attachment:CoinHist.C]]
  • [get | view] (2012-11-02 05:10:49, 2.6 KB) [[attachment:FDC2Hist.C]]
  • [get | view] (2012-11-02 04:31:49, 2.1 KB) [[attachment:HODHist.C]]
  • [get | view] (2012-11-02 04:31:32, 1.6 KB) [[attachment:ICBHist.C]]
  • [get | view] (2014-12-31 11:41:13, 19.5 KB) [[attachment:OnlineMonitor.cc]]
  • [get | view] (2014-12-31 11:41:02, 2.6 KB) [[attachment:OnlineMonitor.hh]]
  • [get | view] (2012-11-02 05:25:41, 1.7 KB) [[attachment:PlaHist.C]]
  • [get | view] (2012-02-15 09:14:24, 3.2 KB) [[attachment:ch2ns.C]]
  • [get | view] (2012-02-15 10:05:13, 3.0 KB) [[attachment:getlandaupeak.C]]
  • [get | view] (2012-02-15 09:14:53, 2.7 KB) [[attachment:getped.C]]
  • [get | view] (2012-02-13 09:49:04, 2.6 KB) [[attachment:makevsta.C]]
  • [get | view] (2012-02-19 14:44:04, 0.5 KB) [[attachment:slew.C]]

You are not allowed to attach a file to this page.