Fixes for the trunk: compilation on Lion (Yves)
[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 **************************************************************************/
7ca4655f 15/* $Id$ */
e370cdfe 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
7ca4655f 25
26#include <TClonesArray.h>
c93255fe 27#include <TTree.h>
7ca4655f 28
360938ba 29#include "AliRun.h"
c93255fe 30#include "AliLoader.h"
31#include "AliLog.h"
360938ba 32#include "AliRunLoader.h"
fad64858 33#include "AliTriggerInput.h"
360938ba 34
fad64858 35#include "AliVZEROdigit.h"
36#include "AliVZEROTriggerSimulator.h"
360938ba 37#include "AliVZEROTrigger.h"
38
39//______________________________________________________________________
40ClassImp(AliVZEROTrigger)
360938ba 41
42//______________________________________________________________________
a055ee24 43
fad64858 44AliVZEROTrigger::AliVZEROTrigger():AliTriggerDetector()
360938ba 45{
46 SetName("VZERO");
47 CreateInputs();
360938ba 48}
360938ba 49//______________________________________________________________________
50void AliVZEROTrigger::CreateInputs()
51{
fad64858 52 // Do not create inputs again!!
53 if( fInputs.GetEntriesFast() > 0 ) return;
54
55 fInputs.AddLast( new AliTriggerInput( "VZERO_BBA_AND_BBC", "VZERO", 0 ) );
56 fInputs.AddLast( new AliTriggerInput( "VZERO_BBA_OR_BBC","VZERO", 0 ) );
57 fInputs.AddLast( new AliTriggerInput( "VZERO_BGA_AND_BBC", "VZERO", 0 ) );
11b1e8cb 58 fInputs.AddLast( new AliTriggerInput( "0VGA", "VZERO", 0 ) );
fad64858 59 fInputs.AddLast( new AliTriggerInput( "VZERO_BGC_AND_BBA", "VZERO", 0 ) );
11b1e8cb 60 fInputs.AddLast( new AliTriggerInput( "0VGC", "VZERO", 0 ) );
fad64858 61 fInputs.AddLast( new AliTriggerInput( "VZERO_CTA1_AND_CTC1", "VZERO", 0 ) );
62 fInputs.AddLast( new AliTriggerInput( "VZERO_CTA1_OR_CTC1", "VZERO", 0 ) );
63 fInputs.AddLast( new AliTriggerInput( "VZERO_CTA2_AND_CTC2", "VZERO", 0 ) );
64 fInputs.AddLast( new AliTriggerInput( "VZERO_CTA2_OR_CTC2", "VZERO", 0 ) );
65 fInputs.AddLast( new AliTriggerInput( "VZERO_MTA_AND_MTC", "VZERO", 0 ) );
66 fInputs.AddLast( new AliTriggerInput( "VZERO_MTA_OR_MTC", "VZERO", 0 ) );
11b1e8cb 67 fInputs.AddLast( new AliTriggerInput( "0VBA", "VZERO", 0 ) );
68 fInputs.AddLast( new AliTriggerInput( "0VBC", "VZERO", 0 ) );
fad64858 69 fInputs.AddLast( new AliTriggerInput( "VZERO_BGA_OR_BGC", "VZERO", 0 ) );
70 fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS", "VZERO", 0 ) );
7bd4d308 71
72 // The following are kept for compatibility with the CTP configuration file. Will have to be removed at some point
73 fInputs.AddLast( new AliTriggerInput( "VZERO_AND", "VZERO", 0 ) );
74 fInputs.AddLast( new AliTriggerInput( "VZERO_OR","VZERO", 0 ) );
360938ba 75}
76
77//______________________________________________________________________
78void AliVZEROTrigger::Trigger()
79{
360938ba 80 // ********** Get run loader for the current event **********
fad64858 81 AliRunLoader* runLoader = AliRunLoader::Instance();
82
83 AliLoader* loader = runLoader->GetLoader( "VZEROLoader" );
84
85 if(!loader) {
86 AliError("Can not get VZERO loader");
87 return;
88 }
d0ff6548 89 loader->LoadDigits("update");
fad64858 90 TTree* vzeroDigitsTree = loader->TreeD();
91
92 if (!vzeroDigitsTree) {
93 AliError("Can not get the VZERO digit tree");
94 return;
95 }
96 TClonesArray* vzeroDigits = NULL;
97 TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
98 digitBranch->SetAddress(&vzeroDigits);
99
100 AliVZEROTriggerSimulator * triggerSimulator = new AliVZEROTriggerSimulator(vzeroDigitsTree,vzeroDigits);
101
d0ff6548 102
fad64858 103 triggerSimulator->Run();
104
d0ff6548 105 loader->WriteDigits("OVERWRITE");
106 loader->UnloadDigits();
107
fad64858 108 if(triggerSimulator->GetBBAandBBC()) SetInput( "VZERO_BBA_AND_BBC" );
109 if(triggerSimulator->GetBBAorBBC()) SetInput( "VZERO_BBA_OR_BBC" );
110 if(triggerSimulator->GetBGAandBBC()) SetInput( "VZERO_BGA_AND_BBC" );
11b1e8cb 111 if(triggerSimulator->GetBGA()) SetInput( "0VGA" );
fad64858 112 if(triggerSimulator->GetBGCandBBA()) SetInput( "VZERO_BGC_AND_BBA" );
11b1e8cb 113 if(triggerSimulator->GetBGC()) SetInput( "0VGC" );
fad64858 114 if(triggerSimulator->GetCTA1andCTC1()) SetInput( "VZERO_CTA1_AND_CTC1" );
115 if(triggerSimulator->GetCTA1orCTC1()) SetInput( "VZERO_CTA1_OR_CTC1" );
116 if(triggerSimulator->GetCTA2andCTC2()) SetInput( "VZERO_CTA2_AND_CTC2" );
117 if(triggerSimulator->GetCTA1orCTC1()) SetInput( "VZERO_CTA1_OR_CTC1" );
118 if(triggerSimulator->GetMTAandMTC()) SetInput( "VZERO_MTA_AND_MTC" );
119 if(triggerSimulator->GetMTAorMTC()) SetInput( "VZERO_MTA_OR_MTC" );
11b1e8cb 120 if(triggerSimulator->GetBBA()) SetInput( "0VBA" );
121 if(triggerSimulator->GetBBC()) SetInput( "0VBC" );
fad64858 122 if(triggerSimulator->GetBGAorBGC()) SetInput( "VZERO_BGA_OR_BGC" );
123 if(triggerSimulator->GetBeamGas()) SetInput( "VZERO_BEAMGAS" );
360938ba 124
7bd4d308 125 // The following are kept for compatibility with the CTP configuration file. Will have to be removed at some point
11b1e8cb 126 if(triggerSimulator->GetBBAandBBC()) SetInput( "VZERO_AND" );
127 if(triggerSimulator->GetBBAorBBC()) SetInput( "VZERO_OR" );
7bd4d308 128
360938ba 129 return;
130}
131
7bd4d308 132
e370cdfe 133