Trigger input names as in CTP
[u/mrichter/AliRoot.git] / AD / ADrec / AliADTrigger.cxx
CommitLineData
5e319bd5 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: AliADTrigger.cxx 49869 2011-05-18 04:49:51Z hristov $ */
16// ---------------------
17// Class AliADTrigger
18// ---------------------
19// Top class to simulate the AD trigger response
20// This class is only used for interface with AliTriggerDetector
21// Its create and Set Inputs of the CTP
22//
23
24
25#include <TClonesArray.h>
26#include <TTree.h>
27
28#include "AliRun.h"
29#include "AliLoader.h"
30#include "AliLog.h"
31#include "AliRunLoader.h"
32#include "AliTriggerInput.h"
33
34#include "AliADdigit.h"
35#include "AliADTrigger.h"
2cbbb1d5 36#include "AliADTriggerSimulator.h"
5e319bd5 37
38//______________________________________________________________________
39ClassImp(AliADTrigger)
40
41//______________________________________________________________________
42
43AliADTrigger::AliADTrigger():AliTriggerDetector()
44{
45 SetName("AD");
46 CreateInputs();
47}
48//______________________________________________________________________
49void AliADTrigger::CreateInputs()
50{
51 // Do not create inputs again!!
52 if( fInputs.GetEntriesFast() > 0 ) return;
53
2cbbb1d5 54 fInputs.AddLast( new AliTriggerInput( "AD_BBA_AND_BBC", "AD", 0 ) );
55 fInputs.AddLast( new AliTriggerInput( "AD_BBA_OR_BBC","AD", 0 ) );
56 fInputs.AddLast( new AliTriggerInput( "AD_BGA_AND_BBC", "AD", 0 ) );
13ecea20 57 fInputs.AddLast( new AliTriggerInput( "0UGA", "AD", 0 ) );
2cbbb1d5 58 fInputs.AddLast( new AliTriggerInput( "AD_BGC_AND_BBA", "AD", 0 ) );
13ecea20 59 fInputs.AddLast( new AliTriggerInput( "0UGC", "AD", 0 ) );
2cbbb1d5 60 fInputs.AddLast( new AliTriggerInput( "AD_CTA1_AND_CTC1", "AD", 0 ) );
61 fInputs.AddLast( new AliTriggerInput( "AD_CTA1_OR_CTC1", "AD", 0 ) );
62 fInputs.AddLast( new AliTriggerInput( "AD_CTA2_AND_CTC2", "AD", 0 ) );
63 fInputs.AddLast( new AliTriggerInput( "AD_CTA2_OR_CTC2", "AD", 0 ) );
64 fInputs.AddLast( new AliTriggerInput( "AD_MTA_AND_MTC", "AD", 0 ) );
65 fInputs.AddLast( new AliTriggerInput( "AD_MTA_OR_MTC", "AD", 0 ) );
13ecea20 66 fInputs.AddLast( new AliTriggerInput( "0UBA", "AD", 0 ) );
67 fInputs.AddLast( new AliTriggerInput( "0UBC", "AD", 0 ) );
2cbbb1d5 68 fInputs.AddLast( new AliTriggerInput( "AD_BGA_OR_BGC", "AD", 0 ) );
69 fInputs.AddLast( new AliTriggerInput( "AD_BEAMGAS", "AD", 0 ) );
5e319bd5 70}
71
72//______________________________________________________________________
73void AliADTrigger::Trigger()
74{
75 // ********** Get run loader for the current event **********
76 AliRunLoader* runLoader = AliRunLoader::Instance();
77
78 AliLoader* loader = runLoader->GetLoader( "ADLoader" );
79
80 if(!loader) {
81 AliError("Can not get AD loader");
82 return;
83 }
84 loader->LoadDigits("update");
2cbbb1d5 85 TTree* ADDigitsTree = loader->TreeD();
5e319bd5 86
2cbbb1d5 87 if (!ADDigitsTree) {
5e319bd5 88 AliError("Can not get the AD digit tree");
89 return;
90 }
2cbbb1d5 91 TClonesArray* ADDigits = NULL;
92 TBranch* digitBranch = ADDigitsTree->GetBranch("ADDigit");
93 digitBranch->SetAddress(&ADDigits);
5e319bd5 94
2cbbb1d5 95 AliADTriggerSimulator * triggerSimulator = new AliADTriggerSimulator(ADDigitsTree,ADDigits);
96 triggerSimulator->Run();
97
98 loader->WriteDigits("OVERWRITE");
5e319bd5 99 loader->UnloadDigits();
100
2cbbb1d5 101 if(triggerSimulator->GetBBAandBBC()) SetInput( "AD_BBA_AND_BBC" );
102 if(triggerSimulator->GetBBAorBBC()) SetInput( "AD_BBA_OR_BBC" );
103 if(triggerSimulator->GetBGAandBBC()) SetInput( "AD_BGA_AND_BBC" );
13ecea20 104 if(triggerSimulator->GetBGA()) SetInput( "0UGA" );
2cbbb1d5 105 if(triggerSimulator->GetBGCandBBA()) SetInput( "AD_BGC_AND_BBA" );
13ecea20 106 if(triggerSimulator->GetBGC()) SetInput( "0UGC" );
2cbbb1d5 107 if(triggerSimulator->GetCTA1andCTC1()) SetInput( "AD_CTA1_AND_CTC1" );
108 if(triggerSimulator->GetCTA1orCTC1()) SetInput( "AD_CTA1_OR_CTC1" );
109 if(triggerSimulator->GetCTA2andCTC2()) SetInput( "AD_CTA2_AND_CTC2" );
110 if(triggerSimulator->GetCTA1orCTC1()) SetInput( "AD_CTA1_OR_CTC1" );
111 if(triggerSimulator->GetMTAandMTC()) SetInput( "AD_MTA_AND_MTC" );
112 if(triggerSimulator->GetMTAorMTC()) SetInput( "AD_MTA_OR_MTC" );
13ecea20 113 if(triggerSimulator->GetBBA()) SetInput( "0UBA" );
114 if(triggerSimulator->GetBBC()) SetInput( "0UBC" );
2cbbb1d5 115 if(triggerSimulator->GetBGAorBGC()) SetInput( "AD_BGA_OR_BGC" );
116 if(triggerSimulator->GetBeamGas()) SetInput( "AD_BEAMGAS" );
5e319bd5 117
118 return;
119}
120
121
122