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 // Macro MUONTrigger.C (TO BE COMPILED)
17 // for testing the C++ trigger code
19 #if !defined(__CINT__) || defined(__MAKECINT__)
22 #include "AliMUONLoader.h"
23 #include "AliMUONData.h"
24 #include "AliMUONDigit.h"
25 #include "AliMUONTriggerDecision.h"
27 void MUONTrigger(char * FileName="galice.root", Int_t nevents=1, Int_t idebug=2)
29 // Creating Run Loader and openning file containing Digits
30 AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"MUONLoader","UPDATE");
31 if (RunLoader ==0x0) {
32 printf(">>> Error : Error Opening %s file \n",FileName);
35 // Loading AliRun master
36 if (RunLoader->GetAliRun() == 0x0) RunLoader->LoadgAlice();
37 gAlice = RunLoader->GetAliRun();
39 // Loading MUON subsystem
40 // AliMUONLoader *MUONLoader = (AliMUONLoader*) RunLoader->GetLoader("MUONLoader");
41 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
42 MUONLoader->LoadDigits("READ");
43 // Creating MUON data container
44 AliMUONData* MUONData = new AliMUONData(MUONLoader,"MUON","MUON");
46 // Creating MUONTriggerDecision
47 AliMUONTriggerDecision* decision = new AliMUONTriggerDecision(MUONLoader ,idebug,MUONData);
49 Int_t nEvents = RunLoader->GetNumberOfEvents();
50 AliMUONDigit * mDigit;
56 for(Int_t ievent = 0; ievent < nevents; ievent++) {
57 printf(">>> Event %i out of %i \n",ievent,nevents);
58 RunLoader->GetEvent(ievent);
59 MUONData->SetTreeAddress("D");
61 for(Int_t icathode=0; icathode<2; icathode++) {
62 MUONData->GetCathode(icathode);
63 for(Int_t ichamber=10; ichamber<14; ichamber++) {
64 Int_t idigit, ndigits;
65 ndigits = (Int_t) MUONData->Digits(ichamber)->GetEntriesFast();
66 // printf(">>> Chamber Cathode ndigits %d %d %d\n",ichamber,icathode,ndigits);
67 for(idigit=0; idigit<ndigits; idigit++) {
68 mDigit = static_cast<AliMUONDigit*>(MUONData->Digits(ichamber)->At(idigit));
69 digits[0] = mDigit->PadX();
70 digits[1] = mDigit->PadY();
71 digits[2] = mDigit->Cathode();
72 digits[3] = mDigit->Signal();
73 digits[4] = mDigit->Physics();
74 digits[5] = mDigit->Hit();
75 digits[6] = mDigit->DetElemId();
77 Int_t nptracks = mDigit->GetNTracks();
78 for (Int_t i = 0; i < nptracks; i++) {
79 tracks[i] = mDigit->GetTrack(i);
80 charges[i] = mDigit->GetCharge(i);
83 // printf("ichamber icathode ix iy %d %d %d %d \n",ichamber,icathode,mDigit->PadX(),mDigit->PadY());
85 decision->AddDigit(ichamber, tracks, charges, digits);
89 MUONData->ResetDigits();
91 decision->ClearDigits();
93 MUONLoader->UnloadDigits();