]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - VZERO/AliVZEROTrigger.cxx
Set IMAGE_PATH to .
[u/mrichter/AliRoot.git] / VZERO / AliVZEROTrigger.cxx
index 33aa9aeefd5c5efbf13f6c6436d000d0bd5d2cda..75087d5cbeff4c3f5fce4c1d4bfbc07a7a735aa7 100644 (file)
@@ -1,3 +1,22 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+#include <TClonesArray.h>
+
 #include "AliRun.h"
 #include "AliRunLoader.h"
 
@@ -15,12 +34,16 @@ ClassImp(AliVZEROTrigger)
 
 //______________________________________________________________________
 AliVZEROTrigger::AliVZEROTrigger()
-  : AliTriggerDetector()
+  :AliTriggerDetector(),
+   fAdcThresHold(0.0),
+   fTimeWindowWidth(50.0)
+   
 {
    SetName("VZERO");
    CreateInputs();
 
    SetAdcThreshold();
+   SetTimeWindowWidth();
 }
 
 //______________________________________________________________________
@@ -50,6 +73,7 @@ void AliVZEROTrigger::Trigger()
 
   loader->LoadDigits("READ");
   TTree* vzeroDigitsTree = loader->TreeD();
+  if (!vzeroDigitsTree) return;
 
   TClonesArray* vzeroDigits = new TClonesArray("AliVZEROdigit",1000);
   TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
@@ -60,9 +84,10 @@ void AliVZEROTrigger::Trigger()
   Int_t nRightDig = 0;
   
   // first time 
-  Float_t firstTimeLeft = 9999;
-  Float_t firstTimeRight = 9999;
-
+  Float_t firstTimeLeft  = 9999.0;
+  Float_t firstTimeRight = 9999.0;
+  Float_t TimeHalfWidth  = fTimeWindowWidth/2.0;
   // loop over vzero entries
   Int_t nEntries = (Int_t)vzeroDigitsTree->GetEntries();
   for (Int_t e=0; e<nEntries; e++) {
@@ -74,18 +99,19 @@ void AliVZEROTrigger::Trigger()
       //      vzeroDigitsTree->GetEvent(d);
       AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(d);
       
-      Int_t   cellNumber = digit->CellNumber();
+      Int_t   PMNumber   = digit->PMNumber();
       Float_t adc        = digit->ADC();
       Float_t tdc        = digit->Time(); // in 100 of picoseconds
       
-      if (cellNumber<=47 && adc>fAdcThresHold) {
-       nLeftDig++;
+      if (PMNumber<=31 && adc>fAdcThresHold) {
+       if (tdc>(29.0-TimeHalfWidth) && tdc<(29.0+TimeHalfWidth)) nRightDig++;
+       if (tdc<firstTimeRight) firstTimeRight = tdc;
+      }      
+      if (PMNumber>=32 && adc>fAdcThresHold) {
+       if (tdc>(112.0-TimeHalfWidth) && tdc<(112.0+TimeHalfWidth)) nLeftDig++;
        if (tdc<firstTimeLeft) firstTimeLeft = tdc;
       }        
-      if (cellNumber>=48 && adc>fAdcThresHold) {
-       nRightDig++;
-       if (tdc<firstTimeRight) firstTimeRight = tdc;
-      }
+      
     } // end of loop over digits
   } // end of loop over events in digits tree
   
@@ -99,21 +125,21 @@ void AliVZEROTrigger::Trigger()
     SetInput( "VZERO_BEAMGAS" );
 
   if (nLeftDig > 0)
-    SetInput( "VZERO_LEFT" );
+      SetInput( "VZERO_LEFT" );
 
   if (nRightDig > 0)
-    SetInput( "VZERO_RIGHT" );
+      SetInput( "VZERO_RIGHT" );
   
   if (nLeftDig>0 || nRightDig>0) {
-    SetInput( "VZERO_OR" );
+      SetInput( "VZERO_OR" );
 
     if (nLeftDig>0 && nRightDig>0) {
-    SetInput( "VZERO_AND" );   
+        SetInput( "VZERO_AND" );   
     }
   }
   
-  AliDebug(1,Form("VZERO cells fired: %d (left) %d (right)", nLeftDig, nRightDig));
-
+  AliDebug(1,Form("VZERO PMs fired: %d (left) %d (right)", nLeftDig, nRightDig));
   return;
 }