implemented destructors
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Jul 2006 07:56:05 +0000 (07:56 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Jul 2006 07:56:05 +0000 (07:56 +0000)
PWG0/dNdEta/AliMultiplicityESDSelector.cxx
PWG0/dNdEta/AlidNdEtaAnalysisESDSelector.cxx
PWG0/dNdEta/AlidNdEtaCorrection.cxx
PWG0/dNdEta/AlidNdEtaCorrection.h

index 03c678b..b08da1b 100644 (file)
@@ -26,8 +26,6 @@ AliMultiplicityESDSelector::AliMultiplicityESDSelector() :
   //
   // Constructor. Initialization of pointers
   //
-
-  AliLog::SetClassDebugLevel("AliMultiplicityESDSelector", AliLog::kDebug);
 }
 
 AliMultiplicityESDSelector::~AliMultiplicityESDSelector()
@@ -117,14 +115,10 @@ Bool_t AliMultiplicityESDSelector::Process(Long64_t entry)
     return kTRUE;
 
   // get number of "good" tracks
-  TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD);
-  Int_t nGoodTracks = list->GetEntries();
-  delete list;
-  list = 0;
+  Int_t nGoodTracks = fEsdTrackCuts->CountAcceptedTracks(fESD);
 
   fMultiplicity->Fill(nGoodTracks);
 
-
   return kTRUE;
 }
 
index f9771dd..1e01297 100644 (file)
@@ -43,6 +43,36 @@ AlidNdEtaAnalysisESDSelector::~AlidNdEtaAnalysisESDSelector()
 
   // histograms are in the output list and deleted when the output
   // list is deleted by the TSelector dtor
+
+  if (fdNdEtaAnalysis)
+  {
+    delete fdNdEtaAnalysis;
+    fdNdEtaAnalysis = 0;
+  }
+
+  if (fdNdEtaAnalysisMB)
+  {
+    delete fdNdEtaAnalysisMB;
+    fdNdEtaAnalysisMB = 0;
+  }
+
+  if (fdNdEtaAnalysisMBVtx)
+  {
+    delete fdNdEtaAnalysisMBVtx;
+    fdNdEtaAnalysisMBVtx = 0;
+  }
+
+  if (fEsdTrackCuts)
+  {
+    delete fEsdTrackCuts;
+    fEsdTrackCuts = 0;
+  }
+
+  if (fdNdEtaCorrection)
+  {
+    delete fdNdEtaCorrection;
+    fdNdEtaCorrection = 0;
+  }
 }
 
 void AlidNdEtaAnalysisESDSelector::Begin(TTree* tree)
@@ -183,7 +213,7 @@ Bool_t AlidNdEtaAnalysisESDSelector::Process(Long64_t entry)
     }
 
     Double_t p[3];
-    esdTrack->GetConstrainedPxPyPz(p); // ### TODO or GetInnerPxPyPy / GetOuterPxPyPy
+    esdTrack->GetConstrainedPxPyPz(p); // ### TODO should be okay because we have a vertex, however GetInnerPxPyPy / GetOuterPxPyPy also exist
     TVector3 vector(p);
 
     Float_t theta = vector.Theta();
@@ -230,9 +260,16 @@ void AlidNdEtaAnalysisESDSelector::SlaveTerminate()
     return;
   }
 
+  // Add the objects to the output list and set them to 0, so that the destructor does not delete them.
+
   fOutput->Add(fdNdEtaAnalysis);
+  fdNdEtaAnalysis = 0;
+
   fOutput->Add(fdNdEtaAnalysisMB);
+  fdNdEtaAnalysisMB = 0;
+
   fOutput->Add(fdNdEtaAnalysisMBVtx);
+  fdNdEtaAnalysisMBVtx = 0;
 }
 
 void AlidNdEtaAnalysisESDSelector::Terminate()
index 0ca7dd5..8509f47 100644 (file)
@@ -25,6 +25,10 @@ AlidNdEtaCorrection::AlidNdEtaCorrection()
 //____________________________________________________________________
 AlidNdEtaCorrection::AlidNdEtaCorrection(const Char_t* name, const Char_t* title)
   : TNamed(name, title),
+  fTrack2ParticleCorrection(0),
+  fVertexRecoCorrection(0),
+  fTriggerCorrection(0),
+  fTriggerBiasCorrection(0),
   fNEvents(0),
   fNTriggeredEvents(0)
 {
@@ -52,6 +56,36 @@ AlidNdEtaCorrection::AlidNdEtaCorrection(const Char_t* name, const Char_t* title
 }
 
 //____________________________________________________________________
+AlidNdEtaCorrection::~AlidNdEtaCorrection()
+{
+  // destructor
+
+  if (fTrack2ParticleCorrection)
+  {
+    delete fTrack2ParticleCorrection;
+    fTrack2ParticleCorrection = 0;
+  }
+
+  if (fVertexRecoCorrection)
+  {
+    delete fVertexRecoCorrection;
+    fVertexRecoCorrection = 0;
+  }
+
+  if (fTriggerCorrection)
+  {
+    delete fTriggerCorrection;
+    fTriggerCorrection = 0;
+  }
+
+  if (fTriggerBiasCorrection)
+  {
+    delete fTriggerBiasCorrection;
+    fTriggerBiasCorrection = 0;
+  }
+}
+
+//____________________________________________________________________
 void
 AlidNdEtaCorrection::Finish() {
   //
index bb5a054..69d6cb0 100644 (file)
@@ -29,6 +29,8 @@ public:
   AlidNdEtaCorrection();
   AlidNdEtaCorrection(const Char_t* name, const Char_t* title);
 
+  ~AlidNdEtaCorrection();
+
   // fVertexRecoCorrection, fTriggerCorrection
   void FillEvent(Float_t vtx, Float_t n)                        {fTriggerCorrection->FillGene(vtx, n);}
   void FillEventWithTrigger(Float_t vtx, Float_t n)             {fVertexRecoCorrection->FillGene(vtx, n); fTriggerCorrection->FillMeas(vtx, n);}