]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/jetfinder/AliEMCALJetFinderAlgo.cxx
Removing comment for "magic" lines to correctly read raw tag files.
[u/mrichter/AliRoot.git] / EMCAL / jetfinder / AliEMCALJetFinderAlgo.cxx
CommitLineData
45a58699 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
17/* $Id$ */
18
19//_________________________________________________________________________
20// Base Class for JetFinder Algorithms
21// --
22//*-- Author: Mark Horner (LBL/UCT)
23// --
24
25
26
27#include "AliEMCALJetFinderAlgo.h"
28#include "AliRun.h"
29#include "AliEMCALGeometry.h"
30#include "AliMagF.h"
31ClassImp(AliEMCALJetFinderAlgo)
32
18a21c7c 33AliEMCALJetFinderAlgo::AliEMCALJetFinderAlgo() :
34 fInputPointer(0),fOutputPointer(0),fOutputAllocated(kFALSE),
35 fDebug(0),fPythiaComparison(0)
45a58699 36{
37 fDebug =0;
38 fOutputPointer=0;
39 fInputPointer=0;
40 fOutputAllocated=kFALSE;
41}
42
18a21c7c 43
44AliEMCALJetFinderAlgo::AliEMCALJetFinderAlgo(const AliEMCALJetFinderAlgo& jfa)
45 : TTask(jfa.GetName(), jfa.GetTitle()),
46 fInputPointer(jfa.fInputPointer),fOutputPointer(jfa.fOutputPointer),
47 fOutputAllocated(jfa.fOutputAllocated), fDebug(jfa.fDebug),
48 fPythiaComparison(jfa.fPythiaComparison)
49{
50 //copy ctor
51}
52
45a58699 53AliEMCALJetFinderAlgo::~AliEMCALJetFinderAlgo()
54{
55 if (fOutputAllocated)
56 delete fOutputPointer;
57}
58
59void AliEMCALJetFinderAlgo::SetOutput(AliEMCALJetFinderOutput* output) {
60 if (fOutputAllocated)
61 delete fOutputPointer;
62 fOutputPointer=output;
63 fOutputAllocated=kFALSE;
64}
65
66void AliEMCALJetFinderAlgo::InitInput(AliEMCALJetFinderInput* input)
67{
68// Take input data
69if (fDebug>1) Info("InitInput","Beginning InitInput");
70 fInputPointer = input;
71 if (fOutputPointer==0) {
72
73 if (fDebug>1) Info("InitInput","Allocating output object");
74 fOutputPointer=new AliEMCALJetFinderOutput();
75 fOutputAllocated=kTRUE;
76 }
77 fOutputPointer->Reset(kResetAll);
78 // automatically copy parton and particle info to output object
79
80 for (Int_t counter = 0 ; counter < fInputPointer->GetNPartons();counter++)
81 {
82 fOutputPointer->AddParton(fInputPointer->GetParton(counter));
83 }
84 for (Int_t counter = 0 ; counter < fInputPointer->GetNParticles();counter++)
85 {
86 fOutputPointer->AddParticle(fInputPointer->GetParticle(counter));
87 }
88}
89
90Float_t AliEMCALJetFinderAlgo::PropagatePhi(Float_t pt, Float_t charge, Bool_t& curls)
91{
92 // Propagates phi angle to EMCAL radius
93 // //
94 Float_t b = 0.0, rEMCAL = -1.0;
95 if(rEMCAL<0)
96 {
f7a1cc68 97 b = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->SolenoidField();
45a58699 98 rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance();
99 }
100 Float_t dPhi = 0.;
101 Float_t rB = 3335.6 * pt / b; // [cm] (case of |charge|=1)
102 if (2.*rB < rEMCAL)
103 {
104 curls = kTRUE;
105 return dPhi;
106 }
107 Float_t phi = TMath::ACos(1.-rEMCAL*rEMCAL/(2.*rB*rB));
108 dPhi = TMath::ATan2(1.-TMath::Cos(phi), TMath::Sin(phi));
109 dPhi = -TMath::Sign(dPhi, charge);
110 return dPhi;
111}
112