]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/totEt/macros/runCaloEt.C
Split: fix refs to AddTaskCentrality.C
[u/mrichter/AliRoot.git] / PWGLF / totEt / macros / runCaloEt.C
index 82070e889bfbf68314a558143b06345bd92d0e2b..9c83e296df89c2682efba3e4193a5b6620caca02 100644 (file)
@@ -5,17 +5,20 @@
 //With the argument true this submits jobs to the grid
 //As written this requires an xml script tag.xml in the ~/et directory on the grid to submit jobs
 void runCaloEt(bool submit = false, // true or false 
-              const char *dataType="real", // "sim" or "real" etc.
+              const char *dataType="simPbPb", // "sim" or "real" etc.
+              // const char *dataType="realPbPb", // "sim" or "real" etc.
               const char *pluginRunMode="test", // "test" or "full" or "terminate"
-              const char *det = "EMCalDetail") // "PHOS" or "EMCAL"
+              const char *det = "EMCal",//"EMCal",
+              int production = 1, Bool_t withtender = kTRUE, Int_t runnum = 0, Bool_t withNonlinearity = kTRUE, Bool_t withReclusterizing = kFALSE, Int_t trackmatchcuts=0, Bool_t is2011 = kFALSE, Bool_t jethad = kFALSE) // "PHOS" or "EMCAL" or EMCalDetail
 {
+  bool runCompiledVersion = kTRUE;
+  class AliAnalysisEtCuts;
   TStopwatch timer;
   timer.Start();
   gSystem->Load("libTree");
   gSystem->Load("libGeom");
   gSystem->Load("libVMC");
   gSystem->Load("libPhysics");
-
   gSystem->Load("libMinuit");
 
   gSystem->AddIncludePath("-I$ALICE_ROOT/include");
@@ -29,6 +32,12 @@ void runCaloEt(bool submit = false, // true or false
   gSystem->Load("libANALYSISalice");
   gSystem->Load("libCORRFW");
 
+    gSystem->Load("libTender");
+    gSystem->Load("libTenderSupplies");
+    gSystem->Load("libPWGTools");
+    gSystem->Load("libPWGEMCAL");
+    gROOT->ProcessLine(".include $ALICE_ROOT/Tender/"); 
+    //gSystem->AddIncludePath("-I$ALICE_ROOT/ANALYSIS "); 
 
 
   if (!submit) { 
@@ -38,25 +47,79 @@ void runCaloEt(bool submit = false, // true or false
     cout << "submitting to grid" << endl;
   }
    
-  gROOT->ProcessLine(".L AliAnalysisEtCuts.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisHadEtCorrections.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEtCommon.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEt.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEtMonteCarlo.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEtMonteCarloPhos.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEtMonteCarloEmcal.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEtReconstructed.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEtReconstructedPhos.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEtReconstructedEmcal.cxx+g");  
-  gROOT->ProcessLine(".L AliAnalysisEtSelectionContainer.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEtSelectionHandler.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisTaskTransverseEnergy.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEmEtMonteCarlo.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisEmEtReconstructed.cxx+g");
-  gROOT->ProcessLine(".L AliAnalysisTaskTotEt.cxx+g");
-
-  gInterpreter->GenerateDictionary("std::map<int, AliPhysicsSelection*>", "AliPhysicsSelection.h;map")  ;
-  gInterpreter->GenerateDictionary("std::pair<int, AliPhysicsSelection*>", "AliPhysicsSelection.h;utility");
+  if(runCompiledVersion){
+    gSystem->Load("libPWGLFtotEt");
+  }
+  else{
+    gROOT->ProcessLine(".L AliAnalysisEtCuts.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisHadEtCorrections.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtCommon.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtSelector.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtSelectorPhos.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtSelectorEmcal.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtTrackMatchCorrections.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtRecEffCorrection.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEt.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtMonteCarlo.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtMonteCarloPhos.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtMonteCarloEmcal.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtReconstructed.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtReconstructedPhos.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtReconstructedEmcal.cxx+g");  
+    //gROOT->ProcessLine(".L AliAnalysisEtSelectionContainer.cxx+g");
+    //gROOT->ProcessLine(".L AliAnalysisEtSelectionHandler.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisTaskTransverseEnergy.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEmEtMonteCarlo.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEmEtReconstructed.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisTaskTotEt.cxx+g");
+  }
+  TString detStr(det);
+  TString dataStr(dataType);
+  if ( detStr.Contains("PHOS") ) {
+    if(is2011){
+      gSystem->CopyFile("calocorrections.2011.PHOS.root","calocorrections.root",kTRUE);
+    }
+    else{
+      gSystem->CopyFile("calocorrections.PHOS.root","calocorrections.root",kTRUE);
+    }
+    if ( dataStr.Contains("sim") ) {
+      gSystem->CopyFile("ConfigEtMonteCarlo.PHOS.C","ConfigEtMonteCarlo.C",kTRUE);
+    }
+    else{
+      gSystem->CopyFile("ConfigEtMonteCarlo.PHOS.data.C","ConfigEtMonteCarlo.C",kTRUE);
+    }
+  }
+  else{
+    if(is2011){
+      gSystem->CopyFile("calocorrections.2011.EMCAL.root","calocorrections.root",kTRUE);
+    }
+    else{
+      gSystem->CopyFile("calocorrections.EMCAL.root","calocorrections.root",kTRUE);
+    }
+    if(is2011){
+      if ( dataStr.Contains("sim") ) {
+       gSystem->CopyFile("ConfigEtMonteCarlo.EMCAL.2011.C","ConfigEtMonteCarlo.C",kTRUE);
+      }
+      else{
+       gSystem->CopyFile("ConfigEtMonteCarlo.EMCAL.2011.data.C","ConfigEtMonteCarlo.C",kTRUE);
+      }
+    }
+    else{
+      if ( dataStr.Contains("sim") ) {
+       gSystem->CopyFile("ConfigEtMonteCarlo.EMCAL.C","ConfigEtMonteCarlo.C",kTRUE);
+      }
+      else{
+       gSystem->CopyFile("ConfigEtMonteCarlo.EMCAL.data.C","ConfigEtMonteCarlo.C",kTRUE);
+      }
+    }
+  }
+
+  if(is2011){
+      gSystem->CopyFile("ConfigEtReconstructed.2011.C","ConfigEtReconstructed.C",kTRUE);
+  }
+  else{
+      gSystem->CopyFile("ConfigEtReconstructed.2010.C","ConfigEtReconstructed.C",kTRUE);
+  }
 
   char *kTreeName = "esdTree" ;
   TChain * chain   = new TChain(kTreeName,"myESDTree") ;
@@ -71,22 +134,41 @@ void runCaloEt(bool submit = false, // true or false
   // Make the analysis manager
   AliAnalysisManager *mgr = new AliAnalysisManager("TotEtManager");
   
-  TString detStr(det);
   TString taskName = "TaskTotEt" + detStr;
-  TString dataStr(dataType);
   TString dataStrName(dataType);
   dataStrName.ReplaceAll("/",".");
+  Bool_t isPb = kFALSE;
+  if ( dataStr.Contains("PbPb") ) { isPb = kTRUE;}
+  TString suffix = "";
+  if(!withtender){
+    suffix = "WithoutTender";
+  }
+  if(!isPb){
+    suffix = "pp"+suffix;
+  }
   TString outputName = "Et.ESD." + dataStrName + "." + detStr + ".root";
-  TString outputDir = "totEt" + dataStr;
+  TString outputDir = "totEt" + dataStr + detStr+suffix;
+  if(!withNonlinearity){
+    outputDir +="NoNonlinearity";
+  }
+  if(withReclusterizing){
+    outputDir +="WithReclusterizing";
+  }
+  if(trackmatchcuts!=0){
+    outputDir +=Form("TrackMatchCut%i",trackmatchcuts);
+  }
+  if(jethad) outputDir+="WithJetHadronMethod";
 
   cout << " taskName " << taskName
        << " outputName " << outputName 
        << " outputDir (alien) " << outputDir << endl;
   mgr->SetCommonFileName(outputName.Data());
   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("out1", TList::Class(), AliAnalysisManager::kOutputContainer, outputName);
+  if(!isPb){ cout<<"I am not PbPb!!"<<endl;}
   if (submit) {
     gROOT->LoadMacro("CreateAlienHandlerCaloEtSim.C");
-    AliAnalysisGrid *alienHandler = CreateAlienHandlerCaloEtSim(outputDir, outputName, pluginRunMode);  
+    cout<<"Passing in production number "<<production<<endl;
+    AliAnalysisGrid *alienHandler = CreateAlienHandlerCaloEtSim(outputDir, outputName, pluginRunMode, production,detStr.Contains("PHOS"),!isPb,dataStr.Contains("real"),runnum,runCompiledVersion);  
     if (!alienHandler) return;
     mgr->SetGridHandler(alienHandler);
   }
@@ -95,19 +177,90 @@ void runCaloEt(bool submit = false, // true or false
   mgr->SetInputEventHandler(esdH);
   AliMCEventHandler* handler = new AliMCEventHandler;
   Bool_t isMc = kTRUE;
-  Bool_t isPb = kFALSE;
-  if ( dataStr.Contains("PbPb") ) { isPb = kTRUE;}
   if ( dataStr.Contains("sim") ) {
     cout << " MC " << endl;
     if ( dataStr.Contains("PbPb") ) { // a la: simPbPb/LHC10e18a
       cout << " PbPb " << endl;
-      TString fileLocation = "/home/dsilverm/data/E_T/" + dataStr + "/dir/AliESDs.root";
+      TString fileLocation = "/data/LHC10h8/137161/999/AliESDs.root";//"/home/dsilverm/data/E_T/" + dataStr + "/dir/AliESDs.root";
       cout << "fileLocation " << fileLocation.Data() << endl; 
-      chain->Add(fileLocation.Data()); // link to local test file
+//       chain->Add(fileLocation.Data()); // link to local test file
+//      chain->Add("/data/tmp/3682/AliESDs.root");
+//      chain->Add("/data/tmp/2782/AliESDs.root");
+//       chain->Add("/data/LHC10h8/137161/999/AliESDs.root");//Hijing Pb+Pb
+//       chain->Add("/data/LHC10h8/137161/111/AliESDs.root");//Hijing Pb+Pb
+//       chain->Add("/data/LHC10h8/137161/222/AliESDs.root");//Hijing Pb+Pb
+//      chain->Add("/data/LHC14a6/168464/605/AliESDs.root");
+//chain->Add("/data/LHC11a10a_bis/139465/001/AliESDs.root");
+//      chain->Add("/data/LHC14a6/168464/605/AliESDs.root");//HIJING with embedded signals
+      chain->Add("/data/LHC12d3/168464/201/AliESDs.root");//HIJING with embedded signals - works, full acceptance
+      //chain->Add("/data/LHC14a6/168464/888/AliESDs.root");//HIJING with embedded signals
+//   chain->Add("/data/LHC11a10a_bis/139465/002/AliESDs.root");
+//   chain->Add("/data/LHC11a10a_bis/139465/003/AliESDs.root");
+//  chain->Add("/data/LHC11a10a_bis/139465/004/AliESDs.root");
+//  chain->Add("/data/LHC11a10a_bis/139465/006/AliESDs.root");
+//  chain->Add("/data/LHC11a10a_bis/139465/007/AliESDs.root");
+//  chain->Add("/data/LHC11a10a_bis/139465/008/AliESDs.root");
+//  chain->Add("/data/LHC11a10a_bis/139465/009/AliESDs.root");
+//  chain->Add("/data/LHC11a10a_bis/139465/010/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/011/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/012/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/013/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/014/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/015/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/016/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/017/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/018/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/019/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/020/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/021/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/022/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/023/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/024/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/025/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/026/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/027/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/028/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/029/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/030/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/031/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/032/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/033/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/034/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/035/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/036/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/037/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/038/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/039/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/040/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/041/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/042/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/043/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/044/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/045/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/046/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/047/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/048/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/049/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/050/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/051/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/052/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/053/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/054/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/055/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/056/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/057/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/058/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/059/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/060/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/061/AliESDs.root");
+// chain->Add("/data/LHC11a10a_bis/139465/062/AliESDs.root");
+
     }
     else { // pp
       cout<<"adding pp simulation file"<<endl;
-      chain->Add("/data/LHC10d15/1821/AliESDs.root");
+      chain->Add("/data/LHC11b1b/999/AliESDs.root");
+      //chain->Add("/data/LHC11b1a/999/AliESDs.root");
+      //chain->Add("/data/LHC10d15/1821/AliESDs.root");
       //chain->Add("/data/LHC10dpass2/10000126403050.70/AliESDs.root");//data
       //chain->Add("/home/dsilverm/data/E_T/sim/LHC10d1/117222/100/AliESDs.root"); // link to local test file
     }
@@ -115,37 +268,96 @@ void runCaloEt(bool submit = false, // true or false
     mgr->SetMCtruthEventHandler(handler);
   }
   else { // real data
+    cout<<"Hello there!  I am data."<<endl;
     isMc = kFALSE;
-    chain->Add("/data/LHC10dpass2/10000126403050.70/AliESDs.root");//data
+
+    //      chain->Add("/data/tmp/10000139465010.600/AliESDs.root");
+
+      chain->Add("/data/LHC11h/pass2/000168464/11000168464082.94/AliESDs.root");
+      //chain->Add("/data/LHC10h/pass2_rev15/10000137366041.860/AliESDs.root");
+//       chain->Add("/data/LHC10h/pass2_rev15/10000137366041.870/AliESDs.root");
+//       chain->Add("/data/LHC10h/pass2_rev15/10000137366041.880/AliESDs.root");
+//       chain->Add("/data/LHC10h/pass2_rev15/10000137366041.890/AliESDs.root");
+//       chain->Add("/data/LHC10h/pass2_rev15/10000137366041.900/AliESDs.root");
+//     chain->Add("/data/LHC10dpass2/10000126403050.70/AliESDs.root");//data
     //chain->Add("/home/dsilverm/data/E_T/data/2010/LHC10b/000117222/ESDs/pass2/10000117222021.30/AliESDs.root"); // link to local test file
     cout << " not MC " << endl;
   }
 
 
-  if(!isMc && detStr.Contains("EMC")){
+  //if(!isMc && detStr.Contains("EMC")){
+    if(detStr.Contains("EMC")){
+  //if(0){
     cout<<"You are running over EMCal data and using the tender supply"<<endl;
-    gSystem->Load("libTENDER.so");
-    gSystem->Load("libTENDERSupplies.so"); 
-    gROOT->ProcessLine(".include $ALICE_ROOT/Tender/"); 
-    gSystem->AddIncludePath("-I$ALICE_ROOT/ANALYSIS "); 
-//     //Tender Supplies
-//     gROOT->LoadMacro("CreateEMCALTender.C");
-//     AliAnalysisTaskSE *tender = CreateEMCALTender(kTRUE);
-//     mgr->AddTask(tender); 
-
-    gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEMCALTender.C");
-    AliTender *tender = AddTaskEMCALTender( "EMCAL_COMPLETEV1", 0);
-    if(submit){
-      cout<<"Setting tender to run on grid"<<endl;
-      tender->SetDefaultCDBStorage("raw://"); //uncomment if you work on grid
-    }
-    else{
-      cout<<"Setting tender to run locally"<<endl;
-      tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB"); //uncomment if you work local
-    }
+    //this macro is downloaded from the EMCal tender supply twiki 
+    //hopefully it will be replaced by something checked in to aliroot
+    //I have added the function from GetOCDBRecParam.C in Jiri's example to this so that we don't add gobs of macros to the code
+    //I set the defaults to the golden run for PbPb because we are focusing on the golden run, however, this should be thought through!!
+    //AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance(geoname);
+
+    gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalSetup.C");
+    AliEmcalSetupTask *setupTask = AddTaskEmcalSetup();
+    setupTask->SetGeoPath("$ALICE_ROOT/OADB/EMCAL");
+    setupTask->SetOcdbPath(""); 
+
+//     gROOT->LoadMacro("AddTaskEMCALTenderForEtAnalysis.C");
+//     //cout<<"WARNING: YOU ARE USING CALIBRATION FACTORS FROM PbPb RUN 137161!!"<<endl;
+// //          // get reco params from grid OCDB
+// //    gROOT->LoadMacro("./GetOCDBRecParam.C");
+// //          // run num, data type pp/PbPb, from grid
+// //Gets calibration factors from grid if jobs are to be submitted to the grid
+// //          AliEMCALRecParam* pars = GetOCDBRecParam( 137161, "PbPb", submit);
+// //EMCAL_FIRSTYEARV1 F-
+//     //AliTender *tender = AddTaskEMCALTender( "EMCAL_COMPLETEV1", 0,withNonlinearity,withReclusterizing,trackmatchcuts);
+// AliTender *tender = AddTaskEMCALTender( "EMCAL_FIRSTYEARV1", 0,withNonlinearity,withReclusterizing,trackmatchcuts);
+//     //this also likely needs modification
+// //     tender->SelectCollisionCandidates( AliVEvent::kMB | AliVEvent::kEMCEGA | AliVEvent::kEMC1 | AliVEvent::kEMC7 );
+// //     if(submit){tender->SetDefaultCDBStorage("raw://");} //uncomment if you work on grid
+// //     else{tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB");} //uncomment if you work local
+
+//     if(submit){
+//       cout<<"Setting tender to run on grid"<<endl;
+//       tender->SetDefaultCDBStorage("raw://"); //uncomment if you work on grid
+//     }
+//     else{
+//       cout<<"Setting tender to run locally"<<endl;
+//       tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB"); //uncomment if you work local
+//     }
+
+
+    gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEMCALTender.C");//tendertasks
+    TString runPeriod = "LHC10h";
+  Bool_t distBC         = kTRUE;   //distance to bad channel
+  Bool_t recalibClus    = kTRUE;   //recalibrate cluster energy
+  Bool_t recalcClusPos  = kTRUE;   //recalculate cluster position
+  Bool_t nonLinearCorr  = kTRUE;   //apply non-linearity
+  Bool_t remExotic      = kTRUE;   //remove exotic cells
+  Bool_t fidRegion      = kTRUE;  //apply fiducial cuts -->  different from defaults
+  Bool_t calibEnergy    = kTRUE;   //calibrate energy
+  Bool_t calibTime      = kTRUE;   //calibrate timing
+  Bool_t remBC          = kTRUE;   //remove bad channels
+  UInt_t nonLinFunct    = AliEMCALRecoUtils::kBeamTestCorrected;
+  Bool_t reclusterize   = kFALSE;   //reclusterize --> different from defaults
+  Float_t seedthresh    = 0.100;   //seed threshold
+  Float_t cellthresh    = 0.050;   //cell threshold
+  UInt_t clusterizer    = AliEMCALRecParam::kClusterizerv2;
+  Bool_t trackMatch     = kTRUE;   //track matching
+  Bool_t updateCellOnly = kFALSE;  //only change if you run your own clusterizer task
+  Float_t timeMin       = 100e-9;  //minimum time of physical signal in a cell/digit (s)
+  Float_t timeMax       = 900e-9;  //maximum time of physical signal in a cell/digit (s)
+  Float_t timeCut       = 900e-9;  //maximum time difference between the digits inside EMC cluster (s)
+    const char *pass      = 0 ;       //string defining pass (use none if figured out from path)
+    //AliAnalysisTaskSE *tender = AddTaskEMCALTender();
+    AliAnalysisTaskSE *tender = AddTaskEMCALTender(distBC, recalibClus, recalcClusPos, nonLinearCorr, remExotic, 
+                                                  fidRegion, calibEnergy, calibTime, remBC, nonLinFunct, reclusterize, seedthresh, 
+                                                  cellthresh, clusterizer, trackMatch, updateCellOnly, timeMin, timeMax, timeCut);
+    
+
+
     // one can sellect what collision candidates to use
     // triggered sample only: L1 = AliVEvent::kEMCEGA, AliVEvent::kEMCEJE; L0 = AliVEvent::kEMC1, AliVEvent::kEMC7
     tender->SelectCollisionCandidates( AliVEvent::kAny );
+    //tender->SetDebugLevel(2);
 
     //AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("histosTrgContam", TList::Class(), AliAnalysisManager::kOutputContainer,"AnalysisResults.root");
     //mgr->ConnectOutput(tender,1,coutput3);
@@ -158,12 +370,40 @@ void runCaloEt(bool submit = false, // true or false
   AliPhysicsSelectionTask *physicsSelectionTask = AddTaskPhysicsSelection(isMc);//isMC is true when processing monte carlo
   if(isPb){     
     cout<<"Adding centrality selection task"<<endl;
-    gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
-    gROOT->ProcessLine(".L AliCentralitySelectionTask.cxx++g");
+    gROOT->ProcessLine(".L $ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
+    //gROOT->ProcessLine(".L AliCentralitySelectionTask.cxx++g");
     AliCentralitySelectionTask *centTask = AddTaskCentrality();
+    if(isMc){
+     cout<<"Setting up centrality for MC"<<endl;
+     centTask->SetMCInput();
+   }
+    else{
+     cout<<"Setting up centrality for data"<<endl;
+   }
   }
 
+  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+  //AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,
+//                                     Bool_t tuneOnData=kFALSE, Int_t recoPass=2,
+//                                     Bool_t cachePID=kFALSE, TString detResponse="",
+//                                     Bool_t useTPCEtaCorrection = kFALSE);
+//  AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,
+//                                  Bool_t tuneOnData=kFALSE, Int_t recoPass=2,
+//                                  Bool_t cachePID=kFALSE, TString detResponse="",
+//                                  Bool_t useTPCEtaCorrection = kTRUE,
+//                                  Bool_t useTPCMultiplicityCorrection = kFALSE
+//                                  Int_t  userDataRecoPass = -1)
 
+  AliAnalysisTask *taskPID;
+  if(submit){
+    taskPID=AddTaskPIDResponse(isMc);//,kTRUE,kTRUE,2,kFALSE,"",kTRUE,kFALSE,2);
+  }
+  else{
+    cout<<"Not submitting so forcing pass number locally so it doesn't crash"<<endl;
+    taskPID=AddTaskPIDResponse(isMc,kTRUE,kTRUE,2,kFALSE,"",kTRUE,kFALSE,2);
+  }
+  //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
+  //AddTaskPIDqa();
 
   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
 
@@ -173,6 +413,7 @@ void runCaloEt(bool submit = false, // true or false
 
   AliAnalysisTaskTotEt *task1 = new AliAnalysisTaskTotEt(taskName);
   task1->SetMcData(isMc);//necessary to tell the task to basically accept all MC events.
+  task1->SelectCollisionCandidates(AliVEvent::kMB ) ;
   mgr->AddTask(task1);