SDDRP - removed cdb->SetRun, initialize CDB clib objects at the first call of UserExe...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 14 Oct 2011 08:37:28 +0000 (08:37 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 14 Oct 2011 08:37:28 +0000 (08:37 +0000)
PWG1/ITS/AliAnalysisTaskITSTrackingCheck.cxx
PWG1/ITS/AliAnalysisTaskSDDRP.cxx
PWG1/ITS/AliAnalysisTaskSEImpParRes.cxx
PWG1/ITS/AliAnalysisTaskSPD.cxx

index d3cc9b2..d5016c7 100644 (file)
@@ -1659,6 +1659,7 @@ void AliAnalysisTaskITSTrackingCheck::UserCreateOutputObjects()
   fNtupleITSAlignSPDTracklets = new TNtuple("fNtupleITSAlignSPDTracklets","ITS alignment checks: SPD tracklets wrt SPD vertex","phi:theta:z:dxy:dz:pt");  
   fOutput->Add(fNtupleITSAlignSPDTracklets);
 
+  PostData(1, fOutput);
   return;
 }
 
index b7cb394..692bf23 100644 (file)
@@ -306,6 +306,9 @@ void AliAnalysisTaskSDDRP::UserCreateOutputObjects() {
 
     // Read dead channels from OCDB
 
+// == Not allowed in QA train. This is set by AliTaskCDBconnect. (A.G. 14/10/2011)
+// If needed for independent use of the task, protect via a flag that is OFF by default.
+/*
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) AliFatal("No analysis manager");
 
@@ -313,49 +316,8 @@ void AliAnalysisTaskSDDRP::UserCreateOutputObjects() {
   man->SetDefaultStorage("raw://");
   Int_t nrun=mgr->GetRunFromPath();
   man->SetRun(nrun);
-  
+*/  
     
-  AliCDBEntry* eR=(AliCDBEntry*)man->Get("ITS/Calib/RespSDD");
-  if (eR) {
-      eR->PrintId();
-      eR->PrintMetaData();
-      fResp=(AliITSresponseSDD*)eR->GetObject();
-  }
-  
-  AliCDBEntry* eC=(AliCDBEntry*)man->Get("ITS/Calib/CalibSDD");
-  Int_t countGood3[14];
-  Int_t countGood4[22];
-  Int_t countGoodMod[260];
-  if (eC) {
-      eC->PrintId();
-      eC->PrintMetaData();
-      TObjArray* calsdd=(TObjArray*)eC->GetObject();
-      for(Int_t ilad=0;ilad<14;ilad++) countGood3[ilad]=0;
-      for(Int_t ilad=0;ilad<22;ilad++) countGood4[ilad]=0;
-      for(Int_t imod=0;imod<260;imod++) countGoodMod[imod]=0;
-      for(Int_t imod=0;imod<260;imod++){
-         AliITSCalibrationSDD* cal=(AliITSCalibrationSDD*)calsdd->At(imod);
-         if(cal->IsBad()) continue;
-         Int_t modId=imod+AliITSgeomTGeo::GetModuleIndex(3,1,1);
-         Int_t lay,lad,det;
-         AliITSgeomTGeo::GetModuleId(modId,lay,lad,det);
-         if(fExcludeBadMod && !CheckModule(lay,lad,det)) continue;
-         for(Int_t ian=0; ian<512; ian++){
-             if(cal->IsBadChannel(ian)) continue;
-             countGoodMod[imod]++;
-             if(lay==3) countGood3[lad-1]++;
-             else if(lay==4) countGood4[lad-1]++;
-         }
-      }
-  }
-  
-  for(Int_t imod=0;imod<260;imod++) fGoodAnMod->SetBinContent(imod+1,countGoodMod[imod]);
-  fGoodAnMod->SetMinimum(0);
-  for(Int_t ilad=0;ilad<14;ilad++) fGoodAnLadLay3->SetBinContent(ilad+1,countGood3[ilad]);
-  fGoodAnLadLay3->SetMinimum(0);    
-  for(Int_t ilad=0;ilad<22;ilad++) fGoodAnLadLay4->SetBinContent(ilad+1,countGood4[ilad]);
-  fGoodAnLadLay4->SetMinimum(0);
-
   PostData(1, fOutput);
 
 }
@@ -363,6 +325,7 @@ void AliAnalysisTaskSDDRP::UserCreateOutputObjects() {
 void AliAnalysisTaskSDDRP::UserExec(Option_t *)
 {
   //
+  static Bool_t initCalib = kFALSE;
   AliESDEvent *esd = (AliESDEvent*) (InputEvent());
 
 
@@ -377,6 +340,59 @@ void AliAnalysisTaskSDDRP::UserExec(Option_t *)
     return;
   }
   
+// Code below moved from UserCreateOutputObjects where the run for OCDB may not 
+// be yet properly set. Make sure this is called only once. (A.G. 14/10/2011)
+
+/************/
+  if (!initCalib) {
+    AliCDBManager* man = AliCDBManager::Instance();
+    if (!man) {
+       AliFatal("CDB not set but needed by AliAnalysisTaskSDDRP");
+       return;
+    }   
+    AliCDBEntry* eR=(AliCDBEntry*)man->Get("ITS/Calib/RespSDD");
+    if (eR) {
+      eR->PrintId();
+      eR->PrintMetaData();
+      fResp=(AliITSresponseSDD*)eR->GetObject();
+    }
+  
+    AliCDBEntry* eC=(AliCDBEntry*)man->Get("ITS/Calib/CalibSDD");
+    Int_t countGood3[14];
+    Int_t countGood4[22];
+    Int_t countGoodMod[260];
+    if (eC) {
+      eC->PrintId();
+      eC->PrintMetaData();
+      TObjArray* calsdd=(TObjArray*)eC->GetObject();
+      for(Int_t ilad=0;ilad<14;ilad++) countGood3[ilad]=0;
+      for(Int_t ilad=0;ilad<22;ilad++) countGood4[ilad]=0;
+      for(Int_t imod=0;imod<260;imod++) countGoodMod[imod]=0;
+      for(Int_t imod=0;imod<260;imod++){
+        AliITSCalibrationSDD* cal=(AliITSCalibrationSDD*)calsdd->At(imod);
+        if(cal->IsBad()) continue;
+            Int_t modId=imod+AliITSgeomTGeo::GetModuleIndex(3,1,1);
+        Int_t lay,lad,det;
+        AliITSgeomTGeo::GetModuleId(modId,lay,lad,det);
+        if(fExcludeBadMod && !CheckModule(lay,lad,det)) continue;
+        for(Int_t ian=0; ian<512; ian++){
+          if(cal->IsBadChannel(ian)) continue;
+          countGoodMod[imod]++;
+          if(lay==3) countGood3[lad-1]++;
+          else if(lay==4) countGood4[lad-1]++;
+        }
+      }
+    }  
+  
+    for(Int_t imod=0;imod<260;imod++) fGoodAnMod->SetBinContent(imod+1,countGoodMod[imod]);
+    fGoodAnMod->SetMinimum(0);
+    for(Int_t ilad=0;ilad<14;ilad++) fGoodAnLadLay3->SetBinContent(ilad+1,countGood3[ilad]);
+    fGoodAnLadLay3->SetMinimum(0);    
+    for(Int_t ilad=0;ilad<22;ilad++) fGoodAnLadLay4->SetBinContent(ilad+1,countGood4[ilad]);
+    fGoodAnLadLay4->SetMinimum(0);
+    initCalib = kTRUE;
+  }  
+/************/
   
   PostData(1, fOutput);
 
index 928cc4c..c588391 100644 (file)
@@ -1127,7 +1127,41 @@ void AliAnalysisTaskSEImpParRes::UserCreateOutputObjects()
 
   if(!fNentries) fNentries = new TH1F("hNentries", "number of entries", 26, 0., 40.);
   if(!fEstimVtx) fEstimVtx = new TH1F("vtxRes","Resolution of vertex",1000,-5000.,5000);
-
+  PostData(1, fOutputitspureSARec);
+  PostData(2, fOutputitspureSASkip);
+  PostData(3, fOutputallPointRec);
+  PostData(4, fOutputallPointSkip);
+  PostData(5, fOutputpartPointRec);
+  PostData(6, fOutputpartPointSkip);
+  PostData(7, fOutputonepointSPDRec);
+  PostData(8, fOutputonepointSPDSkip);
+  PostData(9, fOutputpostvTracRec);
+  PostData(10, fOutputpostvTracSkip);
+  PostData(11, fOutputnegtvTracRec);
+  PostData(12, fOutputnegtvTracSkip);
+  PostData(13, fOutputpullAllpointRec);
+  PostData(14, fOutputpullAllpointSkip);
+  PostData(15, fOutputOnlyRefitRec);
+  PostData(16, fOutputOnlyRefitSkip);
+  PostData(17, fOutputSinThetaRec);
+  PostData(18, fOutputSinThetaSkip);
+  PostData(19, fOutputallPointTrue);
+  PostData(20, fOutputpostvTracTrue);
+  PostData(21, fOutputnegtvTracTrue);
+  PostData(22, fOutputpullAllpointTrue);
+  PostData(23, fOutputphiAllpointSkip);
+  PostData(24, fOutputphiPostvtracSkip);
+  PostData(25, fOutputphiNegtvtracSkip);
+  PostData(26, fOutputclusterTypeSPD01Skip);
+  PostData(27, fOutputclusterTypeSPD02Skip);
+  PostData(28, fOutputclusterTypeSPD03Skip);
+  PostData(29, fOutputclusterTypeSPD11Skip);
+  PostData(30, fOutputclusterTypeSPD12Skip);
+  PostData(31, fOutputclusterTypeSPD13Skip);
+  PostData(32, fOutputparticlePID);
+  PostData(33, fOutputPt);
+  PostData(34, fNentries);
+  PostData(35, fEstimVtx);  
 
   return;
 }
index efea3c7..e0d87a1 100644 (file)
@@ -128,7 +128,8 @@ void AliAnalysisTaskSPD::UserCreateOutputObjects() {
 
   Info("CreateOutputObjects","CreateOutputObjects of task %s", GetName());
   if(fRunNb!=999){
-    LoadGeometryFromOCDB();
+    // Geometry is loaded (including ITS alignment) by AliTaskCDBconnect (A.G. 14/10/2011) 
+    if (fTest) LoadGeometryFromOCDB();
   }
   fSegSPD = new AliITSsegmentationSPD();