updating tender supply implementation
authorcnattras <cnattras@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 26 Apr 2012 17:02:25 +0000 (17:02 +0000)
committercnattras <cnattras@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 26 Apr 2012 17:02:25 +0000 (17:02 +0000)
PWGLF/totEt/macros/AddTaskEMCALTenderForEtAnalysis.C [new file with mode: 0644]
PWGLF/totEt/macros/runCaloEt.C

diff --git a/PWGLF/totEt/macros/AddTaskEMCALTenderForEtAnalysis.C b/PWGLF/totEt/macros/AddTaskEMCALTenderForEtAnalysis.C
new file mode 100644 (file)
index 0000000..77e37db
--- /dev/null
@@ -0,0 +1,174 @@
+// EMCal tender task adder
+// Author: Jiri Kral
+
+// Script to recover AliEMCALRecParam from OCDB
+// Author: Jiri Kral
+
+#if !defined(__CINT__)
+#include <TString.h>
+#include <TH2.h>
+#include <TF1.h>
+
+#include "AliRun.h"
+#include "AliCaloCalibPedestal.h"
+#include "AliEMCALGeoParams.h"
+#include "AliEMCALRecParam.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBId.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#endif
+
+
+
+AliTender *AddTaskEMCALTender(const char *geoname="EMCAL_COMPLETEV1", AliEMCALRecParam *pars = 0 )
+{
+  // Parameters: geoname = "EMCAL_FIRSTYEARV1" or "EMCAL_COMPLETEV1" or ""
+
+  // Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    ::Error("AddTaskEMCALTender", "No analysis manager to connect to.");
+    return NULL;
+  }  
+  
+  // Create the task and configure it.
+  //===========================================================================
+  AliTender* ana = new  AliTender("TenderTask");
+  
+  mgr->AddTask(ana);
+
+  // Adding EMCAL supply
+  AliEMCALTenderSupply *EMCALSupply=new AliEMCALTenderSupply("EMCALtender");  
+
+  EMCALSupply->SetEMCALGeometryName(geoname);  
+
+  // prepare the reco params ------------------------------------------------
+       if( pars == 0 ){
+               // you can write your reco params here to avoid loading them automatically
+               // from OCDB during execution time
+/*             AliEMCALRecParam *params = new AliEMCALRecParam();
+               // reclustering parameters
+               // use v1 for pp and v2 for PbPb
+               params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv2);
+               params->SetClusteringThreshold(0.1); // 100 MeV
+               params->SetMinECut(0.05); //50 MeV  
+               params->SetW0(4.5);
+               // you may want to enable the timing cut
+               params->SetTimeCut(1e6);// s
+               params->SetTimeMin(-1);
+               params->SetTimeMax(1e6);//s
+
+               EMCALSupply->SetRecParam(params);*/
+       }
+       else{
+               cout << "------- TENDER is using supplied reco params -------" << endl;
+               pars->Print( "reco" );
+               cout << "----------------------------------------------------" << endl;
+               EMCALSupply->SetRecParam(pars);
+       }
+
+  // prepare tender parameters ----------------------------------------------
+  EMCALSupply->SetDebugLevel( 0 );
+
+  // fiducial cut
+  EMCALSupply->SetNumberOfCellsFromEMCALBorder( 1 );
+
+  // nonlinearity
+  EMCALSupply->SetNonLinearityFunction( AliEMCALTenderSupply::kBeamTestCorrected );
+
+  // track matching parameters
+  //EMCALSupply->SetMass(0.139);
+  //EMCALSupply->SetStep(5);
+  EMCALSupply->SwitchOnCutEtaPhiSum(); 
+  EMCALSupply->SetRCut(0.025);
+  //EMCALSupply->SwitchOnCutEtaPhiSeparate();
+  //EMCALSupply->SetEtaCut(0.025);
+  //EMCALSupply->SetPhiCut(0.05);
+
+  // switches ---------------------------------------------------------------
+  EMCALSupply->SwitchOnBadCellRemove();
+  EMCALSupply->SwitchOnExoticCellRemove();
+  EMCALSupply->SwitchOnCalibrateEnergy();
+  EMCALSupply->SwitchOnCalibrateTime();
+  EMCALSupply->SwitchOnUpdateCell();
+  EMCALSupply->SwitchOnReclustering();
+  EMCALSupply->SwitchOnClusterBadChannelCheck();
+  EMCALSupply->SwitchOnClusterExoticChannelCheck();
+  EMCALSupply->SwitchOnCellFiducialRegion();
+  EMCALSupply->SwitchOnReCalibrateCluster();
+  EMCALSupply->SwitchOnRecalculateClusPos();
+  EMCALSupply->SwitchOnRecalShowerShape();
+  EMCALSupply->SwitchOnRecalDistBadChannel();
+  EMCALSupply->SwitchOnNonLinearityCorrection();
+  EMCALSupply->SwitchOnTrackMatch();
+  
+
+  ana->AddSupply(EMCALSupply);
+  // Create ONLY the output containers for the data produced by the task.
+  // Get and connect other common input/output containers via the manager as below
+  //==============================================================================
+//  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histosEmcalTender", TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s", AliAnalysisManager::GetCommonFileName()));
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("emcal_tender_event", AliESDEvent::Class(),
+                           AliAnalysisManager::kExchangeContainer,"emcal_tender");
+  
+  mgr->ConnectInput  (ana, 0, mgr->GetCommonInputContainer());
+  mgr->ConnectOutput (ana, 1, coutput1 );
+   
+  return ana;
+}
+
+AliEMCALRecParam* GetOCDBRecParam( Int_t runNum, char *datatype="pp", Bool_t grid=kTRUE ){
+
+       AliCDBManager *man;
+
+       AliEMCALRecParam *pars;
+       TObjArray *arr;
+       
+       if( grid ){
+               cout << "======= Will get reco params from OCDB on grid ============= " << endl;
+               if(!gGrid) {
+                       if (!TGrid::Connect("alien://")){
+                               cout << "Error: can't connect to grid" << endl;
+                               exit(1);
+                       }
+               }
+       }
+       else{
+               cout << "======= Will get reco params from local ODCB =============== " << endl;
+       }
+       
+       // created the OCDB manager
+       man = AliCDBManager::Instance();
+
+       // point it to local storage
+       // !!! careful, one must build an exact path of OCDB directories
+       // and store the file in those
+       // here "./OCDB/EMCAL/Calib/Pedestals/Run*.root) for masks
+       if( grid )
+               man->SetDefaultStorageFromRun( runNum );
+       else
+               man->SetDefaultStorage( "local://$ALICE_ROOT/OCDB" );
+       
+       // load the file data
+       arr = (TObjArray*)(man->Get("EMCAL/Calib/RecoParam", runNum)->GetObject());
+
+  if( !strcmp( datatype, "pp" ))
+               pars = (AliEMCALRecParam*)arr->FindObject( "Low Flux - p+p" );
+       else
+               pars = (AliEMCALRecParam*)arr->FindObject( "High Flux - Pb+Pb" );
+
+       // cleanup
+       arr->Clear();
+       delete arr;
+       man->ClearCache();
+       man->DestroyActiveStorages();
+       man->Destroy();
+
+       cout << "======= Reco parames retrieval finished ==================== " << endl;
+       
+       return pars;
+}
index 82070e8..e695787 100644 (file)
@@ -5,7 +5,7 @@
 //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="realPbPb", // "sim" or "real" etc.
               const char *pluginRunMode="test", // "test" or "full" or "terminate"
               const char *det = "EMCalDetail") // "PHOS" or "EMCAL"
 {
@@ -128,13 +128,25 @@ void runCaloEt(bool submit = false, // true or false
     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");
+    //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!!
+    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);
+
     AliTender *tender = AddTaskEMCALTender( "EMCAL_COMPLETEV1", 0);
+    //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
@@ -146,6 +158,7 @@ void runCaloEt(bool submit = false, // true or false
     // 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);