]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGGA/CaloTrackCorrelations/macros/ana.C
TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / macros / ana.C
index a989b95e41eac6d4f51b4e8ce69992056685f24a..f294fe9b2e7de40868760802e42a36607a6090f6 100644 (file)
@@ -23,14 +23,13 @@ enum anaModes {mLocal=0, mPROOF=1, mPlugin=2, mGRID=3};
 
 char * kInDir   = "/user/data/files/"; 
 char * kPattern = ""; // Data are in files kInDir/kPattern+i 
-Int_t  kFile    = 3
+Int_t  kFile    = 2
 
 //---------------------------------------------------------------------------
 // Dataset for proof analysis, mode=mPROOF
 // char * kDataset = "/alice/vernet/PbPb_LHC10h_ESD";
 
 char *  kDatasetPROOF     = "/alice/vernet/LHC11b_149646";
-//char *  kDatasetPROOF     = "/alice/vernet/LHC11b10a_AOD046";//LHC11d_AOD076
 Int_t   kDatasetNMaxFiles = 20;
 TString ccin2p3UserName   = "arbor" ;
 TString alienUserName     = "narbor" ;
@@ -45,7 +44,6 @@ char * kXML = "collection.xml";
 //Put name of file containing xsection 
 //Put number of events per ESD file
 //This is an specific case for normalization of Pythia files.
-const Bool_t kGetXSectionFromFileAndScale = kFALSE ;
 const char * kXSFileName = "pyxsec.root";
 
 //---------------------------------------------------------------------------
@@ -56,7 +54,7 @@ Bool_t  kMC        = kFALSE; //With real data kMC = kFALSE
 TString kInputData = "ESD"; //ESD, AOD, MC, deltaAOD
 Int_t   kYear      = 2011;
 TString kCollision = "pp";
-Bool_t  outAOD     = kTRUE; //Some tasks doesnt need it.
+Bool_t  outAOD     = kFALSE; //Some tasks doesnt need it.
 TString kTreeName;
 TString kPass      = "";
 char    kTrigger[1024];
@@ -96,6 +94,29 @@ void ana(Int_t mode=mGRID)
   TChain * chainxs = new TChain("Xsection") ;
   CreateChain(mode, chain, chainxs); 
   
+  Double_t scale = -1;
+  printf("===== kMC %d, chainxs %p\n",kMC,chainxs);
+  if(kMC && chainxs && chainxs->GetEntries() > 0)
+  {
+    Int_t nfiles = chainxs->GetEntries();
+    
+    //Get the cross section
+    Double_t xsection = 0; 
+    Float_t ntrials   = 0;
+    
+    GetAverageXsection(chainxs, xsection, ntrials);
+    
+    Int_t    nEventsPerFile = chain->GetEntries() / nfiles;
+    
+    Double_t trials = ntrials / nEventsPerFile ;
+    
+    scale = xsection/trials;
+    
+    printf("Get Cross section : nfiles  %d, nevents %d, nevents per file %d \n",nfiles, chain->GetEntries(),nEventsPerFile);     
+    printf("                    ntrials %d, trials %2.2f, xs %2.2e, scale factor %2.2e\n", ntrials,trials,xsection,scale);
+    
+  } 
+  
   printf("*********************************************\n");
   printf("number of entries # %lld, skipped %d\n", chain->GetEntries()) ;      
   printf("*********************************************\n");
@@ -187,38 +208,55 @@ void ana(Int_t mode=mGRID)
   //-------------------------------------------------------------------------
   
   // Physics selection
-  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); 
-  AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kMC); 
+  if(kInputData=="ESD")
+  {
+    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); 
+    AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kMC); 
+  }
   
   // Centrality
-  if(kCollision=="PbPb")
+  if(kCollision=="PbPb" && kInputData=="ESD")
   {
     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
     AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
   }
   
+  if(kCollision=="PbPb")
+  {
+    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C");
+    AliVZEROEPSelectionTask  * EPV0 = AddTaskVZEROEPSelection();  
+    
+    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskEventplane.C");
+    AliEPSelectionTask * EP = AddTaskEventplane();
+  }
+  
   // Simple event counting tasks
-  AddTaskCounter("");   // All
-  //AddTaskCounter("MB"); // Min Bias
-  AddTaskCounter("Any"); 
-  AddTaskCounter("AnyINT");// Min Bias
+  
+  gROOT->LoadMacro("$ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros/AddTaskCounter.C");   
 
+  AliAnalysisTask* count    = AddTaskCounter("");   // All
+  AliAnalysisTask* countmb  = AddTaskCounter("MB"); // Min Bias
+  AliAnalysisTask* countany = AddTaskCounter("Any"); 
+  AliAnalysisTask* countint = AddTaskCounter("AnyINT");// Min Bias
+  
   if(!kMC)
   {
-    AddTaskCounter("EMC1"); // Trig Th > 1.5 GeV approx
-    AddTaskCounter("EMC7"); // Trig Th > 4-5 GeV 
-    AddTaskCounter("EMCEGA"); 
-    AddTaskCounter("EMCEJE"); 
+    AliAnalysisTaskCounter* countemg = AddTaskCounter("EMCEGA"); 
+    AliAnalysisTaskCounter* countemj = AddTaskCounter("EMCEJE"); 
     if(kCollision=="PbPb")
     {
-      AddTaskCounter("Central"); 
-      AddTaskCounter("SemiCentral"); 
-      AddTaskCounter("PHOSPb"); 
+      AliAnalysisTaskCounter* countcen = AddTaskCounter("Central"); 
+      AliAnalysisTaskCounter* countsce = AddTaskCounter("SemiCentral"); 
+      AliAnalysisTaskCounter* countssce= AddTaskCounter("SemiOrCentral"); 
+      AliAnalysisTaskCounter* countphP = AddTaskCounter("PHOSPb"); 
     }
-    else AddTaskCounter("PHOS"); 
-
-  }
-    
+    else
+    {
+      AliAnalysisTaskCounter* countem1 = AddTaskCounter("EMC1"); // Trig Th > 1.5 GeV approx
+      AliAnalysisTaskCounter* countem7 = AddTaskCounter("EMC7"); // Trig Th > 4-5 GeV 
+      AliAnalysisTaskCounter* countphp = AddTaskCounter("PHOS"); 
+    }
+  }  
   // -----------------
   // Photon conversion
   // ----------------- 
@@ -245,15 +283,18 @@ void ana(Int_t mode=mGRID)
   gROOT->LoadMacro("AddTaskCaloTrackCorr.C");   // $ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros
   gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEMCALClusterize.C"); // $ALICE_ROOT/PWGGA/EMCALTasks/macros  
   
- // gROOT->LoadMacro("$ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C");  
- // AliAnalysisTaskCaloTrackCorrelation * qatask = AddTaskCalorimeterQA(kInputData,kYear,kPrint,kMC); 
+  //gROOT->LoadMacro("$ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C");  
+  //AliAnalysisTaskCaloTrackCorrelation * qatask = AddTaskCalorimeterQA(kInputData,kYear,kPrint,kMC); 
+  
+  //gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEMCALTriggerQA.C");  
+  //AliAnalysisTaskEMCALTriggerQA * qatrigtask = AddTaskEMCALTriggerQA(); 
   
   // Calibration, bad map ...
   
-  Bool_t calibEE = kTRUE; // It is set automatically, but here we force to use ir or not in any case
-  Bool_t calibTT = kTRUE; // It is set automatically, but here we force to use ir or not in any case
-  if(kRun < 122195 || (kRun > 126437 && kRun < 136851)) calibTT=kFALSE ; // Recalibration parameters not available for LHC10a,b,c,e,f,g
-  Bool_t badMap  = kTRUE; // It is set automatically, but here we force to use ir or not in any case  
+  Bool_t calibEE = kTRUE; // It is set automatically, but here we force to use it or not in any case
+  Bool_t calibTT = kTRUE; // It is set automatically, but here we force to use it or not in any case
+  if(kRun < 122195 || (kRun > 126437 && kRun < 136851) || kMC) calibTT=kFALSE ; // Recalibration parameters not available for LHC10a,b,c,e,f,g
+  Bool_t badMap  = kTRUE; // It is set automatically, but here we force to use it or not in any case  
   
   if(kCollision=="pp")
   {
@@ -261,28 +302,30 @@ void ana(Int_t mode=mGRID)
     printf("CONFIGURE ANALYSIS FOR PP COLLISIONS \n");
     printf("==================================== \n");
     
+    Bool_t  mixing    = kTRUE; // mixing in reader and hadron correlation, and pi0
     Bool_t  clTM      = kTRUE;
     Bool_t  reTM      = kFALSE; // Recalculate matches if not already done in clusterizer
     Bool_t  anTM      = kTRUE;  // Remove matched
     Bool_t  exo       = kTRUE;  // Remove exotic cells
+    Bool_t  clnonlin  = kTRUE;  // Apply non linearity (clusterization)
     Bool_t  annonlin  = kFALSE; // Apply non linearity (analysis)
     Int_t   minEcell  = 50;     // 50  MeV (10 MeV used in reconstruction)
     Int_t   minEseed  = 100;    // 100 MeV
     Int_t   dTime     = 0;      // default, 250 ns
-    Int_t   wTime     = 0;      // default 425 < T < 825 ns, careful if time calibration is on
+    Int_t   wTime     = 30;     // default 425 < T < 825 ns, careful if time calibration is on
     Int_t   unfMinE   = 15;     // Remove cells with less than 15 MeV from cluster after unfolding
     Int_t   unfFrac   = 1;      // Remove cells with less than 1% of cluster energy after unfolding
 
-    
     //Trigger
-    TString clTrigger   = "EMC7";   
+    TString clTrigger   = "";   
     TString anTrigger   = "EMC7";  
-    TString anTriggerPH = "PHS";   
+    
     if(kMC) 
     {
-      clTrigger = "";
-      anTrigger = "";
-      anTriggerPH = ""; 
+      clTrigger   = "";
+      anTrigger   = "";
+      dTime       = 0;      
+      wTime       = 0;    
     }
     
     Bool_t  selectEvents = kFALSE; // Select events depending on V0, pile-up and vertex quality
@@ -292,62 +335,79 @@ void ana(Int_t mode=mGRID)
     //Analysis with clusterizer V1
     
     TString arrayNameV1 = "";
-    AliAnalysisTaskEMCALClusterize * clv1 = AddTaskEMCALClusterize(kMC,exo,"V1",arrayNameV1,clTrigger, clTM,
+    
+    AliAnalysisTaskEMCALClusterize * clv1 = AddTaskEMCALClusterize(arrayNameV1,outAOD,kMC,exo,"V1",clTrigger, clTM,
                                                                    minEcell,minEseed,dTime,wTime,unfMinE,unfFrac,
-                                                                   calibEE,badMap,calibTT,annonlin);    
+                                                                   calibEE,badMap,calibTT,clnonlin);    
     
     printf("Name of clusterizer1 array: %s\n",arrayNameV1.Data());
     
-    AliAnalysisTaskCaloTrackCorrelation *anav1   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
-                                                                        kYear,kCollision,anTrigger,arrayNameV1,reTM,anTM, 
-                                                                        -1,-1, qa, hadron,calibEE,badMap,calibTT,deltaAOD,kPrint);
+    if(!kMC)
+    {
+      
+      AliAnalysisTaskCaloTrackCorrelation *anav1trig   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                              kYear,kCollision,anTrigger,arrayNameV1,mixing,reTM,anTM,
+                                                                              -1,-1, qa, hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+    }
+    
+    AliAnalysisTaskCaloTrackCorrelation *anav1mb     = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                            kYear,kCollision,"AnyINT",arrayNameV1,mixing,reTM,anTM,
+                                                                            -1,-1, qa, hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+    
+    
     
     //Analysis with clusterizer V2
     TString arrayNameV2 = "";
-    AliAnalysisTaskEMCALClusterize * clv2 = AddTaskEMCALClusterize(kMC,exo,"V2",arrayNameV2,clTrigger, clTM,
-                                                                   minEcell,minEseed,dTime,wTime,unfMinE,unfFrac,
-                                                                   calibEE,badMap,calibTT,annonlin);    
-
+    AliAnalysisTaskEMCALClusterize * clv2 = AddTaskEMCALClusterize(arrayNameV2,outAOD,kMC,exo,"V2",clTrigger, clTM,
+                                                                   minEcell,minEseed,dTime,wTime,
+                                                                   calibEE,badMap,calibTT,clnonlin);    
+    
     printf("Name of clusterizer2 array: %s\n",arrayNameV2.Data());
     
     hadron = kFALSE;
-    AliAnalysisTaskCaloTrackCorrelation *anav2   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
-                                                                        kYear,kCollision,anTrigger,arrayNameV2,reTM,anTM, 
-                                                                        -1,-1,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint);
-
-  // PHOS  
-
-  //AliAnalysisTaskCaloTrackCorrelation *anaPH   = AddTaskCaloTrackCorr(kInputData, "PHOS", kMC, selectEvents, kFALSE, kFALSE, outputFile.Data(),  
-  //                                                                      kYear,kCollision,anTriggerPH,"",kFALSE,kFALSE,  
-  //                                                                      -1,-1, qa, kFALSE,kFALSE,kFALSE,kFALSE,deltaAOD,kPrint); 
-
+    if(!kMC)
+    {
+      
+      
+      AliAnalysisTaskCaloTrackCorrelation *anav2tr   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                            kYear,kCollision,anTrigger,arrayNameV2,mixing,reTM,anTM, 
+                                                                            -1,-1,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+    }
+    
+    
+    AliAnalysisTaskCaloTrackCorrelation *anav2mb     = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                            kYear,kCollision,"AnyINT",arrayNameV2,mixing,reTM,anTM,
+                                                                            -1,-1, qa, hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
   }
-
+  
   if(kCollision=="PbPb")
   {
     printf("====================================== \n");
     printf("CONFIGURE ANALYSIS FOR PbPb COLLISIONS \n");
     printf("====================================== \n");
-    
+    Bool_t  mixing    = kTRUE; 
     Bool_t  clTM      = kTRUE;
     Bool_t  reTM      = kFALSE; // Recalculate matches if not already done in clusterizer
     Bool_t  anTM      = kTRUE;  // Remove matched
     Bool_t  exo       = kTRUE;  // Remove exotic cells
+    Bool_t  clnonlin  = kTRUE;  // Apply non linearity (clusterization)
     Bool_t  annonlin  = kFALSE; // Apply non linearity (analysis)
-    Int_t   minEcell  = 100;    // 50  MeV (10 MeV used in reconstruction)
-    Int_t   minEseed  = 200;    // 100 MeV
+    Int_t   minEcell  = 150;    // 50  MeV (10 MeV used in reconstruction)
+    Int_t   minEseed  = 300;    // 100 MeV
     Int_t   dTime     = 0;      // default, 250 ns
     Int_t   wTime     = 0;      // default 425 < T < 825 ns
     Int_t   unfMinE   = 15;     // Remove cells with less than 15 MeV from cluster after unfolding
     Int_t   unfFrac   = 1;      // Remove cells with less than 1% of cluster energy after unfolding
-
+    
     // Trigger
-    TString clTrigger = "EMCGA"; 
+    TString clTrigger = ""; 
     TString anTrigger = "EMCGA";  
     if(kMC) 
     {
       clTrigger = "";
       anTrigger = "";
+      dTime       = 0;      
+      wTime       = 0;    
     }
     
     Bool_t  selectEvents = kFALSE; // Select events depending on V0, pile-up and vertex quality
@@ -357,45 +417,65 @@ void ana(Int_t mode=mGRID)
     //Analysis with clusterizer V1
     
     TString arrayNameV1 = "";
-    AliAnalysisTaskEMCALClusterize * clv1 = AddTaskEMCALClusterize(kMC,exo,"V1",arrayNameV1,clTrigger, clTM,
+    AliAnalysisTaskEMCALClusterize * clv1 = AddTaskEMCALClusterize(arrayNameV1,outAOD,kMC,exo,"V1",clTrigger, clTM,
                                                                    minEcell,minEseed,dTime,wTime,unfMinE,unfFrac,
-                                                                   calibEE,badMap,calibTT,annonlin);    
-    
+                                                                   calibEE,badMap,calibTT,clnonlin);    
     
     printf("Name of clusterizer1 array: %s\n",arrayNameV1.Data());
     
-    AliAnalysisTaskCaloTrackCorrelation *anav1c   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
-                                                                         kYear,kCollision,anTrigger,arrayNameV1,reTM,anTM, 
-                                                                         0,20,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint);
-    AliAnalysisTaskCaloTrackCorrelation *anav1m   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
-                                                                        kYear,kCollision,anTrigger,arrayNameV1,reTM,anTM,
-                                                                         20,40,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint);
-    AliAnalysisTaskCaloTrackCorrelation *anav1p   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC,  selectEvents, exo, annonlin, outputFile.Data(), 
-                                                                        kYear,kCollision,anTrigger,arrayNameV1,reTM,anTM,
-                                                                         60,80,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint);
-  
+    if(!kMC)
+    {
+      AliAnalysisTaskCaloTrackCorrelation *anav1c   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                           kYear,kCollision,anTrigger,arrayNameV1,mixing,reTM,anTM, 
+                                                                           0,20,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+      AliAnalysisTaskCaloTrackCorrelation *anav1m   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                           kYear,kCollision,anTrigger,arrayNameV1,mixing,reTM,anTM,
+                                                                           20,40,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+      AliAnalysisTaskCaloTrackCorrelation *anav1p   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC,  selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                           kYear,kCollision,anTrigger,arrayNameV1,mixing,reTM,anTM,
+                                                                           60,80,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+    }
+    
     //Analysis with clusterizer V2
-
+    
     TString arrayNameV2 = "";
-    AliAnalysisTaskEMCALClusterize * clv2 = AddTaskEMCALClusterize(kMC,exo,"V2",arrayNameV2,clTrigger, clTM,
+    AliAnalysisTaskEMCALClusterize * clv2 = AddTaskEMCALClusterize(arrayNameV2,outAOD,kMC,exo,"V2",clTrigger, clTM,
                                                                    minEcell,minEseed,dTime,wTime,unfMinE,unfFrac,
-                                                                   calibEE,badMap,calibTT,annonlin);        
+                                                                   calibEE,badMap,calibTT,clnonlin);        
     
     printf("Name of clusterizer2 array: %s\n",arrayNameV2.Data());
     
     hadron = kFALSE;
     
-    AliAnalysisTaskCaloTrackCorrelation *anav2c   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
-                                                                         kYear,kCollision,anTrigger,arrayNameV2,reTM,anTM, 
-                                                                         0,20,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint);
-    AliAnalysisTaskCaloTrackCorrelation *anav2m   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
-                                                                         kYear,kCollision,anTrigger,arrayNameV2,reTM,anTM,
-                                                                         20,40,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint);
-    AliAnalysisTaskCaloTrackCorrelation *anav2p   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
-                                                                         kYear,kCollision,anTrigger,arrayNameV2,reTM,anTM,
-                                                                         60,80,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint);
+    if(!kMC)
+    {
+      
+      AliAnalysisTaskCaloTrackCorrelation *anav2cT   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                            kYear,kCollision,anTrigger,arrayNameV2,mixing,reTM,anTM, 
+                                                                            0,20,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+      AliAnalysisTaskCaloTrackCorrelation *anav2mT   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                            kYear,kCollision,anTrigger,arrayNameV2,mixing,reTM,anTM,
+                                                                            20,40,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+      AliAnalysisTaskCaloTrackCorrelation *anav2pT   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                            kYear,kCollision,anTrigger,arrayNameV2,mixing,reTM,anTM,
+                                                                            60,80,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+    }
+    
+    AliAnalysisTaskCaloTrackCorrelation *anav2cMB   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                           kYear,kCollision,"AnyINT",arrayNameV2,mixing,reTM,anTM, 
+                                                                           0,20,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+    AliAnalysisTaskCaloTrackCorrelation *anav2mMB   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                           kYear,kCollision,"AnyINT",arrayNameV2,mixing,reTM,anTM,
+                                                                           20,40,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+    AliAnalysisTaskCaloTrackCorrelation *anav2pMB   = AddTaskCaloTrackCorr(kInputData, "EMCAL", kMC, selectEvents, exo, annonlin, outputFile.Data(), 
+                                                                           kYear,kCollision,"AnyINT",arrayNameV2,mixing,reTM,anTM,
+                                                                           60,80,qa,hadron,calibEE,badMap,calibTT,deltaAOD,kPrint,scale,kRun);
+    
+    
   }
   
+
+  
   //-----------------------
   // Run the analysis
   //-----------------------    
@@ -417,7 +497,7 @@ void  LoadLibraries(Int_t mode)
   if (mode == mPROOF) {
     //TProof::Mgr("ccalpmaster")->SetROOTVersion("ALICE_v5-27-06b");
     gROOT->LoadMacro("/afs/in2p3.fr/group/alice/laf/EnableAliRootForLAF.C");
-    TProof* proof = EnableAliRootForLAF("ccaplmaster",nPROOFWorkers.Data(),ccin2p3UserName.Data(),alienUserName.Data(),"",kFALSE,kTRUE,kTRUE,"OADB:ANALYSIS:ANALYSISalice:AOD:ESD:CORRFW:STEERBase:EMCALUtils:PHOSUtils:PWGCaloTrackCorrBase:PWGGACaloTrackCorrelations:PWGGAEMCALTasks");
+    TProof* proof = EnableAliRootForLAF("ccaplmaster",nPROOFWorkers.Data(),ccin2p3UserName.Data(),alienUserName.Data(),"",kFALSE,kTRUE,kTRUE,"OADB:ANALYSIS:ANALYSISalice:AOD:ESD:CORRFW:STEERBase:EMCALUtils:PHOSUtils:PWGCaloTrackCorrBase:PWGGACaloTrackCorrelations:PWGEMCAL:PWGGAEMCALTasks");
     
     //  TProof* proof = TProof::Open("ccaplmaster",Form("workers=%s",nPROOFWorkers.Data()));
     
@@ -434,6 +514,7 @@ void  LoadLibraries(Int_t mode)
     //     proof->UploadPackage("EMCALUtils");
     //     proof->UploadPackage("PWGCaloTrackCorrBase");
     //     proof->UploadPackage("PWGGACaloTrackCorrelations");
+    //     proof->UploadPackage("PWGEMCAL");
     //     proof->UploadPackage("PWGGAEMCALTasks");
     
     //     proof->EnablePackage("STEERBase");
@@ -448,6 +529,7 @@ void  LoadLibraries(Int_t mode)
     //     proof->EnablePackage("EMCALUtils");
     //     proof->EnablePackage("PWGCaloTrackCorrBase");
     //     proof->EnablePackage("PWGGACaloTrackCorrelations");
+    //     proof->EnablePackage("PWGEMCAL");
     //     proof->EnablePackage("PWGGAEMCALTasks");
     return;
   }  
@@ -455,30 +537,32 @@ void  LoadLibraries(Int_t mode)
   //--------------------------------------
   // Load the needed libraries most of them already loaded by aliroot
   //--------------------------------------
-  gSystem->Load("libTree.so");
-  gSystem->Load("libGeom.so");
-  gSystem->Load("libVMC.so");
-  gSystem->Load("libXMLIO.so");
-  gSystem->Load("libMatrix.so");
-  gSystem->Load("libPhysics.so");
-  gSystem->Load("libMinuit.so"); // Root + libraries to if reclusterization is done
-  
-  gSystem->Load("libSTEERBase.so");
-  gSystem->Load("libGui.so"); // Root + libraries to if reclusterization is done
-  gSystem->Load("libCDB.so"); // Root + libraries to if reclusterization is done
-  gSystem->Load("libESD.so"); // Root + libraries to if reclusterization is done
-  gSystem->Load("libAOD.so");
-  gSystem->Load("libRAWDatabase.so"); // Root + libraries to if reclusterization is done
-  gSystem->Load("libProof.so"); 
+  gSystem->Load("libTree");
+  gSystem->Load("libGeom");
+  gSystem->Load("libVMC");
+  gSystem->Load("libXMLIO");
+  gSystem->Load("libMatrix");
+  gSystem->Load("libPhysics");
+  gSystem->Load("libMinuit"); // Root + libraries to if reclusterization is done
+  
+  gSystem->Load("libSTEERBase");
+  gSystem->Load("libGui"); // Root + libraries to if reclusterization is done
+  gSystem->Load("libCDB"); // Root + libraries to if reclusterization is done
+  gSystem->Load("libESD"); // Root + libraries to if reclusterization is done
+  gSystem->Load("libAOD");
+  gSystem->Load("libRAWDatabase"); // Root + libraries to if reclusterization is done
+  gSystem->Load("libProof"); 
   gSystem->Load("libOADB");
-  gSystem->Load("libANALYSIS.so");
-  gSystem->Load("libSTEER.so"); // Root + libraries to if reclusterization is done
-  
-  gSystem->Load("libRAWDatarec.so"); // Root + libraries to if reclusterization is done
-  gSystem->Load("libRAWDatasim.so"); // Root + libraries to if reclusterization is done
-  gSystem->Load("libVZERObase.so");  // Root + libraries to if reclusterization is done
-  gSystem->Load("libVZEROrec.so");   // Root + libraries to if reclusterization is done
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libSTEER"); // Root + libraries to if reclusterization is done
   
+  gSystem->Load("libRAWDatarec"); // Root + libraries to if reclusterization is done
+  gSystem->Load("libRAWDatasim"); // Root + libraries to if reclusterization is done
+  gSystem->Load("libVZERObase");  // Root + libraries to if reclusterization is done
+  gSystem->Load("libVZEROrec");   // Root + libraries to if reclusterization is done
+
+  gSystem->Load("libPHOSUtils");
+
   gSystem->Load("libEMCALUtils");
   //SetupPar("EMCALUtils");
   gSystem->Load("libEMCALraw");  // Root + libraries to if reclusterization is done
@@ -490,26 +574,31 @@ void  LoadLibraries(Int_t mode)
   //SetupPar("EMCALsim");
   //SetupPar("EMCALrec");
   
-  gSystem->Load("libANALYSISalice.so");
-  //gSystem->Load("libTENDER.so"); 
-  //gSystem->Load("libTENDERSupplies.so");
+  gSystem->Load("libANALYSISalice");
+  gSystem->Load("libESDfilter");
+
+  gSystem->Load("libTender");
+  gSystem->Load("libTenderSupplies");
+  
+  gSystem->Load("libCORRFW");
+  gSystem->Load("libPWGTools");
+
+  gSystem->Load("libPWGEMCAL");
+  gSystem->Load("libPWGGAEMCALTasks");
+  //SetupPar("PWGEMCAL");
+  //SetupPar("PWGGAEMCALTasks");
   
-  gSystem->Load("libPHOSUtils");
-  gSystem->Load("libEMCALUtils");
   gSystem->Load("libPWGCaloTrackCorrBase");
   gSystem->Load("libPWGGACaloTrackCorrelations");
-  gSystem->Load("libPWGGAEMCALTasks");
   //SetupPar("PWGCaloTrackCorrBase");
   //SetupPar("PWGGACaloTrackCorrelations");
-  //SetupPar("PWGGAEMCALTasks");
-  
  
   //gSystem->Load("libJETAN");
   //gSystem->Load("FASTJETAN");
   //gSystem->Load("PWGJE");
 
-  //gSystem->Load("libCORRFW.so");
-  //gSystem->Load("libPWGGAGammaConv.so"); 
+  //gSystem->Load("libCORRFW");
+  //gSystem->Load("libPWGGAGammaConv"); 
   //SetupPar("PWGGAGammaConv"); 
   
   // needed for plugin?
@@ -679,8 +768,8 @@ void CheckInputData(const anaModes mode)
     else cout<<"XML file "<<kXML<<endl;
     
     //Load necessary libraries and connect to the GRID
-    gSystem->Load("libNetx.so") ; 
-    gSystem->Load("libRAliEn.so"); 
+    gSystem->Load("libNetx") ; 
+    gSystem->Load("libRAliEn"); 
     TGrid::Connect("alien://") ;
     
     //Feed Grid with collection file
@@ -935,48 +1024,6 @@ void CreateChain(const anaModes mode, TChain * chain, TChain * chainxs)
   
 }
 
-//_________________________________________________________________
-void GetAverageXsection(TTree * tree, Double_t & xs, Float_t & ntr)
-{
-  // Read the PYTHIA statistics from the file pyxsec.root created by
-  // the function WriteXsection():
-  // integrated cross section (xsection) and
-  // the  number of Pyevent() calls (ntrials)
-  // and calculate the weight per one event xsection/ntrials
-  // The spectrum calculated by a user should be
-  // multiplied by this weight, something like this:
-  // TH1F *userSpectrum ... // book and fill the spectrum
-  // userSpectrum->Scale(weight)
-  //
-  // Yuri Kharlov 19 June 2007
-  // Gustavo Conesa 15 April 2008
-  Double_t xsection = 0;
-  UInt_t    ntrials = 0;
-  xs = 0;
-  ntr = 0;
-  
-  Int_t nfiles =  tree->GetEntries()  ;
-  if (tree && nfiles > 0) 
-  {
-    tree->SetBranchAddress("xsection",&xsection);
-    tree->SetBranchAddress("ntrials",&ntrials);
-    for(Int_t i = 0; i < nfiles; i++){
-      tree->GetEntry(i);
-      xs += xsection ;
-      ntr += ntrials ;
-      cout << "xsection " <<xsection<<" ntrials "<<ntrials<<endl; 
-    }
-    
-    xs =   xs /  nfiles;
-    ntr =  ntr / nfiles;
-    cout << "-----------------------------------------------------------------"<<endl;
-    cout << "Average of "<< nfiles<<" files: xsection " <<xs<<" ntrials "<<ntr<<endl; 
-    cout << "-----------------------------------------------------------------"<<endl;
-  } 
-  else cout << " >>>> Empty tree !!!! <<<<< "<<endl;
-  
-}
-
 //______________________________
 void CheckEnvironmentVariables()
 {
@@ -1048,92 +1095,44 @@ void CheckEnvironmentVariables()
   
 }
 
-//_______________________________________________
-void AddTaskCounter(const TString trigger = "MB")
+//_________________________________________________________________
+void GetAverageXsection(TTree * tree, Double_t & xs, Float_t & ntr)
 {
+  // Read the PYTHIA statistics from the file pyxsec.root created by
+  // the function WriteXsection():
+  // integrated cross section (xsection) and
+  // the  number of Pyevent() calls (ntrials)
+  // and calculate the weight per one event xsection/ntrials
+  // The spectrum calculated by a user should be
+  // multiplied by this weight, something like this:
+  // TH1F *userSpectrum ... // book and fill the spectrum
+  // userSpectrum->Scale(weight)
+  //
+  // Yuri Kharlov 19 June 2007
+  // Gustavo Conesa 15 April 2008
+  Double_t xsection = 0;
+  UInt_t    ntrials = 0;
+  xs = 0;
+  ntr = 0;
   
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-  
-  AliAnalysisTaskCounter * counter =  new AliAnalysisTaskCounter(Form("Counter%s",trigger.Data()));
-  if(kRun > 140000 && kRun < 146900) counter ->RejectFastCluster();
-  if     (kCollision=="pp"  )   counter->SetZVertexCut(50.);  //Open cut
-  else if(kCollision=="PbPb")   counter->SetZVertexCut(10.);  //Centrality defined in this range.
-  
-  if(trigger=="EMC7")
-  {
-    printf("counter trigger EMC7\n");
-    counter->SelectCollisionCandidates(AliVEvent::kEMC7);
-  }
-  else if (trigger=="INT7")
-  {
-    printf("counter trigger INT7\n");
-    counter->SelectCollisionCandidates(AliVEvent::kINT7);
-  }
-  if(trigger=="EMC1")
-  {
-    printf("counter trigger EMC1\n");
-    counter->SelectCollisionCandidates(AliVEvent::kEMC1);
-  }
-  else if(trigger=="MB")
-  {
-    printf("counter trigger MB\n");
-    counter->SelectCollisionCandidates(AliVEvent::kMB);
-  }
-  else if(trigger=="PHOS")
-  {
-    printf("counter trigger PHOS\n");
-    counter->SelectCollisionCandidates(AliVEvent::kPHI7);
-  }
-  else if(trigger=="PHOSPb")
-  {
-    printf("counter trigger PHOSPb\n");
-    counter->SelectCollisionCandidates(AliVEvent::kPHOSPb);
-  }
-  else if(trigger=="AnyINT")
-  {
-    printf("counter trigger AnyINT\n");
-    counter->SelectCollisionCandidates(AliVEvent::kAnyINT);
-  }  
-  else if(trigger=="INT")
-  {
-    printf("counter trigger AnyINT\n");
-    counter->SelectCollisionCandidates(AliVEvent::kAny);
-  }
-  else if(trigger=="EMCEGA")
-  {
-    printf("counter trigger EMC Gamma\n");
-    counter->SelectCollisionCandidates(AliVEvent::kEMCEGA);
-  } 
-  else if(trigger=="EMCEJE")
-  {
-    printf("counter trigger EMC Jet\n");
-    counter->SelectCollisionCandidates(AliVEvent::kEMCEJE);
-  }
-  else if(trigger=="Central")
-  {
-    printf("counter trigger Central\n");
-    counter->SelectCollisionCandidates(AliVEvent::kCentral);
+  Int_t nfiles =  tree->GetEntries()  ;
+  if (tree && nfiles > 0) {
+    tree->SetBranchAddress("xsection",&xsection);
+    tree->SetBranchAddress("ntrials" ,&ntrials );
+    for(Int_t i = 0; i < nfiles; i++){
+      tree->GetEntry(i);
+      xs  += xsection ;
+      ntr += ntrials ;
+      cout << "xsection " <<xsection<<" ntrials "<<ntrials<<endl; 
+    }
+    
+    xs =   xs /  nfiles;
+    ntr =  ntr / nfiles;
+    cout << "-----------------------------------------------------------------"<<endl;
+    cout << "Average of "<< nfiles<<" files: xsection " <<xs<<" ntrials "<<ntr<<endl; 
+    cout << "-----------------------------------------------------------------"<<endl;
   } 
-  else if(trigger=="SemiCentral")
-  {
-    printf("counter trigger SemiCentral\n");
-    counter->SelectCollisionCandidates(AliVEvent::kSemiCentral);
-  }
-  
-  
-  
-  TString outputFile = AliAnalysisManager::GetCommonFileName(); 
-  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
-  
-  AliAnalysisDataContainer *coutput = 
-  mgr->CreateContainer(Form("Counter%s",trigger.Data()), TList::Class(), AliAnalysisManager::kOutputContainer,  outputFile.Data());
-  mgr->AddTask(counter);
-  mgr->ConnectInput  (counter, 0, cinput1);
-  mgr->ConnectOutput (counter, 1, coutput);
+  else cout << " >>>> Empty tree !!!! <<<<< "<<endl;
   
 }
 
-
-
-
-