ATLAS Offline Software
PRDHandle_CSC_Strip.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include "VP1Base/VP1Msg.h"
8 #include "VP1Utils/VP1DetInfo.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 //____________________________________________________________________
26  : PRDHandleBase(static_cast<PRDCollHandleBase*>(collhandle)), m_csc(csc)
27 {
29 }
30 
31 //____________________________________________________________________
32 void 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,
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  unsigned int i=0;
79  double ypos=(chargeLength-striplength)/2.0;
80  std::vector<float>::const_iterator st = charges.begin();
81  std::vector<float>::const_iterator en = charges.end();
82  double stripPitch=m_csc->detectorElement()->cathodeReadoutPitch(idhelper->chamberLayer( id ),idhelper->measuresPhi( id ));
83  SoTranslation * localtrans = new SoTranslation;
84  localtrans->translation.setValue(0.0,ypos,0.0);
85  rdos->addChild(localtrans);
86 
87  for( std::vector<float>::const_iterator it = st; it!=en; ++it, ++i){
88  // std::cout<<"Charge: "<<i<<" \ty="<<ypos<<" has charge=:"<<*it<<std::endl;
89  float charge = std::max(1.0f,(*it)); // keep charges positive until I understand if it is okay to be -ve
90  const double stripHeightCharge = (1.0 + 4*sqrt(charge/maxCharge))*CLHEP::mm;
91  // std::cout<<"stripHeightCharge: "<<stripHeightCharge<<std::endl;
92  rdos->addChild(common()->nodeManager()->getShapeNode_Strip(chargeLength, stripPitch, stripHeightCharge));
93  // ypos+=chargeLength;
94  SoTranslation * localtrans2 = new SoTranslation;
95  localtrans2->translation.setValue(0.0,chargeLength,0.0);
96  rdos->addChild(localtrans2);
97 
98  }
99  errDetailed->addChild(rdos);
100  }
101  SoMaterial * mat = new SoMaterial;
102  mat->diffuseColor.setValue(1.0,0,0);
103  errDetailed->addChild(mat);
104  errDetailed->addChild(common()->nodeManager()->getShapeNode_Cross(10));
105 
106  shape_detailed = errDetailed;
107 }
108 
109 //____________________________________________________________________
111 {
112  //Unique for each station.
114  return station->getPhiIndex()-99999*station->getEtaIndex();//hopefully unique.
115 }
116 
117 //____________________________________________________________________
118 QStringList PRDHandle_CSC_Strip::clicked() const
119 {
120 
121  if (!m_csc)
122  return QStringList("Null PRD");
123  const CscIdHelper * idhelper = VP1DetInfo::cscIDHelper();
124  if (!idhelper)
125  return QStringList("Null PRD");
126 
127  Identifier id = m_csc->identify();
128  std::ostringstream os;
129  os << "CscStripPrepData with Identifier ["<<id<<"] = ["<<idhelper->print_to_string(id)
130  <<"] at global position = "<<m_csc->globalPosition()<<", local position = "<<m_csc->localPosition();
131  os << ". Samples = [";
132  for( unsigned int i=0;i<m_csc->sampleCharges().size();++i) os << m_csc->sampleCharges()[i] << " , ";
133 
134  os << "]. Time of first sample= "<<m_csc->timeOfFirstSample() << ", sampling time (CLHEP::ns) "
135  << m_csc->samplingTime() << ", sampling phase " << m_csc->samplingPhase();
136  os << ". RDO list= [";
137  for( unsigned int i=0;i<m_csc->rdoList().size();++i) os << m_csc->rdoList()[i] << " , ";
138  os << "].";
139  // os <<"\n Dump follows:";
140  // os <<"\n--------------";
141  //os << *(m_csc);
142  return QString(os.str().c_str()).split("\n");
143 }
144 
145 
CscIdHelper.h
HitsSoNodeManager.h
Muon::CscStripPrepData::samplingTime
unsigned short samplingTime() const
return the sampling time in ns: the time between samplings
Definition: CscStripPrepData.h:173
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
checkFileSG.line
line
Definition: checkFileSG.py:75
max
#define max(a, b)
Definition: cfImp.cxx:41
PRDHandle_CSC_Strip::m_csc
const Muon::CscStripPrepData * m_csc
Definition: PRDHandle_CSC_Strip.h:33
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
VP1Msg.h
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:53
PRDHandleBase::collHandle
PRDCollHandleBase * collHandle() const
Definition: PRDHandleBase.cxx:228
skel.it
it
Definition: skel.GENtoEVGEN.py:423
Trk::PrepRawData::rdoList
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
SoTransparency.h
Muon::CscStripPrepData::detectorElement
virtual const MuonGM::CscReadoutElement * detectorElement() const override final
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
Definition: CscStripPrepData.h:153
PRDHandleBase::common
PRDSysCommonData * common() const
Definition: PRDHandleBase.h:53
MuonGM::CscReadoutElement::stripLength
double stripLength(int chamberLayer, int measuresPhi, int stripNumber, double &epsilon) const
Definition: CscReadoutElement.cxx:292
PRDHandle_CSC_Strip::PRDHandle_CSC_Strip
PRDHandle_CSC_Strip(PRDCollHandle_CSC_Strip *, const Muon::CscStripPrepData *)
Definition: PRDHandle_CSC_Strip.cxx:25
PRDSysCommonData::nodeManager
HitsSoNodeManager * nodeManager() const
Definition: PRDSysCommonData.h:79
VP1DetInfo.h
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Muon::CscStripPrepData
Class representing the raw data of one CSC strip (for clusters look at Muon::CscPrepData).
Definition: CscStripPrepData.h:40
GeoPrimitives.h
PRDCollHandleBase
Definition: PRDCollHandleBase.h:25
MuonGM::MuonStation::getPhiIndex
int getPhiIndex() const
a la AMDB
Definition: MuonStation.h:162
SoTransparency::initClass
static void initClass()
Definition: SoTransparency.cxx:29
lumiFormat.i
int i
Definition: lumiFormat.py:92
Muon::CscStripPrepData::samplingPhase
bool samplingPhase() const
return the sampling phase
Definition: CscStripPrepData.h:178
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
MuonGM::MuonReadoutElement::parentMuonStation
const MuonStation * parentMuonStation() const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx:135
MuonGM::MuonStation
Definition: MuonStation.h:51
HitsSoNodeManager::getShapeNode_Strip
SoNode * getShapeNode_Strip(double length, double width=0, double depth=0)
Definition: HitsSoNodeManager.cxx:269
PRDHandle_CSC_Strip::regionIndex
int regionIndex()
Definition: PRDHandle_CSC_Strip.cxx:110
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
AtlasDetectorID::print_to_string
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:655
PRDHandle_CSC_Strip.h
PlotCalibFromCool.en
en
Definition: PlotCalibFromCool.py:399
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
charge
double charge(const T &p)
Definition: AtlasPID.h:494
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
project
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
Definition: MeasurementSelector.h:142
Muon::CscStripPrepData::globalPosition
const Amg::Vector3D & globalPosition() const
return global position reference
Definition: CscStripPrepData.h:141
PRDHandle_CSC_Strip::clicked
virtual QStringList clicked() const
Definition: PRDHandle_CSC_Strip.cxx:118
PRDCollHandle_CSC_Strip
Definition: PRDCollHandle_CSC_Strip.h:10
PRDHandle_CSC_Strip::buildShapes
void buildShapes(SoNode *&shape_simple, SoNode *&shape_detailed)
Definition: PRDHandle_CSC_Strip.cxx:32
CscIdHelper
Definition: CscIdHelper.h:52
MuonGM::MuonStation::getEtaIndex
int getEtaIndex() const
a la AMDB
Definition: MuonStation.h:163
HitsSoNodeManager::getShapeNode_Cross
SoNode * getShapeNode_Cross(double extent)
Definition: HitsSoNodeManager.cxx:427
PRDHandleBase
Definition: PRDHandleBase.h:35
VP1DetInfo::cscIDHelper
static const CscIdHelper * cscIDHelper()
Definition: VP1DetInfo.cxx:158
CscIdHelper::measuresPhi
bool measuresPhi(const Identifier &id) const override
Definition: CscIdHelper.cxx:774
MuonStation.h
CscIdHelper::chamberLayer
int chamberLayer(const Identifier &id) const
Definition: CscIdHelper.cxx:770
Muon::CscStripPrepData::timeOfFirstSample
double timeOfFirstSample() const
return the time of the first sample
Definition: CscStripPrepData.h:168
Muon::CscStripPrepData::sampleCharges
const std::vector< float > & sampleCharges() const
Return the time samples.
Definition: CscStripPrepData.h:163
MuonGM::CscReadoutElement::cathodeReadoutPitch
double cathodeReadoutPitch(int chLayer, int measuresPhi) const
Definition: CscReadoutElement.cxx:147