]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding AliAODConversionParticle class
authorslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 Dec 2010 14:54:58 +0000 (14:54 +0000)
committerslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 Dec 2010 14:54:58 +0000 (14:54 +0000)
PWG4/GammaConv/AliAODConversionParticle.cxx [new file with mode: 0644]
PWG4/GammaConv/AliAODConversionParticle.h [new file with mode: 0644]

diff --git a/PWG4/GammaConv/AliAODConversionParticle.cxx b/PWG4/GammaConv/AliAODConversionParticle.cxx
new file mode 100644 (file)
index 0000000..521b14b
--- /dev/null
@@ -0,0 +1,155 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt, Svein Lindal          *
+ * Version 1.0                                                            *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+////////////////////////////////////////////////
+//--------------------------------------------- 
+// Class containing the aod information we need
+//---------------------------------------------
+////////////////////////////////////////////////
+
+#include "AliAODConversionParticle.h"
+//#include "AliAODv0.h"
+#include "AliStack.h"
+#include "AliESDEvent.h"
+//#include "AliESDtrack.h"
+#include "TParticle.h"
+
+class AliAODv0;
+class AliESDtrack;
+
+using namespace std;
+
+ClassImp(AliAODConversionParticle)
+
+
+
+AliAODConversionParticle::AliAODConversionParticle() :
+  AliAODPhoton(),
+  fChi2(0),
+  fIMass(0), 
+//fTagged(kFALSE),
+  fMCStack(NULL),
+  fESDEvent(NULL)
+{
+  //Default constructor
+  fLabel[0] = -1;
+  fLabel[1] = -1;
+}
+
+AliAODConversionParticle::AliAODConversionParticle(TLorentzVector & momentum) :
+  AliAODPhoton(momentum),
+  fChi2(-1),
+  fIMass(-1), 
+//fTagged(kFALSE),
+  fMCStack(NULL),
+  fESDEvent(NULL)
+{
+  //Default constructor
+  fLabel[0] = -1;
+  fLabel[1] = -1;
+}
+
+AliAODConversionParticle::AliAODConversionParticle(const AliAODConversionParticle & original) :
+  AliAODPhoton(original),
+  fChi2(original.fChi2),
+  fIMass(original.fIMass),
+  //fTagged(original.fTagged),
+  fMCStack(original.fMCStack),
+  fESDEvent(original.fESDEvent)
+{
+  //Copy constructor
+  fLabel[0] = original.fLabel[0];
+  fLabel[1] = original.fLabel[1];
+}
+
+
+AliAODConversionParticle & AliAODConversionParticle::operator = (const AliAODConversionParticle & /*source*/)
+{
+  // assignment operator
+  return *this;
+}
+
+
+Int_t AliAODConversionParticle::GetGammaMCLabel() const{
+  // returns the MC label of the gamma (if both electrons have the same mother)
+  Int_t iResult = -1;
+  if(fMCStack != NULL){
+    Int_t mcLabel1= GetElectronMCLabel1();
+    Int_t mcLabel2= GetElectronMCLabel2();
+    if(mcLabel1>=0 && mcLabel2>=0){
+      TParticle *electron1 = fMCStack->Particle(mcLabel1);
+      TParticle *electron2 = fMCStack->Particle(mcLabel2);
+      if(electron1->GetMother(0) == electron2->GetMother(0)){
+       iResult = electron1->GetMother(0);
+      }
+    }
+  }
+  return iResult;
+}
+
+Int_t AliAODConversionParticle::GetElectronUniqueID(Int_t mcLabel1, Int_t mcLabel2) const{
+  Int_t iResult = -1;
+  if(fMCStack != NULL){
+    if(mcLabel1>=0 && mcLabel2>=0){
+      TParticle *electron1 = fMCStack->Particle(mcLabel1);
+      TParticle *electron2 = fMCStack->Particle(mcLabel2);
+      if(electron1->GetMother(0) == electron2->GetMother(0)){
+       if(electron1->GetUniqueID() == electron2->GetUniqueID()){
+         iResult = (Int_t)electron1->GetUniqueID();
+       }
+      }
+    }
+  }
+  
+  return iResult;
+}
+
+Int_t AliAODConversionParticle::GetElectronUniqueID() const{
+  // returns the unique id of the electrons if they have the same mother and unique id
+  if(fMCStack != NULL){
+    return GetElectronUniqueID(GetElectronMCLabel1(), GetElectronMCLabel2());
+  }  
+  return -1;
+}
+
+
+Int_t AliAODConversionParticle::GetMCLabel(Int_t label) const {
+  //returns the MC label of the first electron
+  Int_t iResult=-1;
+  if(fESDEvent != NULL){
+    if(label>=0){
+      iResult = fESDEvent->GetTrack(label)->GetLabel();
+    }
+  }
+  return iResult;
+}
+
+Int_t AliAODConversionParticle::GetElectronMCLabel1() const{
+  //returns the MC label of the first electron
+  if(fLabel[0] >=0) {
+    return GetMCLabel(fLabel[0]);
+  }
+  
+  return -1;
+}
+
+Int_t AliAODConversionParticle::GetElectronMCLabel2() const{
+  //returns the MC label of the first electron
+  if(fLabel[1] >=0) {
+    return GetMCLabel(fLabel[1]);
+  }
+  
+  return -1;
+}
diff --git a/PWG4/GammaConv/AliAODConversionParticle.h b/PWG4/GammaConv/AliAODConversionParticle.h
new file mode 100644 (file)
index 0000000..6cf5602
--- /dev/null
@@ -0,0 +1,98 @@
+#ifndef ALIAODCONVERSIONPARTICLE_H
+#define ALIAODCONVERSIONPARTICLE_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice     */
+
+////////////////////////////////////////////////
+//--------------------------------------------- 
+// Class containing the aod information from conversions
+//---------------------------------------------
+////////////////////////////////////////////////
+
+// --- ROOT system ---
+
+class AliStack;
+class AliESDEvent;
+#include "TMath.h"
+#include "AliAODPhoton.h"
+
+class AliAODConversionParticle : public AliAODPhoton {
+
+ public: 
+
+  //Constructors
+  AliAODConversionParticle();    
+  AliAODConversionParticle(TLorentzVector& momentum); 
+  //Copy Constructor
+  AliAODConversionParticle(const AliAODConversionParticle & g);           
+  //assignment operator
+  AliAODConversionParticle & operator = (const AliAODConversionParticle & g);
+
+  //Destructor
+  virtual ~AliAODConversionParticle() {;}
+
+  ///Set the Chi2 of reconstructed conversion gamma
+  void SetChi2(Float_t chi2) {fChi2 = chi2;}
+
+  ///Set track or MC labels
+  void SetLabel1(Int_t label){fLabel[0] = label;}
+  void SetLabel2(Int_t label){fLabel[1] = label;}
+  void SetTrackLabels(Int_t label1, Int_t label2){fLabel[0] = label1; fLabel[1] = label2;}
+  
+  ///Set Invariant mass
+  void SetIMass(Float_t im) { fIMass = im; }
+
+  ///Set the tag for decay meson
+  //void SetTag( Bool_t tagged ) { fTagged = tagged; }
+
+  ///Set pointer to MC stack
+  void SetStack(AliStack* const stack){fMCStack=stack;}
+  
+  ///Set pointer to ESD event
+  void SetESDEvent(AliESDEvent* const esdEvent){fESDEvent = esdEvent;}
+
+  //Get the Chi2 of particle
+  Float_t Chi2() const {return fChi2;}
+
+  ///Get Invariant mass of particle
+  Float_t IMass() const { return fIMass; }
+
+  ///Get track or MC labels
+  Int_t GetLabel1() const{return fLabel[0];}
+  Int_t GetLabel2() const {return fLabel[1];}
+  Int_t GetTrackLabel(Int_t i) const {return fLabel[i];}
+  void  GetTrackLabels(Int_t * labels) { labels[0] = fLabel[0]; labels[1] = fLabel[1];} 
+
+
+  
+  Int_t GetMCLabel(Int_t Label) const;
+
+
+  /* This function returns the Gamma MC label */
+  Int_t GetGammaMCLabel() const;
+  
+  /* This function returns the unique id  of the electrons (if they have the same mother and unique id) */
+  Int_t GetElectronUniqueID() const;
+  Int_t GetElectronUniqueID(Int_t mcLabel1, Int_t mcLabel2) const;
+  
+  /// Get MC labels of electrons
+  Int_t GetElectronMCLabel1() const;
+  Int_t GetElectronMCLabel2() const;
+
+ private:
+
+  Int_t fLabel[2];
+  Float_t fChi2; // Chi sq of reconstructed mother
+  Float_t fIMass; //Invariant mass, 0 for photons
+  //Bool_t fTagged; // Is it tagged as decay pion (only for gammas)
+  AliStack* fMCStack; //!transient pointer to the mc stack
+  AliESDEvent * fESDEvent; //!transient pointer to the esdevent
+
+  ClassDef(AliAODConversionParticle,1)
+};
+
+
+#endif
+
+
+