]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZEROTrigger.cxx
VZEROTUNING2da.cxx has been renamed VZEROINTEGRATIONGATETUNINGda.cxx
[u/mrichter/AliRoot.git] / VZERO / AliVZEROTrigger.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 #include <TClonesArray.h>
19
20 #include "AliRun.h"
21 #include "AliRunLoader.h"
22
23 #include "AliVZEROTrigger.h"
24 #include "AliVZEROTriggerMask.h"
25
26 //______________________________________________________________________
27 ClassImp(AliVZEROTrigger)
28 ////////////////////////////////////////////////////////////////////////
29 //
30 // Version 1
31 //
32 // AliVZEROTrigger: 
33 //
34 ////////////////////////////////////////////////////////////////////////
35
36 //______________________________________________________________________
37
38 AliVZEROTrigger::AliVZEROTrigger()
39   :AliTriggerDetector(),
40    fAdcThresHold(0.0),
41    fTimeWindowWidthBBA(50.0),
42    fTimeWindowWidthBGA(20.0),
43    fTimeWindowWidthBBC(50.0),
44    fTimeWindowWidthBGC(20.0)
45    
46 {
47    SetName("VZERO");
48    CreateInputs();
49
50    SetAdcThreshold();
51 }
52 //______________________________________________________________________
53 void AliVZEROTrigger::CreateInputs()
54 {
55    // inputs
56
57    // Do not create inputs again!!
58    if( fInputs.GetEntriesFast() > 0 ) return;
59
60    fInputs.AddLast( new AliTriggerInput( "VZERO_LEFT", "VZERO", 0 ) );
61    fInputs.AddLast( new AliTriggerInput( "VZERO_RIGHT","VZERO", 0 ) );
62    fInputs.AddLast( new AliTriggerInput( "VZERO_AND",  "VZERO", 0 ) );
63    fInputs.AddLast( new AliTriggerInput( "VZERO_OR",   "VZERO", 0 ) );
64    fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS", "VZERO", 0 ) );
65 }
66
67 //______________________________________________________________________
68 void AliVZEROTrigger::Trigger()
69 {
70   
71   //  ********** Get run loader for the current event **********
72   AliRunLoader* runLoader = gAlice->GetRunLoader();
73
74   AliVZEROLoader* loader = 
75     (AliVZEROLoader* )runLoader->GetLoader( "VZEROLoader" );
76
77   loader->LoadDigits("READ");
78   TTree* vzeroDigitsTree = loader->TreeD();
79   if (!vzeroDigitsTree) return;
80
81   TClonesArray* vzeroDigits = new TClonesArray("AliVZEROdigit",1000);
82   TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
83   digitBranch->SetAddress(&vzeroDigits);
84
85   AliVZEROTriggerMask *TriggerMask = new AliVZEROTriggerMask();
86   TriggerMask->SetAdcThreshold(fAdcThresHold);
87   TriggerMask->SetTimeWindowWidthBBA(fTimeWindowWidthBBA);
88   TriggerMask->SetTimeWindowWidthBGA(fTimeWindowWidthBGA);
89   TriggerMask->SetTimeWindowWidthBBC(fTimeWindowWidthBBC);
90   TriggerMask->SetTimeWindowWidthBGC(fTimeWindowWidthBGC);
91   TriggerMask->FillMasks(vzeroDigitsTree,vzeroDigits);
92
93   if ( (TriggerMask->GetBGtriggerV0A()>0) ||
94        (TriggerMask->GetBGtriggerV0C()>0)) SetInput( "VZERO_BEAMGAS" );
95   if (TriggerMask->GetBBtriggerV0A()>0)  SetInput( "VZERO_LEFT" );
96   if (TriggerMask->GetBBtriggerV0C()>0)  SetInput( "VZERO_RIGHT" );
97   if ( (TriggerMask->GetBBtriggerV0A()>0) ||
98        (TriggerMask->GetBBtriggerV0C()>0)) SetInput( "VZERO_OR" );
99   if ( (TriggerMask->GetBBtriggerV0A()>0) &&
100        (TriggerMask->GetBBtriggerV0C()>0)) SetInput( "VZERO_AND" );
101
102   return;
103 }
104