]> git.uio.no Git - u/mrichter/AliRoot.git/blob - START/AliSTARTTrigger.cxx
fixed bug in AliSTARTTrigger
[u/mrichter/AliRoot.git] / START / AliSTARTTrigger.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 "AliLog.h"
19 #include "AliRun.h"
20 #include "AliRunLoader.h"
21 #include "AliTriggerInput.h"
22
23 #include "AliSTART.h"
24 #include "AliSTARTLoader.h"
25 #include "AliSTARTdigit.h"
26 #include "AliSTARTTrigger.h"
27
28 //----------------------------------------------------------------------
29 ClassImp(AliSTARTTrigger)
30
31 //----------------------------------------------------------------------
32 AliSTARTTrigger::AliSTARTTrigger()
33   : AliTriggerDetector() 
34 {
35    SetName("START");
36    CreateInputs();
37 }
38
39 //----------------------------------------------------------------------
40 void AliSTARTTrigger::CreateInputs()
41 {
42    // inputs 
43    
44    // Do not create inputs again!!
45    if( fInputs.GetEntriesFast() > 0 ) return;
46    
47    fInputs.AddLast( new AliTriggerInput( "START_A_L0", "Signal on T0-A",  0x01 ) );
48    fInputs.AddLast( new AliTriggerInput( "START_C_L0", "Signal on T0-C", 0x02 ) );
49    fInputs.AddLast( new AliTriggerInput( "START_Vertex_L0", " Vertex T0-C&T0-A ", 0x04 ) );
50    fInputs.AddLast( new AliTriggerInput( "START_Centr_L0", "Centrality central",  0x08 ) );
51    fInputs.AddLast( new AliTriggerInput( "START_SemiCentral_L0", "Centrality semicentral",  0x08 ) );
52 }
53
54 //----------------------------------------------------------------------
55 void AliSTARTTrigger::Trigger()
56 {
57
58    AliRunLoader* runLoader = gAlice->GetRunLoader();
59    AliLoader * fSTARTLoader = runLoader->GetLoader("STARTLoader");
60    //   AliSTARTdigit *fDigits; 
61    fSTARTLoader->LoadDigits("READ");
62    // Creating START data container
63    Int_t idebug = 1;
64    TTree* treeD = fSTARTLoader->TreeD();
65   if (!treeD) {
66     AliError("no digits tree");
67     return;
68   }
69
70   TBranch *brDigits = treeD->GetBranch("START");
71   if (brDigits) {
72     brDigits->SetAddress(&fDigits);
73   }else{
74     AliError("Branch START DIGIT not found");
75     exit(111);
76   } 
77   brDigits->GetEntry(0);
78   Int_t   besttimeright = fDigits->BestTimeRight();
79   Int_t   besttimeleft = fDigits->BestTimeLeft();
80   Int_t   timeDiff = besttimeright-besttimeleft;
81   Int_t   meanTime = (besttimeright+besttimeleft)/2;
82   Int_t sumMult=   fDigits->SumMult();
83   cout<<besttimeright<<" "<<besttimeleft<<" "<< timeDiff<<" "<<meanTime<<endl;
84
85   Bool_t trigg[5];
86   if (besttimeright<1000) trigg[0]=kTRUE;
87   if (besttimeleft<1000)  trigg[1]=kTRUE;
88   if (timeDiff<5)      trigg[2]=kTRUE;
89   if (sumMult>2300)    trigg[3]=kTRUE;
90   if (sumMult>1800)    trigg[4]=kTRUE;
91
92
93    if( trigg[0] )  SetInput("START_T0A_L0");
94    if( trigg[1] )  SetInput("START_T0C_L0");
95    if( trigg[2] )  SetInput("START_T0vertex_L0");
96    if( trigg[3] )  SetInput("START_T0Centr_L0");
97    if( trigg[4] )  SetInput("START_T0SemiCentral_L0");
98    cout<<" Trigger "<<trigg[0]<<" "<<trigg[1]<<endl;
99    
100 }