@@ -64,26 +64,75 @@ LadderSegmentation::LadderSegmentation(const LadderSegmentation& ladder)
6464// / Creates the Sensors Segmentation array on the Ladder
6565
6666// _____________________________________________________________________________
67- void LadderSegmentation::createSensors ()
67+ void LadderSegmentation::createSensors (TXMLEngine* xml, XMLNodePointer_t node )
6868{
6969
7070 if (!mChips ) {
7171 mChips = new TClonesArray (" o2::MFT::ChipSegmentation" , mNSensors );
7272 mChips ->SetOwner (kTRUE );
7373 }
7474
75- Geometry* mftGeom = Geometry::instance ();
76-
77- for (Int_t iSensor = 0 ; iSensor < mNSensors ; iSensor++) {
78- UInt_t sensorUniqueID =
79- mftGeom->getObjectID (Geometry::SensorType, mftGeom->getHalfID (GetUniqueID ()), mftGeom->getDiskID (GetUniqueID ()),
80- mftGeom->getPlaneID (GetUniqueID ()), mftGeom->getLadderID (GetUniqueID ()), iSensor);
75+ Int_t ichip;
76+ Double_t pos[3 ];
77+ Double_t ang[3 ] = { 0 ., 0 ., 0 . };
8178
82- auto * chip = new ChipSegmentation (sensorUniqueID );
79+ Geometry* mftGeom = Geometry::instance ( );
8380
84- new ((*mChips )[iSensor]) ChipSegmentation (*chip);
81+ TString nodeName = xml->GetNodeName (node);
82+ if (!nodeName.CompareTo (" chip" )) {
83+ XMLAttrPointer_t attr = xml->GetFirstAttr (node);
84+ while (attr != nullptr ) {
85+ TString attrName = xml->GetAttrName (attr);
86+ TString attrVal = xml->GetAttrValue (attr);
87+ if (!attrName.CompareTo (" ichip" )) {
88+ ichip = attrVal.Atoi ();
89+ if (ichip >= getNSensors () || ichip < 0 ) {
90+ LOG (FATAL) << " Wrong chip number : " << ichip << FairLogger::endl;
91+ }
92+ } else if (!attrName.CompareTo (" xpos" )) {
93+ pos[0 ] = attrVal.Atof ();
94+ } else if (!attrName.CompareTo (" ypos" )) {
95+ pos[1 ] = attrVal.Atof ();
96+ } else if (!attrName.CompareTo (" zpos" )) {
97+ pos[2 ] = attrVal.Atof ();
98+ } else if (!attrName.CompareTo (" phi" )) {
99+ ang[0 ] = attrVal.Atof ();
100+ } else if (!attrName.CompareTo (" theta" )) {
101+ ang[1 ] = attrVal.Atof ();
102+ } else if (!attrName.CompareTo (" psi" )) {
103+ ang[2 ] = attrVal.Atof ();
104+ } else {
105+ LOG (ERROR) << " Unknwon Attribute name " << xml->GetAttrName (attr) << FairLogger::endl;
106+ }
107+ attr = xml->GetNextAttr (attr);
108+ }
109+
110+ UInt_t chipUniqueID =
111+ mftGeom->getObjectID (Geometry::SensorType,
112+ mftGeom->getHalfID (GetUniqueID ()),
113+ mftGeom->getDiskID (GetUniqueID ()),
114+ mftGeom->getPlaneID (GetUniqueID ()),
115+ mftGeom->getLadderID (GetUniqueID ()),
116+ ichip);
117+
118+ auto * chip = new ChipSegmentation (chipUniqueID);
119+ // pos[0] = mftGeom->getSensorID(GetUniqueID())*
120+ // (SegmentationAlpide::SensorSizeCols + Geometry::sSensorInterspace) + Geometry::sSensorSideOffset;
121+ // pos[1] = Geometry::sSensorTopOffset;
122+ // pos[2] = Geometry::sFlexThickness;
123+ chip->setPosition (pos);
124+ chip->setRotationAngles (ang);
125+
126+ new ((*mChips )[ichip]) ChipSegmentation (*chip);
85127 delete chip;
86128 }
129+
130+ // display all child nodes
131+ XMLNodePointer_t child = xml->GetChild (node);
132+ while (child != nullptr ) {
133+ createSensors (xml, child);
134+ child = xml->GetNext (child);
135+ }
87136}
88137
89138// / Returns pointer to a sensor segmentation
0 commit comments