Fork me on GitHub

Changeset a844c07 in git for examples


Ignore:
Timestamp:
Oct 13, 2014, 10:18:02 PM (10 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
ffd01cb
Parents:
b4cd1e7
Message:

More objects available for display

Are shown: electron, muons, photons, genjets. For now, collections are hardcoded.
The MET issue in projection is still there.
Other items on the todo-list: better GUI controls, additional tabs with
full 3D geometry, summary, and plots.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/geometry.C

    rb4cd1e7 ra844c07  
    6161Int_t event_id           = 0; // Current event id.
    6262Double_t gRadius = 1.29;
     63Double_t gTotRadius = 2.0;
    6364Double_t gHalfLength = 3.0;
    6465Double_t gBz = 3.8;
     
    7374TClonesArray *gBranchTower = 0;
    7475TClonesArray *gBranchTrack = 0;
     76TClonesArray *gBranchEle = 0;
     77TClonesArray *gBranchMuon = 0;
     78TClonesArray *gBranchPhoton = 0;
    7579TClonesArray *gBranchJet = 0;
     80TClonesArray *gBranchGenJet = 0;
    7681TClonesArray *gBranchMet = 0;
    7782
    7883DelphesCaloData *gCaloData = 0;
    7984TEveElementList *gJetList = 0;
     85TEveElementList *gGenJetList = 0;
    8086TEveArrow *gMet = 0;
    8187TEveTrackList *gTrackList = 0;
     88TEveTrackList *gElectronList = 0;
     89TEveTrackList *gMuonList = 0;
     90TEveTrackList *gPhotonList = 0;
    8291
    8392DelphesDisplay *gDelphesDisplay = 0;
     
    110119
    111120     Double_t getTrackerRadius() const { return tk_radius_; }
     121     Double_t getDetectorRadius() const { return muonSystem_radius_; }
    112122     Double_t getTrackerHalfLength() const { return tk_length_; }
    113123     Double_t getBField() const { return tk_Bz_; }
     
    136146     Double_t calo_endcap_thickness_;
    137147     Double_t muonSystem_thickn_;
     148     Double_t muonSystem_radius_;
    138149     Double_t tk_radius_;
    139150     Double_t tk_length_;
     
    183194   tk_etamax_ = 3.0;
    184195   tk_Bz_     = 1.;
     196   muonSystem_radius_ = 200.;
    185197}
    186198
     
    268280   etaAxis_ = new TAxis(caloBinning.size() - 1, etaBins);
    269281   phiAxis_ = new TAxis(72, -TMath::Pi(), TMath::Pi()); // note that this is fixed while #phibins could vary, also with eta, which doesn't seem possible in ROOT
     282
     283   muonSystem_radius_ = tk_radius_ + contingency_ + (contingency_+calo_barrel_thickness_)*calorimeters_.size() + muonSystem_thickn_;
    270284
    271285   delete confReader;
     
    485499   // build the detector
    486500   gRadius = det3D.getTrackerRadius();
     501   gTotRadius = det3D.getDetectorRadius();
    487502   gHalfLength = det3D.getTrackerHalfLength();
    488503   gBz = det3D.getBField();
     
    528543
    529544   // Get pointers to branches
    530    gBranchTower = gTreeReader->UseBranch("Tower");
    531    gBranchTrack = gTreeReader->UseBranch("Track");
    532    gBranchJet   = gTreeReader->UseBranch("Jet");
    533    gBranchMet   = gTreeReader->UseBranch("MissingET");
    534 
    535545//TODO make it configurable, for more objects (or can we guess from the config?)
    536 // idea: for pf objects, we could use the TEveCompound to show track + cluster ??? (nice display but little meaning)
    537 // for MET and SHT, show an arrow (tooltip = title)
    538 // for electrons and muons, create additional track collections
    539 // for photons, use TEveStraightLineSet
    540 
    541 /*
    542   add Branch Calorimeter/eflowTracks EFlowTrack Track
    543   add Branch Calorimeter/eflowPhotons EFlowPhoton Tower
    544   add Branch Calorimeter/eflowNeutralHadrons EFlowNeutralHadron Tower
    545 
    546   add Branch GenJetFinder/jets GenJet Jet
    547 
    548   add Branch UniqueObjectFinder/jets Jet Jet
    549 
    550   add Branch UniqueObjectFinder/electrons Electron Electron
    551   add Branch UniqueObjectFinder/photons Photon Photon
    552   add Branch UniqueObjectFinder/muons Muon Muon
    553 
    554   add Branch MissingET/momentum MissingET MissingET
    555   add Branch ScalarHT/energy ScalarHT ScalarHT
    556 */
     546   gBranchTower  = gTreeReader->UseBranch("Tower");
     547   gBranchTrack  = gTreeReader->UseBranch("Track");
     548   gBranchEle    = gTreeReader->UseBranch("Electron");
     549   gBranchMuon   = gTreeReader->UseBranch("Muon");
     550   gBranchPhoton = gTreeReader->UseBranch("Photon");
     551   gBranchJet    = gTreeReader->UseBranch("Jet");
     552   gBranchGenJet = gTreeReader->UseBranch("GenJet");
     553   gBranchMet    = gTreeReader->UseBranch("MissingET");
    557554
    558555   // data
     
    565562
    566563   gJetList = new TEveElementList("Jets");
     564   gJetList->SetMainColor(kYellow);
    567565   gEve->AddElement(gJetList);
     566
     567   gGenJetList = new TEveElementList("GenJets");
     568   gGenJetList->SetMainColor(kCyan);
     569   gGenJetList->SetRnrSelf(false);
     570   gGenJetList->SetRnrChildren(false);
     571   gEve->AddElement(gGenJetList);
    568572
    569573   gMet = new TEveArrow(1., 0., 0., 0., 0., 0.);
     
    574578   gEve->GetCurrentEvent()->AddElement(gMet);
    575579
     580   TEveTrackPropagator *trkProp;
     581
     582   gElectronList = new TEveTrackList("Electrons");
     583   gElectronList->SetMainColor(kRed);
     584   gElectronList->SetMarkerColor(kViolet);
     585   gElectronList->SetMarkerStyle(kCircle);
     586   gElectronList->SetMarkerSize(0.5);
     587   gEve->AddElement(gElectronList);
     588   trkProp = gElectronList->GetPropagator();
     589   trkProp->SetMagField(0.0, 0.0, -gBz);
     590   trkProp->SetMaxR(gRadius);
     591   trkProp->SetMaxZ(gHalfLength);
     592
     593   gMuonList = new TEveTrackList("Muons");
     594   gMuonList->SetMainColor(kGreen);
     595   gMuonList->SetMarkerColor(kViolet);
     596   gMuonList->SetMarkerStyle(kCircle);
     597   gMuonList->SetMarkerSize(0.5);
     598   gEve->AddElement(gMuonList);
     599   trkProp = gMuonList->GetPropagator();
     600   trkProp->SetMagField(0.0, 0.0, -gBz);
     601   trkProp->SetMaxR(gTotRadius);
     602   trkProp->SetMaxZ(gHalfLength);
     603
    576604   gTrackList = new TEveTrackList("Tracks");
    577605   gTrackList->SetMainColor(kBlue);
     
    580608   gTrackList->SetMarkerSize(0.5);
    581609   gEve->AddElement(gTrackList);
    582 
    583    TEveTrackPropagator *trkProp = gTrackList->GetPropagator();
     610   trkProp = gTrackList->GetPropagator();
    584611   trkProp->SetMagField(0.0, 0.0, -gBz);
     612   trkProp->SetMaxR(gRadius);
     613   trkProp->SetMaxZ(gHalfLength);
     614
     615   gPhotonList= new TEveTrackList("Photons");
     616   gPhotonList->SetMainColor(kYellow);
     617   gPhotonList->SetLineStyle(7);
     618   gPhotonList->SetMarkerColor(kViolet);
     619   gPhotonList->SetMarkerStyle(kCircle);
     620   gPhotonList->SetMarkerSize(0.5);
     621   gEve->AddElement(gPhotonList);
     622   trkProp = gPhotonList->GetPropagator();
     623   trkProp->SetMagField(0.0, 0.0, 0.0);
    585624   trkProp->SetMaxR(gRadius);
    586625   trkProp->SetMaxZ(gHalfLength);
     
    623662   if(gCaloData) gCaloData->ClearTowers();
    624663   if(gJetList) gJetList->DestroyElements();
     664   if(gGenJetList) gGenJetList->DestroyElements();
    625665   if(gTrackList) gTrackList->DestroyElements();
     666   if(gElectronList) gElectronList->DestroyElements();
     667   if(gMuonList) gMuonList->DestroyElements();
     668   if(gPhotonList) gPhotonList->DestroyElements();
    626669
    627670   delphes_read();
     
    643686  TIter itTower(gBranchTower);
    644687  TIter itTrack(gBranchTrack);
     688  TIter itElectron(gBranchEle);
     689  TIter itPhoton(gBranchPhoton);
     690  TIter itMuon(gBranchMuon);
    645691  TIter itJet(gBranchJet);
     692  TIter itGenJet(gBranchGenJet);
    646693  TIter itMet(gBranchMet);
    647694
    648695  Tower *tower;
    649696  Track *track;
     697  Electron *electron;
     698  Muon *muon;
     699  Photon *photon;
    650700  Jet *jet;
    651701  MissingET *MET;
     
    658708
    659709  TEveTrackPropagator *trkProp = gTrackList->GetPropagator();
     710  TEveTrackPropagator *photProp = gPhotonList->GetPropagator();
    660711  if(event_id >= gTreeReader->GetEntries()) return;
    661712
    662713  // Load selected branches with data from specified event
    663714  gTreeReader->ReadEntry(event_id);
     715
    664716  // Loop over all towers
    665717  itTower.Reset();
     
    671723  }
    672724  gCaloData->DataChanged();
     725
    673726  // Loop over all tracks
    674727  itTrack.Reset();
    675728  counter = 0;
    676   while((track = (Track *) itTrack.Next()))
    677   {
     729  while((track = (Track *) itTrack.Next())) {
    678730    TParticle pb(track->PID, 1, 0, 0, 0, 0,
    679731                 track->P4().Px(), track->P4().Py(),
     
    685737    eveTrack->SetStdTitle();
    686738    eveTrack->SetAttLineAttMarker(gTrackList);
    687 
    688     switch(TMath::Abs(track->PID))
    689     {
    690       case 11:
    691         eveTrack->SetLineColor(kRed);
    692         break;
    693       case 13:
    694         eveTrack->SetLineColor(kGreen);
    695         break;
    696       default:
    697         eveTrack->SetLineColor(kBlue);
    698     }
    699739    gTrackList->AddElement(eveTrack);
     740    eveTrack->SetLineColor(kBlue);
    700741    eveTrack->MakeTrack();
    701742    maxPt = maxPt > track->PT ? maxPt : track->PT;
    702743  }
     744
     745  // Loop over all electrons
     746  itElectron.Reset();
     747  counter = 0;
     748  while((electron = (Electron *) itElectron.Next())) {
     749    TParticle pb(electron->Charge<0?11:-11, 1, 0, 0, 0, 0,
     750                 electron->P4().Px(), electron->P4().Py(),
     751                 electron->P4().Pz(), electron->P4().E(),
     752                 0., 0., 0., 0.);
     753
     754    eveTrack = new TEveTrack(&pb, counter, trkProp);
     755    eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++));
     756    eveTrack->SetStdTitle();
     757    eveTrack->SetAttLineAttMarker(gElectronList);
     758    gElectronList->AddElement(eveTrack);
     759    eveTrack->SetLineColor(kRed);
     760    eveTrack->MakeTrack();
     761    maxPt = maxPt > electron->PT ? maxPt : electron->PT;
     762  }
     763
     764  // Loop over all photons
     765  itPhoton.Reset();
     766  counter = 0;
     767  while((photon = (Photon *) itPhoton.Next())) {
     768    TParticle pb(22, 1, 0, 0, 0, 0,
     769                 photon->P4().Px(), photon->P4().Py(),
     770                 photon->P4().Pz(), photon->P4().E(),
     771                 0., 0., 0., 0.);
     772
     773    eveTrack = new TEveTrack(&pb, counter, photProp);
     774    eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++));
     775    eveTrack->SetStdTitle();
     776    eveTrack->SetAttLineAttMarker(gPhotonList);
     777    gPhotonList->AddElement(eveTrack);
     778    eveTrack->SetLineColor(kYellow);
     779    eveTrack->MakeTrack();
     780    maxPt = maxPt > photon->PT ? maxPt : photon->PT;
     781  }
     782
     783  // Loop over all muons
     784  itMuon.Reset();
     785  counter = 0;
     786  while((muon = (Muon *) itMuon.Next())) {
     787    TParticle pb(muon->Charge<0?13:-13, 1, 0, 0, 0, 0,
     788                 muon->P4().Px(), muon->P4().Py(),
     789                 muon->P4().Pz(), muon->P4().E(),
     790                 0., 0., 0., 0.);
     791
     792    eveTrack = new TEveTrack(&pb, counter, trkProp);
     793    eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++));
     794    eveTrack->SetStdTitle();
     795    eveTrack->SetAttLineAttMarker(gMuonList);
     796    gMuonList->AddElement(eveTrack);
     797    eveTrack->SetLineColor(kGreen);
     798    eveTrack->MakeTrack();
     799    maxPt = maxPt > muon->PT ? maxPt : muon->PT;
     800  }
     801
    703802  // Loop over all jets
    704803  itJet.Reset();
     
    707806  {
    708807    eveJetCone = new TEveJetCone();
     808    eveJetCone->SetTitle(Form("jet [%d]: Pt=%f, Eta=%f, \nPhi=%f, M=%f",counter,jet->PT, jet->Eta, jet->Phi, jet->Mass));
    709809    eveJetCone->SetName(Form("jet [%d]", counter++));
    710810    eveJetCone->SetMainTransparency(60);
    711811    eveJetCone->SetLineColor(kYellow);
     812    eveJetCone->SetFillColor(kYellow);
    712813    eveJetCone->SetCylinder(gRadius - 10, gHalfLength - 10);
    713814    eveJetCone->SetPickable(kTRUE);
     
    715816    gJetList->AddElement(eveJetCone);
    716817    maxPt = maxPt > jet->PT ? maxPt : jet->PT;
     818  }
     819
     820  // Loop over all genjets
     821  itJet.Reset();
     822  counter = 0;
     823  while((jet = (Jet *) itGenJet.Next()))
     824  {
     825    eveJetCone = new TEveJetCone();
     826    eveJetCone->SetTitle(Form("jet [%d]: Pt=%f, Eta=%f, \nPhi=%f, M=%f",counter,jet->PT, jet->Eta, jet->Phi, jet->Mass));
     827    eveJetCone->SetName(Form("jet [%d]", counter++));
     828    eveJetCone->SetMainTransparency(60);
     829    eveJetCone->SetLineColor(kCyan);
     830    eveJetCone->SetFillColor(kCyan);
     831    eveJetCone->SetCylinder(gRadius - 10, gHalfLength - 10);
     832    eveJetCone->SetPickable(kTRUE);
     833    eveJetCone->AddEllipticCone(jet->Eta, jet->Phi, jet->DeltaEta, jet->DeltaPhi);
     834    gGenJetList->AddElement(eveJetCone);
    717835  }
    718836
     
    724842    gMet = new TEveArrow((gRadius * MET->MET/maxPt)*cos(MET->Phi), (gRadius * MET->MET/maxPt)*sin(MET->Phi), 0., 0., 0., 0.);
    725843    gMet->SetMainColor(kViolet);
    726 //    gMet->SetTubeR(0.04);
     844    gMet->SetTubeR(0.04);
     845    gMet->SetConeR(0.08);
     846    gMet->SetConeL(0.10);
    727847    gMet->SetPickable(kTRUE);
    728848    gMet->SetName("Missing Et");
Note: See TracChangeset for help on using the changeset viewer.