Fork me on GitHub

Changeset 1385 in svn for trunk/examples/Example3.C


Ignore:
Timestamp:
Apr 17, 2014, 1:41:34 PM (11 years ago)
Author:
Pavel Demin
Message:

fix cards and Example3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/Example3.C

    r1357 r1385  
    9595  TClonesArray *branchPhoton = treeReader->UseBranch("Photon");
    9696  TClonesArray *branchMuon = treeReader->UseBranch("Muon");
     97
     98  TClonesArray *branchTrack = treeReader->UseBranch("Track");
     99  TClonesArray *branchTower = treeReader->UseBranch("Tower");
    97100
    98101  TClonesArray *branchEFlowTrack = treeReader->UseBranch("EFlowTrack");
     
    167170
    168171    // Loop over all tracks in event
    169     for(i = 0; i < branchEFlowTrack->GetEntriesFast(); ++i)
    170     {
    171       track = (Track*) branchEFlowTrack->At(i);
     172    for(i = 0; i < branchTrack->GetEntriesFast(); ++i)
     173    {
     174      track = (Track*) branchTrack->At(i);
    172175      particle = (GenParticle*) track->Particle.GetObject();
    173176
     
    197200        if(object->IsA() == GenParticle::Class())
    198201        {
    199           cout<<"    GenPart pt: "<<((GenParticle*) object)->PT<<", eta: "<<((GenParticle*) object)->Eta<<", phi: "<<((GenParticle*) object)->Phi<<endl;
    200           momentum += ((GenParticle*) object)->P4();
     202          particle = (GenParticle*) object;
     203          cout << "    GenPart pt: " << particle->PT << ", eta: " << particle->Eta << ", phi: " << particle->Phi << endl;
     204          momentum += particle->P4();
    201205        }
    202206        else if(object->IsA() == Track::Class())
    203207        {
    204           cout<<"    Track pt: "<<((Track*) object)->PT<<", eta: "<<((Track*) object)->Eta<<", phi: "<<((Track*) object)->Phi<<endl;
    205           momentum += ((Track*) object)->P4();
     208          track = (Track*) object;
     209          cout << "    Track pt: " << track->PT << ", eta: " << track->Eta << ", phi: " << track->Phi << endl;
     210          momentum += track->P4();
    206211        }
    207212        else if(object->IsA() == Tower::Class())
    208213        {
    209           cout<<"    Tower pt: "<<((Tower*) object)->ET<<", eta: "<<((Tower*) object)->Eta<<", phi: "<<((Tower*) object)->Phi<<endl;
    210           momentum += ((Tower*) object)->P4();
     214          tower = (Tower*) object;
     215          cout << "    Tower pt: " << tower->ET << ", eta: " << tower->Eta << ", phi: " << tower->Phi << endl;
     216          momentum += tower->P4();
    211217        }
    212218        else if(object->IsA() == Muon::Class())
    213219        {
    214           cout<<"    Muon pt: "<<((Muon*) object)->PT<<", eta: "<<((Muon*) object)->Eta<<", phi: "<<((Muon*) object)->Phi<<endl;
    215           momentum += ((Muon*) object)->P4();
     220          muon = (Muon*) object;
     221          cout << "    Muon pt: " << muon->PT << ", eta: " << muon->Eta << ", phi: " << muon->Phi << endl;
     222          momentum += muon->P4();
    216223        }
    217224      }
Note: See TracChangeset for help on using the changeset viewer.