예제 #1
0
void aida2tree::read_mapping()
{
    std::ifstream inpf("FEE_table.txt",std::ios::in);
    if (inpf.fail()){
        cout<<"No Mapping table is given"<<endl;
        return;
    }
    std::cout<<"Start reading mapping"<<std::endl;
    //reset
    for (Int_t i=0;i<n_fee64;i++){
        for (Int_t j=0;j<NumChFee;j++){
            FEEtoDSSD[i][j]=-1;
            FEEtoStrip[i][j]=-1;
        }
    }
    //do mapping
    Int_t FEE_index,ch_index,DSSD_index,strip_index;
    //basiclly index=fee_index*ch_index!
    while (inpf.good()){
        inpf>>FEE_index>>ch_index>>DSSD_index>>strip_index;
        //std::cout<<FEE_index<<ch_index<<DSSD_index<<strip_index<<std::endl;
        FEEtoDSSD[FEE_index][ch_index]=DSSD_index;
        FEEtoStrip[FEE_index][ch_index]=strip_index;
    }
    flag_mapping=true;
    inpf.close();
}
예제 #2
0
//________________________________________________________________________________
TChain* CreateChainTXT(const char* inpData)
{
  const char* chName="esdTree";
  TChain* chain = new TChain(chName);
  //
  TString inpDtStr = inpData;
  if (inpDtStr.EndsWith(".root")) {
    chain->AddFile(inpData);
  }
  else {
    //
    ifstream inpf(inpData);
    if (!inpf.good()) {
      printf("Failed on input filename %s\n",inpData);
      return kFALSE;
    }
    //
    TString flName;
    flName.ReadLine(inpf);
    while ( !flName.IsNull() ) {
      flName = flName.Strip(TString::kBoth,' ');
      if (flName.BeginsWith("//") || flName.BeginsWith("#")) {flName.ReadLine(inpf); continue;}
      flName = flName.Strip(TString::kBoth,',');
      flName = flName.Strip(TString::kBoth,'"');
      if (flName.EndsWith("Barrel.root")) barrelFlag = kTRUE;
      printf("Adding %s\n",flName.Data());
      chain->AddFile(flName.Data());
      flName.ReadLine(inpf);
    }
  }
  //
  int n = chain->GetEntries();
  if (n<1) {
    printf("Obtained chain is empty\n");
    return kFALSE;
  }
  printf("Created chain with %d entries in %d trees from %s\n",chain->GetEntries(),chain->GetNtrees(),inpData);
  return chain;
}
예제 #3
0
파일: Setup.cpp 프로젝트: lance6716/SPDZ-2
// Only read enough to initialize the fields (i.e. for OT offline or online phase only)
void read_setup(const string& dir_prefix)
{
  int lg2;
  bigint p;

  string filename = dir_prefix + "Params-Data";

  // backwards compatibility hack
  if (dir_prefix.compare("") == 0)
    filename = string(PREP_DIR "Params-Data");

  cerr << "loading params from: " << filename << endl;
  ifstream inpf(filename.c_str());
  if (inpf.fail()) { throw file_error(filename.c_str()); }
  inpf >> p;
  inpf >> lg2;

  inpf.close();

  gfp::init_field(p);
  gf2n::init_field(lg2);
}
예제 #4
0
   void EOPDataStore::loadIGSFile(std::string igsFile)
      throw(FileMissingException)
   {
      ifstream inpf(igsFile.c_str());
      if(!inpf) 
      {
         FileMissingException fme("Could not open IERS file " + igsFile);
         GPSTK_THROW(fme);
      }

      clear();

      // first we skip the header section
      // skip the header

      //version 2
      //EOP  SOLUTION
      //  MJD         X        Y     UT1-UTC    LOD   Xsig   Ysig   UTsig LODsig  Nr Nf Nt     Xrt    Yrt  Xrtsig Yrtsig   dpsi    deps
      //               10**-6"        .1us    .1us/d    10**-6"     .1us  .1us/d                10**-6"/d    10**-6"/d        10**-6

      string temp;
      getline(inpf,temp);	
      getline(inpf,temp);  
      getline(inpf,temp);  
      getline(inpf,temp);  

      bool ok (true);
      while(!inpf.eof() && inpf.good()) 
      {
         string line;
         getline(inpf,line);
         StringUtils::stripTrailing(line,'\r');
         if(inpf.eof()) break;

         // line length is actually 185
         if(inpf.bad() || line.size() < 120) { ok = false; break; }

         istringstream istrm(line);
         
         double mjd(0.0),xp(0.0),yp(0.0),UT1mUTC(0.0),dPsi(0.0),dEps(0.0);
         
         istrm >> mjd >> xp >> yp >> UT1mUTC;

         for(int i=0;i<12;i++) istrm >> temp;

         istrm >> dPsi >> dEps;
         
         xp *= 1e-6;
         yp *= 1e-6;
         UT1mUTC *= 1e-7;
         
         dPsi *= 1e-6;
         dEps *= 1e-6;

         addEOPData(MJD(mjd,TimeSystem::UTC), EOPData(xp,yp,UT1mUTC,dPsi,dEps));
      };
      inpf.close();

      if(!ok) 
      {
         FileMissingException fme("IERS File " + igsFile
                                  + " is corrupted or wrong format");
         GPSTK_THROW(fme);
      }
   }