1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 #include "Riostream.h"
18 #include <TClonesArray.h>
20 #include "AliRunLoader.h"
21 #include "AliACORDETrigger.h"
22 #include "AliACORDEConstants.h"
24 //______________________________________________________________________
25 ClassImp(AliACORDETrigger)
27 AliACORDETrigger::AliACORDETrigger()
28 :AliTriggerDetector(),
33 cout << " ================>>>>>>>>>>>>>>>>> AliACORDETrigger" << endl;
36 for (Int_t i=0; i<60; i++) fModuleFired[i]=kFALSE;
39 void AliACORDETrigger::CreateInputs()
41 // Do not create inputs again!!
42 if( fInputs.GetEntriesFast() > 0 ) return;
44 // two acorde triggers, single muon and multicoincidence
46 AliTriggerInput( "0ASL",
49 AliTriggerInput( "0AMU",
53 void AliACORDETrigger::Trigger()
56 // 1.- Get loaders and pointers
57 // 2.- Loop over all entries
58 // set temporal variables to default values
60 // 3.- Loop over all digits in an entrie
61 // Fill temporal arrays
62 // Find module with lowest time
63 // 4.- Loop over temporal arrays
64 // Find number of modules within the time window
65 // 5.- Set the relevant trigger
67 // 1.- Get loaders and pointers
68 AliRunLoader* runLoader = AliRunLoader::Instance();
69 AliACORDELoader* loader =
70 (AliACORDELoader* )runLoader->GetLoader( "ACORDELoader" );
71 loader->LoadDigits("READ");
72 TTree* acordeDigitsTree = loader->TreeD();
73 if (!acordeDigitsTree) return;
74 TClonesArray* acordeDigits = new TClonesArray("AliACORDEdigit",1000);
75 TBranch* digitBranch = acordeDigitsTree->GetBranch("ACORDEdigit");
76 digitBranch->SetAddress(&acordeDigits);
78 // 2.- Loop over all entries
79 // set temporal variables to default values
81 Int_t MultiMin = AliACORDEConstants::Instance()->MultiMuonThreshold();
82 Float_t time_window = AliACORDEConstants::Instance()->MultiMuonWindow();
83 Int_t MinTimeModule = -1;
84 Float_t MinTime = 1e10;
85 Float_t ModuleTimes[60];
86 for (Int_t i=0; i<60; i++) ModuleTimes[i] = -1.0;
89 Int_t nEntries = (Int_t)acordeDigitsTree->GetEntries();
90 cout << " ===AliACORDETrigger=== nEntries " <<nEntries << endl;
91 for (Int_t e=0; e<nEntries; e++) {
92 acordeDigitsTree->GetEvent(e);
93 // 3.- Loop over all digits in an entrie
94 // Fill temporal arrays
95 // Find module with lowest time
96 Int_t nDigits = acordeDigits->GetEntriesFast();
97 cout << " ===AliACORDETrigger=== nDigits " <<nDigits << endl;
98 for (Int_t d=0; d<nDigits; d++) {
99 AliACORDEdigit* digit = (AliACORDEdigit*)acordeDigits->At(d);
100 Int_t module = digit->GetModule();
101 Float_t mod_time = digit->GetTime();
102 ModuleTimes[module-1]=mod_time;
103 if (mod_time < MinTime) {
105 MinTimeModule = module;
107 } // end of loop over digits
108 } // end of loop over events in digits tree
110 // 4.- Loop over temporal arrays
111 // Find number of modules within the time window
112 if (MinTimeModule == -1) return;
113 for (Int_t i=0; i<60; i++) {
114 if (ModuleTimes[i]<0) continue;
115 Float_t diff = ModuleTimes[i]-MinTime;
116 if (diff<time_window) {
118 fModuleFired[i]=kTRUE;
121 cout << " fSingleMuon " << fSingleMuon
122 << " MinTime " << MinTime
123 << " fMultiMuon " << fMultiMuon << endl;
124 // 5.- Set the relevant trigger
125 fSingleMuon = MinTimeModule;
127 if (fMultiMuon>=MultiMin) SetInput( "0AMU" );