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

AlephAlgoLeptons.h

Go to the documentation of this file.
00001 
00002 //
00003 // Aleph Algos for Leptons:
00004 // Leptons filtering and Tau Production
00005 //
00006 // Author : C. Delaere, V. Lemaitre, O. van der Aa
00007 //
00009 
00010 #include <map>
00011 
00013 
00022 template <class Type> 
00023 void AlephCollection<Type>::FilterMu(vector<float> argus)
00024 {
00025   float d0max;
00026   float pmin;
00027   int minhit;
00028   float cosmax;
00029   float z0max;
00030   if(argus.size()==5)
00031   {
00032         d0max  = argus[0];
00033         pmin   = argus[1];
00034         minhit   = (int)argus[2];
00035         cosmax = argus[3];
00036         z0max  = argus[4];
00037   }
00038   else
00039   {
00040         d0max  = 0.5;  
00041         pmin   = 1.;
00042         minhit = 4;
00043         cosmax = 0.95;
00044         z0max  = 10.;
00045   }  
00046   iterator imu;
00047   for (imu=begin();imu<end();imu++)
00048     // ignore locked objects
00049     if (!((*imu)->isLocked()))
00050       { 
00051         // check if the type is correct...
00052         if ((*imu)->TYPE() != MUON ) 
00053           { 
00054             cout << "WARNING Not AlMuon: type not supported !" << endl; 
00055             exit(1);
00056           }
00057         // good tracks selection
00058         bool xtrackdp=true;
00059         if ((*imu)->getTrack()->isLocked())            xtrackdp=false;
00060         if ((*imu)->QP() < pmin)                       xtrackdp=false;
00061         if ((*imu)->getTrack()->NT() < minhit)         xtrackdp=false;
00062         if (fabs((*imu)->QCT()) >= cosmax)             xtrackdp=false;
00063         if (fabs((*imu)->getTrack()->QZB()) >= z0max)  xtrackdp=false;
00064         if (fabs((*imu)->getTrack()->QDB()) >= d0max)  xtrackdp=false;
00065         // final selection
00066         if ((!xtrackdp) || ((*imu)->IF() <=  0)) (*this).looperase(imu);
00067       }
00068 }
00069 
00071 
00090 template <class Type> 
00091 void AlephCollection<Type>::FilterEl( const AlephCollection<AlMuon *>& almup,
00092                                   vector<float> argus)
00093 {
00094   float d0max;
00095   float pmin;
00096   int minhit;
00097   float cosmax;
00098   float z0max;
00099   int nwirem;
00100   float r3cut;
00101   float r2cut0l;
00102   float r2cut1l;
00103   float r2cut2l;
00104   float r2cuth;
00105   float r5cutl;
00106   float r5cuth;
00107   if (argus.size()==13)
00108   {
00109         d0max   = argus[0];
00110         pmin    = argus[1];
00111         minhit  = (int)argus[2];
00112         cosmax  = argus[3];
00113         z0max   = argus[4];
00114         nwirem  = (int)argus[5];
00115         r3cut   = argus[6];
00116         r2cut0l = argus[7];
00117         r2cut1l = argus[8];
00118         r2cut2l = argus[9];
00119         r2cuth  = argus[10];
00120         r5cutl  = argus[11];
00121         r5cuth  = argus[12];
00122   }
00123   else
00124   {
00125         d0max   = 0.5;
00126         pmin    = 1.;
00127         minhit  = 4;
00128         cosmax  = 0.95;
00129         z0max   = 10.;
00130         nwirem  = 40;
00131         r3cut   = 1000.;
00132         r2cut0l = -3.;
00133         r2cut1l = -7.;
00134         r2cut2l = -5.;
00135         r2cuth  = 1000.;
00136         r5cutl  = 0.5;
00137         r5cuth  = 1000.;
00138   }
00139   // We've to check that the electron candidate is NOT a muon
00140   // to loop only once, we first fill a map
00141   // with all the needed information
00142   map<int,int> tr;    
00143   for (unsigned int i=0; i < almup.size(); i++)
00144     if (!((almup[i])->isLocked()))
00145       tr[(almup[i]->TN())]=i;
00146   iterator iel;
00147   for (iel=begin();iel<end();iel++)
00148     // ignore locked objects
00149     if (!((*iel)->isLocked()))
00150       { 
00151         // check the type
00152         if ((*iel)->TYPE() != ELEC)
00153           { 
00154             cout << "WARNING Not AlElec: type not supported !" << endl; 
00155             exit(1);
00156           }
00157         // check track quality
00158         bool xtrackdp=true;
00159         if ((*iel)->getTrack()->isLocked())                xtrackdp=false;
00160         if ((*iel)->QP() < pmin)                           xtrackdp=false;
00161         if ((*iel)->getTrack()->NT() < minhit)             xtrackdp=false;
00162         if (fabs((*iel)->QCT()) >= cosmax)                 xtrackdp=false;
00163         if (fabs((*iel)->getTrack()->QZB()) >= z0max)      xtrackdp=false;
00164         if (fabs((*iel)->getTrack()->QDB()) >= d0max)      xtrackdp=false;
00165         // look in the map if it is a muon or not...
00166         if (tr.find((*iel)->FR())!=tr.end()) xtrackdp=false; 
00167         // final selection
00168         if (xtrackdp) 
00169           {
00170             switch ((*iel)->IF()) 
00171               {
00172               case -1 :                 // no EIDT information available
00173                 xtrackdp=false;
00174                 break;
00175               case 0  :                 // o.k.
00176                 if (((*iel)->R3() >= r3cut)    || 
00177                     ((*iel)->R2() <= r2cut0l)  ||
00178                     ((*iel)->R2() >= r2cuth)     )     xtrackdp=false;
00179                 break;
00180               case 1  :                 // in a crack
00181                 if ((((*iel)->R3() >= r3cut)   || 
00182                      ((*iel)->R2() <= r2cut1l) || 
00183                      ((*iel)->R2() >= r2cuth)) 
00184                     &&
00185                     (((*iel)->R5() >= r5cuth)  || 
00186                      ((*iel)->R5() <= r5cutl)  || 
00187                      ((*iel)->getTrack()->NSsum() < nwirem)) )  xtrackdp=false;
00188                 break;
00189               case 2  :               // in overlap
00190                 if ((((*iel)->R3() >= r3cut)   || 
00191                      ((*iel)->R2() <= r2cut2l) || 
00192                      ((*iel)->R2() >= r2cuth)) 
00193                     &&
00194                     (((*iel)->R5() >= r5cuth)  || 
00195                      ((*iel)->R5() <= r5cutl)  || 
00196                      ((*iel)->getTrack()->NSsum() < nwirem)) )  xtrackdp=false;
00197                 break;
00198               }
00199           }
00200         if (!xtrackdp) (*this).looperase(iel); 
00201       }
00202 }
00203 
00205 
00216 template <class Type>
00217 AlephCollection<AlTau> AlephCollection<Type>::ATauJn(vector<float> argus, float Qelep) const
00218 {
00219   float Ycut;
00220   int Scheme;
00221   int Metric;
00222   if((argus.size()==8)||(argus.size()==3))
00223   {
00224         Ycut = argus[0];
00225         Scheme = (int)argus[1];
00226         Metric = (int)argus[2];
00227   }
00228   else
00229   {
00230         Ycut = 0.01;;
00231         Scheme = 1;
00232         Metric = 1;
00233   }
00234   // Check the type of object. MUST be Eflw
00235   for (const_iterator i=begin();i<end();i++)
00236     if ((*i)->TYPE() != EFLOW)
00237       { 
00238         cout << "WARNING Not Eflw: type not supported !" << endl; 
00239         exit(1);
00240       }
00241   // make a lot of mini-jets with JADE algorithm (preferably)
00242   // we don't have to care about the lock problem 'cause the JetAlgo does it
00243   AlephCollection<AlJet> Jjade;
00244   if (Metric)
00245     Jjade = (*this).JadeJet(Ycut, Scheme, Qelep);
00246   else
00247     Jjade = (*this).DurhamJet(Ycut, Scheme, Qelep);
00248   AlephCollection<AlTau> P;
00249   int jetn = Jjade.size();
00250   // loop on the candidates
00251   for (int ijet = 0; ijet<jetn; ijet++)
00252     {
00253       typedef AlephCollection<AlObject*>::iterator ObI;
00254       AlEflw* theAssEflw = NULL;
00255       float Echgood=0.;
00256       int tn=0;
00257       // loop on objects in the taujet, record #tracks and total E
00258       for (ObI ifl=Jjade[ijet].getObjects().begin();
00259            ifl<Jjade[ijet].getObjects().end();
00260            ifl++)
00261         if (((AlEflw*)(*ifl))->getEfType()<=3)
00262           {
00263             theAssEflw = ((AlEflw*)(*ifl));
00264             tn++;
00265             Echgood+=(((AlEflw*)(*ifl))->QE());
00266           }
00267       // check number of objects and save the result
00268       if ((tn == 1) || (tn == 3))
00269         {
00270           AlTau tmp = Jjade[ijet];
00271           tmp.setNch(tn);
00272           tmp.setEch(Echgood);
00273           tmp.setEflw(theAssEflw);
00274           P.push_back(tmp);
00275         }
00276       }
00277   return P;
00278 }
00279 
00281 
00293 template <class Type>
00294 void AlephCollection<Type>::FilterTau(vector<float> argus)
00295 {
00296   float psummin;
00297   float d0max;
00298   int minhit;
00299   float cosmax;
00300   float z0max;
00301   if(argus.size()==8)
00302   {
00303         psummin = argus[3];
00304         d0max   = argus[4];
00305         minhit    = (int)argus[5];
00306         cosmax  = argus[6];
00307         z0max   = argus[7];
00308   }
00309   else if (argus.size()==5)
00310   { 
00311         psummin = argus[0];
00312         d0max   = argus[1];
00313         minhit    = (int)argus[2];
00314         cosmax  = argus[3];
00315         z0max   = argus[4];
00316   }
00317   else
00318   {
00319         psummin = 1.; 
00320         d0max   = 2.; 
00321         minhit  = 4;
00322         cosmax  = 0.95; 
00323         z0max   = 10.; 
00324   }
00325     for (iterator ijet = begin(); ijet<end(); ijet++)
00326     {
00327       int Ntpc;
00328       float pp;
00329       float ee;
00330       float d0;
00331       float z0;
00332       float costheta;
00333       int Nchgood=0;
00334       int OneBadTrack=0;
00335       int lock=0;
00336       typedef AlephCollection<AlObject*>::iterator ObI;
00337       AlEflw* dummy = new AlEflw;
00338       AlEflw* theAssEflw = dummy;
00339       theAssEflw->setA4V(0,0,0,0);
00340       // loop on objects in the jet
00341       // compute the associated track and get some parameters
00342       for (ObI ifl=(*ijet)->getObjects().begin();
00343            ifl<(*ijet)->getObjects().end();
00344            ifl++) 
00345         {
00346           if (((AlEflw*)(*ifl))->getEfType()<=3)
00347             {
00348               if (((AlEflw*)(*ifl))->getTrack()==NULL)
00349                 {
00350                   Ntpc = 0;
00351                   d0   = 0;
00352                   z0   = 0;
00353                   lock = 1;
00354                   costheta = 1;
00355                 }
00356               else
00357                 {
00358                   Ntpc = ((AlEflw*)(*ifl)) -> getTrack() -> NT();
00359                   if ((((*ijet)->QCH() * ((AlEflw*)(*ifl))->QCH() > 0 ) && 
00360                        ( ((AlEflw*)(*ifl))->QE() > theAssEflw->QE()    )     ) ||
00361                       (( (*ijet)->QCH() == 0 ) && ( ((AlEflw*)(*ifl))->QE()>theAssEflw->QE())))
00362                     theAssEflw=((AlEflw*)(*ifl));
00363                   d0 = ((AlEflw*)(*ifl)) -> getTrack() -> QDB();
00364                   z0 = ((AlEflw*)(*ifl)) -> getTrack() -> QZB();
00365                   lock = ((AlEflw*)(*ifl)) -> getTrack() -> isLocked();
00366                   costheta = ((AlEflw*)(*ifl)) -> QCT();
00367                 }
00368               // bad tracks rejection
00369               if ( (fabs(d0)>=d0max)        ||
00370                    (fabs(z0)>=z0max)        ||
00371                    (fabs(costheta)>=cosmax) ||
00372                    (Ntpc<minhit)            ||
00373                    (lock==1)                   )
00374                 OneBadTrack++;
00375             }
00376         }
00377       // final selection
00378       if(OneBadTrack>0 || (((*ijet)->getEch()) <= psummin))
00379         looperase(ijet);
00380       else
00381         (*ijet)->setEflw(theAssEflw);
00382       delete dummy;
00383     }
00384 }
00385 

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