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>
21 #include "AliRunLoader.h"
22 #include "AliACORDETrigger.h"
23 #include "AliACORDEConstants.h"
25 //______________________________________________________________________
26 ClassImp(AliACORDETrigger)
28 AliACORDETrigger::AliACORDETrigger()
29 :AliTriggerDetector(),
34 cout << " ================>>>>>>>>>>>>>>>>> AliACORDETrigger" << endl;
37 for (Int_t i=0; i<60; i++) fModuleFired[i]=kFALSE;
40 void AliACORDETrigger::CreateInputs()
42 // Do not create inputs again!!
43 if( fInputs.GetEntriesFast() > 0 ) return;
45 // two acorde triggers, single muon and multicoincidence
47 AliTriggerInput( "0ASL",
50 AliTriggerInput( "0AMU",
54 void AliACORDETrigger::Trigger()
57 // 1.- Get loaders and pointers
58 // 2.- Loop over all entries
59 // set temporal variables to default values
61 // 3.- Loop over all digits in an entrie
62 // Fill temporal arrays
63 // Find module with lowest time
64 // 4.- Loop over temporal arrays
65 // Find number of modules within the time window
66 // 5.- Set the relevant trigger
68 // 1.- Get loaders and pointers
69 AliRunLoader* runLoader = AliRunLoader::Instance();
70 AliACORDELoader* loader =
71 (AliACORDELoader* )runLoader->GetLoader( "ACORDELoader" );
72 loader->LoadDigits("READ");
73 TTree* acordeDigitsTree = loader->TreeD();
74 if (!acordeDigitsTree) return;
75 TClonesArray* acordeDigits = new TClonesArray("AliACORDEdigit",1000);
76 TBranch* digitBranch = acordeDigitsTree->GetBranch("ACORDEdigit");
77 digitBranch->SetAddress(&acordeDigits);
79 // 2.- Loop over all entries
80 // set temporal variables to default values
82 Int_t MultiMin = AliACORDEConstants::Instance()->MultiMuonThreshold();
83 Float_t time_window = AliACORDEConstants::Instance()->MultiMuonWindow();
84 Int_t MinTimeModule = -1;
85 Float_t MinTime = 1e10;
86 Float_t ModuleTimes[60];
87 for (Int_t i=0; i<60; i++) ModuleTimes[i] = -1.0;
90 Int_t nEntries = (Int_t)acordeDigitsTree->GetEntries();
91 cout << " ===AliACORDETrigger=== nEntries " <<nEntries << endl;
92 for (Int_t e=0; e<nEntries; e++) {
93 acordeDigitsTree->GetEvent(e);
94 // 3.- Loop over all digits in an entrie
95 // Fill temporal arrays
96 // Find module with lowest time
97 Int_t nDigits = acordeDigits->GetEntriesFast();
98 cout << " ===AliACORDETrigger=== nDigits " <<nDigits << endl;
99 for (Int_t d=0; d<nDigits; d++) {
100 AliACORDEdigit* digit = (AliACORDEdigit*)acordeDigits->At(d);
101 Int_t module = digit->GetModule();
102 Float_t mod_time = digit->GetTime();
103 ModuleTimes[module-1]=mod_time;
104 if (mod_time < MinTime) {
106 MinTimeModule = module;
108 } // end of loop over digits
109 } // end of loop over events in digits tree
111 // 4.- Loop over temporal arrays
112 // Find number of modules within the time window
113 if (MinTimeModule == -1) return;
114 for (Int_t i=0; i<60; i++) {
115 if (ModuleTimes[i]<0) continue;
116 Float_t diff = ModuleTimes[i]-MinTime;
117 if (diff<time_window) {
119 fModuleFired[i]=kTRUE;
122 cout << " fSingleMuon " << fSingleMuon
123 << " MinTime " << MinTime
124 << " fMultiMuon " << fMultiMuon << endl;
125 // 5.- Set the relevant trigger
126 fSingleMuon = MinTimeModule;
128 if (fMultiMuon>=MultiMin) SetInput( "0AMU" );