o updates (Markus, Daniel)
authorwiechula <wiechula@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Dec 2012 13:36:58 +0000 (13:36 +0000)
committerwiechula <wiechula@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Dec 2012 13:36:58 +0000 (13:36 +0000)
ANALYSIS/TenderSupplies/AliTRDTenderSupply.cxx
ANALYSIS/TenderSupplies/AliTRDTenderSupply.h

index 61645c2..2bb9a98 100644 (file)
@@ -47,9 +47,9 @@
 #include <AliESDInputHandler.h>
 #include <AliAnalysisManager.h>
 #include <AliTrackerBase.h>
-#include <AliTRDPIDResponseObject.h>
+#include <AliTRDPIDReference.h>
 #include <AliTRDPIDResponse.h>
-#include "AliTRDCalChamberStatus.h"
+#include <AliTRDCalChamberStatus.h>
 #include <AliTender.h>
 
 #include "AliTRDTenderSupply.h"
@@ -66,14 +66,14 @@ AliTRDTenderSupply::AliTRDTenderSupply() :
   fChamberVdriftOld(NULL),
   fChamberVdriftNew(NULL),
   fRunByRunCorrection(NULL),
-  fPIDmethod(kNNpid),
+  fPIDmethod(k1DLQpid),
   fNormalizationFactor(1.),
   fPthreshold(0.8),
   fNBadChambers(0),
   fGeoFile(NULL),
   fGainCorrection(kTRUE),
-  fLoadReferences(kFALSE),
-  fLoadReferencesFromCDB(kFALSE),
+//  fLoadReferences(kFALSE),
+//  fLoadReferencesFromCDB(kFALSE),
   fLoadDeadChambers(kFALSE),
   fHasReferences(kFALSE),
   fHasNewCalibration(kTRUE),
@@ -84,7 +84,6 @@ AliTRDTenderSupply::AliTRDTenderSupply() :
   // default ctor
   //
   memset(fSlicesForPID, 0, sizeof(UInt_t) * 2);
-  memset(fBadChamberID, 0, sizeof(Int_t) * kNChambers);
 }
 
 //_____________________________________________________
@@ -97,14 +96,14 @@ AliTRDTenderSupply::AliTRDTenderSupply(const char *name, const AliTender *tender
   fChamberVdriftOld(NULL),
   fChamberVdriftNew(NULL),
   fRunByRunCorrection(NULL),
-  fPIDmethod(kNNpid),
+  fPIDmethod(k1DLQpid),
   fNormalizationFactor(1.),
   fPthreshold(0.8),
   fNBadChambers(0),
   fGeoFile(NULL),
   fGainCorrection(kTRUE),
-  fLoadReferences(kFALSE),
-  fLoadReferencesFromCDB(kFALSE),
+//  fLoadReferences(kFALSE),
+//  fLoadReferencesFromCDB(kFALSE),
   fLoadDeadChambers(kFALSE),
   fHasReferences(kFALSE),
   fHasNewCalibration(kTRUE),
@@ -142,7 +141,7 @@ void AliTRDTenderSupply::Init()
     fTender->GetESDhandler()->SetESDpid(fESDpid);
   }
   // Load References
-  if(fLoadReferences && !fLoadReferencesFromCDB) LoadReferences();
+  //if(fLoadReferences && !fLoadReferencesFromCDB) LoadReferences();
   //fESDpid->GetTRDResponse().SetGainNormalisationFactor(fNormalizationFactor);
   //fESDpid->SetTRDslicesForPID(fSlicesForPID[0], fSlicesForPID[1]);
 
@@ -171,7 +170,7 @@ void AliTRDTenderSupply::ProcessEvent()
   if (fTender->RunChanged()){
     AliDebug(0, Form("AliTPCTenderSupply::ProcessEvent - Run Changed (%d)\n",fTender->GetRun()));
     if (fGainCorrection) SetChamberGain();
-    if(fLoadReferences && !fHasReferences) LoadReferences();
+    //if(fLoadReferences && !fHasReferences) LoadReferences();
     if(fLoadDeadChambers) LoadDeadChambersFromCDB();
     // Load Geometry
     if(AliGeomManager::GetGeometry()){
@@ -257,6 +256,7 @@ void AliTRDTenderSupply::LoadDeadChambersFromCDB(){
   }
 }
 
+/*
 //_____________________________________________________
 void AliTRDTenderSupply::LoadReferences(){
   //
@@ -276,15 +276,15 @@ void AliTRDTenderSupply::LoadReferences(){
     // Get new references
     TIter refs(arr);
     TObject *o = NULL;
-    AliTRDPIDResponseObject *ref = NULL;
+    AliTRDPIDReference *ref = NULL;
     while((o = refs())){
-      if(!TString(o->IsA()->GetName()).CompareTo("AliTRDPIDResponseObject")){
-        ref = dynamic_cast<AliTRDPIDResponseObject *>(o);
+      if(!TString(o->IsA()->GetName()).CompareTo("AliTRDPIDReference")){
+        ref = dynamic_cast<AliTRDPIDReference *>(o);
         break;
       }
     }
     if(ref){
-      fESDpid->GetTRDResponse().SetPIDResponseObject(ref);
+      fESDpid->GetTRDResponse().Load(ref);
       fHasReferences = kTRUE;
       AliDebug(1, "Reference distributions loaded into the PID Response");
     } else {
@@ -297,6 +297,7 @@ void AliTRDTenderSupply::LoadReferences(){
     fHasReferences = kTRUE;
   }
 }
+*/
 
 //_____________________________________________________
 void AliTRDTenderSupply::SetChamberGain(){
@@ -467,10 +468,7 @@ void AliTRDTenderSupply::ApplyRunByRunCorrection(AliESDtrack *const track) {
   //
 
   TVectorD *corrfactor = dynamic_cast<TVectorD *>(fRunByRunCorrection->GetObject(fTender->GetRun()));
-  if(!corrfactor) {
-    AliDebug(2, "Couldn't derive gain correction factor from OADB");
-    return;
-  }
+  if(!corrfactor) AliDebug(2, "Couldn't derive gain correction factor from OADB");
   else AliDebug(2, Form("Gain factor from OADB %f", (*corrfactor)[0]));
   Double_t slice = 0;
   for(Int_t ily = 0; ily < kNPlanes; ily++){
@@ -524,6 +522,7 @@ Bool_t AliTRDTenderSupply::GetTRDchamberID(AliESDtrack * const track, Int_t *det
   Double_t xLayer[kNPlanes] = {300.2, 312.8, 325.4, 338., 350.6, 363.2};
   Double_t etamin[kNStacks] = {0.536, 0.157, -0.145, -0.527,-0.851};
   Double_t etamax[kNStacks] = {0.851, 0.527, 0.145, -0.157,-0.536};
+  //Double_t zboundary[kNPlanes] = {302., 317., 328., 343., 350., 350.};
   for(Int_t ily = 0; ily < kNPlanes; ily++) detectors[ily] = -1;
 
   const AliExternalTrackParam *trueparam = NULL;
@@ -539,28 +538,37 @@ Bool_t AliTRDTenderSupply::GetTRDchamberID(AliESDtrack * const track, Int_t *det
   Double_t pos[3];
   Int_t nDet = 0;
   for(Int_t ily = 0; ily < kNPlanes; ily++){
-    if(!AliTrackerBase::PropagateTrackToBxByBz(&workparam, xLayer[ily], 0.139, 100)){   // Assuming the pion mass
+    //if(TMath::Abs(workparam.GetZ()) > zboundary[ily]) break;
+    //if(!AliTrackerBase::PropagateTrackToBxByBz(&workparam, xLayer[ily], 0.139, 100)){   // Assuming the pion mass
+    if(!workparam.PropagateTo(xLayer[ily], fESD->GetMagneticField())) {
       AliDebug(2, "Propagation failed");
       break;
     }
     workparam.GetXYZ(pos);
     Double_t trackAlpha = TMath::ATan2(pos[1], pos[0]);
+    if(trackAlpha < 0) trackAlpha = 2 * TMath::Pi() + trackAlpha;
+    Double_t secAlpha = 2 * TMath::Pi() / 18.;
+   
+    Int_t sector = static_cast<Int_t>(trackAlpha/secAlpha);
+
     if(fDebugMode){
       // Compare to simple propagation without magnetic field
       AliExternalTrackParam workparam1(*trueparam); // Do calculation on working Copy
       Double_t pos1[3];
-      if(!workparam1.PropagateTo(xLayer[ily], fESD->GetMagneticField())) {
+      //if(!workparam1.PropagateTo(xLayer[ily], fESD->GetMagneticField())) {
+      if(!AliTrackerBase::PropagateTrackToBxByBz(&workparam1, xLayer[ily], 0.139, 100)){   // Assuming the pion mass
         AliDebug(2, "Propagation failed");
         break;
       }
       workparam1.GetXYZ(pos1);
       Double_t trackAlpha1 = TMath::ATan2(pos1[1], pos1[0]);
-      AliDebug(2, Form("Alpha: Old %f, New %f, diff %f", trackAlpha1, trackAlpha, trackAlpha-trackAlpha1));
-    }
-    if(trackAlpha < 0) trackAlpha = 2 * TMath::Pi() + trackAlpha;
-    Double_t secAlpha = 2 * TMath::Pi() / 18.;
+      if(trackAlpha1 < 0) trackAlpha1 = 2 * TMath::Pi() + trackAlpha1;
    
-    Int_t sector = static_cast<Int_t>(trackAlpha/secAlpha);
+      Int_t sector1 = static_cast<Int_t>(trackAlpha1/secAlpha);
+      AliDebug(2, Form("Alpha: Old %f, New %f, diff %f", trackAlpha, trackAlpha1, trackAlpha-trackAlpha1));
+      AliDebug(2, Form("Sector: Old %d, New %d", sector, sector1));
+    }
+
     Double_t etaTrack = track->Eta();
     Int_t stack = -1;
     for(Int_t istack = 0; istack < 5; istack++){
index 82ca5ad..7214092 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <AliTenderSupply.h>
 
-class AliTRDpidRecalculator;
 class AliTRDCalDet;
 class AliESDEvent;
 class AliOADBContainer;
@@ -32,8 +31,8 @@ public:
   virtual ~AliTRDTenderSupply();
 
   void SetRunByRunCorrection(const char *filename) { fNameRunByRunCorrection = filename; }
-  void SetLoadReferencesFromCDB() { fLoadReferences = kTRUE; fLoadReferencesFromCDB = kTRUE; }
-  void SetLoadReferencesFromFile() { fLoadReferences = kTRUE; fLoadReferencesFromCDB = kFALSE; }
+//  void SetLoadReferencesFromCDB() { fLoadReferences = kTRUE; fLoadReferencesFromCDB = kTRUE; }
+//  void SetLoadReferencesFromFile() { fLoadReferences = kTRUE; fLoadReferencesFromCDB = kFALSE; }
   void SetLoadDeadChambersFromCDB(){ fLoadDeadChambers = kTRUE;} ;
   void SetPIDmethod(Int_t pidMethod) { fPIDmethod = pidMethod; }
   void SetNormalizationFactor(Double_t norm) { fNormalizationFactor = norm; }
@@ -83,8 +82,8 @@ private:
   UInt_t fNBadChambers;              // Number of bad chambers
   const char *fGeoFile;              // File with geometry.root
   Bool_t fGainCorrection;            // Apply gain correction 
-  Bool_t fLoadReferences;            // Tender Load references
-  Bool_t fLoadReferencesFromCDB;     // Load References from CDB
+//  Bool_t fLoadReferences;            // Tender Load references
+//  Bool_t fLoadReferencesFromCDB;     // Load References from CDB
   Bool_t fLoadDeadChambers;          // Load dead chambers
   Bool_t fHasReferences;             // has references loaded
   Bool_t fHasNewCalibration;         // has new calibration