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


C++ TObjArray::SetName方法代码示例

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


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

示例1: AliOADBContainer

///
/// Update OADB Container for EMCal energy recalibration factors
/// from external file. 
///
/// \param fileNameOADB: OADB file name and path
/// \param fileNameRecalibFactors: name and path of input file with new factors
///
void UpdateEMCAL_OADB_Recalib
(
 const char *fileNameOADB="EMCALRecalib_input4test.root",
 const char *fileNameRecalibFactors="/cebaf/cebaf/EMCAL/calibPi0_run2/createOCDB_4_with2015data_Nov2016finalCalib/multiplyPi0CalibrationFactors_TextToHisto_Final.root"
 )
{

gSystem->Load("libOADB");  

AliOADBContainer *con	= new AliOADBContainer("");
con->InitFromFile(fileNameOADB, "AliEMCALRecalib"); //Updating the original OADB file, output will be written into BetaRecalib.root 

// **** Loading the root files with Recalibration Factors:
TFile* fRecalibFactors=new TFile(fileNameRecalibFactors);

TObjArray *arrayRecalibFactors = new TObjArray(kNbSMtot);
arrayRecalibFactors->SetName("Recalib");

char name[30];


// Filling The objects above with the EMCALRecalFactors_SM Histos:
for (Int_t iSM=0;iSM<kNbSMtot;iSM++){
    cout<<"SM "<< iSM<<endl;
    sprintf(name,"EMCALRecalFactors_SM%d",iSM);
    cout<<"Recalib : "<<name<<endl;
    arrayRecalibFactors->Add(fRecalibFactors->Get(name));
    } //iSM


//********************************************************************
// Setting Periods
//**** Adding pass object to period Object ****/
//When updating object that has already been created. For instance, adding pass2,3 etc.
//Just get the object and add new array. Append of runnumber is already done in this case.

/*TObjArray *array13b = (TObjArray*)con->GetObject(195345,"LHC13b");
TObjArray *array13c = (TObjArray*)con->GetObject(195529,"LHC13c");          
TObjArray *array13d = (TObjArray*)con->GetObject(195681,"LHC13d");
TObjArray *array13e = (TObjArray*)con->GetObject(195935,"LHC13e");
TObjArray *array13f = (TObjArray*)con->GetObject(196433,"LHC13f");


TObjArray *array13b_pass3 = new TObjArray(kNbSMtot); array13b_pass3->SetName("pass3");  array13b_pass3->Add(*&arrayRecalibFactors);
TObjArray *array13c_pass2 = new TObjArray(kNbSMtot); array13c_pass2->SetName("pass2");  array13c_pass2->Add(*&arrayRecalibFactors);
TObjArray *array13d_pass2 = new TObjArray(kNbSMtot); array13d_pass2->SetName("pass2");  array13d_pass2->Add(*&arrayRecalibFactors);
TObjArray *array13e_pass2 = new TObjArray(kNbSMtot); array13e_pass2->SetName("pass2");  array13e_pass2->Add(*&arrayRecalibFactors);
TObjArray *array13f_pass2 = new TObjArray(kNbSMtot); array13f_pass2->SetName("pass2");  array13f_pass2->Add(*&arrayRecalibFactors);

array13b->Add(*&array13b_pass3);
array13c->Add(*&array13c_pass2);
array13d->Add(*&array13d_pass2);
array13e->Add(*&array13e_pass2);
array13f->Add(*&array13f_pass2);*/

 TObjArray *array15_pass1 = new TObjArray(kNbSMtot);
 TObjArray *array15_pass2 = new TObjArray(kNbSMtot);
 TObjArray *array15_pass3 = new TObjArray(kNbSMtot);
 array15_pass1->SetName("pass1");
 array15_pass2->SetName("pass2");
 array15_pass3->SetName("pass3");
 array15_pass1->Add(*&arrayRecalibFactors);
 array15_pass2->Add(*&arrayRecalibFactors);
 array15_pass3->Add(*&arrayRecalibFactors);

con->WriteToFile("BetaRecalib.root");

//test(195935); // If someone wants to test container

}
开发者ID:ktf,项目名称:AliPhysics,代码行数:77,代码来源:UpdateEMCAL_OADB_Recalib.C

示例2: SetUserTree


//.........这里部分代码省略.........
   //    root[0] T->Draw("PARNAME", "PARNAME_M")
   // will histogram the value of PARNAME for each event in which it is present.
   // (if the selection condition "PARNAME_M" is not used, the histogram will also be filled with a 0
   // for each event in which PARNAME does not appear).
   //          N.B. the PARNAME alias is in fact the sum of the values of PARNAME in each event.
   //          If PARNAME_M>1 in some events, it is not the individual values but their sum which will
   //          be histogrammed in this case.
   //
   // Thus, if the data file has parameters called "PAR_1" and "PAR_2",
   // the following command will work
   //
   //    root[0]  T->Draw("PAR_1:PAR_2", "PAR_1_M&&PAR_2_M", "col")
   //
   // even though no branches "PAR_1" or "PAR_2" exist.
   //
   //
   //
   //    opt = "leaves":
   //
   // The TTree will have a branch/leaf for each parameter. This option is slower and produces
   // larger files.
   //
   // If the option string contains both "arrays" and "leaves", then both structures will be used
   // (in this case there is a high redundancy, as each parameter is stored twice).
   //
   // The full list of parameters is stored in a TObjArray in the list returned by TTree::GetUserInfo().
   // Each parameter is represented by a TNamed object.
   // In order to retrieve the name of the parameter with index 674 (e.g. taken from branch ParNum),
   // do:
   //     TObjArray* parlist = (TObjArray*) T->GetUserInfo()->FindObject("ParameterList");
   //     cout << "Par 674 name = " << (*parlist)[674]->GetName() << endl;
   //
   //
   //  Automatic creation & filling of Scalers TTree
   //
   // give an option string containing "scalers", i.e. "leaves,scalers", or "ARRAYS+SCALERS", etc.
   // a TTree with name 'Scalers' will be created, all scaler buffers will be written in it.


   TString option = opt;
   option.ToUpper();
   make_arrays = option.Contains("ARRAYS");
   make_leaves = option.Contains("LEAVES");
   Bool_t make_scalers = option.Contains("SCALERS");
   if(make_scalers){
   	fGanilData->SetScalerBuffersManagement(GTGanilData::kAutoWriteScaler);
   }

   fUserTree = T;
   if( make_arrays ){
      Int_t maxParFired = GetRawDataParameters()->GetEntries();
      ParVal = new UShort_t[maxParFired];
      ParNum = new UInt_t[maxParFired];
      fUserTree->Branch("NbParFired", &NbParFired, "NbParFired/I");
      fUserTree->Branch("ParNum", ParNum, "ParNum[NbParFired]/i");
      fUserTree->Branch("ParVal", ParVal, "ParVal[NbParFired]/s");
   }
   if( make_leaves ){
      TIter next_rawpar( GetRawDataParameters() );
      KVACQParam* acqpar;
      while( (acqpar = (KVACQParam*)next_rawpar()) ){
         TString leaf;
         leaf.Form("%s/S", acqpar->GetName());
         // for parameters with <=8 bits only use 1 byte for storage
         if(acqpar->GetNbBits()<=8) leaf += "1";
         fUserTree->Branch( acqpar->GetName(), *(acqpar->ConnectData()), leaf.Data() );
      }
   }

#if ROOT_VERSION_CODE > ROOT_VERSION(5,25,4)
#if ROOT_VERSION_CODE < ROOT_VERSION(5,26,1)
   // The TTree::OptimizeBaskets mechanism is disabled, as for ROOT versions < 5.26/00b
   // this lead to a memory leak
   fUserTree->SetAutoFlush(0);
#endif
#endif

   // add list of parameter names in fUserTree->GetUserInfos()
   // and if option="arrays" add aliases for each parameter & its multiplicity
	
	// TObjArray has to be as big as the largest parameter number in the list
	// of raw data parameters. So first loop over parameters to find max param number.
    UInt_t maxpar = 0;
   TIter next(GetRawDataParameters());
   KVACQParam* par;
	while( (par=(KVACQParam*)next()) ) if (par->GetNumber()>maxpar) maxpar=par->GetNumber();
	
   TObjArray *parlist = new TObjArray(maxpar,1);
   parlist->SetName("ParameterList");
	
	next.Reset();
   while( (par = (KVACQParam*)next()) ){
      parlist->AddAt( new TNamed( par->GetName(), Form("index=%d",par->GetNumber()) ), par->GetNumber() );
      if( make_arrays ){
          fUserTree->SetAlias( par->GetName(), Form("Sum$((ParNum==%d)*ParVal)", par->GetNumber() ) );
          fUserTree->SetAlias( Form("%s_M", par->GetName()), Form("Sum$(ParNum==%d)", par->GetNumber() ) );
      }
   }
   fUserTree->GetUserInfo()->Add(parlist);
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:101,代码来源:KVGANILDataReader.cpp

示例3: ProcessSummary

TObjArray* ProcessSummary(TObjArray* arrs, int icl, const char* pref)
{
  // Process TObjArray (e.g. for set of pt bins) of TObjArray of KMCTrackSummary objects:
  // pick the KMCTrackSummary for "summary class" icl (definition of acceptable track) and create
  // graphs vs bin.
  // These graphs are returned in new TObjArray
  //
  TString prefs = pref;
  if (!gs) gs = new TF1("gs","gaus",-1,1);
  //
  int nb = arrs->GetEntriesFast();
  TObjArray* sums = (TObjArray*) arrs->At(0);
  int nclass = sums->GetEntriesFast();
  if (icl>=nclass) {printf("summary set has %d classes only, %d requested\n",nclass,icl);return 0;}
  //
  KMCTrackSummary* sm = (KMCTrackSummary*)sums->At(icl);
  //
  TH1* h;
  //
  h = sm->GetHMCSigDCARPhi();  // MC resolution in transverse DCA 
  TGraphErrors * grSigD = 0;
  if (h) {
    grSigD = new TGraphErrors(nb);
    grSigD->SetName(Form("%s%s",prefs.Data(),h->GetName()));
    grSigD->SetTitle(Form("%s%s",prefs.Data(),h->GetTitle()));
  }
  //
  TGraphErrors * grSigZ = 0;
  h = sm->GetHMCSigDCAZ();    // MC resolution in Z DCA
  if (h) {
    grSigZ = new TGraphErrors(nb);
    grSigZ->SetName(Form("%s%s",prefs.Data(),h->GetName()));
    grSigZ->SetTitle(Form("%s%s",prefs.Data(),h->GetTitle()));
  }
  //
  TGraphErrors * grSigAD = 0; // anaitical estimate for resolution in transverse DCA 
  {
    grSigAD = new TGraphErrors(nb);
    grSigAD->SetName(Form("%s%s",prefs.Data(),"sigmaDan"));
    grSigAD->SetTitle(Form("%s%s",prefs.Data(),"#sigmaD an"));
  }
  //
  TGraphErrors * grSigAZ = 0; // anaitical estimate for resolution in Z DCA 
  {
    grSigAZ = new TGraphErrors(nb);
    grSigAZ->SetName(Form("%s%s",prefs.Data(),"sigmaZan"));
    grSigAZ->SetTitle(Form("%s%s",prefs.Data(),"#sigmaZ an"));
  }
  //
  //
  TGraphErrors * grSigPt = 0; // MC res. in pt
  {
    grSigPt = new TGraphErrors(nb);
    grSigPt->SetName(Form("%s%s",prefs.Data(),"sigmaPt"));
    grSigPt->SetTitle(Form("%s%s",prefs.Data(),"#sigmaPt"));
  }
  //
  TGraphErrors * grSigAPt = 0; // analitycal res. in pt
  {
    grSigAPt = new TGraphErrors(nb);
    grSigAPt->SetName(Form("%s%s",prefs.Data(),"sigmaPtan"));
    grSigAPt->SetTitle(Form("%s%s",prefs.Data(),"#sigmaPt an"));
  }

  //
  TGraphErrors * grEff = 0; // MC efficiency
  {
    grEff = new TGraphErrors(nb);
    grEff->SetName(Form("%s_rate",prefs.Data()));
    grEff->SetTitle(Form("%s Rate",prefs.Data()));
  }
  //
  TGraphErrors * grUpd = 0; // number of Kalman track updates
  {
    grUpd = new TGraphErrors(nb);
    grUpd->SetName(Form("%s_updCalls",prefs.Data()));
    grUpd->SetTitle(Form("%s Updates",prefs.Data()));
  }
  //
  for (int ib=0;ib<nb;ib++) {
    sums = (TObjArray*) arrs->At(ib);
    sm = (KMCTrackSummary*)sums->At(icl);
    KMCProbe& prbRef = sm->GetRefProbe();
    KMCProbe& prbAn  = sm->GetAnProbe();
  
    double pt = prbRef.Pt();
    //
    if (grSigAD) {
      grSigAD->SetPoint(ib, pt,prbAn.GetSigmaY2()>0 ? TMath::Sqrt(prbAn.GetSigmaY2()) : 0.);
    }
    //
    if (grSigAZ) {
      grSigAZ->SetPoint(ib, pt,prbAn.GetSigmaZ2()>0 ? TMath::Sqrt(prbAn.GetSigmaZ2()) : 0.);
    }
    //
    if (grSigAPt) {
      double pts = TMath::Sqrt(prbAn.GetSigma1Pt2());
      grSigAPt->SetPoint(ib, pt,pts>0 ? pts*pt : 0.);
    }
    //
//.........这里部分代码省略.........
开发者ID:alisw,项目名称:AliRoot,代码行数:101,代码来源:PrepSummaryKMC.C


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