11#include <Inventor/nodes/SoSeparator.h>
14#include "CaloDetDescr/CaloDetDescrElement.h"
29#include <Inventor/nodes/SoTransform.h>
41 throw std::runtime_error(
"VP1CaloCell: Calo Cell has no Calo DDE");
92 double radius = ddElement->
r();
93 double z = ddElement->
z();
94 double radialDistance = sqrt(radius*radius +
z*
z);
95 if (radialDistance < globalCuts.
clipRadius )
return true;
101 const QPair<bool,double>& scale,
130 node2cc->erase(
m_hit);
143 throw std::runtime_error(
"VP1CC_LArEMB: 0 pointer to VP1CC Separator Map");
152 VP1CC_SeparatorMap::const_iterator it = separators->find(mySeparatorType);
153 if(it ==separators->end())
154 throw std::runtime_error(
"VP1CC_LArEMB: Missing separator helper in the map");
159 throw std::runtime_error(
"VP1CC_LArEMB: 0 pointer to separator helper");
168 const QPair<bool,double>& scale,
172 bool createNewHit =
false;
182 double eta = ddElement->
eta();
183 double deta = ddElement->
deta()*0.5;
184 double phi = ddElement->
phi();
185 double dphi = ddElement->
dphi()*0.5;
186 double radius = ddElement->
r();
189 double z = std::fabs(ddElement->
z());
190 double radialDistance = sqrt(radius*radius +
z*
z);
198 depth, radius, 0.9, 0.9 );
199 m_hit->drawEdgeLines = outline;
203 (*node2cc)[
m_hit] =
this;
209 std::vector<std::string>
result;
211 std::ostringstream
msg, msg1, msg2, msg3;
213 std::string stars(
"***");
216 msg <<
"LAr EMB. ID = " <<
m_caloCell->ID().getString() <<
" " << extrainfos;
218 msg1 <<
" Eta = " << ddElement->
eta()
219 <<
" Phi = " << ddElement->
phi();
221 msg2 <<
"Energy = " <<
m_caloCell->energy() <<
" (Mev)"
226 <<
" Provenance = " <<
m_caloCell->provenance();
229 result.push_back(msg1.str());
230 result.push_back(msg2.str());
231 result.push_back(msg3.str());
244 throw std::runtime_error(
"VP1CC_LArEMECHEC: 0 pointer to VP1CC Separator Map");
249 else if(calo_id->
is_hec(caloCell->
ID()))
252 throw std::runtime_error(
"VP1CC_LArEMECHEC: Calo Cell is neither EMEC nor HEC!");
256 if(caloCell->
energy()<0) {
258 mySeparatorType = VP1CC_SepLArEMECNeg;
260 mySeparatorType = VP1CC_SepLArHECNeg;
263 mySeparatorType = VP1CC_SepLArEMECPos;
265 mySeparatorType = VP1CC_SepLArHECPos;
269 VP1CC_SeparatorMap::const_iterator it = separators->find(mySeparatorType);
270 if(it ==separators->end())
271 throw std::runtime_error(
"VP1CC_LArEMECHEC: Missing separator in the map");
276 throw std::runtime_error(
"VP1CC_LArEMECHEC: 0 pointer to the separator helper");
285 std::vector<std::string>
result;
288 std::ostringstream
msg, msg1, msg2, msg3;
290 std::string stars(
"***");
297 msg <<
" " << extrainfos;
299 msg1 <<
" Eta = " << ddElement->
eta()
300 <<
" Phi = " << ddElement->
phi();
302 msg2 <<
"Energy = " <<
m_caloCell->energy() <<
" (Mev)"
307 <<
" Provenance = " <<
m_caloCell->provenance();
310 result.push_back(msg1.str());
311 result.push_back(msg2.str());
312 result.push_back(msg3.str());
320 const QPair<bool,double>& scale,
324 bool createNewHit =
false;
334 double eta = ddElement->
eta();
335 double deta = ddElement->
deta()*0.5;
336 double phi = ddElement->
phi();
337 double dphi = ddElement->
dphi()*0.5;
338 double z = ddElement->
z();
346 m_hit->drawEdgeLines = outline;
350 (*node2cc)[
m_hit] =
this;
360 throw std::runtime_error(
"VP1CC_LArFCAL: 0 pointer to VP1CC Separator Map");
370 VP1CC_SeparatorMap::const_iterator it = separators->find(mySeparatorType);
371 if(it ==separators->end())
372 throw std::runtime_error(
"VP1CC_LArFCAL: Missing separator in the map");
377 throw std::runtime_error(
"VP1CC_LArFCAL: Wrong 0 pointer to the separator helper");
386 std::vector<std::string>
result;
388 std::ostringstream
msg, msg1, msg2, msg3;
390 std::string stars(
"***");
393 msg <<
"LAr FCAL. ID = " <<
m_caloCell->ID().getString() <<
" " << extrainfos;
395 msg1 <<
" Eta = " << ddElement->
eta()
396 <<
" Phi = " << ddElement->
phi();
398 msg2 <<
" Energy = " <<
m_caloCell->energy() <<
" (Mev)"
403 <<
" Provenance = " <<
m_caloCell->provenance();
406 result.push_back(msg1.str());
407 result.push_back(msg2.str());
408 result.push_back(msg3.str());
416 const QPair<bool,double>& scale,
420 bool createNewHit =
false;
430 double x = ddElement->
x();
431 double dx = ddElement->
dx()*0.5;
432 double y = ddElement->
y();
433 double dy = ddElement->
dy()*0.5;
434 double z = ddElement->
z();
435 double dz = ddElement->
dz()*0.5;
438 double halfdepth(0.5*
cellDepth(scale,energy));
439 halfdepth = std::min(halfdepth, std::fabs(0.5 * (globalCuts.
clipRadius - std::fabs(
z))));
442 m_hit->setParametersForBox( dx*0.9, dy*0.9, halfdepth,
x,
y,
z-dz+halfdepth);
444 m_hit->setParametersForBox( dx*0.9, dy*0.9, halfdepth,
x,
y,
z+dz-halfdepth);
446 m_hit->drawEdgeLines = outline;
450 (*node2cc)[
m_hit] =
this;
479 throw std::runtime_error(
"VP1CC_TileBarEc: 0 pointer to VP1CC Separator Map");
484 throw std::runtime_error(
"VP1CC_TileBarEc: CaloCell is not TileCell");
490 double energy1 = tile_cell->
ene1();
491 double energy2 = tile_cell->
ene2();
496 mySeparatorTypeDown = VP1CC_SepTileNegativePos;
498 mySeparatorTypeDown = VP1CC_SepTileNegativeDown;
501 mySeparatorTypeUp = VP1CC_SepTileNegativePos;
503 mySeparatorTypeUp = VP1CC_SepTileNegativeUp;
508 mySeparatorTypeDown = VP1CC_SepTilePositiveNeg;
510 mySeparatorTypeDown = VP1CC_SepTilePositiveDown;
513 mySeparatorTypeUp = VP1CC_SepTilePositiveNeg;
515 mySeparatorTypeUp = VP1CC_SepTilePositiveUp;
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");
524 it = separators->find(mySeparatorTypeUp);
525 if(it ==separators->end())
526 throw std::runtime_error(
"VP1CC_TileBarEc: Missing separator helper in the map");
531 throw std::runtime_error(
"VP1CC_TileBarEc: 0 pointer to one of separator helpers" );
540 std::vector<std::string>
result;
542 if (not tile_cell)
return result;
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();
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;
561 std::string stars(
"***");
565 result.push_back(msg1.str());
566 result.push_back(msg2.str());
567 result.push_back(msg3.str());
568 result.push_back(msg4.str());
592 frag = tile_hw_id->
frag(hwId);
593 channel = tile_hw_id->
channel(hwId);
600 const QPair<bool,double>& scale,
604 bool createNewHit =
false;
612 if (not tile_cell)
return;
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;
625 double z = ddElement->
z();
626 double minR = radius - dradius;
627 double radialDistance = sqrt(minR*minR +
z*
z);
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));
642 depth1,radius-dradius,0.9,0.9);
643 m_hitUp->drawEdgeLines = outline;
645 depth2,radius-dradius,0.9,0.9);
658 double z = ddElement->
z();
659 double radius = ddElement->
r();
660 double dradius = ddElement->
dr()*0.5;
661 double minR = radius - dradius;
663 double radialDistance = sqrt(minR*minR +
z*
z);
665 if ( radialDistance > globalCuts.
clipRadius )
return false;
688 std::string name(
"");
692 name += std::string(
"LB");
694 name += std::string(
"EB");
698 name += std::string(
"A");
700 name += std::string(
"C");
703 std::ostringstream modnum;
705 name += (modnum.str() + std::string(
" "));
713 name += std::string(
"A");
720 name += std::string(
"B");
722 name += std::string(
"C");
727 name += std::string(
"B");
729 name += std::string(
"C");
735 name += std::string(
"D");
743 std::ostringstream townum;
749 name += townum.str();
762 throw std::runtime_error(
"VP1CC_TileCrack: 0 pointer to VP1CC Separator Map");
772 VP1CC_SeparatorMap::const_iterator it = separators->find(mySeparatorType);
773 if(it ==separators->end())
774 throw std::runtime_error(
"VP1CC_TileCrack: Missing separator in the map");
779 throw std::runtime_error(
"VP1CC_TileCrack: 0 pointer to the separator");
788 std::vector<std::string>
result;
789 std::ostringstream
msg, msg1;
791 std::string stars(
"***");
793 result.push_back(std::string(
"TileCrack Calo Cell"));
796 std::string cellName(
"EB");
798 cellName += std::string(
"A");
800 cellName += std::string(
"C");
803 std::ostringstream modnum;
804 modnum << calo_id->module(
m_caloCell->ID()) + 1;
805 cellName += (modnum.str() + std::string(
" E"));
811 cellName += std::string(
"1");
816 cellName += std::string(
"2");
821 cellName += std::string(
"3");
826 cellName += std::string(
"4");
833 msg <<
"Cell: " << cellName <<
" " << extrainfos;
835 msg1 <<
" Energy = " <<
m_caloCell->energy() <<
" (Mev)"
838 result.push_back(msg1.str());
857 frag = tile_hw_id->
frag(hwId);
858 channel = tile_hw_id->
channel(hwId);
865 const QPair<bool,double>& scale,
869 bool createNewHit =
false;
876 double eta = ddElement->
eta();
877 double deta = ddElement->
deta()*0.5;
878 double phi = ddElement->
phi();
879 double dphi = ddElement->
dphi()*0.5;
880 double z = ddElement->
z();
881 double dz = ddElement->
dz()*0.5;
884 double radius = ddElement->
r();
885 double minZ = std::fabs(
z)-dz;
886 double radialDistance = sqrt(radius*radius + minZ*minZ);
900 m_hit->drawEdgeLines = outline;
903 (*node2cc)[
m_hit] =
this;
910 double z = ddElement->
z();
911 double dz = ddElement->
dz()*0.5;
912 double radius = ddElement->
r();
913 double minZ = std::fabs(
z)-dz;
914 double radialDistance = sqrt(radius*radius + minZ*minZ);
916 if ( radialDistance > globalCuts.
clipRadius )
return false;
924 node2cc->erase(
m_hit);
938 SoSeparator* separator,
958 if(
m_cell->energy() < energy)
963 if (clipRadius < 350 )
973 if(drawinfo->find(channel) ==drawinfo->end())
974 throw std::runtime_error(
"Unable to find scintillator global info");
979 SoTransform* scinXF = 0;
982 throw std::runtime_error(
"Unable to find global transform for the scintillator");
985 else if(
type == 1) {
987 throw std::runtime_error(
"Unable to find global transform for the scintillator");
1002 SoSeparator* scinSep =
new SoSeparator;
1003 scinSep->addChild(scinXF);
1004 scinSep->addChild(scinTrd);
1008 (*node2mbts)[scinTrd] =
this;
1013 SoTransform* scinXF1 = 0;
1016 throw std::runtime_error(
"Unable to find global transform for the scintillator");
1019 else if(
type == 1) {
1021 throw std::runtime_error(
"Unable to find global transform for the scintillator");
1032 SoSeparator* scinSep1 =
new SoSeparator();
1033 scinSep1->addChild(scinXF1);
1034 scinSep1->addChild(scinTrd1);
1038 (*node2mbts)[scinTrd1] =
this;
1048 std::vector<std::string>
result;
1058 std::ostringstream
msg, msg1, msg2, msg3;
1059 msg <<
" MBTS. Side = " <<
type <<
". Scintillator Type = " << channel
1060 <<
", Num = " << module;
1061 msg1 <<
" Energy = " <<
m_cell->energy();
1062 msg2 <<
" Time = " <<
m_cell->time();
1064 std::string stars(
"***");
1068 result.push_back(msg1.str());
1069 result.push_back(msg2.str());
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
std::map< int, VP1CC_MbtsScinInfo *, std::less< int > > VP1CC_MbtsScinInfoMap
@ VP1CC_SepTileNegativeDown
@ VP1CC_SepTilePositiveDown
std::map< SoNode *, VP1Mbts *, std::less< SoNode * > > VP1CC_SoNode2MbtsMap
std::map< VP1CC_SeparatorTypes, VP1ExtraSepLayerHelper *, std::less< VP1CC_SeparatorTypes > > VP1CC_SeparatorMap
std::map< SoNode *, VP1CaloCell *, std::less< SoNode * > > VP1CC_SoNode2CCMap
bool is_em_endcap(const Identifier id) const
test if the id belongs to the EM Endcap
int side(const Identifier id) const
Tile field values (NOT_VALID == invalid request)
bool is_hec(const Identifier id) const
test if the id belongs to the HEC
int tower(const Identifier id) const
Tile field values (NOT_VALID == invalid request)
Helper class for offline cell identifiers.
Data object for each calorimeter readout cell.
double energy() const
get energy (data member)
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
This class groups all DetDescr information related to a CaloCell.
float dphi() const
cell dphi
float eta() const
cell eta
float phi() const
cell phi
float deta() const
cell deta
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
void setParametersForTrd(float dx1, float dx2, float dy1, float dy2, float dz)
float time1(void) const
get time of first PMT
float ene1(void) const
get energy of first PMT
float time2(void) const
get time of second PMT
float ene2(void) const
get energy of second PMT
Helper class for TileCal online (hardware) identifiers.
int frag(const HWIdentifier &id) const
extract frag field from HW identifier
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
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)
IdContext channel_context() const
idContext for channels
Helper class for TileCal offline identifiers.
Helper class for TileCal offline identifiers of ancillary testbeam detectors and MBTS.
QList< VP1Interval > allowedPhi
VP1CC_LArEMB(const CaloCell *caloCell, const VP1CC_SeparatorMap *separators)
virtual void build3DObjects(VP1CC_SoNode2CCMap *node2cc, bool useEt, const QPair< bool, double > &scale, bool outline, const VP1CC_GlobalCuts &)
std::vector< std::string > ToString(const CaloCell_ID *calo_id, const std::string &extrainfos="")
virtual ~VP1CC_LArEMECHEC()
VP1CC_LArEMECHEC(const CaloCell *caloCell, const CaloCell_ID *calo_id, const VP1CC_SeparatorMap *separators)
std::vector< std::string > ToString(const CaloCell_ID *calo_id, const std::string &extrainfos="")
virtual void build3DObjects(VP1CC_SoNode2CCMap *node2cc, bool useEt, const QPair< bool, double > &scale, bool outline, const VP1CC_GlobalCuts &)
virtual void build3DObjects(VP1CC_SoNode2CCMap *node2cc, bool useEt, const QPair< bool, double > &scale, bool outline, const VP1CC_GlobalCuts &)
std::vector< std::string > ToString(const CaloCell_ID *calo_id, const std::string &extrainfos="")
VP1CC_LArFCAL(const CaloCell *caloCell, const VP1CC_SeparatorMap *separators)
VP1ExtraSepLayerHelper * m_helper
VP1CC_LAr(const CaloCell *caloCell)
virtual void remove3DObjects(VP1CC_SoNode2CCMap *node2cc)
int GetFragChannel(const TileHWID *tile_hw_id, bool up, int &frag, int &channel)
virtual void build3DObjects(VP1CC_SoNode2CCMap *node2cc, bool useEt, const QPair< bool, double > &scale, bool outline, const VP1CC_GlobalCuts &)
virtual void remove3DObjects(VP1CC_SoNode2CCMap *node2cc)
VP1ExtraSepLayerHelper * m_helperUp
VP1CC_TileBarEc(const CaloCell *caloCell, const TileID *tile_id, const VP1CC_SeparatorMap *separators)
std::string id2name(Identifier &id)
bool isInsideClipVolume(const VP1CC_GlobalCuts &globalCuts)
std::vector< std::string > ToString(const CaloCell_ID *calo_id, const std::string &extrainfos="")
virtual ~VP1CC_TileBarEc()
VP1ExtraSepLayerHelper * m_helperDown
virtual void remove3DObjects(VP1CC_SoNode2CCMap *node2cc)
VP1CC_TileCrack(const CaloCell *caloCell, const TileID *tile_id, const VP1CC_SeparatorMap *separators)
int GetFragChannel(const TileHWID *tile_hw_id, bool up, int &frag, int &channel)
virtual void build3DObjects(VP1CC_SoNode2CCMap *node2cc, bool useEt, const QPair< bool, double > &scale, bool outline, const VP1CC_GlobalCuts &)
VP1ExtraSepLayerHelper * m_helper
virtual ~VP1CC_TileCrack()
bool isInsideClipVolume(const VP1CC_GlobalCuts &globalCuts)
std::vector< std::string > ToString(const CaloCell_ID *calo_id, const std::string &extrainfos="")
VP1CC_Tile(const CaloCell *caloCell, const TileID *tile_id)
void updateScene(VP1CC_SoNode2CCMap *node2cc, bool useEt, const QPair< bool, double > &scale, bool outline, const VP1CC_GlobalCuts &globalCuts)
const CaloCell * m_caloCell
VP1CaloCell(const CaloCell *caloCell)
double energyToTransverse(const double &) const
virtual void remove3DObjects(VP1CC_SoNode2CCMap *node2cc)=0
virtual bool isInsideClipVolume(const VP1CC_GlobalCuts &globalCuts)
const CaloCell * getCaloCell()
double cellDepth(const QPair< bool, double > &scale, const double &energy)
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
bool contains(const double &x) const
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)
std::vector< std::string > ToString()
SoSeparator * m_separator
bool UpdateScene(VP1CC_MbtsScinInfoMap *drawinfo, VP1CC_SoNode2MbtsMap *node2mbts, double energy, bool outline, double clipRadius)
const TileTBID * m_idhelper
VP1Mbts(const TileCell *cell, const TileTBID *idhelper, SoSeparator *separator, bool run2Geo)
std::string depth
tag string for intendation
VP1CC_MbtsXfMap cTransforms
VP1CC_MbtsXfMap aTransforms