]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZEROTrigger.cxx
Implementation of Trigger simulation (Raphael Tieulent)
[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 #include "AliTriggerInput.h"
23
24 #include "AliVZEROdigit.h"
25 #include "AliVZEROTriggerSimulator.h"
26 #include "AliVZEROTrigger.h"
27
28 //______________________________________________________________________
29 ClassImp(AliVZEROTrigger)
30 ////////////////////////////////////////////////////////////////////////
31 //
32 // Version 1
33 //
34 // AliVZEROTrigger: 
35 //
36 ////////////////////////////////////////////////////////////////////////
37
38 //______________________________________________________________________
39
40 AliVZEROTrigger::AliVZEROTrigger():AliTriggerDetector()
41 {
42    SetName("VZERO");
43    CreateInputs();
44 }
45 //______________________________________________________________________
46 void AliVZEROTrigger::CreateInputs()
47 {
48         // Do not create inputs again!!
49         if( fInputs.GetEntriesFast() > 0 ) return;
50
51         fInputs.AddLast( new AliTriggerInput( "VZERO_BBA_AND_BBC", "VZERO", 0 ) );
52         fInputs.AddLast( new AliTriggerInput( "VZERO_BBA_OR_BBC","VZERO", 0 ) );
53         fInputs.AddLast( new AliTriggerInput( "VZERO_BGA_AND_BBC",  "VZERO", 0 ) );
54         fInputs.AddLast( new AliTriggerInput( "VZERO_BGA",   "VZERO", 0 ) );
55         fInputs.AddLast( new AliTriggerInput( "VZERO_BGC_AND_BBA", "VZERO", 0 ) );
56         fInputs.AddLast( new AliTriggerInput( "VZERO_BGC",   "VZERO", 0 ) );
57         fInputs.AddLast( new AliTriggerInput( "VZERO_CTA1_AND_CTC1",   "VZERO", 0 ) );
58         fInputs.AddLast( new AliTriggerInput( "VZERO_CTA1_OR_CTC1",   "VZERO", 0 ) );
59         fInputs.AddLast( new AliTriggerInput( "VZERO_CTA2_AND_CTC2",   "VZERO", 0 ) );
60         fInputs.AddLast( new AliTriggerInput( "VZERO_CTA2_OR_CTC2",   "VZERO", 0 ) );
61         fInputs.AddLast( new AliTriggerInput( "VZERO_MTA_AND_MTC",   "VZERO", 0 ) );
62         fInputs.AddLast( new AliTriggerInput( "VZERO_MTA_OR_MTC",   "VZERO", 0 ) );
63         fInputs.AddLast( new AliTriggerInput( "VZERO_BBA",   "VZERO", 0 ) );
64         fInputs.AddLast( new AliTriggerInput( "VZERO_BBC",   "VZERO", 0 ) );
65         fInputs.AddLast( new AliTriggerInput( "VZERO_BGA_OR_BGC",   "VZERO", 0 ) );
66         fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS",   "VZERO", 0 ) );
67         
68 }
69
70 //______________________________________________________________________
71 void AliVZEROTrigger::Trigger()
72 {
73   //  ********** Get run loader for the current event **********
74         AliRunLoader* runLoader = AliRunLoader::Instance();
75
76         AliLoader* loader = runLoader->GetLoader( "VZEROLoader" );
77
78         if(!loader) {
79                 AliError("Can not get VZERO loader");
80                 return;
81         }
82         loader->LoadDigits("READ");
83         TTree* vzeroDigitsTree = loader->TreeD();
84
85         if (!vzeroDigitsTree) {
86                 AliError("Can not get the VZERO digit tree");
87                 return;
88         }
89         TClonesArray* vzeroDigits = NULL;
90         TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
91         digitBranch->SetAddress(&vzeroDigits);
92
93         AliVZEROTriggerSimulator * triggerSimulator = new AliVZEROTriggerSimulator(vzeroDigitsTree,vzeroDigits);
94         
95         triggerSimulator->Run();
96         
97         if(triggerSimulator->GetBBAandBBC())    SetInput( "VZERO_BBA_AND_BBC" );
98         if(triggerSimulator->GetBBAorBBC())             SetInput( "VZERO_BBA_OR_BBC" );
99         if(triggerSimulator->GetBGAandBBC())    SetInput( "VZERO_BGA_AND_BBC" );
100         if(triggerSimulator->GetBGA())                  SetInput( "VZERO_BGA" );
101         if(triggerSimulator->GetBGCandBBA())    SetInput( "VZERO_BGC_AND_BBA" );
102         if(triggerSimulator->GetBGC())                  SetInput( "VZERO_BGC" );
103         if(triggerSimulator->GetCTA1andCTC1())  SetInput( "VZERO_CTA1_AND_CTC1" );
104         if(triggerSimulator->GetCTA1orCTC1())   SetInput( "VZERO_CTA1_OR_CTC1" );
105         if(triggerSimulator->GetCTA2andCTC2())  SetInput( "VZERO_CTA2_AND_CTC2" );
106         if(triggerSimulator->GetCTA1orCTC1())   SetInput( "VZERO_CTA1_OR_CTC1" );
107         if(triggerSimulator->GetMTAandMTC())    SetInput( "VZERO_MTA_AND_MTC" );
108         if(triggerSimulator->GetMTAorMTC())             SetInput( "VZERO_MTA_OR_MTC" );
109         if(triggerSimulator->GetBBA())                  SetInput( "VZERO_BBA" );
110         if(triggerSimulator->GetBBC())                  SetInput( "VZERO_BBC" );
111         if(triggerSimulator->GetBGAorBGC())             SetInput( "VZERO_BGA_OR_BGC" );
112         if(triggerSimulator->GetBeamGas())              SetInput( "VZERO_BEAMGAS" );
113
114   return;
115 }
116