CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalTBH4Trigger Class Reference

#include <SimG4Core/HelpfulWatchers/interface/EcalTBH4Trigger.h>

Inheritance diagram for EcalTBH4Trigger:
SimWatcher

List of all members.

Public Member Functions

 EcalTBH4Trigger (const edm::ParameterSet &pSet)
void update (const EndOfEvent *anEvent)
void update (const G4Step *iStep)
void update (const BeginOfEvent *anEvent)

Private Attributes

bool m_passedTrg1
bool m_passedTrg3
bool m_passedTrg4
bool m_passedTrg5
bool m_passedTrg6
bool m_verbose
int nTriggeredEvents_
int trigEvents_

Detailed Description

Description: Simulates ECALTBH4 trigger an throw exception in case of non triggering event

Usage: <usage>

Definition at line 46 of file EcalTBH4Trigger.h.


Constructor & Destructor Documentation

EcalTBH4Trigger::EcalTBH4Trigger ( const edm::ParameterSet pSet) [inline]

Definition at line 60 of file EcalTBH4Trigger.h.

                                               : 
    m_verbose(pSet.getUntrackedParameter<bool>("verbose",false)), nTriggeredEvents_(0), trigEvents_(pSet.getUntrackedParameter<int>("trigEvents",-1)) {
  }

Member Function Documentation

void EcalTBH4Trigger::update ( const BeginOfEvent anEvent) [inline]

Definition at line 74 of file EcalTBH4Trigger.h.

References m_passedTrg1, m_passedTrg3, m_passedTrg4, m_passedTrg5, and m_passedTrg6.

    {
      //      std::cout <<"++ signal BeginOfEvent " ;
      //      m_enteringTBH4BeamLine=false;
      //      m_exitingTBH4BeamLine=false;
      //      m_passedTrigger=false;
      m_passedTrg1=false;
      m_passedTrg3=false;
      m_passedTrg4=false;
      m_passedTrg5=false;
      m_passedTrg6=false;
    } 
void EcalTBH4Trigger::update ( const EndOfEvent anEvent) [inline]

Definition at line 150 of file EcalTBH4Trigger.h.

References nTriggeredEvents_.

    {
      //      std::cout <<"++ signal BeginOfEvent " ;
      //      m_enteringTBH4BeamLine=false;
      //      m_exitingTBH4BeamLine=false;
      //      m_passedTrigger=false;
      nTriggeredEvents_++;
    } 
void EcalTBH4Trigger::update ( const G4Step *  iStep) [inline]

Definition at line 88 of file EcalTBH4Trigger.h.

References gather_cfg::cout, cuy::ii, m_passedTrg1, m_passedTrg3, m_passedTrg4, m_passedTrg5, m_passedTrg6, m_verbose, nTriggeredEvents_, pos, and trigEvents_.

    { 
      if (trigEvents_ >= 0 && nTriggeredEvents_ >= trigEvents_)
        throw SimG4Exception("Number of needed trigger events reached in ECALTBH4");

      const G4StepPoint* pre = iStep->GetPreStepPoint(); 
      const G4StepPoint* post = iStep->GetPostStepPoint(); 
      if(m_verbose) {
        std::cout <<"++ signal G4Step" ;
        const G4VTouchable* touch = iStep->GetPreStepPoint()->GetTouchable();
        //Get name and copy numbers
        if (touch->GetHistoryDepth() > 0) {
          for (int ii = 0; ii <= touch->GetHistoryDepth() ; ii++) {
            std::cout << "EcalTBH4::Level " << ii
                      << ": " << touch->GetVolume(ii)->GetName() << "["
                      << touch->GetReplicaNumber(ii) << "]";
          }
        }
        std::cout <<std::endl; 
        const G4Track* theTrack = iStep->GetTrack();
        const G4ThreeVector pos = post->GetPosition();
        std::cout << "( "<<pos.x()<<","<<pos.y()<<","<<pos.z()<<") ";
        std::cout << " released energy (MeV) " <<  iStep->GetTotalEnergyDeposit()/MeV  ;
        if (theTrack)
          {
            const G4ThreeVector mom = theTrack->GetMomentum();
            std::cout << " track length (cm) " << theTrack->GetTrackLength()/cm
                      << " particle type " << theTrack->GetDefinition()->GetParticleName()
                      << " momentum " << "( "<<mom.x()<<","<<mom.y()<<","<<mom.z()<<") ";
            if (theTrack->GetCreatorProcess())
              std::cout << " created by " << theTrack->GetCreatorProcess()->GetProcessName();
          }
        if(post->GetPhysicalVolume()) {
          std::cout << " " << pre->GetPhysicalVolume()->GetName() << "->" << post->GetPhysicalVolume()->GetName();
        }
        std::cout <<std::endl; 
      }
      
      if (post && post->GetPhysicalVolume())
        {
          
          if (!m_passedTrg1 && post->GetPhysicalVolume()->GetName() == "TRG1")
            m_passedTrg1 = true;
          if (!m_passedTrg3 && post->GetPhysicalVolume()->GetName() == "TRG3")
            m_passedTrg3 = true;
          if (!m_passedTrg4 && post->GetPhysicalVolume()->GetName() == "TRG4")
            m_passedTrg4 = true;
          if (!m_passedTrg5 && post->GetPhysicalVolume()->GetName() == "TRG5")
            m_passedTrg5 = true;
          if (!m_passedTrg6 && post->GetPhysicalVolume()->GetName() == "TRG6")
            m_passedTrg6 = true;
          if (post->GetPhysicalVolume()->GetName() == "CMSSE") //Exiting TBH4BeamLine
            if (! (m_passedTrg1 && m_passedTrg6) ) // Trigger defined as Trg4 && Trg6
              throw SimG4Exception("Event is not triggered by ECALTBH4");
      }
    
/*     if (!m_enteringTBH4BeamLine && ( post->GetPhysicalVolume()->GetName() ==  */

}

Member Data Documentation

Definition at line 169 of file EcalTBH4Trigger.h.

Referenced by update().

Definition at line 170 of file EcalTBH4Trigger.h.

Referenced by update().

Definition at line 171 of file EcalTBH4Trigger.h.

Referenced by update().

Definition at line 172 of file EcalTBH4Trigger.h.

Referenced by update().

Definition at line 173 of file EcalTBH4Trigger.h.

Referenced by update().

Definition at line 166 of file EcalTBH4Trigger.h.

Referenced by update().

Definition at line 174 of file EcalTBH4Trigger.h.

Referenced by update().

Definition at line 175 of file EcalTBH4Trigger.h.

Referenced by update().