]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - VZERO/AliVZEROTriggerSimulator.cxx
Corrections in order to properly simulate the VZERO trigger gates. Needed some manual...
[u/mrichter/AliRoot.git] / VZERO / AliVZEROTriggerSimulator.cxx
index 78c377c65131571d4b1e3d934bd1c6dbfc3c2f7b..4c9c703667bc9455bcb2470d6391ea90fdb99a6c 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