// Implementation of the interface for THBTprocessor
// Author: Piotr Krzysztof Skowronski <Piotr.Skowronski@cern.ch>
+// 09.10.2001 Piotr Skowronski
+//
+// Theta - Eta cohernecy facilities added:
+// AliGenerator::SetThetaRange method overriden
+// Static methods added
+// EtaToTheta
+// ThetaToEta
+// DegreesToRadians
+// RadiansToDegrees
+//
+// Class description comments put on proper place
+
// 27.09.2001 Piotr Skowronski
// removing of redefinition of defaults velues
// in method's implementation.
//
-#include "AliGenHBTprocessor.h"
-#include "TROOT.h"
-#include <iostream.h>
-
-#include "AliRun.h"
-#include "AliStack.h"
-#include "TParticle.h"
-#include "AliGenCocktailAfterBurner.h"
-
-
-
-const Int_t AliGenHBTprocessor::fgkHBTPMAXPART = 100000;
-
-ClassImp(AliGenHBTprocessor)
-
+//////////////////////////////////////////////////////////////////////////////////
//Wrapper class for "hbt processor" after burner
//The origibal code is written in fortran by Lanny Ray
//and is put in the directory $ALICE_ROOT/HBTprocessor
// A) HBT PROCESSOR NEEDS MORE THAN ONE EVENT TO WORK
// AS MORE AS IT BETTER WORKS
// B) IT IS ABLE TO "ADD" CORRELATIONS ONLY UP TO TWO PARTICLE TYPES AT ONES
+//////////////////////////////////////////////////////////////////////////////////
+
+#include "AliGenHBTprocessor.h"
+#include "TROOT.h"
+#include <iostream.h>
+
+#include "AliRun.h"
+#include "AliStack.h"
+#include "TParticle.h"
+#include "AliGenCocktailAfterBurner.h"
+
+
+
+const Int_t AliGenHBTprocessor::fgkHBTPMAXPART = 100000;
+
+ClassImp(AliGenHBTprocessor)
+
AliGenCocktailAfterBurner* GetGenerator();
//sets up parameters in generator
THBTprocessor *thbtp = fHBTprocessor;
+
thbtp->SetTrackRejectionFactor(fTrackRejectionFactor);
thbtp->SetRefControl(fReferenceControl);
thbtp->SetPxRange(fPx_min,fPx_max);
thbtp->SetPyRange(fPy_min,fPy_max);
thbtp->SetPzRange(fPz_min,fPz_max);
- thbtp->SetPhiRange(fPhiMin*180/TMath::Pi(),fPhiMax*180/TMath::Pi());
-// cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
-// cout<<fPhiMin<<fPhiMax<<endl;
-// cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
+ thbtp->SetPhiRange(fPhiMin*180./TMath::Pi(),fPhiMax*180./TMath::Pi());
thbtp->SetEtaRange(fEta_min,fEta_max);
thbtp->SetNPtBins(fN_pt_bins);
thbtp->SetNPhiBins(fN_phi_bins);
"HBT Processor needs more than 1 event to work properly,\
but there is only %d set", gAlice->GetEventsPerRun());
}
+
+ fHBTprocessor->Initialize(); //reset all fields of common blocks
+ //in case there are many HBT processors
+ //run one after one (i.e. in AliCocktailAfterBurner)
+ //between Init() called and Generate there might
+ Init(); //be different instance running - be sure that we have our settings
InitStatusCodes(); //Init status codes
if(pid1 == pid2)
{
fHBTprocessor->SetPIDs(IdFromPDG(pid1) ,0);
- SetNPIDtypes(1);
- SetSwitchType(1);
+ SetNPIDtypes(1);
+ SetSwitchType(1);
}
else
{
fHBTprocessor->SetPIDs(IdFromPDG(pid1) ,IdFromPDG(pid2));
- SetNPIDtypes(2);
+ SetNPIDtypes(2);
}
}
/*******************************************************************/
void AliGenHBTprocessor::SetSwitch1D(Int_t s1d)
{
//default s1d = 3
-// Sets fSwitch_3d
-// = 0 to not compute the 3D two-body correlations.
-// = 1 to compute this using the side-out-long form
-// = 2 to compute this using the Yanno-Koonin-Pogoredskij form.
+// Sets fSwitch_1d
+// = 0 to not compute the 1D two-body //orrelations.
+// = 1 to compute this using Q-invariant
+// = 2 to compute this using Q-total
+// = 3 to compute this using Q-3-ve//tor
fSwitch_1d = s1d;
fHBTprocessor->SetSwitch1D(s1d);
void AliGenHBTprocessor::SetSwitch3D(Int_t s3d)
{
//default s3d = 0
-// Sets fSwitch_3d
-// = 0 to not compute the 1D two-body //orrelations.
-// = 1 to compute this using Q-invariant
-// = 2 to compute this using Q-total
-// = 3 to compute this using Q-3-ve//tor
+// Sets fSwitch_3d
+// = 0 to not compute the 3D two-body correlations.
+// = 1 to compute this using the side-out-long form
+// = 2 to compute this using the Yanno-Koonin-Pogoredskij form.
fSwitch_3d = s3d;
fHBTprocessor->SetSwitch3D(s3d);
fEta_min= etamin;
fEta_max =etamax;
fHBTprocessor->SetEtaRange(etamin,etamax);
+
+ //set the azimothal angle range in the AliGeneraor -
+ //to keep coherency between azimuthal angle and pseudorapidity
+ //DO NOT CALL this->SetThetaRange, because it calls this method (where we are)
+ //which must cause INFINITE LOOP
+ AliGenerator::SetThetaRange(RadiansToDegrees(EtaToTheta(fEta_min)),
+ RadiansToDegrees(EtaToTheta(fEta_max)));
+
}
+/*******************************************************************/
+void AliGenHBTprocessor::SetThetaRange(Float_t thetamin, Float_t thetamax)
+{
+ //default thetamin = 0, thetamax = 180
+ //Azimuthal angle, override AliGenerator method which uses widely (i.e. wrapper generators)
+ //core fortran HBTProcessor uses Eta (pseudorapidity)
+ //so these methods has to be synchronized
+
+ AliGenerator::SetThetaRange(thetamin,thetamax);
+
+ SetEtaRange( ThetaToEta(fThetaMin) , ThetaToEta(fThetaMax) );
+
+}
+
/*******************************************************************/
void AliGenHBTprocessor::SetNPtBins(Int_t nptbin)
{
//
if(id>0 && id<fNPDGCodes) return fPDGCode[id];
else return -1;
-}
+}
+Double_t AliGenHBTprocessor::ThetaToEta(Double_t arg)
+ {
+ //converts etha(azimuthal angle) to Eta (pseudorapidity). Argument in radians
+
+ if(arg>= TMath::Pi()) return 709.0;//This number is the biggest wich not crashes exp(x)
+ if(arg<= 0.0) return -709.0;//
+
+ arg -= TMath::Pi()/2.;
+ if (arg > 0.0)
+ {
+ return -TMath::Log( TMath::Tan(arg/2.)) ;
+ }
+ else
+ {
+ return TMath::Log( TMath::Tan(-arg/2.)) ;
+ }
+ }
+
/*******************************************************************/
/****** ROUTINES USED FOR COMMUNUCATION ********/
/******************** WITH FORTRAN ********************/
//coherent with AliGenCocktail
//incohernet with AliGenerator
virtual void SetEtaRange(Float_t etamin = -1.5, Float_t etamax = 1.5);//Pseudorapidity
-
+ void SetThetaRange(Float_t thetamin = 0, Float_t thetamax = 180); //Azimuthal angle, override AliGenerator method
+ //which uses this, core fortran HBTProcessor uses Eta (pseudorapidity)
+ //so these methods has to be synchronized
+
virtual void SetNPtBins(Int_t nptbin = 50);
virtual void SetNPhiBins(Int_t nphibin = 50);
virtual void SetNEtaBins(Int_t netabin = 50);
Float_t fPz_max; // Sector range in pz in GeV/c max
Float_t fDelpz; // Mom. space sector cell size - pz(GeV/c)
- public:
+
+ /******* P R O T E C T E D M E T H O D S *****/
+ public:
+ //conveerts Eta (pseudorapidity) to etha(azimuthal angle). Returns radians
+ static Double_t EtaToTheta(Double_t arg){return 2.*TMath::ATan(TMath::Exp(-arg));}
+ //converts etha(azimuthal angle) to Eta (pseudorapidity). Argument in radians
+ static Double_t ThetaToEta(Double_t arg);
+ //converts Degrees To Radians
+ static Double_t DegreesToRadians(Double_t arg){return arg*TMath::Pi()/180.;}
+ //converts Radians To Degrees
+ static Double_t RadiansToDegrees(Double_t arg){return arg*180./TMath::Pi();}
+
ClassDef(AliGenHBTprocessor,1) // Interface class for AliMevsim
};
+#include <iostream.h>
#endif
#ifndef THBTPROCESSOR_H
#define THBTPROCESSOR_H
+/*******************************************************/
+//Author Piotr Krzysztof Skowronski e-mial: Piotr.Skowronski@cern.ch
+// C++ Wrapper Class for fortran made HBT Processor written by Lanny Ray
+//
+// Comunication is done via COMMON BLOCKS declared in HBTprocCOMMON.h
+// using cfortran.h routines
+// User should use class AliGenHBTprocessor and all their interface
+// see there for more description
+//
#include <TGenerator.h>
#include "HBTprocCOMMON.h"
-/**************************************************************
-COMMENTS APROPOS HBTPROCESSOR FORTRAN CODE:
-
-SUBROUTINE INITIALIZE HAS TO BE OMITTED, IT RESETS (ZEROES) COMMON BLOCKS
-
-SUBROUTINE KINEMATICS HAS TO BE RENAMED EITHER IN MEVSIM OR IN PROCESSOR
-AS THEY HAVE IDETICAL DECLARATIONS AND SOMTIMES IS USED THE BAD ONE IN CASE BOTH LIBRARIES ARE LOADED
-
-
-
-
-***************************************************************/
class THBTprocessor: public TGenerator
{
public:
- THBTprocessor();
+ THBTprocessor();
virtual ~THBTprocessor() {};
virtual void Initialize();
virtual Int_t ImportParticles(TClonesArray *particles, Option_t *option="");
//Set/Gets
-
+ //comprehensive description off all these methods
+ //can be found in proper methods of AliGenHBTprocessor
+
virtual void SetTrackRejectionFactor(Float_t trf = 1.0) {PARAMETERS.trk_accep = trf;}
virtual void SetRefControl(Int_t rc =2) {PARAMETERS.ref_control = rc;}
virtual void SetPIDs(Int_t pid1 = 8,Int_t pid2 = 9) {PARAMETERS.pid[0]=pid1; PARAMETERS.pid[1]=pid2;}
};
#endif
+
+/**************************************************************
+COMMENTS APROPOS HBTPROCESSOR FORTRAN CODE:
+
+SUBROUTINE INITIALIZE HAS TO BE OMITTED, IT RESETS (ZEROES) COMMON BLOCKS
+
+SUBROUTINE KINEMATICS HAS TO BE RENAMED EITHER IN MEVSIM OR IN PROCESSOR
+AS THEY HAVE IDENTICAL DECLARATIONS AND SOMTIMES IS USED THE BAD ONE IN CASE BOTH LIBRARIES ARE LOADED
+
+****************************************************************/