]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROTrigger.cxx
changed sixe of fOutputContainer
[u/mrichter/AliRoot.git] / VZERO / AliVZEROTrigger.cxx
CommitLineData
360938ba 1#include "AliRun.h"
2#include "AliRunLoader.h"
3
4#include "AliVZEROTrigger.h"
5
6//______________________________________________________________________
7ClassImp(AliVZEROTrigger)
8////////////////////////////////////////////////////////////////////////
9//
10// Version 1
11//
12// AliVZEROTrigger:
13//
14////////////////////////////////////////////////////////////////////////
15
16//______________________________________________________________________
17AliVZEROTrigger::AliVZEROTrigger()
0b2bea8b 18 :AliTriggerDetector(),
19 fAdcThresHold(0.0),
20 fTimeWindowWidth(50.0)
21
360938ba 22{
23 SetName("VZERO");
24 CreateInputs();
25
26 SetAdcThreshold();
0b2bea8b 27 SetTimeWindowWidth();
360938ba 28}
29
30//______________________________________________________________________
31void AliVZEROTrigger::CreateInputs()
32{
33 // inputs
34
35 // Do not create inputs again!!
36 if( fInputs.GetEntriesFast() > 0 ) return;
37
38 fInputs.AddLast( new AliTriggerInput( "VZERO_LEFT", "At least one hit in the left VZERO", 0x01 ) );
39 fInputs.AddLast( new AliTriggerInput( "VZERO_RIGHT","At least one hit in the right VZERO", 0x02 ) );
b9d46458 40 fInputs.AddLast( new AliTriggerInput( "VZERO_AND", "At least one hit in the each (left and right) VZERO", 0x04 ) );
41 fInputs.AddLast( new AliTriggerInput( "VZERO_OR", "At least one hit in the one (left one right) VZERO", 0x08 ) );
360938ba 42
b9d46458 43 fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS", "Beam gas VZERO trigger ", 0x010 ) );
360938ba 44}
45
46//______________________________________________________________________
47void AliVZEROTrigger::Trigger()
48{
49
50 // ********** Get run loader for the current event **********
51 AliRunLoader* runLoader = gAlice->GetRunLoader();
52
53 AliVZEROLoader* loader = (AliVZEROLoader* )runLoader->GetLoader( "VZEROLoader" );
54
55 loader->LoadDigits("READ");
56 TTree* vzeroDigitsTree = loader->TreeD();
698b2e52 57 if (!vzeroDigitsTree) return;
360938ba 58
59 TClonesArray* vzeroDigits = new TClonesArray("AliVZEROdigit",1000);
60 TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
61 digitBranch->SetAddress(&vzeroDigits);
62
63 // number of hits in left/right
64 Int_t nLeftDig = 0;
65 Int_t nRightDig = 0;
66
67 // first time
0b2bea8b 68 Float_t firstTimeLeft = 9999.0;
69 Float_t firstTimeRight = 9999.0;
70 Float_t TimeHalfWidth = fTimeWindowWidth/2.0;
2ff50a8f 71
360938ba 72 // loop over vzero entries
73 Int_t nEntries = (Int_t)vzeroDigitsTree->GetEntries();
74 for (Int_t e=0; e<nEntries; e++) {
75 vzeroDigitsTree->GetEvent(e);
76
77 Int_t nDigits = vzeroDigits->GetEntriesFast();
78
79 for (Int_t d=0; d<nDigits; d++) {
dcace375 80 // vzeroDigitsTree->GetEvent(d);
360938ba 81 AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(d);
82
20277079 83 Int_t PMNumber = digit->PMNumber();
360938ba 84 Float_t adc = digit->ADC();
85 Float_t tdc = digit->Time(); // in 100 of picoseconds
86
20277079 87 if (PMNumber<=31 && adc>fAdcThresHold) {
c299dbe4 88 if (tdc>(29.0-TimeHalfWidth) && tdc<(29.0+TimeHalfWidth)) nRightDig++;
0b2bea8b 89 if (tdc<firstTimeRight) firstTimeRight = tdc;
90 }
91 if (PMNumber>=32 && adc>fAdcThresHold) {
c299dbe4 92 if (tdc>(112.0-TimeHalfWidth) && tdc<(112.0+TimeHalfWidth)) nLeftDig++;
360938ba 93 if (tdc<firstTimeLeft) firstTimeLeft = tdc;
94 }
0b2bea8b 95
360938ba 96 } // end of loop over digits
97 } // end of loop over events in digits tree
98
99 // Beam gas trigger set from the time difference. The time it takes
100 // to travel between the two counters is ~14.3 ns = 143 * 100 ps.
101 // NB: this should be defined
102 // from time windows relative to the time of the bunch crossing!
103 // beam gas comming from the left ...
104
105 if (TMath::Abs(TMath::Abs(firstTimeLeft - firstTimeRight)-143) < 20) // time window of 2 ns
106 SetInput( "VZERO_BEAMGAS" );
107
108 if (nLeftDig > 0)
0b2bea8b 109 SetInput( "VZERO_LEFT" );
360938ba 110
111 if (nRightDig > 0)
0b2bea8b 112 SetInput( "VZERO_RIGHT" );
360938ba 113
114 if (nLeftDig>0 || nRightDig>0) {
0b2bea8b 115 SetInput( "VZERO_OR" );
360938ba 116
117 if (nLeftDig>0 && nRightDig>0) {
0b2bea8b 118 SetInput( "VZERO_AND" );
360938ba 119 }
120 }
121
2ff50a8f 122 AliDebug(1,Form("VZERO PMs fired: %d (left) %d (right)", nLeftDig, nRightDig));
123
360938ba 124 return;
125}
126
127