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