4 /**************************************************************************
5 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
7 * Author: The ALICE Off-line Project. *
8 * Contributors are mentioned in the code where appropriate. *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
19 // Macro MUONTrigger.C (TO BE COMPILED)
20 // for testing the C++ trigger code
22 #if !defined(__CINT__) || defined(__MAKECINT__)
25 #include "AliMUONLoader.h"
26 #include "AliMUONData.h"
27 #include "AliMUONDigit.h"
28 #include "AliMUONTriggerDecision.h"
30 void MUONTrigger(char * FileName="galice.root", Int_t nevents=1, Int_t idebug=1)
32 // Creating Run Loader and openning file containing Digits
33 AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"MUONLoader","UPDATE");
34 if (RunLoader ==0x0) {
35 printf(">>> Error : Error Opening %s file \n",FileName);
38 // Loading AliRun master
39 if (RunLoader->GetAliRun() == 0x0) RunLoader->LoadgAlice();
40 gAlice = RunLoader->GetAliRun();
42 // Loading MUON subsystem
43 // AliMUONLoader *MUONLoader = (AliMUONLoader*) RunLoader->GetLoader("MUONLoader");
44 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
45 MUONLoader->LoadDigits("READ");
46 // Creating MUON data container
47 AliMUONData* MUONData = new AliMUONData(MUONLoader,"MUON","MUON");
49 // Creating MUONTriggerDecision
50 AliMUONTriggerDecision* decision = new AliMUONTriggerDecision(MUONLoader ,idebug,MUONData);
52 AliMUONDigit * mDigit;
58 for(Int_t ievent = 0; ievent < nevents; ievent++) {
59 printf(">>> Event %i out of %i \n",ievent,nevents);
60 RunLoader->GetEvent(ievent);
61 MUONData->SetTreeAddress("D");
63 MUONData->GetDigits();
64 for(Int_t ichamber=10; ichamber<14; ichamber++) {
65 Int_t idigit, ndigits;
66 ndigits = (Int_t) MUONData->Digits(ichamber)->GetEntriesFast();
67 // printf(">>> Chamber Cathode ndigits %d %d %d\n",ichamber,icathode,ndigits);
68 for(idigit=0; idigit<ndigits; idigit++) {
69 mDigit = static_cast<AliMUONDigit*>(MUONData->Digits(ichamber)->At(idigit));
70 digits[0] = mDigit->PadX();
71 digits[1] = mDigit->PadY();
72 digits[2] = mDigit->Cathode();
73 digits[3] = mDigit->Signal();
74 digits[4] = mDigit->Physics();
75 digits[5] = mDigit->Hit();
76 digits[6] = mDigit->DetElemId();
78 Int_t digitindex = 0 ;
79 printf("ichamber ix iy %d %d %d \n",ichamber,mDigit->PadX(),mDigit->PadY());
81 decision->AddDigit(ichamber, tracks, charges, digits, digitindex );
84 // } // loop on cathodes
85 MUONData->ResetDigits();
87 decision->ClearDigits();
89 MUONLoader->UnloadDigits();