]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New class
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 22 Feb 2007 17:33:39 +0000 (17:33 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 22 Feb 2007 17:33:39 +0000 (17:33 +0000)
PWG4/AliTriggerPHOS.cxx [new file with mode: 0644]
PWG4/AliTriggerPHOS.h [new file with mode: 0644]
PWG4/PWG4GammaLinkDef.h
PWG4/libPWG4Gamma.pkg

diff --git a/PWG4/AliTriggerPHOS.cxx b/PWG4/AliTriggerPHOS.cxx
new file mode 100644 (file)
index 0000000..e69bc3c
--- /dev/null
@@ -0,0 +1,193 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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.                  *
+ **************************************************************************/
+
+//_________________________________________________________________________
+// An analysis task to check the PHOS photon data in simulated data
+//
+//*-- Yves Schutz 
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TFile.h> 
+#include <TNtuple.h>
+#include <TVector3.h> 
+
+#include "AliTriggerPHOS.h" 
+#include "AliESD.h" 
+#include "AliLog.h"
+
+//______________________________________________________________________________
+AliTriggerPHOS::AliTriggerPHOS(const char *name) : 
+  AliAnalysisTask(name,""),  
+  fChain(0),
+  fESD(0), 
+  fOutputContainer(0),
+  fNtTrigger22(0), 
+  fNtTriggerNN(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()) ; 
+}
+
+//______________________________________________________________________________
+AliTriggerPHOS::~AliTriggerPHOS()
+{
+  // dtor
+  fOutputContainer->Clear() ; 
+  delete fOutputContainer ;
+  delete fNtTrigger22 ; 
+  delete fNtTriggerNN ; 
+}
+
+
+//______________________________________________________________________________
+void AliTriggerPHOS::ConnectInputData(const Option_t*)
+{
+  // Initialisation of branch container and histograms 
+    
+  AliInfo(Form("*** Initialization of %s", GetName())) ; 
+  
+  // Get input data
+  fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
+  if (!fChain) {
+    AliError(Form("Input 0 for %s not found\n", GetName()));
+    return ;
+  }
+  
+  // One should first check if the branch address was taken by some other task
+  char ** address = (char **)GetBranchAddress(0, "ESD");
+  if (address) {
+    fESD = (AliESD*)(*address);
+  } else {
+    fESD = new AliESD();
+    SetBranchAddress(0, "ESD", &fESD);
+  }
+}
+
+//________________________________________________________________________
+
+void AliTriggerPHOS::CreateOutputObjects()
+{  
+
+  // create histograms 
+  fNtTrigger22 = new TNtuple("PHOStrigger22", "Trigger data 2x2 patch", "a22:a220:enMax:phEnMax:p22:eta22:phi22:etaMax:phiMax:phEtaMax:phPhiMax");
+  fNtTriggerNN = new TNtuple("PHOStriggerNN", "Trigger data NxN patch", "aNN:aNN0:enMax:phEnMax:pNN:etaNN:phiNN:etaMax:phiMax:phEtaMax:phPhiMax");
+
+  // create output container
+  
+  fOutputContainer = new TObjArray(2) ; 
+  fOutputContainer->SetName(GetName()) ; 
+
+  fOutputContainer->AddAt(fNtTrigger22,             0) ; 
+  fOutputContainer->AddAt(fNtTriggerNN,             1) ; 
+
+}
+
+//______________________________________________________________________________
+void AliTriggerPHOS::Exec(Option_t *) 
+{
+  // Processing of one event
+  
+  Long64_t entry = fChain->GetReadEntry() ;
+  
+  if (!fESD) {
+    AliError("fESD is not connected to the input!") ; 
+    return ; 
+  }
+  
+  if ( !((entry-1)%100) ) 
+    AliInfo(Form("%s ----> Processing event # %lld",  (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ; 
+  
+  // ************************  PHOS *************************************
+  // Get trigger information 
+  
+  // trigger amplitudes
+  const TArrayF * triggerAmplitudes      = fESD->GetPHOSTriggerAmplitudes();
+  const Float_t a22    = static_cast<Float_t>(triggerAmplitudes->At(0)) ; 
+  const Float_t a22O   = static_cast<Float_t>(triggerAmplitudes->At(1)) ; 
+  const Float_t aNN    = static_cast<Float_t>(triggerAmplitudes->At(2)) ; 
+  const Float_t aNNO   = static_cast<Float_t>(triggerAmplitudes->At(3)) ; 
+
+  // trigger position
+  const TArrayI * triggerCells      = fESD->GetPHOSTriggerCells();
+  const Float_t p22    =  static_cast<Float_t>(triggerCells->At(0)) ; 
+  const Float_t phi22  =  static_cast<Float_t>(triggerCells->At(1)) ;
+  const Float_t eta22  =  static_cast<Float_t>(triggerCells->At(2)) ;
+  const Float_t pNN    =  static_cast<Float_t>(triggerCells->At(3)) ; 
+  const Float_t phiNN  =  static_cast<Float_t>(triggerCells->At(4)) ;
+  const Float_t etaNN  =  static_cast<Float_t>(triggerCells->At(5)) ; 
+  
+  Int_t       firstPhosCluster       = fESD->GetFirstPHOSCluster() ;
+  const Int_t numberOfPhosClusters   = fESD->GetNumberOfPHOSClusters() ;
+   
+  Float_t enMax       = 0. ;
+  Float_t phEnMax     = 0. ;
+  Float_t etaMax      = 999. ;
+  Float_t phiMax      = 999. ; 
+  Float_t phEtaMax    = 999. ;
+  Float_t phPhiMax    = 999. ; 
+
+  Int_t      phosCluster ; 
+  
+  // loop over the PHOS Cluster
+  
+  for(phosCluster = firstPhosCluster ; phosCluster < firstPhosCluster + numberOfPhosClusters ; phosCluster++) {
+    AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(phosCluster) ;
+    if (caloCluster) {
+
+      Float_t cluEnergy = caloCluster->GetClusterEnergy() ; 
+      Float_t pos[3] ;
+      TVector3 vpos ;
+      
+      caloCluster->GetGlobalPosition( pos ) ;
+      
+      if ( cluEnergy > enMax) { 
+       enMax = cluEnergy ; 
+       vpos.SetXYZ(pos[0], pos[1], pos[2]) ; 
+       etaMax = vpos.Eta() ; 
+       phiMax = vpos.Phi() ; 
+      }
+
+      Float_t * pid = caloCluster->GetPid() ;
+      
+      if(pid[AliPID::kPhoton] > 0.9) {
+       if ( cluEnergy > phEnMax) { 
+         phEnMax = cluEnergy ; 
+         vpos.SetXYZ(pos[0], pos[1], pos[2]) ; 
+         phEtaMax = vpos.Eta() ; 
+         phPhiMax = vpos.Phi() ; 
+       }
+      }
+    }
+    
+    fNtTrigger22->Fill(a22, a22O, enMax, phEnMax, p22, eta22, phi22, etaMax, phiMax, phEtaMax, phPhiMax );
+    fNtTriggerNN->Fill(aNN, aNNO, enMax, phEnMax, pNN, etaNN, phiNN, etaMax, phiMax, phEtaMax, phPhiMax );
+ }
+  
+  
+  PostData(0, fOutputContainer);
+  
+}
+
+//______________________________________________________________________________
+void AliTriggerPHOS::Terminate(Option_t *)
+{
+  // Processing when the event loop is ended
+
+}
diff --git a/PWG4/AliTriggerPHOS.h b/PWG4/AliTriggerPHOS.h
new file mode 100644 (file)
index 0000000..1acd822
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef ALIPHOSQATASK_H
+#define ALIPHOSQATASK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice     */
+//______________________________________________________________________________
+// An analysis task to check the PHOS photon data in simulated data
+//
+//*-- Yves Schutz 
+//////////////////////////////////////////////////////////////////////////////
+
+#include <TTree.h> 
+#include "AliAnalysisTask.h"  
+
+class AliESD ; 
+class TNtuple ;
+class TH1D ; 
+class TH1I ; 
+
+class AliTriggerPHOS : public AliAnalysisTask {
+
+public:
+  AliTriggerPHOS(const char *name) ;
+  virtual ~AliTriggerPHOS() ;
+   
+  virtual void Exec(Option_t * opt = "") ;
+  virtual void ConnectInputData(Option_t *);
+  virtual void CreateOutputObjects();
+  virtual void Terminate(Option_t * opt = "") ;
+
+private:
+  TTree   * fChain ;            //!pointer to the analyzed TTree or TChain
+  AliESD  * fESD ;              //! Declaration of leave types
+
+  TObjArray * fOutputContainer ; //! output data container
+
+  // Histograms
+  TNtuple * fNtTrigger22 ;
+  TNtuple * fNtTriggerNN ;
+
+  ClassDef(AliTriggerPHOS, 0); // a PHOS photon analysis task 
+};
+#endif // ALIPHOSQATASK_H
index a70f06649bca329bf04f0f912dd6606bc24bb1a8..cbaae05ed8a602b8869fe9625e64393b5b1c71e6 100644 (file)
@@ -8,5 +8,6 @@
 #pragma link C++ class AliAnaGammaIsolCut+;
 #pragma link C++ class AliAnaGammaHadron+;
 #pragma link C++ class AliAnaGammaJet+;
 #pragma link C++ class AliAnaGammaIsolCut+;
 #pragma link C++ class AliAnaGammaHadron+;
 #pragma link C++ class AliAnaGammaJet+;
+#pragma link C++ class AliTriggerPHOS+;
 
 #endif
 
 #endif
index 8df0c62f104bd791c2f7d9e422eff77cd70045a6..63b42acc0f18b39ebd870a344bb022a750eb4d20 100644 (file)
@@ -1,4 +1,4 @@
-SRCS = AliAnaGammaDirect.cxx AliAnaGammaIsolCut.cxx AliAnaGammaHadron.cxx AliAnaGammaJet.cxx
+SRCS = AliAnaGammaDirect.cxx AliAnaGammaIsolCut.cxx AliAnaGammaHadron.cxx AliAnaGammaJet.cxx AliTriggerPHOS.cxx
 
 HDRS:= $(SRCS:.cxx=.h) 
 
 
 HDRS:= $(SRCS:.cxx=.h)