예제 #1
0
TList* KVDMS::GetListing(const Char_t* directory)
{
   // Create and fill TList with just the names of files & containers in current directory
   // (default) or in given directory.
   // TList is filled with DMSFile_t objects which belong to the list, list must be deleted after use.

   list(directory);
   if (fout == "") {
      Error("GetListing", "Unknown directory %s", directory);
      return 0;
   }

   TObjArray* toks = fout.Tokenize("\n");
   TList* list = new TList;
   list->SetOwner(kTRUE);
   list->SetName(((TObjString*)(*toks)[0])->String().Remove(TString::kBoth, ' ').Data());
   for (int i = 1; i < toks->GetEntries(); i++) {
      TString tmp = ((TObjString*)(*toks)[i])->String().Remove(TString::kBoth, ' ');
      DMSFile_t* f = new DMSFile_t;
      if (IsContainer(tmp)) { // container
         f->SetName(gSystem->BaseName(tmp.Data()));
         f->SetIsContainer();
      } else {
         f->SetName(tmp.Data());
      }
      list->Add(f);
   }
   delete toks;
   return list;
}
예제 #2
0
  /** 
   * End of job processing 
   */
  void Terminate(Option_t*)
  {
    fList = dynamic_cast<TList*>(GetOutputData(1));
    if (!fList) {
      AliError(Form("No output list defined (%p)", GetOutputData(1)));
      if (GetOutputData(1)) GetOutputData(1)->Print();
      return;
    }


    TList* output = new TList;
    output->SetName("triggerResults");
    output->SetOwner();

    fVertexMC = static_cast<TH1D*>(fList->FindObject("vertexMC"));
    fVertexESD = static_cast<TH1D*>(fList->FindObject("vertexESD"));
    fM         = static_cast<TH1D*>(fList->FindObject("m"));
    if (fVertexMC) { 
      TH1D* vtxMC = static_cast<TH1D*>(fVertexMC->Clone("vertexMC"));
      vtxMC->SetDirectory(0);
      if (vtxMC->GetEntries() > 0)
	vtxMC->Scale(1. / vtxMC->GetEntries());
      else 
	vtxMC->Scale(0);
      output->Add(vtxMC);
    }
    if (fVertexESD) { 
      TH1D* vtxESD = static_cast<TH1D*>(fVertexESD->Clone("vertexESD"));
      vtxESD->SetDirectory(0);
      if (vtxESD->GetEntries() > 0)
	vtxESD->Scale(1. / vtxESD->GetEntries());
      else 
	vtxESD->Scale(0);
      output->Add(vtxESD);
    }
    if (fM) { 
      TH1D* m = static_cast<TH1D*>(fM->Clone("m"));
      m->SetDirectory(0);
      m->SetYTitle("P(N_{ch}|_{|#eta|<1} < X)");
      if (m->GetBinContent(1) > 0)
	m->Scale(1. / m->GetBinContent(1));
      else 
	m->Scale(0);
      output->Add(m);
    }      

    TString vtxReq;
    if (fVertexRequirement & kMC)  vtxReq.Append("MC ");
    if (fVertexRequirement & kESD) vtxReq.Append("ESD ");
    output->Add(new TNamed("vtxReq", vtxReq.Data()));
    output->Add(new TNamed("trkReq",
			   fTrackletRequirement == kMC ? "MC" : "ESD"));

    fInel.Finish(fList, output);
    fInelGt0.Finish(fList, output);
    fNSD.Finish(fList, output);
    fNClusterGt0.Finish(fList, output);

    PostData(2, output);
  }
예제 #3
0
void AdaptFileStructure(TString fileName)
{
  TFile* f = TFile::Open(fileName.Data(), "READ");
  TList* cList = new TList();
  cList->SetName("cList");
  cList->SetOwner(kTRUE);
  for (Int_t i = 0; i < gFile->GetNkeys(); i++) {
    TObject* obj = f->GetListOfKeys()->At(i);
    TString name = obj->GetName();
    TObject* obj2 = f->Get(name.Data());
    cList->Add(obj2); 
  }
  
  TString fileNameOutput = fileName;
  fileNameOutput.ReplaceAll(".root", "_commonStructure.root");
  TFile* fOut = TFile::Open(fileNameOutput.Data(), "RECREATE");
  fOut->mkdir("PWGLF_PPVsMultXCheck_MC");
  fOut->cd("PWGLF_PPVsMultXCheck_MC");
  cList->Write("cList", TObject::kSingleKey);
  fOut->Close();
  f->Close();
}
예제 #4
0
파일: Scheme.cpp 프로젝트: laduga/pradis
af::TElement Scheme::SetDataList()
{
	if(Root.IsNull())
	{
		throw NoLabelInicialisationException("Scheme: label do not inicialised.");
	}

	RemoveElementByName("DataList");

	TDF_Label NewLabel = TDF_TagSource::NewChild(Root);
	Handle(TDataStd_TreeNode) NewNode = TDataStd_TreeNode::Set(NewLabel);

	Handle(TDataStd_TreeNode) CurrNode;
    Root.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(),CurrNode);
	CurrNode->Append(NewNode);

	TList B;
	B.SetRoot(NewLabel);
	B.SetName("DataList");
	DataList = B;

	return B;
}
예제 #5
0
void histobrowser(const char* name="HLT Histos")
{
   TEveManager::Create();

   // --- Create special browser

   gEve->GetBrowser()->StartEmbedding(0);
   g_hlt_browser = gEve->GetBrowser()->MakeFileBrowser();
   gEve->GetBrowser()->StopEmbedding(name);

   // --- Fill and register some lists/folders/histos

   gDirectory = 0;
   TH1F* h;

   TList* l = new TList;
   l->SetName("Cilka");
   h = new TH1F("Foo", "Bar", 51, 0, 1);
   for (Int_t i=0; i<500; ++i)
      h->Fill(gRandom->Gaus(.63, .2));
   l->Add(h);
   g_hlt_browser->Add(l);

   TFolder* f = new TFolder("Booboayes", "Statisticos");
   h = new TH1F("Fooes", "Baros", 51, 0, 1);
   for (Int_t i=0; i<2000; ++i) {
      h->Fill(gRandom->Gaus(.7, .1));
      h->Fill(gRandom->Gaus(.3, .1));
   }
   f->Add(h);
   g_hlt_browser->Add(f);

   h = new TH1F("Fooesoto", "Barosana", 51, 0, 1);
   for (Int_t i=0; i<4000; ++i) {
      h->Fill(gRandom->Gaus(.25, .02), 0.04);
      h->Fill(gRandom->Gaus(.5, .1));
      h->Fill(gRandom->Gaus(.75, .02), 0.04);
   }
   g_hlt_browser->Add(h);

   // --- Add some macros.

   TMacro* m;

   m = new TMacro;
   m->AddLine("{ g_hlt_canvas->Clear();"
              "  g_hlt_canvas->cd();"
              "  g_hlt_canvas->Update(); }");
   m->SetName("Clear Canvas");
   g_hlt_browser->Add(m);

   m = new TMacro;
   m->AddLine("{ g_hlt_canvas->Clear();"
              "  g_hlt_canvas->Divide(2,2);"
              "  g_hlt_canvas->cd(1);"
              "  g_hlt_canvas->Update(); }");
   m->SetName("Split Canvas");
   g_hlt_browser->Add(m);

   // --- Create an embedded canvas

   gEve->GetBrowser()->StartEmbedding(1);
   g_hlt_canvas = new TCanvas;
   gEve->GetBrowser()->StopEmbedding("HLT Canvas");
}
예제 #6
0
void FillVZEROEPOADBFull(const char* filename = "AOD083.txt", Bool_t mbOnly = kFALSE)
{
  gSystem->Load("libCore");
  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libPhysics");
  gSystem->Load("libMinuit");
  gSystem->Load("libSTEERBase");
  gSystem->Load("libESD");
  gSystem->Load("libAOD");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");   
  gSystem->Load("libOADB");

  AliOADBContainer * oadbCont = new AliOADBContainer("vzeroEP");

  {
    TList *defaultList = new TList;
    defaultList->SetName("Default");
    TProfile *profHisto = NULL;
    TFile fInputDefault("minbias/VZERO.EPFlatenning.PS.LHC11h_AOD083_000170162.root");
    TList *inputList = (TList*)fInputDefault.Get("coutput");
    for(Int_t i = 0; i < 11; ++i) {
      profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
      profHisto->SetDirectory(0);
      defaultList->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
      profHisto->SetDirectory(0);
      defaultList->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
      profHisto->SetDirectory(0);
      defaultList->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
      profHisto->SetDirectory(0);
      defaultList->Add(profHisto);
    }
    fInputDefault.Close();
    oadbCont->AddDefaultObject(defaultList);
    printf("Run 170162 filled\n");
  }

  {
    TList *list1 = new TList;
    TProfile *profHisto = NULL;
    TFile fInput1("minbias/VZERO.EPFlatenning.PS.LHC11h_AOD083_000169683.root");
    TList *inputList = (TList*)fInput1.Get("coutput");
    for(Int_t i = 0; i < 11; ++i) {
      profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
      profHisto->SetDirectory(0);
      list1->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
      profHisto->SetDirectory(0);
      list1->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
      profHisto->SetDirectory(0);
      list1->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
      profHisto->SetDirectory(0);
      list1->Add(profHisto);
    }
    oadbCont->AppendObject(list1, 169683, 169683);
    printf("Run 169683 filled\n");
  }

  // loop of over all other runs
  Int_t runList[500];
  ifstream *fruns = new ifstream (filename);
  if (!*fruns) return;
  TString strLine;
  Int_t count = 0;
  while (strLine.ReadLine(*fruns)) {
    runList[count++] = strLine.Atoi();
  }
  delete fruns;

  for(Int_t irun = 0; irun < count; ++irun) {
    TList *list2 = new TList;
    TProfile *profHisto = NULL;
    TFile fInput2(Form("csemi/VZERO.EPFlatenning.PS.LHC11h_AOD083_000%d.root",runList[irun]));
    TList *inputList = (TList*)fInput2.Get("coutput");
    TFile fInput3(Form("cpbi2/VZERO.EPFlatenning.PS.LHC11h_AOD083_000%d.root",runList[irun]));
    TList *inputListBis = (TList*)fInput3.Get("coutput");
    for(Int_t i = 0; i < 11; ++i) {
      profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
      profHisto->SetDirectory(0);
      Int_t ibin = profHisto->FindBin(62.5);
      profHisto->SetBinContent(ibin,0);
      profHisto->SetBinError(ibin,0);
      profHisto->SetBinEntries(ibin,0);
      if (mbOnly) {
	profHisto = (TProfile*)inputListBis->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
	profHisto->SetDirectory(0);
      }
      else
	profHisto->Add((TProfile*)inputListBis->FindObject(Form("fX2_%d",i)));
      list2->Add(profHisto);

      profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
      profHisto->SetDirectory(0);
      profHisto->SetBinContent(ibin,0);
      profHisto->SetBinError(ibin,0);
      profHisto->SetBinEntries(ibin,0);
      if (mbOnly) {
	profHisto = (TProfile*)inputListBis->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
	profHisto->SetDirectory(0);
      }
      else
	profHisto->Add((TProfile*)inputListBis->FindObject(Form("fY2_%d",i)));
      list2->Add(profHisto);

      profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
      profHisto->SetDirectory(0);
      profHisto->SetBinContent(ibin,0);
      profHisto->SetBinError(ibin,0);
      profHisto->SetBinEntries(ibin,0);
      if (mbOnly) {
	profHisto = (TProfile*)inputListBis->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
	profHisto->SetDirectory(0);
      }
      else
	profHisto->Add((TProfile*)inputListBis->FindObject(Form("fX2Y2_%d",i)));
      list2->Add(profHisto);

      profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
      profHisto->SetDirectory(0);
      profHisto->SetBinContent(ibin,0);
      profHisto->SetBinError(ibin,0);
      profHisto->SetBinEntries(ibin,0);
      if (mbOnly) {
	profHisto = (TProfile*)inputListBis->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
	profHisto->SetDirectory(0);
      }
      else
	profHisto->Add((TProfile*)inputListBis->FindObject(Form("fCos8Psi_%d",i)));
      list2->Add(profHisto);
    }
    oadbCont->AppendObject(list2, runList[irun], runList[irun]);
    printf("Run %d filled\n",runList[irun]);
  }

  TString oadbFileName = Form("%s/COMMON/EVENTPLANE/data/vzero.root", AliAnalysisManager::GetOADBPath());
  oadbCont->WriteToFile(oadbFileName.Data());
}
예제 #7
0
파일: Scheme.cpp 프로젝트: laduga/pradis
void Scheme::AddEquivalence (DOF1 nnode1, DOF1 nnode2)
{
	int num1, num2;
	bool isb1, isb2, ise1, ise2;
	QString node1, node2;
	bool isbn1, isbn2, isen1, isen2;
	bool isBase, isExt;
	bool isOK;
	
	GetEqvList();

	node1 = nnode1.GetObjectName();
	node2 = nnode2.GetObjectName();
	
	// printf ("Scheme:1 %s, %s\n", node1.toAscii().data(), node2.toAscii().data());

	isbn1 = nnode1.GetBase();
	isbn2 = nnode2.GetBase();

	isen1 = nnode1.GetExternal();
	isen2 = nnode2.GetExternal();
	
	// printf ("Scheme:1.1 isen1=%d isen2=%d\n", isen1, isen2);

	isb1=ise1=isb2=ise2 = false;

	num1 = FindDOF (node1, isb1, ise1);
	// printf ("Scheme:1.2. num1=%d\n",num1);

	num2 = FindDOF (node2, isb2, ise2);
	// printf ("Scheme:1.3. num2=%d\n",num2);
	
	isBase = isb1 || isb2 || isbn1 || isbn2;
	isExt = ise1 || ise2 || isen1 || isen2;

	// printf ("Scheme:2\n");
	

	if (num1==-1 && num2 == -1)
	{

		TElement var (EqvList.Add());
		
		// printf ("Scheme:3\n");
		
		TList doflist;
		var.AddElement(doflist);
		doflist.SetName ("doflist");

		// printf ("Scheme:4\n");
		
		
		TString n1 (doflist.Add());
		TString n2 (doflist.Add());
		n1.SetValue (node1);
		n2.SetValue (node2);

		// printf ("Scheme:5\n");


		TInteger base;
		var.AddElement(base);
		base.SetName ("isBase");
		base.SetValue (isBase);

		TInteger ext;
		var.AddElement(ext);
		ext.SetName ("isExt");
		ext.SetValue (isExt);


	}else
	if (num1==-1)
	{
		TElement el (EqvList.GetAt(num2));
		TList doflist (el.GetField ("doflist", isOK));
		TInteger isb (el.GetField ("isBase", isOK));
		TInteger ise (el.GetField ("isExt", isOK));

		isb.SetValue (isBase);
		ise.SetValue (isExt);
		
		TString n1 (doflist.Add());
		n1.SetValue (node1);

	}else
	if (num2==-1)
	{
		TElement el (EqvList.GetAt(num1));
		TList doflist (el.GetField ("doflist", isOK));
		TInteger isb (el.GetField ("isBase", isOK));
		TInteger ise (el.GetField ("isExt", isOK));

		isb.SetValue (isBase);
		ise.SetValue (isExt);

		TString n2 (doflist.Add());
		n2.SetValue (node2);
	}else
	if (num1 != num2)
	{
		TElement el (EqvList.GetAt(num1));
		TList doflist1 (el.GetField ("doflist", isOK));
		TInteger isb (el.GetField ("isBase", isOK));
		TInteger ise (el.GetField ("isExt", isOK));

		isb.SetValue (isBase);
		ise.SetValue (isExt);

		el.Init (EqvList.GetAt(num2));
		TList doflist2 (el.GetField ("doflist", isOK));
		
//		TList doflist2 (EqvList.GetAt(num2));
		TIterator it (doflist2.GetIterator());
		
		while (it.More())
		{
			TString n1 (it.Value());
			QString value = n1.GetValue();
			TString n2 (doflist1.Add());
			n2.SetValue (value);
			
			it.Next();
		}
		EqvList.RemoveVar (el);
	}
	
	return;
}