]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/AliT0Trigger.cxx
Restored optimization
[u/mrichter/AliRoot.git] / T0 / AliT0Trigger.cxx
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$ */
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
26
27 #include "AliLog.h"
28 #include "AliRun.h"
29 #include "AliRunLoader.h"
30 #include "AliTriggerInput.h"
31
32 #include "AliT0.h"
33 #include "AliT0digit.h"
34 #include "AliT0Trigger.h"
35
36 //----------------------------------------------------------------------
37 ClassImp(AliT0Trigger)
38
39 //----------------------------------------------------------------------
40 AliT0Trigger::AliT0Trigger()
41   : AliTriggerDetector(),
42     fT0(0x0),
43     fDigits(0x0)
44 {
45    SetName("T0");
46    CreateInputs();
47 }
48
49 //----------------------------------------------------------------------
50 void AliT0Trigger::CreateInputs()
51 {
52    // inputs 
53    
54    // Do not create inputs again!!
55    if( fInputs.GetEntriesFast() > 0 ) return;
56    
57    fInputs.AddLast( new AliTriggerInput( "T0_A_L0", "T0",  0 ) );
58    fInputs.AddLast( new AliTriggerInput( "T0_C_L0", "T0", 0 ) );
59    fInputs.AddLast( new AliTriggerInput( "T0_Vertex_L0", "T0", 0 ) );
60    fInputs.AddLast( new AliTriggerInput( "T0_Centr_L0", "T0",  0 ) );
61    fInputs.AddLast( new AliTriggerInput( "T0_SemiCentral_L0", "T0",  0 ) );
62 }
63
64 //----------------------------------------------------------------------
65 void AliT0Trigger::Trigger()
66 {
67   // trigger input
68
69    AliRunLoader* runLoader = gAlice->GetRunLoader();
70    AliLoader * fT0Loader = runLoader->GetLoader("T0Loader");
71    //   AliT0digit *fDigits; 
72    fT0Loader->LoadDigits("READ");
73    // Creating T0 data container
74
75    TTree* treeD = fT0Loader->TreeD();
76   if (!treeD) {
77     AliError("no digits tree");
78     return;
79   }
80   fDigits = new AliT0digit();
81
82   TBranch *brDigits = treeD->GetBranch("T0");
83   if (brDigits) {
84     brDigits->SetAddress(&fDigits);
85   }else{
86     AliError("Branch T0 DIGIT not found");
87     return;
88   } 
89   brDigits->GetEntry(0);
90   Int_t   besttimeA = fDigits->BestTimeA();
91   Int_t   besttimeC = fDigits->BestTimeC();
92   Int_t   timeDiff = fDigits->TimeDiff();
93   Int_t    sumMult=   fDigits->SumMult();
94
95   if (besttimeA > 0 && besttimeA <99999  )  SetInput("T0_A_L0");
96   if (besttimeC>0  && besttimeC<99999)   SetInput("T0_C_L0"); 
97   //6093 corrsponds to vertex -20cm, 6202 vertex +20 with delay 150nc eqalized on the TVDC unit 
98   if (timeDiff >6090 && timeDiff < 6210)       SetInput("T0_Vertex_L0");
99   if (sumMult > 175)                           SetInput("T0_Centr_L0");
100   if (sumMult>155 && sumMult <= 175)           SetInput("T0_SemiCentral_L0");;
101
102    
103 }