Updated calibration object to use by triggger simulator and simulator itself
authormbroz <Michal.Broz@cern.ch>
Wed, 21 Jan 2015 10:59:55 +0000 (11:59 +0100)
committermbroz <Michal.Broz@cern.ch>
Wed, 21 Jan 2015 10:59:55 +0000 (11:59 +0100)
16 files changed:
AD/ADbase/ADbaseLinkDef.h
AD/ADbase/AliADCalibData.cxx
AD/ADbase/AliADCalibData.h
AD/ADbase/AliADDataDCS.cxx
AD/ADbase/AliADDataDCS.h
AD/ADbase/AliADdigit.h
AD/ADrec/AliADTrigger.cxx
AD/ADrec/CMakeLists.txt
AD/ADsim/ADsimLinkDef.h
AD/ADsim/AliADLogicalSignal.cxx [new file with mode: 0644]
AD/ADsim/AliADLogicalSignal.h [new file with mode: 0644]
AD/ADsim/AliADTriggerSimulator.cxx [new file with mode: 0644]
AD/ADsim/AliADTriggerSimulator.h [new file with mode: 0644]
AD/ADsim/CMakeLists.txt
AD/macros/ADTestPreprocessor.C
AD/macros/DCSValues.txt

index d133a09..ca39d55 100644 (file)
 #pragma link C++ class  AliADCalibData+;
 #pragma link C++ class  AliADPreprocessor+;
 #pragma link C++ class  AliADDataDCS+;
-//#pragma link C++ class  AliADQAChecker+;
 //#pragma link C++ class  AliADMisAligner+;
-//#pragma link C++ class  AliADLogicalSignal+;
-//#pragma link C++ class  AliADTrending+;
-//#pragma link C++ class  AliADDataFEE+;
-//#pragma link C++ class  AliADTriggerSimulator+;
-//#pragma link C++ class  AliADTriggerData+;
 
 #endif
index a77d2ba..76802b8 100644 (file)
@@ -43,10 +43,10 @@ AliADCalibData::AliADCalibData():
   fBGCThreshold(0) ,  
   fBBAForBGThreshold(0) ,  
   fBBCForBGThreshold(0) ,   
-  fMultV0AThrLow(0) ,  
-  fMultV0AThrHigh(0) , 
-  fMultV0CThrLow(0) ,  
-  fMultV0CThrHigh(0)
+  fMultADAThrLow(0) ,  
+  fMultADAThrHigh(0) , 
+  fMultADCThrLow(0) ,  
+  fMultADCThrHigh(0)
 {
   // default constructor
   
@@ -106,10 +106,10 @@ AliADCalibData::AliADCalibData(const char* name) :
   fBGCThreshold(0) ,  
   fBBAForBGThreshold(0) ,  
   fBBCForBGThreshold(0) ,   
-  fMultV0AThrLow(0) ,  
-  fMultV0AThrHigh(0) , 
-  fMultV0CThrLow(0) ,  
-  fMultV0CThrHigh(0)
+  fMultADAThrLow(0) ,  
+  fMultADAThrHigh(0) , 
+  fMultADCThrLow(0) ,  
+  fMultADCThrHigh(0)
 {
   // Constructor
    TString namst = "Calib_";
@@ -411,10 +411,10 @@ void AliADCalibData::SetParameter(TString name, Int_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("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("MultADAThrLow")) SetMultADAThrLow((UShort_t) val);
+       else if(name.Contains("MultADAThrHigh")) SetMultADAThrHigh((UShort_t) val);
+       else if(name.Contains("MultADCThrLow")) SetMultADCThrLow((UShort_t) val);
+       else if(name.Contains("MultADCThrHigh")) SetMultADCThrHigh((UShort_t) val);
        else if(name.Contains("TriggerSelect")) SetTriggerSelected((UShort_t) val, iChannel-1 );
        else if(name.Contains("EnableCharge")) SetEnableCharge((Bool_t) val, iBoard , iChannel-1);
        else if(name.Contains("EnableTiming")) SetEnableTiming((Bool_t) val, iBoard , iChannel-1);
index ad41006..773dc43 100644 (file)
@@ -104,11 +104,11 @@ class AliADCalibData: public TNamed {
   UShort_t GetBBAForBGThreshold() const {return fBBAForBGThreshold;};
   UShort_t GetBBCForBGThreshold() const {return fBBCForBGThreshold;};
   
-  UShort_t GetMultV0AThrLow() const {return fMultV0AThrLow;};
-  UShort_t GetMultV0AThrHigh() const {return fMultV0AThrHigh;};
+  UShort_t GetMultADAThrLow() const {return fMultADAThrLow;};
+  UShort_t GetMultADAThrHigh() const {return fMultADAThrHigh;};
 
-  UShort_t GetMultV0CThrLow() const {return fMultV0CThrLow;};
-  UShort_t GetMultV0CThrHigh() const {return fMultV0CThrHigh;};
+  UShort_t GetMultADCThrLow() const {return fMultADCThrLow;};
+  UShort_t GetMultADCThrHigh() const {return fMultADCThrHigh;};
 
   UShort_t GetTriggerSelected(Int_t output) const {return ((output>=0 && output<5)?fTriggerSelected[output]:0);};
   
@@ -208,11 +208,11 @@ class AliADCalibData: public TNamed {
   void SetBBCForBGThreshold(UShort_t th) {fBBCForBGThreshold = th;};
   
   
-  void SetMultV0AThrLow(UShort_t th) {fMultV0AThrLow = th;};
-  void SetMultV0AThrHigh(UShort_t th) {fMultV0AThrHigh = th;};
+  void SetMultADAThrLow(UShort_t th) {fMultADAThrLow = th;};
+  void SetMultADAThrHigh(UShort_t th) {fMultADAThrHigh = th;};
   
-  void SetMultV0CThrLow(UShort_t th) {fMultV0CThrLow = th;};
-  void SetMultV0CThrHigh(UShort_t th) {fMultV0CThrHigh = th;};
+  void SetMultADCThrLow(UShort_t th) {fMultADCThrLow = th;};
+  void SetMultADCThrHigh(UShort_t th) {fMultADCThrHigh = th;};
   
   void SetTriggerSelected(UShort_t trigger, Int_t output);
   
@@ -267,10 +267,10 @@ class AliADCalibData: public TNamed {
   UShort_t fBGCThreshold;  // Beam Gas Threshold in number of channel hit for ADC
   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 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 fMultADAThrLow;  // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fMultADAThrHigh; // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fMultADCThrLow;  // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fMultADCThrHigh; // Threshold used for multiplicity triggers (i.e. MTA and MTC)
   UShort_t fTriggerSelected[5]; // Triggers selected on the 5 outputs to CTP
   Bool_t   fEnableCharge[16]; // Flag to know is a channel is participating to the Charge triggers
   Bool_t   fEnableTiming[16]; // Flag to know is a channel is participating to the Timing triggers
index 742aa0f..89b6132 100644 (file)
@@ -200,6 +200,48 @@ void AliADDataDCS::Init(){
                fHv[iAlias]->GetXaxis()->SetTitle("Hv");
                iAlias++;
   }
+  // CCIU Parameters
+       
+  fAliasNames[iAlias++] = "AD0/FEE/CCIU/BBAThreshold";
+  fAliasNames[iAlias++] = "AD0/FEE/CCIU/BBCThreshold";
+  fAliasNames[iAlias++] = "AD0/FEE/CCIU/BGAThreshold";
+  fAliasNames[iAlias++] = "AD0/FEE/CCIU/BGCThreshold";
+  fAliasNames[iAlias++] = "AD0/FEE/CCIU/BBAForBGThreshold";
+  fAliasNames[iAlias++] = "AD0/FEE/CCIU/BBCForBGThreshold";
+  fAliasNames[iAlias++] = "AD0/FEE/CCIU/MultADAThrLow";
+  fAliasNames[iAlias++] = "AD0/FEE/CCIU/MultADAThrHigh";
+  fAliasNames[iAlias++] = "AD0/FEE/CCIU/MultADCThrLow";
+  fAliasNames[iAlias++] = "AD0/FEE/CCIU/MultADCThrHigh";
+  for(int i=1;i<=5;i++) {
+       fAliasNames[iAlias] = "AD0/FEE/CCIU/TriggerSelect";
+       fAliasNames[iAlias++] += Form("%d",i);
+  }
+  //Trigger parameters
+  for(int iCIU = 0; iCIU<2 ; iCIU++){
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/Clk1Win1",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/Clk1Win2",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/Clk2Win1",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/Clk2Win2",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/DelayClk1Win1",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/DelayClk1Win2",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/DelayClk2Win1",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/DelayClk2Win2",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/LatchWin1",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/LatchWin2",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/ResetWin1",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/ResetWin2",iCIU);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/PedestalSubtraction",iCIU);
+  }
+  for(int iCIU = 0; iCIU<2 ; iCIU++){
+         for(int iCh=1;iCh<=8;iCh++){
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/EnableCharge%d",iCIU,iCh);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/EnableTiming%d",iCIU,iCh);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/PedEven%d",iCIU,iCh);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/PedOdd%d",iCIU,iCh);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/PedCutEven%d",iCIU,iCh);
+               fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/PedCutOdd%d",iCIU,iCh);
+         }
+  }
  // Time Resolution Parameters 
   for(int iCIU = 0; iCIU<2 ; iCIU++){
                fAliasNames[iAlias++] = Form("AD0/FEE/CIU%d/TimeResolution",iCIU);
index 6cedab4..fe5fa10 100644 (file)
@@ -20,7 +20,7 @@ class TH1F;
 
 class AliADDataDCS : public TObject {
 public:
-  enum {kNAliases=60,kNGraphs=16,kNHvChannel=16,kNLvChannel=4,kNCIUBoards = 2};
+  enum {kNAliases=197,kNGraphs=16,kNHvChannel=16,kNLvChannel=4,kNCIUBoards = 2};
   enum {kHvMin=0, kHvMax=3000};
   
   AliADDataDCS();
@@ -80,7 +80,7 @@ private:
   Float_t fMeanHV[kNHvChannel];            // High Voltage mean values
   Float_t fWidthHV[kNHvChannel];           // High Voltage widths
   Bool_t  fDeadChannel[kNHvChannel];       // Dead Map 
-  TMap * fFEEParameters;  // TMap holding the FEE parameters of Time Resolution
+  TMap * fFEEParameters;  // TMap holding the FEE parameters
     
   Bool_t fIsProcessed;                   // bool to know processing status
   
index e2debed..9c37a68 100644 (file)
@@ -32,6 +32,8 @@ public:
     Bool_t  GetIntegratorFlag(Int_t clock);
     Bool_t  GetBBflag()  const {return fBBflag;}
     Bool_t  GetBGflag()  const {return fBGflag;}
+    void    SetBBflag(Bool_t bbFlag) {fBBflag = bbFlag;}
+    void    SetBGflag(Bool_t bgFlag) {fBGflag = bgFlag;}
     
   protected:
     Int_t   fPMNumber;      // PhotoMultiplier number (0 to 16)
index e10b293..3677ea5 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "AliADdigit.h"
 #include "AliADTrigger.h"
+#include "AliADTriggerSimulator.h"
 
 //______________________________________________________________________
 ClassImp(AliADTrigger)
@@ -50,10 +51,22 @@ void AliADTrigger::CreateInputs()
    // Do not create inputs again!!
    if( fInputs.GetEntriesFast() > 0 ) return;
 
-   fInputs.AddLast( new AliTriggerInput( "AD_ADA", "AD", 0 ) );
-   fInputs.AddLast( new AliTriggerInput( "AD_ADD","AD", 0 ) );
-   fInputs.AddLast( new AliTriggerInput( "AD_ADA2", "AD", 0 ) );
-   fInputs.AddLast( new AliTriggerInput( "AD_ADD2","AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_BBA_AND_BBC", "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_BBA_OR_BBC","AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_BGA_AND_BBC",  "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "0AGA",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_BGC_AND_BBA", "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "0AGC",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_CTA1_AND_CTC1",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_CTA1_OR_CTC1",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_CTA2_AND_CTC2",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_CTA2_OR_CTC2",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_MTA_AND_MTC",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_MTA_OR_MTC",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "0ADA",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "0ADC",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_BGA_OR_BGC",   "AD", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "AD_BEAMGAS",   "AD", 0 ) );
 }
 
 //______________________________________________________________________
@@ -69,25 +82,38 @@ void AliADTrigger::Trigger()
       return;
    }
    loader->LoadDigits("update");
-   TTree* vzeroDigitsTree = loader->TreeD();
+   TTree* ADDigitsTree = loader->TreeD();
 
-   if (!vzeroDigitsTree) {
+   if (!ADDigitsTree) {
       AliError("Can not get the AD digit tree");
       return;
    }
-   TClonesArray* vzeroDigits = NULL;
-   TBranch* digitBranch = vzeroDigitsTree->GetBranch("ADDigit");
-   digitBranch->SetAddress(&vzeroDigits);
-   
-   // Check trigger contitions
-   // .... Ex. number of digit over threshold
-   //
+   TClonesArray* ADDigits = NULL;
+   TBranch* digitBranch = ADDigitsTree->GetBranch("ADDigit");
+   digitBranch->SetAddress(&ADDigits);
    
+   AliADTriggerSimulator * triggerSimulator = new AliADTriggerSimulator(ADDigitsTree,ADDigits);
+   triggerSimulator->Run();
+       
+   loader->WriteDigits("OVERWRITE");  
    loader->UnloadDigits();     
 
-
-   //   if(  )  SetInput( "AD_ADA" );
-   //   if(  )  SetInput( "AD_ADD" );
+   if(triggerSimulator->GetBBAandBBC())   SetInput( "AD_BBA_AND_BBC" );
+   if(triggerSimulator->GetBBAorBBC())      SetInput( "AD_BBA_OR_BBC" );
+   if(triggerSimulator->GetBGAandBBC())   SetInput( "AD_BGA_AND_BBC" );
+   if(triggerSimulator->GetBGA())         SetInput( "0AGA" );
+   if(triggerSimulator->GetBGCandBBA())   SetInput( "AD_BGC_AND_BBA" );
+   if(triggerSimulator->GetBGC())         SetInput( "0AGC" );
+   if(triggerSimulator->GetCTA1andCTC1())   SetInput( "AD_CTA1_AND_CTC1" );
+   if(triggerSimulator->GetCTA1orCTC1())   SetInput( "AD_CTA1_OR_CTC1" );
+   if(triggerSimulator->GetCTA2andCTC2())   SetInput( "AD_CTA2_AND_CTC2" );
+   if(triggerSimulator->GetCTA1orCTC1())   SetInput( "AD_CTA1_OR_CTC1" );
+   if(triggerSimulator->GetMTAandMTC())   SetInput( "AD_MTA_AND_MTC" );
+   if(triggerSimulator->GetMTAorMTC())      SetInput( "AD_MTA_OR_MTC" );
+   if(triggerSimulator->GetBBA())         SetInput( "0ABA" );
+   if(triggerSimulator->GetBBC())         SetInput( "0ABC" );
+   if(triggerSimulator->GetBGAorBGC())      SetInput( "AD_BGA_OR_BGC" );
+   if(triggerSimulator->GetBeamGas())      SetInput( "AD_BEAMGAS" );
 
   return;
 }
index 5908014..1af5333 100644 (file)
@@ -21,6 +21,7 @@ include_directories(${AliRoot_SOURCE_DIR}/AD/${MODULE})
 
 # Additional include folders in alphabetical order except ROOT
 include_directories(${AliRoot_SOURCE_DIR}/AD/ADbase
+                   ${AliRoot_SOURCE_DIR}/AD/ADsim
                     ${AliRoot_SOURCE_DIR}/RAW/dateStream
                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatarec
index 43b07f8..d84050f 100644 (file)
@@ -12,5 +12,7 @@
 #pragma link C++ class  AliADDigitizer+;
 #pragma link C++ class  AliADQADataMakerSim+;
 #pragma link C++ class  AliADBuffer+;
+#pragma link C++ class  AliADLogicalSignal+;
+#pragma link C++ class  AliADTriggerSimulator+;
 
 #endif
diff --git a/AD/ADsim/AliADLogicalSignal.cxx b/AD/ADsim/AliADLogicalSignal.cxx
new file mode 100644 (file)
index 0000000..9478c74
--- /dev/null
@@ -0,0 +1,125 @@
+/**************************************************************************
+ * 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 AliADLogicalSignal
+// ---------------------------
+// Describes a logical signal in the electronics. 
+// Use it to generate observation windows
+// which are used by AliADTriggerSimulator class
+// 
+
+#include "AliLog.h"
+#include "AliADLogicalSignal.h"
+
+ClassImp(AliADLogicalSignal)
+
+//_____________________________________________________________________________
+AliADLogicalSignal::AliADLogicalSignal() : TObject(), fStart(0.), fStop(0.)
+{
+       // Default constructor
+}
+//_____________________________________________________________________________
+AliADLogicalSignal::AliADLogicalSignal(UShort_t profilClock, UInt_t delay) : TObject(), fStart(0.), fStop(0.)
+{
+       // Constructor using the profilClock and delay parameters comming from the FEE
+       
+       Bool_t word;
+       Bool_t up=kFALSE;
+       Bool_t down=kFALSE;
+       
+       for(int i=0 ; i<5 ; i++) {
+               Int_t shift = (i<4) ? (3-i) : 4;
+               word = (profilClock >> shift) & 0x1;
+               if(word&&!up) {
+                       fStart = 5. * (i + 1);
+                       up = kTRUE;
+               }
+               if(!word&&up&&!down) {
+                       fStop = 5. * (i + 1);
+                       down = kTRUE;
+               }               
+       }
+       if(!down) fStop = 30.;
+       
+       fStart += delay*1e-2; // Add 10 ps par register unit
+       fStop  += delay*1e-2; 
+}
+//_____________________________________________________________________________
+AliADLogicalSignal::AliADLogicalSignal(const AliADLogicalSignal &signal) : 
+       TObject(), fStart(signal.fStart), 
+       fStop(signal.fStop)
+{
+       // Copy constructor
+}
+
+//_____________________________________________________________________________
+AliADLogicalSignal::~AliADLogicalSignal(){
+       // Destructor
+}
+
+//_____________________________________________________________________________
+AliADLogicalSignal& AliADLogicalSignal::operator = 
+(const AliADLogicalSignal& signal)
+{
+       // Operator =
+        if(&signal == this) return *this;
+       fStart = signal.fStart;
+       fStop  = signal.fStop;
+       return *this;
+}
+
+//_____________________________________________________________________________
+AliADLogicalSignal AliADLogicalSignal::operator|(const AliADLogicalSignal& 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));
+       
+       AliADLogicalSignal 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;
+}
+//_____________________________________________________________________________
+AliADLogicalSignal AliADLogicalSignal::operator&(const AliADLogicalSignal& 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));
+       
+       AliADLogicalSignal 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 AliADLogicalSignal::IsInCoincidence(Float_t time) const
+{
+       // Check if a signal arriving at the time "time" is in coincidence with the logical signal
+       Bool_t result = kFALSE;
+       if((time>fStart) && (time<fStop)) result = kTRUE;
+       return result;
+}
+
diff --git a/AD/ADsim/AliADLogicalSignal.h b/AD/ADsim/AliADLogicalSignal.h
new file mode 100644 (file)
index 0000000..528b867
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef ALIADLOGICALSIGNAL_H
+#define ALIADLOGICALSIGNAL_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved. 
+ *
+ * See cxx source for full Copyright notice                               
+ */
+
+
+// 
+// Class AliADLogicalSignal
+// ---------------------------
+// Describes a logical signal in the electronics. 
+// Use it to generate observation windows
+// which are used by AliADTriggerSimulator class
+// 
+
+
+#include <TObject.h>
+#include <AliLog.h>
+
+class AliADLogicalSignal  : public TObject {
+public:
+       AliADLogicalSignal();
+       AliADLogicalSignal(UShort_t profilClock, UInt_t delay);
+       virtual ~AliADLogicalSignal();
+       AliADLogicalSignal(const AliADLogicalSignal &signal);
+       AliADLogicalSignal& operator= (const AliADLogicalSignal &signal);
+       AliADLogicalSignal operator& (const AliADLogicalSignal &signal) const;
+       AliADLogicalSignal operator| (const AliADLogicalSignal &signal) const;
+       // Print method
+       virtual void Print(Option_t* opt="") const { AliInfo(Form("\t%s -> Start %f Stop %f\n ",opt,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){fStart = time;};
+       void SetStopTime(Float_t time){fStop = time;};
+       
+       Bool_t IsInCoincidence(Float_t time) const;
+       
+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( AliADLogicalSignal, 1 )  
+       
+};
+
+#endif // ALIADLOGICALSIGNAL_H
+
+
diff --git a/AD/ADsim/AliADTriggerSimulator.cxx b/AD/ADsim/AliADTriggerSimulator.cxx
new file mode 100644 (file)
index 0000000..6832db8
--- /dev/null
@@ -0,0 +1,359 @@
+/**************************************************************************
+ * 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 AliADTriggerSimulator
+// ------------------------------
+//  Simulate the AD Trigger response
+// Use FEE parameters stored in Database
+// Can work on real data or in simulation
+//
+
+#include <TTree.h>
+#include <TClonesArray.h>
+#include <TParameter.h>
+
+#include "AliLog.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliCDBStorage.h"
+#include "AliCDBId.h"
+#include "AliADCalibData.h"
+#include "AliADLogicalSignal.h"
+#include "AliADTriggerSimulator.h"
+#include "AliADdigit.h"
+#include "AliADConst.h"
+#include "AliCTPTimeParams.h"
+
+ClassImp(AliADTriggerSimulator)
+
+//_____________________________________________________________________________
+AliADTriggerSimulator::AliADTriggerSimulator(TTree * digitsTree, TClonesArray* digits) : 
+TObject(),fCalibData(NULL),fDigitsTree(digitsTree),fDigits(digits),fTriggerWord(0)
+{
+       // constructor
+       fCalibData = LoadCalibData();
+       LoadClockOffset();
+       
+       for(int i=0;i<16;i++) {
+               fBBFlags[i] = fBGFlags[i] = kFALSE;
+               fCharges[i] = 0.;
+       }
+       GenerateBBWindows();
+       GenerateBGWindows();
+       for (int i=0; i<kNCIUBoards; i++) {
+               fBBLatch[i] = new AliADLogicalSignal(fCalibData->GetLatchWin1(i),0); 
+               fBGLatch[i] = new AliADLogicalSignal(fCalibData->GetLatchWin2(i),0); 
+               fBBReset[i] = new AliADLogicalSignal(fCalibData->GetResetWin1(i),0);
+               fBGReset[i] = new AliADLogicalSignal(fCalibData->GetResetWin2(i),0);            
+       }
+}
+//_____________________________________________________________________________
+AliADTriggerSimulator::AliADTriggerSimulator() : 
+TObject(),fCalibData(NULL),fDigitsTree(NULL),fDigits(NULL),fTriggerWord(0)
+{
+       // Default constructor
+       fCalibData = LoadCalibData();
+       LoadClockOffset();
+
+       for(int i=0;i<16;i++) {
+               fBBFlags[i] = fBGFlags[i] = kFALSE;
+               fCharges[i] = 0;
+       }
+       GenerateBBWindows();
+       GenerateBGWindows();
+       for (int i=0; i<kNCIUBoards; i++) {
+               fBBLatch[i] = new AliADLogicalSignal(fCalibData->GetLatchWin1(i),0); 
+               fBGLatch[i] = new AliADLogicalSignal(fCalibData->GetLatchWin2(i),0); 
+               fBBReset[i] = new AliADLogicalSignal(fCalibData->GetResetWin1(i),0);
+               fBGReset[i] = new AliADLogicalSignal(fCalibData->GetResetWin2(i),0);            
+       }
+}
+
+//_____________________________________________________________________________
+AliADTriggerSimulator::~AliADTriggerSimulator(){
+// Destructor
+  for (Int_t i=0; i<kNCIUBoards; i++) {
+    delete fBBGate[i];
+    delete fBGGate[i];
+    delete fBBLatch[i];
+    delete fBBReset[i];
+    delete fBGLatch[i];
+    delete fBGReset[i];
+  }
+}
+
+//_____________________________________________________________________________
+void AliADTriggerSimulator::GenerateBBWindows() 
+{
+  // Generates the BB observation window
+  // In case gates are open the windows are equal to 25ns
+  if (AreGatesOpen()) {
+       for (int i=0; i<kNCIUBoards; i++) {
+               fBBGate[i] = new AliADLogicalSignal();
+               fBBGate[i]->SetStartTime(0.);
+               fBBGate[i]->SetStopTime(25.0);
+       }    
+  }
+  else {
+       for (int i=0; i<kNCIUBoards; i++) {
+               AliADLogicalSignal clk1BB(fCalibData->GetClk1Win1(i),fCalibData->GetDelayClk1Win1(i));
+               AliADLogicalSignal clk2BB(fCalibData->GetClk2Win1(i),fCalibData->GetDelayClk2Win1(i));
+               fBBGate[i] = new AliADLogicalSignal(clk1BB & clk2BB);
+       }
+  }
+}
+//_____________________________________________________________________________
+void AliADTriggerSimulator::GenerateBGWindows() 
+{
+  // Generates the BG observation window
+  // In case gates are open the windows are equal to 25ns
+  if (AreGatesOpen()) {
+       for (int i=0; i<kNCIUBoards; i++) {
+               fBGGate[i] = new AliADLogicalSignal();
+               fBGGate[i]->SetStartTime(0.);
+               fBGGate[i]->SetStopTime(25.0);
+       }    
+  }
+  else {
+       for (int i=0; i<kNCIUBoards; i++) {
+               AliADLogicalSignal clk1BG(fCalibData->GetClk1Win2(i),fCalibData->GetDelayClk1Win2(i));
+               AliADLogicalSignal clk2BG(fCalibData->GetClk2Win2(i),fCalibData->GetDelayClk2Win2(i));
+               fBGGate[i] = new AliADLogicalSignal(clk1BG & clk2BG);
+               // In AD-A we have a shift by -25ns which is controlled by
+               // 'Delay Win2' = 7 instead of default 6.
+               // The flag is not stored in OCDB so we have manually shift the
+               // trigger windows
+               if (i < 4) {
+                 fBGGate[i]->SetStartTime(fBGGate[i]->GetStartTime()-25.0);
+                 fBGGate[i]->SetStopTime(fBGGate[i]->GetStopTime()-25.0);
+               }
+       }
+  }
+}
+
+//_____________________________________________________________________________
+AliADCalibData * AliADTriggerSimulator::LoadCalibData() const 
+{
+       // Gets Trigger object for AD set
+        AliDebug(1,"Loading Trigger parameters");
+       AliCDBManager *man = AliCDBManager::Instance();
+       
+       
+       AliCDBEntry *entry=0;
+       
+       entry = man->Get("AD/Calib/Data");
+       if(!entry){
+               AliFatal("Load of calibration data from default storage failed!");
+               return NULL;
+       }
+       
+       AliADCalibData *calibData = NULL;
+       
+       if (entry) calibData = (AliADCalibData*) entry->GetObject();
+       if (!calibData)  AliError("No Trigger data from database !");
+       
+       return calibData;
+}
+
+
+//_____________________________________________________________________________
+void AliADTriggerSimulator::LoadClockOffset()
+{
+  // This method is used in order to
+  // retrieve the TDC clock offset including
+  // roll-over, trig count and CTP L0->L1 delay
+
+  AliCDBEntry *entry0 = AliCDBManager::Instance()->Get("AD/Calib/Data");
+  if (!entry0) {
+    AliFatal("AD Calib object is not found in OCDB !");
+    return;
+  }
+  AliADCalibData *calibdata = (AliADCalibData*) entry0->GetObject();
+
+  AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
+  if (!entry) {
+    AliFatal("CTP timing parameters are not found in OCDB !");
+    return;
+  }
+  AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
+  Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
+
+  AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
+  if (!entry1) {
+    AliFatal("CTP time-alignment is not found in OCDB !");
+    return;
+  }
+  AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
+  l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
+
+  for(Int_t board = 0; board < kNCIUBoards; ++board) {
+    fClockOffset[board] = (((Float_t)calibdata->GetRollOver(board)-
+                           (Float_t)calibdata->GetTriggerCountOffset(board))*25.0-
+                          l1Delay+
+                          kV0Offset);
+    AliDebug(1,Form("Board %d Offset %f",board,fClockOffset[board]));
+  }
+}
+
+//_____________________________________________________________________________
+void AliADTriggerSimulator::Run() {
+       //AliInfo("Generating AD Triggers");
+       
+       // Loop over AD 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++) {
+                       AliADdigit* digit = (AliADdigit*)fDigits->At(iDigit);
+                       
+                       Int_t integrator = digit->Integrator();
+                       Int_t pmNumber   = digit->PMNumber();
+                       Int_t board   = AliADCalibData::GetBoardNumber(pmNumber);
+                       if (board < 0) continue;
+                       
+                       if(fCalibData->GetEnableCharge(pmNumber)) {
+                               fCharges[pmNumber] = digit->ChargeADC(kNClocks/2);
+                               if(fCalibData->GetPedestalSubtraction(board)) {
+                                       if(fCharges[pmNumber]>=(Float_t) fCalibData->GetOnlinePedestalCut(integrator,pmNumber)){ 
+                                               fCharges[pmNumber] -= (Float_t) fCalibData->GetOnlinePedestal(integrator,pmNumber);
+                                       } else {
+                                               fCharges[pmNumber] = 0.;
+                                       }
+                               }
+                       } else {
+                               fCharges[pmNumber] = 0.;
+                       }
+                       
+                       Float_t time = digit->Time();
+                       time -= fClockOffset[board];
+
+                       AliDebug(10,Form(" Digit: %f %d %d %d %d %d %d %d %d",digit->Time(),
+                                        digit->ChargeADC(8),digit->ChargeADC(9),digit->ChargeADC(10),
+                                        digit->ChargeADC(11),digit->ChargeADC(12),digit->ChargeADC(13),
+                                        digit->ChargeADC(14),digit->ChargeADC(15)));
+                       AliDebug(10,Form(" PM nb : %d ; TDC= %f(%f)  Enable Time %d charge %d inCoin %d charge %f",
+                                        pmNumber,time,digit->Time(),
+                                        fCalibData->GetEnableTiming(pmNumber),fCalibData->GetEnableCharge(pmNumber),
+                                        fBBGate[board]->IsInCoincidence(time),fCharges[pmNumber]));
+                       fBBFlags[pmNumber] = fCalibData->GetEnableTiming(pmNumber) && fBBGate[board]->IsInCoincidence(time);
+                       fBGFlags[pmNumber] = fCalibData->GetEnableTiming(pmNumber) && fBGGate[board]->IsInCoincidence(time);
+                       // Store the BB and BG flags in the digits tree
+                       digit->SetBBflag(fBBFlags[pmNumber]);
+                       digit->SetBGflag(fBGFlags[pmNumber]);
+                       
+               } // end of loop over digits
+       } // end of loop over events in digits tree
+       
+       Int_t nBBflagsADA = 0;
+       Int_t nBBflagsADC = 0;
+       Int_t nBGflagsADA = 0;
+       Int_t nBGflagsADC = 0;
+       Float_t chargeADA   = 0.;
+       Float_t chargeADC   = 0.;
+
+       for(int i=0;i<16;i++) {
+               if(i<8) {
+                       nBBflagsADC += fBBFlags[i]; 
+                       nBGflagsADC += fBGFlags[i];
+                       chargeADC += fCharges[i];
+               } else {
+                       nBBflagsADA += fBBFlags[i]; 
+                       nBGflagsADA += fBGFlags[i];
+                       chargeADA += fCharges[i];
+               }
+               //AliInfo(Form("Ch %d BB=%d BG=%d",i,fBBFlags[i],fBGFlags[i] )); 
+       }
+       
+       // BBA
+       if(nBBflagsADA>=fCalibData->GetBBAThreshold())  SetBBA();
+       
+       // BBC
+       if(nBBflagsADC>=fCalibData->GetBBCThreshold())  SetBBC();
+
+       // BBA_AND_BBC
+       if(GetBBA() && GetBBC())  SetBBAandBBC();
+       
+       // BBA_OR_BBC
+       if(GetBBA() || GetBBC()) SetBBAorBBC();
+
+       // BGA
+       if(nBGflagsADA>=fCalibData->GetBGAThreshold()) SetBGA();
+
+       // BGC
+       if(nBGflagsADC>=fCalibData->GetBGCThreshold()) SetBGC();
+       
+       // BGA_AND_BBC (Beam Gas from RB24 side)
+       if(nBBflagsADC>=fCalibData->GetBBCForBGThreshold() && GetBGA()) SetBGAandBBC();
+       
+       // BGC_AND_BBA (Beam Gas from RB26 side)
+       if(nBBflagsADA>=fCalibData->GetBBAForBGThreshold() && GetBGC()) SetBGCandBBA();
+
+       
+       // MTA_AND_MTC (Multiplicity Trigger)
+       if((nBBflagsADA<=fCalibData->GetMultADAThrHigh() && nBBflagsADA>=fCalibData->GetMultADAThrLow())
+          && (nBBflagsADC<=fCalibData->GetMultADCThrHigh() && nBBflagsADC>=fCalibData->GetMultADCThrLow()) ) 
+               SetMTAandMTC();
+       
+       // MTA_OR_MTC (Multiplicity Trigger)
+       if((nBBflagsADA<=fCalibData->GetMultADAThrHigh() && nBBflagsADA>=fCalibData->GetMultADAThrLow())
+          || (nBBflagsADC<=fCalibData->GetMultADCThrHigh() && nBBflagsADC>=fCalibData->GetMultADCThrLow()) ) 
+               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 : ADA = %d  ADC = %d ",nBBflagsADA, nBBflagsADC )); 
+//     AliInfo(Form("BG Flags : ADA = %d  ADC = %d ",nBGflagsADA, nBGflagsADC )); 
+//     AliInfo(Form("Charges  : ADA = %d  ADC = %d ",chargeADA, chargeADC )); 
+       
+}
+
+//_____________________________________________________________________________
+Bool_t AliADTriggerSimulator::AreGatesOpen() const {
+  // The method check if the gates are suppossed to be open
+  // (corresponding to 'Test Window' flag in DCS).
+  // Since the flag is not stored in OCDB, we just check if
+  // all the clock delays are 0 or not.
+  // This rules should be followed when setting up the detector
+  // at the level of DCS
+
+  for (int i=0; i<kNCIUBoards; i++) {
+    if (fCalibData->GetDelayClk1Win1(i)!=0 ||
+       fCalibData->GetDelayClk2Win1(i)!=0 ||
+       fCalibData->GetDelayClk1Win2(i)!=0 ||
+       fCalibData->GetDelayClk2Win2(i)!=0)
+      return kFALSE;
+  }
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AliADTriggerSimulator::Print(Option_t* /* opt */) const
+{
+  // Prints the trigger windows as
+  // initialized from the OCDB
+  for (int i=0; i<kNCIUBoards; i++) {
+    std::cout << "Board=" << i << "   BB (" << fBBGate[i]->GetStartTime() << " -> " << fBBGate[i]->GetStopTime() << ")   BG (" << fBGGate[i]->GetStartTime() << " -> " << fBGGate[i]->GetStopTime() << ")" << std::endl;
+  }
+  std::cout << std::endl;
+}
+
+
diff --git a/AD/ADsim/AliADTriggerSimulator.h b/AD/ADsim/AliADTriggerSimulator.h
new file mode 100644 (file)
index 0000000..0c0857e
--- /dev/null
@@ -0,0 +1,107 @@
+#ifndef ALIADTRIGGERSIMULATOR_H
+#define ALIADTRIGGERSIMULATOR_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved. 
+ *
+ * See cxx source for full Copyright notice                               
+ */
+// 
+// Class AliADTriggerSimulator
+// ------------------------------
+//  Simulate the AD Trigger response
+// Use FEE parameters stored in Database
+// Can work on real data or in simulation
+//
+
+#include <TObject.h>
+#include "AliADConst.h"
+
+class AliADLogicalSignal;
+class AliADCalibData;
+class TTree;
+class TClonesArray;
+
+class AliADTriggerSimulator : public TObject {
+public:
+       AliADTriggerSimulator();
+       AliADTriggerSimulator(TTree * digitsTree, TClonesArray* digits);
+       ~AliADTriggerSimulator();
+       
+       AliADCalibData * GetCalibData() const {return fCalibData;};
+       
+       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();
+       virtual void Print(Option_t* /* opt */) const;
+       
+private:
+       // Private methods
+       AliADTriggerSimulator(const AliADTriggerSimulator &/*triggerSim*/);
+       AliADTriggerSimulator& operator= (const AliADTriggerSimulator & /*triggerSim*/);
+       AliADCalibData * LoadCalibData() const ;
+       void                  LoadClockOffset();
+       void GenerateBBWindows();
+       void GenerateBGWindows();
+       Bool_t AreGatesOpen() const;
+       
+       // Members
+       AliADLogicalSignal * fBBGate[kNCIUBoards];  // BB Observation window
+       AliADLogicalSignal * fBBLatch[kNCIUBoards]; // BB Latch window
+       AliADLogicalSignal * fBBReset[kNCIUBoards]; // BB Reset Window
+       
+       AliADLogicalSignal * fBGGate[kNCIUBoards];  // BG Observation window
+       AliADLogicalSignal * fBGLatch[kNCIUBoards]; // BG Latch Window
+       AliADLogicalSignal * fBGReset[kNCIUBoards]; // BG Reset Window
+
+       AliADCalibData *fCalibData; // Object holding the trigger configuration parameters
+       Float_t fClockOffset[kNCIUBoards]; // TDC clock offset including roll-over, trig count and L0->L1 delay
+       
+       TTree* fDigitsTree; //Pointer to AD digit tree
+       TClonesArray* fDigits; //Pointer to AD digit array
+       
+       Bool_t fBBFlags[64]; // Individual BB Flags
+       Bool_t fBGFlags[64]; // Individual BG Flags
+       Float_t  fCharges[64]; // Individual Charge
+       
+       UShort_t fTriggerWord; // Word holding the 16 triggers return by the FEE
+               
+       ClassDef( AliADTriggerSimulator, 3 )  
+
+};
+
+
+#endif // ALIADTRIGGERSIMULATOR_H
+
+
index 258496c..ddb85a7 100644 (file)
@@ -38,6 +38,8 @@ set(SRCS
     AliADDigitizer.cxx
     AliADBuffer.cxx
     AliADQADataMakerSim.cxx
+    AliADLogicalSignal.cxx
+    AliADTriggerSimulator.cxx
    )
 
 # Headers from sources
@@ -72,4 +74,4 @@ install(TARGETS ${MODULE}
         ARCHIVE DESTINATION lib
         LIBRARY DESTINATION lib)
 
-install(FILES ${HDRS} DESTINATION include)
\ No newline at end of file
+install(FILES ${HDRS} DESTINATION include)
index aa23222..5643772 100644 (file)
@@ -11,7 +11,7 @@
 void ADTestPreprocessor()
 {
   // load library
-  gSystem->Load("libTestShuttle");
+  gSystem->Load("$ALICE_ROOT/src/SHUTTLE/TestShuttle/libTestShuttle");
 
    // create AliTestShuttle instance
   // The parameters are run, startTime, endTime
@@ -19,8 +19,8 @@ void ADTestPreprocessor()
 
   // TODO if needed, change location of OCDB and Reference test folders
   // by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB and TestReference
-  AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/OCDB");
-  AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/OCDB");
+  AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/src/OCDB");
+  AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/src/OCDB");
 
   printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
   printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
index 3e2ec64..3cb0cca 100644 (file)
@@ -14,6 +14,82 @@ AD0/HV/PM12        100
 AD0/HV/PM13        1682
 AD0/HV/PM14        1958
 AD0/HV/PM15        1718
+AD0/FEE/CCIU/BBAThreshold      1
+AD0/FEE/CCIU/BBCThreshold      1
+AD0/FEE/CCIU/BGAThreshold      1
+AD0/FEE/CCIU/BGCThreshold      1       
+AD0/FEE/CCIU/BBAForBGThreshold 1
+AD0/FEE/CCIU/BBCForBGThreshold 1       
+AD0/FEE/CCIU/MultADAThrLow     3
+AD0/FEE/CCIU/MultADAThrHigh    32
+AD0/FEE/CCIU/MultADCThrLow     3
+AD0/FEE/CCIU/MultADCThrHigh    32
+AD0/FEE/CCIU/TriggerSelect1    1
+AD0/FEE/CCIU/TriggerSelect2    2
+AD0/FEE/CCIU/TriggerSelect3    3
+AD0/FEE/CCIU/TriggerSelect4    4
+AD0/FEE/CCIU/TriggerSelect5    5
+AD0/FEE/CIU0/Clk1Win1                          3
+AD0/FEE/CIU0/Clk2Win1  14
+AD0/FEE/CIU0/Clk1Win2  7 
+AD0/FEE/CIU0/Clk2Win2  14
+AD0/FEE/CIU0/DelayClk1Win1     300
+AD0/FEE/CIU0/DelayClk2Win1     200
+AD0/FEE/CIU0/DelayClk1Win2     0
+AD0/FEE/CIU0/DelayClk2Win2     100
+AD0/FEE/CIU0/LatchWin1 16
+AD0/FEE/CIU0/LatchWin2 16
+AD0/FEE/CIU0/ResetWin1 16
+AD0/FEE/CIU0/ResetWin2 12
+AD0/FEE/CIU0/PedestalSubtraction       1
+AD0/FEE/CIU0/EnableCharge1     1
+AD0/FEE/CIU0/EnableCharge2     1
+AD0/FEE/CIU0/EnableCharge3     1
+AD0/FEE/CIU0/EnableCharge4     1
+AD0/FEE/CIU0/EnableCharge5     1
+AD0/FEE/CIU0/EnableCharge6     1
+AD0/FEE/CIU0/EnableCharge7     1
+AD0/FEE/CIU0/EnableCharge8     1
+AD0/FEE/CIU0/EnableTiming1     1
+AD0/FEE/CIU0/EnableTiming2     1
+AD0/FEE/CIU0/EnableTiming3     1
+AD0/FEE/CIU0/EnableTiming4     1
+AD0/FEE/CIU0/EnableTiming5     1
+AD0/FEE/CIU0/EnableTiming6     1
+AD0/FEE/CIU0/EnableTiming7     1
+AD0/FEE/CIU0/EnableTiming8     1
+AD0/FEE/CIU0/PedEven1  16
+AD0/FEE/CIU0/PedEven2  16
+AD0/FEE/CIU0/PedEven3  16
+AD0/FEE/CIU0/PedEven4  16
+AD0/FEE/CIU0/PedEven5  16
+AD0/FEE/CIU0/PedEven6  16
+AD0/FEE/CIU0/PedEven7  16
+AD0/FEE/CIU0/PedEven8  16
+AD0/FEE/CIU0/PedOdd1   16
+AD0/FEE/CIU0/PedOdd2   16
+AD0/FEE/CIU0/PedOdd3   16
+AD0/FEE/CIU0/PedOdd4   16
+AD0/FEE/CIU0/PedOdd5   16
+AD0/FEE/CIU0/PedOdd6   16
+AD0/FEE/CIU0/PedOdd7   16
+AD0/FEE/CIU0/PedOdd8   16
+AD0/FEE/CIU0/PedCutEven1       18
+AD0/FEE/CIU0/PedCutEven2       18
+AD0/FEE/CIU0/PedCutEven3       18
+AD0/FEE/CIU0/PedCutEven4       18
+AD0/FEE/CIU0/PedCutEven5       18
+AD0/FEE/CIU0/PedCutEven6       18
+AD0/FEE/CIU0/PedCutEven7       18
+AD0/FEE/CIU0/PedCutEven8       18
+AD0/FEE/CIU0/PedCutOdd1        18
+AD0/FEE/CIU0/PedCutOdd2        18
+AD0/FEE/CIU0/PedCutOdd3        18
+AD0/FEE/CIU0/PedCutOdd4        18
+AD0/FEE/CIU0/PedCutOdd5        18
+AD0/FEE/CIU0/PedCutOdd6        18
+AD0/FEE/CIU0/PedCutOdd7        18
+AD0/FEE/CIU0/PedCutOdd8        18
 AD0/FEE/CIU0/TimeResolution 2
 AD0/FEE/CIU0/WidthResolution 8
 AD0/FEE/CIU0/MatchWindow 4
@@ -36,6 +112,67 @@ AD0/FEE/CIU0/DiscriThr5     2000
 AD0/FEE/CIU0/DiscriThr6        2000
 AD0/FEE/CIU0/DiscriThr7        2000
 AD0/FEE/CIU0/DiscriThr8        2000
+AD0/FEE/CIU1/Clk1Win1                          3
+AD0/FEE/CIU1/Clk2Win1  14
+AD0/FEE/CIU1/Clk1Win2  7 
+AD0/FEE/CIU1/Clk2Win2  14
+AD0/FEE/CIU1/DelayClk1Win1     300
+AD0/FEE/CIU1/DelayClk2Win1     200
+AD0/FEE/CIU1/DelayClk1Win2     0
+AD0/FEE/CIU1/DelayClk2Win2     100
+AD0/FEE/CIU1/LatchWin1 16
+AD0/FEE/CIU1/LatchWin2 16
+AD0/FEE/CIU1/ResetWin1 16
+AD0/FEE/CIU1/ResetWin2 16
+AD0/FEE/CIU1/PedestalSubtraction       1
+AD0/FEE/CIU1/EnableCharge1     1
+AD0/FEE/CIU1/EnableCharge2     1
+AD0/FEE/CIU1/EnableCharge3     1
+AD0/FEE/CIU1/EnableCharge4     1
+AD0/FEE/CIU1/EnableCharge5     1
+AD0/FEE/CIU1/EnableCharge6     1
+AD0/FEE/CIU1/EnableCharge7     1
+AD0/FEE/CIU1/EnableCharge8     1
+AD0/FEE/CIU1/EnableTiming1     1
+AD0/FEE/CIU1/EnableTiming2     1
+AD0/FEE/CIU1/EnableTiming3     1
+AD0/FEE/CIU1/EnableTiming4     1
+AD0/FEE/CIU1/EnableTiming5     1
+AD0/FEE/CIU1/EnableTiming6     1
+AD0/FEE/CIU1/EnableTiming7     1
+AD0/FEE/CIU1/EnableTiming8     1
+AD0/FEE/CIU1/PedEven1  16
+AD0/FEE/CIU1/PedEven2  16
+AD0/FEE/CIU1/PedEven3  16
+AD0/FEE/CIU1/PedEven4  16
+AD0/FEE/CIU1/PedEven5  16
+AD0/FEE/CIU1/PedEven6  16
+AD0/FEE/CIU1/PedEven7  16
+AD0/FEE/CIU1/PedEven8  16
+AD0/FEE/CIU1/PedOdd1   16
+AD0/FEE/CIU1/PedOdd2   16
+AD0/FEE/CIU1/PedOdd3   16
+AD0/FEE/CIU1/PedOdd4   16
+AD0/FEE/CIU1/PedOdd5   16
+AD0/FEE/CIU1/PedOdd6   16
+AD0/FEE/CIU1/PedOdd7   16
+AD0/FEE/CIU1/PedOdd8   16
+AD0/FEE/CIU1/PedCutEven1       18
+AD0/FEE/CIU1/PedCutEven2       18
+AD0/FEE/CIU1/PedCutEven3       18
+AD0/FEE/CIU1/PedCutEven4       18
+AD0/FEE/CIU1/PedCutEven5       18
+AD0/FEE/CIU1/PedCutEven6       18
+AD0/FEE/CIU1/PedCutEven7       18
+AD0/FEE/CIU1/PedCutEven8       18
+AD0/FEE/CIU1/PedCutOdd1        18
+AD0/FEE/CIU1/PedCutOdd2        18
+AD0/FEE/CIU1/PedCutOdd3        18
+AD0/FEE/CIU1/PedCutOdd4        18
+AD0/FEE/CIU1/PedCutOdd5        18
+AD0/FEE/CIU1/PedCutOdd6        18
+AD0/FEE/CIU1/PedCutOdd7        18
+AD0/FEE/CIU1/PedCutOdd8        18
 AD0/FEE/CIU1/TimeResolution 0
 AD0/FEE/CIU1/WidthResolution 5
 AD0/FEE/CIU1/MatchWindow 4
@@ -58,4 +195,3 @@ AD0/FEE/CIU1/DiscriThr5      2000
 AD0/FEE/CIU1/DiscriThr6        2000
 AD0/FEE/CIU1/DiscriThr7        2000
 AD0/FEE/CIU1/DiscriThr8        2000
-