Fork me on GitHub

Changeset 30bb83a in git


Ignore:
Timestamp:
Oct 16, 2014, 10:11:54 PM (10 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
369744d
Parents:
fafc433
Message:

Some small cleaning

Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • display/DelphesBranchElement.cc

    rfafc433 r30bb83a  
    4343template<> void DelphesBranchElement<TEveElementList>::Reset() { data_->DestroyElements(); }
    4444
    45 //TODO: does the type really make sense?
    4645// special case for track lists
    4746template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color):DelphesBranchBase(name, type, color) {
    48       if(TString(type)=="track") {
    4947        data_ = new TEveTrackList(name);
    5048        data_->SetMainColor(color_);
     
    5250        data_->SetMarkerStyle(kCircle);
    5351        data_->SetMarkerSize(0.5);
    54       } else if(TString(type)=="photon") {
    55         data_ = new TEveTrackList(name);
    56         data_->SetMainColor(color_);
    57         data_->SetMarkerColor(color_);
    58         data_->SetMarkerStyle(kCircle);
    59         data_->SetMarkerSize(0.5);
    60       } else {
    61         data_ = new TEveTrackList(name);
    62         data_->SetMainColor(color_);
    63         data_->SetMarkerColor(color_);
    64         data_->SetMarkerStyle(kCircle);
    65         data_->SetMarkerSize(0.5);
    66         //throw std::exception();
    67       }
    6852    }
    6953template<> void DelphesBranchElement<TEveTrackList>::Reset() { data_->DestroyElements(); }
  • display/DelphesEventDisplay.cc

    rfafc433 r30bb83a  
    6666   tkHalfLength_ = det3D.getTrackerHalfLength();
    6767   bz_ = det3D.getBField();
    68 
    69    //TODO specific to some classical detector... could use better the det3D
    7068   TGeoVolume* top = det3D.getDetector(false);
    7169   geom->SetTopVolume(top);
    7270   TEveElementList *geometry = new TEveElementList("Geometry");
    73    TEveGeoTopNode* trk = new TEveGeoTopNode(gGeoManager, top->FindNode("tracker_1"));
    74    trk->SetVisLevel(6);
    75    geometry->AddElement(trk);
    76    TEveGeoTopNode* calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_barrel_1"));
    77    calo->SetVisLevel(3);
    78    geometry->AddElement(calo);
    79    calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_endcap_1"));
    80    calo->SetVisLevel(3);
    81    calo->UseNodeTrans();
    82    geometry->AddElement(calo);
    83    calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_endcap_2"));
    84    calo->SetVisLevel(3);
    85    calo->UseNodeTrans();
    86    geometry->AddElement(calo);
    87    TEveGeoTopNode* muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_barrel_1"));
    88    muon->SetVisLevel(4);
    89    geometry->AddElement(muon);
    90    muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_endcap_1"));
    91    muon->SetVisLevel(4);
    92    muon->UseNodeTrans();
    93    geometry->AddElement(muon);
    94    muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_endcap_2"));
    95    muon->SetVisLevel(4);
    96    muon->UseNodeTrans();
    97    geometry->AddElement(muon);
    98    //gGeoManager->DefaultColors();
     71   TObjArray* nodes = top->GetNodes();
     72   TIter itNodes(nodes);
     73   TGeoNode* nodeobj;
     74   TEveGeoTopNode* node;
     75   while((nodeobj = (TGeoNode*)itNodes.Next())) {
     76     node = new TEveGeoTopNode(gGeoManager,nodeobj);
     77     node->UseNodeTrans();
     78     geometry->AddElement(node);
     79   }
    9980
    10081   // Create chain of root trees
     
    145126
    146127}
     128
    147129// function that parses the config to extract the branches of interest and prepare containers
    148130void DelphesEventDisplay::readConfig(const char *configFile, Delphes3DGeometry& det3D, std::vector<DelphesBranchBase*>& elements, std::vector<TClonesArray*>& arrays) {
     
    216198       continue;
    217199     }
    218 //TODO one possible simplification could be to add the array to the element class.
    219200     arrays.push_back(treeReader_->UseBranch(name));
    220201   }
     
    237218}
    238219
    239 
    240 //______________________________________________________________________________
    241220void DelphesEventDisplay::load_event()
    242221{
     
    244223   // The contents of previous event are removed.
    245224
     225   // safety
     226   if(event_id_ >= treeReader_->GetEntries() || event_id_<0 ) return;
     227
    246228   //TODO move this to the status bar ???
    247229   printf("Loading event %d.\n", event_id_);
    248 
    249230
    250231   // clear the previous event
     
    254235   }
    255236
    256    // read the new event
    257    delphes_read();
     237   // Load selected branches with data from specified event
     238   treeReader_->ReadEntry(event_id_);
     239
     240   // loop over selected branches, and apply the proper recipe to fill the collections.
     241   // this is basically to loop on arrays_ to fill elements_.
     242   std::vector<TClonesArray*>::iterator data = arrays_.begin();
     243   std::vector<DelphesBranchBase*>::iterator element = elements_.begin();
     244   for(; data<arrays_.end() && element<elements_.end(); ++data, ++element) {
     245     TString type = (*element)->GetType();
     246     // branch on the element type
     247     if(type=="tower") delphes_read_towers(*data,*element);
     248     else if(type=="track" || type=="photon" || type=="electron" || type=="muon" || type=="genparticle") delphes_read_tracks(*data,*element);
     249     else if(type=="jet") delphes_read_jets(*data,*element);
     250     else if(type=="vector") delphes_read_vectors(*data,*element);
     251   }
    258252
    259253   // update display
     
    264258   delphesDisplay_->ImportEventRhoZ(top);
    265259   //update_html_summary();
     260
    266261   gEve->Redraw3D(kFALSE, kTRUE);
    267 }
    268 
    269 void DelphesEventDisplay::delphes_read()
    270 {
    271 
    272   // safety
    273   if(event_id_ >= treeReader_->GetEntries() || event_id_<0 ) return;
    274 
    275   // Load selected branches with data from specified event
    276   treeReader_->ReadEntry(event_id_);
    277 
    278   // loop over selected branches, and apply the proper recipe to fill the collections.
    279   // this is basically to loop on arrays_ to fill elements_.
    280 
    281 //TODO: one option would be to have templated methods in the element classes. We could simply call "element.fill()"
    282   std::vector<TClonesArray*>::iterator data = arrays_.begin();
    283   std::vector<DelphesBranchBase*>::iterator element = elements_.begin();
    284   for(; data<arrays_.end() && element<elements_.end(); ++data, ++element) {
    285     TString type = (*element)->GetType();
    286     // branch on the element type
    287     if(type=="tower") delphes_read_towers(*data,*element);
    288     else if(type=="track" || type=="photon" || type=="electron" || type=="muon" || type=="genparticle") delphes_read_tracks(*data,*element);
    289     else if(type=="jet") delphes_read_jets(*data,*element);
    290     else if(type=="vector") delphes_read_vectors(*data,*element);
    291   }
    292262}
    293263
  • display/DelphesEventDisplay.h

    rfafc433 r30bb83a  
    4545    void make_gui();
    4646    void load_event();
    47     void delphes_read();
    4847    void delphes_read_towers(TClonesArray* data, DelphesBranchBase* element);
    4948    void delphes_read_tracks(TClonesArray* data, DelphesBranchBase* element);
Note: See TracChangeset for help on using the changeset viewer.