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 **************************************************************************/
18 #include <TClonesArray.h>
21 #include "AliRunLoader.h"
23 #include "AliVZEROTrigger.h"
24 #include "AliVZEROTriggerMask.h"
26 //______________________________________________________________________
27 ClassImp(AliVZEROTrigger)
28 ////////////////////////////////////////////////////////////////////////
34 ////////////////////////////////////////////////////////////////////////
36 //______________________________________________________________________
38 AliVZEROTrigger::AliVZEROTrigger()
39 :AliTriggerDetector(),
41 fTimeWindowWidthBBA(50.0),
42 fTimeWindowWidthBGA(20.0),
43 fTimeWindowWidthBBC(50.0),
44 fTimeWindowWidthBGC(20.0)
52 //______________________________________________________________________
53 void AliVZEROTrigger::CreateInputs()
57 // Do not create inputs again!!
58 if( fInputs.GetEntriesFast() > 0 ) return;
60 fInputs.AddLast( new AliTriggerInput( "VZERO_LEFT", "VZERO", 0 ) );
61 fInputs.AddLast( new AliTriggerInput( "VZERO_RIGHT","VZERO", 0 ) );
62 fInputs.AddLast( new AliTriggerInput( "VZERO_AND", "VZERO", 0 ) );
63 fInputs.AddLast( new AliTriggerInput( "VZERO_OR", "VZERO", 0 ) );
64 fInputs.AddLast( new AliTriggerInput( "VZERO_BEAMGAS", "VZERO", 0 ) );
67 //______________________________________________________________________
68 void AliVZEROTrigger::Trigger()
71 // ********** Get run loader for the current event **********
72 AliRunLoader* runLoader = AliRunLoader::Instance();
74 AliVZEROLoader* loader =
75 (AliVZEROLoader* )runLoader->GetLoader( "VZEROLoader" );
77 loader->LoadDigits("READ");
78 TTree* vzeroDigitsTree = loader->TreeD();
79 if (!vzeroDigitsTree) return;
81 TClonesArray* vzeroDigits = new TClonesArray("AliVZEROdigit",1000);
82 TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
83 digitBranch->SetAddress(&vzeroDigits);
85 AliVZEROTriggerMask *TriggerMask = new AliVZEROTriggerMask();
86 TriggerMask->SetAdcThreshold(fAdcThresHold);
87 TriggerMask->SetTimeWindowWidthBBA(fTimeWindowWidthBBA);
88 TriggerMask->SetTimeWindowWidthBGA(fTimeWindowWidthBGA);
89 TriggerMask->SetTimeWindowWidthBBC(fTimeWindowWidthBBC);
90 TriggerMask->SetTimeWindowWidthBGC(fTimeWindowWidthBGC);
91 TriggerMask->FillMasks(vzeroDigitsTree,vzeroDigits);
93 if ( (TriggerMask->GetBGtriggerV0A()>0) ||
94 (TriggerMask->GetBGtriggerV0C()>0)) SetInput( "VZERO_BEAMGAS" );
95 if (TriggerMask->GetBBtriggerV0A()>0) SetInput( "VZERO_LEFT" );
96 if (TriggerMask->GetBBtriggerV0C()>0) SetInput( "VZERO_RIGHT" );
97 if ( (TriggerMask->GetBBtriggerV0A()>0) ||
98 (TriggerMask->GetBBtriggerV0C()>0)) SetInput( "VZERO_OR" );
99 if ( (TriggerMask->GetBBtriggerV0A()>0) &&
100 (TriggerMask->GetBBtriggerV0C()>0)) SetInput( "VZERO_AND" );