CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

Multi5x5BremRecoveryClusterAlgo Class Reference

#include <Multi5x5BremRecoveryClusterAlgo.h>

List of all members.

Public Types

enum  VerbosityLevel { pDEBUG = 0, pWARNING = 1, pINFO = 2, pERROR = 3 }

Public Member Functions

reco::SuperClusterCollection makeSuperClusters (reco::CaloClusterPtrVector &clusters)
 Multi5x5BremRecoveryClusterAlgo (const edm::ParameterSet &bremRecoveryPset, double eb_sc_road_etasize=0.06, double eb_sc_road_phisize=0.80, double ec_sc_road_etasize=0.14, double ec_sc_road_phisize=0.40, bool dynamicPhiRoad=true, double theSeedTransverseEnergyThreshold=0.40, VerbosityLevel the_verbosity=pERROR)
void setVerbosity (VerbosityLevel the_verbosity)
 ~Multi5x5BremRecoveryClusterAlgo ()

Private Member Functions

void makeIslandSuperClusters (reco::CaloClusterPtrVector &clusters_v, double etaRoad, double phiRoad)
bool match (reco::CaloClusterPtr seed_p, reco::CaloClusterPtr cluster_p, double etaRoad, double phiRoad)

Private Attributes

bool dynamicPhiRoad_
double eb_rdeta_
double eb_rdphi_
double ec_rdeta_
double ec_rdphi_
BremRecoveryPhiRoadAlgophiRoadAlgo_
double seedTransverseEnergyThreshold
reco::SuperClusterCollection superclusters_v
VerbosityLevel verbosity

Detailed Description

Definition at line 24 of file Multi5x5BremRecoveryClusterAlgo.h.


Member Enumeration Documentation

Enumerator:
pDEBUG 
pWARNING 
pINFO 
pERROR 

Definition at line 28 of file Multi5x5BremRecoveryClusterAlgo.h.

{ pDEBUG = 0, pWARNING = 1, pINFO = 2, pERROR = 3 }; 

Constructor & Destructor Documentation

Multi5x5BremRecoveryClusterAlgo::Multi5x5BremRecoveryClusterAlgo ( const edm::ParameterSet bremRecoveryPset,
double  eb_sc_road_etasize = 0.06,
double  eb_sc_road_phisize = 0.80,
double  ec_sc_road_etasize = 0.14,
double  ec_sc_road_phisize = 0.40,
bool  dynamicPhiRoad = true,
double  theSeedTransverseEnergyThreshold = 0.40,
VerbosityLevel  the_verbosity = pERROR 
) [inline]

Definition at line 30 of file Multi5x5BremRecoveryClusterAlgo.h.

References dynamicPhiRoad_, eb_rdeta_, eb_rdphi_, ec_rdeta_, ec_rdphi_, phiRoadAlgo_, seedTransverseEnergyThreshold, and verbosity.

    {
      // e*_rdeta_ and e*_rdphi_ are half the total window 
      // because they correspond to one direction (positive or negative)
      eb_rdeta_ = eb_sc_road_etasize / 2;
      eb_rdphi_ = eb_sc_road_phisize / 2;
      ec_rdeta_ = ec_sc_road_etasize / 2;
      ec_rdphi_ = ec_sc_road_phisize / 2;

      seedTransverseEnergyThreshold = theSeedTransverseEnergyThreshold;
      dynamicPhiRoad_ = dynamicPhiRoad;
      if (dynamicPhiRoad_) phiRoadAlgo_ = new BremRecoveryPhiRoadAlgo(bremRecoveryPset);

      verbosity = the_verbosity;
    }
Multi5x5BremRecoveryClusterAlgo::~Multi5x5BremRecoveryClusterAlgo ( ) [inline]

Definition at line 55 of file Multi5x5BremRecoveryClusterAlgo.h.

References dynamicPhiRoad_, and phiRoadAlgo_.

  {
     if (dynamicPhiRoad_) delete phiRoadAlgo_;
  } 

Member Function Documentation

void Multi5x5BremRecoveryClusterAlgo::makeIslandSuperClusters ( reco::CaloClusterPtrVector clusters_v,
double  etaRoad,
double  phiRoad 
) [private]

Definition at line 41 of file Multi5x5BremRecoveryClusterAlgo.cc.

References edm::PtrVector< T >::begin(), edm::PtrVectorBase::clear(), gather_cfg::cout, dynamicPhiRoad_, edm::PtrVector< T >::end(), BremRecoveryPhiRoadAlgo::endcapPhiRoad(), relval_parameters_module::energy, spr::find(), match(), phiRoadAlgo_, pINFO, edm::PtrVector< T >::push_back(), seedTransverseEnergyThreshold, funct::sin(), superclusters_v, and verbosity.

Referenced by makeSuperClusters().

{

        std::vector<DetId> usedSeedDetIds;
        usedSeedDetIds.clear();

        for (reco::CaloCluster_iterator currentSeed = clusters_v.begin(); currentSeed != clusters_v.end(); ++currentSeed)
        {

                // check this seed was not already used
                if (std::find(usedSeedDetIds.begin(), usedSeedDetIds.end(), (*currentSeed)->seed()) 
                        != usedSeedDetIds.end()) continue;

                // Does our highest energy cluster have high enough energy?
                // changed this to continue from break (to be robust against the order of sorting of the seed clusters)
                if ((*currentSeed)->energy() * sin((*currentSeed)->position().theta()) < seedTransverseEnergyThreshold) continue;

                // if yes, make it a seed for a new SuperCluster:
                double energy = (*currentSeed)->energy();
                math::XYZVector position_((*currentSeed)->position().X(), 
                                (*currentSeed)->position().Y(), 
                                (*currentSeed)->position().Z());
                position_ *= energy;
                usedSeedDetIds.push_back((*currentSeed)->seed());

                if (verbosity <= pINFO)
                {
                        std::cout << "*****************************" << std::endl;
                        std::cout << "******NEW SUPERCLUSTER*******" << std::endl;
                        std::cout << "Seed R = " << (*currentSeed)->position().Rho() << std::endl;
                }

                // and add the matching clusters:
                reco::CaloClusterPtrVector constituentClusters;
                constituentClusters.push_back(*currentSeed);
                reco::CaloCluster_iterator currentCluster = currentSeed + 1;

                while (currentCluster != clusters_v.end())
                {

                        // if dynamic phi road is enabled then compute the phi road for a cluster
                        // of energy of existing clusters + the candidate cluster.
                        if (dynamicPhiRoad_)
                                phiRoad = phiRoadAlgo_->endcapPhiRoad(energy + (*currentCluster)->energy());

                        // does the cluster match the phi road for this candidate supercluster
                        if (match(*currentSeed, *currentCluster, etaRoad, phiRoad) &&
                                std::find(usedSeedDetIds.begin(), usedSeedDetIds.end(), (*currentCluster)->seed()) == usedSeedDetIds.end())
                        {

                                // add basic cluster to supercluster constituents
                                constituentClusters.push_back(*currentCluster);
                                energy   += (*currentCluster)->energy();
                                position_ += (*currentCluster)->energy() * math::XYZVector((*currentCluster)->position().X(),
                                                (*currentCluster)->position().Y(), 
                                                (*currentCluster)->position().Z());

                                // remove cluster from vector of available clusters
                                usedSeedDetIds.push_back((*currentCluster)->seed());

                                if (verbosity <= pINFO) 
                                        std::cout << "Cluster R = " << (*currentCluster)->position().Rho() << std::endl;
                        }
                        ++currentCluster;

                }

                position_ /= energy;

                if (verbosity <= pINFO)
                        std::cout << "Final SuperCluster R = " << position_.Rho() << std::endl;

                reco::SuperCluster newSuperCluster(energy, 
                                math::XYZPoint(position_.X(), position_.Y(), position_.Z()), 
                                (*currentSeed), 
                                constituentClusters);

                superclusters_v.push_back(newSuperCluster);

                if (verbosity <= pINFO)
                {
                        std::cout << "created a new supercluster of: " << std::endl;
                        std::cout << "Energy = " << newSuperCluster.energy() << std::endl;
                        std::cout << "Position in (R, phi, theta) = (" 
                                << newSuperCluster.position().Rho() << ", " 
                                << newSuperCluster.position().phi() << ", "
                                << newSuperCluster.position().theta() << ")" << std::endl;
                }

        }

        clusters_v.clear();

}
reco::SuperClusterCollection Multi5x5BremRecoveryClusterAlgo::makeSuperClusters ( reco::CaloClusterPtrVector clusters)

Definition at line 4 of file Multi5x5BremRecoveryClusterAlgo.cc.

References edm::PtrVector< T >::begin(), eb_rdeta_, eb_rdphi_, ec_rdeta_, ec_rdphi_, edm::PtrVector< T >::end(), makeIslandSuperClusters(), reco::CaloCluster::multi5x5, edm::PtrVector< T >::push_back(), and superclusters_v.

Referenced by Multi5x5SuperClusterProducer::produceSuperclustersForECALPart().

{

        const float etaBorder = 1.479;
        superclusters_v.clear();

        // create vectors of references to clusters of a specific origin...
        reco::CaloClusterPtrVector islandClustersBarrel_v;
        reco::CaloClusterPtrVector islandClustersEndCap_v;

        // ...and populate them:
        for (reco::CaloCluster_iterator it = clustersCollection.begin(); it != clustersCollection.end(); it++)
        {
                reco::CaloClusterPtr cluster_p = *it;
                if (cluster_p->algo() == reco::CaloCluster::multi5x5) 
                {
                        if (fabs(cluster_p->position().eta()) < etaBorder)
                        {
                                islandClustersBarrel_v.push_back(cluster_p);
                        }
                        else
                        {
                                islandClustersEndCap_v.push_back(cluster_p);
                        }
                }
        }

        // make the superclusters from the Barrel clusters - Island
        makeIslandSuperClusters(islandClustersBarrel_v, eb_rdeta_, eb_rdphi_);
        // make the superclusters from the EndCap clusters - Island
        makeIslandSuperClusters(islandClustersEndCap_v, ec_rdeta_, ec_rdphi_);

        return superclusters_v;
}
bool Multi5x5BremRecoveryClusterAlgo::match ( reco::CaloClusterPtr  seed_p,
reco::CaloClusterPtr  cluster_p,
double  etaRoad,
double  phiRoad 
) [private]

Definition at line 138 of file Multi5x5BremRecoveryClusterAlgo.cc.

References funct::cos(), and dPhi().

Referenced by makeIslandSuperClusters().

{
        math::XYZPoint clusterPosition = cluster_p->position();
        math::XYZPoint seedPosition = seed_p->position();

        double dPhi = acos(cos(seedPosition.phi() - clusterPosition.phi()));

        double dEta = fabs(seedPosition.eta() - clusterPosition.eta());

        if (dEta > dEtaMax) return false;
        if (dPhi > dPhiMax) return false;

        return true;
}
void Multi5x5BremRecoveryClusterAlgo::setVerbosity ( VerbosityLevel  the_verbosity) [inline]

Definition at line 60 of file Multi5x5BremRecoveryClusterAlgo.h.

References verbosity.

    {
      verbosity = the_verbosity;
    }

Member Data Documentation

Definition at line 92 of file Multi5x5BremRecoveryClusterAlgo.h.

Referenced by makeIslandSuperClusters(), and makeSuperClusters().