Changes in / [d8b1858:365dbc9] in git
- Files:
-
- 10 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
classes/SortableObject.h
rd8b1858 r365dbc9 43 43 public: 44 44 virtual ~CompBase() { } 45 virtual Bool_t IsSortable(const TObject * obj) const { return kTRUE; }45 virtual Bool_t IsSortable(const TObject *) const { return kTRUE; } 46 46 virtual Int_t Compare(const TObject *obj1, const TObject *obj2) const = 0; 47 47 }; -
display/DisplayLinkDef.h
rd8b1858 r365dbc9 32 32 #include "display/DelphesDisplay.h" 33 33 #include "display/DelphesCaloData.h" 34 #include "display/DelphesBranchElement.h" 35 #include "display/Delphes3DGeometry.h" 36 #include "display/DelphesEventDisplay.h" 37 #include "display/DelphesHtmlSummary.h" 38 #include "display/DelphesPlotSummary.h" 34 39 35 40 #ifdef __CINT__ … … 41 46 #pragma link C++ class DelphesDisplay+; 42 47 #pragma link C++ class DelphesCaloData+; 48 #pragma link C++ class DelphesBranchElement<DelphesCaloData>-!; 49 #pragma link C++ class DelphesBranchElement<TEveElementList>-!; 50 #pragma link C++ class DelphesBranchElement<TEveTrackList>-!; 51 #pragma link C++ class Delphes3DGeometry; 52 #pragma link C++ class DelphesEventDisplay; 53 #pragma link C++ class DelphesHtmlObjTable; 54 #pragma link C++ class DelphesHtmlSummary; 55 #pragma link C++ class DelphesPlotSummary; 43 56 44 57 #endif -
examples/EventDisplay.C
rd8b1858 r365dbc9 1 2 void evdisplay(const char* configfile = "delphes_card_CMS.tcl", const char* datafile = "delphes_output.root", 3 const char* ParticlePropagator="ParticlePropagator", 4 const char* TrackingEfficiency="ChargedHadronTrackingEfficiency", 5 const char* MuonEfficiency="MuonEfficiency", 6 const char* Calorimeters="Calorimeter") 7 { 8 // load the libraries 9 gSystem->Load("libGeom"); 10 gSystem->Load("libGuiHtml"); 11 gSystem->Load("../libDelphesDisplay"); 12 13 // create the detector representation 14 Delphes3DGeometry det3D(new TGeoManager("delphes", "Delphes geometry")); 15 det3D.readFile(configfile, ParticlePropagator, TrackingEfficiency, MuonEfficiency, Calorimeters); 16 17 // create the application items 18 DelphesEventDisplay* display = new DelphesEventDisplay(configfile, datafile, det3D); 19 1 20 /* 2 root -l examples/EventDisplay.C'("examples/delphes_card_CMS.tcl","delphes_output.root")' 3 ShowEvent(1); 4 ShowEvent(2); 21 // EClipType not exported to CINT (see TGLUtil.h): 22 // 0 - no clip, 1 - clip plane, 2 - clip box 23 TGLViewer *v = gEve->GetDefaultGLViewer(); 24 //Double_t plane[4] = { 0., 1., 0., 0. }; 25 //v->GetClipSet()->SetClipState(1,plane); 26 //v->GetClipSet()->SetClipType(1); 27 //v->ColorSet().Background().SetColor(kMagenta+4); 28 //v->SetGuideState(TGLUtil::kAxesEdge, kTRUE, kFALSE, 0); 29 v->RefreshPadEditor(v); 30 v->CurrentCamera().RotateRad(-1.2, 0.5); 31 v->DoDraw(); 5 32 */ 6 7 //------------------------------------------------------------------------------8 9 // radius of the barrel, in m10 Double_t gRadius = 1.29;11 12 // half-length of the barrel, in m13 Double_t gHalfLength = 3.0;14 15 // magnetic field16 Double_t gBz = 3.8;17 18 TAxis *gEtaAxis = 0;19 TAxis *gPhiAxis = 0;20 21 //------------------------------------------------------------------------------22 23 #include <set>24 #include <vector>25 26 using namespace std;27 28 class ExRootTreeReader;29 class DelphesCaloData;30 class DelphesDisplay;31 32 TChain gChain("Delphes");33 34 ExRootTreeReader *gTreeReader = 0;35 36 TClonesArray *gBranchTower = 0;37 TClonesArray *gBranchTrack = 0;38 TClonesArray *gBranchJet = 0;39 40 DelphesCaloData *gCaloData = 0;41 TEveElementList *gJetList = 0;42 TEveTrackList *gTrackList = 0;43 44 DelphesDisplay *gDelphesDisplay = 0;45 46 //------------------------------------------------------------------------------47 48 void EventDisplay(const char *configFile, const char *inputFile)49 {50 gSystem->Load("libDelphesDisplay");51 52 TEveManager::Create(kTRUE, "IV");53 54 ExRootConfParam param, paramEtaBins;55 Long_t i, j, size, sizeEtaBins;56 set< Double_t > etaSet;57 set< Double_t >::iterator itEtaSet;58 59 Double_t *etaBins;60 61 ExRootConfReader *confReader = new ExRootConfReader;62 confReader->ReadFile(configFile);63 64 gRadius = confReader->GetDouble("ParticlePropagator::Radius", 1.0);65 gHalfLength = confReader->GetDouble("ParticlePropagator::HalfLength", 3.0);66 gBz = confReader->GetDouble("ParticlePropagator::Bz", 0.0);67 68 // read eta and phi bins69 param = confReader->GetParam("Calorimeter::EtaPhiBins");70 size = param.GetSize();71 etaSet.clear();72 for(i = 0; i < size/2; ++i)73 {74 paramEtaBins = param[i*2];75 sizeEtaBins = paramEtaBins.GetSize();76 77 for(j = 0; j < sizeEtaBins; ++j)78 {79 etaSet.insert(paramEtaBins[j].GetDouble());80 }81 }82 83 delete confReader;84 85 etaBins = new Double_t[etaSet.size()];86 i = 0;87 88 for(itEtaSet = etaSet.begin(); itEtaSet != etaSet.end(); ++itEtaSet)89 {90 etaBins[i] = *itEtaSet;91 ++i;92 }93 94 gEtaAxis = new TAxis(etaSet.size() - 1, etaBins);95 gPhiAxis = new TAxis(72, -TMath::Pi(), TMath::Pi());96 97 // Create chain of root trees98 gChain.Add(inputFile);99 100 // Create object of class ExRootTreeReader101 gTreeReader = new ExRootTreeReader(&gChain);102 103 // Get pointers to branches104 gBranchTower = gTreeReader->UseBranch("Tower");105 gBranchTrack = gTreeReader->UseBranch("Track");106 gBranchJet = gTreeReader->UseBranch("Jet");107 108 // data109 gCaloData = new DelphesCaloData(2);110 gCaloData->RefSliceInfo(0).Setup("ECAL", 0.1, kRed);111 gCaloData->RefSliceInfo(1).Setup("HCAL", 0.1, kBlue);112 gCaloData->SetEtaBins(gEtaAxis);113 gCaloData->SetPhiBins(gPhiAxis);114 gCaloData->IncDenyDestroy();115 116 gJetList = new TEveElementList("Jets");117 gEve->AddElement(gJetList);118 119 gTrackList = new TEveTrackList("Tracks");120 gTrackList->SetMainColor(kBlue);121 gTrackList->SetMarkerColor(kRed);122 gTrackList->SetMarkerStyle(kCircle);123 gTrackList->SetMarkerSize(0.5);124 gEve->AddElement(gTrackList);125 126 TEveTrackPropagator *trkProp = gTrackList->GetPropagator();127 trkProp->SetMagField(0.0, 0.0, -gBz);128 trkProp->SetMaxR(gRadius*100.0);129 trkProp->SetMaxZ(gHalfLength*100.0);130 131 // viewers and scenes132 133 TEveElementList *geometry = new TEveElementList("Geometry");134 135 TEveGeoShape *barell = new TEveGeoShape("Barell");136 barell->SetShape(new TGeoTube(gRadius*100.0 - 1, gRadius*100.0, gHalfLength*100.0));137 barell->SetMainColor(kCyan);138 barell->SetMainTransparency(80);139 geometry->AddElement(barell);140 141 TEveCalo3D *calo = new TEveCalo3D(gCaloData);142 calo->SetBarrelRadius(gRadius*100.0);143 calo->SetEndCapPos(gHalfLength*100.0);144 145 gStyle->SetPalette(1, 0);146 TEveCaloLego *lego = new TEveCaloLego(gCaloData);147 lego->InitMainTrans();148 lego->RefMainTrans().SetScale(TMath::TwoPi(), TMath::TwoPi(), TMath::Pi());149 lego->SetAutoRebin(kFALSE);150 lego->Set2DMode(TEveCaloLego::kValSizeOutline);151 152 gDelphesDisplay = new DelphesDisplay;153 154 gEve->AddGlobalElement(geometry);155 gEve->AddGlobalElement(calo);156 157 gDelphesDisplay->ImportGeomRPhi(geometry);158 gDelphesDisplay->ImportCaloRPhi(calo);159 160 gDelphesDisplay->ImportGeomRhoZ(geometry);161 gDelphesDisplay->ImportCaloRhoZ(calo);162 163 gDelphesDisplay->ImportCaloLego(lego);164 165 gEve->Redraw3D(kTRUE);166 33 } 167 34 168 //------------------------------------------------------------------------------169 170 void ShowEvent(Long64_t event)171 {172 TIter itTower(gBranchTower);173 TIter itTrack(gBranchTrack);174 TIter itJet(gBranchJet);175 176 Tower *tower;177 Track *track;178 Jet *jet;179 180 TEveJetCone *eveJetCone;181 TEveTrack *eveTrack;182 183 Int_t counter;184 185 TEveElement *currentEvent = gEve->GetCurrentEvent();186 187 TEveTrackPropagator *trkProp = gTrackList->GetPropagator();188 189 if(event >= gTreeReader->GetEntries()) return;190 191 // Load selected branches with data from specified event192 gTreeReader->ReadEntry(event);193 194 gCaloData->ClearTowers();195 gJetList->DestroyElements();196 gTrackList->DestroyElements();197 198 // Loop over all towers199 itTower.Reset();200 while((tower = (Tower *) itTower.Next()))201 {202 gCaloData->AddTower(tower->Edges[0], tower->Edges[1], tower->Edges[2], tower->Edges[3]);203 gCaloData->FillSlice(0, tower->Eem);204 gCaloData->FillSlice(1, tower->Ehad);205 }206 gCaloData->DataChanged();207 208 // Loop over all tracks209 itTrack.Reset();210 counter = 0;211 while((track = (Track *) itTrack.Next()))212 {213 TParticle pb(track->PID, 1, 0, 0, 0, 0,214 track->P4().Px(), track->P4().Py(),215 track->P4().Pz(), track->P4().E(),216 track->X, track->Y, track->Z, 0.0);217 218 eveTrack = new TEveTrack(&pb, counter, trkProp);219 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++));220 eveTrack->SetStdTitle();221 eveTrack->SetAttLineAttMarker(gTrackList);222 223 switch(TMath::Abs(track->PID))224 {225 case 11:226 eveTrack->SetLineColor(kRed);227 break;228 case 13:229 eveTrack->SetLineColor(kGreen);230 break;231 default:232 eveTrack->SetLineColor(kBlue);233 }234 gTrackList->AddElement(eveTrack);235 eveTrack->MakeTrack();236 }237 238 // Loop over all jets239 itJet.Reset();240 counter = 0;241 while((jet = (Jet *) itJet.Next()))242 {243 eveJetCone = new TEveJetCone();244 eveJetCone->SetName(Form("jet [%d]", counter++));245 eveJetCone->SetMainTransparency(60);246 eveJetCone->SetLineColor(kYellow);247 eveJetCone->SetCylinder(gRadius*100.0 - 10, gHalfLength*100.0 - 10);248 eveJetCone->SetPickable(kTRUE);249 eveJetCone->AddEllipticCone(jet->Eta, jet->Phi, jet->DeltaEta, jet->DeltaPhi);250 gJetList->AddElement(eveJetCone);251 }252 253 gDelphesDisplay->DestroyEventRPhi();254 gDelphesDisplay->ImportEventRPhi(currentEvent);255 256 gDelphesDisplay->DestroyEventRhoZ();257 gDelphesDisplay->ImportEventRhoZ(currentEvent);258 259 gEve->Redraw3D(kTRUE);260 }
Note:
See TracChangeset
for help on using the changeset viewer.