Line data Source code
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"
36 : #include "AliADTriggerSimulator.h"
37 :
38 : //______________________________________________________________________
39 16 : ClassImp(AliADTrigger)
40 :
41 : //______________________________________________________________________
42 :
43 0 : AliADTrigger::AliADTrigger():AliTriggerDetector()
44 0 : {
45 0 : SetName("AD");
46 0 : CreateInputs();
47 0 : }
48 : //______________________________________________________________________
49 : void AliADTrigger::CreateInputs()
50 : {
51 : // Do not create inputs again!!
52 0 : if( fInputs.GetEntriesFast() > 0 ) return;
53 :
54 0 : fInputs.AddLast( new AliTriggerInput( "AD_BBA_AND_BBC", "AD", 0 ) );
55 0 : fInputs.AddLast( new AliTriggerInput( "AD_BBA_OR_BBC","AD", 0 ) );
56 0 : fInputs.AddLast( new AliTriggerInput( "AD_BGA_AND_BBC", "AD", 0 ) );
57 0 : fInputs.AddLast( new AliTriggerInput( "0UGA", "AD", 0 ) );
58 0 : fInputs.AddLast( new AliTriggerInput( "AD_BGC_AND_BBA", "AD", 0 ) );
59 0 : fInputs.AddLast( new AliTriggerInput( "0UGC", "AD", 0 ) );
60 0 : fInputs.AddLast( new AliTriggerInput( "AD_CTA1_AND_CTC1", "AD", 0 ) );
61 0 : fInputs.AddLast( new AliTriggerInput( "AD_CTA1_OR_CTC1", "AD", 0 ) );
62 0 : fInputs.AddLast( new AliTriggerInput( "AD_CTA2_AND_CTC2", "AD", 0 ) );
63 0 : fInputs.AddLast( new AliTriggerInput( "AD_CTA2_OR_CTC2", "AD", 0 ) );
64 0 : fInputs.AddLast( new AliTriggerInput( "AD_MTA_AND_MTC", "AD", 0 ) );
65 0 : fInputs.AddLast( new AliTriggerInput( "AD_MTA_OR_MTC", "AD", 0 ) );
66 0 : fInputs.AddLast( new AliTriggerInput( "0UBA", "AD", 0 ) );
67 0 : fInputs.AddLast( new AliTriggerInput( "0UBC", "AD", 0 ) );
68 0 : fInputs.AddLast( new AliTriggerInput( "AD_BGA_OR_BGC", "AD", 0 ) );
69 0 : fInputs.AddLast( new AliTriggerInput( "AD_BEAMGAS", "AD", 0 ) );
70 0 : }
71 :
72 : //______________________________________________________________________
73 : void AliADTrigger::Trigger()
74 : {
75 : // ********** Get run loader for the current event **********
76 0 : AliRunLoader* runLoader = AliRunLoader::Instance();
77 :
78 0 : AliLoader* loader = runLoader->GetLoader( "ADLoader" );
79 :
80 0 : if(!loader) {
81 0 : AliError("Can not get AD loader");
82 0 : return;
83 : }
84 0 : loader->LoadDigits("update");
85 0 : TTree* ADDigitsTree = loader->TreeD();
86 :
87 0 : if (!ADDigitsTree) {
88 0 : AliError("Can not get the AD digit tree");
89 0 : return;
90 : }
91 0 : TClonesArray* ADDigits = NULL;
92 0 : TBranch* digitBranch = ADDigitsTree->GetBranch("ADDigit");
93 0 : digitBranch->SetAddress(&ADDigits);
94 :
95 0 : AliADTriggerSimulator * triggerSimulator = new AliADTriggerSimulator(ADDigitsTree,ADDigits);
96 0 : triggerSimulator->Run();
97 :
98 0 : loader->WriteDigits("OVERWRITE");
99 0 : loader->UnloadDigits();
100 :
101 0 : if(triggerSimulator->GetBBAandBBC()) SetInput( "AD_BBA_AND_BBC" );
102 0 : if(triggerSimulator->GetBBAorBBC()) SetInput( "AD_BBA_OR_BBC" );
103 0 : if(triggerSimulator->GetBGAandBBC()) SetInput( "AD_BGA_AND_BBC" );
104 0 : if(triggerSimulator->GetBGA()) SetInput( "0UGA" );
105 0 : if(triggerSimulator->GetBGCandBBA()) SetInput( "AD_BGC_AND_BBA" );
106 0 : if(triggerSimulator->GetBGC()) SetInput( "0UGC" );
107 0 : if(triggerSimulator->GetCTA1andCTC1()) SetInput( "AD_CTA1_AND_CTC1" );
108 0 : if(triggerSimulator->GetCTA1orCTC1()) SetInput( "AD_CTA1_OR_CTC1" );
109 0 : if(triggerSimulator->GetCTA2andCTC2()) SetInput( "AD_CTA2_AND_CTC2" );
110 0 : if(triggerSimulator->GetCTA1orCTC1()) SetInput( "AD_CTA1_OR_CTC1" );
111 0 : if(triggerSimulator->GetMTAandMTC()) SetInput( "AD_MTA_AND_MTC" );
112 0 : if(triggerSimulator->GetMTAorMTC()) SetInput( "AD_MTA_OR_MTC" );
113 0 : if(triggerSimulator->GetBBA()) SetInput( "0UBA" );
114 0 : if(triggerSimulator->GetBBC()) SetInput( "0UBC" );
115 0 : if(triggerSimulator->GetBGAorBGC()) SetInput( "AD_BGA_OR_BGC" );
116 0 : if(triggerSimulator->GetBeamGas()) SetInput( "AD_BEAMGAS" );
117 :
118 : return;
119 0 : }
120 :
121 :
122 :
|