Fork me on GitHub

Changeset 307 in svn for trunk


Ignore:
Timestamp:
Mar 9, 2009, 9:47:21 PM (16 years ago)
Author:
severine ovyn
Message:

LHCO advanced

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Delphes.cpp

    r306 r307  
    4747#include "LHEFConverter.h"
    4848#include "STDHEPConverter.h"
     49#include "LHCOConverter.h"
    4950
    5051#include "SmearUtil.h"
     
    7778int main(int argc, char *argv[])
    7879{
    79 
     80 
    8081  int appargc = 2;
    8182  char *appName= new char[20];
     
    8788  delete [] appName;
    8889  delete [] appOpt;
    89 
     90 
    9091  if(argc != 3 && argc != 4 && argc != 5) {
    9192    cout << " Usage: " << argv[0] << " input_file output_file [detector_card] [trigger_card] " << endl;
     
    9697    exit(1);
    9798  }
    98 
    99 
    100  
    101  
    102 cout << endl << endl;
    103 
    104 cout <<"*********************************************************************"<< endl;
    105 cout <<"*********************************************************************"<< endl;
    106 cout <<"**                                                                 **"<< endl;
    107 cout <<"**                            Welcome to                           **"<< endl;
    108 cout <<"**                                                                 **"<< endl;
    109 cout <<"**                                                                 **"<< endl;
    110 cout <<"**     .ddddddd-            lL             hH                      **"<< endl;
    111 cout <<"**     -Dd` `dD:           Ll             hH`                      **"<< endl;
    112 cout <<"**     dDd   dDd    eeee.  lL  .pp+pp    Hh+hhh`   -eeee- `sssss   **"<< endl;
    113 cout <<"**    -Dd   `DD   ee. ee  Ll   .Pp. PP   Hh. HH.  ee. ee  sSs      **"<< endl;
    114 cout <<"**    dD`   dDd  eEeee:   lL.  pP.  pP  hH   hH` eEeee:` -sSSSs.   **"<< endl;
    115 cout <<"**   .Dd  :dd    eE.     LlL   PpppPP   Hh  Hh   eE         sSS    **"<< endl;
    116 cout <<"**   dddddd:.     eee+:  lL.  pp.      hh.  hh    eee+  sssssS     **"<< endl;
    117 cout <<"**                            Pp                                   **"<< endl;
    118 cout <<"**                                                                 **"<< endl;
    119 cout <<"**           Delphes, a framework for the fast simulation          **"<< endl;
    120 cout <<"**                 of a  generic collider experiment               **"<< endl;
    121 cout <<"**                                                                 **"<< endl;
    122 cout <<"**                --- Version 1.4beta of Delphes ---               **"<< endl;
    123 cout <<"**               Last date of change: 9 February 2009              **"<< endl;
    124 cout <<"**                                                                 **"<< endl;
    125 cout <<"**                                                                 **"<< endl;
    126 cout <<"**     This package uses:                                          **"<< endl;
    127 cout <<"**     ------------------                                          **"<< endl;
    128 cout <<"**     FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **"<< endl;
    129 cout <<"**     Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2]  **"<< endl;
    130 cout <<"**     FROG:                               [hep-ex/0901.2718v1]    **"<< endl;
    131 cout <<"**                                                                 **"<< endl;
    132 cout <<"**-----------------------------------------------------------------**"<< endl;
    133 cout <<"**                                                                 **"<< endl;
    134 cout <<"**   Main authors:                                                 **"<< endl;
    135 cout <<"**   -------------                                                 **"<< endl;
    136 cout <<"**                                                                 **"<< endl;
    137 cout <<"**              Séverine Ovyn               Xavier Rouby           **"<< endl;
    138 cout <<"**       severine.ovyn@uclouvain.be      xavier.rouby@cern         **"<< endl;
    139 cout <<"**       Center for Particle Physics and Phenomenology (CP3)       **"<< endl;
    140 cout <<"**       Universite Catholique de Louvain (UCL)                    **"<< endl;
    141 cout <<"**       Louvain-la-Neuve, Belgium                                 **"<< endl;
    142 cout <<"**                                                                 **"<< endl;
    143 cout <<"**-----------------------------------------------------------------**"<< endl;
    144 cout <<"**                                                                 **"<< endl;
    145 cout <<"**   Former Delphes versions and documentation can be found on :   **"<< endl;
    146 cout <<"**               http://www.fynu.ucl.ac.be/delphes.html            **"<< endl;
    147 cout <<"**                                                                 **"<< endl;
    148 cout <<"**                                                                 **"<< endl;
    149 cout <<"**   Disclaimer: this program is a beta version of Delphes and     **"<< endl;
    150 cout <<"** therefore comes without guarantees. Beware of errors and please **"<< endl;
    151 cout <<"**        give us your feedbacks about potential bugs              **"<< endl;
    152 cout <<"**                                                                 **"<< endl;
    153 cout <<"*********************************************************************"<< endl;
    154 cout <<"*********************************************************************"<< endl;
    155  
    156 // 1. ********** initialisation ***********
    157 
     99 
     100 
     101 
     102  
     103  cout << endl << endl;
     104 
     105  cout <<"*********************************************************************"<< endl;
     106  cout <<"*********************************************************************"<< endl;
     107  cout <<"**                                                                 **"<< endl;
     108  cout <<"**                            Welcome to                           **"<< endl;
     109  cout <<"**                                                                 **"<< endl;
     110  cout <<"**                                                                 **"<< endl;
     111  cout <<"**     .ddddddd-            lL             hH                      **"<< endl;
     112  cout <<"**     -Dd` `dD:           Ll             hH`                      **"<< endl;
     113  cout <<"**     dDd   dDd    eeee.  lL  .pp+pp    Hh+hhh`   -eeee- `sssss   **"<< endl;
     114  cout <<"**    -Dd   `DD   ee. ee  Ll   .Pp. PP   Hh. HH.  ee. ee  sSs      **"<< endl;
     115  cout <<"**    dD`   dDd  eEeee:   lL.  pP.  pP  hH   hH` eEeee:` -sSSSs.   **"<< endl;
     116  cout <<"**   .Dd  :dd    eE.     LlL   PpppPP   Hh  Hh   eE         sSS    **"<< endl;
     117  cout <<"**   dddddd:.     eee+:  lL.  pp.      hh.  hh    eee+  sssssS     **"<< endl;
     118  cout <<"**                            Pp                                   **"<< endl;
     119  cout <<"**                                                                 **"<< endl;
     120  cout <<"**           Delphes, a framework for the fast simulation          **"<< endl;
     121  cout <<"**                 of a  generic collider experiment               **"<< endl;
     122  cout <<"**                                                                 **"<< endl;
     123  cout <<"**                --- Version 1.4beta of Delphes ---               **"<< endl;
     124  cout <<"**               Last date of change: 9 February 2009              **"<< endl;
     125  cout <<"**                                                                 **"<< endl;
     126  cout <<"**                                                                 **"<< endl;
     127  cout <<"**     This package uses:                                          **"<< endl;
     128  cout <<"**     ------------------                                          **"<< endl;
     129  cout <<"**     FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **"<< endl;
     130  cout <<"**     Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2]  **"<< endl;
     131  cout <<"**     FROG:                               [hep-ex/0901.2718v1]    **"<< endl;
     132  cout <<"**                                                                 **"<< endl;
     133  cout <<"**-----------------------------------------------------------------**"<< endl;
     134  cout <<"**                                                                 **"<< endl;
     135  cout <<"**   Main authors:                                                 **"<< endl;
     136  cout <<"**   -------------                                                 **"<< endl;
     137  cout <<"**                                                                 **"<< endl;
     138  cout <<"**              Séverine Ovyn               Xavier Rouby           **"<< endl;
     139  cout <<"**       severine.ovyn@uclouvain.be      xavier.rouby@cern         **"<< endl;
     140  cout <<"**       Center for Particle Physics and Phenomenology (CP3)       **"<< endl;
     141  cout <<"**       Universite Catholique de Louvain (UCL)                    **"<< endl;
     142  cout <<"**       Louvain-la-Neuve, Belgium                                 **"<< endl;
     143  cout <<"**                                                                 **"<< endl;
     144  cout <<"**-----------------------------------------------------------------**"<< endl;
     145  cout <<"**                                                                 **"<< endl;
     146  cout <<"**   Former Delphes versions and documentation can be found on :   **"<< endl;
     147  cout <<"**               http://www.fynu.ucl.ac.be/delphes.html            **"<< endl;
     148  cout <<"**                                                                 **"<< endl;
     149  cout <<"**                                                                 **"<< endl;
     150  cout <<"**   Disclaimer: this program is a beta version of Delphes and     **"<< endl;
     151  cout <<"** therefore comes without guarantees. Beware of errors and please **"<< endl;
     152  cout <<"**        give us your feedbacks about potential bugs              **"<< endl;
     153  cout <<"**                                                                 **"<< endl;
     154  cout <<"*********************************************************************"<< endl;
     155  cout <<"*********************************************************************"<< endl;
     156  
     157  // 1. ********** initialisation ***********
     158 
    158159  srand (time (NULL));         /* Initialisation du générateur */
    159160  TStopwatch globalwatch, loopwatch, triggerwatch, frogwatch;
    160161  globalwatch.Start();
    161 
     162 
    162163 
    163164  //read the output TROOT file
     
    182183  string DetDatacard("data/DetectorCard.dat"); //for detector smearing parameters
    183184  string TrigDatacard("data/TriggerCard.dat"); //for trigger selection
    184  
     185  
    185186  string lineCard1,lineCard2;
    186187  bool detecCard=false,trigCard=false;
     
    190191      infile1 >> lineCard1; // the first line determines the type of input files
    191192      if(strstr(lineCard1.c_str(),"DETECTOR") && detecCard==true)
    192            cerr <<"**         ERROR: A DETECTOR card has already been loaded          **"<< endl;
     193        cerr <<"**         ERROR: A DETECTOR card has already been loaded          **"<< endl;
    193194      else if(strstr(lineCard1.c_str(),"DETECTOR") && detecCard==false){DetDatacard =argv[3]; detecCard=true;}
    194195      else if(strstr(lineCard1.c_str(),"TRIGGER") && trigCard==true)
    195            cerr <<"**         ERROR: A TRIGGER card has already been loaded           **"<< endl;
     196        cerr <<"**         ERROR: A TRIGGER card has already been loaded           **"<< endl;
    196197      else if(strstr(lineCard1.c_str(),"TRIGGER") && trigCard==false){TrigDatacard =argv[3]; trigCard=true;}
    197198    }
     
    201202      infile2 >> lineCard2; // the first line determines the type of input files
    202203      if(strstr(lineCard2.c_str(),"DETECTOR") && detecCard==true)
    203            cerr <<"**         ERROR: A DETECTOR card has already been loaded          **"<< endl;
     204        cerr <<"**         ERROR: A DETECTOR card has already been loaded          **"<< endl;
    204205      else if(strstr(lineCard2.c_str(),"DETECTOR") && detecCard==false){DetDatacard =argv[4]; detecCard=true;}
    205206      else if(strstr(lineCard2.c_str(),"TRIGGER") && trigCard==true)
    206            cerr <<"**         ERROR: A TRIGGER card has already been loaded           **"<< endl;
     207        cerr <<"**         ERROR: A TRIGGER card has already been loaded           **"<< endl;
    207208      else if(strstr(lineCard2.c_str(),"TRIGGER") && trigCard==false){TrigDatacard =argv[4]; trigCard=true;}
    208209    }
     
    221222       << right << setw(2) <<"**"<<""<<endl;
    222223  cout <<"**                                                                 **"<< endl;
    223 
     224 
    224225  //Trigger information
    225226  cout <<"**        ########### Start reading TRIGGER card ##########        **"<< endl;
    226227  if(trigCard==false)
    227      {
    228        cout <<"**        WARNING: Datacard  not found, use default card           **" << endl;
    229        TrigDatacard="data/TriggerCard.dat";
    230      }
     228    {
     229      cout <<"**        WARNING: Datacard  not found, use default card           **" << endl;
     230      TrigDatacard="data/TriggerCard.dat";
     231    }
    231232  TriggerTable *TRIGT = new TriggerTable();
    232233  TRIGT->TriggerCardReader(TrigDatacard.c_str());
     
    248249  //VFD information
    249250  VeryForward * VFD = new VeryForward(DET);
    250  
     251  
    251252  // data converters
    252253  DataConverter *converter=NULL;
    253254  cout <<"**                                                                 **"<<endl;
    254255  cout <<"**        ####### Start convertion to TRoot format ########        **"<< endl;
    255 
     256 
    256257  if(strstr(line.c_str(),".hep"))
    257258    {                           
     
    273274    }
    274275  else {
    275       cerr << left  << setw(4) <<"**  "<<""
    276           << left  << setw(63) << line.c_str() <<""
    277           << right << setw(2) <<"**"<<endl;
    278       cerr <<"**         ERROR: File format not identified --  Exiting...        **"<< endl;
    279       cout <<"**                                                                 **"<< endl;
    280       cout <<"*********************************************************************"<< endl;
    281       return -1;};
     276    cerr << left  << setw(4) <<"**  "<<""
     277        << left  << setw(63) << line.c_str() <<""
     278        << right << setw(2) <<"**"<<endl;
     279    cerr <<"**         ERROR: File format not identified --  Exiting...        **"<< endl;
     280    cout <<"**                                                                 **"<< endl;
     281    cout <<"*********************************************************************"<< endl;
     282    return -1;};
    282283  cout <<"**                       Exiting conversion...                     **"<< endl;
    283 
     284 
    284285  TChain chain("GEN");
    285286  chain.Add(outputfilename.c_str());
    286287  ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
    287288  const TClonesArray *branchGen = treeReader->UseBranch("Particle");
    288 
     289 
    289290  TIter itGen((TCollection*)branchGen);
    290291 
     
    322323  vector<D_Particle> muon;
    323324  vector<D_Particle> gamma;
    324 
    325 bool FLAG_lhco = true;
    326 
     325 
     326  vector<int> NTrackJet;
     327
     328  bool FLAG_lhco = true;
     329 
    327330  TSimpleArray<TRootGenParticle> NFCentralQ;
    328 
    329 D_CaloList list_of_calorimeters;
    330 D_CaloElement CentralCalo("centralcalo",
    331         -DET->CEN_max_calo_cen, DET->CEN_max_calo_cen,
    332         DET->ELG_Ccen,  DET->ELG_Ncen,  DET->ELG_Scen,
    333          DET->HAD_Chcal, DET->HAD_Nhcal, DET->HAD_Shcal);
    334 D_CaloElement ForwardCalo("forwardcalo",
    335         DET->CEN_max_calo_cen, DET->CEN_max_calo_fwd,
    336          DET->ELG_Cfwd,  DET->ELG_Nfwd,  DET->ELG_Sfwd,
    337          DET->HAD_Chf,   DET->HAD_Nhf,   DET->HAD_Shf  );
    338 D_CaloElement BackwardCalo("backwardcalo",
    339         -DET->CEN_max_calo_fwd, -DET->CEN_max_calo_cen,
    340          DET->ELG_Cfwd,  DET->ELG_Nfwd,  DET->ELG_Sfwd,
    341          DET->HAD_Chf,   DET->HAD_Nhf,   DET->HAD_Shf  );
    342 //D_CaloElement CastorCalo("castor",5.5,6.6,1,0,0,1,0,0);
    343 list_of_calorimeters.addElement(CentralCalo);
    344 list_of_calorimeters.addElement(ForwardCalo);
    345 list_of_calorimeters.addElement(BackwardCalo);
    346 //list_of_calorimeters.addElement(CastorCalo);
    347 list_of_calorimeters.sortElements();
    348 
    349 
    350 // 2. ********** Loop over all events ***********
     331 
     332  D_CaloList list_of_calorimeters;
     333  D_CaloElement CentralCalo("centralcalo",
     334                            -DET->CEN_max_calo_cen, DET->CEN_max_calo_cen,
     335                            DET->ELG_Ccen,  DET->ELG_Ncen,  DET->ELG_Scen,
     336                            DET->HAD_Chcal, DET->HAD_Nhcal, DET->HAD_Shcal);
     337  D_CaloElement ForwardCalo("forwardcalo",
     338                            DET->CEN_max_calo_cen, DET->CEN_max_calo_fwd,
     339                            DET->ELG_Cfwd,  DET->ELG_Nfwd,  DET->ELG_Sfwd,
     340                            DET->HAD_Chf,   DET->HAD_Nhf,   DET->HAD_Shf  );
     341  D_CaloElement BackwardCalo("backwardcalo",
     342                             -DET->CEN_max_calo_fwd, -DET->CEN_max_calo_cen,
     343                             DET->ELG_Cfwd,  DET->ELG_Nfwd,  DET->ELG_Sfwd,
     344                             DET->HAD_Chf,   DET->HAD_Nhf,   DET->HAD_Shf  );
     345  //D_CaloElement CastorCalo("castor",5.5,6.6,1,0,0,1,0,0);
     346  list_of_calorimeters.addElement(CentralCalo);
     347  list_of_calorimeters.addElement(ForwardCalo);
     348  list_of_calorimeters.addElement(BackwardCalo);
     349  //list_of_calorimeters.addElement(CastorCalo);
     350  list_of_calorimeters.sortElements();
     351 
     352 
     353  // 2. ********** Loop over all events ***********
    351354  Long64_t entry, allEntries = treeReader->GetEntries();
    352355  cout <<"**                                                                 **"<<endl;
     
    355358       << left  << setw(15) << allEntries <<""
    356359       << right << setw(2) <<"**"<<endl;
    357 
     360 
    358361  ExRootProgressBar *Progress = new ExRootProgressBar(allEntries);
    359 
     362 
    360363  loopwatch.Start();
    361 
     364 
    362365  // loop on all events
    363366  for(entry = 0; entry < allEntries; ++entry)
     
    376379      towers.clear();
    377380      input_particles.clear();
    378 
     381      NTrackJet.clear();     
     382 
    379383      {
    380       D_CaloTowerList list_of_active_towers;
    381       D_CaloTowerList list_of_towers_with_photon; // to speed up the code: will only look in interesting towers for gamma candidates
    382 
    383       // 2.1a Loop over all particles in event, to fill the towers
    384       itGen.Reset();
    385       GenParticle *particleG;
    386       while( (particleG = (GenParticle*) itGen.Next()) ) {
    387 
    388       TRootGenParticle *particle = new TRootGenParticle(particleG);
    389       int pid = abs(particle->PID);
    390       particle->Charge=ChargeVal(particle->PID);
    391       particle->setFractions(); // init
    392 
    393 
     384        D_CaloTowerList list_of_active_towers;
     385        D_CaloTowerList list_of_towers_with_photon; // to speed up the code: will only look in interesting towers for gamma candidates
     386       
     387        // 2.1a Loop over all particles in event, to fill the towers
     388        itGen.Reset();
     389        GenParticle *particleG;
     390        while( (particleG = (GenParticle*) itGen.Next()) ) {
     391         
     392          TRootGenParticle *particle = new TRootGenParticle(particleG);
     393          int pid = abs(particle->PID);
     394          particle->Charge=ChargeVal(particle->PID);
     395          particle->setFractions(); // init
     396         
     397         
    394398          // 2.1a.1********************* preparation for the b-tagging
    395399          //// This subarray is needed for the B-jet algorithm
     
    401405            NFCentralQ.Add(particle);
    402406          }
    403 
     407         
    404408          // 2.1a.2********************* visible particles only
    405409          if( (particle->Status == 1) && (pid != pNU1) && (pid != pNU2) && (pid != pNU3) ){
    406 
     410           
    407411            // 2.1a.2.1 Central solenoidal magnetic field
    408412            TRACP->bfield(particle); // fills in particle->EtaCalo et particle->PhiCalo
     
    412416                particle->Charge==0 ||
    413417                (!DET->FLAG_bfield && particle->Charge!=0 && particle->PT > DET->TRACK_ptmin))
    414             if(
    415                 (particle->EtaCalo > list_of_calorimeters.getEtamin() ) &&
    416                 (particle->EtaCalo < list_of_calorimeters.getEtamax() )
    417               ) {
     418              if(
     419                 (particle->EtaCalo > list_of_calorimeters.getEtamin() ) &&
     420                 (particle->EtaCalo < list_of_calorimeters.getEtamax() )
     421                ) {
    418422                float iEta=UNDEFINED, iPhi=UNDEFINED;
    419423                DET->BinEtaPhi(particle->PhiCalo,particle->EtaCalo,iPhi,iEta); // fills in iPhi and iEta
    420424                if (iEta != UNDEFINED && iPhi != UNDEFINED)
    421                 {
    422                   D_CaloTower tower(iEta,iPhi);                                // new tower
    423                   tower.Set_Eem_Ehad_E_ET(particle->E*particle->getFem() , particle->E*particle->getFhad() );
    424                
    425                   list_of_active_towers.addTower(tower);
    426                   // this list may contain several times the same calotower, as several particles
    427                   // may leave some energy in the same calotower
    428                   // After the loop on particles, identical cells in the list should be merged
    429                 } // iEta and iPhi must be defined
    430             }
    431 
     425                  {
     426                    D_CaloTower tower(iEta,iPhi);                                      // new tower
     427                    tower.Set_Eem_Ehad_E_ET(particle->E*particle->getFem() , particle->E*particle->getFhad() );
     428                   
     429                    list_of_active_towers.addTower(tower);
     430                    // this list may contain several times the same calotower, as several particles
     431                    // may leave some energy in the same calotower
     432                    // After the loop on particles, identical cells in the list should be merged
     433                  } // iEta and iPhi must be defined
     434              }
     435           
    432436            // 2.1a.2.3 charged particles in tracker: energy flow
    433437            // if bfield not simulated, pt should be high enough to be taken into account
     
    435439            if( particle->Charge !=0 &&
    436440                fabs(particle->EtaCalo)< DET->CEN_max_tracker && // stays in the tracker -> track available
    437                ( DET->FLAG_bfield ||
     441                ( DET->FLAG_bfield ||
    438442                  (!DET->FLAG_bfield && particle->PT > DET->TRACK_ptmin)
    439                 )
    440               ) {       
    441                 // 2.1a.2.3.1 Filling the particle properties + smearing
    442                    // Hypothesis: the final eta/phi are the ones from the generator, thanks to the track reconstruction
    443                    // This is the EnergyFlow hypothesis
    444                    particle->SetEtaPhi(particle->Eta,particle->Phi);
    445                    float sET=UNDEFINED; // smeared ET, computed from the smeared E -> needed for the tracks
    446 
    447                    // 2.1a.2.3.2 Muons
    448                    if (pid == pMU && fabs(particle->EtaCalo)< DET->CEN_max_mu) {
    449                         TLorentzVector p;
    450                         float sPT = gRandom->Gaus(particle->PT, DET->MU_SmearPt*particle->PT );
    451                         if (sPT > 0 && sPT > DET->PTCUT_muon) {
    452                            p.SetPtEtaPhiE(sPT,particle->Eta,particle->Phi,sPT*cosh(particle->Eta));
    453                            muon.push_back(D_Particle(p,pMU,particle->EtaCalo,particle->PhiCalo));
    454                         }
    455                         sET = (sPT >0)? sPT : 0;
    456                    } 
    457                    // 2.1a.2.3.3 Electrons
    458                    else if (pid == pE) {
    459                      // Finds in which calorimeter the particle has gone, to know its resolution
    460 
    461                      D_CaloElement currentCalo = list_of_calorimeters.getElement(particle->EtaCalo);
    462                      if(currentCalo.getName() == dummyCalo.getName()) {
    463                         cout << "** Warning: the calo coverage behind the tracker is not complete! **" << endl; }
    464 
    465                      // final smeared EM energy   // electromagnetic fraction F_em =1 for electrons;
    466                      float sE  = currentCalo.getElectromagneticResolution().Smear(particle->E);
    467                      if (sE>0) {
    468                        sET = sE/cosh(particle->Eta);
    469                        // NB: ET is found via the calorimetry and not via the track curvature
    470 
    471                        TLorentzVector p;
    472                        p.SetPtEtaPhiE(sET,particle->Eta,particle->Phi,sE);
    473                        if (sET > DET->PTCUT_elec)
    474                          electron.push_back(D_Particle(p,particle->PID,particle->EtaCalo,particle->PhiCalo));
    475                      } else { sET=0;} // if negative smeared energy -- needed for the tracks
    476                    } 
    477                    // 2.1a.2.3.4 Other charged particles : smear them for the tracks!
    478                    else {  //other particles
    479                         D_CaloElement currentCalo = list_of_calorimeters.getElement(particle->EtaCalo);
    480                         float sEem  = currentCalo.getElectromagneticResolution().Smear(particle->E * particle->getFem());
    481                         float sEhad = currentCalo.getHadronicResolution().Smear(particle->E * particle->getFhad());
    482                         float sE = ( (sEem>0)? sEem : 0 ) + ( (sEhad>0)? sEhad : 0 );
    483                         sET = sE/cosh(particle->EtaCalo);
    484                    }
    485 
    486                    // 2.1a.2.3.5 Tracks
    487                    if( (rand()%100) < DET->TRACK_eff && sET!=0) {
    488                      elementTrack = (TRootTracks*) branchTrack->NewEntry();
    489                      elementTrack->Set(particle->Eta, particle->Phi, particle->EtaCalo, particle->PhiCalo, sET, particle->Charge);
    490                      //TrackCentral.push_back(elementTrack->GetFourVector()); // tracks at vertex!
    491                      TrackCentral.push_back(*elementTrack); // tracks at vertex!
    492                      // TODO!!! apply a smearing on the position of the origin of the track
    493                      // TODO!!! elementTracks->SetPositionOut(Xout,Yout,Zout);
    494                    }
     443                  )
     444                ) {     
     445              // 2.1a.2.3.1 Filling the particle properties + smearing
     446              // Hypothesis: the final eta/phi are the ones from the generator, thanks to the track reconstruction
     447              // This is the EnergyFlow hypothesis
     448              particle->SetEtaPhi(particle->Eta,particle->Phi);
     449              float sET=UNDEFINED; // smeared ET, computed from the smeared E -> needed for the tracks
     450             
     451              // 2.1a.2.3.2 Muons
     452              if (pid == pMU && fabs(particle->EtaCalo)< DET->CEN_max_mu) {
     453                TLorentzVector p;
     454                float sPT = gRandom->Gaus(particle->PT, DET->MU_SmearPt*particle->PT );
     455                if (sPT > 0 && sPT > DET->PTCUT_muon) {
     456                  p.SetPtEtaPhiE(sPT,particle->Eta,particle->Phi,sPT*cosh(particle->Eta));
     457                  muon.push_back(D_Particle(p,pMU,particle->EtaCalo,particle->PhiCalo));
     458                }
     459                sET = (sPT >0)? sPT : 0;
     460              } 
     461              // 2.1a.2.3.3 Electrons
     462              else if (pid == pE) {
     463                // Finds in which calorimeter the particle has gone, to know its resolution
     464               
     465                D_CaloElement currentCalo = list_of_calorimeters.getElement(particle->EtaCalo);
     466                if(currentCalo.getName() == dummyCalo.getName()) {
     467                  cout << "** Warning: the calo coverage behind the tracker is not complete! **" << endl; }
     468               
     469                // final smeared EM energy   // electromagnetic fraction F_em =1 for electrons;
     470                float sE  = currentCalo.getElectromagneticResolution().Smear(particle->E);
     471                if (sE>0) {
     472                  sET = sE/cosh(particle->Eta);
     473                  // NB: ET is found via the calorimetry and not via the track curvature
     474                 
     475                  TLorentzVector p;
     476                  p.SetPtEtaPhiE(sET,particle->Eta,particle->Phi,sE);
     477                  if (sET > DET->PTCUT_elec)
     478                    electron.push_back(D_Particle(p,particle->PID,particle->EtaCalo,particle->PhiCalo));
     479                } else { sET=0;} // if negative smeared energy -- needed for the tracks
     480              } 
     481              // 2.1a.2.3.4 Other charged particles : smear them for the tracks!
     482              else {  //other particles
     483                D_CaloElement currentCalo = list_of_calorimeters.getElement(particle->EtaCalo);
     484                float sEem  = currentCalo.getElectromagneticResolution().Smear(particle->E * particle->getFem());
     485                float sEhad = currentCalo.getHadronicResolution().Smear(particle->E * particle->getFhad());
     486                float sE = ( (sEem>0)? sEem : 0 ) + ( (sEhad>0)? sEhad : 0 );
     487                sET = sE/cosh(particle->EtaCalo);
     488              }
     489             
     490              // 2.1a.2.3.5 Tracks
     491              if( (rand()%100) < DET->TRACK_eff && sET!=0) {
     492                elementTrack = (TRootTracks*) branchTrack->NewEntry();
     493                elementTrack->Set(particle->Eta, particle->Phi, particle->EtaCalo, particle->PhiCalo, sET, particle->Charge);
     494                //TrackCentral.push_back(elementTrack->GetFourVector()); // tracks at vertex!
     495                TrackCentral.push_back(*elementTrack); // tracks at vertex!
     496                // TODO!!! apply a smearing on the position of the origin of the track
     497                // TODO!!! elementTracks->SetPositionOut(Xout,Yout,Zout);
     498              }
    495499            } // 2.1a.2.3 : if tracker/energy-flow
    496500            // 2.1a.2.4 Photons
    497                // stays in the tracker -> track available -> gamma ID
     501            // stays in the tracker -> track available -> gamma ID
    498502            else if( (pid == pGAMMA) && fabs(particle->EtaCalo)< DET->CEN_max_tracker ) {
    499                 float iEta=UNDEFINED, iPhi=UNDEFINED;
    500                 DET->BinEtaPhi(particle->PhiCalo,particle->EtaCalo,iPhi,iEta); // fills in iPhi and iEta
    501                 D_CaloTower tower(iEta,iPhi);
    502                 // stores the list of towers where to apply the photon ID algorithm. Just a trick for a faster search
    503                 list_of_towers_with_photon.addTower(tower);
     503              float iEta=UNDEFINED, iPhi=UNDEFINED;
     504              DET->BinEtaPhi(particle->PhiCalo,particle->EtaCalo,iPhi,iEta); // fills in iPhi and iEta
     505              D_CaloTower tower(iEta,iPhi);
     506              // stores the list of towers where to apply the photon ID algorithm. Just a trick for a faster search
     507              list_of_towers_with_photon.addTower(tower);
    504508            }
    505509            // 2.1a.2.5 : very forward detectors
     
    507511              {
    508512                if (DET->FLAG_RP==1) {
    509                    // for the moment, only protons are transported
    510                    // BUT !!! could be a beam of other particles! (heavy ions?)
    511                    // BUT ALSO !!! if very forward muons, or others!
    512                    VFD->RomanPots(treeWriter,branchRP220,branchFP420,particle);
     513                  // for the moment, only protons are transported
     514                  // BUT !!! could be a beam of other particles! (heavy ions?)
     515                  // BUT ALSO !!! if very forward muons, or others!
     516                  VFD->RomanPots(treeWriter,branchRP220,branchFP420,particle);
    513517                }
    514518                // 2.1a.2.6: Zero degree calorimeter
    515519                if(DET->FLAG_vfd==1) {
    516                    VFD->ZDC(treeWriter,branchZDC,particle);
     520                  VFD->ZDC(treeWriter,branchZDC,particle);
    517521                }
    518522              }
    519 
     523           
    520524          } // 2.1a.2 : if visible particle
    521         delete particle;
    522       } // loop on all particles 2.1a
     525          delete particle;
     526        } // loop on all particles 2.1a
    523527       
    524 
    525       // 2.1b loop on all (activated) towers
    526       // at this stage, list_of_active_towers may contain several times the same tower
    527       // first step is to merge identical towers, by matching their (iEta,iPhi) 
    528       list_of_active_towers.mergeDuplicates();
    529       // Calotower smearing
    530       list_of_active_towers.smearTowers(list_of_calorimeters);
    531 
    532       for(unsigned int i=0; i<list_of_active_towers.size(); i++) {
    533         float iEta = list_of_active_towers[i].getEta();
    534         float iPhi = list_of_active_towers[i].getPhi();
    535         float e = list_of_active_towers[i].getE();
    536         if(iEta != UNDEFINED && iPhi != UNDEFINED && e!=0) {
    537            elementCalo = (TRootCalo*) branchCalo->NewEntry();
    538            elementCalo->set(list_of_active_towers[i]);
    539            // not beautiful : should be improved!
    540            TLorentzVector p;
    541            p.SetPtEtaPhiE(list_of_active_towers[i].getET(), iEta, iPhi, e );
    542            PhysicsTower Tower(LorentzVector(p.Px(),p.Py(),p.Pz(),p.E()));
    543            towers.push_back(Tower);
    544         }
    545       } // loop on towers
    546 
    547       // 2.1c photon ID
    548       // list_of_towers_with_photon is the list of towers with photon candidates
    549       // already smeared !
    550       // sorts the vector and smears duplicates
    551       list_of_towers_with_photon.mergeDuplicates();
    552 
    553       for(unsigned int i=0; i<list_of_towers_with_photon.size(); i++) {
     528       
     529        // 2.1b loop on all (activated) towers
     530        // at this stage, list_of_active_towers may contain several times the same tower
     531        // first step is to merge identical towers, by matching their (iEta,iPhi) 
     532        list_of_active_towers.mergeDuplicates();
     533        // Calotower smearing
     534        list_of_active_towers.smearTowers(list_of_calorimeters);
     535       
     536        for(unsigned int i=0; i<list_of_active_towers.size(); i++) {
     537          float iEta = list_of_active_towers[i].getEta();
     538          float iPhi = list_of_active_towers[i].getPhi();
     539          float e = list_of_active_towers[i].getE();
     540          if(iEta != UNDEFINED && iPhi != UNDEFINED && e!=0) {
     541            elementCalo = (TRootCalo*) branchCalo->NewEntry();
     542            elementCalo->set(list_of_active_towers[i]);
     543            // not beautiful : should be improved!
     544            TLorentzVector p;
     545            p.SetPtEtaPhiE(list_of_active_towers[i].getET(), iEta, iPhi, e );
     546            PhysicsTower Tower(LorentzVector(p.Px(),p.Py(),p.Pz(),p.E()));
     547            towers.push_back(Tower);
     548          }
     549        } // loop on towers
     550       
     551        // 2.1c photon ID
     552        // list_of_towers_with_photon is the list of towers with photon candidates
     553        // already smeared !
     554        // sorts the vector and smears duplicates
     555        list_of_towers_with_photon.mergeDuplicates();
     556       
     557        for(unsigned int i=0; i<list_of_towers_with_photon.size(); i++) {
    554558          float eta = list_of_towers_with_photon[i].getEta();
    555559          float phi = list_of_towers_with_photon[i].getPhi();
     
    560564            if (cal.getET() > DET->PTCUT_gamma) { gamma.push_back(D_Particle(p,pGAMMA,p.Eta(),p.Phi())); }
    561565          }
    562       } // for -- list of photons
    563 
    564 }  // IF NEW ALGORITHM with energy flow
    565 
    566 
    567 
    568 
     566        } // for -- list of photons
     567       
     568      }  // IF NEW ALGORITHM with energy flow
     569     
     570     
     571     
     572     
    569573      // 2.2 ********** Output preparation & complex objects  ***********
    570574      // 2.2.1 ********************* sorting collections by decreasing pt
     
    599603          Att.SetPxPyPzE(towers[i].fourVector.px, towers[i].fourVector.py, towers[i].fourVector.pz, towers[i].fourVector.E);
    600604          if(fabs(Att.Eta()) < DET->CEN_max_calo_fwd)
    601           {
    602             PTmis = PTmis + Att;
    603             // create a fastjet::PseudoJet with these components and put it onto
    604             // back of the input_particles vector
    605             input_particles.push_back(fastjet::PseudoJet(towers[i].fourVector.px,towers[i].fourVector.py,towers[i].fourVector.pz,towers[i].fourVector.E));
    606           }
     605            {
     606              PTmis = PTmis + Att;
     607              // create a fastjet::PseudoJet with these components and put it onto
     608              // back of the input_particles vector
     609              input_particles.push_back(fastjet::PseudoJet(towers[i].fourVector.px,towers[i].fourVector.py,towers[i].fourVector.pz,towers[i].fourVector.E));
     610            }
    607611        }
    608612      elementEtmis = (TRootETmis*) branchETmis->NewEntry();
     
    613617     
    614618      // 2.2.3 ************* jets, B-tag, tau jets
    615       sorted_jets=JETRUN->RunJets(input_particles);
    616       JETRUN->RunJetBtagging(treeWriter, branchJet,sorted_jets,NFCentralQ);
    617       JETRUN->RunTauJets(treeWriter,branchTauJet,sorted_jets,towers, TrackCentral);
     619      vector<int> NTrackJet;
     620      sorted_jets=JETRUN->RunJets(input_particles, TrackCentral,NTrackJet);
     621      JETRUN->RunJetBtagging(treeWriter, branchJet,sorted_jets,NFCentralQ,NTrackJet);
     622      JETRUN->RunTauJets(treeWriter,branchTauJet,sorted_jets,towers, TrackCentral,NTrackJet);
    618623     
    619624      treeWriter->Fill();
    620625    } // 2. Loop over all events ('for' loop)
    621 
    622 
     626 
     627 
    623628  cout <<"**                                                                 **"<< endl;
    624629  cout <<"**                 Exiting detector simulation...                  **"<< endl;
    625 
    626  
     630 
     631  
    627632  treeWriter->Write();
    628633  delete treeWriter;
    629634  loopwatch.Stop();
    630  
    631 
    632  
     635  
     636 
     637  
    633638  // 3. ********** Trigger  & Frog ***********
    634639  // 3.1 ************ running the trigger in case the FLAG trigger is put to 1 in the datacard
     
    636641  if(DET->FLAG_trigger == 1)
    637642    {
    638        cout <<"**                                                                 **"<<endl;
    639        cout <<"**        ########### Start Trigger selection ###########          **"<< endl;
    640 
     643      cout <<"**                                                                 **"<<endl;
     644      cout <<"**        ########### Start Trigger selection ###########          **"<< endl;
     645     
    641646      // input
    642647      TChain chainT("Analysis");
     
    654659      ExRootTreeWriter *treeWriterT = new ExRootTreeWriter(outputfilename, "Trigger");
    655660      ExRootTreeBranch *branchTrigger = treeWriterT->NewBranch("TrigResult", TRootTrigger::Class());
    656      
    657  
     661      
     662      
    658663      Long64_t entryT, allEntriesT = treeReaderT->GetEntries();
    659664      // loop on all entries
    660665      for(entryT = 0; entryT < allEntriesT; ++entryT) {
    661           treeWriterT->Clear();
    662           treeReaderT->ReadEntry(entryT);
    663           TRIGT->GetGlobalResult(branchElecTrig, branchMuonTrig,branchJetTrig, branchTauJetTrig,branchPhotonTrig, branchETmisTrig,branchTrigger);
    664           treeWriterT->Fill();
     666        treeWriterT->Clear();
     667        treeReaderT->ReadEntry(entryT);
     668        TRIGT->GetGlobalResult(branchElecTrig, branchMuonTrig,branchJetTrig, branchTauJetTrig,branchPhotonTrig, branchETmisTrig,branchTrigger);
     669        treeWriterT->Fill();
    665670      } // loop on all entries
    666671      cout <<"**                 Exiting trigger simulation...                   **"<< endl;
     
    670675      delete treeReaderT;
    671676    } // trigger
    672     triggerwatch.Stop();
    673  
    674  
     677  triggerwatch.Stop();
     678  
     679  
    675680  // 3.2 ************** FROG display
    676681  frogwatch.Start();
    677682  if(DET->FLAG_frog == 1) {
    678       cout <<"**                                                                 **"<<endl;
    679       cout <<"**        ################## Start FROG #################          **"<< endl;
    680 
    681       FrogDisplay *FROG = new FrogDisplay(DET);
    682       FROG->BuildEvents(outputfilename);
    683       FROG->BuildGeom();
    684       delete FROG;
     683    cout <<"**                                                                 **"<<endl;
     684    cout <<"**        ################## Start FROG #################          **"<< endl;
     685   
     686    FrogDisplay *FROG = new FrogDisplay(DET);
     687    FROG->BuildEvents(outputfilename);
     688    FROG->BuildGeom();
     689    delete FROG;
    685690  }
    686691  frogwatch.Stop();
    687692 
    688 
    689 
    690 
    691 // 4. ********** End & Exit ***********
    692 
     693  // 3.3 *************** LHCO output
     694  if(DET->FLAG_lhco == 1){
     695    cout <<"**                                                                 **"<<endl;
     696    cout <<"**        ############ Start LHCO convertion ############          **"<< endl;
     697    /*
     698    //create output log-file name
     699    string forLogLHCO = outputfilename;
     700    string LogNameLHCO = forLogLHCO.erase(forLogLHCO.find(".root"));
     701    LogNameLHCO = LogNameLHCO+"_events.lhco";
     702    */
     703   
     704    //LHCOConverter *LHCO = new LHCOConverter(outputfilename,LogNameLHCO);
     705    LHCOConverter *LHCO = new LHCOConverter(outputfilename,"");
     706    LHCO->CopyRunLogFile();
     707    LHCO->ConvertExRootAnalysisToLHCO();
     708    delete LHCO;
     709  }
     710 
     711 
     712 
     713  // 4. ********** End & Exit ***********
     714 
    693715  globalwatch.Stop();
    694716  cout <<"**                                                                 **"<< endl;
    695717  cout <<"**        ################## Time report #################         **"<< endl;
    696718  cout << left  << setw(32) <<"**              Time report for "<<""
    697               << left  << setw(15) << allEntries <<""
    698               << right << setw(22) <<"events         **"<<endl;
     719       << left  << setw(15) << allEntries <<""
     720       << right << setw(22) <<"events         **"<<endl;
    699721  cout <<"**                                                                 **"<< endl;
    700722  cout << left  << setw(10) <<"**"<<""
     
    715737  if(DET->FLAG_trigger == 1)
    716738    {
    717      cout << left  << setw(10) <<"**"<<""
    718           << left  << setw(15) <<" +  Trigger:"<<""
    719           << right << setw(15) <<triggerwatch.CpuTime()<<""
    720           << right << setw(15) <<triggerwatch.RealTime()<<""
    721           << right << setw(14)  <<"**"<<endl;
     739      cout << left  << setw(10) <<"**"<<""
     740           << left  << setw(15) <<" +  Trigger:"<<""
     741           << right << setw(15) <<triggerwatch.CpuTime()<<""
     742           << right << setw(15) <<triggerwatch.RealTime()<<""
     743           << right << setw(14)  <<"**"<<endl;
    722744    }
    723745  if(DET->FLAG_frog == 1)
    724746    {
    725      cout << left  << setw(10) <<"**"<<""
    726           << left  << setw(15) <<" +  Frog:"<<""
    727           << right << setw(15) <<frogwatch.CpuTime()<<""
    728           << right << setw(15) <<frogwatch.RealTime()<<""
    729           << right << setw(14)  <<"**"<<endl;
    730 
    731     }
    732  
    733    cout <<"**                                                                 **"<< endl;
    734    cout <<"**                        Exiting Delphes ...                      **"<< endl;
    735    cout <<"**                                                                 **"<< endl;
    736    cout <<"*********************************************************************"<< endl;
    737    cout <<"*********************************************************************"<< endl;
    738 
    739 
     747      cout << left  << setw(10) <<"**"<<""
     748           << left  << setw(15) <<" +  Frog:"<<""
     749           << right << setw(15) <<frogwatch.CpuTime()<<""
     750           << right << setw(15) <<frogwatch.RealTime()<<""
     751           << right << setw(14)  <<"**"<<endl;
     752     
     753    }
     754 
     755  cout <<"**                                                                 **"<< endl;
     756  cout <<"**                        Exiting Delphes ...                      **"<< endl;
     757  cout <<"**                                                                 **"<< endl;
     758  cout <<"*********************************************************************"<< endl;
     759  cout <<"*********************************************************************"<< endl;
     760 
     761 
    740762  delete treeReader;
    741763  delete DET;
     
    746768  delete converter;
    747769 
    748 //  todo("TODO");
     770  //  todo("TODO");
    749771}
  • trunk/Resolutions.cpp

    r264 r307  
    246246  vector<fastjet::PseudoJet> input_particlesGEN;//for FastJet algorithm
    247247  vector<fastjet::PseudoJet> sorted_jetsGEN;
    248  
     248 
     249  vector<int> NTrackJet;
     250 
    249251  vector<TLorentzVector> towers;
    250252 
     
    342344
    343345      //*****************************
    344      
    345       sorted_jetsGEN=JETRUN->RunJets(input_particlesGEN);
     346      vector<TRootTracks> TrackCentral;
     347      sorted_jetsGEN=JETRUN->RunJets(input_particlesGEN, TrackCentral, NTrackJet);
    346348
    347349      TSimpleArray<TRootGenParticle> TausHadr = TauHadr(branchGen);
  • trunk/Utilities/ExRootAnalysis/interface/BlockClasses.h

    r290 r307  
    354354  TRootTauJet() {};
    355355  float Charge; // normally, using the charge of the track ; here using gen-level tau charge
     356  int NTracks;
    356357
    357358//  float E;  // particle energy in GeV
     
    382383
    383384  bool Btag;
    384 
     385  int NTracks;
    385386  ClassDef(TRootJet, 1)
    386387};
  • trunk/data/DetectorCard.dat

    r306 r307  
    7474FLAG_trigger     1                       //1 to run the trigger selection else 0
    7575FLAG_frog        1                       //1 to run the FROG event display
     76FLAG_lhco        1                       //1 to run the LHCO
    7677
    7778# In case BField propagation allowed
  • trunk/data/DetectorCard_ATLAS.dat

    r306 r307  
    7474FLAG_trigger     1                       // 1 to run the trigger selection else 0
    7575FLAG_frog        1                       // 1 to run the FROG event display
     76FLAG_lhco        1                       //1 to run the LHCO
    7677
    7778# In case BField propagation allowed
  • trunk/data/DetectorCard_CMS.dat

    r306 r307  
    7474FLAG_trigger     1                       //1 to run the trigger selection else 0
    7575FLAG_frog        1                       //1 to run the FROG event display
     76FLAG_lhco        1                       //1 to run the LHCO
    7677
    7778# In case BField propagation allowed
  • trunk/interface/JetsUtil.h

    r286 r307  
    7979  void init(); // for constructors
    8080
    81   vector<fastjet::PseudoJet> RunJets(const vector<fastjet::PseudoJet>&  input_particles);
    82   void RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle> & NFCentralQ);
     81  vector<fastjet::PseudoJet> RunJets(const vector<fastjet::PseudoJet>&  input_particles, const vector<TRootTracks> & TrackCentral, vector<int> &NTrackJet);
     82  void RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle> & NFCentralQ, const vector<int> &NTrackJet);
    8383  //void RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TLorentzVector> & TrackCentral);
    84   void RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral);
     84  void RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral, const vector<int> &NTrackJet);
    8585
    8686 private:
  • trunk/interface/SmearUtil.h

    r306 r307  
    193193 int FLAG_vfd;                  //flag for very forward detector
    194194 int FLAG_RP;                  //flag for very forward detector
     195 int FLAG_lhco;                  //flag for very forward detector
    195196 
    196197 int NEvents_Frog;
  • trunk/src/JetsUtil.cc

    r286 r307  
    120120}
    121121
    122 vector<fastjet::PseudoJet> JetsUtil::RunJets(const vector<fastjet::PseudoJet>&  input_particles)
     122vector<fastjet::PseudoJet> JetsUtil::RunJets(const vector<fastjet::PseudoJet>&  input_particles,  const vector<TRootTracks> & TrackCentral,  vector<int> &NTrackJet)
    123123{
    124124  inclusive_jets.clear();
     
    131131      double ptmin = 5.0;
    132132      inclusive_jets = clust_seq.inclusive_jets(ptmin);
     133     
    133134      // sort jets into increasing pt
    134135      sorted_jets = sorted_by_pt(inclusive_jets);
     136
     137      //check number of tracks in jets
     138      float  iEtaTrack[TrackCentral.size()];
     139      float  iPhiTrack[TrackCentral.size()];
     140      for(unsigned int t = 0; t < TrackCentral.size(); t++)
     141         {
     142           DET->BinEtaPhi(TrackCentral[t].PhiOuter,TrackCentral[t].EtaOuter,iPhiTrack[t],iEtaTrack[t]);
     143         }
     144      int numTrackJet;
     145      for (unsigned int i = 0; i < sorted_jets.size(); i++)
     146          {
     147            numTrackJet=0;
     148            vector<fastjet::PseudoJet> constituents = clust_seq.constituents(sorted_jets[i]);
     149            for(unsigned int it = 0; it < TrackCentral.size(); it++)
     150               {
     151                 for (unsigned int j = 0; j < constituents.size(); j++)
     152                     {
     153                       if(DeltaR(iPhiTrack[it], iEtaTrack[it], constituents[j].phi(), constituents[j].eta())<0.001)numTrackJet++;
     154                     }
     155               }
     156            NTrackJet.push_back(numTrackJet);
     157       }
    135158    }
    136159 
     
    138161}
    139162
    140 void JetsUtil::RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle>& NFCentralQ)
     163
     164
     165void JetsUtil::RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle>& NFCentralQ, const vector<int> &NTrackJet)
    141166{
    142167  TRootJet *elementJet;
    143168  TLorentzVector JET;
    144169  for (unsigned int i = 0; i < sorted_jets.size(); i++) {
     170
    145171    JET.SetPxPyPzE(sorted_jets[i].px(),sorted_jets[i].py(),sorted_jets[i].pz(),sorted_jets[i].E());
    146172    if(JET.Pt() > DET->PTCUT_jet)
     
    148174        elementJet = (TRootJet*) branchJet->NewEntry();
    149175        elementJet->Set(JET);
     176        elementJet->NTracks = NTrackJet[i];
     177
    150178        // b-jets
    151179        bool btag=false;
     
    157185}
    158186
    159 //void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TLorentzVector> & TrackCentral)
    160 void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral)
     187void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral, const vector<int> &NTrackJet)
    161188{
    162189  TRootTauJet *elementTauJet;
     
    176203        elementTauJet = (TRootTauJet*) branchTauJet->NewEntry();
    177204        elementTauJet->Set(JET);
     205        elementTauJet->NTracks=NTrackJet[i];
    178206        elementTauJet->Charge = charge;
    179207      } // if tau jet
  • trunk/src/LHCOConverter.cc

    r288 r307  
    6666        }
    6767        else {
    68                 outputfilename_.replace(r_find,5,".lhco");
     68                outputfilename_.replace(r_find,5,"_events.lhco");
    6969                ofstream outfile( outputfilename_.c_str());
    7070                outfile.close();
     
    138138
    139139    outfile << setw(3) << line++  << setw(4) << " " << setw(7) << event << setw(7) << triginfo << endl;
    140     outfile.close();
    141140
    142141    // 0 photon data
    143     //outfile << BranchReader(branchPhoton,line,lhcoPhotonID);
    144142    BranchReader(branchPhoton,line,lhcoPhotonID);
    145143
     
    161159  } // event loop
    162160
     161  outfile.close();
    163162  delete triggerTree;
    164163  delete analysisTree;
     
    180179        jmass = pmu.M();
    181180        float ntrk = 0.0;
     181        float btag =0;
     182        double ratioE = 0;
     183
    182184        if(lhcoID == lhcoElectronID) { TRootElectron elec(*((TRootElectron*) branch->At(i))); ntrk = elec.Charge; }
    183185        else if (lhcoID == lhcoMuonID) { TRootMuon muon(*((TRootMuon*) branch->At(i))); ntrk = muon.Charge; }
    184186        else if (lhcoID == lhcoTauJetID) { TRootTauJet taujet(*((TRootTauJet*) branch->At(i))); ntrk = taujet.Charge; }
    185         float btag =0;
    186         double ratioE = 0;
     187        else if (lhcoID == lhcoJetID) { TRootJet jet(*((TRootJet*) branch->At(i))); ntrk = jet.NTracks; btag = jet.Btag;}
    187188        if(lhcoID != lhcoETmisID) {
    188189        outfile << fixed << setprecision(3)
  • trunk/src/SmearUtil.cc

    r306 r307  
    119119  FLAG_bfield      = 1;                       //1 to run the bfield propagation else 0
    120120  FLAG_vfd         = 1;                       //1 to run the very forward detectors else 0
    121   FLAG_RP         = 1;                       //1 to run the zero degree calorimeter else 0
     121  FLAG_RP          = 1;                       //1 to run the zero degree calorimeter else 0
    122122  FLAG_trigger     = 1;                       //1 to run the trigger selection else 0
    123123  FLAG_frog        = 1;                       //1 to run the FROG event display
     124  FLAG_lhco        = 1;
    124125
    125126  // In case BField propagation allowed
     
    247248  FLAG_trigger     = DET.FLAG_trigger;
    248249  FLAG_frog        = DET.FLAG_frog;
     250  FLAG_lhco        = DET.FLAG_lhco;
    249251
    250252  // In case BField propagation allowed
     
    365367  FLAG_trigger     = DET.FLAG_trigger;
    366368  FLAG_frog        = DET.FLAG_frog;
     369  FLAG_lhco        = DET.FLAG_lhco;
    367370
    368371  // In case BField propagation allowed
     
    510513    else if(strstr(temp_string.c_str(),"FLAG_trigger"))     {curstring >> varname >> ivalue; FLAG_trigger     = ivalue;}
    511514    else if(strstr(temp_string.c_str(),"FLAG_frog"))        {curstring >> varname >> ivalue; FLAG_frog        = ivalue;}
     515    else if(strstr(temp_string.c_str(),"FLAG_lhco"))        {curstring >> varname >> ivalue; FLAG_lhco        = ivalue;}
    512516    else if(strstr(temp_string.c_str(),"NEvents_Frog"))     {curstring >> varname >> ivalue; NEvents_Frog     = ivalue;}
    513517  }
Note: See TracChangeset for help on using the changeset viewer.