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