]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZEROTrigger.cxx
Sector numbering corrected in stepmanager (has changed in the geometry after previous...
[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 /* $Id$ */
16 // ---------------------
17 // Class AliVZEROTrigger
18 // ---------------------
19 // Top class to simulate the VZERO trigger response
20 // This class is only used for interface with AliTriggerDetector
21 // Its create and Set  Inputs of the CTP
22 // The Calculation of the trigger response is done into AliVZEROTriggerSimulator
23 //
24
25
26 #include <TClonesArray.h>
27
28 #include "AliRun.h"
29 #include "AliRunLoader.h"
30 #include "AliTriggerInput.h"
31
32 #include "AliVZEROdigit.h"
33 #include "AliVZEROTriggerSimulator.h"
34 #include "AliVZEROTrigger.h"
35
36 //______________________________________________________________________
37 ClassImp(AliVZEROTrigger)
38
39 //______________________________________________________________________
40
41 AliVZEROTrigger::AliVZEROTrigger():AliTriggerDetector()
42 {
43    SetName("VZERO");
44    CreateInputs();
45 }
46 //______________________________________________________________________
47 void AliVZEROTrigger::CreateInputs()
48 {
49         // Do not create inputs again!!
50         if( fInputs.GetEntriesFast() > 0 ) return;
51
52         fInputs.AddLast( new AliTriggerInput( "VZERO_BBA_AND_BBC", "VZERO", 0 ) );
53         fInputs.AddLast( new AliTriggerInput( "VZERO_BBA_OR_BBC","VZERO", 0 ) );
54         fInputs.AddLast( new AliTriggerInput( "VZERO_BGA_AND_BBC",  "VZERO", 0 ) );
55         fInputs.AddLast( new AliTriggerInput( "0VGA",   "VZERO", 0 ) );
56         fInputs.AddLast( new AliTriggerInput( "VZERO_BGC_AND_BBA", "VZERO", 0 ) );
57         fInputs.AddLast( new AliTriggerInput( "0VGC",   "VZERO", 0 ) );
58         fInputs.AddLast( new AliTriggerInput( "VZERO_CTA1_AND_CTC1",   "VZERO", 0 ) );
59         fInputs.AddLast( new AliTriggerInput( "VZERO_CTA1_OR_CTC1",   "VZERO", 0 ) );
60         fInputs.AddLast( new AliTriggerInput( "VZERO_CTA2_AND_CTC2",   "VZERO", 0 ) );
61         fInputs.AddLast( new AliTriggerInput( "VZERO_CTA2_OR_CTC2",   "VZERO", 0 ) );
62         fInputs.AddLast( new AliTriggerInput( "VZERO_MTA_AND_MTC",   "VZERO", 0 ) );
63         fInputs.AddLast( new AliTriggerInput( "VZERO_MTA_OR_MTC",   "VZERO", 0 ) );
64         fInputs.AddLast( new AliTriggerInput( "0VBA",   "VZERO", 0 ) );
65         fInputs.AddLast( new AliTriggerInput( "0VBC",   "VZERO", 0 ) );
66         fInputs.AddLast( new AliTriggerInput( "VZERO_BGA_OR_BGC",   "VZERO", 0 ) );
67         fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS",   "VZERO", 0 ) );
68
69         // The following are kept for compatibility with the CTP configuration file. Will have to be removed at some point
70         fInputs.AddLast( new AliTriggerInput( "VZERO_AND", "VZERO", 0 ) );
71         fInputs.AddLast( new AliTriggerInput( "VZERO_OR","VZERO", 0 ) );
72 }
73
74 //______________________________________________________________________
75 void AliVZEROTrigger::Trigger()
76 {
77   //  ********** Get run loader for the current event **********
78         AliRunLoader* runLoader = AliRunLoader::Instance();
79
80         AliLoader* loader = runLoader->GetLoader( "VZEROLoader" );
81
82         if(!loader) {
83                 AliError("Can not get VZERO loader");
84                 return;
85         }
86         loader->LoadDigits("READ");
87         TTree* vzeroDigitsTree = loader->TreeD();
88
89         if (!vzeroDigitsTree) {
90                 AliError("Can not get the VZERO digit tree");
91                 return;
92         }
93         TClonesArray* vzeroDigits = NULL;
94         TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
95         digitBranch->SetAddress(&vzeroDigits);
96
97         AliVZEROTriggerSimulator * triggerSimulator = new AliVZEROTriggerSimulator(vzeroDigitsTree,vzeroDigits);
98         
99         triggerSimulator->Run();
100         
101         if(triggerSimulator->GetBBAandBBC())    SetInput( "VZERO_BBA_AND_BBC" );
102         if(triggerSimulator->GetBBAorBBC())             SetInput( "VZERO_BBA_OR_BBC" );
103         if(triggerSimulator->GetBGAandBBC())    SetInput( "VZERO_BGA_AND_BBC" );
104         if(triggerSimulator->GetBGA())                  SetInput( "0VGA" );
105         if(triggerSimulator->GetBGCandBBA())    SetInput( "VZERO_BGC_AND_BBA" );
106         if(triggerSimulator->GetBGC())                  SetInput( "0VGC" );
107         if(triggerSimulator->GetCTA1andCTC1())  SetInput( "VZERO_CTA1_AND_CTC1" );
108         if(triggerSimulator->GetCTA1orCTC1())   SetInput( "VZERO_CTA1_OR_CTC1" );
109         if(triggerSimulator->GetCTA2andCTC2())  SetInput( "VZERO_CTA2_AND_CTC2" );
110         if(triggerSimulator->GetCTA1orCTC1())   SetInput( "VZERO_CTA1_OR_CTC1" );
111         if(triggerSimulator->GetMTAandMTC())    SetInput( "VZERO_MTA_AND_MTC" );
112         if(triggerSimulator->GetMTAorMTC())             SetInput( "VZERO_MTA_OR_MTC" );
113         if(triggerSimulator->GetBBA())                  SetInput( "0VBA" );
114         if(triggerSimulator->GetBBC())                  SetInput( "0VBC" );
115         if(triggerSimulator->GetBGAorBGC())             SetInput( "VZERO_BGA_OR_BGC" );
116         if(triggerSimulator->GetBeamGas())              SetInput( "VZERO_BEAMGAS" );
117
118         // The following are kept for compatibility with the CTP configuration file. Will have to be removed at some point
119         if(triggerSimulator->GetBBAandBBC())    SetInput( "VZERO_AND" );
120         if(triggerSimulator->GetBBAorBBC())             SetInput( "VZERO_OR" );
121
122   return;
123 }
124
125
126