#pragma link C++ class AliRsnPairDef+;
+#pragma link C++ class AliRsnValue+;
+#pragma link C++ class AliRsnValueList+;
#pragma link C++ class AliRsnFunction+;
#pragma link C++ class AliRsnFunctionAxis+;
#pragma link C++ class AliRsnAnalysisEffSE+;
#pragma link C++ class AliRsnAnalysisTrackEffSE+;
+#pragma link C++ class AliRsnTOFT0maker+;
+#pragma link C++ class AliRsnAnalysisPhi900GeV+;
+
#endif
--- /dev/null
+#include "TTree.h"
+#include "TParticle.h"
+#include "TRandom.h"
+#include "TLorentzVector.h"
+
+#include "AliLog.h"
+#include "AliESDEvent.h"
+#include "AliESDVertex.h"
+#include "AliESDtrack.h"
+#include "AliStack.h"
+#include "AliMCEvent.h"
+
+#include "AliRsnAnalysisPhi900GeV.h"
+
+
+AliRsnAnalysisPhi900GeV::AliRsnAnalysisPhi900GeV(const char *name) :
+ AliAnalysisTaskSE(name),
+ fUseMC(kFALSE),
+ fPDG(0),
+ fIM(0.0),
+ fPt(0.0),
+ fY(0.0),
+ fEta(0.0),
+ fDCAr(1E6),
+ fDCAz(1E6),
+ fChi2(1E6),
+ fNTPC(0),
+ fMinTPC(-1E6),
+ fMaxTPC( 1E6),
+ fOutTree(0x0),
+ fTOFESD(kFALSE),
+ fTOFSigma(210.0),
+ fTOFmaker(0x0),
+ fTOFSettings(AliRsnTOFT0maker::kNone)
+{
+//
+// Constructor
+//
+
+ DefineOutput(1, TTree::Class());
+}
+
+
+AliRsnAnalysisPhi900GeV::AliRsnAnalysisPhi900GeV(const AliRsnAnalysisPhi900GeV& copy) :
+ AliAnalysisTaskSE(copy),
+ fUseMC(copy.fUseMC),
+ fPDG(0),
+ fIM(0.0),
+ fPt(0.0),
+ fY(0.0),
+ fEta(0.0),
+ fDCAr(copy.fDCAr),
+ fDCAz(copy.fDCAz),
+ fChi2(copy.fChi2),
+ fNTPC(copy.fNTPC),
+ fMinTPC(copy.fMinTPC),
+ fMaxTPC(copy.fMaxTPC),
+ fOutTree(0x0),
+ fTOFESD(copy.fTOFESD),
+ fTOFSigma(copy.fTOFSigma),
+ fTOFmaker(0x0),
+ fTOFSettings(copy.fTOFSettings)
+{
+//
+// Copy constructor
+//
+}
+
+
+AliRsnAnalysisPhi900GeV& AliRsnAnalysisPhi900GeV::operator=(const AliRsnAnalysisPhi900GeV& copy)
+{
+//
+// Assignment operator
+//
+
+ fUseMC = copy.fUseMC;
+
+ fDCAr = copy.fDCAr;
+ fDCAz = copy.fDCAz;
+ fChi2 = copy.fChi2;
+ fNTPC = copy.fNTPC;
+
+ fMinTPC = copy.fMinTPC;
+ fMaxTPC = copy.fMaxTPC;
+
+ fTOFESD = copy.fTOFESD;
+ fTOFSigma = copy.fTOFSigma;
+ fTOFSettings = copy.fTOFSettings;
+
+ return (*this);
+}
+
+
+AliRsnAnalysisPhi900GeV::~AliRsnAnalysisPhi900GeV()
+{
+//
+// Destructor
+//
+
+ if (fOutTree) delete fOutTree;
+}
+
+
+void AliRsnAnalysisPhi900GeV::UserCreateOutputObjects()
+{
+//
+// Create the output data container
+//
+
+ // setup TOF maker
+ fTOFmaker = new AliRsnTOFT0maker;
+ fTOFmaker->SetTimeResolution(fTOFSigma * 1E-12);
+ fTOFmaker->SetESDdata(fTOFESD);
+ fTOFmaker->fSettings = fTOFSettings;
+ AliInfo(Form("TOF sigma = %f", fTOFSigma));
+ AliInfo(Form("TOF ESD = %s", (fTOFESD ? "YES" : "NO")));
+ AliInfo(Form("TOF settings = %s", fTOFmaker->Settings().Data()));
+
+ // load dead channel map
+ fTOFmaker->LoadChannelMap("tofmap.root");
+ fTOFmaker->SetMaskOffChannel();
+
+ // initialize random
+ gRandom->SetSeed(0);
+
+ // create output trees
+ OpenFile(1);
+ fOutTree = new TTree("rsnTree", "Pairs");
+
+ fOutTree->Branch("pdg", &fPDG, "pdg/S");
+ fOutTree->Branch("im" , &fIM , "im/F" );
+ fOutTree->Branch("y" , &fY , "y/F" );
+ fOutTree->Branch("pt" , &fPt , "pt/F" );
+ fOutTree->Branch("eta", &fEta, "eta/F");
+}
+
+
+void AliRsnAnalysisPhi900GeV::UserExec(Option_t *)
+{
+//
+// Main execution function
+//
+
+ // retrieve ESD event and related stack (if available)
+ AliESDEvent *esd = dynamic_cast<AliESDEvent*>(fInputEvent);
+ AliStack *stack = (fMCEvent ? fMCEvent->Stack() : 0x0);
+
+ // get the best primary vertex:
+ // first try the one with tracks
+ Int_t type = 0;
+ const AliESDVertex *v = esd->GetPrimaryVertexTracks();
+ if(v->GetNContributors() < 1)
+ {
+ // if not good, try SPD vertex
+ type = 1;
+ v = esd->GetPrimaryVertexSPD();
+
+ // if this is not good skip this event
+ if (v->GetNContributors() < 1) return;
+ }
+
+ // if the Z position is larger than 10, skip this event
+ if (TMath::Abs(v->GetZv()) > 10.0) return;
+
+ // smear TOF times in case of MC
+ if (stack) RemakeTOFtimeMC(esd);
+
+ // get time zero for TOF
+ Double_t *tof = fTOFmaker->RemakePID(esd);
+
+ if (!fUseMC) ProcessESD(esd, v, tof[0], stack);
+ else ProcessMC(stack);
+}
+
+
+void AliRsnAnalysisPhi900GeV::Terminate(Option_t *)
+{
+//
+// Terminate
+//
+}
+
+
+void AliRsnAnalysisPhi900GeV::ProcessESD
+(AliESDEvent *esd, const AliESDVertex *v, Double_t time0, AliStack *stack)
+{
+//
+// This function works with the ESD object
+//
+
+ // prepare to look on all tracks to select the ones
+ // which pass all the cuts
+ Int_t ntracks = esd->GetNumberOfTracks();
+ TArrayI pos(ntracks);
+ TArrayI neg(ntracks);
+
+ // define fixed functions for TOF compatibility range
+ Double_t a1 = 0.01, a2 = -0.03;
+ Double_t b1 = 0.25, b2 = 0.25;
+ Double_t c1 = 0.05, c2 = -0.03;
+ Double_t ymax, ymin;
+
+ // loop on all tracks
+ Int_t i, charge, nSPD, npos = 0, nneg = 0;
+ Float_t chi2, b[2], bCov[3];
+ Double_t tpc, bb, mom, tofTime, tofRef, tofRel, times[10];
+ Bool_t okTOF;
+ for (i = 0; i < ntracks; i++)
+ {
+ AliESDtrack *track = esd->GetTrack(i);
+ if (!track) continue;
+
+ // skip if it has not the required flags
+ if (!track->IsOn(AliESDtrack::kTPCin)) continue;
+ if (!track->IsOn(AliESDtrack::kTPCrefit)) continue;
+ if (!track->IsOn(AliESDtrack::kITSrefit)) continue;
+
+ // skip if it has not the TPC inner wall projection
+ if (!track->GetInnerParam()) continue;
+
+ // skip kink daughters
+ if ((Int_t)track->GetKinkIndex(0) > 0) continue;
+
+ // check clusters in TPC
+ if (track->GetTPCclusters(0) < fNTPC) continue;
+
+ // check chi2
+ chi2 = (Float_t)track->GetTPCchi2();
+ chi2 /= (Float_t)track->GetTPCclusters(0);
+ if (chi2 > fChi2) continue;
+
+ // check that has at least 1 SPD cluster
+ nSPD = 0;
+ if (track->HasPointOnITSLayer(0)) nSPD++;
+ if (track->HasPointOnITSLayer(1)) nSPD++;
+ if (nSPD < 1) continue;
+
+ // check primary by reverting to vertex
+ // and checking DCA
+ if (!track->RelateToVertex(v, esd->GetMagneticField(), kVeryBig)) continue;
+ track->GetImpactParameters(b, bCov);
+ if (b[0] > fDCAr) continue;
+ if (b[1] > fDCAz) continue;
+
+ // check TPC dE/dx
+ AliExternalTrackParam trackIn(*track->GetInnerParam());
+ mom = trackIn.P();
+ tpc = (Double_t)track->GetTPCsignal();
+ bb = AlephBB(mom);
+ tpc = (tpc - bb) / bb;
+ if (tpc < fMinTPC || tpc > fMaxTPC) continue;
+
+ // if possible, check TOF
+ okTOF = kTRUE;
+ if (track->IsOn(AliESDtrack::kTOFpid))
+ {
+ mom = track->P();
+ if (mom <= 0.26)
+ okTOF = kTRUE;
+ else
+ {
+ track->GetIntegratedTimes(times);
+ tofTime = (Double_t)track->GetTOFsignal() - time0;
+ tofRef = times[AliPID::kKaon];
+ tofRel = (tofTime - tofRef) / tofRef;
+ ymax = a1 / (mom - b1) + c1;
+ ymin = a2 / (mom - b2) + c2;
+ okTOF = (tofRel >= ymin && tofRel <= ymax);
+ }
+ }
+ if (!okTOF) continue;
+
+ // if we arrive here, all cuts were passed
+ // and we add the track to one array depending on charge
+ charge = (Int_t)track->Charge();
+ if (charge > 0)
+ pos[npos++] = i;
+ else if (charge < 0)
+ neg[nneg++] = i;
+ }
+
+ // resize arrays accordingly
+ pos.Set(npos);
+ neg.Set(nneg);
+
+ // loop to compute invariant mass
+ Int_t ip, in, lp, ln;
+ AliPID pid;
+ Double_t kmass = pid.ParticleMass(AliPID::kKaon);
+ Double_t phimass = 1.019455;
+ TParticle *partp = 0x0, *partn = 0x0;
+ AliESDtrack *tp = 0x0, *tn = 0x0;
+ TLorentzVector vp, vn, vsum, vref;
+ for (ip = 0; ip < npos; ip++)
+ {
+ tp = esd->GetTrack(pos[ip]);
+ lp = TMath::Abs(tp->GetLabel());
+ if (stack) partp = stack->Particle(lp);
+
+ for (in = 0; in < nneg; in++)
+ {
+ if (pos[ip] == neg[in]) continue;
+ tn = esd->GetTrack(neg[in]);
+ ln = TMath::Abs(tn->GetLabel());
+ if (stack) partn = stack->Particle(ln);
+
+ fPDG = 0;
+ if (partp && partn)
+ {
+ if (partp->GetFirstMother() == partn->GetFirstMother())
+ {
+ if (partp->GetFirstMother() > 0)
+ {
+ TParticle *mum = stack->Particle(partp->GetFirstMother());
+ fPDG = mum->GetPdgCode();
+ }
+ }
+ }
+ fPDG = TMath::Abs(fPDG);
+
+ vp.SetXYZM(tp->Px(), tp->Py(), tp->Pz(), kmass);
+ vn.SetXYZM(tn->Px(), tn->Py(), tn->Pz(), kmass);
+ vsum = vp + vn;
+ vref.SetXYZM(vsum.X(), vsum.Y(), vsum.Z(), phimass);
+
+ fIM = (Float_t)vsum.M();
+ fPt = (Float_t)vsum.Perp();
+ fEta = (Float_t)vsum.Eta();
+ fY = (Float_t)vref.Rapidity();
+
+ fOutTree->Fill();
+ }
+ }
+}
+
+
+void AliRsnAnalysisPhi900GeV::ProcessMC(AliStack *stack)
+{
+//
+// Function to process stack only
+//
+
+ if (!stack) return;
+ Int_t nPart = stack->GetNtrack();
+
+ // loop to compute invariant mass
+ Int_t ip, in;
+ AliPID pid;
+ Double_t kmass = pid.ParticleMass(AliPID::kKaon);
+ Double_t phimass = 1.019455;
+ TParticle *partp = 0x0, *partn = 0x0;
+ TLorentzVector vp, vn, vsum, vref;
+
+ for (ip = 0; ip < nPart; ip++)
+ {
+ partp = stack->Particle(ip);
+ if (partp->GetPdgCode() != 321) continue;
+
+ for (in = 0; in < nPart; in++)
+ {
+ partn = stack->Particle(in);
+ if (partn->GetPdgCode() != -321) continue;
+
+ fPDG = 0;
+ if (partp->GetFirstMother() == partn->GetFirstMother())
+ {
+ if (partp->GetFirstMother() > 0)
+ {
+ TParticle *mum = stack->Particle(partp->GetFirstMother());
+ fPDG = mum->GetPdgCode();
+ }
+ }
+ fPDG = TMath::Abs(fPDG);
+ if (fPDG != 333) continue;
+
+ vp.SetXYZM(partp->Px(), partp->Py(), partp->Pz(), kmass);
+ vn.SetXYZM(partn->Px(), partn->Py(), partn->Pz(), kmass);
+ vsum = vp + vn;
+ vref.SetXYZM(vsum.X(), vsum.Y(), vsum.Z(), phimass);
+
+ fIM = (Float_t)vsum.M();
+ fPt = (Float_t)vsum.Perp();
+ fEta = (Float_t)vsum.Eta();
+ fY = (Float_t)vref.Rapidity();
+
+ fOutTree->Fill();
+ }
+ }
+}
+
+
+Double_t AliRsnAnalysisPhi900GeV::AlephBB(Double_t p, Double_t mass)
+{
+//
+// Compute expected Bethe-Bloch for that momentum and mass
+//
+
+ if (mass < 1E-6) return 0.0;
+
+ Double_t aa, bb, out, beta, bg;
+
+ bg = p / mass;
+ beta = bg / TMath::Sqrt(1.0 + bg * bg);
+ aa = TMath::Power(beta, fTPCpar[3]);
+ bb = TMath::Power(1./bg, fTPCpar[4]);
+ bb = TMath::Log(fTPCpar[2] + bb);
+ out = (fTPCpar[1] - aa - bb) * fTPCpar[0]/aa;
+
+ return out;
+}
+
+
+Double_t AliRsnAnalysisPhi900GeV::RemakeTOFtimeMC(AliESDEvent *& esd)
+{
+//
+// Smear initial time for TOF in order to reproduce data resolution
+//
+
+ Double_t t0 = gRandom->Gaus(0,135.); //spread in ps
+ Int_t ntracks = esd->GetNumberOfTracks();
+ Double_t sigmaStandard = 80.; // 80 ps from TOF
+
+ while (ntracks--)
+ {
+ AliESDtrack *t = esd->GetTrack(ntracks);
+ if ((t->GetStatus()&AliESDtrack::kTOFout) == 0 || (t->GetStatus()&AliESDtrack::kTIME)==0) continue;
+ Double_t time = t->GetTOFsignal();
+ if(fTOFSigma > sigmaStandard)
+ {
+ Double_t sigmaAdded = TMath::Sqrt(fTOFSigma*fTOFSigma - sigmaStandard*sigmaStandard);
+ Double_t timerandomtrack = gRandom->Gaus(0, sigmaAdded); //spread in ps
+ time += timerandomtrack;
+ }
+ time += t0;
+ t->SetTOFsignal(time);
+ }
+ return t0;
+}
--- /dev/null
+#ifndef ALIRSNANALYSISPHI900GEV
+#define ALIRSNANALYSISPHI900GEV
+
+#include "AliAnalysisTaskSE.h"
+#include "AliRsnTOFT0maker.h"
+
+class TTree;
+class AliESDEvent;
+class AliESDVertex;
+class AliStack;
+
+class AliRsnAnalysisPhi900GeV : public AliAnalysisTaskSE
+{
+ public:
+
+ AliRsnAnalysisPhi900GeV(const char *name = "Phi900GeV");
+ AliRsnAnalysisPhi900GeV(const AliRsnAnalysisPhi900GeV& copy);
+ AliRsnAnalysisPhi900GeV& operator=(const AliRsnAnalysisPhi900GeV& copy);
+ virtual ~AliRsnAnalysisPhi900GeV();
+
+ void SetUseMC(Bool_t yn = kTRUE) {fUseMC = yn;}
+ void SetMaxDCAr(Double_t v) {fDCAr = v;}
+ void SetMaxDCAz(Double_t v) {fDCAz = v;}
+ void SetMaxChi2(Double_t v) {fChi2 = v;}
+ void SetMinNTPC(Int_t n) {fNTPC = n;}
+ void SetTPCrange(Double_t min, Double_t max) {fMinTPC = min; fMaxTPC = max;}
+ void SetTPCpar(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4)
+ {fTPCpar[0]=p0;fTPCpar[1]=p1;fTPCpar[2]=p2;fTPCpar[3]=p3;fTPCpar[4]=p4;}
+
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *option = "");
+ virtual void Terminate(Option_t *option = "");
+
+ private:
+
+ void ProcessESD(AliESDEvent *esd, const AliESDVertex *v, Double_t time0, AliStack *stack);
+ void ProcessMC(AliStack *stack);
+ Double_t AlephBB(Double_t p, Double_t mass = 0.493677);
+ Double_t RemakeTOFtimeMC(AliESDEvent *& esd);
+
+ Bool_t fUseMC;
+
+ Float_t fPDG;
+ Float_t fIM;
+ Float_t fPt;
+ Float_t fY;
+ Float_t fEta;
+
+ Double_t fDCAr;
+ Double_t fDCAz;
+ Double_t fChi2;
+ Int_t fNTPC;
+
+ Double_t fTPCpar[5];
+ Double_t fMinTPC;
+ Double_t fMaxTPC;
+
+ TTree *fOutTree;
+
+ Bool_t fTOFESD; // TOF flag to check if ESD data should be used
+ Double_t fTOFSigma; // TOF default resolution
+ AliRsnTOFT0maker *fTOFmaker; //! TOF time0 computator
+ AliRsnTOFT0maker::ESettings fTOFSettings; // TOF settings
+
+ // ROOT dictionary
+ ClassDef(AliRsnAnalysisPhi900GeV,1)
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+/* $Id: AliRsnTOFT0maker.cxx,v 1.8 2010/01/19 16:32:20 noferini Exp $ */
+
+/////////////////////////////////////////////////////////////////////////////
+// //
+// This class contains the basic functions for the time zero //
+// evaluation with TOF detector informations. //
+// Use case in an analysis task: //
+// //
+// Create the object in the task constructor (fTOFmakerANA is a private var) //
+// fTOFmakerANA = new AliRsnTOFT0maker(); //
+// fTOFmakerANA->SetTimeResolution(115.0e-12); // if you want set the TOF res //
+// 115 ps is the TOF default resolution value //
+// //
+// Use the RemakePID method in the task::Exec //
+// Double_t* calcolot0; //
+// calcolot0=fTOFmakerANA->RemakePID(fESD); //
+// //calcolot0[0] = calculated event time //
+// //calcolot0[1] = event time time resolution //
+// //calcolot0[2] = average event time for the current fill //
+// //
+// Let consider that: //
+// - the PIF is automatically recalculated with the event time subtrction //
+// //
+/////////////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <stdlib.h>
+
+#include "AliTOFT0v1.h"
+#include "AliTOFcalibHisto.h"
+#include "AliPID.h"
+#include "AliESDpid.h"
+#include "TFile.h"
+#include "AliRsnTOFT0maker.h"
+
+ClassImp(AliRsnTOFT0maker)
+
+//____________________________________________________________________________
+ AliRsnTOFT0maker::AliRsnTOFT0maker():
+ fSettings(kNone),
+ fCalib(new AliTOFcalibHisto()),
+ fESDswitch(0),
+ fTimeResolution(115),
+ fT0sigma(1000),
+ fHmapChannel(0),
+ fKmask(0),
+ fNoTOFT0(0)
+{
+ fCalculated[0] = 0;
+ fCalculated[1] = 0;
+ fCalculated[2] = 0;
+ fCalculated[3] = 0;
+
+ fCalib->LoadCalibPar();
+
+ if(AliPID::ParticleMass(0) == 0) new AliPID();
+}
+//____________________________________________________________________________
+AliRsnTOFT0maker::AliRsnTOFT0maker(const AliRsnTOFT0maker & t) :
+ TObject(),
+ fSettings(t.fSettings),
+ fCalib(t.fCalib),
+ fESDswitch(t.fESDswitch),
+ fTimeResolution(t.fTimeResolution),
+ fT0sigma(t.fT0sigma),
+ fHmapChannel(t.fHmapChannel),
+ fKmask(t.fKmask),
+ fNoTOFT0(t.fNoTOFT0)
+{
+}
+
+//____________________________________________________________________________
+AliRsnTOFT0maker& AliRsnTOFT0maker::operator=(const AliRsnTOFT0maker &t)
+{
+ //
+ // assign. operator
+ //
+
+ fSettings = t.fSettings;
+ if (this == &t)
+ return *this;
+ fCalib = t.fCalib;
+ fESDswitch = t.fESDswitch;
+ fTimeResolution = t.fTimeResolution;
+ fT0sigma = t.fT0sigma;
+
+ return *this;
+}
+//____________________________________________________________________________
+AliRsnTOFT0maker::~AliRsnTOFT0maker()
+{
+ // dtor
+ if(fCalib) delete fCalib;
+}
+//____________________________________________________________________________
+Double_t* AliRsnTOFT0maker::RemakePID(AliESDEvent *esd,Double_t t0time,Double_t t0sigma){
+ //
+ // Remake TOF PID probabilities
+ //
+
+ Double_t *t0tof;
+
+ if(fKmask) ApplyMask(esd);
+
+ AliTOFT0v1* t0makerANA=new AliTOFT0v1(esd);
+// t0makerANA->SetCalib(fCalib);
+ t0makerANA->SetTimeResolution(fTimeResolution*1e-12);
+
+ if(! fESDswitch){
+ TakeTimeRawCorrection(esd);
+ }
+
+ t0tof=t0makerANA->DefineT0("all");
+
+ Float_t lT0Current=0.;
+ fT0sigma=1000;
+
+ Int_t nrun = 0;//esd->GetRunNumber();
+ Double_t t0fill = 175;//GetT0Fill(nrun);
+ if (fSettings == kPass2 || fSettings == kPass4) // cambiato!!!!!!!!
+ {
+ nrun = esd->GetRunNumber();
+ t0fill = GetT0Fill(nrun);
+ }
+ else if (fSettings == kLHC09d10) // e' il MC del pass2?
+ {
+ t0fill = GetT0Fill(nrun);
+ }
+
+ fCalculated[0]=-1000*t0tof[0];
+ fCalculated[1]=1000*t0tof[1];
+ fCalculated[2] = t0fill;
+ fCalculated[3] = t0tof[2];
+
+ if(fCalculated[1] < 150 && TMath::Abs(fCalculated[0] - t0fill) < 500){
+ fT0sigma=fCalculated[1];
+ lT0Current=fCalculated[0];
+ }
+
+ if(t0sigma < 1000){
+ if(fT0sigma < 1000){
+ Double_t w1 = 1./t0sigma/t0sigma;
+ Double_t w2 = 1./fCalculated[1]/fCalculated[1];
+
+ Double_t wtot = w1+w2;
+
+ lT0Current = (w1*t0time + w2*fCalculated[0]) / wtot;
+ fT0sigma = TMath::Sqrt(1./wtot);
+ }
+ else{
+ lT0Current=t0time;
+ fT0sigma=t0sigma;
+ }
+ }
+
+ if(fT0sigma >= 1000 || fNoTOFT0){
+ lT0Current = t0fill;
+ fT0sigma = 135;
+
+ fCalculated[0] = t0fill;
+ fCalculated[1] = 150;
+ }
+
+ RemakeTOFpid(esd,lT0Current);
+
+ return fCalculated;
+}
+//____________________________________________________________________________
+void AliRsnTOFT0maker::TakeTimeRawCorrection(AliESDEvent * const esd){
+ //
+ // Take raw corrections for time measurements
+ //
+
+ Int_t ntracks = esd->GetNumberOfTracks();
+
+ while (ntracks--) {
+ AliESDtrack *t=esd->GetTrack(ntracks);
+
+ if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
+
+ Double_t time=t->GetTOFsignalRaw();
+ Double_t tot = t->GetTOFsignalToT();
+ Int_t chan = t->GetTOFCalChannel();
+ Double_t corr = fCalib->GetFullCorrection(chan,tot) - fCalib->GetCorrection(AliTOFcalibHisto::kTimeSlewingCorr,chan,0);
+ time -= corr*1000;
+
+ //Int_t crate = Int_t(fCalib->GetCalibMap(AliTOFcalibHisto::kDDL,chan));
+
+// if(crate == 63 || crate == 62){
+// time += 9200;
+
+// }
+
+// if(crate == 63 || crate == 62|| crate == 61){
+// printf("%i) %f\n",crate,time);
+// getchar();
+// }
+ t->SetTOFsignal(time);
+ }
+}
+//____________________________________________________________________________
+void AliRsnTOFT0maker::RemakeTOFpid(AliESDEvent *esd,Float_t timezero){
+ //
+ // Recalculate TOF PID probabilities
+ //
+ AliESDpid pidESD;
+ pidESD.GetTOFResponse().SetTimeResolution(TMath::Sqrt(fT0sigma*fT0sigma + fTimeResolution*fTimeResolution));
+ pidESD.MakePID(esd,kFALSE,timezero);
+
+}
+//____________________________________________________________________________
+Double_t AliRsnTOFT0maker::GetT0Fill(Int_t nrun) const {
+ //
+ // Return T0 of filling
+ //
+
+ Double_t t0;
+ if(nrun==104065) t0= 1771614;
+ else if(nrun==104068) t0= 1771603;
+ else if(nrun==104070) t0= 1771594;
+ else if(nrun==104073) t0= 1771610;
+ else if(nrun==104080) t0= 1771305;
+ else if(nrun==104083) t0= 1771613;
+ else if(nrun==104157) t0= 1771665;
+ else if(nrun==104159) t0= 1771679;
+ else if(nrun==104160) t0= 1771633;
+ else if(nrun==104316) t0= 1764344;
+ else if(nrun==104320) t0= 1764342;
+ else if(nrun==104321) t0= 1764371;
+ else if(nrun==104439) t0= 1771750;
+ else if(nrun==104792) t0= 1771755;
+ else if(nrun==104793) t0= 1771762;
+ else if(nrun==104799) t0= 1771828;
+ else if(nrun==104800) t0= 1771788;
+ else if(nrun==104801) t0= 1771796;
+ else if(nrun==104802) t0= 1771775;
+ else if(nrun==104803) t0= 1771795;
+ else if(nrun==104824) t0= 1771751;
+ else if(nrun==104825) t0= 1771763;
+ else if(nrun==104845) t0= 1771792;
+ else if(nrun==104852) t0= 1771817;
+ else if(nrun==104864) t0= 1771825;
+ else if(nrun==104865) t0= 1771827;
+ else if(nrun==104867) t0= 1771841;
+ else if(nrun==104876) t0= 1771856;
+ else if(nrun==104878) t0= 1771847;
+ else if(nrun==104879) t0= 1771830;
+ else if(nrun==104892) t0= 1771837;
+ else t0= 487;
+
+ if(fESDswitch) t0 -= 487;
+ else { if (fSettings == kPass4) t0 -=37*1024*24.4; }
+
+ return t0;
+}
+
+//____________________________________________________________________________
+void AliRsnTOFT0maker::LoadChannelMap(char *filename){
+ // Load the histo with the channel off map
+ TFile *f= new TFile(filename);
+ if(!f){
+ printf("Cannot open the channel map file (%s)\n",filename);
+ return;
+ }
+
+ fHmapChannel = (TH1F *) f->Get("hChEnabled");
+
+ if(!fHmapChannel){
+ printf("Cannot laod the channel map histo (from %s)\n",filename);
+ return;
+ }
+
+}
+//____________________________________________________________________________
+void AliRsnTOFT0maker::ApplyMask(AliESDEvent *esd){
+ // Switch off the disable channel
+ if(!fHmapChannel){
+ printf("Channel Map is not available\n");
+ return;
+ }
+
+ Int_t ntracks = esd->GetNumberOfTracks();
+
+ while (ntracks--) {
+ AliESDtrack *t=esd->GetTrack(ntracks);
+
+ if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
+
+ Int_t chan = t->GetTOFCalChannel();
+
+ if(fHmapChannel->GetBinContent(chan) < 0.01){
+ t->ResetStatus(AliESDtrack::kTOFout);
+ }
+ }
+}
--- /dev/null
+#ifndef ALITOFT0MAKERANA_H
+#define ALITOFT0MAKERANA_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliRsnTOFT0maker.h,v 1.8 2010/01/19 16:32:20 noferini Exp $ */
+
+///////////////////////////////////////////////
+// //
+// Manager class for time zero evaluation //
+// with TOF informations //
+// //
+///////////////////////////////////////////////
+
+
+#include "TObject.h"
+#include "TString.h"
+#include "AliESDEvent.h"
+#include "AliStack.h"
+#include "TH1F.h"
+
+class AliTOFcalibHisto;
+class AliTOFT0v1;
+
+class AliRsnTOFT0maker : public TObject {
+public:
+
+ enum ESettings
+ {
+ kNone,
+ kPass2,
+ kPass4,
+ kLHC09d10
+ };
+
+ ESettings fSettings;
+ TString Settings()
+ {
+ TString out;
+ switch (fSettings)
+ {
+ case kPass2: out = "pass 2"; break;
+ case kPass4: out = "pass 4"; break;
+ case kLHC09d10: out = "LHC09d10"; break;
+ default: out = "none specific"; break;
+ }
+ return out;
+ }
+
+
+ AliRsnTOFT0maker() ;
+ virtual ~AliRsnTOFT0maker() ; // dtor
+ AliRsnTOFT0maker(const AliRsnTOFT0maker & t);
+ AliRsnTOFT0maker & operator=(const AliRsnTOFT0maker & t);
+
+ void SetESDdata(Bool_t val=kTRUE){fESDswitch=val;};
+
+ // return (fCalculated[0]=event time -- fCalculated[1]=sigma event time in ps -- fCalculated[2]=mean event time for each fill -- fCalculated[3]=number of tracks at the TOF level) if you can subtruct the event time; return NULL if there is no event time
+ Double_t *RemakePID(AliESDEvent *esd,Double_t t0time=0.,Double_t t0sigma=1000.); // t0time and t0sigma in ps
+
+ void SetTimeResolution(Double_t timeresolution){fTimeResolution=timeresolution;};// TOF timeresolution in [s] e.g. for 120 ps -> 1.2e-10
+ Double_t GetTimeResolution() const {return fTimeResolution;}
+
+ void LoadChannelMap(char *filename="$ALICE_ROOT/TOF/enableMap.104892.root"); //load the enable channel map
+ void ApplyMask(AliESDEvent *esd);
+
+ void SetNoTOFT0(Bool_t status=kTRUE){fNoTOFT0=status;}; // disable the TOF T0 info
+ void SetMaskOffChannel(Bool_t status=kTRUE){fKmask=status;}; // swith for the map off channel
+
+ private:
+ void TakeTimeRawCorrection(AliESDEvent * const esd);
+ void RemakeTOFpid(AliESDEvent *esd,Float_t timezero);
+ Double_t GetT0Fill(Int_t nrun) const ;
+
+ AliTOFcalibHisto *fCalib; // TOF calibration object pointer
+
+ Bool_t fESDswitch; // if you want take the ESD time instead of the raw + time slewing correction
+
+ Double_t fCalculated[4]; // contains the parameters with the event time
+ Double_t fTimeResolution; // global time resolution used to calculate T0
+
+ Float_t fT0sigma; // T0 resolution
+
+ TH1F *fHmapChannel; // histo with the channel map
+ Bool_t fKmask;
+ Bool_t fNoTOFT0;
+
+ ClassDef(AliRsnTOFT0maker,1); // Calculate the time zero using TOF detector */
+
+};
+
+#endif // ALITOFT0MAKERANA_H
--- /dev/null
+//
+// Class AliRsnValue
+//
+// Definition of a single value which can be computed
+// from any of the defined input objects implemented
+// in the resonance package.
+//
+
+#include "AliRsnEvent.h"
+#include "AliRsnDaughter.h"
+#include "AliRsnPairParticle.h"
+#include "AliRsnPairDef.h"
+
+#include "AliRsnValue.h"
+
+ClassImp(AliRsnValue)
+
+//_____________________________________________________________________________
+AliRsnValue::AliRsnValue(EAxisType type) : fType(type)
+{
+//
+// Constructor
+//
+}
+
+//_____________________________________________________________________________
+const char* AliRsnValue::GetName() const
+{
+//
+// Return the name of this object defined by the type
+//
+
+ switch (fType)
+ {
+ case kTrackPt: return "PT";
+ case kTrackEta: return "ETA";
+ case kTrack1P: return "P1";
+ case kTrack2P: return "P2";
+ case kTrack1Pt: return "PT1";
+ case kTrack2Pt: return "PT2";
+ case kPairInvMass: return "IM";
+ case kPairInvMassMC: return "IMMC";
+ case kPairInvMassRes: return "IMRES";
+ case kPairPt: return "PT";
+ case kPairEta: return "ETA";
+ case kPairMt: return "MT";
+ case kPairY: return "Y";
+ case kEventMult: return "MULT";
+ default: return "UNDEF";
+ }
+}
+
+//_____________________________________________________________________________
+AliRsnValue::EAxisObject AliRsnValue::GetAxisObject() const
+{
+//
+// Tells what kind of object must be evaluated for this axis
+//
+
+ switch (fType)
+ {
+ // values coming from single track
+ case kTrackPt:
+ case kTrackEta:
+ return kParticle;
+ // values coming from pair
+ case kTrack1P:
+ case kTrack2P:
+ case kTrack1Pt:
+ case kTrack2Pt:
+ case kPairInvMass:
+ case kPairInvMassMC:
+ case kPairInvMassRes:
+ case kPairPt:
+ case kPairEta:
+ case kPairMt:
+ case kPairY:
+ return kPair;
+ // values coming from event
+ case kEventMult:
+ return kEvent;
+ default:
+ return kNone;
+ }
+}
+
+//_____________________________________________________________________________
+Double_t AliRsnValue::Eval(TObject * const obj, const AliRsnPairDef *pairDef) const
+{
+//
+// Evaluation of the required value.
+// Checks that the passed object is of the right type
+// and if this check is successful, returns the required value.
+// The output of the function tells if it was successful,
+// and the values must be taken with GetValue().
+//
+
+ // dynamic casting
+ AliRsnDaughter *track = dynamic_cast<AliRsnDaughter*>(obj);
+ AliRsnPairParticle *pair = dynamic_cast<AliRsnPairParticle*>(obj);
+ AliRsnEvent *event = dynamic_cast<AliRsnEvent*>(obj);
+
+ // check that the object type and required input match
+ EAxisObject requiredInput = GetAxisObject();
+ Double_t mass = pairDef->GetMotherMass();
+ if (requiredInput == kParticle && !track)
+ return 0.0;
+ else if (requiredInput == kPair)
+ {
+ if (!pair)
+ return 0.0;
+ else
+ {
+ // if we are filling a pair, we need the pair def
+ if (pairDef)
+ mass = pairDef->GetMotherMass();
+ else
+ {
+ AliError("Cannot compute a 'pair' value if I don't have a vaild PairDef");
+ return 0.0;
+ }
+ }
+ }
+ else if (requiredInput == kEvent && !event)
+ {
+ return 0.0;
+ }
+ else
+ {
+ AliError(Form("Failed computation: expected type %d, passed a '%s'", (Int_t)requiredInput, obj->ClassName()));
+ return 0.0;
+ }
+
+ switch (fType)
+ {
+ case kTrackPt:
+ return track->Pt();
+ case kTrackEta:
+ return track->Eta();
+ case kTrack1P:
+ return pair->GetDaughter(0)->P();
+ case kTrack2P:
+ return pair->GetDaughter(1)->P();
+ case kTrack1Pt:
+ return pair->GetDaughter(0)->Pt();
+ case kTrack2Pt:
+ return pair->GetDaughter(1)->Pt();
+ case kPairInvMass:
+ return pair->GetInvMass(pairDef->GetMass(0), pairDef->GetMass(1));
+ case kPairInvMassMC:
+ return pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1));
+ case kPairInvMassRes:
+ {
+ Double_t value;
+ value = pair->GetInvMass (pairDef->GetMass(0), pairDef->GetMass(1));
+ value -= pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1));
+ value /= pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1));
+ return value;
+ }
+ case kPairPt:
+ return pair->GetPt();
+ case kPairEta:
+ return pair->GetEta();
+ case kPairMt:
+ if (TMath::Abs(mass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", mass));
+ return (TMath::Sqrt(pair->GetPt()*pair->GetPt() + mass*mass) - mass);
+ case kPairY:
+ if (TMath::Abs(mass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", mass));
+ return pair->GetY(mass);
+ case kEventMult:
+ return (Double_t)event->GetMultiplicity();
+ default:
+ AliWarning("Invalid value type");
+ return 0.0;
+ }
+}
--- /dev/null
+//
+// Class AliRsnValue
+//
+// Definition of a single value which can be computed
+// from any of the defined input objects implemented
+// in the resonance package.
+//
+
+#ifndef ALIRSNVALUE_H
+#define ALIRSNVALUE_H
+
+class AliRsnPairDef;
+
+class AliRsnValue : public TObject
+{
+ public:
+
+ enum EAxisType
+ {
+ kTrackPt,
+ kTrackEta,
+ kTrack1P,
+ kTrack2P,
+ kTrack1Pt,
+ kTrack2Pt,
+ kPairInvMass,
+ kPairInvMassMC,
+ kPairInvMassRes,
+ kPairPt,
+ kPairEta,
+ kPairMt,
+ kPairY,
+ kEventMult,
+ kAxisTypes
+ };
+
+ enum EAxisObject
+ {
+ kParticle,
+ kPair,
+ kEvent,
+ kNone
+ };
+
+ AliRsnValue(EAxisType type = kAxisTypes);
+ virtual ~AliRsnValue() { }
+
+ virtual const char* GetName() const;
+ EAxisObject GetAxisObject() const;
+ void SetType(EAxisType type) {fType = type;}
+ EAxisType GetAxisType() {return fType;}
+ Double_t Eval(TObject * const obj, const AliRsnPairDef *pairDef = 0x0) const;
+
+ private:
+
+ EAxisType fType; // value type
+
+ // ROOT dictionary
+ ClassDef(AliRsnValue, 1)
+};
+
+#endif
--- /dev/null
+//
+// Class AliRsnValueList
+//
+// This class defines a base classe to implement a function
+// which uses the internal RSN package event format (AliRsnEvent).
+// It contains some default flags which turn out to be useful:
+// - a flag to select only the "true" pairs (tracks from same resonance)
+// - a flag to know if the computation is done over two events (mixing)
+//
+// Any kind of analysis object should be implemented as inheriting from this
+// because the AliRsnAnalyzer which executes the analysis will accept a collection
+// of such objects, in order to have a unique format of processing method
+//
+// The user who implements a kind of computation type should inherit from
+// this class and override the virtual functions defined in it, which
+// initialize the final output histogram and define how to process data.
+//
+//
+// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
+//
+
+#include <TString.h>
+
+#include "AliLog.h"
+
+#include "AliRsnDaughter.h"
+#include "AliRsnEvent.h"
+#include "AliRsnPairDef.h"
+#include "AliRsnPairParticle.h"
+#include "AliRsnValue.h"
+
+#include "AliRsnValueList.h"
+
+ClassImp(AliRsnValueList)
+
+//________________________________________________________________________________________
+AliRsnValueList::AliRsnValueList() :
+ TNamed(),
+ fValueList("AliRsnValue", 0),
+ fArray(0)
+{
+//
+// Constructor.
+//
+}
+
+//________________________________________________________________________________________
+AliRsnValueList::AliRsnValueList(const AliRsnValueList ©) :
+ TNamed(copy),
+ fValueList(copy.fValueList),
+ fArray(copy.fArray)
+{
+//
+// Copy constructor.
+//
+}
+
+//________________________________________________________________________________________
+const AliRsnValueList& AliRsnValueList::operator=(const AliRsnValueList& copy)
+{
+//
+// Assignment operator.
+//
+
+ // copy name and title
+ SetName(copy.GetName());
+ SetTitle(copy.GetTitle());
+
+ // add a copy of each axis to this list
+ // this will update the value list accordingly
+ Int_t i, n = copy.fValueList.GetEntries();
+ for (i = 0; i < n; i++)
+ {
+ AliRsnValue *val = (AliRsnValue*)copy.fValueList[i];
+ AddValue(val);
+ }
+
+ return *this;
+}
+
+//________________________________________________________________________________________
+void AliRsnValueList::AddValue(const AliRsnValue *axis)
+{
+//
+// Adds a new value to the list
+// and upgrades the list of values accordingly
+//
+
+ Int_t size = fValueList.GetEntries();
+ new(fValueList[size]) AliRsnValue(*axis);
+ fArray.Set(size + 1);
+}
+
+//________________________________________________________________________________________
+Bool_t AliRsnValueList::Eval(TObject * const obj, const AliRsnPairDef *pairDef)
+{
+//
+// Fill function histogram using the passed object,
+// whose type is dynamically casted when used and checked.
+//
+
+ AliDebug(AliLog::kDebug +2,"->");
+
+ Int_t i, size = fValueList.GetSize();
+ for (i = 0; i < size; i++)
+ {
+ AliRsnValue *val = (AliRsnValue*)fValueList[i];
+ fArray[i] = val->Eval(obj, pairDef);
+ }
+}
--- /dev/null
+//
+// Class AliRsn Fcn
+//
+// This class defines a base classe to implement a typical computation
+// which uses the internal RSN package event format (AliRsnEvent).
+// It contains some default flags which turn out to be useful:
+// - a flag to select only the "true" pairs (tracks from same resonance)
+// - a flag to know if the computation is done over two events (mixing)
+//
+// Any kind of analysis object should be implemented as inheriting from this
+// because the AliRsnAnalyzer which executes the analysis will accept a collection
+// of such objects, in order to have a unique format of processing method
+//
+// The user who implements a kind of computation type should inherit from
+// this class and override the virtual functions defined in it, which
+// initialize the final output histogram and define how to process data.
+//
+//
+// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
+//
+
+#ifndef ALIRSNVALUELIST_H
+#define ALIRSNVALUELIST_H
+
+#include <TClonesArray.h>
+#include <TArrayD.h>
+#include <TNamed.h>
+
+class AliRsnValue;
+class AliRsnPairParticle;
+class AliRsnPairDef;
+
+class AliRsnValueList : public TNamed
+{
+
+ public:
+
+ AliRsnValueList();
+ AliRsnValueList(const AliRsnValueList ©);
+ virtual ~AliRsnValueList() { Clear(""); }
+ const AliRsnValueList& operator=(const AliRsnValueList ©);
+
+ virtual void Clear(Option_t* /*option = ""*/) {fValueList.Delete();}
+ Int_t GetNumberOfValues() {return fValueList.GetEntries();}
+
+ void AddValue(const AliRsnValue * const axis);
+ Bool_t Eval(TObject * const obj, const AliRsnPairDef *pairDef = 0x0);
+ Double_t GetValue(Int_t i) {if (i>=0 && i<fArray.GetSize()) return fArray[i]; return 0.0;}
+
+ protected:
+
+ TClonesArray fValueList; // list of computators
+ TArrayD fArray; // list of values
+
+ // ROOT dictionary
+ ClassDef(AliRsnValueList, 3)
+};
+
+#endif
RESONANCES/AliRsnPIDDefESD.cxx \
RESONANCES/AliRsnEvent.cxx \
RESONANCES/AliRsnPairDef.cxx \
+ RESONANCES/AliRsnValue.cxx \
+ RESONANCES/AliRsnValueList.cxx \
RESONANCES/AliRsnFunction.cxx \
RESONANCES/AliRsnFunctionAxis.cxx \
RESONANCES/AliRsnPair.cxx \
RESONANCES/AliRsnAnalysisME.cxx \
RESONANCES/AliRsnAnalysisEffSE.cxx \
RESONANCES/AliRsnAnalysisTrackEffSE.cxx \
+ RESONANCES/AliRsnTOFT0maker.cxx \
+ RESONANCES/AliRsnAnalysisPhi900GeV.cxx
HDRS= $(SRCS:.cxx=.h)
EXPORT:=
-EINCLUDE:= PYTHIA6 PWG2/RESONANCES CORRFW
+EINCLUDE:= PYTHIA6 PWG2/RESONANCES CORRFW TOF
ifeq (win32gcc,$(ALICE_TARGET))
PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) -lSTEERBase \