ITS tracking V1 integrated with the last version of ITS PID
authorbarbera <barbera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Oct 2002 17:12:58 +0000 (17:12 +0000)
committerbarbera <barbera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Oct 2002 17:12:58 +0000 (17:12 +0000)
ITS/AliITSIOTrack.cxx
ITS/AliITSIOTrack.h
ITS/AliITSPid.cxx
ITS/AliITSStoreFindableTracksCompiled.C
ITS/AliITSTrackV1.cxx
ITS/AliITSTrackV1.h
ITS/AliITSTrackerV1.cxx
ITS/AliITSTrackingV1.C

index 4e5dc6c49530a144b309885406b4c7702b67f96f..40b6d18d2e70ccc1e6c76a8242ba96b7de740037 100644 (file)
@@ -19,6 +19,9 @@ AliITSIOTrack::AliITSIOTrack() {
   for (Int_t i=0;i<6;i++) {fIdModules[i]=fIdPoints[i]=-1; fIdPoints[i]=-1;}
   fStateVPhi=0.; fStateVZ=0.; fStateVD=0.; fStateVTgl=0.; fStateVC=0.;
   fRadius=0.; fCharge=0; 
+  fMass =0.;
+  fdEdx=0.;
+  fPid=0;
   fC00=fC10=fC11=fC20=fC21=fC22=fC30=fC31=fC32=fC33=fC40=fC41=fC42=fC43=fC44=0.; 
 
 }
index 561115d9a8f3815748df50ff8361801dec923a8b..1986a4f40b5a6bee3056f4e05e1d242ac217605d 100644 (file)
@@ -38,6 +38,11 @@ class AliITSIOTrack : public TObject {
   Float_t GetPy() const {return fPy;}   // gets the y momentum component at the fX,fY,fZ point  
   Float_t GetPz() const {return fPz;}    // gets the z momentum component at the fX,fY,fZ point  
   Double_t GetDz() const {return fDz;}   // gets the longitudinal impact parameter
+  Int_t    GetPid() const {return fPid;} // gets the identified particle code
+  Double_t GetMass() {return fMass;}                             // get the tracking mass  
+  Float_t GetdEdx() {return fdEdx;}                              //get the track energy loss
+  void SetMass(Double_t mass) {fMass=mass;}                      // put the tracking mass
+  void SetPid(Int_t pid) {fPid=pid;}                             // put the identified particle code
   
   void SetCovMatrix(Double_t C00, Double_t C10, Double_t C11, Double_t C20, Double_t C21, 
        Double_t C22, Double_t C30, Double_t C31, Double_t C32, Double_t C33, Double_t C40, 
@@ -63,6 +68,8 @@ class AliITSIOTrack : public TObject {
   void SetPy(Float_t py) {fPy=py;}   // sets the y momentum component at the fX,fY,fZ point
   void SetPz(Float_t pz) {fPz=pz;}   // sets the z momentum component at the fX,fY,fZ point
   void SetDz(Double_t dz) {fDz=dz;}  //sets the longitudinal impact parameter
+  void SetdEdx(Float_t dedx) {fdEdx=dedx;} //sets the de/dx
+
 
  private:
     
@@ -87,9 +94,15 @@ class AliITSIOTrack : public TObject {
   Double_t  fStateVC;            //  state vector component C
         
   Double_t  fRadius;             //  distance of the point from the origin
+  Int_t     fPid;                //  identified particle code
   Int_t     fCharge;             //  particle charge 
   
-  Double_t  fDz;                  //longitudinal impact parameter 
+  Double_t  fMass;               //  tracking mass
+  
+  Double_t  fDz;                 // longitudinal impact parameter 
+  
+  Float_t fdEdx;             //track energy loss by trouncated method
+
 
 //  Covariance matrix
   Double_t  fC00;                                   // first row elements of the covariance matrix
index dbcb0d6640a2bd38e63407877525805b4550f385..8de1982cf629df34b085b9fd25d554b188afa54f 100644 (file)
@@ -77,8 +77,8 @@ Int_t AliITSPid::wpik(Int_t nc,Float_t q)
     sigk =cut[nc][4];
     appi = aprob[0][nc-5];
     apk  = aprob[1][nc-5];
-    cout<<"qmpi,sigpi,qmk,sigk="<<qmpi<<"  "<<sigpi<<"  "<<qmk<<"  "<<sigk<<endl;
-    cout<<"appi,apk="<<appi<<","<<apk<<endl;
+//    cout<<"qmpi,sigpi,qmk,sigk="<<qmpi<<"  "<<sigpi<<"  "<<qmk<<"  "<<sigk<<endl;
+//    cout<<"appi,apk="<<appi<<","<<apk<<endl;
     Float_t dqpi=(q-qmpi)/sigpi;
     Float_t dqk =(q-qmk )/sigk;
     if( dqk<-1. )return pion();
@@ -91,9 +91,9 @@ Int_t AliITSPid::wpik(Int_t nc,Float_t q)
     pk = apk*TMath::Gaus(q,qmk, sigk )
         /(appi*TMath::Gaus(q,qmpi,sigpi)+apk*TMath::Gaus(q,qmk,sigk));
 
-    Float_t rpik=ppi/(pk+0.0000001); 
-       cout<<"q,dqpi,dqk, wpik: ppi,pk,rpik="
-       <<q<<"  "<<dqpi<<"  "<<dqk<<"  "<<ppi<<"  "<<pk<<"  "<<rpik<<endl;
+//    Float_t rpik=ppi/(pk+0.0000001); 
+//     cout<<"q,dqpi,dqk, wpik: ppi,pk,rpik="
+//     <<q<<"  "<<dqpi<<"  "<<dqk<<"  "<<ppi<<"  "<<pk<<"  "<<rpik<<endl;
 
     fWp=0.; fWpi=ppi; fWk=pk;
     if( pk>ppi){return kaon();}else{return pion();}
@@ -130,10 +130,10 @@ Int_t     AliITSPid::wpikp(Int_t nc,Float_t q)
 
     fWp=pp; fWpi=ppi; fWk=pk;
 
-cout<<" wpikp: mid,sig pi,k,p="<<qmpi<<" "<<sigpi<<";   "<<qmk<<" "<<sigk<<";   "
-    <<qmp<<" "<<sigp<<"; "<<endl;
- cout<<" aprob: "<<appi<<"  "<<apk<<"  "<<app<<endl;
-cout<<" ppi,pk,pp="<<ppi<<"  "<<pk<<"  "<<pp<<endl;
+//cout<<" wpikp: mid,sig pi,k,p="<<qmpi<<" "<<sigpi<<";   "<<qmk<<" "<<sigk<<";   "
+//    <<qmp<<" "<<sigp<<"; "<<endl;
+// cout<<" aprob: "<<appi<<"  "<<apk<<"  "<<app<<endl;
+//cout<<" ppi,pk,pp="<<ppi<<"  "<<pk<<"  "<<pp<<endl;
 
     if( ppi>pk&&ppi>pp )  { return pion(); }
     if(pk>pp){return kaon();}else{return proton();}
@@ -155,7 +155,7 @@ Int_t   AliITSPid::GetPcode(AliTPCtrack *track)
       Float_t mom=1./(pt_1*TMath::Cos(lam));
       Float_t dedx=track->GetdEdx();
     Int_t pcode=GetPcode(dedx/40.,mom);
-    cout<<"TPCtrack dedx,mom,pcode="<<dedx<<","<<mom<<","<<pcode<<endl;
+//    cout<<"TPCtrack dedx,mom,pcode="<<dedx<<","<<mom<<","<<pcode<<endl;
     return pcode?pcode:211;
     }
 //------------------------------------------------------------
@@ -167,11 +167,11 @@ Int_t   AliITSPid::GetPcode(AliITSIOTrack *track)
     pz=track->GetPz();
     Float_t mom=TMath::Sqrt(px*px+py*py+pz*pz);
 //???????????????????
-    Float_t dedx=1.0;
-    //  Float_t dedx=track->GetdEdx();
+    // Float_t dedx=1.0;
+    Float_t dedx=track->GetdEdx();
 //???????????????????    
     Int_t pcode=GetPcode(dedx,mom);
-    cout<<"ITSV1 dedx,mom,pcode="<<dedx<<","<<mom<<","<<pcode<<endl;
+//    cout<<"ITSV1 dedx,mom,pcode="<<dedx<<","<<mom<<","<<pcode<<endl;
 return pcode?pcode:211;
 }
 //-----------------------------------------------------------
@@ -187,9 +187,9 @@ Int_t   AliITSPid::GetPcode(AliITStrackV2 *track)
     Float_t mom=0.;
     if( (pt_1*TMath::Cos(lam))!=0. ){ mom=1./(pt_1*TMath::Cos(lam)); }else{mom=0.;};
     Float_t dedx=track->GetdEdx();
-    cout<<"lam,pt_1,mom,dedx="<<lam<<","<<pt_1<<","<<mom<<","<<dedx<<endl;
+//    cout<<"lam,pt_1,mom,dedx="<<lam<<","<<pt_1<<","<<mom<<","<<dedx<<endl;
     Int_t pcode=GetPcode(dedx,mom);
-    cout<<"ITS V2 dedx,mom,pcode="<<dedx<<","<<mom<<","<<pcode<<endl;
+//    cout<<"ITS V2 dedx,mom,pcode="<<dedx<<","<<mom<<","<<pcode<<endl;
 return pcode?pcode:211;
 }
 //-----------------------------------------------------------
@@ -335,7 +335,7 @@ for(Int_t i=0;i<trs->GetEntries();i++)
            xx(9)=GetWp();
 //       3)Print table
            if(xx(0)>0){
-                   cout<<xx(0)<<" ";
+//                 cout<<xx(0)<<" ";
                    for(Int_t j=1;j<11;j++){
                      if(i<7){ cout.width(7);cout.precision(4);cout<<xx(j);}
                       if(i>7){ cout.width(7);cout.precision(5);cout<<xx(j);}
index 19d6800934f72dbcd16ad637d069bbd992efd08c..74590c13fe6ae8c01e5093c1d3e23a0b56adf0be 100644 (file)
@@ -84,7 +84,7 @@ Int_t AliITSStoreFindableTracksCompiled
        }
        
        // Scan recpoints and define findable tracks
-       Int_t nModules = (Int_t)TR->GetEntries(), nPoints = 0;
+       Int_t nModules = (Int_t)TR->GetEntries(), nPoints = 0, nEmpty = 0;
        cout << "Found " << nModules;
        cout << " entries in the TreeR (must be one per module!)" << endl;
        for (Int_t layer = 1; layer <= 6; layer++) {
@@ -93,7 +93,7 @@ Int_t AliITSStoreFindableTracksCompiled
                        TR->GetEntry(mod);
                        nPoints = recPoints->GetEntries();
                        if(!nPoints) {
-                               cout << "Module " << mod << " is empty..." << endl;
+                               nEmpty++;
                                continue;
                        }
                        for (Int_t point = 0; point < nPoints; point++) {
@@ -111,6 +111,7 @@ Int_t AliITSStoreFindableTracksCompiled
                        } //loop over points
                } //loop over modules
        } //loop over layers
+       cout << "Found " << nEmpty << " empty modules" << endl;
        
        // Scan the file of tracks in TPC to retrieve the findable TPC tracks
        TString strLabelsTPC;
@@ -125,7 +126,7 @@ Int_t AliITSStoreFindableTracksCompiled
                        
        // Define the TTree with tracks data by means of a set of variables
        Int_t nFindablesITS = 0, nFindablesITSTPC = 0;
-       Int_t nhits, tpc_ok, entry = 0;
+       Int_t nhits, tpc_ok, mother, entry = 0;
        Double_t vx, vy, vz;
        Double_t px, py, pz, pt;
 
@@ -140,6 +141,7 @@ Int_t AliITSStoreFindableTracksCompiled
        tree->Branch("pt", &pt, "pt/D");
        tree->Branch("label", &label, "label/I");
        tree->Branch("entry", &entry, "entry/I");
+       tree->Branch("mother", &mother, "mother/I");
        tree->Branch("pdg_code", &pdg_code, "pdg_code/I");
        tree->Branch("nhits", &nhits, "nhits/I");
        tree->Branch("tpc_ok", &tpc_ok, "tpc_ok/I");
@@ -148,6 +150,9 @@ Int_t AliITSStoreFindableTracksCompiled
        cout << endl;
        TParticle *p = 0;
        for (Int_t i = 0; i < nTracks; i++) {
+               nhits = 0;
+               for (Int_t j = 0; j < 6; j++) if (hitITSLayer[j][i]) nhits++;
+               if (nhits < nMinClusters) continue;
                p = gAlice->Particle(i);
                px = p->Px();
                py = p->Py();
@@ -156,9 +161,7 @@ Int_t AliITSStoreFindableTracksCompiled
                vx = p->Vx();
                vy = p->Vy();
                vz = p->Vz();
-               nhits = 0;
-               for (Int_t j = 0; j < 6; j++) if (hitITSLayer[j][i]) nhits++;
-               if (nhits < nMinClusters) continue;
+               mother = p->GetFirstMother();
                cout << "Track " << i << " stored\r" << flush;
                tpc_ok = (strLabelsTPC.Contains(Form("[%d]", i)));
                pdg_code = p->GetPdgCode();
index a5a2d4d16d82c9e6dc7e1dedddda1099b54c30b5..f718f71cfd0a92d7a481ce73e511a10ae743ae20 100644 (file)
@@ -33,7 +33,10 @@ AliITSTrackV1::AliITSTrackV1() {
   fnoclust=0;
   fMass=0.13956995; //a pion by default
   fFieldFactor = 0.0;
-   
+  fdEdx = 0.;                          // oggi
+  Int_t ia=0;                          // oggi
+  for( ia=0; ia<4; ia++) fcor[ia]=0.;  // oggi
+  
 }
 AliITSTrackV1::AliITSTrackV1(const char *opt, Double_t fieldfactor) {
 //Origin  A. Badala' and G.S. Pappalardo:  e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it 
@@ -54,7 +57,11 @@ AliITSTrackV1::AliITSTrackV1(const char *opt, Double_t fieldfactor) {
   fd2.ResizeTo(6);
   ftgl2.ResizeTo(6); 
   fdtgl.ResizeTo(6);
-  fMass=0.13956995; //a pion by default 
+  fMass=0.13956995; //a pion by default
+  fdEdx = 0.;
+  Int_t ia=0;
+  for( ia=0; ia<4; ia++) fcor[ia]=0.;   
+
   
 //////////////////////////////////////// gets magnetic field factor ////////////////////////////////
 
@@ -100,7 +107,11 @@ AliITSTrackV1::AliITSTrackV1(const AliITSTrackV1 &cobj) {
   fd2=cobj.fd2;
   ftgl2=cobj.ftgl2;
   fdtgl=cobj.fdtgl;
-  fnoclust=cobj.fnoclust;   
+  fnoclust=cobj.fnoclust; 
+  fdEdx = cobj.fdEdx;
+  Int_t ia=0;
+  for( ia=0; ia<4; ia++) fcor[ia]=cobj.fcor[ia];    
+
     
   fC00=cobj.fC00; fC10=cobj.fC10; fC11=cobj.fC11; fC20=cobj.fC20; fC21=cobj.fC21;
   fC22=cobj.fC22; fC30=cobj.fC30; fC31=cobj.fC31; fC32=cobj.fC32; fC33=cobj.fC33; 
@@ -156,7 +167,10 @@ AliITSTrackV1::AliITSTrackV1(AliTPCtrack &obj, Double_t fieldfactor)
   }  
   flistCluster = new TObjArray; 
   fNumClustInTrack = 0;
-  fnoclust=0;        
+  fnoclust=0;
+  fdEdx = 0.;
+  Int_t ia=0;
+  for( ia=0; ia<4; ia++) fcor[ia]=0.;          
   LmTPC(); 
 
 }
@@ -351,7 +365,11 @@ AliITSTrackV1 &AliITSTrackV1::operator=(AliITSTrackV1 obj) {
   fC22=obj.fC22; fC30=obj.fC30; fC31=obj.fC31; fC32=obj.fC32; fC33=obj.fC33; 
   fC40=obj.fC40; fC41=obj.fC41; fC42=obj.fC42; fC43=obj.fC43; fC44=obj.fC44;
    
-  fMass=obj.fMass;   
+  fMass=obj.fMass; 
+  fdEdx = obj.fdEdx; 
+  Int_t ia=0;
+  for( ia=0; ia<4; ia++) fcor[ia]=obj.fcor[ia];   
+
   
   *fClusterInTrack = *obj.fClusterInTrack;
   Int_t i;
index 57823b311cdeaae1c3799828db40cbec16f374eb..c2ad67be9156afef0fc893d6d9e3f312fc2da847 100644 (file)
@@ -36,6 +36,8 @@ public:
   Double_t GetC() const {return fX4;}            // gets the curvature value for the track
   Double_t GetD() const{return fX2;}             // gets the radial impact parameter for the track
   Double_t GetPt() const {return 0.299792458*0.2*fFieldFactor/(fX4*100.);} // gets the transvers momentum 
+  Float_t GetdEdx() const {return fdEdx;}        //gets fdEdx    // oggi
+
                                                                            // value for the track           
   void SetVertex(TVector &vert) { for(Int_t i=0;i<3;i++) fVertex(i) = vert(i);} // sets the vertex
                                                                                 // cohordinates
@@ -62,7 +64,9 @@ public:
                                                                                            // of state vector
   void PutXElements(Double_t X0, Double_t X1, Double_t X2, Double_t X3, Double_t X4);  // put elements
  
-  void PutMass(Double_t mass) {fMass=mass;} // put the  particle mass                                                                                        // of state vector
+  void PutMass(Double_t mass) {fMass=mass;} // put the particle mass
+  Double_t GetMass() const {return fMass;}  // get the particle mass   // oggi                                                                                      // of state vector
+
     
   void SetLayer(Int_t layer) { fLayer = layer;}      // set current layer
   AliTPCtrack *GetTPCtrack() const { return fTPCtrack;}    // get hte TPC track
@@ -115,7 +119,10 @@ public:
   //Double_t GetxoTPC() const {return fxoTPC;}  // gets fxoTPC
   Int_t  Getfnoclust() const {return fnoclust;}  //gets fnoclust 
   Double_t GetPredChi2(Double_t m[2], Double_t sigma[2]) const; //get predicted chi2
+  void Setfcor()                  //set correction for layer                // oggi
+   {if(fLayer>=3) fcor[fLayer-3] = 1./TMath::Sqrt(1.+ fX3*fX3);}            // oggi
+  Float_t Getfcor(Int_t i) {return fcor[i];}  //return correction for layer // oggi
+
                        
 //////////////////////////////////////////////////////////////////////////////////////// 
 
@@ -152,7 +159,11 @@ public:
   TVector           ftgl2;              // C(3,3)  for primary track
   TVector           fdtgl;              // C(2,3)  for primary track
 
-  Double_t          fMass;         //  particle mass 
+  Double_t          fMass;         //  tracking particle mass
+  
+  Float_t           fdEdx ;         // energy loss                  // oggi
+  Float_t           fcor[4];          // corrections for dE/dx      // oggi
   
   Int_t   fnoclust;  //nm of layers in which tracking doesn't add a cluster to the track
                   
index df4b3f31e65dc8088f49823d18f3618feb139d7a..8059195516ea3198116074533314270b3c35bae6 100644 (file)
@@ -15,6 +15,9 @@
  
 /*
 $Log$
+Revision 1.24  2002/10/23 14:28:38  barbera
+Fixes added to get into account the new magnetic field conversion factor automatically
+
 Revision 1.23  2002/10/22 18:29:34  barbera
 Tracking V1 ported to the HEAD
 
@@ -88,6 +91,7 @@ cleanded up a little bit of code.
 #include "../TPC/AliTPCtracker.h"
 #include "AliITSTrackerV1.h"
 #include "AliITSVertex.h"
+#include "AliITSPid.h"
 
 ClassImp(AliITSTrackerV1)
  //______________________________________________________________________
@@ -233,8 +237,7 @@ AliITSTrackerV1::AliITSTrackerV1(AliITS* IITTSS, Int_t evnumber, Bool_t flag) {
        fphidet[im1] = new Double_t[im2max];
     } // end for im1
 
-    //Float_t global[3],local[3];
-        Double_t global[3],local[3];
+       Double_t global[3],local[3];
     Double_t pigre=TMath::Pi();
     Double_t xmin,ymin,xmax,ymax;
 
@@ -267,11 +270,8 @@ AliITSTrackerV1::AliITSTrackerV1(AliITS* IITTSS, Int_t evnumber, Bool_t flag) {
 /////////////// allocate memory and define vector fNRecPoints and matrices fRecCylR, fRecCylPhi, fRecCylZ /////////////
        gAlice->GetEvent(evnumber);
   Int_t NumOfModules = g1->GetIndexMax();
-  //fRecCylR = new Float_t *[NumOfModules];
   fRecCylR = new Double_t *[NumOfModules];
-  //fRecCylPhi = new Float_t *[NumOfModules];
   fRecCylPhi = new Double_t *[NumOfModules]; 
-  //fRecCylZ = new Float_t *[NumOfModules];
   fRecCylZ = new Double_t *[NumOfModules];
   AliITSRecPoint *recp;
   fNRecPoints = new Int_t[NumOfModules];
@@ -281,11 +281,6 @@ AliITSTrackerV1::AliITSTrackerV1(AliITS* IITTSS, Int_t evnumber, Bool_t flag) {
         gAlice->TreeR()->GetEvent(module);               
                  frecPoints=fITS->RecPoints();
                  Int_t nRecPoints=fNRecPoints[module]=frecPoints->GetEntries();
-                 /*
-                 fRecCylR[module] = new Float_t[nRecPoints];
-                 fRecCylPhi[module] = new Float_t[nRecPoints];
-                 fRecCylZ[module] = new Float_t[nRecPoints];
-                 */
                  fRecCylR[module] = new Double_t[nRecPoints];
                  fRecCylPhi[module] = new Double_t[nRecPoints];
                  fRecCylZ[module] = new  Double_t[nRecPoints];           
@@ -298,15 +293,10 @@ AliITSTrackerV1::AliITSTrackerV1(AliITS* IITTSS, Int_t evnumber, Bool_t flag) {
               local[1]=0.;
               local[2]= recp->GetZ();                                  
                         g1->LtoG(module,local,global);
-                        /*
-                        Float_t r = TMath::Sqrt(global[0]*global[0]+global[1]*global[1]);                     // r hit
-                        Float_t phi = TMath::ATan2(global[1],global[0]); if(phi<0.) phi+=2.*TMath::Pi();      // phi hit                       
-          Float_t z = global[2];                                                               // z hit
-                        */
                                                                                         
                         Double_t r = TMath::Sqrt(global[0]*global[0]+global[1]*global[1]);                     // r hit
                         Double_t phi = TMath::ATan2(global[1],global[0]); if(phi<0.) phi+=2.*TMath::Pi();      // phi hit                      
-          Double_t z = global[2];                                                                // z hit
+                Double_t z = global[2];                                                                // z hit
                                                                                                                                                                                                                                     
                         fRecCylR[module][ind]=r;
                         fRecCylPhi[module][ind]=phi;
@@ -507,22 +497,12 @@ AliITSTrackerV1 &AliITSTrackerV1::operator=(AliITSTrackerV1 obj) {
 
        AliITSgeom *g1 = fITS->GetITSgeom();  
    Int_t NumOfModules = g1->GetIndexMax();
-       /*
-  fRecCylR = new Float_t *[NumOfModules];
-  fRecCylPhi = new Float_t *[NumOfModules]; 
-  fRecCylZ = new Float_t *[NumOfModules];
-  */
   fRecCylR = new Double_t *[NumOfModules];
   fRecCylPhi = new Double_t *[NumOfModules]; 
   fRecCylZ = new Double_t *[NumOfModules];  
   fNRecPoints = new Int_t[NumOfModules];  
          for(Int_t module=0; module<NumOfModules; module++) {            
                  Int_t nRecPoints=fNRecPoints[module]=obj.fNRecPoints[module];
-                 /*
-                 fRecCylR[module] = new Float_t[nRecPoints];
-                 fRecCylPhi[module] = new Float_t[nRecPoints];
-                 fRecCylZ[module] = new Float_t[nRecPoints];
-                 */
                  fRecCylR[module] = new Double_t[nRecPoints];
                  fRecCylPhi[module] = new Double_t[nRecPoints];
                  fRecCylZ[module] = new Double_t[nRecPoints];            
@@ -586,7 +566,8 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr,
     Int_t nentr=(Int_t)tracktree->GetEntries();
     Int_t kk;
 
-    AliTPCtrack *ioTrackTPC=0;    
+    AliITSRecPoint *recp;    // oggi
+       AliTPCtrack *ioTrackTPC=0;    
     for (kk=0; kk<nentr; kk++) {
        ioTrackTPC=new AliTPCtrack; 
        tbranch->SetAddress(&ioTrackTPC);
@@ -632,9 +613,11 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr,
 
     TTree tracktree1("TreeT","Tree with ITS tracks");
     AliITSIOTrack *ioTrack=0;
+       AliITSPid *pid=new AliITSPid(1000);  // oggi
+
     tracktree1.Branch("ITStracks","AliITSIOTrack",&ioTrack,32000,0);
   
-   TDatabasePDG * db = new TDatabasePDG;   
+    TDatabasePDG * db = new TDatabasePDG;   
   
     Int_t j;       
     for (j=minTr; j<=maxTr; j++) {     
@@ -644,40 +627,17 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr,
        ///   mass definition ////////////////////////
     Double_t mass=0.13956995;
         Int_t pcode=211;  // a pion by default
+        
         if(realmass) {
-    Int_t TPClabel=TMath::Abs( track->GetLabel() );   
-        TParticle *p = (TParticle*)gAlice->Particle(TPClabel);
-         pcode=p->GetPdgCode();
-        // Int_t mothercode=p->GetFirstMother();
-        //if(mothercode>0 ) numofsecondaries++; else numofprimaries++;
+       if(TMath::Abs(pcode)<20443) mass=db->GetParticle(pcode)->Mass();
         }
-        //if(!pcode) pcode=211;         
-        if(TMath::Abs(pcode)<20443) mass=db->GetParticle(pcode)->Mass();       
+        else {
+                mass = track->GetMass();
+                cout << "Mass = " << mass << endl;
+        }
+        
        
        
-       ///////////////////////////////////////////////
-  /*
-       //////   propagation to the end of TPC //////////////
-       Double_t xk=77.415;
-       track->PropagateTo(xk, 28.94, 1.204e-3,mass);    //Ne    
-       xk -=0.01;
-       track->PropagateTo(xk, 44.77, 1.71,mass);        //Tedlar
-       xk -=0.04;
-       track->PropagateTo(xk, 44.86, 1.45,mass);        //kevlar
-       xk -=2.0;
-       track->PropagateTo(xk, 41.28, 0.029,mass);       //Nomex         
-       xk-=16;
-       track->PropagateTo(xk,36.2,1.98e-3,mass); //C02
-       xk -=0.01;
-       track->PropagateTo(xk, 24.01, 2.7,mass);         //Al    
-       xk -=0.01;
-       track->PropagateTo(xk, 44.77, 1.71,mass);        //Tedlar
-       xk -=0.04;
-       track->PropagateTo(xk, 44.86, 1.45,mass);        //kevlar
-       xk -=0.5;
-       track->PropagateTo(xk, 41.28, 0.029,mass);       //Nomex
-    ////////////////////////////////////////////////////////////////////
-   */
         //   new propagation to the end of TPC
     Double_t xk=80.;
    // track->PropagateTo(xk,0.,0.); //Ne if it's still there   //attenzione funziona solo se modifica in TPC
@@ -817,7 +777,7 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr,
        //propagation to vertex
 
        Double_t rbeam=3.;
-    if((*fresult).DoNotCross(rbeam)) continue;  //no intersection with beampipe        
+       if((*fresult).DoNotCross(rbeam)) continue;  //no intersection with beampipe     
        (*fresult).Propagation(rbeam);
        Double_t c00,c10,c11,c20,c21,c22,c30,c31,c32,c33,c40,c41,c42,c43,c44;
        (*fresult).GetCElements(c00,
@@ -856,6 +816,8 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr,
            Int_t charge;
            if(c>0.) charge=-1;  else charge=1;
            ioTrack->SetCharge(charge);
+               Double_t trackmass=(*fresult).GetMass();         // oggi
+               ioTrack->SetMass(trackmass);                     // oggi
            ioTrack->SetCovMatrix(c00,
                                  c10,c11,
                                  c20,c21,c22,
@@ -877,11 +839,15 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr,
            ioTrack->SetTPCLabel(lab);
                 ioTrack->SetDz(dz);
            Int_t il;           
-           for(il=0;il<6; il++){
+           /*
+               for(il=0;il<6; il++){
                ioTrack->SetIdPoint(il,(*fresult).GetIdPoint(il));
                ioTrack->SetIdModule(il,(*fresult).GetIdModule(il));
            } // end for il
-           tracktree1.Fill();
+           */
+           //tracktree1.Fill();
+               Float_t q[4]={-1.,-1.,-1.,-1.};
+           Float_t  globaldedx=0.;        
            for (il=0;il<6;il++) {
                idpoint=(*fresult).GetIdPoint(il);
                idmodule=(*fresult).GetIdModule(il);
@@ -889,7 +855,53 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr,
                                                               
                ioTrack->SetIdPoint(il,idpoint);
                ioTrack->SetIdModule(il,idmodule);
-           } // end for il         
+               ////  for q definition
+               if(il>1){
+                 if(idmodule>0.){                      
+                   fITS->ResetRecPoints();
+                   gAlice->TreeR()->GetEvent(idmodule);
+                   recp=(AliITSRecPoint*)frecPoints->UncheckedAt(idpoint);
+                   q[il-2]=recp->GetQ()*(*fresult).Getfcor(il-2);
+                 }
+               }                               
+           } // end for il      
+               q[0]/=280.; q[1]/=280.;
+           q[2]/=38.; q[3]/=38.;
+
+ // cout<<" q prima = "<<q[0]<<" "<<q[1]<<" "<<q[2]<<" "<<q[3]<<"\n"; getchar(); 
+     
+     Int_t swap;
+  do{
+    swap=0;   
+    for (il=0; il<3; il++) {
+      if (q[il]<=q[il+1]) continue;
+      Float_t tmp=q[il];
+      q[il]=q[il+1]; q[il+1]=tmp;
+      swap++;
+    }
+  } while(swap); 
+
+  // cout<<" q dopo = "<<q[0]<<" "<<q[1]<<" "<<q[2]<<" "<<q[3]<<"\n"; getchar();
+      
+    if(q[0]<0.) {
+      q[0]=q[1];
+      q[1]=q[2];
+      q[2]=q[3];
+      q[3]=-1.;            
+    } 
+  // cout<<" q  dopo if = "<<q[0]<<" "<<q[1]<<" "<<q[2]<<" "<<q[3]<<"\n"; getchar(); 
+     
+    globaldedx=(q[0]+q[1])/2.;
+    
+   // if(q[3]> 0.) globaldedx=(q[0]+q[1]+q[2]+q[3])/4.;
+   //      else    globaldedx=(q[0]+q[1]+q[2])/3.; 
+   
+    ioTrack->SetdEdx(globaldedx);
+    ioTrack->SetPid(pid->GetPcode(ioTrack));
+           
+           tracktree1.Fill();         
        } // end if on numOfCluster
        //gObjectTable->Print();    // stampa memoria     
     }  //  end for (int j=minTr; j<=maxTr; j++)
@@ -905,6 +917,7 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr,
     tfile->ls();
     char hname[30];
     sprintf(hname,"TreeT%d",evNumber);
+       cout << "Number of saved ITS tracks " << tracktree1.GetEntries() << endl;
     tracktree1.Write(hname);
   
     TTree *fAli=gAlice->TreeK();
@@ -1010,6 +1023,8 @@ void AliITSTrackerV1::RecursiveTracking(TList *trackITSlist) {
        //       << " "<<(*trackITS)(1)<<"\n"; getchar();
        if(outinters==-1) continue;
        Int_t flaghit=0;
+       (*trackITS).SetLayer(layerfin);  // oggi
+       (*trackITS).Setfcor();           // oggi
        if(outinters==0){
            TVector toucLad(9), toucDet(9);      
            Int_t lycur=layerfin;
@@ -1207,7 +1222,7 @@ void AliITSTrackerV1::RecursiveTracking(TList *trackITSlist) {
                        continue;
                    // cout<<" supero sigmaphi \n";      
                    AliITSTrackV1 *newTrack = new AliITSTrackV1((*trackITS));
-                   (*newTrack).SetLayer((*trackITS).GetLayer()-1);
+                   //(*newTrack).SetLayer((*trackITS).GetLayer()-1);
                    if (TMath::Abs(rTrack-cluster(0))/rTrack>1e-6) 
                        (*newTrack).Correct(Double_t(cluster(0)));      
                    //cout<<" cluster(2) e(*newTrack).GetZ()="<<cluster(2)<<" "
@@ -1246,7 +1261,7 @@ void AliITSTrackerV1::RecursiveTracking(TList *trackITSlist) {
        if(flaghit==0 || outinters==-2) {
            AliITSTrackV1 *newTrack = new AliITSTrackV1(*trackITS);
            (*newTrack).Setfnoclust();           
-           (*newTrack).SetLayer((*trackITS).GetLayer()-1); 
+           //(*newTrack).SetLayer((*trackITS).GetLayer()-1); 
            (*newTrack).AddMS(frl);  // add the multiple scattering matrix
                                     // to the covariance matrix  
            (*newTrack).AddEL(frl,1.,0);
index c49c4784b3f9936d0dc8016f36c0384ced09558c..891153e5e26b4a6a1db347a96d7136c932df43d8 100644 (file)
@@ -6,7 +6,7 @@ Bool_t TPCSortTracks(Int_t event = 0)
 {
    TFile *fileTracks   = TFile::Open("AliTPCtracks.root");
    TFile *fileClusters = TFile::Open("AliTPCclusters.root");
-       TFile *fileEvent    = TFile::Open("galice.root");
+   TFile *fileEvent    = TFile::Open("galice.root");
 
    // get TPC parameterization
    AliTPCParam *param=(AliTPCParam *)fileEvent->Get("75x40_100x60_150x60");
@@ -82,17 +82,7 @@ void AliITSTrackingV1(Int_t evNumber1=0,Int_t evNumber2=0, Int_t min_t=-1, Int_t
     gAlice=0;
   }
   
-  cout << "Sorting TPC tracks w.r. to transverse momentum...";
-  Bool_t success_sorting = TPCSortTracks();
-  if (success_sorting) {
-     cout << "DONE!" << endl;
-  }
-  else {
-       cout << "Some error occurred..." << endl;
-       return 1;
-  }
-
-// Connect the Root Galice file containing Geometry, Kine and Hits
+  // Connect the Root Galice file containing Geometry, Kine and Hits
    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
    if (!file) file = new TFile("galice.root","UPDATE");
    //if (!file) file = new TFile(filename);
@@ -103,6 +93,19 @@ void AliITSTrackingV1(Int_t evNumber1=0,Int_t evNumber2=0, Int_t min_t=-1, Int_t
       if (gAlice) printf("AliRun object found on file\n");
       if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
    }
+   
+   AliKalmanTrack::SetMagneticField(gAlice->Field()->SolenoidField() / 10.0);
+
+  
+  cout << "Sorting TPC tracks w.r. to transverse momentum...";
+  Bool_t success_sorting = TPCSortTracks();
+  if (success_sorting) {
+     cout << "DONE!" << endl;
+  }
+  else {
+       cout << "Some error occurred..." << endl;
+       return 1;
+  }
 
   AliITS* IITTSS =(AliITS *)gAlice->GetDetector("ITS");        
   if (!IITTSS) return;