コード例 #1
0
Int_t IlcDCHFindClustersFast(Int_t n=0) {
   
   IlcRunLoader* rl = IlcRunLoader::Open("gilc.root");
   if (rl == 0x0) {
      cerr<<"Can not open session"<<endl;
      return 1;
   }
   
   IlcLoader *dchl = (IlcLoader*)rl->GetLoader("DCHLoader");
   if (dchl == 0x0) {
      cerr<<"Can not get DCH Loader"<<endl;
      return 1;
   }
   if (dchl->LoadHits()) {
      cerr<<"Error occured while loading hits"<<endl;
      return 1;
   }


   if (dchl->LoadRecPoints("recreate")) {
      cerr<<"Error occured while loading digits"<<endl;
      return 1;
   }
   
   if (rl->LoadgIlc()) {
      cerr<<"Error occured while l"<<endl;
      return 1;
   }
   rl->LoadKinematics();
   rl->LoadTrackRefs();
   rl->LoadHeader();
   gIlc=rl->GetIlcRun();
   if (!gIlc) {
      cerr<<"Can't get gIlc !\n";
      return 1;
   }

   TDirectory *cwd = gDirectory;

   IlcDCH *dch = (IlcDCH*)gIlc->GetDetector("DCH"); 
//   Int_t ver = dch->IsVersion(); 
//   cerr<<"DCH version "<<ver<<" has been found !\n";
   
   /*if (!gGeoManager) {
     TString geom = "geometry.root";
     TGeoManager::Import(geom.Data());
     }*/
   IlcDCHParam *param=dch->GetParam();
   //param->ReadGeoMatrices();
//   param->SetMWPCReadout(false);

   rl->CdGAFile();

   TStopwatch timer;
   
//    IlcDCHwireposition *wireMatr = new IlcDCHwireposition();
//    IlcDCHclusterizer *clus = new IlcDCHclusterizer("clusterer", "DCH clusterizer");
//    IlcDCHFast dchfast(wireMatr,clus);
   IlcDCHFast dchfast;
   //n = 30;
  
  if (n==0) n = rl->GetNumberOfEvents();

   for(Int_t i=0;i<n;i++){
     printf("Processing event %d\n",i);
     rl->GetEvent(i);
     //     tpcfast.Hits2ExactClusters(rl);
    
     dchfast.Hits2Clusters(rl,i);

   } 
   
   timer.Stop(); 
   timer.Print();
   //cleans everything
   delete rl;
   
//    delete wireMatr;
//    delete clus;


   return 0;
}
コード例 #2
0
ファイル: kine_tracks.C プロジェクト: brettviren/ORKA-ILCRoot
TEveTrackList*
kine_tracks(Double_t min_pt,  Double_t min_p,
	    Bool_t   pdg_col, Bool_t   recurse,
	    Bool_t   use_track_refs)
{
  IlcRunLoader* rl =  IlcEveEventManager::AssertRunLoader();
  rl->LoadKinematics();
  IlcStack* stack = rl->Stack();
  if (!stack)
  {
    Error("kine_tracks", "can not get kinematics.");
    return 0;
  }

  gEve->DisableRedraw();

  TEveTrackList* cont = new TEveTrackList("Kine Tracks");
  cont->SetMainColor(3);
  TEveTrackPropagator* trkProp = cont->GetPropagator();

  kine_track_propagator_setup(trkProp);

  gEve->AddElement(cont);
  Int_t count = 0;
  Int_t Np = stack->GetNprimary();
  for (Int_t i = 0; i < Np; ++i)
  {
    TParticle* p = stack->Particle(i);
    if (p->GetStatusCode() <= 1)
    {
      if (p->Pt() < min_pt && p->P() < min_p) continue;

      ++count;
      IlcEveTrack* track = new IlcEveTrack(p, i, trkProp);

      //PH The line below is replaced waiting for a fix in Root
      //PH which permits to use variable siza arguments in CINT
      //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
      //PH    track->SetName(Form("%s [%d]", p->GetName(), i));
      char form[1000];
      sprintf(form,"%s [%d]", p->GetName(), i);
      track->SetName(form);
      track->SetStdTitle();
      Int_t ml = p->GetMother(0);
      if (ml != -1)
      {
        track->SetTitle(Form("%s\nMother label=%d\nMother Pdg=%d",
                             track->GetElementTitle(),
                             ml, stack->Particle(ml)->GetPdgCode()));
      }
      set_track_color(track, pdg_col);

      gEve->AddElement(track, cont);

      if (recurse)
	kine_daughters(track, stack, min_pt, min_p, pdg_col, recurse);
    }
  }

  // set path marks
  IlcEveKineTools kt;
  kt.SetDaughterPathMarks(cont, stack, recurse);
  if (use_track_refs && rl->LoadTrackRefs() == 0)
  {
    kt.SetTrackReferences(cont, rl->TreeTR(), recurse);
    trkProp->SetEditPathMarks(kTRUE);
  }
  kt.SortPathMarks(cont, recurse);

  //PH  const Text_t* tooltip = Form("min pT=%.2lf, min P=%.2lf), N=%d", min_pt, min_p, count);
  char tooltip[1000];
  sprintf(tooltip,"min pT=%.2lf, min P=%.2lf), N=%d", min_pt, min_p, count);
  cont->SetTitle(tooltip); // Not broadcasted automatically ...

  cont->MakeTracks(recurse);
  gEve->EnableRedraw();
  gEve->Redraw3D();

  return cont;
}