]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONTrigger.C
Fixing bug in setting scaler events for trigger
[u/mrichter/AliRoot.git] / MUON / MUONTrigger.C
CommitLineData
29348618 1
2
3
a653f08b 4/**************************************************************************
5 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * *
7 * Author: The ALICE Off-line Project. *
8 * Contributors are mentioned in the code where appropriate. *
9 * *
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 **************************************************************************/
18
19// Macro MUONTrigger.C (TO BE COMPILED)
20// for testing the C++ trigger code
21
22#if !defined(__CINT__) || defined(__MAKECINT__)
23#include "AliRun.h"
24#include "AliMUON.h"
25#include "AliMUONLoader.h"
26#include "AliMUONData.h"
27#include "AliMUONDigit.h"
28#include "AliMUONTriggerDecision.h"
29#endif
29348618 30void MUONTrigger(char * FileName="galice.root", Int_t nevents=1, Int_t idebug=1)
a653f08b 31{
32 // Creating Run Loader and openning file containing Digits
33 AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"MUONLoader","UPDATE");
34 if (RunLoader ==0x0) {
29348618 35 printf(">>> Error : Error Opening %s file \n",FileName);
36 return;
a653f08b 37 }
38 // Loading AliRun master
39 if (RunLoader->GetAliRun() == 0x0) RunLoader->LoadgAlice();
40 gAlice = RunLoader->GetAliRun();
41
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");
48
49 // Creating MUONTriggerDecision
50 AliMUONTriggerDecision* decision = new AliMUONTriggerDecision(MUONLoader ,idebug,MUONData);
51
a653f08b 52 AliMUONDigit * mDigit;
53
54 Int_t tracks[10];
55 Int_t charges[10];
56 Int_t digits[7];
57
58 for(Int_t ievent = 0; ievent < nevents; ievent++) {
29348618 59 printf(">>> Event %i out of %i \n",ievent,nevents);
60 RunLoader->GetEvent(ievent);
61 MUONData->SetTreeAddress("D");
62
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();
77
78 Int_t digitindex = 0 ;
79 printf("ichamber ix iy %d %d %d \n",ichamber,mDigit->PadX(),mDigit->PadY());
80
81 decision->AddDigit(ichamber, tracks, charges, digits, digitindex );
82 } // loop on digits
83 } // loop on chambers
84 // } // loop on cathodes
85 MUONData->ResetDigits();
86 decision->Trigger();
87 decision->ClearDigits();
a653f08b 88 } // loop on events
89 MUONLoader->UnloadDigits();
90}