ATLAS Offline Software
Loading...
Searching...
No Matches
PRDHandle_CSC_Strip.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include "VP1Base/VP1Msg.h"
10
13
15
16#include <Inventor/nodes/SoSeparator.h>
17#include <Inventor/nodes/SoTranslation.h>
18#include <Inventor/nodes/SoMaterial.h>
19
20#include <sstream>
21#include <algorithm>
22
23
24//____________________________________________________________________
30
31//____________________________________________________________________
32void PRDHandle_CSC_Strip::buildShapes(SoNode*&shape_simple, SoNode*&shape_detailed)
33{
34 const CscIdHelper * idhelper = VP1DetInfo::cscIDHelper();
35 if (!idhelper)
36 return;
37
38 Identifier id = m_csc->identify();
39
40 SoSeparator * errDetailed = new SoSeparator;
41 SoSeparator * errSimple = new SoSeparator;
42 shape_simple = errSimple;
43
44 double striplength = m_csc->detectorElement()->stripLength( id );
45 if (static_cast<PRDCollHandle_CSC_Strip*>(collHandle())->project())
46 striplength += 300.0;//Fixme: Rough extension for now
47 SoNode* line = common()->nodeManager()->getShapeNode_Strip(striplength);
48 errSimple->addChild(line);
49 errSimple->addChild(common()->nodeManager()->getShapeNode_Cross(10));
50 const double maxCharge = 1e5;
51 //Thickness of highlighed strip
52 //FIXME: the maxCharge/3 is just a quick fix to get a nice presentation
53 // maybe this should go like sqrt(charge/maxCharge) so that it
54 // is clear for small charges.
55 //const double stripHeight = (1 + 4*sqrt(m_csc->charge()/maxCharge))*CLHEP::mm; // [1,5]
56 //
57 // The minimum is chosen equal to the neighbouring strips, such
58 // that a zero charge will give the same stirp height
59 const double stripHeight = 1*CLHEP::mm; // [1,5]
60
61 const std::vector< float > charges = m_csc->sampleCharges();
62 if (charges.size() == 0 )
63 {
64 // Add arbitrary strip height & draw entire length of strip.
65 errDetailed->addChild(common()->nodeManager()->getShapeNode_Strip(striplength,
66 m_csc->detectorElement()->cathodeReadoutPitch(idhelper->chamberLayer( id ),
67 idhelper->measuresPhi( id )), stripHeight));
68 } else {
69 SoSeparator * rdos = new SoSeparator;
70
71 Amg::Vector2D localposCharge;
72
73 // SoTransparency * transparent = new SoTransparency;
74 // transparent->transparency.setValue(0.5);
75 // rdos->addChild( transparent );
76 double chargeLength=striplength/static_cast<double>(charges.size()); // size of one charge cell
77 // std::cout<<"Number of charges="<<charges.size()<<", chargeLength="<<chargeLength<<" striplength="<<striplength<<std::endl;
78 double ypos=(chargeLength-striplength)/2.0;
79 double stripPitch=m_csc->detectorElement()->cathodeReadoutPitch(idhelper->chamberLayer( id ),idhelper->measuresPhi( id ));
80 SoTranslation * localtrans = new SoTranslation;
81 localtrans->translation.setValue(0.0,ypos,0.0);
82 rdos->addChild(localtrans);
83
84 for( float charge : charges ) {
85 charge = std::max(1.0f,charge); // keep charges positive until I understand if it is okay to be -ve
86 const double stripHeightCharge = (1.0 + 4*sqrt(charge/maxCharge))*CLHEP::mm;
87 // std::cout<<"stripHeightCharge: "<<stripHeightCharge<<std::endl;
88 rdos->addChild(common()->nodeManager()->getShapeNode_Strip(chargeLength, stripPitch, stripHeightCharge));
89 // ypos+=chargeLength;
90 SoTranslation * localtrans2 = new SoTranslation;
91 localtrans2->translation.setValue(0.0,chargeLength,0.0);
92 rdos->addChild(localtrans2);
93
94 }
95 errDetailed->addChild(rdos);
96 }
97 SoMaterial * mat = new SoMaterial;
98 mat->diffuseColor.setValue(1.0,0,0);
99 errDetailed->addChild(mat);
100 errDetailed->addChild(common()->nodeManager()->getShapeNode_Cross(10));
101
102 shape_detailed = errDetailed;
103}
104
105//____________________________________________________________________
107{
108 //Unique for each station.
109 const MuonGM::MuonStation* station = m_csc->detectorElement()->parentMuonStation();
110 return station->getPhiIndex()-99999*station->getEtaIndex();//hopefully unique.
111}
112
113//____________________________________________________________________
115{
116
117 if (!m_csc)
118 return QStringList("Null PRD");
119 const CscIdHelper * idhelper = VP1DetInfo::cscIDHelper();
120 if (!idhelper)
121 return QStringList("Null PRD");
122
123 Identifier id = m_csc->identify();
124 std::ostringstream os;
125 os << "CscStripPrepData with Identifier ["<<id<<"] = ["<<idhelper->print_to_string(id)
126 <<"] at global position = "<<m_csc->globalPosition()<<", local position = "<<m_csc->localPosition();
127 os << ". Samples = [";
128 for( unsigned int i=0;i<m_csc->sampleCharges().size();++i) os << m_csc->sampleCharges()[i] << " , ";
129
130 os << "]. Time of first sample= "<<m_csc->timeOfFirstSample() << ", sampling time (CLHEP::ns) "
131 << m_csc->samplingTime() << ", sampling phase " << m_csc->samplingPhase();
132 os << ". RDO list= [";
133 for( unsigned int i=0;i<m_csc->rdoList().size();++i) os << m_csc->rdoList()[i] << " , ";
134 os << "].";
135 // os <<"\n Dump follows:";
136 // os <<"\n--------------";
137 //os << *(m_csc);
138 return QString(os.str().c_str()).split("\n");
139}
140
141
double charge(const T &p)
Definition AtlasPID.h:997
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
int chamberLayer(const Identifier &id) const
bool measuresPhi(const Identifier &id) const override
SoNode * getShapeNode_Strip(double length, double width=0, double depth=0)
int getEtaIndex() const
a la AMDB
int getPhiIndex() const
a la AMDB
Class representing the raw data of one CSC strip (for clusters look at Muon::CscPrepData).
PRDHandleBase(PRDCollHandleBase *)
PRDSysCommonData * common() const
PRDCollHandleBase * collHandle() const
const Muon::CscStripPrepData * csc() const
PRDHandle_CSC_Strip(PRDCollHandle_CSC_Strip *, const Muon::CscStripPrepData *)
const Muon::CscStripPrepData * m_csc
virtual QStringList clicked() const
void buildShapes(SoNode *&shape_simple, SoNode *&shape_detailed)
HitsSoNodeManager * nodeManager() const
static void initClass()
static const CscIdHelper * cscIDHelper()
Eigen::Matrix< double, 2, 1 > Vector2D