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


C++ TObjString::GetName方法代码示例

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


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

示例1: GetRunInfos

void KVAvailableRunsFile::GetRunInfos(Int_t run, KVList * dates,
                                      KVList * files)
{
   //Look for a given run number in the file, and read the file's modification date/time and filename
   //These informations are stored in the two TList as TObjString objects (these objects belong to the
   //lists and will be deleted by them).
   //We do not stop at the first run found, but continue until the end of the file, adding
   //informations for every occurence of the run in the file.
   //If available runs file does not exist, Update() is called to create it.

   //does runlist exist ?
   if (!OpenAvailableRunsFile()) {
      Error("GetRunInfos", "Error opening available runs file");
      return;
   }
   //clear lists - delete objects
   dates->Delete();
   files->Delete();

   //loop over lines in fRunlist file
   //look for line beginning with 'run|'
   TString line;
   line.ReadLine(fRunlist);
   while (fRunlist.good()) {
      if (line.BeginsWith(Form("%d|", run))) {

         //found it
         TObjArray *toks = line.Tokenize('|');  // split into fields
         // check date is not identical to a previous entry
         // i.e. there are spurious duplicate entries
         TObjString* rundate = (TObjString*)toks->At(1)->Clone();
         if(dates->FindObject(rundate->GetName())){
             delete toks;
             delete rundate;
             line.ReadLine(fRunlist);
             continue;
         }
         //add date string
         dates->Add(toks->At(1)->Clone());

         //backwards compatibility
         //an old available_runs file will not have the filename field
         //in this case we assume that the name of the file is given by the
         //dataset's base file name (i.e. with no date/time suffix)
         if (toks->GetEntries() > 2) {
            files->Add(toks->At(2)->Clone());
         } else {
            files->
                Add(new
                    TObjString(fDataSet->
                               GetBaseFileName(GetDataType(), run)));
         }
         delete toks;

      }
      line.ReadLine(fRunlist);
   }
   CloseAvailableRunsFile();
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:59,代码来源:KVAvailableRunsFile.cpp

示例2: AddGroups

//___________________________________________________________________________//
void KVParticle::AddGroups(KVUniqueNameList* un)
{
   //list of groups added to the current one
   TObjString* os = 0;
   TIter no(un);
   while ((os = (TObjString*)no.Next())) {
      AddGroup(os->GetName());
   }

}
开发者ID:GiuseppePast,项目名称:kaliveda,代码行数:11,代码来源:KVParticle.cpp

示例3: ListGroups

void KVParticle::ListGroups(void) const
{
   //List all stored groups
   if (!fGroups.GetEntries()) {
      cout << "Cette particle n appartient a aucun groupe" << endl;
      return;
   } else {
      cout << "--------------------------------------------------" << endl;
      cout << "Liste des groupes auxquels la particule appartient" << endl;
   }
   TObjString* os = 0;
   TIter no(GetGroups());
   while ((os = (TObjString*)no.Next())) cout << os->GetName() << endl;
   cout << "--------------------------------------------------" << endl;
}
开发者ID:GiuseppePast,项目名称:kaliveda,代码行数:15,代码来源:KVParticle.cpp

示例4: SetupReweighting


//.........这里部分代码省略.........
   *
   * How to reweigh can be specifed as 
   *
   * - + or up   Increase weights (for pt < 0.05 by +30%)
   * - - or down Decrease weights (for pt < 0.05 by -30%)
   * - If none of these are given, then the weights are used as is. 
   * 
   * If pid rewighting is done and one of up or down are given, then
   * one can specify which particle type to reweigh
   *
   * - pi or pion    Reweight (up or down) pions 
   * - K  or kaon    Reweight (up or down) kaons
   * - p  or proton  Reweight (up or down) protons 
   *
   * Note, if PID, with explicit selection of pions, and strangeness
   * reweighting are specified, then the up/down flag applies to both
   * PID reweighting and the strangeness reweighting
   * 
   * @param task The task to modify 
   */
  void SetupReweighting(AliAnalysisTaskSE* task)
  {
    TString sel = fOptions.AsString("reweight");
    sel.ToLower();
    if (sel.IsNull() || sel.BeginsWith("no"))
      return;

    TList       files;
    Int_t       what = 0;
    Int_t       opt  = 0;
    TObjArray*  tokens = sel.Tokenize(", ");
    TIter       next(tokens);
    TObjString* ostr;
    // First find what should be done 
    while ((ostr = static_cast<TObjString*>(next()))) {
      const TString& token = ostr->String();
      
      if      (token.EqualTo("pt"))   {
	what |= 0x1;
	files.Add(new TObjString("REWEIGHTpt.root"));
	Printf("Will reweigh in pT");
      }
      else if (token.EqualTo("pid")) {
	what |= 0x2;
	Printf("Will reweigh particle species");
      }
      else if (token.EqualTo("str"))  {
	what |= 0x4;
	Printf("Will reweight particles from strange weak decays");
      }
    }
    if (what == 0x0) return;
    
    // Now figure out how to do it 
    next.Reset();
    TString part;
    while ((ostr = static_cast<TObjString*>(next()))) {
      const TString& token = ostr->String();
      Int_t aOpt = TMath::Abs(opt);
      if      (token.EqualTo("up")   || token.EqualTo("+")) 
	opt = (aOpt==0 ? +1 : +aOpt); 
      else if (token.EqualTo("down") || token.EqualTo("-"))
	opt = (aOpt==0 ? -1 : -aOpt);
      else if (token.EqualTo("pi")   || token.EqualTo("pion")){
	  opt = 1; part = "pi";
      }
      else if (token.EqualTo("k")    || token.EqualTo("kaon")) {
	opt = 2; part = "ka";
      }
      else if (token.EqualTo("p")    || token.EqualTo("proton")) {	  
	opt = 3; part = "pr";
      }
    }
    if (opt != 0)
      Printf("Will reweigh %s (%c30%% for pT<0.05)",
	     opt < 0 ? "down" : "up", opt < 0 ? '-' : '+');
    if (what & 0x2) {
      if (!part.IsNull()) {
	Printf("Will reweight %s in particular", part.Data());
	part.Prepend("_");
	part.Append(opt < 0 ? "-" : "+");
      }
      files.Add(new TObjString(Form("REWEIGHTpid%s.root", part.Data())));
    }
    if (what & 0x4)
      files.Add(new TObjString(Form("REWEIGHTstr%s.root",
				    opt == -1 ? "-" :
				    opt == +1 ? "+" : "")));
    delete tokens;

    Printf("Setting reweighing flag=0x%x with option=%d", what, opt);
    SetOnTask(task, "ReweightStack", what);
    SetOnTask(task, "ReweightFlag",  opt);

    TIter nextF(&files);
    while ((ostr = static_cast<TObjString*>(nextF()))) {
      Printf("Loading reweighting file %s", ostr->GetName());
      fRailway->LoadAux(ostr->GetName());
    }
  }
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:TrackletdNdetaTrain.C

示例5: fit

void NBD::fit(){
	TFile *fdata = TFile::Open(dataname.GetName());
	TH1D *histo_obs = (TH1D*)fdata->Get(histoname.GetName());
	TFile *fGlauber = TFile::Open(Glaubername.GetName());
	TH1D *histo_exp = (TH1D*)histo_obs->Clone();
	TF1 *NBD_fun = new TF1("NBD_fun","[0]*TMath::Gamma(x+[1])/(TMath::Gamma(x+1)*TMath::Gamma([1]))*TMath::Power([2]/[1],x)/TMath::Power([2]/[1]+1,x+[1])",0,100);
	UInt_t iniseed = gRandom->GetSeed();	// reproduce the "random" numbers
	std::vector<double> muvector, kvector, chisvector, ndfvector;
	double mu,k;
	for(mu=mumin;mu<=mumax;mu+=mustep){
		for(k=kmin;k<=kmax;k+=kstep){
		//	if(npar%50==0)	cout<<"Have run "<<npar<<" parameter sets"<<endl; 
			NBD_fun->SetParameter(0,1);	//[0]: Normalized constant
			NBD_fun->SetParameter(1,k);	//[1]: k value
			NBD_fun->SetParameter(2,mu);	//[2]: mu value
			TTree *t = (TTree*)fGlauber->Get("nt_Pb_Pb");

			Float_t Ncoll, Npart, B;	Long_t Nevent;

			t->SetBranchAddress("Ncoll",&Ncoll);
			t->SetBranchAddress("Npart",&Npart);
			t->SetBranchAddress("B",&B);

			Nevent = (Long_t) t->GetEntries();
			Long_t Ev;	Int_t Bino;	Double_t Para, Bi_Para;
			gRandom->SetSeed(iniseed);
                        histo_exp->Reset("M");
			for (Ev=0; Ev<Nevent; Ev++){
				//if(Ev%100000==0)	cout<<"\t"<<"Have run "<<Ev<<" events"<<endl;
				t->GetEntry(Ev);
				Para = 0; //make sure that Para doesn't accumulate through loops
				for(Bino=0; Bino<Ncoll; Bino++){
				//	Bi_Para = unr.SampleDiscr();
					Bi_Para = NBD_fun->GetRandom();
					Para += Bi_Para;
				}
				histo_exp->Fill(Para);
			}
                double ndf;
                double chi_square = chisquare(histo_obs,histo_exp,xmin[0],xmax[0],ndf);
                if(chi_square>=0){
                    chisvector.push_back(chi_square);
                    muvector.push_back(mu);
                    kvector.push_back(k);
                    ndfvector.push_back(ndf);
                }
                cout<<mu<<"\t"<<k<<"\t"<<chi_square<<"\t"<<ndf<<endl;//<<"\t"<<ndf<<"\t"<<p<<endl;
		}
	}
	double *amu = &muvector[0];
	double *ak = &kvector[0];
	double *achis = &chisvector[0];
        int loc = TMath::LocMin(chisvector.size(),achis);
        mubest[0] = muvector[loc];
        kbest[0] = kvector[loc];
        chis[0] = chisvector[loc];
        Ndf[0] = ndfvector[loc];
	cout<<"{"<<mubest[0]<<","<<kbest[0]<<"}"<<endl;
	cout<<chis[0]<<"\t"<<Ndf[0]<<endl;

	Grgrid = new TGraph2D("Grgrid","",chisvector.size(),amu,ak,achis);
}
开发者ID:XuQiao,项目名称:HI,代码行数:62,代码来源:NBDclass.C

示例6: calcvar

void NBD::calcvar(){
	double mumin_temp = mumin;	double mumax_temp = mumax;	
	double kmin_temp = kmin;	double kmax_temp = kmax;	
	this->initmu(mubest[0],mubest[0],mustep);
	this->initk(kbest[0],kbest[0],kstep);
	this->fit();
	this->initmu(mumin_temp,mumax_temp,mustep);
	this->initk(kmin_temp,kmax_temp,kstep);
	TFile *fdata = TFile::Open(dataname.GetName());
	TH1D *histo_obs = (TH1D*)fdata->Get(histoname.GetName());
	TFile *fGlauber = TFile::Open(Glaubername.GetName());
	int binnum = histo_obs->GetNbinsX();
        double Minx = histo_obs->GetXaxis()->GetXmin();
        double Maxx = histo_obs->GetXaxis()->GetXmax();
	TH1D *histo_exp = new TH1D("histo_exp","Simulated distribution;Multiplicity;# of events",binnum,Minx,Maxx);
	TF1 *NBD_fun = new TF1("NBD_fun","[0]*TMath::Gamma(x+[1])/(TMath::Gamma(x+1)*TMath::Gamma([1]))*TMath::Power([2]/[1],x)/TMath::Power([2]/[1]+1,x+[1])",0,100);
     	NBD_fun->SetParameter(0,1);
        NBD_fun->SetParameter(1,kbest[0]);
        NBD_fun->SetParameter(2,mubest[0]);
	TTree *t = (TTree*) fGlauber ->Get("nt_Pb_Pb");
	Float_t Ncoll, Npart, B;
	Long_t Nevent;

	t->SetBranchAddress("Ncoll",&Ncoll);
	t->SetBranchAddress("Npart",&Npart);
	t->SetBranchAddress("B",&B);

	Nevent = (Long_t) t->GetEntries();
	Long_t Ev;	Int_t Bino;	Double_t Para, Bi_Para, Mult;
	
	TString treestr=Form("tree%.f.root",kbest[0]*mubest[0]*1000);
	TFile *treefile = new TFile(treestr,"Recreate");
	TTree *GlauEvent = new TTree("GlauEvent","Glauber Events");
	GlauEvent -> Branch("Mult",&Para,"Mult/D");
	GlauEvent -> Branch("Ncoll",&Ncoll,"Ncoll/F");
	GlauEvent -> Branch("Npart",&Npart,"Npart/F");
	GlauEvent -> Branch("B",&B,"B/F");

	for(Ev=0; Ev<Nevent; Ev++){
		//if(Ev%100000==0)	 cout<<"Have run "<<Ev<<" events"<<endl;
		t->GetEntry(Ev);
		Para = 0; //make sure that Para doesn't accumulate through loops
		for(Bino=0; Bino<Ncoll; Bino++){
		//	Bi_Para = unr.SampleDiscr();
			Bi_Para = NBD_fun->GetRandom();
			Para += Bi_Para;
		}
		histo_exp->Fill(Para);
		GlauEvent->Fill();
	}
        
	GlauEvent->SetBranchAddress("Ncoll",&Ncoll);
        GlauEvent->SetBranchAddress("Npart",&Npart);
        GlauEvent->SetBranchAddress("B",&B);
        GlauEvent->SetBranchAddress("Mult",&Mult);
	
	Int_t i;
	if(method[0]==0){
/*	double Glau_array[1000000];
	Long_t count_Ev=0;
	
	for(Ev=0;Ev<Nevent;Ev++){ 
		GlauEvent->GetEntry(Ev);
		if(Mult>=Minx&&Mult<=Maxx){
			count_Ev++;
			Glau_array[count_Ev-1]=Mult;
		}
	}
	int low=0;
	int high=count_Ev-1;
	int k0[N+1];
	for(i=0;i<N+1;i++){
		k0[i]=count_Ev*(1-centbin[i]);
		kpoint[i]=findkth(Glau_array,low,high,k0[i]);
		count_Ev=0;
		for(Ev=0;Ev<Nevent;Ev++){
			GlauEvent->GetEntry(Ev);
			if(Mult>=Minx&&Mult<=Maxx){
				count_Ev++;
				Glau_array[count_Ev-1]=Mult;
			}
		}
	}
*/
	
	for(i=0;i<N+1;i++){
	kpoint[i] = findpoint(histo_exp,centbin[i]);
	kpoint_[i] = findpoint(histo_obs,centbin[i]);
	}

	}
        
	TH1D* hNpart[N+1];
	for(i=0; i<N; i++){     //Initialization
	hNpart[i] = new TH1D(Form("Npart_%d-%d",i,i+1),Form("Npart distribution for %dth bin",i),4000,0,4000);
	}
	hNpart[N] = new TH1D(Form("Npart_0-%d",N),Form("Npart distribution for all bin"),4000,0,4000);

        std::vector<double> PartEvent(N);std::vector<double> PartEvent_(N+1);

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

示例7: hPYphocalc

void hPYphocalc(){
	gStyle->SetOptStat(kFALSE);
	const int maxNpart = 100;
	int sth=0, Gth=0;
        TFile *f = TFile::Open(outG);
        if(sth==0){TString dirname = "std";}
        else if(sth==1){TString dirname ="Gri055";}
        else {TString dirname ="Gri101";}
        TObjString* dataname = (TObjString*)f->Get(Form("dataname"));
        TObjString* histoname = (TObjString*)f->Get(Form("histoname"));
	TFile *fdata = TFile::Open(dataname->GetName());
                TString name;
        if(Gth==0)
                name = "G0";
        else if(Gth<nGlau)
                name = Form("Glau_%d",Gth);
        else
                name = Form("bin_%d",Gth-nGlau+1);
        TObjString* Glaubername = (TObjString*)f->Get(Form("%s/%s/Glaubername",dirname.Data(),name.Data()));
        TVectorD* k0 = (TVectorD*)f->Get(Form("%s/%s/k0",dirname.Data(),name.Data()));
        TVectorD* theta0 = (TVectorD*)f->Get(Form("%s/%s/theta0",dirname.Data(),name.Data()));
        TVectorD* xmin = (TVectorD*)f->Get(Form("%s/%s/xmin",dirname.Data(),name.Data()));
        TVectorD* xmax = (TVectorD*)f->Get(Form("%s/%s/xmax",dirname.Data(),name.Data()));
        TVectorD* thetabest = (TVectorD*)f->Get(Form("%s/%s/thetabest",dirname.Data(),name.Data()));
        TVectorD* kbest = (TVectorD*)f->Get(Form("%s/%s/kbest",dirname.Data(),name.Data()));
	TVectorD* kpoint = (TVectorD*)f->Get(Form("%s/%s/kpoint",dirname.Data(),name.Data()));
        TVectorD* NcollAver = (TVectorD*)f->Get(Form("%s/%s/NcollAver",dirname.Data(),name.Data()));
	TVectorD* centbin = (TVectorD*)f->Get(Form("%s/%s/centbin",dirname.Data(),name.Data()));

        TFile *fGlauber = TFile::Open(Glaubername->GetName());
        //(*k0)[0]=1.39;  (*kbest)[0]=0.425;
        //(*theta0)[0]=3.41;      (*thetabest)[0]=1.30;
        TF1 *gammafun[maxNpart];
        TF1 *gammafunevt[maxNpart];
        TF1 *gammafunnucl[maxNpart];
        TF1 *gammafunnuclNcoll[maxNpart];
        double kevt = (*k0)[0]-(*kbest)[0];
        for(int iNpart=0;iNpart<maxNpart;iNpart++){
        	gammafun[iNpart] = new TF1("gammafun","TMath::GammaDist(x,[0],0,[1])",0,200);
		gammafunevt[iNpart] = new TF1("gammafunevt","TMath::GammaDist(x,[0],0,[1])",0,200);
	        gammafunnucl[iNpart] = new TF1("gammafunnucl","TMath::GammaDist(x,[0],0,[1])",0,200);
        	gammafunnuclNcoll[iNpart] = new TF1("gammafunnuclNcoll","TMath::GammaDist(x,[0],0,[1])",0,200);
                double k_=(*k0)[0]+(*kbest)[0]*(iNpart-2);
                double theta_=(*theta0)[0]+(*thetabest)[0]*TMath::Log(iNpart-1);
                gammafun[iNpart]->SetParameter(0,k_);   //[1]: k value
                gammafun[iNpart]->SetParameter(1,theta_);       //[2]: theta value
		gammafunevt[iNpart]->SetParameter(0,kevt);
		gammafunevt[iNpart]->SetParameter(1,theta_);
		gammafunnucl[iNpart]->SetParameter(0,(*kbest)[0]);
		gammafunnucl[iNpart]->SetParameter(1,theta_);
		gammafunnuclNcoll[iNpart]->SetParameter(0,(*kbest)[0]*(iNpart-1));
		gammafunnuclNcoll[iNpart]->SetParameter(1,theta_);
		if(iNpart==2){
			gammafunnuclNcoll[iNpart]->SetNpx(1e4);
			gammafunnuclNcoll[iNpart]->SetRange(1e-11,200);
		}
       }

        TTree *t = (TTree*)fGlauber->Get("nt_p_Pb");
        Float_t Ncoll, Npart, B;        Long_t Nevent;
        t->SetBranchAddress("Ncoll",&Ncoll);
        t->SetBranchAddress("Npart",&Npart);
        t->SetBranchAddress("B",&B);

        Nevent = (Long_t) t->GetEntries();
        Long_t Ev;      Int_t Bino;     Double_t Para, Para_nucl, Para_p, Para_evt, Bi_Para_nucl, Bi_Para_evt;			

	double yUCM[8]={};
	double yPCM[8]={};
	double yVCM[8]={};
	double yUCM_[200]={};
	double yPCM_[200]={};
	double yVCM_[200]={};
	double C=1e-4;
	double PNcoll[maxNpart]={};
	TH1D *histo_obs = (TH1D*)fdata->Get(histoname->GetName());
        TH1D *histo_obs_norm = (TH1D*)histo_obs->Clone();
        histo_obs_norm->Scale(1/histo_obs->Integral());
	TH1D* hUCM = new TH1D("hUCM","hUCM",200,0,200);
	TH1D* hPCM = new TH1D("hPCM","hPCM",200,0,200);
	TH1D* hVCM = new TH1D("hVCM","hVCM",200,0,200);
	TH2D* NcollvsET = new TH2D("NcollvsET","NcollvsET",100,0,100,2000,0,400);
	for(Ev=0;Ev<Nevent;Ev++){
		t->GetEntry(Ev);
		PNcoll[(int)Ncoll]++;
	}
	for(int i=0;i<maxNpart;i++){
		PNcoll[i]/=Nevent;
		cout<<PNcoll[i]<<"\t";
	}
		cout<<endl;
	for(Ev=0;Ev<Nevent;Ev++){
		if(Ev%100000==0)	cout<<"\t"<<"Have run "<<Ev<<" events"<<endl;
		t->GetEntry(Ev);
		Para = gammafun[(int)Npart]->GetRandom();
		Para_nucl = gammafunnuclNcoll[(int)Npart]->GetRandom();
		Para_p = gammafunnuclNcoll[(int)Npart]->GetRandom();
		Para_evt = 0;
		for(int i=0;i<N-1;i++)
			if(Para>=(*kpoint)[i] && Para<(*kpoint)[i+1])
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:hPYphocalc.C

示例8: scanDirectory

void scanDirectory(const char *dirname) 
{
   TDirectoryIter iter(dirname);
   const char *filename = 0;
   TString ent;
   TString file;
   TString html;
   html.Form(gPreamble,dirname,dirname);
   
   TList dirList;
   TList fileList;
 
   while( (filename=iter.Next()) )
   {
      if (filename[0]!='.') {
         ent.Form("%s/%s", dirname, filename);
         FileStat_t st;
         gSystem->GetPathInfo(ent.Data(), st);
         if (R_ISDIR(st.fMode)) {
            //fprintf(stderr,"Seeing directory %s\n",ent.Data());
            scanDirectory(ent.Data());
            dirList.Add(new TObjString(filename));
         } else {
            size_t len = strlen(filename);
            if (len > 8 && strncmp(filename,"pt_",3)==0 && strncmp(filename+len-5,".root",5)==0) {
               //fprintf(stderr,"Seeing file %s\n",ent.Data());
               file = filename;
               file[len-5]='\0';
               fileList.Add(new TObjString(file));
            }
         }
      }
   }
   dirList.Sort();
   fileList.Sort();
   TIter next(&dirList);
   TObjString *obj;
   html += "<table width=\"500\">\n";
   html += gLine;
   html += gParentDir;
   while ( (obj = (TObjString*)next()) ) {
      html += TString::Format(gDirFmt,obj->GetName(),obj->GetName());
   }
   html += gLine;
   
   if (!fileList.IsEmpty()) {

      next = &fileList;
      while ( (obj = (TObjString*)next()) ) {
         html += "<tr>";
         html += TString::Format(gFiles,obj->GetName(),obj->GetName(),obj->GetName(),obj->GetName());
         obj = (TObjString*)next();
         if (obj) {
            html += TString::Format(gFiles,obj->GetName(),obj->GetName(),obj->GetName(),obj->GetName());
         } else {
            html += "<td></td></tr>";
            break;
         }
      }
      html += gLine;
   }
   html += "</table>\n";
   dirList.Delete();
   fileList.Delete();
   html += "</body>\n";
   html += "</html>\n";
   ent.Form("%s/pt_index.html",dirname);
   FILE *output = fopen(ent.Data(),"w");
   fprintf(output,"%s",html.Data());
   fclose(output);
}
开发者ID:asmagina1995,项目名称:roottest,代码行数:71,代码来源:pt_createIndex.C

示例9: TriggerInputsForMuonEventCuts

void TriggerInputsForMuonEventCuts ( TString runListFilename, TString selectedInputs="", TString defaultStorage = "raw://" )
{
  AliCDBManager::Instance()->SetDefaultStorage(defaultStorage.Data());
  TObjArray inputsList;
  inputsList.SetOwner();
  
  TObjArray* selectedInputsList = selectedInputs.Tokenize(",");

  // Read input run list
  ifstream inFile(runListFilename.Data());
  TString srun = "";
  if ( inFile.is_open() ) {
    while ( ! inFile.eof() ) {
      srun.ReadLine(inFile,kFALSE);
      if ( ! srun.IsDigit() ) continue;
      
      // For each run, read trigger inputs from OCDB
      Int_t runNumber = srun.Atoi();
      AliCDBManager::Instance()->SetRun(runNumber);
      
      // Get trigger class configuration
      AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/CTP/Config");
      if ( ! entry ) continue;
      
      THashList* runInputs = new THashList();
      runInputs->SetOwner();
      runInputs->SetUniqueID((UInt_t)runNumber);
      AliTriggerConfiguration* trigConf = (AliTriggerConfiguration*)entry->GetObject();
      const TObjArray& trigInputsArray = trigConf->GetInputs();
      AliTriggerInput* trigInput = 0x0;
      TIter next(&trigInputsArray);
      while ( ( trigInput = static_cast<AliTriggerInput*>(next()) ) ) {
        if ( selectedInputsList->GetEntriesFast() > 0 && ! selectedInputsList->FindObject(trigInput->GetName()) ) continue;
        Int_t inputId = (Int_t)TMath::Log2(trigInput->GetMask());
        TObjString* currInput = new TObjString(trigInput->GetName());
        currInput->SetUniqueID(inputId);
        runInputs->Add(currInput);
      }
      inputsList.Add(runInputs);
    }
    inFile.close();
  }
  delete selectedInputsList;
  
  // Loop on the trigger inputs
  // and group runs with an equal list of inputs
  Int_t nentries = inputsList.GetEntries();
  TArrayI checkMask(nentries);
  checkMask.Reset(1);
  for ( Int_t irun=0; irun<nentries; irun++ ) {
    if ( checkMask[irun] == 0 ) continue;
    THashList* currList = static_cast<THashList*>(inputsList.At(irun));
    TString runRange = Form("Run range: %u", currList->GetUniqueID());
    for ( Int_t jrun=irun+1; jrun<nentries; jrun++ ) {
      if ( checkMask[jrun] == 0 ) continue;
      THashList* checkList = static_cast<THashList*>(inputsList.At(jrun));
      Bool_t isDifferent = kFALSE;
      for ( Int_t itrig=0; itrig<currList->GetEntries(); itrig++ ) {
        TObjString* currInput = static_cast<TObjString*>(currList->At(itrig));
        TObject* checkInput = checkList->FindObject(currInput->GetName());
        if ( ! checkInput || checkInput->GetUniqueID() != currInput->GetUniqueID() ) {
          isDifferent = kTRUE;
          break;
        }
      } // loop on trigger inputs
      if ( isDifferent ) continue;
      checkMask[jrun] = 0;
      runRange += Form(",%u", checkList->GetUniqueID());
    } // loop on runs
    
    TString outString = "\nSetTrigInputsMap(\"";
    for ( Int_t itrig=0; itrig<currList->GetEntries(); itrig++ ) {
      TObjString* currInput = static_cast<TObjString*>(currList->At(itrig));
      outString += Form("%s:%u,",currInput->GetString().Data(), currInput->GetUniqueID());
    }
    outString.Append("\");\n");
    outString.ReplaceAll(",\"","\"");
    outString += runRange;
    printf("%s\n", outString.Data());
  } // loop on runs
}
开发者ID:benjaminaudurier,项目名称:Macro,代码行数:81,代码来源:TriggerInputsForMuonEventCuts.C


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