/* History of cvs commits:
*
* $Log$
+ * Revision 1.87 2007/05/04 14:49:29 policheh
+ * AliPHOSRecPoint inheritance from AliCluster
+ *
+ * Revision 1.86 2007/04/02 15:00:16 cvetan
+ * No more calls to gAlice in the reconstruction
+ *
+ * Revision 1.85 2007/03/28 19:18:15 kharlov
+ * RecPoints recalculation in TSM removed
+ *
+ * Revision 1.84 2007/03/07 07:01:21 hristov
+ * Fixing copy/paste erro. Additional protections
+ *
+ * Revision 1.83 2007/03/06 21:07:37 kharlov
+ * DP: xz CPV-EMC distance filled to TS
+ *
+ * Revision 1.82 2007/03/06 06:54:48 kharlov
+ * DP:Calculation of cluster properties dep. on vertex added
+ *
+ * Revision 1.81 2007/02/05 10:02:40 kharlov
+ * Module numbering is corrected
+ *
+ * Revision 1.80 2006/08/28 10:01:56 kharlov
+ * Effective C++ warnings fixed (Timur Pocheptsov)
+ *
+ * Revision 1.79 2006/04/25 12:41:15 hristov
+ * Moving non-persistent data to AliESDfriend (Yu.Belikov)
+ *
+ * Revision 1.78 2005/11/18 13:04:51 hristov
+ * Bug fix
+ *
+ * Revision 1.77 2005/11/17 23:34:36 hristov
+ * Corrected logics
+ *
+ * Revision 1.76 2005/11/17 22:29:12 hristov
+ * Faster version, no attempt to match tracks outside the PHOS acceptance
+ *
+ * Revision 1.75 2005/11/17 12:35:27 hristov
+ * Use references instead of objects. Avoid to create objects when they are not really needed
+ *
+ * Revision 1.74 2005/07/08 14:01:36 hristov
+ * Tracking in non-uniform nmagnetic field (Yu.Belikov)
+ *
+ * Revision 1.73 2005/05/28 14:19:05 schutz
+ * Compilation warnings fixed by T.P.
+ *
*/
//_________________________________________________________________________
//____________________________________________________________________________
- AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1() : AliPHOSTrackSegmentMaker()
+AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1() :
+ AliPHOSTrackSegmentMaker(),
+ fDefaultInit(kTRUE),
+ fWrite(kFALSE),
+ fNTrackSegments(0),
+ fRcpv(0.f),
+ fRtpc(0.f),
+ fLinkUpArray(0),
+ fEmcFirst(0),
+ fEmcLast(0),
+ fCpvFirst(0),
+ fCpvLast(0),
+ fModule(0),
+ fTrackSegmentsInRun(0)
+
{
// default ctor (to be used mainly by Streamer)
-
InitParameters() ;
- fDefaultInit = kTRUE ;
}
//____________________________________________________________________________
- AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const TString alirunFileName, const TString eventFolderName)
- :AliPHOSTrackSegmentMaker(alirunFileName, eventFolderName)
+AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const TString & alirunFileName, const TString & eventFolderName) :
+ AliPHOSTrackSegmentMaker(alirunFileName, eventFolderName),
+ fDefaultInit(kFALSE),
+ fWrite(kFALSE),
+ fNTrackSegments(0),
+ fRcpv(0.f),
+ fRtpc(0.f),
+ fLinkUpArray(0),
+ fEmcFirst(0),
+ fEmcLast(0),
+ fCpvFirst(0),
+ fCpvLast(0),
+ fModule(0),
+ fTrackSegmentsInRun(0)
{
// ctor
-
InitParameters() ;
Init() ;
- fDefaultInit = kFALSE ;
fESD = 0;
}
+
+AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const AliPHOSTrackSegmentMakerv1 & tsm) :
+ AliPHOSTrackSegmentMaker(tsm),
+ fDefaultInit(kFALSE),
+ fWrite(kFALSE),
+ fNTrackSegments(0),
+ fRcpv(0.f),
+ fRtpc(0.f),
+ fLinkUpArray(0),
+ fEmcFirst(0),
+ fEmcLast(0),
+ fCpvFirst(0),
+ fCpvLast(0),
+ fModule(0),
+ fTrackSegmentsInRun(0)
+{
+ // cpy ctor: no implementation yet
+ // requested by the Coding Convention
+ Fatal("cpy ctor", "not implemented") ;
+}
+
+
//____________________________________________________________________________
AliPHOSTrackSegmentMakerv1::~AliPHOSTrackSegmentMakerv1()
{
}
//____________________________________________________________________________
-Float_t AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * emcClu,AliPHOSCpvRecPoint * cpvClu, Int_t &trackindex) const
+void AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * emcClu,
+ AliPHOSCpvRecPoint * cpvClu,
+ Int_t &trackindex,
+ Float_t &dx, Float_t &dz) const
{
// Calculates the distance between the EMC RecPoint and the CPV RecPoint
// Clusters are sorted in "rows" and "columns" of width 1 cm
- //Float_t delta = 1 ; // Width of the rows in sorting of RecPoints (in cm)
- // if you change this value, change it as well in xxxRecPoint::Compare()
- Float_t distance2Cpv = fRcpv ;
+// Float_t delta = 1 ; // Width of the rows in sorting of RecPoints (in cm)
+// // if you change this value, change it as well in xxxRecPoint::Compare()
Float_t distance2Track = fRtpc ;
trackindex = -1 ; // closest track within fRCpv
TVector3 vecEmc ; // Local position of EMC recpoint
- TVector3 vecCpv ; // Local position of CPV recpoint propagated to EMC
- TVector3 vecDist ; // Distance between local positions of two points
+ TVector3 vecP ; // Momentum direction at CPV plain
+ TVector3 vecPloc ; // Momentum direction at CPV plain
- emcClu->GetLocalPosition(vecEmc) ;
- cpvClu->GetLocalPosition(vecCpv) ;
-
//toofar = kTRUE ;
- if(emcClu->GetPHOSMod() == cpvClu->GetPHOSMod()){
+ if(emcClu->GetPHOSMod() != cpvClu->GetPHOSMod()){
+ dx=999. ;
+ dz=999. ;
+ return ;
+ }
- // Find EMC-CPV distance
- distance2Cpv = (vecCpv - vecEmc).Mag() ;
+ emcClu->GetLocalPosition(vecEmc) ;
+
+ AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
+ const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
- if (fESD != 0x0) {
- // Extrapolate the global track direction if any to CPV and find the closest track
- Int_t nTracks = fESD->GetNumberOfTracks();
- Int_t iClosestTrack = -1;
- Double_t minDistance = 1e6;
- Double_t pxyz[3], xyz[3];
- Double_t rPHOS =
- AliPHOSGetter::Instance()->PHOSGeometry()->GetIPtoCrystalSurface();
- AliESDtrack *track;
- for (Int_t iTrack=0; iTrack<nTracks; iTrack++) {
- track = fESD->GetTrack(iTrack);
- if (track->IsPHOS())
- continue ;
- if (!track->GetXYZAt(rPHOS,xyz))
+ Double_t xCPV,zCPV ; //EMC-projected coordinates of CPV cluster
+ TVector3 cpvGlobal; // Global position of the CPV recpoint
+ geom->GetGlobalPHOS((AliPHOSRecPoint*)cpvClu,cpvGlobal);
+ Double_t vtxCPV[3]={cpvGlobal.X(),cpvGlobal.Y(),cpvGlobal.Z()} ;
+ Int_t dummyMod ;
+
+ if (fESD == 0x0) {
+ //if no track information available, assume straight line from IP to emcal
+ geom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,xCPV,zCPV) ;
+ dx=xCPV - vecEmc.X() ;
+ dz=zCPV - vecEmc.Z() ;
+ return ;
+ }
+
+ //if there is ESD try to correct distance using TPC information on particle direct in CPV
+ if (fESD != 0x0) {
+
+ Double_t rCPV = cpvGlobal.Pt() ;// Radius from IP to current point
+
+ // Extrapolate the global track direction if any to CPV and find the closest track
+ Int_t nTracks = fESD->GetNumberOfTracks();
+ Int_t iClosestTrack = -1;
+ Double_t minDistance = 1.e6;
+ TVector3 inPHOS ;
+
+ AliESDtrack *track;
+ Double_t xyz[3] ;
+ Double_t pxyz[3];
+ for (Int_t iTrack=0; iTrack<nTracks; iTrack++) {
+ track = fESD->GetTrack(iTrack);
+ if (!track->GetXYZAt(rCPV, fESD->GetMagneticField(), xyz))
continue; //track coord on the cylinder of PHOS radius
- if ((TMath::Abs(xyz[0])+TMath::Abs(xyz[1])+TMath::Abs(xyz[2]))<=0)
+ if ((TMath::Abs(xyz[0])+TMath::Abs(xyz[1])+TMath::Abs(xyz[2]))<=0)
continue;
- if (!track->GetPxPyPzAt(rPHOS,pxyz))
- continue; // track momentum ibid.
- vecDist = PropagateToPlane(xyz,pxyz,"CPV",cpvClu->GetPHOSMod());
- // Info("GetDistanceInPHOSPlane","Track %d propagation to CPV = (%f,%f,%f)",
- // iTrack,vecDist.X(),vecDist.Y(),vecDist.Z());
- vecDist -= vecCpv;
- distance2Track = TMath::Sqrt(vecDist.X()*vecDist.X() + vecDist.Z()*vecDist.Z());
- // Find the closest track to the EMC recpoint
- if (distance2Track < minDistance) {
- minDistance = distance2Track;
- iClosestTrack = iTrack;
- }
+ //Check if this track hits PHOS
+ inPHOS.SetXYZ(xyz[0],xyz[1],xyz[2]);
+ distance2Track = inPHOS.Angle(cpvGlobal) ;
+ // Find the closest track to the CPV recpoint
+ if (distance2Track < minDistance) {
+ minDistance = distance2Track;
+ iClosestTrack = iTrack;
}
+ }
- if (iClosestTrack != -1) {
- track = fESD->GetTrack(iClosestTrack);
- if (track->GetPxPyPzAt(rPHOS,pxyz)) { // track momentum ibid.
- TVector3 vecCpvGlobal; // Global position of the CPV recpoint
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
- geom->GetGlobal((AliRecPoint*)cpvClu,vecCpvGlobal);
- for (Int_t ixyz=0; ixyz<3; ixyz++)
- xyz[ixyz] = vecCpvGlobal[ixyz];
- vecDist = PropagateToPlane(xyz,pxyz,"EMC",cpvClu->GetPHOSMod());
-// Info("GetDistanceInPHOSPlane","Track %d propagation to EMC = (%f,%f,%f)",
-// iClosestTrack,vecDist.X(),vecDist.Y(),vecDist.Z());
- vecDist -= vecEmc;
- distance2Track = TMath::Sqrt(vecDist.X()*vecDist.X() + vecDist.Z()*vecDist.Z());
- }
+ if (iClosestTrack != -1) {
+ track = fESD->GetTrack(iClosestTrack);
+ if (track->GetPxPyPzAt(rCPV, fESD->GetMagneticField(), pxyz)) { // track momentum ibid.
+ vecP.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
+ Int_t dummyMod ;
+ geom->ImpactOnEmc(vtxCPV,vecP.Theta(),vecP.Phi(),dummyMod,xCPV,zCPV) ;
}
-// } else {
-// // If no ESD exists, than simply find EMC-CPV distance
-// distance = (vecCpv - vecEmc).Mag() ;
+ }
- //if(distance2Track < fRcpv + 2*delta )
- if(distance2Track < fRtpc )
- trackindex = iClosestTrack ;
- // toofar = kFALSE ;
+ if(minDistance < fRtpc ){
+ trackindex = iClosestTrack ;
}
- // Info("GetDistanceInPHOSPlane","cpv-emc distance is %f cm",
- // distance);
}
-
- return distance2Cpv ;
-}
-
-//____________________________________________________________________________
-TVector3 AliPHOSTrackSegmentMakerv1::PropagateToPlane(Double_t *x, Double_t *p,
- const char *det, Int_t moduleNumber) const
-{
- // Propagate a straight-line track from the origin point x
- // along the direction p to the CPV or EMC module moduleNumber
- // Returns a local position of such a propagation
-
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
- TVector3 moduleCenter = geom->GetModuleCenter(det,moduleNumber);
- TVector3 vertex(x);
- TVector3 direction(p);
-
-// Info("PropagateToCPV","Center of the %s module %d is (%f,%f,%f)",
-// det,moduleNumber,moduleCenter[0],moduleCenter[1],moduleCenter[2]);
-
- Double_t time = (moduleCenter.Mag2() - vertex.Dot(moduleCenter)) /
- (direction.Dot(moduleCenter));
- TVector3 globalIntersection = vertex + direction*time;
- return geom->Global2Local(globalIntersection,moduleNumber);
+ if(trackindex!=-1){
+ // If the closest global track is found, calculate EMC-CPV distance from it
+ dx=xCPV - vecEmc.X() ;
+ dz=zCPV - vecEmc.Z() ;
+ }
+ else{
+ // If no global track was found, just take the nearest CPV point
+ geom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,xCPV,zCPV) ;
+ dx=xCPV - vecEmc.X() ;
+ dz=zCPV - vecEmc.Z() ;
+ }
+ return ;
}
-
//____________________________________________________________________________
void AliPHOSTrackSegmentMakerv1::Init()
{
cpv = dynamic_cast<AliPHOSCpvRecPoint *>(cpvRecPoints->At(iCpv)) ;
Int_t track = -1 ;
- Float_t r = GetDistanceInPHOSPlane(emcclu, cpv, track) ;
- // if(toofar)
- // continue ;
- if(r < fRcpv) {
- new ((*fLinkUpArray)[iLinkUp++]) AliPHOSLink(r, iEmcRP, iCpv, track) ;
+ Float_t dx,dz ;
+ GetDistanceInPHOSPlane(emcclu, cpv, track,dx,dz) ;
+ if(TMath::Sqrt(dx*dx+dz*dz) < fRcpv ){
+ new ((*fLinkUpArray)[iLinkUp++]) AliPHOSLink(dx, dz, iEmcRP, iCpv, track) ;
}
}
}
if(emcExist[linkUp->GetEmc()-fEmcFirst] != -1){
if(cpvExist[linkUp->GetCpv()-fCpvFirst]){ //CPV still exist
+ Float_t dx,dz ;
+ linkUp->GetXZ(dx,dz) ;
new ((* trackSegments)[fNTrackSegments])
AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(linkUp->GetEmc())) ,
dynamic_cast<AliPHOSCpvRecPoint *>(cpvRecPoints->At(linkUp->GetCpv())) ,
- linkUp->GetTrack()) ;
+ linkUp->GetTrack(),dx,dz) ;
(dynamic_cast<AliPHOSTrackSegment *>(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
fNTrackSegments++ ;
Int_t ievent ;
for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
- gime->Event(ievent,"R") ;
+ gime->Event(ievent,"DR") ;
//Make some initializations
fNTrackSegments = 0 ;
fEmcFirst = 0 ;
if(fWrite) //do not unload in "on flight" mode
Unload();
}
-
//____________________________________________________________________________
void AliPHOSTrackSegmentMakerv1::Unload()
{
TClonesArray * trackSegments = AliPHOSGetter::Instance()->TrackSegments() ;
Info("PrintTrackSegments", "Results from TrackSegmentMaker:") ;
- printf("nevent: %d\n", gAlice->GetEvNumber()) ;
+ printf("nevent: %d\n", AliPHOSGetter::Instance()->EventNumber()) ;
printf(" Found %d TrackSegments\n", trackSegments->GetEntriesFast() );
if(strstr(option,"all")) { // printing found TS