ATLAS Offline Software
Loading...
Searching...
No Matches
VP1CC_TileBarEc Class Reference

#include <VP1CaloCells.h>

Inheritance diagram for VP1CC_TileBarEc:
Collaboration diagram for VP1CC_TileBarEc:

Public Member Functions

 VP1CC_TileBarEc (const CaloCell *caloCell, const TileID *tile_id, const VP1CC_SeparatorMap *separators)
virtual ~VP1CC_TileBarEc ()
virtual void build3DObjects (VP1CC_SoNode2CCMap *node2cc, bool useEt, const QPair< bool, double > &scale, bool outline, const VP1CC_GlobalCuts &)
bool isInsideClipVolume (const VP1CC_GlobalCuts &globalCuts)
virtual void remove3DObjects (VP1CC_SoNode2CCMap *node2cc)
std::vector< std::string > ToString (const CaloCell_ID *calo_id, const std::string &extrainfos="")
int GetFragChannel (const TileHWID *tile_hw_id, bool up, int &frag, int &channel)
double energyToTransverse (const double &) const
bool cutPassed (const VP1CC_GlobalCuts &globalCuts)
const CaloCellgetCaloCell ()
Identifier getID ()
void updateScene (VP1CC_SoNode2CCMap *node2cc, bool useEt, const QPair< bool, double > &scale, bool outline, const VP1CC_GlobalCuts &globalCuts)
double cellDepth (const QPair< bool, double > &scale, const double &energy)

Protected Member Functions

std::string id2name (Identifier &id)

Protected Attributes

SoGenericBoxm_hitUp
SoGenericBoxm_hitDown
VP1ExtraSepLayerHelperm_helperUp
VP1ExtraSepLayerHelperm_helperDown
const TileIDm_tileID
const CaloCellm_caloCell

Detailed Description

Definition at line 313 of file VP1CaloCells.h.

Constructor & Destructor Documentation

◆ VP1CC_TileBarEc()

VP1CC_TileBarEc::VP1CC_TileBarEc ( const CaloCell * caloCell,
const TileID * tile_id,
const VP1CC_SeparatorMap * separators )

caloCell was already dereferenced in the initialiser list, so this is redundant: you've already crashed. if(!caloCell) throw std::runtime_error("VP1CC_TileBarEc: 0 pointer to CaloCell");

Definition at line 466 of file VP1CaloCells.cxx.

468 :
469 VP1CC_Tile(caloCell,tile_id),
470 m_hitUp(0),
471 m_hitDown(0)
472{
478 if(!separators)
479 throw std::runtime_error("VP1CC_TileBarEc: 0 pointer to VP1CC Separator Map");
480
481 // The CaloCell has to be of type TileCell
482 const TileCell* tile_cell = dynamic_cast<const TileCell*>(caloCell);
483 if(tile_cell==0)
484 throw std::runtime_error("VP1CC_TileBarEc: CaloCell is not TileCell");
485
486 // define Separator types (Up/Down) depending on Cell energy
487 VP1CC_SeparatorTypes mySeparatorTypeUp;
488 VP1CC_SeparatorTypes mySeparatorTypeDown;
489
490 double energy1 = tile_cell->ene1();
491 double energy2 = tile_cell->ene2();
492
493 if(caloCell->energy()<0)
494 {
495 if(energy1>=0)
496 mySeparatorTypeDown = VP1CC_SepTileNegativePos;
497 else
498 mySeparatorTypeDown = VP1CC_SepTileNegativeDown;
499
500 if(energy2>=0)
501 mySeparatorTypeUp = VP1CC_SepTileNegativePos;
502 else
503 mySeparatorTypeUp = VP1CC_SepTileNegativeUp;
504 }
505 else
506 {
507 if(energy1<=0)
508 mySeparatorTypeDown = VP1CC_SepTilePositiveNeg;
509 else
510 mySeparatorTypeDown = VP1CC_SepTilePositiveDown;
511
512 if(energy2<=0)
513 mySeparatorTypeUp = VP1CC_SepTilePositiveNeg;
514 else
515 mySeparatorTypeUp = VP1CC_SepTilePositiveUp;
516 }
517
518 VP1CC_SeparatorMap::const_iterator it = separators->find(mySeparatorTypeDown);
519 if(it ==separators->end())
520 throw std::runtime_error("VP1CC_TileBarEc: Missing separator helper in the map");
521
522 m_helperDown = it->second;
523
524 it = separators->find(mySeparatorTypeUp);
525 if(it ==separators->end())
526 throw std::runtime_error("VP1CC_TileBarEc: Missing separator helper in the map");
527
528 m_helperUp = it->second;
529
530 if(!m_helperDown || !m_helperUp)
531 throw std::runtime_error("VP1CC_TileBarEc: 0 pointer to one of separator helpers" );
532}
VP1CC_SeparatorTypes
@ VP1CC_SepTileNegativeDown
@ VP1CC_SepTilePositiveDown
@ VP1CC_SepTilePositiveNeg
@ VP1CC_SepTilePositiveUp
@ VP1CC_SepTileNegativePos
@ VP1CC_SepTileNegativeUp
double energy() const
get energy (data member)
Definition CaloCell.h:327
float ene1(void) const
get energy of first PMT
Definition TileCell.h:187
float ene2(void) const
get energy of second PMT
Definition TileCell.h:189
SoGenericBox * m_hitDown
SoGenericBox * m_hitUp
VP1ExtraSepLayerHelper * m_helperUp
VP1ExtraSepLayerHelper * m_helperDown
VP1CC_Tile(const CaloCell *caloCell, const TileID *tile_id)

◆ ~VP1CC_TileBarEc()

VP1CC_TileBarEc::~VP1CC_TileBarEc ( )
virtual

Definition at line 534 of file VP1CaloCells.cxx.

535{
536}

Member Function Documentation

◆ build3DObjects()

void VP1CC_TileBarEc::build3DObjects ( VP1CC_SoNode2CCMap * node2cc,
bool useEt,
const QPair< bool, double > & scale,
bool outline,
const VP1CC_GlobalCuts & globalCuts )
virtual

Implements VP1CaloCell.

Definition at line 598 of file VP1CaloCells.cxx.

603{
604 bool createNewHit = false;
605 if(!m_hitUp){
606 m_hitUp = new SoGenericBox();
607 m_hitDown = new SoGenericBox();
608 createNewHit = true;
609 }
610
611 const TileCell* tile_cell = dynamic_cast<const TileCell*>(m_caloCell);
612 if (not tile_cell) return;
613 double energy1 = (useEt ? energyToTransverse(tile_cell->ene1()) : tile_cell->ene1());
614 double energy2 = (useEt ? energyToTransverse(tile_cell->ene2()) : tile_cell->ene2());
615
616 const CaloDetDescrElement* ddElement = m_caloCell->caloDDE();
617
618 double eta = ddElement->eta();
619 double deta = ddElement->deta()*0.5;
620 double phi = ddElement->phi();
621 double dphi = ddElement->dphi()*0.5;
622 double radius = ddElement->r();
623 double dradius = ddElement->dr()*0.5;
624
625 double z = ddElement->z();
626 double minR = radius - dradius;
627 double radialDistance = sqrt(minR*minR + z*z);
628
629
630 double depth1 = cellDepth(scale,energy1);
631 depth1 = std::min(depth1, std::fabs(globalCuts.clipRadius - radialDistance));
632 double depth2 = cellDepth(scale,energy2);
633 depth2 = std::min(depth2, std::fabs(globalCuts.clipRadius - radialDistance));
634 // std::cout<<"VP1CC_TileBarEc clipRadius: "<<globalCuts.clipRadius<<"\t radius "<<radius<<"\t depth1 "
635 // <<cellDepth(scale,energy1)<<"\t depth2 "<<cellDepth(scale,energy2)<<"\t cd1 "<<depth1<<"\t cd1 "<<depth1<<std::endl;
636
637 //double etaMin, double etaMax,
638 // double phiMin, double phiMax,
639 // double cellDepth, double cellDistance,
640 // double etasqueezefact, double phisqueezefact
641 m_hitUp->setParametersForBarrelEtaPhiCell(eta,eta+deta,phi-dphi,phi+dphi,
642 depth1,radius-dradius,0.9,0.9);
643 m_hitUp->drawEdgeLines = outline;
644 m_hitDown->setParametersForBarrelEtaPhiCell(eta-deta,eta,phi-dphi,phi+dphi,
645 depth2,radius-dradius,0.9,0.9);
646 m_hitDown->drawEdgeLines = outline;
647
648 if(createNewHit) {
649 (*node2cc)[m_hitUp] = this;
650 (*node2cc)[m_hitDown] = this;
651 m_helperUp->addNode(m_hitUp);
652 m_helperDown->addNode(m_hitDown);
653 }
654}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define z
const CaloCell * m_caloCell
double energyToTransverse(const double &) const
double cellDepth(const QPair< bool, double > &scale, const double &energy)

◆ cellDepth()

double VP1CaloCell::cellDepth ( const QPair< bool, double > & scale,
const double & energy )
inlineinherited

Definition at line 189 of file VP1CaloCells.h.

190 { return std::max(1.0*Gaudi::Units::mm,scale.second*(scale.first?log(1+fabs(energy)):fabs(energy))); }

◆ cutPassed()

bool VP1CaloCell::cutPassed ( const VP1CC_GlobalCuts & globalCuts)
inherited

Definition at line 63 of file VP1CaloCells.cxx.

64{
65 // only do this if it's something significant
66 if (globalCuts.clipRadius<10e8){
67 if (!isInsideClipVolume(globalCuts)) return false;
68 // double radius = sqrt(m_caloCell->x()*m_caloCell->x() + m_caloCell->y()*m_caloCell->y() + m_caloCell->z()*m_caloCell->z());
69
70 }
71
72 // Check side and Eta cut
73 bool passed = (m_caloCell->eta()>=0 && globalCuts.sideA)
74 || (m_caloCell->eta()<0 && globalCuts.sideC);
75 passed = passed && globalCuts.allowedEta.contains(m_caloCell->eta());
76 if(!passed) return false;
77 // Check Phi Cut
78 passed = false;
79 for(const VP1Interval& i : globalCuts.allowedPhi){
80 if(i.contains(m_caloCell->phi())
81 ||i.contains(m_caloCell->phi()+2*M_PI)
82 ||i.contains(m_caloCell->phi()-2*M_PI)) {
83 passed = true;
84 break;
85 }
86 }
87 return passed;
88}
#define M_PI
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
QList< VP1Interval > allowedPhi
VP1Interval allowedEta
virtual bool isInsideClipVolume(const VP1CC_GlobalCuts &globalCuts)
bool contains(const double &x) const

◆ energyToTransverse()

double VP1CaloCell::energyToTransverse ( const double & e) const
inherited

Definition at line 58 of file VP1CaloCells.cxx.

59{
60 return m_caloCell->sinTh()*e;
61}

◆ getCaloCell()

const CaloCell * VP1CaloCell::getCaloCell ( )
inherited

Definition at line 48 of file VP1CaloCells.cxx.

49{
50 return m_caloCell;
51}

◆ GetFragChannel()

int VP1CC_TileBarEc::GetFragChannel ( const TileHWID * tile_hw_id,
bool up,
int & frag,
int & channel )
virtual

Implements VP1CC_Tile.

Definition at line 574 of file VP1CaloCells.cxx.

578{
579 HWIdentifier hwId;
580 IdContext context = tile_hw_id->channel_context();
581
582 int result = 0;
583
584 if(up)
585 result = tile_hw_id->get_id(m_caloCell->caloDDE()->onl2(),hwId,&context);
586 else
587 result = tile_hw_id->get_id(m_caloCell->caloDDE()->onl1(),hwId,&context);
588
589 if(result!=0)
590 return result;
591
592 frag = tile_hw_id->frag(hwId);
593 channel = tile_hw_id->channel(hwId);
594
595 return 0;
596}
int frag(const HWIdentifier &id) const
extract frag field from HW identifier
Definition TileHWID.h:181
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
Definition TileHWID.h:189
virtual int get_id(const IdentifierHash &hash_id, HWIdentifier &id, const IdContext *context=0) const
create compact HW ID from hash id (return == 0 for OK)
Definition TileHWID.cxx:491
IdContext channel_context() const
idContext for channels
Definition TileHWID.cxx:478

◆ getID()

Identifier VP1CaloCell::getID ( )
inherited

Definition at line 53 of file VP1CaloCells.cxx.

54{
55 return m_caloCell->ID();
56}

◆ id2name()

std::string VP1CC_TileBarEc::id2name ( Identifier & id)
protected

Definition at line 686 of file VP1CaloCells.cxx.

687{
688 std::string name("");
689
690 // Barrel/EC
691 if(m_tileID->is_tile_barrel(id))
692 name += std::string("LB");
693 else
694 name += std::string("EB");
695
696 // Pos/Neg
697 if(m_tileID->side(id)==1)
698 name += std::string("A");
699 else
700 name += std::string("C");
701
702 // Module number
703 std::ostringstream modnum;
704 modnum << m_tileID->module(id) + 1;
705 name += (modnum.str() + std::string(" "));
706
707 // Sample
708 int sample = m_tileID->sample(id);
709 switch(sample)
710 {
711 case 0:
712 {
713 name += std::string("A");
714 break;
715 }
716 case 1:
717 {
718 if(m_tileID->is_tile_barrel(id))
719 {
720 name += std::string("B");
721 if(m_tileID->tower(id)<9)
722 name += std::string("C");
723 }
724 else
725 {
726 if(m_tileID->section(id)==2)
727 name += std::string("B");
728 else
729 name += std::string("C");
730 }
731 break;
732 }
733 case 2:
734 {
735 name += std::string("D");
736 break;
737 }
738 default:
739 break;
740 }
741
742 // Tower
743 std::ostringstream townum;
744 if(m_tileID->sample(id)==2)
745 townum << m_tileID->tower(id)/2;
746 else
747 townum << m_tileID->tower(id)+1;
748
749 name += townum.str();
750 return name;
751}
const TileID * m_tileID

◆ isInsideClipVolume()

bool VP1CC_TileBarEc::isInsideClipVolume ( const VP1CC_GlobalCuts & globalCuts)
virtual

Reimplemented from VP1CaloCell.

Definition at line 656 of file VP1CaloCells.cxx.

656 {
657 const CaloDetDescrElement* ddElement = m_caloCell->caloDDE();
658 double z = ddElement->z();
659 double radius = ddElement->r();
660 double dradius = ddElement->dr()*0.5;
661 double minR = radius - dradius;
662
663 double radialDistance = sqrt(minR*minR + z*z);
664
665 if ( radialDistance > globalCuts.clipRadius ) return false;
666 return true;
667}

◆ remove3DObjects()

void VP1CC_TileBarEc::remove3DObjects ( VP1CC_SoNode2CCMap * node2cc)
virtual

Implements VP1CaloCell.

Definition at line 670 of file VP1CaloCells.cxx.

671{
672 if(m_hitUp) {
673 // Remove entries from node2cc map
674 node2cc->erase(m_hitUp);
675 node2cc->erase(m_hitDown);
676
677 // Drop the hit from the scene and delete hit object
678 m_helperUp->removeNode(m_hitUp);
679 m_helperDown->removeNode(m_hitDown);
680
681 m_hitUp = 0;
682 m_hitDown = 0;
683 }
684}

◆ ToString()

std::vector< std::string > VP1CC_TileBarEc::ToString ( const CaloCell_ID * calo_id,
const std::string & extrainfos = "" )
virtual

Implements VP1CaloCell.

Definition at line 538 of file VP1CaloCells.cxx.

539{
540 std::vector<std::string> result;
541 const TileCell* tile_cell = dynamic_cast<const TileCell*>(m_caloCell);
542 if (not tile_cell) return result;
543 Identifier cellid = m_caloCell->ID();
544
545 double total_energy = m_caloCell->energy();
546 double total_time = m_caloCell->time();
547 double pmt_energy1 = tile_cell->ene1();
548 double pmt_time1 = tile_cell->time1();
549 double pmt_energy2 = tile_cell->ene2();
550 double pmt_time2 = tile_cell->time2();
551
552 std::ostringstream msg, msg1, msg2, msg3, msg4;
553 msg << "Cell: " << id2name(cellid) << " " << extrainfos;
554 msg1 << "Energy = " << total_energy << " (Mev)";
555 msg2 << "Time = " << total_time;
556 msg3 << " PMT1 Energy = " << pmt_energy1 << " (Mev)"
557 << " PMT1 Time = " << pmt_time1;
558 msg4 << " PMT2 Energy = " << pmt_energy2 << " (Mev)"
559 << " PMT2 Time = " << pmt_time2;
560
561 std::string stars("***");
562 result.push_back(stars);
563
564 result.push_back(msg.str());
565 result.push_back(msg1.str());
566 result.push_back(msg2.str());
567 result.push_back(msg3.str());
568 result.push_back(msg4.str());
569
570 result.push_back(stars);
571 return result;
572}
std::string id2name(Identifier &id)
MsgStream & msg
Definition testRead.cxx:32

◆ updateScene()

void VP1CaloCell::updateScene ( VP1CC_SoNode2CCMap * node2cc,
bool useEt,
const QPair< bool, double > & scale,
bool outline,
const VP1CC_GlobalCuts & globalCuts )
inherited

Definition at line 99 of file VP1CaloCells.cxx.

104{
105 if(cutPassed(globalCuts))
106 build3DObjects(node2cc,useEt,scale,outline, globalCuts);
107 else
108 remove3DObjects(node2cc);
109}
virtual void remove3DObjects(VP1CC_SoNode2CCMap *node2cc)=0
bool cutPassed(const VP1CC_GlobalCuts &globalCuts)
virtual void build3DObjects(VP1CC_SoNode2CCMap *node2cc, bool useEt, const QPair< bool, double > &scale, bool outline, const VP1CC_GlobalCuts &)=0

Member Data Documentation

◆ m_caloCell

const CaloCell* VP1CaloCell::m_caloCell
protectedinherited

Definition at line 204 of file VP1CaloCells.h.

◆ m_helperDown

VP1ExtraSepLayerHelper* VP1CC_TileBarEc::m_helperDown
protected

Definition at line 342 of file VP1CaloCells.h.

◆ m_helperUp

VP1ExtraSepLayerHelper* VP1CC_TileBarEc::m_helperUp
protected

Definition at line 341 of file VP1CaloCells.h.

◆ m_hitDown

SoGenericBox* VP1CC_TileBarEc::m_hitDown
protected

Definition at line 340 of file VP1CaloCells.h.

◆ m_hitUp

SoGenericBox* VP1CC_TileBarEc::m_hitUp
protected

Definition at line 339 of file VP1CaloCells.h.

◆ m_tileID

const TileID* VP1CC_Tile::m_tileID
protectedinherited

Definition at line 307 of file VP1CaloCells.h.


The documentation for this class was generated from the following files: