CMS 3D CMS Logo

TotemSD Class Reference

Description: Stores hits of Totem in appropriate container. More...

#include <SimG4CMS/Forward/interface/TotemSD.h>

Inheritance diagram for TotemSD:

SensitiveTkDetector Observer< const BeginOfEvent * > Observer< const EndOfEvent * > SensitiveDetector

List of all members.

Public Member Functions

virtual void clear ()
virtual void DrawAll ()
virtual void EndOfEvent (G4HCofThisEvent *eventHC)
void fillHits (edm::PSimHitContainer &, std::string use)
virtual void Initialize (G4HCofThisEvent *HCE)
virtual void PrintAll ()
virtual bool ProcessHits (G4Step *, G4TouchableHistory *)
virtual uint32_t setDetUnitId (G4Step *)
 TotemSD (std::string, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
virtual ~TotemSD ()

Private Member Functions

virtual void clearHits ()
void CreateNewHit ()
void CreateNewHitEvo ()
void GetStepInfo (G4Step *aStep)
bool HitExists ()
G4ThreeVector PosizioEvo (G4ThreeVector, double, double, double, double, int &)
void ResetForNewPrimary ()
G4ThreeVector SetToLocal (G4ThreeVector globalPoint)
void StoreHit (TotemG4Hit *)
void Summarize ()
void update (const ::EndOfEvent *)
void update (const BeginOfEvent *)
 This routine will be called when the appropriate signal arrives.
void UpdateHit ()

Private Attributes

TotemG4HitcurrentHit
G4VPhysicalVolume * currentPV
float edeposit
float Eloss
G4ThreeVector entrancePoint
int eventno
G4int hcID
G4ThreeVector hitPoint
float incidentEnergy
std::string name
TotemVDetectorOrganizationnumberingScheme
float Pabs
int ParentId
short ParticleType
float PhiAtEntry
G4ThreeVector Posizio
G4StepPoint * postStepPoint
G4StepPoint * preStepPoint
uint32_t previousUnitID
int primaryID
G4int primID
TrackingSlaveSDslave
TotemG4HitCollectiontheHC
const SimTrackManagertheManager
float ThetaAtEntry
G4Track * theTrack
float Tof
int tsID
double tSlice
int tSliceID
uint32_t unitID
float Vx
float Vy
float Vz


Detailed Description

Description: Stores hits of Totem in appropriate container.

Usage: Used in sensitive detector builder

Definition at line 43 of file TotemSD.h.


Constructor & Destructor Documentation

TotemSD::TotemSD ( std::string  name,
const DDCompactView cpv,
SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 45 of file TotemSD.cc.

References SensitiveDetector::AssignSD(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), it, LogDebug, SensitiveDetectorCatalog::logicalNames(), numberingScheme, SensitiveDetector::Register(), and slave.

00047                                                                             :
00048   SensitiveTkDetector(name, cpv, clg, p), numberingScheme(0), name(name),
00049   hcID(-1), theHC(0), theManager(manager), currentHit(0), theTrack(0), 
00050   currentPV(0), unitID(0),  previousUnitID(0), preStepPoint(0), 
00051   postStepPoint(0), eventno(0){
00052 
00053   //Add Totem Sentitive Detector Names
00054   collectionName.insert(name);
00055 
00056   //Parameters
00057   edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("TotemSD");
00058   int verbn = m_p.getUntrackedParameter<int>("Verbosity");
00059  
00060   SetVerboseLevel(verbn);
00061   LogDebug("ForwardSim") 
00062     << "*******************************************************\n"
00063     << "*                                                     *\n"
00064     << "* Constructing a TotemSD  with name " << name << "\n"
00065     << "*                                                     *\n"
00066     << "*******************************************************";
00067 
00068   slave  = new TrackingSlaveSD(name);
00069 
00070   //
00071   // Now attach the right detectors (LogicalVolumes) to me
00072   //
00073   std::vector<std::string> lvNames = clg.logicalNames(name);
00074   this->Register();
00075   for (std::vector<std::string>::iterator it=lvNames.begin();  
00076        it !=lvNames.end(); it++) {
00077     this->AssignSD(*it);
00078     edm::LogInfo("ForwardSim") << "TotemSD : Assigns SD to LV " << (*it);
00079   }
00080 
00081   if      (name == "TotemHitsT1") {
00082     numberingScheme = dynamic_cast<TotemVDetectorOrganization*>(new TotemT1NumberingScheme(1));
00083   } else if (name == "TotemHitsT2Si") {
00084     numberingScheme = dynamic_cast<TotemVDetectorOrganization*>(new TotemT2NumberingSchemeGem(3));
00085   } else if (name == "TotemHitsT2Gem") {
00086     numberingScheme = dynamic_cast<TotemVDetectorOrganization*>(new TotemT2NumberingSchemeGem(4));
00087   } else if (name == "TotemHitsRP") {
00088     numberingScheme = dynamic_cast<TotemVDetectorOrganization*>(new TotemRPNumberingScheme(3));
00089   } else {
00090     edm::LogWarning("ForwardSim") << "TotemSD: ReadoutName not supported\n";
00091   }
00092   
00093   edm::LogInfo("ForwardSim") << "TotemSD: Instantiation completed";
00094 } 

TotemSD::~TotemSD (  )  [virtual]

Definition at line 96 of file TotemSD.cc.

References numberingScheme, and slave.

00096                   { 
00097   if (slave)           delete slave; 
00098   if (numberingScheme) delete numberingScheme;
00099 }


Member Function Documentation

void TotemSD::clear ( void   )  [virtual]

Definition at line 165 of file TotemSD.cc.

00165                     {
00166 } 

void TotemSD::clearHits (  )  [private, virtual]

Implements SensitiveDetector.

Definition at line 190 of file TotemSD.cc.

References TrackingSlaveSD::Initialize(), and slave.

Referenced by update().

00190                        {
00191   slave->Initialize();
00192 }

void TotemSD::CreateNewHit (  )  [private]

Definition at line 285 of file TotemSD.cc.

References GenMuonPlsPt100GeV_cfg::cout, currentHit, currentPV, Eloss, incidentEnergy, LogDebug, NULL, Pabs, ParentId, PhiAtEntry, Posizio, primaryID, TotemG4Hit::setEnergyLoss(), TotemG4Hit::setEntry(), TotemG4Hit::setIncidentEnergy(), TotemG4Hit::setPabs(), TotemG4Hit::setParentId(), TotemG4Hit::setParticleType(), TotemG4Hit::setPhiAtEntry(), TotemG4Hit::setThetaAtEntry(), TotemG4Hit::setTimeSlice(), TotemG4Hit::setTof(), TotemG4Hit::setTrackID(), TotemG4Hit::setUnitID(), TotemG4Hit::setVx(), TotemG4Hit::setVy(), TotemG4Hit::setVz(), StoreHit(), ThetaAtEntry, theTrack, Tof, tSlice, tSliceID, unitID, UpdateHit(), Vx, Vy, and Vz.

Referenced by ProcessHits().

00285                            {
00286 
00287 #ifdef debug
00288   LogDebug("ForwardSim") << "TotemSD CreateNewHit for"
00289                          << " PV "     << currentPV->GetName()
00290                          << " PVid = " << currentPV->GetCopyNo()
00291                          << " MVid = " << currentPV->GetMother()->GetCopyNo()
00292                          << " Unit "   << unitID << "\n"
00293                          << " primary "    << primaryID
00294                          << " time slice " << tSliceID 
00295                          << " For Track  " << theTrack->GetTrackID()
00296                          << " which is a " 
00297                          << theTrack->GetDefinition()->GetParticleName();
00298            
00299   if (theTrack->GetTrackID()==1) {
00300     LogDebug("ForwardSim") << " of energy "     << theTrack->GetTotalEnergy();
00301   } else {
00302     LogDebug("ForwardSim") << " daughter of part. " << theTrack->GetParentID();
00303   }
00304 
00305   cout  << " and created by " ;
00306   if (theTrack->GetCreatorProcess()!=NULL)
00307     LogDebug("ForwardSim") << theTrack->GetCreatorProcess()->GetProcessName() ;
00308   else 
00309     LogDebug("ForwardSim") << "NO process";
00310 #endif          
00311     
00312 
00313   currentHit = new TotemG4Hit;
00314   currentHit->setTrackID(primaryID);
00315   currentHit->setTimeSlice(tSlice);
00316   currentHit->setUnitID(unitID);
00317   currentHit->setIncidentEnergy(incidentEnergy);
00318 
00319   currentHit->setPabs(Pabs);
00320   currentHit->setTof(Tof);
00321   currentHit->setEnergyLoss(Eloss);
00322   currentHit->setParticleType(ParticleType);
00323   currentHit->setThetaAtEntry(ThetaAtEntry);
00324   currentHit->setPhiAtEntry(PhiAtEntry);
00325 
00326   currentHit->setEntry(Posizio.x(),Posizio.y(),Posizio.z());
00327 
00328   currentHit->setParentId(ParentId);
00329   currentHit->setVx(Vx);
00330   currentHit->setVy(Vy);
00331   currentHit->setVz(Vz);
00332 
00333   UpdateHit();
00334   
00335   StoreHit(currentHit);
00336 }        

void TotemSD::CreateNewHitEvo (  )  [private]

Definition at line 338 of file TotemSD.cc.

References currentHit, Eloss, incidentEnergy, Pabs, ParentId, PhiAtEntry, Posizio, PosizioEvo(), primaryID, TotemG4Hit::setEnergyLoss(), TotemG4Hit::setEntry(), TotemG4Hit::setIncidentEnergy(), TotemG4Hit::setPabs(), TotemG4Hit::setParentId(), TotemG4Hit::setParticleType(), TotemG4Hit::setPhiAtEntry(), TotemG4Hit::setThetaAtEntry(), TotemG4Hit::setTimeSlice(), TotemG4Hit::setTof(), TotemG4Hit::setTrackID(), TotemG4Hit::setUnitID(), TotemG4Hit::setVx(), TotemG4Hit::setVy(), TotemG4Hit::setVz(), StoreHit(), ThetaAtEntry, Tof, tSlice, unitID, UpdateHit(), Vx, Vy, and Vz.

Referenced by ProcessHits().

00338                               {
00339 
00340 // LogDebug("ForwardSim") << "INSIDE CREATE NEW HIT EVO ";
00341 
00342   currentHit = new TotemG4Hit;
00343   currentHit->setTrackID(primaryID);
00344   currentHit->setTimeSlice(tSlice);
00345   currentHit->setUnitID(unitID);
00346   currentHit->setIncidentEnergy(incidentEnergy);
00347 
00348   currentHit->setPabs(Pabs);
00349   currentHit->setTof(Tof);
00350   currentHit->setEnergyLoss(Eloss);
00351   currentHit->setParticleType(ParticleType);
00352   currentHit->setThetaAtEntry(ThetaAtEntry);
00353   currentHit->setPhiAtEntry(PhiAtEntry);
00354 
00355   //  LogDebug("ForwardSim") << Posizio.x() << " " << Posizio.y() << " " << Posizio.z();
00356 
00357   currentHit->setParentId(ParentId);
00358   currentHit->setVx(Vx);
00359   currentHit->setVy(Vy);
00360   currentHit->setVz(Vz);
00361 
00362   G4ThreeVector _PosizioEvo;
00363   int flagAcc=0;
00364   _PosizioEvo=PosizioEvo(Posizio,Vx,Vy,Vz,Pabs,flagAcc);
00365 
00366   if(flagAcc==1){
00367     currentHit->setEntry(_PosizioEvo.x(),_PosizioEvo.y(),_PosizioEvo.z());
00368 
00369     // if(flagAcc==1)
00370     UpdateHit();
00371   
00372     StoreHit(currentHit);
00373   }
00374   // LogDebug("ForwardSim") << "STORED HIT IN: " << unitID;
00375 }        

void TotemSD::DrawAll (  )  [virtual]

Definition at line 168 of file TotemSD.cc.

00168                       {
00169 } 

void TotemSD::EndOfEvent ( G4HCofThisEvent *  eventHC  )  [virtual]

Reimplemented from SensitiveDetector.

Definition at line 138 of file TotemSD.cc.

References TotemG4Hit::getEnergyLoss(), TotemG4Hit::getEntry(), TotemG4Hit::getPabs(), TotemG4Hit::getParticleType(), TotemG4Hit::getPhiAtEntry(), TotemG4Hit::getThetaAtEntry(), TotemG4Hit::getTof(), TotemG4Hit::getTrackID(), TotemG4Hit::getUnitID(), j, LogDebug, TrackingSlaveSD::processHits(), slave, Summarize(), and theHC.

00138                                           {
00139 
00140   // here we loop over transient hits and make them persistent
00141   for (int j=0; j<theHC->entries() && j<15000; j++) {
00142     TotemG4Hit* aHit = (*theHC)[j];
00143 #ifdef ddebug
00144     LogDebug("ForwardSim") << "HIT NUMERO " << j << "unit ID = "
00145                            << aHit->getUnitID() << "\n"
00146                            << "               " << "enrty z " 
00147                            << aHit->getEntry().z() << "\n"
00148                            << "               " << "theta   " 
00149                            << aHit->getThetaAtEntry() << "\n";
00150 #endif
00151     Local3DPoint theExitPoint(0,0,0);
00152     Local3DPoint Entrata(aHit->getEntry().x(),
00153                          aHit->getEntry().y(),
00154                          aHit->getEntry().z());
00155     slave->processHits(PSimHit(Entrata,theExitPoint,
00156                                aHit->getPabs(), aHit->getTof(),
00157                                aHit->getEnergyLoss(), aHit->getParticleType(),
00158                                aHit->getUnitID(), aHit->getTrackID(),
00159                                aHit->getThetaAtEntry(),aHit->getPhiAtEntry()));
00160 
00161   }
00162   Summarize();
00163 }

void TotemSD::fillHits ( edm::PSimHitContainer c,
std::string  use 
) [virtual]

Implements SensitiveTkDetector.

Definition at line 176 of file TotemSD.cc.

References TrackingSlaveSD::hits(), TrackingSlaveSD::name(), and slave.

00176                                                           {
00177   if (slave->name() == n) c=slave->hits();
00178 }

void TotemSD::GetStepInfo ( G4Step *  aStep  )  [private]

Definition at line 202 of file TotemSD.cc.

References currentPV, edeposit, Eloss, hitPoint, int, LogDebug, name, Pabs, ParentId, PhiAtEntry, Posizio, postStepPoint, preStepPoint, primaryID, setDetUnitId(), ThetaAtEntry, theTrack, Tof, tSlice, tSliceID, unitID, Vx, Vy, and Vz.

Referenced by ProcessHits().

00202                                        {
00203   
00204   preStepPoint = aStep->GetPreStepPoint(); 
00205   postStepPoint= aStep->GetPostStepPoint(); 
00206   theTrack     = aStep->GetTrack();   
00207   //Local3DPoint theEntryPoint = SensitiveDetector::InitialStepPosition(aStep,LocalCoordinates);  
00208   //Local3DPoint theExitPoint  = SensitiveDetector::FinalStepPosition(aStep,LocalCoordinates);
00209   hitPoint     = preStepPoint->GetPosition();   
00210   currentPV    = preStepPoint->GetPhysicalVolume();
00211 
00212   // double weight = 1; 
00213   G4String name = currentPV->GetName();
00214   name.assign(name,0,4);
00215   G4String particleType = theTrack->GetDefinition()->GetParticleName();
00216   edeposit = aStep->GetTotalEnergyDeposit();
00217   
00218   tSlice    = (postStepPoint->GetGlobalTime() )/nanosecond;
00219   tSliceID  = (int) tSlice;
00220   unitID    = setDetUnitId(aStep);
00221 #ifdef debug
00222   LogDebug("ForwardSim") << "UNITa " << unitID;
00223 #endif
00224   primaryID = theTrack->GetTrackID();
00225 
00226 
00227   Posizio = hitPoint;
00228   Pabs    = aStep->GetPreStepPoint()->GetMomentum().mag()/GeV;
00229   Tof     = aStep->GetPostStepPoint()->GetGlobalTime()/nanosecond;
00230    
00231   Eloss   = aStep->GetTotalEnergyDeposit()/GeV;
00232   ParticleType = theTrack->GetDefinition()->GetPDGEncoding();      
00233 
00234   ThetaAtEntry = aStep->GetPreStepPoint()->GetPosition().theta()/deg;
00235   PhiAtEntry   = aStep->GetPreStepPoint()->GetPosition().phi()/deg;
00236 
00237   ParentId = theTrack->GetParentID();
00238   Vx = theTrack->GetVertexPosition().x();
00239   Vy = theTrack->GetVertexPosition().y();
00240   Vz = theTrack->GetVertexPosition().z();
00241 }

bool TotemSD::HitExists (  )  [private]

Definition at line 243 of file TotemSD.cc.

References currentHit, TotemG4Hit::getTimeSliceID(), TotemG4Hit::getTrackID(), TotemG4Hit::getUnitID(), j, previousUnitID, primaryID, primID, ResetForNewPrimary(), theHC, tsID, tSliceID, unitID, and UpdateHit().

Referenced by ProcessHits().

00243                         {
00244    
00245   if (primaryID<1) {
00246     edm::LogWarning("ForwardSim") << "***** TotemSD error: primaryID = " 
00247                                   << primaryID
00248                                   << " maybe detector name changed";
00249   }
00250    
00251   // Update if in the same detector, time-slice and for same track   
00252   //  if (primaryID == primID && tSliceID == tsID && unitID==previousUnitID) {
00253   if (tSliceID == tsID && unitID==previousUnitID) {
00254     UpdateHit();
00255     return true;
00256   }
00257    
00258   // Reset entry point for new primary
00259   if (primaryID != primID)
00260     ResetForNewPrimary();
00261    
00262   //look in the HitContainer whether a hit with the same primID, unitID,
00263   //tSliceID already exists:
00264    
00265   bool found = false;
00266 
00267   for (int j=0; j<theHC->entries()&&!found; j++) {
00268     TotemG4Hit* aPreviousHit = (*theHC)[j];
00269     if (aPreviousHit->getTrackID()     == primaryID &&
00270         aPreviousHit->getTimeSliceID() == tSliceID  &&
00271         aPreviousHit->getUnitID()      == unitID       ) {
00272       currentHit = aPreviousHit;
00273       found      = true;
00274     }
00275   }          
00276 
00277   if (found) {
00278     UpdateHit();
00279     return true;
00280   } else {
00281     return false;
00282   }    
00283 }

void TotemSD::Initialize ( G4HCofThisEvent *  HCE  )  [virtual]

Reimplemented from SensitiveDetector.

Definition at line 125 of file TotemSD.cc.

References hcID, LogDebug, name, primID, theHC, and tsID.

00125                                               { 
00126 
00127   LogDebug("ForwardSim") << "TotemSD : Initialize called for " << name;
00128 
00129   theHC = new TotemG4HitCollection(name, collectionName[0]);
00130   if (hcID<0) 
00131     hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
00132   HCE->AddHitsCollection(hcID, theHC);
00133 
00134   tsID   = -2;
00135   primID = -2;
00136 }

G4ThreeVector TotemSD::PosizioEvo ( G4ThreeVector  Pos,
double  vx,
double  vy,
double  vz,
double  pabs,
int accettanza 
) [private]

Definition at line 377 of file TotemSD.cc.

References j, and funct::sqrt().

Referenced by CreateNewHitEvo().

00378                                                                            {
00379   accettanza=0;
00380   //Pos.xyz() in mm
00381   G4ThreeVector PosEvo; 
00382   double ThetaX=atan((Pos.x()-vx)/(Pos.z()-vz));                 
00383   double ThetaY=atan((Pos.y()-vy)/(Pos.z()-vz));                
00384   double X_at_0 =(vx-((Pos.x()-vx)/(Pos.z()-vz))*vz)/1000.;   
00385   double Y_at_0 =(vy-((Pos.y()-vy)/(Pos.z()-vz))*vz)/1000.;  
00386   
00387   //  double temp_evo_X;
00388   //  double temp_evo_Y;
00389   //  double temp_evo_Z;
00390   //  temp_evo_Z = fabs(Pos.z())/Pos.z()*220000.; 
00391  
00392   //csi=-dp/d
00393   double csi = fabs((7000.-pabs)/7000.);
00394 
00395   // all in m 
00396   const int no_rp=4;
00397   double x_par[no_rp+1];
00398   double y_par[no_rp+1];
00399   //rp z position
00400   double rp[no_rp]={141.,149.,198.,220.};
00401   //{lx0,mlx} for each rp; Lx=lx0+mlx*csi
00402   double leffx[][2]={{122.5429,-46.9312},{125.4194,-49.1849},{152.6,-81.157},{98.8914,-131.8390}};
00403   //{ly0,mly} for each rp; Ly=ly0+mly*csi
00404   double leffy[][2]={{124.2314,-55.4852},{127.7825,-57.4503},{179.455,-76.274},{273.0931,-40.4626}};
00405   //{vx0,mvx0} for each rp; vx=vx0+mvx*csi
00406   double avx[][2]={{0.515483,-1.0123},{0.494122,-1.0534},{0.2217,-1.483},{0.004633,-1.0719}};
00407   //{vy0,mvy0} for each rp; vy=vy0+mvy*csi
00408   double avy[][2]={{0.371418,-1.6327},{0.349035,-1.6955},{0.0815,-2.59},{0.007592,-4.0841}};                
00409   //{D0,md,a,b} for each rp; D=D0+(md+a*thetax)*csi+b*thetax
00410   double ddx[][4]= {{-0.082336,-0.092513,112.3436,-82.5029},{-0.086927,-0.097670,114.9513,-82.9835},
00411                     {-0.092117,-0.0915,180.6236,-82.443},{-0.050470,0.058837,208.1106,20.8198}};
00412   // {10sigma_x+0.5mm,10sigma_y+0.5mm}
00413   double detlim[][2]={{0,0},{0.0028,0.0021},{0,0},{0.0008,0.0013}};   
00414   //{rmax,dmax}
00415   double pipelim[][2]={{0.026,0.026},{0.04,0.04},{0.0226,0.0177},{0.04,0.04}};
00416   
00417   
00418   for(int j=0; j<no_rp ; j++)  { 
00419     //y=Ly*thetay+vy*y0
00420     //x=Lx*thetax+vx*x0-csi*D   
00421     y_par[j]=ThetaY*(leffy[j][0]+leffy[j][1]*csi)+(avy[j][0]+avy[j][1]*csi)*Y_at_0;
00422     x_par[j]=ThetaX*(leffx[j][0]+leffx[j][1]*csi)+(avx[j][0]+avx[j][1]*csi)*X_at_0-
00423       csi*(ddx[j][0]+(ddx[j][1]+ddx[j][2]*ThetaX)*csi+ddx[j][3]*ThetaX);
00424   }
00425    
00426    
00427   //pass TAN@141
00428   if (fabs(y_par[0])<pipelim[0][1] && sqrt((y_par[0]*y_par[0])+(x_par[0]*x_par[0]))<pipelim[0][0])  {
00429     //pass 149
00430     if ((sqrt((y_par[1]*y_par[1])+(x_par[1]*x_par[1]))<pipelim[1][0]) &&
00431         (fabs(y_par[1])>detlim[1][1] || x_par[1]>detlim[1][0]))  {
00432       accettanza = 1;
00433     }
00434   }
00435 
00436       
00437   //pass TAN@141
00438   if (fabs(y_par[0])<pipelim[0][1] && sqrt((y_par[0])*(y_par[0])+(x_par[0])*(x_par[0]))<pipelim[0][0]) {
00439     //pass Q5@198
00440     if (fabs(y_par[2])<pipelim[2][1] && sqrt((y_par[2]*y_par[2])+(x_par[2]*x_par[2]))<pipelim[2][0]) {
00441       //pass 220
00442       if ((sqrt((y_par[3]*y_par[3])+(x_par[3]*x_par[3]))<pipelim[3][0]) &&
00443           (fabs(y_par[3])>detlim[3][1] || x_par[3]>detlim[3][0])) {
00444         accettanza = 1;
00445         
00446         PosEvo.setX(1000*x_par[3]);
00447         PosEvo.setY(1000*y_par[3]);
00448         PosEvo.setZ(1000*rp[3]);          
00449         if(Pos.z()<vz)PosEvo.setZ(-1000*rp[3]);
00450       }
00451     }
00452     
00453   }
00454 /*
00455   LogDebug("ForwardSim") << "\n"
00456                          << "ACCETTANZA: "<<accettanza << "\n" 
00457                          << "CSI: "<< csi << "\n"
00458                          << "Theta_X: " << ThetaX << "\n"
00459                          << "Theta_Y: " << ThetaY << "\n"
00460                          << "X_at_0: "<< X_at_0 << "\n"
00461                          << "Y_at_0: "<< Y_at_0 << "\n" 
00462                          << "x_par[3]: "<< x_par[3] << "\n"
00463                          << "y_par[3]: "<< y_par[3] << "\n"
00464                          << "pos " << Pos.x() << " " << Pos.y() << " " 
00465                          << Pos.z() << "\n" << "V "<< vx << " " << vy << " "
00466                          << vz << "\n"
00467 */
00468 // --------------
00469   return PosEvo;
00470 }

void TotemSD::PrintAll (  )  [virtual]

Definition at line 171 of file TotemSD.cc.

References LogDebug, and theHC.

00171                        {
00172   LogDebug("ForwardSim") << "TotemSD: Collection " << theHC->GetName();
00173   theHC->PrintAllHits();
00174 } 

bool TotemSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
) [virtual]

Implements SensitiveDetector.

Definition at line 101 of file TotemSD.cc.

References CreateNewHit(), CreateNewHitEvo(), edeposit, GetStepInfo(), HitExists(), NULL, ParentId, and unitID.

00101                                                                {
00102 
00103   if (aStep == NULL) {
00104     return true;
00105   } else {
00106     GetStepInfo(aStep);
00107     if (HitExists() == false && edeposit>0.) { 
00108       CreateNewHit();
00109       return true;
00110     }
00111     if (HitExists() == false && (((unitID==1111 || unitID==2222) && 
00112                                   ParentId==0 && ParticleType==2212))) { 
00113       CreateNewHitEvo();
00114       return true;
00115     }
00116   }
00117   return true;
00118 }

void TotemSD::ResetForNewPrimary (  )  [private]

Definition at line 516 of file TotemSD.cc.

References entrancePoint, hitPoint, incidentEnergy, preStepPoint, and SetToLocal().

Referenced by HitExists().

00516                                  {
00517   
00518   entrancePoint  = SetToLocal(hitPoint);
00519   incidentEnergy = preStepPoint->GetKineticEnergy();
00520 }

uint32_t TotemSD::setDetUnitId ( G4Step *  aStep  )  [virtual]

Implements SensitiveDetector.

Definition at line 120 of file TotemSD.cc.

References TotemVDetectorOrganization::GetUnitID(), and numberingScheme.

Referenced by GetStepInfo().

00120                                              { 
00121 
00122   return (numberingScheme == 0 ? 0 : numberingScheme->GetUnitID(aStep));
00123 }

G4ThreeVector TotemSD::SetToLocal ( G4ThreeVector  globalPoint  )  [private]

Definition at line 194 of file TotemSD.cc.

References preStepPoint.

Referenced by ResetForNewPrimary().

00194                                                       {
00195 
00196   G4ThreeVector       localPoint;
00197   const G4VTouchable* touch= preStepPoint->GetTouchable();
00198   localPoint = touch->GetHistory()->GetTopTransform().TransformPoint(global);
00199   return localPoint;  
00200 }

void TotemSD::StoreHit ( TotemG4Hit hit  )  [private]

Definition at line 505 of file TotemSD.cc.

References primID, and theHC.

Referenced by CreateNewHit(), and CreateNewHitEvo().

00505                                       {
00506 
00507   if (primID<0) return;
00508   if (hit == 0 ) {
00509     edm::LogWarning("ForwardSim") << "TotemSD: hit to be stored is NULL !!";
00510     return;
00511   }
00512 
00513   theHC->insert( hit );
00514 }

void TotemSD::Summarize (  )  [private]

Definition at line 522 of file TotemSD.cc.

Referenced by EndOfEvent().

00522                         {
00523 }

void TotemSD::update ( const ::EndOfEvent  )  [private]

Definition at line 187 of file TotemSD.cc.

00187                                        {
00188 }

void TotemSD::update ( const BeginOfEvent  )  [private, virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 180 of file TotemSD.cc.

References clearHits(), eventno, and LogDebug.

00180                                             {
00181   LogDebug("ForwardSim") << " Dispatched BeginOfEvent for " << GetName()
00182                        << " !" ;
00183    clearHits();
00184    eventno = (*i)()->GetEventID();
00185 }

void TotemSD::UpdateHit (  )  [private]

Definition at line 473 of file TotemSD.cc.

References currentHit, Eloss, LogDebug, postStepPoint, previousUnitID, primaryID, primID, TotemG4Hit::setEnergyLoss(), tsID, tSliceID, and unitID.

Referenced by CreateNewHit(), CreateNewHitEvo(), and HitExists().

00473                         {
00474   //
00475   if (Eloss > 0.) {
00476     //  currentHit->addEnergyDeposit(edepositEM,edepositHAD);
00477 
00478 #ifdef debug
00479     LogDebug("ForwardSim") << "G4TotemT1SD updateHit: add eloss " << Eloss 
00480                            << "\nCurrentHit=" << currentHit
00481                            << ", PostStepPoint=" 
00482                            << postStepPoint->GetPosition();
00483 #endif
00484 
00485     currentHit->setEnergyLoss(Eloss);
00486   }  
00487   //  if(PostStepPoint->GetPhysicalVolume() != CurrentPV){
00488   //  currentHit->setExitPoint(SetToLocal(postStepPoint->GetPosition()));
00489   // Local3DPoint exit=currentHit->exitPoint();
00490 /*
00491 #ifdef debug
00492   LogDebug("ForwardSim") << "G4TotemT1SD updateHit: exit point " 
00493                          << exit.x() << " " << exit.y() << " " << exit.z();
00494 //  LogDebug("ForwardSim") << "Energy deposit in Unit " << unitID << " em " << edepositEM/MeV
00495 // << " hadronic " << edepositHAD/MeV << " MeV";
00496 #endif
00497 */
00498 
00499   // buffer for next steps:
00500   tsID           = tSliceID;
00501   primID         = primaryID;
00502   previousUnitID = unitID;
00503 }


Member Data Documentation

TotemG4Hit* TotemSD::currentHit [private]

Definition at line 103 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), HitExists(), and UpdateHit().

G4VPhysicalVolume* TotemSD::currentPV [private]

Definition at line 105 of file TotemSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float TotemSD::edeposit [private]

Definition at line 112 of file TotemSD.h.

Referenced by GetStepInfo(), and ProcessHits().

float TotemSD::Eloss [private]

Definition at line 118 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), GetStepInfo(), and UpdateHit().

G4ThreeVector TotemSD::entrancePoint [private]

Definition at line 93 of file TotemSD.h.

Referenced by ResetForNewPrimary().

int TotemSD::eventno [private]

Definition at line 127 of file TotemSD.h.

Referenced by update().

G4int TotemSD::hcID [private]

Definition at line 98 of file TotemSD.h.

Referenced by Initialize().

G4ThreeVector TotemSD::hitPoint [private]

Definition at line 113 of file TotemSD.h.

Referenced by GetStepInfo(), and ResetForNewPrimary().

float TotemSD::incidentEnergy [private]

Definition at line 94 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), and ResetForNewPrimary().

std::string TotemSD::name [private]

Reimplemented from SensitiveDetector.

Definition at line 97 of file TotemSD.h.

Referenced by GetStepInfo(), and Initialize().

TotemVDetectorOrganization* TotemSD::numberingScheme [private]

Definition at line 86 of file TotemSD.h.

Referenced by setDetUnitId(), TotemSD(), and ~TotemSD().

float TotemSD::Pabs [private]

Definition at line 116 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), and GetStepInfo().

int TotemSD::ParentId [private]

Definition at line 124 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), GetStepInfo(), and ProcessHits().

short TotemSD::ParticleType [private]

Definition at line 119 of file TotemSD.h.

float TotemSD::PhiAtEntry [private]

Definition at line 122 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), and GetStepInfo().

G4ThreeVector TotemSD::Posizio [private]

Definition at line 115 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), and GetStepInfo().

G4StepPoint* TotemSD::postStepPoint [private]

Definition at line 111 of file TotemSD.h.

Referenced by GetStepInfo(), and UpdateHit().

G4StepPoint* TotemSD::preStepPoint [private]

Definition at line 110 of file TotemSD.h.

Referenced by GetStepInfo(), ResetForNewPrimary(), and SetToLocal().

uint32_t TotemSD::previousUnitID [private]

Definition at line 106 of file TotemSD.h.

Referenced by HitExists(), and UpdateHit().

int TotemSD::primaryID [private]

Definition at line 107 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), GetStepInfo(), HitExists(), and UpdateHit().

G4int TotemSD::primID [private]

Definition at line 95 of file TotemSD.h.

Referenced by HitExists(), Initialize(), StoreHit(), and UpdateHit().

TrackingSlaveSD* TotemSD::slave [private]

Definition at line 85 of file TotemSD.h.

Referenced by clearHits(), EndOfEvent(), fillHits(), TotemSD(), and ~TotemSD().

TotemG4HitCollection* TotemSD::theHC [private]

Definition at line 99 of file TotemSD.h.

Referenced by EndOfEvent(), HitExists(), Initialize(), PrintAll(), and StoreHit().

const SimTrackManager* TotemSD::theManager [private]

Definition at line 100 of file TotemSD.h.

float TotemSD::ThetaAtEntry [private]

Definition at line 121 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), and GetStepInfo().

G4Track* TotemSD::theTrack [private]

Definition at line 104 of file TotemSD.h.

Referenced by CreateNewHit(), and GetStepInfo().

float TotemSD::Tof [private]

Definition at line 117 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), and GetStepInfo().

int TotemSD::tsID [private]

Definition at line 102 of file TotemSD.h.

Referenced by HitExists(), Initialize(), and UpdateHit().

double TotemSD::tSlice [private]

Definition at line 108 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), and GetStepInfo().

int TotemSD::tSliceID [private]

Definition at line 107 of file TotemSD.h.

Referenced by CreateNewHit(), GetStepInfo(), HitExists(), and UpdateHit().

uint32_t TotemSD::unitID [private]

Definition at line 106 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), GetStepInfo(), HitExists(), ProcessHits(), and UpdateHit().

float TotemSD::Vx [private]

Definition at line 125 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), and GetStepInfo().

float TotemSD::Vy [private]

Definition at line 125 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), and GetStepInfo().

float TotemSD::Vz [private]

Definition at line 125 of file TotemSD.h.

Referenced by CreateNewHit(), CreateNewHitEvo(), and GetStepInfo().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:50 2009 for CMSSW by  doxygen 1.5.4