/[PAMELA software]/PamelaLevel2/src/PamLevel2.cpp
ViewVC logotype

Diff of /PamelaLevel2/src/PamLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.63 by mocchiut, Tue Sep 30 07:45:24 2008 UTC revision 1.64 by mocchiut, Wed Oct 1 16:06:19 2008 UTC
# Line 284  PamTrack::PamTrack(){ Line 284  PamTrack::PamTrack(){
284      trk_track  = 0;      trk_track  = 0;
285      calo_track = 0;      calo_track = 0;
286      tof_track  = 0;      tof_track  = 0;
287        orb_track  = 0;
288      candeleteobj = 0;      candeleteobj = 0;
289      pscore = 0;      pscore = 0;
290      iscore = 0;      iscore = 0;
# Line 295  PamTrack::PamTrack(){ Line 296  PamTrack::PamTrack(){
296  /**  /**
297   * Constructor   * Constructor
298   */   */
299  PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o){  PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r){
300    
301      trk_track  = 0;      trk_track  = 0;
302      calo_track = 0;      calo_track = 0;
303      tof_track  = 0;      tof_track  = 0;
304        orb_track  = 0;
305  //     if(t)trk_track  = new TrkTrack(*t);  //     if(t)trk_track  = new TrkTrack(*t);
306  //     if(c)calo_track = new CaloTrkVar(*c);  //     if(c)calo_track = new CaloTrkVar(*c);
307  //     if(o)tof_track  = new ToFTrkVar(*o);  //     if(o)tof_track  = new ToFTrkVar(*o);
308      if(t)trk_track  = t;      if(t)trk_track  = t;
309      if(c)calo_track = c;      if(c)calo_track = c;
310      if(o)tof_track  = o;      if(o)tof_track  = o;
311        if(r)orb_track  = r;
312      candeleteobj = 0;      candeleteobj = 0;
313    
314  };  };
# Line 314  PamTrack::PamTrack(const PamTrack& track Line 317  PamTrack::PamTrack(const PamTrack& track
317      TrkTrack   *t = track.trk_track;      TrkTrack   *t = track.trk_track;
318      CaloTrkVar *c = track.calo_track;      CaloTrkVar *c = track.calo_track;
319      ToFTrkVar  *o = track.tof_track;      ToFTrkVar  *o = track.tof_track;
320        OrbitalInfoTrkVar  *r = track.orb_track;
321    
322      trk_track  = 0;      trk_track  = 0;
323      calo_track = 0;      calo_track = 0;
324      tof_track  = 0;      tof_track  = 0;
325        orb_track  = 0;
326      if(t)trk_track  = new TrkTrack(*t);      if(t)trk_track  = new TrkTrack(*t);
327      if(c)calo_track = new CaloTrkVar(*c);      if(c)calo_track = new CaloTrkVar(*c);
328      if(o)tof_track  = new ToFTrkVar(*o);      if(o)tof_track  = new ToFTrkVar(*o);
329        if(r)orb_track  = new OrbitalInfoTrkVar(*r);
330      candeleteobj = 1;      candeleteobj = 1;
331            
332  }  }
# Line 331  void PamTrack::Clear(){ Line 337  void PamTrack::Clear(){
337          if(trk_track)  trk_track->TrkTrack::Clear();          if(trk_track)  trk_track->TrkTrack::Clear();
338          if(calo_track) calo_track->CaloTrkVar::Clear();//???          if(calo_track) calo_track->CaloTrkVar::Clear();//???
339          if(tof_track)  tof_track->ToFTrkVar::Clear();//???          if(tof_track)  tof_track->ToFTrkVar::Clear();//???
340            if(orb_track)  orb_track->OrbitalInfoTrkVar::Clear();//???
341      }else{      }else{
342          trk_track  = 0;          trk_track  = 0;
343          calo_track = 0;          calo_track = 0;
344          tof_track  = 0;          tof_track  = 0;
345            orb_track  = 0;
346      }      }
347      pscore = 0;      pscore = 0;
348      iscore = 0;      iscore = 0;
# Line 355  void PamTrack::Delete(){ Line 363  void PamTrack::Delete(){
363              tof_track->ToFTrkVar::Clear();//???              tof_track->ToFTrkVar::Clear();//???
364              delete tof_track;              delete tof_track;
365          }          }
366            if(orb_track){
367                orb_track->OrbitalInfoTrkVar::Clear();//???
368                delete orb_track;
369            }
370      }else{      }else{
371          Clear();          Clear();
372      }      }
# Line 866  ToFTrkVar *PamLevel2::GetToFStoredTrack( Line 878  ToFTrkVar *PamLevel2::GetToFStoredTrack(
878  //  //
879  //--------------------------------------  //--------------------------------------
880  /**  /**
881   * Give the pamela track associated to a tracker track, retrieving related calorimeter and tof track information.   * Retrieves the OrbitalInfo track matching the seqno-th tracker stored track.
882     * (If seqno = -1 retrieves the tracker-independent tof related track)
883     */
884    OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno){
885            
886        if( !orb_obj )return 0;
887    
888        if( orb_obj->OrbitalInfo::ntrk()==0 ){
889            cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no OrbitalInfo tracks are stored"<<endl;
890            return NULL;
891        };
892        
893        OrbitalInfoTrkVar *c = 0;
894        Int_t it_tof=0;
895        
896        do{
897            c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof);
898            it_tof++;
899        } while( c && seqno != c->trkseqno && it_tof < orb_obj->OrbitalInfo::ntrk());      
900        
901        if(!c || seqno != c->trkseqno){
902            c = 0;
903            if(seqno!=-1)cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match OrbitalInfo stored tracks"<<endl;
904        };
905        return c;
906        
907    };
908    
909    //--------------------------------------
910    //
911    //
912    //--------------------------------------
913    /**
914     * Give the pamela track associated to a tracker track, retrieving related calorimeter, orbitalinfo and tof track information.
915   */   */
916  PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t){  PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t){
917            
# Line 875  PamTrack* PamLevel2::GetPamTrackAlong(Tr Line 920  PamTrack* PamLevel2::GetPamTrackAlong(Tr
920    
921      CaloTrkVar *c = 0;      CaloTrkVar *c = 0;
922      ToFTrkVar  *o = 0;      ToFTrkVar  *o = 0;
923        OrbitalInfoTrkVar  *r = 0;
924            
925      if(CAL2) c = GetCaloStoredTrack(t->GetSeqNo());      if(CAL2) c = GetCaloStoredTrack(t->GetSeqNo());
926      if(TOF) o = GetToFStoredTrack(t->GetSeqNo());      if(TOF) o = GetToFStoredTrack(t->GetSeqNo());
927        if(ORB) r = GetOrbitalInfoStoredTrack(t->GetSeqNo());
928            
929  //    if(t && c && o)track = new PamTrack(t,c,o);  //    if(t && c && o)track = new PamTrack(t,c,o);
930      PamTrack *track = new PamTrack(t,c,o);      PamTrack *track = new PamTrack(t,c,o,r);
931            
932      return track;      return track;
933    
# Line 898  PamTrack* PamLevel2::GetPamTrackAlong(Tr Line 945  PamTrack* PamLevel2::GetPamTrackAlong(Tr
945  PamTrack* PamLevel2::GetStoredTrack(Int_t itrk){  PamTrack* PamLevel2::GetStoredTrack(Int_t itrk){
946            
947      cout <<"PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** "<<endl;      cout <<"PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** "<<endl;
948      cout <<"for the moment, better use separately the methods: TrkLevel2::GetStoredTrack(seqno) CaloLevel2::GetCaloTrkVar(Int_t notrack) ToFLevel2::GetToFTrkVar(Int_t notrack)"<<endl;      cout <<"for the moment, better use separately the methods: TrkLevel2::GetStoredTrack(seqno) CaloLevel2::GetCaloTrkVar(Int_t notrack) ToFLevel2::GetToFTrkVar(Int_t notrack) OrbitalInfo::GetOrbitalInfoTrkVar(Int_t notrack)"<<endl;
949      cout <<"(if you use it, remember to delete the PamTrack object)"<<endl;      cout <<"(if you use it, remember to delete the PamTrack object)"<<endl;
950      PamTrack *track = 0;      PamTrack *track = 0;
951            
# Line 1010  void PamLevel2::SortTracks(){ Line 1057  void PamLevel2::SortTracks(){
1057          TrkTrack   *ts = 0;          TrkTrack   *ts = 0;
1058          CaloTrkVar *cs = 0;          CaloTrkVar *cs = 0;
1059          ToFTrkVar  *os = 0;          ToFTrkVar  *os = 0;
1060            OrbitalInfoTrkVar  *rs = 0;
1061                    
1062          // get tracker tracks          // get tracker tracks
1063          TrkTrack   *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker          TrkTrack   *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker
1064          CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo());          CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo());
1065          ToFTrkVar  *op = GetToFStoredTrack(tp->GetSeqNo());          ToFTrkVar  *op = GetToFStoredTrack(tp->GetSeqNo());
1066            OrbitalInfoTrkVar  *rp = GetOrbitalInfoStoredTrack(tp->GetSeqNo());
1067    
1068          TrkTrack   *ti = 0; //tracker (image)          TrkTrack   *ti = 0; //tracker (image)
1069          CaloTrkVar *ci = 0;          CaloTrkVar *ci = 0;
1070          ToFTrkVar  *oi = 0;          ToFTrkVar  *oi = 0;
1071            OrbitalInfoTrkVar  *ri = 0;
1072          //      cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl;          //      cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl;
1073          // if track has an image, check image selection          // if track has an image, check image selection
1074    
# Line 1032  void PamLevel2::SortTracks(){ Line 1082  void PamLevel2::SortTracks(){
1082              ti = trk2_obj->TrkLevel2::GetTrackImage(i);              //tracker (image)              ti = trk2_obj->TrkLevel2::GetTrackImage(i);              //tracker (image)
1083              ci = GetCaloStoredTrack(ti->GetSeqNo());              ci = GetCaloStoredTrack(ti->GetSeqNo());
1084              oi = GetToFStoredTrack(ti->GetSeqNo());              oi = GetToFStoredTrack(ti->GetSeqNo());
1085                ri = GetOrbitalInfoStoredTrack(ti->GetSeqNo());
1086                            
1087              //      cout << "its image "<<i << " "<<hex<< ti <<dec<< endl;              //      cout << "its image "<<i << " "<<hex<< ti <<dec<< endl;
1088    
# Line 1373  void PamLevel2::SortTracks(){ Line 1424  void PamLevel2::SortTracks(){
1424                  ts = ti;//its image!!                  ts = ti;//its image!!
1425                  cs = ci;                  cs = ci;
1426                  os = oi;                  os = oi;
1427                    rs = ri;
1428                  Int_t totis = toti_score;                  Int_t totis = toti_score;
1429    
1430                  ti = tp;//its image!!                  ti = tp;//its image!!
1431                  ci = cp;                  ci = cp;
1432                  oi = op;                  oi = op;
1433                    ri = rp;
1434    
1435                  tp = ts;//its image!!                  tp = ts;//its image!!
1436                  cp = cs;                  cp = cs;
1437                  op = os;                  op = os;
1438                    rp = rs;
1439    
1440                  toti_score = totp_score;                  toti_score = totp_score;
1441                  totp_score = totis;                  totp_score = totis;
# Line 1411  void PamLevel2::SortTracks(){ Line 1465  void PamLevel2::SortTracks(){
1465          //      cout<<"o "<<cp<<endl;          //      cout<<"o "<<cp<<endl;
1466          //      cout<<"o "<<op<<endl;          //      cout<<"o "<<op<<endl;
1467    
1468          new(ttsorted[i]) PamTrack(tp,cp,op);          new(ttsorted[i]) PamTrack(tp,cp,op,rp);
1469          new(ttimage[i])  PamTrack(ti,ci,oi);          new(ttimage[i])  PamTrack(ti,ci,oi,ri);
1470    
1471          ((PamTrack*)(ttsorted[i]))->SetPScore(totp_score);          ((PamTrack*)(ttsorted[i]))->SetPScore(totp_score);
1472          ((PamTrack*)(ttsorted[i]))->SetIScore(toti_score);          ((PamTrack*)(ttsorted[i]))->SetIScore(toti_score);

Legend:
Removed from v.1.63  
changed lines
  Added in v.1.64

  ViewVC Help
Powered by ViewVC 1.1.23