]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/AliT0Trigger.cxx
time delay calibration numbers
[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 {
36    SetName("T0");
37    CreateInputs();
38 }
39
40 //----------------------------------------------------------------------
41 void AliT0Trigger::CreateInputs()
42 {
43    // inputs 
44    
45    // Do not create inputs again!!
46    if( fInputs.GetEntriesFast() > 0 ) return;
47    
48    fInputs.AddLast( new AliTriggerInput( "START_A_L0", "Signal on T0-A",  0x0100 ) );
49    fInputs.AddLast( new AliTriggerInput( "START_C_L0", "Signal on T0-C", 0x0200 ) );
50    fInputs.AddLast( new AliTriggerInput( "START_Vertex_L0", " Vertex T0-C&T0-A ", 0x0400 ) );
51    fInputs.AddLast( new AliTriggerInput( "START_Centr_L0", "Centrality central",  0x0800 ) );
52    fInputs.AddLast( new AliTriggerInput( "START_SemiCentral_L0", "Centrality semicentral",  0x1000 ) );
53 }
54
55 //----------------------------------------------------------------------
56 void AliT0Trigger::Trigger()
57 {
58    AliRunLoader* runLoader = gAlice->GetRunLoader();
59    AliLoader * fT0Loader = runLoader->GetLoader("T0Loader");
60    //   AliT0digit *fDigits; 
61    fT0Loader->LoadDigits("READ");
62    // Creating T0 data container
63
64    TTree* treeD = fT0Loader->TreeD();
65   if (!treeD) {
66     AliError("no digits tree");
67     return;
68   }
69   AliT0digit *fDigits = new AliT0digit();
70
71   TBranch *brDigits = treeD->GetBranch("T0");
72   if (brDigits) {
73     brDigits->SetAddress(&fDigits);
74   }else{
75     AliError("Branch T0 DIGIT not found");
76     return;
77   } 
78   brDigits->GetEntry(0);
79   Int_t   besttimeright = fDigits->BestTimeRight();
80   Int_t   besttimeleft = fDigits->BestTimeLeft();
81   Int_t   timeDiff = fDigits->TimeDiff();
82   Int_t    sumMult=   fDigits->SumMult();
83
84   if (besttimeright > 0 && besttimeright <99999  )  SetInput("START_A_L0");
85   if (besttimeleft>0  && besttimeleft<99999)   SetInput("START_C_L0"); 
86   if (timeDiff >5500 && timeDiff < 6500)       SetInput("START_Vertex_L0");
87   if (sumMult > 175)                           SetInput("START_Centr_L0");
88   if (sumMult>155 && sumMult <= 175)           SetInput("START_SemiCentral_L0");;
89
90    
91 }