]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
This commit was generated by cvs2svn to compensate for changes in r18145,
authorpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 25 Apr 2007 15:38:41 +0000 (15:38 +0000)
committerpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 25 Apr 2007 15:38:41 +0000 (15:38 +0000)
which included commits to RCS files with non-trunk default branches.

106 files changed:
PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoLikeSignAnalysis.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoLikeSignAnalysis.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexMultAnalysis.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexMultAnalysis.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoBaseAnalysis.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoCorrFctn.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoCutMonitor.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventWriter.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoHiddenInfo.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoKinkCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoLikeSignCorrFctn.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoPairCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoParticleCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoTrackCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoV0Cut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoXiCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/PhysicalConstants.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Base/SystemOfUnits.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicTrackCut.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicTrackCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoAnalysisCollection.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCorrFctnCollection.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorCollection.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEnumeration.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEventWriterCollection.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoHelix.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKinkCollection.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoLinkDef.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoLorentzVector.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoLorentzVectorD.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticleCollection.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollection.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVector.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoString.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoThreeVector.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoThreeVectorD.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrack.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrack.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrackCollection.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTypes.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0Collection.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoVector.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXiCollection.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelixD.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmLorentzVector.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmLorentzVectorD.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmPhysicalHelix.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmPhysicalHelix.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmPhysicalHelixD.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmThreeVector.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmThreeVectorD.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmThreeVectorF.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/TpcLocalTransform.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/TpcLocalTransform.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Infrastructure/phys_constants.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.h [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.cxx [new file with mode: 0644]
PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.h [new file with mode: 0644]

diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.cxx b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.cxx
new file mode 100644 (file)
index 0000000..d9419f5
--- /dev/null
@@ -0,0 +1,514 @@
+/***************************************************************************
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *      This is the Class for Analysis objects.  Each of the simultaneous
+ *      Analyses running should have one of these instantiated.  They link
+ *      into the Manager in an Analysis Collection.
+ *
+ ***************************************************************************
+ *
+ *
+ * Revision 1.23  2002/11/20 00:09:26  renault
+ * fill a new monitor with (hbtEvent,partCollection)
+ *
+ * Revision 1.22  2002/11/03 16:40:31  magestro
+ * Modified ProcessEvent(), added MakePairs() method, and implemented immediate event mixing
+ *
+ * Revision 1.21  2002/06/26 17:27:09  lisa
+ * fixed small bug in AliFemtoAnalysis associated with the new feature to require ParticleCollections to have some minimum number of particles
+ *
+ * Revision 1.20  2002/06/22 17:53:31  lisa
+ * implemented switch to allow user to require minimum number of particles in First and Second ParticleCollections - default value is zero so if user does not Set this value then behaviour is like before
+ *
+ * Revision 1.19  2001/11/06 20:20:53  laue
+ * Order of event-mixing fixed.
+ *
+ * Revision 1.18  2001/05/25 23:23:59  lisa
+ * Added in AliFemtoKink stuff
+ *
+ * Revision 1.17  2001/04/05 21:57:45  laue
+ * current pico-event becomes a member of the analysis (fPicoEvent) and gets
+ * an access-function (CurrentPicoEvent)
+ *
+ * Revision 1.15  2000/09/13 18:09:09  laue
+ * Bux fix: Delete track cut only once for identical particle hbt
+ *
+ * Revision 1.14  2000/08/31 22:31:30  laue
+ * AliFemtoAnalysis: output changed (a little bit less)
+ * AliFemtoEvent: new version, members for reference mult added
+ * AliFemtoIOBinary: new IO for new AliFemtoEvent version
+ * AliFemtoTypes: TTree typedef to AliFemtoTTree added
+ * AliFemtoVertexAnalysis: overflow and underflow added
+ *
+ * Revision 1.13  2000/08/11 16:35:40  rcwells
+ * Added number of events processed to each HBT analysis
+ *
+ * Revision 1.12  2000/07/16 22:23:17  laue
+ * I forgot that we moved memberfunctions out of AliFemtoBaseAnalysis.
+ * So my previous check-ins didn't compile with the library.
+ * Now they do.
+ *
+ * Revision 1.11  2000/07/16 21:38:22  laue
+ * AliFemtoCoulomb.cxx AliFemtoSectoredAnalysis.cxx : updated for standalone version
+ * AliFemtoV0.cc AliFemtoV0.h : some cast to prevent compiling warnings
+ * AliFemtoParticle.cc AliFemtoParticle.h : pointers mTrack,mV0 initialized to 0
+ * AliFemtoIOBinary.cc : some printouts in #ifdef STHBTDEBUG
+ * AliFemtoEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
+ *                 solution
+ *
+ * Revision 1.10  2000/07/06 18:45:51  laue
+ * Copy constructor fixed. It couldn't handle identicle particles.
+ *
+ * Revision 1.9  2000/04/13 20:20:22  laue
+ * Event mixing corrected. Now the first collection of the current event is
+ * mixed with the second collection from the mixing buffer _AND_ vice verse
+ *
+ * Revision 1.8  2000/03/23 23:00:01  laue
+ * AliFemtoAnalysis copy constructor now uses Clone() function of cuts
+ * AliFemtoTypes now has AliFemtoTF1 for fitting purposes
+ *
+ * Revision 1.7  2000/03/17 17:23:05  laue
+ * Roberts new three particle correlations implemented.
+ *
+ * Revision 1.6  2000/03/16 02:07:04  laue
+ * Copy constructor added to AliFemtoAnalysis (only known cuts, corrfctn).
+ *
+ * AliFemtoBinaryReader can now derive filename from StIOMaker and read a list
+ * of files.
+ *
+ * AliFemtoManager now holds a collection of AliFemtoEventWriters (multiple writes
+ * possible now)
+ *
+ * Revision 1.5  2000/02/13 17:17:12  laue
+ * Calls to the EventBegin() and EventEnd() functions implemented
+ * The actual analysis is moved from AliFemtoManager to AliFemtoAnalysis
+ *
+ * Revision 1.4  2000/01/25 17:35:16  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.3  1999/10/04 15:38:53  lisa
+ * include Franks new accessor methods AliFemtoAnalysis::CorrFctn and AliFemtoManager::Analysis as well as McEvent example macro
+ *
+ * Revision 1.2  1999/07/06 22:33:22  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#include "Analysis/AliFemtoAnalysis.h"
+#include "Base/AliFemtoTrackCut.h"
+#include "Base/AliFemtoV0Cut.h"
+#include "Base/AliFemtoKinkCut.h"
+#include <string>
+
+
+#ifdef __ROOT__ 
+ClassImp(AliFemtoAnalysis)
+#endif
+
+AliFemtoEventCut*    copyTheCut(AliFemtoEventCut*);
+AliFemtoParticleCut* copyTheCut(AliFemtoParticleCut*);
+AliFemtoPairCut*     copyTheCut(AliFemtoPairCut*);
+AliFemtoCorrFctn*    copyTheCorrFctn(AliFemtoCorrFctn*);
+
+// this little function used to apply ParticleCuts (TrackCuts or V0Cuts) and fill ParticleCollections of picoEvent
+//  it is called from AliFemtoAnalysis::ProcessEvent()
+void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
+                              AliFemtoEvent*               hbtEvent,
+                              AliFemtoParticleCollection*  partCollection)
+{
+  switch (partCut->Type()) {
+  case hbtTrack:       // cut is cutting on Tracks
+    {
+      AliFemtoTrackCut* pCut = (AliFemtoTrackCut*) partCut;
+      AliFemtoTrack* pParticle;
+      AliFemtoTrackIterator pIter;
+      AliFemtoTrackIterator startLoop = hbtEvent->TrackCollection()->begin();
+      AliFemtoTrackIterator endLoop   = hbtEvent->TrackCollection()->end();
+      for (pIter=startLoop;pIter!=endLoop;pIter++){
+       pParticle = *pIter;
+       bool tmpPassParticle = pCut->Pass(pParticle);
+       pCut->FillCutMonitor(pParticle, tmpPassParticle);
+       if (tmpPassParticle){   
+         AliFemtoParticle* particle = new AliFemtoParticle(pParticle,pCut->Mass());
+         partCollection->push_back(particle);
+       }
+      }
+      break;
+    }
+  case hbtV0:          // cut is cutting on V0s
+    {
+      AliFemtoV0Cut* pCut = (AliFemtoV0Cut*) partCut;
+      AliFemtoV0* pParticle;
+      AliFemtoV0Iterator pIter;
+      AliFemtoV0Iterator startLoop = hbtEvent->V0Collection()->begin();
+      AliFemtoV0Iterator endLoop   = hbtEvent->V0Collection()->end();
+      // this following "for" loop is identical to the one above, but because of scoping, I can's see how to avoid repitition...
+      for (pIter=startLoop;pIter!=endLoop;pIter++){
+       pParticle = *pIter; 
+       bool tmpPassV0 = pCut->Pass(pParticle);
+       pCut->FillCutMonitor(pParticle,tmpPassV0);
+       if (tmpPassV0){
+         AliFemtoParticle* particle = new AliFemtoParticle(pParticle,partCut->Mass());
+         partCollection->push_back(particle);
+       }
+      }
+      pCut->FillCutMonitor(hbtEvent,partCollection);// Gael 19/06/02
+      break;
+    }
+  case hbtKink:          // cut is cutting on Kinks  -- mal 25May2001
+    {
+      AliFemtoKinkCut* pCut = (AliFemtoKinkCut*) partCut;
+      AliFemtoKink* pParticle;
+      AliFemtoKinkIterator pIter;
+      AliFemtoKinkIterator startLoop = hbtEvent->KinkCollection()->begin();
+      AliFemtoKinkIterator endLoop   = hbtEvent->KinkCollection()->end();
+      // this following "for" loop is identical to the one above, but because of scoping, I can's see how to avoid repitition...
+      for (pIter=startLoop;pIter!=endLoop;pIter++){
+       pParticle = *pIter; 
+       bool tmpPass = pCut->Pass(pParticle);
+       pCut->FillCutMonitor(pParticle,tmpPass);
+       if (tmpPass){
+         AliFemtoParticle* particle = new AliFemtoParticle(pParticle,partCut->Mass());
+         partCollection->push_back(particle);
+       }
+      }
+      break;
+    }
+  default:
+    cout << "FillHbtParticleCollection function (in AliFemtoAnalysis.cxx) - undefined Particle Cut type!!! \n";
+  }
+}
+//____________________________
+AliFemtoAnalysis::AliFemtoAnalysis(){
+  //  mControlSwitch     = 0;
+  fEventCut          = 0;
+  fFirstParticleCut  = 0;
+  fSecondParticleCut = 0;
+  fPairCut           = 0;
+  fCorrFctnCollection= 0;
+  fCorrFctnCollection = new AliFemtoCorrFctnCollection;
+  fMixingBuffer = new AliFemtoPicoEventCollection;
+  fNeventsProcessed = 0;
+  fPicoEvent=0;
+
+  fPicoEventCollectionVectorHideAway = 0;
+
+  fMinSizePartCollection=0;  // minimum # particles in ParticleCollection
+
+}
+//____________________________
+
+AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) : AliFemtoBaseAnalysis() {
+  //AliFemtoAnalysis();
+  fEventCut          = 0;
+  fFirstParticleCut  = 0;
+  fSecondParticleCut = 0;
+  fPairCut           = 0;
+  fCorrFctnCollection= 0;
+  fCorrFctnCollection = new AliFemtoCorrFctnCollection;
+  fMixingBuffer = new AliFemtoPicoEventCollection;
+  fNeventsProcessed = 0;
+  fPicoEvent=0;
+
+  // find the right event cut
+  fEventCut = a.fEventCut->Clone();
+  // find the right first particle cut
+  fFirstParticleCut = a.fFirstParticleCut->Clone();
+  // find the right second particle cut
+  if (a.fFirstParticleCut==a.fSecondParticleCut) 
+    SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
+  else
+  fSecondParticleCut = a.fSecondParticleCut->Clone();
+
+  fPairCut = a.fPairCut->Clone();
+  
+  if ( fEventCut ) {
+      SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - event cut set " << endl;
+  }
+  if ( fFirstParticleCut ) {
+      SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - first particle cut set " << endl;
+  }
+  if ( fSecondParticleCut ) {
+      SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - second particle cut set " << endl;
+  }  if ( fPairCut ) {
+      SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - pair cut set " << endl;
+  }
+
+  AliFemtoCorrFctnIterator iter;
+  for (iter=a.fCorrFctnCollection->begin(); iter!=a.fCorrFctnCollection->end();iter++){
+    cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - looking for correlation functions " << endl;
+    AliFemtoCorrFctn* fctn = (*iter)->Clone();
+    if (fctn) AddCorrFctn(fctn);
+    else cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - correlation function not found " << endl;
+  }
+
+  fNumEventsToMix = a.fNumEventsToMix;
+
+  fMinSizePartCollection = a.fMinSizePartCollection;  // minimum # particles in ParticleCollection
+
+  cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - analysis copied " << endl;
+
+}
+//____________________________
+AliFemtoAnalysis::~AliFemtoAnalysis(){
+  cout << " AliFemtoAnalysis::~AliFemtoAnalysis()" << endl;
+  if (fEventCut) delete fEventCut; fEventCut=0;
+  if (fFirstParticleCut == fSecondParticleCut) fSecondParticleCut=0;
+  if (fFirstParticleCut)  delete fFirstParticleCut; fFirstParticleCut=0;
+  if (fSecondParticleCut) delete fSecondParticleCut; fSecondParticleCut=0;
+  if (fPairCut) delete fPairCut; fPairCut=0;
+  // now delete every CorrFunction in the Collection, and then the Collection itself
+  AliFemtoCorrFctnIterator iter;
+  for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
+    delete *iter;
+  }
+  delete fCorrFctnCollection;
+  // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
+  if (fMixingBuffer) {
+    AliFemtoPicoEventIterator piter;
+    for (piter=fMixingBuffer->begin();piter!=fMixingBuffer->end();piter++){
+      delete *piter;
+    }
+    delete fMixingBuffer;
+  }
+}
+//______________________
+AliFemtoCorrFctn* AliFemtoAnalysis::CorrFctn(int n){  // return pointer to n-th correlation function
+  if ( n<0 || n > (int)fCorrFctnCollection->size() )
+    return NULL;
+  AliFemtoCorrFctnIterator iter=fCorrFctnCollection->begin();
+  for (int i=0; i<n ;i++){
+    iter++;
+  }
+  return *iter;
+}
+//____________________________
+AliFemtoString AliFemtoAnalysis::Report()
+{
+  cout << "AliFemtoAnalysis - constructing Report..."<<endl;
+  string temp = "-----------\nHbt Analysis Report:\n";
+  temp += "\nEvent Cuts:\n";
+  temp += fEventCut->Report();
+  temp += "\nParticle Cuts - First Particle:\n";
+  temp += fFirstParticleCut->Report();
+  temp += "\nParticle Cuts - Second Particle:\n";
+  temp += fSecondParticleCut->Report();
+  temp += "\nPair Cuts:\n";
+  temp += fPairCut->Report();
+  temp += "\nCorrelation Functions:\n";
+  AliFemtoCorrFctnIterator iter;
+  if ( fCorrFctnCollection->size()==0 ) {
+    cout << "AliFemtoAnalysis-Warning : no correlations functions in this analysis " << endl;
+  }
+  for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
+    temp += (*iter)->Report();
+    temp += "\n";
+  }
+  temp += "-------------\n";
+  AliFemtoString returnThis=temp;
+  return returnThis;
+}
+//_________________________
+void AliFemtoAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
+  // Add event to processed events
+  fPicoEvent=0; // we will get a new pico event, if not prevent corr. fctn to access old pico event
+  AddEventProcessed();
+  // startup for EbyE 
+  EventBegin(hbtEvent);  
+  // event cut and event cut monitor
+  bool tmpPassEvent = fEventCut->Pass(hbtEvent);
+  fEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
+  if (tmpPassEvent) {
+    cout << "AliFemtoAnalysis::ProcessEvent() - Event has passed cut - build picoEvent from " <<
+      hbtEvent->TrackCollection()->size() << " tracks in TrackCollection" << endl;
+    // OK, analysis likes the event-- build a pico event from it, using tracks the analysis likes...
+    fPicoEvent = new AliFemtoPicoEvent; // this is what we will make pairs from and put in Mixing Buffer
+    // no memory leak. we will delete picoevents when they come out of the mixing buffer
+    FillHbtParticleCollection(fFirstParticleCut,(AliFemtoEvent*)hbtEvent,fPicoEvent->FirstParticleCollection());
+    if ( !(AnalyzeIdenticalParticles()) )
+      FillHbtParticleCollection(fSecondParticleCut,(AliFemtoEvent*)hbtEvent,fPicoEvent->SecondParticleCollection());
+    cout <<"AliFemtoAnalysis::ProcessEvent - #particles in First, Second Collections: " <<
+      fPicoEvent->FirstParticleCollection()->size() << " " <<
+      fPicoEvent->SecondParticleCollection()->size() << endl;
+    
+    // mal - implement a switch which allows only using events with ParticleCollections containing a minimum
+    // number of entries (jun2002)
+    if ((fPicoEvent->FirstParticleCollection()->size() >= fMinSizePartCollection )
+       && ( AnalyzeIdenticalParticles() || (fPicoEvent->SecondParticleCollection()->size() >= fMinSizePartCollection ))) {
+
+
+//------------------------------------------------------------------------------
+//   Temporary comment:
+//      This whole section rewritten so that all pairs are built using the
+//      same code... easier to read and manage, and MakePairs() can be called by
+//      derived classes.  Also, the requirement of a full mixing buffer before
+//      mixing is removed.
+//                          Dan Magestro, 11/2002
+
+      //------ Make real pairs. If identical, make pairs for one collection ------//
+
+      if (AnalyzeIdenticalParticles()) {
+        MakePairs("real", fPicoEvent->FirstParticleCollection() );
+      }
+      else {
+        MakePairs("real", fPicoEvent->FirstParticleCollection(),
+                          fPicoEvent->SecondParticleCollection() );
+      }
+      cout << "AliFemtoAnalysis::ProcessEvent() - reals done ";
+
+      //---- Make pairs for mixed events, looping over events in mixingBuffer ----//
+
+      AliFemtoPicoEvent* storedEvent;
+      AliFemtoPicoEventIterator fPicoEventIter;
+      for (fPicoEventIter=MixingBuffer()->begin();fPicoEventIter!=MixingBuffer()->end();fPicoEventIter++){
+        storedEvent = *fPicoEventIter;
+        if (AnalyzeIdenticalParticles()) {
+          MakePairs("mixed",fPicoEvent->FirstParticleCollection(),
+                            storedEvent->FirstParticleCollection() );
+        }
+        else {
+          MakePairs("mixed",fPicoEvent->FirstParticleCollection(),
+                            storedEvent->SecondParticleCollection() );
+
+          MakePairs("mixed",storedEvent->FirstParticleCollection(),
+                            fPicoEvent->SecondParticleCollection() );
+        }
+      }
+      cout << " - mixed done   " << endl;
+
+      //--------- If mixing buffer is full, delete oldest event ---------//
+
+      if ( MixingBufferFull() ) {
+        delete MixingBuffer()->back();
+        MixingBuffer()->pop_back();
+      }
+
+      //-------- Add current event (fPicoEvent) to mixing buffer --------//
+
+      MixingBuffer()->push_front(fPicoEvent);
+
+
+// Temporary comment: End of rewritten section... Dan Magestro, 11/2002
+//------------------------------------------------------------------------------
+
+
+    }  // if ParticleCollections are big enough (mal jun2002)
+    else{
+      delete fPicoEvent;
+    }
+  }   // if currentEvent is accepted by currentAnalysis
+  EventEnd(hbtEvent);  // cleanup for EbyE 
+  //cout << "AliFemtoAnalysis::ProcessEvent() - return to caller ... " << endl;
+}
+//_________________________
+void AliFemtoAnalysis::MakePairs(const char* typeIn, AliFemtoParticleCollection *partCollection1,
+                                            AliFemtoParticleCollection *partCollection2){
+// Build pairs, check pair cuts, and call CFs' AddRealPair() or
+// AddMixedPair() methods. If no second particle collection is
+// specfied, make pairs within first particle collection.
+
+  string type = typeIn;
+
+  AliFemtoPair* ThePair = new AliFemtoPair;
+
+  AliFemtoCorrFctnIterator CorrFctnIter;
+
+  AliFemtoParticleIterator PartIter1, PartIter2;
+
+  AliFemtoParticleIterator StartOuterLoop = partCollection1->begin();  // always
+  AliFemtoParticleIterator EndOuterLoop   = partCollection1->end();    // will be one less if identical
+  AliFemtoParticleIterator StartInnerLoop;
+  AliFemtoParticleIterator EndInnerLoop;
+  if (partCollection2) {                        // Two collections:
+    StartInnerLoop = partCollection2->begin();  //   Full inner & outer loops
+    EndInnerLoop   = partCollection2->end();    //
+  }
+  else {                                        // One collection:
+    EndOuterLoop--;                             //   Outer loop goes to next-to-last particle
+    EndInnerLoop = partCollection1->end() ;     //   Inner loop goes to last particle
+  }
+  for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++) {
+    if (!partCollection2){
+      StartInnerLoop = PartIter1;
+      StartInnerLoop++;
+    }
+    ThePair->SetTrack1(*PartIter1);
+    for (PartIter2 = StartInnerLoop; PartIter2!=EndInnerLoop;PartIter2++) {
+      ThePair->SetTrack2(*PartIter2);
+
+      // The following lines have to be uncommented if you want pairCutMonitors
+      // they are not in for speed reasons
+      // bool tmpPassPair = fPairCut->Pass(ThePair);
+      // fPairCut->FillCutMonitor(ThePair, tmpPassPair);
+      // if ( tmpPassPair )
+
+      //---- If pair passes cut, loop over CF's and add pair to real/mixed ----//
+
+      if (fPairCut->Pass(ThePair)){
+        for (CorrFctnIter=fCorrFctnCollection->begin();
+             CorrFctnIter!=fCorrFctnCollection->end();CorrFctnIter++){
+          AliFemtoCorrFctn* CorrFctn = *CorrFctnIter;
+          if(type == "real")
+            CorrFctn->AddRealPair(ThePair);
+         else if(type == "mixed")
+            CorrFctn->AddMixedPair(ThePair);
+          else
+            cout << "Problem with pair type, type = " << type.c_str() << endl;
+        }
+      }
+
+    }    // loop over second particle
+
+  }      // loop over first particle
+
+  delete ThePair;
+
+}
+//_________________________
+void AliFemtoAnalysis::EventBegin(const AliFemtoEvent* ev){
+  //cout << " AliFemtoAnalysis::EventBegin(const AliFemtoEvent* ev) " << endl;
+  fFirstParticleCut->EventBegin(ev);
+  fSecondParticleCut->EventBegin(ev);
+  fPairCut->EventBegin(ev);
+  for (AliFemtoCorrFctnIterator iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
+    (*iter)->EventBegin(ev);
+  }
+}
+//_________________________
+void AliFemtoAnalysis::EventEnd(const AliFemtoEvent* ev){
+  fFirstParticleCut->EventEnd(ev);
+  fSecondParticleCut->EventEnd(ev);
+  fPairCut->EventEnd(ev);
+  for (AliFemtoCorrFctnIterator iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
+    (*iter)->EventEnd(ev);
+  }
+}
+//_________________________
+void AliFemtoAnalysis::Finish(){
+  AliFemtoCorrFctnIterator iter;
+  for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
+    (*iter)->Finish();
+  }
+}
+//_________________________
+void AliFemtoAnalysis::AddEventProcessed() {
+  fNeventsProcessed++;
+}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.h b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.h
new file mode 100644 (file)
index 0000000..f709edf
--- /dev/null
@@ -0,0 +1,120 @@
+/**************************************************************************
+ AliFemtoAnalysis - the most basic analysis there is.
+ Most others (e.g. AliFemtoVertexAnalysis) wrap this one.
+**************************************************************************/
+
+#ifndef AliFemtoAnalysis_hh
+#define AliFemtoAnalysis_hh
+//#ifndef StMaker_H
+//#include "StMaker.h"
+//#endif
+
+#include "Base/AliFemtoBaseAnalysis.h"        // base analysis class
+#include "Base/AliFemtoPairCut.h"     
+#include "Base/AliFemtoEventCut.h"
+#include "Base/AliFemtoParticleCut.h"
+#include "Base/AliFemtoCorrFctn.h"
+#include "Infrastructure/AliFemtoCorrFctnCollection.h"
+#include "Infrastructure/AliFemtoPicoEventCollection.h"
+#include "Infrastructure/AliFemtoParticleCollection.h"
+#include "Infrastructure/AliFemtoPicoEvent.h"
+
+class AliFemtoPicoEventCollectionVectorHideAway;
+
+
+class AliFemtoAnalysis : public AliFemtoBaseAnalysis {
+
+ friend class AliFemtoLikeSignAnalysis;
+
+ public:
+  AliFemtoAnalysis();
+  AliFemtoAnalysis(const AliFemtoAnalysis& OriginalAnalysis);  // copy constructor
+  virtual ~AliFemtoAnalysis();
+
+  // Gets and Sets
+
+  virtual AliFemtoPairCut*       PairCut();
+  virtual AliFemtoEventCut*      EventCut();
+  virtual AliFemtoParticleCut*   FirstParticleCut();
+  virtual AliFemtoParticleCut*   SecondParticleCut();
+
+  AliFemtoCorrFctnCollection* CorrFctnCollection();
+  virtual AliFemtoCorrFctn* CorrFctn(int n);     // Access to CFs within the collection
+  void AddCorrFctn(AliFemtoCorrFctn* AnotherCorrFctn);
+
+  void SetPairCut(AliFemtoPairCut* ThePairCut);
+  void SetEventCut(AliFemtoEventCut* TheEventCut);
+  void SetFirstParticleCut(AliFemtoParticleCut* TheFirstParticleCut);
+  void SetSecondParticleCut(AliFemtoParticleCut* TheSecondParticleCut);
+
+  void SetMinSizePartCollection(unsigned int minSize);
+
+  unsigned int NumEventsToMix();
+  void SetNumEventsToMix(const unsigned int& NumberOfEventsToMix);
+  AliFemtoPicoEvent* CurrentPicoEvent();
+  AliFemtoPicoEventCollection* MixingBuffer();
+  bool MixingBufferFull();
+
+  bool AnalyzeIdenticalParticles();
+  virtual AliFemtoString Report();       //! returns reports of all cuts applied and correlation functions being done
+
+  virtual void EventBegin(const AliFemtoEvent* TheEventToBegin); // startup for EbyE
+  virtual void ProcessEvent(const AliFemtoEvent* EventToProcess);
+  virtual void EventEnd(const AliFemtoEvent* TheEventToWrapUp);   // cleanup for EbyE
+  int GetNeventsProcessed();
+
+  virtual void Finish();
+
+ protected:
+
+  void AddEventProcessed();
+  void MakePairs(const char* type, 
+                AliFemtoParticleCollection* ParticlesPassingCut1,
+                AliFemtoParticleCollection* ParticlesPssingCut2=0);
+
+  AliFemtoPicoEventCollectionVectorHideAway* fPicoEventCollectionVectorHideAway;  /* Mixing Buffer used for Analyses which wrap this one */
+
+  AliFemtoPairCut*             fPairCut;             /* cut applied to pairs */
+  AliFemtoCorrFctnCollection*  fCorrFctnCollection;  /* correlation functions of this analysis */
+  AliFemtoEventCut*            fEventCut;            /* cut to select events */
+  AliFemtoParticleCut*         fFirstParticleCut;    /* select particles of type #1 */
+  AliFemtoParticleCut*         fSecondParticleCut;   /* select particles of type #2 */
+  AliFemtoPicoEventCollection* fMixingBuffer;        /* mixing buffer used in this simplest analysis */
+  AliFemtoPicoEvent*           fPicoEvent;           /* The current event, in the small (pico) form */
+  unsigned int fNumEventsToMix;                      /* How many "previous" events get mixed with this one, to make background */
+  unsigned int fNeventsProcessed;                    /* How many events processed so far */
+
+  unsigned int fMinSizePartCollection;               /* Don't use event if it has fewer than this many particles passing ParticleCuts default 0*/
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoAnalysis, 0)
+#endif
+
+    };
+
+// Get's
+inline AliFemtoPairCut*             AliFemtoAnalysis::PairCut() {return fPairCut;}
+inline AliFemtoEventCut*            AliFemtoAnalysis::EventCut() {return fEventCut;}
+inline AliFemtoParticleCut*         AliFemtoAnalysis::FirstParticleCut() {return fFirstParticleCut;}
+inline AliFemtoParticleCut*         AliFemtoAnalysis::SecondParticleCut() {return fSecondParticleCut;}
+inline AliFemtoCorrFctnCollection*  AliFemtoAnalysis::CorrFctnCollection() {return fCorrFctnCollection;}
+inline unsigned int              AliFemtoAnalysis::NumEventsToMix(){return fNumEventsToMix;}
+inline AliFemtoPicoEvent*           AliFemtoAnalysis::CurrentPicoEvent() {return fPicoEvent;}
+
+inline AliFemtoPicoEventCollection*  AliFemtoAnalysis::MixingBuffer() {return fMixingBuffer;}
+
+// Set's
+inline bool AliFemtoAnalysis::AnalyzeIdenticalParticles(){return (fFirstParticleCut==fSecondParticleCut);}
+inline void AliFemtoAnalysis::SetPairCut(AliFemtoPairCut* x) { fPairCut = x; x->SetAnalysis((AliFemtoBaseAnalysis*)this);}
+inline void AliFemtoAnalysis::AddCorrFctn(AliFemtoCorrFctn* cf) {fCorrFctnCollection->push_back(cf); cf->SetAnalysis((AliFemtoBaseAnalysis*)this);}
+inline void AliFemtoAnalysis::SetEventCut(AliFemtoEventCut* x) {fEventCut = x; x->SetAnalysis((AliFemtoBaseAnalysis*)this);}
+inline void AliFemtoAnalysis::SetFirstParticleCut(AliFemtoParticleCut* x) {fFirstParticleCut = x; x->SetAnalysis((AliFemtoBaseAnalysis*)this);}
+inline void AliFemtoAnalysis::SetSecondParticleCut(AliFemtoParticleCut* x) {fSecondParticleCut = x; x->SetAnalysis((AliFemtoBaseAnalysis*)this);}
+
+inline void AliFemtoAnalysis::SetNumEventsToMix(const unsigned int& nmix){ fNumEventsToMix = nmix;}
+inline bool AliFemtoAnalysis::MixingBufferFull(){return (fMixingBuffer->size() >= fNumEventsToMix);}
+inline int AliFemtoAnalysis::GetNeventsProcessed() {return fNeventsProcessed;}
+
+inline void AliFemtoAnalysis::SetMinSizePartCollection(unsigned int minSize){fMinSizePartCollection = minSize;}
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoLikeSignAnalysis.cxx b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoLikeSignAnalysis.cxx
new file mode 100644 (file)
index 0000000..1471dfe
--- /dev/null
@@ -0,0 +1,275 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Frank Laue, Ohio State, Laue@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *      This is the Class for Analysis objects.  Each of the simultaneous
+ *      Analyses running should have one of these instantiated.  They link
+ *      into the Manager in an Analysis Collection.
+ *
+ ***************************************************************************/
+
+#include "Analysis/AliFemtoLikeSignAnalysis.h"
+#include "Infrastructure/AliFemtoParticleCollection.h"
+#include "Base/AliFemtoTrackCut.h"
+#include "Base/AliFemtoV0Cut.h"
+#include "Infrastructure/AliFemtoPicoEventCollectionVector.h"
+#include "Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.h"
+
+#ifdef __ROOT__ 
+ClassImp(AliFemtoLikeSignAnalysis)
+#endif
+
+// this little function used to apply ParticleCuts (TrackCuts or V0Cuts) and fill ParticleCollections of picoEvent
+//  it is called from AliFemtoAnalysis::ProcessEvent()
+
+
+extern void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
+                                    AliFemtoEvent*               hbtEvent,
+                                    AliFemtoParticleCollection*  partCollection);
+
+//____________________________
+AliFemtoLikeSignAnalysis::AliFemtoLikeSignAnalysis(unsigned int bins, double min, double max) : AliFemtoAnalysis() {
+  fVertexBins = bins;
+  fVertexZ[0] = min;
+  fVertexZ[1] = max;
+  fUnderFlow = 0; 
+  fOverFlow = 0; 
+  if (fMixingBuffer) delete fMixingBuffer;
+  fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexBins,fVertexZ[0],fVertexZ[1]);
+    /* no-op */
+}
+//____________________________
+AliFemtoLikeSignAnalysis::AliFemtoLikeSignAnalysis(const AliFemtoLikeSignAnalysis& a) : AliFemtoAnalysis(a) {
+  fVertexBins = a.fVertexBins; 
+  fVertexZ[0] = a.fVertexZ[0]; 
+  fVertexZ[1] = a.fVertexZ[1];
+  fUnderFlow = 0; 
+  fOverFlow = 0; 
+  if (fMixingBuffer) delete fMixingBuffer;
+  fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexBins,fVertexZ[0],fVertexZ[1]);
+ }
+//____________________________ 
+AliFemtoLikeSignAnalysis::~AliFemtoLikeSignAnalysis(){
+  delete fPicoEventCollectionVectorHideAway; fPicoEventCollectionVectorHideAway=0;
+}
+//____________________________
+AliFemtoString AliFemtoLikeSignAnalysis::Report()
+{  
+  char Ctemp[200];
+  cout << "AliFemtoLikeSignAnalysis - constructing Report..."<<endl;
+  AliFemtoString temp = "-----------\nHbt Analysis Report:\n";
+  sprintf(Ctemp,"Events are mixed in %d bins in the range %E cm to %E cm.\n",fVertexBins,fVertexZ[0],fVertexZ[1]);
+  temp += Ctemp;
+  sprintf(Ctemp,"Events underflowing: %d\n",fUnderFlow);
+  temp += Ctemp;
+  sprintf(Ctemp,"Events overflowing: %d\n",fOverFlow);
+  temp += Ctemp;
+  sprintf(Ctemp,"Now adding AliFemtoAnalysis(base) Report\n");
+  temp += Ctemp; 
+  temp += "Adding AliFemtoAnalysis(base) Report now:\n";
+  temp += AliFemtoAnalysis::Report();
+  temp += "-------------\n";
+  AliFemtoString returnThis=temp;
+  return returnThis;
+}
+//_________________________
+void AliFemtoLikeSignAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
+  // get right mixing buffer
+  double vertexZ = hbtEvent->PrimVertPos().z();
+  fMixingBuffer = fPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ); 
+  if (!fMixingBuffer) {
+    if ( vertexZ < fVertexZ[0] ) fUnderFlow++;
+    if ( vertexZ > fVertexZ[1] ) fOverFlow++;
+    return;
+  }
+
+  // startup for EbyE 
+  EventBegin(hbtEvent);  
+  // event cut and event cut monitor
+  bool tmpPassEvent = fEventCut->Pass(hbtEvent);
+  fEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
+  if (tmpPassEvent) {
+      fNeventsProcessed++;
+      cout << "AliFemtoLikeSignAnalysis::ProcessEvent() - " << hbtEvent->TrackCollection()->size();
+      cout << " #track=" << hbtEvent->TrackCollection()->size();
+      // OK, analysis likes the event-- build a pico event from it, using tracks the analysis likes...
+      AliFemtoPicoEvent* picoEvent = new AliFemtoPicoEvent;       // this is what we will make pairs from and put in Mixing Buffer
+      FillHbtParticleCollection(fFirstParticleCut,(AliFemtoEvent*)hbtEvent,picoEvent->FirstParticleCollection());
+      if ( !(AnalyzeIdenticalParticles()) )
+       FillHbtParticleCollection(fSecondParticleCut,(AliFemtoEvent*)hbtEvent,picoEvent->SecondParticleCollection());
+      cout <<"   #particles in First, Second Collections: " <<
+       picoEvent->FirstParticleCollection()->size() << " " <<
+       picoEvent->SecondParticleCollection()->size() << endl;
+      
+      if (picoEvent->SecondParticleCollection()->size()*picoEvent->FirstParticleCollection()->size()==0) {
+       delete picoEvent;
+       cout << "AliFemtoLikeSignAnalysis - picoEvent deleted due to empty collection " <<endl; 
+       return;
+      }
+      // OK, pico event is built
+      // make real pairs...
+      
+      // Fabrice points out that we do not need to keep creating/deleting pairs all the time
+      // We only ever need ONE pair, and we can just keep changing internal pointers
+      // this should help speed things up
+      AliFemtoPair* ThePair = new AliFemtoPair;
+      
+      AliFemtoParticleIterator PartIter1;
+      AliFemtoParticleIterator PartIter2;
+      AliFemtoCorrFctnIterator CorrFctnIter;
+      AliFemtoParticleIterator StartOuterLoop = picoEvent->FirstParticleCollection()->begin();  // always
+      AliFemtoParticleIterator EndOuterLoop   = picoEvent->FirstParticleCollection()->end();    // will be one less if identical
+      AliFemtoParticleIterator StartInnerLoop;
+      AliFemtoParticleIterator EndInnerLoop;
+      if (AnalyzeIdenticalParticles()) {             // only use First collection
+       EndOuterLoop--;                                               // outer loop goes to next-to-last particle in First collection
+       EndInnerLoop = picoEvent->FirstParticleCollection()->end() ;  // inner loop goes to last particle in First collection
+      }
+      else {                                                          // nonidentical - loop over First and Second collections
+       StartInnerLoop = picoEvent->SecondParticleCollection()->begin(); // inner loop starts at first particle in Second collection
+       EndInnerLoop   = picoEvent->SecondParticleCollection()->end() ;  // inner loop goes to last particle in Second collection
+      }
+      // real pairs
+      for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
+       if (AnalyzeIdenticalParticles()){
+         StartInnerLoop = PartIter1;
+         StartInnerLoop++;
+       }
+       ThePair->SetTrack1(*PartIter1);
+       for (PartIter2 = StartInnerLoop; PartIter2!=EndInnerLoop;PartIter2++){
+         ThePair->SetTrack2(*PartIter2);
+         // The following lines have to be uncommented if you want pairCutMonitors
+         // they are not in for speed reasons
+         // bool tmpPassPair = mPairCut->Pass(ThePair);
+          // mPairCut->FillCutMonitor(ThePair, tmpPassPair);
+         // if ( tmpPassPair ) {
+         if (fPairCut->Pass(ThePair)){
+           for (CorrFctnIter=fCorrFctnCollection->begin();
+                CorrFctnIter!=fCorrFctnCollection->end();CorrFctnIter++){
+             AliFemtoLikeSignCorrFctn* CorrFctn = dynamic_cast<AliFemtoLikeSignCorrFctn*>(*CorrFctnIter);
+             if (CorrFctn) CorrFctn->AddRealPair(ThePair);
+           }
+         }  // if passed pair cut
+       }    // loop over second particle
+      }      // loop over first particle
+#ifdef STHBTDEBUG
+      cout << "AliFemtoLikeSignAnalysis::ProcessEvent() - reals done" << endl;
+#endif
+
+      AliFemtoParticleIterator nextIter;
+      AliFemtoParticleIterator prevIter;
+
+      // like sign first partilce collection pairs
+      prevIter = EndOuterLoop;
+      prevIter--;
+      for (PartIter1=StartOuterLoop;PartIter1!=prevIter;PartIter1++){
+       ThePair->SetTrack1(*PartIter1);
+       nextIter = PartIter1;
+       nextIter++;
+       for (PartIter2 = nextIter; PartIter2!=EndOuterLoop;PartIter2++){
+         ThePair->SetTrack2(*PartIter2);
+         // The following lines have to be uncommented if you want pairCutMonitors
+         // they are not in for speed reasons
+         // bool tmpPassPair = mPairCut->Pass(ThePair);
+          // mPairCut->FillCutMonitor(ThePair, tmpPassPair);
+         // if ( tmpPassPair ) {
+         if (fPairCut->Pass(ThePair)){
+           for (CorrFctnIter=fCorrFctnCollection->begin();
+                CorrFctnIter!=fCorrFctnCollection->end();CorrFctnIter++){
+             AliFemtoLikeSignCorrFctn* CorrFctn = dynamic_cast<AliFemtoLikeSignCorrFctn*>(*CorrFctnIter);
+             if (CorrFctn) CorrFctn->AddLikeSignPositivePair(ThePair);
+           }
+         }  // if passed pair cut
+       }    // loop over second particle
+      }      // loop over first particle
+#ifdef STHBTDEBUG
+      cout << "AliFemtoLikeSignAnalysis::ProcessEvent() - like sign first collection done" << endl;
+#endif
+      // like sign second partilce collection pairs
+      prevIter = EndInnerLoop;
+      prevIter--;
+      for (PartIter1=StartInnerLoop;PartIter1!=prevIter;PartIter1++){
+       ThePair->SetTrack1(*PartIter1);
+       nextIter = PartIter1;
+       nextIter++;
+       for (PartIter2 = nextIter; PartIter2!=EndInnerLoop;PartIter2++){
+         ThePair->SetTrack2(*PartIter2);
+         // The following lines have to be uncommented if you want pairCutMonitors
+         // they are not in for speed reasons
+         // bool tmpPassPair = mPairCut->Pass(ThePair);
+          // mPairCut->FillCutMonitor(ThePair, tmpPassPair);
+         // if ( tmpPassPair ) {
+         if (fPairCut->Pass(ThePair)){
+           for (CorrFctnIter=fCorrFctnCollection->begin();
+                CorrFctnIter!=fCorrFctnCollection->end();CorrFctnIter++){
+             AliFemtoLikeSignCorrFctn* CorrFctn = dynamic_cast<AliFemtoLikeSignCorrFctn*>(*CorrFctnIter);
+             if (CorrFctn) CorrFctn->AddLikeSignNegativePair(ThePair);
+           }
+         }  // if passed pair cut
+       }    // loop over second particle
+      }      // loop over first particle
+#ifdef STHBTDEBUG
+      cout << "AliFemtoLikeSignAnalysis::ProcessEvent() - like sign second collection done" << endl;
+#endif
+      
+      if (MixingBufferFull()){
+#ifdef STHBTDEBUG
+       cout << "Mixing Buffer is full - lets rock and roll" << endl;
+#endif
+      }
+      else {
+       cout << "Mixing Buffer not full -gotta wait " << MixingBuffer()->size() << endl;
+      }
+      if (MixingBufferFull()){
+       StartOuterLoop = picoEvent->FirstParticleCollection()->begin();
+       EndOuterLoop   = picoEvent->FirstParticleCollection()->end();
+       AliFemtoPicoEvent* storedEvent;
+       AliFemtoPicoEventIterator picoEventIter;
+       for (picoEventIter=MixingBuffer()->begin();picoEventIter!=MixingBuffer()->end();picoEventIter++){
+         storedEvent = *picoEventIter;
+         if (AnalyzeIdenticalParticles()){
+           StartInnerLoop = storedEvent->FirstParticleCollection()->begin();
+           EndInnerLoop = storedEvent->FirstParticleCollection()->end();
+         }
+         else{
+           StartInnerLoop = storedEvent->SecondParticleCollection()->begin();
+           EndInnerLoop = storedEvent->SecondParticleCollection()->end();
+         }
+         for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
+           ThePair->SetTrack1(*PartIter1);
+           for (PartIter2=StartInnerLoop;PartIter2!=EndInnerLoop;PartIter2++){
+             ThePair->SetTrack2(*PartIter2);
+             // testing...           cout << "ThePair defined... going to pair cut... ";
+             if (fPairCut->Pass(ThePair)){
+               // testing...           cout << " ThePair passed PairCut... ";
+               for (CorrFctnIter=fCorrFctnCollection->begin();
+                    CorrFctnIter!=fCorrFctnCollection->end();CorrFctnIter++){
+                 AliFemtoLikeSignCorrFctn* CorrFctn = dynamic_cast<AliFemtoLikeSignCorrFctn*>(*CorrFctnIter);
+                 if (CorrFctn) { 
+                   CorrFctn->AddMixedPair(ThePair);
+                   //cout << " ThePair has been added to MixedPair method " << endl;
+                 }
+               }
+             }  // if passed pair cut
+           }    // loop over second particle
+         }      // loop over first particle
+       }        // loop over pico-events stored in Mixing buffer
+       // Now get rid of oldest stored pico-event in buffer.
+       // This means (1) delete the event from memory, (2) "pop" the pointer to it from the MixingBuffer
+       delete MixingBuffer()->back();
+       MixingBuffer()->pop_back();
+      }  // if mixing buffer is full
+      delete ThePair;
+      MixingBuffer()->push_front(picoEvent);  // store the current pico-event in buffer
+    }   // if currentEvent is accepted by currentAnalysis
+    EventEnd(hbtEvent);  // cleanup for EbyE 
+    //    cout << "AliFemtoLikeSignAnalysis::ProcessEvent() - return to caller ... " << endl;
+}
+
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoLikeSignAnalysis.h b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoLikeSignAnalysis.h
new file mode 100644 (file)
index 0000000..34c366c
--- /dev/null
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *      This is an analysis which calculated the background from like sign
+ *      pairs in the same event
+ *      Frank Laue, Ohio State, 2000
+ ***************************************************************************/
+
+
+#ifndef AliFemtoLikeSignAnalysis_hh
+#define AliFemtoLikeSignAnalysis_hh
+//#ifndef StMaker_H
+//#include "StMaker.h"
+//#endif
+
+#include "Base/AliFemtoBaseAnalysis.h"        // base analysis class
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Base/AliFemtoEventCut.h"             // base class 
+#include "Base/AliFemtoParticleCut.h"          // base class
+#include "Base/AliFemtoPairCut.h"              // base class
+#include "Base/AliFemtoLikeSignCorrFctn.h"    // base class
+#include "Analysis/AliFemtoAnalysis.h"
+#include "Infrastructure/AliFemtoCorrFctnCollection.h"
+
+
+class AliFemtoLikeSignAnalysis : public AliFemtoAnalysis {
+
+public: 
+
+  AliFemtoLikeSignAnalysis(unsigned int bins=20, double min=-100., double max=100.);
+  AliFemtoLikeSignAnalysis(const AliFemtoLikeSignAnalysis& OriginalAnalysis);  // copy constructor
+  virtual ~AliFemtoLikeSignAnalysis();
+
+  virtual void ProcessEvent(const AliFemtoEvent* TheEventToBeProcessed);
+  virtual AliFemtoString Report();
+  virtual unsigned int Overflow() { return fOverFlow;}
+  virtual unsigned int Underflow() { return fUnderFlow;}
+
+protected:
+  double fVertexZ[2];           /* min/max z-vertex position allowed to be processed */
+  unsigned int fVertexBins;     /* number of mixing bins in z-vertex in EventMixing Buffer */
+  unsigned int fOverFlow;       /* number of events encountered which had too large z-vertex */
+  unsigned int fUnderFlow;      /* number of events encountered which had too small z-vertex */
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoLikeSignAnalysis, 0)
+#endif
+
+};
+
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.cxx b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.cxx
new file mode 100644 (file)
index 0000000..cd50d69
--- /dev/null
@@ -0,0 +1,166 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *      This is the Class for Analysis objects.  Each of the simultaneous
+ *      Analyses running should have one of these instantiated.  They link
+ *      into the Manager in an Analysis Collection.
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.5  2001/05/25 23:24:00  lisa
+ * Added in AliFemtoKink stuff
+ *
+ * Revision 1.4  2000/08/31 22:31:32  laue
+ * AliFemtoAnalysis: output changed (a little bit less)
+ * AliFemtoEvent: new version, members for reference mult added
+ * AliFemtoIOBinary: new IO for new AliFemtoEvent version
+ * AliFemtoTypes: TTree typedef to AliFemtoTTree added
+ * AliFemtoVertexAnalysis: overflow and underflow added
+ *
+ * Revision 1.1  2000/07/16 21:44:11  laue
+ * Collection and analysis for vertex dependent event mixing
+ *
+ *
+ **************************************************************************/
+
+#include "Analysis/AliFemtoVertexAnalysis.h"
+#include "Infrastructure/AliFemtoParticleCollection.h"
+#include "Base/AliFemtoTrackCut.h"
+#include "Base/AliFemtoV0Cut.h"
+#include "Base/AliFemtoKinkCut.h"
+#include "Infrastructure/AliFemtoPicoEventCollectionVector.h"
+#include "Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.h"
+
+
+#ifdef __ROOT__ 
+ClassImp(AliFemtoVertexAnalysis)
+#endif
+
+extern void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
+                                    AliFemtoEvent*               hbtEvent,
+                                    AliFemtoParticleCollection*  partCollection);
+
+
+//____________________________
+AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(unsigned int bins, double min, double max){
+  //  mControlSwitch     = 0;
+  fEventCut          = 0;
+  fFirstParticleCut  = 0;
+  fSecondParticleCut = 0;
+  fPairCut           = 0;
+  fCorrFctnCollection= 0;
+  fCorrFctnCollection = new AliFemtoCorrFctnCollection;
+  fVertexBins = bins;
+  fVertexZ[0] = min;
+  fVertexZ[1] = max;
+  fUnderFlow = 0; 
+  fOverFlow = 0; 
+  if (fMixingBuffer) delete fMixingBuffer;
+  fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexBins,fVertexZ[0],fVertexZ[1]);
+};
+//____________________________
+
+AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) : AliFemtoAnalysis() {
+  //AliFemtoVertexAnalysis();
+  fEventCut          = 0;
+  fFirstParticleCut  = 0;
+  fSecondParticleCut = 0;
+  fPairCut           = 0;
+  fCorrFctnCollection= 0;
+  fCorrFctnCollection = new AliFemtoCorrFctnCollection;
+  fVertexBins = a.fVertexBins; 
+  fVertexZ[0] = a.fVertexZ[0]; 
+  fVertexZ[1] = a.fVertexZ[1];
+  fUnderFlow = 0; 
+  fOverFlow = 0; 
+  if (fMixingBuffer) delete fMixingBuffer;
+  fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexBins,fVertexZ[0],fVertexZ[1]);
+
+  // find the right event cut
+  fEventCut = a.fEventCut->Clone();
+  // find the right first particle cut
+  fFirstParticleCut = a.fFirstParticleCut->Clone();
+  // find the right second particle cut
+  if (a.fFirstParticleCut==a.fSecondParticleCut) 
+    SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
+  else
+  fSecondParticleCut = a.fSecondParticleCut->Clone();
+
+  fPairCut = a.fPairCut->Clone();
+  
+  if ( fEventCut ) {
+      SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - event cut set " << endl;
+  }
+  if ( fFirstParticleCut ) {
+      SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - first particle cut set " << endl;
+  }
+  if ( fSecondParticleCut ) {
+      SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - second particle cut set " << endl;
+  }  if ( fPairCut ) {
+      SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - pair cut set " << endl;
+  }
+
+  AliFemtoCorrFctnIterator iter;
+  for (iter=a.fCorrFctnCollection->begin(); iter!=a.fCorrFctnCollection->end();iter++){
+    cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - looking for correlation functions " << endl;
+    AliFemtoCorrFctn* fctn = (*iter)->Clone();
+    if (fctn) AddCorrFctn(fctn);
+    else cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - correlation function not found " << endl;
+  }
+
+  fNumEventsToMix = a.fNumEventsToMix;
+
+  cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - analysis copied " << endl;
+
+}
+//____________________________
+AliFemtoVertexAnalysis::~AliFemtoVertexAnalysis(){
+  // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
+  delete fPicoEventCollectionVectorHideAway;
+}
+
+//____________________________
+AliFemtoString AliFemtoVertexAnalysis::Report()
+{
+  cout << "AliFemtoVertexAnalysis - constructing Report..."<<endl;
+  char Ctemp[200];
+  AliFemtoString temp = "-----------\nHbt AliFemtoVertexAnalysis Report:\n";
+  sprintf(Ctemp,"Events are mixed in %d bins in the range %E cm to %E cm.\n",fVertexBins,fVertexZ[0],fVertexZ[1]);
+  temp += Ctemp;
+  sprintf(Ctemp,"Events underflowing: %d\n",fUnderFlow);
+  temp += Ctemp;
+  sprintf(Ctemp,"Events overflowing: %d\n",fOverFlow);
+  temp += Ctemp;
+  sprintf(Ctemp,"Now adding AliFemtoAnalysis(base) Report\n");
+  temp += Ctemp;
+  temp += AliFemtoAnalysis::Report();
+  AliFemtoString returnThis=temp;
+  return returnThis;
+}
+//_________________________
+void AliFemtoVertexAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
+  cout << " AliFemtoVertexAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) " << endl;
+  // get right mixing buffer
+  double vertexZ = hbtEvent->PrimVertPos().z();
+  fMixingBuffer = fPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ); 
+  if (!fMixingBuffer) {
+    if ( vertexZ < fVertexZ[0] ) fUnderFlow++;
+    if ( vertexZ > fVertexZ[1] ) fOverFlow++;
+    return;
+  }
+  // call ProcessEvent() from AliFemtoAnalysis-base
+  AliFemtoAnalysis::ProcessEvent(hbtEvent);
+}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.h b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.h
new file mode 100644 (file)
index 0000000..f79a51b
--- /dev/null
@@ -0,0 +1,35 @@
+/***************************************************************************
+ * Collection and analysis for vertex dependent event mixing
+ * Frank Laue, Ohio State, 2000
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoVertexAnalysis_hh
+#define AliFemtoVertexAnalysis_hh
+
+#include "Analysis/AliFemtoAnalysis.h"        // base analysis class
+
+class AliFemtoVertexAnalysis : public AliFemtoAnalysis {
+
+public:
+
+  AliFemtoVertexAnalysis(unsigned int =10, double =-100., double=+100.);
+  AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& OriginalAnalysis);  // copy constructor
+  virtual void ProcessEvent(const AliFemtoEvent* ProcessThisEvent);
+  virtual ~AliFemtoVertexAnalysis();
+  virtual AliFemtoString Report();       //! returns reports of all cuts applied and correlation functions being done
+  virtual unsigned int Overflow() { return fOverFlow;}
+  virtual unsigned int Underflow() { return fUnderFlow;}
+protected:
+  double fVertexZ[2];            /* min/max z-vertex position allowed to be processed */
+  unsigned int fVertexBins;      /* number of mixing bins in z-vertex in EventMixing Buffer */
+  unsigned int fOverFlow;        /* number of events encountered which had too large z-vertex */
+  unsigned int fUnderFlow;       /* number of events encountered which had too small z-vertex */
+  
+#ifdef __ROOT__
+  ClassDef(AliFemtoVertexAnalysis, 0)
+#endif
+    
+};
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexMultAnalysis.cxx b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexMultAnalysis.cxx
new file mode 100644 (file)
index 0000000..f6cc2d9
--- /dev/null
@@ -0,0 +1,188 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *      This is the Class for Analysis objects.  Each of the simultaneous
+ *      Analyses running should have one of these instantiated.  They link
+ *      into the Manager in an Analysis Collection.
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.2  2005/06/28 23:12:24  chajecki
+ * UncorrectedNumberOfNegativePrimaries() -> UncorrectedNumberOfPrimaries()
+ *
+ * For data taken in Y2 and later the centrality definition bases
+ * on UncorrectedNumberOfPrimaries() while for Y1(AuAu@130)
+ * it based on UncorrectedNumberOfNegativePrimaries().
+ * But in many places of HBT code the number of negative primaries
+ * was used as a multiplicity for all productions.
+ * This has been fixed.
+ *
+ * Revision 1.1  2001/11/11 18:34:14  laue
+ * AliFemtoPicoEventCollectionVectorHideAway: updated for 3d grid
+ * AliFemtoVertexMultAnalysis: new
+ *
+ *
+ **************************************************************************/
+
+#include "Analysis/AliFemtoVertexMultAnalysis.h"
+#include "Infrastructure/AliFemtoParticleCollection.h"
+#include "Base/AliFemtoTrackCut.h"
+#include "Base/AliFemtoV0Cut.h"
+#include "Base/AliFemtoKinkCut.h"
+#include "Infrastructure/AliFemtoPicoEventCollectionVector.h"
+#include "Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.h"
+
+
+#ifdef __ROOT__ 
+ClassImp(AliFemtoVertexMultAnalysis)
+#endif
+
+extern void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
+                                    AliFemtoEvent*               hbtEvent,
+                                    AliFemtoParticleCollection*  partCollection);
+
+
+//____________________________
+AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(unsigned int binsVertex, double minVertex, double maxVertex,
+                                                unsigned int binsMult, double minMult, double maxMult) 
+  : fVertexZBins(binsVertex), fMultBins(binsMult) {
+  //  mControlSwitch     = 0;
+  fEventCut          = 0;
+  fFirstParticleCut  = 0;
+  fSecondParticleCut = 0;
+  fPairCut           = 0;
+  fCorrFctnCollection= 0;
+  fCorrFctnCollection = new AliFemtoCorrFctnCollection;
+  fVertexZ[0] = minVertex;
+  fVertexZ[1] = maxVertex;
+  fUnderFlowVertexZ = 0; 
+  fOverFlowVertexZ = 0; 
+  fMult[0] = minMult;
+  fMult[1] = maxMult;
+  fUnderFlowMult = 0; 
+  fOverFlowMult = 0; 
+  if (fMixingBuffer) delete fMixingBuffer;
+  fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
+                                                                                 fMultBins,fMult[0],fMult[1]);
+};
+//____________________________
+
+AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) : AliFemtoAnalysis() {
+  //AliFemtoVertexMultAnalysis();
+  fEventCut          = 0;
+  fFirstParticleCut  = 0;
+  fSecondParticleCut = 0;
+  fPairCut           = 0;
+  fCorrFctnCollection= 0;
+  fCorrFctnCollection = new AliFemtoCorrFctnCollection;
+  fVertexZBins = a.fVertexZBins; 
+  fVertexZ[0] = a.fVertexZ[0]; 
+  fVertexZ[1] = a.fVertexZ[1];
+  fUnderFlowVertexZ = 0; 
+  fOverFlowVertexZ = 0; 
+  fMultBins = a.fMultBins; 
+  fMult[0] = a.fMult[0]; 
+  fMult[1] = a.fMult[1];
+  fUnderFlowMult = 0; 
+  fOverFlowMult = 0; 
+  if (fMixingBuffer) delete fMixingBuffer;
+  fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
+                                                                                 fMultBins,fMult[0],fMult[1]);
+
+  // find the right event cut
+  fEventCut = a.fEventCut->Clone();
+  // find the right first particle cut
+  fFirstParticleCut = a.fFirstParticleCut->Clone();
+  // find the right second particle cut
+  if (a.fFirstParticleCut==a.fSecondParticleCut) 
+    SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
+  else
+  fSecondParticleCut = a.fSecondParticleCut->Clone();
+
+  fPairCut = a.fPairCut->Clone();
+  
+  if ( fEventCut ) {
+      SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - event cut set " << endl;
+  }
+  if ( fFirstParticleCut ) {
+      SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - first particle cut set " << endl;
+  }
+  if ( fSecondParticleCut ) {
+      SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - second particle cut set " << endl;
+  }  if ( fPairCut ) {
+      SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
+      cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - pair cut set " << endl;
+  }
+
+  AliFemtoCorrFctnIterator iter;
+  for (iter=a.fCorrFctnCollection->begin(); iter!=a.fCorrFctnCollection->end();iter++){
+    cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - looking for correlation functions " << endl;
+    AliFemtoCorrFctn* fctn = (*iter)->Clone();
+    if (fctn) AddCorrFctn(fctn);
+    else cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - correlation function not found " << endl;
+  }
+
+  fNumEventsToMix = a.fNumEventsToMix;
+
+  cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - analysis copied " << endl;
+
+}
+//____________________________
+AliFemtoVertexMultAnalysis::~AliFemtoVertexMultAnalysis(){
+  // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
+  delete fPicoEventCollectionVectorHideAway;
+}
+
+//____________________________
+AliFemtoString AliFemtoVertexMultAnalysis::Report()
+{
+  cout << "AliFemtoVertexMultAnalysis - constructing Report..."<<endl;
+  char Ctemp[200];
+  AliFemtoString temp = "-----------\nHbt AliFemtoVertexMultAnalysis Report:\n";
+  sprintf(Ctemp,"Events are mixed in %d VertexZ bins in the range %E cm to %E cm.\n",fVertexZBins,fVertexZ[0],fVertexZ[1]);
+  temp += Ctemp;
+  sprintf(Ctemp,"Events underflowing: %d\n",fUnderFlowVertexZ);
+  temp += Ctemp;
+  sprintf(Ctemp,"Events overflowing: %d\n",fOverFlowVertexZ);
+  temp += Ctemp;
+  sprintf(Ctemp,"Events are mixed in %d Mult bins in the range %E cm to %E cm.\n",fMultBins,fMult[0],fMult[1]);
+  temp += Ctemp;
+  sprintf(Ctemp,"Events underflowing: %d\n",fUnderFlowMult);
+  temp += Ctemp;
+  sprintf(Ctemp,"Events overflowing: %d\n",fOverFlowMult);
+  temp += Ctemp;
+  sprintf(Ctemp,"Now adding AliFemtoAnalysis(base) Report\n");
+  temp += Ctemp;
+  temp += AliFemtoAnalysis::Report();
+  AliFemtoString returnThis=temp;
+  return returnThis;
+}
+//_________________________
+void AliFemtoVertexMultAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
+  cout << " AliFemtoVertexMultAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) " << endl;
+  // get right mixing buffer
+  double vertexZ = hbtEvent->PrimVertPos().z();
+  double mult = hbtEvent->UncorrectedNumberOfPrimaries();
+  fMixingBuffer = fPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ,mult); 
+  if (!fMixingBuffer) {
+    if ( vertexZ < fVertexZ[0] ) fUnderFlowVertexZ++;
+    if ( vertexZ > fVertexZ[1] ) fOverFlowVertexZ++;
+    if ( mult < fMult[0] ) fUnderFlowMult++;
+    if ( mult > fMult[1] ) fOverFlowMult++;
+    return;
+  }
+  // call ProcessEvent() from AliFemtoAnalysis-base
+  AliFemtoAnalysis::ProcessEvent(hbtEvent);
+}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexMultAnalysis.h b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexMultAnalysis.h
new file mode 100644 (file)
index 0000000..bf75f8b
--- /dev/null
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Frank Laue, Ohio State, 2001
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoVertexMultAnalysis_hh
+#define AliFemtoVertexMultAnalysis_hh
+
+#include "Analysis/AliFemtoAnalysis.h"        // base analysis class
+#include <limits.h>
+
+class AliFemtoVertexMultAnalysis : public AliFemtoAnalysis {
+
+public:
+
+  AliFemtoVertexMultAnalysis(unsigned int=10, double=-100., double=+100., unsigned int b=10, double=-1.e9, double=+1.e9);
+  AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& TheOriginalAnalysis);  // copy constructor
+  virtual void ProcessEvent(const AliFemtoEvent* ProcessThisEvent);
+  virtual ~AliFemtoVertexMultAnalysis();
+  virtual AliFemtoString Report();       //! returns reports of all cuts applied and correlation functions being done
+  virtual unsigned int OverflowVertexZ() { return fOverFlowVertexZ;}
+  virtual unsigned int UnderflowVertexZ() { return fUnderFlowVertexZ;}
+  virtual unsigned int OverflowMult() { return fOverFlowMult;}
+  virtual unsigned int UnderflowMult() { return fUnderFlowMult;}
+protected:
+  double fVertexZ[2];                 /* min/max z-vertex position allowed to be processed */
+  unsigned int fVertexZBins;          /* number of VERTEX mixing bins in z-vertex in EventMixing Buffer */
+  unsigned int fOverFlowVertexZ;      /* number of events encountered which had too large z-vertex */
+  unsigned int fUnderFlowVertexZ;     /* number of events encountered which had too small z-vertex */
+  double fMult[2];                    /* min/max multiplicity allowed for event to be processed */
+  unsigned int fMultBins;             /* number of MULTIPLICITY mixing bins in z-vertex in EventMixing Buffer */
+  unsigned int fOverFlowMult;         /* number of events encountered which had too large multiplicity */
+  unsigned int fUnderFlowMult;        /* number of events encountered which had too small multiplicity */
+  
+#ifdef __ROOT__
+  ClassDef(AliFemtoVertexMultAnalysis, 0)
+#endif
+    
+};
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoBaseAnalysis.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoBaseAnalysis.h
new file mode 100644 (file)
index 0000000..5b0c7ee
--- /dev/null
@@ -0,0 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoBaseAnalysis - the pure virtual base class for femto analysis    ///
+/// All analysis classes must inherit from this one                          ///
+////////////////////////////////////////////////////////////////////////////////
+#ifndef AliFemtoBaseAnalysis_hh
+#define AliFemtoBaseAnalysis_hh
+
+#include "Infrastructure/AliFemtoTypes.h"
+
+class AliFemtoEvent;
+
+class AliFemtoBaseAnalysis{
+
+public:
+
+  AliFemtoBaseAnalysis() { /* noop */ };
+  virtual ~AliFemtoBaseAnalysis() { /* noop */ };
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoBaseAnalysis, 0)
+#endif 
+  
+  virtual AliFemtoString Report() = 0;       //! returns reports of all cuts applied and correlation functions being done
+
+  virtual void ProcessEvent(const AliFemtoEvent* aEventToAnalyze) = 0;
+
+  virtual void Finish() = 0;
+
+};
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoCorrFctn.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoCorrFctn.h
new file mode 100644 (file)
index 0000000..6dfbcf2
--- /dev/null
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoCorrFctn - the pure virtual base class for correlation function  ///
+/// All correlation function classes must inherit from this one              ///
+////////////////////////////////////////////////////////////////////////////////
+#ifndef AliFemtoCorrFctn_hh
+#define AliFemtoCorrFctn_hh
+
+#include "Base/AliFemtoBaseAnalysis.h"
+#include "Infrastructure/AliFemtoEvent.h"
+#include "Infrastructure/AliFemtoPair.h"
+
+class AliFemtoCorrFctn{
+
+  friend class AliFemtoBaseAnalysis;
+
+public:
+  AliFemtoCorrFctn(){/* no-op */};
+  AliFemtoCorrFctn(const AliFemtoCorrFctn& aCorrFctn);
+  virtual ~AliFemtoCorrFctn(){/* no-op */};
+
+  virtual AliFemtoString Report() = 0;
+
+  virtual void AddRealPair(const AliFemtoPair* aPair);
+  virtual void AddMixedPair(const AliFemtoPair* aPir);
+
+  virtual void EventBegin(const AliFemtoEvent* aEvent) { /* no-op */ }
+  virtual void EventEnd(const AliFemtoEvent* aEvent) { /* no-op */ }
+  virtual void Finish() = 0;
+
+  virtual AliFemtoCorrFctn* Clone() { return 0;}
+
+  AliFemtoBaseAnalysis* HbtAnalysis(){return fyAnalysis;};
+  void SetAnalysis(AliFemtoBaseAnalysis* aAnalysis);
+
+protected:
+  AliFemtoBaseAnalysis* fyAnalysis;
+
+private:
+
+};
+
+inline void AliFemtoCorrFctn::AddRealPair(const AliFemtoPair*) { cout << "Not implemented" << endl; }
+inline void AliFemtoCorrFctn::AddMixedPair(const AliFemtoPair*) { cout << "Not implemented" << endl; }
+
+inline AliFemtoCorrFctn::AliFemtoCorrFctn(const AliFemtoCorrFctn& c) { fyAnalysis =0; }
+inline void AliFemtoCorrFctn::SetAnalysis(AliFemtoBaseAnalysis* analysis) { fyAnalysis = analysis; }
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoCutMonitor.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoCutMonitor.h
new file mode 100644 (file)
index 0000000..09b98e4
--- /dev/null
@@ -0,0 +1,81 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoCutMonitor - the  base class for cut monitor                     ///
+/// A cut monitor saves the entities that passed and failed the given cut    ///
+////////////////////////////////////////////////////////////////////////////////
+#ifndef AliFemtoCutMonitor_hh
+#define AliFemtoCutMonitor_hh
+
+class AliFemtoEvent;
+class AliFemtoTrack;
+class AliFemtoV0;
+class AliFemtoKink;
+class AliFemtoPair; // Gael 12/04/02
+#include "Infrastructure/AliFemtoString.h"
+#include "Infrastructure/AliFemtoParticleCollection.h" // Gael 19/06/02
+
+class AliFemtoCutMonitor{
+  
+private:
+  
+public:
+  AliFemtoCutMonitor(){/* no-op */};
+  virtual ~AliFemtoCutMonitor(){/* no-op */};
+  virtual AliFemtoString Report(){ 
+    string Stemp = "*** no user defined Fill(const AliFemtoEvent*), take from base class"; 
+    AliFemtoString returnThis = Stemp;
+    return returnThis; 
+  }
+  virtual void EventBegin(const AliFemtoEvent* aEvent) { /* no-op */ }
+  virtual void EventEnd(const AliFemtoEvent* aEvent) { /* no-op */ }
+  virtual void Fill(const AliFemtoEvent* aEvent) { 
+#ifdef STHBTDEBUG
+    cout << " *** no user defined Fill(const AliFemtoEvent*), take from base class" << endl;
+#endif
+  }
+  virtual void Fill(const AliFemtoTrack* aTrack) { 
+#ifdef STHBTDEBUG
+    cout << " *** no user defined Fill(const AliFemtoTrack*), take from base class" << endl;
+#endif
+  }
+  virtual void Fill(const AliFemtoV0* aV0) { 
+#ifdef STHBTDEBUG
+    cout << " *** no user defined Fill(const AliFemtoV0Track*), take from base class" << endl;
+#endif
+  }
+  virtual void Fill(const AliFemtoKink* aKink) { 
+#ifdef STHBTDEBUG
+    cout << " *** no user defined Fill(const AliFemtoKink*), take from base class" << endl;
+#endif
+  }
+  //-----------------------------------Gael 12/04/02------------------------------------
+  virtual void Fill(const AliFemtoPair* aPair) { 
+#ifdef STHBTDEBUG
+    cout << " *** no user defined Fill(const AliFemtoPair*), take from base class" << endl;
+#endif
+  }
+  //-----------------------------------Gael 19/06/02------------------------------------
+  virtual void Fill(const AliFemtoParticleCollection* aCollection) {
+#ifdef STHBTDEBUG
+    cout << " *** no user defined Fill(const AliFemtoParticleCollection*), take from base class" << endl;
+#endif
+  }
+  //-----------------------------------Gael 19/06/02------------------------------------
+  virtual void Fill(const AliFemtoEvent* aEvent,const AliFemtoParticleCollection* aCollection) {
+#ifdef STHBTDEBUG
+    cout << " *** no user defined Fill(const AliFemtoEvent*,const AliFemtoParticleCollection*), take from base class" << endl;
+#endif
+  }
+  // -------------------------------------------------------------------------------------
+  virtual void Finish() { 
+#ifdef STHBTDEBUG
+    cout << " *** no user defined Finish(), take from base class" << endl;
+#endif
+  }
+  virtual void Init() { 
+#ifdef STHBTDEBUG
+    cout << " *** no user defined Init(), take from base class" << endl;
+#endif
+  }
+};
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventCut.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventCut.h
new file mode 100644 (file)
index 0000000..9944b7e
--- /dev/null
@@ -0,0 +1,43 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoEventCut - the pure virtual base class for the event cut         ///
+/// All event cuts must inherit from this one                                ///
+////////////////////////////////////////////////////////////////////////////////
+#ifndef AliFemtoEventCut_hh
+#define AliFemtoEventCut_hh
+
+class AliFemtoEvent;
+class AliFemtoBaseAnalysis;
+
+#include "Infrastructure/AliFemtoCutMonitorHandler.h"
+#include "Infrastructure/AliFemtoString.h"
+
+class AliFemtoEventCut : public AliFemtoCutMonitorHandler {
+
+  friend class AliFemtoBaseAnalysis;
+
+public:
+
+  AliFemtoEventCut(){/* no-op */};                // default constructor. - Users should write their own
+  AliFemtoEventCut(const AliFemtoEventCut& c); // copy constructor
+  virtual ~AliFemtoEventCut(){/* no-op */};       // destructor
+  
+  virtual bool Pass(const AliFemtoEvent* event) =0;  // true if passes, false if not
+
+  virtual AliFemtoString Report() =0;    // user-written method to return string describing cuts
+  virtual AliFemtoEventCut* Clone() { return 0;}
+
+
+  AliFemtoBaseAnalysis* HbtAnalysis(){return fyAnalysis;};
+  void SetAnalysis(AliFemtoBaseAnalysis* aAnalysis);
+
+protected:
+  AliFemtoBaseAnalysis* fyAnalysis;
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoEventCut, 0)
+#endif
+};
+
+inline AliFemtoEventCut::AliFemtoEventCut(const AliFemtoEventCut& c) : AliFemtoCutMonitorHandler() { fyAnalysis=0;}
+inline void AliFemtoEventCut::SetAnalysis(AliFemtoBaseAnalysis* analysis) { fyAnalysis = analysis; }
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.cxx b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.cxx
new file mode 100644 (file)
index 0000000..fd37b6c
--- /dev/null
@@ -0,0 +1,79 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoEventReader - the pure virtual base class for the event reader   ///
+/// All event readers must inherit from this one                             ///
+////////////////////////////////////////////////////////////////////////////////
+#include "Infrastructure/AliFemtoEvent.h"
+#include "Base/AliFemtoEventCut.h"
+#include "Base/AliFemtoTrackCut.h"
+#include "Base/AliFemtoV0Cut.h"
+#include "Base/AliFemtoXiCut.h"
+#include "Base/AliFemtoKinkCut.h"
+#include "Base/AliFemtoEventReader.h"
+
+#ifdef __ROOT__
+ClassImp(AliFemtoEventReader)
+#endif
+
+AliFemtoString AliFemtoEventReader::Report(){
+  // Create a simple report from the workings of the reader
+  AliFemtoString temp = "\n This is the base class AliFemtoEventReader reporting";
+  temp += "\n---> EventCuts in Reader: ";
+  if (fEventCut) {
+    temp += fEventCut->Report();
+  }
+  else {
+    temp += "NONE";
+  }
+  temp += "\n---> TrackCuts in Reader: ";
+  if (fTrackCut) {
+    temp += fTrackCut->Report();
+  }
+  else {
+    temp += "NONE";
+  }
+  temp += "\n---> V0Cuts in Reader: ";
+  if (fV0Cut) {
+    temp += fV0Cut->Report();
+  }
+  else {
+    temp += "NONE";
+  }
+  temp += "\n---> XiCuts in Reader: ";
+  if (fXiCut) {
+    temp += fXiCut->Report();
+  }
+  else {
+    temp += "NONE";
+  }
+  temp += "\n---> KinkCuts in Reader: ";
+  if (fKinkCut) {
+    temp += fKinkCut->Report();
+  }
+  else {
+    temp += "NONE";
+  }
+  temp += "\n";
+  return temp;
+}
+//______________________________________
+void AliFemtoEventReader::SetEventCut(AliFemtoEventCut* ecut){fEventCut=ecut;}
+//______________________________________
+void AliFemtoEventReader::SetTrackCut(AliFemtoTrackCut* pcut){cout << pcut << endl; fTrackCut=pcut;}
+//______________________________________
+void AliFemtoEventReader::SetV0Cut(AliFemtoV0Cut* pcut){fV0Cut=pcut;}
+//______________________________________
+void AliFemtoEventReader::SetXiCut(AliFemtoXiCut* pcut){fXiCut=pcut;}
+//______________________________________
+void AliFemtoEventReader::SetKinkCut(AliFemtoKinkCut* pcut){fKinkCut=pcut;}
+//______________________________________
+AliFemtoEventCut* AliFemtoEventReader::EventCut(){return fEventCut;}
+//______________________________________
+AliFemtoTrackCut* AliFemtoEventReader::TrackCut(){return fTrackCut;}
+//______________________________________
+AliFemtoV0Cut*    AliFemtoEventReader::V0Cut(){return fV0Cut;} 
+//______________________________________
+AliFemtoXiCut*    AliFemtoEventReader::XiCut(){return fXiCut;} 
+//______________________________________
+AliFemtoKinkCut*    AliFemtoEventReader::KinkCut(){return fKinkCut;}
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.h
new file mode 100644 (file)
index 0000000..3fa1d16
--- /dev/null
@@ -0,0 +1,79 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoEventReader - the pure virtual base class for the event reader   ///
+/// All event readers must inherit from this one                             ///
+////////////////////////////////////////////////////////////////////////////////
+#ifndef AliFemtoEventReader_hh
+#define AliFemtoEventReader_hh
+class AliFemtoEvent;
+class AliFemtoEventCut;
+class AliFemtoTrackCut;
+class AliFemtoV0Cut;
+class AliFemtoXiCut;
+class AliFemtoKinkCut;
+
+#include <iostream>
+#include <fstream>
+#include <stdio.h>
+using namespace std;
+
+#include "Infrastructure/AliFemtoString.h"
+
+class AliFemtoEventReader {
+
+public:
+  // even tho it's only a base class and never constructed, if you don't have an implementation,
+  // you get "AliFemtoEventReader type_info node" upon dynamical loading
+  AliFemtoEventReader() : fEventCut(0), fTrackCut(0), fV0Cut(0), fXiCut(0), fKinkCut(0), fDebug(1) { /* no-op */ }
+  virtual ~AliFemtoEventReader(){/* no-op */}
+  
+  virtual AliFemtoEvent* ReturnHbtEvent() =0;
+
+  virtual AliFemtoString Report();    // user-written method to return string describing reader
+                                      // Including whatever "early" cuts are being done
+
+  // this next method does NOT need to be implemented, in which case the 
+  // "default" method below is executed
+  virtual int WriteHbtEvent(AliFemtoEvent*){cout << "No WriteHbtEvent implemented\n"; return (0);}
+
+  // these next two are optional but would make sense for, e.g., opening and closing a file
+  virtual int Init(const char* ReadWrite, AliFemtoString& Message){cout << "do-nothing AliFemtoEventReader::Init()\n"; return(0);}
+  virtual void Finish(){/*no-op*/};
+
+  int Status(){return fReaderStatus;} // AliFemtoManager looks at this for guidance if it gets null pointer from ReturnHbtEvent
+
+  virtual void SetEventCut(AliFemtoEventCut* ecut);
+  virtual void SetTrackCut(AliFemtoTrackCut* pcut);
+  virtual void SetV0Cut(AliFemtoV0Cut* pcut);
+  virtual void SetXiCut(AliFemtoXiCut* pcut);
+  virtual void SetKinkCut(AliFemtoKinkCut* pcut);
+  virtual AliFemtoEventCut* EventCut();
+  virtual AliFemtoTrackCut* TrackCut();
+  virtual AliFemtoV0Cut*    V0Cut();
+  virtual AliFemtoXiCut*    XiCut();
+  virtual AliFemtoKinkCut*    KinkCut();
+
+  /* control of debug informations print out, my rule is: */
+  /* 0: no output at all                                  */
+  /* 1: once (e.g. in constructor, finsh                  */
+  /* 2: once per event                                    */
+  /* 3: once per track                                    */
+  /* 4: once per pair                                     */
+  int Debug(){return fDebug;} 
+  void SetDebug(int d){fDebug=d;}
+
+protected:
+  AliFemtoEventCut* fEventCut;     //! link to the front-loaded event cut
+  AliFemtoTrackCut* fTrackCut;     //! link to the front-loaded track cut
+  AliFemtoV0Cut* fV0Cut;           //! link to the front-loaded V0 cut
+  AliFemtoXiCut* fXiCut;           //! link to the front-loaded Xi cut
+  AliFemtoKinkCut* fKinkCut;       //! link to the front-loaded Kink cut
+  int fReaderStatus;               // 0="good"
+  int fDebug;                      // Debug information level
+#ifdef __ROOT__
+  ClassDef(AliFemtoEventReader,0)
+#endif
+};
+
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventWriter.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventWriter.h
new file mode 100644 (file)
index 0000000..11b9371
--- /dev/null
@@ -0,0 +1,12 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoEventWrite - a wrapper for the base class                        ///
+////////////////////////////////////////////////////////////////////////////////
+#ifndef AliFemtoEventWriter_hh
+#define AliFemtoEventWriter_hh
+
+#include "Base/AliFemtoEventReader.h"
+
+typedef AliFemtoEventReader AliFemtoEventWriter;//!  // yes, because our writer are reader-writers
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoHiddenInfo.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoHiddenInfo.h
new file mode 100644 (file)
index 0000000..bc47de9
--- /dev/null
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoHiddenInfo - pure virtual base class for the hidden info         ///
+/// Hidden info stores additional information, which is not in a standard    ///
+/// track. 
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef AliFemtoHiddenInfo_hh
+#define AliFemtoHiddenInfo_hh
+
+#include "Infrastructure/AliFemtoTypes.h"
+
+class AliFemtoHiddenInfo{
+
+public:
+  AliFemtoHiddenInfo(){/* no-op */};
+  virtual ~AliFemtoHiddenInfo(){/* no-op */};
+
+// !!! MANDATORY !!!
+// --- Copy the hidden info from AliFemtoTrack to AliFemtoParticle
+  virtual AliFemtoHiddenInfo* getParticleHiddenInfo() const =0;
+  virtual AliFemtoHiddenInfo* clone() const;
+
+};
+//_______________________________________
+inline AliFemtoHiddenInfo* AliFemtoHiddenInfo::clone() const{
+  // return exact copy of this hidden info
+  return getParticleHiddenInfo();
+}
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoKinkCut.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoKinkCut.h
new file mode 100644 (file)
index 0000000..c310b3d
--- /dev/null
@@ -0,0 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoKinkCut - the pure virtual base class for the kink cut           ///
+/// All kink cuts must inherit from this one                                 ///
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef AliFemtoKinkCut_hh
+#define AliFemtoKinkCut_hh
+
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Infrastructure/AliFemtoKink.h"
+#include "Base/AliFemtoParticleCut.h"
+
+class AliFemtoKinkCut : public AliFemtoParticleCut {
+
+public:
+
+  AliFemtoKinkCut(){/* no-op */};                       // default constructor. - Users should write their own
+  AliFemtoKinkCut(const AliFemtoKinkCut&);                         // copy constructor
+  virtual ~AliFemtoKinkCut(){/* no-op */};              // destructor
+
+  virtual bool Pass(const AliFemtoKink* aKink)=0;               // true if passes, false if not
+
+  virtual AliFemtoParticleType Type(){return hbtKink;}
+  virtual AliFemtoKinkCut* Clone() { return 0;}
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoKinkCut, 0)
+#endif
+};
+//_____________________________
+inline AliFemtoKinkCut::AliFemtoKinkCut(const AliFemtoKinkCut& c) : AliFemtoParticleCut(c) { /* no-op */ } 
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoLikeSignCorrFctn.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoLikeSignCorrFctn.h
new file mode 100644 (file)
index 0000000..ccf8e57
--- /dev/null
@@ -0,0 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoLikeSignCorrFctn - the pure virtual base class for the like sign ///
+/// correlation function. All like sign correlation functions  must inherit  ///
+/// from this one                                                            ///
+////////////////////////////////////////////////////////////////////////////////
+#ifndef AliFemtoLikeSignCorrFctn_hh
+#define AliFemtoLikeSignCorrFctn_hh
+
+class AliFemtoPair;
+#include "Base/AliFemtoCorrFctn.h"
+
+class AliFemtoLikeSignCorrFctn : public AliFemtoCorrFctn {
+
+  friend class AliFemtoLikeSignAnalysis;
+
+public:
+  AliFemtoLikeSignCorrFctn(){/* no-op */};
+  AliFemtoLikeSignCorrFctn(const AliFemtoLikeSignCorrFctn& aCorrFctn);
+  virtual ~AliFemtoLikeSignCorrFctn(){/* no-op */};
+
+  virtual void AddLikeSignPositivePair(const AliFemtoPair* aPair) = 0;
+  virtual void AddLikeSignNegativePair(const AliFemtoPair* aPair) = 0;
+
+  virtual AliFemtoLikeSignCorrFctn* Clone() { return 0;}
+
+  // the following allows "back-pointing" from the CorrFctn to the "parent" Analysis
+};
+//________________________________________
+inline AliFemtoLikeSignCorrFctn::AliFemtoLikeSignCorrFctn(const AliFemtoLikeSignCorrFctn& c) { fyAnalysis =0; }
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoPairCut.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoPairCut.h
new file mode 100644 (file)
index 0000000..25ba8ba
--- /dev/null
@@ -0,0 +1,50 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoPairCut - the pure virtual base class for the pair cut           ///
+/// All pair cuts must inherit from this one                                 ///
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef AliFemtoPairCut_hh
+#define AliFemtoPairCut_hh
+
+#include <string>
+
+class AliFemtoBaseAnalysis;
+
+#include "Infrastructure/AliFemtoString.h"
+#include "Infrastructure/AliFemtoEvent.h"
+#include "Infrastructure/AliFemtoPair.h"
+#include "Infrastructure/AliFemtoCutMonitorHandler.h"
+
+class AliFemtoPairCut : public AliFemtoCutMonitorHandler {
+
+  friend class AliFemtoBaseAnalysis;
+
+public:
+
+  AliFemtoPairCut(){/* no-op */};   // default constructor. - Users should write their own
+  AliFemtoPairCut(const AliFemtoPairCut& c); // copy constructor
+  virtual ~AliFemtoPairCut(){/* no-op */};  // destructor
+
+  virtual bool Pass(const AliFemtoPair* pair) =0;  // true if passes, false if not
+
+  virtual AliFemtoString Report() =0;    // user-written method to return string describing cuts
+  virtual void EventBegin(const AliFemtoEvent* aEvent) { /* no-op */ }
+  virtual void EventEnd(const AliFemtoEvent* aEvent) { /* no-op */ }
+  virtual AliFemtoPairCut* Clone() { return 0;}
+
+  // the following allows "back-pointing" from the CorrFctn to the "parent" Analysis
+  AliFemtoBaseAnalysis* HbtAnalysis(){return fyAnalysis;};
+  void SetAnalysis(AliFemtoBaseAnalysis* aAnalysis);    // Set Back pointer to Analysis
+
+protected:
+  AliFemtoBaseAnalysis* fyAnalysis; // Link to the base analysis class
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoPairCut, 0)
+#endif
+};
+
+
+inline AliFemtoPairCut::AliFemtoPairCut(const AliFemtoPairCut& c) : AliFemtoCutMonitorHandler() { fyAnalysis = 0; }
+inline void AliFemtoPairCut::SetAnalysis(AliFemtoBaseAnalysis* analysis) { fyAnalysis = analysis; }
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoParticleCut.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoParticleCut.h
new file mode 100644 (file)
index 0000000..f1a0f23
--- /dev/null
@@ -0,0 +1,54 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoParticleCut - the pure virtual base class for the particle cut   ///
+/// All particle cuts must inherit from this one                             ///
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef AliFemtoParticleCut_hh
+#define AliFemtoParticleCut_hh
+
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Infrastructure/AliFemtoCutMonitorHandler.h"
+
+class AliFemtoBaseAnalysis;
+
+class AliFemtoParticleCut : public AliFemtoCutMonitorHandler {
+
+  friend class AliFemtoBaseAnalysis;
+
+public:
+  AliFemtoParticleCut(){/* no-op */};   // default constructor. - Users should write their own
+  AliFemtoParticleCut(const AliFemtoParticleCut&); // copy constructor
+  virtual ~AliFemtoParticleCut(){/* no-op */};  // destructor
+
+  virtual AliFemtoString Report() =0;    // user-written method to return string describing cuts
+
+  double Mass(){return fMass;};       // mass of the particle being selected
+  virtual void SetMass(const double& mass) {fMass = mass;};
+
+  virtual void EventBegin(const AliFemtoEvent* aEvent) { /* no-op */ }
+  virtual void EventEnd(const AliFemtoEvent* aEvent) { /* no-op */ }
+  virtual AliFemtoParticleCut* Clone() { return 0;}
+
+  virtual AliFemtoParticleType Type()=0;
+
+  // the following allows "back-pointing" from the CorrFctn to the "parent" Analysis
+  AliFemtoBaseAnalysis* HbtAnalysis(){return fyAnalysis;};
+  void SetAnalysis(AliFemtoBaseAnalysis*);
+
+protected:
+  double fMass;
+  AliFemtoBaseAnalysis* fyAnalysis; // Link to the base analysis class
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoParticleCut, 0)
+#endif
+};
+
+inline AliFemtoParticleCut::AliFemtoParticleCut(const AliFemtoParticleCut& c) : AliFemtoCutMonitorHandler() { 
+  fMass = c.fMass; fyAnalysis = 0; 
+#ifdef STHBTDEBUG
+  cout << " AliFemtoParticleCut::AliFemtoParticleCut(const AliFemtoParticleCut& c) - fMass: " << fMass << endl;
+#endif
+}
+inline void AliFemtoParticleCut::SetAnalysis(AliFemtoBaseAnalysis* analysis) { fyAnalysis = analysis; }
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoTrackCut.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoTrackCut.h
new file mode 100644 (file)
index 0000000..1be1afd
--- /dev/null
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoTrackCut - the pure virtual base class for the track cut         ///
+/// All track cuts must inherit from this one                                ///
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef AliFemtoTrackCut_hh
+#define AliFemtoTrackCut_hh
+
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Infrastructure/AliFemtoTrack.h"
+#include "Base/AliFemtoParticleCut.h"
+
+class AliFemtoTrackCut : public AliFemtoParticleCut {
+
+public:
+
+  AliFemtoTrackCut(){/* no-op */};                       // default constructor. - Users should write their own
+  AliFemtoTrackCut(const AliFemtoTrackCut&);                // copy constructor
+  virtual ~AliFemtoTrackCut(){/* no-op */};              // destructor
+
+  virtual bool Pass(const AliFemtoTrack* track)=0;       // true if passes, false if not
+  virtual AliFemtoParticleType Type(){return hbtTrack;}
+  virtual AliFemtoTrackCut* Clone() { return 0;}
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoTrackCut, 0)
+#endif
+};
+
+inline AliFemtoTrackCut::AliFemtoTrackCut(const AliFemtoTrackCut& c) : AliFemtoParticleCut(c) {
+#ifdef STHBTDEBUG
+  cout << " AliFemtoTrackCut::AliFemtoTrackCut(const AliFemtoTrackCut& c) : AliFemtoParticleCut(c) " << endl;
+#endif
+}
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoV0Cut.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoV0Cut.h
new file mode 100644 (file)
index 0000000..d4f63f9
--- /dev/null
@@ -0,0 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoV0Cut - the pure virtual base class for the V0 cut           ///
+/// All V0 cuts must inherit from this one                                 ///
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef AliFemtoV0Cut_hh
+#define AliFemtoV0Cut_hh
+
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Infrastructure/AliFemtoV0.h"
+#include "Base/AliFemtoParticleCut.h"
+
+class AliFemtoV0Cut : public AliFemtoParticleCut {
+
+public:
+
+  AliFemtoV0Cut(){/* no-op */};                             // default constructor. - Users should write their own
+  AliFemtoV0Cut(const AliFemtoV0Cut& aCut);                 // copy constructor
+  virtual ~AliFemtoV0Cut(){/* no-op */};                    // destructor
+
+  virtual bool Pass(const AliFemtoV0* aV0)=0;               // true if passes, false if not
+
+  virtual AliFemtoParticleType Type(){return hbtV0;}
+  virtual AliFemtoV0Cut* Clone() { return 0;}
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoV0Cut, 0)
+#endif
+};
+
+inline AliFemtoV0Cut::AliFemtoV0Cut(const AliFemtoV0Cut& c) : AliFemtoParticleCut(c) { /* no-op */ } 
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoXiCut.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoXiCut.h
new file mode 100644 (file)
index 0000000..bcfbadb
--- /dev/null
@@ -0,0 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////
+/// AliFemtoXiCut - the pure virtual base class for the Xi cut               ///
+/// All Xi cuts must inherit from this one                                   ///
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef AliFemtoXiCut_hh
+#define AliFemtoXiCut_hh
+
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Infrastructure/AliFemtoXi.h"
+#include "Base/AliFemtoParticleCut.h"
+
+class AliFemtoXiCut : public AliFemtoParticleCut {
+
+public:
+
+  AliFemtoXiCut(){/* no-op */};                          // default constructor. - Users should write their own
+  AliFemtoXiCut(const AliFemtoXiCut& aCut);              // copy constructor
+  virtual ~AliFemtoXiCut(){/* no-op */};                 // destructor
+
+  virtual bool Pass(const AliFemtoXi* aCut)=0;               // true if passes, false if not
+
+  virtual AliFemtoParticleType Type(){return hbtXi;}
+  virtual AliFemtoXiCut* Clone() { return 0;}
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoXiCut, 0)
+#endif
+};
+
+inline AliFemtoXiCut::AliFemtoXiCut(const AliFemtoXiCut& c) : AliFemtoParticleCut(c) { /* no-op */ } 
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/PhysicalConstants.h b/PWG2/FEMTOSCOPY/AliFemto/Base/PhysicalConstants.h
new file mode 100644 (file)
index 0000000..90d96c4
--- /dev/null
@@ -0,0 +1,140 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: CLHEP (see below)
+ ***************************************************************************
+ *
+ * Description:  Taken as-is from CLHEP.
+ *               Modified original CVS-Id to retain version info. 
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.2  1999/02/22 16:52:47  didenko
+ * updates from Gene
+ *
+ * Revision 1.1  1999/01/30 03:58:59  fisyak
+ * Root Version of StarClassLibrary
+ *
+ * Revision 1.1  1999/01/23 00:27:34  ullrich
+ * Initial Revision
+ *
+ **************************************************************************/
+
+#ifndef HEP_PHYSICAL_CONSTANTS_H
+#define HEP_PHYSICAL_CONSTANTS_H
+
+#include "SystemOfUnits.h"
+
+#ifndef ST_NO_NAMESPACES
+using namespace std;
+using namespace units;
+#endif
+
+#include <math.h>
+#include <cmath>
+
+//
+#ifndef M_PI
+#define M_PI 3.14159265358979312
+#endif
+//
+//#ifdef MACOSX
+//extern const double     pi;    // from <math.h>
+//#else
+static const double     pi  = M_PI;    // from <math.h>
+//#endif
+static const double  twopi  = 2*pi;
+static const double halfpi  = pi/2;
+static const double    pi2  = pi*pi;
+
+//
+// 
+//
+static const double Avogadro = 6.0221367e+23/mole;
+
+//
+// c   = 299.792458 mm/ns
+// c^2 = 898.7404 (mm/ns)^2 
+//
+static const double c_light   = 2.99792458e+8 * meter/second;
+static const double c_squared = c_light * c_light;
+
+//
+// h     = 4.13566e-12 MeV*ns
+// hbar  = 6.58212e-13 MeV*ns
+// hbarc = 197.32705e-12 MeV*mm
+//
+static const double h_Planck      = 6.6260755e-34 * joule*second;
+static const double hbar_Planck   = h_Planck/twopi;
+static const double hbarc         = hbar_Planck * c_light;
+static const double hbarc_squared = hbarc * hbarc;
+
+//
+//
+//
+static const double electron_charge = - eplus; // see SystemOfUnits.h
+static const double e_squared = eplus * eplus;
+
+//
+// amu_c2 - atomic equivalent mass unit
+// amu    - atomic mass unit
+//
+static const double electron_mass_c2 = 0.51099906 * MeV;
+static const double   proton_mass_c2 = 938.27231 * MeV;
+static const double  neutron_mass_c2 = 939.56563 * MeV;
+static const double           amu_c2 = 931.49432 * MeV;
+static const double              amu = amu_c2/c_squared;
+
+static const double kaon_0_short_mass_c2 = 497.672  * MeV;
+static const double    pion_plus_mass_c2 = 139.5700 * MeV;
+static const double   pion_minus_mass_c2 = 139.5700 * MeV;
+static const double       lambda_mass_c2 = 1115.684 * MeV;
+static const double   antilambda_mass_c2 = 1115.684 * MeV;
+static const double     xi_minus_mass_c2 = 1321.32  * MeV;
+
+
+//
+// permeability of free space mu0    = 2.01334e-16 Mev*(ns*eplus)^2/mm
+// permittivity of free space epsil0 = 5.52636e+10 eplus^2/(MeV*mm)
+//
+static const double mu0      = 4*pi*1.e-7 * henry/meter;
+static const double epsilon0 = 1./(c_squared*mu0);
+
+//
+// electromagnetic coupling = 1.43996e-12 MeV*mm/(eplus^2)
+//
+static const double elm_coupling           = e_squared/(4*pi*epsilon0);
+static const double fine_structure_const   = elm_coupling/hbarc;
+static const double classic_electr_radius  = elm_coupling/electron_mass_c2;
+static const double electron_Compton_length = hbarc/electron_mass_c2;
+static const double Bohr_radius = electron_Compton_length/fine_structure_const;
+
+static const double alpha_rcl2 = fine_structure_const
+                                   *classic_electr_radius
+                                   *classic_electr_radius;
+
+static const double twopi_mc2_rcl2 = twopi*electron_mass_c2
+                                             *classic_electr_radius
+                                             *classic_electr_radius;
+//
+//
+//
+static const double k_Boltzmann = 8.617385e-11 * MeV/kelvin;
+
+//
+//
+//
+static const double STP_Temperature = 273.15*kelvin;
+static const double STP_Pressure    = 1.*atmosphere;
+static const double kGasThreshold   = 1.e-2*gram/centimeter3;
+
+#endif /* HEP_PHYSICAL_CONSTANTS_H */
+
+
+
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/SystemOfUnits.h b/PWG2/FEMTOSCOPY/AliFemto/Base/SystemOfUnits.h
new file mode 100644 (file)
index 0000000..8521f9d
--- /dev/null
@@ -0,0 +1,304 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: blasiuk adapted from CLHEP
+ ***************************************************************************
+ *
+ * Description:  This file is based on the SystemOfUnits provided
+ *               in the CLHEP library v1.2:  The units remain the same.
+ *               It is just the naming conventions that are different:
+ *
+ * 1) No single letter unit:
+ *    : m --> meter
+ *    : s --> second
+ *    : g --> gram
+ *
+ * 2) All prefixes are spelled out explicitly (except electron Volt):
+ *    : ns --> nanosecond
+ *    : mm --> millimeter
+ *
+ * 3) All units with proper names follow the international standard
+ *    of being lower case:
+ *    : farad --> farad
+ *    : volt  --> volt
+ *
+ * The basic units are :
+ *              centimeter              (centimeter)
+ *              second                  (second)
+ *              Giga electron Volt      (GeV)
+ *              positron charge         (eplus)
+ *              degree Kelvin           (kelvin)
+ *              the amount of substance (mole)
+ *              radian                  (radian)
+ *              steradian               (steradian)
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.5  2003/09/02 17:59:35  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.4  1999/03/22 16:21:38  fisyak
+ * Add anti CINT flags
+ *
+ * Revision 1.3  1999/03/11 14:53:07  ullrich
+ * Added definition of inch.
+ *
+ * Revision 1.2  1999/03/02 20:15:08  ullrich
+ * Added millivolt.
+ *
+ * Revision 1.1  1999/01/30 03:59:06  fisyak
+ * Root Version of StarClassLibrary
+ *
+ * Revision 1.1  1999/01/23 00:28:08  ullrich
+ * Initial Revision
+ *
+ **************************************************************************/
+#ifndef HEP_SYSTEM_OF_UNITS_H
+#define HEP_SYSTEM_OF_UNITS_H
+
+
+#ifndef M_PI
+#define M_PI 3.14159265358979312
+#endif
+
+
+namespace units {
+    // new macro for CLHEP SystemOfUnits: at end of file
+    //  ST_ADD_OLD_CLHEP_SYSTEM_OF_UNITS
+    // 
+    // Length [L]
+    //
+    static const double millimeter  = 0.1;
+    static const double millimeter2 = millimeter*millimeter;
+    static const double millimeter3 = millimeter*millimeter*millimeter;
+
+    static const double centimeter  = 10*millimeter;
+    static const double centimeter2 = centimeter*centimeter;
+    static const double centimeter3 = centimeter*centimeter*centimeter;
+
+    static const double meter       = 100.*centimeter;
+    static const double meter2      = meter*meter;
+    static const double meter3      = meter*meter*meter;
+
+    static const double kilometer   = 1000.*meter;
+    static const double kilometer2  = kilometer*kilometer;
+    static const double kilometer3  = kilometer*kilometer*kilometer;
+
+    static const double micrometer  = 1.e-6*meter;
+    static const double nanometer   = 1.e-9*meter;
+    static const double femtometer  = 1.e-15*meter;
+    static const double fermi       = 1*femtometer;
+    
+    static const double      barn   = 1.e-28*meter2;
+    static const double millibarn   = 1.e-3*barn;
+    static const double microbarn   = 1.e-6*barn;
+    static const double  nanobarn   = 1.e-9*barn;
+    static const double      inch   = 2.54*centimeter;
+    
+    //
+    // Angle
+    //
+    static const double      radian = 1.;
+    static const double milliradian = 1.e-3*radian;
+#ifndef __CINT__
+    static const double      degree = (M_PI/180.0)*radian;
+#endif    
+    static const double   steradian = 1.;
+
+    //
+    // Time [T]
+    //
+    static const double      second = 1;
+    static const double millisecond = 1.e-3*second;
+    static const double microsecond = 1.e-3*millisecond;
+    static const double  nanosecond = 1.e-3*microsecond;
+    
+    static const double     hertz   = 1./second;
+    static const double kilohertz   = 1.e+3*hertz;
+    static const double Megahertz   = 1.e+6*hertz;
+    
+    // but these are also unambiguous and unlikely to be used as variable!
+    static const double  Hz         = 1*hertz;
+    static const double kHz         = 1*kilohertz;
+    static const double MHz         = 1*Megahertz;
+
+    //
+    // Electric charge [Q]
+    //
+    static const double eplus   = 1. ;                 // positron charge
+    static const double e_SI    = 1.60217733e-19;      // positron charge in coulomb
+    static const double coulomb = eplus/e_SI;
+    
+    //
+    // Energy [E]
+    //
+    static const double Gigaelectronvolt = 1.;
+    static const double Megaelectronvolt = 1.e-3*Gigaelectronvolt;
+    static const double     electronvolt = 1.e-6*Megaelectronvolt;
+    static const double kiloelectronvolt = 1.e+3*electronvolt;
+    static const double Teraelectronvolt = 1.e+3*Gigaelectronvolt;
+    
+    // but these are also unambiguous and unlikely to be used as variables
+    static const double MeV     = Megaelectronvolt;
+    static const double  eV     =     electronvolt;
+    static const double keV     = kiloelectronvolt;
+    static const double GeV     = Gigaelectronvolt;
+    static const double TeV     = Teraelectronvolt;
+    
+    static const double joule   = electronvolt/e_SI;
+    
+    //
+    // Mass [E][T^2][L^-2]
+    //
+    static const double  kilogram = joule*second*second/(meter*meter);
+    static const double      gram = 1.e-3*kilogram;
+    static const double milligram = 1.e-3*gram;
+
+    //
+    // Power [E][T^-1]
+    //
+    static const double watt    = joule/second;
+    
+    //
+    // Force [E][L^-1]
+    //
+    static const double newton  = joule/meter;
+
+    //
+    // Pressure [E][L^-3]
+    //
+#ifndef __CINT__    
+#define pascal hep_pascal       // a trick to avoid warnings 
+    static const double hep_pascal = newton/meter2;
+#else
+    static const double pascal     = newton/meter2;
+#endif
+    static const double bar        = 100000*pascal;
+    static const double atmosphere = 101325*pascal;
+
+    //
+    // Electric current [Q][T^-1]
+    //
+    static const double ampere   = coulomb/second;
+    
+    //
+    // Electric potential [E][Q^-1]
+    //
+    static const double Megavolt = MeV/eplus;
+    static const double kilovolt = 1.e-3*Megavolt;
+    static const double     volt = 1.e-6*Megavolt;
+    static const double millivolt = 1.e-3*volt;
+    
+    //
+    // Electric resistance [E][T][Q^-2]
+    //
+    static const double ohm = volt/ampere;
+    
+    //
+    // Electric capacitance [Q^2][E^-1]
+    //
+    static const double farad = coulomb/volt;
+    static const double millifarad = 1.e-3*farad;
+    static const double microfarad = 1.e-6*farad;
+    static const double  nanofarad = 1.e-9*farad;
+    static const double  picofarad = 1.e-12*farad;
+    
+    //
+    // Magnetic Flux [T][E][Q^-1]
+    //
+    static const double weber = volt*second;
+    
+    //
+    // Magnetic Field [T][E][Q^-1][L^-2]
+    //
+    static const double tesla     = volt*second/meter2;
+    
+    static const double gauss     = 1.e-4*tesla;
+    static const double kilogauss = 1.e-1*tesla;
+
+    //
+    // Inductance [T^2][E][Q^-2]
+    //
+    static const double henry = weber/ampere;
+
+    //
+    // Temperature
+    //
+    static const double kelvin = 1.;
+
+    //
+    // Amount of substance
+    //
+    static const double mole = 1.;
+    
+    //
+    // Activity [T^-1]
+    //
+    static const double becquerel = 1./second;
+    static const double curie = 3.7e+10 * becquerel;
+    
+    //
+    // Absorbed dose [L^2][T^-2]
+    //
+    static const double gray = joule/kilogram ;
+
+    //
+    // Miscellaneous
+    //
+    static const double perCent     = 0.01 ;
+    static const double perThousand = 0.001;
+    static const double perMillion  = 0.000001;
+
+#ifdef ST_ADD_OLD_CLHEP_SYSTEM_OF_UNITS
+
+    static const double mm  = 0.1;         // millimeter
+    static const double mm2 = mm*mm;
+    static const double mm3 = mm*mm*mm;
+    
+    static const double cm  = 10.*mm;      // centimeter
+    static const double cm2 = cm*cm;
+    static const double cm3 = cm*cm*cm;
+    
+    static const double m  = 1000.*mm;     // meter
+    static const double m2 = m*m;
+    static const double m3 = m*m*m;
+    
+    static const double km = 1000.*m;      // kilometer
+    static const double km2 = km*km;
+    static const double km3 = km*km*km;
+
+    static const double microm = 1.e-6*m;  // micro meter
+    static const double  nanom = 1.e-9*m;
+    //static const double  fermi = 1.e-15*m;
+
+    //
+    // Angle
+    //
+    static const double  rad = 1.;        // radian 
+    static const double mrad = 1.e-3*rad; // milliradian
+    static const double  deg = (M_PI/180.0)*rad;
+
+    static const double   st = 1.;         // steradian
+
+    //
+    // Time [T]
+    //
+    static const double  s = 1;           // second
+    static const double ns = 1.e-9*s;     // nano second
+    static const double ms = 1.e-3*s;     // milli second
+
+    // Mass [E][T^2][L^-2]
+    //
+    static const double kg = joule*second*second/(meter*meter);        // kg = 6.24150 e+24 * MeV*ns*ns/(mm*mm)   
+    static const double  g = 1.e-3*kg;
+    static const double mg = 1.e-3*g;
+
+#endif
+
+};
+using namespace units;
+#endif /* HEP_SYSTEM_OF_UNITS_H */
diff --git a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.cxx b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.cxx
new file mode 100644 (file)
index 0000000..30a3122
--- /dev/null
@@ -0,0 +1,321 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   3D Bertsch-Pratt decomposition in the LCMS frame
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.7  2003/01/31 19:20:54  magestro
+ * Cleared up simple compiler warnings on i386_linux24
+ *
+ * Revision 1.6  2002/06/07 22:51:38  lisa
+ * Widely used AliFemtoBPLCMS3DCorrFctn class now accumulates UNcorrected denominator and has a WriteOutHistos method
+ *
+ * Revision 1.5  2001/05/23 00:19:04  lisa
+ * Add in Smearing classes and methods needed for momentum resolution studies and correction
+ *
+ * Revision 1.4  2000/10/26 19:48:49  rcwells
+ * Added functionality for Coulomb correction of <qInv> in 3D correltions
+ *
+ * Revision 1.3  2000/09/14 18:36:53  lisa
+ * Added Qinv and ExitSep pair cuts and AliFemtoBPLCMS3DCorrFctn_SIM CorrFctn
+ *
+ * Revision 1.2  2000/08/23 19:43:43  lisa
+ * added alternate normalization algorithm to 3d CorrFctns in case normal one fails
+ *
+ * Revision 1.1  2000/08/17 20:48:39  lisa
+ * Adding correlationfunction in LCMS frame
+ *
+ *
+ **************************************************************************/
+
+#include "CorrFctn/AliFemtoBPLCMS3DCorrFctn.h"
+//#include "Infrastructure/AliFemtoHisto.h"
+#include <cstdio>
+
+#ifdef __ROOT__ 
+ClassImp(AliFemtoBPLCMS3DCorrFctn)
+#endif
+
+//____________________________
+AliFemtoBPLCMS3DCorrFctn::AliFemtoBPLCMS3DCorrFctn(char* title, const int& nbins, const float& QLo, const float& QHi){
+
+  // set some stuff...
+  fQinvNormLo = 0.15;
+  fQinvNormHi = 0.18;
+  fNumRealsNorm = 0;
+  fNumMixedNorm = 0;
+  //  fCorrection = 0;  // pointer to Coulomb Correction object
+
+  fPairCut = 0; // added Sept2000 - CorrFctn-specific PairCut
+
+  //  fSmearPair = 0; // no resolution correction unless user sets SmearPair
+
+  // set up numerator
+  char TitNum[100] = "Num";
+  strcat(TitNum,title);
+  fNumerator = new TH3D(TitNum,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  // set up denominator
+  char TitDen[100] = "Den";
+  strcat(TitDen,title);
+  fDenominator = new TH3D(TitDen,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  // set up uncorrected denominator
+  char TitDenUncoul[100] = "DenNoCoul";
+  strcat(TitDenUncoul,title);
+  //  fUncorrectedDenominator = new TH3D(TitDenUncoul,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  // set up ratio
+  char TitRat[100] = "Rat";
+  strcat(TitRat,title);
+  fRatio = new TH3D(TitRat,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  // set up ave qInv
+  char TitQinv[100] = "Qinv";
+  strcat(TitQinv,title);
+  fQinvHisto = new TH3D(TitQinv,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+
+  // to enable error bar calculation...
+  fNumerator->Sumw2();
+  fDenominator->Sumw2();
+  //  fUncorrectedDenominator->Sumw2();
+  fRatio->Sumw2();
+
+  // Following histos are for the momentum resolution correction
+  // they are filled only if a AliFemtoSmear object is plugged in
+  // here comes the "idea" numerator and denominator and ratio...
+  char TitNumID[100] = "IDNum";
+  strcat(TitNumID,title);
+  fIDNumHisto = new TH3D(TitNumID,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  char TitDenID[100] = "IDDen";
+  strcat(TitDenID,title);
+  fIDDenHisto = new TH3D(TitDenID,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  char TitRatID[100] = "IDRat";
+  strcat(TitRatID,title);
+  fIDRatHisto = new TH3D(TitRatID,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+
+  fIDNumHisto->Sumw2();
+  fIDDenHisto->Sumw2();
+  fIDRatHisto->Sumw2();
+
+  //
+  // here comes the "smeared" numerator and denominator...
+  char TitNumSM[100] = "SMNum";
+  strcat(TitNumSM,title);
+  fSMNumHisto = new TH3D(TitNumSM,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  char TitDenSM[100] = "SMDen";
+  strcat(TitDenSM,title);
+  fSMDenHisto = new TH3D(TitDenSM,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  char TitRatSM[100] = "SMRat";
+  strcat(TitRatSM,title);
+  fSMRatHisto = new TH3D(TitRatSM,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  //
+  fSMNumHisto->Sumw2();
+  fSMDenHisto->Sumw2();
+  fSMRatHisto->Sumw2();
+  //
+  // here comes the correction factor (which is just ratio of ideal ratio to smeared ratio)
+  char TitCorrection[100] = "CorrectionFactor";
+  strcat(TitCorrection,title);
+  fCorrectionHisto = new TH3D(TitCorrection,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);  
+  fCorrectionHisto->Sumw2();
+  // here comes the fully corrected correlation function
+  char TitCorrCF[100] = "CorrectedCF";
+  strcat(TitCorrCF,title);
+  fCorrCFHisto = new TH3D(TitCorrCF,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  fCorrCFHisto->Sumw2();
+
+  // user can (and should) override these defaults...
+  fLambda = 0.6;
+  fRout2 = 6.0*6.0;
+  fRside2 = 6.0*6.0;
+  fRlong2 = 7.0*7.0;
+
+}
+
+//____________________________
+AliFemtoBPLCMS3DCorrFctn::~AliFemtoBPLCMS3DCorrFctn(){
+  delete fNumerator;
+  delete fDenominator;
+  delete fRatio;
+  delete fQinvHisto;
+  delete fIDNumHisto;
+  delete fIDDenHisto;
+  delete fIDRatHisto;
+  delete fSMNumHisto;
+  delete fSMDenHisto;
+  delete fSMRatHisto;
+  delete fCorrectionHisto;
+  delete fCorrCFHisto;
+}
+
+//_________________________
+void AliFemtoBPLCMS3DCorrFctn::WriteOutHistos(){
+
+  fNumerator->Write();
+  fDenominator->Write();
+  //  fUncorrectedDenominator->Write();
+  fRatio->Write();
+  fQinvHisto->Write();
+
+  /*
+    if (fSmearPair){
+    fIDNumHisto->Write();
+    fIDDenHisto->Write();
+    fIDRatHisto->Write();
+    //
+    fSMNumHisto->Write();
+    fSMDenHisto->Write();
+    fSMRatHisto->Write();
+    //
+    fCorrectionHisto->Write();
+    fCorrCFHisto->Write();
+    }
+  */
+}
+
+//_________________________
+void AliFemtoBPLCMS3DCorrFctn::Finish(){
+  // here is where we should normalize, fit, etc...
+  double NumFact,DenFact;
+  if ((fNumRealsNorm !=0) && (fNumMixedNorm !=0)){
+    NumFact = double(fNumRealsNorm);
+    DenFact = double(fNumMixedNorm);
+  }
+  // can happen that the fNumRealsNorm and fNumMixedNorm = 0 if you do non-standard
+  //   things like making a new CorrFctn and just setting the Numerator and Denominator
+  //   from OTHER CorrFctns which you read in (like when doing parallel processing) 
+  else{
+    cout << "Warning! - no normalization constants defined - I do the best I can..." << endl;
+    int nbins = fNumerator->GetNbinsX();
+    int half_way = nbins/2;
+    NumFact = fNumerator->Integral(half_way,nbins,half_way,nbins,half_way,nbins);
+    DenFact = fDenominator->Integral(half_way,nbins,half_way,nbins,half_way,nbins);
+  }
+
+  fRatio->Divide(fNumerator,fDenominator,DenFact,NumFact);
+  //  fQinvHisto->Divide(fUncorrectedDenominator);
+  fQinvHisto->Divide(fDenominator);
+
+  /*
+  // now do all the resolution correction stuff..
+  if (fSmearPair){  // but only do it if we have been working with a SmearPair
+  fIDRatHisto->Divide(fIDNumHisto,fIDDenHisto);
+  fSMRatHisto->Divide(fSMNumHisto,fSMDenHisto);
+  fCorrectionHisto->Divide(fIDRatHisto,fSMRatHisto);
+  fCorrCFHisto->Multiply(fRatio,fCorrectionHisto);
+  }
+  */
+
+}
+
+//____________________________
+AliFemtoString AliFemtoBPLCMS3DCorrFctn::Report(){
+  string stemp = "LCMS Frame Bertsch-Pratt 3D Correlation Function Report:\n";
+  char ctemp[100];
+  sprintf(ctemp,"Number of entries in numerator:\t%E\n",fNumerator->GetEntries());
+  stemp += ctemp;
+  sprintf(ctemp,"Number of entries in denominator:\t%E\n",fDenominator->GetEntries());
+  stemp += ctemp;
+  sprintf(ctemp,"Number of entries in ratio:\t%E\n",fRatio->GetEntries());
+  stemp += ctemp;
+  sprintf(ctemp,"Normalization region in Qinv was:\t%E\t%E\n",fQinvNormLo,fQinvNormHi);
+  stemp += ctemp;
+  sprintf(ctemp,"Number of pairs in Normalization region was:\n");
+  stemp += ctemp;
+  sprintf(ctemp,"In numerator:\t%lu\t In denominator:\t%lu\n",fNumRealsNorm,fNumMixedNorm);
+  stemp += ctemp;
+  /*  if (fCorrection)
+      {
+      float radius = fCorrection->GetRadius();
+      sprintf(ctemp,"Coulomb correction used radius of\t%E\n",radius);
+      }
+      else
+      {
+      sprintf(ctemp,"No Coulomb Correction applied to this CorrFctn\n");
+      }
+      stemp += ctemp;
+  */
+
+  if (fPairCut){
+    sprintf(ctemp,"Here is the PairCut specific to this CorrFctn\n");
+    stemp += ctemp;
+    stemp += fPairCut->Report();
+  }
+  else{
+    sprintf(ctemp,"No PairCut specific to this CorrFctn\n");
+    stemp += ctemp;
+  }
+
+  //  
+  AliFemtoString returnThis = stemp;
+  return returnThis;
+}
+//____________________________
+void AliFemtoBPLCMS3DCorrFctn::AddRealPair(const AliFemtoPair* pair){
+
+  if (fPairCut){
+    if (!(fPairCut->Pass(pair))) return;
+  }
+
+  double Qinv = fabs(pair->qInv());   // note - qInv() will be negative for identical pairs...
+  if ((Qinv < fQinvNormHi) && (Qinv > fQinvNormLo)) fNumRealsNorm++;
+  double qOut = fabs(pair->qOutCMS());
+  double qSide = fabs(pair->qSideCMS());
+  double qLong = fabs(pair->qLongCMS());
+
+  fNumerator->Fill(qOut,qSide,qLong);
+}
+//____________________________
+void AliFemtoBPLCMS3DCorrFctn::AddMixedPair(const AliFemtoPair* pair){
+
+  if (fPairCut){
+    if (!(fPairCut->Pass(pair))) return;
+  }
+
+  //  double CoulombWeight = (fCorrection ? fCorrection->CoulombCorrect(pair) : 1.0);
+  double CoulombWeight = 1.0;
+
+  double Qinv = fabs(pair->qInv());   // note - qInv() will be negative for identical pairs...
+  if ((Qinv < fQinvNormHi) && (Qinv > fQinvNormLo)) fNumMixedNorm++;
+  double qOut = fabs(pair->qOutCMS());
+  double qSide = fabs(pair->qSideCMS());
+  double qLong = fabs(pair->qLongCMS());
+
+  fDenominator->Fill(qOut,qSide,qLong,CoulombWeight);
+  //  fUncorrectedDenominator->Fill(qOut,qSide,qLong,1.0);
+  fQinvHisto->Fill(qOut,qSide,qLong,Qinv);
+
+  /*
+  // now for the momentum resolution stuff...
+  if (fSmearPair){
+      double CorrWeight =  1.0 + 
+      fLambda*exp((-qOut*qOut*fRout2 -qSide*qSide*fRside2 -qLong*qLong*fRlong2)/0.038936366329);
+    CorrWeight *= CoulombWeight;  // impt.
+
+    fIDNumHisto->Fill(qOut,qSide,qLong,CorrWeight);
+    fIDDenHisto->Fill(qOut,qSide,qLong,CoulombWeight);
+
+    fSmearPair->SetUnsmearedPair(pair);
+    double qOut_prime = fabs(fSmearPair->SmearedPair().qOutCMS());
+    double qSide_prime = fabs(fSmearPair->SmearedPair().qSideCMS());
+    double qLong_prime = fabs(fSmearPair->SmearedPair().qLongCMS());
+
+    fSMNumHisto->Fill(qOut_prime,qSide_prime,qLong_prime,CorrWeight);
+
+    double SmearedCoulombWeight = ( fCorrection ? 
+                                   fCorrection->CoulombCorrect(&(fSmearPair->SmearedPair())) : 
+                                   1.0);
+
+    fSMDenHisto->Fill(qOut_prime,qSide_prime,qLong_prime,SmearedCoulombWeight);
+  }
+  */
+}
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.h b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.h
new file mode 100644 (file)
index 0000000..c37919f
--- /dev/null
@@ -0,0 +1,149 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   This one does 3D Bertsch-Pratt decomposition in the LCMS frame
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.5  2002/06/07 22:51:39  lisa
+ * Widely used AliFemtoBPLCMS3DCorrFctn class now accumulates UNcorrected denominator and has a WriteOutHistos method
+ *
+ * Revision 1.4  2001/05/23 00:19:04  lisa
+ * Add in Smearing classes and methods needed for momentum resolution studies and correction
+ *
+ * Revision 1.3  2000/10/26 19:48:50  rcwells
+ * Added functionality for Coulomb correction of <qInv> in 3D correltions
+ *
+ * Revision 1.2  2000/09/14 18:36:53  lisa
+ * Added Qinv and ExitSep pair cuts and AliFemtoBPLCMS3DCorrFctn_SIM CorrFctn
+ *
+ * Revision 1.1  2000/08/17 20:48:39  lisa
+ * Adding correlationfunction in LCMS frame
+ *
+ *
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoBPLCMS3DCorrFctn_hh
+#define AliFemtoBPLCMS3DCorrFctn_hh
+
+#include "Base/AliFemtoCorrFctn.h"
+//#include "Infrastructure/AliFemtoCoulomb.h"
+#include "Base/AliFemtoPairCut.h"
+//#include "Infrastructure/AliFemtoHisto.h"
+#include "TH3D.h"
+//#include "Infrastructure/AliFemtoSmearPair.h"
+
+class AliFemtoBPLCMS3DCorrFctn : public AliFemtoCorrFctn {
+public:
+  AliFemtoBPLCMS3DCorrFctn(char* title, const int& nbins, const float& QLo, const float& QHi);
+  virtual ~AliFemtoBPLCMS3DCorrFctn();
+
+  virtual AliFemtoString Report();
+  virtual void AddRealPair(const AliFemtoPair*);
+  virtual void AddMixedPair(const AliFemtoPair*);
+
+  virtual void Finish();
+
+  TH3D* Numerator();
+  TH3D* Denominator();
+  TH3D* Ratio();
+  TH3D* QinvHisto();
+
+  // here are get and set for the range over which the correlation function 
+  // is normalized (in Qinv).  The range is set to 0.15..0.18 in the constuctor
+  // by default, but the Set's below override this
+  void SetNormRangeLo(float qLo);
+  void SetNormRangeHi(float qHi);
+  float GetNormRangeLo();
+  float GetNormRangeHi();
+
+  void WriteOutHistos();
+
+  //  void SetCoulombCorrection(AliFemtoCoulomb* Correction);
+
+  void SetSpecificPairCut(AliFemtoPairCut*);
+
+  //  void SetSmearPair(AliFemtoSmearPair*);
+  void SetRout(double guess);
+  void SetRside(double guess);
+  void SetRlong(double guess);
+  void SetLambda(double guess);
+
+
+  // here are a whole bunch of histos that get filled if we do resolution correction
+  TH3D* fIDNumHisto;
+  TH3D* fIDDenHisto;
+  TH3D* fIDRatHisto;
+  //
+  TH3D* fSMNumHisto;
+  TH3D* fSMDenHisto;
+  TH3D* fSMRatHisto;
+  //
+  TH3D* fCorrectionHisto;
+  TH3D* fCorrCFHisto;
+
+
+
+
+private:
+  TH3D* fNumerator;
+  TH3D* fDenominator;
+  //  TH3D* fUncorrectedDenominator;
+  TH3D* fRatio;
+  TH3D* fQinvHisto;
+
+  // for resolution correction
+  //  AliFemtoSmearPair* fSmearPair; //!
+  double fLambda;
+  double fRout2;
+  double fRside2;
+  double fRlong2;
+
+  AliFemtoPairCut* fPairCut;    //! this is a PairCut specific to THIS CorrFctn, not the Analysis
+
+  // upper and lower bounds of Qinv region where to do normalization
+  float fQinvNormLo;
+  float fQinvNormHi;
+
+  // and here are the number of pairs in that region...
+  unsigned long int fNumRealsNorm;
+  unsigned long int fNumMixedNorm;
+
+  //  AliFemtoCoulomb* fCorrection; //!
+
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoBPLCMS3DCorrFctn, 1)
+#endif
+};
+
+inline  TH3D* AliFemtoBPLCMS3DCorrFctn::Numerator(){return fNumerator;}
+inline  TH3D* AliFemtoBPLCMS3DCorrFctn::Denominator(){return fDenominator;}
+//inline  TH3D* AliFemtoBPLCMS3DCorrFctn::UncorrectedDenominator(){return fUncorrectedDenominator;}
+inline  TH3D* AliFemtoBPLCMS3DCorrFctn::Ratio(){return fRatio;}
+inline  TH3D* AliFemtoBPLCMS3DCorrFctn::QinvHisto(){return fQinvHisto;}
+inline  void AliFemtoBPLCMS3DCorrFctn::SetNormRangeLo(float qLo){fQinvNormLo = qLo;}
+inline  void AliFemtoBPLCMS3DCorrFctn::SetNormRangeHi(float qHi){fQinvNormHi = qHi;}
+inline  float AliFemtoBPLCMS3DCorrFctn::GetNormRangeLo(){return fQinvNormLo;}
+inline  float AliFemtoBPLCMS3DCorrFctn::GetNormRangeHi(){return fQinvNormHi;}
+//inline  void AliFemtoBPLCMS3DCorrFctn::SetCoulombCorrection(AliFemtoCoulomb* Correction){fCorrection = Correction;}
+inline  void AliFemtoBPLCMS3DCorrFctn::SetSpecificPairCut(AliFemtoPairCut* pc){fPairCut=pc;}
+//inline  void AliFemtoBPLCMS3DCorrFctn::SetSmearPair(AliFemtoSmearPair* sp){fSmearPair = sp;}
+
+inline  void AliFemtoBPLCMS3DCorrFctn::SetRout(double r){fRout2 = r*r;}
+inline  void AliFemtoBPLCMS3DCorrFctn::SetRside(double r){fRside2 = r*r;}
+inline  void AliFemtoBPLCMS3DCorrFctn::SetRlong(double r){fRlong2 = r*r;}
+inline  void AliFemtoBPLCMS3DCorrFctn::SetLambda(double l){fLambda = l;}
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.cxx b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.cxx
new file mode 100644 (file)
index 0000000..6b5eaea
--- /dev/null
@@ -0,0 +1,125 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   a simple Q-invariant correlation function           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.4  2000/01/25 17:34:45  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.3  1999/07/29 02:47:09  lisa
+ * 1) add OpeningAngle correlation function 2) add AliFemtoMcEventReader 3) make histos in CorrFctns do errors correctly
+ *
+ * Revision 1.2  1999/07/06 22:33:20  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#include "CorrFctn/AliFemtoQinvCorrFctn.h"
+//#include "Infrastructure/AliFemtoHisto.h"
+#include <cstdio>
+
+#ifdef __ROOT__ 
+ClassImp(AliFemtoQinvCorrFctn)
+#endif
+
+//____________________________
+AliFemtoQinvCorrFctn::AliFemtoQinvCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi){
+  // set up numerator
+  //  title = "Num Qinv (MeV/c)";
+  char TitNum[100] = "Num";
+  strcat(TitNum,title);
+  fNumerator = new TH1D(TitNum,title,nbins,QinvLo,QinvHi);
+  // set up denominator
+  //title = "Den Qinv (MeV/c)";
+  char TitDen[100] = "Den";
+  strcat(TitDen,title);
+  fDenominator = new TH1D(TitDen,title,nbins,QinvLo,QinvHi);
+  // set up ratio
+  //title = "Ratio Qinv (MeV/c)";
+  char TitRat[100] = "Rat";
+  strcat(TitRat,title);
+  fRatio = new TH1D(TitRat,title,nbins,QinvLo,QinvHi);
+  // this next bit is unfortunately needed so that we can have many histos of same "title"
+  // it is neccessary if we typedef TH1D to TH1d (which we do)
+  //fNumerator->SetDirectory(0);
+  //fDenominator->SetDirectory(0);
+  //fRatio->SetDirectory(0);
+
+  // to enable error bar calculation...
+  fNumerator->Sumw2();
+  fDenominator->Sumw2();
+  fRatio->Sumw2();
+
+}
+
+//____________________________
+AliFemtoQinvCorrFctn::~AliFemtoQinvCorrFctn(){
+  delete fNumerator;
+  delete fDenominator;
+  delete fRatio;
+}
+//_________________________
+void AliFemtoQinvCorrFctn::Finish(){
+  // here is where we should normalize, fit, etc...
+  // we should NOT Draw() the histos (as I had done it below),
+  // since we want to insulate ourselves from root at this level
+  // of the code.  Do it instead at root command line with browser.
+  //  fNumerator->Draw();
+  //fDenominator->Draw();
+  //fRatio->Draw();
+  fRatio->Divide(fNumerator,fDenominator,1.0,1.0);
+
+}
+
+//____________________________
+AliFemtoString AliFemtoQinvCorrFctn::Report(){
+  string stemp = "Qinv Correlation Function Report:\n";
+  char ctemp[100];
+  sprintf(ctemp,"Number of entries in numerator:\t%E\n",fNumerator->GetEntries());
+  stemp += ctemp;
+  sprintf(ctemp,"Number of entries in denominator:\t%E\n",fDenominator->GetEntries());
+  stemp += ctemp;
+  sprintf(ctemp,"Number of entries in ratio:\t%E\n",fRatio->GetEntries());
+  stemp += ctemp;
+  //  stemp += mCoulombWeight->Report();
+  AliFemtoString returnThis = stemp;
+  return returnThis;
+}
+//____________________________
+void AliFemtoQinvCorrFctn::AddRealPair(const AliFemtoPair* pair){
+  double Qinv = fabs(pair->qInv());   // note - qInv() will be negative for identical pairs...
+  fNumerator->Fill(Qinv);
+  //  cout << "AliFemtoQinvCorrFctn::AddRealPair : " << pair->qInv() << " " << Qinv <<
+  //" " << pair->track1().FourMomentum() << " " << pair->track2().FourMomentum() << endl;
+}
+//____________________________
+void AliFemtoQinvCorrFctn::AddMixedPair(const AliFemtoPair* pair){
+  double weight = 1.0;
+  double Qinv = fabs(pair->qInv());   // note - qInv() will be negative for identical pairs...
+  fDenominator->Fill(Qinv,weight);
+}
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.h b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.h
new file mode 100644 (file)
index 0000000..34dd0da
--- /dev/null
@@ -0,0 +1,74 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   a simple Q-invariant correlation function           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.3  2000/01/25 17:34:45  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.2  1999/07/06 22:33:20  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoQinvCorrFctn_hh
+#define AliFemtoQinvCorrFctn_hh
+
+#include "TH1D.h"
+#include "Base/AliFemtoCorrFctn.h"
+
+class AliFemtoQinvCorrFctn : public AliFemtoCorrFctn {
+public:
+  AliFemtoQinvCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi);
+  virtual ~AliFemtoQinvCorrFctn();
+
+  virtual AliFemtoString Report();
+  virtual void AddRealPair(const AliFemtoPair*);
+  virtual void AddMixedPair(const AliFemtoPair*);
+
+  virtual void Finish();
+
+  TH1D* Numerator();
+  TH1D* Denominator();
+  TH1D* Ratio();
+
+private:
+  TH1D* fNumerator;
+  TH1D* fDenominator;
+  TH1D* fRatio;
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoQinvCorrFctn, 1)
+#endif
+};
+
+inline  TH1D* AliFemtoQinvCorrFctn::Numerator(){return fNumerator;}
+inline  TH1D* AliFemtoQinvCorrFctn::Denominator(){return fDenominator;}
+inline  TH1D* AliFemtoQinvCorrFctn::Ratio(){return fRatio;}
+
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.cxx b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.cxx
new file mode 100644 (file)
index 0000000..0e22b4e
--- /dev/null
@@ -0,0 +1,106 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   A simple event-wise cut that selects on multiplicity and z-position
+ *   of primary vertex           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.7  2000/02/18 21:27:10  laue
+ * franksTrackCut changed. If mCharge is set to '0' there will be no cut
+ * on charge. This is important for front-loaded cuts.
+ *
+ * Revision 1.6  2000/01/25 17:35:02  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.5  1999/10/15 01:57:03  lisa
+ * Important enhancement of AliFemtoMaker - implement Franks CutMonitors
+ * ----------------------------------------------------------
+ * This means 3 new files in Infrastructure area (CutMonitor),
+ * several specific CutMonitor classes in the Cut area
+ * and a new base class in the Base area (AliFemtoCutMonitor).
+ * This means also changing all Cut Base class header files from .h to .h
+ * so we have access to CutMonitor methods from Cint command line.
+ * This last means
+ * 1) files which include these header files are slightly modified
+ * 2) a side benefit: the TrackCuts and V0Cuts no longer need
+ * a SetMass() implementation in each Cut class, which was stupid.
+ * Also:
+ * -----
+ * Include Franks AliFemtoAssociationReader
+ * ** None of these changes should affect any user **
+ *
+ * Revision 1.4  1999/07/24 16:24:20  lisa
+ * adapt AliFemtoMaker to dev version of library - solaris still gives problems with strings
+ *
+ * Revision 1.3  1999/07/19 14:24:04  hardtke
+ * modifications to implement uDST
+ *
+ * Revision 1.2  1999/07/06 22:33:21  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:56  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#include "Cut/AliFemtoBasicEventCut.h"
+#include <cstdio>
+
+#ifdef __ROOT__
+ClassImp(AliFemtoBasicEventCut)
+#endif
+
+AliFemtoBasicEventCut::AliFemtoBasicEventCut(){
+  fNEventsPassed =  fNEventsFailed = 0;
+} 
+//------------------------------
+//AliFemtoBasicEventCut::~AliFemtoBasicEventCut(){
+//  /* noop */
+//}
+//------------------------------
+bool AliFemtoBasicEventCut::Pass(const AliFemtoEvent* event){
+  int mult =  event->NumberOfTracks();
+  double VertexZPos = event->PrimVertPos().z();
+  cout << "AliFemtoBasicEventCut:: mult:       " << fEventMult[0] << " < " << mult << " < " << fEventMult[1] << endl;
+  cout << "AliFemtoBasicEventCut:: VertexZPos: " << fVertZPos[0] << " < " << VertexZPos << " < " << fVertZPos[1] << endl;
+  bool goodEvent =
+    ((mult > fEventMult[0]) && 
+     (mult < fEventMult[1]) && 
+     (VertexZPos > fVertZPos[0]) &&
+     (VertexZPos < fVertZPos[1]));
+  goodEvent ? fNEventsPassed++ : fNEventsFailed++ ;
+  cout << "AliFemtoBasicEventCut:: return : " << goodEvent << endl;
+  return (goodEvent);
+}
+//------------------------------
+AliFemtoString AliFemtoBasicEventCut::Report(){
+  string Stemp;
+  char Ctemp[100];
+  sprintf(Ctemp,"\nMultiplicity:\t %d-%d",fEventMult[0],fEventMult[1]);
+  Stemp = Ctemp;
+  sprintf(Ctemp,"\nVertex Z-position:\t %E-%E",fVertZPos[0],fVertZPos[1]);
+  Stemp += Ctemp;
+  sprintf(Ctemp,"\nNumber of events which passed:\t%ld  Number which failed:\t%ld",fNEventsPassed,fNEventsFailed);
+  Stemp += Ctemp;
+  AliFemtoString returnThis = Stemp;
+  return returnThis;
+}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.h b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.h
new file mode 100644 (file)
index 0000000..3fb25ab
--- /dev/null
@@ -0,0 +1,115 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   A simple event-wise cut that selects on multiplicity and z-position
+ *   of primary vertex           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.5  2000/03/23 22:57:28  laue
+ * Clone() function implemented
+ *
+ * Revision 1.4  2000/01/25 17:35:02  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.3  1999/10/15 01:57:04  lisa
+ * Important enhancement of AliFemtoMaker - implement Franks CutMonitors
+ * ----------------------------------------------------------
+ * This means 3 new files in Infrastructure area (CutMonitor),
+ * several specific CutMonitor classes in the Cut area
+ * and a new base class in the Base area (AliFemtoCutMonitor).
+ * This means also changing all Cut Base class header files from .h to .h
+ * so we have access to CutMonitor methods from Cint command line.
+ * This last means
+ * 1) files which include these header files are slightly modified
+ * 2) a side benefit: the TrackCuts and V0Cuts no longer need
+ * a SetMass() implementation in each Cut class, which was stupid.
+ * Also:
+ * -----
+ * Include Franks AliFemtoAssociationReader
+ * ** None of these changes should affect any user **
+ *
+ * Revision 1.2  1999/07/06 22:33:21  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:56  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoBasicEventCut_hh
+#define AliFemtoBasicEventCut_hh
+
+// do I need these lines ?
+//#ifndef StMaker_H
+//#include "StMaker.h"
+//#endif
+
+#include "Base/AliFemtoEventCut.h"
+
+class AliFemtoBasicEventCut : public AliFemtoEventCut {
+
+public:
+
+  AliFemtoBasicEventCut();
+  AliFemtoBasicEventCut(AliFemtoBasicEventCut&);
+  //~AliFemtoBasicEventCut();
+
+  void SetEventMult(const int& lo,const int& hi);
+  void SetVertZPos(const float& lo, const float& hi);
+  int NEventsPassed();
+  int NEventsFailed();
+
+  virtual AliFemtoString Report();
+  virtual bool Pass(const AliFemtoEvent*);
+
+  AliFemtoBasicEventCut* Clone();
+
+private:   // here are the quantities I want to cut on...
+
+  int fEventMult[2];      // range of multiplicity
+  float fVertZPos[2];     // range of z-position of vertex
+
+  long fNEventsPassed;
+  long fNEventsFailed;
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoBasicEventCut, 1)
+#endif
+
+};
+
+inline void AliFemtoBasicEventCut::SetEventMult(const int& lo, const int& hi){fEventMult[0]=lo; fEventMult[1]=hi;}
+inline void AliFemtoBasicEventCut::SetVertZPos(const float& lo, const float& hi){fVertZPos[0]=lo; fVertZPos[1]=hi;}
+inline int  AliFemtoBasicEventCut::NEventsPassed() {return fNEventsPassed;}
+inline int  AliFemtoBasicEventCut::NEventsFailed() {return fNEventsFailed;}
+inline AliFemtoBasicEventCut* AliFemtoBasicEventCut::Clone() { AliFemtoBasicEventCut* c = new AliFemtoBasicEventCut(*this); return c;}
+inline AliFemtoBasicEventCut::AliFemtoBasicEventCut(AliFemtoBasicEventCut& c) : AliFemtoEventCut(c) {
+  fEventMult[0] = c.fEventMult[0];
+  fEventMult[1] = c.fEventMult[1];
+  fVertZPos[0] = c.fVertZPos[0];
+  fVertZPos[1] = c.fVertZPos[1];
+  fNEventsPassed = 0;
+  fNEventsFailed = 0;
+}
+
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicTrackCut.cxx b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicTrackCut.cxx
new file mode 100644 (file)
index 0000000..c342cd8
--- /dev/null
@@ -0,0 +1,134 @@
+/***************************************************************************
+ *
+ * $Id: 
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *    a simple particle cut that selects on phasespace, #hits, DCA, and PID          
+ *
+ ***************************************************************************
+ *
+ * $Log:
+ **************************************************************************/
+
+#include "Cut/AliFemtoBasicTrackCut.h"
+#include <cstdio>
+
+#ifdef __ROOT__ 
+ClassImp(AliFemtoBasicTrackCut)
+#endif
+
+AliFemtoBasicTrackCut::AliFemtoBasicTrackCut(){
+  fNTracksPassed = fNTracksFailed = 0;
+  fCharge = 1;  // takes both charges 0
+  fNSigmaPion[0] = -100.0;   fNSigmaPion[1] = 100.0;
+  fNSigmaKaon[0] = -100.0;   fNSigmaKaon[1] = 100.0;
+  fNSigmaProton[0] = -100.0; fNSigmaProton[1] = 100.0;
+  fNHits[0] = 10;          fNHits[1] = 180;
+  fPt[0]=0.0;              fPt[1] = 100.0;//100
+  fRapidity[0]=-2;       fRapidity[1]=2;//-2 2
+  fDCA[0] = -1.0;           fDCA[1] = 20.0;
+
+}
+//------------------------------
+//AliFemtoBasicTrackCut::~AliFemtoBasicTrackCut(){
+//  /* noop */
+//}
+//------------------------------
+bool AliFemtoBasicTrackCut::Pass(const AliFemtoTrack* track){
+
+
+  //  return true ;  // THIS CUT IS A STHBTDUMMY!!
+
+  /*
+    cout << endl;
+    cout << "#track " << trackCount++;
+    cout << " * pion " << (track->NSigmaPion() > fNSigmaPion[0]) && (track->NSigmaPion() < fNSigmaPion[1]);
+    cout << " * kaon " << (track->NSigmaKaon() > fNSigmaKaon[0]) && (track->NSigmaKaon() < fNSigmaKaon[1]);
+    cout << " * proton " << (track->NSigmaProton() > fNSigmaProton[0]) && (track->NSigmaProton() < fNSigmaProton[1]);
+    cout << " * charge " << (track->Charge() == fCharge);
+  */
+  bool goodPID = 1;  
+  /* ----- NOT DOING PID CUTS !!!! ------
+  bool goodPID = ((track->NSigmaPion()   > fNSigmaPion[0]) &&
+                  (track->NSigmaPion()   < fNSigmaPion[1]) &&
+                  (track->NSigmaKaon()   > fNSigmaKaon[0]) &&
+                  (track->NSigmaKaon()   < fNSigmaKaon[1]) &&
+                  (track->NSigmaProton() > fNSigmaProton[0]) &&
+                  (track->NSigmaProton() < fNSigmaProton[1]));
+  ----- NOT DOING PID CUTS !!!! ------ */
+  if (fCharge !=0){               // if user requests "charge=0" then that means ignore charge
+    goodPID = (goodPID&&(track->Charge() == fCharge));
+  }
+  if (goodPID){
+    float TEnergy = ::sqrt(track->P().mag2()+fMass*fMass);
+    float TRapidity = 0.5*::log((TEnergy+track->P().z())/
+                           (TEnergy-track->P().z()));
+
+    float Pt = ::sqrt((track->P().x())*(track->P().x())+
+                    (track->P().y())*(track->P().y()));
+
+    
+    /*
+      cout << " * DCAxy " << (track->DCAxy()  > fDCA[0]) && (track->DCAxy()  < fDCA[1]);
+      cout << " * fDCA[0] " << fDCA[0];
+      cout << " * fDCA[1] " << fDCA[1];
+      cout << " * track->DCAxy " << track->DCAxy();
+      cout << " * NHits " <<  (track->NHits() > fNHits[0]) && (track->NHits() < fNHits[1]); 
+      cout << " * Pt " << (Pt > fPt[0]) && (Pt < fPt[1]);
+      cout << " * y " << (TRapidity > fRapidity[0]) && (TRapidity < fRapidity[1]);
+      cout << endl;
+    */
+
+    bool goodTrack=
+      (//(track->DCAxy()  > fDCA[0]) &&
+     //  (track->DCAxy()  < fDCA[1]) &&
+  //     (track->NHits() > fNHits[0]) &&
+    //   (track->NHits() < fNHits[1]) &&
+       (Pt             > fPt[0]) &&
+       (Pt             < fPt[1]) &&
+       (TRapidity      > fRapidity[0]) &&
+       (TRapidity      < fRapidity[1]))&&
+       (track->PidProbPion()>0.5)&&//moje
+       (track->PidProbMuon()<0.47)&&//moje
+       (track->Label()>0);//moje
+
+    //    cout << track->DCAxy() << " " << track->NHits() << " " << Pt << " " << TRapidity << " " << TEnergy << endl;
+
+    goodTrack ? fNTracksPassed++ : fNTracksFailed++;
+    return (goodTrack);
+  }
+  else{
+    fNTracksFailed++;
+    return (goodPID);
+  }
+}
+//------------------------------
+AliFemtoString AliFemtoBasicTrackCut::Report(){
+  string Stemp;
+  char Ctemp[100];
+  sprintf(Ctemp,"Particle mass:\t%E\n",this->Mass());
+  Stemp=Ctemp;
+  sprintf(Ctemp,"Particle charge:\t%d\n",fCharge);
+  Stemp=Ctemp;
+  sprintf(Ctemp,"Particle Nsigma from pion:\t%E - %E\n",fNSigmaPion[0],fNSigmaPion[1]);
+  Stemp+=Ctemp;
+  sprintf(Ctemp,"Particle Nsigma from kaon:\t%E - %E\n",fNSigmaKaon[0],fNSigmaKaon[1]);
+  Stemp+=Ctemp;
+  sprintf(Ctemp,"Particle Nsigma from proton:\t%E - %E\n",fNSigmaProton[0],fNSigmaProton[1]);
+  Stemp+=Ctemp;
+  sprintf(Ctemp,"Particle #hits:\t%d - %d\n",fNHits[0],fNHits[1]);
+  Stemp+=Ctemp;
+  sprintf(Ctemp,"Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
+  Stemp+=Ctemp;
+  sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
+  Stemp+=Ctemp;
+  sprintf(Ctemp,"Particle DCA:\t%E - %E\n",fDCA[0],fDCA[1]);
+  Stemp+=Ctemp;
+  sprintf(Ctemp,"Number of tracks which passed:\t%ld  Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
+  Stemp += Ctemp;
+  AliFemtoString returnThis = Stemp;
+  return returnThis;
+}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicTrackCut.h b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicTrackCut.h
new file mode 100644 (file)
index 0000000..a166626
--- /dev/null
@@ -0,0 +1,78 @@
+/***************************************************************************
+ *
+ * $Id:
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *    a simple particle cut that selects on phasespace, #hits, DCA, and PID          
+ *
+ ***************************************************************************
+ *
+ * $Log:
+ **************************************************************************/
+
+#ifndef AliFemtoBasicTrackCut_hh
+#define AliFemtoBasicTrackCut_hh
+
+//#ifndef StMaker_H
+//#include "StMaker.h"
+//#endif
+
+#include "Base/AliFemtoTrackCut.h"
+
+class AliFemtoBasicTrackCut : public AliFemtoTrackCut {
+
+public:
+
+  AliFemtoBasicTrackCut();
+  //~mikesTrackCut();
+
+  virtual bool Pass(const AliFemtoTrack*);
+
+  virtual AliFemtoString Report();
+
+
+  void SetNSigmaPion(const float& lo, const float& hi);
+  void SetNSigmaKaon(const float& lo, const float& hi);
+  void SetNSigmaProton(const float& lo, const float& hi);
+
+  void SetNHits(const int& lo, const int& hi);
+  void SetPt(const float& lo, const float& hi);
+  void SetRapidity(const float& lo, const float& hi);
+  void SetDCA(const float& lo, const float& hi);
+  void SetCharge(const int&);
+
+
+private:   // here are the quantities I want to cut on...
+
+  int               fCharge;
+  float             fNSigmaPion[2];
+  float             fNSigmaKaon[2];
+  float             fNSigmaProton[2];
+  int               fNHits[2];
+  float             fPt[2];
+  float             fRapidity[2];
+  float             fDCA[2];
+
+  long              fNTracksPassed;
+  long              fNTracksFailed;
+
+#ifdef __ROOT__ 
+  ClassDef(AliFemtoBasicTrackCut, 1)
+#endif
+};
+
+
+inline void AliFemtoBasicTrackCut::SetNSigmaPion(const float& lo, const float& hi){fNSigmaPion[0]=lo; fNSigmaPion[1]=hi;}
+inline void AliFemtoBasicTrackCut::SetNSigmaKaon(const float& lo, const float& hi){fNSigmaKaon[0]=lo; fNSigmaKaon[1]=hi;}
+inline void AliFemtoBasicTrackCut::SetNSigmaProton(const float& lo, const float& hi){fNSigmaProton[0]=lo; fNSigmaProton[1]=hi;}
+
+inline void AliFemtoBasicTrackCut::SetNHits(const int& lo, const int& hi){fNHits[0]=lo;fNHits[1]=hi;}
+inline void AliFemtoBasicTrackCut::SetPt(const float& lo, const float& hi){fPt[0]=lo; fPt[1]=hi;}
+inline void AliFemtoBasicTrackCut::SetRapidity(const float& lo,const float& hi){fRapidity[0]=lo; fRapidity[1]=hi;}
+inline void AliFemtoBasicTrackCut::SetDCA(const float& lo,const float& hi){fDCA[0]=lo; fDCA[1]=hi;}
+inline void AliFemtoBasicTrackCut::SetCharge(const int& ch){fCharge = ch;}
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.cxx b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.cxx
new file mode 100644 (file)
index 0000000..84a05e0
--- /dev/null
@@ -0,0 +1,68 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   a do-nothing pair cut that simply says "true" to every pair           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007-03-07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.3  2000/01/25 17:35:02  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.2  1999/07/06 22:33:21  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:56  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#include "Cut/AliFemtoDummyPairCut.h"
+#include <string>
+#include <cstdio>
+
+#ifdef __ROOT__
+ClassImp(AliFemtoDummyPairCut)
+#endif
+
+//__________________
+AliFemtoDummyPairCut::AliFemtoDummyPairCut(){
+  fNPairsPassed = fNPairsFailed = 0;
+}
+//__________________
+//AliFemtoDummyPairCut::~AliFemtoDummyPairCut(){
+//  /* no-op */
+//}
+//__________________
+bool AliFemtoDummyPairCut::Pass(const AliFemtoPair* pair){
+  bool temp = true;
+  temp ? fNPairsPassed++ : fNPairsFailed++;
+  return true;
+}
+//__________________
+AliFemtoString AliFemtoDummyPairCut::Report(){
+  string Stemp = "AliFemtoDummy Pair Cut - total dummy-- always returns true\n";
+  char Ctemp[100];
+  sprintf(Ctemp,"Number of pairs which passed:\t%ld  Number which failed:\t%ld\n",fNPairsPassed,fNPairsFailed);
+  Stemp += Ctemp;
+  AliFemtoString returnThis = Stemp;
+  return returnThis;
+}
+//__________________
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.h b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.h
new file mode 100644 (file)
index 0000000..bf46847
--- /dev/null
@@ -0,0 +1,95 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   a do-nothing pair cut that simply says "true" to every pair           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.5  2000/03/23 22:57:28  laue
+ * Clone() function implemented
+ *
+ * Revision 1.4  2000/01/25 17:35:03  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.3  1999/10/15 01:57:05  lisa
+ * Important enhancement of AliFemtoMaker - implement Franks CutMonitors
+ * ----------------------------------------------------------
+ * This means 3 new files in Infrastructure area (CutMonitor),
+ * several specific CutMonitor classes in the Cut area
+ * and a new base class in the Base area (AliFemtoCutMonitor).
+ * This means also changing all Cut Base class header files from .h to .h
+ * so we have access to CutMonitor methods from Cint command line.
+ * This last means
+ * 1) files which include these header files are slightly modified
+ * 2) a side benefit: the TrackCuts and V0Cuts no longer need
+ * a SetMass() implementation in each Cut class, which was stupid.
+ * Also:
+ * -----
+ * Include Franks AliFemtoAssociationReader
+ * ** None of these changes should affect any user **
+ *
+ * Revision 1.2  1999/07/06 22:33:21  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:56  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+
+#ifndef AliFemtoDummyPairCut_hh
+#define AliFemtoDummyPairCut_hh
+
+// do I need these lines ?
+//#ifndef StMaker_H
+//#include "StMaker.h"
+//#endif
+
+#include "Base/AliFemtoPairCut.h"
+
+class AliFemtoDummyPairCut : public AliFemtoPairCut{
+public:
+  AliFemtoDummyPairCut();
+  AliFemtoDummyPairCut(const AliFemtoDummyPairCut&);
+  //~AliFemtoDummyPairCut();
+
+  virtual bool Pass(const AliFemtoPair*);
+  virtual AliFemtoString Report();
+  AliFemtoDummyPairCut* Clone();
+
+
+private:
+  long fNPairsPassed;
+  long fNPairsFailed;
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoDummyPairCut, 1)
+#endif
+};
+
+inline AliFemtoDummyPairCut::AliFemtoDummyPairCut(const AliFemtoDummyPairCut& c) : AliFemtoPairCut(c) {
+  fNPairsPassed = 0;
+  fNPairsFailed = 0;
+
+}
+inline AliFemtoDummyPairCut* AliFemtoDummyPairCut::Clone() { AliFemtoDummyPairCut* c = new AliFemtoDummyPairCut(*this); return c;}
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoAnalysisCollection.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoAnalysisCollection.h
new file mode 100644 (file)
index 0000000..f12e44e
--- /dev/null
@@ -0,0 +1,48 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *  The AnalysisCollection is pointed to by the Manager, and holds pointers
+ *  to all Analysis objects currently active
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.3  2000/03/17 17:23:05  laue
+ * Roberts new three particle correlations implemented.
+ *
+ * Revision 1.2  2000/02/01 00:33:31  laue
+ * namespaces changed to run on the new Solaris Compiler CC5
+ * since we can use member templates in franks1Histo.h we are doing it
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoAnalysisCollection_hh
+#define AliFemtoAnalysisCollection_hh
+
+
+#include <list>
+#if !defined(ST_NO_NAMESPACES)
+using std::list;
+#endif
+class AliFemtoBaseAnalysis;
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef list<AliFemtoBaseAnalysis*, allocator<AliFemtoBaseAnalysis*> >            AliFemtoAnalysisCollection;
+typedef list<AliFemtoBaseAnalysis*, allocator<AliFemtoBaseAnalysis*> >::iterator  AliFemtoAnalysisIterator;
+#else
+typedef list<AliFemtoBaseAnalysis*>            AliFemtoAnalysisCollection;
+typedef list<AliFemtoBaseAnalysis*>::iterator  AliFemtoAnalysisIterator;
+#endif
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCorrFctnCollection.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCorrFctnCollection.h
new file mode 100644 (file)
index 0000000..fa0a1e2
--- /dev/null
@@ -0,0 +1,45 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   The CorrFctnCollection contains pointers to all Correlation Functions
+ *   that are associated with a particular Analysis object.
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.2  2000/02/01 00:33:32  laue
+ * namespaces changed to run on the new Solaris Compiler CC5
+ * since we can use member templates in franks1Histo.h we are doing it
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoCorrFctnCollection_hh
+#define AliFemtoCorrFctnCollection_hh
+
+
+#include <list>
+#if !defined(ST_NO_NAMESPACES)
+using std::list;
+#endif
+class AliFemtoCorrFctn;
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef list<AliFemtoCorrFctn*, allocator<AliFemtoCorrFctn*> >            AliFemtoCorrFctnCollection;
+typedef list<AliFemtoCorrFctn*, allocator<AliFemtoCorrFctn*> >::iterator  AliFemtoCorrFctnIterator;
+#else
+typedef list<AliFemtoCorrFctn*>            AliFemtoCorrFctnCollection;
+typedef list<AliFemtoCorrFctn*>::iterator  AliFemtoCorrFctnIterator;
+#endif
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.cxx
new file mode 100644 (file)
index 0000000..9978c3e
--- /dev/null
@@ -0,0 +1,457 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Randy Wells, Ohio State, rcwells@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *    This is a Coulomb correction class which
+ *  1. Reads in the dat from a file
+ *  2. Performs a linear interpolation in R and creates any array of interpolations
+ *  3. Interpolates in eta and returns the Coulomb correction to user
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.17  2003/09/02 17:58:32  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.16  2003/02/04 21:10:31  magestro
+ * Cleaned up a couple functions
+ *
+ * Revision 1.15  2003/01/31 19:44:00  magestro
+ * Cleared up simple compiler warnings on i386_linux24
+ *
+ * Revision 1.14  2000/10/26 19:48:54  rcwells
+ * Added functionality for Coulomb correction of <qInv> in 3D correltions
+ *
+ * Revision 1.13  2000/07/16 21:38:22  laue
+ * AliFemtoCoulomb.cxx AliFemtoSectoredAnalysis.cxx : updated for standalone version
+ * AliFemtoV0.cc AliFemtoV0.h : some cast to prevent compiling warnings
+ * AliFemtoParticle.cc AliFemtoParticle.h : pointers mTrack,mV0 initialized to 0
+ * AliFemtoIOBinary.cc : some printouts in #ifdef STHBTDEBUG
+ * AliFemtoEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
+ *                 solution
+ *
+ * Revision 1.12  2000/05/31 20:12:53  rcwells
+ * Modified AliFemtoCoulomb for Id and Log entries
+ *
+ *
+ **************************************************************************/
+
+#include "AliFemtoCoulomb.h"
+//#include "Stiostream.h"
+#include <stdio.h>
+#include <cassert>
+#include "PhysicalConstants.h"
+
+#ifdef __ROOT__
+ClassImp(AliFemtoCoulomb)
+#endif
+
+AliFemtoCoulomb::AliFemtoCoulomb() {
+  fFile = "/afs/rhic/star/hbt/coul/AliFemtoCorrectionFiles/correctionpp.dat";
+  if (!fFile) {
+    cout << " No file, dummy!" << endl;
+    assert(0);
+  }
+  fRadius = -1.0;
+  fZ1Z2 = 1.0; // Default has been set up to be same sign charges
+  cout << "You have 1 default Coulomb correction!" << endl;
+}
+
+AliFemtoCoulomb::AliFemtoCoulomb(const char* readFile, const double& radius, const double& charge) {
+  fFile = readFile;
+  fRadius = radius;
+  CreateLookupTable(fRadius);
+  fZ1Z2 = charge;
+  cout << "You have 1 Coulomb correction!" << endl;
+}
+
+AliFemtoCoulomb::~AliFemtoCoulomb() {
+
+}
+
+void AliFemtoCoulomb::SetRadius(const double& radius) {
+  cout << " AliFemtoCoulomb::setRadius() " << endl;
+  fRadius = radius;
+  CreateLookupTable(fRadius);
+}
+
+double AliFemtoCoulomb::GetRadius() {
+  return (fRadius);
+}
+
+void AliFemtoCoulomb::SetFile(const char* readFile) {
+  cout << " AliFemtoCoulomb::SetFile() " << endl;
+  fFile = readFile;
+  // Create new lookup table since file has changed
+  if (fRadius>0.0) {
+    CreateLookupTable(fRadius);
+  }
+}
+
+void AliFemtoCoulomb::SetChargeProduct(const double& charge) {
+  cout << " AliFemtoCoulomb::SetChargeProduct() " << endl;
+  if ( fZ1Z2!=charge ) { 
+    fZ1Z2 = charge;
+    if ( fZ1Z2>0 ) {
+      fFile = "/afs/rhic/star/hbt/coul/AliFemtoCorrectionFiles/correctionpp.dat";
+    }
+    else {
+      fFile = "/afs/rhic/star/hbt/coul/AliFemtoCorrectionFiles/correctionpm.dat";
+    }
+    CreateLookupTable(fRadius);
+  }
+}
+
+void AliFemtoCoulomb::CreateLookupTable(const double& radius) {
+  cout << " AliFemtoCoulomb::CreateLookupTable() " << endl;
+  // Read radii from fFile
+  // Create array(pair) of linear interpolation between radii
+
+  if (radius<0.0) {
+    cout << " AliFemtoCoulomb::CreateLookupTable -> NEGATIVE RADIUS " << endl;
+    cout << "  call AliFemtoCoulomb::SetRadius(r) with positive r " << endl;
+    cerr << " AliFemtoCoulomb::CreateLookupTable -> NEGATIVE RADIUS " << endl;
+    cerr << "  call AliFemtoCoulomb::SetRadius(r) with positive r " << endl;
+    assert(0);
+  }
+  ifstream mystream(fFile);
+  if (!mystream) {
+    cout << "Could not open file" << endl;
+    assert(0);
+  }
+  else {
+    cout << "Input correction file opened" << endl;
+  }
+
+  static char tempstring[2001];
+  static float radii[2000];
+  static int NRadii = 0;
+  NRadii = 0;
+  if (!mystream.getline(tempstring,2000)) {
+    cout << "Could not read radii from file" << endl;
+    assert(0);
+  }
+  for (unsigned int ii=0; ii<strlen(tempstring); ii++) {
+    while (tempstring[ii]==' ') ii++;
+    sscanf(&tempstring[ii++],"%f",&radii[++NRadii]);
+    while ( tempstring[ii]!=' ' && (ii)<strlen(tempstring) )ii++;
+  }
+  cout << " Read " << NRadii << " radii from file" << endl;
+
+  static double LowRadius = -1.0;
+  static double HighRadius = -1.0;
+  static int LowIndex = 0;
+  LowRadius = -1.0;
+  HighRadius = -1.0;
+  LowIndex = 0;
+  for(int iii=1; iii<=NRadii-1; iii++) { // Loop to one less than #radii
+    if ( radius >= radii[iii] && radius <= radii[iii+1] ) {
+      LowRadius = radii[iii];
+      HighRadius = radii[iii+1];
+      LowIndex = iii;
+    }
+  }
+  if ( (LowRadius < 0.0) || (HighRadius < 0.0) ) {
+    cout << "AliFemtoCoulomb::CreateLookupTable --> Problem interpolating radius" << endl;
+    cout << "  Check range of radii in lookup file...." << endl;
+    cerr << "AliFemtoCoulomb::CreateLookupTable --> Problem interpolating radius" << endl;
+    cerr << "  Check range of radii in lookup file...." << endl;
+    assert(0);
+  }
+
+  static double corr[100];           // array of corrections ... must be > NRadii
+  fNLines = 0;
+  static double tempEta = 0;
+  tempEta = 0;
+  while (mystream >> tempEta) {
+    for (int i=1; i<=NRadii; i++) {
+      mystream >> corr[i];
+    }
+    static double LowCoulomb = 0;
+    static double HighCoulomb = 0;
+    static double nCorr = 0;
+    LowCoulomb = corr[LowIndex];
+    HighCoulomb = corr[LowIndex+1];
+    nCorr = ( (radius-LowRadius)*HighCoulomb+(HighRadius-radius)*LowCoulomb )/(HighRadius-LowRadius);
+      fEta[fNLines] = tempEta;     // Eta
+      fCoulomb[fNLines] = nCorr;   // Interpolated Coulomb correction for radius
+      fNLines++;
+  }
+  mystream.close();
+  cout << "Lookup Table is created with " << fNLines << " points" << endl;
+}
+
+double AliFemtoCoulomb::CoulombCorrect(const double& eta) {
+  // Interpolates in eta
+  if (fRadius < 0.0) {
+    cout << "AliFemtoCoulomb::CoulombCorrect(eta) --> Trying to correct for negative radius!" << endl;
+    cerr << "AliFemtoCoulomb::CoulombCorrect(eta) --> Trying to correct for negative radius!" << endl;
+    assert(0);
+  }
+  static int middle=0;
+  middle=int( (fNLines-1)/2 );
+  if (eta*fEta[middle]<0.0) {
+    cout << "AliFemtoCoulomb::CoulombCorrect(eta) --> eta: " << eta << " has wrong sign for data file! " << endl;
+    cerr << "AliFemtoCoulomb::CoulombCorrect(eta) --> eta: " << eta << " has wrong sign for data file! " << endl;
+    assert(0);
+  }
+
+  static double Corr = 0;
+  Corr = -1.0;
+  
+  if ( (eta>fEta[0]) && (fEta[0]>0.0) ) {
+    Corr = fCoulomb[0];
+    return (Corr);
+  }
+  if ( (eta<fEta[fNLines-1]) && (fEta[fNLines-1]<0.0) ) {
+    Corr = fCoulomb[fNLines-1];
+    return (Corr);
+  }
+  // This is a binary search for the bracketing pair of data points
+  static int high = 0;
+  static int low = 0;
+  static int width = 0;
+  high = fNLines-1;
+  low = 0;
+  width = high-low;
+  middle = int(width/2.0); // Was instantiated above
+  while (middle > 0) {
+    if (fEta[low+middle] < eta) {
+      // eta is in the 1st half
+      high-=middle;
+      width = high-low;
+      middle = int(width/2.0);
+    }
+    else {
+      // eta is in the 2nd half
+      low+=middle;
+      width = high-low;
+      middle = int(width/2.0);
+    }
+  }
+  // Make sure we found the right one
+  if ( (fEta[low] >= eta) && (eta >= fEta[low+1]) ) {
+    static double LowEta = 0;
+    static double HighEta = 0;    
+    static double LowCoulomb = 0;
+    static double HighCoulomb = 0;
+    LowEta = fEta[low];
+    HighEta = fEta[low+1];    
+    LowCoulomb = fCoulomb[low];
+    HighCoulomb = fCoulomb[low+1];
+    //      cout << LowEta << " *** Eta *** " << HighEta << endl;
+    //      cout << LowCoulomb << " *** Coulomb *** " << HighCoulomb << endl;
+    Corr = ( (eta-LowEta)*HighCoulomb+(HighEta-eta)*LowCoulomb )/(HighEta-LowEta);
+  }
+  if (Corr<0.0) {
+    cout << "AliFemtoCoulomb::CoulombCorrect(eta) --> No correction" << endl;
+    cout << "  Check range of eta in file: Input eta  " << eta << endl;
+    cerr << "AliFemtoCoulomb::CoulombCorrect(eta) --> No correction" << endl;
+    cerr << "  Check range of eta in file: Input eta  " << eta << endl;
+    assert(0);
+  } 
+  return (Corr);
+
+}
+
+double AliFemtoCoulomb::CoulombCorrect(const double& eta,
+                               const double& radius) {
+  // Checks radii ... input radius and fRadius
+  // Calls createLookupTable if neccessary
+  // Interpolate(linear) between etas in the created lookup table
+
+  if (radius < 0.0) {
+    if (fRadius < 0.0) {
+      // Both radii are negative
+      cout << "AliFemtoCoulomb::CoulombCorrect(eta,r) --> input and member radii are negative!" << endl;
+      cerr << "AliFemtoCoulomb::CoulombCorrect(eta,r) --> input and member radii are negative!" << endl;
+      assert(0);
+    }
+  }
+  else {
+    // radius > 0.0
+    if (radius == fRadius) {
+      // Both radii are positive and equal
+      //      cout << "Radii are the same!!!" << endl;
+    }
+    else {
+      // Both radii are positive but not equal
+      fRadius = radius;
+      CreateLookupTable(fRadius);
+    }
+  }
+
+  // Interpolate in eta
+  return ( CoulombCorrect(eta) );
+}
+
+double AliFemtoCoulomb::CoulombCorrect(const AliFemtoPair* pair) {
+  return ( CoulombCorrect( Eta(pair) ) );;
+}
+
+double AliFemtoCoulomb::CoulombCorrect(const AliFemtoPair* pair, const double& radius) {
+  return ( CoulombCorrect( Eta(pair),radius ) );
+}
+
+double AliFemtoCoulomb::Eta(const AliFemtoPair* pair) {
+  static double px1,py1,pz1,px2,py2,pz2;
+  static double px1new,py1new,pz1new;
+  static double px2new,py2new,pz2new;
+  static double vx1cms,vy1cms,vz1cms;
+  static double vx2cms,vy2cms,vz2cms;
+  static double VcmsX,VcmsY,VcmsZ;
+  static double dv = 0.0;
+  static double e1,e2,e1new,e2new;
+  static double psi,theta;
+  static double beta,gamma;
+  static double VcmsXnew;
+
+  px1 = pair->track1()->FourMomentum().px();
+  py1 = pair->track1()->FourMomentum().py();
+  pz1 = pair->track1()->FourMomentum().pz();
+  e1 = pair->track1()->FourMomentum().e();
+  px2 = pair->track2()->FourMomentum().px();
+  py2 = pair->track2()->FourMomentum().py();
+  pz2 = pair->track2()->FourMomentum().pz();
+  e2 = pair->track2()->FourMomentum().e();
+  
+  VcmsX = ( px1+px2 )/( e1+e2 );
+  VcmsY = ( py1+py2 )/( e1+e2 );
+  VcmsZ = ( pz1+pz2 )/( e1+e2 );
+  // Rotate Vcms to x-direction
+  psi = atan(VcmsY/VcmsX);
+  VcmsXnew = VcmsX*cos(psi)+VcmsY*sin(psi);
+  VcmsX = VcmsXnew;
+  theta = atan(VcmsZ/VcmsX);
+  VcmsXnew = VcmsX*cos(theta)+VcmsZ*sin(theta);
+  VcmsX = VcmsXnew;
+  // Gamma and Beta
+  beta = VcmsX;
+  gamma = 1.0/::sqrt( 1.0-beta*beta );
+
+  // Rotate p1 and p2 to new frame
+  px1new = px1*cos(psi)+py1*sin(psi);
+  py1new = -px1*sin(psi)+py1*cos(psi);
+  px1 = px1new;
+  px1new = px1*cos(theta)+pz1*sin(theta);
+  pz1new = -px1*sin(theta)+pz1*cos(theta);
+  px1 = px1new;
+  py1 = py1new;
+  pz1 = pz1new;
+
+  px2new = px2*cos(psi)+py2*sin(psi);
+  py2new = -px2*sin(psi)+py2*cos(psi);
+  px2 = px2new;
+  px2new = px2*cos(theta)+pz2*sin(theta);
+  pz2new = -px2*sin(theta)+pz2*cos(theta);
+  px2 = px2new;
+  py2 = py2new;
+  pz2 = pz2new;
+
+  // Lorentz transform the x component and energy
+  e1new = gamma*e1 - gamma*beta*px1;
+  px1new = -gamma*beta*e1 + gamma*px1;
+  e2new = gamma*e2 - gamma*beta*px2;
+  px2new = -gamma*beta*e2 + gamma*px2;
+  px1 = px1new;
+  px2 = px2new;
+
+  // New velocities
+  vx1cms = px1/e1new;
+  vy1cms = py1/e1new;
+  vz1cms = pz1/e1new;
+  vx2cms = px2/e2new;
+  vy2cms = py2/e2new;
+  vz2cms = pz2/e2new;
+
+  // Velocity difference in CMS frame
+  dv = ::sqrt( (vx1cms-vx2cms)*(vx1cms-vx2cms) +
+            (vy1cms-vy2cms)*(vy1cms-vy2cms) +
+            (vz1cms-vz2cms)*(vz1cms-vz2cms) );
+
+  return ( fZ1Z2*fine_structure_const/(dv) );
+}
+
+TH1D* AliFemtoCoulomb::CorrectionHistogram(const double& mass1, const double& mass2, const int& nBins, 
+                                               const double& low, const double& high) {
+  if ( mass1!=mass2 ) {
+    cout << "Masses not equal ... try again.  No histogram created." << endl;
+    assert(0);
+  }
+  TH1D* correction = new TH1D("correction","Coulomb correction",nBins,low,high);
+  const double reducedMass = mass1*mass2/(mass1+mass2);
+  double qInv = low;
+  //double dQinv = (high-low)/( (double)nBins );
+  double eta;
+  for (int ii=1; ii<=nBins; ii++) 
+    {
+      qInv = correction->GetBinCenter(ii);
+      eta = 2.0*fZ1Z2*reducedMass*fine_structure_const/( qInv );
+      CoulombCorrect( eta );
+      correction->Fill( qInv, CoulombCorrect(eta,fRadius) );
+    }
+
+  return (correction);
+}
+
+#ifdef __ROOT__
+TH1D* AliFemtoCoulomb::CorrectionHistogram(const TH1D* histo, const double mass) {
+
+  TH1D* correction = (TH1D*) ((TH1D*)histo)->Clone();
+  correction->Reset();
+  correction->SetDirectory(0);
+  int    nBins = correction->GetXaxis()->GetNbins();
+  const double reducedMass = 0.5*mass;
+  double qInv;
+  double eta;
+  for (int ii=1; ii<=nBins; ii++) 
+    {
+      qInv = correction->GetBinCenter(ii);
+      eta = 2.0*fZ1Z2*reducedMass*fine_structure_const/( qInv );
+      correction->Fill( qInv, CoulombCorrect(eta,fRadius) );
+    }
+
+  return (correction);
+}
+
+TH3D* AliFemtoCoulomb::CorrectionHistogram(const TH3D* histo, const double mass) {
+
+  TH3D* correction = (TH3D*) ((TH3D*)histo)->Clone();
+  correction->Reset();
+  correction->SetDirectory(0);
+  int    nBinsX = correction->GetXaxis()->GetNbins();
+  int    nBinsY = correction->GetYaxis()->GetNbins();
+  int    nBinsZ = correction->GetZaxis()->GetNbins();
+  const double reducedMass = 0.5*mass;
+  double eta;
+  double qInv;
+  int binNumber;
+  for (int ii=1; ii<=nBinsX; ii++) { 
+    for (int iii=1; iii<=nBinsY; iii++) {
+      for (int iv=1; iv<=nBinsZ; iv++) {
+       binNumber = histo->GetBin(ii,iii,iv);
+       qInv = histo->GetBinContent(binNumber);
+       eta = 2.0*fZ1Z2*reducedMass*fine_structure_const/( qInv );
+       correction->SetBinContent(binNumber, CoulombCorrect(eta,fRadius) );
+      }
+    }
+  }
+  return (correction);
+}
+#endif
+
+double AliFemtoCoulomb::CoulombCorrect(const double& mass, const double& charge,
+                                   const double& radius, const double& qInv) {
+  fRadius = radius;
+  fZ1Z2 = charge;
+  const double reducedMass = 0.5*mass; // must be same mass particles
+  double eta = 2.0*fZ1Z2*reducedMass*fine_structure_const/( qInv );
+  return ( CoulombCorrect(eta,fRadius) );
+}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.h
new file mode 100644 (file)
index 0000000..f23e486
--- /dev/null
@@ -0,0 +1,91 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Randy Wells, Ohio State, rcwells@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *    This is a Coulomb correction class which
+ *  1. Reads in the dat from a file
+ *  2. Performs a linear interpolation in R and creates any array of interpolations
+ *  3. Interpolates in eta and returns the Coulomb correction to user
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.12  2000/10/26 19:48:54  rcwells
+ * Added functionality for Coulomb correction of <qInv> in 3D correltions
+ *
+ * Revision 1.11  2000/08/02 01:25:12  lisa
+ * Add Coulomb correction capability to 3D Bertsch-Pratt CorrFctn
+ *
+ * Revision 1.10  2000/07/16 21:38:22  laue
+ * AliFemtoCoulomb.cxx AliFemtoSectoredAnalysis.cxx : updated for standalone version
+ * AliFemtoV0.cc AliFemtoV0.h : some cast to prevent compiling warnings
+ * AliFemtoParticle.cc AliFemtoParticle.h : pointers mTrack,mV0 initialized to 0
+ * AliFemtoIOBinary.cc : some printouts in #ifdef STHBTDEBUG
+ * AliFemtoEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
+ *                 solution
+ *
+ * Revision 1.9  2000/05/31 20:12:53  rcwells
+ * Modified AliFemtoCoulomb for Id and Log entries
+ *
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoCoulomb_HH
+#define AliFemtoCoulomb_HH
+
+#include <stdio.h>
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Infrastructure/AliFemtoPair.h"
+#include "Infrastructure/AliFemtoParticle.h"
+#include "TH1D.h"
+#include "TH3D.h"
+
+class AliFemtoCoulomb {
+
+public:
+  AliFemtoCoulomb();
+  AliFemtoCoulomb(const char *readFile, const double& radius, const double& charge);
+  virtual ~AliFemtoCoulomb();
+
+  void SetRadius(const double& radius);
+  double GetRadius();
+  void SetFile(const char *readFile);
+  void SetChargeProduct(const double& charge);
+
+  // These have different names so eta/Qinv don't confuse the compiler
+  double CoulombCorrect(const double& eta);
+  double CoulombCorrect(const double& eta, const double& radius);
+  double CoulombCorrect(const AliFemtoPair* pair);
+  double CoulombCorrect(const AliFemtoPair* pair, const double& radius);
+  double CoulombCorrect(const double& mass, const double& charge,
+                       const double& radius, const double& qInv);
+  TH1D* CorrectionHistogram(const double& mass1, const double& mass2, const int& nBins, 
+                                   const double& low, const double& high);
+#ifdef __ROOT__
+  TH1D* CorrectionHistogram(const TH1D*, const double);
+  TH3D* CorrectionHistogram(const TH3D*, const double);
+#endif
+private:
+  double Eta(const AliFemtoPair* pair);                // Calculates eta
+  void CreateLookupTable(const double& radius);  // Creates look-up table
+  const char* fFile;                             // File to interpolate corrections from    
+  double fRadius;                                // Radius from previous iteration
+  double fZ1Z2;                                  // Charge product of particles
+  double fEta[1000];                             // interpolated Coulomb correction table
+  double fCoulomb[1000];                         // interpolated Coulomb correction table
+  int fNLines;                                   // Number of Eta's in lookup-table
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoCoulomb, 0)
+#endif
+};
+
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorCollection.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorCollection.h
new file mode 100644 (file)
index 0000000..fd1d947
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef AliFemtoCutMonitorCollection_hh
+#define AliFemtoCutMonitorCollection_hh
+
+
+//#include <list>
+#include <vector>
+#if !defined(ST_NO_NAMESPACES)
+using std::vector;
+#endif
+class AliFemtoCutMonitor;
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef vector<AliFemtoCutMonitor*, allocator<AliFemtoCutMonitor*> >            AliFemtoCutMonitorCollection;
+typedef vector<AliFemtoCutMonitor*, allocator<AliFemtoCutMonitor*> >::iterator  AliFemtoCutMonitorIterator;
+#else
+typedef vector<AliFemtoCutMonitor*>            AliFemtoCutMonitorCollection;
+typedef vector<AliFemtoCutMonitor*>::iterator  AliFemtoCutMonitorIterator;
+#endif
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.cxx
new file mode 100644 (file)
index 0000000..4fb5fb1
--- /dev/null
@@ -0,0 +1,183 @@
+
+#include "Infrastructure/AliFemtoCutMonitorHandler.h"
+#include "Infrastructure/AliFemtoTypes.h"
+
+#ifdef __ROOT__
+ClassImp(AliFemtoCutMonitorHandler)
+#endif
+// ---------------------------------------------------------------------------
+AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler() {
+  cout << " *** AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler() " << endl;
+  fCollectionsEmpty = 0;
+  fPassColl = new AliFemtoCutMonitorCollection();
+  fFailColl = new AliFemtoCutMonitorCollection();
+}
+// ---------------------------------------------------------------------------
+AliFemtoCutMonitorHandler::~AliFemtoCutMonitorHandler() { 
+  delete fPassColl;
+  delete fFailColl;
+}   
+// ---------------------------------------------------------------------------
+void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoEvent* event, bool pass) { 
+  if (fCollectionsEmpty) return;
+  AliFemtoCutMonitorIterator iter;
+  AliFemtoCutMonitor* CM;
+  if ( pass) {
+    for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
+      CM = *iter;
+      CM->Fill(event);
+    }
+  } else {
+    for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
+      CM = *iter;
+      CM->Fill(event);
+    }
+  }
+}
+// ---------------------------------------------------------------------------
+void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoTrack* track, bool pass) { 
+  if (fCollectionsEmpty) return;
+  AliFemtoCutMonitorIterator iter;
+  AliFemtoCutMonitor* CM;
+  if ( pass) {
+    for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
+      CM = *iter;
+      CM->Fill(track);
+    }
+  } else {
+    for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
+      CM = *iter;
+      CM->Fill(track);
+    }
+  }
+}
+// ---------------------------------------------------------------------------
+void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoV0* v0, bool pass) { 
+  if (fCollectionsEmpty) return;
+  AliFemtoCutMonitorIterator iter;
+  AliFemtoCutMonitor* CM;
+  if ( pass) {
+    for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
+      CM = *iter;
+      CM->Fill(v0);
+    }
+  } else {
+    for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
+      CM = *iter;
+      CM->Fill(v0);
+    }
+  }
+}
+// ---------------------------------------------------------------------------
+void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoKink* kink, bool pass) { 
+  if (fCollectionsEmpty) return;
+  AliFemtoCutMonitorIterator iter;
+  AliFemtoCutMonitor* CM;
+  if ( pass) {
+    for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
+      CM = *iter;
+      CM->Fill(kink);
+    }
+  } else {
+    for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
+      CM = *iter;
+      CM->Fill(kink);
+    }
+  }
+}
+// ---------------------------------Gael/12/04/02-----------------------------
+void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoPair* pair, bool pass) { 
+  if (fCollectionsEmpty) return;
+  AliFemtoCutMonitorIterator iter;
+  AliFemtoCutMonitor* CM;
+  if ( pass) {
+    for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
+      CM = *iter;
+      CM->Fill(pair);
+    }
+  } else {
+    for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
+      CM = *iter;
+      CM->Fill(pair);
+    }
+  }
+}
+// ---------------------------------Gael/19/06/02-----------------------------
+void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoParticleCollection* partColl) {
+  if (fCollectionsEmpty) return;
+  AliFemtoCutMonitorIterator iter;
+  AliFemtoCutMonitor* CM;
+  
+  for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
+    CM = *iter;
+    CM->Fill(partColl);
+  }
+}
+// ------------------------------------Gael/19/06/02-------------------------
+void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoEvent* event,const AliFemtoParticleCollection* partColl) {
+  
+  cout<<"In AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoEvent* event, AliFemtoPicoEvent* picoEvent)"<<endl;
+  if (fCollectionsEmpty) return;
+  AliFemtoCutMonitorIterator iter;
+  AliFemtoCutMonitor* CM;
+  
+  for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
+    CM = *iter;
+    CM->Fill(event,partColl);
+  }
+}
+// ---------------------------------------------------------------------------
+void AliFemtoCutMonitorHandler::Finish() { 
+  AliFemtoCutMonitorIterator iter;
+  for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
+    (*iter)->Finish();
+  }
+  for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
+    (*iter)->Finish();
+  }
+}
+// ---------------------------------------------------------------------------
+void AliFemtoCutMonitorHandler::AddCutMonitor(AliFemtoCutMonitor* cutMoni1, AliFemtoCutMonitor* cutMoni2) { 
+  fPassColl->push_back(cutMoni1);
+  fFailColl->push_back(cutMoni2);
+  fCollectionsEmpty=false;
+}
+// ---------------------------------------------------------------------------
+void AliFemtoCutMonitorHandler::AddCutMonitor(AliFemtoCutMonitor* cutMoni) { 
+  cout << " make a copy of the cutmonitor and push both into the collections " << endl;
+  cout << " not yet implemented" << endl;
+  fPassColl->push_back(cutMoni);
+  cout << " only pass collection pushed" << endl;
+  fCollectionsEmpty=false;
+}
+// ---------------------------------------------------------------------------
+void AliFemtoCutMonitorHandler::AddCutMonitorPass(AliFemtoCutMonitor* cutMoni) { 
+  fPassColl->push_back(cutMoni);
+  fCollectionsEmpty=false;
+}
+// ---------------------------------------------------------------------------
+void AliFemtoCutMonitorHandler::AddCutMonitorFail(AliFemtoCutMonitor* cutMoni) { 
+  fFailColl->push_back(cutMoni);
+  fCollectionsEmpty=false;
+}
+// ---------------------------------------------------------------------------
+AliFemtoCutMonitor* AliFemtoCutMonitorHandler::PassMonitor(int n) { 
+  AliFemtoCutMonitorIterator iter = fPassColl->begin();
+  if ( (int)fPassColl->size() <= n ) return NULL;
+  for ( int i=0; i<n; i++)
+    iter++;
+  return *iter;
+}
+// ---------------------------------------------------------------------------
+AliFemtoCutMonitor* AliFemtoCutMonitorHandler::FailMonitor(int n) { 
+  AliFemtoCutMonitorIterator iter = fFailColl->begin();
+  if ( (int)fFailColl->size() <= n ) return NULL;
+  for ( int i=0; i<n; i++)
+    iter++;
+  return *iter;
+}
+
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.h
new file mode 100644 (file)
index 0000000..f48a2bf
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef AliFemtoCutMonitorHandler_hh
+#define AliFemtoCutMonitorHandler_hh
+
+
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Infrastructure/AliFemtoEvent.h"
+#include "Infrastructure/AliFemtoTrack.h"
+#include "Infrastructure/AliFemtoV0.h"
+#include "Infrastructure/AliFemtoKink.h"
+#include "Infrastructure/AliFemtoPair.h" //Gael 12/04/02
+#include "Infrastructure/AliFemtoParticleCollection.h" // Gael 19/06/02
+#include "Infrastructure/AliFemtoCutMonitorCollection.h"
+#include "Base/AliFemtoCutMonitor.h"
+
+class AliFemtoCutMonitorHandler{
+  
+ public:
+  
+  AliFemtoCutMonitorHandler();
+  virtual ~AliFemtoCutMonitorHandler();
+  
+  AliFemtoCutMonitorCollection* PassMonitorColl(); 
+  AliFemtoCutMonitorCollection* FailMonitorColl(); 
+  AliFemtoCutMonitor* PassMonitor(int n); 
+  AliFemtoCutMonitor* FailMonitor(int n); 
+  void AddCutMonitor(AliFemtoCutMonitor* cutMoni1, AliFemtoCutMonitor* cutMoni2); 
+  void AddCutMonitor(AliFemtoCutMonitor* cutMoni); 
+  void AddCutMonitorPass(AliFemtoCutMonitor* cutMoni); 
+  void AddCutMonitorFail(AliFemtoCutMonitor* cutMoni); 
+  void FillCutMonitor(const AliFemtoEvent* event, bool pass); 
+  void FillCutMonitor(const AliFemtoTrack* track, bool pass); 
+  void FillCutMonitor(const AliFemtoV0* v0, bool pass); 
+  void FillCutMonitor(const AliFemtoKink* kink, bool pass);
+  void FillCutMonitor(const AliFemtoPair* pair, bool pass);//Gael 11/04/02
+  void FillCutMonitor(const AliFemtoParticleCollection* partColl);// Gael 19/06/02
+  void FillCutMonitor(const AliFemtoEvent* event, const AliFemtoParticleCollection* partColl);// Gael 19/06/02
+  void Finish();
+  
+ private:
+  bool fCollectionsEmpty;
+  AliFemtoCutMonitorCollection* fPassColl; 
+  AliFemtoCutMonitorCollection* fFailColl; 
+#ifdef __ROOT__  
+  ClassDef(AliFemtoCutMonitorHandler, 0)
+#endif  
+  
+};
+
+inline AliFemtoCutMonitorCollection* AliFemtoCutMonitorHandler::PassMonitorColl() { return fPassColl;}
+inline AliFemtoCutMonitorCollection* AliFemtoCutMonitorHandler::FailMonitorColl() { return fFailColl;}
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEnumeration.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEnumeration.h
new file mode 100644 (file)
index 0000000..1464df7
--- /dev/null
@@ -0,0 +1,42 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Frank Laue, BNL, laue@bnl.gov
+ ***************************************************************************
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.3  2003/01/08 19:43:12  perev
+ * CleanUp
+ *
+ * Revision 1.2  2001/09/05 20:41:42  laue
+ * Updates of the hbtMuDstTree microDSTs
+ *
+ * Revision 1.1  2001/06/21 19:15:45  laue
+ * Modified fiels:
+ *   CTH.h : new constructor added
+ *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
+ *                                   (TTree) classes added
+ *   AliFemtoLikeSignAnalysis : minor changes, for debugging
+ *   AliFemtoTypes: split into different files
+ * Added files: for the new TTree muDst's
+ *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
+ *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
+ *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
+ *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
+ *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
+ *
+ *
+ ***************************************************************************/
+#ifndef AliFemtoEnumeration_hh
+#define AliFemtoEnumeration_hh
+
+enum AliFemtoParticleType {hbtUndefined, hbtTrack, hbtV0, hbtKink, hbtXi};
+enum AliFemtoIOMode {hbtRead, hbtWrite};
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.cxx
new file mode 100644 (file)
index 0000000..e5a3461
--- /dev/null
@@ -0,0 +1,292 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   HbtEvent is the "transient microDST"  Objects of this class are
+ *   generated from the input data by a Reader, and then presented to
+ *   the Cuts of the various active Analyses.
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.2  2007-04-03 16:00:08  mchojnacki
+ * Changes to iprove memory managing
+ *
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.23  2005/08/19 21:19:11  chajecki
+ * line 326: the same change as in line 235
+ *
+ * Revision 1.22  2005/08/19 11:33:31  chajecki
+ * fix due to the last changes in MuDst
+ * line 235: TClonesArray* tracks=0; to TObjArray* tracks=0;
+ * see for more details:
+ * http://www.star.bnl.gov/HyperNews-star/protected/get/starsoft/5949.html
+ *
+ * Revision 1.21  2003/09/02 17:58:32  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.20  2003/01/31 19:43:20  magestro
+ * several casts added to remove compiler warnings
+ *
+ * Revision 1.19  2003/01/17 16:46:58  mercedes
+ * StMuEvent::refMult() added
+ *
+ * Revision 1.18  2002/11/19 23:27:37  renault
+ * New event constructor to find V0 daughters informations(helix for average
+ * separation calculation)
+ *
+ * Revision 1.17  2002/03/21 18:49:31  laue
+ * updated for new MuDst reader
+ *
+ * Revision 1.16  2001/12/06 16:47:13  laue
+ * l3 trigger algorithm added
+ *
+ * Revision 1.15  2001/11/14 21:07:21  lisa
+ * Fixed several small things (mostly discarded const) that caused fatal errors with gcc2.95.3
+ *
+ * Revision 1.14  2001/09/05 20:41:42  laue
+ * Updates of the hbtMuDstTree microDSTs
+ *
+ * Revision 1.13  2001/07/20 20:03:53  rcwells
+ * Added pT weighting and moved event angle cal. to event cut
+ *
+ * Revision 1.12  2001/06/23 21:55:17  laue
+ * AliFemtoCheckPdgIdList can take can not check for mother,particle,daughter
+ * Some output turned off
+ *
+ * Revision 1.11  2001/06/21 19:15:45  laue
+ * Modified fiels:
+ *   CTH.h : new constructor added
+ *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
+ *                                   (TTree) classes added
+ *   AliFemtoLikeSignAnalysis : minor changes, for debugging
+ *   AliFemtoTypes: split into different files
+ * Added files: for the new TTree muDst's
+ *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
+ *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
+ *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
+ *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
+ *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
+ *
+ * Revision 1.10  2001/05/15 15:30:16  rcwells
+ * Added magnetic field to AliFemtoEvent
+ *
+ * Revision 1.9  2000/08/31 22:31:31  laue
+ * AliFemtoAnalysis: output changed (a little bit less)
+ * AliFemtoEvent: new version, members for reference mult added
+ * AliFemtoIOBinary: new IO for new AliFemtoEvent version
+ * AliFemtoTypes: TTree typedef to AliFemtoTTree added
+ * AliFemtoVertexAnalysis: overflow and underflow added
+ *
+ * Revision 1.8  2000/07/16 21:38:22  laue
+ * AliFemtoCoulomb.cxx AliFemtoSectoredAnalysis.cxx : updated for standalone version
+ * AliFemtoV0.cc AliFemtoV0.h : some cast to prevent compiling warnings
+ * AliFemtoParticle.cc AliFemtoParticle.h : pointers mTrack,mV0 initialized to 0
+ * AliFemtoIOBinary.cc : some printouts in #ifdef STHBTDEBUG
+ * AliFemtoEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
+ *                 solution
+ *
+ * Revision 1.7  2000/05/25 21:54:16  laue
+ * RotateZ implemented. Rotates momentum and helix around the z axis
+ *
+ * Revision 1.5  2000/02/18 21:32:23  laue
+ * franksTrackCut changed. If mCharge is set to '0' there will be no cut
+ * on charge. This is important for front-loaded cuts.
+ *
+ * copy constructor implemented for AliFemtoEvent, AliFemtoTrack and AliFemtoV0.
+ *
+ * franks1HistoD.cxx franks1HistoD.h franks2HistoD.cxx franks2HistoD.h
+ * removed. We can now (CC5 on Solaris) use the versions (no D)
+ *
+ * Revision 1.4  1999/09/16 18:47:59  lisa
+ * replace placeholder HbtV0Track stuff with Helens AliFemtoV0 classes
+ *
+ * Revision 1.3  1999/07/27 10:47:04  lisa
+ * now works in dev on linux and solaris - mistake in deleting picoEvents fixed
+ *
+ * Revision 1.2  1999/07/19 14:24:05  hardtke
+ * modifications to implement uDST
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#include "Infrastructure/AliFemtoEvent.h"
+#include "Infrastructure/AliFemtoTrack.h"
+#include "Infrastructure/AliFemtoV0.h"
+#include "Infrastructure/AliFemtoXi.h"
+#include "Infrastructure/AliFemtoKink.h"
+#include "Base/AliFemtoTrackCut.h"
+#include "Base/AliFemtoV0Cut.h"
+#include "Base/AliFemtoXiCut.h"
+#include "Base/AliFemtoKinkCut.h"
+#include "PhysicalConstants.h"
+#include "SystemOfUnits.h"
+
+// Mike removed all of the AliFemtoTTree stuff here 21apr2006 - it was not used for a long time.
+
+
+
+//___________________
+AliFemtoEvent::AliFemtoEvent(){
+  fPrimVertPos[0]=-999.0;
+  fPrimVertPos[1]=-999.0;
+  fPrimVertPos[2]=-999.0;
+  fTrackCollection = new AliFemtoTrackCollection;
+  fV0Collection = new AliFemtoV0Collection;
+  fXiCollection = new AliFemtoXiCollection;
+  fKinkCollection = new AliFemtoKinkCollection;
+  fMagneticField=0.0;
+}
+//___________________
+AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev, AliFemtoTrackCut* tCut, AliFemtoV0Cut* vCut, AliFemtoXiCut* xCut, AliFemtoKinkCut* kCut){ // copy constructor with track and v0 cuts
+  //cout << "AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev, AliFemtoTrackCut* tCut, AliFemtoV0Cut* vCut, AliFemtoV0Cut* kCut)" << endl;
+  fEventNumber = ev.fEventNumber;
+  fRunNumber = ev.fRunNumber;
+  
+  fZDCN1Energy=ev.fZDCN1Energy;     
+  fZDCP1Energy=ev.fZDCP1Energy;      
+  fZDCN2Energy=ev.fZDCN2Energy;      
+  fZDCP2Energy=ev.fZDCP2Energy;      
+  fZDCEMEnergy=ev.fZDCEMEnergy;
+  fZDCParticipants=ev.fZDCParticipants;
+  fNumberOfTracks = ev.fNumberOfTracks;
+  fMagneticField= ev.fMagneticField;
+  
+  fTriggerMask=ev.fTriggerMask;     // Trigger Type (mask)
+  fTriggerCluster=ev.fTriggerCluster;
+  // create collections
+  fTrackCollection = new AliFemtoTrackCollection;
+  fV0Collection = new AliFemtoV0Collection;
+  fXiCollection = new AliFemtoXiCollection;
+  fKinkCollection = new AliFemtoKinkCollection;
+  // copy track collection  
+  for ( AliFemtoTrackIterator tIter=ev.fTrackCollection->begin(); tIter!=ev.fTrackCollection->end(); tIter++) {
+    if ( !tCut || tCut->Pass(*tIter) ) {
+      AliFemtoTrack* trackCopy = new AliFemtoTrack(**tIter);
+      fTrackCollection->push_back(trackCopy);
+    }
+  }
+  // copy v0 collection
+  for ( AliFemtoV0Iterator vIter=ev.fV0Collection->begin(); vIter!=ev.fV0Collection->end(); vIter++) {
+    if ( !vCut || vCut->Pass(*vIter) ) {
+      AliFemtoV0* v0Copy = new AliFemtoV0(**vIter);
+      fV0Collection->push_back(v0Copy);
+    }
+  }
+  // copy xi collection
+  for ( AliFemtoXiIterator xIter=ev.fXiCollection->begin(); xIter!=ev.fXiCollection->end(); xIter++) {
+    if ( !xCut || xCut->Pass(*xIter) ) {
+      AliFemtoXi* xiCopy = new AliFemtoXi(**xIter);
+      fXiCollection->push_back(xiCopy);
+    }
+  }
+  // copy kink collection  
+  for ( AliFemtoKinkIterator kIter=ev.fKinkCollection->begin(); kIter!=ev.fKinkCollection->end(); kIter++) {
+    if ( !kCut || kCut->Pass(*kIter) ) {
+      //cout << " kinkCut passed " << endl;
+      AliFemtoKink* kinkCopy = new AliFemtoKink(**kIter);
+      fKinkCollection->push_back(kinkCopy);
+    }
+  }
+}
+//___________________
+AliFemtoEvent::~AliFemtoEvent(){
+#ifdef STHBTDEBUG
+  cout << " AliFemtoEvent::~AliFemtoEvent() " << endl;
+#endif
+  for (AliFemtoTrackIterator iter=fTrackCollection->begin();iter!=fTrackCollection->end();iter++){
+    delete *iter;
+  }
+  fTrackCollection->clear();
+  delete fTrackCollection;
+  //must do the same for the V0 collection
+  for (AliFemtoV0Iterator V0iter=fV0Collection->begin();V0iter!=fV0Collection->end();V0iter++){
+    delete *V0iter;
+  }//added by M Chojnacki To avodid memory leak 
+  fV0Collection->clear();
+  delete fV0Collection;
+  //must do the same for the Xi collection
+  for (AliFemtoXiIterator XiIter=fXiCollection->begin();XiIter!=fXiCollection->end();XiIter++){
+    delete *XiIter;
+  }
+  fXiCollection->clear();
+  delete fXiCollection;
+  //must do the same for the Kink collection
+  for (AliFemtoKinkIterator kinkIter=fKinkCollection->begin();kinkIter!=fKinkCollection->end();kinkIter++){
+    delete *kinkIter;
+  }
+  fKinkCollection->clear();
+  delete fKinkCollection;
+}
+//___________________
+
+
+
+void AliFemtoEvent::SetEventNumber(const unsigned short& event){fEventNumber = event;}
+void AliFemtoEvent::SetRunNumber(const int& runNum){fRunNumber = runNum;}
+
+
+void AliFemtoEvent::SetZDCN1Energy(const float& ZDCN1Energy){fZDCN1Energy=ZDCN1Energy;}
+void AliFemtoEvent::SetZDCP1Energy(const float& ZDCP1Energy){fZDCP1Energy=ZDCP1Energy;}      
+void AliFemtoEvent::SetZDCN2Energy(const float& ZDCN2Energy){fZDCN2Energy=ZDCN2Energy;}      
+void AliFemtoEvent::SetZDCP2Energy(const float& ZDCP2Energy){fZDCP2Energy=ZDCP2Energy;}      
+void AliFemtoEvent::SetZDCEMEnergy(const float& ZDCEMEnergy){fZDCEMEnergy=ZDCEMEnergy;}    
+void AliFemtoEvent::SetZDCParticipants(const unsigned int& ZDCParticipants){fZDCParticipants=ZDCParticipants;}
+    
+
+void AliFemtoEvent::SetNumberOfTracks(const unsigned short& tracks){fNumberOfTracks = tracks;}
+
+
+
+void AliFemtoEvent::SetPrimVertPos(const AliFemtoThreeVector& vp){fPrimVertPos = vp;}
+void AliFemtoEvent::SetMagneticField(const double& magF){fMagneticField = magF;}
+
+void AliFemtoEvent::SetTriggerMask(const unsigned long int& TriggerMask) {fTriggerMask=TriggerMask;}
+void AliFemtoEvent::SetTriggerCluster(const unsigned char& TriggerCluster) {fTriggerCluster=TriggerCluster;}
+
+
+unsigned short AliFemtoEvent::EventNumber() const {return fEventNumber;}
+int            AliFemtoEvent::RunNumber() const {return fRunNumber;}
+
+
+
+unsigned short AliFemtoEvent::NumberOfTracks() const {return fNumberOfTracks;}
+
+AliFemtoV0Collection* AliFemtoEvent::V0Collection() const {return fV0Collection;}
+AliFemtoXiCollection* AliFemtoEvent::XiCollection() const {return fXiCollection;}
+AliFemtoKinkCollection* AliFemtoEvent::KinkCollection() const {return fKinkCollection;}
+AliFemtoTrackCollection* AliFemtoEvent::TrackCollection() const {return fTrackCollection;}
+AliFemtoThreeVector AliFemtoEvent::PrimVertPos() const {return fPrimVertPos;}
+double AliFemtoEvent::MagneticField() const {return fMagneticField;}
+unsigned long int AliFemtoEvent::TriggerMask() const {return fTriggerMask;}
+unsigned char AliFemtoEvent::TriggerCluster() const {return fTriggerCluster;}
+
+
+float AliFemtoEvent::ZDCN1Energy() const {return fZDCN1Energy;}       
+float AliFemtoEvent::ZDCP1Energy() const {return fZDCP1Energy;}       
+float AliFemtoEvent::ZDCN2Energy() const {return fZDCN2Energy;}       
+float AliFemtoEvent::ZDCP2Energy() const {return fZDCP2Energy;}       
+float AliFemtoEvent::ZDCEMEnergy() const {return fZDCEMEnergy;}   
+unsigned int  AliFemtoEvent::ZDCParticipants() const {return fZDCParticipants;}
+
+//----------------------------- below here is only for star
+
+double AliFemtoEvent::UncorrectedNumberOfNegativePrimaries() const
+{
+  return NumberOfTracks()/2;
+}
+
+double AliFemtoEvent::UncorrectedNumberOfPrimaries() const
+{
+  return NumberOfTracks();
+}
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.h
new file mode 100644 (file)
index 0000000..26b75ab
--- /dev/null
@@ -0,0 +1,198 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   HbtEvent is the "transient microDST"  Objects of this class are
+ *   generated from the input data by a Reader, and then presented to
+ *   the Cuts of the various active Analyses.
+ *
+ ***************************************************************************
+ * Revision 1.21 to use in Alice version 1 Chojnacki  
+ *
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.20  2003/01/17 16:46:22  mercedes
+ * StMuEvent::refMult() added
+ *
+ * Revision 1.19  2002/11/19 23:27:25  renault
+ * New event constructor to find V0 daughters informations(helix for average
+ * separation calculation)
+ *
+ * Revision 1.18  2002/03/21 18:49:31  laue
+ * updated for new MuDst reader
+ *
+ * Revision 1.17  2001/12/06 16:47:13  laue
+ * l3 trigger algorithm added
+ *
+ * Revision 1.14  2001/06/21 19:15:45  laue
+ * Modified fiels:
+ *   CTH.h : new constructor added
+ *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
+ *                                   (TTree) classes added
+ *   AliFemtoLikeSignAnalysis : minor changes, for debugging
+ *   AliFemtoTypes: split into different files
+ * Added files: for the new TTree muDst's
+ *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
+ *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
+ *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
+ *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
+ *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
+ *
+ * Revision 1.13  2001/06/04 19:09:52  rcwells
+ * Adding B-field, run number, and improved reaction plane functionality
+ *
+ * Revision 1.12  2001/05/25 23:23:59  lisa
+ * Added in AliFemtoKink stuff
+ *
+ * Revision 1.11  2001/05/15 15:30:16  rcwells
+ * Added magnetic field to AliFemtoEvent
+ *
+ * Revision 1.10  2000/08/31 22:31:31  laue
+ * AliFemtoAnalysis: output changed (a little bit less)
+ * AliFemtoEvent: new version, members for reference mult added
+ * AliFemtoIOBinary: new IO for new AliFemtoEvent version
+ * AliFemtoTypes: TTree typedef to AliFemtoTTree added
+ * AliFemtoVertexAnalysis: overflow and underflow added
+ *
+ * Revision 1.9  2000/05/25 21:54:16  laue
+ * RotateZ implemented. Rotates momentum and helix around the z axis
+ *
+ * Revision 1.7  2000/02/18 21:32:23  laue
+ * franksTrackCut changed. If mCharge is set to '0' there will be no cut
+ * on charge. This is important for front-loaded cuts.
+ *
+ * copy constructor implemented for AliFemtoEvent, AliFemtoTrack and AliFemtoV0.
+ *
+ * franks1HistoD.cxx franks1HistoD.h franks2HistoD.cxx franks2HistoD.h
+ * removed. We can now (CC5 on Solaris) use the versions (no D)
+ *
+ * Revision 1.6  1999/09/16 18:47:59  lisa
+ * replace placeholder HbtV0Track stuff with Helens AliFemtoV0 classes
+ *
+ * Revision 1.5  1999/09/03 22:39:15  lisa
+ * Readers now MUST have Report() methods and MAY have WriteHbtEvent() methods
+ *
+ * Revision 1.4  1999/07/19 14:24:06  hardtke
+ * modifications to implement uDST
+ *
+ * Revision 1.3  1999/07/06 22:33:22  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.2  1999/06/29 17:50:27  fisyak
+ * formal changes to account new StEvent, does not complie yet
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoEvent_hh
+#define AliFemtoEvent_hh
+
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Infrastructure/AliFemtoTrackCollection.h"
+#include "Infrastructure/AliFemtoV0Collection.h"
+#include "Infrastructure/AliFemtoXiCollection.h"
+#include "Infrastructure/AliFemtoKinkCollection.h"
+
+class AliFemtoTrackCut;
+class AliFemtoV0Cut;
+class AliFemtoXiCut;
+class AliFemtoKinkCut;
+
+
+#ifdef __ROOT__
+
+// the following encapsulation by malisa 21apr2006
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+class StMuDst;
+#endif
+
+#endif
+
+class AliFemtoEvent{
+public:
+  AliFemtoEvent();
+#ifdef __ROOT__
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+//
+#endif
+#endif
+  AliFemtoEvent(const AliFemtoEvent&, AliFemtoTrackCut* =0, AliFemtoV0Cut* =0,  AliFemtoXiCut* =0, AliFemtoKinkCut* =0); // copy constructor with track and v0 cuts
+  ~AliFemtoEvent();
+
+  unsigned short EventNumber() const;
+  int RunNumber() const;
+  unsigned short NumberOfTracks() const;
+  AliFemtoThreeVector PrimVertPos() const;
+  AliFemtoV0Collection* V0Collection() const;
+  AliFemtoXiCollection* XiCollection() const;
+  AliFemtoKinkCollection* KinkCollection() const;
+  AliFemtoTrackCollection* TrackCollection() const;
+  double MagneticField() const;
+
+  //functions for alice variables
+  float ZDCN1Energy() const;      
+  float ZDCP1Energy() const;      
+  float ZDCN2Energy() const;      
+  float ZDCP2Energy() const;      
+  float ZDCEMEnergy() const;    
+  unsigned int ZDCParticipants() const; 
+  
+  unsigned long int     TriggerMask() const;     
+  unsigned char      TriggerCluster() const;  
+  
+  void SetEventNumber(const unsigned short&);
+  void SetRunNumber(const int&);
+  void SetNumberOfTracks(const unsigned short&);
+  void SetPrimVertPos(const AliFemtoThreeVector&);
+  void SetMagneticField(const double&);
+  
+   //functions for alice variables
+  void SetZDCN1Energy(const float&);      
+  void SetZDCP1Energy(const float&);      
+  void SetZDCN2Energy(const float&);      
+  void SetZDCP2Energy(const float&);      
+  void SetZDCEMEnergy(const float&);    
+  void SetZDCParticipants(const unsigned int&);
+  
+  void SetTriggerMask(const unsigned long int&);     
+  void SetTriggerCluster(const unsigned char&); 
+  
+  double UncorrectedNumberOfNegativePrimaries() const;
+  double UncorrectedNumberOfPrimaries() const;
+
+private:
+  unsigned short fEventNumber;           //
+  unsigned short fRunNumber;
+  unsigned short fNumberOfTracks;     // total number of TPC tracks
+  double fMagneticField; // magnetic field in Z direction
+
+  AliFemtoThreeVector fPrimVertPos;
+  AliFemtoTrackCollection* fTrackCollection;
+  AliFemtoV0Collection* fV0Collection;
+  AliFemtoXiCollection* fXiCollection;
+  AliFemtoKinkCollection* fKinkCollection;
+
+  //for alice changed by Marek Chojnacki
+  float      fZDCN1Energy;      // reconstructed energy in the neutron ZDC
+  float      fZDCP1Energy;      // reconstructed energy in the proton ZDC
+  float      fZDCN2Energy;      // reconstructed energy in the neutron ZDC
+  float      fZDCP2Energy;      // reconstructed energy in the proton ZDC
+  float      fZDCEMEnergy;     // reconstructed energy in the electromagnetic ZDC
+  unsigned int        fZDCParticipants; // number of participants estimated by the ZDC
+  
+  unsigned long int     fTriggerMask;     // Trigger Type (mask)
+  unsigned char      fTriggerCluster;  // Trigger cluster (mask)
+};
+
+
+
+#endif 
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEventWriterCollection.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEventWriterCollection.h
new file mode 100644 (file)
index 0000000..0089c2f
--- /dev/null
@@ -0,0 +1,34 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *  The EventWriterCollection is pointed to by the Manager, and holds pointers
+ *  to all EventWriter objects currently active
+ *
+ ***************************************************************************
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoEventWriterCollection_hh
+#define AliFemtoEventWriterCollection_hh
+
+#include "Base/AliFemtoEventWriter.h"
+
+#include <list>
+#if !defined(ST_NO_NAMESPACES)
+using std::list;
+#endif
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef list<AliFemtoEventWriter*, allocator<AliFemtoEventWriter*> >            AliFemtoEventWriterCollection;
+typedef list<AliFemtoEventWriter*, allocator<AliFemtoEventWriter*> >::iterator  AliFemtoEventWriterIterator;
+#else
+typedef list<AliFemtoEventWriter*>            AliFemtoEventWriterCollection;
+typedef list<AliFemtoEventWriter*>::iterator  AliFemtoEventWriterIterator;
+#endif
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoHelix.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoHelix.h
new file mode 100644 (file)
index 0000000..0715659
--- /dev/null
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Frank Laue, BNL, laue@bnl.gov
+ ***************************************************************************
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.1  2001/06/21 19:15:45  laue
+ * Modified fiels:
+ *   CTH.h : new constructor added
+ *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
+ *                                   (TTree) classes added
+ *   AliFemtoLikeSignAnalysis : minor changes, for debugging
+ *   AliFemtoTypes: split into different files
+ * Added files: for the new TTree muDst's
+ *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
+ *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
+ *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
+ *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
+ *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
+ *
+ *
+ ***************************************************************************/
+#ifndef AliFemtoHelix_hh
+#define AliFemtoHelix_hh
+
+#include "AliFmHelix.h"
+typedef AliFmHelix AliFemtoHelix;//!
+#include "AliFmPhysicalHelixD.h"
+typedef AliFmPhysicalHelixD AliFemtoPhysicalHelix;//!
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.cxx
new file mode 100644 (file)
index 0000000..9d50d36
--- /dev/null
@@ -0,0 +1,112 @@
+/***********************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, 23May2001
+ *
+ ***********************************************************************
+ *
+ * Description: Kink class with information gotten from the StKinkVertex
+ *              of Wenshen Deng and Spiros Margetis
+ *
+ ***********************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.4  2001/11/14 21:07:21  lisa
+ * Fixed several small things (mostly discarded const) that caused fatal errors with gcc2.95.3
+ *
+ * Revision 1.3  2001/09/05 21:55:23  laue
+ * typo fixed
+ *
+ * Revision 1.2  2001/06/21 19:15:46  laue
+ * Modified fiels:
+ *   CTH.h : new constructor added
+ *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
+ *                                   (TTree) classes added
+ *   AliFemtoLikeSignAnalysis : minor changes, for debugging
+ *   AliFemtoTypes: split into different files
+ * Added files: for the new TTree muDst's
+ *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
+ *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
+ *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
+ *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
+ *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
+ *
+ * Revision 1.1  2001/05/25 23:23:59  lisa
+ * Added in AliFemtoKink stuff
+ *
+ * 
+ *
+ ***********************************************************************/
+
+#include "AliFemtoKink.h"
+#include "phys_constants.h"
+#include "Infrastructure/AliFemtoTrack.h"
+// -----------------------------------------------------------------------
+AliFemtoKink::AliFemtoKink(const AliFemtoKink& k){ // copy constructor
+
+  fDcaParentDaughter          =   k.fDcaParentDaughter;           
+  fDcaDaughterPrimaryVertex   =   k.fDcaDaughterPrimaryVertex;    
+  fDcaParentPrimaryVertex     =   k.fDcaParentPrimaryVertex;      
+  fHitDistanceParentDaughter  =   k.fHitDistanceParentDaughter;   
+  fHitDistanceParentVertex    =   k.fHitDistanceParentVertex;     
+  fDeltaEnergy[0]             =   k.fDeltaEnergy[0];              
+  fDeltaEnergy[1]             =   k.fDeltaEnergy[1];              
+  fDeltaEnergy[2]             =   k.fDeltaEnergy[2];              
+  fDecayAngle                 =   k.fDecayAngle;                  
+  fDecayAngleCM               =   k.fDecayAngleCM;                
+  fDaughter                   =   k.fDaughter;                    
+  mParent                     =   k.mParent;                      
+  mPosition                   =   k.mPosition;                
+
+}
+// -----------------------------------------------------------------------
+
+
+//--------------------- below here is ONLY star ----------------
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+#ifdef __ROOT__
+#include "StEvent/StTrack.h"
+#include "StEvent/StKinkVertex.h"
+AliFemtoKink::AliFemtoKink( const StKinkVertex& SKV, AliFemtoThreeVector PrimaryVertex )
+{ 
+
+  fDcaParentDaughter          = SKV.dcaParentDaughter();
+  fDcaDaughterPrimaryVertex   = SKV.dcaDaughterPrimaryVertex();
+  fDcaParentPrimaryVertex     = SKV.dcaParentPrimaryVertex();
+  fHitDistanceParentDaughter  = SKV.hitDistanceParentDaughter();
+  fHitDistanceParentVertex    = SKV.hitDistanceParentVertex();
+  fDeltaEnergy[0]             = SKV.dE(0);
+  fDeltaEnergy[1]             = SKV.dE(1);
+  fDeltaEnergy[2]             = SKV.dE(2);
+  fDecayAngle                 = SKV.decayAngle();
+  fDecayAngleCM               = SKV.decayAngleCM();
+
+  // now fill member AliFemtoTrack data...
+  const StTrack* StTrk;
+  AliFemtoTrack* HbtTrk;
+  // Daughter
+  StTrk = SKV.daughter(0);
+  HbtTrk = new AliFemtoTrack(StTrk,PrimaryVertex); // generate NEW HbtTrack from StTrack
+  fDaughter = *HbtTrk;                         // invoke copy ctr of AliFemtoTrack
+  delete HbtTrk;                               // get rid of the NEW HbtTrack - we are done with that
+  // Parent
+  StTrk = SKV.parent();
+  HbtTrk = new AliFemtoTrack(StTrk,PrimaryVertex); // generate NEW HbtTrack from StTrack
+  mParent = *HbtTrk;                           // invoke copy ctr of AliFemtoTrack
+  delete HbtTrk;                               // get rid of the NEW HbtTrack - we are done with that
+
+  // finally, the kink position
+  mPosition.setX(SKV.position().x());
+  mPosition.setY(SKV.position().y());
+  mPosition.setZ(SKV.position().z());
+
+}
+
+// mike removed all AliFemtoTTree stuff 21apr2006
+
+#endif // __ROOT__
+#endif  // __NO_STAR_DEPENDENCE_ALLOWED__
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.h
new file mode 100644 (file)
index 0000000..8d7f67c
--- /dev/null
@@ -0,0 +1,129 @@
+/***********************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, 23May2001
+ *
+ ***********************************************************************
+ *
+ * Description: Kink class with information gotten from the StKinkVertex
+ *              of Wenshen Deng and Spiros Margetis
+ *
+ ***********************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.4  2003/09/02 17:58:32  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.3  2001/11/14 21:07:21  lisa
+ * Fixed several small things (mostly discarded const) that caused fatal errors with gcc2.95.3
+ *
+ * Revision 1.2  2001/06/21 19:15:46  laue
+ * Modified fiels:
+ *   CTH.h : new constructor added
+ *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
+ *                                   (TTree) classes added
+ *   AliFemtoLikeSignAnalysis : minor changes, for debugging
+ *   AliFemtoTypes: split into different files
+ * Added files: for the new TTree muDst's
+ *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
+ *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
+ *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
+ *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
+ *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
+ *
+ * Revision 1.1  2001/05/25 23:23:59  lisa
+ * Added in AliFemtoKink stuff
+ *
+ * 
+ *
+ ***********************************************************************/
+#ifndef AliFemtoKink_hh
+#define AliFemtoKink_hh
+
+class StKinkVertex;
+//#include "StEvent/StKinkVertex.h"  // from StEvent
+#include "Infrastructure/AliFemtoTrack.h"
+
+#include "Infrastructure/AliFemtoTypes.h" //same as in AliFemtoTrack.h
+
+class AliFemtoKink {
+public:
+  AliFemtoKink(){/* no-op */}
+  AliFemtoKink( const AliFemtoKink&); // copy constructor
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+#ifdef __ROOT__
+  AliFemtoKink( const StKinkVertex&, AliFemtoThreeVector PrimaryVertex); // create a AliFemtoKink from a StKinkVertex
+#endif
+#endif
+  ~AliFemtoKink(){/* no-op */}
+
+  // Get's
+  float        DcaParentDaughter() const;
+  float        DcaDaughterPrimaryVertex() const;
+  float        DcaParentPrimaryVertex() const;
+  float        HitDistanceParentDaughter() const;
+  float        HitDistanceParentVertex() const;
+  float        DeltaEnergy(int i=0) const;
+  float        DecayAngle() const;
+  float        DecayAngleCM() const;
+  AliFemtoTrack   Daughter() const;
+  AliFemtoTrack   Parent() const;
+  AliFemtoThreeVector Position() const; 
+
+  
+
+protected:
+
+  float        fDcaParentDaughter;           // from StKinkVertex class directly 
+  float        fDcaDaughterPrimaryVertex;    // from StKinkVertex class directly 
+  float        fDcaParentPrimaryVertex;      // from StKinkVertex class directly 
+  float        fHitDistanceParentDaughter;   // from StKinkVertex class directly 
+  float        fHitDistanceParentVertex;     // from StKinkVertex class directly 
+  float        fDeltaEnergy[3];              // from StKinkVertex class directly 
+  float        fDecayAngle;                  // from StKinkVertex class directly 
+  float        fDecayAngleCM;                // from StKinkVertex class directly 
+  AliFemtoTrack   fDaughter;                    // from StKinkVertex class directly 
+  AliFemtoTrack   mParent;                      // from StVertex class (which StKinkVertex inherits from)
+  AliFemtoThreeVector mPosition;                // from StMeasuredPoint class (which StVertex inherits from)
+
+};
+
+// Get's
+inline float        AliFemtoKink::DcaParentDaughter() const {return fDcaParentDaughter;}
+inline float        AliFemtoKink::DcaDaughterPrimaryVertex() const {return fDcaDaughterPrimaryVertex;}
+inline float        AliFemtoKink::DcaParentPrimaryVertex() const {return fDcaParentPrimaryVertex;}
+inline float        AliFemtoKink::HitDistanceParentDaughter() const {return fHitDistanceParentDaughter;}
+inline float        AliFemtoKink::HitDistanceParentVertex() const {return fHitDistanceParentVertex;}
+inline float        AliFemtoKink::DeltaEnergy(int i) const {return fDeltaEnergy[i];}
+inline float        AliFemtoKink::DecayAngle() const {return fDecayAngle;}
+inline float        AliFemtoKink::DecayAngleCM() const {return fDecayAngleCM;}
+inline AliFemtoTrack   AliFemtoKink::Daughter() const {return fDaughter;}
+inline AliFemtoTrack   AliFemtoKink::Parent() const {return mParent;}
+inline AliFemtoThreeVector AliFemtoKink::Position() const {return mPosition;}
+
+
+
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKinkCollection.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKinkCollection.h
new file mode 100644 (file)
index 0000000..135b248
--- /dev/null
@@ -0,0 +1,43 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   The Collection of Kinks is the a component of the HbtEvent,
+ *   which is essentially the transient microDST
+ *
+ ****************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.1  2001/05/25 23:23:59  lisa
+ * Added in AliFemtoKink stuff
+ *
+ *
+ ***************************************************************************/
+
+
+#ifndef AliFemtoKinkCollection_hh
+#define AliFemtoKinkCollection_hh
+#include "Infrastructure/AliFemtoKink.h"
+#include <list>
+
+#if !defined(ST_NO_NAMESPACES)
+using std::list;
+#endif
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef list<AliFemtoKink*, allocator<AliFemtoKink*> >            AliFemtoKinkCollection;
+typedef list<AliFemtoKink*, allocator<AliFemtoKink*> >::iterator  AliFemtoKinkIterator;
+#else
+typedef list<AliFemtoKink*>            AliFemtoKinkCollection;
+typedef list<AliFemtoKink*>::iterator  AliFemtoKinkIterator;
+#endif
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoLinkDef.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoLinkDef.h
new file mode 100644 (file)
index 0000000..c7fa87d
--- /dev/null
@@ -0,0 +1,30 @@
+// LinkDef.h
+
+#ifdef __CINT__
+// General:
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class AliFemtoBaseAnalysis;
+#pragma link C++ class AliFemtoEventCut;
+#pragma link C++ class AliFemtoEventReader;
+#pragma link C++ class AliFemtoKinkCut;
+#pragma link C++ class AliFemtoPairCut;
+#pragma link C++ class AliFemtoParticleCut;
+#pragma link C++ class AliFemtoTrackCut;
+#pragma link C++ class AliFemtoV0Cut;
+#pragma link C++ class AliFemtoXiCut;
+#pragma link C++ class AliFemtoAnalysis;
+#pragma link C++ class AliFemtoCutMonitorHandler;
+#pragma link C++ class AliFemtoLikeSignAnalysis;
+#pragma link C++ class AliFemtoManager;
+#pragma link C++ class AliFemtoVertexAnalysis;
+//#pragma link C++ class AliFemtoVertexMultAnalysis;
+
+
+//#pragma link C++ class AliFemtoCoulomb; - leave this out for now
+
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoLorentzVector.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoLorentzVector.h
new file mode 100644 (file)
index 0000000..a574e38
--- /dev/null
@@ -0,0 +1,735 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Brian Lasiuk, Thomas Ullrich, April 1998
+ ***************************************************************************
+ *
+ * Description:
+ *
+ * Remarks:   Since not all compilers support member templates
+ *            we have to specialize the templated member on these
+ *            platforms. If member templates are not supported the
+ *            ST_NO_MEMBER_TEMPLATES flag has to be set. tu.
+ *
+ *            In the near future when all compilers can handle member
+ *            templates this class should be cleaned up. A lot of
+ *            redundant code can be removed as soon as the compilers
+ *            are up-to-date. tu
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.11  2005/09/22 20:09:20  fisyak
+ * Make AliFemtoLorentzVector persistent
+ *
+ * Revision 1.10  2005/07/06 18:49:56  fisyak
+ * Replace AliFemtoHelixD, AliFemtoLorentzVectorD,AliFemtoLorentzVectorF,AliFemtoMatrixD,AliFemtoMatrixF,AliFemtoPhysicalHelixD,AliFemtoThreeVectorD,AliFemtoThreeVectorF by templated version
+ *
+ * Revision 1.9  2005/03/28 06:02:45  perev
+ * Defence FPE added
+ *
+ * Revision 1.8  2003/09/02 17:59:35  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.7  2003/05/01 19:24:31  ullrich
+ * Corrected problem in boost().
+ *
+ * Revision 1.6  1999/10/15 15:56:36  ullrich
+ * Changed output format in operator<<, added operator>>
+ *
+ * Revision 1.5  1999/06/04 18:01:36  ullrich
+ * New operators operator() and operator[] which can be used
+ * as lvalues.
+ *
+ * Revision 1.4  1999/04/14 23:12:07  fisyak
+ * Add __CINT__ to handle references
+ *
+ * Revision 1.3  1999/02/17 11:38:36  ullrich
+ * Removed specialization for 'long double'.
+ *
+ * Revision 1.2  1999/02/14 23:11:42  fisyak
+ * Fixes for Rootcint
+ *
+ * Revision 1.1  1999/01/30 03:59:02  fisyak
+ * Root Version of AliFemtoarClassLibrary
+ *
+ * Revision 1.1  1999/01/23 00:27:52  ullrich
+ * Initial Revision
+ *
+ **************************************************************************/
+#ifndef ST_LORENTZ_VECTOR_HH
+#define ST_LORENTZ_VECTOR_HH
+
+#include "AliFemtoThreeVector.h"
+template<class T> class AliFemtoLorentzVector {
+public:
+    AliFemtoLorentzVector(T = 0, T = 0, T = 0, T = 0);
+    virtual ~AliFemtoLorentzVector();
+    
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template<class X> AliFemtoLorentzVector(const AliFemtoThreeVector<X>&, T);
+    template<class X> AliFemtoLorentzVector(T, const AliFemtoThreeVector<X>&);   
+
+    template<class X> AliFemtoLorentzVector(const AliFemtoLorentzVector<X>&);
+    template<class X> AliFemtoLorentzVector<T>& operator=(const AliFemtoLorentzVector<X>&);
+    // AliFemtoLorentzVector(const AliFemtoLorentzVector<T>&);                use default
+    // AliFemtoLorentzVector<T>& operator=(const AliFemtoLorentzVector<T>&);  use default
+#else
+    AliFemtoLorentzVector(const AliFemtoThreeVector<float>&, T);
+    AliFemtoLorentzVector(T, const AliFemtoThreeVector<float>&);   
+    AliFemtoLorentzVector(const AliFemtoLorentzVector<float>&);
+    
+    AliFemtoLorentzVector(const AliFemtoThreeVector<double>&, T);
+    AliFemtoLorentzVector(T, const AliFemtoThreeVector<double>&);   
+    AliFemtoLorentzVector(const AliFemtoLorentzVector<double>&);
+        
+    AliFemtoLorentzVector<T>& operator=(const AliFemtoLorentzVector<float>&);
+    AliFemtoLorentzVector<T>& operator=(const AliFemtoLorentzVector<double>&);
+#endif
+    
+    T x()                     const;
+    T y()                     const;
+    T z()                     const;
+    T t()                     const;
+    T px()                    const;
+    T py()                    const;
+    T pz()                    const;
+    T e()                     const;
+    T operator()  (size_t)    const;
+    T operator[]  (size_t)    const;
+    
+    T& operator()  (size_t);
+    T& operator[]  (size_t);
+
+    const AliFemtoThreeVector<T>& vect() const;    
+    
+    void setX(T);
+    void setY(T);
+    void setZ(T);
+    void setPx(T);
+    void setPy(T);
+    void setPz(T);
+    void setE(T);
+    void setT(T);
+    
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template <class X> void setVect(const AliFemtoThreeVector<X>&);
+#else
+    void setVect(const AliFemtoThreeVector<float>&);
+    void setVect(const AliFemtoThreeVector<double>&);
+#endif   
+
+    T perp()               const;
+    T perp2()              const;
+    T pseudoRapidity()     const;
+    T phi()                const;
+    T theta()              const;
+    T cosTheta()           const;
+    
+    T plus()               const;
+    T minus()              const;
+    
+    T m()                  const; 
+    T m2()                 const; 
+    T mt()                 const;
+    T mt2()                const;
+    T rapidity()           const;
+    
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template<class X> AliFemtoLorentzVector<T> boost(const AliFemtoLorentzVector<X>&) const;
+#else
+    AliFemtoLorentzVector<T> boost(const AliFemtoLorentzVector<float>&) const;
+    AliFemtoLorentzVector<T> boost(const AliFemtoLorentzVector<double>&) const;
+#endif   
+    
+    AliFemtoLorentzVector<T>  operator- ();
+    AliFemtoLorentzVector<T>  operator+ ();
+    AliFemtoLorentzVector<T>& operator*= (double);
+    AliFemtoLorentzVector<T>& operator/= (double);
+
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template<class X> bool operator == (const AliFemtoLorentzVector<X>&) const;
+    template<class X> bool operator != (const AliFemtoLorentzVector<X>&) const;
+    template<class X> AliFemtoLorentzVector<T>& operator+= (const AliFemtoLorentzVector<X>&);
+    template<class X> AliFemtoLorentzVector<T>& operator-= (const AliFemtoLorentzVector<X>&);
+#else    
+    bool operator == (const AliFemtoLorentzVector<float>&) const;
+    bool operator != (const AliFemtoLorentzVector<float>&) const;
+    bool operator == (const AliFemtoLorentzVector<double>&) const;
+    bool operator != (const AliFemtoLorentzVector<double>&) const;
+
+    AliFemtoLorentzVector<T>& operator+= (const AliFemtoLorentzVector<float>&);
+    AliFemtoLorentzVector<T>& operator-= (const AliFemtoLorentzVector<float>&);
+    AliFemtoLorentzVector<T>& operator+= (const AliFemtoLorentzVector<double>&);
+    AliFemtoLorentzVector<T>& operator-= (const AliFemtoLorentzVector<double>&);
+#endif
+
+protected:
+    AliFemtoThreeVector<T> mThreeVector;
+    T               mX4;
+#ifdef __ROOT__
+  ClassDef(AliFemtoLorentzVector,3)
+#endif
+};
+#ifndef __CINT__
+//
+//        Implementation of member functions
+//
+template<class T>
+AliFemtoLorentzVector<T>::AliFemtoLorentzVector(T x, T y, T z, T t)
+    : mThreeVector(x, y, z), mX4(t) { /* nop */ }
+
+template<class T>
+AliFemtoLorentzVector<T>::~AliFemtoLorentzVector() { /* nopt */ }    
+
+template<class T>
+const AliFemtoThreeVector<T>& AliFemtoLorentzVector<T>::vect() const 
+{
+    return mThreeVector;
+}
+
+template<class T>
+T AliFemtoLorentzVector<T>::m2() const
+{
+    return (mX4*mX4 - mThreeVector*mThreeVector);    
+}
+
+template<class T>
+T AliFemtoLorentzVector<T>::plus() const { return (e() + pz()); }
+
+template<class T>
+T AliFemtoLorentzVector<T>::minus() const { return (e() - pz()); }
+
+template<class T>
+T AliFemtoLorentzVector<T>::m() const
+{
+    T mass2 = m2();
+    if (mass2 < 0)
+       return -::sqrt(-mass2);
+    else
+       return ::sqrt(mass2);
+}
+
+template<class T>
+T AliFemtoLorentzVector<T>::mt2() const
+{
+    return this->perp2() + m2();
+}
+
+template<class T>
+T AliFemtoLorentzVector<T>::mt() const
+{
+    //
+    // change to more optimal code ?
+    // return e()*e() - pz()*pz();
+    T massPerp2 = mt2();
+    if (massPerp2 < 0)
+       return -::sqrt(-massPerp2);
+    else
+       return ::sqrt(massPerp2);
+}
+
+template<class T>
+void AliFemtoLorentzVector<T>::setPx(T x) {mThreeVector.setX(x);}
+
+template<class T>
+void AliFemtoLorentzVector<T>::setPy(T y) {mThreeVector.setY(y);}
+
+template<class T>
+void AliFemtoLorentzVector<T>::setPz(T z) {mThreeVector.setZ(z);}
+
+template<class T>
+void AliFemtoLorentzVector<T>::setX(T x) {mThreeVector.setX(x);}
+
+template<class T>
+void AliFemtoLorentzVector<T>::setY(T y) {mThreeVector.setY(y);}
+
+template<class T>
+void AliFemtoLorentzVector<T>::setZ(T z) {mThreeVector.setZ(z);}
+
+template<class T>
+void AliFemtoLorentzVector<T>::setT(T t) {mX4 = t;}
+
+template<class T>
+void AliFemtoLorentzVector<T>::setE(T e) {mX4 = e;}
+
+template<class T>
+T AliFemtoLorentzVector<T>::x() const {return mThreeVector.x();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::y() const {return mThreeVector.y();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::z() const {return mThreeVector.z();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::px() const {return mThreeVector.x();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::py() const {return mThreeVector.y();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::pz() const {return mThreeVector.z();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::e() const {return mX4;}
+
+template<class T>
+T AliFemtoLorentzVector<T>::t() const {return mX4;}
+
+template<class T>
+T AliFemtoLorentzVector<T>::perp() const {return mThreeVector.perp();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::perp2() const {return mThreeVector.perp2();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::pseudoRapidity() const {return mThreeVector.pseudoRapidity();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::phi() const {return mThreeVector.phi();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::theta() const {return mThreeVector.theta();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::cosTheta() const {return mThreeVector.cosTheta();}
+
+template<class T>
+T AliFemtoLorentzVector<T>::operator() (size_t i) const
+{
+    if (i < 3)
+        return mThreeVector(i);
+    else if (i == 3)
+        return mX4;
+    else {
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFemtoLorentzVector<T>::operator(): bad index");  
+#else
+      cerr << "AliFemtoLorentzVector<T>::operator(): bad index." << endl;
+#endif
+      return 0;
+    }
+}
+
+template<class T>
+T& AliFemtoLorentzVector<T>::operator() (size_t i)
+{
+    if (i < 3)
+        return mThreeVector(i);
+    else if (i == 3)
+        return mX4;
+    else {
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFemtoLorentzVector<T>::operator(): bad index");  
+#else
+      cerr << "AliFemtoLorentzVector<T>::operator(): bad index." << endl;
+#endif
+      return mX4;
+    }
+}
+
+template<class T>
+T AliFemtoLorentzVector<T>::operator[] (size_t i) const
+{
+    if (i < 3)
+        return mThreeVector[i];
+    else if (i == 3)
+        return mX4;
+    else {
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFemtoLorentzVector<T>::operator[]: bad index"); 
+#else
+      cerr << "AliFemtoLorentzVector<T>::operator[]: bad index." << endl;
+#endif
+      return 0;
+    }
+}
+
+template<class T>
+T& AliFemtoLorentzVector<T>::operator[] (size_t i)
+{
+    if (i < 3)
+        return mThreeVector[i];
+    else if (i == 3)
+        return mX4;
+    else {
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFemtoLorentzVector<T>::operator[]: bad index"); 
+#else
+      cerr << "AliFemtoLorentzVector<T>::operator[]: bad index." << endl;
+#endif
+      return mX4;
+    }
+}
+
+template<class T>
+T AliFemtoLorentzVector<T>::rapidity() const
+{
+    return 0.5*::log((mX4+mThreeVector.z())/(mX4-mThreeVector.z())+1e-20);
+}
+
+template<class T>
+AliFemtoLorentzVector<T> AliFemtoLorentzVector<T>::operator- ()
+{
+    return AliFemtoLorentzVector<T>(-mX4,-mThreeVector);
+}
+
+template<class T>
+AliFemtoLorentzVector<T> AliFemtoLorentzVector<T>::operator+ ()
+{
+    return *this;
+}
+
+template<class T>
+AliFemtoLorentzVector<T>& AliFemtoLorentzVector<T>::operator*= (double c)
+{
+    mThreeVector *= c;
+    mX4 *= c;
+    return *this;
+}
+
+template<class T>
+AliFemtoLorentzVector<T>& AliFemtoLorentzVector<T>::operator/= (double c)
+{
+    mThreeVector /= c;
+    mX4 /= c;
+    return *this;
+}
+
+#ifndef ST_NO_MEMBER_TEMPLATES
+#ifndef WIN32
+
+template<class T>
+template<class X>
+AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoThreeVector<X> &vec, T t)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+template<class X>
+AliFemtoLorentzVector<T>::AliFemtoLorentzVector(T t, const AliFemtoThreeVector<X> &vec)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+template<class X>
+AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoLorentzVector<X> &vec)
+       : mThreeVector(vec.vect()), mX4(vec.t()) { /* nop */ }
+
+template<class T>
+template<class X>
+AliFemtoLorentzVector<T>
+AliFemtoLorentzVector<T>::boost(const AliFemtoLorentzVector<X>& pframe) const
+{
+    T mass               = abs(pframe);
+    AliFemtoThreeVector<T> eta = (-1./mass)*pframe.vect();            // gamma*beta
+    T gamma              = fabs(pframe.e())/mass;
+    AliFemtoThreeVector<T> pl  = ((this->vect()*eta)/(eta*eta))*eta;  // longitudinal momentum
+    return AliFemtoLorentzVector<T>(gamma*this->e() - this->vect()*eta,
+                              this->vect() + (gamma-1.)*pl - this->e()*eta);
+}
+
+template<class T>
+template<class X>
+void AliFemtoLorentzVector<T>::setVect(const AliFemtoThreeVector<X>& v)
+{
+    mThreeVector = v;
+}
+
+template<class T>
+template<class X>
+AliFemtoLorentzVector<T>&
+AliFemtoLorentzVector<T>::operator=(const AliFemtoLorentzVector<X>& vec)
+{
+    mThreeVector = vec.vect();
+    mX4 = vec.t();
+    return *this;
+}
+
+template<class T>
+template<class X>
+bool
+AliFemtoLorentzVector<T>::operator== (const AliFemtoLorentzVector<X>& v) const
+{
+    return (mThreeVector == v.vect()) && (mX4 == v.t());
+}
+
+template<class T>
+template<class X>
+bool
+AliFemtoLorentzVector<T>::operator!= (const AliFemtoLorentzVector<X>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+template<class X>
+AliFemtoLorentzVector<T>&
+AliFemtoLorentzVector<T>::operator+= (const AliFemtoLorentzVector<X>& v)
+{
+    mThreeVector += v.vect();
+    mX4 += v.t();
+    return *this;
+}
+
+template<class T>
+template<class X>
+AliFemtoLorentzVector<T>&
+AliFemtoLorentzVector<T>::operator-= (const AliFemtoLorentzVector<X>& v)
+{
+    mThreeVector -= v.vect();
+    mX4 -= v.t();
+    return *this;
+}
+
+#endif 
+#else
+
+template<class T>
+AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoThreeVector<float> &vec, T t)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoThreeVector<double> &vec, T t)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+AliFemtoLorentzVector<T>::AliFemtoLorentzVector(T t, const AliFemtoThreeVector<float> &vec)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+AliFemtoLorentzVector<T>::AliFemtoLorentzVector(T t, const AliFemtoThreeVector<double> &vec)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoLorentzVector<float> &vec)
+       : mThreeVector(vec.vect()), mX4(vec.t()) { /* nop */ }
+    
+template<class T>
+AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoLorentzVector<double> &vec)
+       : mThreeVector(vec.vect()), mX4(vec.t()) { /* nop */ }
+    
+template<class T>
+AliFemtoLorentzVector<T>
+AliFemtoLorentzVector<T>::boost(const AliFemtoLorentzVector<float>& pframe) const
+{
+    T mass               = abs(pframe);
+    AliFemtoThreeVector<T> eta = (-1./mass)*pframe.vect();            // gamma*beta
+    T gamma              = fabs(pframe.e())/mass;
+    AliFemtoThreeVector<T> pl  = ((this->vect()*eta)/(eta*eta))*eta;  // longitudinal momentum
+    return AliFemtoLorentzVector<T>(gamma*this->e() - this->vect()*eta,
+                              this->vect() + (gamma-1.)*pl - this->e()*eta);
+}
+
+template<class T>
+AliFemtoLorentzVector<T>
+AliFemtoLorentzVector<T>::boost(const AliFemtoLorentzVector<double>& pframe) const
+{
+    T mass               = abs(pframe);
+    AliFemtoThreeVector<T> eta = (-1./mass)*pframe.vect();            // gamma*beta
+    T gamma              = fabs(pframe.e())/mass;
+    AliFemtoThreeVector<T> pl  = ((this->vect()*eta)/(eta*eta))*eta;  // longitudinal momentum
+    return AliFemtoLorentzVector<T>(gamma*this->e() - this->vect()*eta,
+                              this->vect() + (gamma-1.)*pl - this->e()*eta);
+}
+
+template<class T>
+void AliFemtoLorentzVector<T>::setVect(const AliFemtoThreeVector<float>& v)
+{
+    mThreeVector = v;
+}
+
+template<class T>
+void AliFemtoLorentzVector<T>::setVect(const AliFemtoThreeVector<double>& v)
+{
+    mThreeVector = v;
+}
+
+template<class T>
+AliFemtoLorentzVector<T>&
+AliFemtoLorentzVector<T>::operator=(const AliFemtoLorentzVector<float>& vec)
+{
+    mThreeVector = vec.vect();
+    mX4 = vec.t();
+    return *this;
+}
+
+template<class T>
+AliFemtoLorentzVector<T>&
+AliFemtoLorentzVector<T>::operator=(const AliFemtoLorentzVector<double>& vec)
+{
+    mThreeVector = vec.vect();
+    mX4 = vec.t();
+    return *this;
+}
+
+template<class T>
+bool
+AliFemtoLorentzVector<T>::operator== (const AliFemtoLorentzVector<float>& v) const
+{
+    return (this->vect() == v.vect()) && (mX4 == v.t());
+}
+
+template<class T>
+bool
+AliFemtoLorentzVector<T>::operator== (const AliFemtoLorentzVector<double>& v) const
+{
+    return (mThreeVector == v.vect()) && (mX4 == v.t());
+}
+
+template<class T>
+bool
+AliFemtoLorentzVector<T>::operator!= (const AliFemtoLorentzVector<float>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+bool
+AliFemtoLorentzVector<T>::operator!= (const AliFemtoLorentzVector<double>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+AliFemtoLorentzVector<T>&
+AliFemtoLorentzVector<T>::operator+= (const AliFemtoLorentzVector<float>& v)
+{
+    mThreeVector += v.vect();
+    mX4 += v.t();
+    return *this;
+}
+
+template<class T>
+AliFemtoLorentzVector<T>&
+AliFemtoLorentzVector<T>::operator+= (const AliFemtoLorentzVector<double>& v)
+{
+    mThreeVector += v.vect();
+    mX4 += v.t();
+    return *this;
+}
+
+template<class T>
+AliFemtoLorentzVector<T>&
+AliFemtoLorentzVector<T>::operator-= (const AliFemtoLorentzVector<float>& v)
+{
+    mThreeVector -= v.vect();
+    mX4 -= v.t();
+    return *this;
+}
+
+template<class T>
+AliFemtoLorentzVector<T>&
+AliFemtoLorentzVector<T>::operator-= (const AliFemtoLorentzVector<double>& v)
+{
+    mThreeVector -= v.vect();
+    mX4 -= v.t();
+    return *this;
+}
+
+#endif // ST_NO_MEMBER_TEMPLATES
+#endif /* ! __CINT__ */
+#ifdef __CINT__
+template<> AliFemtoLorentzVector<double> operator+ (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<double>& v2);
+template<> AliFemtoLorentzVector<double> operator+ (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<float>& v2);
+template<> AliFemtoLorentzVector<double> operator+ (const AliFemtoLorentzVector<float>&  v1, const AliFemtoLorentzVector<double>& v2);
+template<> AliFemtoLorentzVector<float>  operator+ (const AliFemtoLorentzVector<float>&  v1, const AliFemtoLorentzVector<float>& v2);
+template<> AliFemtoLorentzVector<double> operator- (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<double>& v2);
+template<> AliFemtoLorentzVector<double> operator- (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<float>& v2);
+template<> AliFemtoLorentzVector<double> operator- (const AliFemtoLorentzVector<float>&  v1, const AliFemtoLorentzVector<double>& v2);
+template<> AliFemtoLorentzVector<float>  operator- (const AliFemtoLorentzVector<float>&  v1, const AliFemtoLorentzVector<float>& v2);
+template<> AliFemtoLorentzVector<double> operator* (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<double>& v2);
+template<> AliFemtoLorentzVector<double> operator* (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<float>& v2);
+template<> AliFemtoLorentzVector<double> operator* (const AliFemtoLorentzVector<float>&  v1, const AliFemtoLorentzVector<double>& v2);
+template<> AliFemtoLorentzVector<float>  operator* (const AliFemtoLorentzVector<float>&  v1, const AliFemtoLorentzVector<float>& v2);
+template<> AliFemtoLorentzVector<double> operator* (const              double v1, const AliFemtoLorentzVector<double>& v2);
+template<> AliFemtoLorentzVector<double> operator* (const              double v1, const AliFemtoLorentzVector<float>&  v2);
+template<> AliFemtoLorentzVector<double> operator* (const AliFemtoLorentzVector<double>& v1, const double              v2);
+template<> AliFemtoLorentzVector<double> operator* (const AliFemtoLorentzVector<float>&  v1, const double              v2);
+template<> AliFemtoLorentzVector<double> operator/ (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<double>& v2);
+template<> AliFemtoLorentzVector<double> operator/ (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<float>& v2);
+template<> AliFemtoLorentzVector<double> operator/ (const AliFemtoLorentzVector<float>&  v1, const AliFemtoLorentzVector<double>& v2);
+template<> AliFemtoLorentzVector<float>  operator/ (const AliFemtoLorentzVector<float>&  v1, const AliFemtoLorentzVector<float>& v2);
+template<> AliFemtoLorentzVector<double> operator/ (const              double v1, const AliFemtoLorentzVector<double>& v2);
+template<> AliFemtoLorentzVector<double> operator/ (const              double v1, const AliFemtoLorentzVector<float>&  v2);
+template<> AliFemtoLorentzVector<double> operator/ (const AliFemtoLorentzVector<double>& v1, const double              v2);
+template<> AliFemtoLorentzVector<double> operator/ (const AliFemtoLorentzVector<float>&  v1, const double              v2);
+template<> istream& operator>> (istream& is, const AliFemtoLorentzVector<double>& v);
+template<> ostream& operator<< (ostream& os, const AliFemtoLorentzVector<double>& v);
+template<> istream& operator>> (istream& is, const AliFemtoLorentzVector<float>& v);
+template<> ostream& operator<< (ostream& os, const AliFemtoLorentzVector<float>& v);
+template<> double abs(const AliFemtoLorentzVector<double>& v);
+template<> float  abs(const AliFemtoLorentzVector<float>& v);
+#else
+//
+//   Non-member operators
+//
+template<class T, class X>
+AliFemtoLorentzVector<T>
+operator+ (const AliFemtoLorentzVector<T>& v1, const AliFemtoLorentzVector<X>& v2)
+{
+    return AliFemtoLorentzVector<T>(v1) += v2;
+}
+
+template<class T, class X>
+AliFemtoLorentzVector<T>
+operator- (const AliFemtoLorentzVector<T>& v1, const AliFemtoLorentzVector<X>& v2)
+{
+    return AliFemtoLorentzVector<T>(v1) -= v2;
+}
+
+template<class T, class X>
+T
+operator* (const AliFemtoLorentzVector<T>& v1, const AliFemtoLorentzVector<X>& v2)
+{
+    return v1.t()*v2.t() - v1.vect()*v2.vect();
+}
+
+template<class T>
+AliFemtoLorentzVector<T>
+operator* (const AliFemtoLorentzVector<T>& v, double c)
+{
+    return AliFemtoLorentzVector<T>(v) *= c;
+}
+
+template<class T>
+AliFemtoLorentzVector<T> operator* (double c, const AliFemtoLorentzVector<T>& v)
+{
+    return AliFemtoLorentzVector<T>(v) *= c;
+}
+
+template<class T, class X>
+AliFemtoLorentzVector<T> operator/ (const AliFemtoLorentzVector<T>& v, X c)
+{
+    return AliFemtoLorentzVector<T>(v) /= c;
+}
+
+template<class T>
+ostream& operator<< (ostream& os, const AliFemtoLorentzVector<T>& v)
+{
+    return os << v.vect() << "\t\t" << v.t();
+}
+
+template<class T>
+istream&  operator>>(istream& is, AliFemtoLorentzVector<T>& v)
+{
+    T  x, y, z, t;
+    is >> x >> y >> z >> t;
+    v.setX(x);
+    v.setY(y);
+    v.setZ(z);
+    v.setT(t);
+    return is;
+}
+
+//
+//        Non-member functions
+//
+template<class T>
+T abs(const AliFemtoLorentzVector<T>& v) {return v.m();}
+
+#endif /*  __CINT__ */
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoLorentzVectorD.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoLorentzVectorD.h
new file mode 100644 (file)
index 0000000..3fad3d4
--- /dev/null
@@ -0,0 +1,19 @@
+/***************************************************************************
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.6  2005/07/06 18:49:56  fisyak
+ * Replace AliFemtoHelixD, AliFemtoLorentzVectorD,AliFemtoLorentzVectorF,AliFemtoMatrixD,AliFemtoMatrixF,AliFemtoPhysicalHelixD,AliFemtoThreeVectorD,AliFemtoThreeVectorF by templated version
+ *
+
+****************************************************************************/
+#ifndef ALIFM_LORENTZ_VECTOR_D_HH
+#define ALIFM_LORENTZ_VECTOR_D_HH
+//#include "AliFemtoThreeVectorF.hh"
+#include "AliFmThreeVectorD.h"
+#include "AliFmLorentzVector.h"
+typedef AliFmLorentzVector<double> AliFmLorentzVectorD;
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.cxx
new file mode 100644 (file)
index 0000000..edaaf0c
--- /dev/null
@@ -0,0 +1,297 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   The Manager is the top-level object that coordinates activities
+ *   and performs event, particle, and pair loops, and checks the
+ *   various Cuts of the Analyses in its AnalysisCollection
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.20  2001/06/21 19:15:46  laue
+ * Modified fiels:
+ *   CTH.h : new constructor added
+ *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
+ *                                   (TTree) classes added
+ *   AliFemtoLikeSignAnalysis : minor changes, for debugging
+ *   AliFemtoTypes: split into different files
+ * Added files: for the new TTree muDst's
+ *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
+ *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
+ *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
+ *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
+ *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
+ *
+ * Revision 1.19  2000/05/08 15:45:50  laue
+ * Memory leak fixed. Current hbt event was not deleted
+ *
+ * Revision 1.18  2000/03/17 17:23:05  laue
+ * Roberts new three particle correlations implemented.
+ *
+ * Revision 1.16  2000/02/26 19:04:52  laue
+ * Some unnecessary includes removed.
+ * StThreeVectorD replace by AliFemtoThreeVector.
+ * AliFemtoCoulomb modified to compile without Root (ClassDef embraced into
+ *   #ifdef __ROOT__  ..... #endif)
+ * AliFemtoParticle now returns references (FourMomentum(),Helix(),
+ *   DecayVertexPosiion())
+ *
+ * Revision 1.15  2000/02/18 21:32:24  laue
+ * franksTrackCut changed. If mCharge is set to '0' there will be no cut
+ * on charge. This is important for front-loaded cuts.
+ *
+ * copy constructor implemented for AliFemtoEvent, AliFemtoTrack and AliFemtoV0.
+ *
+ * franks1HistoD.cxx franks1HistoD.h franks2HistoD.cxx franks2HistoD.h
+ * removed. We can now (CC5 on Solaris) use the versions (no D)
+ *
+ * Revision 1.14  2000/02/13 17:17:12  laue
+ * Calls to the EventBegin() and EventEnd() functions implemented
+ * The actual analysis is moved from AliFemtoManager to AliFemtoAnalysis
+ *
+ * Revision 1.13  2000/01/25 17:35:17  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.12  1999/10/15 01:57:29  lisa
+ * Important enhancement of AliFemtoMaker - implement Franks CutMonitors
+ * ----------------------------------------------------------
+ * This means 3 new files in Infrastructure area (CutMonitor),
+ * several specific CutMonitor classes in the Cut area
+ * and a new base class in the Base area (AliFemtoCutMonitor).
+ * This means also changing all Cut Base class header files from .h to .h
+ * so we have access to CutMonitor methods from Cint command line.
+ * This last means
+ * 1) files which include these header files are slightly modified
+ * 2) a side benefit: the TrackCuts and V0Cuts no longer need
+ * a SetMass() implementation in each Cut class, which was stupid.
+ * Also:
+ * -----
+ * Include Franks AliFemtoAssociationReader
+ * ** None of these changes should affect any user **
+ *
+ * Revision 1.11  1999/10/04 15:38:57  lisa
+ * include Franks new accessor methods AliFemtoAnalysis::CorrFctn and AliFemtoManager::Analysis as well as McEnt example macro
+ *
+ * Revision 1.10  1999/09/17 22:38:02  lisa
+ * first full integration of V0s into AliFemto framework
+ *
+ * Revision 1.9  1999/09/08 04:15:52  lisa
+ * persistent microDST implementation tweaked to please fickle solaris details
+ *
+ * Revision 1.8  1999/09/05 02:58:11  lisa
+ * add ASCII microDST reader/writer AND franksParticle cuts
+ *
+ * Revision 1.7  1999/09/04 04:41:01  lisa
+ * AliFemtoEvent IO   --and--  AliFemtoEventWriter (microDST) method added to framework
+ *
+ * Revision 1.6  1999/09/03 22:39:15  lisa
+ * Readers now MUST have Report() methods and MAY have WriteHbtEvent() methods
+ *
+ * Revision 1.5  1999/07/27 10:47:04  lisa
+ * now works in dev on linux and solaris - mistake in deleting picoEvents fixed
+ *
+ * Revision 1.4  1999/07/26 16:21:26  lisa
+ * always convert string to char when output - needed on solaris
+ *
+ * Revision 1.3  1999/07/22 18:49:10  lisa
+ * Implement idea of Fabrice to not create and delete AliFemtoPair all the time
+ *
+ * Revision 1.2  1999/07/06 22:33:22  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#include "Infrastructure/AliFemtoManager.h"
+//#include "Infrastructure/AliFemtoParticleCollection.h"
+//#include "Base/AliFemtoTrackCut.h"
+//#include "Base/AliFemtoV0Cut.h"
+#include <cstdio>
+
+#ifdef __ROOT__
+ClassImp(AliFemtoManager)
+#endif
+
+
+
+//____________________________
+AliFemtoManager::AliFemtoManager(){
+  fAnalysisCollection = new AliFemtoAnalysisCollection;
+  fEventWriterCollection = new AliFemtoEventWriterCollection;
+  fEventReader = 0;
+}
+//____________________________
+AliFemtoManager::~AliFemtoManager(){
+  delete fEventReader;
+  // now delete each Analysis in the Collection, and then the Collection itself
+  AliFemtoAnalysisIterator AnalysisIter;
+  for (AnalysisIter=fAnalysisCollection->begin();AnalysisIter!=fAnalysisCollection->end();AnalysisIter++){
+    delete *AnalysisIter;
+    *AnalysisIter = 0;
+  }
+  delete fAnalysisCollection;
+  // now delete each EventWriter in the Collection, and then the Collection itself
+  AliFemtoEventWriterIterator EventWriterIter;
+  for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){
+    delete *EventWriterIter;
+    *EventWriterIter = 0;
+  }
+  delete fEventWriterCollection;
+}
+//____________________________
+int AliFemtoManager::Init(){
+  AliFemtoString readerMessage;
+  readerMessage += "*** *** *** *** *** *** *** *** *** *** *** *** \n";
+  // EventReader
+  if (fEventReader) {
+    if (fEventReader->Init("r",readerMessage)){
+      cout << " AliFemtoManager::Init() - Reader initialization failed " << endl;
+      return (1);
+    }
+    readerMessage += fEventReader->Report();
+  }
+  // EventWriters
+  AliFemtoEventWriterIterator EventWriterIter;
+  for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){
+    //cout << "*EventWriterIter " << *EventWriterIter << endl;
+    // The message (AliFemtoString) passed into Init will be at the file header.
+    // for that reason take the readerReport, add my own report and pass as message 
+    AliFemtoString writerMessage = readerMessage;
+    writerMessage += "*** *** *** *** *** *** *** *** *** *** *** *** \n";
+    writerMessage += (*EventWriterIter)->Report();
+    if (*EventWriterIter) {
+      if ( (*EventWriterIter)->Init("w",writerMessage)){ // yes, the message from the reader is passed into the writer
+       cout << " AliFemtoManager::Init() - Writer initialization failed " << endl;
+       return (1);
+      }
+    }
+  }
+  
+  
+  return (0);
+}
+//____________________________
+void AliFemtoManager::Finish(){
+  // EventReader
+  if (fEventReader) fEventReader->Finish();
+  // EventWriters
+  AliFemtoEventWriterIterator EventWriterIter;
+  AliFemtoEventWriter* currentEventWriter;
+  for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){
+    currentEventWriter = *EventWriterIter;
+    currentEventWriter->Finish();
+  }
+  // Analyses
+  AliFemtoAnalysisIterator AnalysisIter;
+  AliFemtoBaseAnalysis* currentAnalysis;
+  for (AnalysisIter=fAnalysisCollection->begin();AnalysisIter!=fAnalysisCollection->end();AnalysisIter++){
+    currentAnalysis = *AnalysisIter;
+    currentAnalysis->Finish();
+  }
+}
+//____________________________
+AliFemtoString AliFemtoManager::Report(){
+  string stemp;
+  char ctemp[100];
+  // EventReader
+  stemp = fEventReader->Report();
+  // EventWriters
+  sprintf(ctemp,"\nAliFemtoManager Reporting %u EventWriters\n",fEventWriterCollection->size());
+  stemp += ctemp;
+  AliFemtoEventWriterIterator EventWriterIter;
+  AliFemtoEventWriter* currentEventWriter;
+  for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){
+    cout << "AliFemtoManager - asking for EventWriter Report" << endl;
+    currentEventWriter = *EventWriterIter;
+    stemp+=currentEventWriter->Report();
+  }
+  // Analyses
+  sprintf(ctemp,"\nAliFemtoManager Reporting %u Analyses\n",fAnalysisCollection->size());
+  stemp += ctemp;
+  AliFemtoAnalysisIterator AnalysisIter;
+  AliFemtoBaseAnalysis* currentAnalysis;
+  for (AnalysisIter=fAnalysisCollection->begin();AnalysisIter!=fAnalysisCollection->end();AnalysisIter++){
+    cout << "AliFemtoManager - asking for Analysis Report" << endl;
+    currentAnalysis = *AnalysisIter;
+    stemp+=currentAnalysis->Report();
+  }
+
+  AliFemtoString returnThis = stemp;
+  return returnThis;
+}
+//____________________________
+AliFemtoBaseAnalysis* AliFemtoManager::Analysis( int n ){  // return pointer to n-th analysis
+  if ( n<0 || n > (int) fAnalysisCollection->size() )
+    return NULL;
+  AliFemtoAnalysisIterator iter = fAnalysisCollection->begin();
+  for (int i=0; i<n ;i++){
+    iter++;
+  }
+  return *iter;
+}
+//____________________________
+AliFemtoEventWriter* AliFemtoManager::EventWriter( int n ){  // return pointer to n-th analysis
+  if ( n<0 || n > (int) fEventWriterCollection->size() )
+    return NULL;
+  AliFemtoEventWriterIterator iter = fEventWriterCollection->begin();
+  for (int i=0; i<n ;i++){
+    iter++;
+  }
+  return *iter;
+}
+ //____________________________
+int AliFemtoManager::ProcessEvent(){
+  cout << "AliFemtoManager::ProcessEvent" << endl;
+  // NOTE - this ReturnHbtEvent makes a *new* AliFemtoEvent - delete it when done!
+  AliFemtoEvent* currentHbtEvent = fEventReader->ReturnHbtEvent();
+  cout << "Event reader has returned control to manager" << endl;
+  
+  // if no HbtEvent is returned, then we abort processing.
+  // the question is now: do we try again next time (i.e. there may be an HbtEvent next time)
+  // or are we at EOF or something?  If Reader says Status=0, then that means try again later.
+  // so, we just return the Reader's Status.
+  if (!currentHbtEvent){
+    cout << "AliFemtoManager::ProcessEvent() - Reader::ReturnHbtEvent() has returned null pointer\n";
+    return fEventReader->Status();
+  }
+  
+  // loop over all the EventWriters
+  AliFemtoEventWriterIterator EventWriterIter;
+  for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){
+#ifdef STHBRDEBUG
+    cout << " *EventWriterIter " <<  *EventWriterIter << endl;
+#endif
+    (*EventWriterIter)->WriteHbtEvent(currentHbtEvent);
+  } 
+
+  // loop over all the Analysis
+  AliFemtoAnalysisIterator AnalysisIter;
+  for (AnalysisIter=fAnalysisCollection->begin();AnalysisIter!=fAnalysisCollection->end();AnalysisIter++){
+    (*AnalysisIter)->ProcessEvent(currentHbtEvent);
+  } 
+
+  if (currentHbtEvent) delete currentHbtEvent;
+#ifdef STHBRDEBUG
+  cout << "AliFemtoManager::ProcessEvent() - return to caller ... " << endl;
+#endif
+  return 0;    // 0 = "good return"
+}       // ProcessEvent
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.h
new file mode 100644 (file)
index 0000000..3693e9a
--- /dev/null
@@ -0,0 +1,125 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   The Manager is the top-level object that coordinates activities
+ *   and performs event, particle, and pair loops, and checks the
+ *   various Cuts of the Analyses in its AnalysisCollection
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.10  2000/03/17 17:23:05  laue
+ * Roberts new three particle correlations implemented.
+ *
+ * Revision 1.9  2000/02/18 21:32:24  laue
+ * franksTrackCut changed. If mCharge is set to '0' there will be no cut
+ * on charge. This is important for front-loaded cuts.
+ *
+ * copy constructor implemented for AliFemtoEvent, AliFemtoTrack and AliFemtoV0.
+ *
+ * franks1HistoD.cxx franks1HistoD.h franks2HistoD.cxx franks2HistoD.h
+ * removed. We can now (CC5 on Solaris) use the versions (no D)
+ *
+ * Revision 1.8  2000/01/25 17:35:17  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.7  1999/10/04 15:38:58  lisa
+ * include Franks new accessor methods AliFemtoAnalysis::CorrFctn and AliFemtoManager::Analysis as well as McEvent example macro
+ *
+ * Revision 1.6  1999/09/24 01:23:12  fisyak
+ * Reduced Include Path
+ *
+ * Revision 1.5  1999/09/08 04:15:52  lisa
+ * persistent microDST implementation tweaked to please fickle solaris details
+ *
+ * Revision 1.4  1999/09/05 02:58:12  lisa
+ * add ASCII microDST reader/writer AND franksParticle cuts
+ *
+ * Revision 1.3  1999/09/04 04:41:02  lisa
+ * AliFemtoEvent IO   --and--  AliFemtoEventWriter (microDST) method added to framework
+ *
+ * Revision 1.2  1999/07/06 22:33:22  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoManager_hh
+#define AliFemtoManager_hh
+
+
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Infrastructure/AliFemtoAnalysisCollection.h"
+#include "Infrastructure/AliFemtoEventWriterCollection.h"
+#include "Infrastructure/AliFemtoEvent.h"
+#include "Base/AliFemtoBaseAnalysis.h"
+#include "Base/AliFemtoEventReader.h"
+#include "Base/AliFemtoEventWriter.h"
+
+class AliFemtoManager{
+
+private:
+  AliFemtoAnalysisCollection* fAnalysisCollection;
+  AliFemtoEventReader*        fEventReader;
+  AliFemtoEventWriterCollection* fEventWriterCollection;
+
+public:
+  AliFemtoManager();
+  virtual ~AliFemtoManager();
+
+  // Gets and Sets...
+  AliFemtoAnalysisCollection* AnalysisCollection();
+  AliFemtoBaseAnalysis* Analysis(int n);  // Access to Analysis within Collection
+  void AddAnalysis(AliFemtoBaseAnalysis*);
+
+  AliFemtoEventWriterCollection* EventWriterCollection();
+  AliFemtoEventWriter* EventWriter(int n);// Access to EventWriter within Collection
+  void SetEventWriter(AliFemtoEventWriter*);  // just for historic reasons
+  void AddEventWriter(AliFemtoEventWriter*);
+
+  AliFemtoEventReader* EventReader();
+  void SetEventReader(AliFemtoEventReader*);
+
+
+  int Init();
+  int ProcessEvent();   // a "0" return value means success - otherwise quit
+  void Finish();
+
+  AliFemtoString Report(); //!
+#ifdef __ROOT__
+  ClassDef(AliFemtoManager, 0)
+#endif
+};
+
+inline AliFemtoAnalysisCollection* AliFemtoManager::AnalysisCollection(){return fAnalysisCollection;}
+inline void AliFemtoManager::AddAnalysis(AliFemtoBaseAnalysis* anal){fAnalysisCollection->push_back(anal);}
+
+inline AliFemtoEventWriterCollection* AliFemtoManager::EventWriterCollection(){return fEventWriterCollection;}
+inline void AliFemtoManager::AddEventWriter(AliFemtoEventWriter* writer){fEventWriterCollection->push_back(writer);}
+inline void AliFemtoManager::SetEventWriter(AliFemtoEventWriter* writer){fEventWriterCollection->push_back(writer);}
+
+inline AliFemtoEventReader* AliFemtoManager::EventReader(){return fEventReader;}
+inline void AliFemtoManager::SetEventReader(AliFemtoEventReader* reader){fEventReader = reader;}
+
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.cxx
new file mode 100644 (file)
index 0000000..837d7f6
--- /dev/null
@@ -0,0 +1,1068 @@
+/***************************************************************************
+ *
+ * $Id: AliFemtoPair.cc,v 1.23
+ *
+ * Author: Brian Laziuk, Yale University
+ *         slightly modified by Mike Lisa
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *    the Pair object is passed to the PairCuts for verification, and
+ *    then to the AddRealPair and AddMixedPair methods of the
+ *    Correlation Functions
+ *
+ ***************************************************************************
+ * Revision 1.23  2002/09/25 19:23:25  rcwells
+ * Added const to emissionAngle()
+ *
+ * Revision 1.22  2002/04/22 22:48:11  laue
+ * corrected calculation of opening angle 
+ **
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.27  2003/09/02 17:58:32  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.26  2003/01/31 19:57:15  magestro
+ * Cleared up simple compiler warnings on i386_linux24
+ *
+ * Revision 1.25  2003/01/14 09:44:08  renault
+ * corrections on average separation calculation for tracks which doesn't cross
+ * all 45 padrows.
+ *
+ * Revision 1.24  2002/11/19 23:33:10  renault
+ * Enable average separation calculation for all combinaisons of
+ * V0 daughters and tracks
+ *
+ * Revision 1.21  2002/02/28 14:18:36  rcwells
+ * Added emissionAngle function to AliFemtoPair
+ *
+ * Revision 1.20  2001/12/14 23:11:30  fretiere
+ * Add class HitMergingCut. Add class fabricesPairCut = HitMerginCut + pair purity cuts. Add TpcLocalTransform function which convert to local tpc coord (not pretty). Modify AliFemtoTrack, AliFemtoParticle, AliFemtoHiddenInfo, AliFemtoPair to handle the hit information and cope with my code
+ *
+ * Revision 1.19  2001/04/25 18:05:09  perev
+ * HPcorrs
+ *
+ * Revision 1.18  2001/04/03 21:04:36  kisiel
+ *
+ *
+ *   Changes needed to make the Theoretical code
+ *   work. The main code is the ThCorrFctn directory.
+ *   The most visible change is the addition of the
+ *   HiddenInfo to AliFemtoPair.
+ *
+ * Revision 1.17  2001/03/28 22:35:20  flierl
+ * changes and bugfixes in qYKP*
+ * add pairrapidity
+ *
+ * Revision 1.16  2001/02/15 19:23:00  rcwells
+ * Fixed sign in qSideCMS
+ *
+ * Revision 1.15  2001/01/22 22:56:41  laue
+ * Yano-Koonin-Podgoretskii Parametrisation added
+ *
+ * Revision 1.14  2000/12/11 21:44:30  rcwells
+ * Corrected qSideCMS function
+ *
+ * Revision 1.13  2000/10/26 16:09:16  lisa
+ * Added OpeningAngle PairCut class and method to AliFemtoPair
+ *
+ * Revision 1.12  2000/10/05 23:09:05  lisa
+ * Added kT-dependent radii to mixed-event simulator AND implemented AverageSeparation Cut and CorrFctn
+ *
+ * Revision 1.11  2000/07/17 20:03:16  lisa
+ * Implemented tools for addressing and assessing trackmerging
+ *
+ * Revision 1.10  2000/04/04 16:27:03  rcwells
+ * Removed an errant cout in AliFemtoPair.cc
+ *
+ * Revision 1.9  2000/04/04 16:13:09  lisa
+ * AliFemtoPair:quality() now returns normalized value (and so is double) and add a CorrFctn which looks at quality()
+ *
+ * Revision 1.8  2000/04/03 22:09:12  rcwells
+ * Add member function ... quality().
+ *
+ * Revision 1.7  2000/02/13 21:13:33  lisa
+ * changed ambiguous AliFemtoPair::fourMomentum() to fourMomentumSum() and fourMomentumDiff() and fixed related bug in QvecCorrFctn
+ *
+ * Revision 1.6  1999/07/29 16:16:34  lisa
+ * Selemons upgrade of AliFemtoPair class
+ *
+ * Revision 1.5  1999/07/22 18:49:10  lisa
+ * Implement idea of Fabrice to not create and delete AliFemtoPair all the time
+ *
+ * Revision 1.4  1999/07/12 18:57:05  lisa
+ * fixed small bug in fourMomentum method of AliFemtoPair
+ *
+ * Revision 1.3  1999/07/06 22:33:22  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.2  1999/06/29 17:50:27  fisyak
+ * formal changes to account new StEvent, does not complie yet
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#include "Infrastructure/AliFemtoPair.h"
+
+double AliFemtoPair::fMaxDuInner = .8;
+double AliFemtoPair::fMaxDzInner = 3.;
+double AliFemtoPair::fMaxDuOuter = 1.4;
+double AliFemtoPair::fMaxDzOuter = 3.2;
+
+
+AliFemtoPair::AliFemtoPair(){
+  fTrack1 = 0;
+  fTrack2 = 0;
+  setDefaultHalfFieldMergingPar();
+}
+
+AliFemtoPair::AliFemtoPair(AliFemtoParticle* a, AliFemtoParticle* b)
+  : fTrack1(a), fTrack2(b)
+{ 
+  setDefaultHalfFieldMergingPar();
+}
+
+void AliFemtoPair::setDefaultHalfFieldMergingPar(){
+  fMaxDuInner = 3;
+  fMaxDzInner = 4.;
+  fMaxDuOuter = 4.;
+  fMaxDzOuter = 6.;
+}
+void AliFemtoPair::setDefaultFullFieldMergingPar(){
+  fMaxDuInner = 0.8;
+  fMaxDzInner = 3.;
+  fMaxDuOuter = 1.4;
+  fMaxDzOuter = 3.2;
+}
+void AliFemtoPair::setMergingPar(double aMaxDuInner, double aMaxDzInner,
+                             double aMaxDuOuter, double aMaxDzOuter){
+  fMaxDuInner = aMaxDuInner;
+  fMaxDzInner = aMaxDzInner;
+  fMaxDuOuter = aMaxDuOuter;
+  fMaxDzOuter = aMaxDzOuter;
+};
+
+AliFemtoPair::~AliFemtoPair() {/* no-op */}
+
+//AliFemtoPair::AliFemtoPair(const AliFemtoPair &a) {/* missing */}
+
+//AliFemtoPair& AliFemtoPair::operator=(const AliFemtoPair &a)
+
+//_________________
+double AliFemtoPair::mInv() const
+{
+    double InvariantMass = abs(fTrack1->FourMomentum() + fTrack2->FourMomentum());
+    return (InvariantMass);
+}
+//_________________
+double AliFemtoPair::kT() const
+{
+
+  double  tmp = 
+    (fTrack1->FourMomentum() + fTrack2->FourMomentum()).perp();
+  tmp *= .5;
+
+  return (tmp);
+}
+//_________________
+double AliFemtoPair::rap() const
+{
+  // longitudinal pair rapidity : Y = 0.5 ::log( E1 + E2 + pz1 + pz2 / E1 + E2 - pz1 - pz2 )
+  double  tmp = 0.5 * log (
+                          (fTrack1->FourMomentum().e() + fTrack2->FourMomentum().e() + fTrack1->FourMomentum().z() + fTrack2->FourMomentum().z()) / 
+                          (fTrack1->FourMomentum().e() + fTrack2->FourMomentum().e() - fTrack1->FourMomentum().z() - fTrack2->FourMomentum().z()) 
+                          ) ;
+  return (tmp);
+}
+//_________________
+double AliFemtoPair::emissionAngle()const {
+  double pxTotal = this->fourMomentumSum().x();
+  double pyTotal = this->fourMomentumSum().y();
+  double angle = atan2(pyTotal,pxTotal)*180.0/3.1415926536;
+  if (angle<0.0) angle+=360.0;
+  return angle;
+}
+//_________________
+// get rid of ambiguously-named method fourMomentum() and replace it with
+// fourMomentumSum() and fourMomentumDiff() - mal 13feb2000
+AliFemtoLorentzVector AliFemtoPair::fourMomentumSum() const
+{
+  AliFemtoLorentzVector temp = fTrack1->FourMomentum()+fTrack2->FourMomentum();
+  return temp;
+}
+AliFemtoLorentzVector AliFemtoPair::fourMomentumDiff() const
+{
+  AliFemtoLorentzVector temp = fTrack1->FourMomentum()-fTrack2->FourMomentum();
+  return temp;
+}
+//__________________________________
+// Yano-Koonin-Podgoretskii Parametrisation in CMS
+void AliFemtoPair::qYKPCMS(double& qP, double& qT, double& q0) const
+{
+  ////
+  // calculate momentum difference in source rest frame (= lab frame)
+  ////
+  AliFemtoLorentzVector l1 = fTrack1->FourMomentum() ;
+  AliFemtoLorentzVector l2 = fTrack2->FourMomentum() ;
+  AliFemtoLorentzVector  l ;
+  // random ordering of the particles
+  if ( rand()/(double)RAND_MAX > 0.50 )  
+    { l = l1-l2 ; } 
+  else 
+    { l = l2-l1 ; } ;
+  // fill momentum differences into return variables
+  qP = l.z() ;
+  qT = l.vect().perp() ;
+  q0 = l.e() ;
+}
+//___________________________________
+// Yano-Koonin-Podgoretskii Parametrisation in LCMS
+void AliFemtoPair::qYKPLCMS(double& qP, double& qT, double& q0) const
+{
+  ////
+  //  calculate momentum difference in LCMS : frame where pz1 + pz2 = 0
+  ////
+  AliFemtoLorentzVector l1 = fTrack1->FourMomentum() ;
+  AliFemtoLorentzVector l2 = fTrack2->FourMomentum() ;
+  // determine beta to LCMS
+  double beta = (l1.z()+l2.z()) / (l1.e()+l2.e()) ;
+  double beta2 =  beta*beta ;
+  // unfortunately STAR Class lib knows only boost(particle) not boost(beta) :(
+  // -> create particle with velocity beta and mass 1.0
+  // actually this is : dummyPz = ::sqrt( (dummyMass*dummyMass*beta2) / (1-beta2) ) ; 
+  double dummyPz = ::sqrt( (beta2) / (1-beta2) ) ;
+  // boost in the correct direction
+  if (beta>0.0) { dummyPz = -dummyPz; } ;
+  // create dummy particle
+  AliFemtoLorentzVector  l(0.0, 0.0, dummyPz) ; 
+  double dummyMass = 1.0 ;
+  l.setE(l.vect().massHypothesis(dummyMass) );
+  // boost particles along the beam into a frame with velocity beta 
+  AliFemtoLorentzVector l1boosted = l1.boost(l) ;
+  AliFemtoLorentzVector l2boosted = l2.boost(l) ;
+  // caculate the momentum difference with random ordering of the particle
+  if ( rand()/(double)RAND_MAX >0.50)  
+    { l = l1boosted-l2boosted ; } 
+  else 
+    { l = l2boosted-l1boosted ;} ;
+  // fill momentum differences into return variables
+  qP = l.z() ;
+  qT = l.vect().perp() ;
+  q0 = l.e() ;
+}
+//___________________________________
+// Yano-Koonin-Podgoretskii Parametrisation in pair rest frame
+void AliFemtoPair::qYKPPF(double& qP, double& qT, double& q0) const
+{
+  ////
+  //  calculate momentum difference in pair rest frame : frame where (pz1 + pz2, py1 + py2, px1 + px2) = (0,0,0)
+  ////
+  AliFemtoLorentzVector l1 = fTrack1->FourMomentum() ;
+  AliFemtoLorentzVector l2 = fTrack2->FourMomentum() ;
+  // the center of gravity of the pair travels with l
+  AliFemtoLorentzVector  l = l1 + l2 ; 
+  l = -l ;
+  l.setE(-l.e()) ;
+  // boost particles  
+  AliFemtoLorentzVector l1boosted = l1.boost(l) ;
+  AliFemtoLorentzVector l2boosted = l2.boost(l) ;
+  // caculate the momentum difference with random ordering of the particle
+  if ( rand()/(double)RAND_MAX > 0.50)  
+    { l = l1boosted-l2boosted ; } 
+  else 
+    { l = l2boosted-l1boosted ;} ;
+  // fill momentum differences into return variables
+  qP = l.z();
+  qT = l.vect().perp();
+  q0 = l.e();
+}
+//_________________
+double AliFemtoPair::qOutCMS() const
+{
+    AliFemtoThreeVector tmp1 = fTrack1->FourMomentum().vect();
+    AliFemtoThreeVector tmp2 = fTrack2->FourMomentum().vect();
+
+    double dx = tmp1.x() - tmp2.x();
+    double xt = tmp1.x() + tmp2.x();
+    
+    double dy = tmp1.y() - tmp2.y();
+    double yt = tmp1.y() + tmp2.y();
+
+    double k1 = (::sqrt(xt*xt+yt*yt));
+    double k2 = (dx*xt+dy*yt);
+    double tmp = k2/k1;
+    return (tmp);
+}
+//_________________
+double AliFemtoPair::qSideCMS() const
+{
+    AliFemtoThreeVector tmp1 = fTrack1->FourMomentum().vect();
+    AliFemtoThreeVector tmp2 = fTrack2->FourMomentum().vect();
+
+    double x1 = tmp1.x();  double y1 = tmp1.y();
+    double x2 = tmp2.x();  double y2 = tmp2.y();
+
+    double xt = x1+x2;  double yt = y1+y2;
+    double k1 = ::sqrt(xt*xt+yt*yt);
+
+    double tmp = 2.0*(x2*y1-x1*y2)/k1;
+    return (tmp);
+}
+
+//_________________________
+double AliFemtoPair::qLongCMS() const
+{
+    AliFemtoLorentzVector tmp1 = fTrack1->FourMomentum();
+    AliFemtoLorentzVector tmp2 = fTrack2->FourMomentum();
+
+    double dz = tmp1.z() - tmp2.z();
+    double zz = tmp1.z() + tmp2.z();
+
+    double dt = tmp1.t() - tmp2.t();
+    double tt = tmp1.t() + tmp2.t();
+
+    double beta = zz/tt;
+    double gamma = 1.0/::sqrt(1.0 - beta*beta);
+
+    double temp = gamma*(dz - beta*dt);
+    return (temp);
+}
+
+//________________________________
+double AliFemtoPair::qOutPf() const
+{
+ AliFemtoLorentzVector tmp1 = fTrack1->FourMomentum();
+ AliFemtoLorentzVector tmp2 = fTrack2->FourMomentum();
+
+    double dt = tmp1.t() - tmp2.t();
+    double tt = tmp1.t() + tmp2.t();
+
+    double xt = tmp1.x() + tmp2.x();
+    double yt = tmp1.y() + tmp2.y();
+
+    double k1 = ::sqrt(xt*xt + yt*yt);
+    double bOut = k1/tt;
+    double gOut = 1.0/::sqrt(1.0 - bOut*bOut);
+
+    double temp = gOut*(this->qOutCMS() - bOut*dt);
+    return (temp);
+}
+
+//___________________________________
+double AliFemtoPair::qSidePf() const
+{
+ return(this->qSideCMS());
+}
+
+//___________________________________
+
+double AliFemtoPair::qLongPf() const
+{
+ return(this->qLongCMS());
+}
+
+//___________________________________
+double AliFemtoPair::qOutBf(double beta) const
+{
+ return(this->qOutCMS());
+}
+
+//___________________________________
+
+double AliFemtoPair::qSideBf(double beta) const
+{
+ return(this->qSideCMS());
+}
+
+//___________________________________
+double AliFemtoPair::qLongBf(double beta) const
+{
+    AliFemtoLorentzVector tmp1 = fTrack1->FourMomentum();
+    AliFemtoLorentzVector tmp2 = fTrack2->FourMomentum();
+
+    double dz = tmp1.z() - tmp2.z();
+    double dt = tmp1.t() + tmp2.t();
+
+    double gamma = 1.0/::sqrt(1.0 - beta*beta);
+
+    double temp = gamma*(dz - beta*dt);
+    return (temp);
+}
+
+double AliFemtoPair::quality() const {
+  unsigned long mapMask0 = 0xFFFFFF00;
+  unsigned long mapMask1 = 0x1FFFFF;
+  unsigned long padRow1To24Track1 = fTrack1->TopologyMap(0) & mapMask0;
+  unsigned long padRow25To45Track1 = fTrack1->TopologyMap(1) & mapMask1;
+  unsigned long padRow1To24Track2 = fTrack2->TopologyMap(0) & mapMask0;
+  unsigned long padRow25To45Track2 = fTrack2->TopologyMap(1) & mapMask1;
+  // AND logic
+  unsigned long bothPads1To24 = padRow1To24Track1 & padRow1To24Track2;
+  unsigned long bothPads25To45 = padRow25To45Track1 & padRow25To45Track2;
+  // XOR logic
+  unsigned long onePad1To24 = padRow1To24Track1 ^ padRow1To24Track2;
+  unsigned long onePad25To45 = padRow25To45Track1 ^ padRow25To45Track2;
+  unsigned long bitI;
+  int ibits;
+  int Quality = 0;
+  double normQual = 0.0;
+  int MaxQuality = fTrack1->NumberOfHits() + fTrack2->NumberOfHits();
+  for (ibits=8;ibits<=31;ibits++) {
+    bitI = 0;
+    bitI |= 1UL<<(ibits);
+    if ( onePad1To24 & bitI ) {
+      Quality++;
+      continue;
+    }
+    else{
+      if ( bothPads1To24 & bitI ) Quality--;
+    }
+  }
+  for (ibits=0;ibits<=20;ibits++) {
+    bitI = 0;
+    bitI |= 1UL<<(ibits);
+    if ( onePad25To45 & bitI ) {
+      Quality++;
+      continue;
+    }
+    else{
+      if ( bothPads25To45 & bitI ) Quality--;
+    }
+  }
+  normQual = (double)Quality/( (double) MaxQuality );
+  return ( normQual );
+
+}
+
+double AliFemtoPair::quality2() const {
+  unsigned long mapMask0 = 0xFFFFFF00;
+  unsigned long mapMask1 = 0x1FFFFF;
+  unsigned long padRow1To24Track1 = fTrack1->TopologyMap(0) & mapMask0;
+  unsigned long padRow25To45Track1 = fTrack1->TopologyMap(1) & mapMask1;
+  unsigned long padRow1To24Track2 = fTrack2->TopologyMap(0) & mapMask0;
+  unsigned long padRow25To45Track2 = fTrack2->TopologyMap(1) & mapMask1;
+
+  // AND logic
+  //unsigned long bothPads1To24 = padRow1To24Track1 & padRow1To24Track2;
+  //unsigned long bothPads25To45 = padRow25To45Track1 & padRow25To45Track2;
+
+  // XOR logic
+  unsigned long onePad1To24 = padRow1To24Track1 ^ padRow1To24Track2;
+  unsigned long onePad25To45 = padRow25To45Track1 ^ padRow25To45Track2;
+  unsigned long bitI;
+  int ibits;
+  int Quality = 0;
+  double normQual = 0.0;
+  int MaxQuality = fTrack1->NumberOfHits() + fTrack2->NumberOfHits();
+  for (ibits=8;ibits<=31;ibits++) {
+    bitI = 0;
+    bitI |= 1UL<<(ibits);
+    if ( onePad1To24 & bitI ) {
+      Quality++;
+      continue;
+    }
+    //else{
+    //if ( bothPads1To24 & bitI ) Quality--;
+    //}
+  }
+  for (ibits=0;ibits<=20;ibits++) {
+    bitI = 0;
+    bitI |= 1UL<<(ibits);
+    if ( onePad25To45 & bitI ) {
+      Quality++;
+      continue;
+    }
+    //else{
+    //if ( bothPads25To45 & bitI ) Quality--;
+    //}
+  }
+  normQual = (double)Quality/( (double) MaxQuality );
+  return ( normQual );
+
+}
+
+
+double AliFemtoPair::NominalTpcExitSeparation() const {
+  AliFemtoThreeVector diff = fTrack1->NominalTpcExitPoint() - fTrack2->NominalTpcExitPoint();
+  return (diff.mag());
+}
+
+double AliFemtoPair::NominalTpcEntranceSeparation() const {
+  AliFemtoThreeVector diff = fTrack1->NominalTpcEntrancePoint() - fTrack2->NominalTpcEntrancePoint();
+  return (diff.mag());
+}
+
+double AliFemtoPair::NominalTpcAverageSeparation() const {
+  AliFemtoThreeVector diff;
+  double AveSep = 0.0;
+  int ipt = 0;
+  if (fTrack1->fNominalPosSample && fTrack2->fNominalPosSample){
+  while (fabs(fTrack1->fNominalPosSample[ipt].x())<9999. &&
+        fabs(fTrack1->fNominalPosSample[ipt].y())<9999. && 
+        fabs(fTrack1->fNominalPosSample[ipt].z())<9999. &&
+        fabs(fTrack2->fNominalPosSample[ipt].x())<9999. &&
+        fabs(fTrack2->fNominalPosSample[ipt].y())<9999. && 
+        fabs(fTrack2->fNominalPosSample[ipt].z())<9999. &&
+        ipt<11
+        ){
+    //  for (int ipt=0; ipt<11; ipt++){
+    diff = fTrack1->fNominalPosSample[ipt] - fTrack2->fNominalPosSample[ipt];
+    ipt++;
+    AveSep += diff.mag();
+  }
+  AveSep = AveSep/(ipt+1.);
+  return (AveSep);}
+  else return -1;
+}
+
+double AliFemtoPair::OpeningAngle() const {
+ return 57.296* fTrack1->FourMomentum().vect().angle( fTrack2->FourMomentum().vect() );
+//   AliFemtoThreeVector p1 = fTrack1->FourMomentum().vect();
+//   AliFemtoThreeVector p2 = fTrack2->FourMomentum().vect();
+//   return 57.296*(p1.phi()-p2.phi());
+//   //double dAngInv = 57.296*acos((p1.dot(p2))/(p1.mag()*p2.mag()));
+//   //return (dAngInv);
+}
+//_________________
+
+
+double AliFemtoPair::KStarFlipped() const {
+  AliFemtoLorentzVector tP1 = fTrack1->FourMomentum();
+
+  AliFmThreeVectorD qwe = tP1.vect();
+  qwe *= -1.; // flip it
+  tP1.setVect(qwe);
+  
+  AliFemtoLorentzVector tSum = (tP1+fTrack2->FourMomentum());
+  double tMass = abs(tSum);
+  AliFmThreeVectorD tGammaBeta = (1./tMass)*tSum.vect(); 
+  double tGamma = tSum.e()/tMass;
+  AliFmThreeVectorD tLongMom  = ((tP1.vect()*tGammaBeta)/
+                             (tGammaBeta*tGammaBeta))*tGammaBeta;
+  AliFmLorentzVectorD tK(tGamma*tP1.e() - tP1.vect()*tGammaBeta,
+                     tP1.vect() + (tGamma-1.)*tLongMom - tP1.e()*tGammaBeta);
+//VP  tP1.vect() *= -1.; // unflip it
+  return tK.vect().mag();
+}
+
+//double AliFemtoPair::CVK() const{
+//const AliFemtoLorentzVector& tP1 = fTrack1->FourMomentum();
+//AliFemtoLorentzVector tSum = (tP1+fTrack2->FourMomentum());
+//double tMass = abs(tSum);
+//AliFmThreeVectorD tGammaBeta = (1./tMass)*tSum.vect(); 
+//double tGamma = tSum.e()/tMass;
+//AliFmThreeVectorD tLongMom  = ((tP1.vect()*tGammaBeta)/
+//                   (tGammaBeta*tGammaBeta))*tGammaBeta;
+//AliFmLorentzVectorD tK(tGamma*tP1.e() - tP1.vect()*tGammaBeta,
+//           tP1.vect() + (tGamma-1.)*tLongMom - tP1.e()*tGammaBeta);
+//return (tK.vect())*tGammaBeta/tK.vect().magnitude()/tGammaBeta.magnitude();
+//}
+
+double AliFemtoPair::CVKFlipped() const{
+  AliFemtoLorentzVector tP1 = fTrack1->FourMomentum();
+  AliFmThreeVectorD qwe = tP1.vect();
+  qwe *= -1.; // flip it
+  tP1.setVect(qwe);
+  
+  AliFemtoLorentzVector tSum = (tP1+fTrack2->FourMomentum());
+  double tMass = abs(tSum);
+  AliFmThreeVectorD tGammaBeta = (1./tMass)*tSum.vect(); 
+  double tGamma = tSum.e()/tMass;
+  AliFmThreeVectorD tLongMom  = ((tP1.vect()*tGammaBeta)/
+                             (tGammaBeta*tGammaBeta))*tGammaBeta;
+  AliFmLorentzVectorD tK(tGamma*tP1.e() - tP1.vect()*tGammaBeta,
+                     tP1.vect() + (tGamma-1.)*tLongMom - tP1.e()*tGammaBeta);
+//VP  tP1.vect() *= -1.; // unflip it
+  return (tK.vect())*tGammaBeta/tGamma;
+}
+
+double AliFemtoPair::pInv() const{
+  AliFemtoLorentzVector tP1 = fTrack1->FourMomentum();
+  AliFemtoLorentzVector tP2 = fTrack2->FourMomentum();
+  double tP = (tP1.px()+tP2.px())*(tP1.px()+tP2.px())+
+              (tP1.py()+tP2.py())*(tP1.py()+tP2.py())+
+              (tP1.pz()+tP2.pz())*(tP1.pz()+tP2.pz())-
+              (tP1.e() -tP2.e() )*(tP1.e() -tP2.e() );
+  return ::sqrt(fabs(tP));
+}
+
+double AliFemtoPair::qInvFlippedXY() const{
+  AliFemtoLorentzVector tP1 = fTrack1->FourMomentum();
+  tP1.setX(-1.*tP1.x());
+  tP1.setY(-1.*tP1.y());
+  AliFemtoLorentzVector tDiff = (tP1-fTrack2->FourMomentum());
+  return ( -1.* tDiff.m());
+}
+
+void AliFemtoPair::calcNonIdPar() const{ // fortran like function! faster?
+  fNonIdParNotCalculated=0;
+  double px1 = fTrack1->FourMomentum().vect().x();
+  double py1 = fTrack1->FourMomentum().vect().y();
+  double pz1 = fTrack1->FourMomentum().vect().z();
+  double pE1  = fTrack1->FourMomentum().e();
+  double Particle1Mass = ::sqrt(pE1*pE1 - px1*px1 - py1*py1 - pz1*pz1);
+  double px2 = fTrack2->FourMomentum().vect().x();
+  double py2 = fTrack2->FourMomentum().vect().y();
+  double pz2 = fTrack2->FourMomentum().vect().z();
+  double pE2  = fTrack2->FourMomentum().e();
+  double Particle2Mass = ::sqrt(pE2*pE2 - px2*px2 - py2*py2 - pz2*pz2);
+
+  double Px = px1+px2;
+  double Py = py1+py2;
+  double Pz = pz1+pz2;
+  double PE = pE1+pE2;
+      
+  double Ptrans = Px*Px + Py*Py;
+  double Mtrans = PE*PE - Pz*Pz;
+  double Pinv =   ::sqrt(Mtrans - Ptrans);
+  Mtrans = ::sqrt(Mtrans);
+  Ptrans = ::sqrt(Ptrans);
+       
+  double QinvL = (pE1-pE2)*(pE1-pE2) - (px1-px2)*(px1-px2) -
+    (py1-py2)*(py1-py2) - (pz1-pz2)*(pz1-pz2);
+
+  double Q = (Particle1Mass*Particle1Mass - Particle2Mass*Particle2Mass)/Pinv;
+  Q = sqrt ( Q*Q - QinvL);
+         
+  kStarCalc = Q/2;
+
+  // ad 1) go to LCMS
+  double beta = Pz/PE;
+  double gamma = PE/Mtrans;
+           
+  double pz1L = gamma * (pz1 - beta * pE1);
+  double pE1L = gamma * (pE1 - beta * pz1);
+  
+  // fill histogram for beam projection ( z - axis )
+  fDKLong = pz1L;
+
+  // ad 2) rotation px -> Pt
+  double px1R = (px1*Px + py1*Py)/Ptrans;
+  double py1R = (-px1*Py + py1*Px)/Ptrans;
+  
+  //fill histograms for side projection ( y - axis )
+  fDKSide = py1R;
+
+  // ad 3) go from LCMS to CMS
+  beta = Ptrans/Mtrans;
+  gamma = Mtrans/Pinv;
+  
+  double px1C = gamma * (px1R - beta * pE1L);
+  
+  // fill histogram for out projection ( x - axis )
+  fDKOut  = px1C;
+
+  fCVK = (fDKOut*Ptrans + fDKLong*Pz)/kStarCalc/::sqrt(Ptrans*Ptrans+Pz*Pz);
+}
+
+
+/*void AliFemtoPair::calcNonIdParGlobal() const{ // fortran like function! faster?
+  fNonIdParNotCalculatedGlobal=0;
+  double px1 = fTrack1->Track()->PGlobal().x();
+  double py1 = fTrack1->Track()->PGlobal().y();
+  double pz1 = fTrack1->Track()->PGlobal().z();
+  double Particle1Mass =  fTrack1->FourMomentum().m2();
+  double pE1  = ::sqrt(Particle1Mass + px1*px1 + py1*py1 + pz1*pz1);
+  Particle1Mass = ::sqrt(Particle1Mass);
+
+  double px2 = fTrack2->Track()->PGlobal().x();
+  double py2 = fTrack2->Track()->PGlobal().y();
+  double pz2 = fTrack2->Track()->PGlobal().z();
+  double Particle2Mass =  fTrack2->FourMomentum().m2();
+  double pE2  = ::sqrt(Particle2Mass + px2*px2 + py2*py2 + pz2*pz2);
+  Particle2Mass = ::sqrt(Particle2Mass);
+
+  double Px = px1+px2;
+  double Py = py1+py2;
+  double Pz = pz1+pz2;
+  double PE = pE1+pE2;
+      
+  double Ptrans = Px*Px + Py*Py;
+  double Mtrans = PE*PE - Pz*Pz;
+  double Pinv =   ::sqrt(Mtrans - Ptrans);
+  Mtrans = ::sqrt(Mtrans);
+  Ptrans = ::sqrt(Ptrans);
+       
+  double QinvL = (pE1-pE2)*(pE1-pE2) - (px1-px2)*(px1-px2) -
+    (py1-py2)*(py1-py2) - (pz1-pz2)*(pz1-pz2);
+
+  double Q = (Particle1Mass*Particle1Mass - Particle2Mass*Particle2Mass)/Pinv;
+  Q = sqrt ( Q*Q - QinvL);
+         
+  kStarCalcGlobal = Q/2;
+
+  // ad 1) go to LCMS
+  double beta = Pz/PE;
+  double gamma = PE/Mtrans;
+           
+  double pz1L = gamma * (pz1 - beta * pE1);
+  double pE1L = gamma * (pE1 - beta * pz1);
+  
+  // fill histogram for beam projection ( z - axis )
+  fDKLongGlobal = pz1L;
+
+  // ad 2) rotation px -> Pt
+  double px1R = (px1*Px + py1*Py)/Ptrans;
+  double py1R = (-px1*Py + py1*Px)/Ptrans;
+  
+  //fill histograms for side projection ( y - axis )
+  fDKSideGlobal = py1R;
+
+  // ad 3) go from LCMS to CMS
+  beta = Ptrans/Mtrans;
+  gamma = Mtrans/Pinv;
+  
+  double px1C = gamma * (px1R - beta * pE1L);
+  
+  // fill histogram for out projection ( x - axis )
+  fDKOutGlobal  = px1C;
+
+  fCVKGlobal = (fDKOutGlobal*Ptrans + fDKLongGlobal*Pz)/
+    kStarCalcGlobal/::sqrt(Ptrans*Ptrans+Pz*Pz);
+}*/
+
+
+
+double AliFemtoPair::dcaInsideTpc() const{
+
+  double tMinDist=NominalTpcEntranceSeparation();
+  double tExit = NominalTpcExitSeparation();
+  tMinDist = (tExit>tMinDist) ? tMinDist : tExit;
+  double tInsideDist;
+  //tMinDist = 999.;
+
+  double rMin = 60.;
+  double rMax = 190.;
+  const AliFmPhysicalHelixD& tHelix1 = fTrack1->Helix();
+  const AliFmPhysicalHelixD& tHelix2 = fTrack2->Helix();
+  // --- One is a line and other one a helix
+  //if (tHelix1.mSingularity != tHelix2.mSingularity) return -999.;
+  // --- 2 lines : don't care right now
+  //if (tHelix1.mSingularity)  return -999.;
+  // --- 2 helix
+  double dx = tHelix2.xcenter() - tHelix1.xcenter();
+  double dy = tHelix2.ycenter() - tHelix1.ycenter();
+  double dd = ::sqrt(dx*dx + dy*dy);
+  double r1 = 1/tHelix1.curvature();
+  double r2 = 1/tHelix2.curvature();
+  double cosAlpha = (r1*r1 + dd*dd - r2*r2)/(2*r1*dd);
+    
+  double x, y, r;
+  double s;
+  if (fabs(cosAlpha) < 1) {           // two solutions
+    double sinAlpha = sin(acos(cosAlpha));
+    x = tHelix1.xcenter() + r1*(cosAlpha*dx - sinAlpha*dy)/dd;
+    y = tHelix1.ycenter() + r1*(sinAlpha*dx + cosAlpha*dy)/dd;
+    r = ::sqrt(x*x+y*y);
+    if( r > rMin &&  r < rMax && 
+       fabs(atan2(y,x)-fTrack1->NominalTpcEntrancePoint().phi())< 0.5
+       ){ // first solution inside
+      s = tHelix1.pathLength(x, y);
+      tInsideDist=tHelix2.distance(tHelix1.at(s));
+      if(tInsideDist<tMinDist) tMinDist = tInsideDist;
+    }
+    else{ 
+      x = tHelix1.xcenter() + r1*(cosAlpha*dx + sinAlpha*dy)/dd;
+      y = tHelix1.ycenter() + r1*(cosAlpha*dy - sinAlpha*dx)/dd;
+      r = ::sqrt(x*x+y*y);
+      if( r > rMin &&  r < rMax &&
+         fabs(atan2(y,x)-fTrack1->NominalTpcEntrancePoint().phi())< 0.5
+         ) {  // second solution inside
+        s = tHelix1.pathLength(x, y);
+        tInsideDist=tHelix2.distance(tHelix1.at(s));
+        if(tInsideDist<tMinDist) tMinDist = tInsideDist;
+      }     
+    }
+  }
+  return tMinDist;
+}
+
+void AliFemtoPair::calcMergingPar() const{
+  fMergingParNotCalculated=0;
+
+  double tDu, tDz;
+  int tN = 0;
+  fFracOfMergedRow = 0.;
+  fWeightedAvSep =0.;
+  double tDist;
+  double tDistMax = 200.;
+  for(int ti=0 ; ti<45 ; ti++){
+    if(fTrack1->fSect[ti]==fTrack2->fSect[ti] && fTrack1->fSect[ti]!=-1){
+      tDu = fabs(fTrack1->fU[ti]-fTrack2->fU[ti]);
+      tDz = fabs(fTrack1->fZ[ti]-fTrack2->fZ[ti]);
+      tN++;
+      if(ti<13){
+       fFracOfMergedRow += (tDu<fMaxDuInner && tDz<fMaxDzInner);
+       tDist = ::sqrt(tDu*tDu/fMaxDuInner/fMaxDuInner+
+                    tDz*tDz/fMaxDzInner/fMaxDzInner);
+       //fFracOfMergedRow += (tDu<fMaxDuInner && tDz<fMaxDzInner);
+      }
+      else{
+       fFracOfMergedRow += (tDu<fMaxDuOuter && tDz<fMaxDzOuter);
+       tDist = ::sqrt(tDu*tDu/fMaxDuOuter/fMaxDuOuter+
+                    tDz*tDz/fMaxDzOuter/fMaxDzOuter);
+       //fFracOfMergedRow += (tDu<fMaxDuOuter && tDz<fMaxDzOuter);
+      }
+      if(tDist<tDistMax){
+       fClosestRowAtDCA = ti+1;
+       tDistMax = tDist;
+      }
+      fWeightedAvSep += tDist;
+    }
+  }
+  if(tN>0){
+    fWeightedAvSep /= tN;
+    fFracOfMergedRow /= tN;
+  }
+  else{
+    fClosestRowAtDCA = -1;
+    fFracOfMergedRow = -1.;
+    fWeightedAvSep = -1.;
+  }
+}
+//________________V0 daughters exit/entrance/average separation calc.
+//_______1st part is a track 2nd is a V0 considering Pos daughter
+double AliFemtoPair::TpcExitSeparationTrackV0Pos() const {
+  AliFemtoThreeVector diff = fTrack1->NominalTpcExitPoint() - fTrack2->TpcV0PosExitPoint();
+  return (diff.mag());
+}
+
+double AliFemtoPair::TpcEntranceSeparationTrackV0Pos() const {
+  AliFemtoThreeVector diff = fTrack1->NominalTpcEntrancePoint() - fTrack2->TpcV0PosEntrancePoint();
+  return (diff.mag());
+}
+
+double AliFemtoPair::TpcAverageSeparationTrackV0Pos() const {
+  AliFemtoThreeVector diff;
+  double AveSep = 0.0;
+  int ipt = 0;
+  if (fTrack1->fNominalPosSample && fTrack2->fNominalPosSample){
+  while (fabs(fTrack1->fNominalPosSample[ipt].x())<9999. &&
+        fabs(fTrack1->fNominalPosSample[ipt].y())<9999. && 
+        fabs(fTrack1->fNominalPosSample[ipt].z())<9999. &&
+        fabs(fTrack2->fNominalPosSample[ipt].x())<9999. &&
+        fabs(fTrack2->fNominalPosSample[ipt].y())<9999. && 
+        fabs(fTrack2->fNominalPosSample[ipt].z())<9999. &&
+        (ipt<11)
+        ){
+    diff = fTrack1->fNominalPosSample[ipt] - fTrack2->fNominalPosSample[ipt];
+    ipt++;
+    AveSep += diff.mag();
+  }
+  AveSep = AveSep/(ipt+1.);
+  return (AveSep);}
+  else return -1;
+}
+//_______1st part is a track 2nd is a V0 considering Neg daughter
+double AliFemtoPair::TpcExitSeparationTrackV0Neg() const {
+  AliFemtoThreeVector diff = fTrack1->NominalTpcExitPoint() - fTrack2->TpcV0NegExitPoint();
+  return (diff.mag());
+}
+
+double AliFemtoPair::TpcEntranceSeparationTrackV0Neg() const {
+  AliFemtoThreeVector diff = fTrack1->NominalTpcEntrancePoint() - fTrack2->TpcV0NegEntrancePoint();
+  return (diff.mag());
+}
+
+double AliFemtoPair::TpcAverageSeparationTrackV0Neg() const {
+  AliFemtoThreeVector diff;
+  double AveSep = 0.0;
+  int ipt = 0;
+  if (fTrack1->fNominalPosSample && fTrack2->fTpcV0NegPosSample){
+  while (fabs(fTrack1->fNominalPosSample[ipt].x())<9999. &&
+        fabs(fTrack1->fNominalPosSample[ipt].y())<9999. && 
+        fabs(fTrack1->fNominalPosSample[ipt].z())<9999. &&
+        fabs(fTrack2->fTpcV0NegPosSample[ipt].x())<9999. &&
+        fabs(fTrack2->fTpcV0NegPosSample[ipt].y())<9999. && 
+        fabs(fTrack2->fTpcV0NegPosSample[ipt].z())<9999. &&
+        (ipt<11)
+        ){
+    diff = fTrack1->fNominalPosSample[ipt] - fTrack2->fTpcV0NegPosSample[ipt];
+    ipt++;
+    AveSep += diff.mag();
+  }
+  AveSep = AveSep/(ipt+1.);
+  return (AveSep);}
+  else return -1;
+}
+
+//_______1st part is a V0 considering Pos daughter 2nd is a V0 considering Pos daughter
+double AliFemtoPair::TpcExitSeparationV0PosV0Pos() const {
+  AliFemtoThreeVector diff = fTrack1->TpcV0PosExitPoint() - fTrack2->TpcV0PosExitPoint();
+  return (diff.mag());
+}
+
+double AliFemtoPair::TpcEntranceSeparationV0PosV0Pos() const {
+  AliFemtoThreeVector diff = fTrack1->TpcV0PosEntrancePoint() - fTrack2->TpcV0PosEntrancePoint();
+  return (diff.mag());
+}
+double AliFemtoPair::TpcAverageSeparationV0PosV0Pos() const {
+  AliFemtoThreeVector diff;
+  double AveSep = 0.0;
+  int ipt=0;
+  if (fTrack1->fNominalPosSample && (fTrack2->fNominalPosSample)){
+    while ((fabs(fTrack1->fNominalPosSample[ipt].x())<9999.) &&
+       (fabs(fTrack1->fNominalPosSample[ipt].y())<9999.) &&
+       (fabs(fTrack1->fNominalPosSample[ipt].z())<9999.) &&
+       (fabs(fTrack2->fNominalPosSample[ipt].x())<9999.) &&
+       (fabs(fTrack2->fNominalPosSample[ipt].y())<9999.) &&
+       (fabs(fTrack2->fNominalPosSample[ipt].z())<9999.) &&
+        (ipt<11)  
+       ){
+      diff = fTrack1->fNominalPosSample[ipt] - fTrack2->fNominalPosSample[ipt];
+      ipt++;
+      AveSep += diff.mag();
+    }
+    AveSep = AveSep/(ipt+1);
+    return (AveSep);}
+  else return -1;
+}
+
+//_______1st part is a V0 considering Pos daughter 2nd is a V0 considering Neg daughter
+double AliFemtoPair::TpcExitSeparationV0PosV0Neg() const {
+  AliFemtoThreeVector diff = fTrack1->TpcV0PosExitPoint() - fTrack2->TpcV0NegExitPoint();
+  return (diff.mag());
+}
+
+double AliFemtoPair::TpcEntranceSeparationV0PosV0Neg() const {
+  AliFemtoThreeVector diff = fTrack1->TpcV0PosEntrancePoint() - fTrack2->TpcV0NegEntrancePoint();
+  return (diff.mag());
+}
+double AliFemtoPair::TpcAverageSeparationV0PosV0Neg() const {
+  AliFemtoThreeVector diff;
+  double AveSep = 0.0;
+  int ipt = 0;
+  if (fTrack1->fNominalPosSample && fTrack2->fTpcV0NegPosSample){
+  while (fabs(fTrack1->fNominalPosSample[ipt].x())<9999. &&
+        fabs(fTrack1->fNominalPosSample[ipt].y())<9999. && 
+        fabs(fTrack1->fNominalPosSample[ipt].z())<9999. &&
+        fabs(fTrack2->fTpcV0NegPosSample[ipt].x())<9999. &&
+        fabs(fTrack2->fTpcV0NegPosSample[ipt].y())<9999. && 
+        fabs(fTrack2->fTpcV0NegPosSample[ipt].z())<9999. &&
+        (ipt<11)
+        ){
+    diff = fTrack1->fNominalPosSample[ipt] - fTrack2->fTpcV0NegPosSample[ipt];
+    ipt++;
+    AveSep += diff.mag();
+  }
+  AveSep = AveSep/(ipt+1.);
+  return (AveSep);}
+  else return -1; 
+}
+//_______1st part is a V0 considering Neg daughter 2nd is a V0 considering Pos daughter
+// this is to check the upper case
+double AliFemtoPair::TpcExitSeparationV0NegV0Pos() const {
+  AliFemtoThreeVector diff = fTrack1->TpcV0NegExitPoint() - fTrack2->TpcV0PosExitPoint();
+  return (diff.mag());
+}
+
+double AliFemtoPair::TpcEntranceSeparationV0NegV0Pos() const {
+  AliFemtoThreeVector diff = fTrack1->TpcV0NegEntrancePoint() - fTrack2->TpcV0PosEntrancePoint();
+  return (diff.mag());
+}
+double AliFemtoPair::TpcAverageSeparationV0NegV0Pos() const {
+   AliFemtoThreeVector diff;
+   double AveSep = 0.0;
+   int ipt = 0;
+   if ( fTrack1->fTpcV0NegPosSample &&  fTrack2->fNominalPosSample){
+     while (fabs(fTrack1->fTpcV0NegPosSample[ipt].x())<9999. &&
+           fabs(fTrack1->fTpcV0NegPosSample[ipt].y())<9999. && 
+           fabs(fTrack1->fTpcV0NegPosSample[ipt].z())<9999. &&
+           fabs(fTrack2->fNominalPosSample[ipt].x())<9999. &&
+           fabs(fTrack2->fNominalPosSample[ipt].y())<9999. && 
+           fabs(fTrack2->fNominalPosSample[ipt].z())<9999. &&
+           (ipt<11)
+           ){
+       diff = fTrack1->fTpcV0NegPosSample[ipt] - fTrack2->fNominalPosSample[ipt];
+       ipt++;
+       AveSep += diff.mag();
+     }
+     AveSep = AveSep/(ipt+1);
+     return (AveSep);}
+     else return -1;
+}
+//_______1st part is a V0 considering Neg daughter 2nd is a V0 considering Neg daughter
+double AliFemtoPair::TpcExitSeparationV0NegV0Neg() const {
+  AliFemtoThreeVector diff = fTrack1->TpcV0NegExitPoint() - fTrack2->TpcV0NegExitPoint();
+  return (diff.mag());
+}
+
+double AliFemtoPair::TpcEntranceSeparationV0NegV0Neg() const {
+  AliFemtoThreeVector diff = fTrack1->TpcV0NegEntrancePoint() - fTrack2->TpcV0NegEntrancePoint();
+  return (diff.mag());
+}
+double AliFemtoPair::TpcAverageSeparationV0NegV0Neg() const {
+   AliFemtoThreeVector diff;
+   double AveSep = 0.0;
+   int ipt=0;
+   if (fTrack1->fTpcV0NegPosSample && fTrack2->fTpcV0NegPosSample){
+     while (fabs(fTrack1->fTpcV0NegPosSample[ipt].x())<9999. &&
+           fabs(fTrack1->fTpcV0NegPosSample[ipt].y())<9999. && 
+           fabs(fTrack1->fTpcV0NegPosSample[ipt].z())<9999. &&
+           fabs(fTrack2->fTpcV0NegPosSample[ipt].x())<9999. &&
+           fabs(fTrack2->fTpcV0NegPosSample[ipt].y())<9999. && 
+           fabs(fTrack2->fTpcV0NegPosSample[ipt].z())<9999. &&
+           (ipt<11)
+           ){
+       diff = fTrack1->fTpcV0NegPosSample[ipt] - fTrack2->fTpcV0NegPosSample[ipt];
+       ipt++;
+       AveSep += diff.mag();
+     }
+     AveSep = AveSep/(ipt+1);
+     return (AveSep);}
+   else return -1;
+}
+
+//________________end V0 daughters exit/entrance/average separation calc.
+void AliFemtoPair::CalcMergingParFctn(short* tmpMergingParNotCalculatedFctn,
+                                  float* tmpZ1,float* tmpU1,
+                                  float* tmpZ2,float* tmpU2,
+                                  int *tmpSect1,int *tmpSect2,
+                                  double* tmpFracOfMergedRow,
+                                  double* tmpClosestRowAtDCA
+                                  ) const{
+  tmpMergingParNotCalculatedFctn=0;
+  double tDu, tDz;
+  int tN = 0;
+  *tmpFracOfMergedRow = 0.;
+  *tmpClosestRowAtDCA = 0.;
+  double tDist;
+  double tDistMax = 100000000.;
+  for(int ti=0 ; ti<45 ; ti++){
+    if(tmpSect1[ti]==tmpSect2[ti] && tmpSect1[ti]!=-1){
+       tDu = fabs(tmpU1[ti]-tmpU2[ti]);
+       tDz = fabs(tmpZ1[ti]-tmpZ2[ti]);
+       tN++;
+      if(ti<13){
+       *tmpFracOfMergedRow += (tDu<fMaxDuInner && tDz<fMaxDzInner);
+       tDist = ::sqrt(tDu*tDu/fMaxDuInner/fMaxDuInner+
+                    tDz*tDz/fMaxDzInner/fMaxDzInner);
+      }
+      else{
+       *tmpFracOfMergedRow += (tDu<fMaxDuOuter && tDz<fMaxDzOuter);
+       tDist = ::sqrt(tDu*tDu/fMaxDuOuter/fMaxDuOuter+
+                    tDz*tDz/fMaxDzOuter/fMaxDzOuter);
+       }
+      if(tDist<tDistMax){
+       fClosestRowAtDCA = ti+1;
+       tDistMax = tDist;
+      }
+      //fWeightedAvSep += tDist; // now, wrong but not used
+    }  
+  }
+  if(tN>0){
+    //fWeightedAvSep /= tN;
+    *tmpFracOfMergedRow /= tN;
+  }
+  else{
+    *tmpClosestRowAtDCA = -1;
+    *tmpFracOfMergedRow = -1.;
+    //fWeightedAvSep = -1.;
+  }
+}
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.h
new file mode 100644 (file)
index 0000000..109264a
--- /dev/null
@@ -0,0 +1,515 @@
+/***************************************************************************
+ *
+ * $Id: AliFemtoPair.h,v 1.17
+ *
+ * Author: Brian Laziuk, Yale University
+ *         slightly modified by Mike Lisa
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *    the Pair object is passed to the PairCuts for verification, and
+ *    then to the AddRealPair and AddMixedPair methods of the
+ *    Correlation Functions
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.19  2003/01/14 09:44:00  renault
+ * corrections on average separation calculation for tracks which doesn't cross
+ * all 45 padrows.
+ *
+ * Revision 1.18  2002/11/19 23:33:18  renault
+ * Enable average separation calculation for all combinaisons of
+ * V0 daughters and tracks
+ *
+ * Revision 1.16  2002/02/28 14:18:36  rcwells
+ * Added emissionAngle function to AliFemtoPair
+ *
+ * Revision 1.15  2001/12/14 23:11:30  fretiere
+ * Add class HitMergingCut. Add class fabricesPairCut = HitMerginCut + pair purity cuts. Add TpcLocalTransform function which convert to local tpc coord (not pretty). Modify AliFemtoTrack, AliFemtoParticle, AliFemtoHiddenInfo, AliFemtoPair to handle the hit information and cope with my code
+ *
+ * Revision 1.14  2001/04/03 21:04:36  kisiel
+ *
+ *
+ *   Changes needed to make the Theoretical code
+ *   work. The main code is the ThCorrFctn directory.
+ *   The most visible change is the addition of the
+ *   HiddenInfo to AliFemtoPair.
+ *
+ * Revision 1.13  2001/03/28 22:35:23  flierl
+ * changes and bugfixes in qYKP*
+ * add pairrapidity
+ *
+ * Revision 1.12  2001/01/22 22:56:40  laue
+ * Yano-Koonin-Podgoretskii Parametrisation added
+ *
+ * Revision 1.11  2000/10/26 16:09:16  lisa
+ * Added OpeningAngle PairCut class and method to AliFemtoPair
+ *
+ * Revision 1.10  2000/10/05 23:09:05  lisa
+ * Added kT-dependent radii to mixed-event simulator AND implemented AverageSeparation Cut and CorrFctn
+ *
+ * Revision 1.9  2000/07/17 20:03:17  lisa
+ * Implemented tools for addressing and assessing trackmerging
+ *
+ * Revision 1.8  2000/04/04 16:13:09  lisa
+ * AliFemtoPair:quality() now returns normalized value (and so is double) and add a CorrFctn which looks at quality()
+ *
+ * Revision 1.7  2000/04/03 22:09:12  rcwells
+ * Add member function ... quality().
+ *
+ * Revision 1.6  2000/02/13 21:13:34  lisa
+ * changed ambiguous AliFemtoPair::fourMomentum() to fourMomentumSum() and fourMomentumDiff() and fixed related bug in QvecCorrFctn
+ *
+ * Revision 1.5  2000/01/25 17:35:17  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.4  1999/07/29 16:16:34  lisa
+ * Selemons upgrade of AliFemtoPair class
+ *
+ * Revision 1.3  1999/07/22 18:49:10  lisa
+ * Implement idea of Fabrice to not create and delete AliFemtoPair all the time
+ *
+ * Revision 1.2  1999/07/06 22:33:22  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef ST_HBT_PAIR_HH
+#define ST_HBT_PAIR_HH
+
+#include <utility>
+
+#include "Infrastructure/AliFemtoParticle.h"
+#include "Infrastructure/AliFemtoTypes.h"
+
+class AliFemtoPair {
+public:
+  AliFemtoPair();
+  AliFemtoPair(AliFemtoParticle*, AliFemtoParticle*);
+  
+
+  ~AliFemtoPair();
+  //AliFemtoPair(const AliFemtoPair&);
+  //AliFemtoPair& operator=(const AliFemtoPair&);
+
+  // track Gets:
+  AliFemtoParticle* track1() const;
+  AliFemtoParticle* track2() const;
+  // track Sets:
+  void SetTrack1(const AliFemtoParticle* trkPtr);
+  void SetTrack2(const AliFemtoParticle* trkPtr);
+
+  AliFemtoLorentzVector fourMomentumDiff() const;
+  AliFemtoLorentzVector fourMomentumSum() const;
+  double qInv() const;
+  double kT()   const;
+  double mInv() const;
+  // pair rapidity
+  double rap() const;
+  double emissionAngle() const;
+
+  // Bertsch-Pratt momentum components in Pair Frame - written by Bekele/Humanic
+  double qSidePf() const;
+  double qOutPf() const;
+  double qLongPf() const;
+   
+  // Bertsch-Pratt momentum components in Local CMS (longitudinally comoving) frame
+  // - written by Bekele/Humanic
+  double qSideCMS() const;
+  double qOutCMS() const;
+  double qLongCMS() const;
+
+  double dKSide() const;
+  double dKOut() const;
+  double dKLong() const;
+
+  // Bertsch-Pratt momentum components in a longitudinally boosted frame
+  // the argument is the beta of the longitudinal boost (default is 0.0, meaning lab frame)
+  // - written by Bekele/Humanic
+  double qSideBf(double beta=0.0) const;
+  double qOutBf(double beta=0.0) const;
+  double qLongBf(double beta=0.0) const;
+
+  // Yano-Koonin-Podgoretskii Parametrisation 
+  // source rest frame (usually lab frame)
+  void qYKPCMS(double& qP, double& qT, double& q0) const ;
+  // longitudinal comoving frame
+  void qYKPLCMS(double& qP, double& qT, double& q0) const ;
+  // pair rest frame
+  void qYKPPF(double& qP, double& qT, double& q0) const ;
+
+
+  double quality() const;
+
+  // the following two methods calculate the "nominal" separation of the tracks 
+  // at the inner field cage (EntranceSeparation) and when they exit the TPC,
+  // which may be at the outer field cage, or at the endcaps.
+  // "nominal" means that the tracks are assumed to start at (0,0,0).  Making this
+  // assumption is important for the Event Mixing-- it is not a mistake. - MALisa
+  double NominalTpcExitSeparation() const;
+  double NominalTpcEntranceSeparation() const;
+  double NominalTpcAverageSeparation() const;
+  // adapted calculation of Entrance/Exit/Average Tpc separation to V0 daughters
+  double TpcExitSeparationTrackV0Pos() const;
+  double TpcEntranceSeparationTrackV0Pos() const;
+  double TpcAverageSeparationTrackV0Pos() const; 
+
+  double TpcExitSeparationTrackV0Neg() const;
+  double TpcEntranceSeparationTrackV0Neg() const;
+  double TpcAverageSeparationTrackV0Neg() const; 
+
+  double TpcExitSeparationV0PosV0Pos() const;
+  double TpcEntranceSeparationV0PosV0Pos() const;
+  double TpcAverageSeparationV0PosV0Pos() const; 
+
+  double TpcExitSeparationV0PosV0Neg() const;
+  double TpcEntranceSeparationV0PosV0Neg() const;
+  double TpcAverageSeparationV0PosV0Neg() const; 
+  double TpcExitSeparationV0NegV0Pos() const;
+  double TpcEntranceSeparationV0NegV0Pos() const;
+  double TpcAverageSeparationV0NegV0Pos() const; 
+  
+  double TpcExitSeparationV0NegV0Neg() const;
+  double TpcEntranceSeparationV0NegV0Neg() const;
+  double TpcAverageSeparationV0NegV0Neg() const; 
+
+  double pInv() const;
+  double KStar() const;
+  double KStarFlipped() const;
+  double CVK() const;
+  double CVKFlipped() const;
+  double qInvFlippedXY() const;
+
+  double OpeningAngle() const;
+
+  // Fabrice Private <<<
+  double KStarSide() const;
+  double KStarOut() const;
+  double KStarLong() const;
+
+  float PionPairProbability() const;
+  float ElectronPairProbability() const;
+  float KaonPairProbability() const;
+  float ProtonPairProbability() const;
+  float KaonPionPairProbability() const;
+
+  double dcaInsideTpc() const;
+  double quality2() const;
+
+ /* double KStarGlobal() const;
+  double CVKGlobal() const;
+  double KStarSideGlobal() const;
+  double KStarOutGlobal() const;
+  double KStarLongGlobal() const;*/
+
+  void setMergingPar(double aMaxDuInner, double aMaxDzInner,
+                    double aMaxDuOuter, double aMaxDzOuter);
+  void setDefaultHalfFieldMergingPar();
+  void setDefaultFullFieldMergingPar();
+  double getFracOfMergedRow() const;
+  double getClosestRowAtDCA() const;
+  double getWeightedAvSep() const;
+  // >>>
+  double getFracOfMergedRowTrkV0Pos() const;
+  double getClosestRowAtDCATrkV0Pos() const;
+
+  double getFracOfMergedRowTrkV0Neg() const;
+  double getClosestRowAtDCATrkV0Neg() const;
+
+  double getFracOfMergedRowV0PosV0Neg() const;
+  double getFracOfMergedRowV0NegV0Pos() const;
+  double getFracOfMergedRowV0PosV0Pos() const;
+  double getFracOfMergedRowV0NegV0Neg() const;
+
+private:
+  AliFemtoParticle* fTrack1;
+  AliFemtoParticle* fTrack2;
+
+  mutable short fNonIdParNotCalculated;
+  mutable double fDKSide;
+  mutable double fDKOut;
+  mutable double fDKLong;
+  mutable double fCVK;
+  mutable double kStarCalc;
+  void calcNonIdPar() const;
+
+  mutable short fNonIdParNotCalculatedGlobal;
+ /* mutable double fDKSideGlobal;
+  mutable double fDKOutGlobal;
+  mutable double fDKLongGlobal;
+  mutable double kStarCalcGlobal;
+  mutable double fCVKGlobal;*/
+  //void calcNonIdParGlobal() const;
+
+  mutable short fMergingParNotCalculated;
+  mutable double fWeightedAvSep;
+  mutable double fFracOfMergedRow;
+  mutable double fClosestRowAtDCA;
+
+  mutable short fMergingParNotCalculatedTrkV0Pos;
+  mutable double fFracOfMergedRowTrkV0Pos;
+  mutable double fClosestRowAtDCATrkV0Pos;
+
+  mutable short fMergingParNotCalculatedTrkV0Neg;
+  mutable double fFracOfMergedRowTrkV0Neg;
+  mutable double fClosestRowAtDCATrkV0Neg;
+
+  mutable short fMergingParNotCalculatedV0PosV0Neg;
+  mutable double fFracOfMergedRowV0PosV0Neg;
+  mutable double fClosestRowAtDCAV0PosV0Neg;
+
+  mutable short fMergingParNotCalculatedV0NegV0Pos;
+  mutable double fFracOfMergedRowV0NegV0Pos;
+  mutable double fClosestRowAtDCAV0NegV0Pos;
+
+  mutable short fMergingParNotCalculatedV0PosV0Pos;
+  mutable double fFracOfMergedRowV0PosV0Pos;
+  mutable double fClosestRowAtDCAV0PosV0Pos;
+
+  mutable short fMergingParNotCalculatedV0NegV0Neg;
+  mutable double fFracOfMergedRowV0NegV0Neg;
+  mutable double fClosestRowAtDCAV0NegV0Neg;
+
+  static double fMaxDuInner;
+  static double fMaxDzInner;
+  static double fMaxDuOuter;
+  static double fMaxDzOuter;
+  void calcMergingPar() const;
+
+  void CalcMergingParFctn(short* tmpMergingParNotCalculatedFctn,
+                         float* tmpZ1,float* tmpU1,
+                         float* tmpZ2,float* tmpU2,
+                         int *tmpSect1,int *tmpSect2,
+                         double* tmpFracOfMergedRow,
+                         double* tmpClosestRowAtDCA
+                         ) const;
+
+  void resetParCalculated();
+};
+
+inline void AliFemtoPair::resetParCalculated(){
+  fNonIdParNotCalculated=1;
+  fNonIdParNotCalculatedGlobal=1;
+  fMergingParNotCalculated=1;
+  fMergingParNotCalculatedTrkV0Pos=1;
+  fMergingParNotCalculatedTrkV0Neg=1;
+  fMergingParNotCalculatedV0PosV0Pos=1;
+  fMergingParNotCalculatedV0NegV0Pos=1;
+  fMergingParNotCalculatedV0PosV0Neg=1;
+  fMergingParNotCalculatedV0NegV0Neg=1;
+}
+
+inline void AliFemtoPair::SetTrack1(const AliFemtoParticle* trkPtr){
+  fTrack1=(AliFemtoParticle*)trkPtr;
+  resetParCalculated();
+}
+inline void AliFemtoPair::SetTrack2(const AliFemtoParticle* trkPtr){
+  fTrack2=(AliFemtoParticle*)trkPtr;
+  resetParCalculated();
+}
+
+inline AliFemtoParticle* AliFemtoPair::track1() const {return fTrack1;}
+inline AliFemtoParticle* AliFemtoPair::track2() const {return fTrack2;}
+
+inline double AliFemtoPair::dKSide() const{
+  if(fNonIdParNotCalculated) calcNonIdPar();
+  return fDKSide;
+}
+inline double AliFemtoPair::dKOut() const{
+  if(fNonIdParNotCalculated) calcNonIdPar();
+  return fDKOut;
+}
+inline double AliFemtoPair::dKLong() const{
+  if(fNonIdParNotCalculated) calcNonIdPar();
+  return fDKLong;
+}
+inline double AliFemtoPair::KStar() const{
+  if(fNonIdParNotCalculated) calcNonIdPar();
+  return kStarCalc;
+}
+inline double AliFemtoPair::qInv() const {
+  AliFemtoLorentzVector tDiff = (fTrack1->FourMomentum()-fTrack2->FourMomentum());
+  return ( -1.* tDiff.m());
+}
+
+// Fabrice private <<<
+inline double AliFemtoPair::KStarSide() const{
+  if(fNonIdParNotCalculated) calcNonIdPar();
+  return fDKSide;//mKStarSide;
+}
+inline double AliFemtoPair::KStarOut() const{
+  if(fNonIdParNotCalculated) calcNonIdPar();
+  return fDKOut;//mKStarOut;
+}
+inline double AliFemtoPair::KStarLong() const{
+  if(fNonIdParNotCalculated) calcNonIdPar();
+  return fDKLong;//mKStarLong;
+}
+inline double AliFemtoPair::CVK() const{
+  if(fNonIdParNotCalculated) calcNonIdPar();
+  return fCVK;
+}
+
+/*inline double AliFemtoPair::KStarGlobal() const{
+  if(fNonIdParNotCalculatedGlobal) calcNonIdParGlobal();
+  return kStarCalcGlobal;
+}
+inline double AliFemtoPair::KStarSideGlobal() const{
+  if(fNonIdParNotCalculatedGlobal) calcNonIdParGlobal();
+  return fDKSideGlobal;//mKStarSide;
+}
+inline double AliFemtoPair::KStarOutGlobal() const{
+  if(fNonIdParNotCalculatedGlobal) calcNonIdParGlobal();
+  return fDKOutGlobal;//mKStarOut;
+}
+inline double AliFemtoPair::KStarLongGlobal() const{
+  if(fNonIdParNotCalculatedGlobal) calcNonIdParGlobal();
+  return fDKLongGlobal;//mKStarLong;
+}
+inline double AliFemtoPair::CVKGlobal() const{
+  if(fNonIdParNotCalculatedGlobal) calcNonIdParGlobal();
+  return fCVKGlobal;
+}*/
+
+
+inline float AliFemtoPair::PionPairProbability() const{
+  return (fTrack1->Track()->PidProbPion()) * 
+         (fTrack2->Track()->PidProbPion());
+}
+inline float AliFemtoPair::ElectronPairProbability() const{
+  return (fTrack1->Track()->PidProbElectron()) * 
+         (fTrack2->Track()->PidProbElectron());
+}
+inline float AliFemtoPair::KaonPairProbability() const{
+  return (fTrack1->Track()->PidProbKaon()) * 
+         (fTrack2->Track()->PidProbKaon());
+}
+inline float AliFemtoPair::ProtonPairProbability() const{
+  return (fTrack1->Track()->PidProbProton()) * 
+         (fTrack2->Track()->PidProbProton());
+}
+inline float AliFemtoPair::KaonPionPairProbability() const{
+  return (fTrack1->Track()->PidProbKaon()) * 
+         (fTrack2->Track()->PidProbPion());
+}
+
+inline double AliFemtoPair::getFracOfMergedRow() const{
+  if(fMergingParNotCalculated) calcMergingPar();
+  return fFracOfMergedRow;
+}
+inline double AliFemtoPair::getClosestRowAtDCA() const { 
+  if(fMergingParNotCalculated) calcMergingPar();
+  return fClosestRowAtDCA;
+}
+inline double AliFemtoPair::getWeightedAvSep() const {
+  if(fMergingParNotCalculated) calcMergingPar();
+  return fWeightedAvSep;
+}
+
+
+inline double AliFemtoPair::getFracOfMergedRowTrkV0Pos() const{
+  if(fMergingParNotCalculatedTrkV0Pos)
+    CalcMergingParFctn(&fMergingParNotCalculatedTrkV0Pos,
+                      &(fTrack1->fZ[0]),&(fTrack1->fU[0]),
+                      &(fTrack2->fZ[0]),&(fTrack2->fU[0]),
+                      &(fTrack1->fSect[0]),&(fTrack2->fSect[0]),
+                      &(fFracOfMergedRowTrkV0Pos),&(fClosestRowAtDCATrkV0Pos)
+                      );
+  return fFracOfMergedRowTrkV0Pos;
+}
+inline double AliFemtoPair::getClosestRowAtDCATrkV0Pos() const{
+  if(fMergingParNotCalculatedTrkV0Pos)
+    CalcMergingParFctn(&fMergingParNotCalculatedTrkV0Pos,
+                      &(fTrack1->fZ[0]),&(fTrack1->fU[0]),
+                      &(fTrack2->fZ[0]),&(fTrack2->fU[0]),
+                      &(fTrack1->fSect[0]),&(fTrack2->fSect[0]),
+                      &fFracOfMergedRowTrkV0Pos,&fClosestRowAtDCATrkV0Pos
+                      );
+  return fClosestRowAtDCATrkV0Pos;
+}
+inline double AliFemtoPair::getFracOfMergedRowTrkV0Neg() const{
+  if(fMergingParNotCalculatedTrkV0Neg)
+    CalcMergingParFctn(&fMergingParNotCalculatedTrkV0Neg,
+                      &(fTrack1->fZ[0]),&(fTrack1->fU[0]),
+                      &(fTrack2->fV0NegZ[0]),&(fTrack2->fV0NegU[0]),
+                      &(fTrack1->fSect[0]),&(fTrack2->fV0NegSect[0]),
+                      &(fFracOfMergedRowTrkV0Neg),&(fClosestRowAtDCATrkV0Neg)
+                      );
+  return fFracOfMergedRowTrkV0Neg;
+}
+inline double AliFemtoPair::getClosestRowAtDCATrkV0Neg() const{
+  if(fMergingParNotCalculatedTrkV0Neg)
+    CalcMergingParFctn(&fMergingParNotCalculatedTrkV0Neg,
+                      &(fTrack1->fZ[0]),&(fTrack1->fU[0]),
+                      &(fTrack2->fV0NegZ[0]),&(fTrack2->fV0NegU[0]),
+                      &(fTrack1->fSect[0]),&(fTrack2->fV0NegSect[0]),
+                      &fFracOfMergedRowTrkV0Neg,&fClosestRowAtDCATrkV0Neg
+                      );
+  return fClosestRowAtDCATrkV0Neg;
+}
+inline double AliFemtoPair::getFracOfMergedRowV0PosV0Neg() const{
+  if(fMergingParNotCalculatedV0PosV0Neg)
+    CalcMergingParFctn(&fMergingParNotCalculatedV0PosV0Neg,
+                      &(fTrack1->fZ[0]),&(fTrack1->fU[0]),
+                      &(fTrack2->fV0NegZ[0]),&(fTrack2->fV0NegU[0]),
+                      &(fTrack1->fSect[0]),&(fTrack2->fV0NegSect[0]),
+                      &(fFracOfMergedRowV0PosV0Neg),
+                      &(fClosestRowAtDCAV0PosV0Neg)
+                      );
+  return fFracOfMergedRowV0PosV0Neg;
+}
+inline double AliFemtoPair::getFracOfMergedRowV0NegV0Pos() const{
+  if(fMergingParNotCalculatedV0NegV0Pos)
+    CalcMergingParFctn(&fMergingParNotCalculatedV0NegV0Pos,
+                      &(fTrack1->fV0NegZ[0]),&(fTrack1->fV0NegU[0]),
+                      &(fTrack2->fZ[0]),&(fTrack2->fU[0]),
+                      &(fTrack1->fV0NegSect[0]),
+                      &(fTrack2->fSect[0]),
+                      &(fFracOfMergedRowV0NegV0Pos),
+                      &(fClosestRowAtDCAV0NegV0Pos)
+                      );
+  return fFracOfMergedRowV0NegV0Pos;
+}
+inline double AliFemtoPair::getFracOfMergedRowV0PosV0Pos() const{
+  if(fMergingParNotCalculatedV0PosV0Pos)
+    CalcMergingParFctn(&fMergingParNotCalculatedV0PosV0Pos,
+                      &(fTrack1->fZ[0]),&(fTrack1->fU[0]),
+                      &(fTrack2->fZ[0]),&(fTrack2->fU[0]),
+                      &(fTrack1->fSect[0]),
+                      &(fTrack2->fSect[0]),
+                      &(fFracOfMergedRowV0PosV0Pos),
+                      &(fClosestRowAtDCAV0PosV0Pos)
+                      );
+  return fFracOfMergedRowV0PosV0Pos;
+}
+inline double AliFemtoPair::getFracOfMergedRowV0NegV0Neg() const{
+  if(fMergingParNotCalculatedV0NegV0Neg)
+    CalcMergingParFctn(&fMergingParNotCalculatedV0NegV0Neg,
+                      &(fTrack1->fV0NegZ[0]),&(fTrack1->fV0NegU[0]),
+                      &(fTrack2->fV0NegZ[0]),&(fTrack2->fV0NegU[0]),
+                      &(fTrack1->fV0NegSect[0]),
+                      &(fTrack2->fV0NegSect[0]),
+                      &(fFracOfMergedRowV0NegV0Neg),
+                      &(fClosestRowAtDCAV0NegV0Neg)
+                      );
+  return fFracOfMergedRowV0NegV0Neg;
+}
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.cxx
new file mode 100644 (file)
index 0000000..9dd4bda
--- /dev/null
@@ -0,0 +1,607 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   Particle objects are part of the PicoEvent, which is what is
+ *   stored in the EventMixingBuffers
+ *   A Track object gets converted to a Particle object if it
+ *   passes the ParticleCut of an Analysis
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.22  2003/09/02 17:58:32  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.21  2003/05/07 15:30:43  magestro
+ * Fixed bug related to finding merged hits (commit for Fabrice)
+ *
+ * Revision 1.20  2003/01/14 09:41:26  renault
+ * changes on average separation calculation, hit shared finder and memory optimisation
+ * for Z,U and Sectors variables.
+ *
+ * Revision 1.19  2002/12/12 17:01:49  kisiel
+ * Hidden Information handling and purity calculation
+ *
+ * Revision 1.18  2002/11/19 23:36:00  renault
+ * Enable calculation of exit/entrance separation for V0 daughters
+ *
+ * Revision 1.17  2001/12/14 23:11:30  fretiere
+ * Add class HitMergingCut. Add class fabricesPairCut = HitMerginCut + pair purity cuts. Add TpcLocalTransform function which convert to local tpc coord (not pretty). Modify AliFemtoTrack, AliFemtoParticle, AliFemtoHiddenInfo, AliFemtoPair to handle the hit information and cope with my code
+ *
+ * Revision 1.16  2001/05/25 23:23:59  lisa
+ * Added in AliFemtoKink stuff
+ *
+ * Revision 1.15  2001/04/03 21:04:36  kisiel
+ *
+ *
+ *   Changes needed to make the Theoretical code
+ *   work. The main code is the ThCorrFctn directory.
+ *   The most visible change is the addition of the
+ *   HiddenInfo to AliFemtoPair.
+ *
+ * Revision 1.14  2000/10/05 23:09:05  lisa
+ * Added kT-dependent radii to mixed-event simulator AND implemented AverageSeparation Cut and CorrFctn
+ *
+ * Revision 1.13  2000/08/31 22:31:31  laue
+ * AliFemtoAnalysis: output changed (a little bit less)
+ * AliFemtoEvent: new version, members for reference mult added
+ * AliFemtoIOBinary: new IO for new AliFemtoEvent version
+ * AliFemtoTypes: TTree typedef to AliFemtoTTree added
+ * AliFemtoVertexAnalysis: overflow and underflow added
+ *
+ * Revision 1.12  2000/07/23 13:52:56  laue
+ * NominalExitPoint set to (-9999.,-9999.-9999.) if helix.at()
+ * returns nan (not a number).
+ *
+ * Revision 1.11  2000/07/19 17:18:48  laue
+ * Calculation of Entrance and Exit point added in AliFemtoParticle constructor
+ *
+ * Revision 1.10  2000/07/17 20:03:17  lisa
+ * Implemented tools for addressing and assessing trackmerging
+ *
+ * Revision 1.9  2000/07/16 21:38:23  laue
+ * AliFemtoCoulomb.cxx AliFemtoSectoredAnalysis.cxx : updated for standalone version
+ * AliFemtoV0.cc AliFemtoV0.h : some cast to prevent compiling warnings
+ * AliFemtoParticle.cc AliFemtoParticle.h : pointers fTrack,fV0 initialized to 0
+ * AliFemtoIOBinary.cc : some printouts in #ifdef STHBTDEBUG
+ * AliFemtoEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
+ *                 solution
+ *
+ * Revision 1.8  2000/05/03 17:44:43  laue
+ * AliFemtoEvent, AliFemtoTrack & AliFemtoV0 declared friend to AliFemtoIOBinary
+ * AliFemtoParticle updated for V0 pos,neg track Id
+ *
+ * Revision 1.7  2000/04/03 16:21:51  laue
+ * some include files changed
+ * Multi track cut added
+ *
+ * Revision 1.6  1999/12/11 15:58:29  lisa
+ * Add vertex decay position datum and accessor to AliFemtoParticle to allow pairwise cuts on seperation of V0s
+ *
+ * Revision 1.5  1999/09/17 22:38:02  lisa
+ * first full integration of V0s into AliFemto framework
+ *
+ * Revision 1.4  1999/09/01 19:04:53  lisa
+ * update Particle class AND add parity cf and Randys Coulomb correction
+ *
+ * Revision 1.3  1999/07/06 22:33:23  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.2  1999/06/29 17:50:27  fisyak
+ * formal changes to account new StEvent, does not complie yet
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#include "Infrastructure/AliFemtoParticle.h"
+//#include "math_constants.h"
+#ifdef __CC5__
+  #include <math.h>
+#else
+  #include <cmath>
+#endif
+
+
+#include "TMath.h"
+using namespace TMath;
+
+double AliFemtoParticle::fPrimPimPar0= 9.05632e-01;
+double AliFemtoParticle::fPrimPimPar1= -2.26737e-01;
+double AliFemtoParticle::fPrimPimPar2= -1.03922e-01;
+double AliFemtoParticle::fPrimPipPar0= 9.09616e-01;
+double AliFemtoParticle::fPrimPipPar1= -9.00511e-02;
+double AliFemtoParticle::fPrimPipPar2= -6.02940e-02;
+double AliFemtoParticle::fPrimPmPar0= 0.;
+double AliFemtoParticle::fPrimPmPar1= 0.;
+double AliFemtoParticle::fPrimPmPar2= 0.;
+double AliFemtoParticle::fPrimPpPar0= 0.;
+double AliFemtoParticle::fPrimPpPar1= 0.;
+double AliFemtoParticle::fPrimPpPar2= 0.;
+
+int TpcLocalTransform(AliFmThreeVectorD& xgl, 
+                     int& iSector, 
+                     int& iPadrow, 
+                     float& xlocal,
+                     double& ttPhi);
+
+
+//_____________________
+AliFemtoParticle::AliFemtoParticle() : fTrack(0), fV0(0), fKink(0), fHiddenInfo(0) {
+  /* no-op for default */
+  //  cout << "Created particle " << this << endl;
+}
+//_____________________
+AliFemtoParticle::~AliFemtoParticle(){
+  //  cout << "Issuing delete for AliFemtoParticle." << endl;
+
+  if (fTrack) delete fTrack;
+  if (fV0) {
+    delete[] fTpcV0NegPosSample;
+    delete[] fV0NegZ;
+    delete[] fV0NegU;
+    delete[] fV0NegSect;
+    delete fV0;
+  }
+  if (fKink) delete fKink;
+  //  cout << "Trying to delete HiddenInfo: " << fHiddenInfo << endl;
+  if (fHiddenInfo) 
+    {
+      //      cout << "Deleting HiddenInfo." << endl;
+      delete fHiddenInfo;
+    }
+  //  cout << "Deleted particle " << this << endl;
+}
+//_____________________
+AliFemtoParticle::AliFemtoParticle(const AliFemtoTrack* const hbtTrack,const double& mass) : fTrack(0), fV0(0), fKink(0), fHiddenInfo(0) {
+  
+  
+  // I know there is a better way to do this...
+  fTrack = new AliFemtoTrack(*hbtTrack);
+  AliFemtoThreeVector temp = hbtTrack->P();
+  fFourMomentum.setVect(temp);
+  double ener = ::sqrt(temp.mag2()+mass*mass);
+  fFourMomentum.setE(ener);
+//  fMap[0] = hbtTrack->TopologyMap(0);
+ // fMap[1] = hbtTrack->TopologyMap(1);
+ // fNhits = hbtTrack->NHits();
+  fHelix = hbtTrack->Helix();
+  //CalculateNominalTpcExitAndEntrancePoints();
+
+  fPrimaryVertex.setX(0.);
+  fPrimaryVertex.setY(0.);
+  fPrimaryVertex.setZ(0.);
+  fSecondaryVertex.setX(0.);
+  fSecondaryVertex.setY(0.);
+  fSecondaryVertex.setZ(0.);
+  /* TO JA ODZNACZYLEM NIE WIEM DLACZEGO
+  CalculateTpcExitAndEntrancePoints(&fHelix,&fPrimaryVertex,
+                                   &fSecondaryVertex,
+                                   &fNominalTpcEntrancePoint,
+                                   &fNominalTpcExitPoint,
+                                   &mNominalPosSample[0],
+                                   &fZ[0],
+                                   &fU[0],
+                                   &fSect[0]);
+  */
+  CalculatePurity();
+  // ***
+  fHiddenInfo= 0;
+  if(hbtTrack->ValidHiddenInfo()){
+    fHiddenInfo= hbtTrack->getHiddenInfo()->getParticleHiddenInfo()->clone();
+  }
+  // ***
+  //  cout << "Created particle " << this << endl;
+
+}
+//_____________________
+AliFemtoParticle::AliFemtoParticle(const AliFemtoV0* const hbtV0,const double& mass) : fTrack(0), fV0(0), fKink(0), fHiddenInfo(0) {
+  fV0 = new AliFemtoV0(*hbtV0);
+ //fMap[0]= 0;
+  //fMap[1]= 0;
+  // I know there is a better way to do this...
+  AliFemtoThreeVector temp = hbtV0->momV0();
+  fFourMomentum.setVect(temp);
+  double ener = ::sqrt(temp.mag2()+mass*mass);
+  fFourMomentum.setE(ener);
+  // Calculating TpcEntrancePoint for Positive V0 daugther
+  fPrimaryVertex = hbtV0->primaryVertex();
+  fSecondaryVertex = hbtV0->decayVertexV0();
+  fHelixV0Pos = hbtV0->HelixPos();
+
+  fTpcV0NegPosSample = new AliFemtoThreeVector[45];//for V0Neg
+  fV0NegZ = new float[45];//for V0Neg
+  fV0NegU = new float[45];//for V0Neg
+  fV0NegSect = new int[45];//for V0Neg
+  CalculateTpcExitAndEntrancePoints(&fHelixV0Pos,&fPrimaryVertex,
+                                   &fSecondaryVertex,
+                                   &fTpcV0PosEntrancePoint,
+                                   &fTpcV0PosExitPoint,
+                                   &fNominalPosSample[0],
+                                   &fZ[0],
+                                   &fU[0],&fSect[0]);
+  fHelixV0Neg = hbtV0->HelixNeg();
+
+  CalculateTpcExitAndEntrancePoints(&fHelixV0Neg,
+                                   &fPrimaryVertex,
+                                   &fSecondaryVertex,
+                                   &fTpcV0NegEntrancePoint,
+                                   &fTpcV0NegExitPoint,
+                                   &fTpcV0NegPosSample[0],
+                                   &fV0NegZ[0],
+                                   &fV0NegU[0],&fV0NegSect[0]);
+
+  // ***
+  fHiddenInfo= 0;
+  if(hbtV0->ValidHiddenInfo()){
+    fHiddenInfo= hbtV0->getHiddenInfo()->clone();
+  }
+  // ***
+}
+//_____________________
+AliFemtoParticle::AliFemtoParticle(const AliFemtoKink* const hbtKink,const double& mass) : fTrack(0), fV0(0), fHiddenInfo(0) {
+  fKink = new AliFemtoKink(*hbtKink);
+ // fMap[0]= 0;
+  //fMap[1]= 0;
+  // I know there is a better way to do this...
+  AliFemtoThreeVector temp = hbtKink->Parent().P();
+  fFourMomentum.setVect(temp);
+  double ener = ::sqrt(temp.mag2()+mass*mass);
+  fFourMomentum.setE(ener);
+}
+
+//_____________________
+AliFemtoParticle::AliFemtoParticle(const AliFemtoXi* const hbtXi, const double& mass)  {
+  fXi = new AliFemtoXi(*hbtXi);
+ // fMap[0]= 0;
+  //fMap[1]= 0;
+  AliFemtoThreeVector temp;// = hbtXi->mMofXi;
+  fFourMomentum.setVect(temp);
+  double ener = ::sqrt(temp.mag2()+mass*mass);
+  fFourMomentum.setE(ener);
+  fHiddenInfo = 0;
+}
+//_____________________
+const AliFemtoThreeVector& AliFemtoParticle::NominalTpcExitPoint() const{
+  // in future, may want to calculate this "on demand" only, sot this routine may get more sophisticated
+  // for now, we calculate Exit and Entrance points upon instantiation
+  return fNominalTpcExitPoint;
+}
+//_____________________
+const AliFemtoThreeVector& AliFemtoParticle::NominalTpcEntrancePoint() const{
+  // in future, may want to calculate this "on demand" only, sot this routine may get more sophisticated
+  // for now, we calculate Exit and Entrance points upon instantiation
+  return fNominalTpcEntrancePoint;
+}
+//_____________________
+void AliFemtoParticle::CalculatePurity(){
+  double tPt = fFourMomentum.perp();
+  // pi -
+  fPurity[0] = fPrimPimPar0*(1.-exp((tPt-fPrimPimPar1)/fPrimPimPar2));
+  fPurity[0] *= fTrack->PidProbPion();
+  // pi+
+  fPurity[1] = fPrimPipPar0*(1.-exp((tPt-fPrimPipPar1)/fPrimPipPar2));
+  fPurity[1] *= fTrack->PidProbPion();
+  // K-
+  fPurity[2] = fTrack->PidProbKaon();
+  // K+
+  fPurity[3] = fTrack->PidProbKaon();
+  // pbar
+  fPurity[4] = fTrack->PidProbProton();
+  // p
+  fPurity[5] = fTrack->PidProbProton();
+}
+
+double AliFemtoParticle::GetPionPurity()
+{
+  if (fTrack->Charge()>0)
+    return fPurity[1];
+  else
+    return fPurity[0];
+}
+double AliFemtoParticle::GetKaonPurity()
+{
+  if (fTrack->Charge()>0)
+    return fPurity[3];
+  else
+    return fPurity[2];
+}
+double AliFemtoParticle::GetProtonPurity()
+{
+  if (fTrack->Charge()>0)
+    return fPurity[5];
+  else
+    return fPurity[4];
+}
+
+void AliFemtoParticle::CalculateTpcExitAndEntrancePoints(AliFmPhysicalHelixD* tHelix,
+                                                      AliFemtoThreeVector*  PrimVert,
+                                                      AliFemtoThreeVector*  SecVert,
+                                                      AliFemtoThreeVector* tmpTpcEntrancePoint,
+                                                      AliFemtoThreeVector* tmpTpcExitPoint,
+                                                      AliFemtoThreeVector* tmpPosSample,
+                                                      float* tmpZ,
+                                                      float* tmpU,
+                                                      int* tmpSect){
+  // this calculates the exit point of a secondary track, 
+  // either through the endcap or through the Outer Field Cage
+  // We assume the track to start at tHelix.origin-PrimaryVertex
+  // it also calculates the entrance point of the secondary track, 
+  // which is the point at which it crosses the
+  // inner field cage
+  //  static AliFemtoThreeVector ZeroVec(0.,0.,0.);
+  AliFemtoThreeVector ZeroVec(0.,0.,0.);
+//   ZeroVec.setX(tHelix->origin().x()-PrimVert->x());
+//   ZeroVec.setY(tHelix->origin().y()-PrimVert->y());
+//   ZeroVec.setZ(tHelix->origin().z()-PrimVert->z());
+  ZeroVec.setX(SecVert->x()-PrimVert->x());
+  ZeroVec.setY(SecVert->y()-PrimVert->y());
+  ZeroVec.setZ(SecVert->z()-PrimVert->z());
+  double dip, curv, phase;
+  int h;
+  curv = tHelix->curvature();
+  dip  = tHelix->dipAngle();
+  phase= tHelix->phase();
+  h    = tHelix->h();
+  
+  AliFmHelixD hel(curv,dip,phase,ZeroVec,h);
+
+  pairD candidates;
+  double sideLength;  // this is how much length to go to leave through sides of TPC
+  double endLength;  // this is how much length to go to leave through endcap of TPC
+  // figure out how far to go to leave through side...
+  candidates = hel.pathLength(200.0);  // bugfix MAL jul00 - 200cm NOT 2cm
+  sideLength = (candidates.first > 0) ? candidates.first : candidates.second;
+
+  static AliFemtoThreeVector WestEnd(0.,0.,200.);  // bugfix MAL jul00 - 200cm NOT 2cm
+  static AliFemtoThreeVector EastEnd(0.,0.,-200.); // bugfix MAL jul00 - 200cm NOT 2cm
+  static AliFemtoThreeVector EndCapNormal(0.,0.,1.0);
+
+  endLength = hel.pathLength(WestEnd,EndCapNormal);
+  if (endLength < 0.0) endLength = hel.pathLength(EastEnd,EndCapNormal);
+
+  if (endLength < 0.0) cout << 
+                        "AliFemtoParticle::CalculateTpcExitAndEntrancePoints(): "
+                            << "Hey -- I cannot find an exit point out endcaps" << endl;
+  // OK, firstExitLength will be the shortest way out of the detector...
+  double firstExitLength = (endLength < sideLength) ? endLength : sideLength;
+  // now then, let's return the POSITION at which particle leaves TPC...
+  *tmpTpcExitPoint = hel.at(firstExitLength);
+  // Finally, calculate the position at which the track crosses the inner field cage
+  candidates = hel.pathLength(50.0);  // bugfix MAL jul00 - 200cm NOT 2cm
+
+  sideLength = (candidates.first > 0) ? candidates.first : candidates.second;
+  //  cout << "sideLength 2 ="<<sideLength << endl;
+  *tmpTpcEntrancePoint = hel.at(sideLength);
+  // This is the secure way !  
+  if (IsNaN(tmpTpcEntrancePoint->x()) || 
+      IsNaN(tmpTpcEntrancePoint->y()) || 
+      IsNaN(tmpTpcEntrancePoint->z()) ){ 
+    cout << "tmpTpcEntrancePoint NAN"<< endl; 
+    cout << "tmpNominalTpcEntrancePoint = " <<tmpTpcEntrancePoint<< endl;
+    tmpTpcEntrancePoint->setX(-9999.);
+    tmpTpcEntrancePoint->setY(-9999.);
+    tmpTpcEntrancePoint->setZ(-9999.);
+  } 
+    
+  if (IsNaN(tmpTpcExitPoint->x()) || 
+      IsNaN(tmpTpcExitPoint->y()) || 
+      IsNaN(tmpTpcExitPoint->z()) ) {
+//     cout << "tmpTpcExitPoint NAN set at (-9999,-9999,-9999)"<< endl; 
+//     cout << "tmpTpcExitPoint X= " <<tmpTpcExitPoint->x()<< endl;
+//     cout << "tmpTpcExitPoint Y= " <<tmpTpcExitPoint->y()<< endl;
+//     cout << "tmpTpcExitPoint Z= " <<tmpTpcExitPoint->z()<< endl;
+    tmpTpcExitPoint->setX(-9999.);
+    tmpTpcExitPoint->setY(-9999.);
+    tmpTpcExitPoint->setZ(-9999.);
+  }
+
+
+//   if (IsNaN(tmpTpcExitPoint->x())) *tmpTpcExitPoint = AliFemtoThreeVector(-9999.,-9999.,-9999); 
+//   if (IsNaN(tmpTpcEntrancetPoint->x())) *tmpTpcEntrancePoint = AliFemtoThreeVector(-9999.,-9999.,-9999); 
+  //  cout << "tmpTpcEntrancePoint"<<*tmpTpcEntrancePoint << endl;
+
+  // 03Oct00 - mal.  OK, let's try something a little more 
+  // along the lines of NA49 and E895 strategy.
+  // calculate the "nominal" position at N radii (say N=11) 
+  // within the TPC, and for a pair cut
+  // use the average separation of these N
+  int irad = 0;
+  candidates = hel.pathLength(50.0);
+  sideLength = (candidates.first > 0) ? candidates.first : candidates.second;
+  while (irad<11 && !IsNaN(sideLength)){ 
+    float radius = 50.0 + irad*15.0;
+    candidates = hel.pathLength(radius);
+    sideLength = (candidates.first > 0) ? candidates.first : candidates.second;
+    tmpPosSample[irad] = hel.at(sideLength);
+    if(IsNaN(tmpPosSample[irad].x()) ||
+       IsNaN(tmpPosSample[irad].y()) ||
+       IsNaN(tmpPosSample[irad].z()) 
+       ){
+      cout << "tmpPosSample for radius=" << radius << " NAN"<< endl; 
+      cout << "tmpPosSample=(" <<tmpPosSample[irad]<<")"<< endl;
+      tmpPosSample[irad] =  AliFemtoThreeVector(-9999.,-9999.,-9999);
+    }
+    irad++;
+    if (irad<11){
+      float radius = 50.0 + irad*15.0;
+      candidates = hel.pathLength(radius);
+      sideLength = (candidates.first > 0) ? candidates.first : candidates.second;
+    }
+   }
+   for (int i = irad; i<11; i++)
+     {
+       tmpPosSample[i] =  AliFemtoThreeVector(-9999.,-9999.,-9999);   
+     }
+
+  static float tRowRadius[45] = {60,64.8,69.6,74.4,79.2,84,88.8,93.6,98.8, 
+                                104,109.2,114.4,119.6,127.195,129.195,131.195,
+                                133.195,135.195,137.195,139.195,141.195,
+                                143.195,145.195,147.195,149.195,151.195,
+                                153.195,155.195,157.195,159.195,161.195,
+                                163.195,165.195,167.195,169.195,171.195,
+                                173.195,175.195,177.195,179.195,181.195,
+                                183.195,185.195,187.195,189.195};
+  int tRow,tSect,tOutOfBound;
+  double tLength,tPhi;
+  float tU;
+  AliFemtoThreeVector tPoint;
+  AliFmThreeVectorD tn(0,0,0);
+  AliFmThreeVectorD tr(0,0,0);
+  int ti =0;
+  // test to enter the loop
+  candidates =  hel.pathLength(tRowRadius[ti]);
+  tLength = (candidates.first > 0) ? candidates.first : candidates.second;
+  if (IsNaN(tLength)){
+    cout <<"tLength Init tmp NAN" << endl;
+    cout <<"padrow number= "<<ti << "not reached" << endl;
+    cout << "*** DO NOT ENTER THE LOOP***" << endl;
+    tmpSect[ti]=-1;//sector
+  }
+  // end test
+  while(ti<45 && !IsNaN(tLength)){
+    candidates =  hel.pathLength(tRowRadius[ti]);
+    tLength = (candidates.first > 0) ? candidates.first : candidates.second;
+    if (IsNaN(tLength)){
+      cout <<"tLength loop 1st NAN" << endl;
+      cout <<"padrow number=  " << ti << " not reached" << endl;
+      cout << "*** THIS IS AN ERROR SHOULDN'T  LOOP ***" << endl;
+      tmpSect[ti]=-1;//sector
+    }
+    tPoint = hel.at(tLength);
+    // Find which sector it is on
+    TpcLocalTransform(tPoint,tmpSect[ti],tRow,tU,tPhi);
+    if (IsNaN(tmpSect[ti])){
+      cout <<"***ERROR tmpSect"<< endl; 
+    }
+    if (IsNaN(tRow)){
+      cout <<"***ERROR tRow"<< endl;
+    }
+    if (IsNaN(tU)){
+      cout <<"***ERROR tU"<< endl;
+    }
+    if (IsNaN(tPhi)){
+      cout <<"***ERROR tPhi"<< endl;
+    }  
+    // calculate crossing plane
+    tn.setX(cos(tPhi));
+    tn.setY(sin(tPhi));       
+    tr.setX(tRowRadius[ti]*cos(tPhi));
+    tr.setY(tRowRadius[ti]*sin(tPhi));
+    // find crossing point
+    tLength = hel.pathLength(tr,tn); 
+    if (IsNaN(tLength)){
+      cout <<"tLength loop 2nd  NAN" << endl;
+      cout <<"padrow number=  " << ti << " not reached" << endl;
+      tmpSect[ti]=-2;//sector
+    }
+    tPoint = hel.at(tLength);
+    tmpZ[ti] = tPoint.z();
+    tOutOfBound = TpcLocalTransform(tPoint,tSect,tRow,tmpU[ti],tPhi);
+    if (IsNaN(tSect)){
+      cout <<"***ERROR tSect 2"<< endl; 
+    }
+    if (IsNaN(tRow)){
+      cout <<"***ERROR tRow 2"<< endl;
+    }
+    if (IsNaN(tmpU[ti])){
+      cout <<"***ERROR tmpU[ti] 2"<< endl;
+    }
+    if (IsNaN(tPhi)){
+      cout <<"***ERROR tPhi 2 "<< endl;
+    }  
+    if(tOutOfBound || (tmpSect[ti] == tSect && tRow!=(ti+1))){
+      tmpSect[ti]=-2;
+      //         cout << "missed once"<< endl;
+    }
+    else{
+      if(tmpSect[ti] != tSect){
+       // Try again on the other sector
+       tn.setX(cos(tPhi));
+       tn.setY(sin(tPhi));       
+       tr.setX(tRowRadius[ti]*cos(tPhi));
+       tr.setY(tRowRadius[ti]*sin(tPhi));
+       // find crossing point
+       tLength = hel.pathLength(tr,tn);
+       tPoint = hel.at(tLength);
+       if (IsNaN(tLength)){
+         cout <<"tLength loop 3rd NAN" << endl;
+         cout <<"padrow number=  "<< ti << " not reached" << endl;
+         tmpSect[ti]=-1;//sector
+       }
+       tmpZ[ti] = tPoint.z();
+       tmpSect[ti] = tSect;
+       tOutOfBound = TpcLocalTransform(tPoint,tSect,tRow,tmpU[ti],tPhi);
+       if (IsNaN(tSect)){
+         cout <<"***ERROR tSect 3"<< endl; 
+       }
+       if (IsNaN(tRow)){
+         cout <<"***ERROR tRow 3"<< endl;
+       }
+       if (IsNaN(tmpU[ti])){
+         cout <<"***ERROR tmpU[ti] 3"<< endl;
+       }
+       if (IsNaN(tPhi)){
+         cout <<"***ERROR tPhi 3 "<< endl;
+       }  
+       if(tOutOfBound || tSect!= tmpSect[ti] || tRow!=(ti+1)){
+         tmpSect[ti]=-1;
+       }
+      }
+    }
+    if (IsNaN(tmpSect[ti])){
+      cout << "*******************ERROR***************************" << endl;
+      cout <<"AliFemtoParticle--Fctn tmpSect=" << tmpSect[ti] << endl;
+      cout << "*******************ERROR***************************" << endl;
+    }
+    if (IsNaN(tmpU[ti])){
+      cout << "*******************ERROR***************************" << endl;
+      cout <<"AliFemtoParticle--Fctn tmpU=" << tmpU[ti] << endl;
+      cout << "*******************ERROR***************************" << endl;
+    }
+    if (IsNaN(tmpZ[ti])){
+      cout << "*******************ERROR***************************" << endl;
+      cout <<"AliFemtoParticle--Fctn tmpZ=" << tmpZ[ti] << endl;
+      cout << "*******************ERROR***************************" << endl;
+    }
+    // If padrow ti not reached all other beyond are not reached
+    // in this case set sector to -1
+    if (tmpSect[ti]==-1){
+      for (int tj=ti; tj<45;tj++){
+       tmpSect[tj] = -1;
+       ti=45;
+      }
+    }
+    ti++;
+    if (ti<45){
+      candidates =  hel.pathLength(tRowRadius[ti]);
+      tLength = (candidates.first > 0) ? candidates.first : candidates.second;}
+  }
+}
+//_____________________
+const AliFemtoThreeVector& AliFemtoParticle::TpcV0PosExitPoint() const{
+  return fTpcV0PosExitPoint;
+}
+//_____________________
+const AliFemtoThreeVector& AliFemtoParticle::TpcV0PosEntrancePoint() const{
+  return fTpcV0PosEntrancePoint;
+}
+//______________________
+const AliFemtoThreeVector& AliFemtoParticle::TpcV0NegExitPoint() const{
+  return fTpcV0NegExitPoint;
+}
+//_____________________
+const AliFemtoThreeVector& AliFemtoParticle::TpcV0NegEntrancePoint() const{
+  return fTpcV0NegEntrancePoint;
+}
+//______________________
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.h
new file mode 100644 (file)
index 0000000..18b423d
--- /dev/null
@@ -0,0 +1,246 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   Particle objects are part of the PicoEvent, which is what is
+ *   stored in the EventMixingBuffers
+ *   A Track object gets converted to a Particle object if it
+ *   passes the ParticleCut of an Analysis
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.2  2007-04-03 16:00:08  mchojnacki
+ * Changes to iprove memory managing
+ *
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.19  2003/01/14 09:41:16  renault
+ * changes on average separation calculation, hit shared finder and memory optimisation
+ * for Z,U and Sectors variables.
+ *
+ * Revision 1.18  2002/12/12 17:01:50  kisiel
+ * Hidden Information handling and purity calculation
+ *
+ * Revision 1.17  2002/11/19 23:35:52  renault
+ * Enable calculation of exit/entrance separation for V0 daughters
+ *
+ * Revision 1.16  2001/12/14 23:11:30  fretiere
+ * Add class HitMergingCut. Add class fabricesPairCut = HitMerginCut + pair purity cuts. Add TpcLocalTransform function which convert to local tpc coord (not pretty). Modify AliFemtoTrack, AliFemtoParticle, AliFemtoHiddenInfo, AliFemtoPair to handle the hit information and cope with my code
+ *
+ * Revision 1.15  2001/05/25 23:23:59  lisa
+ * Added in AliFemtoKink stuff
+ *
+ * Revision 1.14  2001/05/23 00:19:05  lisa
+ * Add in Smearing classes and methods needed for momentum resolution studies and correction
+ *
+ * Revision 1.13  2001/04/03 21:04:36  kisiel
+ *
+ *
+ *   Changes needed to make the Theoretical code
+ *   work. The main code is the ThCorrFctn directory.
+ *   The most visible change is the addition of the
+ *   HiddenInfo to AliFemtoPair.
+ *
+ * Revision 1.12  2000/10/05 23:09:05  lisa
+ * Added kT-dependent radii to mixed-event simulator AND implemented AverageSeparation Cut and CorrFctn
+ *
+ * Revision 1.11  2000/07/17 20:03:17  lisa
+ * Implemented tools for addressing and assessing trackmerging
+ *
+ * Revision 1.10  2000/07/16 21:38:23  laue
+ * AliFemtoCoulomb.cxx AliFemtoSectoredAnalysis.cxx : updated for standalone version
+ * AliFemtoV0.cc AliFemtoV0.h : some cast to prevent compiling warnings
+ * AliFemtoParticle.cc AliFemtoParticle.h : pointers fTrack,fV0 initialized to 0
+ * AliFemtoIOBinary.cc : some printouts in #ifdef STHBTDEBUG
+ * AliFemtoEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
+ *                 solution
+ *
+ * Revision 1.9  2000/05/03 17:44:43  laue
+ * AliFemtoEvent, AliFemtoTrack & AliFemtoV0 declared friend to AliFemtoIOBinary
+ * AliFemtoParticle updated for V0 pos,neg track Id
+ *
+ * Revision 1.8  2000/04/03 16:21:51  laue
+ * some include files changed
+ * Multi track cut added
+ *
+ * Revision 1.6  2000/02/26 19:04:52  laue
+ * Some unnecessary includes removed.
+ * StThreeVectorD replace by AliFemtoThreeVector.
+ * AliFemtoCoulomb modified to compile without Root (ClassDef embraced into
+ *   #ifdef __ROOT__  ..... #endif)
+ * AliFemtoParticle now returns references (FourMomentum(),Helix(),
+ *   DecayVertexPosiion())
+ *
+ * Revision 1.5  1999/12/11 15:58:29  lisa
+ * Add vertex decay position datum and accessor to AliFemtoParticle to allow pairwise cuts on seperation of V0s
+ *
+ * Revision 1.4  1999/09/17 22:38:02  lisa
+ * first full integration of V0s into AliFemto framework
+ *
+ * Revision 1.3  1999/09/01 19:04:54  lisa
+ * update Particle class AND add parity cf and Randys Coulomb correction
+ *
+ * Revision 1.2  1999/07/06 22:33:23  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoParticle_hh
+#define AliFemtoParticle_hh
+
+//#include "math.h"
+#include "Infrastructure/AliFemtoTypes.h"
+#include "Infrastructure/AliFemtoTrack.h"
+#include "Infrastructure/AliFemtoV0.h"
+#include "Infrastructure/AliFemtoKink.h"
+#include "Infrastructure/AliFemtoXi.h"
+#include "AliFmPhysicalHelixD.h"
+// ***
+class AliFemtoHiddenInfo;
+// ***
+class AliFemtoParticle{
+public:
+  AliFemtoParticle();
+  AliFemtoParticle(const AliFemtoTrack* const hbtTrack, const double& mass);
+  AliFemtoParticle(const AliFemtoV0* const hbtV0, const double& mass);
+  AliFemtoParticle(const AliFemtoKink* const hbtKink, const double& mass);
+  AliFemtoParticle(const AliFemtoXi* const hbtXi, const double& mass);
+  ~AliFemtoParticle();
+
+  const AliFemtoLorentzVector& FourMomentum() const;
+
+  AliFmPhysicalHelixD& Helix();
+
+  const AliFemtoThreeVector DecayVertexPosition() const;
+  unsigned long TopologyMap(const int word) const;
+  int NumberOfHits() const;
+
+  unsigned long TrackId() const;         // only for particles from tracks 
+  unsigned short   NegTrackId() const;   // only for particles from v0 
+  unsigned short   PosTrackId() const;   // only for particles from v0 
+
+  AliFemtoTrack* Track() const;
+  AliFemtoV0* V0() const;
+  AliFemtoKink* Kink() const;
+
+  const AliFemtoThreeVector& NominalTpcExitPoint() const;     // position track exits TPC assuming start at (0,0,0)
+  const AliFemtoThreeVector& NominalTpcEntrancePoint() const; // position track crosses IFC assuming start at (0,0,0)
+  const AliFemtoThreeVector& TpcV0PosExitPoint() const;  
+  const AliFemtoThreeVector& TpcV0PosEntrancePoint() const;
+  const AliFemtoThreeVector& TpcV0NegExitPoint() const;  
+  const AliFemtoThreeVector& TpcV0NegEntrancePoint() const;
+
+  // the following method is for explicit internal calculation to fill datamembers.
+  // It is invoked automatically if AliFemtoParticle constructed from AliFemtoTrack
+  //void CalculateNominalTpcExitAndEntrancePoints(); // NOTE - this requires the fHelix, so be sure this is filled
+
+
+  AliFemtoThreeVector fNominalPosSample[11];  // I make this public for convenience and speed of AliFemtoPair()
+  float fZ[45];
+  float fU[45];
+  int fSect[45];
+
+  void ResetFourMomentum(const AliFemtoLorentzVector& fourMomentum);
+
+  const AliFemtoHiddenInfo*  HiddenInfo() const;
+  // Fab private
+  AliFemtoHiddenInfo*  getHiddenInfo() const;
+  void SetHiddenInfo(AliFemtoHiddenInfo* aHiddenInfo);
+  void CalculatePurity();
+  double GetPionPurity();
+  double GetKaonPurity();
+  double GetProtonPurity();
+  void CalculateTpcExitAndEntrancePoints( AliFmPhysicalHelixD* tHelix,
+                                         AliFemtoThreeVector* PrimVert,
+                                         AliFemtoThreeVector* SecVert,
+                                         AliFemtoThreeVector* tmpTpcEntrancePoint,
+                                         AliFemtoThreeVector* tmpTpcExitPoint,
+                                         AliFemtoThreeVector* tmpPosSample,
+                                         float* tmpZ,float* tmpU,int* tmpSect);
+
+  // For V0 Neg Daugthers TpcEntrance/ExitPoints
+  AliFemtoThreeVector* fTpcV0NegPosSample;
+  float* fV0NegZ;
+  float* fV0NegU;
+  int* fV0NegSect;
+private:
+  AliFemtoTrack* fTrack;  // copy of the track the particle was formed of, else Null
+  AliFemtoV0* fV0;        // copy of the v0 the particle was formed of, else Null
+  AliFemtoKink* fKink;        // copy of the v0 the particle was formed of, else Null
+  AliFemtoXi* fXi;
+
+  AliFemtoLorentzVector fFourMomentum;
+  AliFmPhysicalHelixD fHelix;
+  //unsigned long  fMap[2]; 
+  //int fNhits;
+  AliFemtoThreeVector fNominalTpcExitPoint;
+  AliFemtoThreeVector fNominalTpcEntrancePoint;
+  AliFemtoHiddenInfo* fHiddenInfo;  // Fab private
+
+  double fPurity[6];
+
+  static double fPrimPimPar0;
+  static double fPrimPimPar1;
+  static double fPrimPimPar2;
+  static double fPrimPipPar0;
+  static double fPrimPipPar1;
+  static double fPrimPipPar2;
+  static double fPrimPmPar0;
+  static double fPrimPmPar1;
+  static double fPrimPmPar2;
+  static double fPrimPpPar0;
+  static double fPrimPpPar1;
+  static double fPrimPpPar2;
+
+   // For V0 Daugthers TpcEntrance/ExitPoints
+  AliFemtoThreeVector fPrimaryVertex;
+  AliFemtoThreeVector fSecondaryVertex;
+
+  AliFmPhysicalHelixD fHelixV0Pos;
+  AliFemtoThreeVector fTpcV0PosEntrancePoint;
+  AliFemtoThreeVector fTpcV0PosExitPoint;
+
+  AliFmPhysicalHelixD fHelixV0Neg;
+  AliFemtoThreeVector fTpcV0NegEntrancePoint;
+  AliFemtoThreeVector fTpcV0NegExitPoint;
+};
+
+inline AliFemtoTrack* AliFemtoParticle::Track() const { return fTrack; }
+inline unsigned long  AliFemtoParticle::TrackId() const { return fTrack->TrackId(); }; 
+inline const AliFemtoLorentzVector& AliFemtoParticle::FourMomentum() const {return fFourMomentum;}
+inline AliFmPhysicalHelixD& AliFemtoParticle::Helix() {return fHelix;}
+//inline unsigned long AliFemtoParticle::TopologyMap(const int word) const {return fMap[word];}
+//inline int AliFemtoParticle::NumberOfHits() const {return fNhits;}
+//by marek chojnacki to could compile 
+
+inline unsigned long AliFemtoParticle::TopologyMap(const int word) const {return 1;}
+inline int AliFemtoParticle::NumberOfHits() const {return 1;}
+
+inline AliFemtoV0* AliFemtoParticle::V0() const { return fV0; }
+inline unsigned short AliFemtoParticle::NegTrackId() const { return fV0->idNeg(); }
+inline unsigned short AliFemtoParticle::PosTrackId() const { return fV0->idPos(); }
+inline const AliFemtoThreeVector AliFemtoParticle::DecayVertexPosition() const {return fV0->decayVertexV0(); }
+// ***
+inline AliFemtoHiddenInfo* AliFemtoParticle::getHiddenInfo() const
+{return fHiddenInfo;}
+inline const AliFemtoHiddenInfo* AliFemtoParticle::HiddenInfo() const
+{return fHiddenInfo;}
+inline void AliFemtoParticle::SetHiddenInfo(AliFemtoHiddenInfo* aHiddenInfo)
+{ fHiddenInfo = aHiddenInfo->clone();}
+// ***
+
+inline void AliFemtoParticle::ResetFourMomentum(const AliFemtoLorentzVector& vec){fFourMomentum = vec;}
+
+inline AliFemtoKink* AliFemtoParticle::Kink() const { return fKink; }
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticleCollection.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticleCollection.h
new file mode 100644 (file)
index 0000000..1de0927
--- /dev/null
@@ -0,0 +1,43 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   The ParticleCollection is the main component of the picoEvent
+ *   It points to the particle objects in the picoEvent.           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.2  2000/02/01 00:33:32  laue
+ * namespaces changed to run on the new Solaris Compiler CC5
+ * since we can use member templates in franks1Histo.h we are doing it
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+#ifndef AliFemtoParticleCollection_hh
+#define AliFemtoParticleCollection_hh
+#include "Infrastructure/AliFemtoParticle.h"
+#include <list>
+
+#if !defined(ST_NO_NAMESPACES)
+using std::list;
+#endif
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef list<AliFemtoParticle*, allocator<AliFemtoParticle*> >            AliFemtoParticleCollection;
+typedef list<AliFemtoParticle*, allocator<AliFemtoParticle*> >::iterator  AliFemtoParticleIterator;
+#else
+typedef list<AliFemtoParticle*>            AliFemtoParticleCollection;
+typedef list<AliFemtoParticle*>::iterator  AliFemtoParticleIterator;
+#endif
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.cxx
new file mode 100644 (file)
index 0000000..80cc772
--- /dev/null
@@ -0,0 +1,86 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *  PicoEvents are last-step ultra-compressed "events" just containing
+ *  bare information about the particles of interest.  They have already
+ *  gone through Event and Track cuts, so only Pair cuts are left.
+ *  PicoEvents are *internal* to the code, and are stored in the
+ *  Event-mixing buffers.
+ *           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.4  2000/07/16 21:38:23  laue
+ * AliFemtoCoulomb.cxx AliFemtoSectoredAnalysis.cxx : updated for standalone version
+ * AliFemtoV0.cc AliFemtoV0.h : some cast to prevent compiling warnings
+ * AliFemtoParticle.cc AliFemtoParticle.h : pointers mTrack,mV0 initialized to 0
+ * AliFemtoIOBinary.cc : some printouts in #ifdef STHBTDEBUG
+ * AliFemtoEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
+ *                 solution
+ *
+ * Revision 1.3  2000/06/01 20:40:13  laue
+ * AliFemtoIO.cc: updated for new V0s
+ * AliFemtoPicoEvent.cc: collections especially cleared
+ * franks1DHistoD.h, include changed from  <stdio> to <cstdio>
+ * franks1DHistoD.cc, cout statement deleted
+ *
+ * Revision 1.2  2000/03/17 17:23:05  laue
+ * Roberts new three particle correlations implemented.
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#include "Infrastructure/AliFemtoPicoEvent.h"
+
+//________________
+AliFemtoPicoEvent::AliFemtoPicoEvent(){
+  fFirstParticleCollection = new AliFemtoParticleCollection;
+  fSecondParticleCollection = new AliFemtoParticleCollection;
+  fThirdParticleCollection = new AliFemtoParticleCollection;
+}
+//_________________
+AliFemtoPicoEvent::~AliFemtoPicoEvent(){
+  AliFemtoParticleIterator iter;
+
+
+  if (fFirstParticleCollection){
+      for (iter=fFirstParticleCollection->begin();iter!=fFirstParticleCollection->end();iter++){
+       delete *iter;
+      }
+      fFirstParticleCollection->clear();
+      delete fFirstParticleCollection;
+      fFirstParticleCollection = 0;
+  }
+
+  if (fSecondParticleCollection){
+    for (iter=fSecondParticleCollection->begin();iter!=fSecondParticleCollection->end();iter++){
+      delete *iter;
+    }
+    fSecondParticleCollection->clear();
+    delete fSecondParticleCollection;
+    fSecondParticleCollection = 0;
+  }
+
+  if (fThirdParticleCollection){
+    if (fThirdParticleCollection->size() != 0 ) {
+      for (iter=fThirdParticleCollection->begin();iter!=fThirdParticleCollection->end();iter++){
+       delete *iter;
+      }
+    }
+    fThirdParticleCollection->clear();
+    delete fThirdParticleCollection;
+    fThirdParticleCollection = 0;
+  }
+}
+//_________________
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.h
new file mode 100644 (file)
index 0000000..17ee411
--- /dev/null
@@ -0,0 +1,58 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *  PicoEvents are last-step ultra-compressed "events" just containing
+ *  bare information about the particles of interest.  They have already
+ *  gone through Event and Track cuts, so only Pair cuts are left.
+ *  PicoEvents are *internal* to the code, and are stored in the
+ *  Event-mixing buffers.
+ *           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.2  2000/03/17 17:23:05  laue
+ * Roberts new three particle correlations implemented.
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoPicoEvent_hh
+#define AliFemtoPicoEvent_hh
+
+#include "Infrastructure/AliFemtoParticleCollection.h"
+
+class AliFemtoPicoEvent{
+public:
+  AliFemtoPicoEvent();
+  ~AliFemtoPicoEvent();
+
+  /* may want to have other stuff in here, like where is primary vertex */
+
+  AliFemtoParticleCollection* FirstParticleCollection();
+  AliFemtoParticleCollection* SecondParticleCollection();
+  AliFemtoParticleCollection* ThirdParticleCollection();
+
+private:
+  AliFemtoParticleCollection* fFirstParticleCollection;
+  AliFemtoParticleCollection* fSecondParticleCollection;
+  AliFemtoParticleCollection* fThirdParticleCollection;
+};
+
+inline AliFemtoParticleCollection* AliFemtoPicoEvent::FirstParticleCollection(){return fFirstParticleCollection;}
+inline AliFemtoParticleCollection* AliFemtoPicoEvent::SecondParticleCollection(){return fSecondParticleCollection;}
+inline AliFemtoParticleCollection* AliFemtoPicoEvent::ThirdParticleCollection(){return fThirdParticleCollection;}
+
+
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollection.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollection.h
new file mode 100644 (file)
index 0000000..688ff62
--- /dev/null
@@ -0,0 +1,44 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   A Collection of PicoEvents is what makes up the EventMixingBuffer
+ *   of each Analysis
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.2  2000/02/01 00:33:32  laue
+ * namespaces changed to run on the new Solaris Compiler CC5
+ * since we can use member templates in franks1Histo.h we are doing it
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoPicoEventCollection_hh
+#define AliFemtoPicoEventCollection_hh
+#include "Infrastructure/AliFemtoPicoEvent.h"
+#include <list>
+
+#if !defined(ST_NO_NAMESPACES)
+using std::list;
+#endif
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef list<AliFemtoPicoEvent*, allocator<AliFemtoPicoEvent*> >            AliFemtoPicoEventCollection;
+typedef list<AliFemtoPicoEvent*, allocator<AliFemtoPicoEvent*> >::iterator  AliFemtoPicoEventIterator;
+#else
+typedef list<AliFemtoPicoEvent*>            AliFemtoPicoEventCollection;
+typedef list<AliFemtoPicoEvent*>::iterator  AliFemtoPicoEventIterator;
+#endif
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVector.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVector.h
new file mode 100644 (file)
index 0000000..d9ddd7f
--- /dev/null
@@ -0,0 +1,41 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.1  2000/07/16 21:44:11  laue
+ * Collection and analysis for vertex dependent event mixing
+ *
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoPicoEventCollectionVector_hh
+#define AliFemtoPicoEventCollectionVector_hh
+#include "Infrastructure/AliFemtoPicoEventCollection.h"
+#include <vector>
+#include <list>
+
+#if !defined(ST_NO_NAMESPACES)
+using std::vector;
+using std::list;
+#endif
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef vector<AliFemtoPicoEventCollection*, allocator<AliFemtoPicoEventCollection*> >            AliFemtoPicoEventCollectionVector;  //!
+typedef vector<AliFemtoPicoEventCollection*, allocator<AliFemtoPicoEventCollection*> >::iterator  AliFemtoPicoEventCollectionIterator;//!
+#else
+typedef vector<AliFemtoPicoEventCollection*>            AliFemtoPicoEventCollectionVector;//!
+typedef vector<AliFemtoPicoEventCollection*>::iterator  AliFemtoPicoEventCollectionIterator;//!
+#endif
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.cxx
new file mode 100644 (file)
index 0000000..e236ce1
--- /dev/null
@@ -0,0 +1,72 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.3  2002/11/01 20:45:53  magestro
+ * Fixed bug in 3rd dimension of event collection vector, probably never encountered
+ *
+ * Revision 1.2  2001/11/11 18:34:13  laue
+ * AliFemtoPicoEventCollectionVectorHideAway: updated for 3d grid
+ * AliFemtoVertexMultAnalysis: new
+ *
+ * Revision 1.1  2000/07/16 21:44:11  laue
+ * Collection and analysis for vertex dependent event mixing
+ *
+ *
+ **************************************************************************/
+#include "Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.h"
+
+// -----------------------------------
+AliFemtoPicoEventCollectionVectorHideAway::AliFemtoPicoEventCollectionVectorHideAway(int bx, double lx, double ux,
+                                                                              int by, double ly, double uy,
+                                                                              int bz, double lz, double uz) {
+    fBinsx = bx;  fMinx = lx; fMaxx = ux;
+    fBinsy = by;  fMiny = ly; fMaxy = uy;
+    fBinsz = bz;  fMinz = lz; fMaxz = uz;
+
+    fBinsTot = fBinsx * fBinsy * fBinsz;
+    fStepx=0;  fStepx = (fMaxx-fMinx)/fBinsx;
+    fStepy=0;  fStepy = (fMaxy-fMiny)/fBinsy;
+    fStepz=0;  fStepz = (fMaxz-fMinz)/fBinsz;
+    
+
+    //fCollectionVector = new AliFemtoPicoEventCollectionVector();
+    fCollection = 0;
+    for ( int i=0; i<fBinsTot; i++) {
+       fCollection = new AliFemtoPicoEventCollection();
+       fCollectionVector.push_back(fCollection);
+    }
+}
+// -----------------------------------
+AliFemtoPicoEventCollection* AliFemtoPicoEventCollectionVectorHideAway::PicoEventCollection(int ix, int iy, int iz) { 
+  if ( ix<0 || ix >= fBinsx) return 0;
+  if ( iy<0 || iy >= fBinsy) return 0;
+  if ( iz<0 || iz >= fBinsz) return 0;
+  int bin = ix + iy*fBinsx + iz*fBinsy*fBinsx; 
+  cout << " AliFemtoPicoEventCollectionVectorHideAway::PicoEventCollection(...) - bin(ix,iy,iz): ";
+  cout << bin << "(" << ix <<"," << iy << "," << iz <<")" << endl;
+  return fCollectionVector[bin]; 
+}
+// -----------------------------------
+AliFemtoPicoEventCollection* AliFemtoPicoEventCollectionVectorHideAway::PicoEventCollection(double x, double y, double z) {
+  int ix,iy,iz;
+  ix=0;iy=0;iz=0;
+
+  ix = (int)floor( (x-fMinx)/fStepx );
+  iy = (int)floor( (y-fMiny)/fStepy );
+  iz = (int)floor( (z-fMinz)/fStepz );
+
+  return PicoEventCollection( ix,iy,iz );
+}
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.h
new file mode 100644 (file)
index 0000000..50ee0f0
--- /dev/null
@@ -0,0 +1,60 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.3  2002/02/04 18:58:33  laue
+ * *** empty log message ***
+ *
+ * Revision 1.2  2001/11/11 18:34:13  laue
+ * AliFemtoPicoEventCollectionVectorHideAway: updated for 3d grid
+ * AliFemtoVertexMultAnalysis: new
+ *
+ * Revision 1.1  2000/07/16 21:44:11  laue
+ * Collection and analysis for vertex dependent event mixing
+ *
+ *
+ **************************************************************************/
+#ifndef AliFemtoPicoEventCollectionVectorHideAway_hh
+#define AliFemtoPicoEventCollectionVectorHideAway_hh
+#include "Infrastructure/AliFemtoPicoEvent.h"
+#include "Infrastructure/AliFemtoPicoEventCollection.h"
+#include "Infrastructure/AliFemtoPicoEventCollectionVector.h"
+#include <vector>
+#include <list>
+#include <float.h>
+#include <limits.h>
+
+#if !defined(ST_NO_NAMESPACES)
+using std::vector;
+using std::list;
+#endif
+
+class AliFemtoPicoEventCollectionVectorHideAway {
+public:
+  AliFemtoPicoEventCollectionVectorHideAway(int bx=1, double lx=-FLT_MAX, double ux=FLT_MAX,
+                                        int by=1, double ly=-FLT_MAX, double uy=FLT_MAX,
+                                        int bz=1, double lz=-FLT_MAX, double uz=FLT_MAX);
+  AliFemtoPicoEventCollection* PicoEventCollection(int, int, int);
+  AliFemtoPicoEventCollection* PicoEventCollection(double x, double y=0, double z=0);
+private:
+  int fBinsTot;
+  int fBinsx,fBinsy,fBinsz;
+  double fMinx,fMiny,fMinz;
+  double fMaxx,fMaxy,fMaxz;
+  double fStepx,fStepy,fStepz;
+  AliFemtoPicoEventCollection* fCollection;
+  AliFemtoPicoEventCollectionVector fCollectionVector;
+};
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoString.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoString.h
new file mode 100644 (file)
index 0000000..a91e862
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef AliFemtoString_hh
+#define AliFemtoString_hh
+
+#ifndef __CINT__
+
+#ifndef AliFemtoString_noCint
+#define AliFemtoString_noCint
+#include <string>
+
+#if !defined(ST_NO_NAMESPACES)
+using std::string;
+#endif
+
+typedef string AliFemtoString; //!
+#endif
+
+#else
+
+#ifndef AliFemtoString_yesCint
+#define AliFemtoString_yesCint
+class AliFemtoString; //!
+#endif
+
+#endif
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoThreeVector.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoThreeVector.h
new file mode 100644 (file)
index 0000000..63cb152
--- /dev/null
@@ -0,0 +1,855 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Brian Lasiuk, Thomas Ullrich, April 1998
+ ***************************************************************************
+ *
+ * Description:  
+ *
+ * Remarks:   Since not all compilers support member templates
+ *            we have to specialize the templated member on these
+ *            platforms. If member templates are not supported the
+ *            ST_NO_MEMBER_TEMPLATES flag has to be set. tu.
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.15  2005/09/22 20:09:20  fisyak
+ * Make AliFmLorentzVector persistent
+ *
+ * Revision 1.14  2005/07/19 22:27:11  perev
+ * Cleanup
+ *
+ * Revision 1.13  2005/07/06 18:49:57  fisyak
+ * Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
+ *
+ * Revision 1.12  2005/03/28 06:03:41  perev
+ * Defence FPE added
+ *
+ * Revision 1.11  2004/12/02 20:07:32  fine
+ * define the valid method for both flavor of AliFmThreeVector
+ *
+ * Revision 1.10  2003/10/30 20:06:46  perev
+ * Check of quality added
+ *
+ * Revision 1.9  2003/09/02 17:59:35  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.8  2002/06/21 17:47:37  genevb
+ * Added pseudoProduct
+ *
+ * Revision 1.7  2000/01/04 19:56:05  ullrich
+ * Added cpp macro for CINT.
+ *
+ * Revision 1.6  1999/12/21 15:14:31  ullrich
+ * Modified to cope with new compiler version on Sun (CC5.0).
+ *
+ * Revision 1.5  1999/10/15 15:46:54  ullrich
+ * Changed output format in operator<<
+ *
+ * Revision 1.4  1999/06/04 18:00:05  ullrich
+ * Added new constructor which takes C-style array as argument.
+ * New operators operator() and operator[] which can be used
+ * as lvalues.
+ *
+ * Revision 1.3  1999/02/17 11:42:19  ullrich
+ * Removed specialization for 'long double'.
+ *
+ * Revision 1.2  1999/02/14 23:11:48  fisyak
+ * Fixes for Rootcint
+ *
+ * Revision 1.1  1999/01/30 03:59:05  fisyak
+ * Root Version of AliFmarClassLibrary
+ *
+ * Revision 1.1  1999/01/23 00:28:04  ullrich
+ * Initial Revision
+ *
+ **************************************************************************/
+#ifndef ST_THREE_VECTOR_HH
+#define ST_THREE_VECTOR_HH
+#ifdef __ROOT__
+#include "Rtypes.h"
+#endif
+#ifndef __CINT__
+#include <iostream>
+#include <fstream>
+#include <math.h>
+#ifdef GNU_GCC
+#    include <stddef.h>
+#endif
+#if defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500
+#    include <stdcomp.h>
+#endif
+#ifndef ST_NO_EXCEPTIONS
+#    include <stdexcept>
+#    if !defined(ST_NO_NAMESPACES)
+using std::out_of_range;
+#    endif
+#endif
+#endif // __CINT__
+
+#ifdef WIN32
+#include "gcc2vs.h"
+#endif
+
+class TRootIOCtor;//nic nie rozumiem
+using namespace std;
+
+
+template<class T> class AliFmThreeVector {
+public:    
+    AliFmThreeVector(T = 0, T = 0, T = 0);
+  //                     ROOT_VERSION(5,03,01)
+#if ROOT_VERSION_CODE >= 328449
+   AliFmThreeVector(TRootIOCtor*) : mX1(0), mX2(0), mX3(0) {}
+#endif
+    virtual ~AliFmThreeVector();
+
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template<class X> AliFmThreeVector(const AliFmThreeVector<X>&);
+    template<class X> AliFmThreeVector(const X*);  
+    template<class X> AliFmThreeVector<T>& operator=(const AliFmThreeVector<X>&);
+    // AliFmThreeVector(const AliFmThreeVector<T>&);                use default
+    // AliFmThreeVector<T>& operator=(const AliFmThreeVector<T>&);  use default
+#else    
+    AliFmThreeVector(const AliFmThreeVector<float>&);
+    AliFmThreeVector(const AliFmThreeVector<double>&);
+    
+    AliFmThreeVector(const float*); 
+    AliFmThreeVector(const double*);
+    
+    AliFmThreeVector<T>& operator=(const AliFmThreeVector<float>&);
+    AliFmThreeVector<T>& operator=(const AliFmThreeVector<double>&);
+#endif
+    
+    void setX(T);
+    void setY(T);
+    void setZ(T);
+
+    void setPhi(T);
+    void setTheta(T);
+    void setMag(T);
+    void setMagnitude(T);
+    
+    T   x()                        const;
+    T   y()                        const;
+    T   z()                        const;
+    T   theta()                    const;
+    T   cosTheta()                 const;
+    T   phi()                      const;
+    T   perp()                     const;
+    T   perp2()                    const;
+    T   magnitude()                const;
+    T   mag()                      const;
+    T   mag2()                     const;
+    T   pseudoRapidity()           const;
+    T   operator() (size_t)        const;
+    T   operator[] (size_t)        const;
+
+    T&  operator() (size_t);
+    T&  operator[] (size_t);
+    
+    T   massHypothesis(T mass)     const;
+    
+    AliFmThreeVector<T>  unit()       const;
+    AliFmThreeVector<T>  orthogonal() const;
+
+    void  rotateX(T);
+    void  rotateY(T);
+    void  rotateZ(T);
+    
+    AliFmThreeVector<T>  operator- ();
+    AliFmThreeVector<T>  operator+ ();
+    AliFmThreeVector<T>& operator*= (double);
+    AliFmThreeVector<T>& operator/= (double);
+    AliFmThreeVector<T>  pseudoProduct(double,double,double) const;
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template<class X> T                angle(const AliFmThreeVector<X>&) const;
+    template<class X> AliFmThreeVector<T> cross(const AliFmThreeVector<X>&) const;
+    template<class X> T                dot  (const AliFmThreeVector<X>&) const;
+    template<class X> AliFmThreeVector<T> pseudoProduct(const AliFmThreeVector<X>&) const;
+    
+    template<class X> bool operator == (const AliFmThreeVector<X>& v) const;
+    template<class X> bool operator != (const AliFmThreeVector<X>& v) const;
+
+    template<class X> AliFmThreeVector<T>& operator+= (const AliFmThreeVector<X>&);
+    template<class X> AliFmThreeVector<T>& operator-= (const AliFmThreeVector<X>&);
+#else    
+    T                angle(const AliFmThreeVector<float>&) const;
+    AliFmThreeVector<T> cross(const AliFmThreeVector<float>&) const;
+    T                dot  (const AliFmThreeVector<float>&) const;
+    AliFmThreeVector<T> pseudoProduct(const AliFmThreeVector<float>&) const;
+    
+    T                angle(const AliFmThreeVector<double>&) const;
+    T                dot  (const AliFmThreeVector<double>&) const;
+    AliFmThreeVector<T> cross(const AliFmThreeVector<double>&) const;
+    AliFmThreeVector<T> pseudoProduct(const AliFmThreeVector<double>&) const;
+
+    bool operator == (const AliFmThreeVector<float>& v) const;
+    bool operator != (const AliFmThreeVector<float>& v) const;
+    AliFmThreeVector<T>& operator+= (const AliFmThreeVector<float>&);
+    AliFmThreeVector<T>& operator-= (const AliFmThreeVector<float>&);
+    
+    bool operator == (const AliFmThreeVector<double>& v) const;
+    bool operator != (const AliFmThreeVector<double>& v) const;
+    AliFmThreeVector<T>& operator+= (const AliFmThreeVector<double>&);
+    AliFmThreeVector<T>& operator-= (const AliFmThreeVector<double>&);
+#endif
+  int             valid(double world = 1.e+5) const;
+    int               bad(double world = 1.e+5) const;
+protected:
+    T    mX1, mX2, mX3;
+#ifdef __ROOT__
+  ClassDef(AliFmThreeVector,3)
+#endif /* __ROOT__ */
+};
+
+#ifndef __CINT__
+//
+//        Implementation of member functions
+//
+template<class T>
+inline AliFmThreeVector<T>::AliFmThreeVector(T x, T y, T z)
+    : mX1(x), mX2(y), mX3(z) {/* nop */}
+template<class T>
+inline AliFmThreeVector<T>::~AliFmThreeVector() {/* nop */}
+
+template<class T>
+inline void AliFmThreeVector<T>::setX(T x) {mX1 = x;}
+
+template<class T>
+inline void AliFmThreeVector<T>::setY(T y) {mX2 = y;}
+
+template<class T>
+inline void AliFmThreeVector<T>::setZ(T z) {mX3 = z;}
+
+template<class T>
+void AliFmThreeVector<T>::setPhi(T angle)
+{
+    double  r = magnitude();
+    double th = theta();
+    
+    mX1 = r*sin(th)*cos(angle);
+    mX2 = r*sin(th)*sin(angle);
+}
+
+template <class T>
+void AliFmThreeVector<T>::setTheta(T angle)
+{
+    double r  = magnitude();
+    double ph = phi();
+
+    mX1 = r*sin(angle)*cos(ph);
+    mX2 = r*sin(angle)*sin(ph);
+    mX3 = r*cos(angle);
+}
+
+template <class T>
+void AliFmThreeVector<T>::setMagnitude(T r)
+{
+    double th = theta();
+    double ph = phi();
+    
+    mX1 = r*sin(th)*cos(ph);
+    mX2 = r*sin(th)*sin(ph);
+    mX3 = r*cos(th);
+}
+
+template <class T>
+void AliFmThreeVector<T>::setMag(T mag)
+{
+    setMagnitude(mag);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::x() const {return mX1;}
+
+template<class T>
+inline T AliFmThreeVector<T>::y() const {return mX2;}
+
+template<class T>
+inline T AliFmThreeVector<T>::z() const {return mX3;}
+
+template<class T>
+inline T AliFmThreeVector<T>::theta() const
+{
+  return acos(cosTheta());
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::cosTheta() const
+{
+  return mX3/(mag()+1e-20);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::phi() const
+{
+    return atan2(mX2,mX1);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::pseudoRapidity() const
+{
+    //
+    // change code to more optimal:
+    // double m = mag();
+    // return 0.5*::log( (m+z())/(m-z()) );
+    double tmp = tan(theta()/2.); if (tmp <=0.) return 1e20;
+    return -::log(tmp);
+}
+
+template<class T>
+inline AliFmThreeVector<T> AliFmThreeVector<T>::unit() const
+{
+    double tmp = mag(); if (tmp<=0.) tmp = 1e-20;
+    return *this/tmp;
+}
+
+template <class T>
+T AliFmThreeVector<T>::massHypothesis(T mass) const
+{
+    return ::sqrt((*this)*(*this) + mass*mass);
+}
+
+template <class T>
+AliFmThreeVector<T> AliFmThreeVector<T>::orthogonal() const
+{
+    // Direct copy from CLHEP--it is probably better to
+    // use your own dot/cross product code...
+    double x = (mX1 < 0.0) ? -mX1 : mX1;
+    double y = (mX2 < 0.0) ? -mX2 : mX2;
+    double z = (mX3 < 0.0) ? -mX3 : mX3;
+    
+    if(x<y)
+       return x < z ? AliFmThreeVector<T>(0,mX3,-mX2) :  AliFmThreeVector<T>(mX2,-mX1,0);
+    else
+       return  mX2 < mX3 ? AliFmThreeVector<T>(-mX3,0,mX1) :  AliFmThreeVector<T>(mX2,-mX1,0);
+}
+
+template <class T>
+void AliFmThreeVector<T>::rotateX(T angle)
+{
+    // may in the future make use of the AliFmRotation class!
+    double yPrime = cos(angle)*mX2 - sin(angle)*mX3;
+    double zPrime = sin(angle)*mX2 + cos(angle)*mX3;
+
+    mX2 = yPrime;
+    mX3 = zPrime;
+}
+
+template <class T>
+void AliFmThreeVector<T>::rotateY(T angle)
+{
+    // may in the future make use of the AliFmRotation class!
+    double zPrime = cos(angle)*mX3 - sin(angle)*mX1;
+    double xPrime = sin(angle)*mX3 + cos(angle)*mX1;
+
+    mX1 = xPrime;
+    mX3 = zPrime;
+}
+
+template <class T>
+void AliFmThreeVector<T>::rotateZ(T angle)
+{
+    // may in the future make use of the AliFmRotation class!
+    double xPrime = cos(angle)*mX1 - sin(angle)*mX2;
+    double yPrime = sin(angle)*mX1 + cos(angle)*mX2;
+
+    mX1 = xPrime;
+    mX2 = yPrime;
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::perp() const
+{
+    return ::sqrt(mX1*mX1+mX2*mX2);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::perp2() const
+{
+    return mX1*mX1+mX2*mX2;
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::magnitude() const
+{
+    return mag();
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::mag() const
+{
+    return ::sqrt(mX1*mX1+mX2*mX2+mX3*mX3);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::mag2() const
+{
+    return mX1*mX1+mX2*mX2+mX3*mX3;
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::operator() (size_t i) const
+{
+    if (0 <=i && i <= 2)  return (&mX1)[i];
+#ifndef ST_NO_EXCEPTIONS
+    throw out_of_range("AliFmThreeVector<T>::operator(): bad index");
+#else
+    cerr << "AliFmThreeVector<T>::operator(): bad index" << endl;
+#endif
+    return 0;
+}
+
+template<class T>
+inline T& AliFmThreeVector<T>::operator() (size_t i) 
+{
+    if (0 <=i && i <= 2)  return (&mX1)[i];
+#ifndef ST_NO_EXCEPTIONS
+    throw out_of_range("AliFmThreeVector<T>::operator(): bad index");
+#else
+    cerr << "AliFmThreeVector<T>::operator(): bad index" << endl;
+#endif
+    return mX1;
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::operator[] (size_t i) const
+{
+    if (0 <=i && i <= 2)  return (&mX1)[i];
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFmThreeVector<T>::operator[]: bad index"); 
+#else
+      cerr << "AliFmThreeVector<T>::operator[]: bad index" << endl;
+#endif
+      return 0;
+}
+
+template<class T>
+inline T &AliFmThreeVector<T>::operator[] (size_t i) 
+{
+    if (0 <=i && i <= 2)  return (&mX1)[i];
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFmThreeVector<T>::operator[]: bad index"); 
+#else
+      cerr << "AliFmThreeVector<T>::operator[]: bad index" << endl;
+#endif
+      return mX1;
+}
+
+template<class T>
+inline AliFmThreeVector<T>& AliFmThreeVector<T>::operator*= (double c)
+{
+    mX1 *= c; mX2 *= c; mX3 *= c;
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>& AliFmThreeVector<T>::operator/= (double c)
+{
+    mX1 /= c; mX2 /= c; mX3 /= c;
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::pseudoProduct(double x,double y,double z) const
+{
+    return AliFmThreeVector<T>(mX1*x,mX2*y,mX3*z);
+}
+
+template<class T>
+AliFmThreeVector<T> AliFmThreeVector<T>::operator- ()
+{
+    return AliFmThreeVector<T>(-mX1, -mX2, -mX3);
+}
+
+template<class T>
+AliFmThreeVector<T> AliFmThreeVector<T>::operator+ ()
+{
+    return *this;
+}
+
+#ifndef ST_NO_MEMBER_TEMPLATES
+#ifndef WIN32
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<X>& v)
+    : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>::AliFmThreeVector(const X *a)
+{
+    mX1 = a[0];
+    mX2 = a[1];
+    mX3 = a[2];
+}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator=(const AliFmThreeVector<X>& v)
+{
+    mX1 = v.x();  mX2 = v.y();  mX3 = v.z();
+    return *this;
+}
+
+template<class T>
+template<class X>
+inline bool AliFmThreeVector<T>::operator== (const AliFmThreeVector<X>& v) const
+{
+    return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
+}
+
+template<class T>
+template<class X>
+inline bool AliFmThreeVector<T>::operator!= (const AliFmThreeVector<X>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator+= (const AliFmThreeVector<X>& v)
+{
+    mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
+    return *this;
+}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator-= (const AliFmThreeVector<X>& v)
+{
+    mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
+    return *this;
+}
+
+template<class T>
+template<class X>
+inline T AliFmThreeVector<T>::dot(const AliFmThreeVector<X>& v) const
+{
+    return mX1*v.x() + mX2*v.y() + mX3*v.z();
+}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::cross(const AliFmThreeVector<X>& v) const
+{
+    return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
+                           mX3*v.x() - mX1*v.z(),
+                           mX1*v.y() - mX2*v.x());
+}
+
+template<class T>
+template<class X>
+inline T AliFmThreeVector<T>::angle(const AliFmThreeVector<X>& vec) const
+{
+    double norm = this->mag2()*vec.mag2(); 
+    
+    return norm > 0 ? acos(this->dot(vec)/(::sqrt(norm))) : 0;
+}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::pseudoProduct(const AliFmThreeVector<X>& v) const
+{
+    return this->pseudoProduct(v.x(),v.y(),v.z());
+}
+
+#endif
+#else
+
+template<class T>
+inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<float>& v)
+    : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
+
+template<class T>
+inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<double>& v)
+    : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
+
+template<class T>
+inline AliFmThreeVector<T>::AliFmThreeVector(const float *a)
+{
+    mX1 = a[0];
+    mX2 = a[1];
+    mX3 = a[2];
+}
+
+template<class T>
+inline AliFmThreeVector<T>::AliFmThreeVector(const double *a)
+{
+    mX1 = a[0];
+    mX2 = a[1];
+    mX3 = a[2];
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator=(const AliFmThreeVector<float>& v)
+{
+    mX1 = v.x();  mX2 = v.y();  mX3 = v.z();
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator=(const AliFmThreeVector<double>& v)
+{
+    mX1 = v.x();  mX2 = v.y();  mX3 = v.z();
+    return *this;
+}
+
+template<class T>
+inline bool
+AliFmThreeVector<T>::operator== (const AliFmThreeVector<float>& v) const
+{
+    return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
+}
+
+template<class T>
+inline bool
+AliFmThreeVector<T>::operator== (const AliFmThreeVector<double>& v) const
+{
+    return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
+}
+
+template<class T>
+inline bool
+AliFmThreeVector<T>::operator!= (const AliFmThreeVector<float>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+inline bool
+AliFmThreeVector<T>::operator!= (const AliFmThreeVector<double>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator+= (const AliFmThreeVector<float>& v)
+{
+    mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator+= (const AliFmThreeVector<double>& v)
+{
+    mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator-= (const AliFmThreeVector<float>& v)
+{
+    mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator-= (const AliFmThreeVector<double>& v)
+{
+    mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
+    return *this;
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::dot(const AliFmThreeVector<float>& v) const
+{
+    return mX1*v.x() + mX2*v.y() + mX3*v.z();
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::dot(const AliFmThreeVector<double>& v) const
+{
+    return mX1*v.x() + mX2*v.y() + mX3*v.z();
+}
+
+template<class T>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::cross(const AliFmThreeVector<float>& v) const
+{
+    return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
+                           mX3*v.x() - mX1*v.z(),
+                           mX1*v.y() - mX2*v.x());
+}
+
+template<class T>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::cross(const AliFmThreeVector<double>& v) const
+{
+    return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
+                           mX3*v.x() - mX1*v.z(),
+                           mX1*v.y() - mX2*v.x());
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::angle(const AliFmThreeVector<float>& v) const
+{
+    double tmp = mag()*v.mag(); if (tmp <=0) tmp = 1e-20;
+    return acos(this->dot(v)/tmp);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::angle(const AliFmThreeVector<double>& v) const
+{
+    double tmp = mag()*v.mag(); if (tmp <=0) tmp = 1e-20;
+    return acos(this->dot(v)/tmp);
+}
+
+template<class T>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::pseudoProduct(const AliFmThreeVector<float>& v) const
+{
+    return this->pseudoProduct(v.x(),v.y(),v.z());
+}
+
+template<class T>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::pseudoProduct(const AliFmThreeVector<double>& v) const
+{
+    return this->pseudoProduct(v.x(),v.y(),v.z());
+}
+#endif  // ST_NO_MEMBER_TEMPLATES
+template<class T>
+inline int
+AliFmThreeVector<T>::valid(double world) const  {return !bad(world);}
+
+template<class T>
+inline int
+AliFmThreeVector<T>::bad(double world) const
+{
+  for (int i=0;i<3;i++) {
+         if (!finite((&mX1)[i])      ) return 10+i;            
+         if ( fabs  ((&mX1)[i])>world) return 20+i;            
+  }            
+  return 0;            
+}
+#endif /*! __CINT__ */
+#ifdef __CINT__
+template<> float abs(const AliFmThreeVector<float>& v);
+template<> double abs(const AliFmThreeVector<double>& v);
+template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  cross_product(const AliFmThreeVector<float>&  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<float>&  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  operator+ (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  operator- (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  operator* (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> operator* (const double                 v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<float>&  v1, const double v2);
+template<> AliFmThreeVector<double> operator* (const double                 v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const double v2);
+template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  operator/ (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> operator/ (const                double  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  operator/ (const                double  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const double v2);
+template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<float>&  v1, const double v2);
+template<> istream&  operator>>(istream& is,const AliFmThreeVector<double>& v);
+template<> istream&  operator>>(istream& is,const AliFmThreeVector<float>& v);
+template<> ostream&  operator<<(ostream& os,const AliFmThreeVector<double>& v);
+template<> ostream&  operator<<(ostream& os,const AliFmThreeVector<float>& v);
+#else
+//
+//        Non-member functions
+//
+template<class T>
+inline T abs(const AliFmThreeVector<T>& v) {return v.mag();}
+
+template<class T, class X>
+inline AliFmThreeVector<T>
+cross_product(const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
+{
+    return v1.cross(v2);
+}
+
+
+//
+//        Non-member operators
+//
+template<class T, class X>
+inline AliFmThreeVector<T>
+operator+ (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
+{
+    return AliFmThreeVector<T>(v1) += v2;
+}
+
+template<class T, class X>
+inline AliFmThreeVector<T>
+operator- (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
+{
+    return AliFmThreeVector<T>(v1) -= v2;
+}
+
+template<class T, class X>
+inline T operator* (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
+{
+    return AliFmThreeVector<T>(v1).dot(v2);
+}
+
+template<class T>
+inline AliFmThreeVector<T> operator* (const AliFmThreeVector<T>& v, double c)
+{
+    return AliFmThreeVector<T>(v) *= c;
+}
+
+template<class T>
+inline AliFmThreeVector<T> operator* (double c, const AliFmThreeVector<T>& v)
+{
+    return AliFmThreeVector<T>(v) *= c;
+}
+
+template<class T, class X>
+inline AliFmThreeVector<T> operator/ (const AliFmThreeVector<T>& v, X c)
+{
+    return AliFmThreeVector<T>(v) /= c;
+}
+
+template<class T>
+ostream&  operator<<(ostream& os, const AliFmThreeVector<T>& v)
+{
+    return os << v.x() << '\t' << v.y() << '\t' << v.z();
+}
+
+template<class T>
+istream&  operator>>(istream& is, AliFmThreeVector<T>& v)
+{
+    T  x, y, z;
+    is >> x >> y >> z;
+    v.setX(x);
+    v.setY(y);
+    v.setZ(z);
+    return is;
+}
+#endif /* ! __CINT__ */
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoThreeVectorD.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoThreeVectorD.h
new file mode 100644 (file)
index 0000000..906f5aa
--- /dev/null
@@ -0,0 +1,17 @@
+/***************************************************************************
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.11  2005/07/06 18:49:57  fisyak
+ * Replace AliFemtoHelixD, AliFemtoLorentzVectorD,AliFemtoLorentzVectorF,AliFemtoMatrixD,AliFemtoMatrixF,AliFemtoPhysicalHelixD,AliFemtoThreeVectorD,AliFemtoThreeVectorF by templated version
+ *
+
+****************************************************************************/
+#ifndef ALIFM_THREE_VECTOR_D_HH
+#define ALIFM_THREE_VECTOR_D_HH
+#include "AliFmThreeVector.h"
+typedef AliFmThreeVector<double> AliFmThreeVectorD;
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrack.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrack.cxx
new file mode 100644 (file)
index 0000000..0070d7d
--- /dev/null
@@ -0,0 +1,221 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ * Implementation of methods
+ *
+ ***************************************************************************
+ * $Log$
+ * Revision 1.3  2007-04-03 16:00:09  mchojnacki
+ * Changes to iprove memory managing
+ *
+ * Revision 1.2  2007/03/08 14:58:04  mchojnacki
+ * adding some alice stuff
+ *
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.19  2005/07/15 17:41:43  kopytin
+ * initialized fHiddenInfo in AliFemtoTrack() to null
+ *
+ * Revision 1.18  2005/07/10 02:17:21  chajecki
+ * Ftpc (Eeat+West) hits included in nHits()
+ *
+ * Revision 1.17  2005/06/17 21:41:12  chajecki
+ * Two bugs fixed:
+ * 1. wrong value of mNHits set in one of the constructors
+ * AliFemtoTrack::AliFemtoTrack(const StTrack* ST, AliFemtoThreeVector PrimaryVertex)
+ *
+ * 2. since year 4 the StMuTrack::nHits() returns the total number of hits.
+ * We're interested in TPC hits only so this value can be taken by
+ *  StMuTrack::topologyMap().numberOfHits(kTpcId);
+ * This change is backwards compatible so the code should work also
+ * for data <=Y3
+ *
+ * Revision 1.16  2003/03/18 14:41:48  kisiel
+ * Bugfix update for the theoretical part of the code. Reverts the changes to the Lednicky weight calculator, as the previuos one had problems with strong interaction
+ *
+ * Revision 1.15  2003/01/31 19:57:15  magestro
+ * Cleared up simple compiler warnings on i386_linux24
+ *
+ * Revision 1.14  2003/01/21 17:26:33  magestro
+ * Added condition to globalTrack() call so GlobalTracks branch in MuDst can be disabled
+ *
+ * Revision 1.13  2002/03/21 18:49:31  laue
+ * updated for new MuDst reader
+ *
+ * Revision 1.12  2002/02/04 18:58:33  laue
+ * *** empty log message ***
+ *
+ * Revision 1.11  2001/12/14 23:11:30  fretiere
+ * Add class HitMergingCut. Add class fabricesPairCut = HitMerginCut + pair purity cuts. Add TpcLocalTransform function which convert to local tpc coord (not pretty). Modify AliFemtoTrack, AliFemtoParticle, AliFemtoHiddenInfo, AliFemtoPair to handle the hit information and cope with my code
+ *
+ * Revision 1.4  2001/06/21 19:15:48  laue
+ * Modified fiels:
+ *   CTH.h : new constructor added
+ *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
+ *                                   (TTree) classes added
+ *   AliFemtoLikeSignAnalysis : minor changes, for debugging
+ *   AliFemtoTypes: split into different files
+ * Added files: for the new TTree muDst's
+ *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
+ *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
+ *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
+ *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
+ *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
+ *
+ * Revision 1.3  2001/05/25 23:23:59  lisa
+ * Added in AliFemtoKink stuff
+ *
+ *
+ ****************************************************************************/
+
+#include "Infrastructure/AliFemtoTrack.h" 
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+#ifdef __ROOT__
+#include "StEvent/StEnumerations.h"
+#include "Infrastructure/AliFemtoAihongPid.h"
+#include "StEventUtilities/StuProbabilityPidAlgorithm.h"
+#endif
+#endif
+
+#include "SystemOfUnits.h"   // has "tesla" in it
+//#include "AliFemtoParticleTypes.h"
+//#include "Infrastructure/AliFemtoTTreeEvent.h" 
+//#include "Infrastructure/AliFemtoTTreeTrack.h" 
+
+AliFemtoTrack::AliFemtoTrack():
+  fTrackId(0),
+  fFlags(0),
+  fLabel(0),
+  fImpactD(0),
+  fImpactZ(0),
+  fCdd(0),
+  fCdz(0),
+  fCzz(0),
+  fITSchi2(0),       
+  fITSncls(0),        
+  fTPCchi2(0),       
+  fTPCncls(0),       
+  fTPCnclsF(0),      
+  fTPCsignalN(0),    
+  fTPCsignalS(0),
+  fClusters(159),
+  fShared(159)
+{
+  fHiddenInfo = NULL;
+  //  cout << "Created track " << this << endl;
+}
+
+
+AliFemtoTrack::AliFemtoTrack(const AliFemtoTrack& t)
+ { // copy constructor
+  fCharge = t.fCharge;
+  fPidProbElectron = t.fPidProbElectron;
+  fPidProbPion = t.fPidProbPion;
+  fPidProbKaon = t.fPidProbKaon;
+  fPidProbProton = t.fPidProbProton;
+  fPidProbMuon=t.fPidProbMuon;
+  fP = t.fP;
+  fPt = t.fPt;
+  fHelix = t.fHelix;
+  fTrackId = t.fTrackId;
+  fFlags=t.fFlags;
+  fLabel=t.fLabel;
+  fImpactD=t.fImpactD;
+  fImpactZ=t.fImpactZ;
+  fCdd=t.fCdd;
+  fCdz=t.fCdz;
+  fCzz=t.fCzz;
+  fITSchi2=t.fITSchi2;       
+  fITSncls=t.fITSncls;        
+  fTPCchi2=t.fTPCchi2;       
+  fTPCncls=t.fTPCncls;       
+  fTPCnclsF=t.fTPCnclsF;      
+  fTPCsignalN=t.fTPCsignalN;    
+  fTPCsignalS=t.fTPCsignalS;  
+  fClusters=t.fClusters;
+  fShared=t.fShared;
+  if (t.ValidHiddenInfo())
+    fHiddenInfo = t.getHiddenInfo()->clone();
+  else 
+    fHiddenInfo = NULL;
+  //  cout << "Created track " << this << endl;
+};
+
+void AliFemtoTrack::SetCharge(const short& ch){fCharge=ch;}
+
+void AliFemtoTrack::SetPidProbElectron(const float& x){fPidProbElectron = x;}
+void AliFemtoTrack::SetPidProbPion(const float& x){fPidProbPion = x;}
+void AliFemtoTrack::SetPidProbKaon(const float& x){fPidProbKaon = x;}
+void AliFemtoTrack::SetPidProbProton(const float& x){fPidProbProton = x;}
+void AliFemtoTrack::SetPidProbMuon(const float& x){fPidProbMuon = x;}
+void AliFemtoTrack::SetP(const AliFemtoThreeVector& p){fP = p;}
+void AliFemtoTrack::SetPt(const float& pt){fPt = pt;} 
+void AliFemtoTrack::SetHelix(const AliFmPhysicalHelixD& h){fHelix = h;}
+void AliFemtoTrack::SetTrackId(const short & id) { fTrackId=id;}
+void AliFemtoTrack::SetFlags(const long int &flags) {fFlags=flags;}
+void AliFemtoTrack::SetLabel(const int &label) {fLabel=label;}
+void AliFemtoTrack::SetImpactD(const float& ImpactD){fImpactD=ImpactD;}
+void AliFemtoTrack::SetImpactZ(const float& ImpactZ){fImpactZ=ImpactZ;}
+void AliFemtoTrack::SetCdd(const float& Cdd){fCdd=Cdd;}
+void AliFemtoTrack::SetCdz(const float& Cdz){fCdz=Cdz;}
+void AliFemtoTrack::SetCzz(const float& Czz){fCzz=Czz;}
+void AliFemtoTrack::SetITSchi2(const float& ITSchi2){fITSchi2=ITSchi2;}    
+void AliFemtoTrack::SetITSncls(const int& ITSncls){fITSncls=ITSncls;}     
+void AliFemtoTrack::SetTPCchi2(const float& TPCchi2){fTPCchi2=TPCchi2;}       
+void AliFemtoTrack::SetTPCncls(const int& TPCncls){fTPCncls=TPCncls;}       
+void AliFemtoTrack::SetTPCnclsF(const short& TPCnclsF){fTPCnclsF=TPCnclsF;}      
+void AliFemtoTrack::SetTPCsignalN(const short& TPCsignalN){fTPCsignalN=TPCsignalN;}    
+void AliFemtoTrack::SetTPCsignalS(const float& TPCsignalS){fTPCsignalS=TPCsignalS;} 
+
+
+short AliFemtoTrack::Charge() const {return fCharge;}  
+AliFemtoThreeVector AliFemtoTrack::P() const {return fP;}
+float AliFemtoTrack::Pt() const {return fPt;}              
+const AliFmPhysicalHelixD& AliFemtoTrack::Helix() const {return fHelix;}
+short AliFemtoTrack::TrackId() const { return fTrackId; }
+long int AliFemtoTrack::Flags() const {return fFlags;}
+int AliFemtoTrack::Label()const {return fLabel;}
+float AliFemtoTrack::ImpactD()const{return fImpactD;}
+float AliFemtoTrack::ImpactZ()const{return fImpactZ;}
+float AliFemtoTrack::Cdd() const{return fCdd;}
+float AliFemtoTrack::Cdz() const{return fCdz;}
+float AliFemtoTrack::Czz() const{return fCzz;} 
+float AliFemtoTrack::ITSchi2() const{return fITSchi2;}    
+int   AliFemtoTrack::ITSncls() const{return fITSncls;}     
+float AliFemtoTrack::TPCchi2() const{return fTPCchi2;}       
+int   AliFemtoTrack::TPCncls() const{return fTPCncls;}       
+short AliFemtoTrack::TPCnclsF() const{return fTPCnclsF;}      
+short AliFemtoTrack::TPCsignalN() const{return fTPCsignalN;}    
+float AliFemtoTrack::TPCsignalS() const{return fTPCsignalS;} 
+
+void AliFemtoTrack::SetHiddenInfo(AliFemtoHiddenInfo* aHiddenInfo) {fHiddenInfo=aHiddenInfo;}
+bool AliFemtoTrack::ValidHiddenInfo() const { if (fHiddenInfo) return true; else return false; }
+AliFemtoHiddenInfo* AliFemtoTrack::getHiddenInfo() const {return fHiddenInfo;}
+  
+AliFemtoTrack::~AliFemtoTrack()
+{
+  if (fHiddenInfo)
+    delete fHiddenInfo;
+  //  cout << "Deleted track " << this << endl;
+}
+
+const TBits& AliFemtoTrack::TPCclusters() const {return fClusters;}
+const TBits& AliFemtoTrack::TPCsharing()  const {return fShared;}
+
+void AliFemtoTrack::SetTPCcluster(const short& aNBit, const Bool_t& aValue)
+{
+  fClusters.SetBitNumber(aNBit, aValue);
+}
+
+void AliFemtoTrack::SetTPCshared(const short& aNBit, const Bool_t& aValue)
+{
+  fShared.SetBitNumber(aNBit, aValue);
+}
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrack.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrack.h
new file mode 100644 (file)
index 0000000..1e8ac1b
--- /dev/null
@@ -0,0 +1,179 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *    Intermediate format for particle.  This is built from the
+ *    input particle format (e.g. StTrack of StEvent) and presented to
+ *    the Analyses for ParticleCuts.
+ *
+ ***************************************************************************
+ *  ... Lots of stuff deleted here ...
+ **************************************************************************/
+
+#ifndef AliFemtoTrack_hh
+#define AliFemtoTrack_hh
+
+#include "Infrastructure/AliFemtoTypes.h"
+#include "AliFmPhysicalHelixD.h"
+#include "TBits.h"
+/* Th stuff */
+#include "Base/AliFemtoHiddenInfo.h"
+/***/
+
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+class StEvent;
+class StTrack;
+class StMuDst;
+class StMuTrack;
+#endif
+
+
+
+
+class AliFemtoTrack{
+public:
+  AliFemtoTrack();
+  AliFemtoTrack(const AliFemtoTrack&);// copy constructor
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+#ifdef __ROOT__
+ //AliFemtoTrack(const StTrack*, AliFemtoThreeVector);   // c-tor from StTrack of STAR DSTs
+  //AliFemtoTrack(const StMuDst* dst, const StMuTrack* t);
+#endif
+  //AliFemtoTrack(const StEvent*, const StTrack*);
+#endif
+
+  ~AliFemtoTrack();
+//    ~AliFemtoTrack(){/* no-op*/};
+
+  short Charge() const;
+  float PidProbElectron() const;
+  float PidProbPion() const;
+  float PidProbKaon() const;
+  float PidProbProton() const;
+  float PidProbMuon() const;
+  
+  AliFemtoThreeVector P() const;
+  float Pt() const;
+  const AliFmPhysicalHelixD& Helix() const;
+  short TrackId() const;
+  long int Flags() const;
+  int Label()const;
+  float ImpactD()const;
+  float ImpactZ()const;
+  float Cdd() const;
+  float Cdz() const;
+  float Czz() const; 
+  
+  float ITSchi2() const;    
+  int   ITSncls() const;     
+  float TPCchi2() const;       
+  int   TPCncls() const;       
+  short TPCnclsF() const;      
+  short TPCsignalN() const;    
+  float TPCsignalS() const;   
+
+  const TBits& TPCclusters() const;
+  const TBits& TPCsharing()  const;
+  
+  void SetCharge(const short&);
+  void SetPidProbElectron(const float&);
+  void SetPidProbPion(const float&);
+  void SetPidProbKaon(const float&);
+  void SetPidProbProton(const float&);
+  void SetPidProbMuon(const float&);
+   
+  void SetP(const AliFemtoThreeVector&);
+  void SetPt(const float&);
+  void SetHelix(const AliFmPhysicalHelixD&);
+  void SetTrackId(const short&);
+  void SetFlags(const long int&);
+  void SetLabel(const int&);
+  void SetImpactD(const float&);
+  void SetImpactZ(const float&);
+  void SetCdd(const float&);
+  void SetCdz(const float&);
+  void SetCzz(const float&);
+  
+  void SetITSchi2(const float&);    
+  void SetITSncls(const int&);     
+  void SetTPCchi2(const float&);       
+  void SetTPCncls(const int&);       
+  void SetTPCnclsF(const short&);      
+  void SetTPCsignalN(const short&);    
+  void SetTPCsignalS(const float&);   
+
+  void SetTPCcluster(const short& aNBit, const Bool_t& aValue);
+  void SetTPCshared(const short& aNBit, const Bool_t& aValue);
+
+  /* Th stuff */
+  void SetHiddenInfo(AliFemtoHiddenInfo* aHiddenInfo);
+  bool ValidHiddenInfo() const;
+  // Fab private : (official : const AliFemtoHiddenInfo* HiddenInfo() const;
+  AliFemtoHiddenInfo* getHiddenInfo() const;
+  /***/
+  
+  //Alice stuff
+   enum {
+    kITSin=0x0001,kITSout=0x0002,kITSrefit=0x0004,kITSpid=0x0008,
+    kTPCin=0x0010,kTPCout=0x0020,kTPCrefit=0x0040,kTPCpid=0x0080,
+    kTRDin=0x0100,kTRDout=0x0200,kTRDrefit=0x0400,kTRDpid=0x0800,
+    kTOFin=0x1000,kTOFout=0x2000,kTOFrefit=0x4000,kTOFpid=0x8000,
+    kRICHpid=0x20000,
+    kTRDbackup=0x80000,
+    kTRDStop=0x20000000,
+    kESDpid=0x40000000,
+    kTIME=0x80000000
+  };
+
+private:
+  char fCharge;
+  float fPidProbElectron; // new
+  float fPidProbPion; // new
+  float fPidProbKaon; // new
+  float fPidProbProton; // new
+  float fPidProbMuon; //new 
+  unsigned int fTrackId;
+
+
+  AliFemtoThreeVector fP;
+  float fPt;
+  AliFmPhysicalHelixD fHelix;
+
+  //alice stuff
+  long int fFlags; //Reconsruction status flags
+  int fLabel; //Track label  
+  float fImpactD; //impact parameter in xy plane
+  float fImpactZ;//impacct parameter in z
+  float fCdd,fCdz,fCzz;//covariance matrix of the impact parameters
+  // ITS related track information
+  float fITSchi2;        // chi2 in the ITS
+  int   fITSncls;        // number of clusters assigned in the ITS
+  // TPC related track information
+  float  fTPCchi2;       // chi2 in the TPC
+  int    fTPCncls;       // number of clusters assigned in the TPC
+  short fTPCnclsF;      // number of findable clusters in the TPC
+  short fTPCsignalN;    // number of points used for dEdx
+  float fTPCsignalS;    // RMS of dEdx measurement
+  TBits fClusters;
+  TBits fShared;
+  
+  /* Th stuff */
+  // Fab private : add mutable
+  //  mutable 
+  AliFemtoHiddenInfo* fHiddenInfo; //!
+  /***/
+};
+
+//inline const float* AliFemtoTrack::NSigma() const 
+//{return &mNSigmaElectron;} // Fab private 
+inline float AliFemtoTrack::PidProbElectron() const {return fPidProbElectron;}
+inline float AliFemtoTrack::PidProbPion() const {return fPidProbPion;}
+inline float AliFemtoTrack::PidProbKaon() const {return fPidProbKaon;}
+inline float AliFemtoTrack::PidProbProton() const {return fPidProbProton;}
+inline float AliFemtoTrack::PidProbMuon() const {return fPidProbMuon;}
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrackCollection.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrackCollection.h
new file mode 100644 (file)
index 0000000..920b3fc
--- /dev/null
@@ -0,0 +1,44 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   The Collection of Tracks is the main component of the HbtEvent,
+ *   which is essentially the transient microDST
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.2  2000/02/01 00:33:32  laue
+ * namespaces changed to run on the new Solaris Compiler CC5
+ * since we can use member templates in franks1Histo.h we are doing it
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoTrackCollection_hh
+#define AliFemtoTrackCollection_hh
+#include "Infrastructure/AliFemtoTrack.h"
+#include <list>
+
+#if !defined(ST_NO_NAMESPACES)
+using std::list;
+#endif
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef list<AliFemtoTrack*, allocator<AliFemtoTrack*> >            AliFemtoTrackCollection;
+typedef list<AliFemtoTrack*, allocator<AliFemtoTrack*> >::iterator  AliFemtoTrackIterator;
+#else
+typedef list<AliFemtoTrack*>            AliFemtoTrackCollection;
+typedef list<AliFemtoTrack*>::iterator  AliFemtoTrackIterator;
+#endif
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTypes.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTypes.h
new file mode 100644 (file)
index 0000000..28984b8
--- /dev/null
@@ -0,0 +1,42 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Frank Laue, BNL, laue@bnl.gov
+ ***************************************************************************
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.14  2001/06/21 19:15:48  laue
+ * Modified fiels:
+ *   CTH.h : new constructor added
+ *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
+ *                                   (TTree) classes added
+ *   AliFemtoLikeSignAnalysis : minor changes, for debugging
+ *   AliFemtoTypes: split into different files
+ * Added files: for the new TTree muDst's
+ *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
+ *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
+ *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
+ *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
+ *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
+ *
+ *
+ ***************************************************************************/
+
+// 
+// I split this up into different files, so that I do not have to 
+// load/recompile everything all over again.
+//
+
+//#include "Infrastructure/AliFemtoHisto.h"
+#include "Infrastructure/AliFemtoString.h"
+#include "Infrastructure/AliFemtoVector.h"
+#include "Infrastructure/AliFemtoHelix.h"
+#include "Infrastructure/AliFemtoEnumeration.h"
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.cxx
new file mode 100644 (file)
index 0000000..6b8749f
--- /dev/null
@@ -0,0 +1,173 @@
+#include "AliFemtoV0.h"
+#include "phys_constants.h"
+
+// -----------------------------------------------------------------------
+AliFemtoV0::AliFemtoV0(const AliFemtoV0& v){ // copy constructor
+  fDecayLengthV0 = v.fDecayLengthV0;
+  fDecayVertexV0 = v.fDecayVertexV0;
+  fDcaV0Daughters = v.fDcaV0Daughters;
+  fDcaV0ToPrimVertex = v.fDcaV0ToPrimVertex;
+  fDcaPosToPrimVertex = v.fDcaPosToPrimVertex;
+  fDcaNegToPrimVertex = v.fDcaNegToPrimVertex;
+  fMomPos = v.fMomPos;
+  fMomNeg = v.fMomNeg;
+
+  fTrackTopologyMapPos[0] = v.fTrackTopologyMapPos[0];
+  fTrackTopologyMapPos[1] = v.fTrackTopologyMapPos[1];
+  fTrackTopologyMapNeg[0] = v.fTrackTopologyMapNeg[0];
+  fTrackTopologyMapNeg[1] = v.fTrackTopologyMapNeg[1];
+   
+  fKeyPos = v.fKeyPos;
+  fKeyNeg = v.fKeyNeg;
+     
+  fTpcHitsPos = v.fTpcHitsPos;
+  fTpcHitsNeg = v.fTpcHitsNeg;
+
+  fChi2V0 = v.fChi2V0;
+  fClV0 = v.fClV0;
+  fChi2Pos = v.fChi2Pos;
+  fClPos = v.fClPos;
+  fChi2Neg = v.fChi2Neg;
+  fClNeg = v.fClNeg;
+  fDedxPos = v.fDedxPos;
+  fErrDedxPos = v.fErrDedxPos;//Gael 04Fev2002
+  fLenDedxPos = v.fLenDedxPos;//Gael 04Fev2002
+  fDedxNeg = v.fDedxNeg;
+  fErrDedxNeg = v.fErrDedxNeg;//Gael 04Fev2002
+  fLenDedxNeg = v.fLenDedxNeg;//Gael 04Fev2002
+
+  fNufDedxPos = v.fNufDedxPos;
+  fNufDedxNeg = v.fNufDedxNeg;
+
+  fHelixPos = v.fHelixPos;// Gael 12 Sept
+  fHelixNeg = v.fHelixNeg;// Gael 12 Sept
+  fHiddenInfo = v.fHiddenInfo? v.fHiddenInfo->clone() : 0;// GR 11 DEC 02
+  UpdateV0();
+}
+// -----------------------------------------------------------------------
+void AliFemtoV0::UpdateV0(){
+  //Calc. derived memebers of the v0 class
+  float MomNegAlongV0, MomPosAlongV0;
+
+   fMomV0  = fMomPos + fMomNeg;
+   fPtV0   = fMomV0.perp();
+   fPtotV0 = fMomV0.mag();
+   fPtPos  = fMomPos.perp();
+   fPtotPos= fMomPos.mag();
+   fPtNeg  = fMomNeg.perp();
+   fPtotNeg= fMomNeg.mag();
+   fELambda= ::sqrt(fPtotV0*fPtotV0+M_LAMBDA*M_LAMBDA);
+   fEK0Short= ::sqrt(fPtotV0*fPtotV0+M_KAON_0_SHORT*M_KAON_0_SHORT);
+   fEPosProton = ::sqrt(fPtotPos*fPtotPos+M_PROTON*M_PROTON);
+   fENegProton = ::sqrt(fPtotNeg*fPtotNeg+M_PROTON*M_PROTON);
+   fEPosPion = ::sqrt(fPtotPos*fPtotPos+M_PION_PLUS*M_PION_PLUS);
+   fENegPion = ::sqrt(fPtotNeg*fPtotNeg+M_PION_MINUS*M_PION_MINUS);
+  
+   MomNegAlongV0 =  fMomNeg*fMomV0 / ::sqrt(::pow(fPtotV0,2));
+   MomPosAlongV0 =  fMomPos*fMomV0 / ::sqrt(::pow(fPtotV0,2));
+
+   fAlphaV0 = (MomPosAlongV0-MomNegAlongV0)/(MomPosAlongV0+MomNegAlongV0);
+   fPtArmV0 =  ::sqrt(fPtotPos*fPtotPos - MomPosAlongV0*MomPosAlongV0);
+   fMassLambda = ::sqrt(::pow(fEPosProton+fENegPion,2)-::pow(fPtotV0,2));
+   fMassAntiLambda = ::sqrt(::pow(fENegProton+fEPosPion,2)-::pow(fPtotV0,2));
+   fMassK0Short = ::sqrt(::pow(fENegPion+fEPosPion,2)-::pow(fPtotV0,2));
+
+   fRapLambda = 0.5*::log( (fELambda+fMomV0.z()) / (fELambda-fMomV0.z()) );
+   fCTauLambda = M_LAMBDA*(fDecayLengthV0) / ::sqrt( ::pow((double)fMomV0.mag(),2.) );
+   
+   fRapK0Short = 0.5*::log( (fEK0Short+fMomV0.z()) / (fEK0Short-fMomV0.z()) );
+   fCTauK0Short = M_KAON_0_SHORT*(fDecayLengthV0) / ::sqrt( ::pow((double)fMomV0.mag(),2.) );
+
+}
+// -----------------------------------------------------------------------
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+#ifdef __ROOT__
+#include "StStrangeMuDstMaker/StV0MuDst.h"
+AliFemtoV0::AliFemtoV0( StV0MuDst& v){ // from strangess micro dst structure
+  fDecayLengthV0 = v.decayLengthV0();
+  fDecayVertexV0 = AliFemtoThreeVector( v.decayVertexV0X(), v.decayVertexV0Y(), v.decayVertexV0Z() );
+  fDcaV0Daughters = v.dcaV0Daughters();
+  fDcaV0ToPrimVertex = v.dcaV0ToPrimVertex();
+  fDcaPosToPrimVertex = v.dcaPosToPrimVertex();
+  fDcaNegToPrimVertex = v.dcaNegToPrimVertex();
+  fMomPos = AliFemtoThreeVector( v.momPosX(), v.momPosY(), v.momPosZ() );
+  fMomNeg = AliFemtoThreeVector( v.momNegX(), v.momNegY(), v.momNegZ() ); 
+#ifdef STHBTDEBUG
+  cout << " hist pos ";
+  cout << v.topologyMapPos().numberOfHits(kTpcId); 
+  cout << " hist neg ";
+  cout << v.topologyMapNeg().numberOfHits(kTpcId) << endl;
+#endif
+  fTpcHitsPos = ( v.topologyMapPos().numberOfHits(kTpcId) );
+  fTpcHitsNeg = ( v.topologyMapNeg().numberOfHits(kTpcId) );
+  fTrackTopologyMapPos[0] = ( v.topologyMapPos().data(0) );
+  fTrackTopologyMapPos[1] = ( v.topologyMapPos().data(1) );
+  fTrackTopologyMapNeg[0] = ( v.topologyMapNeg().data(0) );
+  fTrackTopologyMapNeg[1] = ( v.topologyMapNeg().data(1) );
+  fKeyPos = v.keyPos();
+  fKeyNeg = v.keyNeg();
+  fChi2V0 = v.chi2V0();
+  fClV0 = v.clV0();
+  fChi2Pos = v.chi2Pos();
+  fClPos = v.clPos();
+  fChi2Neg = v.chi2Neg();
+  fClNeg = v.clNeg();
+  fDedxPos = v.dedxPos();
+  fErrDedxPos = v.errDedxPos();//Gael 04Fev2002
+  fLenDedxPos = v.lenDedxPos();//Gael 04Fev2002
+  fDedxNeg = v.dedxNeg();
+  fErrDedxNeg = v.errDedxNeg();//Gael 04Fev2002
+  fLenDedxNeg = v.lenDedxNeg();//Gael 04Fev2002
+  fNufDedxPos = v.nufDedxPos();
+  fNufDedxNeg = v.nufDedxNeg();
+  fHiddenInfo =  0;//GR 11 DEC 02
+
+#ifdef STHBTDEBUG
+  cout << " keyPos " << v.keyPos() << endl;
+  cout << " keyNeg " << v.keyNeg() << endl;
+#endif
+  fMomV0 = AliFemtoThreeVector( v.momV0X(), v.momV0Y(), v.momV0Z() );
+#ifdef STHBTDEBUG
+  cout << " alpha  ";
+  cout << v.alphaV0();
+  cout << " ptArm  ";
+  cout << v.ptArmV0() << endl;
+#endif
+  fAlphaV0 = v.alphaV0();
+  fPtArmV0 = v.ptArmV0();
+  fELambda = v.eLambda();
+  fEK0Short = v.eK0Short();
+  fEPosProton = v.ePosProton();
+  fEPosPion = v.ePosPion();
+  fENegPion = v.eNegPion();
+  fENegProton = v.eNegProton();
+  fMassLambda = v.massLambda();
+  fMassAntiLambda = v.massAntiLambda();
+  fMassK0Short = v.massK0Short();
+  fRapLambda = v.rapLambda();
+  fRapK0Short = v.rapK0Short();
+  fCTauLambda = v.cTauLambda();
+  fCTauK0Short = v.cTauK0Short();
+  fPtV0 = v.ptV0();
+  fPtotV0 = v.ptotV0();
+  fPtPos = v.ptPos();
+  fPtotPos = v.ptotPos();
+  fDedxPos = v.dedxPos();
+  fPtNeg = v.ptNeg();
+  fPtotNeg = v.ptotNeg();
+  fDedxNeg = v.dedxNeg();
+}
+#endif // __ROOT__
+#endif  //  __NO_STAR_DEPENDENCE_ALLOWED__
+
+
+
+void AliFemtoV0::SetHelixPos(const AliFmPhysicalHelixD& h){fHelixPos = h;}// Gael 12 Sept 02
+const AliFmPhysicalHelixD& AliFemtoV0::HelixPos() const {return fHelixPos;}// Gael 12 Sept 02
+void AliFemtoV0::SetHelixNeg(const AliFmPhysicalHelixD& h){fHelixNeg = h;}// Gael 12 Sept 02
+const AliFmPhysicalHelixD& AliFemtoV0::HelixNeg() const {return fHelixNeg;}// Gael 12 Sept 02
+
+void AliFemtoV0::SetHiddenInfo(AliFemtoHiddenInfo* aHiddenInfo) {fHiddenInfo=aHiddenInfo;}
+bool AliFemtoV0::ValidHiddenInfo() const { if (fHiddenInfo) return true; else return false; }
+AliFemtoHiddenInfo* AliFemtoV0::getHiddenInfo() const {return fHiddenInfo;}
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.h
new file mode 100644 (file)
index 0000000..a4a676a
--- /dev/null
@@ -0,0 +1,464 @@
+/***********************************************************************
+ *
+ * $Id: AliFemtoV0.h,v 1.0 1999/09/07
+ *
+ * Authors: Helen Caines, Tom Humanic 07-Sep-1999
+ *
+ ***********************************************************************
+ *
+ * Description: V0 class with members copied from StV0hbtV0.h
+ *
+ ***********************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.13  2003/09/02 17:58:32  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.12  2003/01/14 09:45:14  renault
+ * enable this class to be used for theorical calculations.
+ *
+ * Revision 1.11  2002/11/19 23:37:56  renault
+ * Get V0 daughters helix
+ *
+ * Revision 1.10  2002/02/09 19:25:36  laue
+ * updates (dedx length)
+ *
+ * Revision 1.9  2001/09/05 20:41:43  laue
+ * Updates of the hbtMuDstTree microDSTs
+ *
+ * Revision 1.8  2000/10/09 21:54:23  laue
+ * Helens changes to the V0s
+ *
+ * Revision 1.7  2000/08/09 14:50:22  laue
+ * 'const' removed to compile on solaris
+ *
+ * Revision 1.6  2000/07/16 21:38:23  laue
+ * AliFemtoCoulomb.cxx AliFemtoSectoredAnalysis.cxx : updated for standalone version
+ * AliFemtoV0.cc AliFemtoV0.h : some cast to prevent compiling warnings
+ * AliFemtoParticle.cc AliFemtoParticle.h : pointers mTrack,mV0 initialized to 0
+ * AliFemtoIOBinary.cc : some printouts in #ifdef STHBTDEBUG
+ * AliFemtoEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
+ *                 solution
+ *
+ * Revision 1.5  2000/05/03 17:44:43  laue
+ * AliFemtoEvent, AliFemtoTrack & AliFemtoV0 declared friend to AliFemtoIOBinary
+ * AliFemtoParticle updated for V0 pos,neg track Id
+ *
+ * Revision 1.4  2000/02/18 21:32:24  laue
+ * franksTrackCut changed. If mCharge is set to '0' there will be no cut
+ * on charge. This is important for front-loaded cuts.
+ *
+ * copy constructor implemented for AliFemtoEvent, AliFemtoTrack and AliFemtoV0.
+ *
+ * franks1HistoD.cxx franks1HistoD.h franks2HistoD.cxx franks2HistoD.h
+ * removed. We can now (CC5 on Solaris) use the versions (no D)
+ *
+ * Revision 1.3  2000/02/01 00:33:32  laue
+ * namespaces changed to run on the new Solaris Compiler CC5
+ * since we can use member templates in franks1Histo.h we are doing it
+ *
+ * Revision 1.2  1999/10/15 02:32:37  lisa
+ * Helen has added method AliFemtoV0::UpdateV0() to fill derived information - this leads to smaller microDSTs
+ *
+ * Revision 1.1  1999/09/16 18:47:59  lisa
+ * replace placeholder HbtV0Track stuff with Helens AliFemtoV0 classes
+ *
+ * 
+ *
+ ***********************************************************************/
+#ifndef AliFemtoV0_hh
+#define AliFemtoV0_hh
+
+#include "Infrastructure/AliFemtoTypes.h" //same as in AliFemtoTrack.h
+#include "AliFmPhysicalHelixD.h" // Gael 12 Sept 02
+#ifdef __ROOT__
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+#include "StStrangeMuDstMaker/StV0MuDst.h"
+#endif
+#endif
+/* Th stuff */
+#include "Base/AliFemtoHiddenInfo.h"
+/***/
+
+class AliFemtoV0 {
+public:
+  AliFemtoV0(){/* no-op */}
+  AliFemtoV0( const AliFemtoV0&); // copy constructor
+#ifdef __ROOT__
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+  AliFemtoV0( StV0MuDst&); // from strangeness V0 micro dst structure
+#endif
+#endif
+  ~AliFemtoV0(){if(fHiddenInfo) delete fHiddenInfo;}
+
+
+  float decayLengthV0() const;       // 3-d decay distance
+  AliFemtoThreeVector decayVertexV0() const; // Coordinates of decay vertex
+  AliFemtoThreeVector primaryVertex() const; // Coordinates of primary vertex
+  float decayVertexV0X() const; // Coordinates of decay vertex
+  float decayVertexV0Y() const; // Coordinates of decay vertex
+  float decayVertexV0Z() const; // Coordinates of decay vertex
+  float dcaV0Daughters() const;      // DCA of v0 daughters at decay vertex
+  float dcaV0ToPrimVertex() const;   // DCA of v0 to primary vertex
+  float dcaPosToPrimVertex() const;  // DCA of pos v0 daughter to pri vertex
+  float dcaNegToPrimVertex() const;  // DCA of neg v0 daughter to pri vertex
+  AliFemtoThreeVector momPos() const;   // Momentum components of pos. daughter
+  float momPosX() const;   // Momentum components of pos. daughter
+  float momPosY() const;   // Momentum components of pos. daughter
+  float momPosZ() const;   // Momentum components of pos. daughter
+  AliFemtoThreeVector momNeg() const;   // Momentum components of neg. daughter
+  float momNegX() const;   // Momentum components of neg. daughter
+  float momNegY() const;   // Momentum components of neg. daughter
+  float momNegZ() const;   // Momentum components of neg. daughter
+
+  int   tpcHitsPos() const;          // Number of TPC hits on pos. daughter
+  int   tpcHitsNeg() const;          // Number of TPC hits on neg. daughter
+  unsigned long trackTopologyMapPos(unsigned int) const;
+  unsigned long trackTopologyMapNeg(unsigned int) const;
+
+  AliFemtoThreeVector momV0() const ;    // Momentum components of V0
+  float momV0X() const ;    // Momentum components of V0
+  float momV0Y() const ;    // Momentum components of V0
+  float momV0Z() const ;    // Momentum components of V0
+  float alphaV0() const ;             // Armenteros-Podolanski variable
+  float ptArmV0() const ;            // Armenteros-Podolanski variable
+  float eLambda() const ;             // Energy assuming lambda hypothesis
+  float eK0Short() const ;            // Energy assuming k-short hypothesis
+  float ePosProton() const ;          // Energy of pos. daughter assuming proton
+  float ePosPion() const ;            // Energy of pos. daughter assuming pion
+  float eNegProton() const ;          // Energy of neg. daughter assuming antiproton
+  float eNegPion() const ;            // Energy of neg. daughter assuming pion
+  float massLambda() const ;          // Mass assuming lambda hypothesis
+  float massAntiLambda() const ;      // Mass assuming antilambda hypothesis
+  float massK0Short() const ;         // Mass assuming k-short hypothesis
+  float rapLambda() const ;           // Rapidity assuming (anti) constlambda
+  float rapK0Short() const ;          // Rapidity assuming k-short
+  float cTauLambda() const ;          // Lifetime (ctau) const assuming (anti) constlambda
+  float cTauK0Short() const ;         // Lifetime (ctau) const assuming k-short
+  float ptV0() const ;                // Transverse momentum
+  float ptotV0() const ;              // Total momentum
+  float ptPos() const ;               // Transverse momentum of pos. daughter
+  float ptotPos() const ;             // Total momentum of pos. daughter
+  float dedxPos() const;              // dedx of Positive track
+  float numdedxPos() const;
+// number of hits in dE/dX track of pos. daughter--Gael04Fev 2002
+  float errdedxPos() const;              
+// error on dedx of Positive track--Gael04Fev 2002
+  float lendedxPos() const;              
+// Length of dE/dX track of pos. daughter--Gael04Fev 2002
+  float pseudoRapPos() const;              
+// Length of dE/dX track of neg. daughter--Gael04Fev 2002
+
+  float ptNeg() const ;               // Transverse momentum of neg. daughter
+  float ptotNeg() const ;             // Total momentum of neg. daughter
+  float dedxNeg() const;              // dedx of Negative track
+  float numdedxNeg() const;
+// number of hits in dE/dX track of neg. daughter--Gael04Fev 2002
+  float errdedxNeg() const;              
+// error on dedx of Negative track--Gael04Fev 2002
+  float lendedxNeg() const;              
+// Length of dE/dX track of neg. daughter--Gael04Fev 2002
+  float pseudoRapNeg() const;              
+// Length of dE/dX track of neg. daughter--Gael04Fev 2002
+
+  unsigned short     idNeg() const;               // Id of negative track
+  unsigned short   idPos() const;               // Id of positive track
+  unsigned short   keyNeg() const;               // Id of negative track
+  unsigned short   keyPos() const;               // Id of positive track
+
+  const AliFmPhysicalHelixD& HelixPos() const; // Gael 12 Sept 02
+  const AliFmPhysicalHelixD& HelixNeg() const; // Gael 12 Sept 02
+
+  void UpdateV0(); // Fills derived info
+  void SetdecayLengthV0(const float);  
+  void SetdecayVertexV0(const AliFemtoThreeVector);  
+  void SetdecayVertexV0X(const float);
+  void SetdecayVertexV0Y(const float);
+  void SetdecayVertexV0Z(const float);
+  void SetdcaV0Daughters(const float); 
+  void SetdcaV0ToPrimVertex(const float);  
+  void SetdcaPosToPrimVertex(const float); 
+  void SetdcaNegToPrimVertex(const float); 
+  void SetmomPos(const AliFemtoThreeVector);  
+  void SetmomPosX(const float);  
+  void SetmomPosY(const float);  
+  void SetmomPosZ(const float);  
+  void SetmomNeg(const AliFemtoThreeVector);  
+  void SetmomNegX(const float);  
+  void SetmomNegY(const float);  
+  void SetmomNegZ(const float);  
+
+  void SettpcHitsPos(const int&);      
+  void SettpcHitsNeg(const int&);      
+
+  void SetTrackTopologyMapPos(unsigned int, const unsigned long&);
+  void SetTrackTopologyMapNeg(unsigned int, const unsigned long&);      
+
+  void SetmomV0( AliFemtoThreeVector);
+  void SetmomV0X( float);
+  void SetmomV0Y( float);
+  void SetmomV0Z( float);
+  void SetalphaV0( float);       
+  void SetptArmV0( float);       
+  void SeteLambda( float);     
+  void SeteK0Short( float);    
+  void SetePosProton( float);  
+  void SetePosPion( float);    
+  void SeteNegProton( float);  
+  void SeteNegPion( float);    
+  void SetmassLambda( float);  
+  void SetmassAntiLambda( float);
+  void SetmassK0Short( float);  
+  void SetrapLambda( float);    
+  void SetrapK0Short( float);   
+  void SetcTauLambda( float);   
+  void SetcTauK0Short( float);  
+  void SetptV0( float);         
+  void SetptotV0( float);       
+  void SetptPos( float);        
+  void SetptotPos( float);      
+  void SetptNeg( float);        
+  void SetptotNeg( float);
+  void SetidNeg(const unsigned short&);
+  void SetidPos(const unsigned short&);
+  void SetdedxNeg(float);
+  void SeterrdedxNeg(float x);//Gael 04Fev2002
+  void SetlendedxNeg(float x);//Gael 04Fev2002
+  void SetpseudoRapNeg(float x);//Gael 04Fev2002
+  void SetdedxPos(float);
+  void SeterrdedxPos(float x);//Gael 04Fev2002
+  void SetlendedxPos(float x);//Gael 04Fev2002
+  void SetpseudoRapPos(float x);//Gael 04Fev2002
+  void SetkeyNeg(const unsigned short&);
+  void SetkeyPos(const unsigned short&);
+     
+  void SetHelixPos(const AliFmPhysicalHelixD&); // Gael 12 Sept 02
+  void SetHelixNeg(const AliFmPhysicalHelixD&); // Gael 12 Sept 02
+
+  void SetprimaryVertex(const AliFemtoThreeVector v);//Gael 24 Sept 02
+  /* Th stuff */
+  void SetHiddenInfo(AliFemtoHiddenInfo* aHiddenInfo);
+  bool ValidHiddenInfo() const;
+  // Fab private : (official : const AliFemtoHiddenInfo* HiddenInfo() const;
+  AliFemtoHiddenInfo* getHiddenInfo() const;
+  /***/
+
+protected:
+  float fDecayLengthV0;
+  AliFemtoThreeVector fDecayVertexV0;
+  AliFemtoThreeVector fPrimaryVertex;
+  float fDcaV0Daughters;
+  float fDcaV0ToPrimVertex;
+  float fDcaPosToPrimVertex;
+  float fDcaNegToPrimVertex;
+  AliFemtoThreeVector fMomPos;
+  AliFemtoThreeVector fMomNeg;
+
+  unsigned long  fTrackTopologyMapPos[2];
+  unsigned long  fTrackTopologyMapNeg[2];
+       
+  int   fTpcHitsPos;
+  int   fTpcHitsNeg;
+
+  float fChi2V0;
+  float fClV0;
+  float fChi2Pos;
+  float fClPos;
+  float fChi2Neg;
+  float fClNeg;
+
+  float fDedxPos;
+  float fErrDedxPos;
+  float fLenDedxPos;
+  
+  float fDedxNeg;
+  float fErrDedxNeg;
+  float fLenDedxNeg;
+
+  unsigned short fNufDedxPos;
+  unsigned short fNufDedxNeg;
+
+  AliFmPhysicalHelixD fHelixPos; // Gael 12 Sept 02
+  AliFmPhysicalHelixD fHelixNeg; // Gael 12 Sept 02
+
+  // the following variables are not in the persistent version and can be calculated via UpdateV0();
+  AliFemtoThreeVector fMomV0;
+  float fAlphaV0;
+  float fPtArmV0;
+  float fELambda;
+  float fEK0Short;
+  float fEPosProton;
+  float fEPosPion;
+  float fENegProton;
+  float fENegPion;
+  float fMassLambda;
+  float fMassAntiLambda;
+  float fMassK0Short;
+  float fRapLambda;
+  float fRapK0Short;
+  float fCTauLambda;
+  float fCTauK0Short;
+  float fPtV0;
+  float fPtotV0;
+  float fPtPos;
+  float fPtotPos;
+  float fPtNeg;
+  float fPtotNeg;
+
+  unsigned short   fKeyNeg;
+  unsigned short   fKeyPos;
+  /* Th stuff */
+  // Fab private : add mutable
+  mutable AliFemtoHiddenInfo* fHiddenInfo; //!
+  /***/
+
+
+};
+
+
+
+inline float AliFemtoV0::decayLengthV0() const { return fDecayLengthV0; }
+inline AliFemtoThreeVector AliFemtoV0::decayVertexV0() const { return fDecayVertexV0; } 
+inline AliFemtoThreeVector AliFemtoV0::primaryVertex() const { return fPrimaryVertex; }
+inline float AliFemtoV0::decayVertexV0X() const { return fDecayVertexV0.x(); } 
+inline float AliFemtoV0::decayVertexV0Y() const { return fDecayVertexV0.y(); } 
+inline float AliFemtoV0::decayVertexV0Z() const { return fDecayVertexV0.z(); } 
+inline float AliFemtoV0::dcaV0Daughters() const { return fDcaV0Daughters; }
+inline float AliFemtoV0::dcaV0ToPrimVertex() const { return fDcaV0ToPrimVertex; }
+inline float AliFemtoV0::dcaPosToPrimVertex() const { return fDcaPosToPrimVertex; }
+inline float AliFemtoV0::dcaNegToPrimVertex() const { return fDcaNegToPrimVertex; }
+inline AliFemtoThreeVector AliFemtoV0::momPos() const { return fMomPos; }
+inline float AliFemtoV0::momPosX() const { return fMomPos.x(); }
+inline float AliFemtoV0::momPosY() const { return fMomPos.y(); }
+inline float AliFemtoV0::momPosZ() const { return fMomPos.z(); }
+inline AliFemtoThreeVector AliFemtoV0::momNeg() const { return fMomNeg; }
+inline float AliFemtoV0::momNegX() const { return fMomNeg.x(); }
+inline float AliFemtoV0::momNegY() const { return fMomNeg.y(); }
+inline float AliFemtoV0::momNegZ() const { return fMomNeg.z(); }
+inline AliFemtoThreeVector AliFemtoV0::momV0() const { return fMomV0; }
+inline float AliFemtoV0::momV0X() const { return fMomV0.x(); }
+inline float AliFemtoV0::momV0Y() const { return fMomV0.y(); }
+inline float AliFemtoV0::momV0Z() const { return fMomV0.z(); }
+inline float AliFemtoV0::alphaV0() const { return fAlphaV0; }
+inline float AliFemtoV0::ptArmV0() const {return fPtArmV0;}
+inline float AliFemtoV0::eLambda() const {return fELambda;}
+inline float AliFemtoV0::eK0Short() const {return fEK0Short;}
+inline float AliFemtoV0::ePosProton() const {return fEPosProton;}
+inline float AliFemtoV0::ePosPion() const {return fEPosPion;}
+inline float AliFemtoV0::eNegProton() const {return fENegProton;}
+inline float AliFemtoV0::eNegPion() const {return fENegPion;}
+inline float AliFemtoV0::massLambda() const {return fMassLambda;}
+inline float AliFemtoV0::massAntiLambda() const {return fMassAntiLambda;}
+inline float AliFemtoV0::massK0Short() const {return fMassK0Short;}
+inline float AliFemtoV0::rapLambda() const {return fRapLambda;}
+inline float AliFemtoV0::rapK0Short() const {return fRapK0Short;}
+inline float AliFemtoV0::cTauLambda() const {return fCTauLambda;}
+inline float AliFemtoV0::cTauK0Short() const {return fCTauK0Short;}
+inline float AliFemtoV0::ptV0() const {return fPtV0;}
+inline float AliFemtoV0::ptotV0() const {return fPtotV0;}
+inline float AliFemtoV0::ptPos() const {return fPtPos;}
+inline float AliFemtoV0::ptotPos() const {return fPtotPos;}
+inline float AliFemtoV0::ptNeg() const {return fPtNeg;}
+inline float AliFemtoV0::ptotNeg() const {return fPtotNeg;}
+inline int   AliFemtoV0::tpcHitsPos() const { return fTpcHitsPos; }
+inline int   AliFemtoV0::tpcHitsNeg() const { return fTpcHitsNeg; }
+inline float AliFemtoV0::dedxNeg() const {return fDedxNeg;}
+inline float AliFemtoV0::numdedxNeg() const {return fNufDedxNeg;} //Gael 04Fev2002
+inline float AliFemtoV0::errdedxNeg() const {return fErrDedxNeg;} //Gael 04Fev2002
+inline float AliFemtoV0::lendedxNeg() const {return fLenDedxNeg;} //Gael 04Fev2002
+inline float AliFemtoV0::pseudoRapNeg() const {return fMomNeg.pseudoRapidity();} //Gael 04Fev2002
+inline float AliFemtoV0::dedxPos() const {return fDedxPos;}
+inline float AliFemtoV0::numdedxPos() const {return fNufDedxPos;} //Gael 04Fev2002
+inline float AliFemtoV0::errdedxPos() const {return fErrDedxPos;} //Gael 04Fev2002
+inline float AliFemtoV0::lendedxPos() const {return fLenDedxPos;} //Gael 04Fev2002
+inline float AliFemtoV0::pseudoRapPos() const {return fMomPos.pseudoRapidity();} //Gael 04Fev2002
+
+
+inline unsigned long   AliFemtoV0::trackTopologyMapPos(unsigned int word) const { return fTrackTopologyMapPos[word]; }
+inline unsigned long   AliFemtoV0::trackTopologyMapNeg(unsigned int word) const { return fTrackTopologyMapNeg[word]; }
+inline unsigned short   AliFemtoV0::idNeg() const { return fKeyNeg; } 
+inline unsigned short   AliFemtoV0::keyNeg() const { return fKeyNeg; }
+inline unsigned short   AliFemtoV0::idPos() const { return fKeyPos; } 
+inline unsigned short   AliFemtoV0::keyPos() const { return fKeyPos; }
+
+inline void AliFemtoV0::SetdecayLengthV0(const float x){ fDecayLengthV0= x;}   
+inline void AliFemtoV0::SetdecayVertexV0X(const float x){ fDecayVertexV0.setX(x);}
+inline void AliFemtoV0::SetdecayVertexV0Y(const float x){ fDecayVertexV0.setY(x);}
+inline void AliFemtoV0::SetdecayVertexV0Z(const float x){ fDecayVertexV0.setZ(x);}
+inline void AliFemtoV0::SetdecayVertexV0(const AliFemtoThreeVector v){ fDecayVertexV0 = v; }
+inline void AliFemtoV0::SetdcaV0Daughters(const float x){fDcaV0Daughters= x;} 
+inline void AliFemtoV0::SetdcaV0ToPrimVertex(const float x){fDcaV0ToPrimVertex= x;}   
+inline void AliFemtoV0::SetdcaPosToPrimVertex(const float x){fDcaPosToPrimVertex = x;} 
+inline void AliFemtoV0::SetdcaNegToPrimVertex(const float x){fDcaNegToPrimVertex = x;} 
+inline void AliFemtoV0::SetmomPos(const AliFemtoThreeVector v){fMomPos = v; }
+inline void AliFemtoV0::SetmomPosX(const float x){fMomPos.setX(x);}
+inline void AliFemtoV0::SetmomPosY(const float x){fMomPos.setY(x);}
+inline void AliFemtoV0::SetmomPosZ(const float x){fMomPos.setZ(x);}
+inline void AliFemtoV0::SetmomNeg(const AliFemtoThreeVector v){fMomNeg = v; }
+inline void AliFemtoV0::SetmomNegX(const float x){fMomNeg.setX(x);}
+inline void AliFemtoV0::SetmomNegY(const float x){fMomNeg.setY(x);}
+inline void AliFemtoV0::SetmomNegZ(const float x){fMomNeg.setZ(x);}
+inline void AliFemtoV0::SetTrackTopologyMapPos(unsigned int word, const unsigned long& m){fTrackTopologyMapPos[word]=m;} 
+inline void AliFemtoV0::SetTrackTopologyMapNeg(unsigned int word, const unsigned long& m){fTrackTopologyMapNeg[word]=m;} 
+inline void AliFemtoV0::SetmomV0(AliFemtoThreeVector v){fMomV0= v; }
+inline void AliFemtoV0::SetmomV0X(const float x){fMomV0.setX(x);}
+inline void AliFemtoV0::SetmomV0Y(const float x){fMomV0.setY(x);}
+inline void AliFemtoV0::SetmomV0Z(const float x){fMomV0.setZ(x);}
+
+inline void AliFemtoV0::SetalphaV0( float x){fAlphaV0= x;}
+inline void AliFemtoV0::SetptArmV0( float x){fPtArmV0 = x;}
+inline void AliFemtoV0::SeteLambda( float x){fELambda= x;}       
+inline void AliFemtoV0::SeteK0Short( float x){fEK0Short= x;}
+inline void AliFemtoV0::SetePosProton( float x){fEPosProton= x;}      
+inline void AliFemtoV0::SetePosPion( float x){fEPosPion= x;}      
+inline void AliFemtoV0::SeteNegProton( float x){fENegProton= x;} 
+inline void AliFemtoV0::SeteNegPion( float x){fENegPion= x;}       
+inline void AliFemtoV0::SetmassLambda( float x){fMassLambda = x;} 
+inline void AliFemtoV0::SetmassAntiLambda( float x){fMassAntiLambda= x;} 
+inline void AliFemtoV0::SetmassK0Short( float x){fMassK0Short= x;}  
+inline void AliFemtoV0::SetrapLambda( float x){fRapLambda= x;}
+inline void AliFemtoV0::SetrapK0Short( float x){fRapK0Short = x;}   
+inline void AliFemtoV0::SetcTauLambda( float x){fCTauLambda = x;}   
+inline void AliFemtoV0::SetcTauK0Short( float x){fCTauK0Short = x;}   
+inline void AliFemtoV0::SetptV0( float x){fPtV0 = x;}          
+inline void AliFemtoV0::SetptotV0( float x){fPtotV0 = x;}
+inline void AliFemtoV0::SetptPos( float x){fPtPos = x;}
+inline void AliFemtoV0::SetptotPos( float x){fPtotPos = x;}    
+inline void AliFemtoV0::SetptNeg( float x){ fPtNeg= x;}    
+inline void AliFemtoV0::SetptotNeg( float x){ fPtotNeg= x;}
+inline void AliFemtoV0::SetidNeg(const unsigned short& s){ fKeyNeg= s;}
+inline void AliFemtoV0::SetidPos(const unsigned short& s){ fKeyPos= s;}
+inline void AliFemtoV0::SetkeyNeg(const unsigned short& s){ fKeyNeg= s;}
+inline void AliFemtoV0::SetkeyPos(const unsigned short& s){ fKeyPos= s;}
+inline void AliFemtoV0::SettpcHitsPos(const int& i){fTpcHitsPos=i;} 
+inline void AliFemtoV0::SettpcHitsNeg(const int& i){fTpcHitsNeg=i;}
+inline void AliFemtoV0::SetdedxNeg(float x){fDedxNeg=x;}
+inline void AliFemtoV0::SeterrdedxNeg(float x){fErrDedxNeg=x;}//Gael 04Fev2002
+inline void AliFemtoV0::SetlendedxNeg(float x){fLenDedxNeg=x;}//Gael 04Fev2002
+inline void AliFemtoV0::SetdedxPos(float x){fDedxPos=x;}
+inline void AliFemtoV0::SeterrdedxPos(float x){fErrDedxPos=x;}//Gael 04Fev2002
+inline void AliFemtoV0::SetlendedxPos(float x){fLenDedxPos=x;}//Gael 04Fev2002
+inline void AliFemtoV0::SetprimaryVertex(const AliFemtoThreeVector v) { fPrimaryVertex = v; }//Gael 24 Sept 02
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0Collection.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0Collection.h
new file mode 100644 (file)
index 0000000..4a4d9a4
--- /dev/null
@@ -0,0 +1,33 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Tom Humanic, Ohio State, humanic@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   The Collection of v0s is the main component of the HbtEvent,
+ *   which is essentially the transient microDST
+ *
+ ***************************************************************************/
+
+
+#ifndef AliFemtoV0Collection_hh
+#define AliFemtoV0Collection_hh
+#include "Infrastructure/AliFemtoV0.h"
+#include <list>
+
+#if !defined(ST_NO_NAMESPACES)
+using std::list;
+#endif
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef list<AliFemtoV0*, allocator<AliFemtoV0*> >            AliFemtoV0Collection;
+typedef list<AliFemtoV0*, allocator<AliFemtoV0*> >::iterator  AliFemtoV0Iterator;
+#else
+typedef list<AliFemtoV0*>            AliFemtoV0Collection;
+typedef list<AliFemtoV0*>::iterator  AliFemtoV0Iterator;
+#endif
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoVector.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoVector.h
new file mode 100644 (file)
index 0000000..7045e2e
--- /dev/null
@@ -0,0 +1,36 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Frank Laue, BNL, laue@bnl.gov
+ ***************************************************************************
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.1  2001/06/21 19:15:48  laue
+ * Modified fiels:
+ *   CTH.h : new constructor added
+ *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
+ *                                   (TTree) classes added
+ *   AliFemtoLikeSignAnalysis : minor changes, for debugging
+ *   AliFemtoTypes: split into different files
+ * Added files: for the new TTree muDst's
+ *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
+ *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
+ *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
+ *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
+ *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
+ *
+ *
+ ***************************************************************************/
+#ifndef AliFemtoVector_hh
+#define AliFemtoVector_hh
+#include "AliFmThreeVectorD.h"
+typedef AliFmThreeVectorD AliFemtoThreeVector;//!
+#include "AliFmLorentzVectorD.h"
+typedef AliFmLorentzVectorD AliFemtoLorentzVector;//!
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.cxx
new file mode 100644 (file)
index 0000000..4dfe3f4
--- /dev/null
@@ -0,0 +1,72 @@
+#include "Infrastructure/AliFemtoXi.h"
+#include "phys_constants.h"
+
+// -----------------------------------------------------------------------
+void AliFemtoXi::UpdateXi(){
+  //Calc. derived members of the xi class
+  float MomV0AlongXi, MomBacAlongXi;
+
+   fMomXi  = momV0() + momBac(); 
+   fPtXi   = fMomXi.perp();
+   fPtotXi = fMomXi.mag();
+   fPtBac  = momBac().perp();
+   fPtotBac= momBac().mag();
+   fEXi= ::sqrt(fPtotXi*fPtotXi+M_XI_MINUS*M_XI_MINUS);
+   fEOmega= ::sqrt(fPtotXi*fPtotXi+M_OMEGA_MINUS*M_OMEGA_MINUS);
+   fEBacPion = ::sqrt(ptotBac()*ptotBac()+M_PION_MINUS*M_PION_MINUS);
+   fEBacKaon = ::sqrt(ptotBac()*ptotBac()+M_KAON_MINUS*M_KAON_MINUS);
+
+   MomV0AlongXi  =  momV0()*fMomXi / ::sqrt(::pow(fPtotXi,2));
+   MomBacAlongXi =  momBac()*fMomXi / ::sqrt(::pow(fPtotXi,2));
+
+   fAlphaXi = (MomBacAlongXi-MomV0AlongXi)/(MomBacAlongXi+MomV0AlongXi);
+   fPtArmXi =  ::sqrt(ptotBac()*ptotBac() - MomBacAlongXi*MomBacAlongXi);
+   fMassXi = ::sqrt(::pow(eBacPion()+eLambda(),2)-::pow(fPtotXi,2));
+   fMassOmega = ::sqrt(::pow(eBacKaon()+eLambda(),2)-::pow(fPtotXi,2));
+
+   fRapXi = 0.5*::log( (eXi()+fMomXi.z()) / (eXi()-fMomXi.z()) );
+   fCTauXi = M_XI_MINUS*(fDecayLengthXi) / ::sqrt( ::pow((double)fMomXi.mag(),2.) );
+   
+   fRapOmega = 0.5*::log( (eOmega()+fMomXi.z()) / (eOmega()-fMomXi.z()) );// eO,
+   fCTauOmega = M_OMEGA_MINUS*(fDecayLengthXi) / ::sqrt( ::pow((double)fMomXi.mag(),2.) );
+}
+// -----------------------------------------------------------------------
+#ifdef __ROOT__
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+#include "StStrangeMuDstMaker/StXiMuDst.h"
+AliFemtoXi::AliFemtoXi( StXiMuDst& xiFromMuDst)  : AliFemtoV0(xiFromMuDst) { // from strangess micro dst structure
+  UpdateV0(); // the v0 stuff
+
+
+  fCharge = xiFromMuDst.charge();
+  fDecayLengthXi = xiFromMuDst.decayLengthXi(); // 12/07/2001 Gael
+  fDecayVertexXi.setX(xiFromMuDst.decayVertexXiX());
+  fDecayVertexXi.setY(xiFromMuDst.decayVertexXiY());
+  fDecayVertexXi.setZ(xiFromMuDst.decayVertexXiZ());
+  fDcaXiDaughters = xiFromMuDst.dcaXiDaughters();
+  fDcaBachelorToPrimVertex = xiFromMuDst.dcaBachelorToPrimVertex();
+  fDcaXiToPrimVertex = xiFromMuDst.dcaXiToPrimVertex();
+  fMomBachelor.setX(xiFromMuDst.momBachelorX());
+  fMomBachelor.setY(xiFromMuDst.momBachelorY());
+  fMomBachelor.setZ(xiFromMuDst.momBachelorZ());
+  
+  fKeyBachelor = xiFromMuDst.keyBachelor();
+  fTopologyMapBachelor[0] = xiFromMuDst.topologyMapBachelor().data(1);
+  fTopologyMapBachelor[1] = xiFromMuDst.topologyMapBachelor().data(2);
+  fTpcHitsBac = xiFromMuDst.topologyMapBachelor().numberOfHits(kTpcId); // 12/07/2001 Gael
+
+  fChi2Xi = xiFromMuDst.chi2Xi();//nulle
+  fClXi = xiFromMuDst.clXi();//nulle
+  fChi2Bachelor = xiFromMuDst.chi2Bachelor();
+  fClBachelor = xiFromMuDst.clBachelor();
+  
+  fDedxBachelor = xiFromMuDst.dedxBachelor();
+  fNufDedxBachelor = xiFromMuDst.nufDedxBachelor();
+
+  UpdateXi(); // the xi stuff
+  
+}
+
+#endif // __NO_STAR_DEPENDENCE_ALLOWED__
+#endif // __ROOT__
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.h
new file mode 100644 (file)
index 0000000..ec1dd45
--- /dev/null
@@ -0,0 +1,273 @@
+/***********************************************************************
+ *
+ * $Id: AliFemtoXi.h,v 1.0 1999/09/07
+ *
+ * Authors: Frank Laue
+ *
+ ***********************************************************************
+ *
+ * Description: Xi class with members copied from StXihbtXi.h
+ *
+ ***********************************************************************/
+#ifndef AliFemtoXi_hh
+#define AliFemtoXi_hh
+
+#include "Infrastructure/AliFemtoVector.h" //same as in AliFemtoTrack.h
+#include "Infrastructure/AliFemtoV0.h"
+
+#ifdef __ROOT__
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+#include "StStrangeMuDstMaker/StXiMuDst.h"
+#endif
+#endif
+
+class AliFemtoXi : public AliFemtoV0 {
+public:
+  AliFemtoXi(){/* no-op */}
+#ifdef __ROOT__
+#ifndef __NO_STAR_DEPENDENCE_ALLOWED__
+  AliFemtoXi(StXiMuDst&); // from strangeness Xi micro dst structure
+#endif
+#endif
+  ~AliFemtoXi(){/* no-op */}
+
+  void UpdateXi();
+  float decayLengthXi() const;            // 3-d decay distance
+  AliFemtoThreeVector decayVertexXi() const; // Coordinates of decay vertex
+  float decayVertexXiX() const;           // Coordinates of decay vertex
+  float decayVertexXiY() const;           // Coordinates of decay vertex
+  float decayVertexXiZ() const;           // Coordinates of decay vertex
+  float dcaXiDaughters() const;           // DCA of xi daughters at decay vertex
+  float dcaXiToPrimVertex() const;        // DCA of xi to primary vertex
+  float dcaBacToPrimVertex() const;       // DCA of bachelor  xi daughter to pri vertex
+  AliFemtoThreeVector momBac() const;        // Momentum components of bac. daughter
+  float momBacX() const;                  // Momentum components of bac. daughter
+  float momBacY() const;                  // Momentum components of bac. daughter
+  float momBacZ() const;                  // Momentum components of bac. daughter
+
+  int   tpcHitsBac() const;               // Number of TPC hits on bac. daughter
+  unsigned long trackTopologyMapBac(unsigned int) const;
+
+  AliFemtoThreeVector momXi() const ;        // Momentum components of Xi
+  float momXiX() const ;                  // Momentum components of Xi
+  float momXiY() const ;                  // Momentum components of Xi
+  float momXiZ() const ;                  // Momentum components of Xi
+  float alphaXi() const ;                 // Armenteros-Podolanski variable
+  float ptArmXi() const ;                 // Armenteros-Podolanski variable
+  float eXi() const ;                     // Energy assuming xi hypothesis
+  float eOmega() const ;                  // Energy assuming omega hypothesis
+  float eBacKaon() const ;                // Energy of bac. daughter assuming kaon
+  float eBacPion() const ;                // Energy of bac. daughter assuming pion
+  float massXi() const ;                  // Mass assuming Xi hypothesis
+  float massOmega() const ;               // Mass assuming Omega hypothesis
+  float rapXi() const ;                   // Rapidity assuming (anti) xi
+  float rapOmega() const ;                // Rapidity assuming (anti) omega
+  float cTauXi() const ;                  // Lifetime (ctau) const assuming (anti) xi
+  float cTauOmega() const ;               // Lifetime (ctau) const assuming (anti) omega
+  float ptXi() const ;                    // Transverse momentum
+  float ptotXi() const ;                  // Total momentum
+  float ptBac() const ;                   // Transverse momentum of bac. daughter
+  float ptotBac() const ;                 // Total momentum of bac. daughter
+  float dedxBac() const;                  // dedx of Bac track
+  unsigned short   idBac() const;         // Id of bac. track
+  unsigned short   keyBac() const;        // Id of bac. track
+
+  void SetdecayLengthXi(const float);  
+  void SetdecayVertexXi(const AliFemtoThreeVector);  
+  void SetdecayVertexXiX(const float);
+  void SetdecayVertexXiY(const float);
+  void SetdecayVertexXiZ(const float);
+  void SetdcaXiDaughters(const float); 
+  void SetdcaXiToPrimVertex(const float);  
+  void SetdcaBacToPrimVertex(const float); 
+  void SetmomBac(const AliFemtoThreeVector);  
+  void SetmomBacX(const float);  
+  void SetmomBacY(const float);  
+  void SetmomBacZ(const float);  
+
+  void SettpcHitsBac(const int&);      
+
+  void SetTrackTopologyMapBac(unsigned int, const unsigned long&);
+
+  void SetmomXi( AliFemtoThreeVector);
+  void SetmomXiX( float);
+  void SetmomXiY( float);
+  void SetmomXiZ( float);
+  void SetalphaXi( float);       
+  void SetptArmXi( float);       
+  void SeteXi( float);     
+  void SeteOmega( float);    
+  void SeteBacPion( float);  
+  void SeteBacKaon( float);    
+  void SetmassXi( float);  
+  void SetmassOmega( float);
+  void SetrapXi( float);    
+  void SetrapOmega( float);   
+  void SetcTauXi( float);   
+  void SetcTauOmega( float);  
+  void SetptXi( float);         
+  void SetptotXi( float);       
+  void SetptBac( float);        
+  void SetptotBac( float);      
+  void SetidBac(const unsigned short&);
+  void SetdedxBac(float);
+  void SetkeyBac(const unsigned short&);
+
+
+protected:
+  int   fCharge;                
+  float fDecayLengthXi;
+  AliFemtoThreeVector fDecayVertexXi;
+  float fDcaXiDaughters; 
+  float fDcaXiToPrimVertex;
+  float fDcaBachelorToPrimVertex;
+  AliFemtoThreeVector fMomBachelor;
+
+  unsigned int   fTopologyMapBachelor[2];
+  unsigned short fKeyBachelor;
+
+  int   fTpcHitsBac;
+
+  float fChi2Xi;
+  float fClXi;
+  float fChi2Bachelor;
+  float fClBachelor;
+
+  float fDedxBachelor;
+  unsigned short fNufDedxBachelor;
+
+  // the following variables are not in the persistent version and can be calculated via UpdateXi();
+  AliFemtoThreeVector fMomXi;
+  float fAlphaXi;
+  float fPtArmXi;
+
+  float fEXi;
+  float fEOmega;
+  float fEBacPion;
+  float fEBacKaon;
+  float fMassXi;
+  float fMassOmega;
+  float fRapXi;
+  float fRapOmega;
+  float fCTauXi;
+  float fCTauOmega;
+  float fPtXi;
+  float fPtotXi;
+  float fPtBac;
+  float fPtotBac;
+
+  unsigned short   fKeyBac;
+};
+
+inline float AliFemtoXi::decayLengthXi() const { return fDecayLengthXi; }
+inline AliFemtoThreeVector AliFemtoXi::decayVertexXi() const { return fDecayVertexXi; } 
+inline float AliFemtoXi::decayVertexXiX() const { return fDecayVertexXi.x(); } 
+inline float AliFemtoXi::decayVertexXiY() const { return fDecayVertexXi.y(); } 
+inline float AliFemtoXi::decayVertexXiZ() const { return fDecayVertexXi.z(); } 
+inline float AliFemtoXi::dcaXiDaughters() const { return fDcaXiDaughters; }
+inline float AliFemtoXi::dcaXiToPrimVertex() const { return fDcaXiToPrimVertex; }
+inline float AliFemtoXi::dcaBacToPrimVertex() const { return fDcaBachelorToPrimVertex; }
+inline AliFemtoThreeVector AliFemtoXi::momBac() const { return fMomBachelor; }
+inline float AliFemtoXi::momBacX() const { return fMomBachelor.x(); }
+inline float AliFemtoXi::momBacY() const { return fMomBachelor.y(); }
+inline float AliFemtoXi::momBacZ() const { return fMomBachelor.z(); }
+inline AliFemtoThreeVector AliFemtoXi::momXi() const { return fMomXi; }
+inline float AliFemtoXi::momXiX() const { return fMomXi.x(); }
+inline float AliFemtoXi::momXiY() const { return fMomXi.y(); }
+inline float AliFemtoXi::momXiZ() const { return fMomXi.z(); }
+inline float AliFemtoXi::alphaXi() const { return fAlphaXi; }
+inline float AliFemtoXi::ptArmXi() const {return fPtArmXi;}
+inline float AliFemtoXi::eXi() const {return fEXi;}
+inline float AliFemtoXi::eOmega() const {return fEOmega;}
+inline float AliFemtoXi::eBacPion() const {return fEBacPion;}
+inline float AliFemtoXi::eBacKaon() const {return fEBacKaon;}
+inline float AliFemtoXi::massXi() const {return fMassXi;}
+inline float AliFemtoXi::massOmega() const {return fMassOmega;}
+inline float AliFemtoXi::rapXi() const {return fRapXi;}
+inline float AliFemtoXi::rapOmega() const {return fRapOmega;}
+inline float AliFemtoXi::cTauXi() const {return fCTauXi;}
+inline float AliFemtoXi::cTauOmega() const {return fCTauOmega;}
+inline float AliFemtoXi::ptXi() const {return fPtXi;}
+inline float AliFemtoXi::ptotXi() const {return fPtotXi;}
+inline float AliFemtoXi::ptBac() const {return fPtBac;}
+inline float AliFemtoXi::ptotBac() const {return fPtotBac;}
+inline int   AliFemtoXi::tpcHitsBac() const
+             { return fTpcHitsBac; }
+inline float AliFemtoXi::dedxBac() const {return fDedxBachelor;}
+
+inline unsigned long   AliFemtoXi::trackTopologyMapBac(unsigned int word) const { return fTopologyMapBachelor[word]; }
+inline unsigned short   AliFemtoXi::idBac() const { return fKeyBac; }; 
+inline unsigned short   AliFemtoXi::keyBac() const { return fKeyBac; }
+
+inline void AliFemtoXi::SetdecayLengthXi(const float x){ fDecayLengthXi= x;}   
+inline void AliFemtoXi::SetdecayVertexXiX(const float x){ fDecayVertexXi.setX(x);}
+inline void AliFemtoXi::SetdecayVertexXiY(const float x){ fDecayVertexXi.setY(x);}
+inline void AliFemtoXi::SetdecayVertexXiZ(const float x){ fDecayVertexXi.setZ(x);}
+inline void AliFemtoXi::SetdecayVertexXi(const AliFemtoThreeVector v){ fDecayVertexXi = v; }
+inline void AliFemtoXi::SetdcaXiDaughters(const float x){fDcaXiDaughters= x;} 
+inline void AliFemtoXi::SetdcaXiToPrimVertex(const float x){fDcaXiToPrimVertex= x;}   
+inline void AliFemtoXi::SetdcaBacToPrimVertex(const float x){ fDcaBachelorToPrimVertex = x;} 
+inline void AliFemtoXi::SetmomBac(const AliFemtoThreeVector v){fMomBachelor = v; }
+inline void AliFemtoXi::SetmomBacX(const float x){fMomBachelor.setX(x);}
+inline void AliFemtoXi::SetmomBacY(const float x){fMomBachelor.setY(x);}
+inline void AliFemtoXi::SetmomBacZ(const float x){fMomBachelor.setZ(x);}
+inline void AliFemtoXi::SetTrackTopologyMapBac(unsigned int word, const unsigned long& m){fTopologyMapBachelor[word]=m;} 
+inline void AliFemtoXi::SetmomXi(AliFemtoThreeVector v){fMomXi= v; }
+inline void AliFemtoXi::SetmomXiX(const float x){fMomXi.setX(x);}
+inline void AliFemtoXi::SetmomXiY(const float x){fMomXi.setY(x);}
+inline void AliFemtoXi::SetmomXiZ(const float x){fMomXi.setZ(x);}
+
+inline void AliFemtoXi::SetalphaXi( float x){fAlphaXi= x;}
+inline void AliFemtoXi::SetptArmXi( float x){fPtArmXi = x;}
+inline void AliFemtoXi::SeteXi( float x){fEXi= x;}       
+inline void AliFemtoXi::SeteOmega( float x){fEOmega= x;}
+inline void AliFemtoXi::SeteBacPion( float x){fEBacPion= x;}
+inline void AliFemtoXi::SeteBacKaon( float x){fEBacKaon= x;}
+inline void AliFemtoXi::SetmassXi( float x){fMassXi = x;} 
+inline void AliFemtoXi::SetmassOmega( float x){fMassOmega= x;}  
+inline void AliFemtoXi::SetrapXi( float x){fRapXi= x;}
+inline void AliFemtoXi::SetrapOmega( float x){fRapOmega = x;}   
+inline void AliFemtoXi::SetcTauXi( float x){fCTauXi = x;}   
+inline void AliFemtoXi::SetcTauOmega( float x){fCTauOmega = x;}   
+inline void AliFemtoXi::SetptXi( float x){fPtXi = x;}          
+inline void AliFemtoXi::SetptotXi( float x){fPtotXi = x;}
+inline void AliFemtoXi::SetptBac( float x){fPtBac = x;}
+inline void AliFemtoXi::SetptotBac( float x){fPtotBac = x;}    
+inline void AliFemtoXi::SetidBac(const unsigned short& s){ fKeyBac= s;}
+inline void AliFemtoXi::SetkeyBac(const unsigned short& s){ fKeyBac= s;}
+inline void AliFemtoXi::SettpcHitsBac(const int& i){fTpcHitsBac=i;} 
+inline void AliFemtoXi::SetdedxBac(float x){fDedxBachelor=x;}
+
+#endif
+
+
+/***********************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.3  2003/09/02 17:58:33  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.2  2001/12/05 15:10:33  laue
+ * Boris' updates (mainly access functions)
+ *
+ *
+ ***********************************************************************/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXiCollection.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXiCollection.h
new file mode 100644 (file)
index 0000000..c9337ff
--- /dev/null
@@ -0,0 +1,33 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Frank Laue, BNL
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   The Collection of v0s is the main component of the HbtEvent,
+ *   which is essentially the transient microDST
+ *
+ ***************************************************************************/
+
+
+#ifndef AliFemtoXiCollection_hh
+#define AliFemtoXiCollection_hh
+#include "Infrastructure/AliFemtoXi.h"
+#include <list>
+
+#if !defined(ST_NO_NAMESPACES)
+using std::list;
+#endif
+
+#ifdef ST_NO_TEMPLATE_DEF_ARGS
+typedef list<AliFemtoXi*, allocator<AliFemtoXi*> >            AliFemtoXiCollection;
+typedef list<AliFemtoXi*, allocator<AliFemtoXi*> >::iterator  AliFemtoXiIterator;
+#else
+typedef list<AliFemtoXi*>            AliFemtoXiCollection;
+typedef list<AliFemtoXi*>::iterator  AliFemtoXiIterator;
+#endif
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.cxx
new file mode 100644 (file)
index 0000000..6c4bba4
--- /dev/null
@@ -0,0 +1,707 @@
+/***************************************************************************
+*
+* $Id$
+*
+* Author: Thomas Ullrich, Sep 1997
+***************************************************************************
+*
+* Description: Parametrization of a helix
+* 
+***************************************************************************
+*
+* $Log$
+* Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+* First version on CVS
+*
+* Revision 1.26  2005/10/13 23:15:13  genevb
+* Save a few calculations
+*
+* Revision 1.25  2005/10/13 22:25:35  genevb
+* pathLength to plane now finds nearest approach to intersection regardless of # of loops
+*
+* Revision 1.24  2005/07/06 18:49:56  fisyak
+* Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
+*
+* Revision 1.23  2004/12/02 02:51:16  ullrich
+* Added option to pathLenghth() and distance() to search for
+* DCA only within one period. Default stays as it was.
+*
+* Revision 1.22  2004/05/03 23:35:31  perev
+* Possible non init WarnOff
+*
+* Revision 1.21  2004/01/27 02:49:48  perev
+* Big value appropriate for float
+*
+* Revision 1.20  2003/12/22 18:59:36  perev
+* remove test for only +ve pathLeng added before
+*
+* Revision 1.19  2003/12/18 17:27:02  perev
+* Small bug fix in number of iters. i++ ==> i--
+*
+* Revision 1.18  2003/10/30 20:06:46  perev
+* Check of quality added
+*
+* Revision 1.17  2003/10/19 20:17:00  perev
+* Protection agains overfloat added into pathLength(AliFmThreeVector,AliFmThreeVector)
+*
+* Revision 1.16  2003/10/06 23:39:21  perev
+* sqrt(-ve) == no solution. infinity returns
+*
+* Revision 1.15  2003/09/02 17:59:34  perev
+* gcc 3.2 updates + WarnOff
+*
+* Revision 1.14  2003/06/26 17:15:56  ullrich
+* Changed local variable name in pathLenght.
+*
+* Revision 1.13  2002/06/21 17:49:25  genevb
+* Some minor speed improvements
+*
+* Revision 1.12  2002/04/24 02:40:25  ullrich
+* Restored old format and lost CVS statements.
+*
+* Revision 1.11  2002/02/12 19:37:51  jeromel
+* fix for Linux 7.2 (float.h). Took oportunity to doxygenize.
+*
+* Revision 1.10  2000/07/17 21:44:19  ullrich
+* Fixed problem in pathLength(cyl_rad).
+*
+* Revision 1.9  2000/05/22 21:38:28  ullrich
+* Add parenthesis to make Linux compiler happy.
+*
+* Revision 1.8  2000/05/22 21:11:21  ullrich
+* In pathLength(AliFmThreeVector&): Increased number of max iteration
+* in Newton method from 10 to 100. Improved initial guess in case
+* it is off by n period.
+*
+* Revision 1.7  2000/03/06 20:24:25  ullrich
+* Parameter h for case B=0 correctly handled now.
+*
+* Revision 1.6  1999/12/22 15:14:39  ullrich
+* Added analytical solution for dca between two helices
+* in the case for B=0.
+*
+* Revision 1.5  1999/12/21 15:14:08  ullrich
+* Modified to cope with new compiler version on Sun (CC5.0).
+*
+* Revision 1.4  1999/11/29 21:45:38  fisyak
+* fix abs for HP
+*
+* Revision 1.3  1999/03/07 14:55:41  wenaus
+* fix scope problem
+*
+* Revision 1.2  1999/03/02 19:47:35  ullrich
+* Added method to find dca between two helices
+*
+* Revision 1.1  1999/01/30 03:59:02  fisyak
+* Root Version of AliFmarClassLibrary
+*
+* Revision 1.1  1999/01/23 00:29:15  ullrich
+* Initial Revision
+*
+**************************************************************************/
+#if !defined(ST_NO_NUMERIC_LIMITS)
+#    include <limits>
+#    if !defined(ST_NO_NAMESPACES)
+using std::numeric_limits;
+#    endif
+#endif
+#define FOR_HELIX
+#include <float.h>
+#include <assert.h>
+
+#include "AliFmHelix.h"
+#include "PhysicalConstants.h" 
+#include "SystemOfUnits.h"
+#ifdef __ROOT__
+ClassImpT(AliFmHelix,double);
+#endif
+
+#ifdef WIN32
+#include "gcc2vs.h"
+#endif
+
+#include <iostream>
+#include <fstream>
+using namespace std;
+
+const double AliFmHelix::NoSolution = 3.e+33;
+
+AliFmHelix::AliFmHelix(){ /*noop*/ }
+
+AliFmHelix::AliFmHelix(double c, double d, double phase,
+                                const AliFmThreeVector<double>& o, int h)
+{
+       setParameters(c, d, phase, o, h);
+}
+
+AliFmHelix::~AliFmHelix() { /* noop */ };
+
+void AliFmHelix::setParameters(double c, double dip, double phase,
+                                                       const AliFmThreeVector<double>& o, int h)
+{
+       //
+       //  The order in which the parameters are set is important
+       //  since setCurvature might have to adjust the others.
+       //
+       mH = (h>=0) ? 1 : -1;    // Default is: positive particle
+       //             positive field
+       mOrigin   = o;
+       setDipAngle(dip);
+       setPhase(phase);
+
+       //
+       // Check for singularity and correct for negative curvature.           
+       // May change mH and mPhase. Must therefore be set last.
+       //
+       setCurvature(c);
+
+       //
+       // For the case B=0, h is ill defined. In the following we
+       // always assume h = +1. Since phase = psi - h * pi/2
+       // we have to correct the phase in case h = -1.
+       // This assumes that the user uses the same h for phase
+       // as the one he passed to the constructor.
+       //
+       if (mSingularity && mH == -1) {
+               mH = +1;
+               setPhase(mPhase-M_PI);
+       }
+}
+
+void AliFmHelix::setCurvature(double val)
+{
+       if (val < 0) {
+               mCurvature = -val;
+               mH = -mH;
+               setPhase(mPhase+M_PI);
+       }
+       else
+               mCurvature = val;
+
+#ifndef ST_NO_NUMERIC_LIMITS
+       if (fabs(mCurvature) <= numeric_limits<double>::epsilon())
+#else
+       if (fabs(mCurvature) <= static_cast<double>(0))
+#endif    
+               mSingularity = true;                    // straight line
+       else
+               mSingularity = false;                   // curved
+}
+
+void AliFmHelix::setPhase(double val)
+{
+       mPhase       = val;
+       mCosPhase    = cos(mPhase);
+       mSinPhase    = sin(mPhase);
+       if (fabs(mPhase) > M_PI)
+               mPhase = atan2(mSinPhase, mCosPhase);  // force range [-pi,pi]
+}
+
+void AliFmHelix::setDipAngle(double val)
+{
+       mDipAngle    = val;
+       mCosDipAngle = cos(mDipAngle);
+       mSinDipAngle = sin(mDipAngle);
+}
+
+double AliFmHelix::xcenter() const
+{
+       if (mSingularity)
+               return 0;
+       else
+               return mOrigin.x()-mCosPhase/mCurvature;
+}
+
+double AliFmHelix::ycenter() const
+{
+       if (mSingularity)
+               return 0;
+       else
+               return mOrigin.y()-mSinPhase/mCurvature;
+}
+
+double AliFmHelix::fudgePathLength(const AliFmThreeVector<double>& p) const
+{
+       double s;
+       double dx = p.x()-mOrigin.x();
+       double dy = p.y()-mOrigin.y();
+
+       if (mSingularity) {
+               s = (dy*mCosPhase - dx*mSinPhase)/mCosDipAngle;
+       }
+       else {
+               s = atan2(dy*mCosPhase - dx*mSinPhase,
+                       1/mCurvature + dx*mCosPhase+dy*mSinPhase)/
+                       (mH*mCurvature*mCosDipAngle);
+       }
+       return s;
+}
+
+double AliFmHelix::distance(const AliFmThreeVector<double>& p, bool scanPeriods) const
+{
+       return abs(this->at(pathLength(p,scanPeriods))-p);
+}
+
+double AliFmHelix::pathLength(const AliFmThreeVector<double>& p, bool scanPeriods) const 
+{
+       //
+       //  Returns the path length at the distance of closest 
+       //  approach between the helix and point p. 
+       //  For the case of B=0 (straight line) the path length
+       //  can be calculated analytically. For B>0 there is
+       //  unfortunately no easy solution to the problem.
+       //  Here we use the Newton method to find the root of the
+       //  referring equation. The 'fudgePathLength' serves
+       //  as a starting value.
+       //
+       double s;
+       double dx = p.x()-mOrigin.x();
+       double dy = p.y()-mOrigin.y();
+       double dz = p.z()-mOrigin.z();
+
+       if (mSingularity) {
+               s = mCosDipAngle*(mCosPhase*dy-mSinPhase*dx) +
+                       mSinDipAngle*dz;
+       }
+       else { //
+#ifndef ST_NO_NAMESPACES
+               {
+                       using namespace units;
+#endif
+                       const double MaxPrecisionNeeded = micrometer;
+                       const int    MaxIterations      = 100;
+
+                       //
+                       // The math is taken from Maple with C(expr,optimized) and
+                       // some hand-editing. It is not very nice but efficient.
+                       //
+                       double t34 = mCurvature*mCosDipAngle*mCosDipAngle;
+                       double t41 = mSinDipAngle*mSinDipAngle;
+                       double t6, t7, t11, t12, t19;
+
+                       //
+                       // Get a first guess by using the dca in 2D. Since
+                       // in some extreme cases we might be off by n periods
+                       // we add (subtract) periods in case we get any closer.
+                       // 
+                       s = fudgePathLength(p);
+
+                       if (scanPeriods) {
+                               double ds = period();
+                               int    j, jmin = 0;
+                               double d, dmin = abs(at(s) - p);
+                               for(j=1; j<MaxIterations; j++) {
+                                       if ((d = abs(at(s+j*ds) - p)) < dmin) {
+                                               dmin = d;
+                                               jmin = j;
+                                       }
+                                       else
+                                               break;
+                               }
+                               for(j=-1; -j<MaxIterations; j--) {
+                                       if ((d = abs(at(s+j*ds) - p)) < dmin) {
+                                               dmin = d;
+                                               jmin = j;
+                                       }
+                                       else
+                                               break;
+                               }
+                               if (jmin) s += jmin*ds;
+                       }
+
+                       //
+                       // Newtons method:
+                       // Stops after MaxIterations iterations or if the required
+                       // precision is obtained. Whatever comes first.
+                       //
+                       double sOld = s;
+                       for (int i=0; i<MaxIterations; i++) {
+                               t6  = mPhase+s*mH*mCurvature*mCosDipAngle;
+                               t7  = cos(t6);
+                               t11 = dx-(1/mCurvature)*(t7-mCosPhase);
+                               t12 = sin(t6);
+                               t19 = dy-(1/mCurvature)*(t12-mSinPhase);
+                               s  -= (t11*t12*mH*mCosDipAngle-t19*t7*mH*mCosDipAngle -
+                                       (dz-s*mSinDipAngle)*mSinDipAngle)/
+                                       (t12*t12*mCosDipAngle*mCosDipAngle+t11*t7*t34 +
+                                       t7*t7*mCosDipAngle*mCosDipAngle +
+                                       t19*t12*t34+t41);
+                               if (fabs(sOld-s) < MaxPrecisionNeeded) break;
+                               sOld = s;
+                       }
+#ifndef ST_NO_NAMESPACES
+               }
+#endif
+       }
+       return s;
+}
+
+double AliFmHelix::period() const
+{
+       if (mSingularity)
+#ifndef ST_NO_NUMERIC_LIMITS
+               return numeric_limits<double>::max();
+#else
+               return DBL_MAX;
+#endif    
+       else    
+               return fabs(2*M_PI/(mH*mCurvature*mCosDipAngle)); 
+}
+
+pair<double, double> AliFmHelix::pathLength(double r) const
+{
+       pair<double,double> value;
+       pair<double,double> VALUE(999999999.,999999999.);
+       //
+       // The math is taken from Maple with C(expr,optimized) and
+       // some hand-editing. It is not very nice but efficient.
+       // 'first' is the smallest of the two solutions (may be negative)
+       // 'second' is the other.
+       //
+       if (mSingularity) {
+               double t1 = mCosDipAngle*(mOrigin.x()*mSinPhase-mOrigin.y()*mCosPhase);
+               double t12 = mOrigin.y()*mOrigin.y();
+               double t13 = mCosPhase*mCosPhase;
+               double t15 = r*r;
+               double t16 = mOrigin.x()*mOrigin.x();
+               double t20 = -mCosDipAngle*mCosDipAngle*(2.0*mOrigin.x()*mSinPhase*mOrigin.y()*mCosPhase +
+                       t12-t12*t13-t15+t13*t16);
+               if (t20<0.) return VALUE;
+               t20 = ::sqrt(t20);
+               value.first  = (t1-t20)/(mCosDipAngle*mCosDipAngle);
+               value.second = (t1+t20)/(mCosDipAngle*mCosDipAngle);
+       }
+       else {
+               double t1 = mOrigin.y()*mCurvature;
+               double t2 = mSinPhase;
+               double t3 = mCurvature*mCurvature;
+               double t4 = mOrigin.y()*t2;
+               double t5 = mCosPhase;
+               double t6 = mOrigin.x()*t5;
+               double t8 = mOrigin.x()*mOrigin.x();
+               double t11 = mOrigin.y()*mOrigin.y();
+               double t14 = r*r;
+               double t15 = t14*mCurvature;
+               double t17 = t8*t8;
+               double t19 = t11*t11;
+               double t21 = t11*t3;
+               double t23 = t5*t5;
+               double t32 = t14*t14;
+               double t35 = t14*t3;
+               double t38 = 8.0*t4*t6 - 4.0*t1*t2*t8 - 4.0*t11*mCurvature*t6 +
+                       4.0*t15*t6 + t17*t3 + t19*t3 + 2.0*t21*t8 + 4.0*t8*t23 -
+                       4.0*t8*mOrigin.x()*mCurvature*t5 - 4.0*t11*t23 -
+                       4.0*t11*mOrigin.y()*mCurvature*t2 + 4.0*t11 - 4.0*t14 +
+                       t32*t3 + 4.0*t15*t4 - 2.0*t35*t11 - 2.0*t35*t8;
+               double t40 = (-t3*t38);
+               if (t40<0.) return VALUE;
+               t40 = ::sqrt(t40);
+
+               double t43 = mOrigin.x()*mCurvature;
+               double t45 = 2.0*t5 - t35 + t21 + 2.0 - 2.0*t1*t2 -2.0*t43 - 2.0*t43*t5 + t8*t3;
+               double t46 = mH*mCosDipAngle*mCurvature;
+
+               value.first = (-mPhase + 2.0*atan((-2.0*t1 + 2.0*t2 + t40)/t45))/t46;
+               value.second = -(mPhase + 2.0*atan((2.0*t1 - 2.0*t2 + t40)/t45))/t46;
+
+               //
+               //   Solution can be off by +/- one period, select smallest
+               //
+               double p = period();
+               //      malisa deletes "isnan" check 22apr2006  if (!isnan(value.first)) {
+               if (fabs(value.first-p) < fabs(value.first)) value.first = value.first-p;
+               else if (fabs(value.first+p) < fabs(value.first)) value.first = value.first+p;
+               //      malisa  }
+               //      malisa deletes "isnan" check 22apr2006          if (!isnan(value.second)) {
+               if (fabs(value.second-p) < fabs(value.second)) value.second = value.second-p;
+               else if (fabs(value.second+p) < fabs(value.second)) value.second = value.second+p;
+               //      malisa }
+       }
+       if (value.first > value.second)
+               swap(value.first,value.second);
+       return(value);
+}
+
+pair<double, double> AliFmHelix::pathLength(double r, double x, double y, bool scanPeriods)
+{
+       double x0 = mOrigin.x();
+       double y0 = mOrigin.y();
+       mOrigin.setX(x0-x);
+       mOrigin.setY(y0-y);
+       pair<double, double> result = this->pathLength(r);
+       mOrigin.setX(x0);
+       mOrigin.setY(y0);
+       return result;  
+}
+
+double AliFmHelix::pathLength(const AliFmThreeVector<double>& r,
+                                                  const AliFmThreeVector<double>& n) const
+{
+       //
+       // Vector 'r' defines the position of the center and
+       // vector 'n' the normal vector of the plane.
+       // For a straight line there is a simple analytical
+       // solution. For curvatures > 0 the root is determined
+       // by Newton method. In case no valid s can be found
+       // the max. largest value for s is returned.
+       //
+       double s;
+
+       if (mSingularity) {
+               double t = n.z()*mSinDipAngle +
+                       n.y()*mCosDipAngle*mCosPhase -
+                       n.x()*mCosDipAngle*mSinPhase;
+               if (t == 0)
+                       s = NoSolution;
+               else
+                       s = ((r - mOrigin)*n)/t;
+       }
+       else {
+               const double MaxPrecisionNeeded = micrometer;
+               const int    MaxIterations      = 20;
+
+               double A = mCurvature*((mOrigin - r)*n) -
+                       n.x()*mCosPhase - 
+                       n.y()*mSinPhase;
+               double t = mH*mCurvature*mCosDipAngle;
+               double u = n.z()*mCurvature*mSinDipAngle;
+
+               double a, f, fp;
+               double sOld = s = 0;  
+               double shiftOld = 0;
+               double shift;
+               //              (cos(angMax)-1)/angMax = 0.1
+               const double angMax = 0.21;
+               double deltas = fabs(angMax/(mCurvature*mCosDipAngle));
+               //              dampingFactor = exp(-0.5);
+               double dampingFactor = 0.60653;
+               int i;
+
+               for (i=0; i<MaxIterations; i++) {
+                       a  = t*s+mPhase;
+                       double sina = sin(a);
+                       double cosa = cos(a);
+                       f  = A +
+                               n.x()*cosa +
+                               n.y()*sina +
+                               u*s;
+                       fp = -n.x()*sina*t +
+                               n.y()*cosa*t +
+                               u;
+                       if ( fabs(fp)*deltas <= fabs(f) ) { //too big step
+                               int sgn = 1;
+                               if (fp<0.) sgn = -sgn;
+                               if (f <0.) sgn = -sgn;
+                               shift = sgn*deltas;
+                               if (shift == -shiftOld) { // don't get stuck shifting +/-deltas
+                                       deltas *= dampingFactor; // dampen magnitude of shift
+                                       shift = sgn*deltas;
+                                       // allow iterations to run out
+                               } else {
+                                       i--; // don't count against iterations
+                               }
+                       } else {
+                               shift = f/fp;
+                       }
+                       s -= shift;
+                       shiftOld = shift;
+                       if (fabs(sOld-s) < MaxPrecisionNeeded) break;
+                       sOld = s;
+               }
+               if (i == MaxIterations) return NoSolution;
+       }
+       return s;
+}
+
+pair<double, double>
+AliFmHelix::pathLengths(const AliFmHelix& h, bool scanPeriods) const
+{
+
+       //
+       //      Cannot handle case where one is a helix
+       //  and the other one is a straight line.
+       //
+       if (mSingularity != h.mSingularity) 
+               return pair<double, double>(NoSolution, NoSolution);
+
+       double s1, s2;
+
+       if (mSingularity) {
+               //
+               //  Analytic solution
+               //
+               AliFmThreeVector<double> dv = h.mOrigin - mOrigin;
+               AliFmThreeVector<double> a(-mCosDipAngle*mSinPhase,
+                       mCosDipAngle*mCosPhase,
+                       mSinDipAngle);
+               AliFmThreeVector<double> b(-h.mCosDipAngle*h.mSinPhase,
+                       h.mCosDipAngle*h.mCosPhase,
+                       h.mSinDipAngle);        
+               double ab = a*b;
+               double g  = dv*a;
+               double k  = dv*b;
+               s2 = (k-ab*g)/(ab*ab-1.);
+               s1 = g+s2*ab;
+               return pair<double, double>(s1, s2);
+       }
+       else {  
+               //
+               //  First step: get dca in the xy-plane as start value
+               //
+               double dx = h.xcenter() - xcenter();
+               double dy = h.ycenter() - ycenter();
+               double dd = ::sqrt(dx*dx + dy*dy);
+               double r1 = 1/curvature();
+               double r2 = 1/h.curvature();
+
+               /* malisa 22apr2006 is commenting out the "isnan" check
+                *              if ( !finite(r1) || isnan(r1) || !finite(r2) || isnan(r2) ) {
+                *               cerr << __FUNCTION__ << " *** error *** ";
+                *                      cerr << "  r1=" << r1;
+                *                      cerr << "  r2=" << r2 << endl;
+                *                      return pair<double, double>(NoSolution, NoSolution);
+                *              }
+                */
+
+               double cosAlpha = (r1*r1 + dd*dd - r2*r2)/(2*r1*dd);
+
+               double s;
+               double x, y;
+               if (fabs(cosAlpha) < 1) {           // two solutions
+                       double sinAlpha = sin(acos(cosAlpha));
+                       x = xcenter() + r1*(cosAlpha*dx - sinAlpha*dy)/dd;
+                       y = ycenter() + r1*(sinAlpha*dx + cosAlpha*dy)/dd;
+                       s = pathLength(x, y);
+                       x = xcenter() + r1*(cosAlpha*dx + sinAlpha*dy)/dd;
+                       y = ycenter() + r1*(cosAlpha*dy - sinAlpha*dx)/dd;
+                       double a = pathLength(x, y);
+                       if (h.distance(at(a),scanPeriods) < h.distance(at(s),scanPeriods)) s = a;
+               }
+               else {                              // no intersection (or exactly one)
+                       x = xcenter() + r1*dx/dd;
+                       y = ycenter() + r1*dy/dd;
+                       s = pathLength(x, y);
+               }
+
+               //
+               //   Second step: scan in decreasing intervals around seed 's'
+               // 
+               const double MinStepSize = 10*micrometer;
+               const double MinRange    = 10*centimeter;    
+               double dmin              = h.distance(at(s),scanPeriods);
+               double range             = max(2*dmin, MinRange);
+
+               /* malisa comments out the "isnan" check 22apr2006
+                *              if ( !finite(range) || isnan(range)) {
+                *                      cerr << __FUNCTION__ << " *** error *** ";
+                *                      cerr << "  range=" << range << endl;
+                *                      return pair<double, double>(NoSolution, NoSolution);
+                *              }
+                */
+
+               double ds = range/10.;
+               double slast=-999999, d;
+               s1 = s - range/2.;
+               s2 = s + range/2.;
+
+               double tmp1;
+               double tmp2;
+
+               while (ds > MinStepSize) {
+                       if ( !(s1<s2) ) {
+                               cerr << __FUNCTION__ << " *** error *** s1 = ";
+                               cerr << "    s2 = " << s2;
+                               cerr << "    range = " << range;
+                               cerr << "     ds = " << ds << endl;
+                               return pair<double, double>(NoSolution, NoSolution);
+                       }       
+                       tmp1 = (s2-s1);
+                       tmp2 = tmp1/10.0;
+                       ds = tmp2;
+                       if ( ds<0) {
+                           cerr << __FUNCTION__ << " *** error *** ds = " << ds << endl;
+                           return pair<double, double>(NoSolution, NoSolution);
+                       }
+                       int iterations = 0;
+                       for (double ss=s1; ss<(s2+ds); ss+=ds) {
+                           iterations++;
+                           if ( iterations > 100 ) {
+                               cerr << __FUNCTION__ << " *** error *** iterations = " << iterations << endl;
+                               return pair<double, double>(NoSolution, NoSolution);
+                           }
+                           d = h.distance(at(ss),scanPeriods);
+                           if (d < dmin) {
+                               dmin = d;
+                               s = ss;
+                           }
+                           slast = ss;
+                       }
+                       //
+                       //  In the rare cases where the minimum is at the
+                       //  the border of the current range we shift the range
+                       //  and start all over, i.e we do not decrease 'ds'.
+                       //  Else we decrease the search intervall around the
+                       //  current minimum and redo the scan in smaller steps.
+                       //
+                       if (s == s1) {
+                               d = 0.8*(s2-s1);
+                               s1 -= d;
+                               s2 -= d;
+                       }
+                       else if (s == slast) {
+                               d = 0.8*(s2-s1);
+                               s1 += d;
+                               s2 += d;
+                       }
+                       else {           
+                               s1 = s-ds;
+                               s2 = s+ds;
+                       //      ds /= 10;
+                       }
+               }
+               return pair<double, double>(s, h.pathLength(at(s),scanPeriods));
+       }
+}
+
+
+void AliFmHelix::moveOrigin(double s)
+{
+       if (mSingularity)
+               mOrigin = at(s);
+       else {
+               AliFmThreeVector<double> newOrigin = at(s);
+               double newPhase = atan2(newOrigin.y() - ycenter(),
+                       newOrigin.x() - xcenter());
+               mOrigin = newOrigin;
+               setPhase(newPhase);             
+       }
+}
+
+int operator== (const AliFmHelix& a, const AliFmHelix& b)
+{
+       //
+       // Checks for numerical identity only !
+       //
+       return (a.origin()    == b.origin()    &&
+               a.dipAngle()  == b.dipAngle()  &&
+               a.curvature() == b.curvature() &&
+               a.phase()     == b.phase()     &&
+               a.h()         == b.h());
+}
+
+int operator!= (const AliFmHelix& a, const AliFmHelix& b) {return !(a == b);}
+
+ostream& operator<<(ostream& os, const AliFmHelix& h)
+{
+       return os << '('
+               << "curvature = "  << h.curvature() << ", " 
+               << "dip angle = "  << h.dipAngle()  << ", "
+               << "phase = "      << h.phase()     << ", "  
+               << "h = "          << h.h()         << ", "    
+               << "origin = "     << h.origin()    << ')';
+}
+
+
+
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.h
new file mode 100644 (file)
index 0000000..50af0ad
--- /dev/null
@@ -0,0 +1,222 @@
+/**
+ * \class AliFmHelix
+ * \author Thomas Ullrich, Sep 26 1997
+ * 
+ * Parametrization of a helix. Can also cope with straight tracks, i.e.
+ * with zero curvature. This represents only the mathematical model of 
+ * a helix. See the SCL user guide for more. 
+ */
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Thomas Ullrich, Sep 1997
+ ***************************************************************************
+ *
+ * Description: Parametrization of a helix
+ * 
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.11  2005/10/13 22:23:27  genevb
+ * NoSolution is public
+ *
+ * Revision 1.10  2005/07/06 18:49:56  fisyak
+ * Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
+ *
+ * Revision 1.9  2004/12/02 02:51:16  ullrich
+ * Added option to pathLenghth() and distance() to search for
+ * DCA only within one period. Default stays as it was.
+ *
+ * Revision 1.8  2003/10/30 20:06:46  perev
+ * Check of quality added
+ *
+ * Revision 1.7  2002/06/21 17:49:25  genevb
+ * Some minor speed improvements
+ *
+ * Revision 1.6  2002/04/24 02:41:55  ullrich
+ * Restored old format.
+ *
+ **************************************************************************/
+
+#ifndef ST_HELIX_HH
+#define ST_HELIX_HH
+
+#include <math.h>
+#include <utility>
+#include <algorithm>
+#include "AliFmThreeVector.h"
+#if !defined(ST_NO_NAMESPACES)
+using std::pair;
+using std::swap;
+using std::max;
+#endif
+
+#ifdef WIN32
+#include "gcc2vs.h"
+#endif
+
+class AliFmHelix {
+public:
+    /// curvature, dip angle, phase, origin, h
+    AliFmHelix(double c, double dip, double phase,
+           const AliFmThreeVector<double>& o, int h=-1);
+    
+    virtual ~AliFmHelix();
+    // AliFmHelix(const AliFmHelix&);                  // use default
+    // AliFmHelix& operator=(const AliFmHelix&);       // use default
+
+    double       dipAngle()   const;           
+    double       curvature()  const;   /// 1/R in xy-plane
+    double       phase()      const;   /// aziumth in xy-plane measured from ring center
+    double       xcenter()    const;   /// x-center of circle in xy-plane
+    double       ycenter()    const;   /// y-center of circle in xy-plane
+    int          h()          const;   /// -sign(q*B);
+    
+    const AliFmThreeVector<double>& origin() const;    /// starting point
+
+    void setParameters(double c, double dip, double phase, const AliFmThreeVector<double>& o, int h);
+    
+    double       x(double s)  const;
+    double       y(double s)  const;
+    double       z(double s)  const;
+
+    AliFmThreeVector<double>  at(double s) const;
+
+    /// returns period length of helix
+    double       period()       const;
+    
+    /// path length at given r (cylindrical r)
+    pair<double, double> pathLength(double r)   const;
+    
+    /// path length at given r (cylindrical r, cylinder axis at x,y)
+    pair<double, double> pathLength(double r, double x, double y, bool scanPeriods = true);
+    
+    /// path length at distance of closest approach to a given point
+    double       pathLength(const AliFmThreeVector<double>& p, bool scanPeriods = true) const;
+    
+    /// path length at intersection with plane
+    double       pathLength(const AliFmThreeVector<double>& r,
+                           const AliFmThreeVector<double>& n) const;
+
+    /// path length at distance of closest approach in the xy-plane to a given point
+    double       pathLength(double x, double y) const;
+
+    /// path lengths at dca between two helices 
+    pair<double, double> pathLengths(const AliFmHelix&, bool scanPeriods = true) const;
+    
+    /// minimal distance between point and helix
+    double       distance(const AliFmThreeVector<double>& p, bool scanPeriods = true) const;    
+    
+    /// checks for valid parametrization
+    bool         valid(double world = 1.e+5) const {return !bad(world);}
+    int            bad(double world = 1.e+5) const;
+    
+    /// move the origin along the helix to s which becomes then s=0
+    virtual void moveOrigin(double s);
+    
+    static const double NoSolution;
+    
+protected:
+    AliFmHelix();
+    
+    void setCurvature(double); /// performs also various checks   
+    void setPhase(double);             
+    void setDipAngle(double);
+    
+    /// value of S where distance in x-y plane is minimal
+    double fudgePathLength(const AliFmThreeVector<double>&) const;
+    
+protected:
+    bool                   mSingularity;       // true for straight line case (B=0)
+    AliFmThreeVector<double>  mOrigin;
+    double                 mDipAngle;
+    double                 mCurvature;
+    double                 mPhase;
+    int                    mH;                 // -sign(q*B);
+
+    double                 mCosDipAngle;
+    double                 mSinDipAngle;
+    double                 mCosPhase;
+    double                 mSinPhase;
+#ifdef __ROOT__
+  ClassDef(AliFmHelix,1)
+#endif
+};
+
+//
+//     Non-member functions
+//
+int operator== (const AliFmHelix&, const AliFmHelix&);
+int operator!= (const AliFmHelix&, const AliFmHelix&);
+ostream& operator<<(ostream&, const AliFmHelix&);
+
+//
+//     Inline functions
+//
+inline int AliFmHelix::h() const {return mH;}
+
+inline double AliFmHelix::dipAngle() const {return mDipAngle;}
+
+inline double AliFmHelix::curvature() const {return mCurvature;}
+
+inline double AliFmHelix::phase() const {return mPhase;}
+
+inline double AliFmHelix::x(double s) const
+{
+    if (mSingularity)
+       return mOrigin.x() - s*mCosDipAngle*mSinPhase;
+    else
+       return mOrigin.x() + (cos(mPhase + s*mH*mCurvature*mCosDipAngle)-mCosPhase)/mCurvature;
+}
+inline double AliFmHelix::y(double s) const
+{
+    if (mSingularity)
+       return mOrigin.y() + s*mCosDipAngle*mCosPhase;
+    else
+       return mOrigin.y() + (sin(mPhase + s*mH*mCurvature*mCosDipAngle)-mSinPhase)/mCurvature;
+}
+
+inline double AliFmHelix::z(double s) const
+{
+    return mOrigin.z() + s*mSinDipAngle;
+}
+
+inline const AliFmThreeVector<double>& AliFmHelix::origin() const {return mOrigin;}
+
+inline AliFmThreeVector<double> AliFmHelix::at(double s) const
+{
+    return AliFmThreeVector<double>(x(s), y(s), z(s));
+}
+
+inline double AliFmHelix::pathLength(double x, double y) const
+{
+    return fudgePathLength(AliFmThreeVector<double>(x, y, 0));
+}
+inline int AliFmHelix::bad(double WorldSize) const
+{
+
+    int ierr;
+    if (!::finite(mDipAngle    ))      return   11;
+    if (!::finite(mCurvature   ))      return   12;
+
+    ierr = mOrigin.bad(WorldSize);
+    if (ierr)                           return    3+ierr*100;
+
+    if (::fabs(mDipAngle)  >1.58)      return   21;
+    double qwe = ::fabs(::fabs(mDipAngle)-M_PI/2);
+    if (qwe < 1./WorldSize      )      return   31; 
+
+    if (::fabs(mCurvature) > WorldSize)        return   22;
+    if (mCurvature < 0          )      return   32;
+
+    if (abs(mH) != 1            )       return   24; 
+
+    return 0;
+}
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelixD.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelixD.h
new file mode 100644 (file)
index 0000000..031f31b
--- /dev/null
@@ -0,0 +1,20 @@
+/***************************************************************************
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.8  2005/07/06 18:49:56  fisyak
+ * Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
+ *
+
+****************************************************************************/
+#ifndef ST_HELIX_D_HH
+#define ST_HELIX_D_HH
+#include "AliFmThreeVectorD.h"
+#include "AliFmHelix.h"
+#include <utility>
+typedef AliFmHelix AliFmHelixD;
+typedef pair<double,double> pairD;
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmLorentzVector.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmLorentzVector.h
new file mode 100644 (file)
index 0000000..407bb49
--- /dev/null
@@ -0,0 +1,735 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Brian Lasiuk, Thomas Ullrich, April 1998
+ ***************************************************************************
+ *
+ * Description:
+ *
+ * Remarks:   Since not all compilers support member templates
+ *            we have to specialize the templated member on these
+ *            platforms. If member templates are not supported the
+ *            ST_NO_MEMBER_TEMPLATES flag has to be set. tu.
+ *
+ *            In the near future when all compilers can handle member
+ *            templates this class should be cleaned up. A lot of
+ *            redundant code can be removed as soon as the compilers
+ *            are up-to-date. tu
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.11  2005/09/22 20:09:20  fisyak
+ * Make AliFmLorentzVector persistent
+ *
+ * Revision 1.10  2005/07/06 18:49:56  fisyak
+ * Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
+ *
+ * Revision 1.9  2005/03/28 06:02:45  perev
+ * Defence FPE added
+ *
+ * Revision 1.8  2003/09/02 17:59:35  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.7  2003/05/01 19:24:31  ullrich
+ * Corrected problem in boost().
+ *
+ * Revision 1.6  1999/10/15 15:56:36  ullrich
+ * Changed output format in operator<<, added operator>>
+ *
+ * Revision 1.5  1999/06/04 18:01:36  ullrich
+ * New operators operator() and operator[] which can be used
+ * as lvalues.
+ *
+ * Revision 1.4  1999/04/14 23:12:07  fisyak
+ * Add __CINT__ to handle references
+ *
+ * Revision 1.3  1999/02/17 11:38:36  ullrich
+ * Removed specialization for 'long double'.
+ *
+ * Revision 1.2  1999/02/14 23:11:42  fisyak
+ * Fixes for Rootcint
+ *
+ * Revision 1.1  1999/01/30 03:59:02  fisyak
+ * Root Version of AliFmarClassLibrary
+ *
+ * Revision 1.1  1999/01/23 00:27:52  ullrich
+ * Initial Revision
+ *
+ **************************************************************************/
+#ifndef ST_LORENTZ_VECTOR_HH
+#define ST_LORENTZ_VECTOR_HH
+
+#include "AliFmThreeVector.h"
+template<class T> class AliFmLorentzVector {
+public:
+    AliFmLorentzVector(T = 0, T = 0, T = 0, T = 0);
+    virtual ~AliFmLorentzVector();
+    
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template<class X> AliFmLorentzVector(const AliFmThreeVector<X>&, T);
+    template<class X> AliFmLorentzVector(T, const AliFmThreeVector<X>&);   
+
+    template<class X> AliFmLorentzVector(const AliFmLorentzVector<X>&);
+    template<class X> AliFmLorentzVector<T>& operator=(const AliFmLorentzVector<X>&);
+    // AliFmLorentzVector(const AliFmLorentzVector<T>&);                use default
+    // AliFmLorentzVector<T>& operator=(const AliFmLorentzVector<T>&);  use default
+#else
+    AliFmLorentzVector(const AliFmThreeVector<float>&, T);
+    AliFmLorentzVector(T, const AliFmThreeVector<float>&);   
+    AliFmLorentzVector(const AliFmLorentzVector<float>&);
+    
+    AliFmLorentzVector(const AliFmThreeVector<double>&, T);
+    AliFmLorentzVector(T, const AliFmThreeVector<double>&);   
+    AliFmLorentzVector(const AliFmLorentzVector<double>&);
+        
+    AliFmLorentzVector<T>& operator=(const AliFmLorentzVector<float>&);
+    AliFmLorentzVector<T>& operator=(const AliFmLorentzVector<double>&);
+#endif
+    
+    T x()                     const;
+    T y()                     const;
+    T z()                     const;
+    T t()                     const;
+    T px()                    const;
+    T py()                    const;
+    T pz()                    const;
+    T e()                     const;
+    T operator()  (size_t)    const;
+    T operator[]  (size_t)    const;
+    
+    T& operator()  (size_t);
+    T& operator[]  (size_t);
+
+    const AliFmThreeVector<T>& vect() const;    
+    
+    void setX(T);
+    void setY(T);
+    void setZ(T);
+    void setPx(T);
+    void setPy(T);
+    void setPz(T);
+    void setE(T);
+    void setT(T);
+    
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template <class X> void setVect(const AliFmThreeVector<X>&);
+#else
+    void setVect(const AliFmThreeVector<float>&);
+    void setVect(const AliFmThreeVector<double>&);
+#endif   
+
+    T perp()               const;
+    T perp2()              const;
+    T pseudoRapidity()     const;
+    T phi()                const;
+    T theta()              const;
+    T cosTheta()           const;
+    
+    T plus()               const;
+    T minus()              const;
+    
+    T m()                  const; 
+    T m2()                 const; 
+    T mt()                 const;
+    T mt2()                const;
+    T rapidity()           const;
+    
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template<class X> AliFmLorentzVector<T> boost(const AliFmLorentzVector<X>&) const;
+#else
+    AliFmLorentzVector<T> boost(const AliFmLorentzVector<float>&) const;
+    AliFmLorentzVector<T> boost(const AliFmLorentzVector<double>&) const;
+#endif   
+    
+    AliFmLorentzVector<T>  operator- ();
+    AliFmLorentzVector<T>  operator+ ();
+    AliFmLorentzVector<T>& operator*= (double);
+    AliFmLorentzVector<T>& operator/= (double);
+
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template<class X> bool operator == (const AliFmLorentzVector<X>&) const;
+    template<class X> bool operator != (const AliFmLorentzVector<X>&) const;
+    template<class X> AliFmLorentzVector<T>& operator+= (const AliFmLorentzVector<X>&);
+    template<class X> AliFmLorentzVector<T>& operator-= (const AliFmLorentzVector<X>&);
+#else    
+    bool operator == (const AliFmLorentzVector<float>&) const;
+    bool operator != (const AliFmLorentzVector<float>&) const;
+    bool operator == (const AliFmLorentzVector<double>&) const;
+    bool operator != (const AliFmLorentzVector<double>&) const;
+
+    AliFmLorentzVector<T>& operator+= (const AliFmLorentzVector<float>&);
+    AliFmLorentzVector<T>& operator-= (const AliFmLorentzVector<float>&);
+    AliFmLorentzVector<T>& operator+= (const AliFmLorentzVector<double>&);
+    AliFmLorentzVector<T>& operator-= (const AliFmLorentzVector<double>&);
+#endif
+
+protected:
+    AliFmThreeVector<T> mThreeVector;
+    T               mX4;
+#ifdef __ROOT__
+  ClassDef(AliFmLorentzVector,3)
+#endif
+};
+#ifndef __CINT__
+//
+//        Implementation of member functions
+//
+template<class T>
+AliFmLorentzVector<T>::AliFmLorentzVector(T x, T y, T z, T t)
+    : mThreeVector(x, y, z), mX4(t) { /* nop */ }
+
+template<class T>
+AliFmLorentzVector<T>::~AliFmLorentzVector() { /* nopt */ }    
+
+template<class T>
+const AliFmThreeVector<T>& AliFmLorentzVector<T>::vect() const 
+{
+    return mThreeVector;
+}
+
+template<class T>
+T AliFmLorentzVector<T>::m2() const
+{
+    return (mX4*mX4 - mThreeVector*mThreeVector);    
+}
+
+template<class T>
+T AliFmLorentzVector<T>::plus() const { return (e() + pz()); }
+
+template<class T>
+T AliFmLorentzVector<T>::minus() const { return (e() - pz()); }
+
+template<class T>
+T AliFmLorentzVector<T>::m() const
+{
+    T mass2 = m2();
+    if (mass2 < 0)
+       return -::sqrt(-mass2);
+    else
+       return ::sqrt(mass2);
+}
+
+template<class T>
+T AliFmLorentzVector<T>::mt2() const
+{
+    return this->perp2() + m2();
+}
+
+template<class T>
+T AliFmLorentzVector<T>::mt() const
+{
+    //
+    // change to more optimal code ?
+    // return e()*e() - pz()*pz();
+    T massPerp2 = mt2();
+    if (massPerp2 < 0)
+       return -::sqrt(-massPerp2);
+    else
+       return ::sqrt(massPerp2);
+}
+
+template<class T>
+void AliFmLorentzVector<T>::setPx(T x) {mThreeVector.setX(x);}
+
+template<class T>
+void AliFmLorentzVector<T>::setPy(T y) {mThreeVector.setY(y);}
+
+template<class T>
+void AliFmLorentzVector<T>::setPz(T z) {mThreeVector.setZ(z);}
+
+template<class T>
+void AliFmLorentzVector<T>::setX(T x) {mThreeVector.setX(x);}
+
+template<class T>
+void AliFmLorentzVector<T>::setY(T y) {mThreeVector.setY(y);}
+
+template<class T>
+void AliFmLorentzVector<T>::setZ(T z) {mThreeVector.setZ(z);}
+
+template<class T>
+void AliFmLorentzVector<T>::setT(T t) {mX4 = t;}
+
+template<class T>
+void AliFmLorentzVector<T>::setE(T e) {mX4 = e;}
+
+template<class T>
+T AliFmLorentzVector<T>::x() const {return mThreeVector.x();}
+
+template<class T>
+T AliFmLorentzVector<T>::y() const {return mThreeVector.y();}
+
+template<class T>
+T AliFmLorentzVector<T>::z() const {return mThreeVector.z();}
+
+template<class T>
+T AliFmLorentzVector<T>::px() const {return mThreeVector.x();}
+
+template<class T>
+T AliFmLorentzVector<T>::py() const {return mThreeVector.y();}
+
+template<class T>
+T AliFmLorentzVector<T>::pz() const {return mThreeVector.z();}
+
+template<class T>
+T AliFmLorentzVector<T>::e() const {return mX4;}
+
+template<class T>
+T AliFmLorentzVector<T>::t() const {return mX4;}
+
+template<class T>
+T AliFmLorentzVector<T>::perp() const {return mThreeVector.perp();}
+
+template<class T>
+T AliFmLorentzVector<T>::perp2() const {return mThreeVector.perp2();}
+
+template<class T>
+T AliFmLorentzVector<T>::pseudoRapidity() const {return mThreeVector.pseudoRapidity();}
+
+template<class T>
+T AliFmLorentzVector<T>::phi() const {return mThreeVector.phi();}
+
+template<class T>
+T AliFmLorentzVector<T>::theta() const {return mThreeVector.theta();}
+
+template<class T>
+T AliFmLorentzVector<T>::cosTheta() const {return mThreeVector.cosTheta();}
+
+template<class T>
+T AliFmLorentzVector<T>::operator() (size_t i) const
+{
+    if (i < 3)
+        return mThreeVector(i);
+    else if (i == 3)
+        return mX4;
+    else {
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFmLorentzVector<T>::operator(): bad index");  
+#else
+      cerr << "AliFmLorentzVector<T>::operator(): bad index." << endl;
+#endif
+      return 0;
+    }
+}
+
+template<class T>
+T& AliFmLorentzVector<T>::operator() (size_t i)
+{
+    if (i < 3)
+        return mThreeVector(i);
+    else if (i == 3)
+        return mX4;
+    else {
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFmLorentzVector<T>::operator(): bad index");  
+#else
+      cerr << "AliFmLorentzVector<T>::operator(): bad index." << endl;
+#endif
+      return mX4;
+    }
+}
+
+template<class T>
+T AliFmLorentzVector<T>::operator[] (size_t i) const
+{
+    if (i < 3)
+        return mThreeVector[i];
+    else if (i == 3)
+        return mX4;
+    else {
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFmLorentzVector<T>::operator[]: bad index"); 
+#else
+      cerr << "AliFmLorentzVector<T>::operator[]: bad index." << endl;
+#endif
+      return 0;
+    }
+}
+
+template<class T>
+T& AliFmLorentzVector<T>::operator[] (size_t i)
+{
+    if (i < 3)
+        return mThreeVector[i];
+    else if (i == 3)
+        return mX4;
+    else {
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFmLorentzVector<T>::operator[]: bad index"); 
+#else
+      cerr << "AliFmLorentzVector<T>::operator[]: bad index." << endl;
+#endif
+      return mX4;
+    }
+}
+
+template<class T>
+T AliFmLorentzVector<T>::rapidity() const
+{
+    return 0.5*::log((mX4+mThreeVector.z())/(mX4-mThreeVector.z())+1e-20);
+}
+
+template<class T>
+AliFmLorentzVector<T> AliFmLorentzVector<T>::operator- ()
+{
+    return AliFmLorentzVector<T>(-mX4,-mThreeVector);
+}
+
+template<class T>
+AliFmLorentzVector<T> AliFmLorentzVector<T>::operator+ ()
+{
+    return *this;
+}
+
+template<class T>
+AliFmLorentzVector<T>& AliFmLorentzVector<T>::operator*= (double c)
+{
+    mThreeVector *= c;
+    mX4 *= c;
+    return *this;
+}
+
+template<class T>
+AliFmLorentzVector<T>& AliFmLorentzVector<T>::operator/= (double c)
+{
+    mThreeVector /= c;
+    mX4 /= c;
+    return *this;
+}
+
+#ifndef ST_NO_MEMBER_TEMPLATES
+#ifndef WIN32
+
+template<class T>
+template<class X>
+AliFmLorentzVector<T>::AliFmLorentzVector(const AliFmThreeVector<X> &vec, T t)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+template<class X>
+AliFmLorentzVector<T>::AliFmLorentzVector(T t, const AliFmThreeVector<X> &vec)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+template<class X>
+AliFmLorentzVector<T>::AliFmLorentzVector(const AliFmLorentzVector<X> &vec)
+       : mThreeVector(vec.vect()), mX4(vec.t()) { /* nop */ }
+
+template<class T>
+template<class X>
+AliFmLorentzVector<T>
+AliFmLorentzVector<T>::boost(const AliFmLorentzVector<X>& pframe) const
+{
+    T mass               = abs(pframe);
+    AliFmThreeVector<T> eta = (-1./mass)*pframe.vect();            // gamma*beta
+    T gamma              = fabs(pframe.e())/mass;
+    AliFmThreeVector<T> pl  = ((this->vect()*eta)/(eta*eta))*eta;  // longitudinal momentum
+    return AliFmLorentzVector<T>(gamma*this->e() - this->vect()*eta,
+                              this->vect() + (gamma-1.)*pl - this->e()*eta);
+}
+
+template<class T>
+template<class X>
+void AliFmLorentzVector<T>::setVect(const AliFmThreeVector<X>& v)
+{
+    mThreeVector = v;
+}
+
+template<class T>
+template<class X>
+AliFmLorentzVector<T>&
+AliFmLorentzVector<T>::operator=(const AliFmLorentzVector<X>& vec)
+{
+    mThreeVector = vec.vect();
+    mX4 = vec.t();
+    return *this;
+}
+
+template<class T>
+template<class X>
+bool
+AliFmLorentzVector<T>::operator== (const AliFmLorentzVector<X>& v) const
+{
+    return (mThreeVector == v.vect()) && (mX4 == v.t());
+}
+
+template<class T>
+template<class X>
+bool
+AliFmLorentzVector<T>::operator!= (const AliFmLorentzVector<X>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+template<class X>
+AliFmLorentzVector<T>&
+AliFmLorentzVector<T>::operator+= (const AliFmLorentzVector<X>& v)
+{
+    mThreeVector += v.vect();
+    mX4 += v.t();
+    return *this;
+}
+
+template<class T>
+template<class X>
+AliFmLorentzVector<T>&
+AliFmLorentzVector<T>::operator-= (const AliFmLorentzVector<X>& v)
+{
+    mThreeVector -= v.vect();
+    mX4 -= v.t();
+    return *this;
+}
+
+#endif 
+#else
+
+template<class T>
+AliFmLorentzVector<T>::AliFmLorentzVector(const AliFmThreeVector<float> &vec, T t)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+AliFmLorentzVector<T>::AliFmLorentzVector(const AliFmThreeVector<double> &vec, T t)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+AliFmLorentzVector<T>::AliFmLorentzVector(T t, const AliFmThreeVector<float> &vec)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+AliFmLorentzVector<T>::AliFmLorentzVector(T t, const AliFmThreeVector<double> &vec)
+       : mThreeVector(vec), mX4(t) { /* nop */ }
+
+template<class T>
+AliFmLorentzVector<T>::AliFmLorentzVector(const AliFmLorentzVector<float> &vec)
+       : mThreeVector(vec.vect()), mX4(vec.t()) { /* nop */ }
+    
+template<class T>
+AliFmLorentzVector<T>::AliFmLorentzVector(const AliFmLorentzVector<double> &vec)
+       : mThreeVector(vec.vect()), mX4(vec.t()) { /* nop */ }
+    
+template<class T>
+AliFmLorentzVector<T>
+AliFmLorentzVector<T>::boost(const AliFmLorentzVector<float>& pframe) const
+{
+    T mass               = abs(pframe);
+    AliFmThreeVector<T> eta = (-1./mass)*pframe.vect();            // gamma*beta
+    T gamma              = fabs(pframe.e())/mass;
+    AliFmThreeVector<T> pl  = ((this->vect()*eta)/(eta*eta))*eta;  // longitudinal momentum
+    return AliFmLorentzVector<T>(gamma*this->e() - this->vect()*eta,
+                              this->vect() + (gamma-1.)*pl - this->e()*eta);
+}
+
+template<class T>
+AliFmLorentzVector<T>
+AliFmLorentzVector<T>::boost(const AliFmLorentzVector<double>& pframe) const
+{
+    T mass               = abs(pframe);
+    AliFmThreeVector<T> eta = (-1./mass)*pframe.vect();            // gamma*beta
+    T gamma              = fabs(pframe.e())/mass;
+    AliFmThreeVector<T> pl  = ((this->vect()*eta)/(eta*eta))*eta;  // longitudinal momentum
+    return AliFmLorentzVector<T>(gamma*this->e() - this->vect()*eta,
+                              this->vect() + (gamma-1.)*pl - this->e()*eta);
+}
+
+template<class T>
+void AliFmLorentzVector<T>::setVect(const AliFmThreeVector<float>& v)
+{
+    mThreeVector = v;
+}
+
+template<class T>
+void AliFmLorentzVector<T>::setVect(const AliFmThreeVector<double>& v)
+{
+    mThreeVector = v;
+}
+
+template<class T>
+AliFmLorentzVector<T>&
+AliFmLorentzVector<T>::operator=(const AliFmLorentzVector<float>& vec)
+{
+    mThreeVector = vec.vect();
+    mX4 = vec.t();
+    return *this;
+}
+
+template<class T>
+AliFmLorentzVector<T>&
+AliFmLorentzVector<T>::operator=(const AliFmLorentzVector<double>& vec)
+{
+    mThreeVector = vec.vect();
+    mX4 = vec.t();
+    return *this;
+}
+
+template<class T>
+bool
+AliFmLorentzVector<T>::operator== (const AliFmLorentzVector<float>& v) const
+{
+    return (this->vect() == v.vect()) && (mX4 == v.t());
+}
+
+template<class T>
+bool
+AliFmLorentzVector<T>::operator== (const AliFmLorentzVector<double>& v) const
+{
+    return (mThreeVector == v.vect()) && (mX4 == v.t());
+}
+
+template<class T>
+bool
+AliFmLorentzVector<T>::operator!= (const AliFmLorentzVector<float>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+bool
+AliFmLorentzVector<T>::operator!= (const AliFmLorentzVector<double>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+AliFmLorentzVector<T>&
+AliFmLorentzVector<T>::operator+= (const AliFmLorentzVector<float>& v)
+{
+    mThreeVector += v.vect();
+    mX4 += v.t();
+    return *this;
+}
+
+template<class T>
+AliFmLorentzVector<T>&
+AliFmLorentzVector<T>::operator+= (const AliFmLorentzVector<double>& v)
+{
+    mThreeVector += v.vect();
+    mX4 += v.t();
+    return *this;
+}
+
+template<class T>
+AliFmLorentzVector<T>&
+AliFmLorentzVector<T>::operator-= (const AliFmLorentzVector<float>& v)
+{
+    mThreeVector -= v.vect();
+    mX4 -= v.t();
+    return *this;
+}
+
+template<class T>
+AliFmLorentzVector<T>&
+AliFmLorentzVector<T>::operator-= (const AliFmLorentzVector<double>& v)
+{
+    mThreeVector -= v.vect();
+    mX4 -= v.t();
+    return *this;
+}
+
+#endif // ST_NO_MEMBER_TEMPLATES
+#endif /* ! __CINT__ */
+#ifdef __CINT__
+template<> AliFmLorentzVector<double> operator+ (const AliFmLorentzVector<double>& v1, const AliFmLorentzVector<double>& v2);
+template<> AliFmLorentzVector<double> operator+ (const AliFmLorentzVector<double>& v1, const AliFmLorentzVector<float>& v2);
+template<> AliFmLorentzVector<double> operator+ (const AliFmLorentzVector<float>&  v1, const AliFmLorentzVector<double>& v2);
+template<> AliFmLorentzVector<float>  operator+ (const AliFmLorentzVector<float>&  v1, const AliFmLorentzVector<float>& v2);
+template<> AliFmLorentzVector<double> operator- (const AliFmLorentzVector<double>& v1, const AliFmLorentzVector<double>& v2);
+template<> AliFmLorentzVector<double> operator- (const AliFmLorentzVector<double>& v1, const AliFmLorentzVector<float>& v2);
+template<> AliFmLorentzVector<double> operator- (const AliFmLorentzVector<float>&  v1, const AliFmLorentzVector<double>& v2);
+template<> AliFmLorentzVector<float>  operator- (const AliFmLorentzVector<float>&  v1, const AliFmLorentzVector<float>& v2);
+template<> AliFmLorentzVector<double> operator* (const AliFmLorentzVector<double>& v1, const AliFmLorentzVector<double>& v2);
+template<> AliFmLorentzVector<double> operator* (const AliFmLorentzVector<double>& v1, const AliFmLorentzVector<float>& v2);
+template<> AliFmLorentzVector<double> operator* (const AliFmLorentzVector<float>&  v1, const AliFmLorentzVector<double>& v2);
+template<> AliFmLorentzVector<float>  operator* (const AliFmLorentzVector<float>&  v1, const AliFmLorentzVector<float>& v2);
+template<> AliFmLorentzVector<double> operator* (const              double v1, const AliFmLorentzVector<double>& v2);
+template<> AliFmLorentzVector<double> operator* (const              double v1, const AliFmLorentzVector<float>&  v2);
+template<> AliFmLorentzVector<double> operator* (const AliFmLorentzVector<double>& v1, const double              v2);
+template<> AliFmLorentzVector<double> operator* (const AliFmLorentzVector<float>&  v1, const double              v2);
+template<> AliFmLorentzVector<double> operator/ (const AliFmLorentzVector<double>& v1, const AliFmLorentzVector<double>& v2);
+template<> AliFmLorentzVector<double> operator/ (const AliFmLorentzVector<double>& v1, const AliFmLorentzVector<float>& v2);
+template<> AliFmLorentzVector<double> operator/ (const AliFmLorentzVector<float>&  v1, const AliFmLorentzVector<double>& v2);
+template<> AliFmLorentzVector<float>  operator/ (const AliFmLorentzVector<float>&  v1, const AliFmLorentzVector<float>& v2);
+template<> AliFmLorentzVector<double> operator/ (const              double v1, const AliFmLorentzVector<double>& v2);
+template<> AliFmLorentzVector<double> operator/ (const              double v1, const AliFmLorentzVector<float>&  v2);
+template<> AliFmLorentzVector<double> operator/ (const AliFmLorentzVector<double>& v1, const double              v2);
+template<> AliFmLorentzVector<double> operator/ (const AliFmLorentzVector<float>&  v1, const double              v2);
+template<> istream& operator>> (istream& is, const AliFmLorentzVector<double>& v);
+template<> ostream& operator<< (ostream& os, const AliFmLorentzVector<double>& v);
+template<> istream& operator>> (istream& is, const AliFmLorentzVector<float>& v);
+template<> ostream& operator<< (ostream& os, const AliFmLorentzVector<float>& v);
+template<> double abs(const AliFmLorentzVector<double>& v);
+template<> float  abs(const AliFmLorentzVector<float>& v);
+#else
+//
+//   Non-member operators
+//
+template<class T, class X>
+AliFmLorentzVector<T>
+operator+ (const AliFmLorentzVector<T>& v1, const AliFmLorentzVector<X>& v2)
+{
+    return AliFmLorentzVector<T>(v1) += v2;
+}
+
+template<class T, class X>
+AliFmLorentzVector<T>
+operator- (const AliFmLorentzVector<T>& v1, const AliFmLorentzVector<X>& v2)
+{
+    return AliFmLorentzVector<T>(v1) -= v2;
+}
+
+template<class T, class X>
+T
+operator* (const AliFmLorentzVector<T>& v1, const AliFmLorentzVector<X>& v2)
+{
+    return v1.t()*v2.t() - v1.vect()*v2.vect();
+}
+
+template<class T>
+AliFmLorentzVector<T>
+operator* (const AliFmLorentzVector<T>& v, double c)
+{
+    return AliFmLorentzVector<T>(v) *= c;
+}
+
+template<class T>
+AliFmLorentzVector<T> operator* (double c, const AliFmLorentzVector<T>& v)
+{
+    return AliFmLorentzVector<T>(v) *= c;
+}
+
+template<class T, class X>
+AliFmLorentzVector<T> operator/ (const AliFmLorentzVector<T>& v, X c)
+{
+    return AliFmLorentzVector<T>(v) /= c;
+}
+
+template<class T>
+ostream& operator<< (ostream& os, const AliFmLorentzVector<T>& v)
+{
+    return os << v.vect() << "\t\t" << v.t();
+}
+
+template<class T>
+istream&  operator>>(istream& is, AliFmLorentzVector<T>& v)
+{
+    T  x, y, z, t;
+    is >> x >> y >> z >> t;
+    v.setX(x);
+    v.setY(y);
+    v.setZ(z);
+    v.setT(t);
+    return is;
+}
+
+//
+//        Non-member functions
+//
+template<class T>
+T abs(const AliFmLorentzVector<T>& v) {return v.m();}
+
+#endif /*  __CINT__ */
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmLorentzVectorD.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmLorentzVectorD.h
new file mode 100644 (file)
index 0000000..3fad3d4
--- /dev/null
@@ -0,0 +1,19 @@
+/***************************************************************************
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.6  2005/07/06 18:49:56  fisyak
+ * Replace AliFemtoHelixD, AliFemtoLorentzVectorD,AliFemtoLorentzVectorF,AliFemtoMatrixD,AliFemtoMatrixF,AliFemtoPhysicalHelixD,AliFemtoThreeVectorD,AliFemtoThreeVectorF by templated version
+ *
+
+****************************************************************************/
+#ifndef ALIFM_LORENTZ_VECTOR_D_HH
+#define ALIFM_LORENTZ_VECTOR_D_HH
+//#include "AliFemtoThreeVectorF.hh"
+#include "AliFmThreeVectorD.h"
+#include "AliFmLorentzVector.h"
+typedef AliFmLorentzVector<double> AliFmLorentzVectorD;
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmPhysicalHelix.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmPhysicalHelix.cxx
new file mode 100644 (file)
index 0000000..e871acc
--- /dev/null
@@ -0,0 +1,165 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Brian Lasiuk, Sep 1997
+ ***************************************************************************
+ *
+ * Description: 
+ * Parametrization of a physical helix.
+ * 
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.7  2005/07/06 18:49:56  fisyak
+ * Replace StHelixD, StLorentzVectorD,StLorentzVectorF,StMatrixD,StMatrixF,AliFmPhysicalHelixD,StThreeVectorD,StThreeVectorF by templated version
+ *
+ * Revision 1.6  2003/09/02 17:59:35  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.5  2002/06/21 17:49:26  genevb
+ * Some minor speed improvements
+ *
+ * Revision 1.4  2002/02/20 00:56:23  ullrich
+ * Added methods to calculate signed DCA.
+ *
+ * Revision 1.3  1999/02/24 11:42:18  ullrich
+ * Fixed bug in momentum().
+ *
+ * Revision 1.2  1999/02/12 01:01:04  wenaus
+ * Fix bug in momentum calculation
+ *
+ * Revision 1.1  1999/01/30 03:59:04  fisyak
+ * Root Version of StarClassLibrary
+ *
+ * Revision 1.1  1999/01/23 00:29:21  ullrich
+ * Initial Revision
+ *
+ **************************************************************************/
+#include <math.h>
+#include "AliFmHelix.h"
+#include "AliFmPhysicalHelix.h"
+#include "PhysicalConstants.h" 
+#include "SystemOfUnits.h"
+#ifdef __ROOT__
+ClassImpT(AliFmPhysicalHelix,double);
+#endif
+AliFmPhysicalHelix::AliFmPhysicalHelix(){}
+
+AliFmPhysicalHelix::~AliFmPhysicalHelix() { /* nop */ }
+
+AliFmPhysicalHelix::AliFmPhysicalHelix(const AliFmThreeVector<double>& p,
+                                      const AliFmThreeVector<double>& o,
+                                      double B, double q)
+{
+  mH = (q*B <= 0) ? 1 : -1;
+  if(p.y() == 0 && p.x() == 0)
+    setPhase((M_PI/4)*(1-2.*mH));
+  else
+    setPhase(atan2(p.y(),p.x())-mH*M_PI/2);
+  setDipAngle(atan2(p.z(),p.perp()));
+  mOrigin = o;
+  
+#ifndef ST_NO_NAMESPACES
+  {
+    using namespace units;
+#endif
+    setCurvature(fabs((c_light*nanosecond/meter*q*B/tesla)/
+                     (abs(p.mag())/GeV*mCosDipAngle)/meter));   
+#ifndef ST_NO_NAMESPACES
+  }
+#endif
+}
+
+AliFmPhysicalHelix::AliFmPhysicalHelix(double c, double d, double phase,
+                                const AliFmThreeVector<double>& o, int h)
+    : AliFmHelix(c, d, phase, o, h) { /* nop */}
+
+
+AliFmThreeVector<double> AliFmPhysicalHelix::momentum(double B) const
+{
+    if (mSingularity)
+       return(AliFmThreeVector<double>(0,0,0));
+    else {
+#ifndef ST_NO_NAMESPACES
+       {
+           using namespace units;
+#endif
+           double pt = GeV*fabs(c_light*nanosecond/meter*B/tesla)/(fabs(mCurvature)*meter);
+    
+           return (AliFmThreeVector<double>(pt*cos(mPhase+mH*M_PI/2),   // pos part pos field
+                                         pt*sin(mPhase+mH*M_PI/2),
+                                         pt*tan(mDipAngle)));
+#ifndef ST_NO_NAMESPACES
+       }
+#endif
+    }
+}
+
+AliFmThreeVector<double> AliFmPhysicalHelix::momentumAt(double S, double B) const
+{
+    // Obtain phase-shifted momentum from phase-shift of origin
+    double xc = this->xcenter();
+    double yc = this->ycenter();
+    double rx = (y(S)-yc)/(mOrigin.y()-yc);
+    double ry = (x(S)-xc)/(mOrigin.x()-xc);
+    return (this->momentum(B)).pseudoProduct(rx,ry,1.0);
+}
+
+int AliFmPhysicalHelix::charge(double B) const
+{
+    return (B > 0 ? -mH : mH);
+}
+
+double AliFmPhysicalHelix::geometricSignedDistance(double x, double y)  
+{
+    // Geometric signed distance
+    double thePath = this->pathLength(x,y);
+    AliFmThreeVector<double> DCA2dPosition = this->at(thePath);
+    DCA2dPosition.setZ(0);
+    AliFmThreeVector<double> position(x,y,0);
+    AliFmThreeVector<double> DCAVec = (DCA2dPosition-position);
+    AliFmThreeVector<double> momVec;
+    // Deal with straight tracks
+    if (this->mSingularity) {
+       momVec = this->at(1)- this->at(0);
+       momVec.setZ(0);
+    }
+    else {
+       momVec = this->momentumAt(thePath,1./tesla); // Don't care about Bmag.  Helicity is what matters.
+       momVec.setZ(0);
+    }
+    
+    double cross = DCAVec.x()*momVec.y() - DCAVec.y()*momVec.x();
+    double theSign = (cross>=0) ? 1. : -1.;
+    return theSign*DCAVec.perp();
+}
+
+double AliFmPhysicalHelix::curvatureSignedDistance(double x, double y) 
+{
+    // Protect against mH = 0 or zero field
+    if (this->mSingularity || abs(this->mH)<=0) {
+       return (this->geometricSignedDistance(x,y));
+    }
+    else {
+       return (this->geometricSignedDistance(x,y))/(this->mH);
+    }
+    
+}
+
+double AliFmPhysicalHelix::geometricSignedDistance(const AliFmThreeVector<double>& pos) 
+{
+    double sdca2d = this->geometricSignedDistance(pos.x(),pos.y());
+    double theSign = (sdca2d>=0) ? 1. : -1.;
+    return (this->distance(pos))*theSign;
+}
+
+double AliFmPhysicalHelix::curvatureSignedDistance(const AliFmThreeVector<double>& pos) 
+{
+    double sdca2d = this->curvatureSignedDistance(pos.x(),pos.y());
+    double theSign = (sdca2d>=0) ? 1. : -1.;
+    return (this->distance(pos))*theSign;
+}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmPhysicalHelix.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmPhysicalHelix.h
new file mode 100644 (file)
index 0000000..d078cc7
--- /dev/null
@@ -0,0 +1,72 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Brian Lasiuk, Sep 1997
+ ***************************************************************************
+ *
+ * Description: 
+ * Parametrization of a physical helix. See the SCL user guide for more.
+ * 
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.4  2005/07/06 18:49:56  fisyak
+ * Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
+ *
+ * Revision 1.3  2002/06/21 17:49:26  genevb
+ * Some minor speed improvements
+ *
+ * Revision 1.2  2002/02/20 00:56:23  ullrich
+ * Added methods to calculate signed DCA.
+ *
+ * Revision 1.1  1999/01/30 03:59:04  fisyak
+ * Root Version of AliFmarClassLibrary
+ *
+ * Revision 1.1  1999/01/23 00:27:59  ullrich
+ * Initial Revision
+ *
+ **************************************************************************/
+#ifndef ST_PHYSICAL_HELIX_HH
+#define ST_PHYSICAL_HELIX_HH
+
+#include "AliFmThreeVector.h"
+#include "AliFmHelix.h"
+
+class AliFmPhysicalHelix : public AliFmHelix {
+public:
+    // Requires: momentum, origin, signed Magnetic Field
+    //           and Charge of particle (+/- 1)
+    AliFmPhysicalHelix(const AliFmThreeVector<double>&,
+                   const AliFmThreeVector<double>&,
+                   double, double);
+    
+    // curvature, dip angle, phase, origin, h
+    AliFmPhysicalHelix(double, double, double,
+                   const AliFmThreeVector<double>&, int h=-1);
+    AliFmPhysicalHelix();
+    
+    ~AliFmPhysicalHelix();
+
+    // Requires:  signed Magnetic Field
+    AliFmThreeVector<double> momentum(double) const;     // returns the momentum at origin
+    AliFmThreeVector<double> momentumAt(double, double) const; // returns momemtum at S
+    int                   charge(double)   const;     // returns charge of particle
+    // 2d DCA to x,y point signed relative to curvature
+    double curvatureSignedDistance(double x, double y) ;
+    // 2d DCA to x,y point signed relative to rotation 
+    double geometricSignedDistance(double x, double y) ;
+    // 3d DCA to 3d point signed relative to curvature
+    double curvatureSignedDistance(const AliFmThreeVector<double>&) ;
+    // 3d DCA to 3d point signed relative to rotation
+    double geometricSignedDistance(const AliFmThreeVector<double>&) ;
+    
+#ifdef __ROOT__
+  ClassDef(AliFmPhysicalHelix,1)
+#endif
+};
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmPhysicalHelixD.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmPhysicalHelixD.h
new file mode 100644 (file)
index 0000000..39bcfae
--- /dev/null
@@ -0,0 +1,19 @@
+/***************************************************************************
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.4  2005/07/06 18:49:57  fisyak
+ * Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
+ *
+
+****************************************************************************/
+#ifndef ST_PHYSICALHELIX_D_HH
+#define ST_PHYSICALHELIX_D_HH
+#include "AliFmThreeVectorD.h"
+#include "AliFmHelixD.h"
+#include "AliFmPhysicalHelix.h"
+typedef AliFmPhysicalHelix AliFmPhysicalHelixD;
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmThreeVector.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmThreeVector.h
new file mode 100644 (file)
index 0000000..63cb152
--- /dev/null
@@ -0,0 +1,855 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Brian Lasiuk, Thomas Ullrich, April 1998
+ ***************************************************************************
+ *
+ * Description:  
+ *
+ * Remarks:   Since not all compilers support member templates
+ *            we have to specialize the templated member on these
+ *            platforms. If member templates are not supported the
+ *            ST_NO_MEMBER_TEMPLATES flag has to be set. tu.
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.15  2005/09/22 20:09:20  fisyak
+ * Make AliFmLorentzVector persistent
+ *
+ * Revision 1.14  2005/07/19 22:27:11  perev
+ * Cleanup
+ *
+ * Revision 1.13  2005/07/06 18:49:57  fisyak
+ * Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
+ *
+ * Revision 1.12  2005/03/28 06:03:41  perev
+ * Defence FPE added
+ *
+ * Revision 1.11  2004/12/02 20:07:32  fine
+ * define the valid method for both flavor of AliFmThreeVector
+ *
+ * Revision 1.10  2003/10/30 20:06:46  perev
+ * Check of quality added
+ *
+ * Revision 1.9  2003/09/02 17:59:35  perev
+ * gcc 3.2 updates + WarnOff
+ *
+ * Revision 1.8  2002/06/21 17:47:37  genevb
+ * Added pseudoProduct
+ *
+ * Revision 1.7  2000/01/04 19:56:05  ullrich
+ * Added cpp macro for CINT.
+ *
+ * Revision 1.6  1999/12/21 15:14:31  ullrich
+ * Modified to cope with new compiler version on Sun (CC5.0).
+ *
+ * Revision 1.5  1999/10/15 15:46:54  ullrich
+ * Changed output format in operator<<
+ *
+ * Revision 1.4  1999/06/04 18:00:05  ullrich
+ * Added new constructor which takes C-style array as argument.
+ * New operators operator() and operator[] which can be used
+ * as lvalues.
+ *
+ * Revision 1.3  1999/02/17 11:42:19  ullrich
+ * Removed specialization for 'long double'.
+ *
+ * Revision 1.2  1999/02/14 23:11:48  fisyak
+ * Fixes for Rootcint
+ *
+ * Revision 1.1  1999/01/30 03:59:05  fisyak
+ * Root Version of AliFmarClassLibrary
+ *
+ * Revision 1.1  1999/01/23 00:28:04  ullrich
+ * Initial Revision
+ *
+ **************************************************************************/
+#ifndef ST_THREE_VECTOR_HH
+#define ST_THREE_VECTOR_HH
+#ifdef __ROOT__
+#include "Rtypes.h"
+#endif
+#ifndef __CINT__
+#include <iostream>
+#include <fstream>
+#include <math.h>
+#ifdef GNU_GCC
+#    include <stddef.h>
+#endif
+#if defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500
+#    include <stdcomp.h>
+#endif
+#ifndef ST_NO_EXCEPTIONS
+#    include <stdexcept>
+#    if !defined(ST_NO_NAMESPACES)
+using std::out_of_range;
+#    endif
+#endif
+#endif // __CINT__
+
+#ifdef WIN32
+#include "gcc2vs.h"
+#endif
+
+class TRootIOCtor;//nic nie rozumiem
+using namespace std;
+
+
+template<class T> class AliFmThreeVector {
+public:    
+    AliFmThreeVector(T = 0, T = 0, T = 0);
+  //                     ROOT_VERSION(5,03,01)
+#if ROOT_VERSION_CODE >= 328449
+   AliFmThreeVector(TRootIOCtor*) : mX1(0), mX2(0), mX3(0) {}
+#endif
+    virtual ~AliFmThreeVector();
+
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template<class X> AliFmThreeVector(const AliFmThreeVector<X>&);
+    template<class X> AliFmThreeVector(const X*);  
+    template<class X> AliFmThreeVector<T>& operator=(const AliFmThreeVector<X>&);
+    // AliFmThreeVector(const AliFmThreeVector<T>&);                use default
+    // AliFmThreeVector<T>& operator=(const AliFmThreeVector<T>&);  use default
+#else    
+    AliFmThreeVector(const AliFmThreeVector<float>&);
+    AliFmThreeVector(const AliFmThreeVector<double>&);
+    
+    AliFmThreeVector(const float*); 
+    AliFmThreeVector(const double*);
+    
+    AliFmThreeVector<T>& operator=(const AliFmThreeVector<float>&);
+    AliFmThreeVector<T>& operator=(const AliFmThreeVector<double>&);
+#endif
+    
+    void setX(T);
+    void setY(T);
+    void setZ(T);
+
+    void setPhi(T);
+    void setTheta(T);
+    void setMag(T);
+    void setMagnitude(T);
+    
+    T   x()                        const;
+    T   y()                        const;
+    T   z()                        const;
+    T   theta()                    const;
+    T   cosTheta()                 const;
+    T   phi()                      const;
+    T   perp()                     const;
+    T   perp2()                    const;
+    T   magnitude()                const;
+    T   mag()                      const;
+    T   mag2()                     const;
+    T   pseudoRapidity()           const;
+    T   operator() (size_t)        const;
+    T   operator[] (size_t)        const;
+
+    T&  operator() (size_t);
+    T&  operator[] (size_t);
+    
+    T   massHypothesis(T mass)     const;
+    
+    AliFmThreeVector<T>  unit()       const;
+    AliFmThreeVector<T>  orthogonal() const;
+
+    void  rotateX(T);
+    void  rotateY(T);
+    void  rotateZ(T);
+    
+    AliFmThreeVector<T>  operator- ();
+    AliFmThreeVector<T>  operator+ ();
+    AliFmThreeVector<T>& operator*= (double);
+    AliFmThreeVector<T>& operator/= (double);
+    AliFmThreeVector<T>  pseudoProduct(double,double,double) const;
+#ifndef ST_NO_MEMBER_TEMPLATES
+    template<class X> T                angle(const AliFmThreeVector<X>&) const;
+    template<class X> AliFmThreeVector<T> cross(const AliFmThreeVector<X>&) const;
+    template<class X> T                dot  (const AliFmThreeVector<X>&) const;
+    template<class X> AliFmThreeVector<T> pseudoProduct(const AliFmThreeVector<X>&) const;
+    
+    template<class X> bool operator == (const AliFmThreeVector<X>& v) const;
+    template<class X> bool operator != (const AliFmThreeVector<X>& v) const;
+
+    template<class X> AliFmThreeVector<T>& operator+= (const AliFmThreeVector<X>&);
+    template<class X> AliFmThreeVector<T>& operator-= (const AliFmThreeVector<X>&);
+#else    
+    T                angle(const AliFmThreeVector<float>&) const;
+    AliFmThreeVector<T> cross(const AliFmThreeVector<float>&) const;
+    T                dot  (const AliFmThreeVector<float>&) const;
+    AliFmThreeVector<T> pseudoProduct(const AliFmThreeVector<float>&) const;
+    
+    T                angle(const AliFmThreeVector<double>&) const;
+    T                dot  (const AliFmThreeVector<double>&) const;
+    AliFmThreeVector<T> cross(const AliFmThreeVector<double>&) const;
+    AliFmThreeVector<T> pseudoProduct(const AliFmThreeVector<double>&) const;
+
+    bool operator == (const AliFmThreeVector<float>& v) const;
+    bool operator != (const AliFmThreeVector<float>& v) const;
+    AliFmThreeVector<T>& operator+= (const AliFmThreeVector<float>&);
+    AliFmThreeVector<T>& operator-= (const AliFmThreeVector<float>&);
+    
+    bool operator == (const AliFmThreeVector<double>& v) const;
+    bool operator != (const AliFmThreeVector<double>& v) const;
+    AliFmThreeVector<T>& operator+= (const AliFmThreeVector<double>&);
+    AliFmThreeVector<T>& operator-= (const AliFmThreeVector<double>&);
+#endif
+  int             valid(double world = 1.e+5) const;
+    int               bad(double world = 1.e+5) const;
+protected:
+    T    mX1, mX2, mX3;
+#ifdef __ROOT__
+  ClassDef(AliFmThreeVector,3)
+#endif /* __ROOT__ */
+};
+
+#ifndef __CINT__
+//
+//        Implementation of member functions
+//
+template<class T>
+inline AliFmThreeVector<T>::AliFmThreeVector(T x, T y, T z)
+    : mX1(x), mX2(y), mX3(z) {/* nop */}
+template<class T>
+inline AliFmThreeVector<T>::~AliFmThreeVector() {/* nop */}
+
+template<class T>
+inline void AliFmThreeVector<T>::setX(T x) {mX1 = x;}
+
+template<class T>
+inline void AliFmThreeVector<T>::setY(T y) {mX2 = y;}
+
+template<class T>
+inline void AliFmThreeVector<T>::setZ(T z) {mX3 = z;}
+
+template<class T>
+void AliFmThreeVector<T>::setPhi(T angle)
+{
+    double  r = magnitude();
+    double th = theta();
+    
+    mX1 = r*sin(th)*cos(angle);
+    mX2 = r*sin(th)*sin(angle);
+}
+
+template <class T>
+void AliFmThreeVector<T>::setTheta(T angle)
+{
+    double r  = magnitude();
+    double ph = phi();
+
+    mX1 = r*sin(angle)*cos(ph);
+    mX2 = r*sin(angle)*sin(ph);
+    mX3 = r*cos(angle);
+}
+
+template <class T>
+void AliFmThreeVector<T>::setMagnitude(T r)
+{
+    double th = theta();
+    double ph = phi();
+    
+    mX1 = r*sin(th)*cos(ph);
+    mX2 = r*sin(th)*sin(ph);
+    mX3 = r*cos(th);
+}
+
+template <class T>
+void AliFmThreeVector<T>::setMag(T mag)
+{
+    setMagnitude(mag);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::x() const {return mX1;}
+
+template<class T>
+inline T AliFmThreeVector<T>::y() const {return mX2;}
+
+template<class T>
+inline T AliFmThreeVector<T>::z() const {return mX3;}
+
+template<class T>
+inline T AliFmThreeVector<T>::theta() const
+{
+  return acos(cosTheta());
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::cosTheta() const
+{
+  return mX3/(mag()+1e-20);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::phi() const
+{
+    return atan2(mX2,mX1);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::pseudoRapidity() const
+{
+    //
+    // change code to more optimal:
+    // double m = mag();
+    // return 0.5*::log( (m+z())/(m-z()) );
+    double tmp = tan(theta()/2.); if (tmp <=0.) return 1e20;
+    return -::log(tmp);
+}
+
+template<class T>
+inline AliFmThreeVector<T> AliFmThreeVector<T>::unit() const
+{
+    double tmp = mag(); if (tmp<=0.) tmp = 1e-20;
+    return *this/tmp;
+}
+
+template <class T>
+T AliFmThreeVector<T>::massHypothesis(T mass) const
+{
+    return ::sqrt((*this)*(*this) + mass*mass);
+}
+
+template <class T>
+AliFmThreeVector<T> AliFmThreeVector<T>::orthogonal() const
+{
+    // Direct copy from CLHEP--it is probably better to
+    // use your own dot/cross product code...
+    double x = (mX1 < 0.0) ? -mX1 : mX1;
+    double y = (mX2 < 0.0) ? -mX2 : mX2;
+    double z = (mX3 < 0.0) ? -mX3 : mX3;
+    
+    if(x<y)
+       return x < z ? AliFmThreeVector<T>(0,mX3,-mX2) :  AliFmThreeVector<T>(mX2,-mX1,0);
+    else
+       return  mX2 < mX3 ? AliFmThreeVector<T>(-mX3,0,mX1) :  AliFmThreeVector<T>(mX2,-mX1,0);
+}
+
+template <class T>
+void AliFmThreeVector<T>::rotateX(T angle)
+{
+    // may in the future make use of the AliFmRotation class!
+    double yPrime = cos(angle)*mX2 - sin(angle)*mX3;
+    double zPrime = sin(angle)*mX2 + cos(angle)*mX3;
+
+    mX2 = yPrime;
+    mX3 = zPrime;
+}
+
+template <class T>
+void AliFmThreeVector<T>::rotateY(T angle)
+{
+    // may in the future make use of the AliFmRotation class!
+    double zPrime = cos(angle)*mX3 - sin(angle)*mX1;
+    double xPrime = sin(angle)*mX3 + cos(angle)*mX1;
+
+    mX1 = xPrime;
+    mX3 = zPrime;
+}
+
+template <class T>
+void AliFmThreeVector<T>::rotateZ(T angle)
+{
+    // may in the future make use of the AliFmRotation class!
+    double xPrime = cos(angle)*mX1 - sin(angle)*mX2;
+    double yPrime = sin(angle)*mX1 + cos(angle)*mX2;
+
+    mX1 = xPrime;
+    mX2 = yPrime;
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::perp() const
+{
+    return ::sqrt(mX1*mX1+mX2*mX2);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::perp2() const
+{
+    return mX1*mX1+mX2*mX2;
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::magnitude() const
+{
+    return mag();
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::mag() const
+{
+    return ::sqrt(mX1*mX1+mX2*mX2+mX3*mX3);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::mag2() const
+{
+    return mX1*mX1+mX2*mX2+mX3*mX3;
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::operator() (size_t i) const
+{
+    if (0 <=i && i <= 2)  return (&mX1)[i];
+#ifndef ST_NO_EXCEPTIONS
+    throw out_of_range("AliFmThreeVector<T>::operator(): bad index");
+#else
+    cerr << "AliFmThreeVector<T>::operator(): bad index" << endl;
+#endif
+    return 0;
+}
+
+template<class T>
+inline T& AliFmThreeVector<T>::operator() (size_t i) 
+{
+    if (0 <=i && i <= 2)  return (&mX1)[i];
+#ifndef ST_NO_EXCEPTIONS
+    throw out_of_range("AliFmThreeVector<T>::operator(): bad index");
+#else
+    cerr << "AliFmThreeVector<T>::operator(): bad index" << endl;
+#endif
+    return mX1;
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::operator[] (size_t i) const
+{
+    if (0 <=i && i <= 2)  return (&mX1)[i];
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFmThreeVector<T>::operator[]: bad index"); 
+#else
+      cerr << "AliFmThreeVector<T>::operator[]: bad index" << endl;
+#endif
+      return 0;
+}
+
+template<class T>
+inline T &AliFmThreeVector<T>::operator[] (size_t i) 
+{
+    if (0 <=i && i <= 2)  return (&mX1)[i];
+#ifndef ST_NO_EXCEPTIONS
+      throw out_of_range("AliFmThreeVector<T>::operator[]: bad index"); 
+#else
+      cerr << "AliFmThreeVector<T>::operator[]: bad index" << endl;
+#endif
+      return mX1;
+}
+
+template<class T>
+inline AliFmThreeVector<T>& AliFmThreeVector<T>::operator*= (double c)
+{
+    mX1 *= c; mX2 *= c; mX3 *= c;
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>& AliFmThreeVector<T>::operator/= (double c)
+{
+    mX1 /= c; mX2 /= c; mX3 /= c;
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::pseudoProduct(double x,double y,double z) const
+{
+    return AliFmThreeVector<T>(mX1*x,mX2*y,mX3*z);
+}
+
+template<class T>
+AliFmThreeVector<T> AliFmThreeVector<T>::operator- ()
+{
+    return AliFmThreeVector<T>(-mX1, -mX2, -mX3);
+}
+
+template<class T>
+AliFmThreeVector<T> AliFmThreeVector<T>::operator+ ()
+{
+    return *this;
+}
+
+#ifndef ST_NO_MEMBER_TEMPLATES
+#ifndef WIN32
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<X>& v)
+    : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>::AliFmThreeVector(const X *a)
+{
+    mX1 = a[0];
+    mX2 = a[1];
+    mX3 = a[2];
+}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator=(const AliFmThreeVector<X>& v)
+{
+    mX1 = v.x();  mX2 = v.y();  mX3 = v.z();
+    return *this;
+}
+
+template<class T>
+template<class X>
+inline bool AliFmThreeVector<T>::operator== (const AliFmThreeVector<X>& v) const
+{
+    return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
+}
+
+template<class T>
+template<class X>
+inline bool AliFmThreeVector<T>::operator!= (const AliFmThreeVector<X>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator+= (const AliFmThreeVector<X>& v)
+{
+    mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
+    return *this;
+}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator-= (const AliFmThreeVector<X>& v)
+{
+    mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
+    return *this;
+}
+
+template<class T>
+template<class X>
+inline T AliFmThreeVector<T>::dot(const AliFmThreeVector<X>& v) const
+{
+    return mX1*v.x() + mX2*v.y() + mX3*v.z();
+}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::cross(const AliFmThreeVector<X>& v) const
+{
+    return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
+                           mX3*v.x() - mX1*v.z(),
+                           mX1*v.y() - mX2*v.x());
+}
+
+template<class T>
+template<class X>
+inline T AliFmThreeVector<T>::angle(const AliFmThreeVector<X>& vec) const
+{
+    double norm = this->mag2()*vec.mag2(); 
+    
+    return norm > 0 ? acos(this->dot(vec)/(::sqrt(norm))) : 0;
+}
+
+template<class T>
+template<class X>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::pseudoProduct(const AliFmThreeVector<X>& v) const
+{
+    return this->pseudoProduct(v.x(),v.y(),v.z());
+}
+
+#endif
+#else
+
+template<class T>
+inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<float>& v)
+    : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
+
+template<class T>
+inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<double>& v)
+    : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
+
+template<class T>
+inline AliFmThreeVector<T>::AliFmThreeVector(const float *a)
+{
+    mX1 = a[0];
+    mX2 = a[1];
+    mX3 = a[2];
+}
+
+template<class T>
+inline AliFmThreeVector<T>::AliFmThreeVector(const double *a)
+{
+    mX1 = a[0];
+    mX2 = a[1];
+    mX3 = a[2];
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator=(const AliFmThreeVector<float>& v)
+{
+    mX1 = v.x();  mX2 = v.y();  mX3 = v.z();
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator=(const AliFmThreeVector<double>& v)
+{
+    mX1 = v.x();  mX2 = v.y();  mX3 = v.z();
+    return *this;
+}
+
+template<class T>
+inline bool
+AliFmThreeVector<T>::operator== (const AliFmThreeVector<float>& v) const
+{
+    return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
+}
+
+template<class T>
+inline bool
+AliFmThreeVector<T>::operator== (const AliFmThreeVector<double>& v) const
+{
+    return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
+}
+
+template<class T>
+inline bool
+AliFmThreeVector<T>::operator!= (const AliFmThreeVector<float>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+inline bool
+AliFmThreeVector<T>::operator!= (const AliFmThreeVector<double>& v) const
+{
+    return !(*this == v);
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator+= (const AliFmThreeVector<float>& v)
+{
+    mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator+= (const AliFmThreeVector<double>& v)
+{
+    mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator-= (const AliFmThreeVector<float>& v)
+{
+    mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
+    return *this;
+}
+
+template<class T>
+inline AliFmThreeVector<T>&
+AliFmThreeVector<T>::operator-= (const AliFmThreeVector<double>& v)
+{
+    mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
+    return *this;
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::dot(const AliFmThreeVector<float>& v) const
+{
+    return mX1*v.x() + mX2*v.y() + mX3*v.z();
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::dot(const AliFmThreeVector<double>& v) const
+{
+    return mX1*v.x() + mX2*v.y() + mX3*v.z();
+}
+
+template<class T>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::cross(const AliFmThreeVector<float>& v) const
+{
+    return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
+                           mX3*v.x() - mX1*v.z(),
+                           mX1*v.y() - mX2*v.x());
+}
+
+template<class T>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::cross(const AliFmThreeVector<double>& v) const
+{
+    return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
+                           mX3*v.x() - mX1*v.z(),
+                           mX1*v.y() - mX2*v.x());
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::angle(const AliFmThreeVector<float>& v) const
+{
+    double tmp = mag()*v.mag(); if (tmp <=0) tmp = 1e-20;
+    return acos(this->dot(v)/tmp);
+}
+
+template<class T>
+inline T AliFmThreeVector<T>::angle(const AliFmThreeVector<double>& v) const
+{
+    double tmp = mag()*v.mag(); if (tmp <=0) tmp = 1e-20;
+    return acos(this->dot(v)/tmp);
+}
+
+template<class T>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::pseudoProduct(const AliFmThreeVector<float>& v) const
+{
+    return this->pseudoProduct(v.x(),v.y(),v.z());
+}
+
+template<class T>
+inline AliFmThreeVector<T>
+AliFmThreeVector<T>::pseudoProduct(const AliFmThreeVector<double>& v) const
+{
+    return this->pseudoProduct(v.x(),v.y(),v.z());
+}
+#endif  // ST_NO_MEMBER_TEMPLATES
+template<class T>
+inline int
+AliFmThreeVector<T>::valid(double world) const  {return !bad(world);}
+
+template<class T>
+inline int
+AliFmThreeVector<T>::bad(double world) const
+{
+  for (int i=0;i<3;i++) {
+         if (!finite((&mX1)[i])      ) return 10+i;            
+         if ( fabs  ((&mX1)[i])>world) return 20+i;            
+  }            
+  return 0;            
+}
+#endif /*! __CINT__ */
+#ifdef __CINT__
+template<> float abs(const AliFmThreeVector<float>& v);
+template<> double abs(const AliFmThreeVector<double>& v);
+template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  cross_product(const AliFmThreeVector<float>&  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<float>&  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  operator+ (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  operator- (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  operator* (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> operator* (const double                 v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<float>&  v1, const double v2);
+template<> AliFmThreeVector<double> operator* (const double                 v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const double v2);
+template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  operator/ (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<float>&  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<double> operator/ (const                double  v1, const AliFmThreeVector<double>& v2);
+template<> AliFmThreeVector<float>  operator/ (const                double  v1, const AliFmThreeVector<float>& v2);
+template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const double v2);
+template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<float>&  v1, const double v2);
+template<> istream&  operator>>(istream& is,const AliFmThreeVector<double>& v);
+template<> istream&  operator>>(istream& is,const AliFmThreeVector<float>& v);
+template<> ostream&  operator<<(ostream& os,const AliFmThreeVector<double>& v);
+template<> ostream&  operator<<(ostream& os,const AliFmThreeVector<float>& v);
+#else
+//
+//        Non-member functions
+//
+template<class T>
+inline T abs(const AliFmThreeVector<T>& v) {return v.mag();}
+
+template<class T, class X>
+inline AliFmThreeVector<T>
+cross_product(const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
+{
+    return v1.cross(v2);
+}
+
+
+//
+//        Non-member operators
+//
+template<class T, class X>
+inline AliFmThreeVector<T>
+operator+ (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
+{
+    return AliFmThreeVector<T>(v1) += v2;
+}
+
+template<class T, class X>
+inline AliFmThreeVector<T>
+operator- (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
+{
+    return AliFmThreeVector<T>(v1) -= v2;
+}
+
+template<class T, class X>
+inline T operator* (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
+{
+    return AliFmThreeVector<T>(v1).dot(v2);
+}
+
+template<class T>
+inline AliFmThreeVector<T> operator* (const AliFmThreeVector<T>& v, double c)
+{
+    return AliFmThreeVector<T>(v) *= c;
+}
+
+template<class T>
+inline AliFmThreeVector<T> operator* (double c, const AliFmThreeVector<T>& v)
+{
+    return AliFmThreeVector<T>(v) *= c;
+}
+
+template<class T, class X>
+inline AliFmThreeVector<T> operator/ (const AliFmThreeVector<T>& v, X c)
+{
+    return AliFmThreeVector<T>(v) /= c;
+}
+
+template<class T>
+ostream&  operator<<(ostream& os, const AliFmThreeVector<T>& v)
+{
+    return os << v.x() << '\t' << v.y() << '\t' << v.z();
+}
+
+template<class T>
+istream&  operator>>(istream& is, AliFmThreeVector<T>& v)
+{
+    T  x, y, z;
+    is >> x >> y >> z;
+    v.setX(x);
+    v.setY(y);
+    v.setZ(z);
+    return is;
+}
+#endif /* ! __CINT__ */
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmThreeVectorD.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmThreeVectorD.h
new file mode 100644 (file)
index 0000000..906f5aa
--- /dev/null
@@ -0,0 +1,17 @@
+/***************************************************************************
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.11  2005/07/06 18:49:57  fisyak
+ * Replace AliFemtoHelixD, AliFemtoLorentzVectorD,AliFemtoLorentzVectorF,AliFemtoMatrixD,AliFemtoMatrixF,AliFemtoPhysicalHelixD,AliFemtoThreeVectorD,AliFemtoThreeVectorF by templated version
+ *
+
+****************************************************************************/
+#ifndef ALIFM_THREE_VECTOR_D_HH
+#define ALIFM_THREE_VECTOR_D_HH
+#include "AliFmThreeVector.h"
+typedef AliFmThreeVector<double> AliFmThreeVectorD;
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmThreeVectorF.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmThreeVectorF.h
new file mode 100644 (file)
index 0000000..e9f1582
--- /dev/null
@@ -0,0 +1,27 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Thomas Ullrich, Jan 1999
+ ***************************************************************************
+ *
+ * Description:  
+ *
+ * Remarks:   This is a 'handmade' specialisation of AliFmThreeVector<T>
+ *            for T=float. This code contains no templates.
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.14  2005/07/06 18:49:57  fisyak
+ * Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
+ *
+ ****************************************************************************/
+#ifndef ST_THREE_VECTOR_F_HH
+#define ST_THREE_VECTOR_F_HH
+#include "AliFmThreeVector.h"
+typedef  AliFmThreeVector<float> AliFmThreeVectorF;
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/TpcLocalTransform.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/TpcLocalTransform.cxx
new file mode 100644 (file)
index 0000000..817636e
--- /dev/null
@@ -0,0 +1,89 @@
+
+#include "AliFmThreeVectorD.h"
+// - not needed (which is good because we want no STAR-dependence! 25apr2006) - #include "StEvent/StTpcHit.h"
+#include "TMath.h"
+
+
+//__________________________________
+
+
+
+int TpcLocalTransform(AliFmThreeVectorD& aPoint, int& aSector, int& aRow, 
+                     float& aU, double& aPhi){
+  static int tNPadAtRow[45]={
+  88,96,104,112,118,126,134,142,150,158,166,174,182,
+  98,100,102,104,106,106,108,110,112,112,114,116,118,120,122,122,
+  124,126,128,128,130,132,134,136,138,138,140,142,144,144,144,144};
+  static double tSectToPhi[24]={2.,1.,0.,11.,10.,9.,8. ,7. ,6.,5.,4.,3.,
+                               4.,5.,6., 7., 8.,9.,10.,11.,0.,1.,2.,3.};
+  //static double tPhiToSect[24]={2.,1.,0.,11.,10.,9.,8. ,7. ,6.,5.,4.,3.,
+       //                      4.,5.,6., 7., 8.,9.,10.,11.,0.,1.,2.,3.};
+  static double tPadWidthInner = 0.335;
+  static double tPadWidthOuter = 0.67;
+
+  static double tPi = TMath::Pi();
+  // --- find sector number
+  aPhi = aPoint.phi();
+  if(aPhi<0.) aPhi+=(2*tPi);
+  aPhi += tPi/12.;
+  if(aPhi>2*tPi) aPhi-=2*tPi;
+  int tiPhi = (int) (aPhi/tPi*6.);
+  if(aPoint.z()<0) {
+    aSector = (tiPhi<3)? 3-tiPhi : 15-tiPhi;
+  }
+  else{
+    aSector = (tiPhi<4)? 21+tiPhi : 9+tiPhi;
+  }
+  aPhi = tSectToPhi[aSector-1]*tPi/6.;
+  //if((fabs(aPhi-aPoint.phi())>(tPi/12)){
+  //cout << "Sector missmatch " << aPhi << " " << aPoint.phi() << " "
+  // << aSector << endl;
+  //}
+
+  // --- calculate local coordinate
+  float tR = aPoint.x()*cos(aPhi)+aPoint.y()*sin(aPhi);
+  aU =      -aPoint.x()*sin(aPhi)+aPoint.y()*cos(aPhi);
+
+  // --- find pad row 
+  if(tR<57.6) {
+    aRow = 0;
+    return 1;
+  }
+  float radmax = 62.4;
+  float spacing= 4.8;
+  aRow=1;
+  while(tR>radmax && aRow<46){
+    aRow++;
+    if(aRow==8){
+      radmax = 96.2;
+      spacing = 5.2;
+    }
+    else{
+      if (aRow==13){
+       radmax = 126.195; // lots of stuf in row 13!
+       spacing = 2.0;
+      }
+      else{
+       radmax+=spacing;
+      }
+    }
+  }
+  if(aRow>45){
+    //cout << "No pad row " << tR << endl;
+    return 2;
+  }
+  
+  // --- Check if u (=aU) inbound
+  double tPadWidth = aRow<14? tPadWidthInner : tPadWidthOuter;
+  if(fabs(aU) > tNPadAtRow[aRow-1]*tPadWidth/2.){
+    return 3;
+  }
+
+  return 0;
+}
+
+
+
+
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/TpcLocalTransform.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/TpcLocalTransform.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/phys_constants.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/phys_constants.h
new file mode 100644 (file)
index 0000000..adf5931
--- /dev/null
@@ -0,0 +1,21 @@
+// malisa - there was somewhere a "phys_constants.h" in the STAR hierarchy
+// the Strangeness HBT guys used very little of it, so I just put that stuff
+// in here...
+
+#ifndef _StHbt_phys_constants_h_
+#define _StHbt_phys_constants_h_
+
+#include "PhysicalConstants.h"  // from StarClassLibrary
+
+// the strangeness guys used a different naming system (of course)
+static const double M_LAMBDA        = lambda_mass_c2;
+static const double M_KAON_0_SHORT  = kaon_0_short_mass_c2;
+static const double M_PROTON        = proton_mass_c2;
+static const double M_PION_PLUS     = pion_plus_mass_c2;
+static const double M_PION_MINUS    = pion_minus_mass_c2;
+static const double M_XI_MINUS      = xi_minus_mass_c2;
+static const double M_OMEGA_MINUS   = 1672.45;
+static const double M_KAON_MINUS    = 493.677;
+static const double M_KAON_PLUS     = 493.677;
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.cxx b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.cxx
new file mode 100644 (file)
index 0000000..fdeea3d
--- /dev/null
@@ -0,0 +1,376 @@
+/*
+ *$Id$
+ *$Log$
+ *Revision 1.5  2007-04-03 16:00:08  mchojnacki
+ *Changes to iprove memory managing
+ *
+ *Revision 1.4  2007/03/13 15:30:03  mchojnacki
+ *adding reader for simulated data
+ *
+ *Revision 1.3  2007/03/08 14:58:03  mchojnacki
+ *adding some alice stuff
+ *
+ *Revision 1.2  2007/03/07 13:36:16  mchojnacki
+ *Add some comments
+ *
+ *Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ *First version on CVS
+ *
+ */
+
+#include "AliFemtoEventReaderESD.h"
+
+#include "TFile.h"
+#include "TTree.h"
+#include "AliESD.h"
+#include "AliESDtrack.h"
+
+//#include "TSystem.h"
+
+#include "AliFmPhysicalHelixD.h"
+#include "AliFmThreeVectorF.h"
+
+#include "SystemOfUnits.h"
+
+#include "AliFemtoEvent.h"
+
+ClassImp(AliFemtoEventReaderESD)
+
+#if !(ST_NO_NAMESPACES)
+  using namespace units;
+#endif
+
+using namespace std;
+//____________________________
+//constructor with 0 parameters , look at default settings 
+AliFemtoEventReaderESD::AliFemtoEventReaderESD():
+  fInputFile(" "),
+  fFileName(" "),
+  fConstrained(true),
+  fNumberofEvent(0),
+  fCurEvent(0),
+  fCurFile(0),
+  fTree(0x0),
+  fEvent(0x0),
+  fEsdFile(0x0),
+  fEventFriend(0)
+{
+  fClusterPerPadrow = (list<Int_t> **) malloc(sizeof(list<Int_t> *) * AliESDfriendTrack::kMaxTPCcluster);
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fClusterPerPadrow[tPad] = new list<Int_t>();
+  }
+  fSharedList = (list<Int_t> **) malloc(sizeof(list<Int_t> *) * AliESDfriendTrack::kMaxTPCcluster);
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fSharedList[tPad] = new list<Int_t>();
+  }
+}
+
+//__________________
+//Destructor
+AliFemtoEventReaderESD::~AliFemtoEventReaderESD()
+{
+  //delete fListOfFiles;
+  delete fTree;
+  delete fEvent;
+  delete fEsdFile;
+
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fClusterPerPadrow[tPad]->clear();
+    delete fClusterPerPadrow[tPad];
+  }
+  delete [] fClusterPerPadrow;
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fSharedList[tPad]->clear();
+    delete fSharedList[tPad];
+  }
+  delete [] fSharedList;
+}
+
+//__________________
+AliFemtoString AliFemtoEventReaderESD::Report()
+{
+  AliFemtoString temp = "\n This is the AliFemtoEventReaderESD\n";
+  return temp;
+}
+
+//__________________
+//setting the name of file where names of ESD file are written 
+//it takes only this files which have good trees
+void AliFemtoEventReaderESD::SetInputFile(const char* inputFile)
+{
+  char buffer[256];
+  fInputFile=string(inputFile);
+  cout<<"Input File set on "<<fInputFile<<endl;
+  ifstream infile(inputFile);
+  if(infile.good()==true)
+    { 
+      //checking if all give files have good tree inside
+      while (infile.eof()==false)
+       {
+         infile.getline(buffer,256);
+         //ifstream test_file(buffer);
+         TFile *esdFile=TFile::Open(buffer,"READ");
+         if (esdFile!=0x0)
+           {   
+             TTree* tree = (TTree*) esdFile->Get("esdTree");
+             if (tree!=0x0)
+               {
+                 cout<<"putting file  "<<string(buffer)<<" into analysis"<<endl;
+                 fListOfFiles.push_back(string(buffer));
+                 delete tree;
+               }
+             esdFile->Close(); 
+           }
+         delete esdFile;
+       }
+    }
+}
+
+//setting the next file to read        
+bool AliFemtoEventReaderESD::GetNextFile()
+{      
+  if (fCurFile>=fListOfFiles.size())
+    return false;
+  fFileName=fListOfFiles.at(fCurFile); 
+  cout<<"FileName set on "<<fFileName<<" "<<fCurFile<<endl;
+
+  fCurFile++;
+  return true;
+}
+void AliFemtoEventReaderESD::SetConstrained(const bool constrained)
+{
+  fConstrained=constrained;
+}
+
+bool AliFemtoEventReaderESD::GetConstrained() const
+{
+  return fConstrained;
+}
+
+AliFemtoEvent* AliFemtoEventReaderESD::ReturnHbtEvent()
+{
+  AliFemtoEvent *hbtEvent = 0;
+  string tFriendFileName;
+
+  if (fCurEvent==fNumberofEvent)//open next file  
+    {
+      cout<<"next file"<<endl;
+      if(GetNextFile())        
+       {
+         delete fEventFriend;
+         fEventFriend = 0;
+         delete fEvent;//added 1.04.2007
+         fEvent=new AliESD();
+         delete fTree;
+         //fTree=0;
+         delete fEsdFile;
+               
+         //ESD data
+         fEsdFile=TFile::Open(fFileName.c_str(),"READ");
+         fTree = (TTree*) fEsdFile->Get("esdTree");                    
+         fTree->SetBranchAddress("ESD", &fEvent);                      
+
+         // Attach the friend tree with additional information
+         tFriendFileName = fFileName;
+         tFriendFileName.insert(tFriendFileName.find("s.root"),"friend");
+         cout << "Reading friend " << tFriendFileName.c_str() << endl;;
+         fTree->AddFriend("esdFriendTree",tFriendFileName.c_str());
+         fTree->SetBranchAddress("ESDfriend",&fEventFriend);
+
+         fNumberofEvent=fTree->GetEntries();
+         cout<<"Number of Entries in file "<<fNumberofEvent<<endl;
+         fCurEvent=0;
+         //sim data
+       }
+      else //no more data to read
+       {
+         cout<<"no more files "<<hbtEvent<<endl;
+         fReaderStatus=1;
+         return hbtEvent; 
+       }
+    }          
+  cout<<"starting to read event "<<fCurEvent<<endl;
+  fTree->GetEvent(fCurEvent);//getting next event
+  fEvent->SetESDfriend(fEventFriend);
+  vector<int> label_table;//to check labels
+       
+  hbtEvent = new AliFemtoEvent;
+  //setting basic things
+  hbtEvent->SetEventNumber(fEvent->GetEventNumber());
+  hbtEvent->SetRunNumber(fEvent->GetRunNumber());
+  //hbtEvent->SetNumberOfTracks(fEvent->GetNumberOfTracks());
+  hbtEvent->SetMagneticField(fEvent->GetMagneticField()*kilogauss);//to check if here is ok
+  hbtEvent->SetZDCN1Energy(fEvent->GetZDCN1Energy());
+  hbtEvent->SetZDCP1Energy(fEvent->GetZDCP1Energy());
+  hbtEvent->SetZDCN2Energy(fEvent->GetZDCN2Energy());
+  hbtEvent->SetZDCP2Energy(fEvent->GetZDCP2Energy());
+  hbtEvent->SetZDCEMEnergy(fEvent->GetZDCEMEnergy());
+  hbtEvent->SetZDCParticipants(fEvent->GetZDCParticipants());
+  hbtEvent->SetTriggerMask(fEvent->GetTriggerMask());
+  hbtEvent->SetTriggerCluster(fEvent->GetTriggerCluster());
+       
+  //Vertex
+  double fV1[3];
+  fEvent->GetVertex()->GetXYZ(fV1);
+
+  AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
+  hbtEvent->SetPrimVertPos(vertex);
+       
+  //starting to reading tracks
+  int nofTracks=0;  //number of reconstructed tracks in event
+  nofTracks=fEvent->GetNumberOfTracks();
+  int realnofTracks=0;//number of track which we use ina analysis
+
+  // Clear the shared cluster list
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fClusterPerPadrow[tPad]->clear();
+  }
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fSharedList[tPad]->clear();
+  }
+
+
+  for (int i=0;i<nofTracks;i++) {
+    const AliESDtrack *esdtrack=fEvent->GetTrack(i);//getting next track
+
+    list<Int_t>::iterator tClustIter;
+
+    Int_t tTrackIndices[AliESDfriendTrack::kMaxTPCcluster];
+    Int_t tNClusters = esdtrack->GetTPCclusters(tTrackIndices);
+    for (int tNcl=0; tNcl<AliESDfriendTrack::kMaxTPCcluster; tNcl++) {
+      if (tTrackIndices[tNcl] >= 0) {
+       tClustIter = find(fClusterPerPadrow[tNcl]->begin(), fClusterPerPadrow[tNcl]->end(), tTrackIndices[tNcl]);
+       if (tClustIter == fClusterPerPadrow[tNcl]->end()) {
+         fClusterPerPadrow[tNcl]->push_back(tTrackIndices[tNcl]);
+       }
+       else {
+         fSharedList[tNcl]->push_back(tTrackIndices[tNcl]);
+       }
+      }
+    }
+      
+  }
+
+  for (int i=0;i<nofTracks;i++)
+    {
+      bool  good_momentum=true; //flaga to chcek if we can read momentum of this track
+               
+      AliFemtoTrack* trackCopy = new AliFemtoTrack();  
+      const AliESDtrack *esdtrack=fEvent->GetTrack(i);//getting next track
+      const AliESDfriendTrack *tESDfriendTrack = esdtrack->GetFriendTrack();
+
+      trackCopy->SetCharge((short)esdtrack->GetSign());
+
+      //in aliroot we have AliPID 
+      //0-electron 1-muon 2-pion 3-kaon 4-proton 5-photon 6-pi0 7-neutron 8-kaon0 9-eleCon   
+      //we use only 5 first
+      double esdpid[5];
+      esdtrack->GetESDpid(esdpid);
+      trackCopy->SetPidProbElectron(esdpid[0]);
+      trackCopy->SetPidProbMuon(esdpid[1]);
+      trackCopy->SetPidProbPion(esdpid[2]);
+      trackCopy->SetPidProbKaon(esdpid[3]);
+      trackCopy->SetPidProbProton(esdpid[4]);
+                                               
+      double pxyz[3];
+      if (fConstrained==true)              
+       good_momentum=esdtrack->GetConstrainedPxPyPz(pxyz); //reading constrained momentum
+      else
+       good_momentum=esdtrack->GetPxPyPz(pxyz);//reading noconstarined momentum
+      AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
+      trackCopy->SetP(v);//setting momentum
+      trackCopy->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
+      const AliFmThreeVectorD p(pxyz[0],pxyz[1],pxyz[2]);
+      if (p.mag() == 0) {
+       delete trackCopy;
+       continue;
+      }
+      const AliFmThreeVectorD origin(fV1[0],fV1[1],fV1[2]);
+      //setting helix I do not if it is ok
+      AliFmPhysicalHelixD helix(p,origin,(double)(fEvent->GetMagneticField())*kilogauss,(double)(trackCopy->Charge())); 
+      trackCopy->SetHelix(helix);
+               
+      trackCopy->SetTrackId(esdtrack->GetID());
+      trackCopy->SetFlags(esdtrack->GetStatus());
+      //trackCopy->SetLabel(esdtrack->GetLabel());
+               
+      //some stuff which could be useful 
+      float impact[2];
+      float covimpact[3];
+      esdtrack->GetImpactParameters(impact,covimpact);
+      trackCopy->SetImpactD(impact[0]);
+      trackCopy->SetImpactZ(impact[1]);
+      trackCopy->SetCdd(covimpact[0]);
+      trackCopy->SetCdz(covimpact[1]);
+      trackCopy->SetCzz(covimpact[2]);
+      trackCopy->SetITSchi2(esdtrack->GetITSchi2());    
+      trackCopy->SetITSncls(esdtrack->GetNcls(0));     
+      trackCopy->SetTPCchi2(esdtrack->GetTPCchi2());       
+      trackCopy->SetTPCncls(esdtrack->GetTPCNcls());       
+      trackCopy->SetTPCnclsF(esdtrack->GetTPCNclsF());      
+      trackCopy->SetTPCsignalN((short)esdtrack->GetTPCsignalN()); //due to bug in aliesdtrack class   
+      trackCopy->SetTPCsignalS(esdtrack->GetTPCsignalSigma()); 
+
+      // Fill cluster per padrow information
+      Int_t tTrackIndices[AliESDfriendTrack::kMaxTPCcluster];
+      Int_t tNClusters = esdtrack->GetTPCclusters(tTrackIndices);
+      for (int tNcl=0; tNcl<AliESDfriendTrack::kMaxTPCcluster; tNcl++) {
+       if (tTrackIndices[tNcl] > 0)
+         trackCopy->SetTPCcluster(tNcl, 1);
+       else
+         trackCopy->SetTPCcluster(tNcl, 0);
+      }
+      
+      // Fill shared cluster information
+      list<Int_t>::iterator tClustIter;
+
+      for (int tNcl=0; tNcl<AliESDfriendTrack::kMaxTPCcluster; tNcl++) {
+       if (tTrackIndices[tNcl] > 0) {
+         tClustIter = find(fSharedList[tNcl]->begin(), fSharedList[tNcl]->end(), tTrackIndices[tNcl]);
+         if (tClustIter != fSharedList[tNcl]->end()) {
+           trackCopy->SetTPCshared(tNcl, 1);
+           cout << "Event next" <<  endl;
+           cout << "Track: " << i << endl;
+           cout << "Shared cluster: " << tNcl << " " << tTrackIndices[tNcl] << endl;
+         }
+         else {
+           trackCopy->SetTPCshared(tNcl, 0);
+         }
+       }
+      }
+
+      //decision if we want this track
+      //if we using diffrent labels we want that this label was use for first time 
+      //if we use hidden info we want to have match between sim data and ESD
+      if (good_momentum==true)
+       {
+         hbtEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
+         realnofTracks++;//real number of tracks
+       }
+      else
+       {
+         delete  trackCopy;
+       }
+               
+    }
+
+  hbtEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event  
+  fCurEvent++; 
+  cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
+  if (fCurEvent== fNumberofEvent)//if end of current file close all
+    {   
+      fTree->Reset(); 
+      delete fTree;
+      fEsdFile->Close();
+    }
+  return hbtEvent; 
+}
+
+
+
+
+
+
+
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.h b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.h
new file mode 100644 (file)
index 0000000..3f27d17
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ *$Id$
+ *$Log$
+ *Revision 1.3  2007/03/13 15:30:03  mchojnacki
+ *adding reader for simulated data
+ *
+ *Revision 1.2  2007/03/07 13:36:17  mchojnacki
+ *Add some comments
+ *
+ *Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ *First version on CVS
+ *
+ */
+  
+
+#ifndef AliFemtoEventReaderESD_hh
+#define AliFemtoEventReaderESD_hh
+//Reader for ESD files for StHbt version 10 with hidden info part
+//made by Marek Chojnacki mchojnacki@knf.pw.edu.pl
+// Version 11 Added AliESDfriend reading
+// Adam Kisiel kisiel@mps.ohio-state.edu
+#include "AliFemtoEventReader.h"
+#include "AliFemtoEnumeration.h"
+
+#include <string>
+#include <vector>
+#include "TTree.h"
+#include "AliESD.h"
+#include "AliESDfriend.h"
+#include <list>
+
+class AliFemtoEvent;
+
+class AliFemtoEventReaderESD : public AliFemtoEventReader 
+{
+ public:
+  AliFemtoEventReaderESD();
+  ~AliFemtoEventReaderESD();
+  AliFemtoEvent* ReturnHbtEvent();
+  AliFemtoString Report();
+  //void SetFileName(const char* fileName);
+  void SetInputFile(const char* inputFile);
+  void SetConstrained(const bool constrained);
+  bool GetConstrained() const;
+
+ protected:
+
+ private:
+  bool           GetNextFile();//setting next file to read 
+
+  string         fInputFile; //name of input file
+  string         fFileName; //name of current ESD file
+  bool           fConstrained; //flag to set which momentum from ESD file will be use
+  int            fNumberofEvent;//number of Events in ESD file
+  int            fCurEvent; //number of current event
+  unsigned int   fCurFile; //number of current file
+  vector<string> fListOfFiles;//list of ESD files              
+  TTree*         fTree;//ESD tree
+  AliESD*        fEvent;//ESD event
+  TFile*         fEsdFile;//ESD file 
+  AliESDfriend*  fEventFriend;
+
+  list<Int_t>  **fSharedList;
+  list<Int_t>  **fClusterPerPadrow;
+               
+#ifdef __ROOT__
+  ClassDef(AliFemtoEventReaderESD, 10)
+#endif
+
+    };
+  
+#endif
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.cxx b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.cxx
new file mode 100644 (file)
index 0000000..2ec84aa
--- /dev/null
@@ -0,0 +1,282 @@
+#include "AliFemtoEventReaderESDChain.h"
+
+#include "TFile.h"
+#include "TTree.h"
+#include "AliESD.h"
+#include "AliESDtrack.h"
+
+#include "AliFmPhysicalHelixD.h"
+#include "AliFmThreeVectorF.h"
+
+#include "SystemOfUnits.h"
+
+#include "AliFemtoEvent.h"
+
+ClassImp(AliFemtoEventReaderESDChain)
+
+#if !(ST_NO_NAMESPACES)
+  using namespace units;
+#endif
+
+using namespace std;
+//____________________________
+//constructor with 0 parameters , look at default settings 
+AliFemtoEventReaderESDChain::AliFemtoEventReaderESDChain():
+  fFileName(" "),
+  fConstrained(true),
+  fNumberofEvent(0),
+  fCurEvent(0),
+  fCurFile(0),
+  fEvent(0x0),
+  fEventFriend(0)
+{
+  fClusterPerPadrow = (list<Int_t> **) malloc(sizeof(list<Int_t> *) * AliESDfriendTrack::kMaxTPCcluster);
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fClusterPerPadrow[tPad] = new list<Int_t>();
+  }
+  fSharedList = (list<Int_t> **) malloc(sizeof(list<Int_t> *) * AliESDfriendTrack::kMaxTPCcluster);
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fSharedList[tPad] = new list<Int_t>();
+  }
+}
+
+//__________________
+//Destructor
+AliFemtoEventReaderESDChain::~AliFemtoEventReaderESDChain()
+{
+  delete fEvent;
+
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fClusterPerPadrow[tPad]->clear();
+    delete fClusterPerPadrow[tPad];
+  }
+  delete [] fClusterPerPadrow;
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fSharedList[tPad]->clear();
+    delete fSharedList[tPad];
+  }
+  delete [] fSharedList;
+}
+
+//__________________
+// Simple report
+AliFemtoString AliFemtoEventReaderESDChain::Report()
+{
+  AliFemtoString temp = "\n This is the AliFemtoEventReaderESDChain\n";
+  return temp;
+}
+
+//__________________
+// Select whether to read constrained or not constrained momentum
+void AliFemtoEventReaderESDChain::SetConstrained(const bool constrained)
+{
+  fConstrained=constrained;
+}
+//__________________
+// Check whether we read constrained or not constrained momentum
+bool AliFemtoEventReaderESDChain::GetConstrained() const
+{
+  return fConstrained;
+}
+//__________________
+AliFemtoEvent* AliFemtoEventReaderESDChain::ReturnHbtEvent()
+{
+  // Get the event, read all the relevant information
+  // and fill the AliFemtoEvent class
+  // Returns a valid AliFemtoEvent
+  AliFemtoEvent *hbtEvent = 0;
+  string tFriendFileName;
+
+  // Get the friend information
+  cout<<"starting to read event "<<fCurEvent<<endl;
+  fEvent->SetESDfriend(fEventFriend);
+  vector<int> label_table;//to check labels
+       
+  hbtEvent = new AliFemtoEvent;
+  //setting basic things
+  hbtEvent->SetEventNumber(fEvent->GetEventNumber());
+  hbtEvent->SetRunNumber(fEvent->GetRunNumber());
+  //hbtEvent->SetNumberOfTracks(fEvent->GetNumberOfTracks());
+  hbtEvent->SetMagneticField(fEvent->GetMagneticField()*kilogauss);//to check if here is ok
+  hbtEvent->SetZDCN1Energy(fEvent->GetZDCN1Energy());
+  hbtEvent->SetZDCP1Energy(fEvent->GetZDCP1Energy());
+  hbtEvent->SetZDCN2Energy(fEvent->GetZDCN2Energy());
+  hbtEvent->SetZDCP2Energy(fEvent->GetZDCP2Energy());
+  hbtEvent->SetZDCEMEnergy(fEvent->GetZDCEMEnergy());
+  hbtEvent->SetZDCParticipants(fEvent->GetZDCParticipants());
+  hbtEvent->SetTriggerMask(fEvent->GetTriggerMask());
+  hbtEvent->SetTriggerCluster(fEvent->GetTriggerCluster());
+       
+  //Vertex
+  double fV1[3];
+  fEvent->GetVertex()->GetXYZ(fV1);
+
+  AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
+  hbtEvent->SetPrimVertPos(vertex);
+       
+  //starting to reading tracks
+  int nofTracks=0;  //number of reconstructed tracks in event
+  nofTracks=fEvent->GetNumberOfTracks();
+  int realnofTracks=0;//number of track which we use ina analysis
+
+  // Clear the shared cluster list
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fClusterPerPadrow[tPad]->clear();
+  }
+  for (int tPad=0; tPad<AliESDfriendTrack::kMaxTPCcluster; tPad++) {
+    fSharedList[tPad]->clear();
+  }
+
+
+  for (int i=0;i<nofTracks;i++) {
+    const AliESDtrack *esdtrack=fEvent->GetTrack(i);//getting next track
+
+    list<Int_t>::iterator tClustIter;
+
+    Int_t tTrackIndices[AliESDfriendTrack::kMaxTPCcluster];
+    Int_t tNClusters = esdtrack->GetTPCclusters(tTrackIndices);
+    for (int tNcl=0; tNcl<AliESDfriendTrack::kMaxTPCcluster; tNcl++) {
+      if (tTrackIndices[tNcl] >= 0) {
+       tClustIter = find(fClusterPerPadrow[tNcl]->begin(), fClusterPerPadrow[tNcl]->end(), tTrackIndices[tNcl]);
+       if (tClustIter == fClusterPerPadrow[tNcl]->end()) {
+         fClusterPerPadrow[tNcl]->push_back(tTrackIndices[tNcl]);
+       }
+       else {
+         fSharedList[tNcl]->push_back(tTrackIndices[tNcl]);
+       }
+      }
+    }
+      
+  }
+
+  for (int i=0;i<nofTracks;i++)
+    {
+      bool  good_momentum=true; //flaga to chcek if we can read momentum of this track
+               
+      AliFemtoTrack* trackCopy = new AliFemtoTrack();  
+      const AliESDtrack *esdtrack=fEvent->GetTrack(i);//getting next track
+      const AliESDfriendTrack *tESDfriendTrack = esdtrack->GetFriendTrack();
+
+      trackCopy->SetCharge((short)esdtrack->GetSign());
+
+      //in aliroot we have AliPID 
+      //0-electron 1-muon 2-pion 3-kaon 4-proton 5-photon 6-pi0 7-neutron 8-kaon0 9-eleCon   
+      //we use only 5 first
+      double esdpid[5];
+      esdtrack->GetESDpid(esdpid);
+      trackCopy->SetPidProbElectron(esdpid[0]);
+      trackCopy->SetPidProbMuon(esdpid[1]);
+      trackCopy->SetPidProbPion(esdpid[2]);
+      trackCopy->SetPidProbKaon(esdpid[3]);
+      trackCopy->SetPidProbProton(esdpid[4]);
+                                               
+      double pxyz[3];
+      if (fConstrained==true)              
+       good_momentum=esdtrack->GetConstrainedPxPyPz(pxyz); //reading constrained momentum
+      else
+       good_momentum=esdtrack->GetPxPyPz(pxyz);//reading noconstarined momentum
+
+      AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
+      if (v.mag() == 0) {
+       //      cout << "Found 0 momentum ???? " <<endl;
+       delete trackCopy;
+       continue;
+      }
+      trackCopy->SetP(v);//setting momentum
+      trackCopy->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
+      const AliFmThreeVectorD p(pxyz[0],pxyz[1],pxyz[2]);
+      const AliFmThreeVectorD origin(fV1[0],fV1[1],fV1[2]);
+      //setting helix I do not if it is ok
+      AliFmPhysicalHelixD helix(p,origin,(double)(fEvent->GetMagneticField())*kilogauss,(double)(trackCopy->Charge())); 
+      trackCopy->SetHelix(helix);
+               
+      trackCopy->SetTrackId(esdtrack->GetID());
+      trackCopy->SetFlags(esdtrack->GetStatus());
+      //trackCopy->SetLabel(esdtrack->GetLabel());
+               
+      //some stuff which could be useful 
+      float impact[2];
+      float covimpact[3];
+      esdtrack->GetImpactParameters(impact,covimpact);
+      trackCopy->SetImpactD(impact[0]);
+      trackCopy->SetImpactZ(impact[1]);
+      trackCopy->SetCdd(covimpact[0]);
+      trackCopy->SetCdz(covimpact[1]);
+      trackCopy->SetCzz(covimpact[2]);
+      trackCopy->SetITSchi2(esdtrack->GetITSchi2());    
+      trackCopy->SetITSncls(esdtrack->GetNcls(0));     
+      trackCopy->SetTPCchi2(esdtrack->GetTPCchi2());       
+      trackCopy->SetTPCncls(esdtrack->GetTPCNcls());       
+      trackCopy->SetTPCnclsF(esdtrack->GetTPCNclsF());      
+      trackCopy->SetTPCsignalN((short)esdtrack->GetTPCsignalN()); //due to bug in aliesdtrack class   
+      trackCopy->SetTPCsignalS(esdtrack->GetTPCsignalSigma()); 
+
+      // Fill cluster per padrow information
+      Int_t tTrackIndices[AliESDfriendTrack::kMaxTPCcluster];
+      Int_t tNClusters = esdtrack->GetTPCclusters(tTrackIndices);
+      for (int tNcl=0; tNcl<AliESDfriendTrack::kMaxTPCcluster; tNcl++) {
+       if (tTrackIndices[tNcl] > 0)
+         trackCopy->SetTPCcluster(tNcl, 1);
+       else
+         trackCopy->SetTPCcluster(tNcl, 0);
+      }
+      
+      // Fill shared cluster information
+      list<Int_t>::iterator tClustIter;
+
+      for (int tNcl=0; tNcl<AliESDfriendTrack::kMaxTPCcluster; tNcl++) {
+       if (tTrackIndices[tNcl] > 0) {
+         tClustIter = find(fSharedList[tNcl]->begin(), fSharedList[tNcl]->end(), tTrackIndices[tNcl]);
+         if (tClustIter != fSharedList[tNcl]->end()) {
+           trackCopy->SetTPCshared(tNcl, 1);
+           cout << "Event next" <<  endl;
+           cout << "Track: " << i << endl;
+           cout << "Shared cluster: " << tNcl << " " << tTrackIndices[tNcl] << endl;
+         }
+         else {
+           trackCopy->SetTPCshared(tNcl, 0);
+         }
+       }
+      }
+
+      if (good_momentum==true)
+       {
+         hbtEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
+         realnofTracks++;//real number of tracks
+         //      delete trackCopy;
+       }
+      else
+       {
+         delete  trackCopy;
+       }
+               
+    }
+
+  hbtEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event  
+  fCurEvent++; 
+  cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
+  return hbtEvent; 
+}
+//___________________
+// The chain loads the ESD for us
+// You must provide the address where it can be found
+void AliFemtoEventReaderESDChain::SetESDSource(AliESD *aESD)
+{
+  fEvent = aESD;
+}
+//___________________
+// We need the ESD tree to obtain
+// information about the friend file location
+void AliFemtoEventReaderESDChain::SetESDfriendSource(AliESDfriend *aFriend)
+{
+  fEventFriend = aFriend;
+}
+
+
+
+
+
+
+
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.h b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.h
new file mode 100644 (file)
index 0000000..f0534c8
--- /dev/null
@@ -0,0 +1,53 @@
+// AliFemto reader for the ESD objects given back by the chain
+// Version 1:
+// Adam Kisiel, OSU kisiel@mps.ohio-state.edu
+#ifndef AliFemtoEventReaderESDChain_hh
+#define AliFemtoEventReaderESDChain_hh
+#include "AliFemtoEventReader.h"
+#include "AliFemtoEnumeration.h"
+
+#include <string>
+#include <vector>
+#include "TTree.h"
+#include "AliESD.h"
+#include "AliESDfriend.h"
+#include <list>
+
+class AliFemtoEvent;
+
+class AliFemtoEventReaderESDChain : public AliFemtoEventReader 
+{
+ public:
+  AliFemtoEventReaderESDChain();
+  ~AliFemtoEventReaderESDChain();
+  AliFemtoEvent* ReturnHbtEvent();
+  AliFemtoString Report();
+  void SetConstrained(const bool constrained);
+  bool GetConstrained() const;
+
+  void SetESDSource(AliESD *);
+  void SetESDfriendSource(AliESDfriend *);
+
+ protected:
+
+ private:
+  string         fFileName;      //name of current ESD file
+  bool           fConstrained;   //flag to set which momentum from ESD file will be use
+  int            fNumberofEvent; //number of Events in ESD file
+  int            fCurEvent;      //number of current event
+  unsigned int   fCurFile;       //number of current file
+  AliESD*        fEvent;         //ESD event
+  AliESDfriend*  fEventFriend;
+
+  list<Int_t>  **fSharedList;
+  list<Int_t>  **fClusterPerPadrow;
+               
+#ifdef __ROOT__
+  ClassDef(AliFemtoEventReaderESDChain, 10)
+#endif
+
+    };
+  
+#endif
+
+
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.cxx b/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.cxx
new file mode 100644 (file)
index 0000000..8d7a974
--- /dev/null
@@ -0,0 +1,246 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   a simple Q-invariant correlation function           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.4  2000/01/25 17:34:45  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.3  1999/07/29 02:47:09  lisa
+ * 1) add OpeningAngle correlation function 2) add AliFemtoMcEventReader 3) make histos in CorrFctns do errors correctly
+ *
+ * Revision 1.2  1999/07/06 22:33:20  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#include "CorrFctn/AliFemtoShareQualityCorrFctn.h"
+//#include "Infrastructure/AliFemtoHisto.hh"
+#include <cstdio>
+
+#ifdef __ROOT__ 
+ClassImp(AliFemtoShareQualityCorrFctn)
+#endif
+
+//____________________________
+AliFemtoShareQualityCorrFctn::AliFemtoShareQualityCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi){
+  // set up numerator
+  //  title = "Num Qinv (MeV/c)";
+  char TitNum[100] = "NumShare";
+  strcat(TitNum,title);
+  fShareNumerator = new TH2D(TitNum,title,nbins,QinvLo,QinvHi,50,0.0,1.00001);
+  // set up denominator
+  //title = "Den Qinv (MeV/c)";
+  char TitDen[100] = "DenShare";
+  strcat(TitDen,title);
+  fShareDenominator = new TH2D(TitDen,title,nbins,QinvLo,QinvHi,50,0.0,1.00001);
+
+  char Tit2Num[100] = "NumQuality";
+  strcat(Tit2Num,title);
+  fQualityNumerator = new TH2D(Tit2Num,title,nbins,QinvLo,QinvHi,75,-0.500001,1.000001);
+  // set up denominator
+  //title = "Den Qinv (MeV/c)";
+  char Tit2Den[100] = "DenQuality";
+  strcat(Tit2Den,title);
+  fQualityDenominator = new TH2D(Tit2Den,title,nbins,QinvLo,QinvHi,75,-0.500001,1.000001);
+  // set up ratio
+  //title = "Ratio Qinv (MeV/c)";
+  // this next bit is unfortunately needed so that we can have many histos of same "title"
+  // it is neccessary if we typedef TH2D to TH1d (which we do)
+  //mShareNumerator->SetDirectory(0);
+  //mShareDenominator->SetDirectory(0);
+  //mRatio->SetDirectory(0);
+
+  // to enable error bar calculation...
+  fShareNumerator->Sumw2();
+  fShareDenominator->Sumw2();
+
+  fQualityNumerator->Sumw2();
+  fQualityDenominator->Sumw2();
+}
+
+//____________________________
+AliFemtoShareQualityCorrFctn::~AliFemtoShareQualityCorrFctn(){
+  delete fShareNumerator;
+  delete fShareDenominator;
+  delete fQualityNumerator;
+  delete fQualityDenominator;
+}
+//_________________________
+void AliFemtoShareQualityCorrFctn::Finish(){
+  // here is where we should normalize, fit, etc...
+  // we should NOT Draw() the histos (as I had done it below),
+  // since we want to insulate ourselves from root at this level
+  // of the code.  Do it instead at root command line with browser.
+  //  mShareNumerator->Draw();
+  //mShareDenominator->Draw();
+  //mRatio->Draw();
+
+}
+
+//____________________________
+AliFemtoString AliFemtoShareQualityCorrFctn::Report(){
+  string stemp = "Qinv Correlation Function Report:\n";
+  char ctemp[100];
+  sprintf(ctemp,"Number of entries in numerator:\t%E\n",fShareNumerator->GetEntries());
+  stemp += ctemp;
+  sprintf(ctemp,"Number of entries in denominator:\t%E\n",fShareDenominator->GetEntries());
+  stemp += ctemp;
+  //  stemp += mCoulombWeight->Report();
+  AliFemtoString returnThis = stemp;
+  return returnThis;
+}
+//____________________________
+void AliFemtoShareQualityCorrFctn::AddRealPair(const AliFemtoPair* pair){
+  double Qinv = fabs(pair->qInv());   // note - qInv() will be negative for identical pairs...
+  Int_t nh = 0;
+  Int_t an = 0;
+  Int_t ns = 0;
+  
+  for (unsigned int imap=0; imap<pair->track1()->Track()->TPCclusters().GetNbits(); imap++) {
+    // If both have clusters in the same row
+    if (pair->track1()->Track()->TPCclusters().TestBitNumber(imap) && 
+       pair->track2()->Track()->TPCclusters().TestBitNumber(imap)) {
+      // Do they share it ?
+      if (pair->track1()->Track()->TPCsharing().TestBitNumber(imap) ||
+         pair->track2()->Track()->TPCsharing().TestBitNumber(imap))
+       {
+         if (Qinv < 0.01) {
+           cout << "Shared cluster in row " << imap << endl; 
+         }
+         an++;
+         nh+=2;
+         ns+=2;
+       }
+      
+      // Different hits on the same padrow
+      else {
+       an--;
+       nh+=2;
+      }
+    }
+    else if (pair->track1()->Track()->TPCclusters().TestBitNumber(imap) ||
+            pair->track2()->Track()->TPCclusters().TestBitNumber(imap)) {
+      // One track has a hit, the other does not
+      an++;
+      nh++;
+    }
+  }
+  if (Qinv < 0.01) {
+    cout << "Qinv of the pair is " << Qinv << endl;
+    cout << "Clusters: " << endl;
+    for (unsigned int imap=0; imap<pair->track1()->Track()->TPCclusters().GetNbits(); imap++) {
+      cout << imap ;
+      if (pair->track1()->Track()->TPCclusters().TestBitNumber(imap)) cout << " 1 ";
+      else cout << " 0 " ;
+      if (pair->track2()->Track()->TPCclusters().TestBitNumber(imap)) cout << " 1 ";
+      else cout << " 0 " ;
+      cout << "     ";
+      if (pair->track1()->Track()->TPCsharing().TestBitNumber(imap)) cout << " S ";
+      else cout << " X ";
+      if (pair->track2()->Track()->TPCsharing().TestBitNumber(imap)) cout << " S ";
+      else cout << " X ";
+      cout << endl;
+    }
+  }
+
+  Float_t hsmval = 0.0;
+  Float_t hsfval = 0.0;
+
+  if (nh >0) {
+    hsmval = an*1.0/nh;
+    hsfval = ns*1.0/nh;
+  }
+
+  if (Qinv < 0.01) {
+    cout << "Quality  Sharity " << hsmval << " " << hsfval << " " << pair->track1()->Track() << " " << pair->track2()->Track() << endl;
+  }
+
+  fShareNumerator->Fill(Qinv, hsfval);
+  fQualityNumerator->Fill(Qinv, hsmval);
+  //  cout << "AliFemtoShareQualityCorrFctn::AddRealPair : " << pair->qInv() << " " << Qinv <<
+  //" " << pair->track1().FourMomentum() << " " << pair->track2().FourMomentum() << endl;
+}
+//____________________________
+void AliFemtoShareQualityCorrFctn::AddMixedPair(const AliFemtoPair* pair){
+  double weight = 1.0;
+  double Qinv = fabs(pair->qInv());   // note - qInv() will be negative for identical pairs...
+  Int_t nh = 0;
+  Int_t an = 0;
+  Int_t ns = 0;
+  
+  for (unsigned int imap=0; imap<pair->track1()->Track()->TPCclusters().GetNbits(); imap++) {
+    // If both have clusters in the same row
+    if (pair->track1()->Track()->TPCclusters().TestBitNumber(imap) && 
+       pair->track2()->Track()->TPCclusters().TestBitNumber(imap)) {
+      // Do they share it ?
+      if (pair->track1()->Track()->TPCsharing().TestBitNumber(imap) ||
+         pair->track2()->Track()->TPCsharing().TestBitNumber(imap))
+       {
+         //      cout << "A shared cluster !!!" << endl;
+         //    cout << "imap idx1 idx2 " 
+         //         << imap << " "
+         //         << tP1idx[imap] << " " << tP2idx[imap] << endl;
+         an++;
+         nh+=2;
+         ns+=2;
+       }
+      
+      // Different hits on the same padrow
+      else {
+       an--;
+       nh+=2;
+      }
+    }
+    else if (pair->track1()->Track()->TPCclusters().TestBitNumber(imap) ||
+            pair->track2()->Track()->TPCclusters().TestBitNumber(imap)) {
+      // One track has a hit, the other does not
+      an++;
+      nh++;
+    }
+  }
+  
+  Float_t hsmval = 0.0;
+  Float_t hsfval = 0.0;
+
+  if (nh >0) {
+    hsmval = an*1.0/nh;
+    hsfval = ns*1.0/nh;
+  }
+
+  fShareDenominator->Fill(Qinv,hsfval,weight);
+  fQualityDenominator->Fill(Qinv,hsmval,weight);
+}
+
+
+void AliFemtoShareQualityCorrFctn::WriteHistos()
+{
+  fShareNumerator->Write();
+  fShareDenominator->Write();
+  fQualityNumerator->Write();
+  fQualityDenominator->Write();
+  
+}
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.h b/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.h
new file mode 100644 (file)
index 0000000..4546a23
--- /dev/null
@@ -0,0 +1,71 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   a simple Q-invariant correlation function           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.3  2000/01/25 17:34:45  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.2  1999/07/06 22:33:20  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoShareQualityCorrFctn_hh
+#define AliFemtoShareQualityCorrFctn_hh
+
+#include "TH1D.h"
+#include "TH2D.h"
+#include "Base/AliFemtoCorrFctn.h"
+
+class AliFemtoShareQualityCorrFctn : public AliFemtoCorrFctn {
+public:
+  AliFemtoShareQualityCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi);
+  virtual ~AliFemtoShareQualityCorrFctn();
+
+  virtual AliFemtoString Report();
+  virtual void AddRealPair(const AliFemtoPair*);
+  virtual void AddMixedPair(const AliFemtoPair*);
+
+  virtual void Finish();
+
+  void WriteHistos();
+private:
+  
+  TH2D *fShareNumerator;
+  TH2D *fShareDenominator;
+
+  TH2D *fQualityNumerator;
+  TH2D *fQualityDenominator;
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoShareQualityCorrFctn, 1)
+#endif
+};
+
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.cxx b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.cxx
new file mode 100644 (file)
index 0000000..5d23e13
--- /dev/null
@@ -0,0 +1,190 @@
+/***************************************************************************
+ *
+ * $Id$ 
+ *
+ * 
+ ***************************************************************************
+ *
+ * 
+ *              
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.4  2007-04-03 16:00:08  mchojnacki
+ * Changes to iprove memory managing
+ *
+ * Revision 1.3  2007/03/13 15:30:03  mchojnacki
+ * adding reader for simulated data
+ *
+ * Revision 1.2  2007/03/08 14:58:03  mchojnacki
+ * adding some alice stuff
+ *
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ **************************************************************************/
+
+#include "Cut/AliFemtoESDTrackCut.h"
+#include <cstdio>
+
+#ifdef __ROOT__ 
+ClassImp(AliFemtoESDTrackCut)
+#endif
+
+AliFemtoESDTrackCut::AliFemtoESDTrackCut()
+{
+    fNTracksPassed = fNTracksFailed = 0;
+    fCharge = 0;  // takes both charges 0
+    fPt[0]=0.0;              fPt[1] = 100.0;//100
+    fRapidity[0]=-2;       fRapidity[1]=2;//-2 2
+    fPidProbElectron[0]=-1;fPidProbElectron[1]=2;
+    fPidProbPion[0]=-1;    fPidProbPion[1]=2;
+    fPidProbKaon[0]=-1;fPidProbKaon[1]=2;
+    fPidProbProton[0]=-1;fPidProbProton[1]=2;
+    fPidProbMuon[0]=-1;fPidProbMuon[1]=2;
+    fLabel=false;
+    fStatus=0;
+    fminTPCclsF=0;
+    fminITScls=0;
+    
+}
+//------------------------------
+//AliFemtoESDTrackCut::~AliFemtoESDTrackCut(){
+//  /* noop */
+//}
+//------------------------------
+bool AliFemtoESDTrackCut::Pass(const AliFemtoTrack* track)
+{
+    //cout<<"AliFemtoESD  cut"<<endl;
+    //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
+    if (fStatus!=0)
+    {
+       //cout<<" status "<<track->Label()<<" "<<track->Flags()<<" "<<track->TPCnclsF()<<" "<<track->ITSncls()<<endl;
+       if ((track->Flags()&fStatus)!=fStatus)
+       {
+         //  cout<<track->Flags()<<" "<<fStatus<<" no go through status"<<endl;
+           return false;
+       }
+       
+    }
+    if (fminTPCclsF>track->TPCnclsF())
+    {
+       //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
+       return false;
+    }
+    if (fminITScls>track->ITSncls())
+    {
+       //cout<<" No go because ITS Number of Cls"<<fminITScls<< " "<<track->ITSncls()<<endl;
+       return false;
+    }
+       
+    if (fLabel)
+    {
+       //cout<<"labels"<<endl;
+       if(track->Label()<0)
+       {
+           fNTracksFailed++;
+        //   cout<<"No Go Through the cut"<<endl;
+         //  cout<<fLabel<<" Label="<<track->Label()<<endl;
+           return false;
+       }    
+    }
+    if (fCharge!=0)
+    {              
+        //cout<<"AliFemtoESD  cut ch "<<endl;
+         //cout<<fCharge<<" Charge="<<track->Charge()<<endl;
+       if (track->Charge()!= fCharge)  
+       {
+           fNTracksFailed++;
+         //  cout<<"No Go Through the cut"<<endl;
+          // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
+           return false;
+       }
+    }
+    float TEnergy = ::sqrt(track->P().mag2()+fMass*fMass);
+    float TRapidity = 0.5*::log((TEnergy+track->P().z())/(TEnergy-track->P().z()));
+    float Pt = ::sqrt((track->P().x())*(track->P().x())+(track->P().y())*(track->P().y()));
+    if ((TRapidity<fRapidity[0])||(TRapidity>fRapidity[1]))
+    {
+       fNTracksFailed++;
+       //cout<<"No Go Through the cut"<<endl;   
+       //cout<<fRapidity[0]<<" < Rapidity ="<<TRapidity<<" <"<<fRapidity[1]<<endl;
+       return false;
+    }
+    if ((Pt<fPt[0])||(Pt>fPt[1]))
+    {
+       fNTracksFailed++;
+       //cout<<"No Go Through the cut"<<endl;
+       //cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
+       return false;
+    }
+    if ((track->PidProbElectron()<fPidProbElectron[0])||(track->PidProbElectron()>fPidProbElectron[1]))
+    {
+       fNTracksFailed++;
+       //cout<<"No Go Through the cut"<<endl;
+       //cout<<fPidProbElectron[0]<<" < e ="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
+       return false;
+    }
+    if ((track->PidProbPion()<fPidProbPion[0])||(track->PidProbPion()>fPidProbPion[1]))
+    {
+       fNTracksFailed++;
+       //cout<<"No Go Through the cut"<<endl;
+       //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
+       return false;
+    }
+    if ((track->PidProbKaon()<fPidProbKaon[0])||(track->PidProbKaon()>fPidProbKaon[1]))
+    {
+       fNTracksFailed++;
+       //cout<<"No Go Through the cut"<<endl;
+       //cout<<fPidProbKaon[0]<<" < k ="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
+       return false;
+    }
+    if ((track->PidProbProton()<fPidProbProton[0])||(track->PidProbProton()>fPidProbProton[1]))
+    {
+       fNTracksFailed++;
+       //cout<<"No Go Through the cut"<<endl;
+       //cout<<fPidProbProton[0]<<" < p  ="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
+       return false;
+    }
+    if ((track->PidProbMuon()<fPidProbMuon[0])||(track->PidProbMuon()>fPidProbMuon[1]))
+    {
+       fNTracksFailed++;
+       //cout<<"No Go Through the cut"<<endl;
+       //cout<<fPidProbMuon[0]<<" <  mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
+       return false;
+    }
+  
+   // cout<<"Go Through the cut"<<endl;
+   // cout<<fLabel<<" Label="<<track->Label()<<endl;
+   // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
+    // cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
+    //cout<<fRapidity[0]<<" < Rapidity ="<<TRapidity<<" <"<<fRapidity[1]<<endl;
+    //cout<<fPidProbElectron[0]<<" <  e="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
+    //cout<<fPidProbPion[0]<<" <  pi="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
+    //cout<<fPidProbKaon[0]<<" <  k="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
+    //cout<<fPidProbProton[0]<<" <  p="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
+    //cout<<fPidProbMuon[0]<<" <  mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
+    fNTracksPassed++ ;
+    return true;
+    
+    
+}
+//------------------------------
+AliFemtoString AliFemtoESDTrackCut::Report()
+{
+    string Stemp;
+    char Ctemp[100];
+    sprintf(Ctemp,"Particle mass:\t%E\n",this->Mass());
+    Stemp=Ctemp;
+    sprintf(Ctemp,"Particle charge:\t%d\n",fCharge);
+    Stemp+=Ctemp;
+    sprintf(Ctemp,"Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
+    Stemp+=Ctemp;
+    sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
+    Stemp+=Ctemp;
+    sprintf(Ctemp,"Number of tracks which passed:\t%ld  Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
+    Stemp += Ctemp;
+    AliFemtoString returnThis = Stemp;
+    return returnThis;
+}
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.h b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.h
new file mode 100644 (file)
index 0000000..0e1fa4f
--- /dev/null
@@ -0,0 +1,98 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * 
+ ***************************************************************************
+ *
+ * 
+ *              
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.4  2007/03/20 09:37:13  mchojnacki
+ * *** empty log message ***
+ *
+ * Revision 1.3  2007/03/13 15:30:03  mchojnacki
+ * adding reader for simulated data
+ *
+ * Revision 1.2  2007/03/08 14:58:03  mchojnacki
+ * adding some alice stuff
+ *
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ **************************************************************************/
+
+#ifndef AliFemtoESDTrackCut_hh
+#define AliFemtoESDTrackCut_hh
+
+//#ifndef StMaker_H
+//#include "StMaker.h"
+//#endif
+
+#include "Base/AliFemtoTrackCut.h"
+
+class AliFemtoESDTrackCut : public AliFemtoTrackCut 
+{
+
+    public:
+           AliFemtoESDTrackCut();
+          //~AliFemtoESDTrackCut();
+
+          virtual bool Pass(const AliFemtoTrack*);
+
+          virtual AliFemtoString Report();
+
+          void SetPt(const float& lo, const float& hi);
+          void SetRapidity(const float& lo, const float& hi);
+          void SetCharge(const int&);
+          void SetPidProbElectron(const float& lo, const float& hi);
+          void SetPidProbPion(const float& lo, const float& hi);
+          void SetPidProbKaon(const float& lo, const float& hi);
+          void SetPidProbProton(const float& lo, const float& hi);
+          void SetPidProbMuon(const float& lo, const float& hi);
+          void SetLabel(const bool& flag);
+          void SetStatus(const long& );
+          void SetminTPCclsF(const short& );
+          void SetminITScls(const int& );
+  
+          private:   // here are the quantities I want to cut on...
+
+          int               fCharge;
+          float             fPt[2];
+          float             fRapidity[2];
+          float             fPidProbElectron[2]; // new
+          float             fPidProbPion[2]; // new
+          float             fPidProbKaon[2]; // new
+          float             fPidProbProton[2]; // new
+          float             fPidProbMuon[2]; //new 
+          bool              fLabel;//if true label<0 will not pass throught 
+          long              fStatus;//staus flag
+          short             fminTPCclsF;//min number of findable clusters in the TPC
+          int               fminITScls;//min number of clusters assigned in the ITS 
+          long              fNTracksPassed;
+          long              fNTracksFailed;
+
+#ifdef __ROOT__ 
+  ClassDef(AliFemtoESDTrackCut, 1)
+#endif
+};
+
+
+inline void AliFemtoESDTrackCut::SetPt(const float& lo, const float& hi){fPt[0]=lo; fPt[1]=hi;}
+inline void AliFemtoESDTrackCut::SetRapidity(const float& lo,const float& hi){fRapidity[0]=lo; fRapidity[1]=hi;}
+inline void AliFemtoESDTrackCut::SetCharge(const int& ch){fCharge = ch;}
+inline void AliFemtoESDTrackCut::SetPidProbElectron(const float& lo,const float& hi){fPidProbElectron[0]=lo; fPidProbElectron[1]=hi;}
+inline void AliFemtoESDTrackCut::SetPidProbPion(const float& lo,const float& hi){fPidProbPion[0]=lo; fPidProbPion[1]=hi;}
+inline void AliFemtoESDTrackCut::SetPidProbKaon(const float& lo,const float& hi){fPidProbKaon[0]=lo; fPidProbKaon[1]=hi;}
+inline void AliFemtoESDTrackCut::SetPidProbProton(const float& lo,const float& hi){fPidProbProton[0]=lo; fPidProbProton[1]=hi;}
+inline void AliFemtoESDTrackCut::SetPidProbMuon(const float& lo,const float& hi){fPidProbMuon[0]=lo; fPidProbMuon[1]=hi;}
+inline void AliFemtoESDTrackCut::SetLabel(const bool& flag){fLabel=flag;}
+inline void AliFemtoESDTrackCut::SetStatus(const long& status){fStatus=status;}
+inline void AliFemtoESDTrackCut::SetminTPCclsF(const short& minTPCclsF){fminTPCclsF=minTPCclsF;}
+inline void AliFemtoESDTrackCut::SetminITScls(const int& minITScls){fminITScls=minITScls;}
+
+#endif
+
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.cxx b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.cxx
new file mode 100644 (file)
index 0000000..4c92d04
--- /dev/null
@@ -0,0 +1,76 @@
+/***************************************************************************
+ *
+ * $Id$
+ ***************************************************************************
+ *          
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ *
+ **************************************************************************/
+
+#include "Cut/AliFemtoQPairCut.h"
+#include <string>
+#include <cstdio>
+
+#ifdef __ROOT__
+ClassImp(AliFemtoQPairCut)
+#endif
+    
+//__________________
+AliFemtoQPairCut::AliFemtoQPairCut()
+{
+  fNPairsPassed = fNPairsFailed = 0;
+  fQlong[0]=-1.0; fQlong[1]=100.0;
+  fQout[0]=-1.0;  fQout[1]=100.0;
+  fQside[0]=-1.0; fQside[1]=100.0;
+  fQinv[0]=-1.0;  fQinv[1]=100.0;
+}
+//__________________
+AliFemtoQPairCut::~AliFemtoQPairCut()
+{
+//  /* no-op */
+}
+//__________________
+bool AliFemtoQPairCut::Pass(const AliFemtoPair* pair)
+{
+  //bool temp = true;
+  //temp ? fNPairsPassed++ : fNPairsFailed++;
+  if ((fabs(pair->qLongCMS())<fQlong[0])||(fabs(pair->qLongCMS())>fQlong[1]))
+  {
+       fNPairsFailed++;
+       return false;
+  }
+  if ((fabs(pair->qOutCMS())<fQout[0])||(fabs(pair->qOutCMS())>fQout[1]))
+  {
+       fNPairsFailed++;
+       return false;
+  }
+  if ((fabs(pair->qSideCMS())<fQside[0])||(fabs(pair->qSideCMS())>fQside[1]))
+  {
+       fNPairsFailed++;
+       return false;
+  }
+    if ((fabs(pair->KStar())<fQinv[0])||(fabs(pair->KStar())>fQinv[1]))
+  {
+       fNPairsFailed++;
+       return false;
+  }
+  fNPairsPassed++;
+  return true;
+}
+//__________________
+AliFemtoString AliFemtoQPairCut::Report()
+{
+  string Stemp = "AliFemtoQ Pair Cut \n";
+  char Ctemp[100];
+  sprintf(Ctemp,"Number of pairs which passed:\t%ld  Number which failed:\t%ld\n",fNPairsPassed,fNPairsFailed);
+  Stemp += Ctemp;
+  AliFemtoString returnThis = Stemp;
+  return returnThis;
+}
+//__________________
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.h b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.h
new file mode 100644 (file)
index 0000000..3f11ba9
--- /dev/null
@@ -0,0 +1,67 @@
+/***************************************************************************
+ *
+ * $Id $
+ *
+ ***************************************************************************
+ *         
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ *
+ **************************************************************************/
+
+
+#ifndef AliFemtoQPairCut_hh
+#define AliFemtoQPairCut_hh
+
+// do I need these lines ?
+//#ifndef StMaker_H
+//#include "StMaker.h"
+//#endif
+
+#include "Base/AliFemtoPairCut.h"
+
+class AliFemtoQPairCut : public AliFemtoPairCut{
+public:
+  AliFemtoQPairCut();
+  ~AliFemtoQPairCut();
+
+  virtual bool Pass(const AliFemtoPair*);
+  virtual AliFemtoString Report();
+  void Setqlong(const float& lo, const float& hi);
+  void Setqout(const float& lo, const float& hi);
+  void Setqside(const float& lo, const float& hi);
+  void Setqinv(const float& lo, const float& hi);
+  AliFemtoQPairCut* Clone();
+
+
+private:
+  long fNPairsPassed;
+  long fNPairsFailed;
+  float fQlong[2];
+  float fQout[2];
+  float fQside[2];
+  float fQinv[2];
+  
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoQPairCut, 1)
+#endif
+};
+
+
+inline AliFemtoQPairCut* AliFemtoQPairCut::Clone() 
+{ 
+    AliFemtoQPairCut* c = new AliFemtoQPairCut(*this); 
+    return c;
+}
+inline void AliFemtoQPairCut::Setqlong(const float& lo,const float& hi){fQlong[0]=lo; fQlong[1]=hi;}
+inline void AliFemtoQPairCut::Setqout(const float& lo,const float& hi) {fQout[0]=lo;  fQout[1]=hi;}
+inline void AliFemtoQPairCut::Setqside(const float& lo,const float& hi){fQside[0]=lo; fQside[1]=hi;}
+inline void AliFemtoQPairCut::Setqinv(const float& lo,const float& hi) {fQinv[0]=lo;  fQinv[1]=hi;}
+
+#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.cxx b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.cxx
new file mode 100644 (file)
index 0000000..7837497
--- /dev/null
@@ -0,0 +1,109 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Adam Kisiel, Ohio State, kisiel@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   a cut to remove "shared" and "split" pairs
+ *
+ ***************************************************************************
+ *
+ *
+ **************************************************************************/
+
+#include "Cut/AliFemtoShareQualityPairCut.h"
+#include <string>
+#include <cstdio>
+
+#ifdef __ROOT__
+ClassImp(AliFemtoShareQualityPairCut)
+#endif
+
+//__________________
+AliFemtoShareQualityPairCut::AliFemtoShareQualityPairCut(){
+  fNPairsPassed = fNPairsFailed = 0;
+  fShareQualityMax = 1.0;
+}
+//__________________
+AliFemtoShareQualityPairCut::~AliFemtoShareQualityPairCut(){
+  /* no-op */
+}
+//__________________
+bool AliFemtoShareQualityPairCut::Pass(const AliFemtoPair* pair){
+  bool temp;
+  
+  Int_t nh = 0;
+  Int_t an = 0;
+  Int_t ns = 0;
+  
+  for (unsigned int imap=0; imap<pair->track1()->Track()->TPCclusters().GetNbits(); imap++) {
+    // If both have clusters in the same row
+    if (pair->track1()->Track()->TPCclusters().TestBitNumber(imap) && 
+       pair->track2()->Track()->TPCclusters().TestBitNumber(imap)) {
+      // Do they share it ?
+      if (pair->track1()->Track()->TPCsharing().TestBitNumber(imap) &&
+         pair->track2()->Track()->TPCsharing().TestBitNumber(imap))
+       {
+         //      cout << "A shared cluster !!!" << endl;
+         //    cout << "imap idx1 idx2 " 
+         //         << imap << " "
+         //         << tP1idx[imap] << " " << tP2idx[imap] << endl;
+         an++;
+         nh+=2;
+         ns+=2;
+       }
+      
+      // Different hits on the same padrow
+      else {
+       an--;
+       nh+=2;
+      }
+    }
+    else if (pair->track1()->Track()->TPCclusters().TestBitNumber(imap) ||
+            pair->track2()->Track()->TPCclusters().TestBitNumber(imap)) {
+      // One track has a hit, the other does not
+      an++;
+      nh++;
+    }
+  }
+  
+  Float_t hsmval = 0.0;
+  Float_t hsfval = 0.0;
+
+  if (nh >0) {
+    hsmval = an*1.0/nh;
+    hsfval = ns*1.0/nh;
+  }
+  //  if (hsmval > -0.4) {
+  cout << "Pair quality: " << hsmval << " " << an << " " << nh << " " 
+       << (pair->track1()->Track()) << " " 
+       << (pair->track2()->Track()) << endl;
+  cout << "Bits: " << pair->track1()->Track()->TPCclusters().GetNbits() << endl;
+    //  }
+  if (hsfval > 0.0) {
+    cout << "Pair sharity: " << hsfval << " " << ns << " " << nh << "    " << hsmval << " " << an << " " << nh << endl;
+  }
+
+  temp = hsmval < fShareQualityMax;
+
+  temp ? fNPairsPassed++ : fNPairsFailed++;
+  return temp;
+}
+//__________________
+AliFemtoString AliFemtoShareQualityPairCut::Report(){
+  string Stemp = "AliFemtoShareQuality Pair Cut - remove shared and split pairs\n";  char Ctemp[100];
+  sprintf(Ctemp,"Number of pairs which passed:\t%ld  Number which failed:\t%ld\n",fNPairsPassed,fNPairsFailed);
+  Stemp += Ctemp;
+  AliFemtoString returnThis = Stemp;
+  return returnThis;}
+//__________________
+
+void AliFemtoShareQualityPairCut::SetShareQualityMax(Double_t aShareQualityMax) {
+  fShareQualityMax = aShareQualityMax;
+}
+
+Double_t AliFemtoShareQualityPairCut::GetAliFemtoShareQualityMax() {
+  return fShareQualityMax;
+}
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.h b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.h
new file mode 100644 (file)
index 0000000..5544c94
--- /dev/null
@@ -0,0 +1,57 @@
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Adam Kisiel, Ohio State University, kisiel@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   a cut to remove "shared" and "split" pairs
+ *
+ ***************************************************************************
+ *
+ *
+ **************************************************************************/
+
+
+#ifndef AliFemtoShareQualityPairCut_hh
+#define AliFemtoShareQualityPairCut_hh
+
+// do I need these lines ?
+//#ifndef StMaker_H
+//#include "StMaker.h"
+//#endif
+
+#include "Base/AliFemtoPairCut.h"
+
+class AliFemtoShareQualityPairCut : public AliFemtoPairCut{
+public:
+  AliFemtoShareQualityPairCut();
+  AliFemtoShareQualityPairCut(const AliFemtoShareQualityPairCut&);
+  ~AliFemtoShareQualityPairCut();
+
+  virtual bool Pass(const AliFemtoPair*);
+  virtual AliFemtoString Report();
+  AliFemtoShareQualityPairCut* Clone();
+  void SetShareQualityMax(Double_t aAliFemtoShareQualityMax);
+  Double_t GetAliFemtoShareQualityMax();
+
+private:
+  long fNPairsPassed;
+  long fNPairsFailed;
+  Double_t fShareQualityMax;
+
+#ifdef __ROOT__
+  ClassDef(AliFemtoShareQualityPairCut, 0)
+#endif
+};
+
+inline AliFemtoShareQualityPairCut::AliFemtoShareQualityPairCut(const AliFemtoShareQualityPairCut& c) : AliFemtoPairCut(c) {
+  fNPairsPassed = 0;
+  fNPairsFailed = 0;
+  fShareQualityMax = 1.0; // no cut
+}
+
+inline AliFemtoShareQualityPairCut* AliFemtoShareQualityPairCut::Clone() { AliFemtoShareQualityPairCut* c = new AliFemtoShareQualityPairCut(*this); return c;}
+
+#endif