]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONTrigger.C
disable global transformation for trigger & transform.dat files in new ALICE coordina...
[u/mrichter/AliRoot.git] / MUON / MUONTrigger.C
CommitLineData
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
16// Macro MUONTrigger.C (TO BE COMPILED)
17// for testing the C++ trigger code
18
19#if !defined(__CINT__) || defined(__MAKECINT__)
20#include "AliRun.h"
21#include "AliMUON.h"
22#include "AliMUONLoader.h"
23#include "AliMUONData.h"
24#include "AliMUONDigit.h"
25#include "AliMUONTriggerDecision.h"
26#endif
27void MUONTrigger(char * FileName="galice.root", Int_t nevents=1, Int_t idebug=2)
28{
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);
33 return;
34 }
35 // Loading AliRun master
36 if (RunLoader->GetAliRun() == 0x0) RunLoader->LoadgAlice();
37 gAlice = RunLoader->GetAliRun();
38
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");
45
46 // Creating MUONTriggerDecision
47 AliMUONTriggerDecision* decision = new AliMUONTriggerDecision(MUONLoader ,idebug,MUONData);
48
49 Int_t nEvents = RunLoader->GetNumberOfEvents();
50 AliMUONDigit * mDigit;
51
52 Int_t tracks[10];
53 Int_t charges[10];
54 Int_t digits[7];
55
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");
60
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();
76/*
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);
81 }
82*/
83// printf("ichamber icathode ix iy %d %d %d %d \n",ichamber,icathode,mDigit->PadX(),mDigit->PadY());
84
85 decision->AddDigit(ichamber, tracks, charges, digits);
86 } // loop on digits
87 } // loop on chambers
88 } // loop on cathodes
89 MUONData->ResetDigits();
90 decision->Trigger();
91 decision->ClearDigits();
92 } // loop on events
93 MUONLoader->UnloadDigits();
94}