Example #1
0
int mp104_processH1()
{

   // MacOSX may generate connection to WindowServer errors
   gROOT->SetBatch(kTRUE);

   TStopwatch stp;

   // Prepare dataset: vector of files
   std::vector<std::string> files;
   for (int i = 0; i < 4; i++) {
      files.push_back(fh1[i]);
   }

// Check and fit lambdas
#include "mp_H1_lambdas.C"

   ROOT::TTreeProcessorMP pool(3);

   std::cout << tutname << "processing the H1 dataset with a lambda \n";

   auto hListFun = pool.Process(files, doH1, "h42");

   // Check the output
   if (checkH1(hListFun) < 0) return -1;

   // Do the fit
   if (doFit(hListFun, logfile.c_str()) < 0) return -1;

   stp.Print();
   stp.Start();

   // Run the analysis with a selector

   TString selectorPath = gROOT->GetTutorialDir();
   selectorPath += "/tree/h1analysisTreeReader.C+";
   std::cout << tutname << "processing the H1 dataset with selector '" << selectorPath << "'\n";
   TSelector *sel = TSelector::GetSelector(selectorPath);

   // In a second run we use sel
   gSystem->RedirectOutput(logfile.c_str(), "w", &gRH);
   auto hListSel = pool.Process(files, *sel, "h42");
   gSystem->RedirectOutput(0, 0, &gRH);

   // Check the output
   if (checkH1(hListSel) < 0) return -1;

   // Do the fit
   if (doFit(hListSel, logfile.c_str()) < 0) return -1;

   stp.Print();
   stp.Start();

   return 0;
}
Example #2
0
void sim(Int_t nevt=1) {

  //Simulation spets are performet independently

  //Set debug level to 1 in RSTACK module
  //IlcLog::SetModuleDebugLevel("RSTACK",1);

  IlcSimulation simulator;

  TStopwatch timer;
  timer.Start();

  //Perform Hits simulation
  simulator.RunSimulation(nevt);

  //Export geometry to be used for tracks reconstruction
  gGeoManager->Export("geometry.root");

  //Perform SDigits simulation
  simulator.RunSDigitization("TARGET RSTACK");

  //Perform Digits simulation
  simulator.RunDigitization("TARGET RSTACK");

  timer.Stop();
  timer.Print();
}
Example #3
0
void sim(Int_t nev=20) {
  if (gSystem->Getenv("EVENT"))
   nev = atoi(gSystem->Getenv("EVENT")) ;   
  
  IlcSimulation simulator;
  simulator.SetMakeSDigits("TRD TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0 VZERO");
  simulator.SetMakeDigitsFromHits("ITS TPC");
  simulator.SetWriteRawData("ALL","raw.root",kTRUE);

  simulator.SetDefaultStorage("local://$ILC_ROOT/OCDB");
  simulator.SetSpecificStorage("GRP/GRP/Data",
			       Form("local://%s",gSystem->pwd()));
  
  simulator.SetRunQA("ALL:ALL") ; 
  
  simulator.SetQARefDefaultStorage("local://$ILC_ROOT/QAref") ;

  for (Int_t det = 0 ; det < IlcQA::kNDET ; det++) {
    simulator.SetQACycles(det, nev+1) ;
  }
  
  TStopwatch timer;
  timer.Start();
  simulator.Run(nev);
  timer.Stop();
  timer.Print();
}
Example #4
0
//______________________________________________________________________________
void AODmerge()
{
  // Merging method. No staging and no terminate phase.
  TStopwatch timer;
  timer.Start();
  TString outputDir = "wn.xml";
  TString outputFiles = VAR_AOD_MERGE_FILES;
  TString mergeExcludes = "";
  TObjArray *list = outputFiles.Tokenize(",");
  TIter *iter = new TIter(list);
  TObjString *str;
  TString outputFile;
  Bool_t merged = kTRUE;
  while((str=(TObjString*)iter->Next())) {
    outputFile = str->GetString();
    // Skip already merged outputs
    if (!gSystem->AccessPathName(outputFile)) {
      printf("Output file <%s> found. Not merging again.",outputFile.Data());
      continue;
    }
    if (mergeExcludes.Contains(outputFile.Data())) continue;
    merged = AliAnalysisAlien::MergeOutput(outputFile, outputDir, 10, 0);
    if (!merged) {
      printf("ERROR: Cannot merge %s\n", outputFile.Data());
      return;
    }
  }
  // all outputs merged, validate
  ofstream out;
  out.open("outputs_valid_merge", ios::out);
  out.close();
  timer.Print();
}
Example #5
0
Double_t limit( std::string channel, // dimuon, dielectron, mumuee, etc
		std::string mode,    // observed, expected, mass limit (extra k-factor uncertainty)
		Float_t peak,        // resonance mass
		std::string suffix,  // suffix for output file names
		Int_t ntoys,         // number of pseudoexperiments for expected limit
		Int_t mcmc_iter,     // number of MCMC iterations
		Int_t mcmc_burnin,   // number of MCMC burn in steps to be discarded
		std::string inputdir,// directory with workspace files
		Double_t masswindow_width,
		UInt_t minEvents ){

  // time it
  TStopwatch t;
  t.Start();
  
  RooMsgService::instance().setGlobalKillBelow(RooFit::WARNING);

  Double_t limit = -1.0;  

  TwoBody manager;

  //dimuon single channel ratio limit
  if (channel.find("dimuon") != std::string::npos ){
    manager.DimuonRatioLimit(peak, mode, suffix,
			     ntoys, mcmc_iter, mcmc_burnin,
			     inputdir,masswindow_width,minEvents);
  }

  t.Print();
  
  return limit;
}
Example #6
0
File: sim.C Project: alisw/AliRoot
void sim(Int_t nev=5) {
  // Libraries required by the simulation

  gSystem->Load("liblhapdf"); // Parton density functions
  gSystem->Load("libEGPythia6"); // TGenerator interface
  gSystem->Load("libgeant321");

  gSystem->Load("libDPMJET"); // DPMJET, PhoJet and Pythia6115 library
  gSystem->Load("libAliPythia6"); // ALICE specific implementations
  gSystem->Load("libTDPMjet"); // DPMJET interface


  AliSimulation simulator;
  simulator.SetMakeSDigits("TRD TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0 VZERO");
  simulator.SetMakeDigitsFromHits("ITS TPC");
  simulator.SetWriteRawData("ALL","raw.root",kTRUE);

  simulator.SetDefaultStorage("local://$ALIROOT_OCDB_ROOT/OCDB");
  simulator.SetSpecificStorage("GRP/GRP/Data",
			       Form("local://%s",gSystem->pwd()));
 
  simulator.SetRunHLT("default"); // In case we do not have ancored production

  TStopwatch timer;
  timer.Start();
  simulator.Run(nev);
  timer.Stop();
  timer.Print();
}
Example #7
0
void sim(Int_t nev=100) {
  if (gSystem->Getenv("EVENT"))
   nev = atoi(gSystem->Getenv("EVENT")) ;   
  
  AliSimulation simulator;
  simulator.SetMakeSDigits("TRD TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0 VZERO");
  simulator.SetMakeDigitsFromHits("ITS TPC");
  //  simulator.SetWriteRawData("ALL","raw.root",kTRUE);

  simulator.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal");
  //  simulator.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  simulator.SetSpecificStorage("GRP/GRP/Data",
			       Form("local://%s",gSystem->pwd()));
  
  simulator.SetRunQA(":") ; 
  
//  simulator.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;
//
//  for (Int_t det = 0 ; det < AliQA::kNDET ; det++) {
//    simulator.SetQACycles(det, nev+1) ;
//  }
  
  TStopwatch timer;
  timer.Start();
  simulator.Run(nev);
  timer.Stop();
  timer.Print();
}
Example #8
0
void rec() {
 
	AliReconstruction reco;
	reco.SetWriteESDfriend();
	reco.SetWriteAlignmentData();

	reco.SetRecoParam("ITS",AliITSRecoParam::GetLowFluxParam());
	reco.SetRecoParam("TPC",AliTPCRecoParam::GetLowFluxParam());
	reco.SetRecoParam("TRD",AliTRDrecoParam::GetLowFluxParam());
	reco.SetRecoParam("PHOS",AliPHOSRecoParam::GetDefaultParameters());
	reco.SetRecoParam("MUON",AliMUONRecoParam::GetLowFluxParam());
 	reco.SetRecoParam("EMCAL",AliEMCALRecParam::GetLowFluxParam());
 
	reco.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/?cacheFold=/tmp/CDBCache?operateDisconnected=kFALSE");
 
        reco.SetSpecificStorage("GRP/GRP/Data",
                          Form("local://%s",gSystem->pwd()));

	// add TRD standalone tracks
	reco.SetOption("TRD", "sl_tr_1");

	reco.SetRunGlobalQA(kTRUE);

	TStopwatch timer;
	timer.Start();
	reco.Run();
	timer.Stop();
	timer.Print();
}
Example #9
0
void rec() {
	//  AliLog::SetGlobalDebugLevel(10);
	AliCDBManager * man = AliCDBManager::Instance();
	man->SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-10-Release/Residual/");
	man->SetSpecificStorage("EMCAL/*","local://DB");
	
	AliReconstruction reco;
	AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., AliMagFMaps::k5kG);
	AliTracker::SetFieldMap(field,kTRUE);
	reco.SetUniformFieldTracking(kFALSE);
	reco.SetWriteESDfriend();
	reco.SetWriteAlignmentData();
  
	AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetLowFluxParam();
	AliTPCReconstructor::SetRecoParam(tpcRecoParam);
	AliTPCReconstructor::SetStreamLevel(0);
	reco.SetRunReconstruction("ITS TPC TRD TOF HMPID PHOS EMCAL MUON T0 VZERO FMD PMD ZDC");
	//reco.SetInput("raw.root") ;
	//AliPHOSRecoParam* recEmc = new AliPHOSRecoParamEmc();
//	recEmc->SetSubtractPedestals(kFALSE);
//	AliPHOSReconstructor::SetRecoParamEmc(recEmc);  
	reco.SetRunQA(kFALSE) ; 

	TStopwatch timer;
	timer.Start();
	reco.Run();
	timer.Stop();
	timer.Print();
}
Example #10
0
Int_t AliITSrefitV2(Int_t nev=1) {
   cerr<<"Propagating tracks inward through the ITS...\n";

   TFile *in=TFile::Open("AliTPCrefited.root");
   if (!in->IsOpen()) {cerr<<"Can't open AliTPCrefited.root !\n"; return 1;}

   TFile *out=TFile::Open("AliITStracksV2.root","update");
   if (!out->IsOpen()) {
      cerr<<"Can't open AliITStracksV2.root !\n"; return 2;
   }
   TFile *file=TFile::Open("AliITSclustersV2.root");
   if (!file->IsOpen()) {
      cerr<<"Can't open AliITSclustersV2.root !\n";return 3;
   }
   AliITSgeom *geom=(AliITSgeom*)file->Get("AliITSgeom");

   Int_t rc=0;
   TStopwatch timer;
   AliITStrackerV2 tracker(geom);
   for (Int_t i=0; i<nev; i++) {
     cerr<<"Processing event number : "<<i<<endl;
     tracker.SetEventNumber(i);
     rc=tracker.RefitInward(in,out);
   }
   timer.Stop(); timer.Print();

   delete geom;

   file->Close();
   in->Close();
   out->Close();

   return rc;
}
Example #11
0
void sim2(Int_t nevt=1) {

    //Simulation spets are performet all together

    //Set debug level to 1 in RSTACK module
    //IlcLog::SetModuleDebugLevel("RSTACK",1);

    IlcSimulation simulator;

    TStopwatch timer;
    timer.Start();

    //Select detectors to SDigitize
    simulator.SetMakeSDigits("TARGET RSTACK");

    //Select detectors to Digitize
    simulator.SetMakeDigits("TARGET RSTACK");

    //Perform Hits+SDigits+Digits simulation
    simulator.Run(nevt);

    //Export geometry to be used for tracks reconstruction
    gGeoManager->Export("geometry.root");

    timer.Stop();
    timer.Print();
}
Example #12
0
File: rec.C Project: Gangbiao/cvmfs
void rec() {
  AliReconstruction reco;

  reco.SetWriteESDfriend();
  reco.SetWriteAlignmentData();

  reco.SetDefaultStorage(Form("local://%s/OCDB", gSystem->pwd()));
  reco.SetSpecificStorage("GRP/GRP/Data",
			  Form("local://%s",gSystem->pwd()));
  reco.SetRunPlaneEff(kTRUE);

  //reco.SetRunQA("ALL:ALL") ;
  
  reco.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;
  
  for (Int_t det = 0 ; det < AliQA::kNDET ; det++) {
    reco.SetQACycles((AliQAv1::DETECTORINDEX_t)det, 999) ;
    reco.SetQAWriteExpert((AliQAv1::DETECTORINDEX_t)det) ; 
  }
  
  TStopwatch timer;
  timer.Start();
  reco.Run();
  timer.Stop();
  timer.Print();
}
Example #13
0
void sim(const TString sID, Int_t nev=1000)
{
    gSystem->cd(sID.Data());

//gSystem->Load("liblhapdf");
    gSystem->Load("liblhapdf_5_9_1");
    gSystem->Load("libEGPythia6");
//gSystem->Load("libpythia6");
    gSystem->Load("libpythia6_4_21");
//gSystem->Load("libqpythia");
    gSystem->Load("libAliPythia6");
    gSystem->Load("libHIJING");
    gSystem->Load("libTHijing");
    gSystem->Load("libgeant321");

    if (gSystem->Getenv("EVENT")) nev = atoi(gSystem->Getenv("EVENT"));

    AliSimulation simulator;
    simulator.SetRunGeneration(kTRUE);
    simulator.SetRunSimulation(kFALSE);
    simulator.SetMakeSDigits("");
    simulator.SetMakeDigitsFromHits("");
    simulator.SetWriteRawData("");
    simulator.SetRunQA(":") ;

    TStopwatch timer;
    timer.Start();
    simulator.Run(nev);
    WriteXsection();
    timer.Stop();
    timer.Print();

    return;
}
Example #14
0
int main(int argc, char **argv) {
	setUpOnce();
	TStopwatch watch;

	watch.Start();
	ConfigFile config(argc, argv);
	setConfiguration(config);
	watch.Stop();

	cout << "Time to read configuration: " << watch.CpuTime() << "s" << endl;
	watch.Reset();

	watch.Start();

	boost::scoped_ptr<Analysis> myAnalysis(new Analysis(config.datasetInfoFile()));
	myAnalysis->setMaximalNumberOfEvents(Globals::maxEvents);

	vector<string> inputFiles = config.inputFiles();

	for (unsigned int index = 0; index < inputFiles.size(); ++index) {
		myAnalysis->addInputFile(inputFiles.at(index).c_str());
	}

	watch.Stop();
	cout << "Time to prepare analysis: " << watch.CpuTime() << "s" << endl;
	watch.Reset();

	cout << "starting analysis" << endl;
	watch.Start();
	//	ProfilerStart("BATProfile");
	myAnalysis->analyse();
	//	ProfilerStop();
	watch.Stop();
	double eventsPerMinute = myAnalysis->getNumberOfProccessedEvents() / (watch.CpuTime() / 60);
	cout << "Number of events processed per minute: " << eventsPerMinute << endl;
	watch.Print();
	watch.Reset();
	cout << "Finishing up analysis and writing histograms do disk (wait for \"Analysis finished\")" << endl;
	watch.Start();
	myAnalysis->finishAnalysis();
	watch.Stop();
	watch.Print();
	cout << "==========================================================" << endl;
	cout << "\t \t Analysis finished" << endl;
	cout << "==========================================================" << endl;
	return 0;
}
void example(double E0 = 50, int nevents = 100000)
{
   TStopwatch timer;

   // compound nucleus = carbon
   KVNucleus CN(6, 12);
   CN.SetExcitEnergy(E0);

   // decay products
   KVEvent decay;
   KVNucleus* n = decay.AddParticle();
   n->SetZandA(1, 2);
   n = decay.AddParticle();
   n->SetZandA(2, 4);
   n = decay.AddParticle();
   n->SetZandA(3, 6);

   MicroStat::mdweight gps;
   Double_t etot = E0 + decay.GetChannelQValue();
   Double_t total_mass = decay.GetSum("GetMass");

   if (etot <= 0) {
      printf("Break-up channel is not allowed\n");
      return;
   }
   gps.SetWeight(&decay, etot);
   gps.initGenerateEvent(&decay);

   std::cout << "Edisp = " << etot << " MeV" << std::endl;
   KVHashList histos;
   TH1F* h;

   while ((n = decay.GetNextParticle())) {
      Double_t kappa = total_mass / (total_mass - n->GetMass());
      std::cout << n->GetSymbol() << " : max KE = " << 1. / kappa << " * " << etot << " MeV" << std::endl;
      std::cout << n->GetSymbol() << " : m/M = " << n->GetMass() / total_mass << " k = " << kappa << std::endl;
      histos.Add(h = new TH1F(n->GetSymbol(), Form("Kinetic energy of %s", n->GetSymbol()), 200, 0, etot));
      h->Sumw2();
   }
   KVEvent event;

   while (nevents--) {
      gps.GenerateEvent(&decay, &event);
      while ((n = event.GetNextParticle()))((TH1F*)histos.FindObject(n->GetSymbol()))->Fill(n->GetE());
      gps.resetGenerateEvent();
   }

   TIter it(&histos);

   while ((h = (TH1F*)it())) {

      KVNucleus part(h->GetName());
      new TCanvas;
      FitEDist(h, etot, decay.GetMult(), total_mass, part.GetMass());

   }

   timer.Print();
}
Example #16
0
File: sim.C Project: ktf/AliPhysics
void sim(Int_t nev=50) {

  if (gSystem->Getenv("SIM_EVENTS"))
    nev = atoi(gSystem->Getenv("SIM_EVENTS"));

  printf("GENERATE << %d >> events \n",nev);

  gROOT->LoadMacro("IpPion.C++") ;


  AliSimulation simulator;
  simulator.SetMakeSDigits("PHOS");
  simulator.SetMakeDigits("PHOS");
//
// Ideal OCDB
//  simulator.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  simulator.SetDefaultStorage("local://./OCDB");
//  simulator.SetSpecificStorage("GRP/GRP/Data",
//                               Form("local://%s",gSystem->pwd()));

//  simulator.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/");

 //simulator.SetSpecificStorage("GRP/Calib/MeanVertexSPD", "alien://folder=/alice/data/2010/OCDB");

  //PHOS bad map from RAW OCDB
  simulator.SetSpecificStorage("PHOS/*/*/","local://./OCDB");
//  simulator.SetSpecificStorage("PHOS/Calib/EmcBadChannels/","local://./OCDB");
//  simulator.SetSpecificStorage("PHOS/Calib/EmcGainPedestals/","local://./OCDB");

  simulator.SetRunHLT("");
//

  simulator.SetSpecificStorage("GRP/GRP/Data", "alien://Folder=/alice/data/2010/OCDB");

  AliPHOSSimParam *simParam =  AliPHOSSimParam::GetInstance() ;
  simParam->SetAPDNoise(0.000001) ;
  simParam->SetCellNonLineairyA(0.001) ;
//  simParam->SetCellNonLineairyA(0.1) ; //Default
  simParam->SetCellNonLineairyB(0.2) ;
//  simParam->SetCellNonLineairyC(0.989) ; //Jan4
//  simParam->SetCellNonLineairyC(0.995) ; //Jan5 - 2GeV
  simParam->SetCellNonLineairyC(1.031) ; //no NL

// Vertex and Mag.field from OCDB

//  simulator.UseVertexFromCDB();
  simulator.UseMagFieldFromGRP();
  simulator.SetRunQA(":") ;

//
// The rest

  TStopwatch timer;
  timer.Start();
  simulator.Run(nev);
  timer.Stop();
  timer.Print();
}
Example #17
0
//________________________________________________________________________________
void MergeSimpleHistogramFile( const Char_t *TargetName=0, const Char_t *inputFilesPattern=0) 
{
   // This is the deprecated version. To be dleted after debugging
  if (TargetName && TargetName[0] && inputFilesPattern && inputFilesPattern[0] ) {
    TStopwatch time;
    Int_t fileCounter = 0;
    Int_t histogramCounter = 0;
     // Create the output file
     TFile *outFile = TFile::Open(TargetName,"RECREATE");     
     TDirIter listOfFiles(inputFilesPattern);
     const char *fileName = 0;
     while ( (fileName =  listOfFiles.NextFile() ) ) {
        printf(".");
        fileCounter++;
        TFileIter file(fileName);
        TObject *obj = 0;
        while ( (obj = *file) ) {
           if ( obj->IsA()->InheritsFrom( "TH1" ) ) {
              // descendant of TH1 -> merge it
              // printf("Merging histogram: %s\n",obj->GetName() ); 
//              std::cout << "Merging histogram " << obj->GetName() << std::endl;
              TH1 *h1 = (TH1*)obj;
              TH1 *dstHistogram = 0;
              // Check whether we found the new histogram
              if ( (dstHistogram = (TH1 *)outFile->FindObject(h1->GetName()))) {
                 // Accumulate  the  histogram
                  dstHistogram->Add(h1);
                  delete h1;  // Optional, to reduce the memory consumption
                  printf("+");
              } else {
                // First time - move the histogram
                h1->SetDirectory(outFile);
                printf(" The new Histogram found: %s \n", h1->GetName() );
                histogramCounter++;
              }
           } else {
              // printf("Skipping object: %s\n",obj->GetName() ); 
           }
           ++file;
        }
              
     }
     printf("\n Finishing  . . . \n");
     outFile->ls();
     outFile->Write();
     outFile->Close();     
     delete outFile;
     printf(" Total files merged: %d \n", fileCounter);
     printf(" Total histograms merged: %d \n", histogramCounter);
     time.Print("Merge");
  } else {
     printf("\nUsage: root MergeHistogramFile.C(\"DestinationFileName\",\"InputFilesPattern\",kTRUE)\n");     
     printf("------        where InputFilesPattern  ::= <regexp_pattern_for_the_input_files>|@indirect_file_list\n");
     printf("                    indirect_file_list ::= a text file with the list of the files\n");
     printf("                    indirect_file_list can be create by the shell command:\n");
     printf("                         ls -1 --color=never *.root>indirect_file_list \n\n");
  }
}
Example #18
0
void rec() {  
  AliReconstruction reco;
  reco.SetRunReconstruction("ITS TPC TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0 VZERO");

  reco.SetWriteESDfriend();
  reco.SetWriteAlignmentData();

  reco.SetDefaultStorage("alien://Folder=/alice/data/2011/OCDB");

// Total number of specific storages - 28
//
// ITS (2 objects)

  reco.SetSpecificStorage("ITS/Align/Data",     "alien://folder=/alice/simulation/2008/v4-15-Release/Residual");
  reco.SetSpecificStorage("ITS/Calib/SPDNoisy", "alien://folder=/alice/simulation/2008/v4-15-Release/Residual");

//
// MUON (1 objects)
//      MCH

  reco.SetSpecificStorage("MUON/Align/Data",    "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");

//
// TPC (25 objects)

  reco.SetSpecificStorage("TPC/Align/Data", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/GainFactorDedx", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/PadTime0", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/ClusterParam", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/Pedestals", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/Parameters", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/ExB", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/Mapping", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/PadNoise", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/PadGainFactor", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/Temperature", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/RecoParam", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/TimeGain", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/AltroConfig", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/CE", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/Pulser", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/Distortion", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/Ref", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/Raw", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/QA", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/TimeDrift", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/Goofie", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/HighVoltage", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/LaserTracks", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");
  reco.SetSpecificStorage("TPC/Calib/Correction", "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");

  TStopwatch timer;
  timer.Start();
  reco.Run();
  timer.Stop();
  timer.Print();
}
int main (int argc, char *argv[]){
  
  OptionParser(argc,argv);

  TStopwatch sw;
  sw.Start();
  
  if (clean_){
    cout << "Cleaning up first..." << endl;
    system("rm -rf plots/*");
  }
  if (skipSecondaryModels_){
    doSMHiggsAsBackground_=false;
    doSecondHiggs_=false;
    doNaturalWidth_=false;
  }
  SimultaneousFit *simultaneousFit = new SimultaneousFit(filename_,outfilename_,mhLow_,mhHigh_,verbose_,nInclusiveCats_,nExclusiveCats_,doSMHiggsAsBackground_,doSecondHiggs_,doNaturalWidth_);
  simultaneousFit->setInitialFit(initialFit_);
  simultaneousFit->setSimultaneousFit(simultaneousFit_);
  simultaneousFit->setMHDependentFit(mhDependentFit_);
  simultaneousFit->setLoadPriorConstraints(loadPriorConstraints_,constraintValue_);
  if (linearInterp_) {
    simultaneousFit->setLinearInterp(true);
    onlyInitialFit_=true;
  }
  if (onlyInitialFit_) {
    simultaneousFit->setSimultaneousFit(false);
    simultaneousFit->setMHDependentFit(false);
  }
  simultaneousFit->setForceFracUnity(forceFracUnity_);
  if (fork_) simultaneousFit->setFork(forkN_);
  if (saveExtra_) {
    extrafilename_=="0" ?
      simultaneousFit->saveExtra(outfilename_.substr(0,outfilename_.find_last_of(".root"))+"_extra.root") :   
      simultaneousFit->saveExtra(extrafilename_.c_str())  
    ;
  }
  simultaneousFit->runFit(proc_,cat_,nGaussians_,dmOrder_,sigmaOrder_,fracOrder_,recursive_,setToFitValues_);
  if (dumpVars_) simultaneousFit->dumpPolParams(Form("dat/out/pols_%s_cat%d.dat",proc_.c_str(),cat_),proc_);
  //delete simultaneousFit;
  
  cout << "Done." << endl;
  cout << "Whole process took..." << endl;
  cout << "\t "; sw.Print();
 
  if (web_){
    string sitename = webdir_.substr(webdir_.find("www")+4,string::npos);
    sitename = "www.cern.ch/mkenzie/"+sitename;
    cout << "Publishing to web directory " << webdir_ << endl;
    system(Form("rm -rf %s",webdir_.c_str()));
    system(Form("cp -r plots %s",webdir_.c_str()));
    system(Form("make_html.py %s -c -l -n --title \"Simultaneous Signal Fitting\"",webdir_.c_str()));
    cout << "\t" << sitename << endl;
  }

  return 0;
}
Example #20
0
void runTOFCalibTaskOnProof() {
	TStopwatch timer;
	timer.Start();
	
	printf("*** Open PROOF ***");

	gEnv->SetValue("XSec.GSI.DelegProxy","2");
	TProof::Open("alicecaf");
		
	gProof->UploadPackage("STEERBase.par");
	gProof->EnablePackage("STEERBase");
	gProof->UploadPackage("ESD.par");
	gProof->EnablePackage("ESD");
	gProof->UploadPackage("AOD.par");
	gProof->EnablePackage("AOD");
	gProof->UploadPackage("ANALYSIS.par");
	gProof->EnablePackage("ANALYSIS");
	gProof->UploadPackage("ANALYSISalice.par");
	gProof->EnablePackage("ANALYSISalice");
	
	gProof->Load("AliTOFArray.cxx++g");
	gProof->Load("AliTOFCalibTask.cxx++g");
	gROOT->LoadMacro("AddTaskTOFCalib.C");
	cout << "Loaded AddTaskTOFCalib macro "<< endl;
	
	gProof->ShowEnabledPackages();
	
	//ANALYSIS PART	
	//____________________________________________//
	// Make the analysis manager

	AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
	AliESDInputHandler* esdH = new AliESDInputHandler;
	
	esdH->SetInactiveBranches("FMD CaloCluster");
	mgr->SetInputEventHandler(esdH);  
	
	Bool_t domc = kFALSE;
	if (domc) {
		AliMCEventHandler *mcH = new AliMCEventHandler;
		mgr->SetMCtruthEventHandler(mcH);
	}

	//____________________________________________//
	// 1st TOFCalib task
	
	AliTOFCalibTask *taskTOFCalib = AddTaskTOFCalib();
	
	if (!mgr->InitAnalysis()) return;
	mgr->PrintStatus();
	mgr->StartAnalysis("proof","/COMMON/COMMON/LHC08c11_10TeV_0.5T",1000);
	
	timer.Stop();
	timer.Print();
}
Example #21
0
void sim(char *config = "/afs/cern.ch/user/c/coppedis/public/PDC07/Config_PDC07_b03.C", Int_t nev){

  AliSimulation *sim = new AliSimulation(config);
    sim->SetWriteRawData("ZDC");
    TStopwatch timer;
    timer.Start();
    sim->Run(nev);
    timer.Stop();
    timer.Print();

}
Example #22
0
void TestFitG(TGraph *gr, TF1*f, Int_t n){
  TStopwatch timer;
  printf("%s\n",f->GetTitle());
  timer.Start();
  for (Int_t i=0;i<n;i++){
    gr->Fit(f,"q");
  }
  timer.Stop();
  timer.Print(); 
  //f->Print();
}
Example #23
0
void QAmerge(const char *suffix, const char *dir, Int_t stage)
{
// Merging method
  TStopwatch timer;
  timer.Start();
  TString outputDir = dir;
  TString outputFiles = Form("QAresults%s.root,EventStat_temp%s.root,RecoQAresults%s.root",suffix,suffix,suffix);
  TString mergeExcludes = "";
  TObjArray *list = outputFiles.Tokenize(",");
  TIter *iter = new TIter(list);
  TObjString *str;
  TString outputFile;
  Bool_t merged = kTRUE;
  while((str=(TObjString*)iter->Next())) {
    outputFile = str->GetString();
    // Skip already merged outputs
    if (!gSystem->AccessPathName(outputFile)) {
       printf("Output file <%s> found. Not merging again.",outputFile.Data());
       continue;
    }
    if (mergeExcludes.Contains(outputFile.Data())) continue;
    merged = IlcAnalysisAlien::MergeOutput(outputFile, outputDir, 10, stage);
    if (!merged && !outputFile.Contains("RecoQAresults")) {
       printf("ERROR: Cannot merge %s\n", outputFile.Data());
       return;
    }
  }
  // read the analysis manager from file
  if (!outputDir.Contains("Stage")) {
    ofstream out;
    out.open("outputs_valid", ios::out);
    out.close();    
    return;
  }
  IlcAnalysisManager *mgr = IlcAnalysisManager::GetAnalysisManager();
  mgr->SetRunFromPath(mgr->GetRunFromAlienPath(dir));
  mgr->SetSkipTerminate(kFALSE);
  if (!mgr->InitAnalysis()) return;
  mgr->PrintStatus();
  IlcLog::SetGlobalLogLevel(IlcLog::kError);
  TTree *tree = NULL;
  mgr->StartAnalysis("gridterminate", tree);
  if (strlen(suffix)) {
     if (gSystem->Exec(Form("mv trending.root trending%s.root", suffix)))
        ::Error("QAmerge", "File trending.root was not produced");
     if (gSystem->Exec(Form("mv event_stat.root event_stat%s.root", suffix)))
        ::Error("QAmerge", "File trending.root was not produced");
  }   
  ofstream out;
  out.open("outputs_valid", ios::out);
  out.close();
  timer.Print();
}
Example #24
0
void QAtrain(Int_t run = 0, 
             const char *xmlfile   = "wn.xml",
             Int_t  stage          = 0) /*0 = QA train, 1...n - merging stage*/
{
  run_number = run;

  TGrid::Connect("alien://");
  if (!gGrid || !gGrid->IsConnected()) {
    ::Error("QAtrain", "No grid connection");
    return;
  }   
  // Set temporary merging directory to current one
  gSystem->Setenv("TMPDIR", gSystem->pwd());
  // Set temporary compilation directory to current one
  gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
  // Load libraries
  LoadLibraries();
  printf("Include path: %s\n", gSystem->GetIncludePath());
  // Create manager
  IlcAnalysisManager *mgr  = new IlcAnalysisManager("PilotAnalysis_sim", "Production train");
  mgr->SetRunFromPath(run_number);
  // Input handler
  IlcESDInputHandlerRP *esdHandler = new IlcESDInputHandlerRP();
  esdHandler->SetReadFriends(kTRUE);
  esdHandler->SetActiveBranches("ESDfriend");
  mgr->SetInputEventHandler(esdHandler);
  mgr->SetDebugLevel(debug_level);
  
  // Monte Carlo handler
  IlcMCEventHandler* mcHandler = new IlcMCEventHandler();
  mgr->SetMCtruthEventHandler(mcHandler);
  mcHandler->SetPreReadMode(1);
  mcHandler->SetReadTR(kTRUE); 

  // AnalysisTasks
  AddAnalysisTasks();
  if (stage>0) {
    QAmerge(xmlfile, stage);
    return;
  }   
  // Input chain
  TChain *chain = new TChain("esdTree");
  chain->Add("IlcESDs.root");
  TStopwatch timer;
  timer.Start();
  if (mgr->InitAnalysis()) {                                                                                                              
    mgr->PrintStatus(); 
    mgr->SetSkipTerminate(kTRUE);
//    mgr->SetNSysInfo(1);
    mgr->StartAnalysis("local", chain);
  }
  timer.Print();
}
Example #25
0
void TestPeacVerifier() {

//   gSystem->Load("libPeacUtils.so");

//   TProof *p = TProof::Open("skaf.saske.sk:1099","workers=1x");
//   TProof *p = TProof::Open("skaf.saske.sk","workers=1x");
    TProof *p = TProof::Open("alice-caf.cern.ch", "workers=1x");
    p->UploadPackage("../pars/PeacUtils");
    if (p->EnablePackage("PeacUtils")) return;

//   TProofNodes pn(p);
//   TMap *filesmap = new TMap;
//   TMap *nodesmap = pn.GetMapOfNodes();
//
//   TIter nxnd(nodesmap);
//   TList *wli = 0;
//   TObject *obj = 0;
//   Int_t kf = 1;
//   while ((obj = nxnd()) != 0) {
//      if ((wli = dynamic_cast<TList *>(nodesmap->GetValue(obj)))) {
//         THashList *fli = new THashList;
//         Int_t nf = wli->GetSize();
//         TSlaveInfo *wi = (TSlaveInfo *) wli->First();
//         Printf("WK: %s",wi->GetName());
//         fli->Add(new TObjString(wi->GetName()));
//         filesmap->Add(new TObjString(obj->GetName()), fli);
//      }
//   }
//
//   filesmap->SetName("PROOF_FilesToProcess");
//   p->AddInput(filesmap);

//   TFileCollection *coll = p->GetDataSet("myDS");
//   TFileCollection *coll = p->GetDataSet("myBigDS");
    TFileCollection *coll = p->GetDataSet("/PWG2/mvala/LHC11a_000146805_p4_with_SDD");
    TFileCollection *coll = p->GetDataSet("/PWG2/mvala/myDSNew");

    if (!coll) return;
    coll->SetName("PROOF_PEAC_FileCollectionIn");
    p->AddInput(coll);

//   p->SetParameter("PROOF_Packetizer", "TPacketizerFile");
//   p->SetParameter("PROOF_ProcessNotAssigned", (Int_t)1);
    p->SetParameter("PROOF_Packetizer", "TPacketizerUnit");
//   p->SetParameter("PROOF_ProcessNotAssigned", (Int_t)1);
    p->SetParameter("PROOF_UseMergers", "-1");
    TStopwatch timer;
    timer.Start();
    p->Process("TPeacVerifierSel", (Long64_t) 57);
    timer.Stop();
    timer.Print();
}
Example #26
0
void example(double E0 = 50, int nevents = 100000)
{
   TStopwatch timer;

   // 12C* -> 3(4He)
   // compound nucleus = carbon
   KVNucleus CN(6, 12);
   CN.SetExcitEnergy(E0);

   // decay products
   KVEvent decay;
   KVNucleus* n = decay.AddParticle();
   n->SetZandA(2, 4);
   n = decay.AddParticle();
   n->SetZandA(2, 4);
   n = decay.AddParticle();
   n->SetZandA(2, 4);

   MicroStat::mdweight gps;
   Double_t etot = E0 + decay.GetChannelQValue();

   if (etot <= 0) {
      printf("Break-up channel is not allowed\n");
      return;
   }
   gps.SetWeight(&decay, etot);
   gps.initGenerateEvent(&decay);

   TH1F* h1 = new TH1F("h1", "Kinetic energy of alpha particle 3", 200, 0, etot * 2. / 3.);
   h1->Sumw2();

   KVEvent event;

   while (nevents--) {
      gps.GenerateEvent(&decay, &event);
      h1->Fill(event.GetParticle(3)->GetKE());
      gps.resetGenerateEvent();
   }

   h1->Draw();
   TF1* EDis = new TF1("EDis", edist, 0., etot, 3);
   EDis->SetNpx(500);
   EDis->SetParLimits(0, 0, 1.e+08);
   EDis->SetParLimits(1, 0, 2 * etot);
   EDis->FixParameter(2, 3);
   gStyle->SetOptFit(1);
   h1->Fit(EDis, "EM");

   timer.Print();
}
Example #27
0
void QAmerge(const char *dir, Int_t stage)
{
// Merging method
  TStopwatch timer;
  timer.Start();
  TString outputDir = dir;
  TString outputFiles = "QAresults.root,EventStat_temp.root";
  TString mergeExcludes = "";
  TObjArray *list = outputFiles.Tokenize(",");
  TIter *iter = new TIter(list);
  TObjString *str;
  TString outputFile;
  Bool_t merged = kTRUE;
  while((str=(TObjString*)iter->Next())) {
    outputFile = str->GetString();
    // Skip already merged outputs
    if (!gSystem->AccessPathName(outputFile)) {
       printf("Output file <%s> found. Not merging again.",outputFile.Data());
       continue;
    }
    if (mergeExcludes.Contains(outputFile.Data())) continue;
    merged = AliAnalysisAlien::MergeOutput(outputFile, outputDir, 10, stage);
    if (!merged) {
       printf("ERROR: Cannot merge %s\n", outputFile.Data());
       continue;
    }
  }
  TString infolog = "fileinfo.log";
  AliAnalysisAlien::MergeInfo(infolog, dir); 
  // read the analysis manager from file
  if (!outputDir.Contains("Stage")) {
    ofstream out;
    out.open("outputs_valid", ios::out);
    out.close();    
    return;
  }
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  mgr->SetRunFromPath(mgr->GetRunFromAlienPath(dir));
  mgr->SetSkipTerminate(kFALSE);
  if (!mgr->InitAnalysis()) return;
  mgr->PrintStatus();
  AliLog::SetGlobalLogLevel(AliLog::kError);
  TTree *tree = NULL;
  gROOT->cd();
  mgr->StartAnalysis("gridterminate", tree);
  ofstream out;
  out.open("outputs_valid", ios::out);
  out.close();
  timer.Print();
}
Example #28
0
void runAnalysis() {
  TStopwatch timer;
  timer.Start();

  gSystem->AddIncludePath("-I\"$ILC_ROOT/include\"");
  gSystem->Load("libANALYSIS.so");

  gROOT->LoadMacro("testEvent.C+");
//  generate();
  filter_reco();

  timer.Stop();
  timer.Print();
}
Example #29
0
void sim(Int_t nev=200) {

  AliLog::SetGlobalLogLevel(AliLog::kError);
  AliSimulation simulator;
  simulator.SetMakeSDigits("TPC TRD TOF FMD T0 VZERO PHOS HMPID EMCAL PMD MUON ZDC");
  simulator.SetMakeDigitsFromHits("ITS");
  simulator.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/");
 
  TStopwatch timer;
  timer.Start();
  simulator.Run(nev);
  timer.Stop();
  timer.Print();
}
Example #30
0
void rungen(Int_t nev=1){
  // Simulation and reconstruction
  TStopwatch timer;
  timer.Start();
  gSystem->SetIncludePath("-I$ROOTSYS/include -I$ILC_ROOT/include -I$ILC_ROOT");
  gSystem->Load("liblhapdf.so");      // Parton density functions
  gSystem->Load("libEGPythia6.so");   // TGenerator interface
  gSystem->Load("libpythia6.so");     // Pythia
  gSystem->Load("libIlcPythia6.so");  // ILC specific implementations
  gROOT->LoadMacro("fastGen.C+");
  fastGen(nev);
  timer.Stop();
  timer.Print();
}