Пример #1
0
//_____________________________________//
Bool_t UpdateTag(TString faliroot, TString froot, TString fgeant, 
		 TString turl, TString guid,
		 TString fperiod, TString fpass, TString fname) {
  cout<<"> Updating tags...."<<endl;

  const char * tagPattern = "tag.root";
  // Open the working directory
  void * dirp = gSystem->OpenDirectory(gSystem->pwd());
  const char * name = 0x0;
  // Add all files matching *pattern* to the chain
  while((name = gSystem->GetDirEntry(dirp))) {
    cout<<">>> Adding to chain file " << name << "...." << endl;
    if (strstr(name,tagPattern)) {
      TFile *f = TFile::Open(name,"read") ;
 
      AliRunTag *tag = 0x0;
      AliFileTag *flTag = 0x0;
      TTree *fTree = (TTree *)f->Get("T");
      if (!fTree) { f->Close(); continue; }
      fTree->SetBranchAddress("AliTAG",&tag);
   
      //Defining new tag objects
      AliRunTag *newTag = 0x0;
      TTree ttag("T","A Tree with event tags");
      TBranch * btag = ttag.Branch("AliTAG", &newTag);
      btag->SetCompressionLevel(9);
      
      cout<<">>>>> Found " << fTree->GetEntries() << " entries...." << endl;
      for(Int_t iTagFiles = 0; iTagFiles < fTree->GetEntries(); iTagFiles++) {
	fTree->GetEntry(0);
	newTag = new AliRunTag(*tag);
	newTag->SetAlirootVersion(faliroot);
	newTag->SetRootVersion(froot);
	newTag->SetGeant3Version(fgeant);
	newTag->SetLHCPeriod(fperiod);
	newTag->SetReconstructionPass(fpass);
	newTag->SetProductionName(fname);
 	cout << "Found " << newTag->GetNFiles() << " file tags" << endl;
 	for(Int_t j = 0; j < newTag->GetNFiles(); j++) {
 	  flTag = (AliFileTag *) newTag->GetFileTag(j);
 	  flTag->SetTURL(turl);
 	  flTag->SetGUID(guid);
 	}
	ttag.Fill();

	delete tag;
	delete newTag;
      }//tag file loop 

      TFile* ftag = TFile::Open(name, "recreate");
      ftag->cd();
      ttag.Write();
      ftag->Close();

    }//pattern check
  }//directory loop
  return kTRUE;
}
Пример #2
0
//_____________________________________//
Bool_t UpdateTag(TString faliroot, TString froot, TString fgeant, TString turl, TString guid) {
  cout<<"Updating tags....."<<endl;

  const char * tagPattern = "tag.root";
  // Open the working directory
  void * dirp = gSystem->OpenDirectory(gSystem->pwd());
  const char * name = 0x0;
  // Add all files matching *pattern* to the chain
  while((name = gSystem->GetDirEntry(dirp))) {
    if (strstr(name,tagPattern)) {
      TFile *f = TFile::Open(name,"read") ;
 
      AliRunTag *tag = new AliRunTag;
      AliEventTag *evTag = new AliEventTag;
      TTree *fTree = (TTree *)f->Get("T");
      fTree->SetBranchAddress("AliTAG",&tag);
   
      //Defining new tag objects
      AliRunTag *newTag = new AliRunTag();
      TTree ttag("T","A Tree with event tags");
      TBranch * btag = ttag.Branch("AliTAG", &newTag);
      btag->SetCompressionLevel(9);
      for(Int_t iTagFiles = 0; iTagFiles < fTree->GetEntries(); iTagFiles++) {
	fTree->GetEntry(iTagFiles);
	newTag->SetRunId(tag->GetRunId());
	newTag->SetAlirootVersion(faliroot);
	newTag->SetRootVersion(froot);
	newTag->SetGeant3Version(fgeant);
	const TClonesArray *tagList = tag->GetEventTags();
	for(Int_t j = 0; j < tagList->GetEntries(); j++) {
	  evTag = (AliEventTag *) tagList->At(j);
	  evTag->SetTURL(turl);
	  evTag->SetGUID(guid);
	  newTag->AddEventTag(*evTag);
	}
	ttag.Fill();
	newTag->Clear();
      }//tag file loop 
  
      TFile* ftag = TFile::Open(name, "recreate");
      ftag->cd();
      ttag.Write();
      ftag->Close();
      
      delete tag;
      delete newTag;
    }//pattern check
  }//directory loop
  return kTRUE;
}
Пример #3
0
void UpdateWithRCT(const char *inrun, const char *inrct)
{
  TFile *inrunfile = new TFile(inrun);
  TTree *runtree = (TTree *) inrunfile->Get("T");
  IlcRunTag *runt = new IlcRunTag();
  runtree->SetBranchAddress("IlcTAG", &runt);

  TFile *inrctfile = new TFile(inrct);
  TTree *rcttree = (TTree *) inrctfile->Get("T");
  IlcRunTag *rctt = new IlcRunTag();
  rcttree->SetBranchAddress("IlcTAG", &rctt);

  runtree->GetEntry(0);

  cout << "Looking for RCT match for run " << runt->GetRunId() << endl;

  for (int iter=0; iter<rcttree->GetEntries(); iter++) {
    rcttree->GetEntry(iter);
    if (rctt->GetRunId() == runt->GetRunId()) {
      cout << "Found match in RCT for run " << rctt->GetRunId() << endl;
      cout << "Updating " << endl;

      runt->UpdateFromRunTable(rctt);
    }

  }

  TFile* ftag = TFile::Open("Updated.root", "recreate");

  TTree * ttag = new TTree("T","A Tree with event tags");
  TBranch * btag = ttag->Branch("IlcTAG", &runt);
  ttag->Fill();
  
  btag->SetCompressionLevel(9);

  ftag->cd();
  ttag->Write();
  ftag->Close();


}