Ejemplo n.º 1
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();
}
Ejemplo n.º 2
0
void DphiAnalysis()
{
      gSystem->Load("libTree.so");
      gSystem->Load("libPhysics.so");
      gSystem->Load("libGeom.so");
      gSystem->Load("libVMC.so");
      gSystem->Load("libANALYSIS.so");
      gSystem->Load("libSTEERBase.so");
      gSystem->Load("libAOD.so");
      gSystem->Load("libESD.so");
      gSystem->Load("libANALYSISilc.so");

     //
    if (gApplication) gApplication->InitializeGraphics();
    // Create the chain
    //

    //TString path("/afs/cern.ch/user/m/morsch/public/");
    TString path("./");
    TChain* chain = new TChain("aodTree");
    chain->Add(Form("%s/%s",path.Data(),"IlcAOD.root"));

    /////////////////////////////////////////////////////////////////////////////////// 
    // Create the analysis manager
    //
    // Input 
    IlcMultiEventInputHandler* inpHandler = new IlcMultiEventInputHandler(2, 1);
    // Pool
    IlcEventPoolOTF* pool = new IlcEventPoolOTF("event pool", "AOD");

    pool->SetTagDirectory(path.Data());
    pool->SetMultiplicityBin(0, 100, 100);
    pool->Init();
    
    IlcAnalysisManager *mgr  = new IlcAnalysisManager("Jet Manager", "Jet Manager");
    mgr->SetInputEventHandler  (inpHandler);
    mgr->SetEventPool(pool);
    inpHandler->SetEventPool(pool);
    

    mgr->SetDebugLevel(10);
    /////////////////////////////////////////////////////////////////////////////////// 
    gROOT->LoadMacro("IlcAnalysisTaskPhiCorr.cxx++g");
    IlcAnalysisTaskPhiCorr *dphiana = new IlcAnalysisTaskPhiCorr("Phi Correlation Analysis");
    dphiana->SetDebugLevel(10);
    mgr->AddTask(dphiana);
    
    //
    // Create containers for input/output
    IlcAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
							     IlcAnalysisManager::kInputContainer);

    IlcAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(),
							      IlcAnalysisManager::kExchangeContainer, "default");
    IlcAnalysisDataContainer *coutput2 = mgr->CreateContainer("histos", TList::Class(),
							      IlcAnalysisManager::kOutputContainer, "histos.root");


    mgr->ConnectInput  (dphiana,  0,  mgr->GetCommonInputContainer());
    mgr->ConnectOutput (dphiana,  0, coutput1 );
    mgr->ConnectOutput (dphiana,  1, coutput2 );

    // 
    // Run the analysis
    //    
    mgr->InitAnalysis();
    mgr->PrintStatus();
    mgr->StartAnalysis("mix",chain, 1000);
}
void runCentralitySelection(const char *mode="local")
{
  // Load common libraries
  gSystem->Load("libCore.so");  
  gSystem->Load("libTree.so");
  gSystem->Load("libGeom.so");
  gSystem->Load("libVMC.so");
  gSystem->Load("libPhysics.so");
  gSystem->Load("libSTEERBase");
  gSystem->Load("libESD");
  gSystem->Load("libAOD");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISilc");   
  gSystem->Load("libCORRFW");   
  gSystem->Load("libPWGHFbase");   
  gSystem->Load("libPWGmuon");   
  // Use IlcRoot includes to compile our task
  gROOT->ProcessLine(".include $ILC_ROOT/include");

  // filename 
  TChain* chain = new TChain("esdTree");
  chain->AddFile("/home/alberica/analysis/centrality/data/ilc/sim/LHC10a12/104157/998/root_archive.zip#IlcESDs.root");
 
 // Create the analysis manager
  IlcAnalysisManager *mgr = new IlcAnalysisManager("AnalysisManager");
  mgr->SetDebugLevel(10);
  
  // My task
  gROOT->LoadMacro("IlcCentralitySelectionTask.cxx++g");   
  IlcCentralitySelectionTask *task = new IlcCentralitySelectionTask("CentralitySelection"); 
  task->SetPercentileFile("test_IlcCentralityBy1D.root");
  task->SetCentralityMethod("V0");
  mgr->AddTask(task);

  // My dummy task
  gROOT->LoadMacro("IlcDummy.cxx++g");   
  IlcDummy *dummytask = new IlcDummy("Dummy"); 
  mgr->AddTask(dummytask);



  IlcMCEventHandler*  mcHandler = new IlcMCEventHandler();
  mgr->SetMCtruthEventHandler(mcHandler);

  IlcESDInputHandler* esdH = new IlcESDInputHandler();
  mgr->SetInputEventHandler(esdH);

  // Create containers for input/output
  mgr->ConnectInput (task,0, mgr->GetCommonInputContainer());
  mgr->ConnectInput (dummytask,0, mgr->GetCommonInputContainer());
  //  mgr->ConnectOutput(task,0, mgr->GetCommonOutputContainer());  

  // Enable debug printouts
  mgr->SetDebugLevel(2);

  if(!mgr->InitAnalysis()) return;

  mgr->PrintStatus();
  // Start analysis in grid.
  mgr->StartAnalysis(mode, chain);

};
void JetAnalysisManagerKine()
{
      gSystem->Load("libTree.so");
      gSystem->Load("libPhysics.so");
      gSystem->Load("libGeom.so");
      gSystem->Load("libVMC.so");
      gSystem->Load("libANALYSIS.so");
      gSystem->Load("libSTEERBase.so");
      gSystem->Load("libAOD.so");
      gSystem->Load("libESD.so");
      gSystem->Load("libANALYSISilc.so");
      gSystem->Load("libJETAN.so");

     //
    if (gApplication) gApplication->InitializeGraphics();
    // Create the chain
    //
    gROOT->LoadMacro("CreateESDChain.C");
    TChain* chain = new TChain("TE");
    chain->Add("/Users/kleinb/ilc/sim/PDC_08/LHC08v/280039/999/gilc.root");
    /////////////////////////////////////////////////////////////////////////////////// 
    // Create the analysis manager
    //
    // Output
    IlcAODHandler* aodHandler = new IlcAODHandler();
    aodHandler->SetOutputFileName("aod.root");
    // MC Truth
    IlcMCEventHandler* mcHandler = new IlcMCEventHandler();
    IlcAnalysisManager *mgr  = new IlcAnalysisManager("Jet Manager", "Jet Manager");
    mgr->SetOutputEventHandler (aodHandler);
    mgr->SetMCtruthEventHandler(mcHandler);
    mgr->SetDebugLevel(10);

    IlcAnalysisTaskKineFilter *kinefilter = new IlcAnalysisTaskKineFilter("Kine Filter");
    mgr->AddTask(kinefilter);
    
    
    IlcAnalysisTaskJets *jetana = new IlcAnalysisTaskJets("JetAnalysis");
    jetana->SetConfigFile("ConfigJetAnalysisMC.C");
    jetana->SetDebugLevel(10);
    mgr->AddTask(jetana);

    //
    // Create containers for input/output
    IlcAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
							     IlcAnalysisManager::kInputContainer);

    IlcAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(),
							      IlcAnalysisManager::kOutputContainer, "default");
    IlcAnalysisDataContainer *coutput2 = mgr->CreateContainer("histos", TList::Class(),
							      IlcAnalysisManager::kOutputContainer, "histos.root");

    mgr->ConnectInput  (kinefilter,     0, cinput1  );
    mgr->ConnectOutput (kinefilter,     0, coutput1 );

    mgr->ConnectInput  (jetana,     0, cinput1  );
    mgr->ConnectOutput (jetana,     0, coutput1 );
    mgr->ConnectOutput (jetana,     1, coutput2 );


    //
    // Run the analysis
    //    
    mgr->InitAnalysis();
    mgr->PrintStatus();
    mgr->StartAnalysis("local",chain);
}
Ejemplo n.º 5
0
//______________________________________________________________________________
void AODtrain(Int_t merge=0)
{
// Main analysis train macro.

  if (merge) {
    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);
   printf("==================================================================\n");
   printf("===========    RUNNING FILTERING TRAIN   ==========\n");
   printf("==================================================================\n");
   printf("=  Configuring analysis train for:                               =\n");
   if (usePhysicsSelection)   printf("=  Physics selection                                                =\n");
   if (useTender)    printf("=  TENDER                                                        =\n");
   if (iESDfilter)   printf("=  ESD filter                                                    =\n");
   if (iMUONcopyAOD) printf("=  MUON copy AOD                                                 =\n");
   if (iJETAN)       printf("=  Jet analysis                                                  =\n");
   if (iJETANdelta)  printf("=     Jet delta AODs                                             =\n");
   if (iPWGHFvertexing) printf("=  PWGHF vertexing                                                =\n");
   if (iPWGDQJPSIfilter) printf("=  PWGDQ j/psi filter                                             =\n");
   if (iPWGHFd2h) printf("=  PWGHF D0->2 hadrons QA                                     =\n");

   // Load common libraries and set include path
   if (!LoadCommonLibraries()) {
      ::Error("AnalysisTrain", "Could not load common libraries");
      return;
   }
    
   // Make the analysis manager and connect event handlers
   IlcAnalysisManager *mgr  = new IlcAnalysisManager("Analysis Train", "Production train");
   if (useSysInfo) mgr->SetNSysInfo(100);
   // Load analysis specific libraries
   if (!LoadAnalysisLibraries()) {
      ::Error("AnalysisTrain", "Could not load analysis libraries");
      return;
   }   

   // Create input handler (input container created automatically)
   // ESD input handler
   IlcESDInputHandler *esdHandler = new IlcESDInputHandler();
   mgr->SetInputEventHandler(esdHandler);       
   // Monte Carlo handler
   if (useMC) {
      IlcMCEventHandler* mcHandler = new IlcMCEventHandler();
      mgr->SetMCtruthEventHandler(mcHandler);
      mcHandler->SetReadTR(useTR); 
   }   
   // AOD output container, created automatically when setting an AOD handler
   if (iAODhandler) {
      // AOD output handler
      IlcAODHandler* aodHandler   = new IlcAODHandler();
      aodHandler->SetOutputFileName("IlcAOD.root");
      mgr->SetOutputEventHandler(aodHandler);
   }
   // Debugging if needed
   if (useDBG) mgr->SetDebugLevel(3);

   AddAnalysisTasks();
   if (merge) {
      AODmerge();
      mgr->InitAnalysis();
      mgr->SetGridHandler(new IlcAnalysisAlien);
      mgr->StartAnalysis("gridterminate",0);
      return;
   }   
   // Run the analysis                                                                                                                     
   //
   TChain *chain = CreateChain();
   if (!chain) return;
                                                                                                                                                   
   TStopwatch timer;
   timer.Start();
   mgr->SetSkipTerminate(kTRUE);
   if (mgr->InitAnalysis()) {
      mgr->PrintStatus();
      mgr->StartAnalysis("local", chain);
   }
   timer.Print();
}