--- /dev/null
+//====================================
+//last modified FK 6.NOV 2009
+//====================================
+//blah
+// blah
+
+#include "AliJBaseCard.h"
+
+//ClassImp(AliJBaseCard);
+
+AliJBaseCard::AliJBaseCard()
+ //:TObject()
+{
+ //constructor
+}
+
+AliJBaseCard::AliJBaseCard(const char *filename)
+ //:TObject()
+{
+ //constructor
+
+ strcpy(fcardname, filename); //needed in PrintOut()
+
+ fnentry = 0; //initialize nr of lines
+
+ if( strlen( filename ) > 0 ){
+
+ //---- r e a d t h e c a r d ----
+ ReadInputCard();//read config file fill Tvectors
+ }
+}
+
+
+AliJBaseCard& AliJBaseCard::operator=(const AliJBaseCard& obj){
+ // copy constructor
+ return *this;
+}
+
+AliJBaseCard::~AliJBaseCard(){
+ // destructor
+}
+
+
+unsigned int AliJBaseCard::GetTVectorIndex(TString keyword, int tol){
+
+ // //returns findex of a TVector according to its position in std::hash_map
+ // std::hash_map< TString, unsigned int >::iterator iter = MapKeyWordToTVector.begin();
+ // iter = MapKeyWordToTVector.find(keyword);
+ // if(iter != MapKeyWordToTVector.end()){
+ // return (unsigned int) iter->second;
+ // }else{
+ // cout << "ERROR: \""<<keyword.Data()<<"\" must be defined "<< endl;
+ // exit(1);
+ // }
+
+ UInt_t i;
+ Int_t ind;
+ i = 0;
+ ind = -1;
+
+ //cout<<"ALIJBASECARD_SEARCH_MODE_HASHLIST"<<endl;
+ TNamed * ko = (TNamed*)fKeyTable.FindObject( keyword.Data() );
+ //cout<<ko<<endl;
+ if(ko) ind = ko->GetUniqueID();
+ if( ind == -1 ){
+ for( UInt_t i=0;i<fKeyWordVector.size();i++ ){
+ if( fKeyWordVector[i] == keyword ) return i;
+ }
+ if( tol == 0 ){
+ cout << "ERROR: \""<<keyword.Data()<<"\" must be defined "<< endl;
+ exit(1);
+ }else{
+ cout << "Warning: \""<<keyword.Data()<<"\" is not exist. return default value "<< endl;
+ return -1;
+ }
+ }
+
+ return ind;
+}
+
+int AliJBaseCard::GetN(TString keyword){
+ //returns size of TVector
+ unsigned int findex = GetTVectorIndex(keyword);
+ return (int) fValuesVector[findex].GetNrows();
+}
+
+TVector * AliJBaseCard::GetVector(TString keyword ){
+ int findex = GetTVectorIndex(keyword);
+ return &fValuesVector[findex];
+}
+
+float AliJBaseCard::Get(TString keyword, int VectorComponent){
+ //returns VectorComponent Component of fValuesVecto`uor TVector for given keyword
+ int findex = GetTVectorIndex(keyword);
+ if(0<=VectorComponent && VectorComponent<GetNwithIndex(findex)){
+ return fValuesVector[findex](VectorComponent+1);
+ }else{
+ cout<<"ERROR: fValuesVector findex out of range "<<keyword.Data()<<endl;
+ cout << " Max findex: " << GetN(keyword) - 1<< " Asked: " << VectorComponent << endl;
+ exit(1);
+ }
+}
+
+TString AliJBaseCard::GetStr(TString keyword ){
+ int findex = GetTVectorIndex(keyword, 1);
+ if( findex < 0 ) return TString("");
+ return fValueString[findex];
+}
+
+
+void AliJBaseCard::InitCard(){
+ // set the length of fIndexVector and disable all indices
+}
+
+/*
+void AliJBaseCard::FinishCard(){
+ // recompute fast idices
+}
+*/
+
+void AliJBaseCard::ReadInputCard(){
+ // read card
+
+ char buffer[kMaxDimBuffer];
+ ifstream incard;
+
+ cout << "Reading fcard from file: " << fcardname << endl;
+ incard.open(fcardname,ios::in);
+
+ if(!incard){
+ cout<<"ERROR: Config file <"<<fcardname<<"> not found!"<<endl;
+ exit(1);
+ }
+
+ InitCard();
+
+ while(!incard.eof()){ //loop over the input fcard
+
+ incard.getline(buffer,kMaxDimBuffer); //read a line
+
+ if(fnentry > 1000){//is the file reasonably long?
+ cout<<"Maximum number of 1000 lines reached in AliJBaseCard.C"<<endl;
+ exit(1);
+ }
+
+ ReadInputLine( buffer );
+
+ fnentry++;
+ }//while eof
+
+ FinishCard();
+
+ return;
+}
+
+void AliJBaseCard::ReadInputLine( const char *buffer ){
+ // parse a line
+
+
+
+ TString tstr(buffer); //convert the line in the buffer to TString
+
+ if( tstr.BeginsWith("#") ) return;//skipp comments
+ tstr.ReplaceAll("\t"," ");//get rid of tabelators
+
+ //remove comment in line
+ Ssiz_t startOFcomment = tstr.First('#');
+ if(startOFcomment>0){
+ tstr.Remove(startOFcomment,tstr.Length() - startOFcomment);
+ }
+
+ //remove white spaces from the begining
+ if(tstr.BeginsWith(" ")){
+ Ssiz_t startOFkeyword = 0;
+ while(1){
+ TString s = tstr[startOFkeyword];
+ if(s.CompareTo(" ")) break;
+ startOFkeyword++;
+ }
+ tstr.Replace(0,startOFkeyword,"",0);
+ }
+
+ //separate inputs
+ TObjArray *lineContents = tstr.Tokenize(" ");
+
+ if(lineContents->GetEntriesFast() < 1) return;//skipp empty lines
+
+ //----- Read a keyword -----
+ TString entryname = ((TObjString*)(lineContents->At(0)))->String(); //read a key word
+
+ if(lineContents->GetEntriesFast() == 1){
+ cout<<"WARNING: single keyword "<<entryname.Data()<<" on line"<<endl;
+ }else{
+
+
+ //----- Read parameters -----
+ vector< float > items;//auxiliary vector
+
+ for(int i=1; i<lineContents->GetEntriesFast(); i++){ //loop over the numbers
+ TString token = ((TObjString*)(lineContents->At(i)))->String();//read a string
+
+ if(token.IsFloat()){
+ items.push_back(token.Atof());//if string is float number store it to vector
+ }else{
+ items.push_back(0);
+ // cout<<"ERROR: char "<<token.Data()<<" among numbers"<<endl;
+ // exit(1);
+ }
+ }//end of the for loop
+
+
+ //Fill TVectors and Map
+ fKeyWordVector.push_back( entryname.Data() );//put the new keyword at the end of the array
+
+
+ fValuesVector.push_back( TVector( 1, items.size(), &items[0]) );//store TVector to array
+ fValueString.push_back( ((TObjString*)(lineContents->At(1)))->String() );
+
+ // MapKeyWordToTVector.insert(pair<TString, unsigned int>(entryname.Data(),fKeyWordVector.size()-1));
+ AddToKeyTable( entryname, fValuesVector.size()-1 );
+
+
+ }//else
+
+ lineContents->~TObjArray();//remove array from heap
+}
+
+void AliJBaseCard::PrintOut(){
+ // echo
+ cout<<endl<<"======== "<<fcardname<<" ========="<<endl;
+ for(unsigned int i=0; i<fValuesVector.size();i++){
+ cout<<Form("%15s",fKeyWordVector[i].Data());//print keyword
+ cout<<" (dim ="<<fValuesVector[i].GetNrows()<<") ";//print size of TVector
+ for(int j=1; j<=fValuesVector[i].GetNrows(); j++){
+ cout<<fValuesVector[i][j]<<" ";//TVector components
+ }
+ cout<<endl;
+ }
+}
+
+
+void AliJBaseCard::WriteCard(TFile *file){
+ // write
+ cout<<endl<<"====== Writing into file ========="<<endl;
+
+ if(!file->GetDirectory("JCard")) {
+ file->mkdir("JCard");//directory to store input parameters
+ }
+ file->cd("JCard");
+ for(unsigned int i=0;i<fValuesVector.size();i++){
+ fValuesVector[i].Write(fKeyWordVector[i]);
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+//=================================================
+// AliJBaseCard.h
+// last modified FK 6.NOV 2009
+//=================================================
+
+#ifndef ALIJBASECARD_H
+#define ALIJBASECARD_H
+
+#include <TObject.h>
+
+#include <iostream>
+#include <fstream>
+
+#include <TString.h>
+#include <TVector.h>
+#include <TMath.h>
+#include <TObjArray.h>
+#include <TObjString.h>
+#include <TFile.h>
+#include <TF1.h>
+#include <vector>
+#include <THashList.h>
+#include <TNamed.h>
+
+using namespace std;
+#ifndef AliJMaxDimBuffer
+#define AliJMaxDimBuffer
+const int kMaxDimBuffer = 300;//max length of a line read to a buffe
+#endif
+
+class AliJBaseCard {
+
+ //==== M e m b e r F u n c t i o n s ========
+
+public:
+
+ AliJBaseCard(); // constructor
+ AliJBaseCard(const char *filename); // constructor
+ AliJBaseCard& operator=(const AliJBaseCard& obj);
+
+ virtual ~AliJBaseCard();
+
+ void AddToKeyTable( TString key, int index ){
+ TNamed * ko = new TNamed(key.Data(),"");
+ ko->SetUniqueID(index);
+ fKeyTable.Add(ko);// TODO check duplicate
+ }
+
+ float Get(TString keyword, int VectorComponent=0); //get TVector component
+ TString GetStr(TString keyword ); //get TVector component
+ TVector* GetVector( TString keyword );
+ int GetN(TString keyword); //get TVector dimension
+ void PrintOut();
+ void WriteCard(TFile *file);
+
+ virtual void InitCard();
+ void FinishCard() const {cout << "card finished" << endl;};
+ void ReadInputLine( const char* buffer );
+
+protected:
+ void ReadInputCard();
+
+ int GetNwithIndex(int i){ return fValuesVector[i].GetNrows(); }
+
+ unsigned int GetTVectorIndex(TString keyword, int tol=0);
+
+ //==== D a t a M e m b e r s ========
+
+ char fcardname[255]; // file name
+ int fnentry; //Number of lines in cfg file
+ std::vector< TString > fKeyWordVector; //array of key words
+ std::vector< TVector > fValuesVector; //array of float number confg parameter vectors
+ std::vector< TString > fValueString; // Storage of raw inut string for each item
+ //std::map< TString, unsigned int > MapKeyWordToTVector;//mapping keywords to TVector
+ THashList fKeyTable; // key map with hash algorithm
+
+ //ClassDef(AliJBaseCard, 1); // EMCAL for jcorran
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-2014, 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. *
+ **************************************************************************/
+
+// Comment describing what this class does needed!
+
+// $Id: AliJBaseTrack.cxx,v 1.5 2008/05/08 15:19:52 djkim Exp $
+////////////////////////////////////////////////////
+/*!
+ \file AliJBaseTrack.cxx
+ \brief
+ \author J. Rak, D.J.Kim, R.Diaz (University of Jyvaskyla)
+ \email: djkim@jyu.fi
+ \version $Revision: 1.5 $
+ \date $Date: 2008/05/08 15:19:52 $
+ */
+////////////////////////////////////////////////////
+
+#include "AliJBaseTrack.h"
+
+//______________________________________________________________________________
+AliJBaseTrack::AliJBaseTrack():
+ fID(-1),
+ fLabel(-9999),
+ fParticleType(-1),
+ fCharge(0),
+ fStatus(0),
+ fFlags(0),
+ fTriggID(-1),
+ fAssocID(-1),
+ fTracEff(-1),
+ fMCIndex(-9999),
+ fWeight(1.0)
+{
+ // constructor
+}
+
+//_____________________________________________________________
+AliJBaseTrack::AliJBaseTrack(float px,float py, float pz, float e, Int_t id, Short_t ptype, Char_t charge):
+ TLorentzVector( px, py, pz, e ),
+ fID(id),
+ fLabel(-9999),
+ fParticleType(ptype),
+ fCharge(charge),
+ fStatus(0),
+ fFlags(0),
+ fTriggID(-1),
+ fAssocID(-1),
+ fTracEff(-1),
+ fMCIndex(-9999),
+ fWeight(1.0)
+{
+ // constructor
+}
+
+//_____________________________________________________________
+AliJBaseTrack::AliJBaseTrack(const AliJBaseTrack& a):
+ TLorentzVector (a),
+ fID (a.fID),
+ fLabel (a.fLabel),
+ fParticleType ( a.fParticleType ),
+ fCharge ( a.fCharge ),
+ fStatus ( a.fStatus ),
+ fFlags ( a.fFlags ),
+ fTriggID( a.fTriggID ),
+ fAssocID( a.fAssocID ),
+ fTracEff( a.fTracEff ),
+ fMCIndex( a.fMCIndex ),
+ fWeight ( a.fWeight )
+{
+ //copy constructor
+}
+
+//_____________________________________________________________
+AliJBaseTrack::AliJBaseTrack(const TLorentzVector& a):
+ TLorentzVector (a),
+ fID ( -1 ),
+ fLabel ( -9999 ),
+ fParticleType ( -1 ),
+ fCharge ( 0 ),
+ fStatus ( 0 ),
+ fFlags ( 0 ),
+ fTriggID(-1),
+ fAssocID(-1),
+ fTracEff(-1),
+ fMCIndex(-9999),
+ fWeight(1.0)
+{
+ //copy constructor
+}
+//_____________________________________________________________
+AliJBaseTrack& AliJBaseTrack::operator=(const AliJBaseTrack& trk){
+ //operator =
+ if(this != &trk){
+ TLorentzVector::operator=(trk);
+ fID = trk.fID;
+ fLabel = trk.fLabel;
+ fParticleType = trk.fParticleType;
+ fCharge = trk.fCharge;
+ fStatus = trk.fStatus;
+ fFlags = trk.fFlags;
+ fTriggID = trk.fTriggID;
+ fAssocID = trk.fAssocID;
+ fTracEff = trk.fTracEff;
+ fMCIndex = trk.fMCIndex;
+ fWeight = trk.fWeight;
+ }
+ return *this;
+}
+
+//_____________________________________________________________
+void AliJBaseTrack::Print() const{
+ //object print out
+ std::cout<<Form("(ID,Type,Charge,Flags)=(%d, %d, %d, %d)" ,
+ fID, fParticleType, fCharge, fFlags );
+ TLorentzVector::Print();
+ cout<<"ID ="<<fID <<endl;
+ cout<<"fLabel="<<fLabel <<endl;
+ cout<<"fParticleType="<<fParticleType <<endl;
+ cout<<"fCharge="<<fCharge <<endl;
+ cout<<"fStatus="<<fStatus <<endl;
+ cout<<"fFlags="<<fFlags <<endl;
+ cout<<"fTriggID="<<fTriggID <<endl;
+ cout<<"fAssocID="<<fAssocID <<endl;
+ cout<<"fTracEff="<<fTracEff <<endl;
+}
+
+ClassImp(AliJBaseTrack)
+
--- /dev/null
+/* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+// Short comment describing what this class does needed!
+
+// $Id: AliJBaseTrack.h,v 1.5 2008/05/08 15:19:52 djkim Exp $
+
+///////////////////////////////////////////////////
+/*
+ \file AliJBaseTrack.h
+ \brief
+ \author J. Rak, D.J.Kim, R.Diaz (University of Jyvaskyla)
+ \email: djkim@jyu.fi
+ \version $Revision: 1.5 $
+ \date $Date: 2008/05/08 15:19:52 $
+ */
+///////////////////////////////////////////////////
+
+#ifndef ALIJBASETRACK_H
+#define ALIJBASETRACK_H
+
+#ifndef ROOT_TObject
+#include <TObject.h>
+#endif
+
+#include <iostream>
+#include <TLorentzVector.h>
+#include <TMath.h>
+#include "AliJConst.h"
+
+using namespace std;
+
+class AliJBaseTrack : public TLorentzVector {
+ public:
+ enum { kIsIsolated, kNFlag };
+ AliJBaseTrack();
+ AliJBaseTrack(float px,float py, float pz, float e, Int_t id, Short_t ptype, Char_t charge); // constructor
+ AliJBaseTrack(const AliJBaseTrack& a);
+ AliJBaseTrack(const TLorentzVector & a);
+ virtual ~AliJBaseTrack(){;} //destructor
+
+ double EtaAbs(){ return TMath::Abs(Eta()); }
+ float GetTwoPiPhi() const {return Phi()>-kJPi/3 ? Phi() : kJTwoPi+Phi();}
+ TLorentzVector GetLorentzVector(){ return TLorentzVector(Px(), Py(), Pz(), E());}
+
+ Int_t GetID() const { return fID;}
+ Int_t GetLabel() const { return fLabel; }
+ Short_t GetParticleType() const { return fParticleType;}
+ ULong_t GetStatus() const { return fStatus; }
+ Short_t GetCharge() const { return fCharge; }
+ UInt_t GetFlags() const { return fFlags; }
+ Bool_t GetIsIsolated() const { return IsTrue(kIsIsolated);}
+
+ Int_t GetTriggBin() const { return fTriggID; }
+ Int_t GetAssocBin() const { return fAssocID; }
+ Double32_t GetTrackEff() const {
+ if(fTracEff==-1) { cout<<"AliJBaseTrack: Uninitilized track eff " <<endl; exit(-1);
+ } else return fTracEff; }
+ Bool_t IsInTriggerBin() const { return fTriggID>=0; }
+ Bool_t IsInAssocBin() const { return fAssocID>=0; }
+ Double_t GetWeight() const { return fWeight;}
+ Int_t GetMCIndex() const { return fMCIndex;}
+
+ void SetID (const int id){fID=id;}
+ void SetLabel (const Int_t label ){ fLabel=label; }
+ void SetParticleType(const Short_t ptype){ fParticleType=ptype; }
+ void SetStatus (const ULong_t status){ fStatus=status; }
+ void SetCharge (const Char_t charge){ fCharge=charge; }
+ void SetFlags (const UInt_t bits ){ fFlags=bits; } //MC, is primary flag
+ void SetIsIsolated(Bool_t tf){ SetFlag( kIsIsolated, tf); }
+
+ void SetTriggBin(const int id){fTriggID = id;}
+ void SetAssocBin(const int id){fAssocID = id;}
+ void SetTrackEff(const Double32_t inEff){fTracEff = inEff;}
+
+ void SetWeight(Double_t weight) { fWeight = weight;}
+ void SetMCIndex(Int_t idx) { fMCIndex = idx;}
+
+ virtual void Print() const;
+
+ // Handel BitsData
+ Bool_t IsTrue(int i ) const { return TESTBIT(fFlags, i); }
+ void SetFlag(int i, Bool_t t){ if(t){SETBIT(fFlags,i);}else{CLRBIT(fFlags, i);}}
+
+ // Operators
+ AliJBaseTrack& operator=(const AliJBaseTrack& trk);
+
+ protected:
+ Int_t fID; // Unique track ID
+ Int_t fLabel; // Unique track label for MC-Data relation
+ Short_t fParticleType; // ParticleType
+ Char_t fCharge; // track charge for real data
+ ULong_t fStatus; // reconstruction status flags or MC status
+ UInt_t fFlags; // store series of any boolen value.
+
+ Int_t fTriggID, fAssocID; //! //id of trigger and assoc particle
+ Double32_t fTracEff; //! //track efficiency
+ Int_t fMCIndex; //! //index of corresp. MC track
+ Double_t fWeight; //! //particle weight
+
+ ClassDef(AliJBaseTrack,1)
+};
+
+#endif
+
--- /dev/null
+//====================================
+//last modified FK 6.NOV 2009
+//====================================
+//blah
+// blah
+
+#include "AliJCard.h"
+
+//ClassImp(AliJCard);
+
+AliJCard::AliJCard():
+ AliJBaseCard(),
+ fhCorr(0),
+ fpi0massbin(0)
+{
+ //constructor
+}
+
+AliJCard::AliJCard(const char *filename):
+ AliJBaseCard(filename),
+ fhCorr(0),
+ fpi0massbin(0)
+{
+ //constructor
+ InitCard();
+ MakeFastCorrTypeIndex();
+}
+
+
+
+AliJCard::AliJCard(const AliJCard& obj){
+ // copy constructor
+}
+
+
+AliJCard& AliJCard::operator=(const AliJCard& obj){
+ // copy constructor
+ return *this;
+}
+
+AliJCard::~AliJCard(){
+ // destructor
+ if( fpi0massbin ){
+ for( int i = 0; i < GetNoOfBins( kCentrType ); i++ ){
+ delete [] fpi0massbin[i];
+ } // destructor
+ delete [] fpi0massbin;
+ }
+ if( fhCorr ){
+ delete fhCorr;
+ }
+}
+
+void AliJCard::MakeFastCorrTypeIndex(){
+ // make fast findex array
+ for( unsigned int i=0;i<fKeyWordVector.size();i++ ){
+ int corrIndex = GetCorrType( fKeyWordVector[i] );
+ if( corrIndex != kNoType )
+ fIndexVector[corrIndex] = i;
+ }
+
+}
+
+int AliJCard::IsLessThanUpperPairPtCut(double inPairPt){
+ // pt cut
+ int nB = GetN("UpperPairPtCut");
+ if(inPairPt == -999) return nB;
+ if(-999 < inPairPt && inPairPt <=0) return int(Get("UpperPairPtCut",-int(inPairPt)));
+ int bin=-1, i=0;
+ while(i<nB && inPairPt>Get("UpperPairPtCut",i)) i++;
+ if(i<nB) bin=i;
+ //cout<<" i="<<i<<" bin="<<bin<<" inval="<<inPairPt<<endl;;
+ return bin;
+}
+
+
+
+TString AliJCard::GetKeyWord(corrType ctype){
+ // get keyword
+ TString kw;
+
+ switch(ctype){
+ case kTriggType: kw = "TriggPtBorders"; break;
+ case kAssocType: kw = "AssocPtBorders"; break;
+ case kXeType: kw = "xEBorders"; break;
+ case kLongType: kw = "KlongBorders"; break;
+ case kCentrType: kw = "CentBinBorders"; break;
+ case kZVertType: kw = "zVertBins"; break;
+ case kMassType: kw = "PairInvariantMassBins"; break;
+ case kEtaGapType: kw = "EtaGapThresholds"; break;
+ case kDiJetType: kw = "DiJetMassBorders"; break;
+ case kRGapType: kw = "RGapThresholds"; break;
+ //case kEPType: kw = "EPBorders"; break;
+ default : cout<<"ERROR: kNoType on input to AliJCard::GetKeyWord"<<endl; exit(1); break;
+ }
+ return kw;
+}
+
+corrType AliJCard::GetCorrType( TString inStr ){
+ // get corr type
+ TString kw;
+
+ int i;
+ TString s;
+
+ // go through all corrType to check if the parameter should be added
+ // into fast findex array
+ for( i = 0; i < kNcorrType; i++ ){
+ if( i == kNoType )
+ continue;
+
+ s = GetKeyWord( (corrType)i );
+ if( ! strcmp( s.Data(), inStr.Data() ))
+ return (corrType)i;
+ }
+
+ return kNoType;
+}
+
+int AliJCard::GetN(corrType ctype){
+ //returns size of TVector
+ return GetN(GetKeyWord(ctype));
+}
+
+int AliJCard::GetNFast(corrType ctype){
+ //returns size of TVector
+ int findex = fIndexVector[ctype];
+ if( findex > -1 ){
+ return (int) fValuesVector[findex].GetNrows();
+ }else{
+ cout<<"ERROR: fValuesVector fast findex out of range "<< findex << " " << (GetKeyWord( ctype )).Data() << endl;
+ exit(1);
+ }
+}
+
+
+float AliJCard::Get(corrType ctype, int VectorComponent){
+ //returns VectorComponent Component of fValuesVecto`uor TVector for given keyword
+ return Get(GetKeyWord(ctype), VectorComponent);
+}
+
+float AliJCard::GetFast(corrType ctype, int VectorComponent){
+ // fast get
+
+ if(0<=VectorComponent && VectorComponent<GetNFast(ctype) && fIndexVector[ctype] > -1 ){
+ return fValuesVector[fIndexVector[ctype]][VectorComponent+1];
+ }else{
+ cout<<"ERROR: fValuesVector fast findex out of range "<< (GetKeyWord(ctype)).Data()<<endl;
+ exit(1);
+ }
+}
+
+
+void AliJCard::InitCard(){
+ // Init card
+ cout<<"Init of AliJCard"<<endl;
+ // set the length of fIndexVector and disable all indices
+ fIndexVector.resize( kNcorrType );
+ for( int i = 0; i < kNcorrType; i++ )
+ fIndexVector[i] = -1;
+}
+
+void AliJCard::FinishCard(){
+ // Finish loading of card
+ AliJBaseCard::FinishCard();
+ // recompute fast idices
+
+ fpi0massbin = new Double_t*[GetNoOfBins( kCentrType )];
+
+ char centstr[10];
+
+ // read the pi0 mass bin parameters
+ for( int i = 0; i < GetNoOfBins( kCentrType ); i++ ){
+ fpi0massbin[i] = new Double_t[8];
+
+ for( int j = 0; j < 8; j++ ){
+ sprintf( centstr, "cent%d", i );
+ fpi0massbin[i][j] = Get( centstr, j );
+ }
+ }
+
+}
+
+void AliJCard::PrintOut(){
+ // Print out contents of card
+ AliJBaseCard::PrintOut();
+ cout << "----- fast array ----------" << endl;
+ for( unsigned int ii = 0; ii < fIndexVector.size(); ii++ ){
+ if( ii == kNoType )
+ continue;
+ cout << (GetKeyWord( (corrType)ii )).Data() << " " << fIndexVector[ii];
+ if( fIndexVector[ii] > -1 ){
+ cout<<" (dim ="<<fValuesVector[fIndexVector[ii]].GetNrows()<<") ";//print size of TVector
+ for(int j=1; j<=fValuesVector[fIndexVector[ii]].GetNrows(); j++){
+ cout<<fValuesVector[fIndexVector[ii]][j]<<" ";//TVector components
+ }
+ }
+ else
+ cout << " no link!";
+
+ cout << endl;
+ }
+}
+
+int AliJCard::GetBin(corrType ctype, float val){
+ // get bin
+
+ if(ctype == kNoType) return 0;
+
+ TVector * v = &fValuesVector[fIndexVector[ctype]];
+ int iBin2 = TMath::BinarySearch( v->GetNrows(), v->GetMatrixArray(), val );
+ if( iBin2 >= v->GetNrows()-1 ) iBin2 = -1;
+
+ return iBin2;
+}
+
+int AliJCard::GetBinFast(corrType ctype, float val){
+ // fast get bin
+
+ if(ctype == kNoType) return 0;
+
+ for(int i=0; i<(GetNFast(ctype)-1); i++)
+ if(GetFast(ctype,i)<=val && val<GetFast(ctype,i+1))
+ return i;
+
+ return -1;
+}
+
+
+
+bool AliJCard::IsGoodRun(int runID){
+ // run quality
+ bool isgood = true;
+ for(int i=0; i<GetN("badRuns");i++) if(((int) Get("badRuns",i)) == runID) isgood = false;
+
+ return isgood;
+}
+
+bool AliJCard::MbTrigger(int triggin) const {
+ // MB trigger
+ return (triggin & (1<<kMinBiasTriggerBitJCorran)) > 0; //masking on >0 masking off ==0 desired trigger
+}
+
+
+bool AliJCard::SimilarVertZ(float Z1, float Z2){
+ // z vert
+ static double v = Get("maxMixDZ");
+ if( v < 0 ) return 1;
+ return fabs(Z1-Z2) < v ;
+}
+
+bool AliJCard::SimilarMultiplicity(float mult1, float mult2){
+ // multi
+ static double v = Get("maxMixDMult");
+ if( v <0) return 1;
+ return fabs(mult1-mult2) < v;
+}
+
+
+bool AliJCard::SimilarCentrality(float c1, float c2, int cbin){
+ // centra
+ static TVector *v = GetVector("maxDCent");
+ if(v==NULL) return 1;
+ return fabs(c1-c2) < (*v)[cbin+1]; // TODO
+}
+
+
+//--------- P H E N I X C G L --------------
+
+/*
+bool AliJCard::InPhiRange(float Phi){
+ // phi
+ bool isIn = false;
+ for(int i=1; i<GetN("phiDCRange"); i+=2 )
+ isIn = isIn || (Get("phiDCRange",i-1)<Phi && Phi<Get("phiDCRange",i));
+ return isIn;
+}
+*/
+
+
+bool AliJCard::CheckTrackParamsInTPC(int NClustersTPC,float Chi2PerClusterTPC){
+ // tpc pars
+ bool isGoodTrack = true;
+ if(NClustersTPC < Get("MinNClustersTPC")) isGoodTrack = false;
+ if(Chi2PerClusterTPC > Get("MaxChi2PerClusterTPC")) isGoodTrack = false;
+ return isGoodTrack;
+}
+
+bool AliJCard::CheckMinNumTPCClustPt(int NClustersTPC, float fpt){
+ // tpc pars
+ float minNTPCCls = Get("ParMinNClustTPCPt",0)*log(Get("ParMinNClustTPCPt",1)*fpt + Get("ParMinNClustTPCPt",2));
+ if(NClustersTPC > minNTPCCls) return true; //track had enough clusters
+ else return false; //track did not have sufficient number of clusters
+}
+
+
+bool AliJCard::CheckTrackImpact(float xyIm, float zIm, float fpt){
+ // tpc pars
+ bool isGoodTrack = true;
+ if(TMath::Abs(xyIm) > Get("ParMaxDCAToVertexXYPtDep",0)+Get("ParMaxDCAToVertexXYPtDep",1)/pow(fpt,Get("ParMaxDCAToVertexXYPtDep",2))){
+ isGoodTrack = false;
+ }
+ if(TMath::Abs(zIm) > Get("MaxDCAToVertexZ")) isGoodTrack = false;
+
+ return isGoodTrack;
+}
+
+
+/*
+bool AliJCard::DeltaEtaCheck(const AliJBaseTrack *ftk1, const AliJBaseTrack *ftk2) {
+ // deta
+ double delta = fabs( log(tan(ftk1->Theta()/2.0)) - log(tan(ftk2->Theta()/2.0)) );
+ if(Get("etaCut")>0) return delta < Get("etaCut");
+ if(Get("etaCut")<0) return delta > Get("etaCut");
+
+ return true;
+}
+*/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+//=================================================
+// AliJCard.h
+// last modified FK 6.NOV 2009
+//=================================================
+
+#ifndef ALIJCARD_H
+#define ALIJCARD_H
+
+#include <TObject.h>
+
+#include <iostream>
+#include <fstream>
+#include <stdlib.h>
+#include <stdio.h>
+#include <iomanip>
+
+#include <string.h>
+#include <TString.h>
+#include <TVector.h>
+#include <TMath.h>
+#include <TObjArray.h>
+#include <TObjString.h>
+#include <TFile.h>
+#include <TF1.h>
+#include <TH1D.h>
+#include <TH2D.h>
+#include <vector>
+#include <TVector3.h>
+#include <THashList.h>
+#include <TNamed.h>
+
+#include "AliJConst.h"
+#include "AliJBaseCard.h"
+
+class AliJBaseTrack;
+//#include "AliJPhoton.h"
+//class AliJTrack;
+
+using namespace std;
+
+
+class AliJCard : public AliJBaseCard {
+
+ public:
+
+ AliJCard(); // constructor
+ AliJCard(const char *filename); // constructor
+ AliJCard(const AliJCard& obj);
+ AliJCard& operator=(const AliJCard& obj);
+
+ virtual ~AliJCard();
+
+ void MakeFastCorrTypeIndex();
+
+ void PrintOut();
+
+ float Get(TString keyword, int VectorComponent=0){ return AliJBaseCard::Get(keyword, VectorComponent); }
+ float Get(corrType ctype, int VectorComponent =0); //get TVector component
+ float GetFast(corrType ctype, int VectorComponent=0); //get TVector component
+ int GetN(TString keyword){ return AliJBaseCard::GetN(keyword); } //get TVector dimension
+ int GetN(corrType ctype); //get TVector dimension
+ int GetNFast(corrType ctype); //get TVector dimension
+
+ //---- Collision Species --
+ float GetCollisionType() { return Get("CollisionType");}
+
+ //------ v e r t e x -----
+
+ float VertInZRange(float Z) {
+ //cout<< "zv " << Z <<" "<< ( GetBinBorder(kZVertType,0) < Z && Z < GetBinBorder(kZVertType, GetNoOfBins(kZVertType)) ) <<endl;
+ return ( GetBinBorder(kZVertType,0) < Z && Z < GetBinBorder(kZVertType, GetNoOfBins(kZVertType)) ); }
+
+ //Alice vertex cuts
+ bool CheckEventZVetrex(double fZVertex, double ZVertErr){
+ if(Get("ZVertexRange",0)<fZVertex && fZVertex <Get("ZVertexRange",1) && (Get("MaxZVertexError") > ZVertErr)) return true;
+ else return false;
+ }
+
+ int IsLessThanUpperPairPtCut(double inPairPt);
+
+
+ //--- c o r r e l a t i o n bins & borders --
+ int GetNoOfBins (corrType ctype){ return GetNFast(ctype)-1; }
+ float GetBinBorder(corrType ctype, int ii){ return GetFast(ctype,ii); }
+ int GetBin(corrType ctype, float val);
+ int GetBinFast(corrType ctype, float val);
+ double GetBinCenter(corrType ctype, int ii){ return (GetFast(ctype,ii)+GetFast(ctype,ii+1))/2.;}
+
+ //----- m i x i n g ----
+ int GetEventPoolDepth(int cBin){ return (int) Get("EventPoolDepth",cBin);}
+ bool SimilarVertZ(float Z1, float Z2);
+ bool SimilarMultiplicity(float mult1, float mult2);
+ bool SimilarCentrality(float c1, float c2, int cbin);
+
+ //run characteristics
+ bool IsGoodRun(int runID);
+
+ //trigger
+ bool MbTrigger(int triggin) const;
+
+ //photon
+ /*
+ bool IsPhoton(AliJPhoton *g){ return g->GetProbPhot() > Get("probPhot"); }
+ float GetPhotEnergyCut(){ return Get("minEnergy"); }
+
+ bool InPhiRange(float Phi);
+ bool IsInZEDandThetaRange(float zedDC, float theta){
+ return (fabs(zedDC)<Get("zedRange") && fabs(kJPi/2-theta)<Get("thetaRange"));
+ }
+ */
+
+
+ bool IsInEtaRange(float eta){return fabs(eta)<Get("EtaRange"); }
+ // bool likeSgnCheck(PhJCgl *cgl1, PhJCgl *cgl2);
+ // bool DeltaEtaCheck(const AliJBaseTrack *ftk1, const AliJBaseTrack *ftk2);
+ bool NotGhost(float zedDC, float PhiDC){
+ return (zedDC > Get("deltaZEDPhiDC",0) && fabs(PhiDC) > Get("deltaZEDPhiDC",1));
+ }
+
+ /* bool CheckCovDiagonalElements(double *element){
+ if(Get("MaxCovDiagonalElements",0)<0) return true;
+ bool isGoodTrack = true;
+ for(Int_t i=0;i<5;i++){
+ if(Get("MaxCovDiagonalElements",i) < element[i]) isGoodTrack = false;
+ }
+ return isGoodTrack;
+ }*/
+
+ bool CheckTrackParamsInTPC(int NClustersTPC,float Chi2PerClusterTPC);
+
+ bool CheckMinNumTPCClustPt(int NClustersTPC, float fpt);
+
+ bool CheckTrackImpact(float xyIm, float zIm, float fpt);
+
+
+ bool AcceptKinkDaughters(int kinkIndex){
+ if(( ! (bool) Get("AcceptKinkDaughters")) && kinkIndex > 0 ) return false;//we do not want kinks but kink findex>0
+ else return true;
+ }
+
+
+ double GetCutOnBkgActivity(){
+ return (double) Get("CutOnBkgActivity");
+ }
+
+ void SetEventV3kv(double inV3kv) {feventV3kv = inV3kv;}
+ double GetEventV3kv() const {return feventV3kv;}
+
+ //Alice CALO
+ bool ReadEmcalSm(int sm){ return (bool) Get("EMCAL_SM",sm);}
+ bool ReadPhosSm(int sm){ return (bool) Get("PHOS_SM",sm);}
+
+ bool MixPhotonForPi0Mass() {return ((int) Get("massMix")==1);}//FK//
+ bool MixMBForPi0Mass() {return ((int) Get("massMixMB")>0);}
+ bool MixMBMBForPi0Mass() {return ((int) Get("massMixMB")==2);}
+
+ virtual void InitCard(); //TODO
+ void FinishCard(); // TODO
+
+
+ protected:
+
+
+ TString GetKeyWord(corrType ctype);
+ corrType GetCorrType( TString inStr );
+
+ // double effPar[16];
+ // double corrCent[10]; //FK// additional scaling factor to effPar to correct on hi fcentrality
+ TH2D *fhCorr; // comment me
+
+ double feventV3kv; // comment me
+ //==== D a t a M e m b e r s ========
+
+ vector< int > fIndexVector; //array of float number confg parameter vectors
+
+ Double_t **fpi0massbin; //! faster access to pi0 mass bins
+
+ //ClassDef(AliJCard, 1); // EMCAL for jcorran
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-2014, 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. *
+ **************************************************************************/
+
+// Comment describing what this class does needed!
+
+// $Id: JConst.h,v 1.5 2008/05/08 15:19:52 djkim Exp $
+
+////////////////////////////////////////////////////
+/*!
+ \file JConst.h
+ \brief
+ \author J. Rak, D.J.Kim, R.Diaz (University of Jyvaskyla)
+ \email: djkim@jyu.fi
+ \version $Revision: 1.5 $
+ \date $Date: 2008/05/08 15:19:52 $
+*/
+////////////////////////////////////////////////////
+
+#ifndef JCONST_H
+#define JCONST_H
+
+//
+// Constants
+//
+// for JHisto and PhxJHisto
+#define kMaxNoCentrBin 10 // Maximum no of centrality bins defined in JCard.h
+#define kMaxTriggParticleType 35 //
+#define kMaxJetType 32 //
+#define kPtDim 15 //
+#define kMaxNoRuns 100 // Maximum no of runs in a nanoDST file
+#define kMaxNoEPBin 24
+
+const double kJPi = 3.14159265358979; //TMath::Pi();
+const double kJTwoPi = 2*kJPi;
+const double kJToRadian = kJPi/180.;
+const double kJToDegree = 180./kJPi;
+const double kElectronMass = .51099906e-3;
+const double kPionMass = .1395675;
+
+
+//====================== particle types ============================================
+const int kNumberOfParticleTypes = 10;
+enum particleType {kHadron, kPion, kKaon, kProton, kPhoton, kDecayphoton, kPizero, kEta,kHadronMC, kJet, kJNone};
+
+const char* const kParticleTypeStrName[kNumberOfParticleTypes] =
+ {"hadron", "pion", "kaon", "proton", "photon", "decayphoton", "pizero", "eta", "hadronMC", "none"};
+const char* const kParticleProtoType[kNumberOfParticleTypes] =
+ {"AliJTrack", "AliJTrack", "AliJTrack", "AliJTrack", "AliJPhoton", "AliJPhoton", "AliJPiZero", "AliJPiZero", "None"};
+
+//=======================JCorran trigger table definition===========================
+//internal JCorran trigger mask TBit=0 is MinBias, TBit=1 HighMultiplicityTrigger
+enum TriggerBitJCorran {kMinBiasTriggerBitJCorran, kHighMultTriggerBitJCorran,
+ kEmc0TriggerBitJCorran,
+ kEmc1GammaTriggerBitJCorran, kEmc1JetTriggerBitJCorran,
+ kCentralTriggerBitJCorran,kSemiCentralTriggerBitJCorran,
+ kFastOnlyBitJCorran,
+ kINT7TriggerBitJCorran
+ };
+const int kRangeTriggerTableAlice = 50;
+const int kRangeTriggerTableJCorran = 16;
+
+//==================================================================================
+enum fillType { kReal, kMixed, kEtaGap };
+enum corrFillType {kAzimuthFill=0,kPionFill=1};
+enum corrType { kTriggType, kAssocType, kXeType, kLongType, kCentrType, kZVertType, kMassType, kEtaGapType, kDiJetType, kRGapType, kNoType, kNcorrType };
+enum TriggerParticleType { kTriggParticles, kLeadingParticle, kIsolatedParticle };
+
+const char* const kTriggerParticleTypeName[] =
+ {"TriggParticles","LeadingParticle","IsolatedParticle"};
+
+// JETs =====
+const int kNJetAlg = 10;
+enum JetAlg {kkt,kantikt,ksiscone,krecomE,krecomB,kcdfmidpoint,kjade,kd0run2cone,kGF,kSimpleCone};
+const char* const kJetAlgStrName[kNJetAlg] =
+ {"kt","antikt","siscone","recomE","recomB","cdfmidpoint","jade","d0run2cone","GF","SimpleCone"};
+
+enum EPType { kEPV0A, kEPV0C, kEPV0AC, kNEPType };
+const int kNHarmonics = 5;
+// PHENIX constants
+enum TEMC {kPbSc, kPbGl};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-2014, 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. *
+ **************************************************************************/
+
+/**************************************************************************
+ * AliJXtHistos.h
+ * This class encapsulated all histograms that the analysis provides
+ *
+ *
+ * contact: Sami Räsänen
+ * University of Jyväskylä, Finland
+ * sami.s.rasanen@jyu.fi
+ **************************************************************************/
+
+#include "AliJXtHistos.h"
+#include "AliJCard.h"
+
+//______________________________________________________________________________
+AliJXtHistos::AliJXtHistos(AliJCard* cardP):
+ fUseDirectory(true)
+{ // constructor
+
+ fcard=cardP;
+ fmaxEtaRange = fcard->Get("EtaRange");
+
+ fhistoList = new TList();
+ fTopDirectory = gDirectory;
+}
+
+//______________________________________________________________________________
+AliJXtHistos::AliJXtHistos(const AliJXtHistos& obj){
+ // copy constructor
+}
+
+//______________________________________________________________________________
+AliJXtHistos& AliJXtHistos::operator=(const AliJXtHistos& obj){
+ // copy constructor
+ return *this;
+}
+//______________________________________________________________________________
+TDirectory * AliJXtHistos::MakeDirectory(TString name){
+ // Make directory with given name and move into it
+ JumpToDefaultDirectory();
+ TDirectory * dir = gDirectory->GetDirectory(name);
+ if( !dir ) dir = gDirectory->mkdir(name);
+ dir->cd();
+ return dir;
+}
+//______________________________________________________________________________
+TDirectory * AliJXtHistos::JumpToDefaultDirectory(){
+ // Move to default directory
+ fTopDirectory->cd();
+ return gDirectory;
+}
+//______________________________________________________________________________
+void AliJXtHistos::FillInclusiveHistograms(double pT, double xT, double eta, double phi, double effCorr, int centBin){
+ // Fill all inclusive histograms
+ fhChargedEta[centBin]->Fill(eta, effCorr);
+ fhChargedPhi[centBin]->Fill(phi, effCorr);
+ fhChargedPt[centBin]->Fill(pT, effCorr);
+ fhChargedXt[centBin]->Fill(xT, effCorr);
+ fhInvariantChargedPt[centBin]->Fill(pT, pT > 0. ? effCorr/pT : 0.); // Can you do 1/pT here???
+ fhInvariantChargedXt[centBin]->Fill(xT, xT > 0. ? effCorr/xT : 0.); // Can you do 1/xT here???
+ // For checks, fill also without efficiency correction
+ fhChargedEtaNoCorr[centBin]->Fill(eta);
+ fhChargedPhiNoCorr[centBin]->Fill(phi);
+ fhChargedPtNoCorr[centBin]->Fill(pT);
+ fhChargedXtNoCorr[centBin]->Fill(xT);
+}
+//______________________________________________________________________________
+void AliJXtHistos::FillIsolatedHistograms(double pT, double xT, double eta, double phi, double effCorr, int centBin){
+ // Fill all inclusive histograms
+ fhIsolatedChargedEta[centBin]->Fill(eta, effCorr);
+ fhIsolatedChargedPhi[centBin]->Fill(phi, effCorr);
+ fhIsolatedChargedPt[centBin]->Fill(pT, effCorr);
+ fhIsolatedChargedXt[centBin]->Fill(xT, effCorr);
+ fhInvariantIsolatedChargedPt[centBin]->Fill(pT, pT > 0. ? effCorr/pT : 0.); // Can you do 1/pT here???
+ fhInvariantIsolatedChargedXt[centBin]->Fill(xT, xT > 0. ? effCorr/xT : 0.); // Can you do 1/xT here???
+}
+//______________________________________________________________________________
+void AliJXtHistos::CreateXtHistos(){
+ // all the histograms of xT analysis
+
+ MakeDirectory("xT");
+ TH1::SetDefaultSumw2(kTRUE);
+ cout << "GetDefaultSumw2() = " << TH1::GetDefaultSumw2() << endl;
+
+ // === pT binning
+ int nBins=150;
+ double logBinsPt[nBins+1], limL=0.1, limH=100;
+ double logBW = (log(limH)-log(limL))/nBins;
+ for(int ij=0;ij<=nBins;ij++) logBinsPt[ij]=limL*exp(ij*logBW);
+
+ // === xT binning
+ int nBinsXt=200;
+ double logBinsXt[nBinsXt+1];
+ double xTlimL = 1e-5, xTlimH = 1.0, xTlogBW = (log(xTlimH)-log(xTlimL))/nBinsXt;
+ for(int ij=0;ij<=nBinsXt;ij++) logBinsXt[ij]=xTlimL*exp(ij*xTlogBW);
+
+ // === create histos
+ for (int hic = 0;hic < fcard->GetNoOfBins(kCentrType);hic++) {
+ float b1 = fcard->GetBinBorder(kCentrType, hic);
+ float b2 = fcard->GetBinBorder(kCentrType, hic + 1);
+
+ fhChargedPt[hic] = new TH1D(Form("hChargedPt%d",hic), Form("C: %2.0f-%2.0f%%",b1,b2), nBins, logBinsPt );
+ fhChargedPt[hic]->Sumw2();
+ fhistoList->Add(fhChargedPt[hic]);
+
+ fhInvariantChargedPt[hic] = new TH1D(Form("hInvariantChargedPt%d",hic), Form("C: %2.0f-%2.0f%%",b1,b2), nBins, logBinsPt );
+ fhInvariantChargedPt[hic]->Sumw2();
+ fhistoList->Add(fhInvariantChargedPt[hic]);
+
+ fhChargedPtNoCorr[hic] = new TH1D(Form("hChargedPtNoCorr%d",hic), Form("C: %2.0f-%2.0f%%",b1,b2), nBins, logBinsPt );
+ fhChargedPtNoCorr[hic]->Sumw2();
+ fhistoList->Add(fhChargedPtNoCorr[hic]);
+
+ fhIsolatedChargedPt[hic] = new TH1D(Form("hIsolatedChargedPt%d",hic), Form("C: %2.0f-%2.0f%%",b1,b2), nBins, logBinsPt );
+ fhIsolatedChargedPt[hic]->Sumw2();
+ fhistoList->Add(fhIsolatedChargedPt[hic]);
+
+ fhInvariantIsolatedChargedPt[hic] = new TH1D(Form("hInvariantIsolatedChargedPt%d",hic), Form("C: %2.0f-%2.0f%%",b1,b2), nBins, logBinsPt );
+ fhInvariantIsolatedChargedPt[hic]->Sumw2();
+ fhistoList->Add(fhInvariantIsolatedChargedPt[hic]);
+
+ fhChargedXt[hic] = new TH1D(Form("hChargedXt%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2), nBinsXt, logBinsXt );
+ fhChargedXt[hic]->Sumw2();
+ fhistoList->Add( fhChargedXt[hic] );
+
+ fhInvariantChargedXt[hic] = new TH1D(Form("hInvariantChargedXt%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2), nBinsXt, logBinsXt );
+ fhInvariantChargedXt[hic]->Sumw2();
+ fhistoList->Add( fhInvariantChargedXt[hic] );
+
+ fhChargedXtNoCorr[hic] = new TH1D(Form("hChargedXtNoCorr%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2), nBinsXt, logBinsXt );
+ fhChargedXtNoCorr[hic]->Sumw2();
+ fhistoList->Add( fhChargedXtNoCorr[hic] );
+
+ fhIsolatedChargedXt[hic] = new TH1D(Form("hIsolatedChargedXt%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2), nBinsXt, logBinsXt );
+ fhIsolatedChargedXt[hic]->Sumw2();
+ fhistoList->Add( fhIsolatedChargedXt[hic] );
+
+ fhInvariantIsolatedChargedXt[hic] = new TH1D(Form("hInvariantIsolatedChargedXt%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2), nBinsXt, logBinsXt );
+ fhInvariantIsolatedChargedXt[hic]->Sumw2();
+ fhistoList->Add( fhInvariantIsolatedChargedXt[hic] );
+
+ fhChargedEta[hic] = new TH1D(Form("hChargedEta%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2),100,-1.0,1.0);
+ fhChargedEta[hic]->Sumw2();
+ fhistoList->Add(fhChargedEta[hic]);
+
+ fhChargedEtaNoCorr[hic] = new TH1D(Form("hChargedEtaNoCorr%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2),100,-1.0,1.0);
+ fhChargedEtaNoCorr[hic]->Sumw2();
+ fhistoList->Add(fhChargedEtaNoCorr[hic]);
+
+ fhIsolatedChargedEta[hic] = new TH1D(Form("hIsolatedChargedEta%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2),100,-1.0,1.0);
+ fhIsolatedChargedEta[hic]->Sumw2();
+ fhistoList->Add(fhIsolatedChargedEta[hic]);
+
+ fhChargedPhi[hic] = new TH1D(Form("hChargedPhi%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2),128,-0.2,6.4);
+ fhChargedPhi[hic]->Sumw2();
+ fhistoList->Add(fhChargedPhi[hic]);
+
+ fhChargedPhiNoCorr[hic] = new TH1D(Form("hChargedPhiNoCorr%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2),128,-0.2,6.4);
+ fhChargedPhiNoCorr[hic]->Sumw2();
+ fhistoList->Add(fhChargedPhiNoCorr[hic]);
+
+ fhIsolatedChargedPhi[hic] = new TH1D(Form("hIsolatedChargedPhi%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2),128,-0.2,6.4);
+ fhIsolatedChargedPhi[hic]->Sumw2();
+ fhistoList->Add(fhIsolatedChargedPhi[hic]);
+
+ fhZVert[hic] = new TH1D(Form("hZVert%d",hic),Form("C: %2.0f-%2.0f%%",b1,b2), 120, -30., 30.);
+ fhistoList->Add(fhZVert[hic]);
+ }
+
+ fhZVertRaw = new TH1D("hZVertRaw","vertex 0", 120, -30., 30.);
+ fhistoList->Add(fhZVertRaw);
+ fhCentr = new TH1D("hCentr","centrality", 101, -0.5, 100.5);
+ fhistoList->Add(fhCentr);
+ fhiCentr = new TH1D("hiCentr","centrality",10, -0.5, 9.5);
+ fhistoList->Add(fhiCentr);
+ fhEventPerRun = new TH1D("hEventPerRun","log(eve)/run",200, 0, 30.0);
+ fhistoList->Add(fhEventPerRun);
+
+ //------------------ for Abs Norm FK --------------------------------
+ double binsVertexMult[] = {0,1,2,3,4,5,10000};
+ int nBinsVertexMult = sizeof(binsVertexMult)/sizeof(double)-1;
+ double binsVertexZ[] = {-10,-6,-3,-2,-1.5,-1,-0.5,0,0.5,1,1.5,2,3,6,10};
+ int nBinsVertexZ = sizeof(binsVertexZ)/sizeof(double)-1;
+ fhVertexZTriggVtx = new TH2D("hVertexZTriggVtx","Vertex counts", nBinsVertexMult, binsVertexMult, nBinsVertexZ, binsVertexZ);
+ fhistoList->Add(fhVertexZTriggVtx);
+
+ sprintf(fhtit, "Mean activity inside cone");
+ sprintf(fhname, "hActivity");
+ fhConeActivity = new TProfile(fhname, fhtit, nBins, logBinsPt );
+ fhistoList->Add(fhConeActivity);
+
+ sprintf(fhtit, "Mean pion activity inside cone isolated");
+ sprintf(fhname, "hActivityIsolated");
+ fhConeActivityIsolated = new TProfile(fhname, fhtit, nBins, logBinsPt );
+ fhistoList->Add(fhConeActivityIsolated);
+
+ JumpToDefaultDirectory();
+}
--- /dev/null
+/**************************************************************************
+ * AliJXtHistos.h
+ * This class encapsulated all histograms that the analysis provides
+ *
+ * contact: Sami Räsänen
+ * University of Jyväskylä, Finland
+ * sami.s.rasanen@jyu.fi
+ **************************************************************************/
+
+#ifndef ALIJXTHISTOS_H
+#define ALIJXTHISTOS_H
+
+#include <iostream>
+#include <fstream>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <TH1.h>
+#include <TH2.h>
+#include <TProfile.h>
+#include <TFile.h>
+#include <TList.h>
+
+#define kMaxNoCentrBin 10 // Maximum no of centrality bins defined in JCard.h
+
+class AliJCard;
+
+using namespace std;
+
+class AliJXtHistos {
+
+ public:
+ AliJXtHistos(AliJCard* cardP); //constructor
+ virtual ~AliJXtHistos(){delete fhistoList;} //destructor
+ AliJXtHistos(const AliJXtHistos& obj);
+ AliJXtHistos& operator=(const AliJXtHistos& obj);
+
+ // create histograms
+ void CreateXtHistos();
+
+ TList *GetHistoList() { return fhistoList; } //return the list of histograms
+
+ bool UseDirectory() const { return fUseDirectory; } // Are there directories in the final root file, yes/no
+ void UseDirectory(bool b) { fUseDirectory=b; } // Decide weather to use directories
+
+ TDirectory * MakeDirectory(TString name); // Make new directory into final root file
+ TDirectory * JumpToDefaultDirectory(); // move into default directory at the final root file
+
+ // Fill various histograms
+ void FillCentralityHistos(double fcent, int fCentBin){
+ // Fill centrality histograms
+ fhCentr->Fill(fcent);
+ fhiCentr->Fill(1.0*fCentBin);
+ }
+ void FillRawVertexHisto(double zVert){fhZVertRaw->Fill(zVert);} // fill raw z-vertex histogram
+ void FillAcceptedVertexHisto(double zVert, int centBin){fhZVert[centBin]->Fill(zVert);} // fill accepted z-vertex histograms
+ void FillInclusiveHistograms(double pT, double xT, double eta, double phi, double effCorr, int centBin); // Fill histograms
+ void FillIsolatedHistograms(double pT, double xT, double eta, double phi, double effCorr, int centBin); // Fill histograms
+ void FillInclusiveConeActivities(double pT, double sumPt){fhConeActivity->Fill(pT,sumPt);} // Fill TProfile
+ void FillIsolatedConeActivities(double pT, double sumPt){fhConeActivityIsolated->Fill(pT,sumPt);} // Fill TProfile
+
+ protected:
+ AliJCard *fcard; // parameters in card
+
+ double fmaxEtaRange; // charged track eta acceptance
+
+ TList *fhistoList; // list of histograms
+ bool fUseDirectory; // to create sub-directories in the final results, used more in case of JCORRAN
+ TDirectory * fTopDirectory; // top directory, different analysis (JCORRAN) in sub-directories.
+
+ private:
+ char fhname[40], fhtit[40]; // dummy variables to create histogram names and titles
+
+ TH1D *fhChargedPt[kMaxNoCentrBin], *fhInvariantChargedPt[kMaxNoCentrBin], *fhChargedPtNoCorr[kMaxNoCentrBin]; // inclusive pT distribution - dN/dpT and 1/pT dN/dpT, last without efficiency correction
+ TH1D *fhIsolatedChargedPt[kMaxNoCentrBin], *fhInvariantIsolatedChargedPt[kMaxNoCentrBin]; // the same as above but for isolated pT
+ TH1D *fhChargedXt[kMaxNoCentrBin], *fhInvariantChargedXt[kMaxNoCentrBin], *fhChargedXtNoCorr[kMaxNoCentrBin]; // The same as inclusive, but for xT
+ TH1D *fhIsolatedChargedXt[kMaxNoCentrBin], *fhInvariantIsolatedChargedXt[kMaxNoCentrBin]; // the same, but for isolated xT
+ TH1D *fhChargedPhi[kMaxNoCentrBin], *fhChargedPhiNoCorr[kMaxNoCentrBin], *fhIsolatedChargedPhi[kMaxNoCentrBin]; // phi -distributions - inclusive, without efficiency correction and for isolated
+ TH1D *fhChargedEta[kMaxNoCentrBin], *fhChargedEtaNoCorr[kMaxNoCentrBin], *fhIsolatedChargedEta[kMaxNoCentrBin]; // the same as above but for eta
+
+ TProfile *fhConeActivity; // pT sum in cone, to be compared to the ALICE UE results
+ TProfile *fhConeActivityIsolated; // activity for isolated particles
+
+ TH1D *fhZVertRaw; // raw z-vertex distribution
+ TH1D *fhZVert[kMaxNoCentrBin]; // accepted z-vertex as a function of centrality
+ TH1D *fhCentr; // centrality
+ TH1D *fhiCentr; // centrality, accepted
+ TH1D *fhEventPerRun; // number of events per run
+ TH2D* fhVertexZTriggVtx; // z-vertex distribution of triggered events, needed somewhere?
+
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-2014, 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. *
+ **************************************************************************/
+
+/**************************************************************************
+ * AliXtAnalysis:
+ * This class constructs inclusive and isolated (based on charged tracks)
+ * invariant spectra. Isolated case uses a different efficiency where the
+ * contamination from cases where non-isolated particle appears as an
+ * isolated one due to finite detector efficiency is taken into account.
+ *
+ * contact: Sami Räsänen
+ * University of Jyväskylä, Finland
+ * sami.s.rasanen@jyu.fi
+**************************************************************************/
+
+// general + root classes
+#include <TList.h>
+#include <TChain.h>
+#include <TObjArray.h>
+
+// AliRoot classes
+#include <AliAnalysisManager.h>
+#include <AliInputEventHandler.h>
+#include <AliAnalysisUtils.h>
+#include <AliAODTrack.h>
+#include <AliAODEvent.h>
+
+// Jyväskylä classes
+#include "AliJCard.h"
+#include "AliJXtHistos.h"
+//#include "AliIsolatedEfficiency.h"
+
+// This analysis
+#include "AliXtAnalysis.h"
+
+ClassImp(AliXtAnalysis)
+
+//________________________________________________________________________
+AliXtAnalysis::AliXtAnalysis()
+ : AliAnalysisTaskSE(), fOutputList(0x0)
+{
+ // Constructor
+ fhEvents = NULL;
+ fAnaUtils = NULL;
+ fHistDir = NULL;
+ fHistos = NULL;
+ fhEvents = NULL;
+ //fEfficiency = NULL;
+ fCard = NULL;
+ fChargedList = NULL;
+ fIsolatedChargedList = NULL;
+ fCentBin = -1;
+ fZBin = -1;
+ fZVert = 999999.;
+ fevt = 0;
+ fDebugMode = 0;
+}
+//________________________________________________________________________
+AliXtAnalysis::AliXtAnalysis(const char *name, const char * cardname)
+ : AliAnalysisTaskSE(name),
+ fOutputList(0x0),
+ fAnaUtils(0x0),
+ fHistDir(0x0),
+ fHistos(0x0),
+ fhEvents(0x0),
+ //fEfficiency(0x0),
+ fChargedList(0x0),
+ fIsolatedChargedList(0x0),
+ fCentBin(-1),
+ fZBin(-1),
+ fZVert(999999.),
+ fevt(0),
+ fDebugMode(0)
+{
+ // All parameters of the analysis
+ fCard = new AliJCard(cardname);
+ fCard->PrintOut();
+
+ fAnaUtils = new AliAnalysisUtils();
+ fAnaUtils->SetUseOutOfBunchPileUp( kTRUE );
+ fAnaUtils->SetUseSPDCutInMultBins( kTRUE);
+
+ // Define input and output slots here
+ // Input slot #0 works with a TChain
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(1, TList::Class());
+ // JHistos into TDirectory
+ DefineOutput(2, TDirectory::Class());
+}
+//________________________________________________________________________
+AliXtAnalysis::AliXtAnalysis(const AliXtAnalysis& a):
+ AliAnalysisTaskSE(a.GetName()),
+ fOutputList(a.fOutputList),
+ fAnaUtils(a.fAnaUtils),
+ fCard(a.fCard),
+ fHistDir(a.fHistDir),
+ fHistos(a.fHistos),
+ fhEvents(a.fhEvents),
+ //fEfficiency(a.fEfficiency),
+ fChargedList(a.fChargedList),
+ fIsolatedChargedList(a.fIsolatedChargedList),
+ fCentBin(-1),
+ fZBin(-1),
+ fZVert(999999.),
+ fevt(0),
+ fDebugMode(0)
+{
+ //copy constructor
+ fhEvents = (TH1D*) a.fhEvents->Clone(a.fhEvents->GetName());
+}
+//________________________________________________________________________
+AliXtAnalysis& AliXtAnalysis::operator = (const AliXtAnalysis& ap){
+ // assignment operator
+ this->~AliXtAnalysis();
+ new(this) AliXtAnalysis(ap);
+ return *this;
+}
+//________________________________________________________________________
+AliXtAnalysis::~AliXtAnalysis() {
+ // destructor
+ delete fOutputList;
+ delete [] fAnaUtils;
+ delete [] fhEvents;
+ delete fHistos;
+ //delete fEfficiency;
+ delete fCard;
+ delete fChargedList;
+ delete fIsolatedChargedList;
+}
+//________________________________________________________________________
+void AliXtAnalysis::UserCreateOutputObjects(){
+ // Create histograms
+ // Called once
+
+ cout<<"\n=============== CARD =============="<<endl;
+ fCard->PrintOut();
+ cout<<"===================================\n"<<endl;
+
+ fhEvents = new TH1D("hEvents","events passing cuts", 11, -0.5, 10.5 );
+ fhEvents->SetXTitle( "0 - all, 1 - pileup, 2 - kMB selected, 3 - has vertex, 4 - good vertex, 5 - MB + good vertex, 6 - MB + good vertex + centrality" );
+ fhEvents->Sumw2();
+
+ fOutputList = new TList();
+ fOutputList->SetOwner(kTRUE);
+ //for any MC track filled with MC pt
+ fOutputList->Add(fhEvents);
+
+ fChargedList = new TObjArray;
+ fChargedList->SetOwner(kTRUE);
+ fIsolatedChargedList = new TObjArray;
+
+ PostData(1, fOutputList);
+
+ bool orignalTH1AdddirectoryStatus=TH1::AddDirectoryStatus();
+ TH1::AddDirectory(kTRUE);
+ if( !orignalTH1AdddirectoryStatus ) cout<<"DEBUG : TH1::AddDirectory is turned on"<<endl;
+ TFile * file2 = OpenFile(2);
+ file2-> SetCompressionLevel(9);
+ file2->cd();
+
+ fHistDir=gDirectory;
+ fHistos = new AliJXtHistos(fCard);
+ fHistos->CreateXtHistos();
+
+ PostData(2, fHistDir);
+ TH1::AddDirectory( orignalTH1AdddirectoryStatus );
+ cout<<"DEBUG : TH1::AddDirectory get orignal Value = "<<( orignalTH1AdddirectoryStatus?"True":"False" )<<endl;
+
+ //fEfficiency = new AliJEfficiency();
+
+ fevt = 0;
+}
+//________________________________________________________________________
+void AliXtAnalysis::UserExec(Option_t *) {
+
+ // Main loop - called for each event
+
+ fevt++;
+ if(fevt % 10000 == 0) cout << "Number of event scanned = "<< fevt << endl;
+
+ Int_t filterBit = AliAODTrack::kTrkGlobal; //fCard->Get("TrackFilterBit");
+
+ AliVEvent *event = InputEvent();
+ if(!event) return;
+
+ // check if the event was triggered or not and vertex
+ if( !IsGoodEvent( event ) ) return; // fZBin is set there
+ fhEvents->Fill( 5 );
+ if(fDebugMode > 0) cout << "zvtx = " << fZVert << endl;
+
+ AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(event);
+ if(!aodEvent) return;
+
+ // centrality - in case of pPb and PbPb, dictated by DataType in the card
+ double fcent;
+ if( fCard->Get("DataType") > 0.5 ){
+ AliCentrality *cent = event->GetCentrality();
+ if( ! cent ) return;
+ fcent = cent->GetCentralityPercentile("V0M");
+ fCentBin = fCard->GetBin(kCentrType, fcent);;
+ //cout <<"Centrality = "<< fcent <<"\t"<< fCentBin << endl;
+ }else{
+ fcent = 0.0;
+ fCentBin = 0;
+ }
+
+ if(fCentBin<0) return;
+ fhEvents->Fill( 6 );
+ Int_t nt = aodEvent->GetNumberOfTracks();
+
+ fHistos->FillCentralityHistos(fcent, fCentBin);
+
+ // clear them up for every event
+ fChargedList->Clear();
+ fIsolatedChargedList->Clear();
+
+ // Is there a better way than hard code this into card???
+ double sqrts = fCard->Get("Sqrts");
+
+ // Isolation method: 0 = relative, 1 = absolute
+ double isolMethod = fCard->Get("IsolationMethod");
+
+ // Minimum isolation pT that is considered
+ double minIsolationPt = fCard->Get("MinimumIsolatedPt");
+
+ // Dummy numbers; either of these is updated based on selected method (other is void)
+ double isolationFraction = 99999.;
+ double isolationThreshold = 99999.;
+
+ if( isolMethod > 0.5 ){
+ isolationThreshold = fCard->Get("IsolationThreshold"); // this is fixed threshold
+ }else{
+ isolationFraction = fCard->Get("IsolationFraction"); // fraction in pT, threshold updated later in a loop
+ }
+
+ // Isolation radius
+ double isolR = fCard->Get("IsolationRadius");
+
+ // Get good tracks to the list
+ for(Int_t it = 0; it < nt; it++) {
+ AliAODTrack *track = aodEvent->GetTrack(it);
+ if( !track ) continue;
+ if( !track->TestFilterBit(filterBit) ) continue;
+ double eta = track->Eta();
+ if( !fCard->IsInEtaRange( eta ) ) continue; // Do not use fiducial cut here
+ AliAODTrack *acceptedTrack = new AliAODTrack( *track );
+ double pT = acceptedTrack->Pt();
+ double xT = 2.*pT/sqrts;
+ double phi = acceptedTrack->Phi();
+
+ // TODO:
+ double effCorr = 1.0;
+
+ // Fill histos
+ fHistos->FillInclusiveHistograms(pT, xT, eta, phi, effCorr, fCentBin);
+
+ // Add an accepted track into list of inclusive charged particles
+ fChargedList->Add( acceptedTrack );
+ }
+
+ // Check isolation of the found good tracks
+ Int_t nAcc = fChargedList->GetEntriesFast();
+
+ // Get eta range for fiducial cut
+ double etaRange = fCard->Get("EtaRange");
+
+ for( Int_t it = 0; it < nAcc; it++ ){
+ AliAODTrack *track = (AliAODTrack*)fChargedList->At(it);
+ // Fiducial eta cut for isolated particles
+ double eta = track->Eta();
+ if( abs(eta) > etaRange - isolR ) continue;
+
+ // To check the isolation with cone, use TLorentzVector -routines
+ TLorentzVector lvTrack = TLorentzVector( track->Px(), track->Py(), track->Pz(), track->P() );
+
+ // Set isolation threshold, if relative isolation
+ double pT = lvTrack.Pt();
+ if( pT < minIsolationPt ) continue;
+ if( isolMethod < 0.5 ) isolationThreshold = pT * isolationFraction; // here: relative isolation
+
+ // Isolation check
+ double sum = 0.0;
+ for( Int_t ia = 0; ia < nAcc; ia++ ){
+ if( ia == it ) continue; // Do not count the particle itself
+ AliAODTrack *assocTrack = (AliAODTrack*)fChargedList->At(ia);
+ TLorentzVector lvAssoc = TLorentzVector( assocTrack->Px(), assocTrack->Py(), assocTrack->Pz(), assocTrack->P() );
+ if( lvTrack.DeltaR( lvAssoc ) < isolR ) sum += lvAssoc.Pt();
+ }
+
+ // Cone activity
+ fHistos->FillInclusiveConeActivities(pT,sum); // efficiency correction?
+
+ // If the particle was isolated, fill histograms and the list
+ if( sum < isolationThreshold ){
+
+ double xT = 2.*pT/sqrts;
+
+ if( fDebugMode > 0 ){
+ cout << "DEBUG: isolated particle found " << endl;
+ cout << "fCentBin = " << fCentBin << ", pT = " << pT << ", xT = " << xT << " and eta = " << eta << endl;
+ }
+
+ fHistos->FillIsolatedConeActivities(pT, sum); // efficiency correction?
+
+ // TODO:
+ double effCorr = 1.0;
+
+ // Fill histos
+ fHistos->FillIsolatedHistograms(pT, xT, eta, track->Phi(), effCorr, fCentBin);
+
+ // Add tracks to the isolated list
+ AliAODTrack *acceptedIsolatedTrack = new AliAODTrack( *track );
+ fIsolatedChargedList->Add( acceptedIsolatedTrack );
+ }
+ }
+
+ // For further analysis, there is now lists of all charged and isolated charged available, will be usefull.
+
+ return; // END
+}
+//________________________________________________________________________
+void AliXtAnalysis::Terminate(Option_t *)
+{
+ OpenFile(2);
+ fHistDir->Write();
+
+ cout<<"Successfully finished"<<endl;
+}
+//________________________________________________________________________
+bool AliXtAnalysis::IsGoodEvent(AliVEvent *event) {
+
+ // This function checks that the event has the requested trigger
+ // and that the z-vertex is in given range
+
+
+ fhEvents->Fill( 0 );
+
+ if(fAnaUtils->IsPileUpEvent(event)) {
+ return kFALSE;
+ } else {
+ Bool_t triggeredEventMB = kFALSE; //init
+
+ fhEvents->Fill( 1 );
+
+ Bool_t triggerkMB = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & ( AliVEvent::kMB );
+
+ if( triggerkMB ){
+ triggeredEventMB = kTRUE; //event triggered as minimum bias
+ fhEvents->Fill( 2 );
+ }
+ //--------------------------------------------------------------
+ // check reconstructed vertex
+ int ncontributors = 0;
+ Bool_t goodRecVertex = kFALSE;
+ const AliVVertex *vtx = event->GetPrimaryVertex();
+ if(vtx){
+ fhEvents->Fill( 3 );
+ fZVert = vtx->GetZ();
+ fHistos->FillRawVertexHisto(fZVert);
+ ncontributors = vtx->GetNContributors();
+ if(ncontributors > 0){
+ if(fCard->VertInZRange(fZVert)) {
+ goodRecVertex = kTRUE;
+ fhEvents->Fill( 4 );
+ fHistos->FillAcceptedVertexHisto(fZVert, fCentBin);
+ fZBin = fCard->GetBin(kZVertType, fZVert);
+ }
+ }
+ }
+ return triggerkMB && goodRecVertex;
+ }
+ //---------------------------------
+}
--- /dev/null
+/**************************************************************************
+ * AliXtAnalysis:
+ * This class constructs inclusive and isolated (based on charged tracks)
+ * invariant spectra. Isolated case uses a different efficiency where the
+ * contamination from cases where non-isolated particle appears as an
+ * isolated one due to finite detector efficiency is taken into account.
+ *
+ * contact: Sami Räsänen
+ * University of Jyväskylä, Finland
+ * sami.s.rasanen@jyu.fi
+ **************************************************************************/
+
+#ifndef ALIXTANALYSIS_H
+#define ALIXTANALYSIS_H
+
+#include <AliAnalysisTaskSE.h>
+
+class AliVEvent;
+class TList;
+class AliAnalysisUtils;
+class AliJCard;
+class TDirectory;
+class AliJXtHistos;
+class TH1D;
+class TObjArray;
+
+class AliXtAnalysis : public AliAnalysisTaskSE {
+
+ public:
+ AliXtAnalysis();
+ AliXtAnalysis(const char *name, const char *cardname);
+ AliXtAnalysis(const AliXtAnalysis& a);
+ AliXtAnalysis& operator=(const AliXtAnalysis& ap);
+
+ virtual ~AliXtAnalysis();
+
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *option);
+ virtual void Terminate(Option_t *);
+
+ bool IsGoodEvent(AliVEvent *event);
+ void SetDebugMode( int debug) { fDebugMode = debug; };
+
+ private:
+ TList *fOutputList; // Output list
+ AliAnalysisUtils *fAnaUtils; // Analysis utils
+
+ //AliIsolatedEfficiency *fEfficiency; // TODO: isolated efficiency, currently eff = 1
+ AliJCard *fCard; // All parameters
+
+ TDirectory *fHistDir; // histograms to the directory, structure compatible with JCORRAN
+ AliJXtHistos *fHistos; // encapsulate (almost) all histograms
+ TH1D *fhEvents; // general event statistics
+
+ TObjArray *fChargedList; // accepted charged tracks in an event
+ TObjArray *fIsolatedChargedList; // isolated charged tracks in an event
+
+ int fCentBin; // centrality bin
+ int fZBin; // z -vertex bin
+ double fZVert; // z -vertex
+
+ Int_t fevt; // event number
+ int fDebugMode; // debug mode
+
+ ClassDef(AliXtAnalysis, 1);
+};
+
+#endif
--- /dev/null
+TrackFilterBit 1
+Sqrts 7000.
+EtaRange 0.8
+IsolationMethod 0.0 # 0 = relative, 1 = absolute
+IsolationThreshold 0.5
+IsolationFraction 0.1
+IsolationRadius 0.4
+
--- /dev/null
+AliAnalysisTask *AddTaskXtAnalysis() {
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ ::Error("AddTaskFluctuations", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ if (!mgr->GetInputEventHandler()) {
+ ::Error("AddTaskFluctuations", "This task requires an input event handler");
+ return NULL;
+ }
+
+ TString type = mgr->GetInputEventHandler()->GetDataType();
+
+ AliXtAnalysis *xtTask = new AliXtAnalysis("AliXtAnalysis","./card_xT.input");
+ xtTask->SetDebugLevel(0);
+ xtTask->SetDebugMode(0);
+
+ mgr->AddTask((AliAnalysisTask*) xtTask);
+
+ // Create containers for input/output
+ AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+
+ AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("xtAnalysis", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:xtAnalysis",AliAnalysisManager::GetCommonFileName()));
+ AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("xtHistos", TDirectory::Class(), AliAnalysisManager::kOutputContainer, Form("%s:xtHistos",AliAnalysisManager::GetCommonFileName()));
+ // Connect input/output
+ mgr->ConnectInput(xtTask, 0, cinput);
+ mgr->ConnectOutput(xtTask, 1, coutput1);
+ mgr->ConnectOutput(xtTask, 2, coutput2);
+
+ return xtTask;
+}
+