Пример #1
0
Float_t read_tree(const char *filename = "data.root", Double_t bytes = 10000000)
{
        printf("Reading events from a root tree \n");
        
        TFile *filein = new TFile(filename,"READ");     
        if ( filein->IsZombie() ) {
                printf("Cannot open file \n");
                return 0.0;
        }
        
        Int_t nbgamma; Int_t e[1000]; // up to 1000 energies ..should be ok 
        
        TTree *treein; 
        treein = (TTree *)filein->Get("TEST");
        if ( treein == NULL ) return 0;
        else {
                treein->SetBranchAddress("mult",&nbgamma); 
                treein->SetBranchAddress("e",&e);
        }

        // write events and compute the needed time
        TStopwatch watch; 
        watch.Start();
        treein->Draw("e","","goff");
        watch.Stop();

        cout << "  --> Reading rate " << bytes / (1024*1024*watch.RealTime()) << " MB/s"<< endl ;
        
        filein->Close(); delete filein; return bytes / (1024*1024*watch.RealTime()) ;
}
Пример #2
0
void write(int n) {

   TRandom R;
   TStopwatch timer;

   TFile f1("mathcoreVectorIO_F.root","RECREATE");

   // create tree
   TTree t1("t1","Tree with new Float LorentzVector");

   XYZTVectorF *v1 = new XYZTVectorF();
   t1.Branch("LV branch","ROOT::Math::XYZTVectorF",&v1);

   timer.Start();
   for (int i = 0; i < n; ++i) {
      double Px = R.Gaus(0,10);
      double Py = R.Gaus(0,10);
      double Pz = R.Gaus(0,10);
      double E  = R.Gaus(100,10);
      v1->SetCoordinates(Px,Py,Pz,E);
      t1.Fill();
   }

   f1.Write();
   timer.Stop();
   std::cout << " Time for new Float Vector " << timer.RealTime() << "  " << timer.CpuTime() << std::endl;
   t1.Print();
}
Пример #3
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();
}
Пример #4
0
void run(int nEvents = 100000) {

    TChain* fChain = new TChain("T");

    ifstream sourceFiles("input.txt");
    char line[128];
    int  count = 0;

    while (sourceFiles >> line) {
        fChain->Add(line);      
        ++count;
    }

    cout << count << " files added!" << endl;
    sourceFiles.close();

    TStopwatch timer;
    timer.Start();

    fChain->Process("adcAnalyzer.C+", "", 8*nEvents, 0);

    timer.Stop();

    cout << "\n\nDone!" << endl;
    cout << "CPU Time : " << timer.CpuTime() << " s (total), " << timer.CpuTime()/nEvents << " s (per event)" << endl;
    cout << "RealTime : " << timer.RealTime() << " s (total), " << timer.RealTime()/nEvents << " s (per event)" << endl;
    cout << "\n";
}
Пример #5
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();
}
Пример #6
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();
}
Пример #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();
}
void ana_Main_MC_arg_winscan(string which_MC_to_use, string MCFileLocation) {

	gSystem->Load("libSusyEvent.so");

	// Look ../jec/JetMETObjects/README
	gSystem->Load("../jec/lib/libJetMETObjects.so");

	// Printing utility for ntuple variables
	gROOT->LoadMacro("SusyEventPrinter.cc+");

	// Main analysis code
	gROOT->LoadMacro("SusyMainAna_MC_arg_windowscan.cc+");

	// chain of inputs
	TChain* chain = new TChain("susyTree");

	//////////////// MC files /////////////////
	//MCpoint* thisMCpoint = setupMCpoint(which_MC_to_use);
	chain->Add(MCFileLocation.data());
	//chain->Add(thisMCpoint->filepath.c_str());


	//chain->Add("../susyEvents_AB_1M_ho200_v2.root");
	//chain->Add("../susyEvents_newNatural.root"); //last used!!
	//chain->Add("/eos/uscms/store/user/abarker/MC/newNat350_225/MC_AB_2500k_NEWnaturalHiggsinoNLSPout_mst_350_M3_5025_mu_225.root");//same thing as ../susyEvents_newNatural.root
	//chain->Add("/eos/uscms/store/user/abarker/MC/st_250_ho_150/MC_AB_2500k_st_250_ho_150.root");
	//chain->Add("/eos/uscms/store/user/abarker/MC/st_250_ho_200/MC_AB_2500k_st_250_ho_200.root");
	//chain->Add("/eos/uscms/store/user/abarker/MC/st_350_ho_200/MC_AB_2500k_mst_350_mu_200.root");
	//chain->Add("/eos/uscms/store/user/abarker/MC/ho_140/MC_AB_2500k_ho_140.root");
	//chain->Add("/eos/uscms/store/user/abarker/MC/ho_200/MC_AB_2500k_ho_200.root");
	//chain->Add("../susyEvents_newNatural.root");
	//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_NEWnaturalHiggsinoNLSPout_mst_350_M3_5025_mu_225.root");
	//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_st_250_ho_150.root");
	//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_st_250_ho_200.root");
	//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_mst_350_mu_200.root");
	//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_ho_140.root");
	//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_ho_200.root");


	SusyMainAna_MC_arg_windowscan* sea = new SusyMainAna_MC_arg_windowscan(chain);

	// configuration parameters
	// any values given here will replace the default values
	sea->SetDataset("ttbar_relval");        // dataset name
	sea->SetPrintInterval(1e4);             // print frequency
	sea->SetPrintLevel(0);                  // print level for event contents
	sea->SetUseTrigger(false);
	sea->SetFilter(false);                  // filter events passing final cuts
	sea->SetProcessNEvents(-1);             // number of events to be processed

	TStopwatch ts;
	ts.Start();

	sea->Loop(which_MC_to_use);

	ts.Stop();
	std::cout << "RealTime : " << ts.RealTime()/60.0 << " minutes" << std::endl;
	std::cout << "CPUTime  : " << ts.CpuTime()/60.0 << " minutes" << std::endl;

}
Пример #9
0
void read() {

   TRandom R;
   TStopwatch timer;

   TFile f1("mathcoreVectorIO_F.root");

   // create tree
   TTree *t1 = (TTree*)f1.Get("t1");

   XYZTVectorF *v1 = 0;
   t1->SetBranchAddress("LV branch",&v1);

   timer.Start();
   int n = (int) t1->GetEntries();
   std::cout << " Tree Entries " << n << std::endl;
   double etot=0;
   for (int i = 0; i < n; ++i) {
      t1->GetEntry(i);
      etot += v1->E();
   }

   timer.Stop();
   std::cout << " Time for new Float Vector " << timer.RealTime() << "  " << timer.CpuTime() << std::endl;
   std::cout << " E average" << n<< "  " << etot << "  " << etot/double(n) << endl;
}
Пример #10
0
Float_t write_tree(const char *filename = "data.root", Int_t nbevents = 10000000, Int_t compression = 0)
{
        printf("Writing %d events in a root tree with compression level %d \n",nbevents,compression);
        
        TFile *fileout = new TFile(filename,"recreate");        
        if ( fileout->IsZombie() ) {
                printf("Cannot open file \n");
                return 0.0;
        }
        fileout->SetCompressionLevel(compression);
        
        Double_t wbytes = 0.0;
        Int_t nbgamma; Int_t e[1000]; 
        for (Int_t i = 1; i < 1000; i++) e[i] = 200*i;
        
        TTree *treeout; 
        treeout = new TTree("TEST","TEST");
        treeout->Branch("mult",&nbgamma,"nbgamma/I"); treeout->Branch("e",e,"e[nbgamma]/I");
                
        // write events and compute the needed time
        TStopwatch watch; 
        watch.Start();
        for (int i = 0; i < nbevents; i++ ) {
                nbgamma = 2 + i % 5; wbytes += 4.0;  wbytes += nbgamma * 4.0;
                treeout->Fill();
        }
        watch.Stop();
        
        printf("  --> Writing rate %f MB/s [%f] \n",wbytes/(1024*1024*watch.RealTime()),wbytes/(1024*1024));
        
        fileout->Close(); delete fileout;
        
        return wbytes;
}
Пример #11
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;
}
Пример #12
0
void run(TString runNumber)
{
    TStopwatch timer;
    timer.Start();

    TString dirIn1 = "/Volumes/Data/kresan/s438/data/";
    TString dirIn2 = "/Volumes/Data/kresan/s438/tcal/";
    TString dirOut = "/Volumes/Data/kresan/s438/digi/";
    TString tdiffParName = "tdiff_" + runNumber + ".dat";
    TString inputFileName1 = dirIn2 + runNumber + "_tcal.root";             // name of input file
    TString parFileName    = dirIn1 + "params_" + runNumber + "_raw.root";  // name of parameter file
    TString outputFileName = dirOut + runNumber + "_digi.root";            // name of output file

    // Create analysis run -------------------------------------------------------
    FairRunAna* run = new FairRunAna();
    run->SetInputFile(inputFileName1.Data());
    run->SetOutputFile(outputFileName.Data());
    // ---------------------------------------------------------------------------

    // ----- Runtime DataBase info -----------------------------------------------
    FairRuntimeDb* rtdb = run->GetRuntimeDb();
    FairParRootFileIo* parIo1 = new FairParRootFileIo();
    parIo1->open(parFileName);
    rtdb->setFirstInput(parIo1);
    rtdb->setOutput(parIo1);
    rtdb->saveOutput();
    // ---------------------------------------------------------------------------

    // Tdiff calibration ---------------------------------------------------------
    R3BLandTdiff* landTdiff = new R3BLandTdiff("LandTdiff", 1);
    landTdiff->SetTdiffParName(tdiffParName.Data());
    run->AddTask(landTdiff);
    // ---------------------------------------------------------------------------

    // Analysis ------------------------------------------------------------------
    R3BLandAna* landAna = new R3BLandAna("LandAna", 1);
    landAna->SetNofBars(100);
    run->AddTask(landAna);
    // ---------------------------------------------------------------------------
    
    // Initialize ----------------------------------------------------------------
    run->Init();
    FairLogger::GetLogger()->SetLogScreenLevel("INFO");
    // ---------------------------------------------------------------------------

    // Run -----------------------------------------------------------------------
    run->Run();
    // ---------------------------------------------------------------------------

    timer.Stop();
    Double_t rtime = timer.RealTime();
    Double_t ctime = timer.CpuTime();
    cout << endl << endl;
    cout << "Macro finished succesfully." << endl;
    cout << "Output file is " << outputFileName << endl;
    cout << "Parameter file is " << parFileName << endl;
    cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
}
Пример #13
0
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();
}
Пример #14
0
void  testIntegPerf(double x1, double x2, int n = 100000){


   std::cout << "\n\n***************************************************************\n";
   std::cout << "Test integration performances in interval [ " << x1 << " , " << x2 << " ]\n\n";

  TStopwatch timer;

  double dx = (x2-x1)/double(n);

  //ROOT::Math::Functor1D<ROOT::Math::IGenFunction> f1(& TMath::BreitWigner);
  ROOT::Math::WrappedFunction<> f1(func);

  timer.Start();
  ROOT::Math::Integrator ig(f1 );
  double s1 = 0.0;
  nc = 0;
  for (int i = 0; i < n; ++i) {
     double x = x1 + dx*i;
     s1+= ig.Integral(x1,x);
  }
  timer.Stop();
  std::cout << "Time using ROOT::Math::Integrator        :\t" << timer.RealTime() << std::endl;
  std::cout << "Number of function calls = " << nc/n << std::endl;
  int pr = std::cout.precision(18);  std::cout << s1 << std::endl;  std::cout.precision(pr);



  //TF1 *fBW = new TF1("fBW","TMath::BreitWigner(x)",x1, x2);  //  this is faster but cannot measure number of function calls
  TF1 *fBW = new TF1("fBW",func2,x1, x2,0);

  timer.Start();
  nc = 0;
  double s2 = 0;
  for (int i = 0; i < n; ++i) {
     double x = x1 + dx*i;
     s2+= fBW->Integral(x1,x );
  }
  timer.Stop();
  std::cout << "Time using TF1::Integral :\t\t\t" << timer.RealTime() << std::endl;
  std::cout << "Number of function calls = " << nc/n << std::endl;
  pr = std::cout.precision(18);  std::cout << s1 << std::endl;  std::cout.precision(pr);


}
Пример #15
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();
}
Пример #16
0
// test using UNURAN string interface
void testStringAPI() {

   TH1D * h1 = new TH1D("h1G","gaussian distribution from Unuran",100,-10,10);
   TH1D * h2 = new TH1D("h2G","gaussian distribution from TRandom",100,-10,10);

   cout << "\nTest using UNURAN string API \n\n";


   TUnuran unr; 
   if (! unr.Init( "normal()", "method=arou") ) {
      cout << "Error initializing unuran" << endl;
      return;
   }

   int n = NGEN;
   TStopwatch w; 
   w.Start(); 

   for (int i = 0; i < n; ++i) {
       double x = unr.Sample(); 
       h1->Fill(  x ); 
   }

   w.Stop(); 
   cout << "Time using Unuran method " << unr.MethodName() << "\t=\t " << w.CpuTime() << endl;


   // use TRandom::Gaus
   w.Start();
   for (int i = 0; i < n; ++i) {
      double x = gRandom->Gaus(0,1); 
       h2->Fill(  x ); 
   }

   w.Stop(); 
   cout << "Time using TRandom::Gaus  \t=\t " << w.CpuTime() << endl;

   assert(c1 != 0);
   c1->cd(++izone);
   h1->Draw();
   c1->cd(++izone);
   h2->Draw();

}
Пример #17
0
void dmesondecaylength()
{


    //gStyle->SetOptStat("nemruoi");
    gStyle->SetTitleSize(.04,"S");
    gStyle->SetOptTitle(1);
    gStyle->SetTitleOffset(1.0,"X");
    gStyle->SetTitleOffset(.88,"Y");
    gStyle->SetTitleSize(.04,"X");
    gStyle->SetTitleSize(.04,"Y");
    gStyle->SetLabelSize(.035,"X");
    gStyle->SetLabelSize(.035,"Y");
    gStyle->SetHistLineWidth(2);
    gStyle->SetOptFit(1);
    gStyle->SetOptStat(0);
// -----   Timer   --------------------------------------------------------
    TStopwatch timer;
    timer.Start();
    // ------------------------------------------------------------------------
    double c= 3* std::pow(10.,8.);
    double mt= 1040*std::pow(10.,-15.); // mean decay time
    double mass= 1.869; // rest mass in GeV/c^2
//TCanvas* can = new TCanvas("can","Radiation Length for start detector",0,0,100,100);
    TCanvas *c1 = new TCanvas("c1", "c1",0,52,1191,692);
    TH1D* h = new TH1D("hist","D-meson, D-meson decay length",24,0,24);
    h->SetTitle("D^{+} meson decay length = c#tau#sqrt{(#gamma_{D^{+}}^{2}-1)};Momentum (GeV/c); Decay length (mm)");
    Int_t ci;   // for color index setting
    ci = TColor::GetColor("#000099");
    for (int p=1; p<=24; p++)
    {
        double E = p*p + mass*mass;
        E= std:: sqrt(E);

        double gamma = E/mass;
        double decaylength = c* std::sqrt(gamma*gamma -1)*mt*1000;
        std:: cout<<" Decay length=" <<decaylength<<std::endl;
        h->SetLineColor(ci);
        h->GetXaxis()->CenterTitle(true);
        h->GetYaxis()->CenterTitle(true);
        h->SetMarkerColor(2);
        h->SetMarkerStyle(20);
        h->SetBinContent(p,decaylength);
        h->Draw("E2-text");
    }
// -----  Finish   -------------------------------------------------------
    timer.Stop();
    Double_t rtime = timer.RealTime();
    Double_t ctime = timer.CpuTime();
    cout << endl << endl;
    cout << "Macro finished succesfully." << endl;
    cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
    cout << endl;
    // ------------------------------------------------------------------------

}
Пример #18
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();
}
Пример #19
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();
}
Пример #20
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();

}
Пример #21
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();
}
Пример #22
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();
}
Пример #23
0
double write(int n) {



  TRandom R;
  TStopwatch timer;


  TFile f1("mathcoreLV.root","RECREATE");

  // create tree
  TTree t1("t1","Tree with new LorentzVector");

  std::vector<ROOT::Math::XYZTVector>  tracks;
  std::vector<ROOT::Math::XYZTVector> * pTracks = &tracks;
  t1.Branch("tracks","std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >",&pTracks);

  double M = 0.13957;  // set pi+ mass

  timer.Start();
  double sum = 0;
  for (int i = 0; i < n; ++i) {
    int nPart = R.Poisson(5);
    pTracks->clear();
    pTracks->reserve(nPart);
    for (int j = 0; j < nPart; ++j) {
      double px = R.Gaus(0,10);
      double py = R.Gaus(0,10);
      double pt = sqrt(px*px +py*py);
      double eta = R.Uniform(-3,3);
      double phi = R.Uniform(0.0 , 2*TMath::Pi() );
      RhoEtaPhiVector vcyl( pt, eta, phi);
      // set energy
      double E = sqrt( vcyl.R()*vcyl.R() + M*M);
      XYZTVector q( vcyl.X(), vcyl.Y(), vcyl.Z(), E);
      // fill track vector
      pTracks->push_back(q);
      // evaluate sum of components to check
      sum += q.x()+q.y()+q.z()+q.t();
    }
    t1.Fill();
  }

  f1.Write();
  timer.Stop();
  std::cout << " Time for new Vector " << timer.RealTime() << "  " << timer.CpuTime() << std::endl;

  t1.Print();
  return sum;
}
Пример #24
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();
}
Пример #25
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();
}
Пример #26
0
void sim(Int_t nev=1) {
  AliSimulation simulator;
  simulator.SetWriteRawData("ALL","raw.root",kTRUE);

  simulator.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/");
  simulator.SetSpecificStorage("GRP/GRP/Data",
			       Form("local://%s",gSystem->pwd()));


  TStopwatch timer;
  timer.Start();
  simulator.Run(nev);
  timer.Stop();
  timer.Print();
}
Пример #27
0
void countTriggers() {

  // Printing utility for ntuple variables
  gROOT->LoadMacro("/afs/cern.ch/user/y/yohay/scratch0/CMSSW_4_2_4_patch2/src/SusyAnalysis/SusyNtuplizer/macro/SusyEventPrinter.cc+");
//   gROOT->LoadMacro("SusyEventPrinter.cc+");

  // Main analysis code
//   gSystem->SetIncludePath("-I../../..");
  gSystem->SetIncludePath("-I/afs/cern.ch/user/y/yohay/scratch0/CMSSW_4_2_4_patch2/src");
  gROOT->LoadMacro("/afs/cern.ch/user/y/yohay/scratch0/CMSSW_4_2_4_patch2/src/SusyAnalysis/SusyNtuplizer/macro/EventAnalyzer.cc+");
//   gROOT->LoadMacro("EventAnalyzer.cc+");

  //configuration
  TChain chain("susyTree");
  chain.Add("susyEvent_ALL_1.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-May10ReReco-v1/Photon/Runs160442-163869/susyEvent_ALL_1.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-May10ReReco-v1/Photon/Runs160442-163869/susyEvent_ALL_2.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-PromptReco-v4/Photon/Run166438/susyEvent_ALL.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-PromptReco-v4/Photon/Runs165088-166346/susyEvent_ALL_1.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-PromptReco-v4/Photon/Runs165088-166346/susyEvent_ALL_2.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-PromptReco-v4/Photon/Runs166374-166486/susyEvent_ALL.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-PromptReco-v4/Photon/Runs166502-166530/susyEvent_ALL.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-PromptReco-v4/Photon/Runs166554-166787/susyEvent_ALL.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-PromptReco-v4/Photon/Runs166839-166911/susyEvent_ALL.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-PromptReco-v4/Photon/Runs166921-167078/susyEvent_ALL.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-PromptReco-v4/Photon/Runs167098-167284/susyEvent_ALL.root");
//   chain.Add("/data/ndpc3/c/dmorse/RA3/SusyNtuples/cms423v5_v1/Run2011A-PromptReco-v4/Photon/Runs167551-167913/susyEvent_ALL.root");
  EventAnalyzer treeReader(&chain);
  treeReader.SetPrintInterval(10000);
  treeReader.SetPrintLevel(0);
  treeReader.SetUseTrigger(true);
  treeReader.AddHltName("HLT_Photon32_CaloIdL_Photon26_CaloIdL");
  treeReader.AddHltName("HLT_Photon36_CaloIdL_Photon22_CaloIdL");
  treeReader.AddHltName("HLT_Photon40_CaloIdL_Photon28_CaloIdL");
  treeReader.SetFilter(false);
  treeReader.SetProcessNEvents(-1);
  treeReader.IncludeAJson("/afs/cern.ch/user/y/yohay/scratch0/CMSSW_4_2_4_patch2/src/SusyAnalysis/SusyNtuplizer/macro/Cert_160404-172255_7TeV_PromptReco_Collisions11_JSON.txt");
  treeReader.SetPhotonTag("photons");

  //run
  TStopwatch ts;
  ts.Start();
//   treeReader.countTriggers("/afs/cern.ch/user/y/yohay/scratch0/CMSSW_4_2_4_patch2/src/SusyAnalysis/SusyNtuplizer/count_May10ReReco_PromptRecov4_testv3");
  treeReader.countTriggers("count_May10ReReco_PromptRecov4_batchTest");
  ts.Stop();
  cout << "Real time : " << ts.RealTime()/60.0 << " minutes" << endl;
  cout << "CPU time  : " << ts.CpuTime()/60.0 << " minutes" << endl;
}
Пример #28
0
void testDiscDistr() { 

   cout << "\nTest Discrete distributions\n\n";

   TH1D * h1 = new TH1D("h1PS","Unuran Poisson prob",20,0,20);
   TH1D * h2 = new TH1D("h2PS","Poisson dist from TRandom",20,0,20);

   double mu = 5; 

   TF1 * f = new TF1("fps",poisson,1,0,1);
   f->SetParameter(0,mu);

   TUnuranDiscrDist dist2 = TUnuranDiscrDist(f);
   TUnuran unr;

   // dari method (needs also the mode and pmf sum)
   dist2.SetMode(int(mu) );
   dist2.SetProbSum(1.0);
   bool ret = unr.Init(dist2,"dari");
   if (!ret) return;

   TStopwatch w; 
   w.Start(); 

   int n = NGEN;
   for (int i = 0; i < n; ++i) {
      int k = unr.SampleDiscr(); 
      h1->Fill( double(k) ); 
   }

   w.Stop(); 
   cout << "Time using Unuran method " << unr.MethodName() << "\t=\t\t " << w.CpuTime() << endl;

   w.Start();
   for (int i = 0; i < n; ++i) {
      h2->Fill(  gRandom->Poisson(mu) ); 
   }
   cout << "Time using TRandom::Poisson " << "\t=\t\t " << w.CpuTime() << endl;

   c1->cd(++izone);
   h1->SetMarkerStyle(20);
   h1->Draw("E");
   h2->Draw("same");
   
   std::cout << " chi2 test of UNURAN vs TRandom generated histograms:  " << std::endl;
   h1->Chi2Test(h2,"UUP");

}
Пример #29
0
void rec() {

  AliReconstruction MuonRec;

  MuonRec.SetInput("raw.root");
  MuonRec.SetRunLocalReconstruction("MUON ITS VZERO");
  MuonRec.SetRunTracking("MUON ITS VZERO");
  MuonRec.SetRunVertexFinder(kTRUE);
  MuonRec.SetFillESD("MUON VZERO HLT");
  MuonRec.SetRunQA("MUON:ALL");
  
  MuonRec.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/");

  // QA reference
  MuonRec.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;

  // HLT
  MuonRec.SetSpecificStorage("HLT/ConfigMUON/DecisionComponent","alien://Folder=/alice/cern.ch/user/b/bogdan/prod2009/cdb");
  MuonRec.SetSpecificStorage("HLT/ConfigMUON/HitReconstructor","alien://Folder=/alice/cern.ch/user/b/bogdan/prod2009/cdb");
  MuonRec.SetSpecificStorage("HLT/ConfigMUON/MansoTrackerFSM","alien://Folder=/alice/cern.ch/user/b/bogdan/prod2009/cdb");
  MuonRec.SetSpecificStorage("HLT/ConfigMUON/TriggerReconstructor","alien://Folder=/alice/cern.ch/user/b/bogdan/prod2009/cdb");
  
  // CTP
  MuonRec.SetSpecificStorage("GRP/CTP/Config","alien://Folder=/alice/cern.ch/user/b/bogdan/prod2009/cdb");
  
  // tracker masks
  MuonRec.SetSpecificStorage("MUON/Calib/Gains","alien://Folder=/alice/cern.ch/user/b/bogdan/prod2009/cdb/rec");
  MuonRec.SetSpecificStorage("MUON/Calib/Pedestals","alien://Folder=/alice/cern.ch/user/b/bogdan/prod2009/cdb/rec");

  // reconstruction parameters
  AliMUONRecoParam *muonRecoParam = AliMUONRecoParam::GetLowFluxParam();
  muonRecoParam->SaveFullClusterInESD(kTRUE,100.);
  for (Int_t i = 0; i < 10; i++) {
    muonRecoParam->SetDefaultNonBendingReso(i, 0.1524);
    muonRecoParam->SetDefaultBendingReso(i, 0.05099);
  }
  //muonRecoParam->Print("FULL");
  MuonRec.SetRecoParam("MUON",muonRecoParam);

  MuonRec.SetNumberOfEventsPerFile(500);

  TStopwatch timer;
  timer.Start();
  MuonRec.Run();
  timer.Stop();
  timer.Print();
  
}
Пример #30
0
void runAliTask() {
  TStopwatch timer;
  timer.Start();
//   gSystem->Load("libTree.so");
//   gSystem->Load("libGeom.so");
//   gSystem->Load("libVMC.so");
//   gSystem->Load("libPhysics.so");
//   //____________________________________________________//
//   //_____________Setting up required packages___________//
//   //____________________________________________________//
//   gSystem->Load("libSTEERBase.so");
//   gSystem->Load("libESD.so");
//   gSystem->Load("libAOD.so");
//   gSystem->Load("libANALYSIS.so");
//   gSystem->Load("libANALYSISalice.so");
//   gROOT->ProcessLine(".include $ALICE_ROOT/include");
// 
//   //___________Compile analysis task using AClic____________//
//   gROOT->LoadMacro("../task/AliAnalysisTaskPt.cxx+g");
// 
// 
//   gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");

  TChain* chain = CreateESDChain("files.txt", 2);

  //____________________________________________//
  // Make the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
  AliESDInputHandler* esdH = new AliESDInputHandler();
  mgr->SetInputEventHandler(esdH);  
  //____________________________________________//
  // 1st Pt task
  AliAnalysisTaskPt *task1 = new AliAnalysisTaskPt("TaskPt");
  mgr->AddTask(task1);
  // Create containers for input/output
  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist1", TH1::Class(),AliAnalysisManager::kOutputContainer,"Pt.ESD.root");
  
  //____________________________________________//
  mgr->ConnectInput(task1,0,cinput1);
  mgr->ConnectOutput(task1,0,coutput1);
  if (!mgr->InitAnalysis()) return;
  mgr->PrintStatus();
  //mgr->StartAnalysis("local",chain);

  timer.Stop();
  timer.Print();
}