]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HBTAN/AliHBTReaderITSv2.cxx
Setting of magnetic filed adapted to new schema
[u/mrichter/AliRoot.git] / HBTAN / AliHBTReaderITSv2.cxx
index 7867873a5ae5acaa60063436cf5e866d0f82abf2..d7da1a9e2d784a249d8e0def9bfc586eaa56eda4 100644 (file)
@@ -174,8 +174,8 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks)
     if( (i=OpenFiles(aTracksFile,aClustersFile,aGAliceFile,currentdir)) )
      {
        Error("Read","Exiting due to problems with opening files. Errorcode %d",i);
-       delete iotrack;
-       return i;
+       currentdir++;
+       continue;
      }
     
     if (gAlice->TreeE())//check if tree E exists
@@ -183,22 +183,22 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks)
       Nevents = (Int_t)gAlice->TreeE()->GetEntries();//if yes get number of events in gAlice
       cout<<"________________________________________________________\n";
       cout<<"Found "<<Nevents<<" event(s) in directory "<<GetDirName(currentdir)<<endl;
-      cout<<"Setting Magnetic Field. Factor is "<<gAlice->Field()->Factor()<<endl;
-      AliKalmanTrack::SetConvConst(100/0.299792458/0.2/gAlice->Field()->Factor());  
+      cout<<"Setting Magnetic Field: B="<<gAlice->Field()->SolenoidField()<<"T"<<endl;
+      AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField());
      }
     else
      {//if not return an error
        Error("Read","Can not find Header tree (TreeE) in gAlice");
-       delete iotrack;
-       return 1;
+       currentdir++;
+       continue;
      }
     
     AliITSgeom *geom=(AliITSgeom*)aClustersFile->Get("AliITSgeom");
     if (!geom) 
      { 
        Error("Read","Can't get the ITS geometry!"); 
-       delete iotrack;
-       return 2; 
+       currentdir++;
+       continue;
      }
 
     for(Int_t currentEvent =0; currentEvent<Nevents;currentEvent++)//loop over all events
@@ -207,21 +207,15 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks)
        
        aGAliceFile->cd();
        gAlice->GetEvent(currentEvent);
-       TParticle * part = gAlice->Particle(0);
-       Double_t orz=part->Vz();
-      
+
        aClustersFile->cd();
-//       tracker = new AliITStrackerV2(geom,currentEvent,orz); //<---- this is for Massimo version
-//       tracker = new AliITStrackerV2(geom,currentEvent);
        sprintf(tname,"TreeT_ITS_%d",currentEvent);
        
        tracktree=(TTree*)aTracksFile->Get(tname);
        if (!tracktree) 
          {
            Error("Read","Can't get a tree with ITS tracks"); 
-           delete iotrack;
- //          delete tracker;
-           return 4;
+           continue;
          }
        TBranch *tbranch=tracktree->GetBranch("tracks");
       
@@ -232,7 +226,7 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks)
        Int_t itsfault = 0;
        for (i=0; i<Ntracks; i++) //loop over all tpc tracks
         { 
-          if(i%100 == 0)cout<<"all: "<<i<<"   accepted: "<<accepted<<"   tpc faults: "<<tpcfault<<"   its faults: "<<itsfault<<"\r";
+          if(i%100 == 0)cout<<"all: "<<i<<"   accepted: "<<accepted<<"   tpc faults: "<<tpcfault<<"\r";
           
           tbranch->SetAddress(&iotrack);
           tracktree->GetEvent(i);
@@ -243,15 +237,11 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks)
              tpcfault++;
              continue;
            }
-//          tracker->CookLabel(iotrack,0.);
-//          Int_t itsLabel=iotrack->GetLabel();
- //         if (itsLabel != label)
- //          {
- //           itsfault++;
- //           continue; 
- //          }
 
           TParticle *p = (TParticle*)gAlice->Particle(label);
+          if(p == 0x0) continue; //if returned pointer is NULL
+          if(p->GetPDG() == 0x0) continue; //if particle has crezy PDG code (not known to our database)
+
           if(Pass(p->GetPdgCode())) continue; //check if we are intersted with particles of this type 
                                               //if not take next partilce
             
@@ -260,7 +250,7 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks)
                                                   //if it does not delete it and take next good track
 
           
-          iotrack->Propagate(iotrack->GetAlpha(),3.,0.1/65.19*1.848,0.1*1.848);
+          iotrack->PropagateTo(3.,0.0028,65.19);
           iotrack->PropagateToVertex();
  
           iotrack->GetExternalParameters(xk,par);     //get properties of the track
@@ -295,11 +285,11 @@ Int_t AliHBTReaderITSv2::Read(AliHBTRun* particles, AliHBTRun *tracks)
 //       delete tracker;
        
        totalNevents++;
-       CloseFiles(aTracksFile,aClustersFile,aGAliceFile);     
        cout<<"all: "<<i<<"   accepted: "<<accepted<<"   tpc faults: "<<tpcfault<<"   its faults: "<<itsfault<<endl;
      
      }//end of loop over events in current directory
-     currentdir++;
+    CloseFiles(aTracksFile,aClustersFile,aGAliceFile);     
+    currentdir++;
    }while(currentdir < Ndirs);//end of loop over directories specified in fDirs Obj Array
 
  delete iotrack;