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();
54 TClonesArray* vzeroDigits = new TClonesArray("AliVZEROdigit",1000);
55 TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
56 digitBranch->SetAddress(&vzeroDigits);
58 // number of hits in left/right
63 Float_t firstTimeLeft = 9999;
64 Float_t firstTimeRight = 9999;
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);
71 Int_t nDigits = vzeroDigits->GetEntriesFast();
73 for (Int_t d=0; d<nDigits; d++) {
74 vzeroDigitsTree->GetEvent(d);
75 AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(d);
77 Int_t cellNumber = digit->CellNumber();
78 Float_t adc = digit->ADC();
79 Float_t tdc = digit->Time(); // in 100 of picoseconds
81 if (cellNumber<=47 && adc>fAdcThresHold) {
83 if (tdc<firstTimeLeft) firstTimeLeft = tdc;
85 if (cellNumber>=48 && adc>fAdcThresHold) {
87 if (tdc<firstTimeRight) firstTimeRight = tdc;
89 } // end of loop over digits
90 } // end of loop over events in digits tree
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 ...
98 if (TMath::Abs(TMath::Abs(firstTimeLeft - firstTimeRight)-143) < 20) // time window of 2 ns
99 SetInput( "VZERO_BEAMGAS" );
102 SetInput( "VZERO_LEFT" );
105 SetInput( "VZERO_RIGHT" );
107 if (nLeftDig>0 || nRightDig>0) {
108 SetInput( "VZERO_OR" );
110 if (nLeftDig>0 && nRightDig>0) {
111 SetInput( "VZERO_AND" );
115 AliDebug(1,Form("VZERO cells fired: %d (left) %d (right)", nLeftDig, nRightDig));