Esempio n. 1
0
bool CBaseToolApp::LoadAppLibraries()
{
	if( !LoadLibraries( "CVar", "FileSystem", "SoundSystem", "Renderer" ) )
		return false;

	return true;
}
i32 CCGShaderSystem::Init(IRenderSystem* pRS)
{
    //Init base cg system
    if( XST_FAILED( XSE::CCGShaderSystem::Init( pRS ) ) )
    {
        return XST_FAIL;
    }

    UnloadLibraries();
    if( XST_FAILED( LoadLibraries() ) )
    {
        return XST_FAIL;
    }

    m_pRenderSystem = (CRenderSystem*)pRS;

    CG::SetProfiles( m_pRenderSystem->m_eFeatureLevel, m_aeProfiles );

    HRESULT hr = cgD3D11SetDevice( this->m_CGContext, m_pRenderSystem->m_pDevice );
    CHECK_CG_ERR( "setting Direct3D11 device", "" );
    if( FAILED( hr ) )
    {
        XST_LOG_ERR( "Setting Direct3D11 device failed: " << hr );
        return XST_FAIL;
    }

    if( XST_FAILED( ApplyShaderConstantNames() ) )
    {
        return XST_OK;
    }

    return XST_OK;
}
Esempio n. 3
0
Script::Script(string scriptName)
{
	// init Lua and load all libraries
	L = lua_open();
	LoadLibraries();
	
	LoadScript(scriptName);	
}
Esempio n. 4
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();
}
Esempio n. 5
0
void WinEDA_ConfigFrame::OnCloseWindow(wxCloseEvent & event)
/***********************************************************/
{
    ChangeSetup();
    if ( m_LibListChanged )
    {
        LoadLibraries(m_Parent);
        if ( m_Parent->m_Parent->ViewlibFrame )
            m_Parent->m_Parent->ViewlibFrame->ReCreateListLib();
    }
    EndModal(0);
}
void InitializeHardwareSensor(void)
{
	BOOL bResult;
	//initial hardware sensor
    LoadLibraries();
	
	RtGPS_Init(1,38400);	//Open GPS port
    eCompass_Init();	//initial e-compass
    eCompass_Start();	//start e-compass
	bResult = NOR_Open();
	bResult = HRS_Start();
	bResult = CAD_Start();
}
	i32 CCGShaderSystem::Init(IRenderSystem* pRS)
	{
		UnloadLibraries();
		if( XST_FAILED( LoadLibraries() ) )
		{
			return XST_FAIL;
		}

		m_pRS = pRS;

		m_CGContext = cgCreateContext();
		CHECK_CG_ERR( "creating context", "" );

		return XST_OK;
	}
void LoadLibsSara()
{

  // Load configuration
  gROOT->LoadMacro("ConfigurationVAF.C");


  // Set paths
  gSystem->SetIncludePath(includepath.Data()); 
  gSystem->AddDynamicPath(local_fastjet_path.Data()); 

  // Load libraries locally 
  TString loadLibraries="LoadLibraries.C"; loadLibraries.Prepend(loadMacroPath.Data());
  gROOT->LoadMacro(loadLibraries.Data());
  LoadLibraries(kFALSE);
  // for FastJet
  TObjArray *arr;
  TObjString *objstr;
  arr = loaddylibs.Tokenize(" ");
  TIter next(arr);
  while ((objstr=(TObjString*)next())){
    TString str=(objstr->GetString()).Append(".dylib");
    Printf("Loading %s", str.Data());
    gSystem->Load(str.Data());
  }
  // standard AliRoot
  arr = loadlibs.Tokenize(" ");
  TIter next(arr);
  while ((objstr=(TObjString*)next())){
    TString str=objstr->GetString();
    Printf("Loading %s", str.Data());
    gSystem->Load(str.Data());
  }

  // Load analysis sources locally
  arr = sources.Tokenize(" ");
  TIter next(arr);
  while ((objstr=(TObjString*)next())){
    //TString str=(objstr->GetString()).Append(".cxx++g");
    TString str=(objstr->GetString()).Append(".cxx+");
    gROOT->LoadMacro(str.Data());
  }

  return;
}
void CMusikSourcesCtrl::InitItems()
{
    // libraries / devices
    if ( m_LibrariesRoot )
    {
        DeleteItem( m_LibrariesRoot );
        delete m_LibrariesRoot;
    }

    CMusikPlaylistInfo info;

    info.Set( "Music", -1, -1 );
    m_LibrariesRoot = InsertItem( new CMusikPropTreeItem() );
    m_LibrariesRoot->SetPlaylistInfo( info );
    m_LibrariesRoot->Expand( true );

    LoadLibraries();

    // standard playlists
    if ( m_StdPlaylistRoot )
    {
        DeleteItem( m_StdPlaylistRoot );
        delete m_StdPlaylistRoot;
    }

    info.Set( "Standard Playlists", -1, -1 );
    m_StdPlaylistRoot = InsertItem( new CMusikPropTreeItem() );
    m_StdPlaylistRoot->SetPlaylistInfo( info );
    m_StdPlaylistRoot->Expand( true );
    LoadStdPlaylists();

    // dynamic playlists
    if ( m_DynPlaylistRoot )
    {
        DeleteItem( m_DynPlaylistRoot );
        delete m_DynPlaylistRoot;
    }

    info.Set( "Dynamic Playlists", -1, -1 );
    m_DynPlaylistRoot = InsertItem( new CMusikPropTreeItem() );
    m_DynPlaylistRoot->SetPlaylistInfo( info );
    m_DynPlaylistRoot->Expand( true );
}
Esempio n. 10
0
void
Config()
{

  /* initialise */
  gROOT->LoadMacro("Sim/DetectorConfig.C");
  gROOT->LoadMacro("Sim/GeneratorConfig.C");
  ProcessEnvironment();

  /* verbose */
  printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
  printf(">>>>>       run number: %d \n", runNumber);
  printf(">>>>> number of events: %d \n", neventsConfig);
  printf(">>>>>   magnetic field: %s \n", MagnetName[magnetConfig]);
  printf(">>>>>         detector: %s \n", DetectorName[detectorConfig]);
  printf(">>>>>     MC generator: %s \n", GeneratorName[generatorConfig]);
  printf(">>>>>       CMS energy: %f \n", energyConfig);
  printf(">>>>>          trigger: %s \n", TriggerName[triggerConfig]);
  printf(">>>>>            b-min: %f \n", bminConfig);
  printf(">>>>>            b-max: %f \n", bmaxConfig);
  printf(">>>>>   crossing angle: %f \n", crossingConfig);
  printf(">>>>>      random seed: %d \n", seedConfig);
  printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");

  /* load libraries */
  LoadLibraries();

  /* setup geant */
  new TGeant3TGeo("C++ Interface to Geant3");

  /* create galice.root */
  CreateGAlice();

  /* configure detector */
  DetectorConfig(detectorConfig, runNumber);

  /* configure MC generator */
  GeneratorConfig(generatorConfig, runNumber);
  GeneratorOptions();
}
Esempio n. 11
0
void TaskBuzzer(UInt_t config, const char *collection="wn.xml") 
{
  printf("Running buzzer with: %s\n", ConfigName(config));
  TGrid::Connect("alien://");
  if (!gGrid || !gGrid->IsConnected()) {
    ::Error("PilotAnalysis", "No grid connection");
    return;
  }
  TChain *chain = CreateChain(collection, "ESD");
  // Load libraries
  gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD");
  LoadLibraries();
  // Create manager
  AliAnalysisManager *mgr  = new AliAnalysisManager("ESDfiltering", "Production train");
  mgr->SetNSysInfo(100);
  // Input handler
  AliESDInputHandlerRP *esdHandler = new AliESDInputHandlerRP();
//  AliESDInputHandler *esdHandler = new AliESDInputHandler();
  esdHandler->SetReadFriends(kTRUE);
  esdHandler->SetActiveBranches("ESDfriend");
  mgr->SetInputEventHandler(esdHandler);
  if (config & kAOD) {
     // AOD output handler
     AliAODHandler* aodHandler   = new AliAODHandler();
     aodHandler->SetOutputFileName("AliAOD.root");
     if (!mergeExcludes.IsNull()) mergeExcludes += " ";
     mergeExcludes += "AliAOD.root";
     mgr->SetOutputEventHandler(aodHandler);
  }   
  // AnalysisTasks
  AddAnalysisTasks(config);

  mgr->SetDebugLevel(1);
  if (mgr->InitAnalysis()) {                                                                                                              
    mgr->PrintStatus(); 
    mgr->StartAnalysis("local", chain);
  }  
} 
void AnalysisTrainLocalEmcalFjetSparseMaker()
{
  const TString sDataset = "/DATA04/xzhang/alice/lists/LHC11hPass2AOD145.txt";
//=============================================================================

  if (LoadLibraries()) {
    ::Error("AnalysisTrainLocalEmcalFjetSparseMaker.C::AnalysisTrainLocalEmcalFjetSparseMaker","Load libraries failed!");
    return;
  }

  TChain *chain = CreateChain(sDataset);
  if (!chain) {
    ::Error("AnalysisTrainLocalEmcalFjetSparseMaker.C::AnalysisTrainLocalEmcalFjetSparseMaker", "Creating input chain failed!");
    return;
  }
//=============================================================================

  AliAnalysisManager *mgr = new AliAnalysisManager("AnalysisTrainLocalEmcalFjetSparseMaker", "Analysis Train Local EMCal Bkg SM");
//mgr->SetDebugLevel(3);

  gROOT->LoadMacro("AddTasksEmcalFjetSparseMaker.C"); if (AddTasksEmcalFjetSparseMaker()) return;
  if (mgr->InitAnalysis()) { mgr->PrintStatus(); mgr->StartAnalysis("local",chain); }
  return;
}
Esempio n. 13
0
        //void deroulement_du_jeu()	
        int main(int argc, char *argv[] )
        {
            
            // if( !InitGUI() ){ return 0; }
            
            if( !CheckCommand(argc,argv) ){ return 0; }
            
            if( !InitLogFile() ){ printf("Fail init logFile\n"); }
            
            PrintHeaderMatch();
            
            //Il faut nbMaxCps pour chaques joueurs, donc on multiplie par 2
            nbMaxCps *= 2;
            
            if( !PrintLibInitHeader() ){ printf("Fail print libHeader\n"); }
            if( !LoadLibraries() ){ return(0); }
            PrintTLine();
            
            SGameState* gameState = CreateBoard();
            
            //Srand pour obtenir des nombres aléatoires 
            srand(time(NULL));

            //Initialisation des joueurs    
            j1InitLibrary(j1Name);   
            j2InitLibrary(j2Name);

            if( strlen(pathIA1) && !strlen(pathIA2) ){ PrintPhysicalPlayers(NULL,j2Name); }
            else if( !strlen(pathIA1) && strlen(pathIA2) ){ PrintPhysicalPlayers(j1Name,NULL); }
            else if( !strlen(pathIA1) && !strlen(pathIA2) ){ PrintPhysicalPlayers(j1Name,j2Name); }
            else { PrintPhysicalPlayers(NULL,NULL); }
            
            PrintIAPlayers(pathIA1,pathIA2);
            PrintMaxCps(nbMaxCps/2);
            
            j1StartMatch();
            j2StartMatch();

            int nbMatch = 3;
            int j1Win = 0;
            int j2Win = 0;

            while( nbMatch>0 && j1Win<2 && j2Win<2){

                PrintMatch(4-nbMatch);
                
                //   InitBoard
                
                //On initialise le nombre de coups maximums
                 int cptCps = nbMaxCps;
                 j1NbPenalty = 0;
                 j2NbPenalty = 0;
                 
                 InitGameState(gameState);
                 
                EPiece j1BoardInit[4][10];
                EPiece j2BoardInit[4][10];

                SetPlayerColors();
                
                j1StartGame(j1Color,j1BoardInit);
                j2StartGame(j2Color,j2BoardInit);

                if( j1Color == ECblue ){ PrintColors(j2Name, j1Name); }
                else{ PrintColors(j1Name, j2Name); }
                
                //Initialisation des pions sur le plateau
                if( j1Color == ECblue ){
                    if( !InitBlueBoard(gameState,j1BoardInit) ){PrintBoardInitError(ECblue);return 0;}           
                    if( !InitRedBoard(gameState,j2BoardInit) ){PrintBoardInitError(ECred);return 0;}
                }
                else{
                    if( !InitRedBoard(gameState,j1BoardInit) ){PrintBoardInitError(ECred);return 0;}
                    if( !InitBlueBoard(gameState,j2BoardInit) ){PrintBoardInitError(ECblue);return 0;}
                }

                //Le premier joueur est le rouge
                EColor player = ECred;

                EColor winner = 0;
                
                PrintLine();
                PrintGameState(gameState);
                
                while( !winner && cptCps>0 ){

                    SMove move;
                    
                    //Duplication du plateau
                    SGameState *gameStateCpy = (SGameState*) malloc(sizeof(SGameState));
                    GameStateCpy(gameState,gameStateCpy);
                    
                    //Si c'est le tour du joueur rouge, on inverse son plateau 
                    if( player == ECred ){
                        RevertGame(gameStateCpy);
                    }

                    //On cache les pions du joueur ennemi
                    HideColor(gameStateCpy,abs((player+1)%2)+2);
                    
                    if( player == j1Color ){ move = j1NextMove(gameStateCpy); }
                    else{ move = j2NextMove(gameStateCpy); }
                    
                    if( player == ECred ){
                        move.start.line = 9-move.start.line;
                        move.end.line = 9-move.end.line;
                    }
                    
                    int moveType = CorrectMove(gameState,move,player);

                    PrintMove(player,move);
                    
                    //Mouvement incorrecte
                    if( moveType == 0 ){
                        if( player == j1Color ){
                            j1NbPenalty++;
                            j1Penalty();
                            PrintInvalidMove(player,j1NbPenalty);
                            if( j1NbPenalty == 3 ){
                                PrintPenalty(j1Name,j1Color);
                                winner = abs((j1Color+1)%2)+2;
                                break;
                            }
                        }
                        else{ 
                            j2NbPenalty++;
                            j2Penalty(); 
                            PrintInvalidMove(player,j2NbPenalty);
                            if( j2NbPenalty == 3 ){
                                PrintPenalty(j2Name,j2Color);
                                winner = abs((j2Color+1)%2)+2;
                                break;
                            }
                        }
                    }
                    else{
                        //Attaque
                        if( moveType == 1 ){
                            EPiece army = gameState->board[move.start.line][move.start.col].piece;
                            EPiece enemy = gameState->board[move.end.line][move.end.col].piece;
                            if( player == j1Color ){
                                j1AttackResult(move.start,army,move.end,enemy);
                                j2AttackResult(move.end,enemy,move.start,army);
                            }
                            else{
                                j1AttackResult(move.end,enemy,move.start,army);
                                j2AttackResult(move.start,army,move.end,enemy);
                            }
                            
                            PrintAttackResult(player,move.start,army,move.end,enemy);
                        }
                        
                        ExecuteMove(gameState,move,player);
                    }
                    PrintGameState(gameState);

                    free(gameStateCpy);

                    if( player == ECred ){ player = ECblue; }
                    else{ player = ECred; }

                    winner = Finished(gameState);
                    cptCps--;
                }
                
                if( cptCps == 0){ PrintMaxMoveReached(); }
                else{ 
                    if( j1Color == winner ){ PrintMatchWinner(j1Name, winner, 4-nbMatch);j1Win++; }
                    else{ PrintMatchWinner(j2Name, winner, 4-nbMatch);j2Win++; }
                }
                nbMatch--;
                
                j1EndGame();
                j2EndGame();
                
                printf("j1Win : %d\nj2Win : %d\n",j1Win,j2Win);
            }
            if( j1Win >= 2 ){ PrintGameWinner(j1Name, j1Color); }
            else{ PrintGameWinner(j2Name, j2Color); }
            
            j1EndMatch();
            j2EndMatch();

            free(gameState);
            return(0);
        }
void runFlowTaskCentralityKinkTrain( Int_t mode = mLocal,
                                     Bool_t useFlowParFiles = kFALSE,
                                     Bool_t DATA = kTRUE,
                                     const Char_t* dataDir="fileList",
                                     Int_t nEvents = 1e4,
                                     Int_t offset=0 )
{
  // Time:
  TStopwatch timer;
  timer.Start();

  // Load needed libraries:
  LoadLibraries(mode,useFlowParFiles);

  // Create analysis manager:
  AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager");

  // Chains:
  if(mode == mLocal)
  {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGUD/macros/CreateESDChain.C");
    TChain* chain = CreateESDChain(dataDir, nEvents, offset);
    //TChain* chain = CreateAODChain(dataDir, nEvents, offset);
  }

  // Connect plug-in to the analysis manager:
  if(mode == mGrid)
  {
    gROOT->LoadMacro("CreateAlienHandler.C");
    AliAnalysisGrid *alienHandler = CreateAlienHandler(useFlowParFiles);
    if(!alienHandler) return;
    mgr->SetGridHandler(alienHandler);
  }

  // Event handlers:
  AliVEventHandler* esdH = new AliESDInputHandler;
  mgr->SetInputEventHandler(esdH);
  if (!DATA)
  {
    AliMCEventHandler *mc = new AliMCEventHandler();
    mgr->SetMCtruthEventHandler(mc);
  }

  // Task to check the offline trigger:
  gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
  AddTaskPhysicsSelection(!DATA);

  //Add the centrality determination task
  gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
  AliCentralitySelectionTask* centSelTask = AddTaskCentrality();
  if (!DATA) centSelTask->SetMCInput();

  //add the PID response task
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
  AliAnalysisTaskPIDResponse* pidresponsetask = AddTaskPIDResponse(!DATA);

  //Add the TOF tender
  //gROOT->LoadMacro("$ALICE_PHYSICS/PWGCF/FLOW/macros/AddTaskTenderTOF.C");
  //AddTaskTenderTOF();

  // Setup kink analysis per centrality bin:
  gROOT->LoadMacro("$ALICE_PHYSICS/PWGCF/FLOW/macros/Kinks/AddTaskFlowCentralityKink.C");
  for (Int_t i=binfirst; i<binlast+1; i++)
  {
    Float_t lowCentralityBinEdge = centralityArray[i];
    Float_t highCentralityBinEdge = centralityArray[i+1];
    AddTaskFlowCentralityKink( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kUnknown,
                              AliFlowTrackCuts::kTOFbeta,
                              -1,2,kTRUE );
    AddTaskFlowCentralityKink( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kUnknown,
                              AliFlowTrackCuts::kTOFbeta,
                              1,2,kTRUE );
    AddTaskFlowCentralityKink( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kUnknown,
                              AliFlowTrackCuts::kTOFbeta,
                              -1,3 );
    AddTaskFlowCentralityKink( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kUnknown,
                              AliFlowTrackCuts::kTOFbeta,
                              1,3 );
  } // end of for (Int_t i=0; i<numberOfCentralityBins; i++)

  // Setup kaon analysis per centrality bin:
  gROOT->LoadMacro("$ALICE_PHYSICS/PWGCF/FLOW/macros/Kinks/AddTaskFlowCentralityPID.C");
  for (Int_t i=binfirst; i<binlast+1; i++)
  {
    Float_t lowCentralityBinEdge = centralityArray[i];
    Float_t highCentralityBinEdge = centralityArray[i+1];
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kKaon,
                              AliFlowTrackCuts::kTOFbeta,
                              -1,2,kTRUE );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kKaon,
                              AliFlowTrackCuts::kTOFbeta,
                              1,2,kTRUE );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kKaon,
                              AliFlowTrackCuts::kTOFbeta,
                              -1,3 );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kKaon,
                              AliFlowTrackCuts::kTOFbeta,
                              1,3 );
  } // end of for (Int_t i=0; i<numberOfCentralityBins; i++)

  // Setup He3 analysis per centrality bin:
  gROOT->LoadMacro("$ALICE_PHYSICS/PWGCF/FLOW/macros/Kinks/AddTaskFlowCentralityPID.C");
  for (Int_t i=binfirst; i<binlast+1; i++)
  {
    Float_t lowCentralityBinEdge = centralityArray[i];
    Float_t highCentralityBinEdge = centralityArray[i+1];
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kHe3,
                              AliFlowTrackCuts::kTPCNuclei,
                              -1,2,kTRUE );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kHe3,
                              AliFlowTrackCuts::kTPCNuclei,
                              1,2,kTRUE );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kHe3,
                              AliFlowTrackCuts::kTPCNuclei,
                              -1,3 );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kHe3,
                              AliFlowTrackCuts::kTPCNuclei,
                              1,3 );
  } // end of for (Int_t i=0; i<numberOfCentralityBins; i++)

  // Enable debug printouts:
  mgr->SetDebugLevel(2);
  // Run the analysis:
  if(!mgr->InitAnalysis()) return;
  mgr->PrintStatus();
  if(mode == mLocal)
  {
    mgr->StartAnalysis("local",chain);
  }
  else if(mode == mPROOF)
  {
    mgr->StartAnalysis("proof",dataDir,nEvents,offset);
  }
  else if(mode == mGrid)
  {
    mgr->StartAnalysis("grid");
  }

  // Print real and CPU time used for analysis:
  timer.Stop();
  timer.Print();

} // end of void runFlowTaskCentralityPIDTrain(...)
Esempio n. 15
0
void runSSTCqg(TString mode = "cluster",TString identifier = "qgHists3", TString dataset = "qgRun5.PythJ1-J3.jet17custom.event", TString username = "******", bool mcweights = true, bool sys = true, bool doHists = true) 
{
	//options for mode are local, lite, or cluster
      
  if(dataset.Contains("event")) doHists = true; //override: if running on derived dataset, just do the damn analysis  
 
	LoadLibraries();
    
	//General user run options (now set in run command)
	//TString identifier("myTest"); //unique identifier for this job
	//TString dataset("test.example"); //dataset name
	//TString username("bcbutler"); //username for cluster, not important otherwise

	//SetConfig
	TString configfile("../config/sstcqg.config");

	
	// Best to leave alone	
	TString pathLite("");
	
	TString pathCluster("root://atlprf01.slac.stanford.edu//atlas/local/");
	pathCluster.Append(username);
	pathCluster.Append("/");

	//Determine eventbuilder from dataset name
	TString eventbuilder(dataset);
	eventbuilder.Remove(0,eventbuilder.Last('.')+1);
  if(!dataset.Contains("event")) eventbuilder+="qg";
  //if(dataset.Contains("event")) eventbuilder = "event";
	// Change if defaulting to wrong TTree, otherwise leave
	TString treename("qcd");
	if(dataset.Contains("event")) treename = "jet17customqg";
	

	//Filename paths, URLs for PROOF running
	TString url(mode);
	TString path("");
	if(mode.CompareTo("lite")==0) {
		url = "lite://";
		path = pathLite;
	}
	else if(mode.CompareTo("cluster")==0) {
		url = TString(username+"@atlprf01.slac.stanford.edu");
		path = pathCluster;
	}
	
	//Make an options file, edit as needed
	TFile* options = new TFile("options.root","RECREATE");
	

	Config* conf2 = new Config("sstcqg",configfile);
	if(doHists) conf2->Set("ANALYSIS","sstcqg");
  else conf2->Set("ANALYSIS","writeevent");
	conf2->Set("MCWEIGHTS",mcweights);
	conf2->Set("DEBUG",false);

	conf2->Write();
	//if(conf2->Exists("GRL")) WriteGRLObject(conf2->String("GRL"),conf2->GetName());	


	//ProofAna global Config object
	Config* confProofAna = new Config("ProofAna");
	confProofAna->Set("DEBUG",false); 	// "false", 0, "0" etc. also works
	if(!doHists) confProofAna->Set("MERGE",false);	// enable dataset mode
	confProofAna->Set("SAVETIMERS",false); //ProofAna timer histograms in output file
	confProofAna->Set("IDENTIFIER",identifier);
	confProofAna->Set("DATASET",dataset);
	confProofAna->Set("OUTPUTPATH",path);
	confProofAna->Set("EVENTBUILDER",eventbuilder);
	//confProofAna->Set("EVENTBUILDER","/default/swiatlow/qgStudies_MC_NoP.eventbuilder");
	ReadDatasetInfo(dataset,confProofAna); //Reads information used in MC weighting, multi-dataset jobs
	confProofAna->Write();	
	options->Close();
	delete options;
	
	if(mode.CompareTo("local")==0) runLocal(dataset,treename);
	else runProof(url,dataset,-1,treename);
	
	gSystem->Unlink("options.root");
}
Esempio n. 16
0
void runSusyBkg(TString mode = "cluster", TString identifier = "myTest", TString dataset = "su4.susy1118", TString username = "******", bool mcweights = true, bool sys = true) 
{
	//options for mode are local, lite, cluster, or grid

	LoadLibraries();
    
	//General user run options (now set in run command)
	//TString identifier("myTest"); //unique identifier for this job
	//TString dataset("test.example"); //dataset name
	//TString username("bcbutler"); //username for cluster, not important otherwise

	//SetConfig
	TString configfile("../config/periodsB-M.config");

	// Best to leave alone	
	TString pathLite("");
	
	TString pathCluster("root://atlprf01.slac.stanford.edu:2094//atlas/output/");
	pathCluster.Append(username);
	pathCluster.Append("/");

	//Determine eventbuilder from dataset name
	TString eventbuilder(dataset);
	eventbuilder.Remove(0,eventbuilder.Last('.')+1);

	//Filename paths, URLs for PROOF running
	TString url(mode);
	TString path("");
	if(mode.CompareTo("lite")==0) {
		url = "lite://"; //ROOT 5.32
		path = pathLite;
	}
	else if(mode.CompareTo("cluster")==0) {
		url = TString(username+"@atlprf01.slac.stanford.edu");
		path = pathCluster;
	}
	
	//Make an options file, edit as needed
	TFile* options = new TFile("options.root","RECREATE");
	
	//Analyses Configs, change as needed
	bool do0Lepton = true;
	bool do4Jet = false;
	bool do6Jet = false;
	bool doSR1 = true;
	bool doSR2 = true;
	bool doSR3 = true;
	bool do1Electron = true;
	bool do2Electron = true;
	bool do1Muon = true;
	bool do2Muon = true;
	bool doFakeNu = false; //convert Zmumubb to Znunubb
	bool doKillZnunuZbb = false;
	bool doDetail = true;
	bool doLocHad = false;
	bool doPRW = true;
	bool doHFT = true;
	bool doWriteTrees = eventbuilder.CompareTo("event") ? true : false;
	bool noBtagSFs = true;
	bool fancyBtagErr = false;
	bool truthEB = false;
	bool isData = false;
	
	if(dataset.Contains("Egamma_")) {
		do0Lepton = false;
		do1Muon = false;
		do2Muon = false;
		isData = true;
	}
	else if(dataset.Contains("Muons_")) {
		do0Lepton = false;
		do1Electron = false;
		do2Electron = false;
		isData = true;
	}
	else if(dataset.Contains("JetTauEtmiss_")) {
		do1Electron = false;
		do2Electron = false;
		do1Muon = false;
		do2Muon = false;
		isData = true;
	}

	if(truthEB) {
		if(isData) {
			cout << "You are asking to run the truth-based event builder on data?" << endl;
			exit(1);
		}

		//append for truth-only studies, turn of systematics
		eventbuilder.Append("_truth");	
		sys = false;
	}
	
	Config* chain = new Config("chain",configfile); //eventbuilder/mcweights flags in chain config
	chain->AddVec("ANALYSIS");
	chain->Set("MCWEIGHTS",mcweights);
	chain->Set("BTAG",2*(!isData));
	chain->Set("NOBTAGSF",noBtagSFs);	
	chain->Set("FANCYBTAGERR",fancyBtagErr);
	chain->Set("PILE",doPRW);
	chain->Set("HFT",doHFT);
	chain->Set("0LEPTON",do0Lepton);
	chain->Set("1ELECTRON",do1Electron);
	chain->Set("1MUON",do1Muon);
	chain->Set("2ELECTRON",do2Electron);
	chain->Set("2MUON",do2Muon);
	chain->Set("FAKENU",doFakeNu);
	chain->Set("KILLZNUNUZBB",doKillZnunuZbb);	
	chain->Set("LOCHAD",doLocHad);
	//chain->Set("DEBUG",true);

	Config* nom = new Config("nom");
	nom->Set("ANALYSIS","susybkg");
	nom->Set("BTAG",1*(!isData));
	nom->Set("0LEPTON",do0Lepton);
	nom->Set("4JET",do4Jet);
	nom->Set("6JET",do6Jet);
	nom->Set("SR1",doSR1);
	nom->Set("SR2",doSR2);
	nom->Set("SR3",doSR3);
	nom->Set("1ELECTRON",do1Electron);
	nom->Set("1MUON",do1Muon);	
	nom->Set("2ELECTRON",do2Electron);
	nom->Set("2MUON",do2Muon);	
	nom->Set("DETAIL",doDetail);
	nom->Set("WRITETREES",doWriteTrees);
	//nom->Set("DEBUG",true);
	chain->Add("ANALYSIS",nom);
	
	if(dataset.Contains("JetTauEtmiss_")||dataset.Contains("ttslLAr")) {
		Config* larreversed = new Config("larreversed",configfile);
		larreversed->Set("ANALYSIS","susybkg");
		larreversed->Set("MCWEIGHTS",mcweights);
		larreversed->Set("BTAG",0);
		larreversed->Set("PILE",doPRW);
		larreversed->Set("HFT",doHFT);
		larreversed->Set("0LEPTON",do0Lepton);
		larreversed->Set("4JET",do4Jet);
		larreversed->Set("6JET",do6Jet);
		larreversed->Set("SR1",doSR1);
		larreversed->Set("SR2",doSR2);
		larreversed->Set("SR3",doSR3);
		larreversed->Set("1ELECTRON",false);
		larreversed->Set("1MUON",false);
		larreversed->Set("2ELECTRON",false);
		larreversed->Set("2MUON",false);
		larreversed->Set("FAKENU",doFakeNu);
		larreversed->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		larreversed->Set("DETAIL",doDetail);
		larreversed->Set("LOCHAD",doLocHad);
		larreversed->Set("LARVETOREVERSED",true);
		larreversed->Set("WRITETREES",doWriteTrees);
		//larreversed->Set("DEBUG",true);
		larreversed->Write();	
	}
	
	if(dataset.Contains("Egamma_")||dataset.Contains("Muons_")) {
	
		Config* mmnom = new Config("mmnom");
		mmnom->Set("ANALYSIS","susybkg");
		mmnom->Set("BTAG",0);
		mmnom->Set("0LEPTON",false);
		mmnom->Set("4JET",false);
		mmnom->Set("6JET",false);
		mmnom->Set("SR1",doSR1);
		mmnom->Set("SR2",doSR2);
		mmnom->Set("SR3",doSR3);
		mmnom->Set("1ELECTRON",do1Electron);
		mmnom->Set("1MUON",do1Muon);	
		mmnom->Set("2ELECTRON",false);
		mmnom->Set("2MUON",false);	
		mmnom->Set("DETAIL",doDetail);
		mmnom->Set("MM",1);		
		mmnom->Set("WRITETREES",doWriteTrees);
		//mmnom->Set("DEBUG",true);
		chain->Add("ANALYSIS",mmnom);
		
		Config* mmsys = new Config("mmsys");
		mmsys->Set("ANALYSIS","susybkg");
		mmsys->Set("BTAG",0);
		mmsys->Set("0LEPTON",false);
		mmsys->Set("4JET",false);
		mmsys->Set("6JET",false);
		mmsys->Set("SR1",doSR1);
		mmsys->Set("SR2",doSR2);
		mmsys->Set("SR3",doSR3);
		mmsys->Set("1ELECTRON",do1Electron);
		mmsys->Set("1MUON",do1Muon);	
		mmsys->Set("2ELECTRON",false);
		mmsys->Set("2MUON",false);	
		mmsys->Set("DETAIL",doDetail);
		mmsys->Set("MM",2);		
		mmsys->Set("WRITETREES",doWriteTrees);
		//mmsys->Set("DEBUG",true);
		chain->Add("ANALYSIS",mmsys);
		
		Config* mmstat = new Config("mmstat");
		mmstat->Set("ANALYSIS","susybkg");
		mmstat->Set("BTAG",0);
		mmstat->Set("0LEPTON",false);
		mmstat->Set("4JET",false);
		mmstat->Set("6JET",false);
		mmstat->Set("SR1",doSR1);
		mmstat->Set("SR2",doSR2);
		mmstat->Set("SR3",doSR3);
		mmstat->Set("1ELECTRON",do1Electron);
		mmstat->Set("1MUON",do1Muon);	
		mmstat->Set("2ELECTRON",false);
		mmstat->Set("2MUON",false);	
		mmstat->Set("DETAIL",doDetail);
		mmstat->Set("MM",3);		
		mmstat->Set("WRITETREES",doWriteTrees);
		//mmstat->Set("DEBUG",true);
		chain->Add("ANALYSIS",mmstat);
	}

	if((!isData)&&(!dataset.Contains("ttslLAr"))&&sys) {	

		Config* bup = new Config("bup");
		bup->Set("ANALYSIS","susybkg");
		bup->Set("BTAG",2);
		bup->Set("0LEPTON",do0Lepton);
		bup->Set("4JET",do4Jet);
		bup->Set("6JET",do6Jet);
		bup->Set("SR1",doSR1);
		bup->Set("SR2",doSR2);
		bup->Set("SR3",doSR3);
		bup->Set("1ELECTRON",do1Electron);
		bup->Set("1MUON",do1Muon);
		bup->Set("2ELECTRON",do2Electron);
		bup->Set("2MUON",do2Muon);
		bup->Set("WRITETREES",doWriteTrees);
		//bup->Set("DEBUG",true);
		chain->Add("ANALYSIS",bup);

		Config* bdown = new Config("bdown");
		bdown->Set("ANALYSIS","susybkg");
		bdown->Set("BTAG",3);
		bdown->Set("0LEPTON",do0Lepton);
		bdown->Set("4JET",do4Jet);
		bdown->Set("6JET",do6Jet);
		bdown->Set("SR1",doSR1);
		bdown->Set("SR2",doSR2);
		bdown->Set("SR3",doSR3);
		bdown->Set("1ELECTRON",do1Electron);
		bdown->Set("1MUON",do1Muon);
		bdown->Set("2ELECTRON",do2Electron);
		bdown->Set("2MUON",do2Muon);
		bdown->Set("WRITETREES",doWriteTrees);
		//bdown->Set("DEBUG",true);
		chain->Add("ANALYSIS",bdown);
		
		Config* cup = new Config("cup");
		cup->Set("ANALYSIS","susybkg");
		cup->Set("BTAG",4);
		cup->Set("0LEPTON",do0Lepton);
		cup->Set("4JET",do4Jet);
		cup->Set("6JET",do6Jet);
		cup->Set("SR1",doSR1);
		cup->Set("SR2",doSR2);
		cup->Set("SR3",doSR3);
		cup->Set("1ELECTRON",do1Electron);
		cup->Set("1MUON",do1Muon);
		cup->Set("2ELECTRON",do2Electron);
		cup->Set("2MUON",do2Muon);
		cup->Set("WRITETREES",doWriteTrees);
		//cup->Set("DEBUG",true);
		chain->Add("ANALYSIS",cup);

		Config* cdown = new Config("cdown");
		cdown->Set("ANALYSIS","susybkg");
		cdown->Set("BTAG",5);
		cdown->Set("0LEPTON",do0Lepton);
		cdown->Set("4JET",do4Jet);
		cdown->Set("6JET",do6Jet);
		cdown->Set("SR1",doSR1);
		cdown->Set("SR2",doSR2);
		cdown->Set("SR3",doSR3);
		cdown->Set("1ELECTRON",do1Electron);
		cdown->Set("1MUON",do1Muon);
		cdown->Set("2ELECTRON",do2Electron);
		cdown->Set("2MUON",do2Muon);
		cdown->Set("WRITETREES",doWriteTrees);
		//cdown->Set("DEBUG",true);
		chain->Add("ANALYSIS",cdown);
		
		Config* lup = new Config("lup");
		lup->Set("ANALYSIS","susybkg");
		lup->Set("BTAG",6);
		lup->Set("0LEPTON",do0Lepton);
		lup->Set("4JET",do4Jet);
		lup->Set("6JET",do6Jet);
		lup->Set("SR1",doSR1);
		lup->Set("SR2",doSR2);
		lup->Set("SR3",doSR3);
		lup->Set("1ELECTRON",do1Electron);
		lup->Set("1MUON",do1Muon);
		lup->Set("2ELECTRON",do2Electron);
		lup->Set("2MUON",do2Muon);
		lup->Set("WRITETREES",doWriteTrees);
		//lup->Set("DEBUG",true);
		chain->Add("ANALYSIS",lup);

		Config* ldown = new Config("ldown");
		ldown->Set("ANALYSIS","susybkg");
		ldown->Set("BTAG",7);
		ldown->Set("0LEPTON",do0Lepton);
		ldown->Set("4JET",do4Jet);
		ldown->Set("6JET",do6Jet);
		ldown->Set("SR1",doSR1);
		ldown->Set("SR2",doSR2);
		ldown->Set("SR3",doSR3);
		ldown->Set("1ELECTRON",do1Electron);
		ldown->Set("1MUON",do1Muon);
		ldown->Set("2ELECTRON",do2Electron);
		ldown->Set("2MUON",do2Muon);
		ldown->Set("WRITETREES",doWriteTrees);
		//ldown->Set("DEBUG",true);
		chain->Add("ANALYSIS",ldown);
		
		if(fancyBtagErr) {
			for(int i = 0; i<4; ++i) {
				for(int j = 0; j<1; ++j) {
					Config* bstat_up = new Config(TString::Format("bup_%i_%i",i+1,j+1));
					bstat_up->Set("ANALYSIS","susybkg");
					bstat_up->Set("BTAG",8);
					bstat_up->Set("BTAGFLAVOR",0);
					bstat_up->Set("BTAGDIR",0);	
					bstat_up->Set("BTAGPTBIN",i+1);
					bstat_up->Set("BTAGETABIN",j+1);
					bstat_up->Set("0LEPTON",do0Lepton);
					bstat_up->Set("4JET",do4Jet);
					bstat_up->Set("6JET",do6Jet);
					bstat_up->Set("SR1",doSR1);
					bstat_up->Set("SR2",doSR2);
					bstat_up->Set("SR3",doSR3);
					bstat_up->Set("1ELECTRON",do1Electron);
					bstat_up->Set("1MUON",do1Muon);
					bstat_up->Set("2ELECTRON",do2Electron);
					bstat_up->Set("2MUON",do2Muon);
					bstat_up->Set("WRITETREES",doWriteTrees);
					//bstat_up->Set("DEBUG",true);
					chain->Add("ANALYSIS",bstat_up);
					
					Config* bstat_down = new Config(TString::Format("bdown_%i_%i",i+1,j+1));
					bstat_down->Set("ANALYSIS","susybkg");
					bstat_down->Set("BTAG",8);
					bstat_down->Set("BTAGFLAVOR",0);
					bstat_down->Set("BTAGDIR",1);	
					bstat_down->Set("BTAGPTBIN",i+1);
					bstat_down->Set("BTAGETABIN",j+1);
					bstat_down->Set("0LEPTON",do0Lepton);
					bstat_down->Set("4JET",do4Jet);
					bstat_down->Set("6JET",do6Jet);
					bstat_down->Set("SR1",doSR1);
					bstat_down->Set("SR2",doSR2);
					bstat_down->Set("SR3",doSR3);
					bstat_down->Set("1ELECTRON",do1Electron);
					bstat_down->Set("1MUON",do1Muon);
					bstat_down->Set("2ELECTRON",do2Electron);
					bstat_down->Set("2MUON",do2Muon);
					bstat_down->Set("WRITETREES",doWriteTrees);
					//bstat_down->Set("DEBUG",true);
					chain->Add("ANALYSIS",bstat_down);
				}
			}
	
			for(int i = 0; i<1; ++i) {
				for(int j = 0; j<1; ++j) {
					Config* cstat_up = new Config(TString::Format("cup_%i_%i",i+1,j+1));
					cstat_up->Set("ANALYSIS","susybkg");
					cstat_up->Set("BTAG",8);
					cstat_up->Set("BTAGFLAVOR",1);
					cstat_up->Set("BTAGDIR",0);	
					cstat_up->Set("BTAGPTBIN",i+1);
					cstat_up->Set("BTAGETABIN",j+1);
					cstat_up->Set("0LEPTON",do0Lepton);
					cstat_up->Set("4JET",do4Jet);
					cstat_up->Set("6JET",do6Jet);
					cstat_up->Set("SR1",doSR1);
					cstat_up->Set("SR2",doSR2);
					cstat_up->Set("SR3",doSR3);
					cstat_up->Set("1ELECTRON",do1Electron);
					cstat_up->Set("1MUON",do1Muon);
					cstat_up->Set("2ELECTRON",do2Electron);
					cstat_up->Set("2MUON",do2Muon);
					cstat_up->Set("WRITETREES",doWriteTrees);
					//cstat_up->Set("DEBUG",true);
					chain->Add("ANALYSIS",cstat_up);
					
					Config* cstat_down = new Config(TString::Format("cdown_%i_%i",i+1,j+1));
					cstat_down->Set("ANALYSIS","susybkg");
					cstat_down->Set("BTAG",8);
					cstat_down->Set("BTAGFLAVOR",1);
					cstat_down->Set("BTAGDIR",1);	
					cstat_down->Set("BTAGPTBIN",i+1);
					cstat_down->Set("BTAGETABIN",j+1);
					cstat_down->Set("0LEPTON",do0Lepton);
					cstat_down->Set("4JET",do4Jet);
					cstat_down->Set("6JET",do6Jet);
					cstat_down->Set("SR1",doSR1);
					cstat_down->Set("SR2",doSR2);
					cstat_down->Set("SR3",doSR3);
					cstat_down->Set("1ELECTRON",do1Electron);
					cstat_down->Set("1MUON",do1Muon);
					cstat_down->Set("2ELECTRON",do2Electron);
					cstat_down->Set("2MUON",do2Muon);
					cstat_down->Set("WRITETREES",doWriteTrees);
					//cstat_down->Set("DEBUG",true);
					chain->Add("ANALYSIS",cstat_down);
				}
			}
			
			for(int i = 0; i<1; ++i) {
				for(int j = 0; j<1; ++j) {
					Config* lstat_up = new Config(TString::Format("lup_%i_%i",i+1,j+1));
					lstat_up->Set("ANALYSIS","susybkg");
					lstat_up->Set("BTAG",8);
					lstat_up->Set("BTAGFLAVOR",2);
					lstat_up->Set("BTAGDIR",0);	
					lstat_up->Set("BTAGPTBIN",i+1);
					lstat_up->Set("BTAGETABIN",j+1);
					lstat_up->Set("0LEPTON",do0Lepton);
					lstat_up->Set("4JET",do4Jet);
					lstat_up->Set("6JET",do6Jet);
					lstat_up->Set("SR1",doSR1);
					lstat_up->Set("SR2",doSR2);
					lstat_up->Set("SR3",doSR3);
					lstat_up->Set("1ELECTRON",do1Electron);
					lstat_up->Set("1MUON",do1Muon);
					lstat_up->Set("2ELECTRON",do2Electron);
					lstat_up->Set("2MUON",do2Muon);
					lstat_up->Set("WRITETREES",doWriteTrees);
					//lstat_up->Set("DEBUG",true);
					chain->Add("ANALYSIS",lstat_up);
					
					Config* lstat_down = new Config(TString::Format("ldown_%i_%i",i+1,j+1));
					lstat_down->Set("ANALYSIS","susybkg");
					lstat_down->Set("BTAG",8);
					lstat_down->Set("BTAGFLAVOR",2);
					lstat_down->Set("BTAGDIR",1);				
					lstat_down->Set("BTAGPTBIN",i+1);
					lstat_down->Set("BTAGETABIN",j+1);
					lstat_down->Set("0LEPTON",do0Lepton);
					lstat_down->Set("4JET",do4Jet);
					lstat_down->Set("6JET",do6Jet);
					lstat_down->Set("SR1",doSR1);
					lstat_down->Set("SR2",doSR2);
					lstat_down->Set("SR3",doSR3);
					lstat_down->Set("1ELECTRON",do1Electron);
					lstat_down->Set("1MUON",do1Muon);
					lstat_down->Set("2ELECTRON",do2Electron);
					lstat_down->Set("2MUON",do2Muon);
					lstat_down->Set("WRITETREES",doWriteTrees);
					//lstat_down->Set("DEBUG",true);
					chain->Add("ANALYSIS",lstat_down);
				}
			}
		}

		Config* jesup = new Config("jesup",configfile);
		jesup->Set("ANALYSIS","susybkg");
		jesup->Set("MCWEIGHTS",mcweights);
		jesup->Set("JETSYS",1);
		jesup->Set("BTAG",1);
		jesup->Set("NOBTAGSF",noBtagSFs);
		jesup->Set("PILE",doPRW);
		jesup->Set("HFT",doHFT);
		jesup->Set("0LEPTON",do0Lepton);
		jesup->Set("4JET",do4Jet);
		jesup->Set("6JET",do6Jet);
		jesup->Set("SR1",doSR1);
		jesup->Set("SR2",doSR2);
		jesup->Set("SR3",doSR3);
		jesup->Set("1ELECTRON",do1Electron);
		jesup->Set("1MUON",do1Muon);
		jesup->Set("2ELECTRON",do2Electron);
		jesup->Set("2MUON",do2Muon);
		jesup->Set("FAKENU",doFakeNu);
		jesup->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		jesup->Set("WRITETREES",doWriteTrees);
		jesup->Write();
	
		Config* jesdown = new Config("jesdown",configfile);
		jesdown->Set("ANALYSIS","susybkg");
		jesdown->Set("MCWEIGHTS",mcweights);
		jesdown->Set("JETSYS",2);
		jesdown->Set("BTAG",1);
		jesdown->Set("NOBTAGSF",noBtagSFs);
		jesdown->Set("PILE",doPRW);
		jesdown->Set("HFT",doHFT);
		jesdown->Set("0LEPTON",do0Lepton);
		jesdown->Set("4JET",do4Jet);
		jesdown->Set("6JET",do6Jet);
		jesdown->Set("SR1",doSR1);
		jesdown->Set("SR2",doSR2);
		jesdown->Set("SR3",doSR3);
		jesdown->Set("1ELECTRON",do1Electron);
		jesdown->Set("1MUON",do1Muon);
		jesdown->Set("2ELECTRON",do2Electron);
		jesdown->Set("2MUON",do2Muon);
		jesdown->Set("FAKENU",doFakeNu);
		jesdown->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		jesdown->Set("WRITETREES",doWriteTrees);
		jesdown->Write();
		
		Config* jer = new Config("jer",configfile);
		jer->Set("ANALYSIS","susybkg");
		jer->Set("MCWEIGHTS",mcweights);
		jer->Set("JETSYS",3);
		jer->Set("BTAG",1);
		jer->Set("NOBTAGSF",noBtagSFs);
		jer->Set("PILE",doPRW);
		jer->Set("HFT",doHFT);
		jer->Set("0LEPTON",do0Lepton);
		jer->Set("4JET",do4Jet);
		jer->Set("6JET",do6Jet);
		jer->Set("SR1",doSR1);
		jer->Set("SR2",doSR2);
		jer->Set("SR3",doSR3);
		jer->Set("1ELECTRON",do1Electron);
		jer->Set("1MUON",do1Muon);
		jer->Set("2ELECTRON",do2Electron);
		jer->Set("2MUON",do2Muon);
		jer->Set("FAKENU",doFakeNu);
		jer->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		jer->Set("WRITETREES",doWriteTrees);
		jer->Write();

		Config* scalestup = new Config("scalestup",configfile);
		scalestup->Set("ANALYSIS","susybkg");
		scalestup->Set("MCWEIGHTS",mcweights);
		scalestup->Set("METSYS",1);
		scalestup->Set("BTAG",1);
		scalestup->Set("NOBTAGSF",noBtagSFs);
		scalestup->Set("PILE",doPRW);
		scalestup->Set("HFT",doHFT);
		scalestup->Set("0LEPTON",do0Lepton);
		scalestup->Set("4JET",do4Jet);
		scalestup->Set("6JET",do6Jet);
		scalestup->Set("SR1",doSR1);
		scalestup->Set("SR2",doSR2);
		scalestup->Set("SR3",doSR3);
		scalestup->Set("1ELECTRON",do1Electron);
		scalestup->Set("1MUON",do1Muon);
		scalestup->Set("2ELECTRON",do2Electron);
		scalestup->Set("2MUON",do2Muon);
		scalestup->Set("FAKENU",doFakeNu);
		scalestup->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		scalestup->Set("WRITETREES",doWriteTrees);
		scalestup->Write();
	
		Config* scalestdown = new Config("scalestdown",configfile);
		scalestdown->Set("ANALYSIS","susybkg");
		scalestdown->Set("MCWEIGHTS",mcweights);
		scalestdown->Set("METSYS",2);
		scalestdown->Set("BTAG",1);
		scalestdown->Set("NOBTAGSF",noBtagSFs);
		scalestdown->Set("PILE",doPRW);
		scalestdown->Set("HFT",doHFT);
		scalestdown->Set("0LEPTON",do0Lepton);
		scalestdown->Set("4JET",do4Jet);
		scalestdown->Set("6JET",do6Jet);
		scalestdown->Set("SR1",doSR1);
		scalestdown->Set("SR2",doSR2);
		scalestdown->Set("SR3",doSR3);
		scalestdown->Set("1ELECTRON",do1Electron);
		scalestdown->Set("1MUON",do1Muon);
		scalestdown->Set("2ELECTRON",do2Electron);
		scalestdown->Set("2MUON",do2Muon);
		scalestdown->Set("FAKENU",doFakeNu);
		scalestdown->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		scalestdown->Set("WRITETREES",doWriteTrees);
		scalestdown->Write();
		
		Config* resostup = new Config("resostup",configfile);
		resostup->Set("ANALYSIS","susybkg");
		resostup->Set("MCWEIGHTS",mcweights);
		resostup->Set("METSYS",3);
		resostup->Set("BTAG",1);
		resostup->Set("NOBTAGSF",noBtagSFs);
		resostup->Set("PILE",doPRW);
		resostup->Set("HFT",doHFT);
		resostup->Set("0LEPTON",do0Lepton);
		resostup->Set("4JET",do4Jet);
		resostup->Set("6JET",do6Jet);
		resostup->Set("SR1",doSR1);
		resostup->Set("SR2",doSR2);
		resostup->Set("SR3",doSR3);
		resostup->Set("1ELECTRON",do1Electron);
		resostup->Set("1MUON",do1Muon);
		resostup->Set("2ELECTRON",do2Electron);
		resostup->Set("2MUON",do2Muon);
		resostup->Set("FAKENU",doFakeNu);
		resostup->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		resostup->Set("WRITETREES",doWriteTrees);
		resostup->Write();
	
		Config* resostdown = new Config("resostdown",configfile);
		resostdown->Set("ANALYSIS","susybkg");
		resostdown->Set("MCWEIGHTS",mcweights);
		resostdown->Set("METSYS",4);
		resostdown->Set("BTAG",1);
		resostdown->Set("NOBTAGSF",noBtagSFs);
		resostdown->Set("PILE",doPRW);
		resostdown->Set("HFT",doHFT);
		resostdown->Set("0LEPTON",do0Lepton);
		resostdown->Set("4JET",do4Jet);
		resostdown->Set("6JET",do6Jet);
		resostdown->Set("SR1",doSR1);
		resostdown->Set("SR2",doSR2);
		resostdown->Set("SR3",doSR3);
		resostdown->Set("1ELECTRON",do1Electron);
		resostdown->Set("1MUON",do1Muon);
		resostdown->Set("2ELECTRON",do2Electron);
		resostdown->Set("2MUON",do2Muon);
		resostdown->Set("FAKENU",doFakeNu);
		resostdown->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		resostdown->Set("WRITETREES",doWriteTrees);
		resostdown->Write();
	}
	
	//Write chain (nominal analysis + b-tagging systematics/matrix method, identical eventbuilder result, just reweighted)
	chain->Write();	

	//ProofAna global Config object
	Config* confProofAna = new Config("ProofAna");
	//confProofAna->Set("DEBUG",true); 	// "false", 0, "0" etc. also works
	//confProofAna->Set("MERGE",false);	// enable dataset mode
	//confProofAna->Set("NFILES",1000000); 	// how many input files to merge per worker in dataset mode, very large number = 49 output files
	confProofAna->Set("SAVETIMERS",false); 	// ProofAna timer histograms in output file
	//confProofAna->Set("COUNTER",1);
	confProofAna->Set("IDENTIFIER",identifier);
	confProofAna->Set("DATASET",dataset);
	confProofAna->Set("OUTPUTPATH",path);
	confProofAna->Set("EVENTBUILDER",eventbuilder);

	ReadDatasetInfo(dataset,confProofAna); //Reads information used in MC weighting, multi-dataset jobs
	TString treename;
	if(!confProofAna->Get("TREENAME",treename)) {
		cout << "TREENAME not set in dataset config file, exiting" << endl;
		return;
	} 
	confProofAna->Write();	

	bool isAF2 = false;
	confProofAna->Get("AF2",isAF2);	
	WriteSUSYObjDefObject(options, isData, isAF2);
	
	WriteGRLObject(chain->String("GRL"));	
	WriteMuonTrigReweighterObjects(options);
	WriteMuonTriggerSFToolObject(options);
	//WriteMultijetJESUncertaintyObject(options);
	//WriteBTagCalibObject(options,"SV0","5_85");
	//WriteBTagCalibObject(options,"JetFitterCOMBNN","1_80");
	//WriteBTagCalibObject(options,"JetFitterCOMBNN","0_35");
	//WriteBTagCalibObject(options,"JetFitterCOMBNN","-1_25");
	WriteBTagCalibObject(options,"MV1","0_905363");
	WriteBTagCalibObject(options,"MV1","0_601713");
	WriteBTagCalibObject(options,"MV1","0_404219");
	//WriteJERObject(options);
	Write0LeptonPileupReweightingObject(options);
	Write1ElectronPileupReweightingObject(options);
	Write1MuonPileupReweightingObject(options);
	WriteFakeMetEstimator(options);
	WriteSmearingReweightHist(options);
	WriteElectronMMObject(options);
	
	options->Close();
	delete options;
	
	if(mode.CompareTo("local")==0) runLocal(dataset,treename);
  	else if(mode.CompareTo("grid")==0) {
    		TString prefix = "user."+username+"."+identifier;
		runGrid(prefix);
	}
	else runProof(url,dataset,-1,treename);
	
	gSystem->Unlink("options.root");
}
Esempio n. 17
0
void runSusyOpt(TString mode = "cluster", TString identifier = "myTest", TString dataset = "su4.susy1004", TString username = "******", bool mcweights = true, bool sys = true) 
{
	//options for mode are local, lite, or cluster

	LoadLibraries();
    
	//General user run options (now set in run command)
	//TString identifier("myTest"); //unique identifier for this job
	//TString dataset("test.example"); //dataset name
	//TString username("bcbutler"); //username for cluster, not important otherwise

	//SetConfig
	TString configfile("../config/periodsB-K.config");

	// Change if defaulting to wrong TTree, otherwise leave
	TString treename("");
	
	// Best to leave alone	
	TString pathLite("");
	
	//TString pathCluster("root://atlprf01.slac.stanford.edu:11094//atlas/local/");
	TString pathCluster("root://atlprf01.slac.stanford.edu:2094//atlas/output/");
	pathCluster.Append(username);
	pathCluster.Append("/");

	//Determine eventbuilder from dataset name
	TString eventbuilder(dataset);
	eventbuilder.Remove(0,eventbuilder.Last('.')+1);
	
	//Filename paths, URLs for PROOF running
	TString url(mode);
	TString path("");
	if(mode.CompareTo("lite")==0) {
		url = "lite://";
		path = pathLite;
	}
	else if(mode.CompareTo("cluster")==0) {
		url = TString(username+"@atlprf01.slac.stanford.edu");
		path = pathCluster;
	}
	
	//Make an options file, edit as needed
	TFile* options = new TFile("options.root","RECREATE");
	
	//Analyses Configs, change as needed
	bool do0Lepton = true;
	bool do1Electron = true;
	bool do1Muon = true;
	bool doFakeNu = false; //convert Zmumubb to Znunubb
	bool doDetail = true;
	bool doLocHad = false;
	bool doPRW = true;
	bool doTMN = true;
	bool doWriteTrees = eventbuilder.CompareTo("event") ? true : false;
	
	if(dataset.Contains("Egamma_")) {
		do0Lepton = false;
		do1Muon = false;
	}
	else if(dataset.Contains("Muons_")) {
		do0Lepton = false;
		do1Electron = false;
	}
	else if(dataset.Contains("JetTauEtmiss_")) {
		do1Electron = false;
		do1Muon = false;
	}	

	Config* nom = new Config("nom",configfile);
	nom->Set("ANALYSIS","susyopt");
	nom->Set("MCWEIGHTS",mcweights);
	nom->Set("PILE",doPRW);
	nom->Set("TMN",doTMN);
	nom->Set("0LEPTON",do0Lepton);
	nom->Set("1ELECTRON",do1Electron);
	nom->Set("1MUON",do1Muon);
	nom->Set("FAKENU",doFakeNu);
	nom->Set("DETAIL",doDetail);
	nom->Set("LOCHAD",doLocHad);
	nom->Set("WRITETREES",doWriteTrees);
	//nom->Set("DEBUG",true);
	nom->Write();
	if(nom->Exists("GRL")) WriteGRLObject(nom->String("GRL"),nom->GetName());	

	if(((!dataset.Contains("JetTauEtmiss_"))&&(!dataset.Contains("Egamma_"))&&(!dataset.Contains("Muons_")))&&(!dataset.Contains("ttslLAr"))&&sys) {	

		Config* jesup = new Config("jesup",configfile);
		jesup->Set("ANALYSIS","susyopt");
		jesup->Set("MCWEIGHTS",mcweights);
		jesup->Set("JETSYS",1);
		jesup->Set("PILE",doPRW);
		jesup->Set("TMN",doTMN);
		jesup->Set("0LEPTON",do0Lepton);
		jesup->Set("1ELECTRON",do1Electron);
		jesup->Set("1MUON",do1Muon);
		jesup->Set("FAKENU",doFakeNu);
		jesup->Set("WRITETREES",doWriteTrees);
		//jesup->Set("DEBUG",true);
		jesup->Write();
		if(jesup->Exists("GRL")) WriteGRLObject(jesup->String("GRL"),jesup->GetName());	
	
		Config* jesdown = new Config("jesdown",configfile);
		jesdown->Set("ANALYSIS","susyopt");
		jesdown->Set("MCWEIGHTS",mcweights);
		jesdown->Set("JETSYS",2);
		jesdown->Set("PILE",doPRW);
		jesdown->Set("TMN",doTMN);
		jesdown->Set("0LEPTON",do0Lepton);
		jesdown->Set("1ELECTRON",do1Electron);
		jesdown->Set("1MUON",do1Muon);
		jesdown->Set("FAKENU",doFakeNu);
		jesdown->Set("WRITETREES",doWriteTrees);
		//jesdown->Set("DEBUG",true);
		jesdown->Write();
		if(jesdown->Exists("GRL")) WriteGRLObject(jesdown->String("GRL"),jesdown->GetName());	
	}

	//ProofAna global Config object
	Config* confProofAna = new Config("ProofAna");
	//confProofAna->Set("DEBUG",true); 	// "false", 0, "0" etc. also works
	confProofAna->Set("SAVETIMERS",false); //ProofAna timer histograms in output file
	confProofAna->Set("IDENTIFIER",identifier);
	confProofAna->Set("DATASET",dataset);
	confProofAna->Set("OUTPUTPATH",path);
	confProofAna->Set("EVENTBUILDER",eventbuilder);
	ReadDatasetInfo(dataset,confProofAna); //Reads information used in MC weighting, multi-dataset jobs
	confProofAna->Write();	

	WriteSUSYObjDefObject(options);
	WriteMuonTrigReweightObject(options);
	WriteMuonTriggerSFToolObject(options);
	WriteMultijetJESUncertaintyObject(options);
	
	WriteBTagCalibObject(options,"JetFitterCOMBNN","2_00");
	WriteBTagCalibObject(options,"JetFitterCOMBNN","0_35");
	WriteBTagCalibObject(options,"JetFitterCOMBNN","-1_25");
	WriteBTagCalibObject(options,"SV0","5_85");
	WriteBTagCalibObject(options,"JetProb","3_25");
	WriteBTagCalibObject(options,"JetProb","2_05");
	WriteBTagCalibObject(options,"JetProb","1_40");
	WriteBTagCalibObject(options,"JetProb","0_60");
	
	WriteJERObject(options);
	Write0LeptonPileupReweightingObject(options);
	Write1ElectronPileupReweightingObject(options);
	Write1MuonPileupReweightingObject(options);

	options->Close();
	delete options;
	
	if(mode.CompareTo("local")==0) runLocal(dataset,treename);
	else runProof(url,dataset,-1,treename);
	
	gSystem->Unlink("options.root");
}
Esempio n. 18
0
CompareSpectra(Int_t part, Int_t charge, Int_t cent = -1, Int_t ratio = kFALSE, Int_t fitfunc = -1, Bool_t cutSpectra = kTRUE) 
{

  gROOT->LoadMacro("HistoUtils.C");

  gStyle->SetOptStat(0);
  gStyle->SetOptFit();

  LoadLibraries();
  AliBWFunc bwf;
  bwf.SetVarType(AliBWFunc::kdNdpt);
  TF1 *fFitFunc = NULL;

  switch (fitfunc) {
  case 0:
    gROOT->LoadMacro("SpectraAnalysis.C");
    fFitFunc = STAR_BlastWave("fBW", AliPID::ParticleMass(part), 0.9, 0.1, 1.);
    fBW->SetParLimits(3, 0.5, 1.5);
    //    fBW->FixParameter(3, 1.);
    break;
  case 1:
    fFitFunc = bwf.GetLevi(AliPID::ParticleMass(part), AliPID::ParticleMass(part), 5., 1000.);
    break;
  case 2:
    fFitFunc = bwf.GetBoltzmann(AliPID::ParticleMass(part), AliPID::ParticleMass(part), 100.);
    break;
  case 3:
    fFitFunc = bwf.GetMTExp(AliPID::ParticleMass(part),AliPID::ParticleMass(part) , 100.);
    break;
  case 4:
    fFitFunc = bwf.GetPTExp(AliPID::ParticleMass(part), 100.);
    break;
  case 5:
    fFitFunc = bwf.GetBGBW(AliPID::ParticleMass(part), 0.5, 0.1, 1.e6);
    break;
  case 6:
    fFitFunc = new TF1("fpol9", "pol9", 0., 5.0);
    break;
  }
  if (fFitFunc) fFitFunc->SetLineWidth(2);

  TFile *itssafile = TFile::Open(ratio ? itssaratiofilename : itssafilename);
  //  TFile *itstpcfile = TFile::Open(itstpcfilename);
  if (part / 3 == charge / 3)
    Char_t *tpctofratiofilename = tpctofratiofilenameA;
  else
    Char_t *tpctofratiofilename = tpctofratiofilenameB;
  TFile *tpctoffile = TFile::Open(ratio ? tpctofratiofilename : tpctoffilename);
  TFile *toffile = TFile::Open(ratio ? tofratiofilename : toffilename);
  //  TFile *hydrofile = TFile::Open(hydrofilename);

  TCanvas *cCanvas = new TCanvas("cCanvas");
  if (cent == -1) cCanvas->Divide(5, 2);
  TCanvas *cCanvasCombined = new TCanvas("cCanvasCombined");
  TCanvas *cCanvasRatio = new TCanvas("cCanvasRatio");
  if (cent == -1) cCanvasRatio->Divide(5, 2);
  TCanvas *cCanvasRatioComb = new TCanvas("cCanvasRatioComb");
  if (cent == -1) cCanvasRatioComb->Divide(5, 2);
  TCanvas *cCanvasRatioFit = new TCanvas("cCanvasRatioFit");
  if (cent == -1) cCanvasRatioFit->Divide(5, 2);
  TPad *curpad = NULL;
  TH1D *hITSsa, *hITSTPC, *hTPCTOF, *hTOF;
  TGraph *hHydro;
  TGraphErrors *gCombined[10];
  TProfile *pCombined[10];
  TH1D *hCombined[10];
  TH1D *hRatio_ITSsa_ITSTPC[10];
  TH1D *hRatio_ITSsa_TPCTOF[10];
  TH1D *hRatio_ITSTPC_TPCTOF[10];
  TH1D *hRatio_ITSTPC_TOF[10];
  TH1D *hRatio_TPCTOF_TOF[10];
  TH1D *hRatio_ITSsa_TOF[10];
  for (Int_t icent = 0; icent < 10; icent++) {
    if (cent != -1 && icent != cent) continue;
    gCombined[icent] = new TGraphErrors();
    pCombined[icent] = new TProfile(Form("pCombined_cent%d", icent), "", NptBins, ptBin);
    hCombined[icent] = new TH1D(Form("hCombined_cent%d", icent), "", NptBins, ptBin);
    TObjArray spectraArray;
    hITSsa = ratio ? GetITSsaRatio(itssafile, part, charge, icent, cutSpectra): GetITSsaSpectrum(itssafile, part, charge, icent, cutSpectra);
    //    hITSTPC = GetITSTPCSpectrum(itstpcfile, part, charge, icent, cutSpectra);
    hTPCTOF = ratio ? GetTPCTOFRatio(tpctoffile, part, charge, icent, cutSpectra) : GetTPCTOFSpectrum(tpctoffile, part, charge, icent, cutSpectra);
    hTOF = ratio ? GetTOFRatio(toffile, part, charge, icent, cutSpectra) : GetTOFSpectrum(toffile, part, charge, icent, cutSpectra);
    //    hHydro = GetHydroSpectrum(hydrofile, part, charge, icent);
    if (cent == -1)
      curpad = (TPad *)cCanvas->cd(icent + 1);
    else
      curpad = (TPad *)cCanvas->cd();
    if (!ratio)
      TH1D *hArea = new TH1D(Form("hArea_%d", icent), Form("%s (%s);p_{T} (GeV/c);#frac{d^{2}N}{dy dp_{t}};", partChargeName[part][charge], centName[icent]), 100, 0., 5.);
    else
      TH1D *hArea = new TH1D(Form("hArea_%d", icent), Form("%s (%s);p_{T} (GeV/c);#frac{d^{2}N}{dy dp_{t}};", "generic ratio", centName[icent]), 100, 0., 5.);
    hArea->Draw();
    Double_t minimum = 0.001;
    Double_t maximum = 1000.;
    if (hITSsa) {
      AddPointsToGraph(hITSsa, gCombined[icent]);
      AddPointsToProfile(hITSsa, pCombined[icent]);
      spectraArray.Add(hITSsa);
      hITSsa->DrawCopy("same");
      if (hITSsa->GetMaximum() > maximum) maximum = hITSsa->GetMaximum();
      if (hITSsa->GetMinimum() < minimum) minimum = hITSsa->GetMinimum();
    }
    if (hITSTPC) {
      AddPointsToGraph(hITSTPC, gCombined[icent]);
      AddPointsToProfile(hITSTPC, pCombined[icent]);
      spectraArray.Add(hITSTPC);
      hITSTPC->DrawCopy("same");
      if (hITSTPC->GetMaximum() > maximum) maximum = hITSTPC->GetMaximum();
      if (hITSTPC->GetMinimum() < minimum) minimum = hITSTPC->GetMinimum();
    }
    if (hTPCTOF) {
      AddPointsToGraph(hTPCTOF, gCombined[icent]);
      AddPointsToProfile(hTPCTOF, pCombined[icent]);
      spectraArray.Add(hTPCTOF);
      hTPCTOF->DrawCopy("same");
      if (hTPCTOF->GetMaximum() > maximum) maximum = hTPCTOF->GetMaximum();
      if (hTPCTOF->GetMinimum() < minimum) minimum = hTPCTOF->GetMinimum();
    }
    if (hTOF) {
      AddPointsToGraph(hTOF, gCombined[icent]);
      AddPointsToProfile(hTOF, pCombined[icent]);
      spectraArray.Add(hTOF);
      hTOF->DrawCopy("same");
      if (hTOF->GetMaximum() > maximum) maximum = hTOF->GetMaximum();
      if (hTOF->GetMinimum() < minimum) minimum = hTOF->GetMinimum();
    }
    if (hHydro) {
      ;//hHydro->Draw("c,same");
    }
    TLegend *legend = curpad->BuildLegend();
    legend->SetFillStyle(0);
    legend->SetFillColor(0);
    legend->DeleteEntry();

    hArea->SetMaximum(maximum * 1.1);
    hArea->SetMinimum(0.01);
    //    gPad->SetLogy();

    /*** RATIOS ***/

    /* switch canvas */
    if (cent == -1)
      curpad = (TPad *)cCanvasRatio->cd(icent + 1);
    else
      curpad = (TPad *)cCanvasRatio->cd();

   
    /* area histo */
    if (!ratio)
      TH1D *hAreaRatio = new TH1D(Form("hAreaRatio_%d", icent), Form("%s (%s);p_{T} (GeV/c);ratio;", partChargeName[part][charge], centName[icent]), 100, 0., 5.);
    else
      TH1D *hAreaRatio = new TH1D(Form("hAreaRatio_%d", icent), Form("%s (%s);p_{T} (GeV/c);ratio;", "generic ratio", centName[icent]), 100, 0., 5.);

    hAreaRatio->SetMaximum(1.5);
    hAreaRatio->SetMinimum(0.5);
    hAreaRatio->Draw();

    /* do ratios */
    if (hITSsa && hITSTPC) {
      hRatio_ITSsa_ITSTPC[icent] = new TH1D(*hITSsa);
      hRatio_ITSsa_ITSTPC[icent]->Divide(hITSTPC);
      hRatio_ITSsa_ITSTPC[icent]->SetNameTitle(Form("hRatio_ITSsa_ITSTPC_cent%d", icent), "ITSsa / ITSTPC");
      hRatio_ITSsa_ITSTPC[icent]->Draw("same");
    }
    if (hITSsa && hTPCTOF) {
      hRatio_ITSsa_TPCTOF[icent] = new TH1D(*hITSsa);
      hRatio_ITSsa_TPCTOF[icent]->Divide(hTPCTOF);
      hRatio_ITSsa_TPCTOF[icent]->SetNameTitle(Form("hRatio_ITSsa_TPCTOF_cent%d", icent), "ITSsa / TPCTOF");
      hRatio_ITSsa_TPCTOF[icent]->SetMarkerStyle(23);
      hRatio_ITSsa_TPCTOF[icent]->SetMarkerColor(4);
      hRatio_ITSsa_TPCTOF[icent]->Draw("same");
    }
    if (hITSTPC && hTPCTOF) {
      hRatio_ITSTPC_TPCTOF[icent] = new TH1D(*hITSTPC);
      hRatio_ITSTPC_TPCTOF[icent]->Divide(hTPCTOF);
      hRatio_ITSTPC_TPCTOF[icent]->SetNameTitle(Form("hRatio_ITSTPC_TPCTOF_cent%d", icent), "ITSTPC / TPCTOF");
      hRatio_ITSTPC_TPCTOF[icent]->Draw("same");
    }
    if (hTPCTOF && hTOF) {
      hRatio_TPCTOF_TOF[icent] = new TH1D(*hTPCTOF);
      hRatio_TPCTOF_TOF[icent]->Divide(hTOF);
      hRatio_TPCTOF_TOF[icent]->SetNameTitle(Form("hRatio_TPCTOF_TOF_cent%d", icent), "TPCTOF / TOF");
      hRatio_TPCTOF_TOF[icent]->Draw("same");
    }
    if (hITSsa && hTOF) {
      hRatio_ITSsa_TOF[icent] = new TH1D(*hITSsa);
      hRatio_ITSsa_TOF[icent]->Divide(hTOF);
      hRatio_ITSsa_TOF[icent]->SetNameTitle(Form("hRatio_ITSsa_TOF_cent%d", icent), "ITSsa / TOF");
      //      hRatio_ITSsa_TOF[icent]->SetMarkerStyle(25);
      //      hRatio_ITSsa_TOF[icent]->SetMarkerColor(2);
      hRatio_ITSsa_TOF[icent]->Draw("same");
    }

    /* legend */
    TLegend *legendRatio = curpad->BuildLegend();
    legendRatio->SetFillStyle(0);
    legendRatio->SetFillColor(0);
    legendRatio->DeleteEntry();

    CombineSpectra(hCombined[icent], &spectraArray);
    hCombined[icent]->SetFillStyle(0);
    hCombined[icent]->SetFillColor(kOrange + 1);
    hCombined[icent]->SetMarkerColor(kOrange+1);
    hCombined[icent]->SetMarkerStyle(24);
    hCombined[icent]->SetLineColor(kOrange+1);
    hCombined[icent]->SetLineWidth(2);
    hCombined[icent]->SetMarkerSize(0);
    
    //    hCombined[icent]->DrawCopy("same,E2");
    //    pCombined[icent]->DrawCopy("same");

    if (cent == -1)
      cCanvas->cd(icent + 1);
    else
      cCanvas->cd();
    //    hCombined[icent]->Draw("same, E2");

    cCanvasCombined->cd();
    if (cent == -1 && icent != 0)
      hCombined[icent]->Draw("E2,same");
    else
      hCombined[icent]->Draw("E2");

    //    cCanvasCombined->DrawClonePad();
    if (hITSsa) {
      hITSsa->DrawCopy("same");
    }
    if (hITSTPC) {
      hITSTPC->DrawCopy("same");
    }
    if (hTPCTOF) {
      hTPCTOF->DrawCopy("same");
    }
    if (hTOF) {
      hTOF->DrawCopy("same");
    }
    if (hHydro) {
      ;//hHydro->Draw("c,same");
    }

    if (cent == -1)
      cCanvasRatioComb->cd(icent + 1);
    else
      cCanvasRatioComb->cd();
    //    hCombined[icent]->Draw("same, E2");

    TH1 *hhr = HistoUtils_smartratio(hCombined[icent], hCombined[icent]);
    hhr->SetMaximum(1.25);
    hhr->SetMinimum(0.75);
    hhr->SetFillStyle(3001);
    hhr->SetTitle("combined error;p_{T} (GeV/c);ratio wrt. combined");
    hhr->Draw("e2");
    if (hITSsa) {
      hhr = HistoUtils_smartratio(hITSsa, hCombined[icent]);
      hhr->SetLineColor(1);
      hhr->SetLineWidth(2);
      hhr->Draw("e2,same");
    }
    if (hITSTPC) {
      hhr = HistoUtils_smartratio(hITSTPC, hCombined[icent]);
      hhr->SetLineColor(1);
      hhr->SetLineWidth(2);
      hhr->Draw("e2,same");
    }
    if (hTPCTOF) {
      hhr = HistoUtils_smartratio(hTPCTOF, hCombined[icent]);
      hhr->SetLineColor(8);
      hhr->SetLineWidth(2);
      hhr->Draw("e2,same");
    }
    if (hTOF) {
      hhr = HistoUtils_smartratio(hTOF, hCombined[icent]);
      hhr->SetLineColor(4);
      hhr->SetLineWidth(2);
      hhr->Draw("e2,same");
    }
    if (hHydro) {
      ;//hHydro->Draw("c,same");
    }


    if (!fFitFunc)
      continue;
    
    //    gCombined[icent]->Draw("p*");
    //    gCombined[icent]->Fit(fFitFunc, "0q", "", 0.5, 1.0);
    //    gCombined[icent]->Fit(fFitFunc, "0q", "", 0.2, 1.5);
    hCombined[icent]->Fit(fFitFunc, "0q", "", 0., 5.);
    fFitFunc->DrawCopy("same");
    printf("cent = %d, dNdy = %f +- %f\n", icent, fFitFunc->GetParameter(0), fFitFunc->GetParError(0));

    if (cent == -1)
      cCanvas->cd(icent + 1);
    else
      cCanvas->cd();
    fFitFunc->DrawCopy("same");

    if (cent == -1)
      cCanvasRatioFit->cd(icent + 1);
    else
      cCanvasRatioFit->cd();
    if (!ratio)
      TH1D *hAreaRatioFit = new TH1D(Form("hAreaRatioFit_%d", icent), Form("%s (%s);p_{T} (GeV/c);ratio wrt. fit;", partChargeName[part][charge], centName[icent]), 100, 0., 5.);
    else
      TH1D *hAreaRatioFit = new TH1D(Form("hAreaRatioFit_%d", icent), Form("%s (%s);p_{T} (GeV/c);ratio wrt. fit;", "generic ratio", centName[icent]), 100, 0., 5.);
    hAreaRatioFit->SetMaximum(1.5);
    hAreaRatioFit->SetMinimum(0.5);
    hAreaRatioFit->Draw();
    legend->Draw("same");

    if (hITSsa) {
      hITSsa->Divide(fFitFunc);
      hITSsa->DrawCopy("same");
    }
    if (hITSTPC) {
      hITSTPC->Divide(fFitFunc);
      hITSTPC->DrawCopy("same");
    }
    if (hTPCTOF) {
      hTPCTOF->Divide(fFitFunc);
      hTPCTOF->DrawCopy("same");
    }
    if (hTOF) {
      hTOF->Divide(fFitFunc);
      hTOF->DrawCopy("same");
    }

  }

}
Esempio n. 19
0
Script::Script()
{	
	// init Lua and load all libraries
	L = lua_open();	
	LoadLibraries();
}
Esempio n. 20
0
//________________________
/// Main execution method.
//________________________
void anaM()
{
  // Main
  //--------------------------------------------------------------------
  // Load analysis libraries
  // Look at the method below, 
  // change whatever you need for your analysis case
  // ------------------------------------------------------------------
  LoadLibraries() ;
  
  //-------------------------------------------------------------------------------------------------
  // Create chain from ESD and from cross sections files, look below for options.
  //------------------------------------------------------------------------------------------------- 
  if(kInputData == "ESD") kTreeName = "esdTree" ;
  else if(kInputData == "AOD") kTreeName = "aodTree" ;
  else if (kInputData == "MC") kTreeName = "TE" ;
  else {
    cout<<"Wrong  data type "<<kInputData<<endl;
    break;
  }
  
  TChain * chain   = new TChain(kTreeName) ;
  
  CreateChain(mode, chain);//, chainxs);
  cout<<"Chain created"<<endl;
  
  if( chain )
  {
    AliLog::SetGlobalLogLevel(AliLog::kError);//Minimum prints on screen
    
    //--------------------------------------
    // Make the analysis manager
    //-------------------------------------
    AliAnalysisManager *mgr  = new AliAnalysisManager("Manager", "Manager");
    // MC handler
    if( (kMC && (kInputData == "ESD")) || kInputData == "MC"){
      AliMCEventHandler* mcHandler = new AliMCEventHandler();
      mcHandler->SetReadTR(kFALSE);//Do not search TrackRef file
      mgr->SetMCtruthEventHandler(mcHandler);
      if( kInputData == "MC") mgr->SetInputEventHandler(NULL);
    }
    
//    // AOD output handler
//    AliAODHandler* aodoutHandler   = new AliAODHandler();
//    aodoutHandler->SetOutputFileName("AliAOD.root");
//    mgr->SetOutputEventHandler(aodoutHandler);
    
    //input
    Int_t maxiterations = 1;
    AliEventPoolLoop* pool = new AliEventPoolLoop(maxiterations);
    pool->SetChain(chain);
    Int_t eventsInPool = 10;
    AliMultiEventInputHandler *inpHandler = NULL ; 
    if(kInputData == "ESD"){
      // ESD handler
      printf("ESD MultiInput \n");
      inpHandler = new AliMultiEventInputHandler(eventsInPool, 0);
    }
    if(kInputData == "AOD"){
      // AOD handler
      inpHandler = new AliMultiEventInputHandler(eventsInPool, 1);	   	  
    }
    mgr->SetInputEventHandler(inpHandler);
    cout<<"Input handler "<<mgr->GetInputEventHandler()<<endl;
    mgr->SetEventPool(pool);
    inpHandler->SetEventPool(pool);
    
    //mgr->SetDebugLevel(-1); // For debugging, do not uncomment if you want no messages.
    
    // select triigger events for physics run
    
//    if(!kMC){
//      gROOT->LoadMacro("AddTaskPhysicsSelection.C");
//      AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
//      mgr->AddTask(physSelTask);    
//    }
    
    //-------------------------------------------------------------------------
    //Define task, put here any other task that you want to use.
    //-------------------------------------------------------------------------
    
    //correlation analysis
    gROOT->LoadMacro("AddTaskCaloTrackCorrM.C");
    
    AliAnalysisTaskCaloTrackCorrelationM *taskEMCAL = AddTaskCaloTrackCorrM(kInputData,"EMCAL",kFALSE);

    mgr->AddTask(taskEMCAL);
    
    AliAnalysisTaskCaloTrackCorrelationM *taskPHOS  = AddTaskCaloTrackCorrM(kInputData,"PHOS", kFALSE);

    mgr->AddTask(taskPHOS);
    
    //gROOT->LoadMacro("AddTaskChargeCorr.C");
    AliAnalysisTaskCaloTrackCorrelationM *taskCharge  = AddTaskCaloTrackCorrM(kInputData, "CTS",kFALSE);
//    if(!kMC)
//      taskCharge->SelectCollisionCandidates();
    mgr->AddTask(taskCharge);
    
     //-----------------------
    // Run the analysis
    //-----------------------    
    //mgr->ResetAnalysis();
    mgr->InitAnalysis();
    mgr->PrintStatus();
    mgr->StartAnalysis("mix",chain);
    
    cout <<" Analysis ended sucessfully "<< endl ;
  }
  else cout << "Chain was not produced ! "<<endl;
  
}
Esempio n. 21
0
void anaCaloFilter(Int_t mode=mLocal)
{
  // Main
  char cmd[200] ; 
  sprintf(cmd, ".! rm -rf AliAOD.root") ; 
  gROOT->ProcessLine(cmd) ; 
  //--------------------------------------------------------------------
  // Load analysis libraries
  // Look at the method below, 
  // change whatever you need for your analysis case
  // ------------------------------------------------------------------
  LoadLibraries(mode) ;
  
  //-------------------------------------------------------------------------------------------------
  //Create chain from ESD and from cross sections files, look below for options.
  //-------------------------------------------------------------------------------------------------
  if(kInputData == "ESD") kTreeName = "esdTree" ;
  else if(kInputData == "AOD") kTreeName = "aodTree" ;
  else {
    cout<<"Wrong  data type "<<kInputData<<endl;
    break;
  }
  
  TChain *chain       = new TChain(kTreeName) ;
  CreateChain(mode, chain);  
  
  if(chain){
    AliLog::SetGlobalLogLevel(AliLog::kError);//Minimum prints on screen
    
    //--------------------------------------
    // Make the analysis manager
    //-------------------------------------
    AliAnalysisManager *mgr  = new AliAnalysisManager("Manager", "Manager");
    
    // AOD output handler
    AliAODHandler* aodoutHandler   = new AliAODHandler();
    aodoutHandler->SetOutputFileName("AliAOD.root");
    ////aodoutHandler->SetCreateNonStandardAOD();
    mgr->SetOutputEventHandler(aodoutHandler);
    
    //input
    if(kInputData == "ESD")
    {
      // ESD handler
      AliESDInputHandler *esdHandler = new AliESDInputHandler();
      mgr->SetInputEventHandler(esdHandler);
      esdHandler->SetReadFriends(kFALSE);
      cout<<"ESD handler "<<mgr->GetInputEventHandler()<<endl;
    }
    if(kInputData == "AOD")
    {
      // AOD handler
      AliAODInputHandler *aodHandler = new AliAODInputHandler();
      mgr->SetInputEventHandler(aodHandler);
      cout<<"AOD handler "<<mgr->GetInputEventHandler()<<endl;
      
    }
    
    // mgr->SetDebugLevel(1);
    
    //-------------------------------------------------------------------------
    //Define task, put here any other task that you want to use.
    //-------------------------------------------------------------------------    
    // ESD physics selection task
    if(kInputData == "ESD" && kUsePhysSel)
    {
      gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
      AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
    }
    
    gROOT->LoadMacro("AddTaskCaloFilter.C");
    AliAnalysisTaskCaloFilter* filter = AddTaskCaloFilter();
            
    //AliAnalysisTaskCaloFilter * filter = new AliAnalysisTaskCaloFilter();
    //filter->SetConfigFileName("ConfigCaloFilter.C");
    //mgr->AddTask(filter);
      
    // Create containers for input/output
    AliAnalysisDataContainer *cinput1    = mgr->GetCommonInputContainer();
    AliAnalysisDataContainer *coutput1   = mgr->GetCommonOutputContainer();
    AliAnalysisDataContainer *coutntuple = mgr->CreateContainer("EventNtuple", TNtuple::Class(), 
                                                                AliAnalysisManager::kOutputContainer, "eventselection.root");
    
    mgr->ConnectInput  (filter, 0, cinput1);
    mgr->ConnectOutput (filter, 0, coutput1 );
    mgr->ConnectOutput (filter, 1, coutntuple );
    
    //-----------------------
    // Run the analysis
    //-----------------------    
    TString smode = "";
    if (mode==mLocal || mode == mLocalCAF) 
      smode = "local";
    else if (mode==mPROOF) 
      smode = "proof";
    else if (mode==mGRID) 
      smode = "local";
    
    mgr->InitAnalysis();
    mgr->PrintStatus();
    mgr->StartAnalysis(smode.Data(),chain);
    
    cout <<" Analysis ended sucessfully "<< endl ;
    
  }
  else cout << "Chain was not produced ! "<<endl;
  
  //sprintf(cmd, ".! rm -rf CorrectionFiles") ;
  
}
Esempio n. 22
0
void RunMacro(){
//     check the function for asymmetric TPC cut in ConfigHFEemcalMod....the rest is still necessary????

   // Firstly, set some variables
   const char* launch = "grid"; // grid, local (if your data is on your local machine, doesn't connect at all)
   const char*  mode = "test"; //test, full, terminate  (test= connect to grid but run locally, full= run on grid, terminate= merge output on grid)
   Bool_t pre_final_stage = kTRUE; //TRUE = merging done on grid, FALSE = merge happens locally   
   Int_t cyclenumber = 1;
   Bool_t debug = kTRUE;
   char* work_dir = "PhiCorrelations_LHC16q_0_20_noveto";
   char* output_dir = "output_2018_10_22_FAST";
   Int_t ttl = 50000;
   Int_t noffiles = 40;
   Int_t runcycle[]={0,1,31};
   //Int_t runcycle[]={0,16,31};
   Bool_t UseParfiles = kFALSE;

   // load libraries
   LoadLibraries();

// create and customize the alien handler
  AliAnalysisAlien *alienHandler = new AliAnalysisAlien();
      
    alienHandler->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/EMCAL -I$ALICE_ROOT/PYTHIA6 -I$ALICE_ROOT/ANALYSIS -I$ALICE_PHYSICS/PWGGA -I$ALICE_PHYSICS/PWGHF -I$ALICE_PHYSICS/PWGHF/hfe -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER/STEER -I$ALICE_ROOT/STEER/STEERBase -I$ALICE_ROOT/STEER/ESD -I$ALICE_ROOT/STEER/AOD -I$ALICE_PHYSICS/OADB -I$ALICE_PHYSICS/PWGHF/base  -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS  -I$ALICE_PHYSICS/OADB/macros -I$ALICE_PHYSICS/PWGCF/Correlations -I$ALICE_PHYSICS/PWGCF -I$ALICE_PHYSICS/PWGCF/Correlations/Base -I$ALICE_PHYSICS/include -g");
    
    alienHandler->SetAdditionalLibs("AliAnalysisTaskHadronPhiCorr_current.cxx AliAnalysisTaskHadronPhiCorr_current.h AddTaskHadronPhiCorr_current.C libpythia6.so libEGPythia6.so libAliPythia6.so libPWGHFhfe.so libCDB.so libSTEER.so libCORRFW.so libPWGflowBase.so libPWGflowTasks.so libGui.so libProof.so libMinuit.so libXMLParser.so libRAWDatabase.so libRAWDatarec.so libCDB.so libSTEERBase.so libSTEER.so libTPCbase.so libTOFbase.so libTOFrec.so libTRDbase.so libVZERObase.so libVZEROrec.so libT0base.so libT0rec.so libPWGTools.so libPWGCFCorrelationsBase.so");
    
  alienHandler->SetAnalysisSource("AliAnalysisTaskHadronPhiCorr_current.cxx");
  //alienHandler->SetOverwriteMode();
  alienHandler->SetRunMode(mode);
  alienHandler->SetNtestFiles(2);
  //alienHandler->SetAPIVersion("V1.1x");
  alienHandler->SetAliPhysicsVersion("vAN-20170731-1");
  //alienHandler->SetFileForTestMode("File_LHC12dPass1.txt");  //txt file that tells where to look for local files if launch=local
  //alienHandler->SetGridDataDir("/alice/sim/LHC10d4/");
  //alienHandler->SetDataPattern("*ESDs.root");
  alienHandler->SetGridDataDir("//alice/data/2016/LHC16q/");
  alienHandler->SetDataPattern("*/pass1_FAST/AOD/*/*AOD.root");
  //alienHandler->SetDataPattern("*/pass4/AOD/*AOD.root");
  alienHandler->SetRunPrefix("000"); // IMPORTANT! Only need for real data, comment this line out for MC data

   
//LHC12d   
    //Int_t runArray[] = {186320, 186319, 186318, 186229, 186208, 186205, 186200, 186167, 186165, 186164, 186163, 185912, 185909, 185784, 185778, 185776, 185775, 185768, 185765, 185764, 185757, 185756, 185738, 185735, 185734, 185701, 185699, 185698, 185697, 185695, 185687, 185680, 185589, 185588, 185583, 185582, 185581, 185580, 185578};
  //Int_t runArray[] = {186320, 186319, 186318, 186229, 186208, 186205, 186200, 186167, 186165, 186164, 186163, 185912, 185909, 185784, 185778, 185776, 185775, 185768, 185765, 185764, 185757, 185756, 185738, 185735, 185734, 185701, 185699, 185698, 185697, 185695, 185687, 185680, 185589, 185588, 185583, 185582, 185581, 185580, 185578, 185575, 185574, 185565, 185563, 185474, 185465, 185461, 185457, 185375, 185371, 185363, 185362, 185361, 185360, 185359, 185356, 185351, 185350, 185349, 185303, 185302, 185300, 185299, 185296, 185293, 185292, 185291, 185289, 185288, 185284, 185282, 185221, 185217, 185208, 185206, 185203, 185198, 185196, 185189};

 //LHC13b
    //Int_t runArray[] = {195483, 195482, 195481, 195480, 195479, 195478, 195391, 195389, 195351, 195346, 195344}; 

 //LHC13c
    //Int_t runArray[] = {195529, 195531, 195566, 195567, 195568, 195592, 195593, 195596, 195633, 195635, 195644, 195673, 195675, 195677};

//LHC10d4 - MC Data
    //Int_t runArray[] = {119159, 119161, 119163, 119841, 119842, 119844, 119845, 119846, 119849, 119853, 119856, 119859, 119862, 120067, 120069, 120072, 120073, 120076, 120079, 120244, 120503, 120504, 120505, 120616, 120617, 120671, 120741, 120750, 120758, 120820, 120821, 120822, 120823, 120824, 120825, 120829};
   // Int_t runArray[] = {120073}; //for testing why files were being opened but not closed

//LHC16r - 8 TeV pPb data
    //Int_t runArray[] = {266318, 266317, 266316, 266305, 266304, 266300, 266299, 266296, 266208, 266197, 266196, 266193, 266190, 266189, 266187, 266117, 266086, 266085, 266084, 266083, 266081, 266076, 266074, 266034, 265797, 265795, 265789, 265788, 265756, 265754, 265746, 265744, 265742, 265741, 265714, 265713,265709, 265705, 265701, 265700, 265698, 265697, 265696, 265607, 265596, 265594};
   //Int_t runArray[] = {266318, 266317, 266316, 266208, 266197, 266196, 266187, 265754, 265744, 265607, 265596, 265594};

//LHC16q - 5 TeV pPb data
   Int_t runArray[] = {265525, 265521, 265501, 265500, 265499, 265435, 265427, 265426, 265425, 265424, 265422, 265421, 265420, 265419, 265388, 265387, 265385, 265384, 265383, 265381, 265378, 265377, 265344, 265343, 265342, 265339, 265338, 265336, 265334, 265332, 265309};  
    
  
  for (Int_t i =  runcycle[cyclenumber - 1]; i < runcycle[cyclenumber] ; i++)
   {
    if (i == sizeof(runArray) / sizeof(runArray[1])) break;
    alienHandler->AddRunNumber(runArray[i]);
   }

   printf("\n\nSetting Up alienHandler.\n\n");
   alienHandler->SetGridWorkingDir(work_dir);
   alienHandler->SetGridOutputDir(output_dir);
   alienHandler->SetDefaultOutputs(kTRUE);
   alienHandler->SetAnalysisMacro("PhiInvMass.C");
   alienHandler->SetSplitMaxInputFileNumber(noffiles);
   alienHandler->SetExecutable("PhiInvMass.sh");
   alienHandler->SetExecutableCommand("aliroot -b -q");
   alienHandler->SetTTL(ttl); //10000
   alienHandler->SetInputFormat("xml-single");
   alienHandler->SetJDLName("PhiInvMass.jdl");
   alienHandler->SetPrice(1);
   alienHandler->SetSplitMode("se");
   alienHandler->SetMasterResubmitThreshold(10);
   alienHandler->SetMergeExcludes("EventStat_temp.root");
   alienHandler->SetOutputToRunNo(kTRUE);
   alienHandler->SetKeepLogs(kTRUE);
   alienHandler->SetMaxMergeFiles(15);
   alienHandler->SetMaxMergeStages(7);
   alienHandler->SetMergeViaJDL(pre_final_stage);
//    alienHandler->SetOneStageMerging(kFALSE);   //???????????????????????????????-------------------
    if (!alienHandler) return;

    
// load the necessary macros
   //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
   //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
// Use AliRoot includes to compile our task
   gROOT->ProcessLine(".include $ALICE_ROOT/include");
   gROOT->ProcessLine(".include $ALICE_ROOT/EMCAL");
   gROOT->ProcessLine(".include $ALICE_PHYSICS/include");
   gROOT->ProcessLine(".include $ALICE_ROOT/ANALYSIS/");
   gROOT->ProcessLine(".include $PWD/.");

   gSystem->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/EMCAL -I$ALICE_ROOT/PYTHIA6 -I$ALICE_ROOT/ANALYSIS -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER/STEER -I$ALICE_ROOT/STEER/STEERBase -I$ALICE_ROOT/STEER/ESD -I$ALICE_ROOT/STEER/AOD -I$ALICE_PHYSICS/OADB -I$ALICE_PHYSICS/PWGHF/base  -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS  -I$ALICE_PHYSICS/OADB -I$ALICE_ROOT/PWG/FLOW/Base -I$ALICE_PHYSICS/PWGCF/Correlations/Base -I$ALICE_PHYSICS/PWGCF/Correlations -g ");
   // gSystem->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/macros -I$ALICE_PHYSICS/include -g");

   //printf("\n!!!!!!!!!!!!!!!!!!!!!!\n AliAnalysis Manager \n\n");
   AliAnalysisManager *mgr = new AliAnalysisManager("PhiAnalysis");
   mgr->SetGridHandler(alienHandler);

   AliAODInputHandler* aodH = new AliAODInputHandler();
   mgr->SetInputEventHandler(aodH);
//   AliESDInputHandler* esdH = new AliESDInputHandler();
//   mgr->SetInputEventHandler(esdH);

//    AliMCEventHandler* mcH = new AliMCEventHandler();
//    mgr->SetMCtruthEventHandler(mcH);   
//    mcH->SetReadTR(kFALSE);

   //gROOT->LoadMacro("AddTaskPhiCorr.C");
   gROOT->LoadMacro("./AliAnalysisTaskHadronPhiCorr.cxx++g");
   //gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
   //gROOT->LoadMacro("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros/AddTaskMultSelection.C");
   //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");


    //switch on aliphysicsselection
    gInterpreter->ProcessLine(Form(".x %s", gSystem->ExpandPathName("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros/AddTaskMultSelection.C")));
    AliPhysicsSelectionTask* physSelTask = reinterpret_cast<AliPhysicsSelectionTask*>(gInterpreter->ProcessLine(Form(".x %s(kFALSE, kTRUE)", gSystem->ExpandPathName("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C")))); 
    //Only set true for MC
    Bool_t isMC = kFALSE;
    gInterpreter->ProcessLine(Form(".x %s(kFALSE)", gSystem->ExpandPathName("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C")));

    //create a task
    AliAnalysisTaskHadronPhiCorr_current *task1 = reinterpret_cast<AliAnalysisTaskHadronPhiCorr_current*>(gInterpreter->ProcessLine(Form(".x %s(kFALSE, 0.0, 20.0)", gSystem->ExpandPathName("AddTaskHadronPhiCorr_current.C"))));
    //AliAnalysisTaskHadronPhiCorr_current *task2 = reinterpret_cast<AliAnalysisTaskHadronPhiCorr_current*>(gInterpreter->ProcessLine(Form(".x %s(true, 10.0, 20.0)", gSystem->ExpandPathName("AddTaskHadronPhiCorr_current.C"))));
    //AliAnalysisTaskHadronPhiCorr_current *task3 = reinterpret_cast<AliAnalysisTaskHadronPhiCorr_current*>(gInterpreter->ProcessLine(Form(".x %s(kFALSE, 20.0, 40.0)", gSystem->ExpandPathName("AddTaskHadronPhiCorr_current.C"))));
    //AliAnalysisTaskHadronPhiCorr_current *task4 = reinterpret_cast<AliAnalysisTaskHadronPhiCorr_current*>(gInterpreter->ProcessLine(Form(".x %s(kTRUE, 40.0, 90.0)", gSystem->ExpandPathName("AddTaskHadronPhiCorr_current.C"))));

    task1->SetKaonEtaCut(0.8);
    task1->SetKaonTPCCut(3.0);
    task1->SetKaonTOFCut(3.0);
    task1->SetTOFVeto(kFALSE);
    task1->SetKaonTrkBit(1024);
    task1->SetAssocTrkBit(1024);
    task1->SetTrigTrkBit(AliAODTrack::kIsHybridGCG);
    task1->SetZVertexMin(-10.0);
    task1->SetZVertexMax(10.0);
    task1->SetZVertexNbins(10);
    task1->SetCentEstimator("V0A");


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

   mgr->PrintStatus();
   //fprintf(stdout, "\n!!!!!!!!!!!!!\nAbout to launch analysis... \n");
   // Start analysis in grid.
   mgr->StartAnalysis(launch);
   //printf("\n!!!!!!!!!!!!!\nDone with StartAnalysis(launch)\n");
   fflush(stdout);
}
Esempio n. 23
0
void
Config()
{

  /* initialise */
#if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
  // in root5 the ROOT_VERSION_CODE is defined only in ACLic mode
#else  
  gROOT->LoadMacro("$ALIDPG_ROOT/MC/DetectorConfig.C");
  gROOT->LoadMacro("$ALIDPG_ROOT/MC/GeneratorConfig.C");
#endif
  ProcessEnvironment();

  /* verbose */
  printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
  printf(">>>>>       run number: %d \n", runNumber);
  printf(">>>>> number of events: %d \n", neventsConfig);
  printf(">>>>>   magnetic field: %s \n", MagnetName[magnetConfig]);
  printf(">>>>>         detector: %s \n", DetectorName[detectorConfig]);
  printf(">>>>>     MC generator: %s \n", GeneratorName[generatorConfig]);
  printf(">>>>>          process: %s \n", processConfig.Data());
  printf(">>>>>           system: %s \n", systemConfig.Data());
  printf(">>>>>       CMS energy: %f \n", energyConfig);
  printf(">>>>>          trigger: %s \n", TriggerName[triggerConfig]);
  printf(">>>>>              PDG: %d \n", pdgConfig);
  printf(">>>>>            b-min: %f \n", bminConfig);
  printf(">>>>>            b-max: %f \n", bmaxConfig);
  printf(">>>>>  ptHardMinHijing: %f \n", ptHardMinHijing);
  printf(">>>>>            y-min: %f \n", yminConfig);
  printf(">>>>>            y-max: %f \n", ymaxConfig);
  printf(">>>>>   phi-min (deg.): %f \n", phiminConfig);
  printf(">>>>>   phi-max (deg.): %f \n", phimaxConfig);
  printf(">>>>>           pt-min: %f \n", ptminConfig);
  printf(">>>>>           pt-max: %f \n", ptmaxConfig);
  printf(">>>>>      pt-hard min: %f \n", pthardminConfig);
  printf(">>>>>      pt-hard max: %f \n", pthardmaxConfig);
  printf(">>>>>   pt-trigger min: %f \n", pttrigminConfig);
  printf(">>>>>   pt-trigger max: %f \n", pttrigmaxConfig);
  printf(">>>>>        quenching: %d \n", quenchingConfig);
  printf(">>>>>            q-hat: %f \n", qhatConfig);
  printf(">>>>>   crossing angle: %f \n", crossingConfig);
  printf(">>>>>      random seed: %d \n", seedConfig);
  printf(">>>>>           geant4: %d \n", isGeant4);
  printf(">>>>>       purifyKine: %d \n", purifyKine);
  printf(">>>>>            fluka: %d \n", isFluka);
  printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");

#if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
  // in root5 the ROOT_VERSION_CODE is defined only in ACLic mode
#else  
  LoadLibraries();
#endif

  /* Check that it is not set both Geant4 and Fluka */
  if (isGeant4 && isFluka) {
     printf(">>>>> You cannot have in your parameters both Geant4 and Fluka set!: isGeant4 = %d, isFluka = %d \n", (Int_t)isGeant4, (Int_t)isFluka);
     abort();
  }

  /* setup geant3 */
  if (!isGeant4 && !isFluka) new TGeant3TGeo("C++ Interface to Geant3");

  /* create galice.root */
  CreateGAlice();

  /* configure detector */
  DetectorConfig(detectorConfig);

  /* configure Geant4 if requested */
  if (isGeant4) {
    Int_t error;
    TString geant4config_macro = "$ALIDPG_ROOT/MC/Geant4Config.C";
    if (gROOT->LoadMacro(Form("%s/Geant4Config.C", gSystem->pwd()), &error, kTRUE) == 0) {
      printf(">>>>> Geant4Config.C macro detected in CWD, using that one \n");
      geant4config_macro = Form("%s/Geant4Config.C", gSystem->pwd());
    }
    gROOT->LoadMacro(geant4config_macro.Data());
    gROOT->ProcessLine("Geant4Config();");
  }

  /* configure Fluka if requested */
  if (isFluka) {
     gSystem->Load("libfluka.so");
     gROOT->ProcessLine("new TFluka(\"C++ Interface to Fluka\", 0/*verbositylevel*/);");
     gROOT->ProcessLine("((TFluka*) gMC)->SetLowEnergyNeutronTransport(1);");
  }

  /* configure MC generator */
  GeneratorConfig(generatorConfig);
  GeneratorOptions();

  if (!purifyKine) gAlice->GetMCApp()->PurifyLimits(80., 80.);
}