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

ClusterObserver Struct Reference

List of all members.

Public Methods

 ClusterObserver ()
 ~ClusterObserver ()
void upDate (G3EventProxy *ev)
 ClusterObserver ()
 ~ClusterObserver ()
void upDate (G3EventProxy *ev)

Public Attributes

int nbClusters_
double energySum_
SimpleConfigurable< bool > writeCaloRecHits_
SimpleConfigurable< bool > produceReference_
SimpleConfigurable< string > clusterizer_
SimpleConfigurable< bool > writeCaloRecHits_
SimpleConfigurable< bool > produceReference_
SimpleConfigurable< std::string > clusterizer_
SimpleConfigurable< std::string > superClusterizer_
SimpleConfigurable< std::string > endcapSuperClusterizer_
IsoCalculator * ciso_

Constructor & Destructor Documentation

ClusterObserver::ClusterObserver   [inline]
 

Definition at line 39 of file XANAClusters.cpp.

References clusterizer_, energySum_, nbClusters_, produceReference_, and writeCaloRecHits_.

00040    : nbClusters_(0), energySum_(0)
00041    { 
00042     // initialize observer
00043     Observer<G3EventProxy *>::init() ;      
00044     
00045     // steering
00046     writeCaloRecHits_=SimpleConfigurable<bool>(false,"XANAClusters:ESDWithCaloRecHits");
00047     produceReference_=SimpleConfigurable<bool>(false,"XANAClusters:produceReference");
00048     clusterizer_=SimpleConfigurable<string>("EGBCluster","XANAClusters:Clusterizer");
00049    }

ClusterObserver::~ClusterObserver   [inline]
 

Definition at line 51 of file XANAClusters.cpp.

References energySum_, and nbClusters_.

00052    {
00053     std::cout<<"[OVAL] number of clusters : "<<nbClusters_<<endl ;
00054     std::cout<<"[OVAL] mean energy : "<<energySum_/nbClusters_<<endl ;
00055    }

ClusterObserver::ClusterObserver   [inline]
 

Definition at line 51 of file XANASuperClusters.cpp.

References ciso_, clusterizer_, endcapSuperClusterizer_, energySum_, nbClusters_, produceReference_, superClusterizer_, and writeCaloRecHits_.

00052    : nbClusters_(0), energySum_(0)
00053    { 
00054     // initialize observer
00055     Observer<G3EventProxy *>::init() ;      
00056     
00057     // steering
00058     writeCaloRecHits_=SimpleConfigurable<bool>(false,"XANAClusters:ESDWithCaloRecHits");
00059     produceReference_=SimpleConfigurable<bool>(false,"XANAClusters:ProduceReference");
00060     clusterizer_=SimpleConfigurable<std::string>("EGBCluster","XANAClusters:Clusterizer");
00061     superClusterizer_=SimpleConfigurable<std::string>("EGSCluster","XANAClusters:SuperClusterizer");
00062     endcapSuperClusterizer_=SimpleConfigurable<std::string>("EGECluster","XANAClusters:EndcapSuperClusterizer");
00063 /* 
00064     // defines clustering algo  
00065     EgammaHAnalyzer<EgammaBasicCluster,EGDummy,CaloRecHit> *clustersUnit_=0; 
00066     vector<const EgammaAlgorithm<EgammaBasicCluster,EGDummy,CaloRecHit> * > algos;
00067     if (clusterizer_.value()=="EgammaBasicDynamic") {    
00068       algos.push_back(new EgammaBasicDynamic);
00069       clustersUnit_ = new EgammaHAnalyzer<EgammaBasicCluster,EGDummy,CaloRecHit>(algos,0) ;      
00070      } else if (clusterizer_.value()=="EgammaBasicIsland") { 
00071       algos.push_back(new EgammaBasicIsland); 
00072       clustersUnit_ = new EgammaHAnalyzer<EgammaBasicCluster,EGDummy,CaloRecHit>(algos,0) ;
00073      } else if (clusterizer_.value()=="EgammaBasicHybrid") { 
00074       algos.push_back(new EgammaBasicHybrid);
00075       clustersUnit_ = new EgammaHAnalyzer<EgammaBasicCluster,EGDummy,CaloRecHit>(algos,0) ;
00076      } else if (clusterizer_.value()=="EgammaDefault") { 
00077       // Egamma code uses two algorithms for clustering
00078       EgammaBasicIsland *island = new EgammaBasicIsland;
00079       EgammaBasicHybrid *hybrid = new EgammaBasicHybrid;
00080       algos.push_back(island);
00081       algos.push_back(hybrid);
00082       clustersUnit_ = new EgammaHAnalyzer<EgammaBasicCluster,EGDummy,CaloRecHit>(algos,0);
00083       // island corrections
00084       clustersUnit_->SetCalib(new EgammaCalibrator<EgammaBasicCluster>(new EGBLogPosCorr(island)));
00085       clustersUnit_->AddCalib(new EgammaCalibrator<EgammaBasicCluster>(new EGBLogPosCorr(hybrid)));
00086      } else { 
00087        throw Genexception("[ClusterObserver::ClusterObserver()], wrong cluster algo name");      
00088     }
00089     clustersUnit_->changeName("EgammaBasicCluster") ;    
00090  
00091     Reconstructor::addDefault(clustersUnit_) ;
00092 
00093     // from EgammaSuperClusters/src/EgammaReco.cc
00094     EGSCSeedGenerator *seedgen = new EGSCSeedGenerator();
00095     EgammaHAnalyzer<EgammaCluster, EGDummy, EgammaBasicCluster> *bd =
00096      new EgammaHAnalyzer<EgammaCluster, EGDummy, EgammaBasicCluster>(seedgen,0);
00097    
00098     // SuperCluster and brem recovery
00099     EgammaHAnalyzer<EgammaSuperCluster,EgammaCluster,EgammaBasicCluster> *be = 0;
00100     if (superClusterizer_.value()=="EPBremRecovery") {
00101       EPBremRecovery *brec = new EPBremRecovery(algos);
00102       be = new EgammaHAnalyzer<EgammaSuperCluster,EgammaCluster,EgammaBasicCluster>(brec,0);
00103     } else if (superClusterizer_.value()=="EgammaDefault") {
00104       EgammaBremRecovery *brec = new EgammaBremRecovery();
00105       be = new EgammaHAnalyzer<EgammaSuperCluster,EgammaCluster,EgammaBasicCluster>(brec,0);
00106     } else
00107      throw Genexception("[ClusterObserver::ClusterObserver()], wrong brem recoverer algo name");
00108   
00109     // SuperCluster calibration using Chris's escale functions
00110     be->SetCalib(new EgammaCalibrator<EgammaSuperCluster>(new EgammaSCEnergyScale()));
00111 
00112     // Endcap Preshower association/reconstruction
00113     EgammaEndcapAssociation *egea = new EgammaEndcapAssociation();
00114     EgammaHAnalyzer<EgammaEndcapCluster,EgammaSuperCluster,CaloRecHit> *eea =
00115      new EgammaHAnalyzer<EgammaEndcapCluster,EgammaSuperCluster,CaloRecHit>(egea,0);
00116 
00117     std::cout << "adding superclusters algos " << std::endl;
00118     Reconstructor::addDefault(bd);
00119     Reconstructor::addDefault(be);
00120     Reconstructor::addDefault(eea);
00121 */   
00122 
00123     // finally define isolation algorithm
00124     ciso_ = Singleton<IsoCalculator>::instance();
00125    
00126    }

ClusterObserver::~ClusterObserver   [inline]
 

Definition at line 128 of file XANASuperClusters.cpp.

References energySum_, and nbClusters_.

00129    {
00130     std::cout<<"[OVAL] number of clusters : "<<nbClusters_<<std::endl ;
00131     std::cout<<"[OVAL] mean energy : "<<energySum_/nbClusters_<<std::endl ;
00132    }


Member Function Documentation

void ClusterObserver::upDate G3EventProxy *    ev [inline]
 

Definition at line 135 of file XANASuperClusters.cpp.

References XANASuperCluster::addBremCluster, XANACluster::addHit, ciso_, clusterizer_, endcapSuperClusterizer_, energySum_, XANACluster::getEnergy, nbClusters_, XANASuperCluster::setAlgoName, XANASuperCluster::setCaloIsolation, XANASuperCluster::setDisc1, XANASuperCluster::setDisc2, XANASuperCluster::setDisc3, XANASuperCluster::setEnergy, XANASuperCluster::setEnergyScaleFactor, XANASuperCluster::setHadronicOverEm, XANACluster::setNumberOfRecHits, XANASuperCluster::setPosition, XANASuperCluster::setPositionCovarianceMatrix, XANASuperCluster::setPreshowerInfo, XANASuperCluster::setSeedCluster, XANASuperCluster::setSum1, XANASuperCluster::setSum25, XANASuperCluster::setSum4, and XANASuperCluster::setSum9.

00136    { 
00137     if (!ev) return ;       
00138 
00139     std::cout << "updating .." << std::endl;
00140     // from EgammaSuperClusters/src/EgammaReco.cc
00141     // Egamma code is really messy: all superclusters becomes EndcapClusters at the end !!
00142     RecCollection<EgammaEndcapCluster> endcapSuperClusters( RecQuery(endcapSuperClusterizer_.value()));
00143     RecCollection<EgammaEndcapCluster>::const_iterator endcapSuperCluster ;  
00144     // to produce reference file
00145     if (produceReference_) {
00146      // super clusters are at the end EndCapSuperClusters!!
00147      for (endcapSuperCluster=endcapSuperClusters.begin(); endcapSuperCluster!=endcapSuperClusters.end(); endcapSuperCluster++)      
00148       {
00149        // remove double reconstruction in case of EgammaDefault
00150        if (endcapSuperClusterizer_.value() == "EGECluster") {
00151          // hybrid is algo>=100   
00152          if ( (endcapSuperCluster->seed()->WhichAlgo()>99 && 
00153              fabs(endcapSuperCluster->eta())>1.4791) || 
00154             (endcapSuperCluster->seed()->WhichAlgo()<99 && 
00155              fabs(endcapSuperCluster->eta())<1.4791) ) continue;
00156        }
00157        nbClusters_++;
00158        energySum_ += endcapSuperCluster->energy() ;
00159        std::cout<<"[OVAL] new super cluster with energy "<<endcapSuperCluster->energy()<<endl ;
00160       }
00161       return ;
00162     } 
00163 
00164     // construct XANASuperClusters from SuperClusters
00165     vector<XANASuperCluster> xsclusters;
00166     XANASuperCluster *xscluster;
00167 
00168     // loop on endcaps super clusters
00169     for (endcapSuperCluster=endcapSuperClusters.begin(); endcapSuperCluster!=endcapSuperClusters.end(); endcapSuperCluster++) 
00170      {
00171       // remove double reconstruction in case of EgammaDefault
00172       if (endcapSuperClusterizer_.value() == "EGECluster") {
00173         // Egamma beautiful code: hybrid is algo>=100 !!  
00174         if ( (endcapSuperCluster->seed()->WhichAlgo()>99 && 
00175             fabs(endcapSuperCluster->eta())>1.4791) || 
00176            (endcapSuperCluster->seed()->WhichAlgo()<99 && 
00177             fabs(endcapSuperCluster->eta())<1.4791) ) continue;
00178       }
00179       nbClusters_++;
00180       energySum_ += endcapSuperCluster->energy() ;
00181       std::cout << "[update] constructing new supercluster from algo " << endcapSuperCluster->seed()->WhichAlgo()
00182       << " at eta " << endcapSuperCluster->eta()<< std::endl;
00183       xscluster = new XANASuperCluster;
00184       xscluster->setEnergy(endcapSuperCluster->energy()); 
00185       xscluster->setPosition(endcapSuperCluster->position()); 
00186       xscluster->setSum1(endcapSuperCluster->seed()->getS1()); 
00187       xscluster->setSum4(endcapSuperCluster->seed()->getS4()); 
00188       xscluster->setSum9(endcapSuperCluster->seed()->getS9()); 
00189       xscluster->setSum25(endcapSuperCluster->seed()->getS25()); 
00190       xscluster->setHadronicOverEm(endcapSuperCluster->seed()->getHoe()); 
00191       // iso not available from endcap super clusters
00192       // compute from IsoCalculator
00193       float iso = ciso_->getIso(endcapSuperCluster->eta(),endcapSuperCluster->phi());
00194       xscluster->setCaloIsolation(iso); 
00195       xscluster->setDisc1(endcapSuperCluster->seed()->getDisc1()); 
00196       xscluster->setDisc2(endcapSuperCluster->seed()->getDisc2()); 
00197       xscluster->setDisc3(endcapSuperCluster->seed()->getDisc3()); 
00198       HepSymMatrix cov(2);
00199       cov(1,1) = endcapSuperCluster->seed()->getCovEE();
00200       cov(1,2) = endcapSuperCluster->seed()->getCovEP();
00201       cov(2,2) = endcapSuperCluster->seed()->getCovPP();
00202       xscluster->setPositionCovarianceMatrix(cov);
00203       xscluster->setEnergyScaleFactor(endcapSuperCluster->energy()/endcapSuperCluster->energyUncorrected());
00204       xscluster->setAlgoName(endcapSuperClusterizer_.value());
00205       float theta = 2.*atan(exp(-endcapSuperCluster->seed()->Eta()));
00206       float energy = endcapSuperCluster->seed()->Et()/sin(theta);
00207       float x = endcapSuperCluster->seed()->Radius()*sin(theta)*cos(endcapSuperCluster->seed()->Phi());
00208       float y = endcapSuperCluster->seed()->Radius()*sin(theta)*sin(endcapSuperCluster->seed()->Phi());
00209       float z = endcapSuperCluster->seed()->Radius()*cos(theta);
00210       // Chi2 and NumberOfDigis not available from egamma seed cluster
00211       // retreiving from the basic cluster
00212       float chi2 = 0.;
00213       int numberOfDigis = 0;
00214       EgammaVSuperCluster::const_iterator icf = endcapSuperCluster->basicClusters().first;
00215       std::cout << "[update] adding seed " << std::endl;
00216       // add seed cluster
00217       XANAEmCluster *seed = new XANAEmCluster((*icf)->energy(),
00218                           (*icf)->position(),
00219                           (*icf)->chi2(),
00220                           clusterizer_.value()); 
00221       if (writeCaloRecHits_) {
00222             std::vector<const CaloRecHit *> rhits=(*icf)->rHits();
00223             for (vector<const CaloRecHit *>::const_iterator
00224              it=rhits.begin(); it != rhits.end(); it++) {
00225               seed->addHit(new XANACaloRecHit((*it)->energy(), (*it)->time(), 
00226               (*it)->chi2(), XANACellID((*it)->getMyCell().position())));
00227             } 
00228       } else
00229         seed->setNumberOfRecHits(numberOfDigis);      
00230       xscluster->setSeedCluster(seed);
00231       std::cout << "[update] adding brems " << std::endl;
00232       // now add brems clusters
00233       XANAEmCluster *brem = 0;
00234       for (EgammaVSuperCluster::const_iterator ic = (endcapSuperCluster->basicClusters().first)+1; ic != endcapSuperCluster->basicClusters().second; ic++) {
00235         // beware !! this list includes the seed cluster
00236         // for naming, stick to the RecAlgo names
00237         std::string name = "";
00238         if ((*ic)->whichAlgo() == 1) name="EGBCluster";
00239         else if ((*ic)->whichAlgo() == 2) name="EGBDynamicCluster";
00240         else if ((*ic)->whichAlgo() == 100) name="EGBCluster";  
00241         if ((*ic)->energy() != energy) {
00242           brem = new XANAEmCluster((*ic)->energy(),(*ic)->position(),(*ic)->chi2(),name);           
00243           if (writeCaloRecHits_) {
00244             std::vector<const CaloRecHit *> rhits=(*ic)->rHits();
00245             for (vector<const CaloRecHit *>::const_iterator
00246              it=rhits.begin(); it != rhits.end(); it++) {
00247               brem->addHit(new XANACaloRecHit((*it)->energy(), (*it)->time(),
00248               (*it)->chi2(), XANACellID((*it)->getMyCell().position())));
00249             } 
00250           } else
00251             brem->setNumberOfRecHits((*ic)->numberOfDigis());
00252           std::cout << "[upDate] brem energy " << brem->getEnergy() << std::endl;
00253           xscluster->addBremCluster(brem);
00254         }
00255       } 
00256       std::cout << "[update] adding presh info " << std::endl;
00257       // add preshower info when relevant (endcap)
00258       XANAPreshowerInfo *preshowerInfo = 0;
00259 //ElectronPhoton/EgammaPreshower/interface/EgammaEndcapCluster.h:
00260 //Information about presh clusters currently not stored
00261 //      if (endcapSuperCluster->energy_P1()+endcapSuperCluster->energy_P2() != 0. ) {
00262 //        cout << "[update] constructing a  XANAPreshowerInfo" << endl;
00263 //      preshowerInfo = new XANAPreshowerInfo(endcapSuperCluster->energy_P1(), 
00264 //       endcapSuperCluster->energy_P2(), endcapSuperCluster->position_P1(),
00265 //       endcapSuperCluster->position_P2(), endcapSuperCluster->calibP1(), endcapSuperCluster->calibP2(), 
00266 //       endcapSuperCluster->calibSC());
00267 //      } 
00268       xscluster->setPreshowerInfo(preshowerInfo);
00269       std::cout << "[update] all done for this supercluster " << std::endl;
00270       xsclusters.push_back(*xscluster); 
00271     }     
00272 
00273     // read XANASuperClusters 
00274     vector<XANASuperCluster>::iterator its;
00275     for (its=xsclusters.begin(); its!=xsclusters.end(); its++)  
00276      {
00277       std::cout<<"[OVAL] new super cluster with energy "<<its->getEnergy()<<std::endl ;
00278      }
00279 
00280    }

void ClusterObserver::upDate G3EventProxy *    ev [inline]
 

Definition at line 58 of file XANAClusters.cpp.

References XANACluster::addHit, clusterizer_, energySum_, nbClusters_, xana::out, and XANACluster::setNumberOfRecHits.

00059    { 
00060     
00061     if (!ev) return ;    
00062     
00063     RecCollection<EgammaBasicCluster> clusters ( RecQuery(clusterizer_.value()) );
00064     RecCollection<EgammaBasicCluster> ::const_iterator cluster ;
00065     
00066     // to produce reference
00067     if (produceReference_) {
00068       // BasicClusters
00069       for (cluster=clusters.begin(); cluster!=clusters.end(); cluster++)  
00070        {
00071         // remove double reconstruction in case of EGBCluster
00072         if (clusterizer_.value() == "EGBCluster") {
00073           // hybrid is algo>=100 and is used in barrel only
00074           // island is algo 1 and is used everywhere
00075           if ( (cluster->whichAlgo()>99 && fabs(cluster->eta())>1.4791) || 
00076              (cluster->whichAlgo()<99 && fabs(cluster->eta())<1.4791) ) continue;
00077         }
00078         nbClusters_++ ;
00079         energySum_ += cluster->energy() ;
00080         std::cout<<"[OVAL] new cluster with energy "<<cluster->energy()<<flush ;
00081         std::cout<<" and "<<cluster->numberOfDigis()<<" crystal(s)"<<endl ;
00082        }
00083        return ;
00084     } 
00085     
00086     // construct XANAEmClusters from BasicClusters
00087     vector<XANACluster> xclusters;
00088     XANACluster *xcluster;
00089     for (cluster=clusters.begin(); cluster!=clusters.end(); cluster++)  
00090      {
00091       // remove double reconstruction in case of EGBCluster
00092       if (clusterizer_.value() == "EGBCluster") {
00093         // hybrid is algo>=100 and is used in barrel only
00094         // island is algo 1 and is used everywhere
00095         if ( (cluster->whichAlgo()>99 && fabs(cluster->eta())>1.4791) || 
00096            (cluster->whichAlgo()<99 && fabs(cluster->eta())<1.4791) ) continue;
00097       }
00098       xana::out(2) << "[update] new cluster with energy " << cluster->energy() << " from algo " << cluster->whichAlgo() << std::endl;
00099       nbClusters_++ ;
00100       // for naming, stick to the RecAlgo names
00101       std::string name = "";
00102       if (cluster->whichAlgo() == 1) name="EGBCluster";
00103       else if (cluster->whichAlgo() == 2) name="EGBDynamicCluster";
00104       else if (cluster->whichAlgo() == 100) name="EGBCluster";
00105       xcluster = new XANAEmCluster(cluster->energy(), cluster->position(), cluster->chi2(), name); 
00106       if (writeCaloRecHits_) {
00107         std::vector<const CaloRecHit *> rhits=cluster->rHits();
00108         for (vector<const CaloRecHit *>::const_iterator
00109          it=rhits.begin(); it != rhits.end(); it++) {
00110           xcluster->addHit(new XANACaloRecHit((*it)->energy(), (*it)->time(),
00111           (*it)->chi2(), XANACellID((*it)->getMyCell().position())));
00112 //        (*it)->chi2(), new XANACellID((*it)->getMyCell().position())));
00113         } 
00114       } else 
00115         xcluster->setNumberOfRecHits(cluster->numberOfDigis());
00116       xclusters.push_back(*xcluster);
00117      }
00118      
00119     // read XANAEmClusters 
00120     vector<XANACluster>::iterator it;
00121     for (it=xclusters.begin(); it!=xclusters.end(); it++)  
00122      {
00123       std::cout<<"[OVAL] new cluster with energy "<<it->getEnergy()<<flush ;
00124       std::cout<<" and position "<<it->getPosition()<<endl ;
00125      }
00126    }


Member Data Documentation

IsoCalculator* ClusterObserver::ciso_
 

Definition at line 49 of file XANASuperClusters.cpp.

Referenced by ClusterObserver, and upDate.

SimpleConfigurable<std::string> ClusterObserver::clusterizer_
 

Definition at line 45 of file XANASuperClusters.cpp.

SimpleConfigurable<string> ClusterObserver::clusterizer_
 

Definition at line 37 of file XANAClusters.cpp.

Referenced by ClusterObserver, and upDate.

SimpleConfigurable<std::string> ClusterObserver::endcapSuperClusterizer_
 

Definition at line 47 of file XANASuperClusters.cpp.

Referenced by ClusterObserver, and upDate.

double ClusterObserver::energySum_
 

Definition at line 42 of file XANASuperClusters.cpp.

Referenced by ClusterObserver, upDate, and ~ClusterObserver.

int ClusterObserver::nbClusters_
 

Definition at line 41 of file XANASuperClusters.cpp.

Referenced by ClusterObserver, upDate, and ~ClusterObserver.

SimpleConfigurable<bool> ClusterObserver::produceReference_
 

Definition at line 44 of file XANASuperClusters.cpp.

SimpleConfigurable<bool> ClusterObserver::produceReference_
 

Definition at line 36 of file XANAClusters.cpp.

Referenced by ClusterObserver.

SimpleConfigurable<std::string> ClusterObserver::superClusterizer_
 

Definition at line 46 of file XANASuperClusters.cpp.

Referenced by ClusterObserver.

SimpleConfigurable<bool> ClusterObserver::writeCaloRecHits_
 

Definition at line 43 of file XANASuperClusters.cpp.

SimpleConfigurable<bool> ClusterObserver::writeCaloRecHits_
 

Definition at line 35 of file XANAClusters.cpp.

Referenced by ClusterObserver.


The documentation for this struct was generated from the following files:
Generated on Tue May 10 10:01:36 2005 for XANADOO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002