Implementation of Trigger simulation (Raphael Tieulent)
[u/mrichter/AliRoot.git] / VZERO / AliVZEROTrigger.cxx
CommitLineData
7ca4655f 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
360938ba 20#include "AliRun.h"
21#include "AliRunLoader.h"
22
23#include "AliVZEROTrigger.h"
a055ee24 24#include "AliVZEROTriggerMask.h"
360938ba 25
26//______________________________________________________________________
27ClassImp(AliVZEROTrigger)
28////////////////////////////////////////////////////////////////////////
29//
30// Version 1
31//
32// AliVZEROTrigger:
33//
34////////////////////////////////////////////////////////////////////////
35
36//______________________________________________________________________
a055ee24 37
360938ba 38AliVZEROTrigger::AliVZEROTrigger()
0b2bea8b 39 :AliTriggerDetector(),
40 fAdcThresHold(0.0),
a055ee24 41 fTimeWindowWidthBBA(50.0),
42 fTimeWindowWidthBGA(20.0),
43 fTimeWindowWidthBBC(50.0),
44 fTimeWindowWidthBGC(20.0)
0b2bea8b 45
360938ba 46{
47 SetName("VZERO");
48 CreateInputs();
49
50 SetAdcThreshold();
51}
360938ba 52//______________________________________________________________________
53void AliVZEROTrigger::CreateInputs()
54{
55 // inputs
56
57 // Do not create inputs again!!
58 if( fInputs.GetEntriesFast() > 0 ) return;
59
572b6f20 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 ) );
572b6f20 64 fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS", "VZERO", 0 ) );
360938ba 65}
66
67//______________________________________________________________________
68void AliVZEROTrigger::Trigger()
69{
70
71 // ********** Get run loader for the current event **********
33c3c91a 72 AliRunLoader* runLoader = AliRunLoader::Instance();
360938ba 73
a055ee24 74 AliVZEROLoader* loader =
75 (AliVZEROLoader* )runLoader->GetLoader( "VZEROLoader" );
360938ba 76
77 loader->LoadDigits("READ");
78 TTree* vzeroDigitsTree = loader->TreeD();
698b2e52 79 if (!vzeroDigitsTree) return;
360938ba 80
81 TClonesArray* vzeroDigits = new TClonesArray("AliVZEROdigit",1000);
82 TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
83 digitBranch->SetAddress(&vzeroDigits);
84
a055ee24 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" );
360938ba 101
360938ba 102 return;
103}
104