Classes for trigger processing in simulation
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Jun 2009 11:29:46 +0000 (11:29 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Jun 2009 11:29:46 +0000 (11:29 +0000)
ZDC/AliZDCTriggerParameters.cxx [new file with mode: 0644]
ZDC/AliZDCTriggerParameters.h [new file with mode: 0644]
ZDC/AliZDCTriggerProcessor.cxx [new file with mode: 0644]
ZDC/AliZDCTriggerProcessor.h [new file with mode: 0644]

diff --git a/ZDC/AliZDCTriggerParameters.cxx b/ZDC/AliZDCTriggerParameters.cxx
new file mode 100644 (file)
index 0000000..171d5f2
--- /dev/null
@@ -0,0 +1,98 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+
+/////////////////////////////////////////////////////////////////
+//                                                            //
+//    Class containing the parameters that are configured      //
+//    to trigger events with the ZDC (in A-A collisions)       //
+//    Use: store the set of parameters needed to calculate     //
+//    the trigger function sent to the CTP                     //
+//                                                            //
+//    Author: Chiara.Oppedisano@to.infn.it                     //
+//                                                            //
+/////////////////////////////////////////////////////////////////                                                             
+
+#include "AliZDCTriggerParameters.h"
+
+ClassImp(AliZDCTriggerParameters)
+
+//________________________________________________________________
+AliZDCTriggerParameters::AliZDCTriggerParameters() :
+TObject(),
+fADCZEMCentralityThr(0),
+fADCMBThreshold(0),
+fDiscZEMCentralityThr(0),
+fDiscMBThreshold(0)
+{
+  // Default constructor
+}  
+
+//________________________________________________________________
+AliZDCTriggerParameters::AliZDCTriggerParameters(Float_t *adcParam, 
+       Float_t *discParam) :
+fADCZEMCentralityThr(adcParam[0]),
+fADCMBThreshold(adcParam[1]),
+fDiscZEMCentralityThr(discParam[0]),
+fDiscMBThreshold(discParam[1])
+{
+  // Standard constructor
+  fADCCentralWindow[0] = adcParam[2];
+  fADCCentralWindow[1] = adcParam[3];
+  fADCSemicentralWindow[0] = adcParam[4];
+  fADCSemicentralWindow[1] = adcParam[5];
+  fADCEMDWindow[0] = adcParam[6];
+  fADCEMDWindow[1] = adcParam[7];
+  fADCEMDWindow[2] = adcParam[8];
+  fADCEMDWindow[3] = adcParam[9];
+  //
+  fDiscCentralWindow[0] = discParam[2];
+  fDiscCentralWindow[1] = discParam[3];
+  fDiscSemicentralWindow[0] = discParam[4];
+  fDiscSemicentralWindow[1] = discParam[5];
+  fDiscEMDWindow[0] = discParam[6];
+  fDiscEMDWindow[1] = discParam[7];
+  fDiscEMDWindow[2] = discParam[8];
+  fDiscEMDWindow[3] = discParam[9];
+}
+
+//____________________________________________________________________________
+AliZDCTriggerParameters::AliZDCTriggerParameters(const AliZDCTriggerParameters& oldTrigPar) :
+  TObject(),
+  fADCZEMCentralityThr(oldTrigPar.fADCZEMCentralityThr),
+  fADCMBThreshold(oldTrigPar.fADCMBThreshold),
+  fDiscZEMCentralityThr(oldTrigPar.fDiscZEMCentralityThr),
+  fDiscMBThreshold(oldTrigPar.fDiscMBThreshold)
+{
+  // Copy constructor
+  fADCCentralWindow[0] = oldTrigPar.fADCCentralWindow[0];
+  fADCCentralWindow[1] = oldTrigPar.fADCCentralWindow[1];
+  fADCSemicentralWindow[0] = oldTrigPar.fADCSemicentralWindow[0];
+  fADCSemicentralWindow[1] = oldTrigPar.fADCSemicentralWindow[1];
+  fADCEMDWindow[0] = oldTrigPar.fADCEMDWindow[0];
+  fADCEMDWindow[1] = oldTrigPar.fADCEMDWindow[1];
+  fADCEMDWindow[2] = oldTrigPar.fADCEMDWindow[2];
+  fADCEMDWindow[3] = oldTrigPar.fADCEMDWindow[3];
+  //
+  fDiscCentralWindow[0] = oldTrigPar.fDiscCentralWindow[0];
+  fDiscCentralWindow[1] = oldTrigPar.fDiscCentralWindow[1];
+  fDiscSemicentralWindow[0] = oldTrigPar.fDiscSemicentralWindow[0];
+  fDiscSemicentralWindow[1] = oldTrigPar.fDiscSemicentralWindow[1];
+  fDiscEMDWindow[0] = oldTrigPar.fDiscEMDWindow[0];
+  fDiscEMDWindow[1] = oldTrigPar.fDiscEMDWindow[1];
+  fDiscEMDWindow[2] = oldTrigPar.fDiscEMDWindow[2];
+  fDiscEMDWindow[3] = oldTrigPar.fDiscEMDWindow[3];
+  
+}
diff --git a/ZDC/AliZDCTriggerParameters.h b/ZDC/AliZDCTriggerParameters.h
new file mode 100644 (file)
index 0000000..371f4d9
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef AliZDCTriggerParameter_H
+#define AliZDCTriggerParameter_H
+
+/////////////////////////////////////////////////////////////////
+//                                                            //
+//    Class containing the parameters that are configured      //
+//    to trigger events with the ZDC (in A-A collisions)       //
+//    Use: store the set of parameters needed to calculate     //
+//    the trigger function sent to the CTP                     //
+//                                                            //
+//    Author: Chiara.Oppedisano@to.infn.it                     //
+//                                                            //
+/////////////////////////////////////////////////////////////////                                                             
+
+#include <TObject.h>
+
+class AliZDCTriggerParameters : public TObject{
+
+public:
+  AliZDCTriggerParameters();
+  AliZDCTriggerParameters(Float_t *adcParam, Float_t *discParam);
+  AliZDCTriggerParameters(const AliZDCTriggerParameters &parameters);
+  virtual ~AliZDCTriggerParameters() {;}
+  
+  Float_t   GetADCZDCCentralityThr()  const {return fADCZEMCentralityThr;}
+  Float_t   GetADCMBThreshold()       const {return fADCMBThreshold;}
+  const Float_t * GetADCCentralWindow()     const {return fADCCentralWindow;}
+  const Float_t * GetADCSemicentralWindow() const {return fADCSemicentralWindow;}
+  const Float_t * GetADCEMDWindow()        const {return fADCEMDWindow;}
+  //
+  Float_t   GetDiscZDCCentralityThr()  const {return fDiscZEMCentralityThr;}
+  Float_t   GetDiscMBThreshold()       const {return fDiscMBThreshold;}
+  const Float_t * GetDiscCentralWindow()     const {return fDiscCentralWindow;}
+  const Float_t * GetDiscEMDWindow()        const {return fDiscEMDWindow;}
+  const Float_t * GetDiscSemicentralWindow() const {return fDiscSemicentralWindow;}
+  
+  void SetADCZEMCentralityThr(Float_t zemThrVal) {fADCZEMCentralityThr = zemThrVal;} 
+  void SetADCMBThreshold(Float_t mbThrVal) {fADCMBThreshold = mbThrVal;} 
+  void SetADCCentralWindow(Float_t* cenThrWin) 
+       {for(int i=0; i<2; i++) fADCCentralWindow[i] = cenThrWin[i];}
+  void SetADCSemicentralWindow(Float_t* semicenThrWin)
+       {for(int i=0; i<2; i++) fADCSemicentralWindow[i] = semicenThrWin[i];}
+  void SetADCEMDWindow(Float_t* emdWin)
+       {for(int i=0; i<2; i++) fADCEMDWindow[i] = emdWin[i];}
+  //
+  void SetDiscZEMCentralityThr(Float_t zemThrVal) {fDiscZEMCentralityThr = zemThrVal;} 
+  void SetDiscMBThreshold(Float_t mbThrVal) {fDiscMBThreshold = mbThrVal;} 
+  void SetDiscCentralWindow(Float_t* cenThrWin) 
+       {for(int i=0; i<2; i++) fDiscCentralWindow[i] = cenThrWin[i];}
+  void SetDiscSemicentralWindow(Float_t* semicenThrWin)
+       {for(int i=0; i<2; i++) fDiscSemicentralWindow[i] = semicenThrWin[i];}
+  void SetDiscEMDWindow(Float_t* emdWin)
+       {for(int i=0; i<2; i++) fDiscEMDWindow[i] = emdWin[i];}
+  
+protected:
+  // --- Configurable parameters 
+  // -> [1] values in ADC channels
+  Float_t fADCZEMCentralityThr;     //ZEM ADC value for centrality selection
+  Float_t fADCMBThreshold;         //ZDC ADC value to trigger MB A-A events
+  Float_t fADCCentralWindow[2];            //ZDC ADC value to trigger central A-A events
+  Float_t fADCSemicentralWindow[2]; //ZDC ADC value to trigger semicentral A-A events
+  Float_t fADCEMDWindow[4];        //ZDC ADC value to trigger EMD events
+  //
+  // -> [2] values in discriminator thresholds
+  Float_t fDiscZEMCentralityThr;    //ZEM threshold for centrality selection
+  Float_t fDiscMBThreshold;        //ZDC threshold to trigger MB A-A events    
+  Float_t fDiscCentralWindow[2];    //ZDC threshold to trigger central A-A events
+  Float_t fDiscSemicentralWindow[2];//ZDC threshold to trigger semicentral A-A events
+  Float_t fDiscEMDWindow[4];       //ZDC threshold to trigger EMD events
+
+  ClassDef(AliZDCTriggerParameters, 1)
+
+};
+
+#endif
diff --git a/ZDC/AliZDCTriggerProcessor.cxx b/ZDC/AliZDCTriggerProcessor.cxx
new file mode 100644 (file)
index 0000000..3350090
--- /dev/null
@@ -0,0 +1,141 @@
+#include "AliZDCTriggerProcessor.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliCDBMetaData.h"
+#include "AliLog.h"
+#include "AliZDCTriggerParameters.h"
+
+/////////////////////////////////////////////////////////////////////
+//                                                                //
+//        Class implementing ZDC  trigger processor.              //
+//                                                                //
+/////////////////////////////////////////////////////////////////////
+
+ClassImp(AliZDCTriggerProcessor)
+
+//______________________________________________________________________________________________
+AliZDCTriggerProcessor::AliZDCTriggerProcessor() :
+  fSignal(0x0),
+  fTriggerParam(0x0)
+{
+  // default constructor
+}
+
+//______________________________________________________________________________________________
+AliZDCTriggerProcessor::AliZDCTriggerProcessor(Float_t* signal) :
+  fSignal(signal),
+  fTriggerParam(GetTriggerParamFromOCDB())
+{
+  // standard constructor I 
+  // gets the trigger parameters directly from OCDB
+}
+
+//______________________________________________________________________________________________
+AliZDCTriggerProcessor::AliZDCTriggerProcessor(Float_t* signal, AliZDCTriggerParameters* ocdbParam) :
+  fSignal(signal),
+  fTriggerParam(ocdbParam)
+{
+  // standard constructor II
+}
+
+//______________________________________________________________________________________________
+AliZDCTriggerProcessor::AliZDCTriggerProcessor(const AliZDCTriggerProcessor& trigg) :
+  fSignal(trigg.fSignal),
+  fTriggerParam(trigg.fTriggerParam)
+{
+  // copy constructor
+}
+
+//______________________________________________________________________________________________
+AliZDCTriggerProcessor::~AliZDCTriggerProcessor()
+{
+  // destructor
+}
+
+//______________________________________________________________________________________________
+UInt_t AliZDCTriggerProcessor::ProcessEvent()
+{
+  // process ZDC signals in order to determine the trigger output
+  UInt_t ctpInput = 0;
+  //
+  if(MBTrigger() == kTRUE) ctpInput = 0x1;
+  if(CentralTrigger() == kTRUE) ctpInput = 0x1 << 1;
+  if(SemicentralTrigger() == kTRUE) ctpInput = 0x1 << 2;
+  if(EMDTrigger() == kTRUE) ctpInput = 0x1 << 3;
+}
+
+//______________________________________________________________________________________________
+Bool_t AliZDCTriggerProcessor::MBTrigger()
+{
+  // is the processed event a MB A-A event?
+  
+  Float_t mbTrheshold = fTriggerParam->GetADCMBThreshold();
+  // check whether ZDC signal > mbTrheshold
+  if((fSignal[0]+fSignal[1]+fSignal[3]+fSignal[4]) > mbTrheshold)
+       return kTRUE;
+  else return kFALSE;
+  
+}
+
+//______________________________________________________________________________________________
+Bool_t AliZDCTriggerProcessor::CentralTrigger()
+{
+  // is the processed event a central A-A event?
+  
+  Float_t zemThr = fTriggerParam->GetADCZDCCentralityThr();
+  const Float_t* centralWin = fTriggerParam->GetADCCentralWindow();
+  // 
+  if((fSignal[0]+fSignal[1]+fSignal[3]+fSignal[4]) > centralWin[0]
+     && 
+     (fSignal[0]+fSignal[1]+fSignal[3]+fSignal[4]) < centralWin[1]
+     &&
+     fSignal[2] > zemThr)
+       return kTRUE;
+  else return kFALSE;
+}
+
+//______________________________________________________________________________________________
+Bool_t AliZDCTriggerProcessor::SemicentralTrigger()
+{
+  // is the processed event a semicentral A-A event?
+  
+  Float_t zemThr =  fTriggerParam->GetADCZDCCentralityThr();
+  const Float_t* semicentralWin =   fTriggerParam->GetADCSemicentralWindow();
+  //
+  if((fSignal[0]+fSignal[1]+fSignal[3]+fSignal[4]) > semicentralWin[0]
+     && 
+     (fSignal[0]+fSignal[1]+fSignal[3]+fSignal[4]) < semicentralWin[1]
+     &&
+     fSignal[2] > zemThr)
+       return kTRUE;
+  else return kFALSE;
+}
+
+//______________________________________________________________________________________________
+Bool_t AliZDCTriggerProcessor::EMDTrigger()
+{
+  // is the processed an EMD event?
+  
+  const Float_t* emdWin =   fTriggerParam->GetADCEMDWindow();
+  // check whether ZNA AND ZNC signals fall into the 
+  // 2 distinct windows defined for EMD trigger
+  if(fSignal[0] > emdWin[0] && fSignal[0] < emdWin[1]
+     &&
+     fSignal[3] > emdWin[2] && fSignal[3] < emdWin[3])
+       return kTRUE;
+  else return kFALSE;
+}
+
+//______________________________________________________________________________________________
+AliZDCTriggerParameters* AliZDCTriggerProcessor::GetTriggerParamFromOCDB() const
+{
+  // retrieving trigger parameter configuration form OCDB
+  AliCDBEntry  *entry = AliCDBManager::Instance()->Get("ZDC/Trigger/");
+  if(!entry) AliFatal("No calibration data loaded!");  
+
+  AliZDCTriggerParameters *trigParam = dynamic_cast<AliZDCTriggerParameters*>  (entry->GetObject());
+  if(!trigParam)  AliFatal("Wrong calibration object in calibration  file!");
+
+  return trigParam;
+  
+}
diff --git a/ZDC/AliZDCTriggerProcessor.h b/ZDC/AliZDCTriggerProcessor.h
new file mode 100644 (file)
index 0000000..cc54395
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef ALI_ZDC_TRIGGERPROCESSOR_H
+#define ALI_ZDC_TRIGGERPREPROCESSOR_H
+
+//////////////////////////////////////////////////////////////////////
+//                                                                  //
+//                     ZDC trigger processor                       //
+//      It collects data stored by the dedicated DA and writes     //
+//     an AliZDCTriggerParameters object into the OCDB             //
+//                                                                  //
+//        Author: Chiara.Oppedisano@to.infn.it                      //
+//////////////////////////////////////////////////////////////////////
+#include <TObject.h>
+
+class AliZDCTriggerParameters;
+
+class AliZDCTriggerProcessor : public TObject 
+{
+  public:
+    AliZDCTriggerProcessor();
+    AliZDCTriggerProcessor(Float_t* signal);
+    AliZDCTriggerProcessor(Float_t* signal, AliZDCTriggerParameters* ocdbParam);
+    AliZDCTriggerProcessor(const AliZDCTriggerProcessor& trigg);  
+    virtual ~AliZDCTriggerProcessor();
+    
+    AliZDCTriggerParameters *GetTriggerParamFromOCDB() const;
+    virtual void SetTriggerParam(AliZDCTriggerParameters* ocdbParam) 
+       {fTriggerParam = ocdbParam;}
+    
+    const Float_t* GetSignal() const {return fSignal;}
+    Float_t  GetSignal(Int_t idet) const {return fSignal[idet];}
+    void  SetSignal(Float_t* signal) 
+           {for(Int_t i=0; i<6; i++) fSignal[i] = signal[i];}
+    void  SetSignal(Int_t idet, Float_t signal) {fSignal[idet] = signal;}
+
+  protected:
+    virtual UInt_t ProcessEvent();
+    virtual Bool_t MBTrigger();
+    virtual Bool_t CentralTrigger();
+    virtual Bool_t SemicentralTrigger();
+    virtual Bool_t EMDTrigger();
+
+  private:
+    Float_t* fSignal;
+    AliZDCTriggerParameters *fTriggerParam; // parameters in OCDB
+
+    ClassDef(AliZDCTriggerProcessor, 1);
+};
+
+    
+
+#endif