CMS 3D CMS Logo

Public Member Functions | Private Attributes

MagGeoBuilderFromDDD::eSector Class Reference

#include <eSector.h>

List of all members.

Public Member Functions

MagESectorbuildMagESector () const
 Construct the MagESector upon request.
 eSector (handles::const_iterator begin, handles::const_iterator end)
 Constructor from list of volumes.
 ~eSector ()
 Destructor.

Private Attributes

std::vector< eLayerlayers
MagESectormsector
handles theVolumes

Detailed Description

A sector of volumes in the endcap. One sector is composed of several layers (eLayer)

Date:
2005/09/27 15:15:52
Revision:
1.2
Author:
N. Amapane - INFN Torino

Definition at line 19 of file eSector.h.


Constructor & Destructor Documentation

MagGeoBuilderFromDDD::eSector::eSector ( handles::const_iterator  begin,
handles::const_iterator  end 
)

Constructor from list of volumes.

Definition at line 23 of file eSector.cc.

References ClusterizingHistogram::clusterize(), gather_cfg::cout, MagGeoBuilderFromDDD::debug, f, ClusterizingHistogram::fill(), first, i, prof2calltree::last, layers, precomputed_value_sort(), MagGeoBuilderFromDDD::volumeHandle::printUniqueNames(), and theVolumes.

                                                                  :
  theVolumes(begin,end),
  msector(0)
{
  //FIXME!!!
  //precomputed_value_sort(theVolumes.begin(), theVolumes.end(), ExtractAbsZ());
  precomputed_value_sort(theVolumes.begin(), theVolumes.end(), ExtractZ());
  

  // Clusterize in Z
  const float resolution = 1.; // cm //FIXME ??
  float zmin = theVolumes.front()->center().z()-resolution;
  float zmax = theVolumes.back()->center().z()+resolution;
  ClusterizingHistogram  hisZ( int((zmax-zmin)/resolution) + 1, zmin, zmax);

  if (MagGeoBuilderFromDDD::debug) cout << "     Z layers: " << zmin << " " << zmax << endl;

  handles::const_iterator first = theVolumes.begin();
  handles::const_iterator last = theVolumes.end();  

  for (handles::const_iterator i=first; i!=last; ++i){
    hisZ.fill((*i)->center().z());
  }
  vector<float> zClust = hisZ.clusterize(resolution);

  if (MagGeoBuilderFromDDD::debug) cout << "     Found " << zClust.size() << " clusters in Z, "
                  << " layers: " << endl;

  handles::const_iterator layStart = first;
  handles::const_iterator separ = first;

  for (unsigned int i=0; i<zClust.size() - 1; ++i) {
    float zSepar = (zClust[i] + zClust[i+1])/2.f;
    while ((*separ)->center().z() < zSepar) ++separ;
    if (MagGeoBuilderFromDDD::debug) {
      cout << "     Layer at: " << zClust[i]
           << " elements: " << separ-layStart << " unique volumes: ";
      volumeHandle::printUniqueNames(layStart, separ);
    }
    
    layers.push_back(eLayer(layStart, separ));
    layStart = separ;
  }
  {
    if (MagGeoBuilderFromDDD::debug) {
      cout << "     Layer at: " << zClust.back() <<" elements: " << last-separ
           << " unique volumes: ";
      volumeHandle::printUniqueNames(separ,last);
    }
    layers.push_back(eLayer(separ, last));
  }

  // FIXME: Check that all layers have the same dz?. 
  
}
MagGeoBuilderFromDDD::eSector::~eSector ( )

Destructor.

Definition at line 81 of file eSector.cc.

{}

Member Function Documentation

MagESector * MagGeoBuilderFromDDD::eSector::buildMagESector ( ) const

Construct the MagESector upon request.

Definition at line 84 of file eSector.cc.

                                                              {
  if (msector==0) {
    vector<MagELayer*> mLayers;
    for (vector<eLayer>::const_iterator lay = layers.begin();
         lay!=layers.end(); ++lay) {
      mLayers.push_back((*lay).buildMagELayer());
    }
    msector = new MagESector(mLayers, theVolumes.front()->minPhi()); //FIXME
  }
  return msector;
}

Member Data Documentation

Definition at line 34 of file eSector.h.

Referenced by eSector().

Definition at line 36 of file eSector.h.

Definition at line 35 of file eSector.h.

Referenced by eSector().