Corrections in order to properly simulate the VZERO trigger gates. Needed some manual...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Aug 2012 13:22:57 +0000 (13:22 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Aug 2012 13:22:57 +0000 (13:22 +0000)
VZERO/AliVZEROLogicalSignal.cxx
VZERO/AliVZEROLogicalSignal.h
VZERO/AliVZEROTriggerSimulator.cxx
VZERO/AliVZEROTriggerSimulator.h
VZERO/CheckFeeOCDB.C [new file with mode: 0644]

index 2008792..be4d292 100644 (file)
@@ -32,13 +32,6 @@ AliVZEROLogicalSignal::AliVZEROLogicalSignal() : TObject(), fStart(0.), fStop(0.
        // Default constructor\r
 }\r
 //_____________________________________________________________________________\r
-AliVZEROLogicalSignal::AliVZEROLogicalSignal(Float_t start, Float_t stop) : TObject(), fStart(start), fStop(stop)\r
-{\r
-       // Constructor using start and stop time\r
-       if(fStart>fStop) AliError("Logical Signal has a Start time AFTER the Stop time");\r
-       if(fStart==fStop) AliWarning("Logical Signal has a zero width");\r
-}\r
-//_____________________________________________________________________________\r
 AliVZEROLogicalSignal::AliVZEROLogicalSignal(UShort_t profilClock, UInt_t delay) : TObject(), fStart(0.), fStop(0.)\r
 {\r
        // Constructor using the profilClock and delay parameters comming from the FEE\r
@@ -48,20 +41,21 @@ AliVZEROLogicalSignal::AliVZEROLogicalSignal(UShort_t profilClock, UInt_t delay)
        Bool_t down=kFALSE;\r
        \r
        for(int i=0 ; i<5 ; i++) {\r
-               word = (profilClock >> i) & 0x1;\r
+               Int_t shift = (i<4) ? (3-i) : 4;\r
+               word = (profilClock >> shift) & 0x1;\r
                if(word&&!up) {\r
-                       fStart = 5. * i;\r
+                       fStart = 5. * (i + 1);\r
                        up = kTRUE;\r
                }\r
                if(!word&&up&&!down) {\r
-                       fStop = 5. * i;\r
+                       fStop = 5. * (i + 1);\r
                        down = kTRUE;\r
                }               \r
        }\r
-       if(!down) fStop = 25.;\r
+       if(!down) fStop = 30.;\r
        \r
-       fStart += delay*10.e-2; // Add 10 ps par register unit\r
-       fStop  += delay*10.e-2; \r
+       fStart += delay*1e-2; // Add 10 ps par register unit\r
+       fStop  += delay*1e-2; \r
 }\r
 //_____________________________________________________________________________\r
 AliVZEROLogicalSignal::AliVZEROLogicalSignal(const AliVZEROLogicalSignal &signal) : \r
index 85977dc..cb23581 100644 (file)
@@ -21,7 +21,6 @@
 class AliVZEROLogicalSignal  : public TObject {\r
 public:\r
        AliVZEROLogicalSignal();\r
-       AliVZEROLogicalSignal(Float_t start, Float_t stop);\r
        AliVZEROLogicalSignal(UShort_t profilClock, UInt_t delay);\r
        virtual ~AliVZEROLogicalSignal();\r
        AliVZEROLogicalSignal(const AliVZEROLogicalSignal &signal);\r
index 78c377c..4c9c703 100644 (file)
@@ -98,22 +98,50 @@ AliVZEROTriggerSimulator::~AliVZEROTriggerSimulator(){
 //_____________________________________________________________________________\r
 void AliVZEROTriggerSimulator::GenerateBBWindows() \r
 {\r
-       // Generates the BB observation window\r
+  // Generates the BB observation window\r
+  // In case gates are open the windows are equal to 25ns\r
+  if (AreGatesOpen()) {\r
+       for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {\r
+               fBBGate[i] = new AliVZEROLogicalSignal();\r
+               fBBGate[i]->SetStartTime(0.);\r
+               fBBGate[i]->SetStopTime(25.0);\r
+       }    \r
+  }\r
+  else {\r
        for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {\r
                AliVZEROLogicalSignal clk1BB(fTriggerData->GetClk1Win1(i),fTriggerData->GetDelayClk1Win1(i));\r
                AliVZEROLogicalSignal clk2BB(fTriggerData->GetClk2Win1(i),fTriggerData->GetDelayClk2Win1(i));\r
                fBBGate[i] = new AliVZEROLogicalSignal(clk1BB & clk2BB);\r
        }\r
+  }\r
 }\r
 //_____________________________________________________________________________\r
 void AliVZEROTriggerSimulator::GenerateBGWindows() \r
 {\r
-       // Generates the BG observation window\r
+  // Generates the BG observation window\r
+  // In case gates are open the windows are equal to 25ns\r
+  if (AreGatesOpen()) {\r
+       for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {\r
+               fBGGate[i] = new AliVZEROLogicalSignal();\r
+               fBGGate[i]->SetStartTime(0.);\r
+               fBGGate[i]->SetStopTime(25.0);\r
+       }    \r
+  }\r
+  else {\r
        for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {\r
                AliVZEROLogicalSignal clk1BG(fTriggerData->GetClk1Win2(i),fTriggerData->GetDelayClk1Win2(i));\r
                AliVZEROLogicalSignal clk2BG(fTriggerData->GetClk2Win2(i),fTriggerData->GetDelayClk2Win2(i));\r
                fBGGate[i] = new AliVZEROLogicalSignal(clk1BG & clk2BG);\r
+               // In VZERO-A we have a shift by -25ns which is controlled by\r
+               // 'Delay Win2' = 7 instead of default 6.\r
+               // The flag is not stored in OCDB so we have manually shift the\r
+               // trigger windows\r
+               if (i < 4) {\r
+                 fBGGate[i]->SetStartTime(fBGGate[i]->GetStartTime()-25.0);\r
+                 fBGGate[i]->SetStopTime(fBGGate[i]->GetStopTime()-25.0);\r
+               }\r
        }\r
+  }\r
 }\r
 \r
 //_____________________________________________________________________________\r
@@ -324,5 +352,34 @@ void AliVZEROTriggerSimulator::Run() {
        \r
 }\r
 \r
+//_____________________________________________________________________________\r
+Bool_t AliVZEROTriggerSimulator::AreGatesOpen() const {\r
+  // The method check if the gates are suppossed to be open\r
+  // (corresponding to 'Test Window' flag in DCS).\r
+  // Since the flag is not stored in OCDB, we just check if\r
+  // all the clock delays are 0 or not.\r
+  // This rules should be followed when setting up the detector\r
+  // at the level of DCS\r
+\r
+  for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {\r
+    if (fTriggerData->GetDelayClk1Win1(i)!=0 ||\r
+       fTriggerData->GetDelayClk2Win1(i)!=0 ||\r
+       fTriggerData->GetDelayClk1Win2(i)!=0 ||\r
+       fTriggerData->GetDelayClk2Win2(i)!=0)\r
+      return kFALSE;\r
+  }\r
+  return kTRUE;\r
+}\r
+\r
+//_____________________________________________________________________________\r
+void AliVZEROTriggerSimulator::Print(Option_t* /* opt */) const\r
+{\r
+  // Prints the trigger windows as\r
+  // initialized from the OCDB\r
+  for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {\r
+    cout << "Board=" << i << "   BB (" << fBBGate[i]->GetStartTime() << " -> " << fBBGate[i]->GetStopTime() << ")   BG (" << fBGGate[i]->GetStartTime() << " -> " << fBGGate[i]->GetStopTime() << ")" << endl;\r
+  }\r
+  cout << endl;\r
+}\r
 \r
 \r
index 007c1ca..000ec31 100644 (file)
@@ -64,6 +64,7 @@ public:
        void SetBeamGas()               { (fTriggerWord += 0x1<<15);};\r
        \r
        void Run();\r
+       virtual void Print(Option_t* /* opt */) const;\r
        \r
 private:\r
        // Private methods\r
@@ -73,6 +74,7 @@ private:
        void                  LoadClockOffset();\r
        void GenerateBBWindows();\r
        void GenerateBGWindows();\r
+       Bool_t AreGatesOpen() const;\r
        \r
        // Members\r
        AliVZEROLogicalSignal * fBBGate[AliVZEROTriggerData::kNCIUBoards];  // BB Observation window\r
diff --git a/VZERO/CheckFeeOCDB.C b/VZERO/CheckFeeOCDB.C
new file mode 100644 (file)
index 0000000..447f7bd
--- /dev/null
@@ -0,0 +1,40 @@
+void CheckFeeOCDB(Int_t run)
+{
+  AliCDBManager *man = AliCDBManager::Instance();
+
+  man->SetDefaultStorage("raw://");
+  man->SetRun(run);
+
+  AliCDBEntry *ent1 = man->Get("VZERO/Trigger/Data");
+  AliVZEROTriggerData *fTriggerData = (AliVZEROTriggerData*)ent1->GetObject();
+
+  for (int i=0; i<AliVZEROTriggerData::kNCIUBoards; i++) {
+    AliVZEROLogicalSignal clk1BB(fTriggerData->GetClk1Win1(i),(UInt_t)fTriggerData->GetDelayClk1Win1(i));
+    AliVZEROLogicalSignal clk2BB(fTriggerData->GetClk2Win1(i),(UInt_t)fTriggerData->GetDelayClk2Win1(i));
+    AliVZEROLogicalSignal bbGate(clk1BB & clk2BB);
+
+    AliVZEROLogicalSignal clk1BG(fTriggerData->GetClk1Win2(i),(UInt_t)fTriggerData->GetDelayClk1Win2(i));
+    AliVZEROLogicalSignal clk2BG(fTriggerData->GetClk2Win2(i),(UInt_t)fTriggerData->GetDelayClk2Win2(i));
+    AliVZEROLogicalSignal bgGate(clk1BG & clk2BG);
+
+    printf("Board=%d\n",i);
+    printf("  Win1: Clk1=%d DelayClk1=%d (%.2f -> %.2f) Clk2=%d DelayClk2=%d (%.2f -> %.2f) Latch=%d Reset=%d  Start=%.2f Stop=%.2f\n",
+          fTriggerData->GetClk1Win1(i), fTriggerData->GetDelayClk1Win1(i),
+          clk1BB.GetStartTime(), clk1BB.GetStopTime(),
+          fTriggerData->GetClk2Win1(i), fTriggerData->GetDelayClk2Win1(i),
+          clk2BB.GetStartTime(), clk2BB.GetStopTime(),
+          fTriggerData->GetLatchWin1(i), fTriggerData->GetResetWin1(i),
+          bbGate.GetStartTime(), bbGate.GetStopTime());
+    printf("  Win2: Clk1=%d DelayClk1=%d (%.2f -> %.2f) Clk2=%d DelayClk2=%d (%.2f -> %.2f) Latch=%d Reset=%d  Start=%.2f Stop=%.2f\n\n",
+          fTriggerData->GetClk1Win2(i), fTriggerData->GetDelayClk1Win2(i),
+          clk1BG.GetStartTime(), clk1BG.GetStopTime(),
+          fTriggerData->GetClk2Win2(i), fTriggerData->GetDelayClk2Win2(i),
+          clk2BG.GetStartTime(), clk2BG.GetStopTime(),
+          fTriggerData->GetLatchWin2(i), fTriggerData->GetResetWin2(i),
+          bgGate.GetStartTime(), bgGate.GetStopTime());
+  }
+
+  printf("What will be used in MC:\n");
+  AliVZEROTriggerSimulator simulator;
+  simulator.Print();
+}