2 #include "AliRunLoader.h"
4 #include "AliVZEROTrigger.h"
6 //______________________________________________________________________
7 ClassImp(AliVZEROTrigger)
8 ////////////////////////////////////////////////////////////////////////
14 ////////////////////////////////////////////////////////////////////////
16 //______________________________________________________________________
17 AliVZEROTrigger::AliVZEROTrigger()
18 : AliTriggerDetector()
26 //______________________________________________________________________
27 void AliVZEROTrigger::CreateInputs()
31 // Do not create inputs again!!
32 if( fInputs.GetEntriesFast() > 0 ) return;
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 ) );
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 ) );
39 fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS", "Beam gas VZERO trigger ", 0x010 ) );
42 //______________________________________________________________________
43 void AliVZEROTrigger::Trigger()
46 // ********** Get run loader for the current event **********
47 AliRunLoader* runLoader = gAlice->GetRunLoader();
49 AliVZEROLoader* loader = (AliVZEROLoader* )runLoader->GetLoader( "VZEROLoader" );
51 loader->LoadDigits("READ");
52 TTree* vzeroDigitsTree = loader->TreeD();
53 if (!vzeroDigitsTree) return;
55 TClonesArray* vzeroDigits = new TClonesArray("AliVZEROdigit",1000);
56 TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
57 digitBranch->SetAddress(&vzeroDigits);
59 // number of hits in left/right
64 Float_t firstTimeLeft = 9999;
65 Float_t firstTimeRight = 9999;
67 // loop over vzero entries
68 Int_t nEntries = (Int_t)vzeroDigitsTree->GetEntries();
69 for (Int_t e=0; e<nEntries; e++) {
70 vzeroDigitsTree->GetEvent(e);
72 Int_t nDigits = vzeroDigits->GetEntriesFast();
74 for (Int_t d=0; d<nDigits; d++) {
75 // vzeroDigitsTree->GetEvent(d);
76 AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(d);
78 Int_t cellNumber = digit->CellNumber();
79 Float_t adc = digit->ADC();
80 Float_t tdc = digit->Time(); // in 100 of picoseconds
82 if (cellNumber<=47 && adc>fAdcThresHold) {
84 if (tdc<firstTimeLeft) firstTimeLeft = tdc;
86 if (cellNumber>=48 && adc>fAdcThresHold) {
88 if (tdc<firstTimeRight) firstTimeRight = tdc;
90 } // end of loop over digits
91 } // end of loop over events in digits tree
93 // Beam gas trigger set from the time difference. The time it takes
94 // to travel between the two counters is ~14.3 ns = 143 * 100 ps.
95 // NB: this should be defined
96 // from time windows relative to the time of the bunch crossing!
97 // beam gas comming from the left ...
99 if (TMath::Abs(TMath::Abs(firstTimeLeft - firstTimeRight)-143) < 20) // time window of 2 ns
100 SetInput( "VZERO_BEAMGAS" );
103 SetInput( "VZERO_LEFT" );
106 SetInput( "VZERO_RIGHT" );
108 if (nLeftDig>0 || nRightDig>0) {
109 SetInput( "VZERO_OR" );
111 if (nLeftDig>0 && nRightDig>0) {
112 SetInput( "VZERO_AND" );
116 AliDebug(1,Form("VZERO cells fired: %d (left) %d (right)", nLeftDig, nRightDig));