New QA tasks for p-A
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Jan 2013 13:10:59 +0000 (13:10 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Jan 2013 13:10:59 +0000 (13:10 +0000)
PWGPP/ZDC/AddTaskZDCQA.C
PWGPP/ZDC/AliAnalysisTaskZDCpA.cxx [new file with mode: 0644]
PWGPP/ZDC/AliAnalysisTaskZDCpA.h [new file with mode: 0644]

index 730494d..7f2da38 100644 (file)
@@ -20,10 +20,8 @@ AliAnalysisTaskSE* AddTaskZDCQA()
   
    // Configure analysis
    //===========================================================================
-   
-   AliAnalysisTaskZDC* task = new AliAnalysisTaskZDC("AliAnaZDCQA");
+   //AliAnalysisTaskZDC* task = new AliAnalysisTaskZDC("AliAnaZDCQA");
+   AliAnalysisTaskZDCpA* task = new AliAnalysisTaskZDCpA("AliAnaZDCQA");
    mgr->AddTask(task);
   
    AliAnalysisDataContainer *cout  = mgr->CreateContainer("QAZDCHists",TList::Class(),
diff --git a/PWGPP/ZDC/AliAnalysisTaskZDCpA.cxx b/PWGPP/ZDC/AliAnalysisTaskZDCpA.cxx
new file mode 100644 (file)
index 0000000..72e3a33
--- /dev/null
@@ -0,0 +1,335 @@
+/**************************************************************************
+ * Copyright(c) 1998-2008, 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.                  *
+ **************************************************************************/
+
+/////////////////////////////////////////////////////////////
+//                                                        //
+//     Class to analyze ZDC data                          //
+//                                                        //
+/////////////////////////////////////////////////////////////
+
+#include <TList.h>
+#include <TH2F.h>
+#include <TH1F.h>
+#include <TFile.h>
+#include <TString.h>
+
+#include "AliAnalysisManager.h"
+#include "AliInputEventHandler.h"
+#include "AliVEvent.h"
+#include "AliESD.h"
+#include "AliESDEvent.h"
+#include "AliESDHeader.h"
+#include "AliESDInputHandler.h"
+#include "AliESDZDC.h"
+#include "AliMultiplicity.h"
+#include "AliAODHandler.h"
+#include "AliAODEvent.h"
+#include "AliAODVertex.h"
+#include "AliAODMCHeader.h"
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+#include "AliHeader.h"
+#include "AliAODMCParticle.h"
+#include "AliAnalysisTaskSE.h"
+#include "AliGenEventHeader.h"
+#include "AliGenHijingEventHeader.h"
+#include "AliPhysicsSelectionTask.h"
+#include "AliPhysicsSelection.h"
+#include "AliBackgroundSelection.h"
+#include "AliTriggerAnalysis.h"
+#include "AliCentrality.h"
+#include "AliAnalysisTaskZDCpA.h"
+
+ClassImp(AliAnalysisTaskZDCpA)
+
+
+//________________________________________________________________________
+AliAnalysisTaskZDCpA::AliAnalysisTaskZDCpA():
+  AliAnalysisTaskSE(),
+    fDebug(0),
+    fIsMCInput(kFALSE),
+    fOutput(0x0),
+    fhTDCZNSum(0x0),
+    fhTDCZNDiff(0x0),
+    fhZNCSpectrum(0x0),
+    fhZNASpectrum(0x0),
+    fhZPCSpectrum(0x0),
+    fhZPASpectrum(0x0),
+    fhZEM1Spectrum(0x0),
+    fhZEM2Spectrum(0x0),
+    fhZNCpmc(0x0),      
+    fhZNApmc(0x0),      
+    fhZPCpmc(0x0),      
+    fhZPApmc(0x0),      
+    fhZNCCentroid(0x0), 
+    fhZNACentroid(0x0), 
+    fhZNCemd(0x0),        
+    fhZNAemd(0x0),
+    fhPMCZNCemd(0x0), 
+    fhPMCZNAemd(0x0),
+    fDebunch(0x0)
+{   
+   // Default constructor
+}   
+
+//________________________________________________________________________
+AliAnalysisTaskZDCpA::AliAnalysisTaskZDCpA(const char *name):
+  AliAnalysisTaskSE(name),
+    fDebug(0),
+    fIsMCInput(kFALSE),
+    fOutput(0x0),
+    fhTDCZNSum(0x0),
+    fhTDCZNDiff(0x0),
+    fhZNCSpectrum(0x0),
+    fhZNASpectrum(0x0),
+    fhZPCSpectrum(0x0),
+    fhZPASpectrum(0x0),
+    fhZEM1Spectrum(0x0),
+    fhZEM2Spectrum(0x0),
+    fhZNCpmc(0x0),      
+    fhZNApmc(0x0),      
+    fhZPCpmc(0x0),      
+    fhZPApmc(0x0),      
+    fhZNCCentroid(0x0), 
+    fhZNACentroid(0x0), 
+    fhZNCemd(0x0),        
+    fhZNAemd(0x0),
+    fhPMCZNCemd(0x0), 
+    fhPMCZNAemd(0x0),
+    fDebunch(0x0) 
+{  
+  // Output slot #1 writes into a TList container
+  DefineOutput(1, TList::Class()); 
+
+}
+
+//________________________________________________________________________
+AliAnalysisTaskZDCpA& AliAnalysisTaskZDCpA::operator=(const AliAnalysisTaskZDCpA& c)
+{
+  //
+  // Assignment operator
+  //
+  if (this!=&c) {
+    AliAnalysisTaskSE::operator=(c);
+  }
+  return *this;
+}
+
+//________________________________________________________________________
+AliAnalysisTaskZDCpA::AliAnalysisTaskZDCpA(const AliAnalysisTaskZDCpA& ana):
+  AliAnalysisTaskSE(ana),
+  fDebug(ana.fDebug),    
+  fIsMCInput(ana.fIsMCInput),
+  fOutput(ana.fOutput),
+  fhTDCZNSum(ana.fhTDCZNSum),
+  fhTDCZNDiff(ana.fhTDCZNDiff),
+  fhZNCSpectrum(ana.fhZNCSpectrum),
+  fhZNASpectrum(ana.fhZNASpectrum),
+  fhZPCSpectrum(ana.fhZPCSpectrum),
+  fhZPASpectrum(ana.fhZPASpectrum),
+  fhZEM1Spectrum(ana.fhZEM1Spectrum),
+  fhZEM2Spectrum(ana.fhZEM2Spectrum),
+  fhZNCpmc(ana.fhZNCpmc),       
+  fhZNApmc(ana.fhZNApmc),       
+  fhZPCpmc(ana.fhZPCpmc),       
+  fhZPApmc(ana.fhZPApmc),       
+  fhZNCCentroid(ana.fhZNCCentroid), 
+  fhZNACentroid(ana.fhZNACentroid), 
+  fhZNCemd(ana.fhZNCemd),       
+  fhZNAemd(ana.fhZNAemd),
+  fhPMCZNCemd(ana.fhPMCZNCemd), 
+  fhPMCZNAemd(ana.fhPMCZNAemd),
+  fDebunch(ana.fDebunch)
+{
+  //
+  // Copy Constructor  
+  //
+}
+//________________________________________________________________________
+AliAnalysisTaskZDCpA::~AliAnalysisTaskZDCpA()
+{
+  // Destructor
+  if(fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
+    delete fOutput; fOutput=0;
+  } 
+   
+}  
+
+//________________________________________________________________________
+void AliAnalysisTaskZDCpA::UserCreateOutputObjects()
+{
+  // Create the output containers
+
+  fOutput = new TList;
+  fOutput->SetOwner();
+  //fOutput->SetName("output");
+  
+  fhTDCZNSum = new TH1F("fhTDCZNSum","TDC_{ZNC}+TDC_{ZNA}",60,-30.,30.);
+  fhTDCZNSum->GetXaxis()->SetTitle("TDC_{ZNC}+TDC_{ZNA} (ns)");
+  fOutput->Add(fhTDCZNSum);      
+  
+  fhTDCZNDiff = new TH1F("fhTDCZNDiff","TDC_{ZNC}-TDC_{ZNA}",60,-30.,30.);
+  fhTDCZNDiff->GetXaxis()->SetTitle("TDC_{ZNC}-TDC_{ZNA} (ns)");
+  fOutput->Add(fhTDCZNDiff);     
+  
+  fhZNCSpectrum = new TH1F("fhZNCSpectrum", "ZNC signal", 200,0., 2000.);
+  fOutput->Add(fhZNCSpectrum);      
+  fhZNASpectrum = new TH1F("fhZNASpectrum", "ZNA signal", 200,0., 2000.) ;
+  fOutput->Add(fhZNASpectrum);      
+  fhZPCSpectrum = new TH1F("fhZPCSpectrum", "ZPC signal", 200,0., 2000.) ;
+  fOutput->Add(fhZPCSpectrum);      
+  fhZPASpectrum = new TH1F("fhZPASpectrum", "ZPA signal", 200,0., 2000.) ;
+  fOutput->Add(fhZPASpectrum);      
+  fhZEM1Spectrum = new TH1F("fhZEM1Spectrum", "ZEM1 signal", 100,0., 2000.);
+  fOutput->Add(fhZEM1Spectrum);      
+  fhZEM2Spectrum = new TH1F("fhZEM2Spectrum", "ZEM2 signal", 100,0., 2000.);
+  fOutput->Add(fhZEM2Spectrum);      
+  
+  fhZNCpmc = new TH1F("fhZNCpmc","ZNC PMC",200, 0., 2000.);
+  fOutput->Add(fhZNCpmc);      
+  fhZNApmc = new TH1F("fhZNApmc","ZNA PMC",200, 0., 12000.); 
+  fOutput->Add(fhZNApmc);      
+  fhZPCpmc = new TH1F("fhZPCpmc","ZPC PMC",200, 0., 2000.); 
+  fOutput->Add(fhZPCpmc);      
+  fhZPApmc = new TH1F("fhZPApmc","ZPA PMC",200, 0., 2000.); 
+  fOutput->Add(fhZPApmc);      
+  
+  fhZNCCentroid = new TH2F("fhZNCCentroid","Centroid over ZNC",70,-3.5,3.5,70,-3.5,3.5); 
+  fOutput->Add(fhZNCCentroid);      
+  fhZNACentroid = new TH2F("fhZNACentroid","Centroid over ZNA",70,-3.5,3.5,70,-3.5,3.5); 
+  fOutput->Add(fhZNACentroid);      
+  
+  fhZNCemd = new TH1F("fhZNCemd","ZNC signal lg",200,0.,6000.);         
+  fOutput->Add(fhZNCemd);      
+  fhZNAemd = new TH1F("fhZNAemd","ZNA signal lg",200,0.,6000.);         
+  fOutput->Add(fhZNAemd);      
+  fhPMCZNCemd = new TH1F("fhPMCZNCemd","ZNC PMC lg",200, 10., 6000.);   
+  fOutput->Add(fhPMCZNCemd);      
+  fhPMCZNAemd = new TH1F("fhPMCZNAemd","ZNA PMC lg",200, 10., 6000.);   
+  fOutput->Add(fhPMCZNAemd);     
+  
+  fDebunch = new TH2F("fDebunch","ZN TDC sum vs. diff", 120,-30,30,120,-30,-30);
+  fOutput->Add(fDebunch);     
+    
+  PostData(1, fOutput);
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskZDCpA::UserExec(Option_t */*option*/)
+{
+  // Execute analysis for current event:
+  if(fDebug>1) printf(" **** AliAnalysisTaskZDCpA::UserExec() \n");
+  
+  if (!InputEvent()) {
+    Printf("ERROR: InputEvent not available");
+    return;
+  }
+
+      
+  AliESDEvent* esd = dynamic_cast<AliESDEvent*> (InputEvent());
+  if(!esd) return;
+  // Select PHYSICS events (type=7, for data)
+  //if(!fIsMCInput && esd->GetEventType()!=7) return; 
+  
+  // ********* MC INFO *********************************
+  if(fIsMCInput){
+
+    AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+    if (!eventHandler) {
+      Printf("ERROR: Could not retrieve MC event handler");
+      return;
+    }
+  
+    AliMCEvent* mcEvent = eventHandler->MCEvent();
+    if (!mcEvent) {
+      Printf("ERROR: Could not retrieve MC event");
+      return;
+   }
+
+  }
+  // ****************************************************
+  
+  AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
+    
+  AliESDZDC *esdZDC = esd->GetESDZDC();
+  
+  if((((AliInputEventHandler*)(am->GetInputEventHandler()))->IsEventSelected())){
+  
+    fhZNCSpectrum->Fill(esdZDC->GetZDCN1Energy());       
+    fhZNASpectrum->Fill(esdZDC->GetZDCN2Energy());
+    fhZPCSpectrum->Fill(esdZDC->GetZDCP1Energy());               
+    fhZPASpectrum->Fill(esdZDC->GetZDCP2Energy());       
+    fhZEM1Spectrum->Fill(esdZDC->GetZDCEMEnergy(0));
+    fhZEM2Spectrum->Fill(esdZDC->GetZDCEMEnergy(1));
+  
+    const Double_t * towZNC = esdZDC->GetZN1TowerEnergy();
+    const Double_t * towZPC = esdZDC->GetZP1TowerEnergy();
+    const Double_t * towZNA = esdZDC->GetZN2TowerEnergy();
+    const Double_t * towZPA = esdZDC->GetZP2TowerEnergy();
+    //    
+    fhZNCpmc->Fill(towZNC[0]);    
+    fhZNApmc->Fill(towZNA[0]);    
+    fhZPCpmc->Fill(towZPC[0]);    
+    fhZPApmc->Fill(towZPA[0]);    
+  
+    Double_t xyZNC[2]={-99.,-99.}, xyZNA[2]={-99.,-99.};
+    esdZDC->GetZNCentroidInpp(xyZNC, xyZNA);
+    
+    fhZNCCentroid->Fill(xyZNC[0], xyZNC[1]); 
+    fhZNACentroid->Fill(xyZNA[0], xyZNA[1]); 
+    
+    const Double_t * towZNCLG = esdZDC->GetZN1TowerEnergyLR();
+    const Double_t * towZNALG = esdZDC->GetZN2TowerEnergyLR();
+    Double_t znclg=0., znalg=0.;
+    for(Int_t iq=0; iq<5; iq++){
+       znclg += towZNCLG[iq];
+       znalg += towZNALG[iq];
+    }
+    fhZNCemd->Fill(znclg/2.);   
+    fhZNAemd->Fill(znalg/2.);   
+    fhPMCZNCemd->Fill(towZNCLG[0]);   
+    fhPMCZNAemd->Fill(towZNALG[0]);   
+  
+  }
+    
+  Float_t tdcC=999., tdcA=999;
+  Float_t tdcSum=999., tdcDiff=999;
+  for(int i=0; i<4; i++){
+    if(esdZDC->GetZDCTDCData(10,i) != 0.){
+      tdcC = esdZDC->GetZDCTDCCorrected(10,i);
+      if(esdZDC->GetZDCTDCData(12,i) != 0.){
+        tdcA = esdZDC->GetZDCTDCCorrected(12,i);
+        tdcSum = tdcC+tdcA;
+        tdcDiff = tdcC-tdcA;
+      }
+    }
+    if(tdcSum!=999.) fhTDCZNSum->Fill(tdcSum); 
+    if(tdcDiff!=999.)fhTDCZNDiff->Fill(tdcDiff); 
+    if(tdcSum!=999. && tdcDiff!=999.)  fDebunch->Fill(tdcDiff, tdcSum);  
+  }
+  
+  PostData(1, fOutput);
+   
+}
+
+
+
+//________________________________________________________________________
+void AliAnalysisTaskZDCpA::Terminate(Option_t */*option*/)
+{
+  // Terminate analysis
+  //
+}
diff --git a/PWGPP/ZDC/AliAnalysisTaskZDCpA.h b/PWGPP/ZDC/AliAnalysisTaskZDCpA.h
new file mode 100644 (file)
index 0000000..79800c5
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef ALIANALYSISTASKZDCPA_H
+#define ALIANALYSISTASKZDCPA_H
+
+/* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//*****************************************************
+//   Class AliAnalysisTaskZDCpA
+//   author: Chiara Oppedisano
+//*****************************************************
+
+#include "AliAnalysisTaskSE.h"
+
+class TROOT;
+class TSystem;
+class TList;
+class TFile;
+class TH2F;
+class TTree;
+
+class AliAnalysisTaskZDCpA : public AliAnalysisTaskSE {
+
+ public:
+
+  AliAnalysisTaskZDCpA();
+  AliAnalysisTaskZDCpA(const char *name);
+  AliAnalysisTaskZDCpA& operator= (const AliAnalysisTaskZDCpA& ana);
+  AliAnalysisTaskZDCpA(const AliAnalysisTaskZDCpA& c);
+  virtual ~AliAnalysisTaskZDCpA();
+
+  // Implementation of interface methods
+  virtual void UserCreateOutputObjects();
+  virtual void UserExec(Option_t *option);
+  virtual void Terminate(Option_t *option);
+
+  virtual void  SetDebugLevel(Int_t level) {fDebug = level;}
+  void SetMCInput() {fIsMCInput = kTRUE;}
+ private:
+
+  Int_t    fDebug;             //  Debug flag
+  Bool_t   fIsMCInput;         // true when input is MC
+  //
+  TList   *fOutput;            //! list send on output slot 0
+  TH1F    *fhTDCZNSum;         //! TDC ZNC sum
+  TH1F    *fhTDCZNDiff;        //! TDC DIFF sum
+  TH1F    *fhZNCSpectrum;      //! ZNC spectra
+  TH1F    *fhZNASpectrum;      //! ZNA spectra
+  TH1F    *fhZPCSpectrum;      //! ZPC spectra
+  TH1F    *fhZPASpectrum;      //! ZPA spectra
+  TH1F    *fhZEM1Spectrum;     //! ZEM1 spectra
+  TH1F    *fhZEM2Spectrum;     //! ZEM2 spectra
+  TH1F    *fhZNCpmc;           //! ZNC PMCs
+  TH1F    *fhZNApmc;           //! ZNA PMCs
+  TH1F    *fhZPCpmc;           //! ZPC PMCs
+  TH1F    *fhZPApmc;           //! ZPA PMCs
+  TH2F    *fhZNCCentroid;       //! ZNC centroid
+  TH2F    *fhZNACentroid;       //! ZNA centroid
+  TH1F    *fhZNCemd;           //! ZNC sum low gain chain
+  TH1F    *fhZNAemd;           //! ZNA sum gain chain
+  TH1F    *fhPMCZNCemd;        //! ZNC PMC low gain chain
+  TH1F    *fhPMCZNAemd;        //! ZNA PMC low gain chain
+  TH2F    *fDebunch;            //! TDC sum vs. diff
+  
+  ClassDef(AliAnalysisTaskZDCpA,1); 
+
+};
+
+#endif
+