]>
Commit | Line | Data |
---|---|---|
a653f08b | 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 | ||
07d83718 | 16 | /* $Id$ */ |
17 | ||
d6ea26eb | 18 | // This macro is to be used to check the trigger algorithm w/o having to |
19 | // (re-)perform simulation and digitalization. | |
07d83718 | 20 | // see full description in the REDAME file |
21 | // Author: P.Crochet (LPC) | |
a653f08b | 22 | |
23 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
24 | #include "AliRun.h" | |
25 | #include "AliMUON.h" | |
a653f08b | 26 | #include "AliMUONDigit.h" |
d6ea26eb | 27 | #include "AliMUONTriggerElectronics.h" |
28 | #include "AliMUONCalibrationData.h" | |
29 | #include "AliCDBManager.h" | |
53958b19 | 30 | #include "AliMUONDataInterface.h" |
31 | #include "AliMUONMCDataInterface.h" | |
32 | #include "AliMUONVTriggerStore.h" | |
33 | #include "AliMUONDigitStoreV1.h" | |
07d83718 | 34 | #include <TClonesArray.h> |
53958b19 | 35 | #include "AliMpCDB.h" |
36 | #include <TFile.h> | |
a653f08b | 37 | #endif |
53958b19 | 38 | |
39 | void MUONTrigger(const char* filename) | |
a653f08b | 40 | { |
07d83718 | 41 | // Creating Run Loader and openning file containing Digits |
53958b19 | 42 | AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONLoader","UPDATE"); |
a653f08b | 43 | if (RunLoader ==0x0) { |
53958b19 | 44 | printf(">>> Error : Error Opening %s file \n",filename); |
29348618 | 45 | return; |
a653f08b | 46 | } |
47 | // Loading AliRun master | |
48 | if (RunLoader->GetAliRun() == 0x0) RunLoader->LoadgAlice(); | |
49 | gAlice = RunLoader->GetAliRun(); | |
50 | ||
51 | // Loading MUON subsystem | |
53958b19 | 52 | AliLoader* MUONLoader = RunLoader->GetDetectorLoader("MUON"); |
a653f08b | 53 | MUONLoader->LoadDigits("READ"); |
53958b19 | 54 | MUONLoader->LoadRecPoints("UPDATE"); // absolutely essential !!! |
07d83718 | 55 | |
a653f08b | 56 | // Creating MUONTriggerDecision |
07d83718 | 57 | AliCDBManager* cdbManager = AliCDBManager::Instance(); |
58 | cdbManager->SetDefaultStorage("local://$ALICE_ROOT"); | |
07d83718 | 59 | |
53958b19 | 60 | Int_t runnumber = cdbManager->GetRun(); |
61 | AliMpCDB::LoadDDLStore(); | |
07d83718 | 62 | |
53958b19 | 63 | AliMUONCalibrationData *CalibrationData = new AliMUONCalibrationData(runnumber); |
64 | AliMUONTriggerElectronics *TriggerProcessor = new AliMUONTriggerElectronics(CalibrationData); | |
65 | ||
66 | Int_t nevents = RunLoader->GetNumberOfEvents(); | |
67 | AliMUONVDigitStore* digitStore=0x0; | |
68 | AliMUONVTriggerStore* triggerStore=0x0; | |
a653f08b | 69 | |
70 | for(Int_t ievent = 0; ievent < nevents; ievent++) { | |
d6ea26eb | 71 | printf(">>> Event %i out of %i \n",ievent,nevents); |
53958b19 | 72 | RunLoader->GetRunLoader()->GetEvent(ievent); |
d6ea26eb | 73 | |
53958b19 | 74 | MUONLoader->LoadRecPoints("update"); |
75 | MUONLoader->CleanRecPoints(); | |
76 | MUONLoader->MakeRecPointsContainer(); | |
77 | TTree* clustersTree = MUONLoader->TreeR(); | |
78 | TFile* cfile = clustersTree->GetCurrentFile(); | |
79 | if ( !cfile ) | |
80 | { | |
81 | cout << " could not find Cluster file " << endl; | |
82 | return; | |
83 | } | |
07d83718 | 84 | |
53958b19 | 85 | MUONLoader->LoadDigits("read"); |
86 | TTree* digitsTree = MUONLoader->TreeD(); | |
87 | TFile* dfile = digitsTree->GetCurrentFile(); | |
88 | if ( !dfile ) | |
89 | { | |
90 | cout << " could not find Digit file " << endl; | |
91 | return; | |
92 | } | |
07d83718 | 93 | |
53958b19 | 94 | // here start reconstruction |
95 | if (!digitStore) digitStore = AliMUONVDigitStore::Create(*digitsTree); | |
96 | if (!triggerStore) triggerStore = AliMUONVTriggerStore::Create(*digitsTree); | |
97 | // insure we start with empty stores | |
98 | if ( digitStore ) | |
99 | { | |
100 | digitStore->Clear(); | |
101 | Bool_t alone = ( triggerStore ? kFALSE : kTRUE ); | |
102 | Bool_t ok = digitStore->Connect(*digitsTree,alone); | |
103 | if (!ok) | |
104 | { | |
105 | cerr << "Could not connect digitStore to digitsTree \n"; | |
106 | return; | |
d6ea26eb | 107 | } |
53958b19 | 108 | } else { |
109 | cerr << "digitStore does not exist " << "\n"; | |
110 | return; | |
111 | } | |
112 | ||
113 | digitsTree->GetEvent(0); | |
d6ea26eb | 114 | |
53958b19 | 115 | // process trigger response |
116 | TriggerProcessor->Digits2Trigger(*digitStore,*triggerStore); | |
117 | ||
118 | //triggerStore->Print(); | |
119 | ||
120 | Bool_t ok(kFALSE); | |
121 | if ( triggerStore ) { | |
122 | ok = triggerStore->Connect(*clustersTree,kTRUE); | |
123 | if (!ok) | |
124 | { | |
125 | cerr << "Could not create triggerStore branches in TreeR " << "\n"; | |
126 | return; | |
127 | } | |
128 | } else { | |
129 | cerr << "triggerStore does not exist " << "\n"; | |
130 | return; | |
131 | } | |
132 | ||
133 | // fill TreeR | |
134 | clustersTree->Fill(); | |
135 | MUONLoader->UnloadDigits(); | |
136 | MUONLoader->WriteRecPoints("OVERWRITE"); | |
137 | MUONLoader->UnloadRecPoints(); | |
d6ea26eb | 138 | |
53958b19 | 139 | } // loop on events |
d6ea26eb | 140 | |
a653f08b | 141 | } |
d6ea26eb | 142 | |
53958b19 | 143 | |
144 |