Fork me on GitHub

Changeset 39 in svn for trunk/Resolutions.cpp


Ignore:
Timestamp:
Nov 18, 2008, 10:30:58 AM (16 years ago)
Author:
severine ovyn
Message:

ok for ETmis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Resolutions.cpp

    r26 r39  
    5252//------------------------------------------------------------------------------
    5353
    54 
    55 
    56 void PairingJet(TLorentzVector &JETSm, TLorentzVector JET,  vector<fastjet::PseudoJet> sorted_jetsS)
     54// //********************************** PYTHIA INFORMATION*********************************
     55
     56TSimpleArray<TRootGenParticle> TauHadr(const TClonesArray *GEN)
     57 {
     58   TIter it((TCollection*)GEN);
     59   it.Reset();
     60   TRootGenParticle *gen1;
     61   TSimpleArray<TRootGenParticle> array,array2;
     62
     63   while((gen1 = (TRootGenParticle*) it.Next()))
     64      {
     65        array.Add(gen1);
     66      }
     67   it.Reset();
     68   bool tauhad;
     69   while((gen1 = (TRootGenParticle*) it.Next()))
     70    {
     71       tauhad=false;
     72       if(abs(gen1->PID)==15)
     73         {
     74            int d1=gen1->D1;
     75            int d2=gen1->D2;
     76
     77            if((d1 < array.GetEntries()) && (d1 > 0) && (d2 < array.GetEntries()) && (d2 > 0))
     78               {
     79                 tauhad=true;
     80                 for(int d=d1; d < d2+1; d++)
     81                    {
     82                      if(abs(array[d]->PID)== pE || abs(array[d]->PID)== pMU)tauhad=false;
     83                    }
     84               }
     85         }
     86        if(tauhad)array2.Add(gen1);
     87     }
     88   return array2;
     89 }
     90
     91
     92
     93void PairingJet(TLorentzVector &JETSm, const TLorentzVector &JET,  vector<fastjet::PseudoJet> sorted_jetsS)
    5794{
    5895  JETSm.SetPxPyPzE(0,0,0,0);
     
    146183 
    147184  TRootGenParticle *particle;
    148   TRootETmis *etmisc;
    149  
    150   RESOLELEC *elementElec;
     185 
     186  RESOLELEC * elementElec;
    151187  RESOLMUON *elementMuon;
    152188  RESOLJET *elementJet;
     
    172208  vector<fastjet::PseudoJet> inclusive_jetsS;
    173209  vector<fastjet::PseudoJet> sorted_jetsS;
     210
     211  vector<fastjet::PseudoJet> input_particlesT;//for FastJet algorithm
     212  vector<fastjet::PseudoJet> inclusive_jetsT;
     213  vector<fastjet::PseudoJet> sorted_jetsT;
     214
    174215  vector<PhysicsTower> towers;
    175216 
    176217  fastjet::JetDefinition jet_def;
    177218  fastjet::JetDefinition jet_defS;
     219  fastjet::JetDefinition jet_defT;
    178220  fastjet::JetDefinition::Plugin * plugins;
    179221  fastjet::JetDefinition::Plugin * pluginsS;
     222  fastjet::JetDefinition::Plugin * pluginsT;
    180223 
    181224  // set up a CDF midpoint jet definition
     
    195238#endif
    196239 
     240 // set up a CDF midpoint jet definition
     241 #ifdef ENABLE_PLUGIN_CDFCONES
     242 pluginsT = new fastjet::CDFJetCluPlugin(0,DET->CONERADIUS,DET->C_ADJACENCYCUT,DET->C_MAXITERATIONS,DET->C_IRATCH,DET->C_OVERLAPTHRESHOLD);
     243 jet_defT = fastjet::JetDefinition(pluginsT);
     244 #else
     245 pluginsT = NULL;
     246 #endif
     247 
    197248 
    198249  // Loop over all events
     
    212263      TrackCentral.clear();
    213264      TSimpleArray<TRootGenParticle> NFCentralQ;
     265   
     266      sorted_jetsS.clear();
     267      input_particlesS.clear();
     268      inclusive_jetsS.clear();
     269
     270      sorted_jetsT.clear();
     271      input_particlesT.clear();
     272      inclusive_jetsT.clear();
     273
     274      sorted_jets.clear();
    214275      input_particles.clear();
    215276      inclusive_jets.clear();
    216       sorted_jets.clear();
    217       input_particlesS.clear();
    218       inclusive_jetsS.clear();
    219       sorted_jetsS.clear();
    220277      towers.clear();
    221278     
     
    228285          float eta = fabs(particle->Eta);
    229286         
    230           if(particle->Status == 1)
     287          if(particle->Status == 1 && eta < DET->MAX_CALO_FWD)
    231288            {
    232289              input_particles.push_back(fastjet::PseudoJet(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E()));
    233290            }
    234291         
     292          if((pid == pNU1) || (pid == pNU2) || (pid == pNU3))PTmis = PTmis + genMomentum;
    235293          // keeps only final particles, visible by the central detector, including the fiducial volume
    236294          // the ordering of conditions have been optimised for speed : put first the STATUS condition
     
    241299              )
    242300            {
    243               PTmis = PTmis + genMomentum;//ptmis
     301              //if((pid != pNU1) && (pid != pNU2) && (pid != pNU3))PTmis = PTmis + genMomentum;//ptmis
     302
     303              Float_t nonS=0;
    244304              switch(pid) {
    245 
    246305              case pE: // all electrons with eta < DET->MAX_CALO_FWD
    247                 DET->SmearElectron(genMomentum);
     306                nonS = genMomentum.E();
     307                DET->SmearElectron(genMomentum);
     308                if(eta < DET->MAX_TRACKER){
     309                elementElec=(RESOLELEC*) branchelec->NewEntry();
     310                elementElec->NonSmeareE = nonS;
     311                elementElec->SmeareE = genMomentum.E();}
    248312                break; // case pE
    249313              case pGAMMA: // all photons with eta < DET->MAX_CALO_FWD
     
    251315                break; // case pGAMMA
    252316              case pMU: // all muons with eta < DET->MAX_MU
     317                elementMuon = (RESOLMUON*) branchmuon->NewEntry();
     318                elementMuon->OneoverNonSmearePT = (1/genMomentum.Pt());
    253319                DET->SmearMu(genMomentum);
     320                elementMuon->OneoverSmearePT = (1/genMomentum.Pt());
    254321                break; // case pMU
    255322              case pLAMBDA: // all lambdas with eta < DET->MAX_CALO_FWD
     
    264331              if(pid != pMU)
    265332                {
    266 //                PTmisS = PTmisS + genMomentum;
    267333                  towers.push_back(PhysicsTower(LorentzVector(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E())));
    268                   if(genMomentum.Et()>0.5)input_particlesS.push_back(fastjet::PseudoJet(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E()));
     334                  input_particlesS.push_back(fastjet::PseudoJet(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E()));
    269335                }
    270336             
     
    286352            } // switch
    287353        } // while
    288      
    289      TLorentzVector TowerTLV(0.,0.,0.,0.);
     354   
     355     TLorentzVector Att(0.,0.,0.,0.);
     356     float ScalarEt=0;
    290357     for(unsigned int i=0; i < towers.size(); i++)
    291358       {
    292          TowerTLV.SetPxPyPzE(towers[i].fourVector.px,towers[i].fourVector.py,towers[i].fourVector.pz,towers[i].fourVector.E);
    293          if(TowerTLV.Et()>0.5)PTmisS = PTmisS + TowerTLV;
    294       }
    295 
    296  
     359         Att.SetPxPyPzE(towers[i].fourVector.px,towers[i].fourVector.py,towers[i].fourVector.pz,towers[i].fourVector.E);
     360         ScalarEt = ScalarEt + Att.Et();
     361         PTmisS = PTmisS + Att;
     362       }
     363//cout<<"non smeare "<<PTmis.Pt()<<" "<<PTmisS.Pt()<<endl;
     364//cout<<"smeare "<<PTmis.Px()<<" "<<PTmisS.Px()<<endl;
     365//cout<<"**********"<<endl;
     366
    297367      elementEtmis= (ETMIS*) branchetmis->NewEntry();
    298       elementEtmis->Et = (PTmis).Et();
    299       elementEtmis->EtSmeare = (PTmisS).Et()-(PTmis).Et();
     368      elementEtmis->Et = (PTmis).Pt();
     369      elementEtmis->Ex = (-PTmis).Px();
     370      elementEtmis->SEt = ScalarEt;
     371
     372      elementEtmis->EtSmeare = (PTmisS).Pt()-(PTmis).Pt();
     373      elementEtmis->ExSmeare = (-PTmisS).Px()-(PTmis).Px();
    300374     
    301375      //*****************************
     
    316390        }
    317391     
     392      TSimpleArray<TRootGenParticle> TausHadr = TauHadr(branchGen);
     393
    318394      TLorentzVector JETSm(0,0,0,0);
    319395      for (unsigned int i = 0; i < sorted_jets.size(); i++) {
     
    326402            elementJet->NonSmearePT = JET.Et();
    327403            elementJet->SmearePT = JETSm.Et()/JET.Et();
    328            
    329404          }
     405      }
     406      for (unsigned int i = 0; i < sorted_jetsS.size(); i++) {
     407        TLorentzVector JETT(0,0,0,0);
     408        JETT.SetPxPyPzE(sorted_jetsS[i].px(),sorted_jetsS[i].py(),sorted_jetsS[i].pz(),sorted_jetsS[i].E());
     409        if(fabs(JETT.Eta()) < (DET->MAX_TRACKER - DET->TAU_CONE_TRACKS))
     410           {
     411            for(Int_t i=0; i<TausHadr.GetEntries();i++)
     412              {
     413                if(DeltaR(TausHadr[i]->Phi,TausHadr[i]->Eta,JETT.Phi(),JETT.Eta())<0.1)
     414                  {
     415                    elementTaujet= (TAUHAD*) branchtaujet->NewEntry();
     416                    elementTaujet->EnergieCen = (DET->EnergySmallCone(towers,JETT.Eta(),JETT.Phi())/JETT.E());
     417                    elementTaujet->NumTrack = DET->NumTracks(TrackCentral,DET->PT_TRACK_TAU,JETT.Eta(),JETT.Phi());
     418                 }
     419              }
     420           }
     421         
    330422       
    331423      } // for itJet : loop on all jets
Note: See TracChangeset for help on using the changeset viewer.