]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG1/AliAnalysisTaskV0QA.cxx
fixed bugs with the rule checker.
[u/mrichter/AliRoot.git] / PWG1 / AliAnalysisTaskV0QA.cxx
index e994c87888e4599082976c70134a88aadc11c43f..5e25e37bab2b18f0c8043b200b89ae1f3d697dc5 100644 (file)
@@ -7,8 +7,6 @@
 //-------------------------------------------------
 #define AliAnalysisTaskV0QA_cxx
 
-#include "Riostream.h"
-
 #include "TChain.h"
 #include "TH1.h"
 #include "TH2.h"
@@ -16,7 +14,7 @@
 
 //#include "TLorentzVector.h"
 
-#include "AliAnalysisTask.h"
+#include "AliAnalysisTaskSE.h"
 #include "AliTrackReference.h"
 #include "AliKFParticle.h"
 #include "AliKFVertex.h"
 #include "AliAnalysisTaskV0QA.h"
 
 ClassImp(AliAnalysisTaskV0QA)
+AliAnalysisTaskV0QA::AliAnalysisTaskV0QA() :AliAnalysisTaskSE(), 
+fESD(0), 
+fStack(0),
+fMCtruth(0),
+fChain(0),
+fOutputContainer(0),
+fSparseV0(0),
+fSparseK0(0),
+fSparseL(0),
+fSparseAL(0),
+fnEv(0),
+fgDim(50),
+fnConvGamGeant(-1),
+fgConvGamGeantIndex(0),
+feNegConvGamGeantIndex(0),
+fePosConvGamGeantIndex(0),
+feNegConvGamGeantLength(0),
+fePosConvGamGeantLength(0),
+feNegConvGamSingleRecIndex(0),
+fePosConvGamSingleRecIndex(0),
+feNegConvGamV0RecIndex(0),
+fePosConvGamV0RecIndex(0),
+fConvGamV0RecIndexPos(0),
+fConvGamV0RecIndexNeg(0),
+fnDecayLGeant(-1),
+flDecayLGeantIndex(0),
+fpiNegDecayLGeantIndex(0),
+fpPosDecayLGeantIndex(0),
+fpiNegDecayLGeantLength(0),
+fpPosDecayLGeantLength(0),
+fpiNegDecayLSingleRecIndex(0),
+fpPosDecayLSingleRecIndex(0),
+fpiNegDecayLV0RecIndex(0),
+fpPosDecayLV0RecIndex(0),
+fDecayLV0RecIndexPos(0),
+fDecayLV0RecIndexNeg(0),
+fnDecayALGeant(-1),
+falDecayALGeantIndex(0),
+fpiPosDecayALGeantIndex(0),
+fapNegDecayALGeantIndex(0),
+fpiPosDecayALGeantLength(0),
+fapNegDecayALGeantLength(0),
+fpiPosDecayALSingleRecIndex(0),
+fapNegDecayALSingleRecIndex(0),
+fpiPosDecayALV0RecIndex(0),
+fapNegDecayALV0RecIndex(0),
+fDecayALV0RecIndexPos(0),
+fDecayALV0RecIndexNeg(0),
+fnDecayK0Geant(-1),
+fK0DecayK0GeantIndex(0),
+fpiNegDecayK0GeantIndex(0),
+fpiPosDecayK0GeantIndex(0),
+fpiNegDecayK0GeantLength(0),
+fpiPosDecayK0GeantLength(0),
+fpiNegDecayK0SingleRecIndex(0),
+fpiPosDecayK0SingleRecIndex(0),
+fpiNegDecayK0V0RecIndex(0),
+fpiPosDecayK0V0RecIndex(0),
+fDecayK0V0RecIndexPos(0),
+fDecayK0V0RecIndexNeg(0),
+fpiPosK0Index(-1),
+fpiNegK0Index(-1),
+fnTracksPrim(-1),
+ftpcRefit(0),
+fitsRefit(0),
+ftrdRefit(0),
+ftrdOut(0),
+fDim(37),
+fValueL(0),
+fValueAL(0),
+fValueK0(0),
+fValueV0(0),
+fxminV0(0),
+fxmaxV0(0),
+fbinsV0(0),
+fRefTPC(0),
+fclRefsN(0),
+fclRefsP(0)
+
+ {
+  // Default Constructor.
+
+ }
 
 //________________________________________________________________________
-AliAnalysisTaskV0QA::AliAnalysisTaskV0QA(const char *name) :AliAnalysisTask(name,""), 
+AliAnalysisTaskV0QA::AliAnalysisTaskV0QA(const char *name) :AliAnalysisTaskSE(name), 
 fESD(0), 
 fStack(0),
 fMCtruth(0),
@@ -45,6 +126,7 @@ fSparseK0(0),
 fSparseL(0),
 fSparseAL(0),
 fnEv(0),
+fgDim(50),
 fnConvGamGeant(-1),
 fgConvGamGeantIndex(0),
 feNegConvGamGeantIndex(0),
@@ -57,7 +139,6 @@ feNegConvGamV0RecIndex(0),
 fePosConvGamV0RecIndex(0),
 fConvGamV0RecIndexPos(0),
 fConvGamV0RecIndexNeg(0),
-fgDim(50),
 fnDecayLGeant(-1),
 flDecayLGeantIndex(0),
 fpiNegDecayLGeantIndex(0),
@@ -101,6 +182,7 @@ ftpcRefit(0),
 fitsRefit(0),
 ftrdRefit(0),
 ftrdOut(0),
+fDim(37),
 fValueL(0),
 fValueAL(0),
 fValueK0(0),
@@ -108,30 +190,22 @@ fValueV0(0),
 fxminV0(0),
 fxmaxV0(0),
 fbinsV0(0),
-fDim(37),
 fRefTPC(0),
 fclRefsN(0),
 fclRefsP(0)
 
  {
-  // Constructor.
-  // Input slot #0 works with an Ntuple
-  DefineInput(0, TChain::Class());
-  // Output slot #0 writes into a TH1 container
-  //  DefineOutput(0,TObjArray::Class());
-  DefineOutput(0,TList::Class());
-
-  // Reconstructed arrays
-
-  fnEv=0;
-  fDim=37; 
-  fValueK0 = new Double_t[fDim];
-  fValueL = new Double_t[fDim];
-  fValueAL = new Double_t[fDim];
-  fValueV0 = new Double_t[fDim];
-  fxminV0 = new Double_t[fDim];
-  fxmaxV0 = new Double_t[fDim];
-  fbinsV0 = new Int_t[fDim];
+
+   fnEv=0;
+   fDim=37; 
+
+   fValueK0 = new Double_t[fDim];
+   fValueL = new Double_t[fDim];
+   fValueAL = new Double_t[fDim];
+   fValueV0 = new Double_t[fDim];
+   fxminV0 = new Double_t[fDim];
+   fxmaxV0 = new Double_t[fDim];
+   fbinsV0 = new Int_t[fDim];
 
 
   fgDim=50; 
@@ -207,19 +281,8 @@ fclRefsP(0)
 
 
   AliLog::SetGlobalLogLevel(AliLog::kError);
-
-}
-
-//________________________________________________________________________
-void AliAnalysisTaskV0QA::ConnectInputData(Option_t *) {
-  printf("   ConnectInputData %s\n", GetName());
-  // Connect Input Data
-  
-  AliESDInputHandler* esdH = (AliESDInputHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
-  fESD = esdH->GetEvent();
-  
-  fChain = (TChain*)GetInputData(0);
-
+//
+  DefineOutput(1, TList::Class());
 }
 
 //_____________________________________________________
@@ -299,7 +362,7 @@ AliAnalysisTaskV0QA::~AliAnalysisTaskV0QA()
 
 
 //________________________________________________________________________
-void AliAnalysisTaskV0QA::CreateOutputObjects() {
+void AliAnalysisTaskV0QA::UserCreateOutputObjects() {
   // Create Ouptut objects
 
   for(Int_t d=0;d<fDim;d++){
@@ -661,11 +724,13 @@ void AliAnalysisTaskV0QA::CreateOutputObjects() {
 }
 
 //________________________________________________________________________
-void AliAnalysisTaskV0QA::Exec(Option_t *) {
+void AliAnalysisTaskV0QA::UserExec(Option_t *) {
   // Execution of the Task
 
+    fESD = dynamic_cast<AliESDEvent*>(InputEvent());
+    
   if (!fESD) {
-    cout<< "not a tree"<< endl;
+    //cout<< "not a tree"<< endl;
     return;
   }
 
@@ -843,7 +908,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
 
        int nPointsP =  fclRefsP->GetEntries();
 
-       if (fRefTPC) delete fRefTPC;
+       if (fRefTPC) delete fRefTPC;fRefTPC=NULL;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsP; iPoint++) {
@@ -877,7 +942,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0); 
        int nPointsN =  fclRefsN->GetEntries();
 
-       if (fRefTPC) delete fRefTPC;
+       if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsN; iPoint++) {
@@ -965,7 +1030,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
  
 
        int nPointsP =  fclRefsP->GetEntries();
-       if (fRefTPC) delete fRefTPC;
+       if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsP; iPoint++) {
@@ -999,7 +1064,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0); 
 
        int nPointsN =  fclRefsN->GetEntries();
-       if (fRefTPC) delete fRefTPC;
+       if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsN; iPoint++) {
@@ -1087,7 +1152,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
  
 
        int nPointsP =  fclRefsP->GetEntries();
-       if (fRefTPC) delete fRefTPC;
+       if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
        fRefTPC = new TObjArray();
 
        for(int iPoint=0; iPoint<nPointsP; iPoint++) {
@@ -1320,7 +1385,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
   }
 
  
-  PostData(0,fOutputContainer );
+  PostData(1, fOutputContainer );
   
 
 }