]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROTrigger.cxx
Coverity fixes.
[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>
27
360938ba 28#include "AliRun.h"
29#include "AliRunLoader.h"
fad64858 30#include "AliTriggerInput.h"
360938ba 31
fad64858 32#include "AliVZEROdigit.h"
33#include "AliVZEROTriggerSimulator.h"
360938ba 34#include "AliVZEROTrigger.h"
35
36//______________________________________________________________________
37ClassImp(AliVZEROTrigger)
360938ba 38
39//______________________________________________________________________
a055ee24 40
fad64858 41AliVZEROTrigger::AliVZEROTrigger():AliTriggerDetector()
360938ba 42{
43 SetName("VZERO");
44 CreateInputs();
360938ba 45}
360938ba 46//______________________________________________________________________
47void AliVZEROTrigger::CreateInputs()
48{
fad64858 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 ) );
11b1e8cb 55 fInputs.AddLast( new AliTriggerInput( "0VGA", "VZERO", 0 ) );
fad64858 56 fInputs.AddLast( new AliTriggerInput( "VZERO_BGC_AND_BBA", "VZERO", 0 ) );
11b1e8cb 57 fInputs.AddLast( new AliTriggerInput( "0VGC", "VZERO", 0 ) );
fad64858 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 ) );
11b1e8cb 64 fInputs.AddLast( new AliTriggerInput( "0VBA", "VZERO", 0 ) );
65 fInputs.AddLast( new AliTriggerInput( "0VBC", "VZERO", 0 ) );
fad64858 66 fInputs.AddLast( new AliTriggerInput( "VZERO_BGA_OR_BGC", "VZERO", 0 ) );
67 fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS", "VZERO", 0 ) );
7bd4d308 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 ) );
360938ba 72}
73
74//______________________________________________________________________
75void AliVZEROTrigger::Trigger()
76{
360938ba 77 // ********** Get run loader for the current event **********
fad64858 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 }
d0ff6548 86 loader->LoadDigits("update");
fad64858 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
d0ff6548 99
fad64858 100 triggerSimulator->Run();
101
d0ff6548 102 loader->WriteDigits("OVERWRITE");
103 loader->UnloadDigits();
104
fad64858 105 if(triggerSimulator->GetBBAandBBC()) SetInput( "VZERO_BBA_AND_BBC" );
106 if(triggerSimulator->GetBBAorBBC()) SetInput( "VZERO_BBA_OR_BBC" );
107 if(triggerSimulator->GetBGAandBBC()) SetInput( "VZERO_BGA_AND_BBC" );
11b1e8cb 108 if(triggerSimulator->GetBGA()) SetInput( "0VGA" );
fad64858 109 if(triggerSimulator->GetBGCandBBA()) SetInput( "VZERO_BGC_AND_BBA" );
11b1e8cb 110 if(triggerSimulator->GetBGC()) SetInput( "0VGC" );
fad64858 111 if(triggerSimulator->GetCTA1andCTC1()) SetInput( "VZERO_CTA1_AND_CTC1" );
112 if(triggerSimulator->GetCTA1orCTC1()) SetInput( "VZERO_CTA1_OR_CTC1" );
113 if(triggerSimulator->GetCTA2andCTC2()) SetInput( "VZERO_CTA2_AND_CTC2" );
114 if(triggerSimulator->GetCTA1orCTC1()) SetInput( "VZERO_CTA1_OR_CTC1" );
115 if(triggerSimulator->GetMTAandMTC()) SetInput( "VZERO_MTA_AND_MTC" );
116 if(triggerSimulator->GetMTAorMTC()) SetInput( "VZERO_MTA_OR_MTC" );
11b1e8cb 117 if(triggerSimulator->GetBBA()) SetInput( "0VBA" );
118 if(triggerSimulator->GetBBC()) SetInput( "0VBC" );
fad64858 119 if(triggerSimulator->GetBGAorBGC()) SetInput( "VZERO_BGA_OR_BGC" );
120 if(triggerSimulator->GetBeamGas()) SetInput( "VZERO_BEAMGAS" );
360938ba 121
7bd4d308 122 // The following are kept for compatibility with the CTP configuration file. Will have to be removed at some point
11b1e8cb 123 if(triggerSimulator->GetBBAandBBC()) SetInput( "VZERO_AND" );
124 if(triggerSimulator->GetBBAorBBC()) SetInput( "VZERO_OR" );
7bd4d308 125
360938ba 126 return;
127}
128
7bd4d308 129
e370cdfe 130