CMS 3D CMS Logo

Public Member Functions | Private Attributes

CosmicHitPairGeneratorFromLayerPair Class Reference

#include <CosmicHitPairGeneratorFromLayerPair.h>

Inheritance diagram for CosmicHitPairGeneratorFromLayerPair:
HitPairGenerator OrderedHitsGenerator

List of all members.

Public Member Functions

virtual
CosmicHitPairGeneratorFromLayerPair
clone () const
 CosmicHitPairGeneratorFromLayerPair (const LayerWithHits *inner, const LayerWithHits *outer, const edm::EventSetup &iSetup)
virtual void hitPairs (const TrackingRegion &ar, OrderedHitPairs &ap, const edm::Event &ev, const edm::EventSetup &iSetup)
virtual void hitPairs (const TrackingRegion &ar, OrderedHitPairs &ap, const edm::EventSetup &iSetup)
const LayerWithHitsinnerLayer () const
const LayerWithHitsouterLayer () const
virtual ~CosmicHitPairGeneratorFromLayerPair ()

Private Attributes

const DetLayerinnerlay
const DetLayerouterlay
const LayerWithHitstheInnerLayer
const LayerWithHitstheOuterLayer
const TrackerGeometrytrackerGeometry
const
TransientTrackingRecHitBuilder
TTRHbuilder

Detailed Description

Definition at line 40 of file CosmicHitPairGeneratorFromLayerPair.h.


Constructor & Destructor Documentation

CosmicHitPairGeneratorFromLayerPair::CosmicHitPairGeneratorFromLayerPair ( const LayerWithHits inner,
const LayerWithHits outer,
const edm::EventSetup iSetup 
)
virtual CosmicHitPairGeneratorFromLayerPair::~CosmicHitPairGeneratorFromLayerPair ( ) [inline, virtual]

Definition at line 49 of file CosmicHitPairGeneratorFromLayerPair.h.

{ }

Member Function Documentation

virtual CosmicHitPairGeneratorFromLayerPair* CosmicHitPairGeneratorFromLayerPair::clone ( void  ) const [inline, virtual]
virtual void CosmicHitPairGeneratorFromLayerPair::hitPairs ( const TrackingRegion ar,
OrderedHitPairs ap,
const edm::Event ev,
const edm::EventSetup iSetup 
) [inline, virtual]

Implements HitPairGenerator.

Definition at line 56 of file CosmicHitPairGeneratorFromLayerPair.h.

{}
void CosmicHitPairGeneratorFromLayerPair::hitPairs ( const TrackingRegion ar,
OrderedHitPairs ap,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from HitPairGenerator.

Definition at line 29 of file CosmicHitPairGeneratorFromLayerPair.cc.

References abs, edm::EventSetup::get(), LayerWithHits::layer(), LayerWithHits::recHits(), theInnerLayer, and theOuterLayer.

{
//  static int NSee = 0; static int Ntry = 0; static int Nacc = 0;


  typedef OrderedHitPair::InnerRecHit InnerHit;
  typedef OrderedHitPair::OuterRecHit OuterHit;


  if (theInnerLayer->recHits().empty()) return;

  if (theOuterLayer->recHits().empty()) return;
  //  const DetLayer* innerlay=theOuterLayer->layer();
  // const BarrelDetLayer *pippo=dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer());


  // ************ Daniele

  const DetLayer* blay1;
  const DetLayer* blay2;
  blay1 = dynamic_cast<const BarrelDetLayer*>(theInnerLayer->layer());
  blay2 = dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer());


  bool seedfromoverlaps= false;
  bool InTheBarrel = false;
  bool InTheForward = false;
  if (blay1 && blay2) {
    InTheBarrel = true;
  }
  else  InTheForward = true;

  if (InTheBarrel){
    float radius1 =dynamic_cast<const BarrelDetLayer*>(theInnerLayer->layer())->specificSurface().radius();
    float radius2 =dynamic_cast<const BarrelDetLayer*>(theOuterLayer->layer())->specificSurface().radius();
     seedfromoverlaps=(abs(radius1-radius2)<0.1) ? true : false;
  }

 
  vector<OrderedHitPair> allthepairs;
  std::string builderName = "WithTrackAngle";
  edm::ESHandle<TransientTrackingRecHitBuilder> builder;
  iSetup.get<TransientRecHitRecord>().get(builderName, builder);

  
  std::vector<const TrackingRecHit*>::const_iterator ohh;
  for(ohh=theOuterLayer->recHits().begin();ohh!=theOuterLayer->recHits().end();ohh++){
    TkHitPairsCachedHit oh= builder->build(*ohh);
    std::vector<const TrackingRecHit*>::const_iterator ihh;
    for(ihh=theInnerLayer->recHits().begin();ihh!=theInnerLayer->recHits().end();ihh++){
      TkHitPairsCachedHit ih= builder->build(*ihh);
      
      float z_diff =ih->globalPosition().z()-oh->globalPosition().z();
      float inny=ih->globalPosition().y();
      float outy=oh->globalPosition().y();
      float innx=ih->globalPosition().x();
      float outx=oh->globalPosition().x();;
      float dxdy=abs((outx-innx)/(outy-inny));
      float DeltaR=oh->globalPosition().perp()-ih->globalPosition().perp();;
      
      if( InTheBarrel && (abs(z_diff)<30) // && (outy > 0.) && (inny > 0.)
          //&&((abs(inny-outy))<30) 
          &&(dxdy<2)
          &&(inny*outy>0)
          && (abs(DeltaR)>0)) {

        //      cout << " ******** sono dentro inthebarrel *********** " << endl;
        if (seedfromoverlaps){
          //this part of code works for MTCC
          // for the other geometries must be verified
          //Overlaps in the difference in z is decreased and the difference in phi is
          //less than 0.05
          if ((DeltaR<0)&&(abs(z_diff)<18)&&(abs(ih->globalPosition().phi()-oh->globalPosition().phi())<0.05)&&(dxdy<2)) result.push_back( OrderedHitPair(ih, oh));
        }
        else  result.push_back( OrderedHitPair( ih, oh));
      
        


      }
      if( InTheForward &&  (abs(z_diff) > 1.)) {
        //      cout << " ******** sono dentro intheforward *********** " << endl;
        result.push_back( OrderedHitPair(ih,oh));
      }
    }
  }

//   stable_sort(allthepairs.begin(),allthepairs.end(),CompareHitPairsY(iSetup));
//   //Seed from overlaps are saved only if 
//   //no others have been saved

//   if (allthepairs.size()>0) {
//     if (seedfromoverlaps) {
//       if (result.size()==0) result.push_back(allthepairs[0]);
//     }
//     else result.push_back(allthepairs[0]);
//   }


}
const LayerWithHits* CosmicHitPairGeneratorFromLayerPair::innerLayer ( ) const [inline]

Definition at line 62 of file CosmicHitPairGeneratorFromLayerPair.h.

References theInnerLayer.

{ return theInnerLayer; }
const LayerWithHits* CosmicHitPairGeneratorFromLayerPair::outerLayer ( ) const [inline]

Definition at line 63 of file CosmicHitPairGeneratorFromLayerPair.h.

References theOuterLayer.

{ return theOuterLayer; }

Member Data Documentation

Definition at line 70 of file CosmicHitPairGeneratorFromLayerPair.h.

Definition at line 71 of file CosmicHitPairGeneratorFromLayerPair.h.

Definition at line 69 of file CosmicHitPairGeneratorFromLayerPair.h.

Referenced by hitPairs(), and innerLayer().

Definition at line 68 of file CosmicHitPairGeneratorFromLayerPair.h.

Referenced by hitPairs(), and outerLayer().

Definition at line 66 of file CosmicHitPairGeneratorFromLayerPair.h.