Moving non-implemented copy constructor and assignment operator to the private sectio...
[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
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"
26#include "AliMUONLoader.h"
27#include "AliMUONData.h"
28#include "AliMUONDigit.h"
d6ea26eb 29#include "AliMUONTriggerElectronics.h"
30#include "AliMUONCalibrationData.h"
31#include "AliCDBManager.h"
07d83718 32#include <TClonesArray.h>
a653f08b 33#endif
6b092dfc 34void MUONTrigger(char * FileNameSim="galice_sim.root", char * FileName="galice.root")
a653f08b 35{
07d83718 36 // Creating Run Loader and openning file containing Digits
a653f08b 37 AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"MUONLoader","UPDATE");
38 if (RunLoader ==0x0) {
29348618 39 printf(">>> Error : Error Opening %s file \n",FileName);
40 return;
a653f08b 41 }
42 // Loading AliRun master
43 if (RunLoader->GetAliRun() == 0x0) RunLoader->LoadgAlice();
44 gAlice = RunLoader->GetAliRun();
45
46 // Loading MUON subsystem
a653f08b 47 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
48 MUONLoader->LoadDigits("READ");
d6ea26eb 49 MUONLoader->LoadRecPoints("UPDATE"); // absolutely essential !!!
07d83718 50
d6ea26eb 51 Int_t nevents;
52 nevents = RunLoader->GetNumberOfEvents();
07d83718 53
a653f08b 54 // Creating MUON data container
55 AliMUONData* MUONData = new AliMUONData(MUONLoader,"MUON","MUON");
07d83718 56
a653f08b 57 // Creating MUONTriggerDecision
d6ea26eb 58 TTask *TriggerProcessor;
07d83718 59 AliCDBManager* cdbManager = AliCDBManager::Instance();
60 cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
61 Int_t runnumber = gAlice->GetRunNumber();
62 AliMUONCalibrationData *CalibrationData = new AliMUONCalibrationData(runnumber);
63 TriggerProcessor = new AliMUONTriggerElectronics(MUONData,CalibrationData);
64
d6ea26eb 65 // Testing if Trigger has already been done
66 RunLoader->GetEvent(0);
67 if (MUONLoader->TreeR()) {
68 if (MUONData->IsTriggerBranchesInTree()) {
69 MUONLoader->UnloadRecPoints();
70 MUONLoader->LoadRecPoints("RECREATE");
71 printf("Recreating recpoints files\n");
72 }
73 }
07d83718 74
d6ea26eb 75 AliMUONDigit * mDigit;
09f9a8f1 76 Float_t digits[7];
a653f08b 77
78 for(Int_t ievent = 0; ievent < nevents; ievent++) {
d6ea26eb 79 printf(">>> Event %i out of %i \n",ievent,nevents);
80 RunLoader->GetEvent(ievent);
81 MUONData->SetTreeAddress("D");
82
29348618 83 MUONData->GetDigits();
07d83718 84 for(Int_t ichamber=10; ichamber<14; ichamber++) {
85 Int_t ndigits = (Int_t) MUONData->Digits(ichamber)->GetEntriesFast();
86 for(Int_t idigit=0; idigit<ndigits; idigit++) {
87 mDigit = static_cast<AliMUONDigit*>(MUONData->Digits(ichamber)->At(idigit));
88
29348618 89 digits[0] = mDigit->PadX();
90 digits[1] = mDigit->PadY();
91 digits[2] = mDigit->Cathode();
5ca1e61a 92 digits[3] = mDigit->Charge();
29348618 93 digits[4] = mDigit->Physics();
94 digits[5] = mDigit->Hit();
95 digits[6] = mDigit->DetElemId();
96
07d83718 97// printf("ichamber ix iy %d %d %d \n",ichamber,mDigit->PadX(),mDigit->PadY());
29348618 98
29348618 99 } // loop on digits
100 } // loop on chambers
07d83718 101
102
d6ea26eb 103 if (MUONLoader->TreeR() == 0x0) {
104 MUONLoader->MakeRecPointsContainer();
105 } else {
106 if (MUONData->IsTriggerBranchesInTree()){
107 if (ievent==0) MUONLoader->UnloadRecPoints();
108 MUONLoader->MakeRecPointsContainer();
109 cout << "Recreating RecPointsContainer and deleting previous ones" << "\n";
110 }
111 }
112
113 MUONData->MakeBranch("TC");
114 MUONData->SetTreeAddress("TC");
115 TriggerProcessor->ExecuteTask();
116
117 MUONData->Fill("TC");
118 MUONLoader->WriteRecPoints("OVERWRITE");
29348618 119 MUONData->ResetDigits();
d6ea26eb 120
a653f08b 121 } // loop on events
122 MUONLoader->UnloadDigits();
d6ea26eb 123 MUONLoader->UnloadRecPoints();
a653f08b 124}
d6ea26eb 125