66 fNofStation = fSetup -> GetNofStations();
67 fHM =
new CbmHistManager();
68 fnOfDigisChip.resize(fNofStation);
69 for (Int_t iStation = 0; iStation < fNofStation; iStation ++){
71 fnOfDigisChip[iStation].resize(stat -> GetNofDaughters());
72 for (Int_t iLad = 0; iLad < stat -> GetNofDaughters(); iLad++) {
74 fnOfDigisChip[iStation][iLad].resize(ladd -> GetNofDaughters());
75 for (Int_t iHla = 0; iHla < ladd -> GetNofDaughters(); iHla++) {
77 fnOfDigisChip[iStation][iLad][iHla].resize(hlad -> GetNofDaughters());
78 for (Int_t iMod = 0; iMod < hlad -> GetNofDaughters(); iMod++) {
80 Int_t nOfChips = Int_t(modu -> GetNofChannels() / 128.);
81 fnOfDigisChip[iStation][iLad][iHla][iMod].resize(nOfChips);
82 for (Int_t iChip = 0; iChip < nOfChips; iChip++){
83 fnOfDigisChip[iStation][iLad][iHla][iMod][iChip] = 0;
102 Int_t nofEvents = fHM -> H1(
"h_EventNo_DigitizeQa") -> GetEntries();
103 TString fileName = fOutputDir +
"/digiRateChip";
104 fileName += nofEvents;
106 TString rmFile =
"rm " + fileName;
107 gSystem ->
Exec(rmFile);
108 fOutFile.open(Form(
"%s",fileName.Data()), std::ofstream::app);
109 for (Int_t iStation = 0; iStation < fNofStation; iStation ++){
111 for (Int_t iLad = 0; iLad < stat -> GetNofDaughters(); iLad++) {
113 for (Int_t iHla = 0; iHla < ladd -> GetNofDaughters(); iHla++) {
115 for (Int_t iMod = 0; iMod < hlad -> GetNofDaughters(); iMod++) {
117 if(modu -> GetNofChannels() != 2048) cout <<
"nofChannels = " << modu -> GetNofChannels() << endl;
118 Int_t nOfChips = Int_t(modu -> GetNofChannels() / 128.);
119 for (Int_t iChip = 0; iChip < nOfChips; iChip++)
120 fOutFile << iStation <<
"\t" << iLad <<
"\t" << iHla <<
"\t" << iMod <<
"\t" << iChip
121 <<
"\t" << fnOfDigisChip[iStation][iLad][iHla][iMod][iChip] << endl;
126 gDirectory -> mkdir(
"STSDigitizeQA");
127 gDirectory -> cd(
"STSDigitizeQA");
128 fHM -> WriteToFile();
129 gDirectory -> cd(
"../");
131 report -> Create(fHM, fOutputDir);
187 Double_t maxX = minX + nofBins;
188 fHM -> Create1<TH1F>(
"h_PointsInDigi",
"PointsInDigi;Number of Points;Entries", nofBins, minX, maxX);
189 fHM -> Create1<TH1F>(
"h_PointsInDigiLog",
"PointsInDigi;Number of Points;Entries", nofBins, minX, maxX);
190 fHM -> Create1<TH1F>(
"h_DigisByPoint",
"DigisByPoint;Number of Digis;Entries" , nofBins, minX, maxX);
191 fHM -> Create1<TH1F>(
"h_DigisByPointLog",
"DigisByPoint;Number of Digis;Entries" , nofBins, minX, maxX);
192 nofBins = fDigiPar->GetNofAdc();
193 fHM -> Create1<TH1F>(
"h_DigiCharge",
"DigiCharge;Digi Charge, ADC;Entries", nofBins, 0., Double_t(nofBins));
194 for (Int_t stationId = 0; stationId < fNofStation; stationId++){
195 fHM -> Create2<TH2F>(Form(
"h_DigisPerChip_Station%i",stationId),
196 Form(
"Digis per Chip, Station %i;x, cm;y, cm", stationId), 400, -50, 50, 200, -50, 50);
197 fHM -> Create2<TH2F>(Form(
"h_PointsMap_Station%i",stationId),
198 Form(
"Points Map, Station %i;x, cm;y, cm", stationId), 100, -50, 50, 100, -50, 50);
199 fHM -> Create2<TH2F>(Form(
"h_MeanAngleMap_Station%i",stationId),
200 Form(
"Mean Angle Map, Station %i;x, cm;y, cm", stationId), 50, -50, 50, 50, -50, 50);
201 fHM -> Create2<TH2F>(Form(
"h_RMSAngleMap_Station%i",stationId),
202 Form(
"RMS Angle Map, Station %i;x, cm;y, cm", stationId), 50, -50, 50, 50, -50, 50);
204 Double_t local[3] = {0.,0.,0.};
206 for (Int_t moduId = 0; moduId < fSetup ->
GetNofModules(); moduId++){
210 TGeoMatrix * matrix = node -> GetMatrix();
211 matrix -> LocalToMaster(local, global);
213 fHM -> Create1<TH1F>(Form(
"h_ParticleAngles_%s", modu -> GetName()),
214 Form(
"Particle Angles (%.0f cm, %.0f cm);Angle, deg;Entries", global[0], global[1]), 90, 0., 90.);
219 if ( NULL != digis && fHM -> Exists(
"h_NofObjects_Digis") ) fHM -> H1(
"h_NofObjects_Digis") -> Fill(digis -> GetEntriesFast());
220 std::set<Double_t> pointIndexes;
221 std::map<Double_t, Int_t> stations;
222 std::map<Double_t, Int_t> digisByPoint;
223 std::map<Double_t, Int_t>::iterator map_it;
224 pointIndexes.clear();
225 Double_t local[3] = {0.,0.,0.};
227 for(Int_t iDigi = 0; iDigi < digis -> GetEntriesFast(); iDigi++) {
229 const CbmMatch* digiMatch =
static_cast<const CbmMatch*
>(stsDigi -> GetMatch());
230 Int_t stationId = fSetup->GetStationNumber(stsDigi->GetAddress());
235 Int_t nOfChannelsM = modu -> GetNofChannels();
238 TGeoMatrix * matrix = node -> GetMatrix();
239 matrix -> LocalToMaster(local, global);
242 Int_t iChan = stsDigi->GetChannel();
243 Int_t iChip = iChan / 128 ;
244 fnOfDigisChip[stationId][iLad][iHla][iMod][iChip]++;
245 fHM -> H2(Form(
"h_DigisPerChip_Station%i",stationId)) -> Fill(global[0] + 50. / 400. * ((iChip-8.) * 2. - 1.), global[1]);
247 for(Int_t iLink = 0; iLink < digiMatch -> GetNofLinks(); iLink++) {
248 const CbmLink link = digiMatch -> GetLink(iLink);
249 Double_t index = (1000 * link.GetIndex()) + (link.GetFile()) + (0.0001 * link.GetEntry());
250 pointIndexes.insert(index);
251 stations.insert(std::pair<Double_t, Int_t>(index, stationId));
252 Int_t channel = stsDigi -> GetChannel();
254 Int_t side = channel < Int_t(nOfChannelsM / 2.) ? 0 : 1;
255 map_it = digisByPoint.find(index + (side * 0.00001));
256 if ( map_it != digisByPoint.end() ) {
259 digisByPoint.insert(std::pair<Double_t, Int_t>(index + (side * 0.00001), 1));
262 fHM -> H1(
"h_NofObjects_Digis_Station") -> Fill(stationId);
263 fHM -> H1(
"h_PointsInDigi") -> Fill(digiMatch -> GetNofLinks());
264 fHM -> H1(
"h_PointsInDigiLog") -> Fill(digiMatch -> GetNofLinks());
265 fHM -> H1(
"h_DigiCharge") -> Fill(stsDigi -> GetCharge());
267 fHM -> H1(
"h_NofObjects_Points") -> Fill(pointIndexes.size());
268 std::set<Double_t>::iterator set_it;
269 for(set_it = pointIndexes.begin(); set_it != pointIndexes.end(); ++set_it) {
270 fHM -> H1(
"h_NofObjects_Points_Station") -> Fill(stations[*set_it]);
271 fHM -> H1(
"h_DigisByPoint") -> Fill(digisByPoint[*set_it]);
272 fHM -> H1(
"h_DigisByPoint") -> Fill(digisByPoint[*set_it + 0.00001]);
273 fHM -> H1(
"h_DigisByPointLog") -> Fill(digisByPoint[*set_it]);
274 fHM -> H1(
"h_DigisByPointLog") -> Fill(digisByPoint[*set_it + 0.00001]);
276 if ( pointIndexes.size() >
static_cast<size_t>(fMaxScale) ) fMaxScale = pointIndexes.size();
278 Double_t pointX, pointY;
279 Double_t pointPX, pointPZ;
280 for (Int_t iPoint = 0; iPoint < points -> GetEntriesFast(); iPoint ++){
281 const FairMCPoint * stsPoint =
static_cast<const FairMCPoint*
>(points -> At(iPoint));
285 TGeoMatrix * matrix = node -> GetMatrix();
286 matrix -> LocalToMaster(local, global);
288 pointX = stsPoint -> GetX();
289 pointY = stsPoint -> GetY();
291 pointPX = stsPoint -> GetPx();
292 pointPZ = stsPoint -> GetPz();
293 Int_t stationId = fSetup->GetStationNumber(stsPoint->GetDetectorID());
294 fHM -> H2(Form(
"h_PointsMap_Station%i", stationId)) -> Fill(pointX, pointY);
295 fHM -> H1(Form(
"h_ParticleAngles_%s", modu -> GetName())) -> Fill(TMath::Abs(TMath::ATan(pointPX / pointPZ)) * 180. / 3.1416);
301 Double_t local[3] = {0.,0.,0.};
303 for (Int_t iStation = 0; iStation < fNofStation; iStation++){
305 for (Int_t iLad = 0; iLad < stat -> GetNofDaughters(); iLad++) {
307 for (Int_t iHla = 0; iHla < ladd -> GetNofDaughters(); iHla++) {
309 for (Int_t iMod = 0; iMod < hlad -> GetNofDaughters(); iMod++) {
311 Double_t mean = fHM -> H1(Form(
"h_ParticleAngles_%s",modu -> GetName())) -> GetMean();
312 Double_t rms = fHM -> H1(Form(
"h_ParticleAngles_%s",modu -> GetName())) -> GetRMS();
315 TGeoMatrix * matrix = node -> GetMatrix();
316 matrix -> LocalToMaster(local, global);
318 fHM -> H2(Form(
"h_MeanAngleMap_Station%i", iStation)) -> Fill(global[0],global[1],mean);
319 fHM -> H2(Form(
"h_RMSAngleMap_Station%i", iStation)) -> Fill(global[0],global[1],rms);