1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
26 #include <TClonesArray.h>
30 #include "AliLoader.h"
32 #include "AliRunLoader.h"
33 #include "AliTriggerInput.h"
35 #include "AliVZEROdigit.h"
36 #include "AliVZEROTriggerSimulator.h"
37 #include "AliVZEROTrigger.h"
39 //______________________________________________________________________
40 ClassImp(AliVZEROTrigger)
42 //______________________________________________________________________
44 AliVZEROTrigger::AliVZEROTrigger():AliTriggerDetector()
49 //______________________________________________________________________
50 void AliVZEROTrigger::CreateInputs()
52 // Do not create inputs again!!
53 if( fInputs.GetEntriesFast() > 0 ) return;
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 ) );
58 fInputs.AddLast( new AliTriggerInput( "0VGA", "VZERO", 0 ) );
59 fInputs.AddLast( new AliTriggerInput( "VZERO_BGC_AND_BBA", "VZERO", 0 ) );
60 fInputs.AddLast( new AliTriggerInput( "0VGC", "VZERO", 0 ) );
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 ) );
67 fInputs.AddLast( new AliTriggerInput( "0VBA", "VZERO", 0 ) );
68 fInputs.AddLast( new AliTriggerInput( "0VBC", "VZERO", 0 ) );
69 fInputs.AddLast( new AliTriggerInput( "VZERO_BGA_OR_BGC", "VZERO", 0 ) );
70 fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS", "VZERO", 0 ) );
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 ) );
77 //______________________________________________________________________
78 void AliVZEROTrigger::Trigger()
80 // ********** Get run loader for the current event **********
81 AliRunLoader* runLoader = AliRunLoader::Instance();
83 AliLoader* loader = runLoader->GetLoader( "VZEROLoader" );
86 AliError("Can not get VZERO loader");
89 loader->LoadDigits("update");
90 TTree* vzeroDigitsTree = loader->TreeD();
92 if (!vzeroDigitsTree) {
93 AliError("Can not get the VZERO digit tree");
96 TClonesArray* vzeroDigits = NULL;
97 TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
98 digitBranch->SetAddress(&vzeroDigits);
100 AliVZEROTriggerSimulator * triggerSimulator = new AliVZEROTriggerSimulator(vzeroDigitsTree,vzeroDigits);
103 triggerSimulator->Run();
105 loader->WriteDigits("OVERWRITE");
106 loader->UnloadDigits();
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" );
111 if(triggerSimulator->GetBGA()) SetInput( "0VGA" );
112 if(triggerSimulator->GetBGCandBBA()) SetInput( "VZERO_BGC_AND_BBA" );
113 if(triggerSimulator->GetBGC()) SetInput( "0VGC" );
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" );
120 if(triggerSimulator->GetBBA()) SetInput( "0VBA" );
121 if(triggerSimulator->GetBBC()) SetInput( "0VBC" );
122 if(triggerSimulator->GetBGAorBGC()) SetInput( "VZERO_BGA_OR_BGC" );
123 if(triggerSimulator->GetBeamGas()) SetInput( "VZERO_BEAMGAS" );
125 // The following are kept for compatibility with the CTP configuration file. Will have to be removed at some point
126 if(triggerSimulator->GetBBAandBBC()) SetInput( "VZERO_AND" );
127 if(triggerSimulator->GetBBAorBBC()) SetInput( "VZERO_OR" );