Example #1
0
  /** 
   * Do some sanity checks, then load 
   * 
   * @return See ProofRailway::LoadAliROOT 
   */
  virtual Bool_t LoadAliROOT()
  {
    Bool_t enabPhys = true;
    TString aliVer  = gSystem->Getenv("VafAliRootVersion");
    TString aliPhys = gSystem->Getenv("VafAliPhysicsVersion");
    if (!aliVer.IsNull()) {
      Info("VAFRailway::LoadAliROOT", "Using AliROOT=%s", aliVer.Data());
      if (!aliPhys.IsNull()) {
	Warning("VAFRailway::LoadAliROOT",
		"AliPhysics not loaded, even though version %s was requested",
		aliPhys.Data());
      }
      enabPhys = false;
    }
    else if (aliPhys.IsNull()) {
      Error("VAFRailway::LoadAliROOT", "Neither AliROOT nor AliPhysics "
	    "versions specified, giving up");
      return false;
    }
    else
      Info("VAFRailway::LoadAliROOT", "Using AliPhysics=%s", aliPhys.Data());

    fOptions.Set("alien");
    return ProofRailway::LoadAliROOT();
  }        
Example #2
0
void RsnSetData(AliAnalysisAlien *plugin,TString dsConf,Int_t numRuns = 1000,Int_t numRunsSkip=0,Int_t maxRunsPerMaster = 1000) {

   Bool_t dsFound = kTRUE;
   Int_t nRunsPerMaster = 0;

   Bool_t valid = kTRUE;
   TString legoTrainPath = AliAnalysisManager::GetGlobalStr("rsnLegoTrainPath",valid);

   if (gSystem->AccessPathName(dsConf.Data())) dsConf.Prepend(Form("%s/",legoTrainPath.Data()));
   dsConf = gSystem->ExpandPathName(dsConf.Data());

   if (dsConf.Contains(".txt")) {
      ifstream in;
      in.open(dsConf.Data());
      if (!in.is_open()) Fatal("RsnSetData",Form("File %s was not found !!!",dsConf.Data()));
      Printf("DS config file : %s",dsConf.Data());
      TString line;
      Bool_t isRun = kFALSE;
      while (in.good())
      {
         in >> line;
         if (line.IsNull()) continue;
         if (line.Contains("BASE")) {
            GetParameterFromConfig(line);
            plugin->SetGridDataDir(line.Data());
            Printf("BASE -> %s",line.Data());
            continue;
         }
         if (line.Contains("PREFIX")) {
            GetParameterFromConfig(line);
            plugin->SetRunPrefix(line.Data());
            Printf("PREFIX -> %s",line.Data());
            continue;
         }
         if (line.Contains("DATA_PATTERN")) {
            GetParameterFromConfig(line);
            plugin->SetDataPattern(line.Data());
            Printf("DATA_PATTERN -> %s",line.Data());
            continue;
         }
         if (!line.CompareTo("RUNS")) {
            isRun = kTRUE;
            in >> line;
         }
         if (isRun) {
            if (numRunsSkip>0) {
               numRunsSkip--;
               continue;
            } else {
               if (nRunsPerMaster < numRuns ) {
                  Printf("Adding RUN : %s",line.Data());
                  plugin->AddRunNumber(line.Data());
                  nRunsPerMaster++;
               } else {
                  break;
               }

            }
         }
      }
Example #3
0
Bool_t SETUP_LoadLibraries(const TString &libs) {

  // Loads a list of colon-separated libraries. Returns kTRUE on success, kFALSE
  // if at least one library couldn't load properly. Does not check for double
  // loads (but ROOT does).

  TString l;
  Ssiz_t from;

  while ( libs.Tokenize(l, from, ":") ) {
    if (l.IsNull()) continue;
    if (!l.BeginsWith("lib")) l.Prepend("lib");
    if (l.EndsWith(".so")) l.Remove(l.Length()-3, l.Length());

    ::Info(gMessTag.Data(), ">> Loading library %s...", l.Data());

    if (gSystem->Load(l.Data()) < 0) {
       ::Error(gMessTag.Data(), "Error loading %s, aborting", l.Data());
       return kFALSE;  // failure
    }
  }

  return kTRUE;  // success

  return 0;
}
Example #4
0
//------------------------------
void KVINDRADB_e475s::ReadCalibrations()
//------------------------------
{

   ifstream finput;
   if (!OpenCalibFile("CalibFile", finput)) {
      Error("ReadCalibrations()", "Could not open file %s",
            GetCalibFileName("CalibFile"));
      return;
   }
   
	Info("ReadCalibrations()",
        "Reading calibration parameters...");
	
	TString sline;
   TString stit;
	TString calib_det,calib_gain,calib_file;
	TObjArray *toks=NULL;
	while (finput.good()) {
		sline.ReadLine(finput);
		if (!sline.IsNull()){
			cout << sline << endl;
			toks = sline.Tokenize(" ");
			calib_det = ((TObjString*)(*toks)[0])->GetString();
			calib_gain = ((TObjString*)(*toks)[1])->GetString();
			calib_file = ((TObjString*)(*toks)[2])->GetString();
			stit.Form("%s/%s",gDataSet->GetDataSetDir(),calib_file.Data());
			ifstream fin(stit.Data());
			ReadCalibFile(fin,calib_det,calib_gain);
			fin.close();
   	}
	}
	finput.close();

}
Example #5
0
vector <TString> OnlineConfig::SplitString(TString instring,TString delim) 
{
  // Utility to split up a string on the deliminator.
  //  returns a vector of strings.

  vector <TString> v;

  TString remainingString = instring;
  TString tempstring = instring;
  int i;

  while (remainingString.Index(delim) != -1) {
    i = remainingString.Index(delim);
    tempstring.Remove(i);
    v.push_back(tempstring);
    remainingString.Remove(0,i+1);
    while(remainingString.Index(delim) == 0) {
      remainingString.Remove(0,1);
    }
    tempstring = remainingString;
  }

  while(tempstring.EndsWith(delim)) {
    tempstring.Chop();
  }
     
  if(!tempstring.IsNull()) v.push_back(tempstring);

  return v;
}
Example #6
0
//__________________________________________________________________________
Bool_t Ana(const TString type = "per5", const Int_t run = 1, const Int_t nOfEvt = 1) 
{ 
  // Analyzes data from the AliEn data catalog

  // Data Challenge identification
  const TString kYear("2004") ; 
  const TString kProd("02") ; 
  const TString kVers("V4.01.Rev.00") ; 

  // get the LFN file name in the Grid catalogue ; 
  AliPHOSGridFile lfn ; 
  if (!lfn.IsConnected()) 
    return kFALSE ; 
  lfn.SetPath(kYear, kProd, kVers, type) ;  
  lfn.SetRun(run) ; 

  //loop over the events 
  Int_t nevt, evt = 0 ; 
  for (nevt = 0 ; nevt < nOfEvt ; nevt++) { 
    evt++ ; 
    lfn.SetEvt(evt) ;
    TString fileName = lfn.GetLFN() ; 
    
    if (fileName.IsNull()) {
      nevt-- ; 
      continue ; 
    }

    printf(">>>>>>>>>>>> Processing %s-%s/%s/%s : run # %d event # %d \n", 
	   kYear.Data(), kProd.Data(), kVers.Data(), type.Data(), run, evt) ;
    AnaESD(fileName) ;
  } 
  return kTRUE ; 
}
Example #7
0
//_______________________________________
void PlotDataResults(const char* filenameData, const char* filenameMC="", Bool_t save=kFALSE)
{
  if (!addToName.IsNull()) addToName.Prepend("-");
  AliDielectronCFdraw d(filenameData);
  AliDielectronCFdraw dCorr("corrCont","corrCont");
  TString nameCorr(filenameMC);
  if (!nameCorr.IsNull()) d.SetCFContainers(nameCorr.Data());
  TFile f(filenameData);
  TH1 *hStats=(TH1*)f.Get("hEventStat");
  if (!f.IsOpen() || f.IsZombie() || !hStats) return;
  hStats->SetDirectory(0);
  f.Close();
  
  Int_t stepFirst=0, stepAny=1, stepTOFmix=2;
  
  gStyle->SetOptStat(0);
  //Set common Ranges
  d.SetRangeUser("Leg1_NclsTPC",70.,170.);
  d.SetRangeUser("Leg2_NclsTPC",70.,170.);
  d.SetRangeUser("Leg1_Pt",1.01,100000);
  d.SetRangeUser("Leg2_Pt",1.01,100000);
  d.SetRangeUser("Leg1_Eta",-0.899,0.899);
  d.SetRangeUser("Leg2_Eta",-0.899,0.899);

  d.SetRangeUser("Leg1_TPC_nSigma_Electrons",-3.,2.99);
  d.SetRangeUser("Leg2_TPC_nSigma_Electrons",-3.,2.99);
  d.SetRangeUser("Leg1_TPC_nSigma_Pions",3.51,20); 
  d.SetRangeUser("Leg2_TPC_nSigma_Pions",3.51,20); 
  d.SetRangeUser("Leg1_TPC_nSigma_Protons",3.01,20); 
  d.SetRangeUser("Leg2_TPC_nSigma_Protons",3.01,20);

//   d.SetRangeUser("Pt",0,1000);
  
  d.SetRangeUser("M",0.5,5.);
  //============================
  //SPD first
  //
  
  //--- Like sign subtraction
  AliDielectronSignalBase *sigFirst=GetSignalLS(d,stepFirst);
  SetStyle(sigFirst,"ITS First - Like Sign subtraction");
  DrawSpectra(sigFirst,"cFirst",hStats,save);
  //--- Like sign subtraction Arithmetic mean
  AliDielectronSignalBase *sigFirstArith=GetSignalLS(d,stepFirst,AliDielectronSignalBase::kLikeSignArithm);
  SetStyle(sigFirstArith,"ITS FirstArith - Like Sign subtraction");
  DrawSpectra(sigFirstArith,"cFirstArith",hStats,save);
  
  //============================
  //SPD any
  //
  AliDielectronSignalBase *sigAny=GetSignalLS(d,stepAny);
  SetStyle(sigAny,"ITS Any - Like Sign subtraction");
  DrawSpectra(sigAny,"cAny",hStats,save);
  //--- like sign with arithmetic mean
  AliDielectronSignalBase *sigAnyArith=GetSignalLS(d,stepAny,AliDielectronSignalBase::kLikeSignArithm);
  SetStyle(sigAnyArith,"ITS Any - Like Sign subtraction (Arithm. mean)");
  DrawSpectra(sigAnyArith,"cAnyArith",hStats,save);
  
  if (hStats) delete hStats;
}
Example #8
0
  /** 
   * Get the job url. 
   * 
   * @param name  Production name  
   * @param mc    Should be true for MC 
   * @param url   On return, the job url 
   * 
   * @return true on success 
   */
  Bool_t GetJobUrl(const TString& name, Bool_t mc, TString& url)
  {
    url = "";
    TString index("raw.jsp");
    if (!Download((mc ? "job_details.jsp" : "production/raw.jsp"), index))
	return false;
    
    std::ifstream in(index.Data());
    TString line;
    TString tgt(Form("<td class=\"table_row\">%s</td>", name.Data()));
    do { 
      line.ReadLine(in);
      if (!line.Contains(tgt)) continue;
      line.ReadLine(in);
      Int_t first = line.Index("href=\"");
      Int_t last  = line.Index("\"", first+7);
      url = line(first+6,last-first-6);
      break;
      
    } while (!in.eof());
    in.close();
    
    if (url.IsNull()) { 
      Error("GetJobUrl", "Production %s not found", name.Data());
      return false;
    }

    return true;
  }
Example #9
0
//________________________________________________________________________________________
int main(int argc, char* argv[]) {
// Default options
	bool isList = false;
	TString outputdir = "TempOutput/";
	int verbose = 0;

// Parse options
	char ch;
	while ((ch = getopt(argc, argv, "d:v:lh?")) != -1 ) {
		switch (ch) {
			case 'd': outputdir = TString(optarg); break;
			case 'v': verbose = atoi(optarg); break;
			case 'l': isList = true; break;
			case '?':
			case 'h': usage(0); break;
			default:
			cerr << "*** Error: unknown option " << optarg << std::endl;
			usage(-1);
		}
	}

	argc -= optind;
	argv += optind;

        // Check arguments
	if( argc<1 ) {
		usage(-1);
	}

	TChain *theChain = new TChain("analyze/Analysis");
	for(int i = 0; i < argc; i++){
		if( !isList ){
			theChain->Add(argv[i]);
			printf(" Adding file: %s\n",argv[i]);
		} else {
			TString rootFile;
			ifstream is(argv[i]);
			while(rootFile.ReadLine(is) && (!rootFile.IsNull())){
				if(rootFile[0] == '#') continue;
				theChain->Add(rootFile);
				printf(" Adding file: %s\n", rootFile.Data());
			}
		}
	}

	cout << "--------------" << endl;
	cout << "OutputDir is:     " << outputdir << endl;
	cout << "Verbose level is: " << verbose << endl;
	cout << "Number of events: " << theChain->GetEntries() << endl;
	cout << "--------------" << endl;

	UserAnalyzer *tA = new UserAnalyzer(theChain);
	tA->SetOutputDir(outputdir);
	tA->SetVerbose(verbose);
	tA->BeginJob();
	tA->Loop();
	tA->EndJob();
	delete tA;
	return 0;
}
Example #10
0
  /** 
   * Create the tasks 
   * 
   * @param mgr  Analysis manager 
   */
  void CreateTasks(AliAnalysisManager* mgr)
  {
    // --- Output file name ------------------------------------------
    AliAnalysisManager::SetCommonFileName("forward_qa.root");

    // --- Load libraries/pars ---------------------------------------
    fRailway->LoadLibrary("PWGLFforward2");
    
    // --- Set load path ---------------------------------------------
    gROOT->SetMacroPath(Form("%s:$(ALICE_PHYSICS)/PWGLF/FORWARD/analysis2",
			     gROOT->GetMacroPath()));

    // --- Check if this is MC ---------------------------------------
    Bool_t mc = mgr->GetMCtruthEventHandler() != 0;

    // --- Add the task ----------------------------------------------
    if (!CoupleSECar("AddTaskForwardQA.C", 
		     Form("%d,%d", mc, fOptions.Has("cent")),
		     AliVEvent::kAny))
      Fatal("CreateTasks", "Failed to add ForwardQA task");

    TString  cor = "";
    if (fOptions.Has("corr")) cor = fOptions.Get("corr"); 
    if (!cor.IsNull()) {
      fRailway->LoadAux(Form("%s/fmd_corrections.root",cor.Data()), true);
    }
  }
Example #11
0
/** 
 * Compare results  
 * 
 * @param argv Commmand line parameters 
 *
 * @relates Compare 
 * @ingroup pwglf_forward_tracklets
 */
void CompareResults(const char** argv)
{
  TString newFile;
  TString oldFile;
  TString newTit("");
  TString oldTit("");
  const char** ptr = argv;
  while ((*ptr)) {
    TString argi = *ptr;
    ptr++;
    if (argi.Contains("help")) {
      Printf("Usage: CompareResults AFILE BFILE [ATITLTE [BTITLE]]");
      return;
    }
    if (argi.Contains("CompareResults.C")) continue;
    if (argi.BeginsWith("-")) continue;
    if (argi.EndsWith(".root")) {
      if (newFile.IsNull()) newFile = argi;
      else                  oldFile = argi;
    }
    else {
      if (newTit.IsNull())  newTit = argi;
      else  	            oldTit = argi;
    }
  }
  if (newTit.IsNull()) newTit = "New";
  if (oldTit.IsNull()) oldTit = "Old";
  
      
  CompareResults(newFile, oldFile, newTit, oldTit);
}
Example #12
0
  /** 
   * Register special putput storage 
   * 
   * @param url Url (root://host/full_path)
   * 
   * @return true on success
   */
  static Bool_t RegisterStorage(const TString& url)
  {
    if (url.IsNull()) { 
      Error("OutputUtilities::RegisterStorage", "No storage URI specified");
      return false;
    }

    // Get the manager
    AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
    
    // Get the container 
    AliAnalysisDataContainer* cont    = mgr->GetCommonOutputContainer();
    if (!cont) { 
      Warning("OutputUtilities::RegisterStorage", 
	      "No common output container defined");
      return false;
    }

    TString u(url);
    if (u.EqualTo("auto")) {
      if (!StartXrootd(u)) {
	Warning("OutputUtilities::RegisterStorage",
		"Couldn't start the XRootD server");
	return false;
      }
    }

    cont->SetSpecialOutput();
    mgr->SetSpecialOutputLocation(u);

    return true;
  }
Example #13
0
void ilceve_init(const TString& cdburi = "local://$ILC_ROOT/OCDB",
		 const TString& path   = ".", Int_t event=0,
                 const Text_t* esdfile = 0,
                 const Text_t* aodfile = 0,
                 const Text_t* rawfile = 0,
		 Bool_t assert_runloader = kFALSE,
                 Bool_t assert_esd       = kFALSE,
                 Bool_t assert_aod       = kFALSE,
                 Bool_t assert_raw       = kFALSE)
{
  if (cdburi.IsNull() && ! IlcCDBManager::Instance()->IsDefaultStorageSet())
  {
    gEnv->SetValue("Root.Stacktrace", "no");
    Fatal("ilceve_init.C", "OCDB path MUST be specified as the first argument.");
  }

  Info("ilceve_init", "Adding standard macros.");
  TString  hack = gSystem->pwd(); // Problem with TGFileBrowser cding
  ilceve_init_import_macros();
  gSystem->cd(hack);

  TEveUtil::AssertMacro("VizDB_scan.C");

  gSystem->ProcessEvents();

  IlcEveEventManager::SetESDFileName(esdfile);
  IlcEveEventManager::SetRawFileName(rawfile);
  IlcEveEventManager::SetCdbUri(cdburi);
  IlcEveEventManager::SetAssertElements(assert_runloader, assert_esd,
					assert_aod, assert_raw);

  // Open event
  if (path.BeginsWith("alien:") || ! cdburi.BeginsWith("local:"))
  {
    if (gGrid != 0)
    {
      Info("ilceve_init", "TGrid already initializied. Skiping checks and initialization.");
    }
    else
    {
      Info("ilceve_init", "AliEn requested - connecting.");
      if (gSystem->Getenv("GSHELL_ROOT") == 0)
      {
	Error("ilceve_init", "AliEn environment not initialized. Aborting.");
	gSystem->Exit(1);
      }
      if (TGrid::Connect("alien") == 0)
      {
	Error("ilceve_init", "TGrid::Connect() failed. Aborting.");
	gSystem->Exit(1);
      }
    }
  }

  Info("ilceve_init", "Opening event %d from '%s' ...", event, path.Data());
  TString name("Event"); // CINT has trouble with direct "Event".
  new IlcEveEventManager(name, path, event);
  gEve->AddEvent(IlcEveEventManager::GetMaster());
}
Example #14
0
inline void parseAndSet_b(const TString& input, TString arg, bool& value) {
  TString newval = parseArg(input, arg);
  if (!newval.IsNull()) {
    if (newval.IsBin()) value = newval.Atoi();
    else if (newval == "true") value = true;
    else if (newval == "false") value = false;
  }
}
Example #15
0
void
DrawPlot::drawEventPlot(const TString& pluginName, const TString& histName, const bool normalise, const bool plotZeroApe){
  TString* plugin = new TString(pluginName.Copy());
  if(!plugin->IsNull())plugin->Append("/");
  std::stringstream ss_sector;
  ss_sector<<*plugin<<"EventVariables/"<<histName;
  const TString fullName(ss_sector.str().c_str());
  this->printHist(fullName, histName, normalise, plotZeroApe);
}
Example #16
0
  /** 
   * Get list of runs associated with production
   *  
   * @param url     The production URL 
   * @param mc      True of MC
   * @param minSize Least size of runs to use 
   * 
   * @return true on success
   */
  Bool_t GetRuns(const TString& url, Bool_t mc, ULong_t minSize)
  {
    TString index("job");
    if (!Download(Form("%s%s", (mc ? "" : "raw/"), url.Data()), index)) 
      return false;

    std::ifstream in(index.Data());
    TString tgt1(mc ? "window.open" : "runDetails");
    TString line  = "";
    do { 
      line.ReadLine(in);
      if (!line.Contains(tgt1)) continue;
      Int_t   first = -1;
      Int_t   last  = -1;
      if (!mc) { 
	first = line.Index(tgt1);
	last  = line.Index(")", first+tgt1.Length()+1);
      }
      else { 
	Int_t tmp = line.Index(">");
	first = line.Index(">", tmp+1);
	last  = line.Index("<", first);
      }
      if (first == kNPOS || last == kNPOS) { 
	Error("GetDir", "Failed to get directory from %s", line.Data());
	return false;
      }
      first += (mc ? 1 : tgt1.Length()+1);
      last  -= first;
      TString srun  = line(first, last);
      ULong_t runNo = srun.Atoll();
      if (fDebug) Info("", "Got run %lu (%s)", runNo, srun.Data());

      if (!GetSize(in, runNo, mc, minSize)) continue;
      if (!GetDir(in, runNo, mc))           continue;

      if (!fRuns.IsNull()) fRuns.Append(",");
      fRuns.Append(Form("%lu", runNo));
    } while (!in.eof());
    in.close();
    if (fRuns.IsNull()) return false;

    return true;
  }
Example #17
0
void OnlineGUI::TreeDraw(vector <TString> command) {
  // Called by DoDraw(), this will plot a Tree Variable

  TString var = command[0];

  // Combine the cuts (definecuts and specific cuts)
  TCut cut = "";
  TString tempCut;
  if(command.size()>1) {
    tempCut = command[1];
    vector <TString> cutIdents = fConfig->GetCutIdent();
    for(UInt_t i=0; i<cutIdents.size(); i++) {
      if(tempCut.Contains(cutIdents[i])) {
	TString cut_found = (TString)fConfig->GetDefinedCut(cutIdents[i]);
	tempCut.ReplaceAll(cutIdents[i],cut_found);
      }
    }
    cut = (TCut)tempCut;
  }

  // Determine which Tree the variable comes from, then draw it.
  UInt_t iTree;
  if(command[4].IsNull()) {
    iTree = GetTreeIndex(var);
  } else {
    iTree = GetTreeIndexFromName(command[4]);
  }
  TString drawopt = command[2];
  Int_t errcode=0;
  if(drawopt.IsNull() && var.Contains(":")) drawopt = "box";
  if(drawopt=="scat") drawopt = "";
  if (iTree <= fRootTree.size() ) {
    errcode = fRootTree[iTree]->Draw(var,cut,drawopt,
				     1000000000,fTreeEntries[iTree]);
    TObject *hobj = (TObject*)gROOT->FindObject("htemp");
    if(errcode==-1) {
      BadDraw(var+" not found");
    } else if (errcode!=0) {
      if(!command[3].IsNull()) {
	TH1* thathist = (TH1*)hobj;
	thathist->SetTitle(command[3]);
      }
    } else {
      BadDraw("Empty Histogram");
    }
  } else {
    BadDraw(var+" not found");
    if (fConfig->IsMonitor()){
      // Maybe we missed it... look again.  I dont like the code
      // below... maybe I can come up with something better
      GetFileObjects();
      GetRootTree();
      GetTreeVars();
    }
  }
}
Example #18
0
/** Display hits 
    @ingroup FMD_script
 */
Bool_t
CheckFile(const char* prefix, const char* path, int number, TString& f)
{
  f = (Form("%s%d.csv", prefix, number));
  std::cout << "Checking if " << f << " exists in " << path << " ... " 
	    << std::flush;
  f = gSystem->Which(path, f.Data());
  std::cout << '"' << f << '"' << std::endl;
  return !f.IsNull();
}
Example #19
0
  /** 
   * Get a directory 
   * 
   * @param in    Input stream
   * @param runNo The run number 
   * @param mc    True for MC 
   * 
   * @return true on success 
   */
  Bool_t GetDir(std::istream& in, ULong_t runNo, Bool_t mc)
  {
    TString line;
    TString tgt3("/catalogue/index.jsp");
    do { 
      line.ReadLine(in);
      // Info("", "line=%s", line.Data());
      if (!line.Contains(tgt3)) continue;
      if (fDebug) Info("", line);
      Int_t tmp         = mc ? line.Index(">")+1 : 0;
      Int_t first       = line.Index(">", tmp);
      Int_t last        = line.Index("<",first+1);
      if (first == kNPOS || last == kNPOS) { 
	Error("GetDir", "Failed to get directory from %s", line.Data());
	return false;
      }
      
      TString dir = line(first+1,last-first-1);
	
      if (fDebug) Info("", "Got run %lu %s", runNo, dir.Data());
      TString path, pass;
      if (!GetPathPass(dir, runNo, path, pass)) return false;
      
      if (fDebug) Info("", "Got run %lu %s %s", runNo,path.Data(),pass.Data());

      if      (fPath.IsNull()) fPath = path;
      else if (!fPath.EqualTo(path)) { 
	Warning("GetDir", "Run %lu location %s not %s", 
	      runNo, path.Data(), fPath.Data());
	return false;
      }

      if      (fPass.IsNull()) fPass = pass;
      else if (!fPass.EqualTo(pass)) { 
	Warning("GetDir", "Run %lu pass %s not %s", 
	      runNo, pass.Data(), fPass.Data());
	return false;
      }
      break;
    } while (!in.eof());
    return true;
  }
Example #20
0
/** 
 * Run the unfolding 
 * 
 * @ingroup pwglf_forward_multdist
 */
void
RunUnfoldMult()
{
  TString rooUnfold = gSystem->Getenv("ROOUNFOLD");
  if (!rooUnfold.IsNull()) {
    gSystem->AddIncludePath(Form("-I%s/src", rooUnfold.Data()));
    gSystem->AddDynamicPath(rooUnfold);
  }
  gSystem->Load("libRooUnfold");
  gROOT->Macro("UnfoldMult.C++");
}
Example #21
0
void PublishCanvas(TList *qaList, const char* det, const char* name, TString nadd)
{
  //
  // draw all nSigma + signal histo
  //


  TObjArray arrHistos;

  TPaveText pt(.1,.1,.9,.9,"NDC");
  pt.SetBorderSize(1);
  pt.SetFillColor(0);
  pt.SetTextSizePixels(16);
  pt.AddText(Form("%s PID QA",det));
  if (!nadd.IsNull()){
    pt.AddText(nadd.Data());
    nadd.Prepend("_");
  }
  arrHistos.Add(&pt);

  TH2 *hSig=Get2DHistogramfromList(qaList,det,Form("hSigP_%s",det));
  if (hSig){
    hSig->SetOption("colz");
    arrHistos.Add(hSig);
  }

  for (Int_t i=0;i<AliPID::kSPECIESC;++i){
    //     for (Int_t i=0;i<AliPID::kSPECIES;++i){
    if (i==(Int_t)AliPID::kMuon) continue;
    TH2 *h=Get2DHistogramfromList(qaList,det,Form(name,AliPID::ParticleName(i)));
    if (!h) continue;
    h->SetOption("colz");
    AddFit(h);
    arrHistos.Add(h);
  }

  Int_t nPads=arrHistos.GetEntriesFast();
  Int_t nCols = (Int_t)TMath::Ceil( TMath::Sqrt(nPads) );
  Int_t nRows = (Int_t)TMath::Ceil( (Double_t)nPads/(Double_t)nCols );

  
  fCanvas->Divide(nCols,nRows);


  for (Int_t i=0; i<nPads;++i) {
    fCanvas->cd(i+1);
    SetupPadStyle();
    arrHistos.At(i)->Draw();
  }

  fCanvas->Update();
  fCanvas->Clear();

}
Example #22
0
int main( int argc, char** argv )
{
   // Select methods (don't look at this code - not of interest)
   TString methodList; 
   for (int i=1; i<argc; i++) {
      TString regMethod(argv[i]);
      if(regMethod=="-b" || regMethod=="--batch") continue;
      if (!methodList.IsNull()) methodList += TString(","); 
      methodList += regMethod;
   }
   return TMVAKaggleHiggs(methodList); 
}
Example #23
0
/** 
 * Function to run a train.  
 * 
 * @param name  Name of the train. 
 * @param cls   class name of train setup
 * @param uri   Exection URI  
 * @param opts  Optons 
 * 
 * @return true on success
 *
 * @ingroup pwglf_forward_trains
 */
Bool_t RunTrain(const TString& name, const TString& cls, 
		const TUrl& uri,     const TString& opts)
{
  // Check for help 
  if (name.IsNull() || name.EqualTo("help", TString::kIgnoreCase) || 
      cls.IsNull()  || cls.EqualTo("help", TString::kIgnoreCase) || 
      !uri.IsValid()) {
    PlainUsage();
    return true;
  }
  
  Bool_t verb = opts.Contains("verbose");
  // Build our helpers 
  if (!BuildRailways(verb, false, true)) return false;

  // Tokenize options 
  if (!opts.EndsWith(",")) opts.Append(",");
  opts.Append("url="); 
  opts.Append(uri.GetUrl());
  TObjArray* optList = opts.Tokenize(",");
  return TrainSetup::Main(name, cls, optList, false);
}
Example #24
0
  /** 
   * Stop a previously started Xrootd server 
   * 
   * @return true if stopped, false otherwise 
   */
  static Bool_t StopXrootd()
  {
    std::ifstream pidFile("xrd.pid");
    if (!pidFile) return false;

    TString s; s.ReadFile(pidFile);
    pidFile.close();
    gSystem->Unlink("xrd.pid");
    
    if (s.IsNull()) return false;

    Info("StopXrootd", "Stopping XRootd server (pid: %s)", s.Data());
    return gSystem->Exec(Form("kill -9 %s", s.Data())) == 0;
  }
Example #25
0
//-------------------------------------------------------------------------------------
void MakeUpHisto(TH1* histo, TString titleX, TString titleY, Int_t marker, Color_t color, Int_t lineWidth)
{
  if (!histo) return;
  histo->SetMarkerStyle(marker);
  histo->SetMarkerSize(0.7);
  histo->SetMarkerColor(color);
  histo->SetLineColor(color);
  histo->SetLineWidth(lineWidth);
  histo->SetFillColor(kWhite);
  histo->SetFillStyle(0);
  histo->GetYaxis()->SetNdivisions(515);
  if (!titleX.IsNull()) histo->GetXaxis()->SetTitle(titleX.Data());
  if (!titleY.IsNull()) histo->GetYaxis()->SetTitle(titleY.Data());
  histo->GetXaxis()->SetLabelSize(0.045);
  histo->GetXaxis()->SetTitleSize(0.045);
  histo->GetXaxis()->SetLabelOffset(-0.003);
  histo->GetXaxis()->SetTitleOffset(1.1);
  histo->GetYaxis()->SetLabelSize(0.045);
  histo->GetYaxis()->SetTitleSize(0.045);
  histo->GetYaxis()->SetLabelOffset(0.007);
  histo->GetYaxis()->SetTitleOffset(1.2);
  return;
}
Example #26
0
void
DrawPlot::drawPlot(const TString& pluginName, const TString& histName, const bool normalise, const bool plotZeroApe){
  TString* plugin = new TString(pluginName.Copy());
  if(!plugin->IsNull())plugin->Append("/");
  for(unsigned int iSector=1; ; ++iSector){
    std::stringstream ss_sectorName, ss_sector;
    ss_sectorName<<"Sector_"<<iSector;
    ss_sector<<*plugin<<ss_sectorName.str()<<"/";
    TDirectory* dir(0);
    //std::cout<<"Sector: "<<ss_sector.str()<<"\n";
    dir = (TDirectory*)designFile_->TDirectory::GetDirectory(ss_sector.str().c_str());
    if(!dir)break;
    
    TH1* SectorName(0);
    designFile_->GetObject((ss_sector.str()+"z_name;1").c_str(), SectorName);
    const TString sectorName(SectorName ? SectorName->GetTitle() : ss_sectorName.str().c_str());
    
    
    TTree* baselineTree(0);
    if(histName=="h_residualWidthX1"){baselineTree = baselineTreeX_;}
    else if(histName=="h_residualWidthY1"){baselineTree = baselineTreeY_;}
    if(baselineTree){
      std::stringstream ss_branch;
      ss_branch<<"Ape_Sector_"<<iSector;
      TBranch* branch(0);
      branch = baselineTree->GetBranch(ss_branch.str().c_str());
      if(branch){
	double delta0(999.);
	branch->SetAddress(&delta0);
        branch->GetEntry(0);
        delta0_ = new double(std::sqrt(delta0));
      }
      else delta0_ = 0;
    }
    else delta0_ = 0;
    
    if(histName=="h_entriesX" || histName=="h_entriesY" ||
       histName=="h_ResX" || histName=="h_ResY" ||
       histName=="h_NorResX" || histName=="h_NorResY")ss_sector<<"Results/";
    
    ss_sector<<histName;
    const TString fullName(ss_sector.str().c_str());
    this->printHist(fullName, histName.Copy().Append("_").Append(sectorName), normalise, plotZeroApe);
    
    if(delta0_)delete delta0_;
  }
}
void DrawContourLine3sigma( TLegend *leg, TH2F* hist, const TString& text="", Int_t linecolor=1, Int_t linestyle=2, Int_t linewidth=2 )
{
   // contour plot
   TH2F* h = new TH2F( *hist );
   h->SetContour( 1 );
   double pval = (1.-0.9973)*0.5; // one-sided
   double signif = TMath::NormQuantile(1-pval);
   //cout <<"DrawContourLine3sigma: pval="<<pval<<", "<<signif<<"sigma for "<<text<<endl;
   h->SetContourLevel( 0, signif );

   h->SetLineColor( linecolor );
   h->SetLineWidth( linewidth );
   h->SetLineStyle( linestyle );
   h->Draw( "samecont3" );

   if (!text.IsNull()) leg->AddEntry(h,text.Data(),"l");
}     
Example #28
0
//_________________________________________________________________________________________________
TChain* CreateChainFromText(const char *fileName, const char *treeName, Int_t nread, Int_t nskip)
{
//
// Create a TChain with all required files listed into a text file.
// Necessary to run analysis in local jobs.
// ---
// Arguments:
//  - xmlFileName = input file list
//  - treeName    = "esdTree" or "aodTree"
//  - nread       = how many files to read (0 = all)
//  - nskip       = how many files to skip from beginning
//

  // if third argument is 0, it is interpreted
  // as "read all lines"
  Bool_t readAll = (nread <= 0);
  
  // initialize output object
  TChain* target = new TChain(treeName);
  
  // open text file
  ifstream fileIn(fileName);
  
  // loop on collection
  TString line;
  while (fileIn.good())
  {
    fileIn >> line;
    if (line.IsNull()) continue;
    
    // skip until reached required number of offset
    if (nskip > 0) {--nskip; continue;}
    
    // stop if required number of read files is reached
    // otherwise update the counter
    if (!readAll && nread <= 0) break;
    nread--;
    
    // add file
    Info("CreateChainFromText", "Adding '%s'", line.Data());
    target->Add(line.Data());
  }
  
  return target;
}
void DrawContourLine68( TLegend *leg, TH2F* hist, const TString& text="", Int_t linecolor=1, Int_t linestyle=2, Int_t linewidth=2 ) {
    // contour plot
    TH2F* h = new TH2F( *hist );
    h->SetContour( 1 );
    double pval = CombinationGlob::cl_percent[0];
    cout<< pval<<endl;
    double signif = TMath::NormQuantile(1-pval);
    cout << "signif: " <<signif << endl;
    h->SetContourLevel( 0, signif );

    h->SetLineColor( linecolor );
    h->SetLineWidth( linewidth );
    h->SetLineStyle( linestyle );
    h->Draw( "samecont3" );

    if (!text.IsNull() && leg) leg->AddEntry(h,text.Data(),"l"); 
    //return h;
}
void
DrawContourLine68( TLegend *leg, TH2F* hist, const TString& text="", Int_t linecolor=CombinationGlob::c_VDarkGray, Int_t linestyle=2 )
{
    // contour plot
    TH2F* h = new TH2F( *hist );
    h->SetContour( 1 );
    double pval = CombinationGlob::cl_percent[0];
    double signif = TMath::NormQuantile(1-pval);

    h->SetContourLevel( 0, signif );

    h->SetLineColor( linecolor );
    h->SetLineWidth( 2 );
    h->SetLineStyle( linestyle );
    h->Draw( "samecont3" );

    if (!text.IsNull()) leg->AddEntry(h,text.Data(),"l");
}