CMS 3D CMS Logo

Public Member Functions

CSCNeutronReader Class Reference

#include <CSCNeutronReader.h>

Inheritance diagram for CSCNeutronReader:
SubsystemNeutronReader

List of all members.

Public Member Functions

void addHits (std::map< int, edm::PSimHitContainer > &hitMap)
int chamberId (int globalDetId) const
int chamberType (int globalDetId) const
 CSCNeutronReader (const edm::ParameterSet &pset)
virtual int detId (int chamberIndex, int localDetId)
int localDetId (int globalDetId) const
virtual ~CSCNeutronReader ()

Detailed Description

Definition at line 6 of file CSCNeutronReader.h.


Constructor & Destructor Documentation

CSCNeutronReader::CSCNeutronReader ( const edm::ParameterSet pset) [inline]

Definition at line 9 of file CSCNeutronReader.h.

virtual CSCNeutronReader::~CSCNeutronReader ( ) [inline, virtual]

Definition at line 11 of file CSCNeutronReader.h.

{}

Member Function Documentation

void CSCNeutronReader::addHits ( std::map< int, edm::PSimHitContainer > &  hitMap)

Definition at line 207 of file DTMeantimerPatternReco.cc.

References DTMeantimerPatternReco::addHits(), DTMeantimerPatternReco::checkDoubleCandidates(), gather_cfg::cout, DTMeantimerPatternReco::debug, DTSegmentUpdator::fit(), DTMeantimerPatternReco::fitWithT0(), DTMeantimerPatternReco::geometryFilter(), hit::id, DTEnums::Left, DTMeantimerPatternReco::maxfound, DTEnums::Right, DTSegmentCand::setChi2(), and DTMeantimerPatternReco::theUpdator.

Referenced by CSCDigitizer::doAction().

                                                                                            {

  typedef vector<DTHitPairForFit*> hitCont;
  double chi2l,chi2r,t0_corrl,t0_corrr;
  bool foundSomething = false;

  if (debug) 
    cout << "DTMeantimerPatternReco::addHit " << endl << "   Picked " << assHits.size() << " hits, " << hits.size() << " left." << endl;
  
  if (assHits.size()+hits.size()<maxfound) return;
          
  // loop over the remaining hits
  for (hitCont::const_iterator hit=hits.begin(); hit!=hits.end(); ++hit) {
    if (debug)
      cout << "     Trying B: " << **hit<< " wire: " << (*hit)->id() << endl;
            
    assHits.push_back(AssPoint(*hit, DTEnums::Left));
    bool left_ok=fitWithT0(assHits, chi2l, t0_corrl,0);
    assHits.pop_back();

    assHits.push_back(AssPoint(*hit, DTEnums::Right));
    bool right_ok=fitWithT0(assHits, chi2r, t0_corrr,0);
    assHits.pop_back();

    if (debug) {
      int nHits=assHits.size()+1;
      cout << "         Left:  t0_corr = " << t0_corrl << "ns  chi2/nHits = " << chi2l << "/" << nHits << "  ok: " << left_ok << endl;
      cout << "        Right:  t0_corr = " << t0_corrr << "ns  chi2/nHits = " << chi2r << "/" << nHits << "  ok: " << right_ok << endl;
    }

    if (!left_ok && !right_ok) continue;

    foundSomething = true;    

    // prepare the hit set for the next search, start from the other side                        
    hitCont hitsForFit;
    for (hitCont::const_iterator tmpHit=hit+1; tmpHit!=hits.end(); tmpHit++) 
      if (geometryFilter((*tmpHit)->id(),(*hit)->id())) hitsForFit.push_back(*tmpHit); 
      
    reverse(hitsForFit.begin(),hitsForFit.end());

    // choose only one - left or right
    if (assHits.size()>3 && left_ok && right_ok) {
      if (chi2l<chi2r-0.1) right_ok=false; else
        if (chi2r<chi2l-0.1) left_ok=false;
    }
    if (left_ok) { 
      assHits.push_back(AssPoint(*hit, DTEnums::Left));
      addHits(sl,assHits,hitsForFit,result,usedHits);
      assHits.pop_back();
    }
    if (right_ok) { 
      assHits.push_back(AssPoint(*hit, DTEnums::Right));
      addHits(sl,assHits,hitsForFit,result,usedHits);
      assHits.pop_back();
    }
  }

  if (foundSomething) return;

  // If we already have a segment with more hits from this hit pair - don't save this one.  
  if (assHits.size()<maxfound) return;

  // Check if semgent Ok, calculate chi2
  if (!fitWithT0(assHits, chi2l, t0_corrl,debug)) return;

  // If no more iterations - store the current segment

  DTSegmentCand::AssPointCont pointsSet;
  pointsSet.insert(assHits.begin(),assHits.end());
  DTSegmentCand* seg = new DTSegmentCand(pointsSet,sl);
  theUpdator->fit(seg);

  if (seg) {
    for (vector<AssPoint>::const_iterator hiti = assHits.begin()+1; hiti != assHits.end()-1; hiti++)
      usedHits.push_back(*hiti);

    if (assHits.size()>maxfound) maxfound = assHits.size();
    seg->setChi2(chi2l); // we need to set the chi^2 so that the cleaner can pick the best segments
    if (debug) cout << "Segment built: " << *seg<< endl;
    if (checkDoubleCandidates(result,seg)) {
      result.push_back(seg);
      if (debug) cout << "   Result is now " << result.size() << endl;
    } else {
      if (debug) cout << "   Exists - skipping" << endl;
      delete seg;
    }
  }
}
int CSCNeutronReader::chamberId ( int  globalDetId) const

Definition at line 57 of file CSCNeutronReader.cc.

References CSCDetId.

{
  return CSCDetId(globalDetId).chamberId().rawId();
}
int CSCNeutronReader::chamberType ( int  globalDetId) const
int CSCNeutronReader::detId ( int  chamberIndex,
int  localDetId 
) [virtual]

detector-specific way to get the global detector ID, given the local one.

Implements SubsystemNeutronReader.

Definition at line 37 of file CSCNeutronReader.cc.

References localDetId().

{
  // add the layer bits
  return chamberIndex + localDetId;
}
int CSCNeutronReader::localDetId ( int  globalDetId) const

Definition at line 44 of file CSCNeutronReader.cc.

References CSCDetId.

Referenced by detId().

{
  return CSCDetId(globalDetId).layer();
}