Changes for #89817: Commit calorimeter AOD
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 16 Dec 2011 11:37:42 +0000 (11:37 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 16 Dec 2011 11:37:42 +0000 (11:37 +0000)
14 files changed:
ANALYSIS/AliAnalysisTaskESDfilter.cxx
ANALYSIS/AliAnalysisTaskESDfilter.h
ANALYSIS/AliAnalysisTaskSE.cxx
ANALYSIS/AliAnalysisTaskSE.h
STEER/AOD/AliAODCaloTrigger.cxx [new file with mode: 0644]
STEER/AOD/AliAODCaloTrigger.h [new file with mode: 0644]
STEER/AOD/AliAODEvent.cxx
STEER/AOD/AliAODEvent.h
STEER/AOD/AliAODHandler.cxx
STEER/AOD/AliAODHandler.h
STEER/AOD/AliAODInputHandler.cxx
STEER/AOD/AliAODInputHandler.h
STEER/AODLinkDef.h
STEER/CMakelibAOD.pkg

index 2afc85c..6fede84 100644 (file)
@@ -19,6 +19,7 @@
 #include <TTree.h>\r
 #include <TList.h>\r
 #include <TArrayI.h>\r
+#include <TParameter.h>\r
 #include <TRandom.h>\r
 #include <TParticle.h>\r
 #include <TFile.h>\r
@@ -97,7 +98,9 @@ AliAnalysisTaskESDfilter::AliAnalysisTaskESDfilter():
     fAreCaloClustersEnabled(kTRUE),\r
     fAreEMCALCellsEnabled(kTRUE),\r
     fArePHOSCellsEnabled(kTRUE),\r
-    fAreTrackletsEnabled(kTRUE),\r
+               fAreEMCALTriggerEnabled(kTRUE),\r
+               fArePHOSTriggerEnabled(kFALSE),\r
+               fAreTrackletsEnabled(kTRUE),\r
     fESDpid(0x0),\r
     fIsPidOwner(kFALSE),\r
     fTimeZeroType(AliESDpid::kTOF_T0),\r
@@ -148,7 +151,9 @@ AliAnalysisTaskESDfilter::AliAnalysisTaskESDfilter(const char* name):
     fAreCaloClustersEnabled(kTRUE),\r
     fAreEMCALCellsEnabled(kTRUE),\r
     fArePHOSCellsEnabled(kTRUE),\r
-    fAreTrackletsEnabled(kTRUE),\r
+               fAreEMCALTriggerEnabled(kTRUE),\r
+               fArePHOSTriggerEnabled(kFALSE),\r
+               fAreTrackletsEnabled(kTRUE),\r
     fESDpid(0x0),\r
     fIsPidOwner(kFALSE),\r
     fTimeZeroType(AliESDpid::kTOF_T0),\r
@@ -194,14 +199,16 @@ void AliAnalysisTaskESDfilter::PrintTask(Option_t *option, Int_t indent) const
   \r
   TString spaces(' ',indent+3);\r
   \r
-  cout << spaces.Data() << Form("Cascades     are %s",fAreCascadesEnabled ? "ENABLED":"DISABLED") << endl;\r
-  cout << spaces.Data() << Form("V0s          are %s",fAreV0sEnabled ? "ENABLED":"DISABLED") << endl;\r
-  cout << spaces.Data() << Form("Kinks        are %s",fAreKinksEnabled ? "ENABLED":"DISABLED") << endl;\r
-  cout << spaces.Data() << Form("Tracks       are %s",fAreTracksEnabled ? "ENABLED":"DISABLED") << endl;\r
-  cout << spaces.Data() << Form("PmdClusters  are %s",fArePmdClustersEnabled ? "ENABLED":"DISABLED") << endl;\r
-  cout << spaces.Data() << Form("CaloClusters are %s",fAreCaloClustersEnabled ? "ENABLED":"DISABLED") << endl;\r
-  cout << spaces.Data() << Form("EMCAL cells  are %s",fAreEMCALCellsEnabled ? "ENABLED":"DISABLED") << endl;\r
-  cout << spaces.Data() << Form("Tracklets    are %s",fAreTrackletsEnabled ? "ENABLED":"DISABLED") << endl;  \r
+       cout << spaces.Data() << Form("Cascades       are %s",fAreCascadesEnabled ? "ENABLED":"DISABLED") << endl;\r
+       cout << spaces.Data() << Form("V0s            are %s",fAreV0sEnabled ? "ENABLED":"DISABLED") << endl;\r
+       cout << spaces.Data() << Form("Kinks          are %s",fAreKinksEnabled ? "ENABLED":"DISABLED") << endl;\r
+       cout << spaces.Data() << Form("Tracks         are %s",fAreTracksEnabled ? "ENABLED":"DISABLED") << endl;\r
+       cout << spaces.Data() << Form("PmdClusters    are %s",fArePmdClustersEnabled ? "ENABLED":"DISABLED") << endl;\r
+       cout << spaces.Data() << Form("CaloClusters   are %s",fAreCaloClustersEnabled ? "ENABLED":"DISABLED") << endl;\r
+  cout << spaces.Data() << Form("EMCAL cells    are %s",fAreEMCALCellsEnabled ? "ENABLED":"DISABLED") << endl;\r
+       cout << spaces.Data() << Form("EMCAL triggers are %s",fAreEMCALTriggerEnabled ? "ENABLED":"DISABLED") << endl;\r
+       cout << spaces.Data() << Form("PHOS triggers  are %s",fArePHOSTriggerEnabled ? "ENABLED":"DISABLED") << endl;\r
+       cout << spaces.Data() << Form("Tracklets      are %s",fAreTrackletsEnabled ? "ENABLED":"DISABLED") << endl;  \r
 }\r
 \r
 //______________________________________________________________________________\r
@@ -1428,6 +1435,74 @@ void AliAnalysisTaskESDfilter::ConvertCaloClusters(const AliESDEvent& esd)
 }\r
 \r
 //______________________________________________________________________________\r
+void AliAnalysisTaskESDfilter::ConvertCaloTrigger(TString calo, const AliESDEvent& esd)\r
+{\r
+       AliCodeTimerAuto("",0);\r
+               \r
+       if (calo == "PHOS") \r
+       {\r
+               AliLog::Message(AliLog::kError, "PHOS ESD filter not yet implemented", MODULENAME(), "ConvertCaloTrigger", FUNCTIONNAME(), __FILE__, __LINE__);\r
+               return;\r
+       }\r
+                       \r
+       AliAODHandler *aodHandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()); \r
+                       \r
+       if (aodHandler)\r
+       {\r
+               TTree *aodTree = aodHandler->GetTree();\r
+                                       \r
+               if (aodTree)\r
+               {\r
+                       Int_t *type = esd.GetCaloTriggerType();\r
+                                                       \r
+                       for (Int_t i = 0; i < 8; i++) \r
+                       {\r
+                               aodTree->GetUserInfo()->Add(new TParameter<int>(Form("EMCALCaloTrigger%d",i), type[i]));\r
+                       }\r
+               }\r
+       }\r
+                                               \r
+       AliAODCaloTrigger &aodTrigger = *(AODEvent()->GetCaloTrigger(calo));\r
+                                               \r
+       AliESDCaloTrigger &esdTrigger = *(esd.GetCaloTrigger(calo));\r
+                                               \r
+       aodTrigger.Allocate(esdTrigger.GetEntries());\r
+                                               \r
+       esdTrigger.Reset();\r
+       while (esdTrigger.Next())\r
+       {         \r
+               Int_t px, py, ts, nTimes, times[10], b; \r
+               Float_t a, t;\r
+                                                               \r
+               esdTrigger.GetPosition(px, py);\r
+                                               \r
+               esdTrigger.GetAmplitude(a);\r
+               esdTrigger.GetTime(t);\r
+                                                               \r
+               esdTrigger.GetL0Times(times);\r
+               esdTrigger.GetNL0Times(nTimes);\r
+                                                               \r
+               esdTrigger.GetL1TimeSum(ts);\r
+                                                               \r
+               esdTrigger.GetTriggerBits(b);\r
+                                                               \r
+               aodTrigger.Add(px, py, a, t, times, nTimes, ts, b);\r
+       }\r
+                                                       \r
+       aodTrigger.SetL1Threshold(0, esdTrigger.GetL1Threshold(0));\r
+       aodTrigger.SetL1Threshold(1, esdTrigger.GetL1Threshold(1));\r
+                                                       \r
+       Int_t v0[2] = \r
+       {\r
+               esdTrigger.GetL1V0(0),\r
+               esdTrigger.GetL1V0(1)\r
+       };              \r
+                                                               \r
+       aodTrigger.SetL1V0(v0); \r
+       aodTrigger.SetL1FrameMask(esdTrigger.GetL1FrameMask());\r
+}\r
+\r
+//______________________________________________________________________________\r
 void AliAnalysisTaskESDfilter::ConvertEMCALCells(const AliESDEvent& esd)\r
 {\r
 // Convert EMCAL Cells\r
@@ -1941,6 +2016,10 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD()
   if ( fAreEMCALCellsEnabled )ConvertEMCALCells(*esd);\r
   \r
   if ( fArePHOSCellsEnabled )ConvertPHOSCells(*esd);\r
+       \r
+       if ( fAreEMCALTriggerEnabled )ConvertCaloTrigger(TString("EMCAL"), *esd);\r
+\r
+       if ( fArePHOSTriggerEnabled )ConvertCaloTrigger(TString("PHOS"), *esd);\r
   \r
   if ( fAreTrackletsEnabled ) ConvertTracklets(*esd);\r
   \r
index 918d1d4..1e0588d 100644 (file)
@@ -71,6 +71,7 @@ class AliAnalysisTaskESDfilter : public AliAnalysisTaskSE
   void DisablePmdClusters() { fArePmdClustersEnabled = kFALSE; }
   void DisableCaloClusters() { fAreCaloClustersEnabled = kFALSE; }
   void DisableCells() { fAreEMCALCellsEnabled = fArePHOSCellsEnabled = kFALSE; }
+  void DisableCaloTrigger(TString calo = "PHOS") { if (calo.Contains("EMCAL")) fAreEMCALTriggerEnabled = kFALSE; else fArePHOSTriggerEnabled = kFALSE; }
   void DisableTracklets() { fAreTrackletsEnabled = kFALSE; }
 
   virtual void SetTimeZeroType(AliESDpid::EStartTimeType_t tofTimeZeroType) {fTimeZeroType = tofTimeZeroType;}
@@ -91,6 +92,7 @@ private:
   void ConvertCaloClusters(const AliESDEvent& esd);
   void ConvertEMCALCells(const AliESDEvent& esd);
   void ConvertPHOSCells(const AliESDEvent& esd);
+  void ConvertCaloTrigger(TString calo, const AliESDEvent& esd);
   void ConvertTracklets(const AliESDEvent& esd);
   void ConvertTPCOnlyTracks(const AliESDEvent& esd);
   void ConvertGlobalConstrainedTracks(const AliESDEvent& esd);
@@ -146,6 +148,8 @@ private:
   Bool_t fAreCaloClustersEnabled; // whether or not to fill the calo clusters (true by default)
   Bool_t fAreEMCALCellsEnabled; // whether or not to fill the emcal cells (true by default)
   Bool_t fArePHOSCellsEnabled; // whether or not to fill the phos cells (true by default)
+  Bool_t fAreEMCALTriggerEnabled; // whether or not to fill the emcal trigger (true by default)
+  Bool_t fArePHOSTriggerEnabled; // whether or not to fill the phos trigger (true by default)
   Bool_t fAreTrackletsEnabled; // whether or not to fill the tracklets (true by default)
   AliESDpid* fESDpid; // esd pid
   Bool_t fIsPidOwner; // whether we own fESDpid
index 5650c63..d1a5ad3 100644 (file)
@@ -35,6 +35,7 @@
 #include "AliAODHeader.h"
 #include "AliAODTracklets.h"
 #include "AliAODCaloCells.h"
+#include "AliAODCaloTrigger.h"
 #include "AliAODMCParticle.h"
 #include "AliVEvent.h"
 #include "AliAODHandler.h"
@@ -64,6 +65,8 @@ TClonesArray*    AliAnalysisTaskSE::fgAODMCParticles    = NULL;
 AliAODTracklets* AliAnalysisTaskSE::fgAODTracklets      = NULL;
 AliAODCaloCells* AliAnalysisTaskSE::fgAODEmcalCells     = NULL;
 AliAODCaloCells* AliAnalysisTaskSE::fgAODPhosCells      = NULL;
+AliAODCaloTrigger* AliAnalysisTaskSE::fgAODEMCALTrigger = NULL;
+AliAODCaloTrigger* AliAnalysisTaskSE::fgAODPHOSTrigger  = NULL;
 TClonesArray*    AliAnalysisTaskSE::fgAODDimuons        = NULL;
 
 AliAnalysisTaskSE::AliAnalysisTaskSE():
@@ -268,7 +271,18 @@ void AliAnalysisTaskSE::CreateOutputObjects()
 
                fgAODPhosCells = new AliAODCaloCells("phosCells","phosCells",AliVCaloCells::kPHOSCell);
                handler->AddBranch("AliAODCaloCells", &fgAODPhosCells);
-               
+               }
+           if ((handler->NeedsCaloTriggerBranchReplication() || merging) && !(fgAODEMCALTrigger))        
+           {   
+               if (fDebug > 1) AliInfo("Replicating EMCAL Calo Trigger branches\n");
+               fgAODEMCALTrigger = new AliAODCaloTrigger("emcalTrigger","emcalTrigger");
+               handler->AddBranch("AliAODCaloTrigger", &fgAODEMCALTrigger);
+               }
+               if ((handler->NeedsCaloTriggerBranchReplication() || merging) && !(fgAODPHOSTrigger))     
+               {   
+               if (fDebug > 1) AliInfo("Replicating PHOS Calo Trigger branches\n");
+               fgAODPHOSTrigger = new AliAODCaloTrigger("phosTrigger","phosTrigger");
+               handler->AddBranch("AliAODCaloTrigger", &fgAODPHOSTrigger);
            }
            if ((handler->NeedsMCParticlesBranchReplication() || merging) && !(fgAODMCParticles))         
            {   
@@ -562,7 +576,70 @@ void AliAnalysisTaskSE::Exec(Option_t* option)
                        fgAODPhosCells->Sort();
                    }
                } // Merge PHOS Cells
+               
+               if (aodH->GetMergeEMCALTrigger()) 
+               {
+                       Int_t   EMCALts[48][64], px, py, ts;
+                       Float_t EMCALfo[48][64], am;
+                       
+                       for (Int_t i = 0; i < 48; i++) for (Int_t j = 0; j < 64; j++) 
+                       {
+                               EMCALts[i][j] = 0;
+                               EMCALfo[i][j] = 0.;
+                       }
+                       
+                       AliAODCaloTrigger& trg0 = *(aod->GetCaloTrigger("EMCAL"));
+                       
+                       trg0.Reset();
+                       while (trg0.Next())
+                       {
+                               trg0.GetPosition(px, py);
+                               
+                               if (px > -1 && py > -1) 
+                               {
+                                       trg0.GetL1TimeSum(ts);
+                                       if (ts > -1) EMCALts[px][py] += ts;
+                                       
+                                       trg0.GetAmplitude(am);
+                                       if (am > -1) EMCALfo[px][py] += am;
+                               }
+                       }
+                       
+                       AliAODCaloTrigger& trg1 = *((aodH->GetEventToMerge())->GetCaloTrigger("EMCAL"));
                        
+                       trg1.Reset();
+                       while (trg1.Next())
+                       {
+                               trg1.GetPosition(px, py);
+                               
+                               if (px > -1 && py > -1) 
+                               {
+                                       trg1.GetL1TimeSum(ts);
+                                       if (ts > -1) EMCALts[px][py] += ts;
+                                       
+                                       trg1.GetAmplitude(am);
+                                       if (am > -1) EMCALfo[px][py] += am;
+                               }
+                       }
+                       
+                       int nEntries = 0;
+                       for (Int_t i = 0; i < 48; i++) 
+                               for (Int_t j = 0; j < 64; j++) 
+                                       if (EMCALts[i][j] || EMCALfo[i][j]) nEntries++;
+               
+                       fgAODEMCALTrigger->Allocate(nEntries);
+                       Int_t L0times[10]; for (int i = 0; i < 10; i++) L0times[i] = -1;
+               
+                       for (Int_t i = 0; i < 48; i++) 
+                               for (Int_t j = 0; j < 64; j++) 
+                                       if (EMCALts[i][j] || EMCALfo[i][j]) 
+                                               fgAODEMCALTrigger->Add(i, j, EMCALfo[i][j], -1., L0times, 0, EMCALts[i][j], 0);
+               }
+               
+               if (aodH->GetMergePHOSTrigger()) 
+               {
+                       // To be implemented by PHOS
+               }
            } // merging
            
            handler->SetAODIsReplicated();
index 932927b..31d34c1 100644 (file)
@@ -13,6 +13,7 @@ class AliAODEvent;
 class AliAODHeader;
 class AliAODTracklets;
 class AliAODCaloCells;
+class AliAODCaloTrigger;
 class AliMCEvent;
 class AliMCEventHandler;
 class AliInputEventHandler;
@@ -93,11 +94,13 @@ class AliAnalysisTaskSE : public AliAnalysisTask
     static TClonesArray*    fgAODJets;          //! Jets for replication
     static TClonesArray*    fgAODFMDClusters;   //! FMDClusters for replication
     static TClonesArray*    fgAODCaloClusters;  //! CaloClusters for replication
+    static AliAODCaloTrigger* fgAODEMCALTrigger; //! Emcal Trigger for replication
+    static AliAODCaloTrigger* fgAODPHOSTrigger;  //! Phos Trigger for replication
     static TClonesArray*    fgAODMCParticles;   //! MC Particles for replicatio
     static AliAODTracklets* fgAODTracklets;     //! Tracklets for replication
     static AliAODCaloCells* fgAODEmcalCells;    //! Emcal Cell replication
     static AliAODCaloCells* fgAODPhosCells;     //! Phos  Cell replication
-    static TClonesArray*    fgAODDimuons;       //! Dimuons replication
+       static TClonesArray*    fgAODDimuons;       //! Dimuons replication
     // Event Selection
     UInt_t fOfflineTriggerMask;   //  Task processes collision candidates only
     // Event Mixing
diff --git a/STEER/AOD/AliAODCaloTrigger.cxx b/STEER/AOD/AliAODCaloTrigger.cxx
new file mode 100644 (file)
index 0000000..e36a883
--- /dev/null
@@ -0,0 +1,304 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+
+
+Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
+*/
+
+#include "AliAODCaloTrigger.h"
+#include "AliLog.h"
+
+#include "TArrayI.h"
+#include "Riostream.h"
+#include <cstdlib>
+
+ClassImp(AliAODCaloTrigger)
+
+//_______________
+AliAODCaloTrigger::AliAODCaloTrigger() : TNamed(),
+fNEntries(0),
+fCurrent(-1),
+fColumn(0x0),
+fRow(0x0),
+fAmplitude(0x0),
+fTime(0x0),
+fNL0Times(0x0),
+fL0Times(new TArrayI()),
+fL1TimeSum(0x0),
+fTriggerBits(0x0),
+fL1Threshold(),
+fL1V0(),
+fL1FrameMask(0)
+{
+       //
+       fL1Threshold[0] = fL1Threshold[1] = 0;
+       fL1V0[0] = fL1V0[1] = 0;
+}
+
+//_______________
+AliAODCaloTrigger::AliAODCaloTrigger(const char* name, const char* title) : TNamed(name, title),
+       fNEntries(0),
+       fCurrent(-1),
+       fColumn(0x0),
+       fRow(0x0),
+       fAmplitude(0x0),
+       fTime(0x0),
+       fNL0Times(0x0),
+       fL0Times(new TArrayI()),
+       fL1TimeSum(0x0),
+       fTriggerBits(0x0),
+       fL1Threshold(),
+       fL1V0(),
+       fL1FrameMask(0)
+{
+       //
+       fL1Threshold[0] = fL1Threshold[1] = 0;
+       fL1V0[0] = fL1V0[1] = 0;        
+}
+
+//_______________
+AliAODCaloTrigger::AliAODCaloTrigger(const AliAODCaloTrigger& src) : TNamed(src),
+fNEntries(0),
+fCurrent(-1),
+fColumn(0x0),
+fRow(0x0),
+fAmplitude(0x0),
+fTime(0x0),
+fNL0Times(0x0),
+fL0Times(new TArrayI()),
+fL1TimeSum(0x0),
+fTriggerBits(0x0),
+fL1Threshold(),
+fL1V0(),
+fL1FrameMask(0)
+{
+       //
+       src.Copy(*this);
+}
+
+//_______________
+AliAODCaloTrigger::~AliAODCaloTrigger()
+{
+       //
+       if (fNEntries) DeAllocate();
+       
+       delete fL0Times; fL0Times = 0x0;
+}
+
+//_______________
+void AliAODCaloTrigger::DeAllocate()
+{
+       //
+       delete [] fColumn;      fColumn    = 0x0;
+       delete [] fRow;         fRow       = 0x0;     
+       delete [] fAmplitude;   fAmplitude = 0x0;
+       delete [] fTime;        fTime      = 0x0;   
+       delete [] fNL0Times;    fNL0Times  = 0x0;
+       delete [] fL1TimeSum;   fL1TimeSum = 0x0;
+       delete [] fTriggerBits; fTriggerBits   = 0x0;
+
+       fNEntries =  0;
+       fCurrent  = -1;
+
+       fL0Times->Reset();
+}
+
+//_______________
+AliAODCaloTrigger& AliAODCaloTrigger::operator=(const AliAODCaloTrigger& src)
+{
+       //
+       if (this != &src) src.Copy(*this);
+       
+       return *this;
+}
+
+//_______________
+void AliAODCaloTrigger::Copy(TObject &obj) const 
+{      
+       //
+       TNamed::Copy(obj);
+       
+       AliAODCaloTrigger& dest = static_cast<AliAODCaloTrigger&>(obj);
+
+       if (dest.fNEntries) dest.DeAllocate();
+       
+       dest.Allocate(fNEntries);
+       
+       for (Int_t i = 0; i < fNEntries; i++)
+       {
+               Int_t times[10];
+               for (Int_t j = 0; j < 10; j++) times[j] = fL0Times->At(10 * i + j);
+         
+               dest.Add(fColumn[i], fRow[i], fAmplitude[i], fTime[i], times, fNL0Times[i], fL1TimeSum[i], fTriggerBits[i]);
+       }       
+
+       dest.SetL1Threshold(0, fL1Threshold[0]);
+       dest.SetL1Threshold(1, fL1Threshold[1]);
+       dest.SetL1V0(fL1V0);
+       dest.SetL1FrameMask(fL1FrameMask);
+}
+
+//_______________
+void AliAODCaloTrigger::Allocate(Int_t size)
+{
+       //
+       if (!size) return;
+       
+       fNEntries = size;
+       
+       fColumn      = new   Int_t[fNEntries];
+       fRow         = new   Int_t[fNEntries];
+       fAmplitude   = new Float_t[fNEntries];
+       fTime        = new Float_t[fNEntries];
+       fNL0Times    = new   Int_t[fNEntries];
+       fL1TimeSum   = new   Int_t[fNEntries];
+       fTriggerBits = new   Int_t[fNEntries];
+
+       for (Int_t i = 0; i < fNEntries; i++) 
+       {
+         fColumn[i]      = 0;
+         fRow[i]         = 0;
+         fAmplitude[i]   = 0;
+         fTime[i]        = 0;
+         fNL0Times[i]    = 0;
+         fL1TimeSum[i]   = 0;
+         fTriggerBits[i] = 0;
+       }
+       
+       fL0Times->Set(fNEntries * 10);
+}
+
+//_______________
+Bool_t AliAODCaloTrigger::Add(Int_t col, Int_t row, Float_t amp, Float_t time, Int_t trgtimes[], Int_t ntrgtimes, Int_t trgts, Int_t trgbits)
+{
+       //
+       fCurrent++;
+       
+            fColumn[fCurrent] = col;
+               fRow[fCurrent] = row;
+         fAmplitude[fCurrent] = amp;
+              fTime[fCurrent] = time;
+          fNL0Times[fCurrent] = ntrgtimes;
+         fL1TimeSum[fCurrent] = trgts; 
+       fTriggerBits[fCurrent] = trgbits;
+       
+       if (ntrgtimes > 9) 
+       {
+               AliError("Should not have more than 10 L0 times");
+               return kFALSE;
+       }
+       
+       for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) fL0Times->AddAt(trgtimes[i], 10 * fCurrent + i);
+
+       return kTRUE;
+}
+
+//_______________
+Bool_t AliAODCaloTrigger::Next()
+{
+       //
+       if (fCurrent >= fNEntries - 1 || !fNEntries) return kFALSE;
+       
+       fCurrent++;
+       
+       return kTRUE;
+}
+
+//_______________
+void AliAODCaloTrigger::GetPosition(Int_t& col, Int_t& row) const
+{
+       //
+       if (fCurrent == -1) return;
+       
+       col = fColumn[fCurrent];
+       row =    fRow[fCurrent];
+}
+
+//_______________
+void AliAODCaloTrigger::GetAmplitude(Float_t& amp) const
+{
+       //
+       if (fCurrent == -1) return;
+
+       amp = fAmplitude[fCurrent];
+}
+
+//_______________
+void AliAODCaloTrigger::GetTime(Float_t& time) const
+{
+       //
+       if (fCurrent == -1) return;
+
+       time = fTime[fCurrent];
+}
+
+//_______________
+void AliAODCaloTrigger::GetL1TimeSum(Int_t& amp) const
+{
+       //      
+       if (fCurrent == -1) return;
+
+       amp = fL1TimeSum[fCurrent];
+}
+
+//_______________
+void AliAODCaloTrigger::GetNL0Times(Int_t& ntimes) const
+{
+       //
+       if (fCurrent == -1) return;
+
+       ntimes = fNL0Times[fCurrent];
+}
+
+//_______________
+void AliAODCaloTrigger::GetTriggerBits(Int_t& bits) const
+{
+       //
+       if (fCurrent == -1) return;
+
+       bits = fTriggerBits[fCurrent];
+}
+
+//_______________
+void AliAODCaloTrigger::GetL0Times(Int_t times[]) const
+{
+       //
+       if (fCurrent == -1) return;
+
+       for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) times[i] = fL0Times->At(10 * fCurrent + i);
+}
+
+//_______________
+void AliAODCaloTrigger::Print(const Option_t* /*opt*/) const
+{
+       //
+       if (fCurrent == -1) return;
+
+       printf("============\n");
+       printf("--L0:\n");
+       printf("\tPOSITION (X: %2d Y: %2d) / FITTED F-ALTRO (AMP: %4f TIME: %3f)\n", 
+                  fColumn[fCurrent], fRow[fCurrent], fAmplitude[fCurrent], fTime[fCurrent]);
+       printf("\t%d L0 TIMES (", fNL0Times[fCurrent]); 
+       for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) printf("%2d ",fL0Times->At(10 * fCurrent + i));
+       printf(")\n");
+       printf("--L1:\n");
+       printf("\tTIME SUM: %4d\n", fL1TimeSum[fCurrent]);
+       printf("\tTHRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]);
+       printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fCurrent]);
+}      
diff --git a/STEER/AOD/AliAODCaloTrigger.h b/STEER/AOD/AliAODCaloTrigger.h
new file mode 100644 (file)
index 0000000..1917243
--- /dev/null
@@ -0,0 +1,84 @@
+#ifndef ALIAODCALOTRIGGER_H
+#define ALIAODCALOTRIGGER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*
+
+
+Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
+*/
+
+#include <TNamed.h>
+
+class TArrayI;
+
+class AliAODCaloTrigger : public TNamed 
+{
+public:
+                AliAODCaloTrigger();
+                                        AliAODCaloTrigger(const char* name, const char* title);
+                AliAODCaloTrigger(const AliAODCaloTrigger& ctrig);
+       virtual ~AliAODCaloTrigger();
+       
+       AliAODCaloTrigger& operator=(const AliAODCaloTrigger& ctrig);
+       
+       Bool_t  IsEmpty() {return (fNEntries == 0);}
+
+       virtual void Reset() {fCurrent = -1;}
+
+       void    Allocate(Int_t size);
+       void    DeAllocate(        ); 
+       
+       Bool_t  Add(Int_t col, Int_t row, Float_t amp, Float_t time, Int_t trgtimes[], Int_t ntrgtimes, Int_t trgts, Int_t trgbits);
+       
+       void    SetL1Threshold(Int_t i, Int_t thr) {fL1Threshold[i] = thr;}
+       void    SetL1V0(const Int_t* v) {for (int i = 0; i < 2; i++) fL1V0[i] = v[i];}
+       void    SetL1FrameMask(Int_t m) {fL1FrameMask = m;}
+       
+       void    GetPosition(     Int_t& col, Int_t& row           ) const;
+       
+       void    GetAmplitude(  Float_t& amp                       ) const;
+       void    GetTime(       Float_t& time                      ) const;
+       
+       void    GetTriggerBits(  Int_t& bits                      ) const;
+       void    GetNL0Times(     Int_t& ntimes                    ) const;
+       void    GetL0Times(      Int_t  times[]                   ) const;
+       Int_t   GetEntries(                                       ) const {return fNEntries;}
+
+       void    GetL1TimeSum(    Int_t& timesum                   ) const;
+       Int_t   GetL1Threshold(  Int_t  i                         ) const {return fL1Threshold[i];}
+       Int_t   GetL1V0(         Int_t  i                         ) const {return fL1V0[i];}
+       Int_t   GetL1FrameMask(                                   ) const {return fL1FrameMask;}
+       
+       virtual Bool_t Next();
+
+       virtual void Copy(TObject& obj) const;
+       
+       virtual void Print(const Option_t* opt = "") const;
+       
+private:
+
+       Int_t    fNEntries;
+    Int_t    fCurrent;
+
+       Int_t*   fColumn;         // [fNEntries]
+       Int_t*   fRow;            // [fNEntries]
+       Float_t* fAmplitude;      // [fNEntries]
+       Float_t* fTime;           // [fNEntries]
+       Int_t*   fNL0Times;       // [fNEntries]
+       TArrayI* fL0Times;        //
+       Int_t*   fL1TimeSum;      // [fNEntries]
+       Int_t*   fTriggerBits;    // [fNEntries]
+       
+       Int_t    fL1Threshold[2]; // L1 thresholds from raw data
+       Int_t    fL1V0[2];        // L1 threshold components
+       Int_t    fL1FrameMask;    // Validation flag for L1 data
+       
+       
+       ClassDef(AliAODCaloTrigger, 1)
+};
+#endif
+
index b8bcd3b..efa4f27 100644 (file)
@@ -44,7 +44,9 @@ ClassImp(AliAODEvent)
                                                      "jets",
                                                      "emcalCells",
                                                      "phosCells",
-                                                     "caloClusters",
+                                                                       "caloClusters",
+                                                                       "emcalTrigger",
+                                                                       "phosTrigger",
                                                      "fmdClusters",
                                                      "pmdClusters",
                                                      "dimuons",
@@ -72,6 +74,8 @@ AliAODEvent::AliAODEvent() :
   fEmcalCells(0),
   fPhosCells(0),
   fCaloClusters(0),
+  fEMCALTrigger(0),
+  fPHOSTrigger(0),
   fFmdClusters(0),
   fPmdClusters(0),
   fDimuons(0),
@@ -101,6 +105,8 @@ AliAODEvent::AliAODEvent(const AliAODEvent& aod):
   fEmcalCells(new AliAODCaloCells(*aod.fEmcalCells)),
   fPhosCells(new AliAODCaloCells(*aod.fPhosCells)),
   fCaloClusters(new TClonesArray(*aod.fCaloClusters)),
+  fEMCALTrigger(new AliAODCaloTrigger(*aod.fEMCALTrigger)),
+  fPHOSTrigger(new AliAODCaloTrigger(*aod.fPHOSTrigger)),
   fFmdClusters(new TClonesArray(*aod.fFmdClusters)),
   fPmdClusters(new TClonesArray(*aod.fPmdClusters)),
   fDimuons(new TClonesArray(*aod.fDimuons)),
@@ -122,6 +128,8 @@ AliAODEvent::AliAODEvent(const AliAODEvent& aod):
   AddObject(fEmcalCells);
   AddObject(fPhosCells);
   AddObject(fCaloClusters);
+  AddObject(fEMCALTrigger);
+  AddObject(fPHOSTrigger);
   AddObject(fFmdClusters);
   AddObject(fPmdClusters);
   AddObject(fDimuons);
@@ -288,6 +296,8 @@ void AliAODEvent::CreateStdContent()
   AddObject(new AliAODCaloCells());
   AddObject(new AliAODCaloCells());
   AddObject(new TClonesArray("AliAODCaloCluster", 0));
+  AddObject(new AliAODCaloTrigger()); // EMCAL 
+  AddObject(new AliAODCaloTrigger()); // PHOS
   AddObject(new TClonesArray("AliAODFmdCluster", 0));
   AddObject(new TClonesArray("AliAODPmdCluster", 0));
   AddObject(new TClonesArray("AliAODDimuon", 0));
@@ -377,6 +387,8 @@ void AliAODEvent::GetStdContent()
   fEmcalCells    = (AliAODCaloCells*)fAODObjects->FindObject("emcalCells");
   fPhosCells     = (AliAODCaloCells*)fAODObjects->FindObject("phosCells");
   fCaloClusters  = (TClonesArray*)fAODObjects->FindObject("caloClusters");
+       fEMCALTrigger  = (AliAODCaloTrigger*)fAODObjects->FindObject("emcalTrigger");
+       fPHOSTrigger   = (AliAODCaloTrigger*)fAODObjects->FindObject("phosTrigger");
   fFmdClusters   = (TClonesArray*)fAODObjects->FindObject("fmdClusters");
   fPmdClusters   = (TClonesArray*)fAODObjects->FindObject("pmdClusters");
   fDimuons       = (TClonesArray*)fAODObjects->FindObject("dimuons");
@@ -453,6 +465,11 @@ void AliAODEvent::ResetStd(Int_t trkArrSize,
     fPhosCells->DeleteContainer();  
   if (fEmcalCells)
     fEmcalCells->DeleteContainer();
+  
+  if (fEMCALTrigger)
+       fEMCALTrigger->DeAllocate();
+  if (fPHOSTrigger)
+       fPHOSTrigger->DeAllocate();
 }
 
 void AliAODEvent::ClearStd()
@@ -484,6 +501,11 @@ void AliAODEvent::ClearStd()
     fPmdClusters   ->Clear();
   if (fDimuons)
     fDimuons       ->Clear();
+       
+  if (fEMCALTrigger)
+       fEMCALTrigger->DeAllocate();
+  if (fPHOSTrigger)
+       fPHOSTrigger->DeAllocate();
 }
 
 //_________________________________________________________________
index cb452a3..87c81c0 100644 (file)
@@ -27,6 +27,7 @@
 #include "AliAODJet.h"
 #include "AliAODCaloCells.h"
 #include "AliAODCaloCluster.h"
+#include "AliAODCaloTrigger.h"
 #include "AliAODPmdCluster.h"
 #include "AliAODFmdCluster.h"
 #include "AliAODDimuon.h"
@@ -55,6 +56,8 @@ class AliAODEvent : public AliVEvent {
                       kAODEmcalCells,
                       kAODPhosCells,
                       kAODCaloClusters,
+                  kAODEMCALTrigger,
+                  kAODPHOSTrigger,
                       kAODFmdClusters,
                       kAODPmdClusters,
                       kAODDimuons,
@@ -175,7 +178,13 @@ class AliAODEvent : public AliVEvent {
   AliAODCaloCluster *GetCaloCluster(Int_t nCluster) const { return (AliAODCaloCluster*)fCaloClusters->UncheckedAt(nCluster); }
   Int_t         AddCaloCluster(const AliAODCaloCluster* clus)
   {new((*fCaloClusters)[fCaloClusters->GetEntriesFast()]) AliAODCaloCluster(*clus); return fCaloClusters->GetEntriesFast()-1;}
-
+  AliAODCaloTrigger *GetCaloTrigger(TString calo) const 
+  {      
+     if (calo.Contains("EMCAL")) return fEMCALTrigger;
+     else
+     return fPHOSTrigger; 
+  }    
+       
   Int_t GetEMCALClusters(TRefArray *clusters) const;
   Int_t GetPHOSClusters(TRefArray *clusters) const;
 
@@ -286,6 +295,8 @@ class AliAODEvent : public AliVEvent {
   AliAODCaloCells *fEmcalCells;   //! EMCAL calorimenter cells
   AliAODCaloCells *fPhosCells;    //! PHOS calorimenter cells
   TClonesArray    *fCaloClusters; //! calorimeter clusters
+  AliAODCaloTrigger *fEMCALTrigger; //! EMCAL Trigger information
+  AliAODCaloTrigger *fPHOSTrigger;  //! PHOS Trigger information
   TClonesArray    *fFmdClusters;  //! FMDclusters
   TClonesArray    *fPmdClusters;  //! PMDclusters
   TClonesArray    *fDimuons;      //! dimuons
index 430fb6d..04c17d3 100644 (file)
@@ -66,6 +66,7 @@ AliAODHandler::AliAODHandler() :
     fNeedsJetsBranchReplication(kFALSE),
     fNeedsFMDClustersBranchReplication(kFALSE),
     fNeedsCaloClustersBranchReplication(kFALSE),
+       fNeedsCaloTriggerBranchReplication(kFALSE),
     fNeedsMCParticlesBranchReplication(kFALSE),
     fNeedsDimuonsBranchReplication(kFALSE),
     fAODIsReplicated(kFALSE),
@@ -97,6 +98,7 @@ AliAODHandler::AliAODHandler(const char* name, const char* title):
     fNeedsJetsBranchReplication(kFALSE),
     fNeedsFMDClustersBranchReplication(kFALSE),
     fNeedsCaloClustersBranchReplication(kFALSE),
+       fNeedsCaloTriggerBranchReplication(kFALSE),
     fNeedsMCParticlesBranchReplication(kFALSE),
     fNeedsDimuonsBranchReplication(kFALSE),
     fAODIsReplicated(kFALSE),
index b65271e..9121280 100644 (file)
@@ -58,6 +58,7 @@ class AliAODHandler : public AliVEventHandler {
     virtual void         SetNeedsJetsBranchReplication()         {fNeedsJetsBranchReplication         = kTRUE;}
     virtual void         SetNeedsFMDClustersBranchReplication()  {fNeedsFMDClustersBranchReplication  = kTRUE;}
     virtual void         SetNeedsCaloClustersBranchReplication() {fNeedsCaloClustersBranchReplication = kTRUE;}
+    virtual void         SetNeedsCaloTriggerBranchReplication()  {fNeedsCaloTriggerBranchReplication  = kTRUE;}
     virtual void         SetNeedsMCParticlesBranchReplication()  {fNeedsMCParticlesBranchReplication  = kTRUE;}
     virtual void         SetNeedsDimuonsBranchReplication()      {fNeedsDimuonsBranchReplication      = kTRUE;}
     virtual void         SetAODIsReplicated() {fAODIsReplicated = kTRUE;}
@@ -89,6 +90,7 @@ class AliAODHandler : public AliVEventHandler {
     Bool_t               NeedsJetsBranchReplication()         const {return  fNeedsJetsBranchReplication;}
     Bool_t               NeedsFMDClustersBranchReplication()  const {return  fNeedsFMDClustersBranchReplication;}
     Bool_t               NeedsCaloClustersBranchReplication() const {return  fNeedsCaloClustersBranchReplication;}
+    Bool_t               NeedsCaloTriggerBranchReplication()  const {return  fNeedsCaloTriggerBranchReplication;}
     Bool_t               NeedsMCParticlesBranchReplication()  const {return  fNeedsMCParticlesBranchReplication;}
     Bool_t               NeedsDimuonsBranchReplication()      const {return  fNeedsDimuonsBranchReplication;}
     Bool_t               AODIsReplicated()                    const {return  fAODIsReplicated;}
@@ -122,6 +124,7 @@ class AliAODHandler : public AliVEventHandler {
     Bool_t                   fNeedsJetsBranchReplication;         // Flag for Jets replication
     Bool_t                   fNeedsFMDClustersBranchReplication;  // Flag for FMDClusters replication
     Bool_t                   fNeedsCaloClustersBranchReplication; // Flag for CaloClusters replication
+    Bool_t                   fNeedsCaloTriggerBranchReplication;  // Flag for Calo Trigger replication
     Bool_t                   fNeedsMCParticlesBranchReplication;  // Flag for MCParticles replication
     Bool_t                   fNeedsDimuonsBranchReplication;      // Flag for Dimuons replication
     Bool_t                   fAODIsReplicated;                    // Flag true if replication as been executed
index 4422d8f..c23b448 100644 (file)
@@ -49,7 +49,9 @@ AliAODInputHandler::AliAODInputHandler() :
     fMergeEMCALClusters(kTRUE), 
     fMergePHOSClusters(kTRUE), 
     fMergeEMCALCells(kTRUE), 
-    fMergePHOSCells(kTRUE),
+       fMergePHOSCells(kTRUE), 
+       fMergeEMCALTrigger(kTRUE), 
+       fMergePHOSTrigger(kTRUE),
     fFriendsConnected(kFALSE),
     fFileToMerge(0),
     fTreeToMerge(0),
@@ -73,6 +75,8 @@ AliAODInputHandler::AliAODInputHandler(const char* name, const char* title):
   fMergePHOSClusters(kTRUE), 
   fMergeEMCALCells(kTRUE), 
   fMergePHOSCells(kTRUE),
+  fMergeEMCALTrigger(kTRUE), 
+  fMergePHOSTrigger(kTRUE),
   fFriendsConnected(kFALSE),
   fFileToMerge(0),
   fTreeToMerge(0),
index a29f376..f1023a5 100644 (file)
@@ -56,6 +56,11 @@ class AliAODInputHandler : public AliInputEventHandler {
     Bool_t               GetMergePHOSClusters()      const {return fMergePHOSClusters  ;}
     void                 SetMergePHOSCells(Bool_t flag)    {fMergePHOSCells      = flag;}
     Bool_t               GetMergePHOSCells()         const {return fMergePHOSCells     ;}  
+    void                 SetMergeEMCALTrigger(Bool_t flag)    {fMergeEMCALTrigger      = flag;}
+    Bool_t               GetMergeEMCALTrigger()         const {return fMergeEMCALTrigger     ;}  
+    void                 SetMergePHOSTrigger(Bool_t flag)    {fMergePHOSTrigger      = flag;}
+    Bool_t               GetMergePHOSTrigger()         const {return fMergePHOSTrigger     ;}  
+
     //PID response
     virtual AliPIDResponse* GetPIDResponse() {return (AliPIDResponse*)fAODpidUtil;}
     virtual void CreatePIDResponse(Bool_t isMC=kFALSE);
@@ -78,6 +83,8 @@ class AliAODInputHandler : public AliInputEventHandler {
     Bool_t          fMergePHOSClusters;  // Merge EMCAL cluster
     Bool_t          fMergeEMCALCells;    // Merge PHOS  cluster
     Bool_t          fMergePHOSCells;     // Merge EMCAL cluster
+    Bool_t          fMergeEMCALTrigger;    // Merge EMCAL  cluster
+    Bool_t          fMergePHOSTrigger;     // Merge PHOS cluster
     Bool_t          fFriendsConnected;// Friends are connected
     TFile          *fFileToMerge;     //! File for merging
     TTree          *fTreeToMerge;     //! Tree for merging
index 984e725..81750f1 100644 (file)
@@ -39,6 +39,7 @@
 #pragma link C++ class AliAODTracklets+;
 #pragma link C++ class AliAODTagCreator+;
 #pragma link C++ class AliAODCaloCells+;
+#pragma link C++ class AliAODCaloTrigger+;
 #pragma link C++ class AliAODDiJet+;
 #pragma link C++ class AliAODMCParticle+;
 #pragma link C++ class AliAODMCHeader+;
index 78ff531..103e158 100644 (file)
@@ -31,6 +31,7 @@ set ( SRCS
     AOD/AliAODv0.cxx 
     AOD/AliAODcascade.cxx 
     AOD/AliAODCaloCells.cxx 
+    AOD/AliAODCaloTrigger.cxx 
     AOD/AliAODInputHandler.cxx 
     AOD/AliAODDiJet.cxx 
     AOD/AliAODMCParticle.cxx