Updated macros for pass0 (Jacek)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 14 Oct 2010 07:18:23 +0000 (07:18 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 14 Oct 2010 07:18:23 +0000 (07:18 +0000)
13 files changed:
ANALYSIS/CalibMacros/Pass0/AddTaskTPCCalib.C
ANALYSIS/CalibMacros/Pass0/AddTaskTRDCalib.C [new file with mode: 0644]
ANALYSIS/CalibMacros/Pass0/ConfigCalibTrain.C
ANALYSIS/CalibMacros/Pass0/LoadLibraries.C
ANALYSIS/CalibMacros/Pass0/Pass0.jdl
ANALYSIS/CalibMacros/Pass0/makeOCDB.C [new file with mode: 0644]
ANALYSIS/CalibMacros/Pass0/merge.C [new file with mode: 0644]
ANALYSIS/CalibMacros/Pass0/mergeMakeOCDB.jdl [new file with mode: 0644]
ANALYSIS/CalibMacros/Pass0/mergeMakeOCDB.sh [new file with mode: 0755]
ANALYSIS/CalibMacros/Pass0/recPass0.C
ANALYSIS/CalibMacros/Pass0/runCalibTrain.C
ANALYSIS/CalibMacros/Pass0/runPass0.sh
ANALYSIS/CalibMacros/Pass0/validationMerging.sh [new file with mode: 0755]

index 25e8e0e..e23d687 100644 (file)
@@ -1,56 +1,57 @@
-//=============================================================================
-//
-// *** AddTaskTPCCalib
-//
-// This macros setup the TPC calibration task
-//
-//=============================================================================
+/*
 
+ This macros setup the TPC calibration task AddTaskTPCCalib
+ for Pass0.
+ - the run number is required to config TPC OCDB
+ The following calibration components are added to the AliTPCAnalysisTaskcalib task:
+ 1. AliTPCcalibCalib - redo reconstruction with current calibration
+ 2. AliTPCcalibTimeGain - TPC time dependent gain calibration
+ 3. AliTPCcalibTime - TPC time dependent drift time calibration
+ 4. AliTPCcalibLaser - laser track calibration
 
+*/
 
-
-Int_t debugLevel  = 2;
-Int_t streamLevel = 20;
-TTimeStamp startTime(2010,2,1,0,0,0);
-TTimeStamp stopTime(2010,12,31,0,0,0);
-char * prefix = "/V6/";
-
+// function to set TPC OCDB parameters
 void ConfigOCDB(Int_t crun);
 
+//_____________________________________________________________________________
 AliAnalysisTask  *AddTaskTPCCalib(Int_t runNumber)
 {
-  gSystem->Load("libTPCcalib");
-  // pointer to the analysis manager
+  //
+  // add calibration task
+  //
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
-    Error("AddTaskTPCCalib", "No analysis manager to connect to.");
+    ::Error("AddTaskTPCCalib", "No analysis manager to connect to.");
     return NULL;
   }  
   
   // check the input handler
   if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTask", "This task requires an input event handler");
+    ::Error("AddTaskTPCCalib", "This task requires an input event handler");
     return NULL;
   }  
+
+  // set TPC OCDB parameters
   ConfigOCDB(runNumber);
+
+  // setup task
   AliTPCAnalysisTaskcalib *task1=new AliTPCAnalysisTaskcalib("CalibObjectsTrain1");
-  //
   SetupCalibTaskTrain1(task1);
   mgr->AddTask(task1);
+
   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
-  
   if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
                                       AliAnalysisManager::kInputContainer);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("TPCCalib",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
 
-  AliAnalysisDataContainer *coutput1 =mgr->CreateContainer("TPCCalib",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
   mgr->ConnectInput(task1,0,cinput1);
   mgr->ConnectOutput(task1,0,coutput1);
   return task1;
 }
 
-
-
-
+//_____________________________________________________________________________
 void AddCalibCalib(TObject* task){
   //
   // Responsible: Marian Ivanov
@@ -60,44 +61,99 @@ void AddCalibCalib(TObject* task){
   //
   AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
   AliTPCcalibCalib *calibCalib = new AliTPCcalibCalib("calibTPC","calibTPC");
-  calibCalib->SetDebugLevel(debugLevel);
-  calibCalib->SetStreamLevel(streamLevel);
+  calibCalib->SetDebugLevel(0);
+  calibCalib->SetStreamLevel(0);
   calibCalib->SetTriggerMask(-1,-1,kFALSE);        //accept everything 
   myTask->AddJob(calibCalib);
-
 }
+
+//_____________________________________________________________________________
 void AddCalibTimeGain(TObject* task, Bool_t isCosmic = kFALSE, char * name = "calibTimeGain"){
   //
   //  Responsible: Alexander Kalweit
-  //  Description:
-  //  Parameters to set
+  //  Description: Time Gain calibration
+  //
+
+  // Set run time ranges (time stamps)
+  AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data");
+  if(!entry) { 
+    ::Error("AddCalibTimeGain","Cannot get AliCDBEntry");
+    return;
+  }
+  const AliGRPObject* grpData = dynamic_cast<AliGRPObject*>(entry->GetObject());
+  if(!grpData) { 
+    ::Error("AddCalibTimeGain","Cannot get AliGRPObject");
+    return;
+  }
+  time_t sTime = grpData->GetTimeStart(); 
+  time_t eTime = grpData->GetTimeEnd(); 
+  TTimeStamp startRunTime(sTime);
+  TTimeStamp stopRunTime(eTime);
+
+  UInt_t year;
+  startRunTime.GetDate(kTRUE,0,&year);
+  TTimeStamp startTime(year,1,1,0,0,0);
+  TTimeStamp stopTime(year,12,31,23,59,59);
+
+  // 
+  // setup calibration component
+  //
   AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
-  AliTPCcalibTimeGain *calibTimeGain = new AliTPCcalibTimeGain(name,"calibTimeGain", startTime.GetSec(), stopTime.GetSec(), 30*60);
-  //calibTimeGain->SetLowMemoryConsumption(kTRUE);
-  //calibTimeGain->SetMIP(25.);
+  AliTPCcalibTimeGain *calibTimeGain = new AliTPCcalibTimeGain(name,"calibTimeGain", startTime.GetSec(), stopTime.GetSec(), 10*60);
   calibTimeGain->SetIsCosmic(isCosmic);
   calibTimeGain->SetUseCookAnalytical(kTRUE);
   calibTimeGain->SetUseMax(kFALSE);
-  calibTimeGain->SetDebugLevel(debugLevel);
-  calibTimeGain->SetStreamLevel(streamLevel);
+  calibTimeGain->SetDebugLevel(0);
+  calibTimeGain->SetStreamLevel(0);
   calibTimeGain->SetTriggerMask(-1,-1,kTRUE);        //reject laser
+  calibTimeGain->SetLowerTrunc(0.02);
+  calibTimeGain->SetUpperTrunc(0.6);
+
   myTask->AddJob(calibTimeGain);
 }
 
+//_____________________________________________________________________________
 void AddCalibTime(TObject* task){
   //
   // Responsible: Dag Larsen
-  // Description:
-  //
+  // Description: Time V drift calibration
+  //
+
+  // Set run time ranges (time stamps)
+  AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data");
+  if(!entry) { 
+    ::Error("AddCalibTime","Cannot get AliCDBEntry");
+    return;
+  }
+  const AliGRPObject* grpData = dynamic_cast<AliGRPObject*>(entry->GetObject());
+  if(!grpData) { 
+    ::Error("AddCalibTime","Cannot get AliGRPObject");
+    return;
+  }
+  time_t sTime = grpData->GetTimeStart(); 
+  time_t eTime = grpData->GetTimeEnd(); 
+
+  TTimeStamp startRunTime(sTime);
+  TTimeStamp stopRunTime(eTime);
+
+  UInt_t year;
+  startRunTime.GetDate(kTRUE,0,&year);
+  TTimeStamp startTime(year,1,1,0,0,0);
+  TTimeStamp stopTime(year,12,31,23,59,59);
+
+  // 
+  // setup calibration component
   //
   AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
-  AliTPCcalibTime *calibTime = new AliTPCcalibTime("calibTime","calibTime",  startTime.GetSec(), stopTime.GetSec(), 20*60);
-  calibTime->SetDebugLevel(debugLevel);
-  calibTime->SetStreamLevel(streamLevel);
+  AliTPCcalibTime *calibTime = new AliTPCcalibTime("calibTime","calibTime",  startTime.GetSec(), stopTime.GetSec(), 10*60);
+  calibTime->SetDebugLevel(0);
+  calibTime->SetStreamLevel(0);
   calibTime->SetTriggerMask(-1,-1,kFALSE);        //accept everything 
+
   myTask->AddJob(calibTime);
 }
 
+//_____________________________________________________________________________
 void AddCalibLaser(TObject* task){
   //
   // Responsible: Marian Ivanov
@@ -105,67 +161,29 @@ void AddCalibLaser(TObject* task){
   //
   AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
   AliTPCcalibLaser *calibLaser = new AliTPCcalibLaser("laserTPC","laserTPC");
-  calibLaser->SetDebugLevel(debugLevel);
-  calibLaser->SetStreamLevel(streamLevel);
+  calibLaser->SetDebugLevel(0);
+  calibLaser->SetStreamLevel(0);
   calibLaser->SetTriggerMask(-1,-1,kFALSE);        //accept everything
-  myTask->AddJob(calibLaser);
-}
 
-
-void AddCalibAlign(TObject* task){
-  //
-  // Responsible: Marian Ivanov
-  // Description:
-  //
-  AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
-  AliTPCcalibAlign *calibAlign = new AliTPCcalibAlign("alignTPC","Alignment of the TPC sectors");
-  calibAlign->SetDebugLevel(debugLevel);
-  calibAlign->SetStreamLevel(streamLevel);
-  calibAlign->SetTriggerMask(-1,-1,kTRUE);        //accept everything
-  myTask->AddJob(calibAlign);
-}
-
-void AddCalibCosmic(TObject* task){
-  //
-  // Responsible: Marian Ivanov
-  // Description:
-  // Histogram residuals and pulls of the track parameters in bins of track parameters
-  //
-  AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
-  AliTPCcalibCosmic *calibCosmic = new AliTPCcalibCosmic("cosmicTPC","cosmicTPC");
-  calibCosmic->SetDebugLevel(debugLevel);
-  calibCosmic->SetStreamLevel(streamLevel);
-  calibCosmic->SetTriggerMask(-1,-1,kTRUE);        //accept everything
-  myTask->AddJob(calibCosmic);
+  myTask->AddJob(calibLaser);
 }
 
-
-
-
+//_____________________________________________________________________________
 void SetupCalibTaskTrain1(TObject* task){
   //
+  // Setup tasks for calibration train
   //
-  //
-  AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
   AddCalibCalib(task);
   AddCalibTimeGain(task);
-  AddCalibTimeGain(task,kTRUE,"calibTimeGainCosmic"); // 2nd task for cosmic runs
   AddCalibTime(task);
   AddCalibLaser(task);
-  AddCalibAlign(task);
-  AddCalibCosmic(task);
-  //
-  TString path=gSystem->pwd();
-  path+=prefix;
-  gSystem->mkdir(path);
-  myTask->SetDebugOuputhPath(path.Data());
-
 }
 
-
-
+//_____________________________________________________________________________
 void ConfigOCDB(Int_t run){
-  // 
+  //
+  // Configure TPC OCDB
+  //
   printf("SETUP OCBD for TPC\n");
   printf("SETUP OCBD for TPC\n");
   printf("SETUP OCBD for TPC Run =%d\n", run);
@@ -195,12 +213,7 @@ void ConfigOCDB(Int_t run){
   tpcRecoParam->SetUseQuadrantAlignment(kFALSE);
   //
   tpcRecoParam->SetUseSectorAlignment(kTRUE);
-  tpcRecoParam->SetUseGainCorrectionTime(kFALSE);
   tpcRecoParam->SetUseFieldCorrection(kFALSE);
   tpcRecoParam->SetUseExBCorrection(kTRUE);
   AliTPCcalibDB::Instance()->SetRun(run); 
 }
-
-
-
-
diff --git a/ANALYSIS/CalibMacros/Pass0/AddTaskTRDCalib.C b/ANALYSIS/CalibMacros/Pass0/AddTaskTRDCalib.C
new file mode 100644 (file)
index 0000000..ea1ef0e
--- /dev/null
@@ -0,0 +1,146 @@
+//=============================================================================
+//
+// *** AddTaskTRDCalib
+//
+// This macros setup the TRD calibration task
+//
+//=============================================================================
+
+const AliTRDCalDet *GetCalDetGain(Int_t runNumber, Int_t &version, Int_t &subversion);
+void GetVersionSubversionVdrift(Int_t runNumber, Int_t &version, Int_t &subversion);
+
+AliAnalysisTask  *AddTaskTRDCalib(Int_t runNumber)
+{
+  gSystem->Load("libTRDcalib");
+  // pointer to the analysis manager
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddTaskTRDCalib", "No analysis manager to connect to.");
+    return NULL;
+  }  
+  
+  // check the input handler
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTask", "This task requires an input event handler");
+    return NULL;
+  }  
+
+  ////////////////////////////////////////////
+  // Number of timebins
+  ///////////////////////////////////////////
+  AliTRDcalibDB *calib = AliTRDcalibDB::Instance();
+  Int_t nbOfTimeBins = calib->GetNumberOfTimeBinsDCS();
+  if(nbOfTimeBins < 0) nbOfTimeBins = 27;
+  ////////////////////////////////////////////
+  //
+  /////////////////////////////////////////////
+  Int_t versiongain, subversiongain, versionvdrift, subversionvdrift;
+
+  /////////////////////////
+  // The TRD calib Task
+  /////////////////////////
+  AliTRDCalibTask *calibTask = new AliTRDCalibTask();
+  calibTask->SetHisto2d(kTRUE);
+  calibTask->SetVector2d(kFALSE);
+  calibTask->SetVdriftLinear(kTRUE);
+  calibTask->SetNz(0,0);
+  calibTask->SetNrphi(0,0);
+  calibTask->SetNz(0,1);
+  calibTask->SetNrphi(0,1);
+  calibTask->SetNz(0,2);
+  calibTask->SetNrphi(0,2);
+  calibTask->SetLow(0);
+  calibTask->SetHigh(30);
+  calibTask->SetFillZero(kFALSE);
+  calibTask->AddSelectedTriggerClass("CINT1B-ABCE-NOPF-ALL");
+  calibTask->AddSelectedTriggerClass("CINT1WU-B-NOPF-ALL");
+  calibTask->SetReject(kFALSE);
+  //calibTask->SetDebug(2);
+  calibTask->SetNbTimeBins(nbOfTimeBins);
+  //calibTask->SetMaxEvent(10);
+  //calibTask->SetThresholdP(1.0);
+  calibTask->SetRequirePrimaryVertex(kTRUE);
+  calibTask->SetMinNbOfContributors(1);
+  calibTask->SetMaxCluster(100.0);
+  calibTask->SetNbMaxCluster(2);
+  //calibTask->SetLimitChargeIntegration(kTRUE);
+
+  //calibTask->SetCalDetGain(GetCalDetGain(runNumber,versiongain,subversiongain));
+  //GetVersionSubversionVdrift(runNumber,versionvdrift,subversionvdrift);
+  //calibTask->SetVersionGainUsed(versiongain);
+  //calibTask->SetSubVersionGainUsed(subversiongain);
+  //calibTask->SetVersionVdriftUsed(versionvdrift);
+  //calibTask->SetSubVersionVdriftUsed(subversionvdrift);
+
+
+  /////////////////////////////
+  // Track cuts
+  /////////////////////////////
+  AliESDtrackCuts *trackCuts = new AliESDtrackCuts("trackcuts","trackcuts");
+  trackCuts->SetMinNClustersTPC(50);
+  trackCuts->SetMaxChi2PerClusterTPC(3.5);
+  //trackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
+  trackCuts->SetRequireTPCRefit(kTRUE);
+  //trackCuts->SetRequireITSRefit(kTRUE);
+  //trackCuts->SetMinNsigmaToVertex(10);
+  trackCuts->SetRequireSigmaToVertex(kFALSE);
+  trackCuts->SetAcceptKinkDaughters(kFALSE);
+  trackCuts->SetMaxDCAToVertexZ(30.0);
+  trackCuts->SetMaxDCAToVertexXY(3.0);
+  trackCuts->SetDCAToVertex2D(kFALSE);
+
+  calibTask->SetESDtrackCuts(trackCuts);
+
+  mgr->AddTask(calibTask);
+
+  AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+  //AliAnalysisDataContainer *cinput = mgr->GetCommonOutputContainer();
+  
+  if (!cinput) cinput = mgr->CreateContainer("cchain",TChain::Class(), 
+                                      AliAnalysisManager::kInputContainer);
+
+  AliAnalysisDataContainer *coutput =mgr->CreateContainer("TRDCalib",TList::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
+
+
+  mgr->ConnectInput(calibTask,0,cinput);
+  mgr->ConnectOutput(calibTask,1,coutput);
+  return calibTask;
+
+}
+
+const AliTRDCalDet *GetCalDetGain(Int_t runNumber, Int_t &version, Int_t &subversion){
+  // 
+  // Get Cal Det for gas gain
+  //
+  
+  AliCDBEntry *entry = AliCDBManager::Instance()->Get("TRD/Calib/ChamberGainFactor",runNumber);
+  if(!entry) {
+    printf("Found no entry\n");
+    return 0x0;
+  }
+  const AliCDBId id = entry->GetId();
+  version = id.GetVersion();
+  subversion = id.GetSubVersion();
+  printf("Found version %d and subversion %d for gain\n",version,subversion);
+  const AliTRDCalDet* calDet = (AliTRDCalDet *)entry->GetObject();
+
+  return calDet;
+
+}
+void GetVersionSubversionVdrift(Int_t runNumber, Int_t &version, Int_t &subversion){
+  // 
+  // Get Version and subversion for Vdrift
+  //
+  
+  AliCDBEntry *entry = AliCDBManager::Instance()->Get("TRD/Calib/ChamberVdrift",runNumber);
+  if(!entry) {
+    printf("Found no entry\n");
+    return 0x0;
+  }
+  const AliCDBId id = entry->GetId();
+  version = id.GetVersion();
+  subversion = id.GetSubVersion();
+  printf("Found version %d and subversion %d for vdrift\n",version,subversion);
+
+
+}
index 87a3bd5..843ed19 100644 (file)
@@ -1,79 +1,40 @@
-//
-// Macro to initialize: 
-// - the OCDB (run number required as input argument)
-// - the geometry (expected to be in the current directory)
-// to run the Calibration train.
-// 
+/*
+
+ Macro to initialize: 
+ - the OCDB (run number required as input argument)
+ - the geometry (expected to be in the current directory)
+ to run the Calibration train.
+ Example:
+ .L $ALICE_ROOT/ANALYSIS/CalibMacros/MergeCalibration/ConfigCalibTrain.C
+ ConfigCalibTrain(129160,"raw://");
+
+*/
 
 void ConfigCalibTrain(Int_t run, const char *ocdb="raw://"){
 
   // OCDB
   printf("setting run to %d\n",run);
   AliCDBManager::Instance()->SetDefaultStorage(ocdb);
   AliCDBManager::Instance()->SetRun(run); 
 
-  // geometry
-  AliGeomManager::LoadGeometry();
-  AliGeomManager::ApplyAlignObjsFromCDB("GRP ITS TPC");
-
-
-
-  AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/GRP/Data");
-  AliGRPObject* grpData = (AliGRPObject*)entry->GetObject();
-
-  Bool_t ok=kTRUE;
-  Float_t l3Current = grpData->GetL3Current((AliGRPObject::Stats)0);
-  if (l3Current == AliGRPObject::GetInvalidFloat()) {
-    printf("GRP/GRP/Data entry:  missing value for the L3 current !");
-    ok = kFALSE;
-  }
-  
-  Char_t l3Polarity = grpData->GetL3Polarity();
-  if (l3Polarity == AliGRPObject::GetInvalidChar()) {
-    printf("GRP/GRP/Data entry:  missing value for the L3 polarity !");
-    ok = kFALSE;
-  }
-  
-  // Dipole
-  Float_t diCurrent = grpData->GetDipoleCurrent((AliGRPObject::Stats)0);
-  if (diCurrent == AliGRPObject::GetInvalidFloat()) {
-    printf("GRP/GRP/Data entry:  missing value for the dipole current !");
-    ok = kFALSE;
-  }
-  
-  Char_t diPolarity = grpData->GetDipolePolarity();
-  if (diPolarity == AliGRPObject::GetInvalidChar()) {
-    printf("GRP/GRP/Data entry:  missing value for the dipole polarity !");
-    ok = kFALSE;
-  }
-
-  TString beamType = grpData->GetBeamType();
-  if (beamType==AliGRPObject::GetInvalidString()) {
-    printf("GRP/GRP/Data entry:  missing value for the beam type ! Using UNKNOWN");
-    beamType = "UNKNOWN";
+  // magnetic field
+  if ( !TGeoGlobalMagField::Instance()->GetField() ) {
+    printf("Loading field map...\n");
+    AliGRPManager grpMan;
+    if( !grpMan.ReadGRPEntry() ) { 
+      printf("Cannot get GRP entry\n"); 
+    }
+    if( !grpMan.SetMagField() ) { 
+      printf("Problem with magnetic field setup\n"); 
+    }
   }
 
-  Float_t beamEnergy = grpData->GetBeamEnergy();
-  if (beamEnergy==AliGRPObject::GetInvalidFloat()) {
-    printf("GRP/GRP/Data entry:  missing value for the beam energy ! Using 0");
-    beamEnergy = 0;
+  // geometry
+  printf("Loading geometry...\n");
+  AliGeomManager::LoadGeometry();
+  if( !AliGeomManager::ApplyAlignObjsFromCDB("GRP ITS TPC") ) {
+    printf("Problem with align objects\n"); 
   }
 
-  // read special bits for the polarity convention and map type
-  //Int_t  polConvention = grpData->IsPolarityConventionLHC() ? AliMagF::kConvLHC : AliMagF::kConvDCS2008;
-  Int_t  polConvention = grpData->IsPolarityConventionLHC() ? 0 : 1;
-  Bool_t uniformB = grpData->IsUniformBMap();
-  
-  if (ok) {
-    AliMagF* fld = AliMagF::CreateFieldMap(TMath::Abs(l3Current) * (l3Polarity ? -1:1),
-                                          TMath::Abs(diCurrent) * (diPolarity ? -1:1),
-                                          polConvention,uniformB,beamEnergy, beamType.Data());
-    if (fld) {
-      TGeoGlobalMagField::Instance()->SetField( fld );
-      TGeoGlobalMagField::Instance()->Lock();
-      printf("Running with the B field constructed out of GRP !");
-    }
-  }
-  printf("Problem with magnetic field setup\n");
 }
index 86eab50..7be6fbf 100644 (file)
@@ -1,19 +1,14 @@
-void LoadLibraries(){
-    gSystem->Load("libTree");
-    gSystem->Load("libGeom");
-    gSystem->Load("libPhysics");
-    gSystem->Load("libVMC");
-    gSystem->Load("libSTEERBase");
-    gSystem->Load("libESD");
-    gSystem->Load("libAOD");
-
+void LoadLibraries() {
+    //
+    // load libraries needed for Pass0
+    //
+    gSystem->Load("libSTAT");
     gSystem->Load("libANALYSIS");
     gSystem->Load("libANALYSISalice");
     gSystem->Load("libANALYSIScalib");
-    gSystem->Load("libCORRFW");
-    gSystem->Load("libPWG3muon");
     //
     // detector libraries
     //    
     gSystem->Load("libTPCcalib");
+    gSystem->Load("libTRDcalib");
 }
index 9aa2e86..3cf92d8 100644 (file)
@@ -1,18 +1,14 @@
-Executable="/alice/cern.ch/user/z/zampolli/bin/runPass0.sh";
+Executable="/alice/cern.ch/user/j/jotwinow/bin/runPass0.sh";
 
-Packages={"VO_ALICE@AliRoot::v4-19-07-AN","VO_ALICE@ROOT::v5-26-00b-1","VO_ALICE@APISCONFIG::V1.1x"};
-Jobtag =
-           {
-              "test Calibration Train"
-           };
+Packages= { "VO_ALICE@AliRoot::v4-19-Rev-11", "VO_ALICE@ROOT::v5-27-06-1", "VO_ALICE@APISCONFIG::V1.1x" };
+
+Jobtag = { "Test Pass0 Calibration Train" };
 
 GUIDFILE="guid.txt";
 TTL = "28000";
 Price = 1;
 
-Requirements = ( other.CE == "ALICE::CERN::LCG" );
-
-Validationcommand ="/alice/cern.ch/user/z/zampolli/Pass0/validation.sh";
+Validationcommand ="/alice/cern.ch/user/j/jotwinow/bin/validation.sh";
 
 Split="file";
 
@@ -20,19 +16,21 @@ JDLVariables={"Packages", "OutputDir"};
 GUIDFILE="guid.txt";
 
 
-SplitArguments = {"/alice/data/2009/LHC09d/$1/raw/#alienfilename#"};
+SplitArguments = {"/alice/data/2010/LHC10d/$1/raw/#alienfilename#"};
 Workdirectorysize={"6000MB"};
 
-InputFile={"LF:/alice/cern.ch/user/z/zampolli/Pass0/recPass0.C",
-           "LF:/alice/cern.ch/user/z/zampolli/Pass0/ConfigCalibTrain.C",
-           "LF:/alice/cern.ch/user/z/zampolli/Pass0/runCalibTrain.C",
-           "LF:/alice/cern.ch/user/z/zampolli/Pass0/AddTaskTPCCalib.C",
-           "LF:/alice/cern.ch/user/z/zampolli/Pass0/LoadLibraries.C"
+InputFile={"LF:/alice/cern.ch/user/j/jotwinow/Pass0/CalibMacros/recPass0.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/Pass0/CalibMacros/ConfigCalibTrain.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/Pass0/CalibMacros/runCalibTrain.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/Pass0/CalibMacros/AddTaskTPCCalib.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/Pass0/CalibMacros/AddTaskTRDCalib.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/Pass0/CalibMacros/LoadLibraries.C"
 };
-InputDataCollection="LF:/alice/data/2009/LHC09d/$1/collection,nodownload";
 
-OutputDir="/alice/cern.ch/user/z/zampolli/Pass0/output/$1/#alienfilename/.root//#";
+InputDataCollection="LF:/alice/data/2010/LHC10d/$1/collection,nodownload";
+
+OutputDir="/alice/cern.ch/user/j/jotwinow/Pass0/output/$1/#alienfilename/.root//#";
 
 OutputArchive={"log_archive:*.log@disk=1",
-              "root_archive.zip:galice.root,AliESDs.root, AliESDfriends.root,AliESDfriends_v1.root,@disk=1"};
+              "root_archive.zip:AliESDfriends_v1.root,@disk=1"};
 
diff --git a/ANALYSIS/CalibMacros/Pass0/makeOCDB.C b/ANALYSIS/CalibMacros/Pass0/makeOCDB.C
new file mode 100644 (file)
index 0000000..1e9c5d8
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+  macro to extract the OCDB entries
+
+  input: CalibObjects.root
+  ouput: TimeGain and TimeVdrift calibration objects for TPC and TRD
+
+  Example:
+  .L $ALICE_ROOT/ANALYSIS/CalibMacros/MergeCalibration/makeOCDB.C
+  makeOCDB("105160");
+
+*/
+
+const AliTRDCalDet *GetCalDetVdrift(Int_t runNumber, Int_t version, Int_t subversion);
+void makeOCDB(TString runNumberString, TString  ocdbStorage="")
+{
+  //
+  // extract TPC OCDB entries
+  //
+  gROOT->Macro("LoadLibraries.C");
+  gROOT->LoadMacro("ConfigCalibTrain.C");
+  // switch off log info
+  AliLog::SetClassDebugLevel("AliESDEvent",0);
+
+  // config GRP
+  Int_t runNumber = runNumberString.Atoi();
+  printf("runNumber from runCalibTrain = %d\n",runNumber);
+  ConfigCalibTrain(runNumber, "raw://");
+  
+  // Steering Tasks - set output storage
+  // DefaultStorage set already before - in ConfigCalibTrain.C
+  AliCDBManager::Instance()->SetSpecificStorage("*/*/*",ocdbStorage.Data());
+  
+  // set OCDB storage
+  if (ocdbStorage.Length()==0) ocdbStorage+="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
+
+  // TPC part
+  TFile fcalib("CalibObjects.root");
+  AliTPCPreprocessorOffline proces;
+
+  // switch on parameter validation
+  proces.SwitchOnValidation();
+
+  // Make timegain calibration
+  //proces.CalibTimeGain("CalibObjects.root", runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
+  proces.CalibTimeGain("CalibObjects.root", runNumber,runNumber,ocdbStorage);
+
+  // Make vdrift calibration
+  //proces.CalibTimeVdrift("CalibObjects.root",runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
+  proces.CalibTimeVdrift("CalibObjects.root",runNumber,runNumber,ocdbStorage);
+
+
+  // TRD part
+  AliTRDPreprocessorOffline procestrd;
+  procestrd.SetLinearFitForVdrift(kTRUE);
+  procestrd.Init("CalibObjects.root");
+  Int_t versionVdriftUsed = procestrd.GetVersionVdriftUsed();
+  Int_t subversionVdriftUsed = procestrd.GetSubVersionVdriftUsed();
+  procestrd.SetCalDetVdrift(GetCalDetVdrift(runNumber,versionVdriftUsed,subversionVdriftUsed));
+         
+  procestrd.SetMinStatsVdriftT0PH(600*10);
+  procestrd.SetMinStatsVdriftLinear(600);
+  procestrd.SetMinStatsGain(600);
+  procestrd.SetMinStatsPRF(600);
+
+  procestrd.CalibVdriftT0("CalibObjects.root",runNumber,runNumber,ocdbStorage);
+  procestrd.CalibGain("CalibObjects.root",runNumber,runNumber,ocdbStorage);
+  procestrd.CalibPRF("CalibObjects.root",runNumber,runNumber,ocdbStorage); 
+
+  return;
+}
+
+const AliTRDCalDet *GetCalDetVdrift(Int_t runNumber, Int_t version, Int_t subversion){
+  // 
+  // Get Cal Det used during reconstruction for vdrift
+  //
+  
+  AliCDBEntry *entry = AliCDBManager::Instance()->Get("TRD/Calib/ChamberVdrift",runNumber, version, subversion);
+  if(!entry) {
+    printf("Found no entry\n");
+    return 0x0;
+  }
+  const AliCDBId id = entry->GetId();
+  version = id.GetVersion();
+  subversion = id.GetSubVersion();
+  //printf("Found version %d and subversion %d for vdrift\n",version,subversion);
+  const AliTRDCalDet* calDet = (AliTRDCalDet *)entry->GetObject();
+
+  return calDet;
+
+}
diff --git a/ANALYSIS/CalibMacros/Pass0/merge.C b/ANALYSIS/CalibMacros/Pass0/merge.C
new file mode 100644 (file)
index 0000000..796a7e0
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+  merge output calib objects on Alien
+  using AliFileMerger functionality
+
+  Directory with runCalibTrain output: outputDir
+  pattern: AliESDfriends_v1.root 
+  Output file name: CalibObjects.root
+
+  Example: 
+  .L $ALICE_ROOT/ANALYSIS/CalibMacros/MergeCalibration/merge.C
+  merge("alien:///alice/cern.ch/user/j/jotwinow/CalibTrain/output","AliESDfriends_v1.root");
+*/
+
+void merge(const char* outputDir, const char* pattern) {
+  //
+  // load libraries
+  //
+  gROOT->Macro("LoadLibraries.C");
+  //
+  TH1::AddDirectory(0);
+
+  //
+  AliFileMerger merger;
+  merger.AddReject("esdFriend"); // do not merge 
+
+  // local 
+  // merger.IterTXT("calib.list","CalibObjects.root",kFALSE);
+        
+  // alien 
+  merger.IterAlien(outputDir, "CalibObjects.root", pattern);
+
+return;
+}
diff --git a/ANALYSIS/CalibMacros/Pass0/mergeMakeOCDB.jdl b/ANALYSIS/CalibMacros/Pass0/mergeMakeOCDB.jdl
new file mode 100644 (file)
index 0000000..f77817c
--- /dev/null
@@ -0,0 +1,30 @@
+Executable="/alice/cern.ch/user/j/jotwinow/bin/mergeMakeOCDB.sh";
+
+Packages= { "VO_ALICE@AliRoot::v4-19-Rev-11", "VO_ALICE@ROOT::v5-27-06-1", "VO_ALICE@APISCONFIG::V1.1x" };
+
+Jobtag = { "Merging Calibration Objects from calib train and make OCDB params" };
+
+GUIDFILE="guid.txt";
+TTL = "28000";
+Price = 1;
+
+Validationcommand ="/alice/cern.ch/user/j/jotwinow/bin/validationMerging.sh";
+
+JDLVariables={"Packages", "OutputDir"};
+GUIDFILE="guid.txt";
+
+Arguments = "$1 $2 $3";
+
+Workdirectorysize={"6000MB"}; 
+
+InputFile={"LF:/alice/cern.ch/user/j/jotwinow/Pass0/MergeCalibration/ConfigCalibTrain.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/Pass0/MergeCalibration/LoadLibraries.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/Pass0/MergeCalibration/makeOCDB.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/Pass0/MergeCalibration/merge.C"
+};
+
+OutputDir="/alice/cern.ch/user/j/jotwinow/Pass0/output/$2/";
+
+OutputArchive={"log_archive:*.log@disk=1",
+              "root_archive.zip:CalibObjects.root@disk=1"};
+
diff --git a/ANALYSIS/CalibMacros/Pass0/mergeMakeOCDB.sh b/ANALYSIS/CalibMacros/Pass0/mergeMakeOCDB.sh
new file mode 100755 (executable)
index 0000000..f8b3933
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Script to merge objects coming out of the calibration train:
+# Arguments:
+#    1 - directory on which to look for the files to be merged 
+#    2 - pattern
+#    3 - OCDB output path
+
+# example:
+# mergeMakeOCDB.sh /alice/cern.ch/user/j/jotwinow/Pass0/output/ 000120691 alien://folder=/alice/cern.ch/user/j/jotwinow/Pass0/output
+
+#ALIEN setting
+# $1 = directory where to perform the find 
+# $2 = pattern
+# $3 = OCDB path
+
+echo ">>>>>>> Running AliRoot to merge calib objects found in $1 with pattern AliESDfriends_v1.root"
+aliroot -l -b -q merge.C\(\"$1\",\"AliESDfriends_v1.root\"\) 2>&1 | tee merge.log
+
+echo ">>>>>>> Extract OCDB entries for run = $2, to be stored in $3"
+aliroot -l -b -q makeOCDB.C\(\"$2\",\"$3\"\) 2>&1 | tee ocdb.log
index 98eceed..25cbb10 100644 (file)
@@ -1,26 +1,33 @@
-//
-//   rec.C to be used for pass0
-//   
-
-void recPass0(const char *filename="raw.root",Int_t nevents=-1)
+/*
+   rec.C to be used for pass0
+   - reconstruction of raw data  
+   - QA information switched off
+   - store all friends
+   - default OCDB storage set to "raw://"
+
+   Example:
+   aliroot -b -q 'recPass0.C("raw.root",100)'
+*/
+
+void recPass0(const char *filename="raw.root",Int_t nevents=-1, const char *ocdb="raw://")
 {
   // Load some system libs for Grid and monitoring
   // Set the CDB storage location
   AliCDBManager * man = AliCDBManager::Instance();
-  man->SetDefaultStorage("raw://");
+  man->SetDefaultStorage(ocdb);
  
   // Reconstruction settings
   AliReconstruction rec;
 
+  // All friends
+  rec.SetFractionFriends(1.0);
+
   // Set protection against too many events in a chunk (should not happen)
   if (nevents>0) rec.SetEventRange(0,nevents);
 
-  // Switch off HLT until the problem with schema evolution resolved
-  //rec.SetRunReconstruction("ALL-HLT");
   //
   // QA options
   //
-  AliQAManager *qam = AliQAManager::QAManager(AliQAv1::kRECMODE) ;
   rec.SetRunQA(":");
   rec.SetRunGlobalQA(kFALSE);
 
@@ -32,12 +39,25 @@ void recPass0(const char *filename="raw.root",Int_t nevents=-1)
   rec.SetRunReconstruction("ITS TPC TRD TOF");
   rec.SetFillESD("ITS TPC TRD TOF");
 
+  //rec.SetRunReconstruction("ALL");
+  //rec.SetRunQA("Global:ESDs") ;
+  //rec.SetRunQA(":") ;
+  //rec.SetRunQA("ALL -MUON:ALL") ;
+  //rec.SetRunQA("ALL:ALL") ;
+  //rec.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;
+  //rec.SetWriteESDfriend(kTRUE);
+  //rec.SetWriteAlignmentData();
+  //rec.SetInput(filename);
+  //rec.SetUseTrackingErrorsForAlignment("ITS");
+
   // switch off cleanESD
   rec.SetCleanESD(kFALSE);
 
+  //Ignore SetStopOnError
+  rec.SetStopOnError(kFALSE);
+
   AliLog::Flush();
   rec.Run();
-
 }
 
 
index 957ffd9..3d57665 100644 (file)
@@ -1,53 +1,63 @@
 /*
-  Template of calibration/filtering  macro using ESD
+  Template of calibration/filtering macro using ESD:
+  - requires AliESDs.root and AliESDfriend.root
+  - requires OCDB access (default set to "raw://")
+  - requires run number as argument to init OCDB
+  - calls LoadLibraries.C, ConfigCalibTrain.C and AddTaskTPCCalib.C macros
+  - output AliESDfriends_v1.root with TPC and TRD calibration objects are created
 
   Example:
   .L $ALICE_ROOT/ANALYSIS/macros/runCalibTrain.C
-  runCalibTrain(105160);
-
+  runCalibTrain("104892");
 */
 
-void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.root")
+void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.root", const char *ocdb="raw://")
 {
+  //
+  // macro to run TPC calibration train 
+  //
   gROOT->Macro("LoadLibraries.C");
   gROOT->LoadMacro("ConfigCalibTrain.C");
+
   // detector tasks
-  
   gROOT->LoadMacro("AddTaskTPCCalib.C");
+  gROOT->LoadMacro("AddTaskTRDCalib.C");
   
-  AliLog::SetClassDebugLevel("AliESDEvent",19);
-  TChain *chain = new TChain("esdTree");
-  
-  // Steering input chain
+  // switch off debug 
+  AliLog::SetClassDebugLevel("AliESDEvent",0);
   
+  // steering input chain
+  TChain *chain = new TChain("esdTree");
   chain->Add(inFileName);
+
+  // config calibration train
+  // setting geometry and B-field from GRP
   Int_t runNumber = runNumberString.Atoi();
   printf("runNumber from runCalibTrain = %d\n",runNumber);
-  ConfigCalibTrain(runNumber, "raw://");
+  printf("ocdb from runCalibTrain = %s\n",ocdb);
+  ConfigCalibTrain(runNumber, ocdb);
   
+  //
+  // setup analysis
+  //
   AliAnalysisManager *mgr  = new AliAnalysisManager("ESD to ESD", "Analysis Manager");
   // mgr->SetDebugLevel(3);
   
   // Input
-  
   AliESDInputHandler* inpHandler = new AliESDInputHandler();
-  mgr->SetInputEventHandler  (inpHandler);
+  inpHandler->SetReadFriends(1);
+  mgr->SetInputEventHandler(inpHandler);
   
   // Output
-  
   AliESDHandler* esdHandler   = new AliESDHandler();
   mgr->SetOutputEventHandler(esdHandler);
   esdHandler->SetOutputFileName("AliESDfriends_v1.root");
-  // Steering Tasks
-  // not needed  
   
   // Detector Tasks
-  
   AliAnalysisTask* tTPC = AddTaskTPCCalib(runNumber);
+  AliAnalysisTask* tTRD = AddTaskTRDCalib(runNumber);
   
   // Run the analysis
-  
   if (!mgr->InitAnalysis()) {
     printf("Analysis cannot be started, returning\n");
     return;
index d737b48..ce604a2 100644 (file)
@@ -3,21 +3,20 @@
 # Script to run:
 #    1. reconstruction
 #    2. calibration and friend track filtering
-#    3. tag creation
 #
 # Files assumed to be in working directory:
-# rec.C               - reconstruction macro
+# recPass0.C          - reconstruction macro
 # runCalibTrain.C     - calibration/filtering macro
-# Arguments:
+# Arguments (run locally):
 #    1  - raw data file name
 #    2  - number of events to be processed
 #    3  - run number 
 
 # example:
-# runPassX.sh raw.root  50  104892
+# runPass0.sh raw.root  50  104892
 
 #ALIEN setting
-entries=1000
+entries=500
 # $1 = raw input filename
 runnum=`echo $1 | cut -d "/" -f 6`
 
@@ -32,12 +31,12 @@ echo ">>>>>>>>> PATH is..."
 echo $PATH
 echo ">>>>>>>>> LD_LIBRARY_PATH is..."
 echo $LD_LIBRARY_PATH
-echo ">>>>>>>>> rec.C is..."
+echo ">>>>>>>>> recPass0.C is..."
 cat recPass0.C
 echo
 
 echo ">>>>>>> Running AliRoot to reconstruct $1. Run number is $runnum..."
-aliroot -l -b -q recPass0.C\(\"alien://$1\"\) 2>&1 | tee rec.log
+aliroot -l -b -q recPass0.C\(\"alien://$1\",$entries\) 2>&1 | tee rec.log
 
 echo ">>>>>>> Running AliRoot to make calibration..."
 aliroot -l -b -q  runCalibTrain.C\(\"$runnum\"\)   2>&1 | tee calib.log
diff --git a/ANALYSIS/CalibMacros/Pass0/validationMerging.sh b/ANALYSIS/CalibMacros/Pass0/validationMerging.sh
new file mode 100755 (executable)
index 0000000..b87d9ad
--- /dev/null
@@ -0,0 +1,76 @@
+
+#!/bin/sh
+##################################################
+validateout=`dirname $0`
+validatetime=`date`
+validated="0";
+error=1
+
+if [ -z $validateout ]
+then
+    validateout="."
+fi
+cd $validateout;
+validateworkdir=`pwd`;
+
+echo "*******************************************************" >> stdout;
+echo "* AliRoot Validation Script V1.0                      *" >> stdout;
+echo "* Time:    $validatetime " >> stdout;
+echo "* Dir:     $validateout" >> stdout;
+echo "* Workdir: $validateworkdir" >> stdout;
+echo "* ----------------------------------------------------*" >> stdout;
+ls -la ./ >> stdout;
+echo "* ----------------------------------------------------*" >> stdout;
+
+cp stdout stdout.log
+cp stderr stderr.log
+
+##################################################
+if [ -f merge.log ] && [ -f CalibObjects.root ] 
+then 
+sv=`grep -i  "Segmentation violation" *.log`
+if [ "$sv" = "" ]
+    then
+    sf=`grep -i  "Segmentation fault" *.log`
+    if [ "$sf" = "" ]
+        then
+        be=`grep -i  "Bus error" *.log`
+        if [ "$be" = "" ]
+           then
+           ab=`grep -i "Break" *.log`
+           if [ "$ab" = "" ]
+               then
+               fp=`grep -i  "Floating point exception" *.log`
+               if [ "$fp" = "" ]
+                   then
+                   kl=`grep -i  "Killed" *.log`
+                   if [ "$kl" = "" ]
+                       then
+                       bf=`grep -i "busy flag cleared" *.log`
+                       if [ "$bf" = "" ]
+                            then
+                              echo "* ----------------   Job Validated  ------------------*" >> stdout;
+                              error="0";
+                            else
+                               echo "* #             Check Macro failed !                  #" >> stdout;
+                        fi
+                   fi
+               fi
+            fi
+        fi
+    fi
+fi
+else
+    echo "* ########## Job not validated - no merge.log or CalibObjects.root ###" >> stdout;
+    echo "* ########## Removing all ROOT files from the local directory, leaving only the logs ###" >> stdout;
+    rm -rf *.root
+fi
+if [ "$error" = "1" ] 
+    then
+    echo "* ################   Job not validated ################" >> stdout;
+fi
+echo "* ----------------------------------------------------*" >> stdout;
+echo "*******************************************************" >> stdout;
+sleep 15;
+cd -
+exit $error