ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

////////////////////////////////////////////////////////////////////////////////
//
//  This class contains all code which is used to compute any of the values
//  which can be of interest within a resonance analysis. Besides the obvious
//  invariant mass, it allows to compute other utility values on all possible
//  targets, in order to allow a wide spectrum of binning and checks.
//  When needed, this object can also define a binning in the variable which
//  it is required to compute, which is used for initializing axes of output
//  histograms (see AliRsnFunction).
//  The value computation requires this object to be passed the object whose
//  informations will be used. This object can be of any allowed input type
//  (track, pair, event), then this class must inherit from AliRsnTarget.
//  Then, when value computation is attempted, a check on target type is done
//  and computation is successful only if expected target matches that of the
//  passed object.
//  In some cases, the value computation can require a support external object,
//  which must then be passed to this class. It can be of any type inheriting
//  from TObject.
//
//  authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
//           M. Vala (martin.vala@cern.ch)
//
////////////////////////////////////////////////////////////////////////////////

#include "Riostream.h"
#include "AliVVertex.h"
#include "AliMultiplicity.h"
#include "AliESDtrackCuts.h"
#include "AliESDpid.h"
#include "AliAODPid.h"
#include "AliCentrality.h"
#include "AliESDUtils.h"

#include "AliRsnEvent.h"
#include "AliRsnDaughter.h"
#include "AliRsnMother.h"
#include "AliRsnPairDef.h"
#include "AliRsnDaughterDef.h"

#include "AliRsnMiniPair.h"

#include "AliRsnValuePair.h"

ClassImp(AliRsnValuePair)

//_____________________________________________________________________________
AliRsnValuePair::AliRsnValuePair(const char *name, EType type) :
   AliRsnValue(name, AliRsnTarget::kMother),
   fType(type)
{
//
// Constructor
//
}

//_____________________________________________________________________________
AliRsnValuePair::AliRsnValuePair(const AliRsnValuePair &copy) :
   AliRsnValue(copy),
   fType(copy.fType)
{
//
// Copy constructor
//
}

//_____________________________________________________________________________
AliRsnValuePair &AliRsnValuePair::operator=(const AliRsnValuePair &copy)
{
//
// Assignment operator.
// Works like copy constructor.
//

   AliRsnValue::operator=(copy);
   if (this == &copy)
      return *this;
   fType = copy.fType;

   return (*this);
}

//_____________________________________________________________________________
const char *AliRsnValuePair::GetTypeName() const
{
//
// This method returns a string to give a name to each possible
// computation value.
//

   switch (fType) {
      case kPt:           return "PairPt";
      case kPz:           return "PairPz";
      case kInvMass:      return "PairInvMass";
      case kInvMassRes:   return "PairInvMassResolution";
      case kEta:          return "PairEta";
      case kMt:           return "PairMt";
      case kY:            return "PairY";
      case kPtRatio:      return "PairPtRatio";
      case kDipAngle:     return "PairDipAngle";
      case kCosThetaStar: return "PairCosThetaStar";
      case kAngleLeading: return "PairAngleToLeading";
      case kDCAproduct:   return "DaughterDCAProduct";
      default:            return "Undefined";
   }
}

//_____________________________________________________________________________
Bool_t AliRsnValuePair::Eval(TObject *object)
{
//
// Evaluation of the required value.
// In this implementation, fills the member 4-vectors with data
// coming from the object passed as argument, and then returns the value
//

   // coherence check, which also casts object
   // to AliRsnTarget data members and returns kFALSE
   // in case the object is NULL
   if (!TargetOK(object)) return kFALSE;

   // set a reference to the mother momentum
   TLorentzVector &sum   = fMother->Sum(fUseMCInfo);
   TLorentzVector &ref   = fMother->Ref(fUseMCInfo);
   TLorentzVector &p1    = fMother->GetDaughter(0)->P(fUseMCInfo);
   TLorentzVector &p2    = fMother->GetDaughter(1)->P(fUseMCInfo);

   

   // utility variables
   Bool_t success;

   // compute value depending on types in the enumeration
   // if the type does not match any available choice, or if
   // the computation is not doable due to any problem
   // (not initialized support object, wrong values, risk of floating point errors)
   // the method returng kFALSE and sets the computed value to a meaningless number
   switch (fType) {
      case kPt:
         fComputedValue = sum.Perp();
         return kTRUE;
      case kInvMass:
         fComputedValue = sum.M();
         return kTRUE;
      case kEta:
         fComputedValue = sum.Eta();
         return kTRUE;
      case kInvMassRes:
         fComputedValue  = fMother->Sum(kFALSE).M() - fMother->Sum(kTRUE).M();
         fComputedValue /= fMother->Sum(kTRUE).M();
         return kTRUE;
      case kMt:
         fComputedValue = ref.Mt();
         return kTRUE;
      case kY:
         fComputedValue = ref.Rapidity();
         return kTRUE;
      case kPtRatio:
         fComputedValue  = TMath::Abs(p1.Perp() - p2.Perp());
         fComputedValue /= TMath::Abs(p1.Perp() + p2.Perp());
         return kTRUE;
      case kDipAngle:
         fComputedValue  = p1.Perp() * p2.Perp() + p1.Z() * p2.Z();
         fComputedValue /= p1.Mag() * p2.Mag();
         return kTRUE;
      case kCosThetaStar:
         fComputedValue = fMother->CosThetaStar();
         return kTRUE;
      case kAngleLeading:
         fComputedValue = fMother->AngleToLeading(success);
         return success;
      case kDCAproduct:      
        fComputedValue = fMother->DCAproduct();
        return kTRUE;
      default:
         AliError(Form("[%s] Invalid value type for this computation", GetName()));
         return kFALSE;
   }
}
 AliRsnValuePair.cxx:1
 AliRsnValuePair.cxx:2
 AliRsnValuePair.cxx:3
 AliRsnValuePair.cxx:4
 AliRsnValuePair.cxx:5
 AliRsnValuePair.cxx:6
 AliRsnValuePair.cxx:7
 AliRsnValuePair.cxx:8
 AliRsnValuePair.cxx:9
 AliRsnValuePair.cxx:10
 AliRsnValuePair.cxx:11
 AliRsnValuePair.cxx:12
 AliRsnValuePair.cxx:13
 AliRsnValuePair.cxx:14
 AliRsnValuePair.cxx:15
 AliRsnValuePair.cxx:16
 AliRsnValuePair.cxx:17
 AliRsnValuePair.cxx:18
 AliRsnValuePair.cxx:19
 AliRsnValuePair.cxx:20
 AliRsnValuePair.cxx:21
 AliRsnValuePair.cxx:22
 AliRsnValuePair.cxx:23
 AliRsnValuePair.cxx:24
 AliRsnValuePair.cxx:25
 AliRsnValuePair.cxx:26
 AliRsnValuePair.cxx:27
 AliRsnValuePair.cxx:28
 AliRsnValuePair.cxx:29
 AliRsnValuePair.cxx:30
 AliRsnValuePair.cxx:31
 AliRsnValuePair.cxx:32
 AliRsnValuePair.cxx:33
 AliRsnValuePair.cxx:34
 AliRsnValuePair.cxx:35
 AliRsnValuePair.cxx:36
 AliRsnValuePair.cxx:37
 AliRsnValuePair.cxx:38
 AliRsnValuePair.cxx:39
 AliRsnValuePair.cxx:40
 AliRsnValuePair.cxx:41
 AliRsnValuePair.cxx:42
 AliRsnValuePair.cxx:43
 AliRsnValuePair.cxx:44
 AliRsnValuePair.cxx:45
 AliRsnValuePair.cxx:46
 AliRsnValuePair.cxx:47
 AliRsnValuePair.cxx:48
 AliRsnValuePair.cxx:49
 AliRsnValuePair.cxx:50
 AliRsnValuePair.cxx:51
 AliRsnValuePair.cxx:52
 AliRsnValuePair.cxx:53
 AliRsnValuePair.cxx:54
 AliRsnValuePair.cxx:55
 AliRsnValuePair.cxx:56
 AliRsnValuePair.cxx:57
 AliRsnValuePair.cxx:58
 AliRsnValuePair.cxx:59
 AliRsnValuePair.cxx:60
 AliRsnValuePair.cxx:61
 AliRsnValuePair.cxx:62
 AliRsnValuePair.cxx:63
 AliRsnValuePair.cxx:64
 AliRsnValuePair.cxx:65
 AliRsnValuePair.cxx:66
 AliRsnValuePair.cxx:67
 AliRsnValuePair.cxx:68
 AliRsnValuePair.cxx:69
 AliRsnValuePair.cxx:70
 AliRsnValuePair.cxx:71
 AliRsnValuePair.cxx:72
 AliRsnValuePair.cxx:73
 AliRsnValuePair.cxx:74
 AliRsnValuePair.cxx:75
 AliRsnValuePair.cxx:76
 AliRsnValuePair.cxx:77
 AliRsnValuePair.cxx:78
 AliRsnValuePair.cxx:79
 AliRsnValuePair.cxx:80
 AliRsnValuePair.cxx:81
 AliRsnValuePair.cxx:82
 AliRsnValuePair.cxx:83
 AliRsnValuePair.cxx:84
 AliRsnValuePair.cxx:85
 AliRsnValuePair.cxx:86
 AliRsnValuePair.cxx:87
 AliRsnValuePair.cxx:88
 AliRsnValuePair.cxx:89
 AliRsnValuePair.cxx:90
 AliRsnValuePair.cxx:91
 AliRsnValuePair.cxx:92
 AliRsnValuePair.cxx:93
 AliRsnValuePair.cxx:94
 AliRsnValuePair.cxx:95
 AliRsnValuePair.cxx:96
 AliRsnValuePair.cxx:97
 AliRsnValuePair.cxx:98
 AliRsnValuePair.cxx:99
 AliRsnValuePair.cxx:100
 AliRsnValuePair.cxx:101
 AliRsnValuePair.cxx:102
 AliRsnValuePair.cxx:103
 AliRsnValuePair.cxx:104
 AliRsnValuePair.cxx:105
 AliRsnValuePair.cxx:106
 AliRsnValuePair.cxx:107
 AliRsnValuePair.cxx:108
 AliRsnValuePair.cxx:109
 AliRsnValuePair.cxx:110
 AliRsnValuePair.cxx:111
 AliRsnValuePair.cxx:112
 AliRsnValuePair.cxx:113
 AliRsnValuePair.cxx:114
 AliRsnValuePair.cxx:115
 AliRsnValuePair.cxx:116
 AliRsnValuePair.cxx:117
 AliRsnValuePair.cxx:118
 AliRsnValuePair.cxx:119
 AliRsnValuePair.cxx:120
 AliRsnValuePair.cxx:121
 AliRsnValuePair.cxx:122
 AliRsnValuePair.cxx:123
 AliRsnValuePair.cxx:124
 AliRsnValuePair.cxx:125
 AliRsnValuePair.cxx:126
 AliRsnValuePair.cxx:127
 AliRsnValuePair.cxx:128
 AliRsnValuePair.cxx:129
 AliRsnValuePair.cxx:130
 AliRsnValuePair.cxx:131
 AliRsnValuePair.cxx:132
 AliRsnValuePair.cxx:133
 AliRsnValuePair.cxx:134
 AliRsnValuePair.cxx:135
 AliRsnValuePair.cxx:136
 AliRsnValuePair.cxx:137
 AliRsnValuePair.cxx:138
 AliRsnValuePair.cxx:139
 AliRsnValuePair.cxx:140
 AliRsnValuePair.cxx:141
 AliRsnValuePair.cxx:142
 AliRsnValuePair.cxx:143
 AliRsnValuePair.cxx:144
 AliRsnValuePair.cxx:145
 AliRsnValuePair.cxx:146
 AliRsnValuePair.cxx:147
 AliRsnValuePair.cxx:148
 AliRsnValuePair.cxx:149
 AliRsnValuePair.cxx:150
 AliRsnValuePair.cxx:151
 AliRsnValuePair.cxx:152
 AliRsnValuePair.cxx:153
 AliRsnValuePair.cxx:154
 AliRsnValuePair.cxx:155
 AliRsnValuePair.cxx:156
 AliRsnValuePair.cxx:157
 AliRsnValuePair.cxx:158
 AliRsnValuePair.cxx:159
 AliRsnValuePair.cxx:160
 AliRsnValuePair.cxx:161
 AliRsnValuePair.cxx:162
 AliRsnValuePair.cxx:163
 AliRsnValuePair.cxx:164
 AliRsnValuePair.cxx:165
 AliRsnValuePair.cxx:166
 AliRsnValuePair.cxx:167
 AliRsnValuePair.cxx:168
 AliRsnValuePair.cxx:169
 AliRsnValuePair.cxx:170
 AliRsnValuePair.cxx:171
 AliRsnValuePair.cxx:172
 AliRsnValuePair.cxx:173
 AliRsnValuePair.cxx:174
 AliRsnValuePair.cxx:175
 AliRsnValuePair.cxx:176
 AliRsnValuePair.cxx:177
 AliRsnValuePair.cxx:178
 AliRsnValuePair.cxx:179
 AliRsnValuePair.cxx:180
 AliRsnValuePair.cxx:181
 AliRsnValuePair.cxx:182
 AliRsnValuePair.cxx:183
 AliRsnValuePair.cxx:184
 AliRsnValuePair.cxx:185
 AliRsnValuePair.cxx:186
 AliRsnValuePair.cxx:187
 AliRsnValuePair.cxx:188
 AliRsnValuePair.cxx:189
 AliRsnValuePair.cxx:190
 AliRsnValuePair.cxx:191
 AliRsnValuePair.cxx:192
 AliRsnValuePair.cxx:193