StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFstQAMaker.cxx
1 /***************************************************************************
2 *
3 * $Id: StFstQAMaker.cxx,v $
4 *
5 * Author: Shenghui Zhang, Nov. 2021
6 ****************************************************************************
7 * Description:
8 * See header file.
9 ****************************************************************************
10 * StFstQAMaker.cxx,v 1.0
11 * Revision 1.0 2021/11/01 Shenghui Zhang
12 * Initial version
13 ****************************************************************************/
14 
15 #include "StFstQAMaker.h"
16 #include "StFstHitCollection.h"
17 #include "StFstHit.h"
18 #include "StRoot/StFstUtil/StFstCollection.h"
19 #include "StRoot/StFstUtil/StFstRawHitCollection.h"
20 #include "StEvent/StFstRawHit.h"
21 #include "StIOMaker/StIOMaker.h"
22 #include "StEvent/StEvent.h"
23 #include "StEvent/StTrack.h"
24 
25 //#include "StEvent/StEventTypes.h"
26 #include "StEvent/StPrimaryVertex.h"
27 #include "StMessMgr.h"
28 #include "StDcaGeometry.h"
29 #if ROOT_VERSION_CODE < 334081
30 #include "TArrayL.h"
31 #else
32 #include "TArrayL64.h"
33 #endif
34 #include "TClassTable.h"
35 #include "TH2F.h"
36 #include "TProfile.h"
37 #include "TTree.h"
38 #include "TFile.h"
39 #include "TString.h"
40 #include "StThreeVectorF.hh"
41 #include "StDetectorName.h"
42 
43 #include <string>
44 
45 // constructor
46 StFstQAMaker::StFstQAMaker( const char* name ) :
47  StMaker(name), mEventCounter(0), mDoTreeOutput(false) {
48  for(int iSensor=0; iSensor<kFstNumSensors; iSensor++) {
49  rawHitMap[iSensor] = NULL;
50  hitMap[iSensor] = NULL;
51  numOfRawHits_EventId[iSensor] = NULL;
52  }
53 
54  for(int iDisk = 0; iDisk < kFstNumDisk; iDisk++) {
55  hitMapOfFST[iDisk] = NULL;
56  hitMapOfAPV[iDisk] = NULL;
57  hitGlobalXY[iDisk] = NULL;
58  hitGlobalRPhi[iDisk] = NULL;
59  }
60 
61  for(unsigned char iTimeBin=0; iTimeBin<kFstNumTimeBins; iTimeBin++)
62  rawHitCharge_TimeBin[iTimeBin] = NULL;
63 
64  rawHitChargeErr = NULL;
65  rawHitMaxTimeBin_APV = NULL;
66  hitCharge_SensorId = NULL;
67  hitChargeErr_SensorId = NULL;
68  maxTimeBin_SensorId = NULL;
69  numOfRawHits_SensorId = NULL;
70  numOfHits_SensorId = NULL;
71  clusterSize_SensorId = NULL;
72  clusterSizeR_SensorId = NULL;
73  clusterSizePhi_SensorId = NULL;
74 }
75 
76 // initialize
77 Int_t StFstQAMaker::Init()
78 {
79  Int_t ierr = kStOk;
80 
81  fstRawHitTree = new TTree("fstRawHits", "fstRawHits_QA");
82  fstRawHitTree->Branch("rawHits", &fstRawHit, "channelId/I:geoId:wedge:sensor:phistrip:rstrip:maxTimeBin:rdo:arm:apv:channel:idTruth:seedHitFlag:EventId:charge[9]/F:chargeErr[9]/F");
83 
84  fstHitTree = new TTree("fstHits", "fstHits_QA");
85  fstHitTree->Branch("hits", &fstHit, "hitId/I:wedge/I:sensor/I:apv/I:idTruth/I:EventId/I:maxTimeBin/I:clusteringType/I:nRawHits/I:nRawHitsR/I:nRawHitsPhi/I:meanPhiStrip/F:meanRStrip/F:localR/F:localPhi/F:localZ/F:x/F:y/F:z/F:charge/F:chargeErr/F");
86 
87  numOfRawHits_SensorId = new TH2S("numOfRawHits_SensorId", "The number of RawHits vs. sensor ID", 108, 0, 108, 128, 0, 128);
88  numOfRawHits_SensorId->GetXaxis()->SetTitle("Sensor ID");
89  numOfRawHits_SensorId->GetYaxis()->SetTitle("Number of Raw Hits");
90 
91  rawHitMaxTimeBin_APV = new TH2S("rawHitMaxTimeBin_APV", "Max time bin of raw hits vs APV ID", 288, 0, 288, kFstNumTimeBins, 0, kFstNumTimeBins);
92  rawHitMaxTimeBin_APV->GetXaxis()->SetTitle("APV ID [48*(RDO-1)+16*ARM+APV]");
93  rawHitMaxTimeBin_APV->GetYaxis()->SetTitle("Max Time Bin Index");
94 
95  char buffer[100];
96  for(int iTimeBin=0; iTimeBin<kFstNumTimeBins; iTimeBin++) {
97  sprintf(buffer, "rawHitCharge_TimeBin%d", iTimeBin);
98  rawHitCharge_TimeBin[iTimeBin] = new TH2S(buffer, Form("ADC of raw hits at time bin %d vs. channel geometry ID",iTimeBin), 288, 0, 36864, 512, 0, kFstMaxAdc);
99  rawHitCharge_TimeBin[iTimeBin]->GetXaxis()->SetTitle("Channel ID");
100  rawHitCharge_TimeBin[iTimeBin]->GetYaxis()->SetTitle("ADC of Raw Hits");
101  }
102 
103  rawHitChargeErr = new TH2S("rawHitChargeErr", "RMS noise of raw hits vs. channel geometry ID", 288, 0, 36864, 128, 0, 64);
104  rawHitChargeErr->GetXaxis()->SetTitle("Channel ID");
105  rawHitChargeErr->GetYaxis()->SetTitle("RMS noise of Raw Hits");
106 
107  numOfHits_SensorId = new TH2S("numOfHits_SensorId", "The number of hits vs. sensor ID", 108, 0, 108, 128, 0, 128);
108  numOfHits_SensorId->GetXaxis()->SetTitle("Sensor ID");
109  numOfHits_SensorId->GetYaxis()->SetTitle("Number of Hits");
110 
111  hitCharge_SensorId = new TH2S("hitCharge_SensorId", "ADC of hits vs. sensor ID", 108, 0, 108, 512, 0, kFstMaxAdc);
112  hitCharge_SensorId->GetXaxis()->SetTitle("Sensor ID");
113  hitCharge_SensorId->GetYaxis()->SetTitle("ADC of Hits");
114 
115  hitChargeErr_SensorId = new TH2S("hitChargeErr_SensorId", "RMS noise of hits vs. sensor ID", 108, 0, 108, 128, 0, 64);
116  hitChargeErr_SensorId->GetXaxis()->SetTitle("Sensor ID");
117  hitChargeErr_SensorId->GetYaxis()->SetTitle("RMS noise of Hits");
118 
119  maxTimeBin_SensorId = new TH2S("maxTimeBin_SensorId", "Max time bin of hits vs. sensor ID", 108, 0, 108, kFstNumTimeBins, 0, kFstNumTimeBins);
120  maxTimeBin_SensorId->GetXaxis()->SetTitle("Sensor ID");
121  maxTimeBin_SensorId->GetYaxis()->SetTitle("Max Time Bin Index");
122 
123  clusterSize_SensorId = new TH2S("clusterSize_SensorId", "Cluster size of hits vs. sensor ID", 108, 0, 108, 20, 0, 20);
124  clusterSize_SensorId->GetXaxis()->SetTitle("Sensor ID");
125  clusterSize_SensorId->GetYaxis()->SetTitle("Cluster Size of Hits");
126 
127  clusterSizeR_SensorId = new TH2S("clusterSizeR_SensorId", "Cluster size in R of hits vs. sensor ID", 108, 0, 108, 20, 0, 20);
128  clusterSizeR_SensorId->GetXaxis()->SetTitle("Sensor ID");
129  clusterSizeR_SensorId->GetYaxis()->SetTitle("Cluster Size in R of Hits");
130 
131  clusterSizePhi_SensorId = new TH2S("clusterSizePhi_SensorId", "Cluster size in #phi of hits vs. sensor ID", 108, 0, 108, 20, 0, 20);
132  clusterSizePhi_SensorId->GetXaxis()->SetTitle("Sensor ID");
133  clusterSizePhi_SensorId->GetYaxis()->SetTitle("Cluster Size in #phi of hits");
134 
135  for(int iDisk = 0; iDisk < kFstNumDisk; ++iDisk)
136  {
137  TString HistName;
138  TString HistTitle;
139 
140  HistName = Form("hitMapOfFST_Disk%d",iDisk);
141  HistTitle = Form("FST hit map in r-phi for Disk%d",iDisk+1);
142  hitMapOfFST[iDisk] = new TH2S(HistName.Data(), HistTitle.Data(), kFstNumPhiSegPerWedge*kFstNumWedgePerDisk, 0, kFstNumPhiSegPerWedge*kFstNumWedgePerDisk, kFstNumRStripsPerWedge, 0, kFstNumRStripsPerWedge);
143  hitMapOfFST[iDisk]->GetXaxis()->SetTitle("PhiStrip");
144  hitMapOfFST[iDisk]->GetYaxis()->SetTitle("RStrip");
145 
146  HistName = Form("hitMapOfAPV_Disk%d",iDisk);
147  HistTitle = Form("FST hit map in APV geometry Id vs. wedge for Disk%d",iDisk+1);
148  hitMapOfAPV[iDisk] = new TH2S(HistName.Data(), HistTitle.Data(), kFstNumWedgePerDisk, 1, kFstNumWedgePerDisk+1, kFstApvsPerWedge, 0, kFstApvsPerWedge);
149  hitMapOfAPV[iDisk]->GetXaxis()->SetTitle("Wedge ID");
150  hitMapOfAPV[iDisk]->GetYaxis()->SetTitle("APV geometry ID");
151 
152  HistName = Form("hitGlobalXY_Disk%d",iDisk);
153  HistTitle = Form("Global X vs. Global Y for Disk%d",iDisk+1);
154  hitGlobalXY[iDisk] = new TH2F(HistName.Data(), HistTitle.Data(), 140, -35, 35, 140, -35, 35);
155  hitGlobalXY[iDisk]->GetXaxis()->SetTitle("Global X [cm]");
156  hitGlobalXY[iDisk]->GetYaxis()->SetTitle("Global Y [cm]");
157 
158  HistName = Form("hitGlobalRPhi_Disk%d",iDisk);
159  HistTitle = Form("Global #phi vs. Global r for Disk%d",iDisk+1);
160  hitGlobalRPhi[iDisk] = new TH2F(HistName.Data(), HistTitle.Data(), kFstNumPhiSegPerWedge*kFstNumWedgePerDisk/8, -TMath::Pi(), TMath::Pi(), kFstNumRStripsPerWedge, 5, 28);
161  hitGlobalRPhi[iDisk]->GetXaxis()->SetTitle("Global #phi [rad.]");
162  hitGlobalRPhi[iDisk]->GetYaxis()->SetTitle("Global r [cm]");
163  }
164 
165  char histtitle[128];
166  for(int iWedge=0; iWedge<kFstNumWedges; iWedge++) {
167  for(int iSensor=0; iSensor<kFstNumSensorsPerWedge; iSensor++) {
168  sprintf(histtitle, "Raw Hit phistrip vs. rstrip: Wedge %d Sensor %d", iWedge+1, iSensor);
169  sprintf(buffer,"rawHitMap_Sensor%d", iWedge*3+iSensor+1);
170  rawHitMap[iWedge*3+iSensor] = new TH2S(buffer, histtitle, 128, 0, 128, 8, 0, 8);
171  rawHitMap[iWedge*3+iSensor]->GetXaxis()->SetTitle("PhiStrip");
172  rawHitMap[iWedge*3+iSensor]->GetYaxis()->SetTitle("RStrip");
173 
174  sprintf(histtitle, "Number of raw hits vs. EventID: Wedge %d Sensor %d", iWedge+1, iSensor);
175  sprintf(buffer,"numOfRawHitsVsEventId_Sensor%d", iWedge*3+iSensor+1);
176  numOfRawHits_EventId[iWedge*3+iSensor] = new TProfile(buffer, histtitle, 10000, 0, 10000);
177  numOfRawHits_EventId[iWedge*3+iSensor]->GetXaxis()->SetTitle("EventID (Time)");
178  numOfRawHits_EventId[iWedge*3+iSensor]->GetYaxis()->SetTitle("<rawhits>");
179 
180  sprintf(histtitle, "Hit mean phistrip vs. mean rstrip: Wedge %d Sensor %d", iWedge+1, iSensor);
181  sprintf(buffer,"hitMap_Sensor%d", iWedge*3+iSensor+1);
182  hitMap[iWedge*3+iSensor] = new TH2S(buffer, histtitle, 128, 0, 128, 8, 0, 8);
183  hitMap[iWedge*3+iSensor]->GetXaxis()->SetTitle("Mean PhiStrip");
184  hitMap[iWedge*3+iSensor]->GetYaxis()->SetTitle("Mean RStrip");
185  }
186  }
187  return ierr;
188 }
189 
191  Int_t ierr = kStOk;
192 
193  //hit data input
194  StEvent* eventPtr = 0;
195  eventPtr = (StEvent*)GetInputDS("StEvent");
196 
197  if( !eventPtr ) {
198  LOG_WARN << "StFstQAMaker::Make : Error getting pointer to StEvent from '" << ClassName() << "'" << endm;
199  ierr = kStWarn;
200  }
201 
202  StFstHitCollection* fstHitCollection = 0;
203  if( eventPtr ) {
204  fstHitCollection = eventPtr->fstHitCollection();
205  }
206 
207  if( !fstHitCollection) {
208  LOG_WARN << "StFstQAMaker::Make : Error getting pointer to StFstHitCollection from '" << ClassName() << "'" << endm;
209  ierr = kStWarn;
210  }
211 
212  //raw hit data input
213  TObjectSet* fstDataSet = (TObjectSet*)GetDataSet("fstRawHitAndCluster");
214  if (!fstDataSet) {
215  LOG_WARN << "StFstQAMaker::Make() - there is no fstDataSet (raw hit) " << endm;
216  ierr = kStWarn;
217  }
218 
219  StFstCollection* fstCollectionPtr = (StFstCollection*)fstDataSet->GetObject();
220  if(!fstCollectionPtr) {
221  LOG_WARN << "StFstQAMaker::Make() - no fstCollection."<<endm;
222  ierr = kStWarn;
223  }
224 
225  //*******Initialization of the raw hit and hit level variables**********
226  fstRawHit.channelId = fstRawHit.geoId = fstRawHit.wedge = fstRawHit.sensor = fstRawHit.phistrip = fstRawHit.rstrip = fstRawHit.maxTimeBin = fstRawHit.rdo = fstRawHit.arm = fstRawHit.apv = fstRawHit.channel = fstRawHit.idTruth = fstRawHit.seedHitFlag = fstRawHit.EventId = -1;
227  for(int iTB=0; iTB<kFstNumTimeBins; iTB++) {
228  fstRawHit.charge[iTB] = 0.;
229  fstRawHit.chargeErr[iTB] = 0.;
230  }
231  fstHit.hitId = fstHit.wedge = fstHit.sensor = fstHit.apv = fstHit.idTruth = fstHit.EventId = fstHit.maxTimeBin = fstHit.clusteringType = fstHit.nRawHits = fstHit.nRawHitsR = fstHit.nRawHitsPhi = fstHit.meanPhiStrip = fstHit.meanRStrip = fstHit.localZ = -1;
232  fstHit.x = fstHit.y = fstHit.z = fstHit.charge = fstHit.chargeErr = 0.;
233 
234  //loop
235  if( !ierr ){
236  StPrimaryVertex *primaryVertex = eventPtr->primaryVertex();
237  if(primaryVertex) {
238  const StThreeVectorF &primXYZ = primaryVertex->position();
239  LOG_DEBUG << "primaryVertex \t" << primXYZ.x() << "\t" << primXYZ.y() << "\t" << primXYZ.z() << endm;
240  }
241  else{
242  LOG_DEBUG << "no primaryVertex found" << endm;
243  }
244 
245  if(mEventCounter%100 == 0)
246  LOG_DEBUG << "event index: " << mEventCounter << endm;
247 
248  if(fstHitCollection->numberOfHits() > 0) {
249  for(int wedgeIdx=0; wedgeIdx<kFstNumWedges; wedgeIdx++ ) {
250  StFstWedgeHitCollection* wedgeHitCollection = fstHitCollection->wedge(wedgeIdx);
251  unsigned char nClusteringType = fstHitCollection->getClusteringType();
252  for(int sensorIdx=0; sensorIdx<kFstNumSensorsPerWedge; sensorIdx++) {
253  StFstSensorHitCollection* sensorHitCollection = wedgeHitCollection->sensor(sensorIdx);
254  int sensorIdxTemp = 0;
255  for(int idx=0; idx<(int)sensorHitCollection->hits().size(); idx++ ){
256  StFstHit* hit = sensorHitCollection->hits()[idx];
257  if(hit) {
258  const StThreeVectorF &P = hit->position();
259 
260  fstHit.hitId = (int)hit->id();
261  fstHit.wedge = (int)hit->getWedge();
262  fstHit.sensor = (int)hit->getSensor();
263  fstHit.maxTimeBin = (int)hit->getMaxTimeBin();
264  fstHit.clusteringType = (int)nClusteringType;
265  fstHit.nRawHits = (int)hit->getNRawHits();
266  fstHit.nRawHitsR = (int)hit->getNRawHitsR();
267  fstHit.nRawHitsPhi = (int)hit->getNRawHitsPhi();
268  fstHit.idTruth = (int)hit->idTruth();
269  fstHit.EventId = (int)eventPtr->id();
270  fstHit.localR = (float)hit->localPosition(0);
271  fstHit.localPhi = (float)hit->localPosition(1);
272  fstHit.localZ = (float)hit->localPosition(2);
273  fstHit.x = (float)P.x();
274  fstHit.y = (float)P.y();
275  fstHit.z = (float)P.z();
276  fstHit.charge = (float)hit->charge();
277  fstHit.chargeErr = (float)hit->getChargeErr();
278  fstHit.apv = (int)hit->getApv();
279  fstHit.meanPhiStrip = (float)hit->getMeanPhiStrip();
280  fstHit.meanRStrip = (float)hit->getMeanRStrip();
281 
282  fstHitTree->Fill();
283 
284  sensorIdxTemp = ((int)hit->getWedge()-1)*kFstNumSensorsPerWedge + (int)hit->getSensor(); // 0-107
285  int diskIdxTemp = ((int)hit->getWedge()-1)/kFstNumWedgePerDisk + 1; // 1-3
286  int wedgeIdxTemp = (int)hit->getWedge() - (diskIdxTemp-1)*kFstNumWedgePerDisk; // 1-12
287  int phiIdxTemp = (wedgeIdxTemp-1)*kFstNumPhiSegPerWedge+(int)(hit->getMeanPhiStrip()+0.5);
288  int rIdxTemp = (int)(hit->getMeanRStrip()+0.5);
289 
290  hitMap[sensorIdxTemp]->Fill((int)(hit->getMeanPhiStrip()+0.5), (int)(hit->getMeanRStrip()+0.5));
291  hitMapOfFST[diskIdxTemp-1]->Fill(phiIdxTemp, rIdxTemp);
292  hitMapOfAPV[diskIdxTemp-1]->Fill(wedgeIdxTemp, (int)hit->getApv()+(wedgeIdxTemp%2-1)*kFstApvsPerWedge);
293  hitGlobalXY[diskIdxTemp-1]->Fill((float)P.x(), (float)P.y());
294  hitGlobalRPhi[diskIdxTemp-1]->Fill((float)P.phi(), (float)P.perp());
295 
296  hitCharge_SensorId->Fill(sensorIdxTemp, (int)hit->charge());
297  hitChargeErr_SensorId->Fill(sensorIdxTemp, (int)(hit->getChargeErr()+0.5));
298  maxTimeBin_SensorId->Fill(sensorIdxTemp, (int)hit->getMaxTimeBin());
299  clusterSize_SensorId->Fill(sensorIdxTemp, (int)hit->getNRawHits());
300  clusterSizeR_SensorId->Fill(sensorIdxTemp, (int)hit->getNRawHitsR());
301  clusterSizePhi_SensorId->Fill(sensorIdxTemp, (int)hit->getNRawHitsPhi());
302  }//hit cut
303  }//end loop over hits
304  numOfHits_SensorId->Fill(sensorIdxTemp, sensorHitCollection->hits().size());
305  sensorHitCollection->hits().clear();
306  }//loop over sensors
307  }//loop over wedges
308  }//end of hits cut
309 
310  if(fstCollectionPtr->getNumRawHits() > 0) {
311  int counter[kFstNumSensors]; //raw hit multiplicity per sensor per event
312  for(int iS=0; iS<kFstNumSensors; iS++)
313  counter[iS] = 0;
314 
315  for(int wedgeIdx=0; wedgeIdx<kFstNumWedges; ++wedgeIdx ){
316  StFstRawHitCollection *rawHitCollectionPtr = fstCollectionPtr->getRawHitCollection( wedgeIdx );
317  if( rawHitCollectionPtr ){
318  std::vector<StFstRawHit*>& rawHitVec = rawHitCollectionPtr->getRawHitVec();
319  std::vector< StFstRawHit* >::iterator rawHitIter;
320 
321  for( rawHitIter = rawHitVec.begin(); rawHitIter != rawHitVec.end(); ++rawHitIter ){
322  StFstRawHit* rawHit = *rawHitIter;
323 
324  unsigned char wedge = rawHit->getWedge();
325  unsigned char sensor = rawHit->getSensor();
326  unsigned char maxTimeBin = rawHit->getMaxTimeBin();
327  int sensorId = (wedge-1)*kFstNumSensorsPerWedge + sensor;
328  counter[sensorId]++;
329 
330  for( unsigned char timeBin = 0; timeBin < kFstNumTimeBins; ++timeBin ) {
331  rawHitCharge_TimeBin[timeBin]->Fill(rawHit->getGeoId(), (int)rawHit->getCharge( timeBin ));
332  fstRawHit.charge[timeBin] = rawHit->getCharge(timeBin);
333  fstRawHit.chargeErr[timeBin] = rawHit->getChargeErr(timeBin);
334  }
335  rawHitChargeErr->Fill(rawHit->getGeoId(), (int)(rawHit->getChargeErr( maxTimeBin )+0.5));
336  rawHitMap[sensorId]->Fill((int)rawHit->getPhiStrip(), (int)rawHit->getRStrip());
337  rawHitMaxTimeBin_APV->Fill(((int)rawHit->getRdo()-1)*48+(int)rawHit->getArm()*16+(int)rawHit->getApv(), (int)maxTimeBin);
338 
339  fstRawHit.channelId = (int)rawHit->getChannelId();
340  fstRawHit.geoId = (int)rawHit->getGeoId();
341  fstRawHit.wedge = (int)rawHit->getWedge();
342  fstRawHit.sensor = (int)rawHit->getSensor();
343  fstRawHit.phistrip = (int)rawHit->getPhiStrip();
344  fstRawHit.rstrip = (int)rawHit->getRStrip();
345  fstRawHit.maxTimeBin = (int)maxTimeBin;
346  fstRawHit.rdo = (int)rawHit->getRdo();
347  fstRawHit.arm = (int)rawHit->getArm();
348  fstRawHit.apv = (int)rawHit->getApv();
349  fstRawHit.channel = (int)rawHit->getChannel();
350  fstRawHit.idTruth = (int)rawHit->getIdTruth();
351  fstRawHit.seedHitFlag = (int)rawHit->getSeedhitflag();
352  fstRawHit.EventId = (int)eventPtr->id();
353 
354  fstRawHitTree->Fill();
355  }//loop over raw hits
356  while (!rawHitVec.empty()) delete rawHitVec.back(), rawHitVec.pop_back();
357  }//end raw hit collection
358  }//loop over wedges
359 
360  for(int iS=0; iS<kFstNumSensors; iS++) {
361  numOfRawHits_SensorId->Fill(iS+1, counter[iS]);
362  numOfRawHits_EventId[iS]->Fill((int)eventPtr->id()/100+1, counter[iS]);
363  }
364  }//end number of raw hits cut
365  }
366 
367  mEventCounter++;
368 
369  return ierr;
370 }
371 
373  Int_t ierr = kStOk;
374 
375  if(mDoTreeOutput)
376  {
377  //create output file
378  StIOMaker *ioMaker = (StIOMaker * )GetMaker("inputStream");
379  if (!ioMaker) {
380  LOG_WARN << "StFstQAMaker::Init(): No StIOMaker" << endm;
381  }
382 
383  TString mRootFilename = TString(ioMaker->GetFile());
384  int found = mRootFilename.Last('/');
385  if(found >= 0){
386  mRootFilename.Replace(0, found + 1, "");
387  }
388  found = mRootFilename.First(".");
389  if(found == 0) found = mRootFilename.Length();
390  mRootFilename.Replace(found, mRootFilename.Length() - found, ".fstQa.root");
391  LOG_INFO << "FST QA File Name: " << mRootFilename << endm;
392 
393  cout << "QA file name: " << mRootFilename << endl;
394  TFile *myRootFile = new TFile(mRootFilename.Data(),"RECREATE");
395  if( !myRootFile ) {
396  LOG_WARN << "Error recreating file '" << mRootFilename << "'" << endl;
397  ierr = kStWarn;
398  }
399 
400  //saving histograms
401  myRootFile->WriteTObject(fstRawHitTree);
402  myRootFile->WriteTObject(fstHitTree);
403 
404  myRootFile->WriteTObject(numOfRawHits_SensorId);
405  myRootFile->WriteTObject(numOfHits_SensorId);
406  for(int iTimeBin=0; iTimeBin<kFstNumTimeBins; iTimeBin++)
407  myRootFile->WriteTObject(rawHitCharge_TimeBin[iTimeBin]);
408  myRootFile->WriteTObject(rawHitChargeErr);
409  myRootFile->WriteTObject(hitCharge_SensorId);
410  myRootFile->WriteTObject(hitChargeErr_SensorId);
411  myRootFile->WriteTObject(rawHitMaxTimeBin_APV);
412  myRootFile->WriteTObject(maxTimeBin_SensorId);
413  myRootFile->WriteTObject(clusterSize_SensorId);
414  myRootFile->WriteTObject(clusterSizeR_SensorId);
415  myRootFile->WriteTObject(clusterSizePhi_SensorId);
416  for(int iWedge=0; iWedge<kFstNumWedges; iWedge++) {
417  for(int iSensor=0; iSensor<kFstNumSensorsPerWedge; iSensor++) {
418  myRootFile->WriteTObject(rawHitMap[iWedge*3+iSensor]);
419  myRootFile->WriteTObject(hitMap[iWedge*3+iSensor]);
420  myRootFile->WriteTObject(numOfRawHits_EventId[iWedge*3+iSensor]);
421  }
422  }
423  for(int iDisk = 0; iDisk < kFstNumDisk; iDisk++)
424  {
425  myRootFile->WriteTObject(hitMapOfFST[iDisk]);
426  myRootFile->WriteTObject(hitMapOfAPV[iDisk]);
427  myRootFile->WriteTObject(hitGlobalXY[iDisk]);
428  myRootFile->WriteTObject(hitGlobalRPhi[iDisk]);
429  }
430 
431  myRootFile->Close();
432  }
433 
434  return ierr;
435 }
436 
437 ClassImp( StFstQAMaker );
unsigned char getChannel() const
0-127
unsigned char getArm() const
0-2
Definition: StFstRawHit.cxx:84
unsigned char getSensor() const
0-2
Definition: StFstRawHit.cxx:94
unsigned char getRStrip() const
0-7
Definition: StFstRawHit.cxx:73
unsigned char getPhiStrip() const
0-127
Definition: StFstRawHit.cxx:67
int getGeoId() const
0-36863
Definition: StFstRawHit.cxx:51
unsigned char getApv() const
0-15
Definition: StFstRawHit.cxx:89
unsigned short getIdTruth() const
for embedding, 0 as background
Definition: StFstRawHit.cxx:55
int getChannelId() const
0-36863
Definition: StFstRawHit.cxx:50
Definition: Stypes.h:42
unsigned char getRdo() const
1-6
Definition: StFstRawHit.cxx:79
int getSeedhitflag() const
0 or 1
Definition: StFstRawHit.cxx:52
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:56
Definition: Stypes.h:41
unsigned char getWedge() const
1-36
Definition: StFstRawHit.cxx:62