]> git.uio.no Git - u/mrichter/AliRoot.git/blame - T0/AliT0Trigger.cxx
removed warnings
[u/mrichter/AliRoot.git] / T0 / AliT0Trigger.cxx
CommitLineData
dc7ca31d 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
e358e301 17/***************************************************************
18 * T0 trigger class for T0 trigger signals:
19 * - T0A
20 * - T0C
21 * - T0vertex
22 * - T0 semi central event for ions
23 * - T0 central for ions
24 ****************************************************************/
25
dc7ca31d 26
dc7ca31d 27#include "AliLog.h"
28#include "AliRun.h"
29#include "AliRunLoader.h"
30#include "AliTriggerInput.h"
539b9cb9 31#include "AliT0Parameters.h"
32#include "AliT0TriggerParameters.h"
33#include <AliCDBManager.h>
34#include <AliCDBEntry.h>
35#include <AliCDBStorage.h>
dc7ca31d 36
37#include "AliT0.h"
dc7ca31d 38#include "AliT0digit.h"
39#include "AliT0Trigger.h"
40
539b9cb9 41#include "Riostream.h"
42
dc7ca31d 43//----------------------------------------------------------------------
44ClassImp(AliT0Trigger)
45
46//----------------------------------------------------------------------
47AliT0Trigger::AliT0Trigger()
ea276330 48 : AliTriggerDetector(),
49 fT0(0x0),
50 fDigits(0x0)
dc7ca31d 51{
52 SetName("T0");
53 CreateInputs();
539b9cb9 54 AliCDBManager *stor =AliCDBManager::Instance();
55 //time equalizing
56 AliCDBEntry* fCalibentry = stor->Get("T0/Calib/TriggerParam");
57 if (fCalibentry)
58 fTrigPar = (AliT0TriggerParameters*)fCalibentry->GetObject();
59 else {
60 AliWarning(" No trigger parameters in CDB , use default");
61 }
62
dc7ca31d 63}
64
65//----------------------------------------------------------------------
66void AliT0Trigger::CreateInputs()
67{
68 // inputs
539b9cb9 69
dc7ca31d 70 // Do not create inputs again!!
71 if( fInputs.GetEntriesFast() > 0 ) return;
72
572b6f20 73 fInputs.AddLast( new AliTriggerInput( "T0_A_L0", "T0", 0 ) );
74 fInputs.AddLast( new AliTriggerInput( "T0_C_L0", "T0", 0 ) );
75 fInputs.AddLast( new AliTriggerInput( "T0_Vertex_L0", "T0", 0 ) );
76 fInputs.AddLast( new AliTriggerInput( "T0_Centr_L0", "T0", 0 ) );
77 fInputs.AddLast( new AliTriggerInput( "T0_SemiCentral_L0", "T0", 0 ) );
539b9cb9 78
dc7ca31d 79}
80
81//----------------------------------------------------------------------
82void AliT0Trigger::Trigger()
83{
e358e301 84 // trigger input
85
33c3c91a 86 AliRunLoader* runLoader = AliRunLoader::Instance();
dc7ca31d 87 AliLoader * fT0Loader = runLoader->GetLoader("T0Loader");
88 // AliT0digit *fDigits;
89 fT0Loader->LoadDigits("READ");
90 // Creating T0 data container
91
92 TTree* treeD = fT0Loader->TreeD();
93 if (!treeD) {
94 AliError("no digits tree");
95 return;
96 }
c2337900 97 fDigits = new AliT0digit();
dc7ca31d 98
99 TBranch *brDigits = treeD->GetBranch("T0");
100 if (brDigits) {
101 brDigits->SetAddress(&fDigits);
102 }else{
103 AliError("Branch T0 DIGIT not found");
104 return;
105 }
106 brDigits->GetEntry(0);
c41ceaac 107 Int_t besttimeA = fDigits->BestTimeA();
108 Int_t besttimeC = fDigits->BestTimeC();
dc7ca31d 109 Int_t timeDiff = fDigits->TimeDiff();
110 Int_t sumMult= fDigits->SumMult();
111
539b9cb9 112 //trigger parameteres
113
114 Float_t timeWindowLow = fTrigPar->GetTimeWindowLow();
115 Float_t timeWindowHigh = fTrigPar->GetTimeWindowHigh();
116 Int_t ampCentr = fTrigPar->GetAmpCentr();
117 Int_t ampSemiCentr = fTrigPar->GetAmpSemiCentr();
118
119 if (besttimeA > 0 && besttimeA <99999) SetInput("T0_A_L0");
120 if (besttimeC > 0 && besttimeC<99999) SetInput("T0_C_L0");
ea276330 121 //6093 corrsponds to vertex -20cm, 6202 vertex +20 with delay 150nc eqalized on the TVDC unit
539b9cb9 122 if (timeDiff >timeWindowLow && timeDiff < timeWindowHigh) SetInput("T0_Vertex_L0");
123 if (sumMult > ampCentr) SetInput("T0_Centr_L0");
124 if (sumMult> ampSemiCentr && sumMult <= ampCentr) SetInput("T0_SemiCentral_L0");;
dc7ca31d 125
126
127}