コード例 #1
0
void ilceve_create_vsd(Int_t nEvents=1, Int_t minTracks=0)
{
  // Invoke from a running ilceve.
  // nEvents will be domped starting from current one.
  // If minTracks is set at least that many ESD tracks must exist.

  TEveVSD::DisableTObjectStreamersForVSDStruct();

  IlcEveVSDCreator vc;
  vc.SetDebugLevel(2);

  Int_t nDone = 0;
  while (nDone < nEvents)
  {
    if (minTracks)
    {
      IlcESDEvent* esd = IlcEveEventManager::AssertESD();
      while (esd->GetNumberOfTracks() < minTracks)
      {
	IlcEveEventManager::GetMaster()->NextEvent();
	esd = IlcEveEventManager::AssertESD();
      }
    }
    vc.CreateVSD("IlcVSD.root");
    ++nDone;

    IlcEveEventManager::GetMaster()->NextEvent();
  }
}
コード例 #2
0
void esd_kink_fill_pointset(TEvePointSet* ps)
{
  IlcESDEvent* esd = IlcEveEventManager::AssertESD();

  for (Int_t n=0; n<esd->GetNumberOfTracks(); ++n)
  { 
      IlcESDtrack* track = esd->GetTrack(n);
      if(track->GetKinkIndex(0)<0){
    
          IlcESDkink *kink = esd->GetKink(TMath::Abs(track->GetKinkIndex(0))-1);
	  const TVector3 Position(kink->GetPosition());
	  ps->SetNextPoint(Position.X(), Position.Y(), Position.Z());
          ps->SetPointId(kink);
      }
  }

}
コード例 #3
0
void test(const char * sdir ="signal",
	  const char * bdir ="backgr") {

  TStopwatch timer;
  timer.Start();

  TString name;

  // Signal file, tree, and branch
  name = sdir;
  name += "/IlcESDs.root";
  TFile * fSig = TFile::Open(name.Data());
  TTree * tSig = (TTree*)fSig->Get("esdTree");

  IlcESDEvent * esdSig = new IlcESDEvent();// The signal ESD object is put here
  esdSig->ReadFromTree(tSig);

  // Run loader (signal events)
  name = sdir;
  name += "/gilc.root";
  IlcRunLoader* rlSig = IlcRunLoader::Open(name.Data());

  // Run loader (underlying events)
  name = bdir;
  name += "/gilc.root";
  IlcRunLoader* rlUnd = IlcRunLoader::Open(name.Data(),"Underlying");

  // gIlc
  rlSig->LoadgIlc();
  rlUnd->LoadgIlc();
  gIlc = rlSig->GetIlcRun();

  // Now load kinematics and event header
  rlSig->LoadKinematics();
  rlSig->LoadHeader();
  rlUnd->LoadKinematics();
  rlUnd->LoadHeader();

  // Loop on events: check that MC and data contain the same number of events
  Long64_t nevSig = rlSig->GetNumberOfEvents();
  Long64_t nevUnd = rlUnd->GetNumberOfEvents();
  Long64_t nSigPerUnd = nevSig/nevUnd;

  cout << nevSig << " signal events" << endl;
  cout << nevUnd << " underlying events" << endl;
  cout << nSigPerUnd << " signal events per one underlying" << endl;

  for (Int_t iev=0; iev<nevSig; iev++) {
    cout << "Signal event " << iev << endl;
    Int_t ievUnd = iev/nSigPerUnd;
    cout << "Underlying event " << ievUnd << endl;

    // Get signal ESD
    tSig->GetEntry(iev);
    // Get signal kinematics
    rlSig->GetEvent(iev);
    // Get underlying kinematics
    rlUnd->GetEvent(ievUnd);

    // Particle stack
    IlcStack * stackSig = rlSig->Stack();
    Int_t nPartSig = stackSig->GetNtrack();
    IlcStack * stackUnd = rlUnd->Stack();
    Int_t nPartUnd = stackUnd->GetNtrack();

    Int_t nrec = esdSig->GetNumberOfTracks();
    cout << nrec << " reconstructed tracks" << endl;
    for(Int_t irec=0; irec<nrec; irec++) {
      IlcESDtrack * track = esdSig->GetTrack(irec);
      UInt_t label = TMath::Abs(track->GetTPCLabel());
      if (label>=10000000) {
	// Underlying event. 10000000 is the
	// value of fkMASKSTEP in IlcRunDigitizer
// 	cout << " Track from the underlying event" << endl;
	label %=10000000;
	if (label>=nPartUnd) continue;
	TParticle * part = stackUnd->Particle(label);
 	if(part) part->Print();
      }
      else {
	cout << " Track " << label << " from the signal event" << endl;
	if (label>=nPartSig) {
	  cout <<"Strange, label outside the range "<< endl;
	  continue;
	}
	TParticle * part = stackSig->Particle(label);
	if(part) part->Print();
      }

    }

  }

  fSig->Close();

  timer.Stop();
  timer.Print();
}
コード例 #4
0
ファイル: clusters.C プロジェクト: brettviren/ORKA-ILCRoot
void clusters()
{
  IlcEveEventManager::AssertGeometry();

  IlcRunLoader *rl        = IlcEveEventManager::AssertRunLoader();
  IlcESDEvent  *esd       = IlcEveEventManager::AssertESD();
  IlcEveEventManager::AssertESDfriend();
  IlcEveEventManager::AssertMagField();

  const char* detNames[] = { "ITS", "TPC", /*"TRD",*/ "TOF", "HMPID" };
  const Int_t detIds[]   = {   0,     1,   /*  2,  */   3,     5   };
  const Int_t detN       = sizeof(detNames)/sizeof(char*);

  // Hack - IlcReconstruction does wonders with gGeoManager.
  TGeoManager* xxx = gGeoManager; gGeoManager = 0;
  IlcReconstruction* reco = new IlcReconstruction;
  gGeoManager = xxx;

  // Hack for ITS - it requires RecoParams outside event-loop!
  reco->SetRecoParam("ITS", IlcITSRecoParam::GetLowFluxParam());

  reco->ImportRunLoader(rl);
  {
    TString alldets;
    for (Int_t i = 0; i < detN; ++i) {
      alldets += detNames[i];
      alldets += " ";
    }
    reco->CreateTrackers(alldets);
  }

  TObjArray* clarr = new TObjArray();

  // Load clusters, fill them into clarr.

  for (Int_t i = 0; i < detN; ++i)
  {
    Int_t det = detIds[i];
    rl->LoadRecPoints(detNames[i]);

    TTree *cTree = rl->GetTreeR(detNames[i], false);
    if (cTree == 0)
      continue;

    IlcTracker* tracker = reco->GetTracker(det);
    if (tracker == 0) continue;
    tracker->LoadClusters(cTree);
    tracker->FillClusterArray(clarr);
  }

  // Loop over tracks and friends, tag used clusters.

  for (Int_t n = 0; n < esd->GetNumberOfTracks(); ++n)
  {
    IlcESDtrack* at = esd->GetTrack(n);

    Int_t idx[200];
    for (Int_t i = 0; i < detN; ++i)
    {
      Int_t det = detIds[i];
      IlcTracker* tracker = reco->GetTracker(det);
      if (tracker == 0) continue;
      Int_t nclusters = at->GetClusters(det, idx);
      Int_t p=0;
      for (Int_t c = 0; c < nclusters; )
      {
        Int_t index = idx[p++];
        if (index < 0) continue;
        c++;
        IlcCluster* cluster = tracker->GetCluster(index);
        if (cluster) cluster->IncreaseClusterUsage();
        //else printf("Zero cluster pointer for detector: %s\n",detNames[i]);
      }
    }
  }

  for (Int_t i = 0; i < detN; ++i)
    rl->UnloadRecPoints(detNames[i]);

  // Fill visualization structs

  TEveElementList* list = new TEveElementList("Clusters");
  gEve->AddElement(list);

  TEvePointSet* shared = new TEvePointSet("Shared Clusters");
  shared->SetMainColor(2);
  shared->SetMarkerSize(0.4);
  shared->SetMarkerStyle(2);
  list->AddElement(shared);

  TEvePointSet* used = new TEvePointSet("Single-used Clusters");
  used->SetMainColor(3);
  used->SetMarkerSize(0.4);
  used->SetMarkerStyle(2);
  list->AddElement(used);

  TEvePointSet* nonused = new TEvePointSet("Not-used Clusters");
  nonused->SetMainColor(4);
  nonused->SetMarkerSize(0.4);
  nonused->SetMarkerStyle(2);
  list->AddElement(nonused);

  // Loop over all clusters, fill appropriate container based
  // on shared/used information.

  Int_t ncl = clarr->GetEntriesFast();
  for (Int_t i = 0; i < ncl; ++i)
  {
    IlcCluster   *cluster = (IlcCluster*) clarr->UncheckedAt(i);
    TEvePointSet *dest    = 0;
    if (cluster->IsClusterShared())
      dest = shared;
    else if (cluster->IsClusterUsed())
      dest = used;
    else
      dest = nonused;

    Float_t g[3]; //global coordinates
    cluster->GetGlobalXYZ(g);
    dest->SetNextPoint(g[0], g[1], g[2]);
    dest->SetPointId(cluster);
  }

  delete clarr;

  // ??? What to do with trackers ???
  // I'd propose: have global reconstruction that owns them.
  // IlcEveEventManager::AssertIlcReconstruction();
  // do we have bit-field for detectors, like
  // enum IlcDetectors_e {
  //    kITS = BIT(0),
  //    kTPC = BIT(1),
  //    ...
  //    kCentralTracking = kITS | kTPC | kTRD | kTOF,
  //    ...
  //  };

  gEve->Redraw3D();
}
コード例 #5
0
Int_t IlcESDanalysis() {
    TStopwatch timer;

    gStyle->SetOptStat(111110);
    gStyle->SetOptFit(1);

    Double_t V0mass=0.497672, V0width=0.020, V0window=0.05;
    Double_t mmin=V0mass-V0window, mmax=V0mass+V0window;
    TH1F *hm =new TH1F("hm","K0s",40, mmin, mmax);
    hm->SetXTitle("Mass (GeV/c**2)");
    hm->SetLineColor(2);
    TH1F *hp =new TH1F("hp","Momentum of the positive daughter",40, 0, 2);
    hp->SetXTitle("P (GeV/c)");
    hp->SetLineColor(4);

//****** File with the ESD
    TFile *ef=TFile::Open("IlcESDs.root");
    if (!ef || !ef->IsOpen()) {
        cerr<<"Can't IlcESDs.root !\n";
        return 1;
    }
    IlcESDEvent* event = new IlcESDEvent();
    TTree* tree = (TTree*) ef->Get("esdTree");
    if (!tree) {
        cerr<<"no ESD tree found\n";
        return 1;
    };
    event->ReadFromTree(tree);

    Int_t n=0;

//******* The loop over events
    while (tree->GetEvent(n)) {
        cout<<endl<<"Processing event number : "<<n++<<endl;

        Int_t ntrk=event->GetNumberOfTracks();
        cout<<"Number of ESD tracks : "<<ntrk<<endl;
        Int_t nv0=event->GetNumberOfV0s();
        cout<<"Number of ESD V0s : "<<nv0<<endl;
        Int_t ncas=event->GetNumberOfCascades();
        cout<<"Number of ESD cascades : "<<ncas<<endl;

        //****** The loop over tracks
        Int_t nk=0;
        while (ntrk--) {
            IlcESDtrack *track=event->GetTrack(ntrk);
            UInt_t status=track->GetStatus();

            //select only tracks with the "combined PID"
            if ((status&IlcESDtrack::kESDpid)==0) continue;

            Double_t w[10];
            track->GetESDpid(w);
            //count only "Kaon-like" tracks
            if (w[3]>w[4] && w[3]>w[2] && w[3]>w[1] && w[3]>w[0]) nk++;
        }
        cout<<"Number of \"Kaon-like\" tracks : "<<nk<<endl;

        //****** The loop over V0s
        while (nv0--) {
            IlcESDv0 *v0=event->GetV0(nv0);
            v0->ChangeMassHypothesis(310); // K0s
            Double_t mass=v0->GetEffMass();
            hm->Fill(mass);

            Int_t pidx=v0->GetPindex();               // now let's get an access
            IlcESDtrack *track=event->GetTrack(pidx); // to the positive daughter
            Double_t p=track->GetP();
            hp->Fill(p);
        }

        //****** The loop over cascades
        while (ncas--) {
            IlcESDcascade *cas=event->GetCascade(ncas);
            Double_t q; //"quality" of the associated Lambda
            cas->ChangeMassHypothesis(q,3312); // Xi-
            // Here you do something with your Xis
            //  ...
            // You can get the access to the daughters
        }

    }

    delete event;
    ef->Close();

    timer.Stop();
    timer.Print();

    TCanvas *c1=new TCanvas("c1","",0,0,600,1200);
    c1->Divide(1,2);

    c1->cd(1);
    hm->Fit("gaus","","",V0mass-V0width,V0mass+V0width);

    c1->cd(2);
    hp->Fit("expo","","",0.3,2);

    return 0;
}