Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

acoplanar.cpp

Go to the documentation of this file.
00001 
00002 // User analysis routines for acoplanar jets selection
00003 // suited for inv. Higgs and single W selection
00004 //
00005 // Author : C. Delaere
00006 //
00007 // Date: 2000-09-10
00008 // Updated 2001-14-03 : new Ntuple
00009 // Updated 2001-14-08 : new alpha++ version (with vertexing and root)
00010 //
00012 
00013 
00014 #include <fstream>
00015 #include "AlephExManager.h"
00016 #include "AlephCollection.h"
00017 #include <vector>
00018 
00019 extern ofstream fout;
00020 
00021 
00023 //  User Init
00025 
00026 static int Ngood = 0;
00027 static int Ebeam = -1;
00028 static int Nbad = 0;
00029 static float mZ = 91.1882; // RPP2000
00030 
00031 void AlephExManager::UserInit()
00032 {
00033   // book an ntuple
00034   // this version using AddScalableOutput will not work properly with paw
00035         int i;
00036         float f;
00037 
00038         theNtupleWriter()->AddOutput(f,"echf");
00039         theNtupleWriter()->AddOutput(f,"e12f");
00040         theNtupleWriter()->AddOutput(f,"qelep");
00041         theNtupleWriter()->AddOutput(i,4, "run","event","trig","nch");
00042         theNtupleWriter()->AddOutput(f,2,"econef","ewedgef");
00043         theNtupleWriter()->AddOutput(f,15,"msumf","esumf","ptsumf","thrust",
00044                                           "spher","plan","aplan",
00045                                           "cthmiss","ptmiss","mmiss","minvis",
00046                                           "acopl","acolin","y12","y23");
00047         theNtupleWriter()->AddOutput(i,3,"imutag","ieltag","itautag");
00048         theNtupleWriter()->AddScalableOutput("Pmumax",f,4);
00049         theNtupleWriter()->AddScalableOutput("Pelmax",f,4);
00050         theNtupleWriter()->AddScalableOutput("Ptaumax",f,4);
00051         theNtupleWriter()->AddScalableOutput("Pj1",f,4);
00052         theNtupleWriter()->AddScalableOutput("Pj2",f,4);
00053         theNtupleWriter()->AddScalableOutput("Pj1ww",f,4);
00054         theNtupleWriter()->AddScalableOutput("Pj2ww",f,4);
00055         theNtupleWriter()->AddOutput(f,8,"msumww","acoplww","acolww","pmaxf",
00056                                          "intjets","mjets","pisol","Egamma");
00057         theNtupleWriter()->AddOutput(i,3,"nchtjet","lepton","presel");
00058         theNtupleWriter()->AddScalableOutput("MC_e",f,500);
00059         theNtupleWriter()->AddScalableOutput("MC_x",f,500);
00060         theNtupleWriter()->AddScalableOutput("MC_y",f,500);
00061         theNtupleWriter()->AddScalableOutput("MC_z",f,500);
00062         theNtupleWriter()->AddScalableOutput("MC_code",i,500);
00063 }
00064 
00067 
00068 //number of stable charged particles
00069 int nchCount(AlMCtruth* particle) 
00070 {
00071   int nch=0;
00072   AlephCollection<AlMCtruth*> daughters = particle->getDaughterVector();
00073   for(AlephCollection<AlMCtruth*>::iterator daughter = daughters.begin();
00074                                         daughter < daughters.end();daughter++)
00075    if( (*daughter)->getDaughterVector().size() != 0)
00076      nch += nchCount(*daughter);
00077    else
00078      nch += (int)fabs((*daughter)->QCH());
00079   return nch;
00080 }
00081 //number of stable charged particles
00082 HepLorentzVector A4VchCount(AlMCtruth* particle)
00083 {
00084   HepLorentzVector Ech;
00085   AlephCollection<AlMCtruth*> daughters = particle->getDaughterVector();
00086   for(AlephCollection<AlMCtruth*>::iterator daughter = daughters.begin();
00087                                         daughter < daughters.end();daughter++)
00088    if( (*daughter)->getDaughterVector().size() != 0)
00089      Ech += A4VchCount(*daughter);
00090    else
00091      Ech +=(*daughter)->A4V();
00092   return Ech;
00093 }
00094 // visible part of A4V
00095 HepLorentzVector visible(AlMCtruth* particle)
00096 {
00097   HepLorentzVector vis;
00098   AlephCollection<AlMCtruth*> daughters = particle->getDaughterVector();
00099   for(AlephCollection<AlMCtruth*>::iterator daughter = daughters.begin();
00100                                         daughter < daughters.end();daughter++)
00101    if( (*daughter)->getDaughterVector().size() != 0)
00102      vis += visible(*daughter);
00103    else
00104      if(!(((*daughter)->name()[0]=='n')&&((*daughter)->name()[1]=='u'))) 
00105       vis+=(*daughter)->A4V();
00106   return vis;
00107 }
00108 // the first generation of fermions
00109 vector<pair<HepLorentzVector, int > > FindFermions(AlephCollection<AlMCtruth*>::iterator obj , int thecode)
00110 {
00111         vector<pair<HepLorentzVector, int > > TheResult;
00112         if(((*obj)->PA()==41)||((*obj)->PA()==42)||((*obj)->PA()==43)||((*obj)->PA()==44)||((*obj)->PA()==54))
00113         {
00114                 thecode = (*obj)->PA()*1000;
00115                 AlephCollection<AlMCtruth*> daughters = (*obj)->getDaughterVector();
00116                 for(AlephCollection<AlMCtruth*>::iterator MCpart=daughters.begin();
00117                                 MCpart<daughters.end();MCpart++)
00118                 {
00119                         int thenewcode= thecode+(*MCpart)->PA();
00120                         vector<pair<HepLorentzVector, int > > toappend = FindFermions(MCpart,thenewcode);
00121                         for(vector<pair<HepLorentzVector, int > >::iterator appender=toappend.begin();
00122                                         appender<toappend.end();appender++)
00123                                 TheResult.push_back(*appender);
00124                 }
00125         }
00126         else 
00127         {
00128                 pair<HepLorentzVector, int > thisOne( (*obj)->A4V(), thecode);
00129                 TheResult.push_back(thisOne);
00130         }
00131         return TheResult;
00132 }
00133 // a functor to sort collections of pointors
00134 struct order
00135 {
00136         bool operator()(QvecBase* a, QvecBase* b)
00137         {
00138                 return ((*a) < (*b)) ;
00139         }
00140 };
00142 //  User Event
00144 bool AlephExManager::UserEvent(AlphaBanks& EventInfo)
00145 {
00146 // some definitions
00147   typedef AlephCollection<AlObject *>::iterator ObI;
00148   typedef AlephCollection<AlTrack  *>::iterator TI;
00149   typedef AlephCollection<AlMuon   *>::iterator MuI;
00150   typedef AlephCollection<AlElec   *>::iterator ElI;
00151   typedef AlephCollection<AlEflw   *>::iterator FlI;
00152   typedef AlephCollection<AlTau    *>::iterator TauI;
00153   float QQRADP=180./M_PI;
00154   float QELEP;
00155   TI  Ich;
00156   MuI Imu;
00157   ElI Iel;
00158   FlI Ifl;
00159 // initialize the run/event related quantities
00160   AlRun myrun = EventInfo.Run();
00161   AlEvent myevent = EventInfo.Event();
00162   QELEP = myevent.Energy();
00163   if (QELEP<=0)
00164     {
00165       cerr << "ERROR: QELEP <= 0" << endl;
00166       return false;
00167     }
00168 // Select event according to class
00169   if (!((myevent.EdirClass())&(1<<15))) return false; // class 16
00170 // Select event according to trigger/luminosity
00171   int rawtrigger = myevent.GetRawTrigger();
00172   if (!myevent.xlumok(QELEP)) 
00173     {
00174       cout << "Event " << myevent.number() << " : Bad Luminosity." << endl;
00175       return false;
00176     }
00177   int trig_opt = 1;
00178   typedef vector<double> Tvector;
00179   typedef pair<String,Tvector> element;
00180   vector<element> _UserCards = theCardsReader()->getUserCards();
00181   for( vector<element>::const_iterator cardlookup=_UserCards.begin(); cardlookup<_UserCards.end();cardlookup++)
00182     if (cardlookup->first==string("POT")) trig_opt = 0;
00183 
00184   if (!myevent.IsTrigger(trig_opt)) 
00185     {
00186       cout << "Event " << myevent.number() << " : Bad Trigger. ";
00187       cout << "Trigger word is " << rawtrigger << endl;
00188       return false;
00189     }
00190 // get vectors of pointers to the objects used in MC analysis
00191   AlephCollection<AlMCtruth*> MCparticles = EventInfo.MCtruthPV();
00192 // get vectors of pointers to the objects used in the analysis
00193   // vectors directly obtained from AlphaBank
00194   AlephCollection<AlTrack *> altp =EventInfo.TrackPV();
00195   AlephCollection<AlMuon  *> almup=EventInfo.MuonPV();
00196   AlephCollection<AlElec  *> alelp=EventInfo.ElecPV();
00197   AlephCollection<AlEflw  *> alefp=EventInfo.EflwPV();
00198 // Good quality charged Tracks selection
00199   int Nchsel=0;
00200   float Echsel=0.;
00201   for (Ich=altp.begin(); Ich<altp.end(); Ich++)
00202     {
00203       int Ntpc = (*Ich)->NT();
00204       float costhch = (*Ich)->QCT();
00205       float d0 = (*Ich) -> QDB();
00206       float z0 = (*Ich) -> QZB();
00207 
00208       if ((Ntpc<4)||(costhch>0.95)||(d0>2.)||(z0>10.)
00209           ||(costhch<-.95)||(d0<-2)||(z0<-10))
00210         {
00211           (*Ich)->Lock();          // Lock the tracks (for leptons algos)
00212           altp.looperase(Ich);     // Erases elements in the altp vector
00213         }
00214       else
00215         {
00216           Nchsel++;
00217           Echsel += (*Ich)->QE();
00218         }
00219     }
00220 
00221 // now select the event according to the good charged tracks
00222   if ((Nchsel >= 3) && (Echsel >= 2.)) Ngood++;
00223   else return false;
00224   if ( myevent.ErrorStatus() != 1) return false;
00225   if ( alefp.size()==0 ) return false;
00226 // compute some topological quantities
00227   QvecBase Psum = alefp.GetSum();
00228   float esum  = Psum.QE();
00229   float ptsum = Psum.QPT();
00230   float psum  = Psum.QP();
00231   float msum  = Psum.QM();
00232   QvecBase Pmiss = alefp.GetMiss(QELEP);
00233   float cthmiss=Pmiss.QCT();
00234   float mmiss=Pmiss.QM();
00235   float pmiss=Pmiss.QP();
00236   float minvis=pow(pow(QELEP-(mZ*esum/msum),2)-pow(mZ*pmiss/mmiss,2),.5);
00237   float thethrust  = alefp.AThrust().getThrustValue();
00238   float sphericity = alefp.Sphericity();
00239   float planarity  = alefp.Planarity();
00240   float aplanarity = alefp.Aplanarity();
00241   // preselection cuts
00242   if((Pmiss.QPT()<=0) ||(fabs(Pmiss.QCT())>.95)  ||(msum<5)) return false;
00243   // wedge energy in 30 degree
00244   float ewedge=0;
00245   if (Pmiss.QP() >0)
00246     {
00247       for(Ifl = alefp.begin(); Ifl < alefp.end(); Ifl++)
00248          if((acos(min(max(cos(Pmiss.QPH()-((*Ifl)->QPH())),-1.),1.)))*QQRADP<30)
00249            ewedge+= (*Ifl)->QE();
00250     }
00251   else
00252     return false;
00253   // preselection cuts
00254   if ((ewedge>(.2*QELEP))&&(Pmiss.QPT()<(.02*QELEP))) return false;
00255   //energy in 12 deg cone centred aound beam pipe
00256   float e12_av=0;
00257   float econe =0;
00258   const float c12=0.9781476;
00259   for(Ifl = alefp.begin(); Ifl < alefp.end(); Ifl++)
00260     {
00261       int type = (*Ifl)->getEfType();
00262       float costheta = fabs((*Ifl)->QCT());
00263       const double c12=0.9781476;
00264       float nint=(*Ifl)->QCH();
00265       if((type == 7) || (type == 8) || ((nint ==0) && (costheta> c12)))
00266         e12_av += (*Ifl)->QE();
00267       if(costheta > c12)
00268         econe += (*Ifl)-> QE();
00269     }
00270   if(myrun.number()<4000) e12_av += myevent.gen_e12(QELEP);
00271 
00272 // Initialize leptons loops
00273   //generate raw taus candidates
00274   AlephCollection<AlTau> JJ = alefp.ATauJn(theCardsReader()->TAIDcuts(),QELEP);
00275   AlephCollection<AlTau*> altaup = JJ.Pointers();
00276 
00277   //filter muons
00278   almup.FilterMu(theCardsReader()->MUIDcuts());
00279   sort(almup.begin(),almup.end(),order());
00280 
00281   //filter electrons
00282   alelp.FilterEl(almup,theCardsReader()->ELIDcuts());
00283   sort(alelp.begin(),alelp.end(),order());
00284 
00285   //filter taus
00286   altaup.FilterTau(theCardsReader()->TAIDcuts());
00287   // compute max leptonic momentum
00288   vector<float> pmax(2);
00289   pmax[0] = (almup.size()  ? almup[almup.size()-1]->QP()   : 0.);
00290   pmax[1] = (alelp.size()  ? alelp[alelp.size()-1]->QP()   : 0.);
00291   float plepmax = *max_element(pmax.begin(),pmax.end());
00292 // Select the most anti-parallel (to Pmiss) 
00293 // identified electron or  muon
00294   int imutag=0;
00295   int ieltag=0;
00296   HepLorentzVector A4Vmumax;
00297   HepLorentzVector A4Velmax;
00298   float eelmax=0;
00299   float cosjmiss;
00300   AlMuon selmuon;
00301   AlElec selelec;
00302   AlTrack* theElTrack;
00303   AlTrack* theMuTrack;
00304   float cosjmin=1;
00305   for (Imu=almup.begin(); Imu<almup.end(); Imu++)
00306     if(Pmiss.QP() > 0) 
00307       {
00308         cosjmiss=(*Imu)->QCOSA(Pmiss);
00309         if(cosjmiss <= cosjmin)
00310           {
00311             cosjmin=cosjmiss;
00312             A4Vmumax = (*Imu)->A4V();
00313             selmuon =(**Imu);
00314             theMuTrack = (*Imu) -> getTrack();
00315             imutag =1;
00316           }
00317       }
00318   cosjmin=1;
00319   for (Iel=alelp.begin(); Iel<alelp.end(); Iel++)
00320     if(Pmiss.QP() > 0) 
00321       {
00322         cosjmiss=(*Iel)->QCOSA(Pmiss);
00323         if(cosjmiss <= cosjmin)
00324           {
00325             cosjmin=cosjmiss;
00326             A4Velmax = (*Iel)->A4V();
00327             selelec =(**Iel);
00328             theElTrack = (*Iel) -> getTrack();
00329             ieltag =1;
00330           }
00331       }
00332 // Select the most anti-parallel (to Pmiss) 
00333 // identified tau with energy > 0.05*ELEP
00334 // Do not select Tau which are already identified as electron or muon...
00335   int itautag=0;
00336   HepLorentzVector A4Vtaumax;
00337   AlTau* seltau;
00338   TauI  Itau;
00339   cosjmin=1;
00340   for (Itau=altaup.begin(); Itau<altaup.end(); Itau++)
00341     {
00342       int nch=0;
00343       bool keep=true;
00344       nch=(*Itau)->getNch();
00345       if(imutag>0 || ieltag>0)
00346         for (ObI Ifl=(*Itau)->getObjects().begin();Ifl<(*Itau)->getObjects().end();Ifl++)
00347           if((((AlEflw*)(*Ifl))->getTrack())==theElTrack || 
00348              (((AlEflw*)(*Ifl))->getTrack())==theMuTrack) keep=false;
00349       if(Pmiss.QP()>0 && (keep)) 
00350         {
00351           cosjmiss= (*Itau)->QCOSA(Pmiss);
00352           if(cosjmiss < cosjmin)
00353             {
00354               cosjmin=cosjmiss;
00355               A4Vtaumax = (*Itau)->A4V();
00356               seltau=(*Itau);
00357               itautag=nch;
00358             }
00359         }
00360     }
00361 
00362   int alefpsize=0;
00363   for (AlephCollection<AlEflw*>::iterator i = alefp.begin(); i != alefp.end(); i++)
00364    if (!((*i)->isLocked())) alefpsize++;
00365   if (alefpsize<3) return false;
00366 
00367 // Compute acoplanarity and acolinearity
00368 //     ( Make 2 jets using Durham PE for a fixed number of jet,
00369 //       enter a negative values of Ycut = -number of jets!    )
00370   cerr <<  "." ;
00371   int jetr;
00372   float Ycut = -2.;// force 2 jets
00373   int scheme = 1;  // E-scheme
00374   AlephCollection<AlJet> Jn = alefp.DurhamJet(Ycut, scheme, 0);
00375   jetr = Jn.size();
00376   // first set the Sort Criterium ( component of the 4-vector )
00377   // the default value is 3, so that we may forget this line
00378   QvecBase::SortCriterium = 3;
00379   // sort the vector using the component 3 (e) of A4V
00380   sort(Jn.begin(),Jn.end());
00381   float acopl=180.;
00382   float acolin=90.;
00383   float one=1.;
00384   if(jetr == 2)
00385     {
00386       acopl= acos(min(max(cos(Jn[0].QPH()-Jn[1].QPH()),-1.),1.))*QQRADP;
00387       acolin= acos(min(max(Jn[1].QCOSA(Jn[0]),-one),one))*QQRADP;
00388     }
00389   
00390   // Final preselection cuts
00391   bool set1 = ((Pmiss.QPT()<=0) ||(fabs(Pmiss.QCT())>.95)  ||
00392                (msum<5)         ||(ewedge>(.2*QELEP))      ||(acolin>175));
00393   bool set2 = ((Pmiss.QPT()<=0) ||(fabs(Pmiss.QCT())>.95)  ||
00394                (esum>(.9*QELEP))||(Pmiss.QPT()<(.02*QELEP))||(acopl>175));
00395   if (set1 && set2) return false;
00396   
00397   // Calculate Yi variables
00398   vector<float> Yn = alefp.DurhamYn(scheme,0.);
00399 
00400   // Make 3 jets using Durham PE
00401   Ycut = -3.;      // force 2 jets
00402   scheme = 1;      // E-scheme
00403   AlephCollection<AlJet> Jn2 = alefp.DurhamJet(Ycut, scheme, 0);
00404   vector<float> interjet(3);
00405   vector<float> msumjet(3);
00406   vector<int>   nchtjet(3);
00407   float interjetmin;
00408   float msumjetmin;
00409   float nchtjetmin;
00410   if (Jn2.size()==3)
00411     {
00412       interjet[0] = Jn2[0].QCOSA(Jn2[1]);
00413       msumjet[0]  = Jn2[0].QM2(Jn2[1]);
00414       nchtjet[0]  = 0;
00415       for(ObI iter=Jn2[0].getObjects().begin();iter<Jn2[0].getObjects().end();iter++)
00416         if (((AlEflw*)(*iter))->getEfType()<=3) nchtjet[0] ++; 
00417       interjet[1] = Jn2[0].QCOSA(Jn2[2]);
00418       msumjet[1]  = Jn2[0].QM2(Jn2[2]);
00419       nchtjet[0]  = 1;
00420       for(ObI iter=Jn2[1].getObjects().begin();iter<Jn2[1].getObjects().end();iter++)
00421         if (((AlEflw*)(*iter))->getEfType()<=3) nchtjet[1] ++; 
00422       interjet[2] = Jn2[1].QCOSA(Jn2[2]);
00423       msumjet[2]  = Jn2[1].QM2(Jn2[2]);
00424       nchtjet[2]  = 0;
00425       for(ObI iter=Jn2[2].getObjects().begin();iter<Jn2[2].getObjects().end();iter++)
00426         if (((AlEflw*)(*iter))->getEfType()<=3) nchtjet[2] ++; 
00427       interjetmin = *max_element(interjet.begin(),interjet.end());
00428       msumjetmin  = *min_element(msumjet.begin(),msumjet.end());
00429       nchtjetmin  = *min_element(nchtjet.begin(),nchtjet.end());
00430     }
00431 
00432   // Find the most isolated charged track
00433   float globalmax=0;
00434   AlTrack* associated;
00435   for ( TI track1 = altp.begin(); track1<altp.end(); track1++)
00436     {
00437       float localmin = 2;
00438       for ( TI track2 = altp.begin(); track2<altp.end(); track2++)
00439         if (track2!=track1)
00440          {
00441             float now = (1-(*track2)->QCOSA(**track1));
00442             localmin = localmin < now ? localmin : now;
00443          }
00444       if (globalmax<localmin)
00445         {
00446           globalmax = localmin;
00447           associated = (*track1);
00448         }
00449     }
00450 // Check if it is a lepton...
00451     
00452   int  lepfound = 0;
00453   for (MuI mui=almup.begin(); mui<almup.end();mui++)
00454     lepfound = (*mui)->getTrack()==associated ? 1 : 0;
00455   if (lepfound==0)
00456   for (ElI eli=alelp.begin(); eli<alelp.end();eli++)
00457     lepfound = (*eli)->getTrack()==associated ? 2 : 0;
00458 
00459 // If there is a tau, compute msumww acoplww acolww without the tau
00460   float msumww  = 0.;
00461   float acoplww = 180.;
00462   float acolww  = 90.;
00463   bool validwwjets = false;
00464   AlephCollection<AlJet> Jn3;
00465   if(itautag>0)
00466     {
00467       // lock all tracks belonging to the Tau.(use the recursive lock)
00468       seltau->Lock(1);
00469       // and calculate sumww and acollinww
00470       int alefpsize=0;
00471       for (AlephCollection<AlEflw*>::iterator i = alefp.begin(); i != alefp.end(); i++)
00472          if (!((*i)->isLocked())) alefpsize++;
00473       if (alefpsize>1)
00474         { 
00475          Ycut = -2;
00476          scheme = 1;
00477          validwwjets=true;
00478          Jn3 = alefp.DurhamJet(Ycut, scheme, 0);
00479          // first set the Sort Criterium ( component of the 4-vector )
00480          // the default value is 3, so that we may forget this line
00481          QvecBase::SortCriterium = 3;
00482          // sort the vector using the component 3 (e) of A4V
00483          sort(Jn3.begin(),Jn3.end());
00484          // compute the invariant mass of the 2 jets
00485          msumww = Jn3[0].QM2(Jn3[1]);
00486          jetr = Jn3.size();
00487          // compute acoplanarity and acolinearity
00488          if(jetr == 2) 
00489           {
00490             acoplww= acos(min(max(cos(Jn3[0].QPH()-Jn3[1].QPH()),-1.),1.))*QQRADP;
00491             acolww= acos(min(max(Jn3[1].QCOSA(Jn3[0]),(float)-1),(float)1))*QQRADP;
00492           }
00493        }
00494       else
00495        {
00496          msumww = 0;
00497          acoplww = 0;
00498          acolww = 0;
00499        }
00500        seltau->unLock(1);
00501     }
00502 // Compute MC information.
00503   float Egamma=0;
00504   vector<float> theFermions_e;
00505   vector<float> theFermions_x;
00506   vector<float> theFermions_y;
00507   vector<float> theFermions_z;
00508   vector<int> theFermions_c;
00509   vector<pair<HepLorentzVector, int> > theFermions;
00510   if(myrun.number()<2000)
00511   {
00512         // keep only primary particles
00513         for(AlephCollection<AlMCtruth*>::iterator MCpart=MCparticles.begin();
00514                         MCpart<MCparticles.end();MCpart++)
00515                 if((*MCpart)->NO()!=0) MCparticles.looperase(MCpart);
00516         // compute energy for gammas, and throw them
00517         for(AlephCollection<AlMCtruth*>::iterator MCpart=MCparticles.begin();
00518                         MCpart<MCparticles.end();MCpart++)
00519                 if((*MCpart)->PA()==1)
00520                 {
00521                         Egamma+=(*MCpart)->QE();
00522                         MCparticles.looperase(MCpart);
00523                 }
00524         // now consider the next generations to get a set of fermions
00525         for(AlephCollection<AlMCtruth*>::iterator MCpart=MCparticles.begin();
00526                         MCpart<MCparticles.end();MCpart++)
00527         {
00528                 vector<pair<HepLorentzVector, int> > toappend = FindFermions(MCpart,(*MCpart)->PA());
00529                 for(vector<pair<HepLorentzVector, int> >::iterator appender=toappend.begin();
00530                                 appender<toappend.end();appender++)
00531                         theFermions.push_back(*appender);
00532         }       
00533         // loop on the resulting vector and create the objects to be stored
00534         for(vector<pair<HepLorentzVector, int> >::iterator resel=theFermions.begin();
00535                         resel<theFermions.end();resel++)
00536         {
00537                 theFermions_e.push_back((*resel).first.e());
00538                 theFermions_x.push_back((*resel).first.x());
00539                 theFermions_y.push_back((*resel).first.y());
00540                 theFermions_z.push_back((*resel).first.z());
00541                 theFermions_c.push_back((*resel).second);
00542         }
00543                 
00544   }
00545 
00546 // normalize parameters
00547   Echsel  /= QELEP;
00548   e12_av  /= QELEP;
00549   econe   /= QELEP;
00550   ewedge  /= QELEP;
00551   psum    /= QELEP;
00552   msum    /= QELEP;
00553   ptsum   /= QELEP;
00554   esum    /= QELEP;
00555   plepmax /= QELEP;
00556 
00557 // Ntuple variable initialization
00558   int nvars = 90;
00559   float* myvars = new float[nvars];
00560   for (int i=0;i<nvars; i++) myvars[i]=0.;
00561 
00562 // Prepare output...
00563 #define Keep theNtupleWriter()->Keep
00564 #define KeepV theNtupleWriter()->KeepV
00565   Keep("run", myrun.number());      //run number
00566   Keep("event", myevent.number());  //event number
00567   Keep("trig", rawtrigger);         //raw trigger word
00568   Keep("nch", Nchsel);              //nch
00569   Keep("echf", Echsel);             //ech
00570   Keep("qelep", QELEP);             //LEP energy
00571   Keep("e12f", e12_av);             //forward E
00572   Keep("econef", econe);            //E in 12deg cone
00573   Keep("ewedgef", ewedge);          //wedge Energy
00574   Keep("msumf", msum);              //invariant mass
00575   Keep("esumf", esum);              //invariant E
00576   Keep("ptsumf", ptsum);            //invariant Pt
00577   Keep("thrust", thethrust);        //thrust value
00578   Keep("spher", sphericity);        //sphericity
00579   Keep("plan", planarity);          //planarity
00580   Keep("aplan", aplanarity);        //aplanarity
00581   Keep("cthmiss", cthmiss);         //cthmiss
00582   Keep("ptmiss", Pmiss.QPT()/QELEP);//ptmiss
00583   Keep("mmiss", Pmiss.QM());        //missing mass
00584   Keep("minvis", minvis);           //invisible mass (if signal)
00585   Keep("acopl", acopl);             //acoplanarity
00586   Keep("acolin", acolin);           //acolinearity
00587   Keep("y12", Yn[0]);               //y12
00588   Keep("y23", Yn[1]);               //y23
00589   Keep("imutag", imutag);           //muon
00590   Keep("ieltag", ieltag);           //electron
00591   Keep("itautag", itautag);         //tau
00592   Keep("Pmumax", A4Vmumax);         //muon A4V
00593   Keep("Pelmax", A4Velmax);         //electron A4V
00594   Keep("Ptaumax", A4Vtaumax);       //tau A4V
00595   Keep("Pj1", Jn[1].A4V());         // WW jets A4Vs
00596   Keep("Pj2", Jn[0].A4V());
00597   float v2[4];
00598   if (validwwjets)
00599   {
00600           Keep("Pj1ww", Jn[1].A4V());
00601           Keep("Pj2ww", Jn[0].A4V());
00602   }
00603   else
00604    {
00605           float v[4]={0.};
00606           Keep("Pj1ww", v, 4);
00607           Keep("Pj2ww", v, 4);
00608    }
00609   Keep("msumww", msumww);          //WW invariant mass
00610   Keep("acoplww", acoplww);        //WW acoplanarity
00611   Keep("acolww", acolww);          //WW acolinearity
00612   Keep("pmaxf", plepmax);          //max lep P
00613   Keep("intjets", interjetmin);    //min interjet cos
00614   Keep("mjets", msumjetmin);       //min invariant mass of 2 jets
00615   Keep("nchtjet", nchtjetmin);     //min number of charged tracks in jets
00616   Keep("pisol", associated->QP()/QELEP);//P of the most isolated track.
00617   Keep("lepton", lepfound);        //is the most isolated track a lepton
00618   Keep("Egamma", Egamma);          //energy of initial state radiation
00619   KeepV("MC_e",theFermions_e);      //energy of the MC fermions
00620   KeepV("MC_x",theFermions_x);      //Px of the MC fermions
00621   KeepV("MC_y",theFermions_y);      //Py of the MC fermions
00622   KeepV("MC_z",theFermions_z);      //Pz of the MC fermions
00623   KeepV("MC_code",theFermions_c);   //code of the MC fermions
00624   Keep("presel", ((!set1) + 2*(!set2)));// set of cuts satisfied
00625   
00626   // Fill ntuple
00627   theNtupleWriter()->Fill();
00628   return true;
00629 }
00630 
00633 
00634 
00635 
00637 //  User Term
00639 void AlephExManager::UserTerm()
00640 {
00641   fout << endl << " USER TERM : Ngood = " << Ngood << endl;
00642 }

Generated at Wed Jun 18 17:19:09 2003 for ALPHA++ by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001