Implementation of Trigger simulation (Raphael Tieulent)
authorcheynis <cheynis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 26 Jun 2009 15:03:44 +0000 (15:03 +0000)
committercheynis <cheynis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 26 Jun 2009 15:03:44 +0000 (15:03 +0000)
VZERO/AliVZERODataFEE.cxx [new file with mode: 0644]
VZERO/AliVZERODataFEE.h [new file with mode: 0644]
VZERO/AliVZEROLogicalSignal.cxx [new file with mode: 0644]
VZERO/AliVZEROLogicalSignal.h [new file with mode: 0644]
VZERO/AliVZEROTriggerData.cxx [new file with mode: 0644]
VZERO/AliVZEROTriggerData.h [new file with mode: 0644]
VZERO/AliVZEROTriggerSimulator.cxx [new file with mode: 0644]
VZERO/AliVZEROTriggerSimulator.h [new file with mode: 0644]

diff --git a/VZERO/AliVZERODataFEE.cxx b/VZERO/AliVZERODataFEE.cxx
new file mode 100644 (file)
index 0000000..ae98fd6
--- /dev/null
@@ -0,0 +1,213 @@
+
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+
+//  Simulate the VZERO Trigger response
+// Use FEE parameters stored in Database
+// Can work on real data or in simulation
+#include <TTimeStamp.h>
+#include <TObjString.h>
+
+#include "AliDCSValue.h"
+#include "AliLog.h"
+#include "AliVZERODataFEE.h"
+
+//ClassImp(AliVZERODataFEE)
+
+//_____________________________________________________________________________
+AliVZERODataFEE::AliVZERODataFEE() :
+       TObject(),
+       fRun(0),
+       fStartTime(0),
+       fEndTime(0),
+       fIsProcessed(kFALSE),
+       fParameters(NULL)
+{
+       // Default constructor
+}
+
+//_____________________________________________________________________________
+AliVZERODataFEE::AliVZERODataFEE(Int_t nRun, UInt_t startTime, UInt_t endTime) : 
+       TObject(),
+       fRun(nRun),
+       fStartTime(startTime),
+       fEndTime(endTime),
+       fIsProcessed(kFALSE),
+       fParameters(new TMap())
+{
+       AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,
+                                TTimeStamp(startTime).AsString(),
+                                TTimeStamp(endTime).AsString()));
+       fParameters->SetOwnerValue();
+       Init();
+}
+//________________________________________________________________
+AliVZERODataFEE::AliVZERODataFEE (const AliVZERODataFEE& ) :
+       TObject(),
+       fRun(0),
+       fStartTime(0),
+       fEndTime(0),
+       fIsProcessed(kFALSE),
+       fParameters(NULL)
+{
+
+       AliInfo("Not Implemented");
+
+}
+//________________________________________________________________
+AliVZERODataFEE &AliVZERODataFEE::operator= (const AliVZERODataFEE& ) 
+{
+       AliInfo("Not Implemented");
+       return *this;
+}
+
+//_____________________________________________________________________________
+AliVZERODataFEE::~AliVZERODataFEE()
+{
+       delete fAliasNames;
+       delete fParameters;
+}
+
+//_____________________________________________________________________________
+void AliVZERODataFEE::Init(){
+       // initialization of DCS aliases
+       int iAlias = 0;
+
+       // CCIU Parameters
+       
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/BBAThreshold";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/BBCThreshold";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/BGAThreshold";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/BGCThreshold";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/BBAForBGThreshold";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/BBCForBGThreshold";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0AThrLow";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0AThrHigh";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0CThrLow";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0CThrHigh";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0AThrLow";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0AThrHigh";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0CThrLow";
+       fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0CThrHigh";
+       for(int i=1;i<=5;i++) {
+               fAliasNames[iAlias] = "V00/FEE/CCIU/TriggerSelect";
+               fAliasNames[iAlias++] += Form("%d",i);
+       }
+       
+       // CIU  Parameters
+       
+       for(int iCIU = 0; iCIU<8 ; iCIU++){
+               for(int iParam=0; iParam<kNCIUParam;iParam++){
+                       fAliasNames[iAlias] = "V00/FEE/";
+                       fAliasNames[iAlias] += Form("CIU%d/",iCIU+1);
+                       
+                       fAliasNames[iAlias] += GetFEEParamName(iParam);
+                       iAlias++;
+               }
+               for(int iParam=kNCIUParam; iParam<kNCIUParam+kNChannelParam;iParam++){
+                       for(int iCh=1;iCh<=8;iCh++){
+                               fAliasNames[iAlias] = "V00/FEE/";
+                               fAliasNames[iAlias] += Form("CIU%d/",iCIU+1);
+                       
+                               fAliasNames[iAlias] += GetFEEParamName(iParam);
+                               fAliasNames[iAlias] += Form("%d",iCh);
+                       
+                               iAlias++;
+                       }
+               }
+               
+       }
+
+       if(iAlias!=kNAliases) 
+               AliError(Form("Number of FEE Aliases defined not correct"));
+       
+}
+//_____________________________________________________________________________
+void AliVZERODataFEE::ProcessData(TMap& aliasMap){
+
+       if(!(fAliasNames[0])) Init();
+       
+       TObjArray *aliasArr;
+       AliDCSValue* aValue;
+
+       // starting loop on aliases
+       for(int iAlias=0; iAlias<kNAliases; iAlias++){
+               
+               aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[iAlias].Data());
+               if(!aliasArr){
+                       AliError(Form("Alias %s not found!", fAliasNames[iAlias].Data()));
+                       return;
+               }
+                               
+               if(aliasArr->GetEntries()<1){
+                       AliError(Form("Alias %s has no entries!", fAliasNames[iAlias].Data()));
+                       continue;
+               }
+               
+               TIter iterarray(aliasArr);
+                               
+               AliDCSValue * lastVal;
+               while((aValue = (AliDCSValue*) iterarray.Next())) lastVal = aValue; // Take only the last value
+               
+               //AliInfo(Form("%s %f",fAliasNames[iAlias].Data(), val));
+               fParameters->Add(new TObjString(fAliasNames[iAlias].Data()),lastVal);
+               
+       }
+       
+       // calculate mean and rms of the first two histos
+       // and convert index to aliroot channel
+    
+       fIsProcessed=kTRUE;
+       
+}
+//_____________________________________________________________________________
+
+TString AliVZERODataFEE::GetFEEParamName(Int_t iParam){
+// Return the name of the FEE Parameter iParam
+       TString Result;
+       if(iParam>kNCIUParam + kNChannelParam -1) {
+               AliError(Form("Requesting FEE parameter number %d. Max parameter number is : %d",iParam,kNCIUParam + kNChannelParam-1));
+               return Result;
+       }
+       switch (iParam) {
+               case 0: Result = "Clk1Win1"; break;
+               case 1: Result = "Clk2Win1"; break;
+               case 2: Result = "Clk1Win2"; break;
+               case 3: Result = "Clk2Win2"; break;
+               case 4: Result = "DelayClk1Win1"; break;
+               case 5: Result = "DelayClk2Win1"; break;
+               case 6: Result = "DelayClk1Win2"; break;
+               case 7: Result = "DelayClk2Win2"; break;
+               case 8: Result = "LatchWin1"; break;
+               case 9: Result = "LatchWin2"; break;
+               case 10: Result = "ResetWin1"; break;
+               case 11: Result = "ResetWin2"; break;
+               case 12: Result = "PedestalSubtraction"; break;
+               case 13: Result = "EnableCharge"; break;
+               case 14: Result = "EnableTiming"; break;
+               case 15: Result = "PedEven"; break;
+               case 16: Result = "PedOdd"; break;
+               case 17: Result = "PedCutEven"; break;
+               case 18: Result = "PedCutOdd"; break;
+               case 19: Result = "DelayHit"; break;
+               case 20: Result = "DiscriThr"; break;
+       }
+       return Result;
+}
+
+void AliVZERODataFEE::PrintAliases(){
+       for(int i=0;i<kNAliases;i++) AliInfo(Form("%s",fAliasNames[i].Data()));
+}
diff --git a/VZERO/AliVZERODataFEE.h b/VZERO/AliVZERODataFEE.h
new file mode 100644 (file)
index 0000000..19123c2
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef ALIVZERODATAFEE_H
+#define ALIVZERODATAFEE_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved. 
+ *
+ * See cxx source for full Copyright notice                               
+ */
+class TMap;
+
+#include <TObject.h>
+#include <TString.h>
+#include <TMap.h>
+
+class AliVZERODataFEE : public TObject {
+public:
+       //enum {kNAliases=64};
+       AliVZERODataFEE();
+       AliVZERODataFEE(Int_t nRun, UInt_t startTime, UInt_t endTime);
+       AliVZERODataFEE(const AliVZERODataFEE &dataFEE);
+       AliVZERODataFEE& operator= (const AliVZERODataFEE &dataFEE);
+       virtual ~AliVZERODataFEE();
+       
+       void SetRun(Int_t run) {fRun = run;}
+       void SetStartTime(Int_t startTime) {fStartTime = startTime;}
+       void SetEndTime(Int_t endTime) {fEndTime = endTime;}
+       Int_t GetRun() const {return fRun;}
+       Int_t GetStartTime() const {return fStartTime;}
+       Int_t GetEndTime() const {return fEndTime;}
+
+       void ProcessData(TMap& aliasMap);
+       void Init();
+       void PrintAliases();
+       
+       TMap * GetParameters() const {return fParameters;};
+       
+       enum { kNCIUBoards = 8, kNCIUParam = 13, kNChannelParam = 8, kNCCIUParam = 19, kNAliases  = kNChannelParam*8*kNCIUBoards +kNCIUParam*kNCIUBoards + kNCCIUParam };
+
+private:
+
+       Int_t fRun;       // Run number
+       Int_t fStartTime; // Start time
+       Int_t fEndTime;   // End time
+       TString fAliasNames[kNAliases]; // aliases for DCS data
+       Bool_t fIsProcessed; // bool to know processing status
+
+       TString GetFEEParamName(Int_t iParam);
+       
+       TMap * fParameters;
+       
+       ClassDef( AliVZERODataFEE, 1 )  
+       
+};
+
+
+#endif // ALIVZERODATAFEE_H
diff --git a/VZERO/AliVZEROLogicalSignal.cxx b/VZERO/AliVZEROLogicalSignal.cxx
new file mode 100644 (file)
index 0000000..9871cf8
--- /dev/null
@@ -0,0 +1,119 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+
+//  Describes a logical signal
+// Used by AliVZEROTriggerSim class
+// 
+
+#include "AliLog.h"
+#include "AliVZEROLogicalSignal.h"
+
+ClassImp(AliVZEROLogicalSignal)
+
+//_____________________________________________________________________________
+AliVZEROLogicalSignal::AliVZEROLogicalSignal() : TObject(), fStart(0.), fStop(0.)
+{
+}
+//_____________________________________________________________________________
+AliVZEROLogicalSignal::AliVZEROLogicalSignal(Float_t start, Float_t stop) : TObject(), fStart(start), fStop(stop)
+{
+       if(fStart>fStop) AliError("Logical Signal has a Start time AFTER the Stop time");
+       if(fStart==fStop) AliWarning("Logical Signal has a zero width");
+}
+//_____________________________________________________________________________
+AliVZEROLogicalSignal::AliVZEROLogicalSignal(UShort_t profilClock, UInt_t delay) : TObject(), fStart(0.), fStop(0.)
+{
+       Bool_t word;
+       Bool_t up=kFALSE;
+       Bool_t down=kFALSE;
+       
+       for(int i=0 ; i<5 ; i++) {
+               word = (profilClock >> i) & 0x1;
+               if(word&&!up) {
+                       fStart = 5. * i;
+                       up = kTRUE;
+               }
+               if(!word&&up&&!down) {
+                       fStop = 5. * i;
+                       down = kTRUE;
+               }               
+       }
+       if(!down) fStop = 25.;
+       
+       fStart += delay*10.e-3; // Add 10 ps par register unit
+       fStop  += delay*10.e-3; 
+};
+//_____________________________________________________________________________
+AliVZEROLogicalSignal::AliVZEROLogicalSignal(const AliVZEROLogicalSignal &signal) : 
+       TObject(), fStart(signal.fStart), 
+       fStop(signal.fStop)
+{
+       // Copy constructor
+}
+
+//_____________________________________________________________________________
+AliVZEROLogicalSignal::~AliVZEROLogicalSignal(){
+}
+
+//_____________________________________________________________________________
+AliVZEROLogicalSignal& AliVZEROLogicalSignal::operator = 
+(const AliVZEROLogicalSignal& signal)
+{
+       fStart = signal.fStart;
+       fStop  = signal.fStop;
+       return *this;
+}
+
+//_____________________________________________________________________________
+AliVZEROLogicalSignal AliVZEROLogicalSignal::operator|(const AliVZEROLogicalSignal& signal) const 
+{
+       // Perform the Logical OR of two signals: C = A or B
+       if((fStart>signal.fStop) || (signal.fStart>fStop))
+               AliError(Form("Both signal do not superpose in time.\n  Start(A) = %f Stop(A) = %f\n   Start(B) = %f Stop(B) = %f",fStart, fStop, signal.fStart,signal.fStop));
+       
+       AliVZEROLogicalSignal result;
+       if(fStart<signal.fStart) result.fStart = fStart;
+       else result.fStart = signal.fStart;
+       
+       if(fStop>signal.fStop) result.fStop = fStop;
+       else result.fStop = signal.fStop;
+               
+       return result;
+}
+//_____________________________________________________________________________
+AliVZEROLogicalSignal AliVZEROLogicalSignal::operator&(const AliVZEROLogicalSignal& signal) const
+{
+       // Perform the Logical AND of two signals: C = A and B
+       if((fStart>signal.fStop) || (signal.fStart>fStop))
+               AliError(Form("Both signal do not superpose in time.\n  Start(A) = %f Stop(A) = %f\n   Start(B) = %f Stop(B) = %f",fStart, fStop, signal.fStart,signal.fStop));
+       
+       AliVZEROLogicalSignal result;
+       if(fStart>signal.fStart) result.fStart = fStart;
+       else result.fStart = signal.fStart;
+       
+       if(fStop<signal.fStop) result.fStop = fStop;
+       else result.fStop = signal.fStop;
+       
+       return result;
+}
+
+//_____________________________________________________________________________
+Bool_t AliVZEROLogicalSignal::IsInCoincidence(Float_t time)
+{
+       Bool_t result = kFALSE;
+       if((time>fStart) && (time<fStop)) result = kTRUE;
+       return result;
+}
diff --git a/VZERO/AliVZEROLogicalSignal.h b/VZERO/AliVZEROLogicalSignal.h
new file mode 100644 (file)
index 0000000..faa71f4
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef ALIVZEROLOGICALSIGNAL_H
+#define ALIVZEROLOGICALSIGNAL_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved. 
+ *
+ * See cxx source for full Copyright notice                               
+ */
+
+#include <TObject.h>
+
+class AliVZEROLogicalSignal  : public TObject {
+public:
+       AliVZEROLogicalSignal();
+       AliVZEROLogicalSignal(Float_t start, Float_t stop);
+       AliVZEROLogicalSignal(UShort_t profilClock, UInt_t delay);
+       ~AliVZEROLogicalSignal();
+       AliVZEROLogicalSignal(const AliVZEROLogicalSignal &signal);
+       AliVZEROLogicalSignal& operator= (const AliVZEROLogicalSignal &signal);
+       AliVZEROLogicalSignal operator& (const AliVZEROLogicalSignal &signal) const;
+       AliVZEROLogicalSignal operator| (const AliVZEROLogicalSignal &signal) const;
+       // Print method
+       virtual void Print(Option_t* opt="") const { AliInfo(Form("\t -> Start %f Stop %f\n ",fStart,fStop));};
+       
+       Float_t GetStartTime() const {return fStart;};
+       Float_t GetStopTime() const {return fStop;};
+       Float_t GetWidth() const {return (fStop - fStart);};
+       
+       void SetStartTime(Float_t time);
+       void SetStopTime(Float_t time);
+       
+       Bool_t IsInCoincidence(Float_t time);
+       
+private:
+       
+       Float_t fStart; // Start Time of the signal with respect to the LHC Clock
+       Float_t fStop;  // Stop Time of the signal with respect to the LHC Clock
+       
+       
+       ClassDef( AliVZEROLogicalSignal, 1 )  
+       
+};
+
+#endif // ALIVZEROLOGICALSIGNAL_H
diff --git a/VZERO/AliVZEROTriggerData.cxx b/VZERO/AliVZEROTriggerData.cxx
new file mode 100644 (file)
index 0000000..ba837c4
--- /dev/null
@@ -0,0 +1,452 @@
+
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+
+//  
+// 
+// 
+#include <TObjString.h>
+
+#include "AliLog.h"
+#include "AliDCSValue.h"
+#include "AliVZEROTriggerData.h"
+
+ClassImp(AliVZEROTriggerData)
+//________________________________________________________________
+
+AliVZEROTriggerData::AliVZEROTriggerData() :
+       TNamed(),
+       fBBAThreshold(0),
+       fBBCThreshold(0) ,  
+       fBGAThreshold(0) ,  
+       fBGCThreshold(0) ,  
+       fBBAForBGThreshold(0) ,  
+       fBBCForBGThreshold(0) ,  
+       fCentralityVOAThrLow(0) ,  
+       fCentralityVOAThrHigh(0) , 
+       fCentralityVOCThrLow(0) ,  
+       fCentralityVOCThrHigh(0) , 
+       fMultV0AThrLow(0) ,  
+       fMultV0AThrHigh(0) , 
+       fMultV0CThrLow(0) ,  
+       fMultV0CThrHigh(0),
+       fRun(0),
+       fStartTime(0),
+       fEndTime(0),
+       fIsProcessed(kFALSE)    
+
+{
+       for(int i=0; i<kNCIUBoards ;i++) {
+               fClk1Win1[i] = fClk1Win2[i] = 0;
+               fDelayClk1Win1[i] = fDelayClk1Win2[i] = 0;
+               fClk2Win1[i] = fClk2Win2[i] = 0;
+               fDelayClk2Win1[i] = fDelayClk2Win2[i] = 0;
+               fLatchWin1[i] = fLatchWin2[i] = 0;
+               fResetWin1[i] = fResetWin2[i] = 0;
+               fPedestalSubtraction[i] = kFALSE;
+       }
+}
+//________________________________________________________________
+AliVZEROTriggerData::AliVZEROTriggerData(Int_t nRun, UInt_t startTime, UInt_t endTime) :
+       TNamed(),
+       fBBAThreshold(0),
+       fBBCThreshold(0) ,  
+       fBGAThreshold(0) ,  
+       fBGCThreshold(0) ,  
+       fBBAForBGThreshold(0) ,  
+       fBBCForBGThreshold(0) ,  
+       fCentralityVOAThrLow(0) ,  
+       fCentralityVOAThrHigh(0) , 
+       fCentralityVOCThrLow(0) ,  
+       fCentralityVOCThrHigh(0) , 
+       fMultV0AThrLow(0) ,  
+       fMultV0AThrHigh(0) , 
+       fMultV0CThrLow(0) ,  
+       fMultV0CThrHigh(0),
+       fRun(nRun),
+       fStartTime(startTime),
+       fEndTime(endTime),
+       fIsProcessed(kFALSE)
+{
+       for(int i=0; i<kNCIUBoards ;i++) {
+               fClk1Win1[i] = fClk1Win2[i] = 0;
+               fDelayClk1Win1[i] = fDelayClk1Win2[i] = 0;
+               fClk2Win1[i] = fClk2Win2[i] = 0;
+               fDelayClk2Win1[i] = fDelayClk2Win2[i] = 0;
+               fLatchWin1[i] = fLatchWin2[i] = 0;
+               fResetWin1[i] = fResetWin2[i] = 0;
+               fPedestalSubtraction[i] = kFALSE;
+       }
+       TString namst = "Trigger_FEE";
+       SetName(namst.Data());
+       SetTitle(namst.Data());
+       
+}
+
+//________________________________________________________________
+AliVZEROTriggerData::~AliVZEROTriggerData(){
+}
+//_____________________________________________________________________________
+void AliVZEROTriggerData::FillData(AliVZERODataFEE * data){
+       TMap * params = data->GetParameters();
+       TIter iter(params);     
+       TObjString* aliasName;
+       
+       while ((  aliasName = (TObjString*) iter.Next() ))  {
+               AliDCSValue* aValue = (AliDCSValue*) params->GetValue(aliasName);
+               Float_t val = aValue->GetFloat();
+               //AliInfo(Form("%s : %f",aliasName->String().Data(), val));
+               SetParameter(aliasName->String(),val);
+       
+       }       
+}
+
+//_____________________________________________________________________________
+void AliVZEROTriggerData::SetParameter(TString name, Float_t val){
+       Int_t iBoard = -1;
+       Int_t iChannel = -1;
+
+       TSeqCollection* nameSplit = name.Tokenize("/");
+       TObjString * boardName = (TObjString *)nameSplit->At(2);
+       if(!boardName->String().Contains("CCIU")) sscanf(boardName->String().Data(),"CIU%d",&iBoard);
+       
+       TString paramName = ((TObjString *)nameSplit->At(3))->String();
+       Char_t channel[2] ; channel[1] = '\0';
+       channel[0] = paramName[paramName.Sizeof()-2];
+       sscanf(channel,"%d",&iChannel);
+       
+       if(name.Contains("DelayClk1Win1")) SetDelayClk1Win1((UShort_t) val,iBoard-1);
+       else if(name.Contains("Clk1Win1")) SetClk1Win1((UShort_t) val,iBoard-1);
+       else if(name.Contains("DelayClk1Win2")) SetDelayClk1Win2((UShort_t) val,iBoard-1);
+       else if(name.Contains("Clk1Win2")) SetClk1Win2((UShort_t) val,iBoard-1);
+       else if(name.Contains("DelayClk2Win1")) SetDelayClk2Win1((UShort_t) val,iBoard-1);
+       else if(name.Contains("Clk2Win1")) SetClk2Win1((UShort_t) val,iBoard-1);
+       else if(name.Contains("DelayClk2Win2")) SetDelayClk2Win2((UShort_t) val,iBoard-1);
+       else if(name.Contains("Clk2Win2")) SetClk2Win2((UShort_t) val,iBoard-1);
+       else if(name.Contains("LatchWin1")) SetLatchWin1((UShort_t) val,iBoard-1);
+       else if(name.Contains("LatchWin2")) SetLatchWin2((UShort_t) val,iBoard-1);
+       else if(name.Contains("ResetWin1")) SetResetWin1((UShort_t) val,iBoard-1);
+       else if(name.Contains("ResetWin2")) SetResetWin2((UShort_t) val,iBoard-1);
+       else if(name.Contains("PedestalSubtraction")) SetPedestalSubtraction((Bool_t) val,iBoard-1);
+       else if(name.Contains("BBAThreshold")) SetBBAThreshold((UShort_t) val);
+       else if(name.Contains("BBCThreshold")) SetBBCThreshold((UShort_t) val);
+       else if(name.Contains("BGAThreshold")) SetBGAThreshold((UShort_t) val);
+       else if(name.Contains("BGCThreshold")) SetBGCThreshold((UShort_t) val);
+       else if(name.Contains("BBAForBGThreshold")) SetBBAForBGThreshold((UShort_t) val);
+       else if(name.Contains("BBCForBGThreshold")) SetBBCForBGThreshold((UShort_t) val);
+       else if(name.Contains("CentralityV0AThrLow")) SetCentralityV0AThrLow((UShort_t) val);
+       else if(name.Contains("CentralityV0AThrHigh")) SetCentralityV0AThrHigh((UShort_t) val);
+       else if(name.Contains("CentralityV0CThrLow")) SetCentralityV0CThrLow((UShort_t) val);
+       else if(name.Contains("CentralityV0CThrHigh")) SetCentralityV0CThrHigh((UShort_t) val);
+       else if(name.Contains("MultV0AThrLow")) SetMultV0AThrLow((UShort_t) val);
+       else if(name.Contains("MultV0AThrHigh")) SetMultV0AThrHigh((UShort_t) val);
+       else if(name.Contains("MultV0CThrLow")) SetMultV0CThrLow((UShort_t) val);
+       else if(name.Contains("MultV0CThrHigh")) SetMultV0CThrHigh((UShort_t) val);
+       else if(name.Contains("TriggerSelect")) SetTriggerSelected((UShort_t) val, iBoard -1);
+       else if(name.Contains("EnableCharge")) SetEnableCharge((Bool_t) val, iBoard -1, iChannel-1);
+       else if(name.Contains("EnableTiming")) SetEnableTiming((Bool_t) val, iBoard -1, iChannel-1);
+       else if(name.Contains("DiscriThr")) SetDiscriThr((UShort_t) val, iBoard -1, iChannel-1);
+       else if(name.Contains("DelayHit")) SetDelayHit((UShort_t) val, iBoard -1, iChannel-1);
+       else if(name.Contains("PedOdd")) SetPedestal((UShort_t) val, 1, iBoard -1, iChannel-1);
+       else if(name.Contains("PedEven")) SetPedestal((UShort_t) val, 0, iBoard -1, iChannel-1);
+       else if(name.Contains("PedCutOdd")) SetPedestalCut((UShort_t) val, 1, iBoard -1, iChannel-1);
+       else if(name.Contains("PedCutEven")) SetPedestalCut((UShort_t) val, 0, iBoard -1, iChannel-1);
+       else AliError(Form("No Setter found for FEE parameter : %s",name.Data()));
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetPedestalCut(UShort_t val,Int_t integrator, Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) {
+               if(integrator) fPedestalCutOdd[board][channel] = val;
+               else fPedestalCutEven[board][channel] = val;
+       } else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));
+}
+//________________________________________________________________
+UShort_t AliVZEROTriggerData::GetPedestalCut(Int_t integrator, Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) {
+               if(integrator) return(fPedestalCutOdd[board][channel]);
+               else return(fPedestalCutEven[board][channel]);
+       }else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));
+       return 0;
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetPedestal(UShort_t val, Int_t integrator, Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) {
+               if(integrator) fPedestalOdd[board][channel] = val;
+               else fPedestalEven[board][channel] = val;
+       } else AliError(Form("Impossible to write at : Board %d ; Channel %d ; Integrator %d ",board,channel,integrator));
+}
+//________________________________________________________________
+UShort_t AliVZEROTriggerData::GetPedestal(Int_t integrator, Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) {
+               if(integrator) return(fPedestalOdd[board][channel]);
+               else return(fPedestalEven[board][channel]);
+       } else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));
+       return 0;
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetDelayHit(UShort_t val,Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) fDelayHit[board][channel] = val;
+       else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));
+}
+//________________________________________________________________
+UShort_t AliVZEROTriggerData::GetDelayHit(Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) return(fDelayHit[board][channel]);
+       else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));
+       return 0;
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetDiscriThr(UShort_t val,Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) fDiscriThr[board][channel] = val;
+       else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));
+}
+//________________________________________________________________
+UShort_t AliVZEROTriggerData::GetDiscriThr(Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) return(fDiscriThr[board][channel]);
+       else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));
+       return 0;
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetEnableCharge(Bool_t val,Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) fEnableCharge[board][channel] = val;
+       else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));
+}
+//________________________________________________________________
+Bool_t AliVZEROTriggerData::GetEnableCharge(Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) return(fEnableCharge[board][channel]);
+       else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));
+       return kFALSE;
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetEnableTiming(Bool_t val,Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) fEnableTiming[board][channel] = val;
+       else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));
+}
+//________________________________________________________________
+Bool_t AliVZEROTriggerData::GetEnableTiming(Int_t board, Int_t channel)
+{
+       if(board<kNCIUBoards && channel<kNChannels) return(fEnableTiming[board][channel]);
+       else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));
+       return kFALSE;
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetTriggerSelected(UShort_t trigger, Int_t output)
+{
+       if(output<kNTriggerOutputs) fTriggerSelected[output] = trigger;
+       else AliError(Form("Trigger output number %d not valid",output));
+}
+
+//________________________________________________________________
+void AliVZEROTriggerData::SetClk1Win1(UShort_t* clks)
+{
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk1Win1(clks[t],t);
+       else AliFatal("Profil Clock1 Win1 Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetClk2Win1(UShort_t* clks)
+{
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk2Win1(clks[t],t);
+       else AliFatal("Profil Clock2 Win1 Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetClk1Win1(UShort_t clk, Int_t board)
+{
+       if(IsClkValid(clk) && (board<kNCIUBoards)) fClk1Win1[board] = clk;
+       else AliError(Form("Profil Clock1 Win1 of board %d is not valid : %d",board,clk));
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetClk2Win1(UShort_t clk, Int_t board)
+{
+       if(IsClkValid(clk) && (board<kNCIUBoards)) fClk2Win1[board] = clk;
+       else AliError(Form("Profil Clock2 Win1 of board %d is not valid",board));
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetClk1Win2(UShort_t* clks)
+{
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk1Win2(clks[t],t);
+       else AliFatal("Profil Clock1 Win2 Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetClk2Win2(UShort_t* clks)
+{
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk2Win2(clks[t],t);
+       else AliFatal("Profil Clock2 Win2 Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetClk1Win2(UShort_t clk, Int_t board)
+{
+       if(IsClkValid(clk) && (board<kNCIUBoards)) fClk1Win2[board] = clk;
+       else AliError(Form("Profil Clock1 Win2 of board %d is not valid",board));
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetClk2Win2(UShort_t clk, Int_t board)
+{
+       if(IsClkValid(clk) && (board<kNCIUBoards)) fClk2Win2[board] = clk;
+       else AliError(Form("Profil Clock2 Win2 of board %d is not valid",board));
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetDelayClk1Win1(UShort_t* delays)
+{
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk1Win1(delays[t],t);
+       else AliFatal("Profil Clock1 Win1 Delays Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetDelayClk1Win1(UShort_t delay, Int_t board)
+{
+       if(delay>1023){
+               AliWarning(Form("Profil Clock1 Win1 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if(board<kNCIUBoards)   fDelayClk1Win1[board] = delay;
+       else AliError("Trying to write out of the array");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetDelayClk2Win1(UShort_t* delays)
+{
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk2Win1(delays[t],t);
+       else AliFatal("Profil Clock2 Win1 Delays Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetDelayClk2Win1(UShort_t delay, Int_t board)
+{
+       if(delay>1023){
+               AliWarning(Form("Profil Clock2 Win1 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if(board<kNCIUBoards)   fDelayClk2Win1[board] = delay;
+       else AliError("Trying to write out of the array");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetDelayClk1Win2(UShort_t* delays)
+{
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk1Win2(delays[t],t);
+       else AliFatal("Profil Clock1 Win2 Delays Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetDelayClk1Win2(UShort_t delay, Int_t board)
+{
+       if(delay>1023){
+               AliWarning(Form("Profil Clock1 Win2 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if(board<kNCIUBoards)   fDelayClk1Win2[board] = delay;
+       else AliError("Trying to write out of the array");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetDelayClk2Win2(UShort_t* delays)
+{
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk2Win2(delays[t],t);
+       else AliFatal("Profil Clock2 Win2 Delays Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetDelayClk2Win2(UShort_t delay, Int_t board)
+{
+       if(delay>1023){
+               AliWarning(Form("Profil Clock2 Win2 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if(board<kNCIUBoards)   fDelayClk2Win2[board] = delay;
+       else AliError("Trying to write out of the array");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetLatchWin1(UShort_t *latchs){
+       if(latchs) for(int t=0; t<kNCIUBoards; t++) SetLatchWin1(latchs[t],t);
+       else AliFatal("Latch Win1 profil Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetLatchWin1(UShort_t latch, Int_t board)
+{
+       if(IsClkValid(latch) && (board<kNCIUBoards)) fLatchWin1[board] = latch;
+       else AliError(Form("Latch Win1 profil of board %d is not valid",board));
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetLatchWin2(UShort_t *latchs){
+       if(latchs) for(int t=0; t<kNCIUBoards; t++) SetLatchWin2(latchs[t],t);
+       else AliFatal("Latch Win2 profil Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetLatchWin2(UShort_t latch, Int_t board)
+{
+       if(IsClkValid(latch) && (board<kNCIUBoards)) fLatchWin2[board] = latch;
+       else AliError(Form("Latch Win2 profil of board %d is not valid",board));
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetResetWin1(UShort_t *resets){
+       if(resets) for(int t=0; t<kNCIUBoards; t++) SetResetWin1(resets[t],t);
+       else AliFatal("Reset Win1 profil Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetResetWin1(UShort_t reset, Int_t board)
+{
+       if(IsClkValid(reset) && (board<kNCIUBoards)) fResetWin1[board] = reset;
+       else AliError(Form("Reset Win1 profil of board %d is not valid",board));
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetResetWin2(UShort_t *resets){
+       if(resets)  for(int t=0; t<kNCIUBoards; t++) SetResetWin2(resets[t],t);
+       else AliFatal("Reset Win2 profil Not defined.");
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetResetWin2(UShort_t reset, Int_t board)
+{
+       if(IsClkValid(reset) && (board<kNCIUBoards)) fResetWin2[board] = reset;
+       else AliError(Form("Reset Win2 profil of board %d is not valid",board));
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetPedestalSubtraction(Bool_t *peds){
+       if(peds)  for(int t=0; t<kNCIUBoards; t++) SetPedestalSubtraction(peds[t],t);
+       else AliFatal("Pedestal Subtraction Not defined.");
+       
+}
+//________________________________________________________________
+void AliVZEROTriggerData::SetPedestalSubtraction(Bool_t ped, Int_t board)
+{
+       if((board<kNCIUBoards)) fPedestalSubtraction[board] = ped;
+       else AliError(Form("Board %d is not valid",board));
+}
+
+//________________________________________________________________
+Bool_t AliVZEROTriggerData::IsClkValid(UShort_t clock){
+       Bool_t word[5];
+       Bool_t isValid = kTRUE;
+       Short_t RisingEdge = 0;
+       Short_t FallingEdge = 0;
+       for(int i=0 ; i<5 ; i++) word[i] = (clock >> i) & 0x1;
+       
+       if(word[0] != word[4]){
+               if(word[4]) FallingEdge++;
+               else RisingEdge++;
+       }       
+       for(int i=1 ; i<5 ; i++){
+               if(word[i] != word[i-1]) {
+                       if(word[i-1]) FallingEdge++;
+                       else RisingEdge++;
+               }
+       }
+       if((FallingEdge>1)||(RisingEdge>1)) isValid = kFALSE;
+       if(((RisingEdge==0)&&(FallingEdge==0)) &&(!word[0]))  isValid = kFALSE;
+       return isValid;
+}
diff --git a/VZERO/AliVZEROTriggerData.h b/VZERO/AliVZEROTriggerData.h
new file mode 100644 (file)
index 0000000..07b7aaf
--- /dev/null
@@ -0,0 +1,214 @@
+#ifndef ALIVZEROTRIGGERDATA_H
+#define ALIVZEROTRIGGERDATA_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved. 
+ *
+ * See cxx source for full Copyright notice                               
+ */
+#include "AliVZERODataFEE.h";
+
+#include <TNamed.h>
+
+class AliVZEROTriggerData : public TNamed {
+public:
+       AliVZEROTriggerData();
+       AliVZEROTriggerData(Int_t nRun, UInt_t startTime, UInt_t endTime);
+       ~AliVZEROTriggerData();
+       AliVZEROTriggerData(const AliVZEROTriggerData &triggerData);
+       AliVZEROTriggerData& operator= (const AliVZEROTriggerData &triggerData);
+       
+       void FillData(AliVZERODataFEE * data);
+
+       // ----- Setters -----
+
+       void SetClk1Win1(UShort_t* clks);
+       void SetClk1Win1(UShort_t clk, Int_t board);
+       void SetClk2Win1(UShort_t* clks);
+       void SetClk2Win1(UShort_t clk, Int_t board);
+       
+       void SetClk1Win2(UShort_t* clks);
+       void SetClk1Win2(UShort_t clk, Int_t board);
+       void SetClk2Win2(UShort_t* clks);
+       void SetClk2Win2(UShort_t clk, Int_t board);
+       
+       void SetDelayClk1Win1(UShort_t* delays);
+       void SetDelayClk1Win1(UShort_t delay, Int_t board);
+       void SetDelayClk2Win1(UShort_t* delays);
+       void SetDelayClk2Win1(UShort_t delay, Int_t board);
+       
+       void SetDelayClk1Win2(UShort_t* delays);
+       void SetDelayClk1Win2(UShort_t delay, Int_t board);
+       void SetDelayClk2Win2(UShort_t* delays);
+       void SetDelayClk2Win2(UShort_t delay, Int_t board);
+       
+       void SetLatchWin1(UShort_t *latchs);
+       void SetLatchWin1(UShort_t latch, Int_t board);
+       void SetLatchWin2(UShort_t *latchs);
+       void SetLatchWin2(UShort_t latch, Int_t board);
+       
+       void SetResetWin1(UShort_t *resets);
+       void SetResetWin1(UShort_t reset, Int_t board);
+       void SetResetWin2(UShort_t *resets);
+       void SetResetWin2(UShort_t reset, Int_t board);
+       
+       void SetPedestalSubtraction(Bool_t *peds);
+       void SetPedestalSubtraction(Bool_t ped, Int_t board);
+       
+       void SetBBAThreshold(UShort_t th) {fBBAThreshold = th;};
+       void SetBBCThreshold(UShort_t th) {fBBCThreshold = th;};
+
+       void SetBGAThreshold(UShort_t th) {fBGAThreshold = th;};
+       void SetBGCThreshold(UShort_t th) {fBGCThreshold = th;};
+
+       void SetBBAForBGThreshold(UShort_t th) {fBBAForBGThreshold = th;};
+       void SetBBCForBGThreshold(UShort_t th) {fBBCForBGThreshold = th;};
+       
+       void SetCentralityV0AThrLow(UShort_t th) {fCentralityVOAThrLow = th;};
+       void SetCentralityV0AThrHigh(UShort_t th) {fCentralityVOAThrHigh = th;};
+       
+       void SetCentralityV0CThrLow(UShort_t th) {fCentralityVOCThrLow = th;};
+       void SetCentralityV0CThrHigh(UShort_t th) {fCentralityVOCThrHigh = th;};
+       
+       void SetMultV0AThrLow(UShort_t th) {fMultV0AThrLow = th;};
+       void SetMultV0AThrHigh(UShort_t th) {fMultV0AThrHigh = th;};
+       
+       void SetMultV0CThrLow(UShort_t th) {fMultV0CThrLow = th;};
+       void SetMultV0CThrHigh(UShort_t th) {fMultV0CThrHigh = th;};
+       
+       void SetTriggerSelected(UShort_t trigger, Int_t output);
+       
+       void SetEnableCharge(Bool_t val, Int_t board, Int_t channel);
+       void SetEnableTiming(Bool_t val, Int_t board, Int_t channel);
+       void SetDiscriThr(UShort_t val, Int_t board, Int_t channel);
+       void SetDelayHit(UShort_t val, Int_t board, Int_t channel);
+       void SetPedestal(UShort_t val, Int_t integrator, Int_t board, Int_t channel);
+       void SetPedestalCut(UShort_t val, Int_t integrator, Int_t board, Int_t channel);
+
+       
+       // ----- Getters -----
+       
+       UShort_t * GetClk1Win1() const {return (UShort_t*)fClk1Win1;};
+       UShort_t GetClk1Win1(Int_t board ) const {return (board<kNCIUBoards?fClk1Win1[board]:0);};
+       UShort_t * GetClk2Win1() const {return (UShort_t*)fClk2Win1;};
+       UShort_t GetClk2Win1(Int_t board ) const {return (board<kNCIUBoards?fClk2Win1[board]:0);};
+
+       UShort_t * GetClk1Win2() const {return (UShort_t*)fClk1Win2;};
+       UShort_t GetClk1Win2(Int_t board ) const {return (board<kNCIUBoards?fClk1Win2[board]:0);};
+       UShort_t * GetClk2Win2() const {return (UShort_t*)fClk2Win2;};
+       UShort_t GetClk2Win2(Int_t board ) const {return (board<kNCIUBoards?fClk2Win2[board]:0);};
+
+       UShort_t * GetDelayClk1Win1() const {return (UShort_t*)fDelayClk1Win1;};
+       UShort_t GetDelayClk1Win1(Int_t board ) const {return (board<kNCIUBoards?fDelayClk1Win1[board]:0);};
+       UShort_t * GetDelayClk2Win1() const {return (UShort_t*)fDelayClk2Win1;};
+       UShort_t GetDelayClk2Win1(Int_t board ) const {return (board<kNCIUBoards?fDelayClk2Win1[board]:0);};
+       
+       UShort_t * GetDelayClk1Win2() const {return (UShort_t*)fDelayClk1Win2;};
+       UShort_t GetDelayClk1Win2(Int_t board ) const {return (board<kNCIUBoards?fDelayClk1Win2[board]:0);};
+       UShort_t * GetDelayClk2Win2() const {return (UShort_t*)fDelayClk2Win2;};
+       UShort_t GetDelayClk2Win2(Int_t board ) const {return (board<kNCIUBoards?fDelayClk2Win2[board]:0);};
+       
+       UShort_t * GetLatchWin1() const {return (UShort_t*)fLatchWin1;};
+       UShort_t GetLatchWin1(Int_t board ) const  {return (board<kNCIUBoards?fLatchWin1[board]:0);};
+       UShort_t * GetLatchWin2() const {return (UShort_t*)fLatchWin2;};
+       UShort_t GetLatchWin2(Int_t board ) const  {return (board<kNCIUBoards?fLatchWin2[board]:0);};
+       
+       UShort_t * GetResetWin1() const {return (UShort_t*)fResetWin1;};
+       UShort_t GetResetWin1(Int_t board ) const  {return (board<kNCIUBoards?fResetWin1[board]:0);};
+       UShort_t * GetResetWin2() const {return (UShort_t*)fResetWin2;};
+       UShort_t GetResetWin2(Int_t board ) const  {return (board<kNCIUBoards?fResetWin2[board]:0);};
+       
+       Bool_t * GetPedestalSubtraction() const {return (Bool_t*) fPedestalSubtraction;};
+       Bool_t GetPedestalSubtraction(Int_t board ) const  {return (board<kNCIUBoards?fPedestalSubtraction[board]:0);};
+
+       UShort_t GetBBAThreshold() const {return fBBAThreshold;};
+       UShort_t GetBBCThreshold() const {return fBBCThreshold;};
+
+       UShort_t GetBGAThreshold() const {return fBGAThreshold;};
+       UShort_t GetBGCThreshold() const {return fBGCThreshold;};
+
+       UShort_t GetBBAForBGThreshold() const {return fBBAForBGThreshold;};
+       UShort_t GetBBCForBGThreshold() const {return fBBCForBGThreshold;};
+       
+       UShort_t GetCentralityV0AThrLow() const {return fCentralityVOAThrLow;};
+       UShort_t GetCentralityV0AThrHigh() const {return fCentralityVOAThrHigh;};
+       
+       UShort_t GetCentralityV0CThrLow() const {return fCentralityVOCThrLow;};
+       UShort_t GetCentralityV0CThrHigh() const {return fCentralityVOCThrHigh;};
+
+       UShort_t GetMultV0AThrLow() const {return fMultV0AThrLow;};
+       UShort_t GetMultV0AThrHigh() const {return fMultV0AThrHigh;};
+
+       UShort_t GetMultV0CThrLow() const {return fMultV0CThrLow;};
+       UShort_t GetMultV0CThrHigh() const {return fMultV0CThrHigh;};
+
+       UShort_t GetTriggerSelected(Int_t output) const {return (output<kNTriggerOutputs?fTriggerSelected[output]:0);};
+       
+       Bool_t GetEnableCharge(Int_t board, Int_t channel);
+       Bool_t GetEnableTiming(Int_t board, Int_t channel);
+       UShort_t GetDiscriThr(Int_t board, Int_t channel);
+       UShort_t GetDelayHit(Int_t board, Int_t channel);
+       UShort_t GetPedestal(Int_t integrator, Int_t board, Int_t channel);
+       UShort_t GetPedestalCut(Int_t integrator, Int_t board, Int_t channel);
+
+       enum {
+               kNCIUBoards = AliVZERODataFEE::kNCIUBoards,
+               kNAliases = AliVZERODataFEE::kNAliases,
+               kNTriggerOutputs = 5,
+               kNChannels = 8
+       };
+       
+private:
+       
+       UShort_t fClk1Win1[kNCIUBoards]; //Profil of the Clock 1  of the Window 1 (BB window)
+       UShort_t fClk2Win1[kNCIUBoards]; //Profil of the Clock 2  of the Window 1 (BB window)
+       UShort_t fClk1Win2[kNCIUBoards]; //Profil of the Clock 1  of the Window 2 (BG window)
+       UShort_t fClk2Win2[kNCIUBoards]; //Profil of the Clock 2  of the Window 2 (BG window)
+       UShort_t fDelayClk1Win1[kNCIUBoards]; // Delays of the Clock 1  of the Window 1 (BB window)
+       UShort_t fDelayClk2Win1[kNCIUBoards]; // Delays of the Clock 2 of the Window 1 (BB window)
+       UShort_t fDelayClk1Win2[kNCIUBoards]; // Delays of the Clock 1  of the Window 2 (BG window)
+       UShort_t fDelayClk2Win2[kNCIUBoards]; // Delays of the Clock 2 of the Window 2 (BG window)
+       UShort_t fLatchWin1[kNCIUBoards]; //Profil of the Clock of the Latch signal of Window 1 (BB window)
+       UShort_t fLatchWin2[kNCIUBoards]; //Profil of the Clock of the Latch signal of Window 2 (BG window)
+       UShort_t fResetWin1[kNCIUBoards]; //Profil of the Clock of the Reset signal of Window 1 (BB window)
+       UShort_t fResetWin2[kNCIUBoards]; //Profil of the Clock of the Reset signal of Window 2 (BG window)
+       Bool_t   fPedestalSubtraction[kNCIUBoards]; // Flag to en(dis)able pedestal subtraction before centrality trigger calculation
+       UShort_t fBBAThreshold;  // Minimum bias Threshold in number of channel hit for V0A
+       UShort_t fBBCThreshold;  // Minimum bias Threshold in number of channel hit for V0C
+       UShort_t fBGAThreshold;  // Beam Gas Threshold in number of channel hit for V0A
+       UShort_t fBGCThreshold;  // Beam Gas Threshold in number of channel hit for V0C
+       UShort_t fBBAForBGThreshold;  // BBA threshold for Beam Gas triggers (i.e. BBA and BGC)
+       UShort_t fBBCForBGThreshold;  // BBC threshold for Beam Gas triggers (i.e. BBC and BGA)
+       UShort_t fCentralityVOAThrLow;  // Threshold used for centrality triggers (i.e. CTA1 and CTC1)
+       UShort_t fCentralityVOAThrHigh; // Threshold used for centrality triggers (i.e. CTA2 and CTC2)
+       UShort_t fCentralityVOCThrLow;  // Threshold used for centrality triggers (i.e. CTA1 and CTC1)
+       UShort_t fCentralityVOCThrHigh; // Threshold used for centrality triggers (i.e. CTA2 and CTC2)
+       UShort_t fMultV0AThrLow;  // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+       UShort_t fMultV0AThrHigh; // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+       UShort_t fMultV0CThrLow;  // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+       UShort_t fMultV0CThrHigh; // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+       UShort_t fTriggerSelected[kNTriggerOutputs]; // Triggers selected on the 5 outputs to CTP
+       Bool_t   fEnableCharge[kNCIUBoards][kNChannels]; // Flag to know is a channel is participating to the Charge triggers
+       Bool_t   fEnableTiming[kNCIUBoards][kNChannels]; // Flag to know is a channel is participating to the Timing triggers
+       UShort_t fDiscriThr[kNCIUBoards][kNChannels]; // Threshold of each discriminator
+       UShort_t fDelayHit[kNCIUBoards][kNChannels]; // Individual delays of each channel 
+       UShort_t fPedestalOdd[kNCIUBoards][kNChannels]; // Pedestals for the Odd integrators
+       UShort_t fPedestalEven[kNCIUBoards][kNChannels]; // Pedestals for the Even integrators
+       UShort_t fPedestalCutOdd[kNCIUBoards][kNChannels]; // Pedestals Cut for the Odd integrators
+       UShort_t fPedestalCutEven[kNCIUBoards][kNChannels]; // Pedestals Cut for the Even integrators
+
+       Int_t fRun;       // Run number
+       Int_t fStartTime; // Start time
+       Int_t fEndTime;   // End time
+       TString fAliasNames[kNAliases]; // aliases for DCS data
+       Bool_t fIsProcessed; // bool to know processing status
+       
+       Bool_t  IsClkValid(UShort_t clock);
+       void SetParameter(TString name, Float_t val);
+       
+       
+       ClassDef( AliVZEROTriggerData, 1 )  
+
+};
+
+
+#endif // ALIVZEROTRIGGERDATA_H
diff --git a/VZERO/AliVZEROTriggerSimulator.cxx b/VZERO/AliVZEROTriggerSimulator.cxx
new file mode 100644 (file)
index 0000000..788cc81
--- /dev/null
@@ -0,0 +1,249 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+
+//  Simulate the VZERO Trigger response
+// Use FEE parameters stored in Database
+// Can work on real data or in simulation
+#include "TTree.h"
+#include "TClonesArray.h"
+
+#include "AliLog.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliCDBStorage.h"
+#include "AliCDBId.h"
+#include "AliVZEROTriggerData.h"
+#include "AliVZEROLogicalSignal.h"
+#include "AliVZEROTriggerSimulator.h"
+#include "AliVZEROdigit.h"
+
+ClassImp(AliVZEROTriggerSimulator)
+
+//_____________________________________________________________________________
+AliVZEROTriggerSimulator::AliVZEROTriggerSimulator(TTree * digitsTree, TClonesArray* digits) : 
+TObject(),fTriggerData(LoadTriggerData()),fDigitsTree(digitsTree),fDigits(digits),fTriggerWord(0)
+{
+       for(int i=0;i<64;i++) {
+               fBBFlags[i] = fBGFlags[i] = kFALSE;
+               fCharges[i] = 0;
+       }
+       GenerateBBWindows();
+       GenerateBGWindows();
+       for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {
+               fBBLatch[i] = new AliVZEROLogicalSignal(fTriggerData->GetLatchWin1(i),0); 
+               fBGLatch[i] = new AliVZEROLogicalSignal(fTriggerData->GetLatchWin2(i),0); 
+               fBBReset[i] = new AliVZEROLogicalSignal(fTriggerData->GetResetWin1(i),0);
+               fBGReset[i] = new AliVZEROLogicalSignal(fTriggerData->GetResetWin2(i),0);               
+       }
+       fBBGate[0]->Print();
+       fBBGate[4]->Print();
+}
+//_____________________________________________________________________________
+AliVZEROTriggerSimulator::AliVZEROTriggerSimulator() : 
+TObject(),fTriggerData(LoadTriggerData()),fDigitsTree(NULL),fDigits(NULL),fTriggerWord(0)
+{
+       for(int i=0;i<64;i++) {
+               fBBFlags[i] = fBGFlags[i] = kFALSE;
+               fCharges[i] = 0;
+       }
+       GenerateBBWindows();
+       GenerateBGWindows();
+       for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {
+               fBBLatch[i] = new AliVZEROLogicalSignal(fTriggerData->GetLatchWin1(i),0); 
+               fBGLatch[i] = new AliVZEROLogicalSignal(fTriggerData->GetLatchWin2(i),0); 
+               fBBReset[i] = new AliVZEROLogicalSignal(fTriggerData->GetResetWin1(i),0);
+               fBGReset[i] = new AliVZEROLogicalSignal(fTriggerData->GetResetWin2(i),0);               
+       }
+       fBBGate[0]->Print();
+       fBBGate[4]->Print();
+}
+
+//_____________________________________________________________________________
+AliVZEROTriggerSimulator::~AliVZEROTriggerSimulator(){
+       if(fBBGate) delete [] fBBGate;
+       if(fBGGate) delete [] fBGGate;
+       if(fBBLatch) delete [] fBBLatch;
+       if(fBBReset) delete [] fBBReset;
+       if(fBGLatch) delete [] fBGLatch;
+       if(fBGReset) delete [] fBGReset;
+}
+
+//_____________________________________________________________________________
+void AliVZEROTriggerSimulator::GenerateBBWindows() 
+{
+       for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {
+               AliVZEROLogicalSignal Clk1BB(fTriggerData->GetClk1Win1(i),fTriggerData->GetDelayClk1Win1(i));
+               AliVZEROLogicalSignal Clk2BB(fTriggerData->GetClk2Win1(i),fTriggerData->GetDelayClk2Win1(i));
+               fBBGate[i] = new AliVZEROLogicalSignal(Clk1BB & Clk2BB);
+       }
+}
+//_____________________________________________________________________________
+void AliVZEROTriggerSimulator::GenerateBGWindows() 
+{
+       for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {
+               AliVZEROLogicalSignal Clk1BG(fTriggerData->GetClk1Win2(i),fTriggerData->GetDelayClk1Win2(i));
+               AliVZEROLogicalSignal Clk2BG(fTriggerData->GetClk2Win2(i),fTriggerData->GetDelayClk2Win2(i));
+               fBGGate[i] = new AliVZEROLogicalSignal(Clk1BG & Clk2BG);
+       }
+}
+
+//_____________________________________________________________________________
+AliVZEROTriggerData * AliVZEROTriggerSimulator::LoadTriggerData() const 
+{
+       // Gets Trigger object for VZERO set
+       AliInfo("Loading Trigger parameters");
+       AliCDBManager *man = AliCDBManager::Instance();
+       
+       
+       AliCDBEntry *entry=0;
+       
+       entry = man->Get("VZERO/Trigger/Data");
+       if(!entry){
+               AliWarning("Load of calibration data from default storage failed!");
+               AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
+               
+               man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+               entry = man->Get("VZERO/Trigger/Data",0);
+       }
+       
+       // Retrieval of data in directory VZERO/Calib/Trigger:
+       
+       AliVZEROTriggerData *triggerData = NULL;
+       
+       if (entry) triggerData = (AliVZEROTriggerData*) entry->GetObject();
+       if (!triggerData)  AliError("No Trigger data from database !");
+       
+       return triggerData;
+}
+
+//_____________________________________________________________________________
+void AliVZEROTriggerSimulator::Run() {
+       //AliInfo("Generating VZERO Triggers");
+       
+       // Loop over VZERO entries
+       Int_t nEntries = (Int_t)fDigitsTree->GetEntries();
+       for (Int_t ievt=0; ievt<nEntries; ievt++) {
+               fDigitsTree->GetEvent(ievt);
+               
+               Int_t nDigits = fDigits->GetEntriesFast();
+               
+               for (Int_t iDigit=0; iDigit<nDigits; iDigit++) {
+                       AliVZEROdigit* digit = (AliVZEROdigit*)fDigits->At(iDigit);
+                       
+                       Int_t integrator = digit->Integrator();
+                       Int_t pmNumber   = digit->PMNumber();
+                       Int_t board   = pmNumber / 8;
+                       Int_t channel = pmNumber % 8;
+                       
+                       if(fTriggerData->GetEnableCharge(board,channel)) {
+                               fCharges[pmNumber] = digit->ADC();
+                               if(fTriggerData->GetPedestalSubtraction(board)) 
+                                       if(fCharges[pmNumber]>=fTriggerData->GetPedestalCut(integrator,board,channel)){ 
+                                               fCharges[pmNumber] -= fTriggerData->GetPedestal(integrator,board,channel);
+                                       } else {
+                                               fCharges[pmNumber] = 0;
+                                       }
+                       } else {
+                               fCharges[pmNumber] = 0;
+                       }
+                       
+                       Float_t time = (Float_t)digit->Time() / 10.; // digit->Time() in bin of 100 picoseconds. Divide by 10 to have it in nanoseconds
+                       time += fTriggerData->GetDelayHit(board,channel);
+                       
+                       AliInfo(Form(" PM nb : %d ; ADC= %d ; TDC= %f  Enable Time %d charge %d",pmNumber,digit->ADC(),time,fTriggerData->GetEnableTiming(board,channel),fTriggerData->GetEnableCharge(board,channel)));
+                       fBBFlags[pmNumber] = fTriggerData->GetEnableTiming(board,channel) && fBBGate[board]->IsInCoincidence(time);
+                       fBGFlags[pmNumber] = fTriggerData->GetEnableTiming(board,channel) && fBGGate[board]->IsInCoincidence(time);
+                       
+               } // end of loop over digits
+       } // end of loop over events in digits tree
+       
+       Int_t nBBflagsV0A = 0;
+       Int_t nBBflagsV0C = 0;
+       Int_t nBGflagsV0A = 0;
+       Int_t nBGflagsV0C = 0;
+       Int_t chargeV0A   = 0;
+       Int_t chargeV0C   = 0;
+
+       for(int i=0;i<64;i++) {
+               if(i<32) {
+                       nBBflagsV0C += fBBFlags[i]; 
+                       nBGflagsV0C += fBGFlags[i];
+                       chargeV0C += fCharges[i];
+               } else {
+                       nBBflagsV0A += fBBFlags[i]; 
+                       nBGflagsV0A += fBGFlags[i];
+                       chargeV0A += fCharges[i];
+               }
+               //AliInfo(Form("Ch %d BB=%d BG=%d",i,fBBFlags[i],fBGFlags[i] )); 
+       }
+       
+       // BBA
+       if(nBBflagsV0A>=fTriggerData->GetBBAThreshold())  SetBBA();
+       
+       // BBC
+       if(nBBflagsV0C>=fTriggerData->GetBBCThreshold())  SetBBC();
+
+       // BBA_AND_BBC
+       if(GetBBA() && GetBBC())  SetBBAandBBC();
+       
+       // BBA_OR_BBC
+       if(GetBBA() || GetBBC()) SetBBAorBBC();
+
+       // BGA
+       if(nBGflagsV0A>=fTriggerData->GetBGAThreshold()) SetBGA();
+
+       // BGC
+       if(nBGflagsV0C>=fTriggerData->GetBGCThreshold()) SetBGC();
+       
+       // BGA_AND_BBC (Beam Gas from RB24 side)
+       if(nBBflagsV0C>=fTriggerData->GetBBCForBGThreshold() && GetBGA()) SetBGAandBBC();
+       
+       // BGC_AND_BBA (Beam Gas from RB26 side)
+       if(nBBflagsV0A>=fTriggerData->GetBBAForBGThreshold() && GetBGC()) SetBGCandBBA();
+
+       // CTA1_AND_CTC1 (Centrality trigger 1)
+       if(chargeV0A>=fTriggerData->GetCentralityV0AThrLow() && chargeV0C>=fTriggerData->GetCentralityV0CThrLow()) SetCTA1andCTC1();
+
+       // CTA1_OR_CTC1 (Centrality trigger 1)
+       if(chargeV0A>=fTriggerData->GetCentralityV0AThrLow() || chargeV0C>=fTriggerData->GetCentralityV0CThrLow()) SetCTA1orCTC1();
+       
+       // CTA2_AND_CTC2 (Centrality trigger 2)
+       if(chargeV0A>=fTriggerData->GetCentralityV0AThrHigh() && chargeV0C>=fTriggerData->GetCentralityV0CThrHigh()) SetCTA2andCTC2();
+       
+       // CTA2_OR_CTC2 (Centrality trigger 2)
+       if(chargeV0A>=fTriggerData->GetCentralityV0AThrHigh() || chargeV0C>=fTriggerData->GetCentralityV0CThrHigh()) SetCTA2orCTC2();
+       
+       // MTA_AND_MTC (Multiplicity Trigger)
+       if((nBBflagsV0A<=fTriggerData->GetMultV0AThrHigh() && nBBflagsV0A>=fTriggerData->GetMultV0AThrLow())
+          && (nBBflagsV0C<=fTriggerData->GetMultV0CThrHigh() && nBBflagsV0C>=fTriggerData->GetMultV0CThrLow()) ) 
+               SetMTAandMTC();
+       
+       // MTA_OR_MTC (Multiplicity Trigger)
+       if((nBBflagsV0A<=fTriggerData->GetMultV0AThrHigh() && nBBflagsV0A>=fTriggerData->GetMultV0AThrLow())
+          || (nBBflagsV0C<=fTriggerData->GetMultV0CThrHigh() && nBBflagsV0C>=fTriggerData->GetMultV0CThrLow()) ) 
+               SetMTAorMTC();
+       
+       // BGA_OR_BGC
+       if(GetBGA() || GetBGC()) SetBGAorBGC();
+       
+       // (BGA and BBC) or (BGC and BBA) (Beam Gas from one of the two sides)
+       if(GetBGAandBBC() || GetBGCandBBA()) SetBeamGas();
+
+       AliInfo(Form("BB Flags : V0A = %d  V0C = %d ",nBBflagsV0A, nBBflagsV0C )); 
+       AliInfo(Form("BG Flags : V0A = %d  V0C = %d ",nBGflagsV0A, nBGflagsV0C )); 
+       AliInfo(Form("Charges  : V0A = %d  V0C = %d ",chargeV0A, chargeV0C )); 
+       
+}
diff --git a/VZERO/AliVZEROTriggerSimulator.h b/VZERO/AliVZEROTriggerSimulator.h
new file mode 100644 (file)
index 0000000..ebdf369
--- /dev/null
@@ -0,0 +1,94 @@
+#ifndef ALIVZEROTRIGGERSIMULATOR_H
+#define ALIVZEROTRIGGERSIMULATOR_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved. 
+ *
+ * See cxx source for full Copyright notice                               
+ */
+
+#include <TObject.h>
+
+#include "AliVZEROTriggerData.h";
+
+class AliVZEROLogicalSignal;
+class TTree;
+class TClonesArray;
+
+class AliVZEROTriggerSimulator : public TObject {
+public:
+       AliVZEROTriggerSimulator();
+       AliVZEROTriggerSimulator(TTree * digitsTree, TClonesArray* digits);
+       ~AliVZEROTriggerSimulator();
+       AliVZEROTriggerSimulator(const AliVZEROTriggerSimulator &triggerSim);
+       AliVZEROTriggerSimulator& operator= (const AliVZEROTriggerSimulator &triggerSim);
+       
+       AliVZEROTriggerData * GetTriggerData() const {return fTriggerData;};
+       
+       Bool_t GetBBAandBBC() const             {return (fTriggerWord & 0x1);};
+       Bool_t GetBBAorBBC() const              {return (fTriggerWord>>1 & 0x1);};
+       Bool_t GetBGAandBBC() const             {return (fTriggerWord>>2 & 0x1);};
+       Bool_t GetBGA() const                   {return (fTriggerWord>>3 & 0x1);};
+       Bool_t GetBGCandBBA() const             {return (fTriggerWord>>4 & 0x1);};
+       Bool_t GetBGC() const                   {return (fTriggerWord>>5 & 0x1);};
+       Bool_t GetCTA1andCTC1() const   {return (fTriggerWord>>6 & 0x1);};
+       Bool_t GetCTA1orCTC1() const    {return (fTriggerWord>>7 & 0x1);};
+       Bool_t GetCTA2andCTC2() const   {return (fTriggerWord>>8 & 0x1);};
+       Bool_t GetCTA2orCTC2() const    {return (fTriggerWord>>9 & 0x1);};
+       Bool_t GetMTAandMTC() const             {return (fTriggerWord>>10 & 0x1);};
+       Bool_t GetMTAorMTC() const              {return (fTriggerWord>>11 & 0x1);};
+       Bool_t GetBBA() const                   {return (fTriggerWord>>12 & 0x1);};
+       Bool_t GetBBC() const                   {return (fTriggerWord>>13 & 0x1);};
+       Bool_t GetBGAorBGC() const              {return (fTriggerWord>>14 & 0x1);};
+       Bool_t GetBeamGas() const               {return (fTriggerWord>>15 & 0x1);};
+       
+       void SetBBAandBBC()             { (fTriggerWord += 0x1);};
+       void SetBBAorBBC()              { (fTriggerWord += 0x1<<1);};
+       void SetBGAandBBC()             { (fTriggerWord += 0x1<<2);};
+       void SetBGA()                   { (fTriggerWord += 0x1<<3);};
+       void SetBGCandBBA()             { (fTriggerWord += 0x1<<4);};
+       void SetBGC()                   { (fTriggerWord += 0x1<<5);};
+       void SetCTA1andCTC1()   { (fTriggerWord += 0x1<<6);};
+       void SetCTA1orCTC1()    { (fTriggerWord += 0x1<<7);};
+       void SetCTA2andCTC2()   { (fTriggerWord += 0x1<<8);};
+       void SetCTA2orCTC2()    { (fTriggerWord += 0x1<<9);};
+       void SetMTAandMTC()             { (fTriggerWord += 0x1<<10);};
+       void SetMTAorMTC()              { (fTriggerWord += 0x1<<11);};  
+       void SetBBA()                   { (fTriggerWord += 0x1<<12);};
+       void SetBBC()                   { (fTriggerWord += 0x1<<13);};
+       void SetBGAorBGC()              { (fTriggerWord += 0x1<<14);};
+       void SetBeamGas()               { (fTriggerWord += 0x1<<15);};
+       
+       void Run();
+       
+private:
+       // Private methods
+       AliVZEROTriggerData * LoadTriggerData() const ;
+       void GenerateBBWindows();
+       void GenerateBGWindows();
+       
+       // Members
+       AliVZEROLogicalSignal * fBBGate[AliVZEROTriggerData::kNCIUBoards];
+       AliVZEROLogicalSignal * fBBLatch[AliVZEROTriggerData::kNCIUBoards];
+       AliVZEROLogicalSignal * fBBReset[AliVZEROTriggerData::kNCIUBoards];
+       
+       AliVZEROLogicalSignal * fBGGate[AliVZEROTriggerData::kNCIUBoards];
+       AliVZEROLogicalSignal * fBGLatch[AliVZEROTriggerData::kNCIUBoards];
+       AliVZEROLogicalSignal * fBGReset[AliVZEROTriggerData::kNCIUBoards];
+
+       AliVZEROTriggerData *fTriggerData; // Object holding the trigger configuration parameters
+       
+       TTree* fDigitsTree;
+       TClonesArray* fDigits;
+       
+       Bool_t fBBFlags[64];
+       Bool_t fBGFlags[64];
+       Int_t  fCharges[64];
+       
+       UShort_t fTriggerWord;
+               
+       ClassDef( AliVZEROTriggerSimulator, 1 )  
+
+};
+
+
+#endif // ALIVZEROTRIGGERSIMULATOR_H