Fork me on GitHub

Changes in / [f688c89:52315d4] in git


Ignore:
Location:
modules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • modules/Calorimeter.cc

    rf688c89 r52315d4  
    557557    tower->Eem = ecalNeutralEnergy;
    558558    tower->Ehad = 0.0;
     559    tower->PID = 22;
    559560   
    560561    fEFlowPhotonOutputArray->Add(tower);
  • modules/SimpleCalorimeter.cc

    rf688c89 r52315d4  
    5858  fItParticleInputArray(0), fItTrackInputArray(0)
    5959{
    60   Int_t i;
    61 
     60 
    6261  fResolutionFormula = new DelphesFormula;
    63 
    64   for(i = 0; i < 2; ++i)
    65   {
    66     fTowerTrackArray[i] = new TObjArray;
    67     fItTowerTrackArray[i] = fTowerTrackArray[i]->MakeIterator();
    68   }
     62  fTowerTrackArray = new TObjArray;
     63  fItTowerTrackArray = fTowerTrackArray->MakeIterator();
     64 
    6965}
    7066
     
    7369SimpleCalorimeter::~SimpleCalorimeter()
    7470{
    75   Int_t i;
    76 
     71 
    7772  if(fResolutionFormula) delete fResolutionFormula;
    78 
    79   for(i = 0; i < 2; ++i)
    80   {
    81     if(fTowerTrackArray[i]) delete fTowerTrackArray[i];
    82     if(fItTowerTrackArray[i]) delete fItTowerTrackArray[i];
    83   }
     73  if(fTowerTrackArray) delete fTowerTrackArray;
     74  if(fItTowerTrackArray) delete fItTowerTrackArray;
     75 
    8476}
    8577
     
    198190  Double_t fraction;
    199191  Double_t energy;
    200   Double_t sigma;
    201192  Int_t pdgCode;
    202193
     
    340331      fTowerEnergy = 0.0;
    341332
    342       fTrackEnergy[0] = 0.0;
    343       fTrackEnergy[1] = 0.0;
     333      fTrackEnergy = 0.0;
     334      fTrackSigma = 0.0;
    344335
    345336      fTowerTime = 0.0;
     
    351342      fTowerPhotonHits = 0;
    352343
    353       fTowerTrackArray[0]->Clear();
    354       fTowerTrackArray[1]->Clear();
    355     }
     344      fTowerTrackArray->Clear();
     345     }
    356346
    357347    // check for track hits
     
    366356      energy = momentum.E() * fTrackFractions[number];
    367357
    368       fTrackTime += energy*position.T();
    369       fTrackTimeWeight += energy;
     358      fTrackTime += TMath::Sqrt(energy)*position.T();
     359      fTrackTimeWeight += TMath::Sqrt(energy);
    370360
    371361      if(fTrackFractions[number] > 1.0E-9)
    372362      {
    373         sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E());
    374         if(sigma/momentum.E() < track->TrackResolution)
    375         {
    376           fTrackEnergy[0] += energy;
    377           fTowerTrackArray[0]->Add(track);
    378         }
    379         else
    380         {
    381           fTrackEnergy[1] += energy;
    382           fTowerTrackArray[1]->Add(track);
    383         }
     363             
     364       // compute total charged energy   
     365       fTrackEnergy += energy;
     366       fTrackSigma += ((track->TrackResolution)*momentum.E())*((track->TrackResolution)*momentum.E());
     367       
     368       fTowerTrackArray->Add(track);
     369     
    384370      }
     371       
    385372      else
    386373      {
     
    418405{
    419406  Candidate *tower, *track, *mother;
    420   Double_t energy, pt, eta, phi;
    421   Double_t sigma;
     407  Double_t energy,neutralEnergy, pt, eta, phi;
     408  Double_t sigma, neutralSigma;
    422409  Double_t time;
     410   
     411  Double_t weightTrack, weightCalo, bestEnergyEstimate, rescaleFactor;
    423412
    424413  TLorentzVector momentum;
     
    436425
    437426  if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0;
     427
    438428
    439429  if(fSmearTowerCenter)
     
    464454  if(energy > 0.0) fTowerOutputArray->Add(fTower);
    465455
    466   // fill e-flow candidates
    467 
    468   energy -= fTrackEnergy[1];
    469 
    470   fItTowerTrackArray[0]->Reset();
    471   while((track = static_cast<Candidate*>(fItTowerTrackArray[0]->Next())))
    472   {
    473     mother = track;
    474     track = static_cast<Candidate*>(track->Clone());
    475     track->AddCandidate(mother);
    476 
    477     track->Momentum *= energy/fTrackEnergy[0];
    478 
    479     fEFlowTrackOutputArray->Add(track);
    480   }
    481 
    482   fItTowerTrackArray[1]->Reset();
    483   while((track = static_cast<Candidate*>(fItTowerTrackArray[1]->Next())))
    484   {
    485     mother = track;
    486     track = static_cast<Candidate*>(track->Clone());
    487     track->AddCandidate(mother);
    488 
    489     fEFlowTrackOutputArray->Add(track);
    490   }
    491 
    492   if(fTowerTrackArray[0]->GetEntriesFast() > 0) energy = 0.0;
    493 
    494   sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy);
    495   if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0;
    496 
    497   // save energy excess as an energy flow tower
    498   if(energy > 0.0)
     456 
     457  // e-flow candidates
     458
     459  //compute neutral excess
     460 
     461  fTrackSigma = TMath::Sqrt(fTrackSigma);
     462  neutralEnergy = max( (energy - fTrackEnergy) , 0.0);
     463 
     464  //compute sigma_trk total
     465  neutralSigma = neutralEnergy / TMath::Sqrt(fTrackSigma*fTrackSigma+ sigma*sigma);
     466   
     467  // if neutral excess is significant, simply create neutral Eflow tower and clone each track into eflowtrack
     468  if(neutralEnergy > fEnergyMin && neutralSigma > fEnergySignificanceMin)
    499469  {
    500470    // create new photon tower
    501471    tower = static_cast<Candidate*>(fTower->Clone());
    502     pt = energy / TMath::CosH(eta);
    503 
    504     tower->Eem = (!fIsEcal) ? 0 : energy;
    505     tower->Ehad = (fIsEcal) ? 0 : energy;
     472    pt = neutralEnergy / TMath::CosH(eta);
     473
     474    tower->Eem = (!fIsEcal) ? 0 : neutralEnergy;
     475    tower->Ehad = (fIsEcal) ? 0 : neutralEnergy;
     476    tower->PID = (fIsEcal) ? 22 : 0;
     477 
     478    tower->Momentum.SetPtEtaPhiE(pt, eta, phi, neutralEnergy);
     479    fEFlowTowerOutputArray->Add(tower);
    506480   
    507     tower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
     481    fItTowerTrackArray->Reset();
     482    while((track = static_cast<Candidate*>(fItTowerTrackArray->Next())))
     483    {
     484      mother = track;
     485      track = static_cast<Candidate*>(track->Clone());
     486      track->AddCandidate(mother);
     487
     488      fEFlowTrackOutputArray->Add(track);
     489    }
     490  }
    508491   
    509     tower->PID = (fIsEcal) ? 22 : 0;
    510    
    511     fEFlowTowerOutputArray->Add(tower);
    512   }
    513 }
     492  // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking
     493  else if (fTrackEnergy > 0.0)
     494  {
     495    weightTrack = (fTrackSigma > 0.0) ? 1 / (fTrackSigma*fTrackSigma) : 0.0;
     496    weightCalo  = (sigma > 0.0) ? 1 / (sigma*sigma) : 0.0;
     497 
     498    bestEnergyEstimate = (weightTrack*fTrackEnergy + weightCalo*energy) / (weightTrack + weightCalo);
     499    rescaleFactor = bestEnergyEstimate/fTrackEnergy;
     500   
     501    fItTowerTrackArray->Reset();
     502    while((track = static_cast<Candidate*>(fItTowerTrackArray->Next())))
     503    {
     504      mother = track;
     505      track = static_cast<Candidate*>(track->Clone());
     506      track->AddCandidate(mother);
     507
     508      track->Momentum *= rescaleFactor;
     509
     510      fEFlowTrackOutputArray->Add(track);
     511    }
     512  }
     513   
     514 }
    514515
    515516//------------------------------------------------------------------------------
  • modules/SimpleCalorimeter.h

    rf688c89 r52315d4  
    5959  Double_t fTowerEta, fTowerPhi, fTowerEdges[4];
    6060  Double_t fTowerEnergy;
    61   Double_t fTrackEnergy[2];
     61  Double_t fTrackEnergy;
    6262
    6363  Double_t fTowerTime;
     
    7272
    7373  Double_t fEnergySignificanceMin;
     74
     75  Double_t fTrackSigma;
    7476
    7577  Bool_t fSmearTowerCenter;
     
    102104  TObjArray *fEFlowTowerOutputArray; //!
    103105
    104   TObjArray *fTowerTrackArray[2]; //!
    105   TIterator *fItTowerTrackArray[2]; //!
     106  TObjArray *fTowerTrackArray; //!
     107  TIterator *fItTowerTrackArray; //!
    106108
    107109  void FinalizeTower();
Note: See TracChangeset for help on using the changeset viewer.